@vue.ts/tsx-auto-props 1.0.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +2 -2
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/farm.d.ts +1 -1
- package/dist/farm.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +3 -3
- package/dist/rolldown.d.ts +1 -1
- package/dist/rolldown.js +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{src-CWmlC_RH.js → src-XYcT5WT-.js} +13 -12
- package/dist/{types-BsMRL-YJ.d.ts → types-oYPns0rA.d.ts} +3 -3
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -0
- package/dist/{vite-CO8uPslf.js → vite-DshAWIJo.js} +2 -2
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/dist/{webpack-Bs4ZyN2r.js → webpack-mSQWlstX.js} +2 -2
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +17 -17
package/dist/astro.d.ts
CHANGED
package/dist/astro.js
CHANGED
package/dist/esbuild.d.ts
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/farm.d.ts
CHANGED
package/dist/farm.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/nuxt.d.ts
CHANGED
package/dist/nuxt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import { vite_default } from "./vite-
|
|
3
|
-
import { webpack_default } from "./webpack-
|
|
1
|
+
import "./src-XYcT5WT-.js";
|
|
2
|
+
import { t as vite_default } from "./vite-DshAWIJo.js";
|
|
3
|
+
import { t as webpack_default } from "./webpack-mSQWlstX.js";
|
|
4
4
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
5
5
|
|
|
6
6
|
//#region src/nuxt.ts
|
package/dist/rolldown.d.ts
CHANGED
package/dist/rolldown.js
CHANGED
package/dist/rollup.d.ts
CHANGED
package/dist/rollup.js
CHANGED
package/dist/rspack.d.ts
CHANGED
package/dist/rspack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createUnplugin } from "unplugin";
|
|
2
|
-
import { createFilter, normalizePath } from "@vue.ts/common";
|
|
3
2
|
import { ensureLanguage, getLanguage } from "@vue.ts/language";
|
|
3
|
+
import { normalizePath } from "@vue.ts/shared";
|
|
4
4
|
import MagicString from "magic-string";
|
|
5
5
|
import ts from "typescript";
|
|
6
6
|
import { join } from "node:path";
|
|
@@ -39,14 +39,13 @@ function transform(code, id) {
|
|
|
39
39
|
const s = new MagicString(code);
|
|
40
40
|
const normalizedFilepath = normalizePath(id);
|
|
41
41
|
const language = getLanguage();
|
|
42
|
-
const
|
|
42
|
+
const checker = language.tsLs.getProgram().getTypeChecker();
|
|
43
43
|
const ast = language.getVirtualFileOrTsAst(normalizedFilepath);
|
|
44
44
|
if (!ast) return;
|
|
45
45
|
language.traverseAst(ast, (node) => {
|
|
46
46
|
if (!ts.isCallExpression(node)) return;
|
|
47
47
|
const identifier = node.expression;
|
|
48
|
-
|
|
49
|
-
if (symbol?.declarations?.some((d) => ts.isImportSpecifier(d) && (d.propertyName ?? d.name)?.text === DEFINE_COMPONENT)) {
|
|
48
|
+
if (checker.getSymbolAtLocation(identifier)?.declarations?.some((d) => ts.isImportSpecifier(d) && (d.propertyName ?? d.name)?.text === DEFINE_COMPONENT)) {
|
|
50
49
|
const arg = node.arguments[0];
|
|
51
50
|
let setupFn;
|
|
52
51
|
if (ts.isObjectLiteralExpression(arg)) {
|
|
@@ -60,7 +59,7 @@ function transform(code, id) {
|
|
|
60
59
|
else throw new Error("[@vue.ts/tsx-auto-props] Invalid defineComponent argument");
|
|
61
60
|
const props = setupFn?.parameters[0];
|
|
62
61
|
if (props) {
|
|
63
|
-
const propsList =
|
|
62
|
+
const propsList = checker.getTypeAtLocation(props).getProperties().map((p) => p.name);
|
|
64
63
|
const { variableList, variable } = getNodeAssignNode(node);
|
|
65
64
|
if (propsList.length > 0 && variableList && variable) s.appendRight(variableList.getEnd() + 1, generateDefineProps(variable.name.getText(ast), propsList));
|
|
66
65
|
}
|
|
@@ -76,16 +75,18 @@ function transform(code, id) {
|
|
|
76
75
|
//#region src/index.ts
|
|
77
76
|
const unpluginFactory = (options = {}) => {
|
|
78
77
|
const resolvedOptions = resolveOptions(options);
|
|
79
|
-
const filter = createFilter(resolvedOptions.include, resolvedOptions.exclude);
|
|
80
78
|
return {
|
|
81
79
|
name: "@vue.ts/tsx-auto-props",
|
|
80
|
+
enforce: "pre",
|
|
82
81
|
buildStart() {
|
|
83
|
-
|
|
84
|
-
ensureLanguage(resolvedOptions$1.tsconfigPath);
|
|
82
|
+
ensureLanguage(resolveOptions(options).tsconfigPath);
|
|
85
83
|
},
|
|
86
|
-
transform
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
transform: {
|
|
85
|
+
filter: { id: {
|
|
86
|
+
include: resolvedOptions.include,
|
|
87
|
+
exclude: resolvedOptions.exclude
|
|
88
|
+
} },
|
|
89
|
+
handler: transform
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
92
|
};
|
|
@@ -93,4 +94,4 @@ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
|
93
94
|
var src_default = unplugin;
|
|
94
95
|
|
|
95
96
|
//#endregion
|
|
96
|
-
export {
|
|
97
|
+
export { unplugin as n, unpluginFactory as r, src_default as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FilterPattern } from "
|
|
1
|
+
import { FilterPattern } from "unplugin";
|
|
2
2
|
|
|
3
|
-
//#region ../
|
|
3
|
+
//#region ../shared/src/types.d.ts
|
|
4
4
|
interface BaseOptions {
|
|
5
5
|
include?: FilterPattern;
|
|
6
6
|
exclude?: FilterPattern;
|
|
@@ -12,4 +12,4 @@ interface Options extends BaseOptions {
|
|
|
12
12
|
}
|
|
13
13
|
type ResolvedOptions = Required<Options>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export {
|
|
15
|
+
export { ResolvedOptions as n, Options as t };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as ResolvedOptions, t as Options } from "./types-oYPns0rA.js";
|
|
2
2
|
export { Options, ResolvedOptions };
|
package/dist/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { r as unpluginFactory } from "./src-XYcT5WT-.js";
|
|
2
2
|
import { createVitePlugin } from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.ts
|
|
5
5
|
var vite_default = createVitePlugin(unpluginFactory);
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
|
-
export { vite_default };
|
|
8
|
+
export { vite_default as t };
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { r as unpluginFactory } from "./src-XYcT5WT-.js";
|
|
2
2
|
import { createWebpackPlugin } from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/webpack.ts
|
|
5
5
|
var webpack_default = createWebpackPlugin(unpluginFactory);
|
|
6
6
|
|
|
7
7
|
//#endregion
|
|
8
|
-
export { webpack_default };
|
|
8
|
+
export { webpack_default as t };
|
package/dist/webpack.d.ts
CHANGED
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue.ts/tsx-auto-props",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"author": "Ray <i@mk1.io> (@so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Automatically add props definition for Vue 3 TSX.",
|
|
@@ -62,28 +62,28 @@
|
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@nuxt/kit": "^
|
|
66
|
-
"magic-string": "^0.30.
|
|
67
|
-
"unplugin": "
|
|
68
|
-
"@vue.ts/
|
|
69
|
-
"@vue.ts/
|
|
65
|
+
"@nuxt/kit": "^4.2.0",
|
|
66
|
+
"magic-string": "^0.30.21",
|
|
67
|
+
"unplugin": "2.3.10",
|
|
68
|
+
"@vue.ts/language": "1.0.0-beta.10",
|
|
69
|
+
"@vue.ts/shared": "1.0.0-beta.10"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@nuxt/schema": "^
|
|
73
|
-
"rolldown": "1.0.0-beta.
|
|
74
|
-
"rollup": "^4.
|
|
75
|
-
"vite": "
|
|
76
|
-
"webpack": "^5.
|
|
72
|
+
"@nuxt/schema": "^4.2.0",
|
|
73
|
+
"rolldown": "1.0.0-beta.45",
|
|
74
|
+
"rollup": "^4.52.5",
|
|
75
|
+
"vite": "7.1.12",
|
|
76
|
+
"webpack": "^5.102.1"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@farmfe/core": ">=1",
|
|
80
|
-
"@nuxt/kit": "^
|
|
81
|
-
"@nuxt/schema": "^
|
|
79
|
+
"@farmfe/core": ">=1.7.11",
|
|
80
|
+
"@nuxt/kit": "^4.2.0",
|
|
81
|
+
"@nuxt/schema": "^4.2.0",
|
|
82
82
|
"esbuild": "*",
|
|
83
83
|
"rolldown": "*",
|
|
84
|
-
"rollup": "^
|
|
85
|
-
"vite": ">=
|
|
86
|
-
"webpack": "^
|
|
84
|
+
"rollup": "^4.52.5",
|
|
85
|
+
"vite": ">=7.1.12",
|
|
86
|
+
"webpack": "^5.102.1"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@farmfe/core": {
|