@vureact/compiler-core 1.9.0 → 1.10.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 +3 -4
- package/README.zh-CN.md +2 -3
- package/lib/{chunk-4DEDEJYM.js → chunk-AOWJPHTS.js} +769 -596
- package/lib/{chunk-MBEPCMRP.esm.js → chunk-ZTNVNBKF.esm.js} +681 -508
- package/lib/cli.esm.js +2 -2
- package/lib/cli.js +10 -10
- package/lib/compiler-core.d.cts +18 -3
- package/lib/compiler-core.d.ts +18 -3
- package/lib/compiler-core.esm.js +2 -2
- package/lib/compiler-core.js +3 -3
- package/package.json +3 -3
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.10.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-ZTNVNBKF.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.10.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 _chunkAOWJPHTSjs = require('./chunk-AOWJPHTS.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, _chunkAOWJPHTSjs.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 = _chunkAOWJPHTSjs.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(`(${_chunkAOWJPHTSjs.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 = _chunkAOWJPHTSjs.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, _chunkAOWJPHTSjs.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 = _chunkAOWJPHTSjs.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(_chunkAOWJPHTSjs.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(_chunkAOWJPHTSjs.version).parse();
|
package/lib/compiler-core.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GeneratorOptions as GeneratorOptions$1 } from '@babel/generator';
|
|
2
2
|
import { ParseResult as ParseResult$1 } from '@babel/parser';
|
|
3
3
|
import * as t from '@babel/types';
|
|
4
|
-
import { Expression, ArrayExpression, JSXIdentifier } from '@babel/types';
|
|
5
|
-
import { RootNode, SourceLocation } from '@vue/compiler-core';
|
|
4
|
+
import { SourceLocation, Expression, ArrayExpression, JSXIdentifier } from '@babel/types';
|
|
5
|
+
import { RootNode, SourceLocation as SourceLocation$1 } from '@vue/compiler-core';
|
|
6
6
|
import { SFCTemplateBlock, SFCScriptBlock, SFCStyleBlock } from '@vue/compiler-sfc';
|
|
7
7
|
import { Options } from 'prettier';
|
|
8
8
|
|
|
@@ -210,6 +210,8 @@ interface ICompilationContext {
|
|
|
210
210
|
name?: string;
|
|
211
211
|
inheritAttrs?: boolean;
|
|
212
212
|
};
|
|
213
|
+
/** withDefaults 中的默认值 */
|
|
214
|
+
propsWithDefaults?: PropsWithDefaults;
|
|
213
215
|
/**
|
|
214
216
|
* 使用时手动类型断言为 `ScriptBlockIR`
|
|
215
217
|
*/
|
|
@@ -279,6 +281,19 @@ interface IPropsContext {
|
|
|
279
281
|
emitTypes: t.TSType[];
|
|
280
282
|
slotTypes: t.TSType[];
|
|
281
283
|
}
|
|
284
|
+
interface PropsWithDefaults {
|
|
285
|
+
varName: string;
|
|
286
|
+
values: t.Expression | undefined;
|
|
287
|
+
/** 收集 defineProps 的类型参数 */
|
|
288
|
+
typeParameters?: t.TSTypeParameterInstantiation | null;
|
|
289
|
+
/** 原 withDefaults 调用的 babel 位置信息,用于 postprocess 阶段定位替换 */
|
|
290
|
+
leadingComments?: t.Comment[] | null;
|
|
291
|
+
innerComments?: t.Comment[] | null;
|
|
292
|
+
trailingComments?: t.Comment[] | null;
|
|
293
|
+
start?: number | null;
|
|
294
|
+
end?: number | null;
|
|
295
|
+
loc?: SourceLocation | null;
|
|
296
|
+
}
|
|
282
297
|
|
|
283
298
|
type CompilerPlugins = PluginRegister<CompilationResult> & {
|
|
284
299
|
/**
|
|
@@ -1060,7 +1075,7 @@ interface BaseElementNodeIR {
|
|
|
1060
1075
|
isComponent?: boolean;
|
|
1061
1076
|
isSelfClosing?: boolean;
|
|
1062
1077
|
ref?: string;
|
|
1063
|
-
loc?: SourceLocation;
|
|
1078
|
+
loc?: SourceLocation$1;
|
|
1064
1079
|
}
|
|
1065
1080
|
interface ElementNodeIRMeta {
|
|
1066
1081
|
condition: ConditionMeta;
|
package/lib/compiler-core.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GeneratorOptions as GeneratorOptions$1 } from '@babel/generator';
|
|
2
2
|
import { ParseResult as ParseResult$1 } from '@babel/parser';
|
|
3
3
|
import * as t from '@babel/types';
|
|
4
|
-
import { Expression, ArrayExpression, JSXIdentifier } from '@babel/types';
|
|
5
|
-
import { RootNode, SourceLocation } from '@vue/compiler-core';
|
|
4
|
+
import { SourceLocation, Expression, ArrayExpression, JSXIdentifier } from '@babel/types';
|
|
5
|
+
import { RootNode, SourceLocation as SourceLocation$1 } from '@vue/compiler-core';
|
|
6
6
|
import { SFCTemplateBlock, SFCScriptBlock, SFCStyleBlock } from '@vue/compiler-sfc';
|
|
7
7
|
import { Options } from 'prettier';
|
|
8
8
|
|
|
@@ -210,6 +210,8 @@ interface ICompilationContext {
|
|
|
210
210
|
name?: string;
|
|
211
211
|
inheritAttrs?: boolean;
|
|
212
212
|
};
|
|
213
|
+
/** withDefaults 中的默认值 */
|
|
214
|
+
propsWithDefaults?: PropsWithDefaults;
|
|
213
215
|
/**
|
|
214
216
|
* 使用时手动类型断言为 `ScriptBlockIR`
|
|
215
217
|
*/
|
|
@@ -279,6 +281,19 @@ interface IPropsContext {
|
|
|
279
281
|
emitTypes: t.TSType[];
|
|
280
282
|
slotTypes: t.TSType[];
|
|
281
283
|
}
|
|
284
|
+
interface PropsWithDefaults {
|
|
285
|
+
varName: string;
|
|
286
|
+
values: t.Expression | undefined;
|
|
287
|
+
/** 收集 defineProps 的类型参数 */
|
|
288
|
+
typeParameters?: t.TSTypeParameterInstantiation | null;
|
|
289
|
+
/** 原 withDefaults 调用的 babel 位置信息,用于 postprocess 阶段定位替换 */
|
|
290
|
+
leadingComments?: t.Comment[] | null;
|
|
291
|
+
innerComments?: t.Comment[] | null;
|
|
292
|
+
trailingComments?: t.Comment[] | null;
|
|
293
|
+
start?: number | null;
|
|
294
|
+
end?: number | null;
|
|
295
|
+
loc?: SourceLocation | null;
|
|
296
|
+
}
|
|
282
297
|
|
|
283
298
|
type CompilerPlugins = PluginRegister<CompilationResult> & {
|
|
284
299
|
/**
|
|
@@ -1060,7 +1075,7 @@ interface BaseElementNodeIR {
|
|
|
1060
1075
|
isComponent?: boolean;
|
|
1061
1076
|
isSelfClosing?: boolean;
|
|
1062
1077
|
ref?: string;
|
|
1063
|
-
loc?: SourceLocation;
|
|
1078
|
+
loc?: SourceLocation$1;
|
|
1064
1079
|
}
|
|
1065
1080
|
interface ElementNodeIRMeta {
|
|
1066
1081
|
condition: ConditionMeta;
|
package/lib/compiler-core.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vureact/compiler-core v1.
|
|
2
|
+
* @vureact/compiler-core v1.10.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-ZTNVNBKF.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.10.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 _chunkAOWJPHTSjs = require('./chunk-AOWJPHTS.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -33,4 +33,4 @@ var _chunk4DEDEJYMjs = require('./chunk-4DEDEJYM.js');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
exports.BaseCompiler =
|
|
36
|
+
exports.BaseCompiler = _chunkAOWJPHTSjs.BaseCompiler; exports.CacheKey = _chunkAOWJPHTSjs.CacheKey; exports.FileCompiler = _chunkAOWJPHTSjs.FileCompiler; exports.Helper = _chunkAOWJPHTSjs.Helper; exports.VuReact = _chunkAOWJPHTSjs.VuReact; exports.defineConfig = _chunkAOWJPHTSjs.defineConfig; exports.generate = _chunkAOWJPHTSjs.generate; exports.generateComponent = _chunkAOWJPHTSjs.generateComponent; exports.generateOnlyScript = _chunkAOWJPHTSjs.generateOnlyScript; exports.parse = _chunkAOWJPHTSjs.parse; exports.parseOnlyScript = _chunkAOWJPHTSjs.parseOnlyScript; exports.parseSFC = _chunkAOWJPHTSjs.parseSFC; exports.transform = _chunkAOWJPHTSjs.transform;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vureact/compiler-core",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"description": "A smart compiler for migrating Vue to React",
|
|
5
5
|
"author": "Ruihong Zhong (Ryan John)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"automated-refactoring",
|
|
49
49
|
"cross-framework"
|
|
50
50
|
],
|
|
51
|
-
"homepage": "https://
|
|
51
|
+
"homepage": "https://vureact.top/en",
|
|
52
52
|
"repository": {
|
|
53
53
|
"type": "git",
|
|
54
54
|
"url": "git+https://github.com/vureact-js/core.git",
|