Skip to content

Commit e71ec56

Browse files
committed
use tsdown
1 parent 5d3543b commit e71ec56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2448
-313
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"bumpp": "^10.2.0",
2323
"eslint": "^9.30.1",
2424
"prettier": "^3.6.2",
25+
"tsdown": "^0.12.9",
2526
"typescript": "^5.8.3",
26-
"unbuild": "^3.5.0",
2727
"vite": "^7.0.4",
2828
"vite-tsconfig-paths": "^5.1.4",
2929
"vitest": "^3.2.4",

packages/common/build.config.ts

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

packages/common/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@vue.ts/common",
33
"version": "0.6.0",
44
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5+
"type": "module",
56
"description": "",
67
"keywords": [],
78
"homepage": "https://github.com/so1ve/vue.ts/tree/main/packages/common#readme",
@@ -16,23 +17,21 @@
1617
"license": "MIT",
1718
"sideEffects": false,
1819
"exports": {
19-
".": {
20-
"require": "./dist/index.cjs",
21-
"import": "./dist/index.mjs"
22-
}
20+
".": "./dist/index.js"
2321
},
2422
"main": "dist/index.cjs",
2523
"module": "dist/index.mjs",
24+
"types": "dist/index.d.ts",
2625
"files": [
2726
"dist"
2827
],
2928
"publishConfig": {
3029
"access": "public"
3130
},
3231
"scripts": {
33-
"build": "unbuild",
32+
"build": "tsdown",
3433
"prepublishOnly": "nr build",
35-
"stub": "unbuild --stub"
34+
"watch": "tsdown --tsdown"
3635
},
3736
"dependencies": {
3837
"@rollup/pluginutils": "^5.2.0"

packages/common/tsdown.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from "tsdown";
2+
3+
import base from "../../tsdown.config.ts";
4+
5+
export default defineConfig({
6+
...base,
7+
entry: ["src/*.ts"],
8+
});

packages/complex-types/build.config.ts

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

packages/complex-types/package.json

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
"name": "@vue.ts/complex-types",
33
"version": "0.6.0",
44
"author": "Ray <i@mk1.io> (@so1ve)",
5+
"type": "module",
56
"description": "Resolve complex types in Vue SFCs.",
67
"keywords": [
78
"astro",
9+
"farm",
810
"nuxt",
11+
"rolldown",
912
"rollup",
1013
"rspack",
1114
"transform",
@@ -27,46 +30,22 @@
2730
"license": "MIT",
2831
"sideEffects": false,
2932
"exports": {
30-
".": {
31-
"require": "./dist/index.cjs",
32-
"import": "./dist/index.mjs"
33-
},
33+
".": "./dist/index.js",
3434
"./*": "./*",
35-
"./astro": {
36-
"require": "./dist/astro.cjs",
37-
"import": "./dist/astro.mjs"
38-
},
39-
"./esbuild": {
40-
"require": "./dist/esbuild.cjs",
41-
"import": "./dist/esbuild.mjs"
42-
},
43-
"./nuxt": {
44-
"require": "./dist/nuxt.cjs",
45-
"import": "./dist/nuxt.mjs"
46-
},
47-
"./rollup": {
48-
"require": "./dist/rollup.cjs",
49-
"import": "./dist/rollup.mjs"
50-
},
51-
"./rspack": {
52-
"require": "./dist/rspack.cjs",
53-
"import": "./dist/rspack.mjs"
54-
},
55-
"./types": {
56-
"require": "./dist/types.cjs",
57-
"import": "./dist/types.mjs"
58-
},
59-
"./vite": {
60-
"require": "./dist/vite.cjs",
61-
"import": "./dist/vite.mjs"
62-
},
63-
"./webpack": {
64-
"require": "./dist/webpack.cjs",
65-
"import": "./dist/webpack.mjs"
66-
}
35+
"./astro": "./dist/astro.js",
36+
"./esbuild": "./dist/esbuild.js",
37+
"./farm": "./dist/farm.js",
38+
"./nuxt": "./dist/nuxt.js",
39+
"./rolldown": "./dist/rolldown.js",
40+
"./rollup": "./dist/rollup.js",
41+
"./rspack": "./dist/rspack.js",
42+
"./types": "./dist/types.js",
43+
"./vite": "./dist/vite.js",
44+
"./webpack": "./dist/webpack.js"
6745
},
68-
"main": "./dist/index.cjs",
69-
"module": "./dist/index.mjs",
46+
"main": "./dist/index.js",
47+
"module": "./dist/index.js",
48+
"types": "dist/index.d.ts",
7049
"typesVersions": {
7150
"*": {
7251
"*": [
@@ -82,9 +61,9 @@
8261
"access": "public"
8362
},
8463
"scripts": {
85-
"build": "unbuild",
64+
"build": "tsdown",
8665
"prepublishOnly": "nr build",
87-
"stub": "unbuild --stub"
66+
"watch": "tsdown --watch"
8867
},
8968
"dependencies": {
9069
"@nuxt/kit": "^3.17.6",
@@ -96,13 +75,47 @@
9675
"devDependencies": {
9776
"@nuxt/schema": "^3.17.6",
9877
"@vue-macros/better-define": "^1.11.4",
78+
"rolldown": "1.0.0-beta.27",
9979
"rollup": "^4.44.2",
100-
"unbuild": "^3.5.0",
10180
"vite": "^7.0.4",
10281
"webpack": "^5.100.1"
10382
},
10483
"peerDependencies": {
84+
"@farmfe/core": ">=1",
85+
"@nuxt/kit": "^3 || ^4",
86+
"@nuxt/schema": "^3 || ^4",
87+
"esbuild": "*",
88+
"rolldown": "*",
89+
"rollup": "^3",
10590
"typescript": "^5.2.2",
106-
"vue": "^3.3.7"
91+
"vite": ">=3",
92+
"vue": "^3.3.7",
93+
"webpack": "^4 || ^5"
94+
},
95+
"peerDependenciesMeta": {
96+
"@farmfe/core": {
97+
"optional": true
98+
},
99+
"@nuxt/kit": {
100+
"optional": true
101+
},
102+
"@nuxt/schema": {
103+
"optional": true
104+
},
105+
"esbuild": {
106+
"optional": true
107+
},
108+
"rolldown": {
109+
"optional": true
110+
},
111+
"rollup": {
112+
"optional": true
113+
},
114+
"vite": {
115+
"optional": true
116+
},
117+
"webpack": {
118+
"optional": true
119+
}
107120
}
108121
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import type { Options } from "./types";
2-
import unplugin from ".";
1+
import { createVitePlugin } from "unplugin";
2+
3+
import type { Options } from "./core/types";
4+
import { unpluginFactory } from ".";
35

46
export default (options: Options) => ({
57
name: "@vue.ts/complex-types",
68
hooks: {
79
"astro:config:setup": async (astro: any) => {
810
astro.config.vite.plugins ??= [];
9-
astro.config.vite.plugins.push(unplugin.vite(options));
11+
astro.config.vite.plugins.push(
12+
createVitePlugin(unpluginFactory)(options),
13+
);
1014
},
1115
},
1216
});
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
import unplugin from "./core";
1+
import { createEsbuildPlugin } from "unplugin";
22

3-
export default unplugin.esbuild;
3+
import { unpluginFactory } from ".";
4+
5+
export default createEsbuildPlugin(unpluginFactory);

packages/complex-types/src/farm.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createFarmPlugin } from "unplugin";
2+
3+
import { unpluginFactory } from ".";
4+
5+
export default createFarmPlugin(unpluginFactory);
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
export { default } from "./core";
1+
import { createFilter } from "@vue.ts/common";
2+
import { ensureLanguage } from "@vue.ts/language";
3+
import type { UnpluginFactory } from "unplugin";
4+
import { createUnplugin } from "unplugin";
5+
6+
import { transform } from "./core/transform";
7+
import type { Options } from "./core/types";
8+
import { resolveOptions } from "./core/utils";
9+
10+
export const unpluginFactory: UnpluginFactory<Options | undefined> = (
11+
options = {},
12+
) => ({
13+
name: "@vue.ts/complex-types",
14+
buildStart() {
15+
const resolvedOptions = resolveOptions(options);
16+
ensureLanguage(resolvedOptions.tsconfigPath);
17+
},
18+
transform(code, id) {
19+
const resolvedOptions = resolveOptions(options);
20+
const filter = createFilter(
21+
resolvedOptions.include,
22+
resolvedOptions.exclude,
23+
);
24+
25+
if (!filter(id)) {
26+
return;
27+
}
28+
29+
return transform(code, id, resolvedOptions);
30+
},
31+
});
32+
33+
export const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);
34+
35+
export default unplugin;

0 commit comments

Comments
 (0)