@vue.ts/tsx-auto-props 0.5.0 → 1.0.0-beta.1
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/LICENSE +21 -21
- package/README.md +34 -15
- package/dist/astro.d.ts +8 -8
- package/dist/astro.js +14 -0
- package/dist/esbuild.d.ts +6 -6
- package/dist/esbuild.js +8 -0
- package/dist/farm.d.ts +7 -0
- package/dist/farm.js +8 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.js +3 -0
- package/dist/nuxt.d.ts +6 -6
- package/dist/nuxt.js +20 -0
- package/dist/rolldown.d.ts +7 -0
- package/dist/rolldown.js +8 -0
- package/dist/rollup.d.ts +6 -6
- package/dist/rollup.js +8 -0
- package/dist/rspack.d.ts +4 -4
- package/dist/rspack.js +8 -0
- package/dist/src-CWmlC_RH.js +96 -0
- package/dist/types-BsMRL-YJ.d.ts +15 -0
- package/dist/types.d.ts +2 -8
- package/dist/types.js +0 -0
- package/dist/vite-CO8uPslf.js +8 -0
- package/dist/vite.d.ts +6 -6
- package/dist/vite.js +4 -0
- package/dist/webpack-Bs4ZyN2r.js +8 -0
- package/dist/webpack.d.ts +6 -6
- package/dist/webpack.js +4 -0
- package/package.json +65 -54
- package/dist/astro.cjs +0 -22
- package/dist/astro.d.cts +0 -11
- package/dist/astro.d.mts +0 -11
- package/dist/astro.mjs +0 -20
- package/dist/esbuild.cjs +0 -13
- package/dist/esbuild.d.cts +0 -7
- package/dist/esbuild.d.mts +0 -7
- package/dist/esbuild.mjs +0 -11
- package/dist/index.cjs +0 -119
- package/dist/index.d.cts +0 -7
- package/dist/index.d.mts +0 -7
- package/dist/index.mjs +0 -112
- package/dist/nuxt.cjs +0 -35
- package/dist/nuxt.d.cts +0 -7
- package/dist/nuxt.d.mts +0 -7
- package/dist/nuxt.mjs +0 -33
- package/dist/rollup.cjs +0 -13
- package/dist/rollup.d.cts +0 -7
- package/dist/rollup.d.mts +0 -7
- package/dist/rollup.mjs +0 -11
- package/dist/rspack.cjs +0 -13
- package/dist/rspack.d.cts +0 -6
- package/dist/rspack.d.mts +0 -6
- package/dist/rspack.mjs +0 -11
- package/dist/types.cjs +0 -2
- package/dist/types.d.cts +0 -8
- package/dist/types.d.mts +0 -8
- package/dist/types.mjs +0 -1
- package/dist/vite.cjs +0 -13
- package/dist/vite.d.cts +0 -7
- package/dist/vite.d.mts +0 -7
- package/dist/vite.mjs +0 -11
- package/dist/webpack.cjs +0 -13
- package/dist/webpack.d.cts +0 -7
- package/dist/webpack.d.mts +0 -7
- package/dist/webpack.mjs +0 -11
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue.ts/tsx-auto-props",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"author": "Ray <i@mk1.io> (@so1ve)",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"description": "Automatically add props definition for Vue 3 TSX.",
|
|
6
7
|
"keywords": [
|
|
7
8
|
"astro",
|
|
9
|
+
"farm",
|
|
8
10
|
"nuxt",
|
|
11
|
+
"rolldown",
|
|
9
12
|
"rollup",
|
|
10
13
|
"rspack",
|
|
11
14
|
"transform",
|
|
@@ -14,6 +17,7 @@
|
|
|
14
17
|
"unplugin",
|
|
15
18
|
"vite",
|
|
16
19
|
"vue",
|
|
20
|
+
"vue.ts",
|
|
17
21
|
"webpack"
|
|
18
22
|
],
|
|
19
23
|
"homepage": "https://github.com/so1ve/vue.ts/tree/main/packages/tsx-auto-props#readme",
|
|
@@ -28,46 +32,21 @@
|
|
|
28
32
|
"license": "MIT",
|
|
29
33
|
"sideEffects": false,
|
|
30
34
|
"exports": {
|
|
31
|
-
".":
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"./
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"./
|
|
41
|
-
|
|
42
|
-
"import": "./dist/esbuild.mjs"
|
|
43
|
-
},
|
|
44
|
-
"./nuxt": {
|
|
45
|
-
"require": "./dist/nuxt.cjs",
|
|
46
|
-
"import": "./dist/nuxt.mjs"
|
|
47
|
-
},
|
|
48
|
-
"./rollup": {
|
|
49
|
-
"require": "./dist/rollup.cjs",
|
|
50
|
-
"import": "./dist/rollup.mjs"
|
|
51
|
-
},
|
|
52
|
-
"./rspack": {
|
|
53
|
-
"require": "./dist/rspack.cjs",
|
|
54
|
-
"import": "./dist/rspack.mjs"
|
|
55
|
-
},
|
|
56
|
-
"./types": {
|
|
57
|
-
"require": "./dist/types.cjs",
|
|
58
|
-
"import": "./dist/types.mjs"
|
|
59
|
-
},
|
|
60
|
-
"./vite": {
|
|
61
|
-
"require": "./dist/vite.cjs",
|
|
62
|
-
"import": "./dist/vite.mjs"
|
|
63
|
-
},
|
|
64
|
-
"./webpack": {
|
|
65
|
-
"require": "./dist/webpack.cjs",
|
|
66
|
-
"import": "./dist/webpack.mjs"
|
|
67
|
-
}
|
|
35
|
+
".": "./dist/index.js",
|
|
36
|
+
"./astro": "./dist/astro.js",
|
|
37
|
+
"./esbuild": "./dist/esbuild.js",
|
|
38
|
+
"./farm": "./dist/farm.js",
|
|
39
|
+
"./nuxt": "./dist/nuxt.js",
|
|
40
|
+
"./rolldown": "./dist/rolldown.js",
|
|
41
|
+
"./rollup": "./dist/rollup.js",
|
|
42
|
+
"./rspack": "./dist/rspack.js",
|
|
43
|
+
"./types": "./dist/types.js",
|
|
44
|
+
"./vite": "./dist/vite.js",
|
|
45
|
+
"./webpack": "./dist/webpack.js"
|
|
68
46
|
},
|
|
69
|
-
"main": "./dist/index.
|
|
70
|
-
"module": "./dist/index.
|
|
47
|
+
"main": "./dist/index.js",
|
|
48
|
+
"module": "./dist/index.js",
|
|
49
|
+
"types": "dist/index.d.ts",
|
|
71
50
|
"typesVersions": {
|
|
72
51
|
"*": {
|
|
73
52
|
"*": [
|
|
@@ -83,25 +62,57 @@
|
|
|
83
62
|
"access": "public"
|
|
84
63
|
},
|
|
85
64
|
"dependencies": {
|
|
86
|
-
"@nuxt/kit": "^3.
|
|
87
|
-
"magic-string": "^0.30.
|
|
88
|
-
"unplugin": "^
|
|
89
|
-
"@vue.ts/common": "0.
|
|
90
|
-
"@vue.ts/language": "0.
|
|
65
|
+
"@nuxt/kit": "^3.17.6",
|
|
66
|
+
"magic-string": "^0.30.17",
|
|
67
|
+
"unplugin": "^2.3.5",
|
|
68
|
+
"@vue.ts/common": "1.0.0-beta.1",
|
|
69
|
+
"@vue.ts/language": "1.0.0-beta.1"
|
|
91
70
|
},
|
|
92
71
|
"devDependencies": {
|
|
93
|
-
"@nuxt/schema": "^3.
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"vite": "^
|
|
97
|
-
"webpack": "^5.
|
|
72
|
+
"@nuxt/schema": "^3.17.6",
|
|
73
|
+
"rolldown": "1.0.0-beta.27",
|
|
74
|
+
"rollup": "^4.44.2",
|
|
75
|
+
"vite": "^7.0.4",
|
|
76
|
+
"webpack": "^5.100.1"
|
|
98
77
|
},
|
|
99
78
|
"peerDependencies": {
|
|
100
|
-
"
|
|
101
|
-
"
|
|
79
|
+
"@farmfe/core": ">=1",
|
|
80
|
+
"@nuxt/kit": "^3 || ^4",
|
|
81
|
+
"@nuxt/schema": "^3 || ^4",
|
|
82
|
+
"esbuild": "*",
|
|
83
|
+
"rolldown": "*",
|
|
84
|
+
"rollup": "^3",
|
|
85
|
+
"vite": ">=3",
|
|
86
|
+
"webpack": "^4 || ^5"
|
|
87
|
+
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"@farmfe/core": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@nuxt/kit": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@nuxt/schema": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"esbuild": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"rolldown": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"rollup": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"vite": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"webpack": {
|
|
111
|
+
"optional": true
|
|
112
|
+
}
|
|
102
113
|
},
|
|
103
114
|
"scripts": {
|
|
104
|
-
"build": "
|
|
105
|
-
"
|
|
115
|
+
"build": "tsdown",
|
|
116
|
+
"watch": "tsdown --watch"
|
|
106
117
|
}
|
|
107
118
|
}
|
package/dist/astro.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index.cjs');
|
|
4
|
-
require('@vue.ts/common');
|
|
5
|
-
require('@vue.ts/language');
|
|
6
|
-
require('unplugin');
|
|
7
|
-
require('magic-string');
|
|
8
|
-
require('typescript');
|
|
9
|
-
require('node:path');
|
|
10
|
-
|
|
11
|
-
const astro = (options) => ({
|
|
12
|
-
name: "unplugin-vue-complex-types",
|
|
13
|
-
hooks: {
|
|
14
|
-
"astro:config:setup": async (astro) => {
|
|
15
|
-
var _a;
|
|
16
|
-
(_a = astro.config.vite).plugins || (_a.plugins = []);
|
|
17
|
-
astro.config.vite.plugins.push(index.vite(options));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
module.exports = astro;
|
package/dist/astro.d.cts
DELETED
package/dist/astro.d.mts
DELETED
package/dist/astro.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import unplugin from './index.mjs';
|
|
2
|
-
import '@vue.ts/common';
|
|
3
|
-
import '@vue.ts/language';
|
|
4
|
-
import 'unplugin';
|
|
5
|
-
import 'magic-string';
|
|
6
|
-
import 'typescript';
|
|
7
|
-
import 'node:path';
|
|
8
|
-
|
|
9
|
-
const astro = (options) => ({
|
|
10
|
-
name: "unplugin-vue-complex-types",
|
|
11
|
-
hooks: {
|
|
12
|
-
"astro:config:setup": async (astro) => {
|
|
13
|
-
var _a;
|
|
14
|
-
(_a = astro.config.vite).plugins || (_a.plugins = []);
|
|
15
|
-
astro.config.vite.plugins.push(unplugin.vite(options));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export { astro as default };
|
package/dist/esbuild.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index.cjs');
|
|
4
|
-
require('@vue.ts/common');
|
|
5
|
-
require('@vue.ts/language');
|
|
6
|
-
require('unplugin');
|
|
7
|
-
require('magic-string');
|
|
8
|
-
require('typescript');
|
|
9
|
-
require('node:path');
|
|
10
|
-
|
|
11
|
-
const esbuild = index.esbuild;
|
|
12
|
-
|
|
13
|
-
module.exports = esbuild;
|
package/dist/esbuild.d.cts
DELETED
package/dist/esbuild.d.mts
DELETED
package/dist/esbuild.mjs
DELETED
package/dist/index.cjs
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const common = require('@vue.ts/common');
|
|
4
|
-
const language = require('@vue.ts/language');
|
|
5
|
-
const unplugin$1 = require('unplugin');
|
|
6
|
-
const MagicString = require('magic-string');
|
|
7
|
-
const ts = require('typescript');
|
|
8
|
-
const node_path = require('node:path');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
|
-
|
|
12
|
-
const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
13
|
-
const ts__default = /*#__PURE__*/_interopDefaultCompat(ts);
|
|
14
|
-
|
|
15
|
-
const resolveOptions = (rawOptions) => ({
|
|
16
|
-
include: rawOptions.include ?? ["**/*.vue", "**/*.tsx"],
|
|
17
|
-
exclude: rawOptions.exclude ?? ["node_modules/**"],
|
|
18
|
-
tsconfigPath: rawOptions.tsconfigPath ?? node_path.join(process.cwd(), "tsconfig.json")
|
|
19
|
-
});
|
|
20
|
-
function getNodeAssignNode(node) {
|
|
21
|
-
let parent = null;
|
|
22
|
-
let variableList = null;
|
|
23
|
-
let variable = null;
|
|
24
|
-
while (node) {
|
|
25
|
-
if (parent) {
|
|
26
|
-
if (ts__default.isVariableDeclarationList(parent)) {
|
|
27
|
-
variableList = parent;
|
|
28
|
-
}
|
|
29
|
-
if (ts__default.isVariableDeclaration(parent)) {
|
|
30
|
-
variable = parent;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
parent = node;
|
|
34
|
-
node = node.parent;
|
|
35
|
-
}
|
|
36
|
-
return { variableList, variable };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const generateDefineProps = (name, props) => `
|
|
40
|
-
;Object.defineProperty(${name}, "props", {
|
|
41
|
-
value: ${JSON.stringify(props)},
|
|
42
|
-
});`;
|
|
43
|
-
const DEFINE_COMPONENT = "defineComponent";
|
|
44
|
-
function transform(code, id) {
|
|
45
|
-
const s = new MagicString__default(code);
|
|
46
|
-
const language$1 = language.getLanguage();
|
|
47
|
-
const typeChecker = language$1.__internal__.typeChecker;
|
|
48
|
-
language$1.traverseAst(
|
|
49
|
-
id,
|
|
50
|
-
(node, { virtualFileOrTsAst: ast, isVirtualOrTsFile }) => {
|
|
51
|
-
if (isVirtualOrTsFile && ts__default.isCallExpression(node)) {
|
|
52
|
-
const identifier = node.expression;
|
|
53
|
-
const symbol = typeChecker.getSymbolAtLocation(identifier);
|
|
54
|
-
if (symbol?.declarations?.some(
|
|
55
|
-
(d) => ts__default.isImportSpecifier(d) && (d.propertyName ?? d.name)?.escapedText === DEFINE_COMPONENT
|
|
56
|
-
)) {
|
|
57
|
-
const arg = node.arguments[0];
|
|
58
|
-
let setupFn;
|
|
59
|
-
if (ts__default.isObjectLiteralExpression(arg)) {
|
|
60
|
-
const props2 = arg.properties.find(
|
|
61
|
-
(p) => ts__default.isPropertyAssignment(p) && ts__default.isIdentifier(p.name) && p.name.escapedText === "props"
|
|
62
|
-
);
|
|
63
|
-
const setup = arg.properties.find(
|
|
64
|
-
(p) => ts__default.isPropertyAssignment(p) && ts__default.isIdentifier(p.name) && p.name.escapedText === "setup"
|
|
65
|
-
);
|
|
66
|
-
if (!props2 && setup && ts__default.isPropertyAssignment(setup)) {
|
|
67
|
-
const value = setup.initializer;
|
|
68
|
-
if (ts__default.isFunctionLike(value)) {
|
|
69
|
-
setupFn = value;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
} else if (ts__default.isFunctionLike(arg)) {
|
|
73
|
-
setupFn = arg;
|
|
74
|
-
} else {
|
|
75
|
-
throw new Error(
|
|
76
|
-
"[@vue.ts/tsx-auto-props] Invalid defineComponent argument"
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
const props = setupFn?.parameters[0];
|
|
80
|
-
if (props) {
|
|
81
|
-
const propsList = typeChecker.getTypeAtLocation(props).getProperties().map((p) => p.name);
|
|
82
|
-
const { variableList, variable } = getNodeAssignNode(node);
|
|
83
|
-
if (propsList.length > 0 && variableList && variable) {
|
|
84
|
-
s.appendRight(
|
|
85
|
-
variableList.getEnd() + 1,
|
|
86
|
-
generateDefineProps(variable.name.getText(ast), propsList)
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
return {
|
|
95
|
-
code: s.toString(),
|
|
96
|
-
map: s.generateMap({ hires: true })
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const unplugin = unplugin$1.createUnplugin((options = {}) => ({
|
|
101
|
-
name: "unplugin-vue-complex-types",
|
|
102
|
-
buildStart() {
|
|
103
|
-
const resolvedOptions = resolveOptions(options);
|
|
104
|
-
language.ensureLanguage(resolvedOptions.tsconfigPath);
|
|
105
|
-
},
|
|
106
|
-
transform(code, id) {
|
|
107
|
-
const resolvedOptions = resolveOptions(options);
|
|
108
|
-
const filter = common.createFilter(
|
|
109
|
-
resolvedOptions.include,
|
|
110
|
-
resolvedOptions.exclude
|
|
111
|
-
);
|
|
112
|
-
if (!filter(id)) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
return transform(code, id);
|
|
116
|
-
}
|
|
117
|
-
}));
|
|
118
|
-
|
|
119
|
-
module.exports = unplugin;
|
package/dist/index.d.cts
DELETED
package/dist/index.d.mts
DELETED
package/dist/index.mjs
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { createFilter } from '@vue.ts/common';
|
|
2
|
-
import { getLanguage, ensureLanguage } from '@vue.ts/language';
|
|
3
|
-
import { createUnplugin } from 'unplugin';
|
|
4
|
-
import MagicString from 'magic-string';
|
|
5
|
-
import ts from 'typescript';
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
|
|
8
|
-
const resolveOptions = (rawOptions) => ({
|
|
9
|
-
include: rawOptions.include ?? ["**/*.vue", "**/*.tsx"],
|
|
10
|
-
exclude: rawOptions.exclude ?? ["node_modules/**"],
|
|
11
|
-
tsconfigPath: rawOptions.tsconfigPath ?? join(process.cwd(), "tsconfig.json")
|
|
12
|
-
});
|
|
13
|
-
function getNodeAssignNode(node) {
|
|
14
|
-
let parent = null;
|
|
15
|
-
let variableList = null;
|
|
16
|
-
let variable = null;
|
|
17
|
-
while (node) {
|
|
18
|
-
if (parent) {
|
|
19
|
-
if (ts.isVariableDeclarationList(parent)) {
|
|
20
|
-
variableList = parent;
|
|
21
|
-
}
|
|
22
|
-
if (ts.isVariableDeclaration(parent)) {
|
|
23
|
-
variable = parent;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
parent = node;
|
|
27
|
-
node = node.parent;
|
|
28
|
-
}
|
|
29
|
-
return { variableList, variable };
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const generateDefineProps = (name, props) => `
|
|
33
|
-
;Object.defineProperty(${name}, "props", {
|
|
34
|
-
value: ${JSON.stringify(props)},
|
|
35
|
-
});`;
|
|
36
|
-
const DEFINE_COMPONENT = "defineComponent";
|
|
37
|
-
function transform(code, id) {
|
|
38
|
-
const s = new MagicString(code);
|
|
39
|
-
const language = getLanguage();
|
|
40
|
-
const typeChecker = language.__internal__.typeChecker;
|
|
41
|
-
language.traverseAst(
|
|
42
|
-
id,
|
|
43
|
-
(node, { virtualFileOrTsAst: ast, isVirtualOrTsFile }) => {
|
|
44
|
-
if (isVirtualOrTsFile && ts.isCallExpression(node)) {
|
|
45
|
-
const identifier = node.expression;
|
|
46
|
-
const symbol = typeChecker.getSymbolAtLocation(identifier);
|
|
47
|
-
if (symbol?.declarations?.some(
|
|
48
|
-
(d) => ts.isImportSpecifier(d) && (d.propertyName ?? d.name)?.escapedText === DEFINE_COMPONENT
|
|
49
|
-
)) {
|
|
50
|
-
const arg = node.arguments[0];
|
|
51
|
-
let setupFn;
|
|
52
|
-
if (ts.isObjectLiteralExpression(arg)) {
|
|
53
|
-
const props2 = arg.properties.find(
|
|
54
|
-
(p) => ts.isPropertyAssignment(p) && ts.isIdentifier(p.name) && p.name.escapedText === "props"
|
|
55
|
-
);
|
|
56
|
-
const setup = arg.properties.find(
|
|
57
|
-
(p) => ts.isPropertyAssignment(p) && ts.isIdentifier(p.name) && p.name.escapedText === "setup"
|
|
58
|
-
);
|
|
59
|
-
if (!props2 && setup && ts.isPropertyAssignment(setup)) {
|
|
60
|
-
const value = setup.initializer;
|
|
61
|
-
if (ts.isFunctionLike(value)) {
|
|
62
|
-
setupFn = value;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} else if (ts.isFunctionLike(arg)) {
|
|
66
|
-
setupFn = arg;
|
|
67
|
-
} else {
|
|
68
|
-
throw new Error(
|
|
69
|
-
"[@vue.ts/tsx-auto-props] Invalid defineComponent argument"
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
const props = setupFn?.parameters[0];
|
|
73
|
-
if (props) {
|
|
74
|
-
const propsList = typeChecker.getTypeAtLocation(props).getProperties().map((p) => p.name);
|
|
75
|
-
const { variableList, variable } = getNodeAssignNode(node);
|
|
76
|
-
if (propsList.length > 0 && variableList && variable) {
|
|
77
|
-
s.appendRight(
|
|
78
|
-
variableList.getEnd() + 1,
|
|
79
|
-
generateDefineProps(variable.name.getText(ast), propsList)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
return {
|
|
88
|
-
code: s.toString(),
|
|
89
|
-
map: s.generateMap({ hires: true })
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const unplugin = createUnplugin((options = {}) => ({
|
|
94
|
-
name: "unplugin-vue-complex-types",
|
|
95
|
-
buildStart() {
|
|
96
|
-
const resolvedOptions = resolveOptions(options);
|
|
97
|
-
ensureLanguage(resolvedOptions.tsconfigPath);
|
|
98
|
-
},
|
|
99
|
-
transform(code, id) {
|
|
100
|
-
const resolvedOptions = resolveOptions(options);
|
|
101
|
-
const filter = createFilter(
|
|
102
|
-
resolvedOptions.include,
|
|
103
|
-
resolvedOptions.exclude
|
|
104
|
-
);
|
|
105
|
-
if (!filter(id)) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
return transform(code, id);
|
|
109
|
-
}
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
export { unplugin as default };
|
package/dist/nuxt.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const kit = require('@nuxt/kit');
|
|
4
|
-
const vite = require('./vite.cjs');
|
|
5
|
-
const webpack = require('./webpack.cjs');
|
|
6
|
-
require('./index.cjs');
|
|
7
|
-
require('@vue.ts/common');
|
|
8
|
-
require('@vue.ts/language');
|
|
9
|
-
require('unplugin');
|
|
10
|
-
require('magic-string');
|
|
11
|
-
require('typescript');
|
|
12
|
-
require('node:path');
|
|
13
|
-
|
|
14
|
-
const name = "@vue.ts/tsx-auto-props";
|
|
15
|
-
const version = "0.5.0";
|
|
16
|
-
|
|
17
|
-
const nuxt = kit.defineNuxtModule({
|
|
18
|
-
meta: {
|
|
19
|
-
name,
|
|
20
|
-
version,
|
|
21
|
-
configKey: "complexTypes",
|
|
22
|
-
compatibility: {
|
|
23
|
-
bridge: true
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
defaults: {
|
|
27
|
-
tsconfigPath: "tsconfig.json"
|
|
28
|
-
},
|
|
29
|
-
setup(options) {
|
|
30
|
-
kit.addVitePlugin(vite(options));
|
|
31
|
-
kit.addWebpackPlugin(webpack(options));
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
module.exports = nuxt;
|
package/dist/nuxt.d.cts
DELETED
package/dist/nuxt.d.mts
DELETED
package/dist/nuxt.mjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineNuxtModule, addVitePlugin, addWebpackPlugin } from '@nuxt/kit';
|
|
2
|
-
import VitePlugin from './vite.mjs';
|
|
3
|
-
import WebpackPlugin from './webpack.mjs';
|
|
4
|
-
import './index.mjs';
|
|
5
|
-
import '@vue.ts/common';
|
|
6
|
-
import '@vue.ts/language';
|
|
7
|
-
import 'unplugin';
|
|
8
|
-
import 'magic-string';
|
|
9
|
-
import 'typescript';
|
|
10
|
-
import 'node:path';
|
|
11
|
-
|
|
12
|
-
const name = "@vue.ts/tsx-auto-props";
|
|
13
|
-
const version = "0.5.0";
|
|
14
|
-
|
|
15
|
-
const nuxt = defineNuxtModule({
|
|
16
|
-
meta: {
|
|
17
|
-
name,
|
|
18
|
-
version,
|
|
19
|
-
configKey: "complexTypes",
|
|
20
|
-
compatibility: {
|
|
21
|
-
bridge: true
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
defaults: {
|
|
25
|
-
tsconfigPath: "tsconfig.json"
|
|
26
|
-
},
|
|
27
|
-
setup(options) {
|
|
28
|
-
addVitePlugin(VitePlugin(options));
|
|
29
|
-
addWebpackPlugin(WebpackPlugin(options));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export { nuxt as default };
|
package/dist/rollup.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index.cjs');
|
|
4
|
-
require('@vue.ts/common');
|
|
5
|
-
require('@vue.ts/language');
|
|
6
|
-
require('unplugin');
|
|
7
|
-
require('magic-string');
|
|
8
|
-
require('typescript');
|
|
9
|
-
require('node:path');
|
|
10
|
-
|
|
11
|
-
const rollup = index.rollup;
|
|
12
|
-
|
|
13
|
-
module.exports = rollup;
|
package/dist/rollup.d.cts
DELETED
package/dist/rollup.d.mts
DELETED
package/dist/rollup.mjs
DELETED
package/dist/rspack.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index.cjs');
|
|
4
|
-
require('@vue.ts/common');
|
|
5
|
-
require('@vue.ts/language');
|
|
6
|
-
require('unplugin');
|
|
7
|
-
require('magic-string');
|
|
8
|
-
require('typescript');
|
|
9
|
-
require('node:path');
|
|
10
|
-
|
|
11
|
-
const rspack = index.rspack;
|
|
12
|
-
|
|
13
|
-
module.exports = rspack;
|