@vureact/compiler-core 1.0.2 → 1.0.4

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.
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9;/**
2
- * @vureact/compiler-core v1.0.2
2
+ * @vureact/compiler-core v1.0.3
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -154,12 +154,19 @@ function convertJsxChildToExpression(nodeIR) {
154
154
  function buildFragmentNode(nodeIR) {
155
155
  return t3.jsxFragment(t3.jsxOpeningFragment(), t3.jsxClosingFragment(), nodeIR);
156
156
  }
157
- function buildTextNode(nodeIR) {
158
- return t3.jsxText(nodeIR);
159
- }
160
157
  function buildJsxExpressionNode(nodeIR) {
161
158
  return t3.jsxExpressionContainer(nodeIR);
162
159
  }
160
+ function buildTextNode(nodeIR) {
161
+ if (/[{}]/.test(nodeIR)) {
162
+ return t3.jsxExpressionContainer(t3.stringLiteral(nodeIR));
163
+ }
164
+ const escapedText = escapeHTML(nodeIR);
165
+ return t3.jsxText(escapedText);
166
+ }
167
+ function escapeHTML(text) {
168
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
169
+ }
163
170
 
164
171
  // src/core/codegen/component/jsx/syntax-processor/process/build-jsx-node.ts
165
172
  function buildJsxNode(nodeIR, ctx) {
@@ -863,6 +870,9 @@ function resolveParam(ctx) {
863
870
  }
864
871
  return;
865
872
  }
873
+ if (!propsTSIface.name) {
874
+ return;
875
+ }
866
876
  const typeIdentifier = t12.identifier(propsTSIface.name);
867
877
  propsIdentifier.typeAnnotation = t12.tsTypeAnnotation(t12.tsTypeReference(typeIdentifier));
868
878
  return propsIdentifier;
@@ -879,7 +889,7 @@ function resolveStatements(local, jsx) {
879
889
  return stmts;
880
890
  }
881
891
  function getHasProps(list) {
882
- return Object.keys(list).length > 0;
892
+ return list.length > 0;
883
893
  }
884
894
 
885
895
  // src/core/codegen/component/script/syntax-processor/process/build-program-preamble.ts
@@ -2954,7 +2964,7 @@ function buildSlotPropSignature(rawName, params, optional) {
2954
2964
  t27.tsTypeReference(t27.identifier(REACT_API_MAP.ReactNode))
2955
2965
  );
2956
2966
  let typeAnnotation;
2957
- if (rawName === SLOT_DEFAULT_NAME && params.length === 0) {
2967
+ if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
2958
2968
  typeAnnotation = reactNodeType;
2959
2969
  } else {
2960
2970
  const fnType = t27.tsFunctionType(null, params, reactNodeType);
@@ -5066,7 +5076,7 @@ function transform(ast, ctx, options) {
5066
5076
  }
5067
5077
 
5068
5078
  // package.json
5069
- var version = "1.0.2";
5079
+ var version = "1.0.3";
5070
5080
  var bin = {
5071
5081
  vureact: "./bin/vureact.js"
5072
5082
  };
@@ -5791,7 +5801,13 @@ var AssetManager = class {
5791
5801
  const filename = _path2.default.basename(p).toLowerCase();
5792
5802
  const ext = _path2.default.extname(p).toLowerCase();
5793
5803
  if (!_optionalChain([this, 'access', _205 => _205.fileCompiler, 'access', _206 => _206.options, 'access', _207 => _207.output, 'optionalAccess', _208 => _208.ignoreAssets])) {
5794
- if (!relativeToRoot.includes(_path2.default.sep) && exclusions.has(filename)) {
5804
+ const shouldExclude = Array.from(exclusions).some((pattern) => {
5805
+ if (pattern.endsWith(".")) {
5806
+ return filename.startsWith(pattern);
5807
+ }
5808
+ return relativeToRoot === pattern || filename === pattern;
5809
+ });
5810
+ if (shouldExclude) {
5795
5811
  return false;
5796
5812
  }
5797
5813
  } else if (exclusions.has(relativeToRoot) || exclusions.has(filename)) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vureact/compiler-core v1.0.2
2
+ * @vureact/compiler-core v1.0.3
3
3
  * (c) 2025-present Ruihong Zhong (Ryan John)
4
4
  * @license MIT
5
5
  */
@@ -154,12 +154,19 @@ import * as t3 from "@babel/types";
154
154
  function buildFragmentNode(nodeIR) {
155
155
  return t3.jsxFragment(t3.jsxOpeningFragment(), t3.jsxClosingFragment(), nodeIR);
156
156
  }
157
- function buildTextNode(nodeIR) {
158
- return t3.jsxText(nodeIR);
159
- }
160
157
  function buildJsxExpressionNode(nodeIR) {
161
158
  return t3.jsxExpressionContainer(nodeIR);
162
159
  }
