@vureact/compiler-core 1.1.1 → 1.2.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 +4 -0
- package/README.zh.md +4 -0
- package/lib/{chunk-GWLPQNHN.js → chunk-FCLIDEIZ.js} +1104 -809
- package/lib/{chunk-2ESB4I6I.esm.js → chunk-UJZGDNNB.esm.js} +999 -704
- package/lib/cli.esm.js +1 -1
- package/lib/cli.js +8 -8
- package/lib/compiler-core.d.cts +19 -2
- package/lib/compiler-core.d.ts +19 -2
- package/lib/compiler-core.esm.js +1 -1
- package/lib/compiler-core.js +2 -2
- package/package.json +2 -2
package/lib/cli.esm.js
CHANGED
package/lib/cli.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkFCLIDEIZjs = require('./chunk-FCLIDEIZ.js');
|
|
16
16
|
|
|
17
17
|
// src/cli/index.ts
|
|
18
18
|
var _cac = require('cac');
|
|
@@ -28,7 +28,7 @@ async function resolveAction(root, options) {
|
|
|
28
28
|
const projectRoot = root ? _path2.default.resolve(process.cwd(), root) : process.cwd();
|
|
29
29
|
const userConfig = await loadUserConfig(projectRoot);
|
|
30
30
|
const finalConfig = mergeConfig(projectRoot, options, userConfig);
|
|
31
|
-
const compiler = new (0,
|
|
31
|
+
const compiler = new (0, _chunkFCLIDEIZjs.VuReact)(finalConfig);
|
|
32
32
|
await compiler.execute();
|
|
33
33
|
if (finalConfig.watch) {
|
|
34
34
|
setupWatcher(compiler, finalConfig);
|
|
@@ -82,7 +82,7 @@ function mergeConfig(projectRoot, options, userConfig) {
|
|
|
82
82
|
}
|
|
83
83
|
function setupWatcher(compiler, config) {
|
|
84
84
|
const spinner = _ora2.default.call(void 0, );
|
|
85
|
-
const cmpHelper = new (0,
|
|
85
|
+
const cmpHelper = new (0, _chunkFCLIDEIZjs.Helper)(config);
|
|
86
86
|
const watcher = _chokidar2.default.watch(cmpHelper.getInputPath(), {
|
|
87
87
|
ignored: cmpHelper.getExcludes(),
|
|
88
88
|
persistent: true,
|
|
@@ -117,7 +117,7 @@ function setupWatcher(compiler, config) {
|
|
|
117
117
|
const fn = processors[ext];
|
|
118
118
|
const unit = await fn(filePath);
|
|
119
119
|
cmpHelper.printCoreLogs();
|
|
120
|
-
cmpHelper.printCompileInfo(filePath,
|
|
120
|
+
cmpHelper.printCompileInfo(filePath, _chunkFCLIDEIZjs.calcElapsedTime.call(void 0, startTime));
|
|
121
121
|
if (unit) {
|
|
122
122
|
await _optionalChain([config, 'access', _11 => _11.onChange, 'optionalCall', _12 => _12(event, unit)]);
|
|
123
123
|
}
|
|
@@ -126,7 +126,7 @@ function setupWatcher(compiler, config) {
|
|
|
126
126
|
await compiler.processAsset(filePath);
|
|
127
127
|
cmpHelper.print(
|
|
128
128
|
_kleur2.default.blue("Copied Asset"),
|
|
129
|
-
_kleur2.default.dim(
|
|
129
|
+
_kleur2.default.dim(_chunkFCLIDEIZjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
spinner.stop();
|
|
@@ -139,7 +139,7 @@ function setupWatcher(compiler, config) {
|
|
|
139
139
|
await compiler.removeOutputPath(filePath, type2);
|
|
140
140
|
cmpHelper.print(
|
|
141
141
|
_kleur2.default.yellow("Removed"),
|
|
142
|
-
_kleur2.default.dim(
|
|
142
|
+
_kleur2.default.dim(_chunkFCLIDEIZjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
|
|
143
143
|
);
|
|
144
144
|
};
|
|
145
145
|
if (type === "unlink") {
|
|
@@ -173,7 +173,7 @@ function resolveOptions(command) {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
// src/cli/index.ts
|
|
176
|
-
var [programName] = Object.keys(
|
|
176
|
+
var [programName] = Object.keys(_chunkFCLIDEIZjs.bin);
|
|
177
177
|
var cli = _cac.cac.call(void 0, programName);
|
|
178
178
|
var buildCommand = cli.command("build [root]", "Compile Vue3 to React (one-time)");
|
|
179
179
|
resolveOptions(buildCommand).action((root, options) => {
|
|
@@ -183,4 +183,4 @@ var watchCommand = cli.command("watch [root]", "Compile Vue3 to React and watch
|
|
|
183
183
|
resolveOptions(watchCommand).action((root, options) => {
|
|
184
184
|
resolveAction(root, { ...options, watch: true });
|
|
185
185
|
});
|
|
186
|
-
cli.help().version(
|
|
186
|
+
cli.help().version(_chunkFCLIDEIZjs.version).parse();
|
package/lib/compiler-core.d.cts
CHANGED
|
@@ -18,7 +18,10 @@ interface ICompilationContext {
|
|
|
18
18
|
imports: Map<string, ImportItem[]>;
|
|
19
19
|
cssVars: string[];
|
|
20
20
|
inputType: FileInputType;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* 函数组件的 prop 参数名
|
|
23
|
+
* @default '$props'
|
|
24
|
+
*/
|
|
22
25
|
propField: string;
|
|
23
26
|
/** 是否使用了路由 */
|
|
24
27
|
route?: boolean;
|
|
@@ -29,7 +32,12 @@ interface ICompilationContext {
|
|
|
29
32
|
/** 用于描述 `<slot>` / `<slot name="" ...props>` */
|
|
30
33
|
slots: Record<string, SlotNodesContext>;
|
|
31
34
|
/** 收集模板 ref 对应的 script 绑定元数据 */
|
|
32
|
-
refBindings:
|
|
35
|
+
refBindings: {
|
|
36
|
+
/** 普通 html 元素的 ref */
|
|
37
|
+
domRefs: RefBindings;
|
|
38
|
+
/** 组件的 ref */
|
|
39
|
+
componentRefs: RefBindings;
|
|
40
|
+
};
|
|
33
41
|
/** 收集所有模板中的响应式变量,其来自 script 的绑定元数据 */
|
|
34
42
|
reactiveBindings: ReactiveBindinds;
|
|
35
43
|
};
|
|
@@ -39,6 +47,15 @@ interface ICompilationContext {
|
|
|
39
47
|
provide: ProvideData;
|
|
40
48
|
propsTSIface: IPropsContext;
|
|
41
49
|
source: string;
|
|
50
|
+
/** 是否需要 forwardRef 包装组件 */
|
|
51
|
+
forwardRef: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* forwardRef 函数的第二个参数名
|
|
55
|
+
* @default 'expose'
|
|
56
|
+
*/
|
|
57
|
+
refField: string;
|
|
58
|
+
};
|
|
42
59
|
};
|
|
43
60
|
styleData: {
|
|
44
61
|
filePath: string;
|
package/lib/compiler-core.d.ts
CHANGED
|
@@ -18,7 +18,10 @@ interface ICompilationContext {
|
|
|
18
18
|
imports: Map<string, ImportItem[]>;
|
|
19
19
|
cssVars: string[];
|
|
20
20
|
inputType: FileInputType;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* 函数组件的 prop 参数名
|
|
23
|
+
* @default '$props'
|
|
24
|
+
*/
|
|
22
25
|
propField: string;
|
|
23
26
|
/** 是否使用了路由 */
|
|
24
27
|
route?: boolean;
|
|
@@ -29,7 +32,12 @@ interface ICompilationContext {
|
|
|
29
32
|
/** 用于描述 `<slot>` / `<slot name="" ...props>` */
|
|
30
33
|
slots: Record<string, SlotNodesContext>;
|
|
31
34
|
/** 收集模板 ref 对应的 script 绑定元数据 */
|
|
32
|
-
refBindings:
|
|
35
|
+
refBindings: {
|
|
36
|
+
/** 普通 html 元素的 ref */
|
|
37
|
+
domRefs: RefBindings;
|
|
38
|
+
/** 组件的 ref */
|
|
39
|
+
componentRefs: RefBindings;
|
|
40
|
+
};
|
|
33
41
|
/** 收集所有模板中的响应式变量,其来自 script 的绑定元数据 */
|
|
34
42
|
reactiveBindings: ReactiveBindinds;
|
|
35
43
|
};
|
|
@@ -39,6 +47,15 @@ interface ICompilationContext {
|
|
|
39
47
|
provide: ProvideData;
|
|
40
48
|
propsTSIface: IPropsContext;
|
|
41
49
|
source: string;
|
|
50
|
+
/** 是否需要 forwardRef 包装组件 */
|
|
51
|
+
forwardRef: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* forwardRef 函数的第二个参数名
|
|
55
|
+
* @default 'expose'
|
|
56
|
+
*/
|
|
57
|
+
refField: string;
|
|
58
|
+
};
|
|
42
59
|
};
|
|
43
60
|
styleData: {
|
|
44
61
|
filePath: string;
|
package/lib/compiler-core.esm.js
CHANGED
package/lib/compiler-core.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkFCLIDEIZjs = require('./chunk-FCLIDEIZ.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -33,4 +33,4 @@ var _chunkGWLPQNHNjs = require('./chunk-GWLPQNHN.js');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
exports.BaseCompiler =
|
|
36
|
+
exports.BaseCompiler = _chunkFCLIDEIZjs.BaseCompiler; exports.CacheKey = _chunkFCLIDEIZjs.CacheKey; exports.FileCompiler = _chunkFCLIDEIZjs.FileCompiler; exports.Helper = _chunkFCLIDEIZjs.Helper; exports.VuReact = _chunkFCLIDEIZjs.VuReact; exports.defineConfig = _chunkFCLIDEIZjs.defineConfig; exports.generate = _chunkFCLIDEIZjs.generate; exports.generateComponent = _chunkFCLIDEIZjs.generateComponent; exports.generateOnlyScript = _chunkFCLIDEIZjs.generateOnlyScript; exports.parse = _chunkFCLIDEIZjs.parse; exports.parseOnlyScript = _chunkFCLIDEIZjs.parseOnlyScript; exports.parseSFC = _chunkFCLIDEIZjs.parseSFC; exports.transform = _chunkFCLIDEIZjs.transform;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vureact/compiler-core",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Next Vue to React compiler, compiles Vue 3 syntax into runnable React 18+ code.",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "🌀 Next Vue to React compiler, compiles Vue 3 syntax into runnable React 18+ code.",
|
|
5
5
|
"author": "Ruihong Zhong (Ryan John)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|