@vue.ts/tsx-auto-props 1.0.0-beta.1 → 1.0.0-beta.11
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 +2 -1
- package/dist/astro.js +2 -2
- package/dist/esbuild.d.ts +2 -2
- package/dist/esbuild.js +1 -1
- package/dist/farm.d.ts +2 -2
- package/dist/farm.js +1 -1
- package/dist/index-tWaWg0Kw.d.ts +11 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +3 -3
- package/dist/rolldown.d.ts +2 -2
- package/dist/rolldown.js +1 -1
- package/dist/rollup.d.ts +2 -2
- package/dist/rollup.js +1 -1
- package/dist/rspack.d.ts +2 -2
- package/dist/rspack.js +1 -1
- package/dist/{src-CWmlC_RH.js → src-Be4nzbnH.js} +20 -18
- package/dist/types-DXB6NIW0.d.ts +7 -0
- package/dist/types.d.ts +2 -1
- package/dist/types.js +1 -0
- package/dist/{vite-CO8uPslf.js → vite-j4mVIlZq.js} +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +2 -2
- package/dist/{webpack-Bs4ZyN2r.js → webpack-CxWifJAJ.js} +2 -2
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +2 -2
- package/package.json +17 -17
- package/dist/types-BsMRL-YJ.d.ts +0 -15
package/dist/astro.d.ts
CHANGED
package/dist/astro.js
CHANGED
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as esbuild0 from "esbuild";
|
|
3
3
|
|
|
4
4
|
//#region src/esbuild.d.ts
|
|
5
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: BaseOptions | undefined) => esbuild0.Plugin;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/esbuild.js
CHANGED
package/dist/farm.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as _farmfe_core0 from "@farmfe/core";
|
|
3
3
|
|
|
4
4
|
//#region src/farm.d.ts
|
|
5
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: BaseOptions | undefined) => _farmfe_core0.JsPlugin;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/farm.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
|
+
import { t as Options } from "./types-DXB6NIW0.js";
|
|
2
3
|
import * as unplugin0 from "unplugin";
|
|
3
4
|
import { UnpluginFactory } from "unplugin";
|
|
4
5
|
|
|
5
6
|
//#region src/index.d.ts
|
|
6
7
|
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
7
|
-
declare const unplugin: unplugin0.UnpluginInstance<
|
|
8
|
+
declare const unplugin: unplugin0.UnpluginInstance<BaseOptions | undefined, boolean>;
|
|
8
9
|
//#endregion
|
|
9
10
|
export { unplugin as default, unplugin, unpluginFactory };
|
package/dist/index.js
CHANGED
package/dist/nuxt.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as _nuxt_schema0 from "@nuxt/schema";
|
|
3
3
|
|
|
4
4
|
//#region src/nuxt.d.ts
|
|
5
|
-
declare const _default: _nuxt_schema0.NuxtModule<
|
|
5
|
+
declare const _default: _nuxt_schema0.NuxtModule<BaseOptions, BaseOptions, false>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
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-Be4nzbnH.js";
|
|
2
|
+
import { t as vite_default } from "./vite-j4mVIlZq.js";
|
|
3
|
+
import { t as webpack_default } from "./webpack-CxWifJAJ.js";
|
|
4
4
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
5
5
|
|
|
6
6
|
//#region src/nuxt.ts
|
package/dist/rolldown.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as rolldown0 from "rolldown";
|
|
3
3
|
|
|
4
4
|
//#region src/rolldown.d.ts
|
|
5
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: BaseOptions | undefined) => rolldown0.Plugin<any> | rolldown0.Plugin<any>[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/rolldown.js
CHANGED
package/dist/rollup.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as rollup0 from "rollup";
|
|
3
3
|
|
|
4
4
|
//#region src/rollup.d.ts
|
|
5
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: BaseOptions | undefined) => rollup0.Plugin<any> | rollup0.Plugin<any>[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/rollup.js
CHANGED
package/dist/rspack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
|
|
3
3
|
//#region src/rspack.d.ts
|
|
4
|
-
declare const _default: (options?:
|
|
4
|
+
declare const _default: (options?: BaseOptions | undefined) => RspackPluginInstance;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { _default as default };
|
package/dist/rspack.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
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 { createOptionsResolver, normalizePath } from "@vue.ts/shared";
|
|
4
4
|
import MagicString from "magic-string";
|
|
5
5
|
import ts from "typescript";
|
|
6
|
-
import { join } from "node:path";
|
|
7
6
|
|
|
8
7
|
//#region src/core/utils.ts
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const defaultOptions = {
|
|
9
|
+
root: process.cwd(),
|
|
10
|
+
include: ["**/*.vue", "**/*.tsx"],
|
|
11
|
+
exclude: ["node_modules/**"],
|
|
12
|
+
tsconfigPath: "tsconfig.json"
|
|
13
|
+
};
|
|
14
|
+
const resolveOptions = createOptionsResolver(defaultOptions);
|
|
14
15
|
function getNodeAssignNode(node) {
|
|
15
16
|
let parent = null;
|
|
16
17
|
let variableList = null;
|
|
@@ -39,14 +40,13 @@ function transform(code, id) {
|
|
|
39
40
|
const s = new MagicString(code);
|
|
40
41
|
const normalizedFilepath = normalizePath(id);
|
|
41
42
|
const language = getLanguage();
|
|
42
|
-
const
|
|
43
|
+
const checker = language.tsLs.getProgram().getTypeChecker();
|
|
43
44
|
const ast = language.getVirtualFileOrTsAst(normalizedFilepath);
|
|
44
45
|
if (!ast) return;
|
|
45
46
|
language.traverseAst(ast, (node) => {
|
|
46
47
|
if (!ts.isCallExpression(node)) return;
|
|
47
48
|
const identifier = node.expression;
|
|
48
|
-
|
|
49
|
-
if (symbol?.declarations?.some((d) => ts.isImportSpecifier(d) && (d.propertyName ?? d.name)?.text === DEFINE_COMPONENT)) {
|
|
49
|
+
if (checker.getSymbolAtLocation(identifier)?.declarations?.some((d) => ts.isImportSpecifier(d) && (d.propertyName ?? d.name)?.text === DEFINE_COMPONENT)) {
|
|
50
50
|
const arg = node.arguments[0];
|
|
51
51
|
let setupFn;
|
|
52
52
|
if (ts.isObjectLiteralExpression(arg)) {
|
|
@@ -60,7 +60,7 @@ function transform(code, id) {
|
|
|
60
60
|
else throw new Error("[@vue.ts/tsx-auto-props] Invalid defineComponent argument");
|
|
61
61
|
const props = setupFn?.parameters[0];
|
|
62
62
|
if (props) {
|
|
63
|
-
const propsList =
|
|
63
|
+
const propsList = checker.getTypeAtLocation(props).getProperties().map((p) => p.name);
|
|
64
64
|
const { variableList, variable } = getNodeAssignNode(node);
|
|
65
65
|
if (propsList.length > 0 && variableList && variable) s.appendRight(variableList.getEnd() + 1, generateDefineProps(variable.name.getText(ast), propsList));
|
|
66
66
|
}
|
|
@@ -76,16 +76,18 @@ function transform(code, id) {
|
|
|
76
76
|
//#region src/index.ts
|
|
77
77
|
const unpluginFactory = (options = {}) => {
|
|
78
78
|
const resolvedOptions = resolveOptions(options);
|
|
79
|
-
const filter = createFilter(resolvedOptions.include, resolvedOptions.exclude);
|
|
80
79
|
return {
|
|
81
80
|
name: "@vue.ts/tsx-auto-props",
|
|
81
|
+
enforce: "pre",
|
|
82
82
|
buildStart() {
|
|
83
|
-
|
|
84
|
-
ensureLanguage(resolvedOptions$1.tsconfigPath);
|
|
83
|
+
ensureLanguage(resolveOptions(options).tsconfigPath);
|
|
85
84
|
},
|
|
86
|
-
transform
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
transform: {
|
|
86
|
+
filter: { id: {
|
|
87
|
+
include: resolvedOptions.include,
|
|
88
|
+
exclude: resolvedOptions.exclude
|
|
89
|
+
} },
|
|
90
|
+
handler: transform
|
|
89
91
|
}
|
|
90
92
|
};
|
|
91
93
|
};
|
|
@@ -93,4 +95,4 @@ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
|
93
95
|
var src_default = unplugin;
|
|
94
96
|
|
|
95
97
|
//#endregion
|
|
96
|
-
export {
|
|
98
|
+
export { unplugin as n, unpluginFactory as r, src_default as t };
|
package/dist/types.d.ts
CHANGED
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-Be4nzbnH.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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as vite0 from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.d.ts
|
|
5
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: BaseOptions | undefined) => vite0.Plugin<any> | vite0.Plugin<any>[];
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
package/dist/vite.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { r as unpluginFactory } from "./src-Be4nzbnH.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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BaseOptions } from "./index-tWaWg0Kw.js";
|
|
2
2
|
import * as webpack0 from "webpack";
|
|
3
3
|
|
|
4
4
|
//#region src/webpack.d.ts
|
|
5
|
-
declare const _default: (options?:
|
|
5
|
+
declare const _default: (options?: BaseOptions | undefined) => webpack0.WebpackPluginInstance;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
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.11",
|
|
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.11",
|
|
69
|
+
"@vue.ts/shared": "1.0.0-beta.11"
|
|
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.47",
|
|
74
|
+
"rollup": "^4.52.5",
|
|
75
|
+
"vite": "7.2.2",
|
|
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": {
|
package/dist/types-BsMRL-YJ.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
-
|
|
3
|
-
//#region ../common/src/types.d.ts
|
|
4
|
-
interface BaseOptions {
|
|
5
|
-
include?: FilterPattern;
|
|
6
|
-
exclude?: FilterPattern;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/types.d.ts
|
|
10
|
-
interface Options extends BaseOptions {
|
|
11
|
-
tsconfigPath?: string;
|
|
12
|
-
}
|
|
13
|
-
type ResolvedOptions = Required<Options>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { Options, ResolvedOptions };
|