Skip to content

Commit

Permalink
chore: init astro
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Feb 27, 2024
1 parent 3418579 commit 893a7e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/unplugin-analytics/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineBuildConfig({
'src/index.ts',
'src/vite.ts',
'src/nuxt.ts',
'src/astro.ts',
{ input: 'src/nuxt/runtime/', outDir: `dist/runtime`, ext: 'mjs' }
],
declaration: true,
Expand Down
7 changes: 6 additions & 1 deletion packages/unplugin-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
"import": "./dist/vite.mjs",
"require": "./dist/vite.cjs"
},
"./astro": {
"types": "./dist/astro.d.ts",
"import": "./dist/astro.mjs",
"require": "./dist/astro.cjs"
},
"./nuxt": {
"types": "./dist/nuxt.d.ts",
"import": "./dist/nuxt.mjs",
Expand Down Expand Up @@ -91,4 +96,4 @@
"engines": {
"node": ">=v20.10.0"
}
}
}
11 changes: 11 additions & 0 deletions packages/unplugin-analytics/src/astro.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Options } from './plugin';

export default (options: Options | undefined) => ({
name: 'unplugin-analytics',
hooks: {
'astro:config:setup': async (astro: any) => {
astro.config.vite.plugins ||= [];
astro.config.vite.plugins.push({});
}
}
});

0 comments on commit 893a7e7

Please sign in to comment.