@vureact/compiler-core 1.8.4 → 1.9.0
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/README.md +5 -2
- package/README.zh-CN.md +5 -3
- package/lib/{chunk-EH3325ZP.js → chunk-4DEDEJYM.js} +764 -510
- package/lib/{chunk-S6IFUYGO.esm.js → chunk-MBEPCMRP.esm.js} +622 -368
- package/lib/cli.esm.js +2 -2
- package/lib/cli.js +10 -10
- package/lib/compiler-core.d.cts +5 -1
- package/lib/compiler-core.d.ts +5 -1
- package/lib/compiler-core.esm.js +2 -2
- package/lib/compiler-core.js +3 -3
- package/package.json +104 -101
package/lib/cli.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @vureact/compiler-core v1.
|
|
3
|
+
* @vureact/compiler-core v1.9.0
|
|
4
4
|
* (c) 2025-present Ruihong Zhong (Ryan John)
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getDirname,
|
|
14
14
|
normalizePath,
|
|
15
15
|
version
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MBEPCMRP.esm.js";
|
|
17
17
|
|
|
18
18
|
// src/cli/index.ts
|
|
19
19
|
import { cac } from "cac";
|
package/lib/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict"; function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
3
|
-
* @vureact/compiler-core v1.
|
|
3
|
+
* @vureact/compiler-core v1.9.0
|
|
4
4
|
* (c) 2025-present Ruihong Zhong (Ryan John)
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk4DEDEJYMjs = require('./chunk-4DEDEJYM.js');
|
|
17
17
|
|
|
18
18
|
// src/cli/index.ts
|
|
19
19
|
var _cac = require('cac');
|
|
@@ -76,7 +76,7 @@ var _ora = require('ora'); var _ora2 = _interopRequireDefault(_ora);
|
|
|
76
76
|
|
|
77
77
|
function setupWatcher(compiler, config) {
|
|
78
78
|
const spinner = _ora2.default.call(void 0, );
|
|
79
|
-
const cmpHelper = new (0,
|
|
79
|
+
const cmpHelper = new (0, _chunk4DEDEJYMjs.Helper)(config);
|
|
80
80
|
const watcher = _chokidar2.default.watch(cmpHelper.getInputPath(), {
|
|
81
81
|
ignored: cmpHelper.getExcludes(),
|
|
82
82
|
persistent: true,
|
|
@@ -104,7 +104,7 @@ function setupWatcher(compiler, config) {
|
|
|
104
104
|
};
|
|
105
105
|
const onRecompile = async (event, filePath) => {
|
|
106
106
|
const ext = _path2.default.extname(filePath);
|
|
107
|
-
const relativePath =
|
|
107
|
+
const relativePath = _chunk4DEDEJYMjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath));
|
|
108
108
|
if (ext in processors) {
|
|
109
109
|
spinner.start("Recompiling...");
|
|
110
110
|
const startTime = performance.now();
|
|
@@ -115,7 +115,7 @@ function setupWatcher(compiler, config) {
|
|
|
115
115
|
cmpHelper.print(
|
|
116
116
|
_kleur2.default.green("compiled"),
|
|
117
117
|
_kleur2.default.dim(relativePath),
|
|
118
|
-
_kleur2.default.gray(`(${
|
|
118
|
+
_kleur2.default.gray(`(${_chunk4DEDEJYMjs.calcElapsedTime.call(void 0, startTime)})`)
|
|
119
119
|
);
|
|
120
120
|
await _optionalChain([config, 'access', _5 => _5.onChange, 'optionalCall', _6 => _6(event, unit)]);
|
|
121
121
|
} else {
|
|
@@ -130,7 +130,7 @@ function setupWatcher(compiler, config) {
|
|
|
130
130
|
};
|
|
131
131
|
const onRemoveFile = async (type, filePath) => {
|
|
132
132
|
const ext = _path2.default.extname(filePath);
|
|
133
|
-
const relativePath =
|
|
133
|
+
const relativePath = _chunk4DEDEJYMjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath));
|
|
134
134
|
const scriptExtRegex = /\.(js|ts)$/i;
|
|
135
135
|
const styleExtRegex = /\.(css|less|sass|scss)$/i;
|
|
136
136
|
const removeFile = async (cacheKey) => {
|
|
@@ -167,7 +167,7 @@ async function resolveAction(root, options) {
|
|
|
167
167
|
const projectRoot = root ? _path2.default.resolve(process.cwd(), root) : process.cwd();
|
|
168
168
|
const userConfig = await loadUserConfig(projectRoot);
|
|
169
169
|
const finalConfig = mergeConfig(projectRoot, options, userConfig);
|
|
170
|
-
const compiler = new (0,
|
|
170
|
+
const compiler = new (0, _chunk4DEDEJYMjs.VuReact)(finalConfig);
|
|
171
171
|
await compiler.execute();
|
|
172
172
|
if (finalConfig.watch) {
|
|
173
173
|
setupWatcher(compiler, finalConfig);
|
|
@@ -190,7 +190,7 @@ function resolveOptions(command) {
|
|
|
190
190
|
|
|
191
191
|
|
|
192
192
|
var _updatenotifier = require('update-notifier'); var _updatenotifier2 = _interopRequireDefault(_updatenotifier);
|
|
193
|
-
var __dirname =
|
|
193
|
+
var __dirname = _chunk4DEDEJYMjs.getDirname.call(void 0, import.meta.url);
|
|
194
194
|
function checkForUpdates() {
|
|
195
195
|
try {
|
|
196
196
|
const possiblePaths = [
|
|
@@ -231,7 +231,7 @@ function checkForUpdates() {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// src/cli/index.ts
|
|
234
|
-
var [programName] = Object.keys(
|
|
234
|
+
var [programName] = Object.keys(_chunk4DEDEJYMjs.bin);
|
|
235
235
|
var cli = _cac.cac.call(void 0, programName);
|
|
236
236
|
checkForUpdates();
|
|
237
237
|
var buildCommand = cli.command("build [root]", "Compile Vue3 to React (one-time)");
|
|
@@ -242,4 +242,4 @@ var watchCommand = cli.command("watch [root]", "Compile Vue3 to React and watch
|
|
|
242
242
|
resolveOptions(watchCommand).action((root, options) => {
|
|
243
243
|
resolveAction(root, { ...options, watch: true });
|
|
244
244
|
});
|
|
245
|
-
cli.help().version(
|
|
245
|
+
cli.help().version(_chunk4DEDEJYMjs.version).parse();
|
package/lib/compiler-core.d.cts
CHANGED
|
@@ -159,7 +159,7 @@ interface ICompilationContext {
|
|
|
159
159
|
inputType: FileInputType;
|
|
160
160
|
/**
|
|
161
161
|
* 函数组件的 prop 参数名
|
|
162
|
-
* @default '
|
|
162
|
+
* @default 'props'
|
|
163
163
|
*/
|
|
164
164
|
propField: string;
|
|
165
165
|
/** 是否使用了路由 */
|
|
@@ -210,6 +210,10 @@ interface ICompilationContext {
|
|
|
210
210
|
name?: string;
|
|
211
211
|
inheritAttrs?: boolean;
|
|
212
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* 使用时手动类型断言为 `ScriptBlockIR`
|
|
215
|
+
*/
|
|
216
|
+
__vureact_script_block_ir: any;
|
|
213
217
|
};
|
|
214
218
|
styleData: {
|
|
215
219
|
filePath: string;
|
package/lib/compiler-core.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ interface ICompilationContext {
|
|
|
159
159
|
inputType: FileInputType;
|
|
160
160
|
/**
|
|
161
161
|
* 函数组件的 prop 参数名
|
|
162
|
-
* @default '
|
|
162
|
+
* @default 'props'
|
|
163
163
|
*/
|
|
164
164
|
propField: string;
|
|
165
165
|
/** 是否使用了路由 */
|
|
@@ -210,6 +210,10 @@ interface ICompilationContext {
|
|
|
210
210
|
name?: string;
|
|
211
211
|
inheritAttrs?: boolean;
|
|
212
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* 使用时手动类型断言为 `ScriptBlockIR`
|
|
215
|
+
*/
|
|
216
|
+
__vureact_script_block_ir: any;
|
|
213
217
|
};
|
|
214
218
|
styleData: {
|
|
215
219
|
filePath: string;
|
package/lib/compiler-core.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vureact/compiler-core v1.
|
|
2
|
+
* @vureact/compiler-core v1.9.0
|
|
3
3
|
* (c) 2025-present Ruihong Zhong (Ryan John)
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
parseOnlyScript,
|
|
19
19
|
parseSFC,
|
|
20
20
|
transform
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MBEPCMRP.esm.js";
|
|
22
22
|
export {
|
|
23
23
|
BaseCompiler,
|
|
24
24
|
CacheKey,
|
package/lib/compiler-core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
|
2
|
-
* @vureact/compiler-core v1.
|
|
2
|
+
* @vureact/compiler-core v1.9.0
|
|
3
3
|
* (c) 2025-present Ruihong Zhong (Ryan John)
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunk4DEDEJYMjs = require('./chunk-4DEDEJYM.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -33,4 +33,4 @@ var _chunkEH3325ZPjs = require('./chunk-EH3325ZP.js');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
exports.BaseCompiler =
|
|
36
|
+
exports.BaseCompiler = _chunk4DEDEJYMjs.BaseCompiler; exports.CacheKey = _chunk4DEDEJYMjs.CacheKey; exports.FileCompiler = _chunk4DEDEJYMjs.FileCompiler; exports.Helper = _chunk4DEDEJYMjs.Helper; exports.VuReact = _chunk4DEDEJYMjs.VuReact; exports.defineConfig = _chunk4DEDEJYMjs.defineConfig; exports.generate = _chunk4DEDEJYMjs.generate; exports.generateComponent = _chunk4DEDEJYMjs.generateComponent; exports.generateOnlyScript = _chunk4DEDEJYMjs.generateOnlyScript; exports.parse = _chunk4DEDEJYMjs.parse; exports.parseOnlyScript = _chunk4DEDEJYMjs.parseOnlyScript; exports.parseSFC = _chunk4DEDEJYMjs.parseSFC; exports.transform = _chunk4DEDEJYMjs.transform;
|
package/package.json
CHANGED
|
@@ -1,102 +1,105 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@vureact/compiler-core",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
5
|
-
"author": "Ruihong Zhong (Ryan John)",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "./lib/compiler-core.js",
|
|
9
|
-
"module": "./lib/compiler-core.esm.js",
|
|
10
|
-
"types": "./lib/compiler-core.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./lib/compiler-core.d.ts",
|
|
14
|
-
"import": "./lib/compiler-core.esm.js",
|
|
15
|
-
"require": "./lib/compiler-core.js"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"bin",
|
|
20
|
-
"lib"
|
|
21
|
-
],
|
|
22
|
-
"keywords": [
|
|
23
|
-
"vue",
|
|
24
|
-
"react",
|
|
25
|
-
"vureact",
|
|
26
|
-
"vue2react",
|
|
27
|
-
"vue-to-react",
|
|
28
|
-
"compiler",
|
|
29
|
-
"transformer",
|
|
30
|
-
"vue3",
|
|
31
|
-
"react18",
|
|
32
|
-
"migration",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"vue-react",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"test": "
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
},
|
|
72
|
-
"
|
|
73
|
-
"prettier":
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"@babel/
|
|
82
|
-
"@babel/
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@vureact/compiler-core",
|
|
3
|
+
"version": "1.9.0",
|
|
4
|
+
"description": "For Vue-to-React migration and hybrid development.",
|
|
5
|
+
"author": "Ruihong Zhong (Ryan John)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./lib/compiler-core.js",
|
|
9
|
+
"module": "./lib/compiler-core.esm.js",
|
|
10
|
+
"types": "./lib/compiler-core.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/compiler-core.d.ts",
|
|
14
|
+
"import": "./lib/compiler-core.esm.js",
|
|
15
|
+
"require": "./lib/compiler-core.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"vue",
|
|
24
|
+
"react",
|
|
25
|
+
"vureact",
|
|
26
|
+
"vue2react",
|
|
27
|
+
"vue-to-react",
|
|
28
|
+
"compiler",
|
|
29
|
+
"transformer",
|
|
30
|
+
"vue3",
|
|
31
|
+
"react18",
|
|
32
|
+
"migration",
|
|
33
|
+
"typescript",
|
|
34
|
+
"jsx",
|
|
35
|
+
"sfc",
|
|
36
|
+
"veaury",
|
|
37
|
+
"vuera",
|
|
38
|
+
"vue3-to-react",
|
|
39
|
+
"vue-react",
|
|
40
|
+
"react-vue",
|
|
41
|
+
"vue-in-react",
|
|
42
|
+
"code-migration",
|
|
43
|
+
"framework-migration",
|
|
44
|
+
"vue-migration",
|
|
45
|
+
"react-conversion",
|
|
46
|
+
"single-file-components",
|
|
47
|
+
"progressive-migration",
|
|
48
|
+
"automated-refactoring",
|
|
49
|
+
"cross-framework"
|
|
50
|
+
],
|
|
51
|
+
"homepage": "https://github.com/vureact-js/core#readme",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/vureact-js/core.git",
|
|
55
|
+
"directory": "packages/compiler-core"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/vureact-js/core/issues"
|
|
59
|
+
},
|
|
60
|
+
"bin": {
|
|
61
|
+
"vureact": "bin/vureact.js"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsup",
|
|
65
|
+
"test": "jest",
|
|
66
|
+
"test:watch": "jest --watch",
|
|
67
|
+
"test:coverage": "jest --coverage",
|
|
68
|
+
"test:fixture": "jest --no-coverage compiler-fixtures -t",
|
|
69
|
+
"test:fixture-update": "node -e \"process.env.UPDATE_COMPILER_CORE_FIXTURES='1'; require('child_process').execSync('jest --no-coverage compiler-fixtures -t ' + (process.argv[1] || ''), { stdio: 'inherit', shell: true })\"",
|
|
70
|
+
"prepublishOnly": "npm run build && npm run test:coverage"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"prettier": "^3.0.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"prettier": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"dependencies": {
|
|
81
|
+
"@babel/core": "^7.28.5",
|
|
82
|
+
"@babel/generator": "^7.28.3",
|
|
83
|
+
"@babel/parser": "^7.28.4",
|
|
84
|
+
"@babel/traverse": "^7.28.4",
|
|
85
|
+
"@babel/types": "^7.28.4",
|
|
86
|
+
"@vue/compiler-core": "^3.5.22",
|
|
87
|
+
"@vue/compiler-sfc": "^3.5.22",
|
|
88
|
+
"cac": "^6.7.14",
|
|
89
|
+
"chokidar": "^5.0.0",
|
|
90
|
+
"kleur": "^4.1.5",
|
|
91
|
+
"less": "^4.5.1",
|
|
92
|
+
"minimatch": "^10.1.1",
|
|
93
|
+
"ora": "^9.1.0",
|
|
94
|
+
"postcss": "^8.5.6",
|
|
95
|
+
"postcss-selector-parser": "^7.1.1",
|
|
96
|
+
"proper-lockfile": "^4.1.2",
|
|
97
|
+
"sass": "^1.97.3",
|
|
98
|
+
"tsx": "^4.21.0",
|
|
99
|
+
"update-notifier": "^7.3.1",
|
|
100
|
+
"xxhashjs": "^0.2.2"
|
|
101
|
+
},
|
|
102
|
+
"engines": {
|
|
103
|
+
"node": ">=20.19.0"
|
|
104
|
+
}
|
|
102
105
|
}
|