160
+ function buildTextNode(nodeIR) {
161
+ if (/[{}]/.test(nodeIR)) {
162
+ return t3.jsxExpressionContainer(t3.stringLiteral(nodeIR));
163
+ }
164
+ const escapedText = escapeHTML(nodeIR);
165
+ return t3.jsxText(escapedText);
166
+ }
167
+ function escapeHTML(text) {
168
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
169
+ }
163
170
 
164
171
  // src/core/codegen/component/jsx/syntax-processor/process/build-jsx-node.ts
165
172
  function buildJsxNode(nodeIR, ctx) {
@@ -863,6 +870,9 @@ function resolveParam(ctx) {
863
870
  }
864
871
  return;
865
872
  }
873
+ if (!propsTSIface.name) {
874
+ return;
875
+ }
866
876
  const typeIdentifier = t12.identifier(propsTSIface.name);
867
877
  propsIdentifier.typeAnnotation = t12.tsTypeAnnotation(t12.tsTypeReference(typeIdentifier));
868
878
  return propsIdentifier;
@@ -879,7 +889,7 @@ function resolveStatements(local, jsx) {
879
889
  return stmts;
880
890
  }
881
891
  function getHasProps(list) {
882
- return Object.keys(list).length > 0;
892
+ return list.length > 0;
883
893
  }
884
894
 
885
895
  // src/core/codegen/component/script/syntax-processor/process/build-program-preamble.ts
@@ -2954,7 +2964,7 @@ function buildSlotPropSignature(rawName, params, optional) {
2954
2964
  t27.tsTypeReference(t27.identifier(REACT_API_MAP.ReactNode))
2955
2965
  );
2956
2966
  let typeAnnotation;
