Skip to content

Commit 1f3db58

Browse files
authored
chore: Use tsdown to build packages (#2006)
1 parent 43f6c06 commit 1f3db58

29 files changed

+669
-284
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"prettier": "^3.7.4",
3838
"semver": "^7.7.3",
3939
"simple-git-hooks": "^2.13.1",
40+
"tsdown": "^0.18.1",
4041
"tsx": "4.21.0",
4142
"typedoc": "^0.25.4",
4243
"typedoc-plugin-frontmatter": "^1.3.1",

packages/analytics/build.config.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/analytics/modules/analytics/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export default defineWxtModule({
2222
// Paths
2323
const wxtAnalyticsFolder = resolve(wxt.config.wxtDir, 'analytics');
2424
const wxtAnalyticsIndex = resolve(wxtAnalyticsFolder, 'index.ts');
25-
const clientModuleId = import.meta.env.NPM
25+
const clientModuleId = process.env.NPM
2626
? '@wxt-dev/analytics'
2727
: resolve(wxt.config.modulesDir, 'analytics/client');
28-
const pluginModuleId = import.meta.env.NPM
28+
const pluginModuleId = process.env.NPM
2929
? '@wxt-dev/analytics/background-plugin'
3030
: resolve(wxt.config.modulesDir, 'analytics/background-plugin');
3131

@@ -40,7 +40,7 @@ export default defineWxtModule({
4040
// Generate #analytics module
4141
const wxtAnalyticsCode = [
4242
`import { createAnalytics } from '${
43-
import.meta.env.NPM
43+
process.env.NPM
4444
? clientModuleId
4545
: relative(wxtAnalyticsFolder, clientModuleId)
4646
}';`,

packages/analytics/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
}
3636
},
3737
"module": "./dist/index.mjs",
38-
"types": "./dist/index.d.ts",
38+
"types": "./dist/index.d.mts",
3939
"files": [
4040
"dist"
4141
],
4242
"scripts": {
4343
"dev": "buildc --deps-only -- wxt",
4444
"dev:build": "buildc --deps-only -- wxt build",
4545
"check": "pnpm build && check",
46-
"build": "buildc -- unbuild",
46+
"build": "buildc -- tsdown",
4747
"prepack": "pnpm -s build",
4848
"prepare": "buildc --deps-only -- wxt prepare"
4949
},
@@ -55,7 +55,6 @@
5555
"@types/ua-parser-js": "^0.7.39",
5656
"publint": "^0.3.16",
5757
"typescript": "^5.9.3",
58-
"unbuild": "^3.6.1",
5958
"wxt": "workspace:*"
6059
},
6160
"dependencies": {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineConfig } from 'tsdown';
2+
3+
export default defineConfig({
4+
entry: {
5+
index: './modules/analytics/client.ts',
6+
module: './modules/analytics/index.ts',
7+
'background-plugin': './modules/analytics/background-plugin.ts',
8+
types: './modules/analytics/types.ts',
9+
'providers/google-analytics-4':
10+
'./modules/analytics/providers/google-analytics-4.ts',
11+
'providers/umami': './modules/analytics/providers/umami.ts',
12+
},
13+
external: ['#analytics'],
14+
define: {
15+
'process.env.NPM': 'true',
16+
},
17+
});

packages/auto-icons/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"version": "1.1.0",
2828
"type": "module",
2929
"module": "./dist/index.mjs",
30-
"types": "./dist/index.d.ts",
30+
"types": "./dist/index.d.mts",
3131
"exports": {
3232
".": {
3333
"types": "./dist/index.d.mts",
@@ -38,7 +38,7 @@
3838
"dist"
3939
],
4040
"scripts": {
41-
"build": "buildc -- unbuild",
41+
"build": "buildc -- tsdown",
4242
"check": "pnpm build && check"
4343
},
4444
"peerDependencies": {

packages/i18n/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"license": "MIT",
2222
"funding": "https://github.com/sponsors/wxt-dev",
2323
"scripts": {
24-
"build": "buildc -- unbuild",
24+
"build": "buildc -- tsdown",
2525
"check": "buildc --deps-only -- check",
2626
"test": "buildc --deps-only -- vitest"
2727
},
@@ -45,14 +45,13 @@
4545
"oxlint": "^1.33.0",
4646
"publint": "^0.3.16",
4747
"typescript": "^5.9.3",
48-
"unbuild": "^3.6.1",
4948
"vitest": "^4.0.16",
5049
"vitest-plugin-random-seed": "^1.1.2",
5150
"wxt": "workspace:*"
5251
},
5352
"main": "./dist/index.cjs",
5453
"module": "./dist/index.mjs",
55-
"types": "./dist/index.d.ts",
54+
"types": "./dist/index.d.mts",
5655
"exports": {
5756
".": {
5857
"import": {

packages/i18n/tsdown.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from 'tsdown';
2+
3+
const entry = ['src/index.ts', 'src/build.ts', 'src/module.ts'];
4+
5+
export default defineConfig([
6+
{
7+
entry,
8+
},
9+
{
10+
entry,
11+
format: 'cjs',
12+
},
13+
]);

packages/module-react/build.config.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/module-react/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"type": "module",
2323
"main": "./dist/index.cjs",
2424
"module": "./dist/index.mjs",
25-
"types": "./dist/index.d.ts",
25+
"types": "./dist/index.d.mts",
2626
"exports": {
2727
".": {
2828
"import": {
@@ -41,7 +41,7 @@
4141
"scripts": {
4242
"dev": "wxt",
4343
"check": "pnpm build && check",
44-
"build": "buildc -- unbuild",
44+
"build": "buildc -- tsdown",
4545
"prepare": "buildc --deps-only -- wxt prepare"
4646
},
4747
"peerDependencies": {
@@ -58,7 +58,6 @@
5858
"react": "^19.2.3",
5959
"react-dom": "^19.2.3",
6060
"typescript": "^5.9.3",
61-
"unbuild": "^3.6.1",
6261
"wxt": "workspace:*"
6362
}
6463
}

0 commit comments

Comments
 (0)