@vureact/compiler-core 1.5.2 → 1.6.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/lib/cli.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @vureact/compiler-core v1.5.2
3
+ * @vureact/compiler-core v1.6.1
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-UYTNAOAJ.esm.js";
16
+ } from "./chunk-NXCZJT5W.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.5.2
3
+ * @vureact/compiler-core v1.6.1
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 _chunk37GGS4UWjs = require('./chunk-37GGS4UW.js');
16
+ var _chunkZOTZLL4Ujs = require('./chunk-ZOTZLL4U.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, _chunk37GGS4UWjs.Helper)(config);
79
+ const cmpHelper = new (0, _chunkZOTZLL4Ujs.Helper)(config);
80
80
  const watcher = _chokidar2.default.watch(cmpHelper.getInputPath(), {
81
81
  ignored: cmpHelper.getExcludes(),
82
82
  persistent: true,
@@ -111,7 +111,7 @@ function setupWatcher(compiler, config) {
111
111
  const fn = processors[ext];
112
112
  const unit = await fn(filePath);
113
113
  cmpHelper.printCoreLogs();
114
- cmpHelper.printCompileInfo(filePath, _chunk37GGS4UWjs.calcElapsedTime.call(void 0, startTime));
114
+ cmpHelper.printCompileInfo(filePath, _chunkZOTZLL4Ujs.calcElapsedTime.call(void 0, startTime));
115
115
  if (unit) {
116
116
  await _optionalChain([config, 'access', _5 => _5.onChange, 'optionalCall', _6 => _6(event, unit)]);
117
117
  }
@@ -120,7 +120,7 @@ function setupWatcher(compiler, config) {
120
120
  await compiler.processAsset(filePath);
121
121
  cmpHelper.print(
122
122
  _kleur2.default.blue("Copied Asset"),
123
- _kleur2.default.dim(_chunk37GGS4UWjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
123
+ _kleur2.default.dim(_chunkZOTZLL4Ujs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
124
124
  );
125
125
  }
126
126
  spinner.stop();
@@ -133,7 +133,7 @@ function setupWatcher(compiler, config) {
133
133
  await compiler.removeOutputPath(filePath, type2);
134
134
  cmpHelper.print(
135
135
  _kleur2.default.yellow("Removed"),
136
- _kleur2.default.dim(_chunk37GGS4UWjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
136
+ _kleur2.default.dim(_chunkZOTZLL4Ujs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
137
137
  );
138
138
  };
139
139
  if (type === "unlink") {
@@ -166,7 +166,7 @@ async function resolveAction(root, options) {
166
166
  const projectRoot = root ? _path2.default.resolve(process.cwd(), root) : process.cwd();
167
167
  const userConfig = await loadUserConfig(projectRoot);
168
168
  const finalConfig = mergeConfig(projectRoot, options, userConfig);
169
- const compiler = new (0, _chunk37GGS4UWjs.VuReact)(finalConfig);
169
+ const compiler = new (0, _chunkZOTZLL4Ujs.VuReact)(finalConfig);
170
170
  await compiler.execute();
171
171
  if (finalConfig.watch) {
172
172
  setupWatcher(compiler, finalConfig);
@@ -189,7 +189,7 @@ function resolveOptions(command) {
189
189
 
190
190
 
191
191
  var _updatenotifier = require('update-notifier'); var _updatenotifier2 = _interopRequireDefault(_updatenotifier);
192
- var __dirname = _chunk37GGS4UWjs.getDirname.call(void 0, import.meta.url);
192
+ var __dirname = _chunkZOTZLL4Ujs.getDirname.call(void 0, import.meta.url);
193
193
  function checkForUpdates() {
194
194
  try {
195
195
  const possiblePaths = [
@@ -229,7 +229,7 @@ function checkForUpdates() {
229
229
  }
230
230
 
231
231
  // src/cli/index.ts
232
- var [programName] = Object.keys(_chunk37GGS4UWjs.bin);
232
+ var [programName] = Object.keys(_chunkZOTZLL4Ujs.bin);
233
233
  var cli = _cac.cac.call(void 0, programName);
234
234
  checkForUpdates();
235
235
  var buildCommand = cli.command("build [root]", "Compile Vue3 to React (one-time)");
@@ -240,4 +240,4 @@ var watchCommand = cli.command("watch [root]", "Compile Vue3 to React and watch
240
240
  resolveOptions(watchCommand).action((root, options) => {
241
241
  resolveAction(root, { ...options, watch: true });
242
242
  });
243
- cli.help().version(_chunk37GGS4UWjs.version).parse();
243
+ cli.help().version(_chunkZOTZLL4Ujs.version).parse();
@@ -152,7 +152,6 @@ type ReactiveTypes = 'ref' | 'reactive' | 'indirect' | 'none';
152
152
  interface ICompilationContext {
153
153
  fileId: string;
154
154
  source: string;
155
- compName: string;
156
155
  filename: string;
157
156
  imports: Map<string, ImportItem[]>;
158
157
  cssVars: string[];
@@ -179,13 +178,23 @@ interface ICompilationContext {
179
178
  };
180
179
  /** 收集所有模板中的响应式变量,其来自 script 的绑定元数据 */
181
180
  reactiveBindings: ReactiveBindinds;
181
+ /** defineProps 中声明的属性名 */
182
+ declaredProps: Set<string>;
183
+ /** defineEmits 中声明的事件名 */
184
+ declaredEmits: Set<string>;
185
+ /** useAttrs 的变量声明名 */
186
+ declaredAttrs?: string;
182
187
  };
183
188
  scriptData: {
184
189
  lang: LangType;
185
190
  /** 用于收集 Vue 的 `provide(name, value)` */
186
191
  provide: ProvideData;
192
+ /** 组件 props ts 接口集合 */
187
193
  propsTSIface: IPropsContext;
194
+ /** script 源码 */
188
195
  source: string;
196
+ /** 检测 useAttrs() 调用是否存在 */
197
+ hasUseAttrsCall?: boolean;
189
198
  /** 是否需要 forwardRef 包装组件 */
190
199
  forwardRef: {
191
200
  enabled: boolean;
@@ -195,6 +204,11 @@ interface ICompilationContext {
195
204
  */
196
205
  refField: string;
197
206
  };
207
+ /** defineOptions 中声明的选项 */
208
+ declaredOptions: {
209
+ name?: string;
210
+ inheritAttrs?: boolean;
211
+ };
198
212
  };
199
213
  styleData: {
200
214
  filePath: string;
@@ -1024,6 +1038,7 @@ interface ElementNodeIR extends BaseElementNodeIR {
1024
1038
  }
1025
1039
  interface BaseElementNodeIR {
1026
1040
  tag: string;
1041
+ isRoot?: boolean;
1027
1042
  isComponent?: boolean;
1028
1043
  isSelfClosing?: boolean;
1029
1044
  ref?: string;
@@ -152,7 +152,6 @@ type ReactiveTypes = 'ref' | 'reactive' | 'indirect' | 'none';
152
152
  interface ICompilationContext {
153
153
  fileId: string;
154
154
  source: string;
155
- compName: string;
156
155
  filename: string;
157
156
  imports: Map<string, ImportItem[]>;
158
157
  cssVars: string[];
@@ -179,13 +178,23 @@ interface ICompilationContext {
179
178
  };
180
179
  /** 收集所有模板中的响应式变量,其来自 script 的绑定元数据 */
181
180
  reactiveBindings: ReactiveBindinds;
181
+ /** defineProps 中声明的属性名 */
182
+ declaredProps: Set<string>;
183
+ /** defineEmits 中声明的事件名 */
184
+ declaredEmits: Set<string>;
185
+ /** useAttrs 的变量声明名 */
186
+ declaredAttrs?: string;
182
187
  };
183
188
  scriptData: {
184
189
  lang: LangType;
185
190
  /** 用于收集 Vue 的 `provide(name, value)` */
186
191
  provide: ProvideData;
192
+ /** 组件 props ts 接口集合 */
187
193
  propsTSIface: IPropsContext;
194
+ /** script 源码 */
188
195
  source: string;
196
+ /** 检测 useAttrs() 调用是否存在 */
197
+ hasUseAttrsCall?: boolean;
189
198
  /** 是否需要 forwardRef 包装组件 */
190
199
  forwardRef: {
191
200
  enabled: boolean;
@@ -195,6 +204,11 @@ interface ICompilationContext {
195
204
  */
196
205
  refField: string;
197
206
  };
207
+ /** defineOptions 中声明的选项 */
208
+ declaredOptions: {
209
+ name?: string;
210
+ inheritAttrs?: boolean;
211
+ };
198
212
  };
199
213
  styleData: {
200
214
  filePath: string;
@@ -1024,6 +1038,7 @@ interface ElementNodeIR extends BaseElementNodeIR {
1024
1038
  }
1025
1039
  interface BaseElementNodeIR {
1026
1040
  tag: string;
1041
+ isRoot?: boolean;
1027
1042
  isComponent?: boolean;
1028
1043
  isSelfClosing?: boolean;
1029
1044
  ref?: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vureact/compiler-core v1.5.2
2
+ * @vureact/compiler-core v1.6.1
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-UYTNAOAJ.esm.js";
21
+ } from "./chunk-NXCZJT5W.esm.js";
22
22
  export {
23
23
  BaseCompiler,
24
24
  CacheKey,
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * @vureact/compiler-core v1.5.2
2
+ * @vureact/compiler-core v1.6.1
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 _chunk37GGS4UWjs = require('./chunk-37GGS4UW.js');
21
+ var _chunkZOTZLL4Ujs = require('./chunk-ZOTZLL4U.js');
22
22
 
23
23
 
24
24
 
@@ -33,4 +33,4 @@ var _chunk37GGS4UWjs = require('./chunk-37GGS4UW.js');
33
33
 
34
34
 
35
35
 
36
- exports.BaseCompiler = _chunk37GGS4UWjs.BaseCompiler; exports.CacheKey = _chunk37GGS4UWjs.CacheKey; exports.FileCompiler = _chunk37GGS4UWjs.FileCompiler; exports.Helper = _chunk37GGS4UWjs.Helper; exports.VuReact = _chunk37GGS4UWjs.VuReact; exports.defineConfig = _chunk37GGS4UWjs.defineConfig; exports.generate = _chunk37GGS4UWjs.generate; exports.generateComponent = _chunk37GGS4UWjs.generateComponent; exports.generateOnlyScript = _chunk37GGS4UWjs.generateOnlyScript; exports.parse = _chunk37GGS4UWjs.parse; exports.parseOnlyScript = _chunk37GGS4UWjs.parseOnlyScript; exports.parseSFC = _chunk37GGS4UWjs.parseSFC; exports.transform = _chunk37GGS4UWjs.transform;
36
+ exports.BaseCompiler = _chunkZOTZLL4Ujs.BaseCompiler; exports.CacheKey = _chunkZOTZLL4Ujs.CacheKey; exports.FileCompiler = _chunkZOTZLL4Ujs.FileCompiler; exports.Helper = _chunkZOTZLL4Ujs.Helper; exports.VuReact = _chunkZOTZLL4Ujs.VuReact; exports.defineConfig = _chunkZOTZLL4Ujs.defineConfig; exports.generate = _chunkZOTZLL4Ujs.generate; exports.generateComponent = _chunkZOTZLL4Ujs.generateComponent; exports.generateOnlyScript = _chunkZOTZLL4Ujs.generateOnlyScript; exports.parse = _chunkZOTZLL4Ujs.parse; exports.parseOnlyScript = _chunkZOTZLL4Ujs.parseOnlyScript; exports.parseSFC = _chunkZOTZLL4Ujs.parseSFC; exports.transform = _chunkZOTZLL4Ujs.transform;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vureact/compiler-core",
3
- "version": "1.5.2",
4
- "description": "🌀 Semantic-aware Vue 3 to React 18+ compiler for progressive migration.",
3
+ "version": "1.6.1",
4
+ "description": " Write in Vue 3, compile to React 18+ code.",
5
5
  "author": "Ruihong Zhong (Ryan John)",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -94,6 +94,6 @@
94
94
  "xxhashjs": "^0.2.2"
95
95
  },
96
96
  "engines": {
97
- "node": ">=14.0.0"
97
+ "node": ">=19.0.0"
98
98
  }
99
99
  }