2957
- if (rawName === SLOT_DEFAULT_NAME && params.length === 0) {
2967
+ if (rawName === SLOT_DEFAULT_NAME && params.length === 0 || params.length === 0) {
2958
2968
  typeAnnotation = reactNodeType;
2959
2969
  } else {
2960
2970
  const fnType = t27.tsFunctionType(null, params, reactNodeType);
@@ -5066,7 +5076,7 @@ function transform(ast, ctx, options) {
5066
5076
  }
5067
5077
 
5068
5078
  // package.json
5069
- var version = "1.0.2";
5079
+ var version = "1.0.3";
5070
5080
  var bin = {
5071
5081
  vureact: "./bin/vureact.js"
5072
5082
  };
@@ -5791,7 +5801,13 @@ var AssetManager = class {
5791
5801
  const filename = path4.basename(p).toLowerCase();
5792
5802
  const ext = path4.extname(p).toLowerCase();
5793
5803
  if (!this.fileCompiler.options.output?.ignoreAssets) {
5794
- if (!relativeToRoot.includes(path4.sep) && exclusions.has(filename)) {
5804
+ const shouldExclude = Array.from(exclusions).some((pattern) => {
5805
+ if (pattern.endsWith(".")) {
5806
+ return filename.startsWith(pattern);
5807
+ }
5808
+ return relativeToRoot === pattern || filename === pattern;
5809
+ });
5810
+ if (shouldExclude) {
5795
5811
  return false;
5796
5812
  }
5797
5813
  } else if (exclusions.has(relativeToRoot) || exclusions.has(filename)) {
package/lib/cli.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @vureact/compiler-core v1.0.2
3
+ * @vureact/compiler-core v1.0.3
4
4
  * (c) 2025-present Ruihong Zhong (Ryan John)
5
5
  * @license MIT
6
6
  */
@@ -12,7 +12,7 @@ import {
12
12
  calcElapsedTime,
13
13
  normalizePath,
14
14
  version
15
- } from "./chunk-BITJMMDW.esm.js";
15
+ } from "./chunk-VWMAAVDB.esm.js";
16
16
 
17
17
  // src/cli/index.ts
18
18
  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.0.2
3
+ * @vureact/compiler-core v1.0.3
4
4
  * (c) 2025-present Ruihong Zhong (Ryan John)
5
5
  * @license MIT
6
6
  */
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkVW3OOYW6js = require('./chunk-VW3OOYW6.js');
15
+ var _chunk6PSD2CIOjs = require('./chunk-6PSD2CIO.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, _chunkVW3OOYW6js.VuReact)(finalConfig);
31
+ const compiler = new (0, _chunk6PSD2CIOjs.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, _chunkVW3OOYW6js.Helper)(config);
85
+ const cmpHelper = new (0, _chunk6PSD2CIOjs.Helper)(config);
86
86
  const watcher = _chokidar2.default.watch(cmpHelper.getInputPath(), {
87
87
  ignored: cmpHelper.getExcludes(),
88
88
  persistent: true,
@@ -114,7 +114,7 @@ function setupWatcher(compiler, config) {
114
114
  const fn = processors[ext];
115
115
  const unit = await fn(filePath);
116
116
  cmpHelper.printCoreLogs();
117
- cmpHelper.printCompileInfo(filePath, _chunkVW3OOYW6js.calcElapsedTime.call(void 0, startTime));
117
+ cmpHelper.printCompileInfo(filePath, _chunk6PSD2CIOjs.calcElapsedTime.call(void 0, startTime));
118
118
  if (unit) {
119
119
  await _optionalChain([config, 'access', _11 => _11.onChange, 'optionalCall', _12 => _12(event, unit)]);
120
120
  }
@@ -123,7 +123,7 @@ function setupWatcher(compiler, config) {
123
123
  await compiler.processAsset(filePath);
124
124
  cmpHelper.print(
125
125
  _kleur2.default.blue("Copied Asset"),
126
- _kleur2.default.dim(_chunkVW3OOYW6js.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
126
+ _kleur2.default.dim(_chunk6PSD2CIOjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
127
127
  );
128
128
  }
129
129
  spinner.stop();
@@ -134,7 +134,7 @@ function setupWatcher(compiler, config) {
134
134
  await compiler.removeOutputPath(filePath, type2);
135
135
  cmpHelper.print(
136
136
  _kleur2.default.yellow("Removed"),
137
- _kleur2.default.dim(_chunkVW3OOYW6js.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
137
+ _kleur2.default.dim(_chunk6PSD2CIOjs.normalizePath.call(void 0, cmpHelper.relativePath(filePath)))
138
138
  );
139
139
  };
140
140
  if (type === "unlink") {
@@ -163,7 +163,7 @@ function resolveOptions(command) {
163
163
  }
164
164
 
165
165
  // src/cli/index.ts
166
- var [programName] = Object.keys(_chunkVW3OOYW6js.bin);
166
+ var [programName] = Object.keys(_chunk6PSD2CIOjs.bin);
167
167
  var cli = _cac.cac.call(void 0, programName);
168
168
  var buildCommand = cli.command("build [root]", "Compile Vue3 to React (one-time)");
169
169
  resolveOptions(buildCommand).action((root, options) => {
@@ -173,4 +173,4 @@ var watchCommand = cli.command("watch [root]", "Compile Vue3 to React and watch
173
173
  resolveOptions(watchCommand).action((root, options) => {
174
174
  resolveAction(root, { ...options, watch: true });
175
175
  });
176
- cli.help().version(_chunkVW3OOYW6js.version).parse();
176
+ cli.help().version(_chunk6PSD2CIOjs.version).parse();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vureact/compiler-core v1.0.2
2
+ * @vureact/compiler-core v1.0.3
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-BITJMMDW.esm.js";
21
+ } from "./chunk-VWMAAVDB.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.0.2
2
+ * @vureact/compiler-core v1.0.3
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 _chunkVW3OOYW6js = require('./chunk-VW3OOYW6.js');
21
+ var _chunk6PSD2CIOjs = require('./chunk-6PSD2CIO.js');
22
22
 
23
23
 
24
24
 
@@ -33,4 +33,4 @@ var _chunkVW3OOYW6js = require('./chunk-VW3OOYW6.js');
33
33
 
34
34
 
35
35
 
36
- exports.BaseCompiler = _chunkVW3OOYW6js.BaseCompiler; exports.CacheKey = _chunkVW3OOYW6js.CacheKey; exports.FileCompiler = _chunkVW3OOYW6js.FileCompiler; exports.Helper = _chunkVW3OOYW6js.Helper; exports.VuReact = _chunkVW3OOYW6js.VuReact; exports.defineConfig = _chunkVW3OOYW6js.defineConfig; exports.generate = _chunkVW3OOYW6js.generate; exports.generateComponent = _chunkVW3OOYW6js.generateComponent; exports.generateOnlyScript = _chunkVW3OOYW6js.generateOnlyScript; exports.parse = _chunkVW3OOYW6js.parse; exports.parseOnlyScript = _chunkVW3OOYW6js.parseOnlyScript; exports.parseSFC = _chunkVW3OOYW6js.parseSFC; exports.transform = _chunkVW3OOYW6js.transform;
36
+ exports.BaseCompiler = _chunk6PSD2CIOjs.BaseCompiler; exports.CacheKey = _chunk6PSD2CIOjs.CacheKey; exports.FileCompiler = _chunk6PSD2CIOjs.FileCompiler; exports.Helper = _chunk6PSD2CIOjs.Helper; exports.VuReact = _chunk6PSD2CIOjs.VuReact; exports.defineConfig = _chunk6PSD2CIOjs.defineConfig; exports.generate = _chunk6PSD2CIOjs.generate; exports.generateComponent = _chunk6PSD2CIOjs.generateComponent; exports.generateOnlyScript = _chunk6PSD2CIOjs.generateOnlyScript; exports.parse = _chunk6PSD2CIOjs.parse; exports.parseOnlyScript = _chunk6PSD2CIOjs.parseOnlyScript; exports.parseSFC = _chunk6PSD2CIOjs.parseSFC; exports.transform = _chunk6PSD2CIOjs.transform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vureact/compiler-core",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
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",