@vureact/compiler-core 1.6.1 → 1.6.2
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; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13;/**
|
|
2
|
-
* @vureact/compiler-core v1.6.
|
|
2
|
+
* @vureact/compiler-core v1.6.2
|
|
3
3
|
* (c) 2025-present Ruihong Zhong (Ryan John)
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -39,7 +39,7 @@ var RUNTIME_PACKAGES = {
|
|
|
39
39
|
},
|
|
40
40
|
runtime: {
|
|
41
41
|
name: PACKAGE_NAME.runtime,
|
|
42
|
-
version: "^1.0
|
|
42
|
+
version: "^1.1.0"
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
var STYLE_MODULE_NAME = "$style";
|
|
@@ -5552,14 +5552,30 @@ function collectComponentRef(tag, ctx) {
|
|
|
5552
5552
|
|
|
5553
5553
|
|
|
5554
5554
|
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
const
|
|
5555
|
+
|
|
5556
|
+
function resolveTemplateNodeKey(templNode, keyContent, ctx) {
|
|
5557
|
+
const { filename, source } = ctx;
|
|
5558
|
+
const { children, loc } = templNode;
|
|
5559
|
+
if (children.length > 1) {
|
|
5560
|
+
logger.warn(
|
|
5561
|
+
"Expected <template> with `:key` to have a single parent element; otherwise, the key cannot be transferred to the first child.",
|
|
5562
|
+
{
|
|
5563
|
+
file: filename,
|
|
5564
|
+
source,
|
|
5565
|
+
loc
|
|
5566
|
+
}
|
|
5567
|
+
);
|
|
5568
|
+
return;
|
|
5569
|
+
}
|
|
5570
|
+
const [firstChild] = children;
|
|
5571
|
+
if (_optionalChain([firstChild, 'optionalAccess', _182 => _182.type]) !== _compilercore.NodeTypes.ELEMENT || firstChild.tagType === _compilercore.ElementTypes.TEMPLATE || firstChild.tagType === _compilercore.ElementTypes.SLOT) {
|
|
5572
|
+
return;
|
|
5573
|
+
}
|
|
5574
|
+
const hasKeyProp = firstChild.props.some(
|
|
5559
5575
|
(p) => p.type === _compilercore.NodeTypes.DIRECTIVE && p.name === "key"
|
|
5560
5576
|
);
|
|
5561
5577
|
if (hasKeyProp) return;
|
|
5562
|
-
|
|
5578
|
+
firstChild.props.push(createSimpleVueBind("key", keyContent));
|
|
5563
5579
|
}
|
|
5564
5580
|
function createSimpleVueBind(name, value) {
|
|
5565
5581
|
return {
|
|
@@ -5589,8 +5605,8 @@ function createSimpleVueBind(name, value) {
|
|
|
5589
5605
|
function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
|
|
5590
5606
|
const arg = directive.arg;
|
|
5591
5607
|
const exp = directive.exp;
|
|
5592
|
-
const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess',
|
|
5593
|
-
const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess',
|
|
5608
|
+
const name = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _183 => _183.content]), () => ( ""));
|
|
5609
|
+
const content = _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _184 => _184.content]), () => ( "true"));
|
|
5594
5610
|
warnUnsupportedVueDollarVar(ctx, directive);
|
|
5595
5611
|
if (name === "is") {
|
|
5596
5612
|
resolveDynamicIsProp(directive, ir, ctx, nodeIR);
|
|
@@ -5601,11 +5617,11 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
|
|
|
5601
5617
|
return;
|
|
5602
5618
|
}
|
|
5603
5619
|
if (vueNode.tag === "template" && name === "key") {
|
|
5604
|
-
resolveTemplateNodeKey(vueNode, content);
|
|
5620
|
+
resolveTemplateNodeKey(vueNode, content, ctx);
|
|
5605
5621
|
return;
|
|
5606
5622
|
}
|
|
5607
5623
|
const propIR = createPropsIR(directive.rawName, name, content);
|
|
5608
|
-
propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess',
|
|
5624
|
+
propIR.isStatic = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _185 => _185.isStatic]), () => ( true));
|
|
5609
5625
|
checkPropIsDynamicKey(ctx, directive);
|
|
5610
5626
|
resolvePropertyIR(propIR, ir, ctx, nodeIR, true);
|
|
5611
5627
|
}
|
|
@@ -5644,7 +5660,7 @@ function normalizeString(s) {
|
|
|
5644
5660
|
// src/core/transform/sfc/template/syntax-processor/process/props/resolve-attribute-prop.ts
|
|
5645
5661
|
function resolveAttributeProp(attribute, ir, ctx, nodeIR) {
|
|
5646
5662
|
const name = attribute.name;
|
|
5647
|
-
const content = _nullishCoalesce(_optionalChain([attribute, 'access',
|
|
5663
|
+
const content = _nullishCoalesce(_optionalChain([attribute, 'access', _186 => _186.value, 'optionalAccess', _187 => _187.content]), () => ( "true"));
|
|
5648
5664
|
if (name === "is") {
|
|
5649
5665
|
resolveStaticIsProp(content, ir, ctx, nodeIR);
|
|
5650
5666
|
return;
|
|
@@ -5739,10 +5755,10 @@ function resolveRouterLinkVSlotProp(directive, nodeIR, ctx) {
|
|
|
5739
5755
|
type: 2 /* SLOT */,
|
|
5740
5756
|
name: "customRender",
|
|
5741
5757
|
rawName: _nullishCoalesce(directive.rawName, () => ( "v-slot")),
|
|
5742
|
-
isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess',
|
|
5758
|
+
isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _188 => _188.isStatic]), () => ( true)),
|
|
5743
5759
|
isScoped: true,
|
|
5744
5760
|
callback: {
|
|
5745
|
-
arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess',
|
|
5761
|
+
arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _189 => _189.content, 'optionalAccess', _190 => _190.trim, 'call', _191 => _191()]), () => ( "")),
|
|
5746
5762
|
exp: []
|
|
5747
5763
|
}
|
|
5748
5764
|
};
|
|
@@ -5758,10 +5774,10 @@ function resolveVFor(directive, ir, ctx, nodeIR) {
|
|
|
5758
5774
|
};
|
|
5759
5775
|
}
|
|
5760
5776
|
function resolveForResult(forParseResult) {
|
|
5761
|
-
const source = _optionalChain([forParseResult, 'access',
|
|
5762
|
-
const value = _optionalChain([forParseResult, 'access',
|
|
5763
|
-
const index = _optionalChain([forParseResult, 'access',
|
|
5764
|
-
const key = _optionalChain([forParseResult, 'access',
|
|
5777
|
+
const source = _optionalChain([forParseResult, 'access', _192 => _192.source, 'optionalAccess', _193 => _193.content]);
|
|
5778
|
+
const value = _optionalChain([forParseResult, 'access', _194 => _194.value, 'optionalAccess', _195 => _195.content]);
|
|
5779
|
+
const index = _optionalChain([forParseResult, 'access', _196 => _196.index, 'optionalAccess', _197 => _197.content]);
|
|
5780
|
+
const key = _optionalChain([forParseResult, 'access', _198 => _198.key, 'optionalAccess', _199 => _199.content]);
|
|
5765
5781
|
return {
|
|
5766
5782
|
source,
|
|
5767
5783
|
value,
|
|
@@ -5781,7 +5797,7 @@ function resolveVHtml(directive, ir, ctx, nodeIR) {
|
|
|
5781
5797
|
// src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-if.ts
|
|
5782
5798
|
function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
|
|
5783
5799
|
const name = directive.name === "else-if" ? "elseIf" : directive.name;
|
|
5784
|
-
const value = _nullishCoalesce(_optionalChain([directive, 'access',
|
|
5800
|
+
const value = _nullishCoalesce(_optionalChain([directive, 'access', _200 => _200.exp, 'optionalAccess', _201 => _201.content]), () => ( "true"));
|
|
5785
5801
|
const prevNode = siblingNodesIR[siblingNodesIR.length - 1];
|
|
5786
5802
|
const isElseBranch = name === "else" || name === "elseIf";
|
|
5787
5803
|
let hasError = false;
|
|
@@ -5820,7 +5836,7 @@ function resolveVIf(directive, ir, ctx, nodeIR, siblingNodesIR) {
|
|
|
5820
5836
|
// src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-memo.ts
|
|
5821
5837
|
function resolveVMemo(directive, _ir, ctx, nodeIR) {
|
|
5822
5838
|
const exp = directive.exp;
|
|
5823
|
-
let value = _optionalChain([exp, 'optionalAccess',
|
|
5839
|
+
let value = _optionalChain([exp, 'optionalAccess', _202 => _202.content]);
|
|
5824
5840
|
if (value !== void 0) {
|
|
5825
5841
|
if (!value.trim() || !value.startsWith("[") && !value.endsWith("]")) {
|
|
5826
5842
|
const { source, filename } = ctx;
|
|
@@ -5860,14 +5876,14 @@ function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
|
|
|
5860
5876
|
const getterName = exp.content;
|
|
5861
5877
|
const isComponent = vueNode.tagType === _compilercore.ElementTypes.COMPONENT;
|
|
5862
5878
|
const inputType = resolveHtmlInput(vueNode, isComponent);
|
|
5863
|
-
const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess',
|
|
5879
|
+
const propName = _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _203 => _203.content]), () => ( resolveModelPropName(inputType, isComponent)));
|
|
5864
5880
|
let valuePropIR;
|
|
5865
5881
|
let eventPropIR;
|
|
5866
5882
|
if (isComponent) {
|
|
5867
5883
|
valuePropIR = createPropsIR("v-model", propName, getterName);
|
|
5868
5884
|
const eventReactName = `onUpdate${capitalize(camelCase(propName))}`;
|
|
5869
5885
|
const eventVueName = `update:${propName}`;
|
|
5870
|
-
const isTS = _optionalChain([ctx, 'access',
|
|
5886
|
+
const isTS = _optionalChain([ctx, 'access', _204 => _204.scriptData, 'optionalAccess', _205 => _205.lang, 'optionalAccess', _206 => _206.startsWith, 'call', _207 => _207("ts")]);
|
|
5871
5887
|
const valueArg = isTS ? "value: any" : "value";
|
|
5872
5888
|
const processedValue = applyValueModifiers("value", modifiers);
|
|
5873
5889
|
const handlerBody = `(${valueArg}) => { ${getterName} = ${processedValue} }`;
|
|
@@ -5905,7 +5921,7 @@ function getRadioValue(vueNode) {
|
|
|
5905
5921
|
const valueAttr = vueNode.props.find(
|
|
5906
5922
|
(prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "value"
|
|
5907
5923
|
);
|
|
5908
|
-
if (!_optionalChain([valueAttr, 'optionalAccess',
|
|
5924
|
+
if (!_optionalChain([valueAttr, 'optionalAccess', _208 => _208.value, 'optionalAccess', _209 => _209.content])) return '""';
|
|
5909
5925
|
const content = valueAttr.value.content;
|
|
5910
5926
|
return /^['"]/.test(content) ? content : `"${content}"`;
|
|
5911
5927
|
}
|
|
@@ -5915,7 +5931,7 @@ function resolveHtmlInput(node, isComponent) {
|
|
|
5915
5931
|
const typeProp = node.props.find(
|
|
5916
5932
|
(prop) => prop.type === _compilercore.NodeTypes.ATTRIBUTE && prop.name === "type"
|
|
5917
5933
|
);
|
|
5918
|
-
return _optionalChain([typeProp, 'optionalAccess',
|
|
5934
|
+
return _optionalChain([typeProp, 'optionalAccess', _210 => _210.value, 'optionalAccess', _211 => _211.content, 'optionalAccess', _212 => _212.toLowerCase, 'call', _213 => _213()]);
|
|
5919
5935
|
}
|
|
5920
5936
|
function applyValueModifiers(valueExp, modifiers) {
|
|
5921
5937
|
let result = valueExp;
|
|
@@ -6000,7 +6016,7 @@ function resolveVSlotProp(directive, ir, ctx) {
|
|
|
6000
6016
|
const name = !arg || arg.content === "default" ? "children" : arg.content;
|
|
6001
6017
|
const content = !isScoped ? [] : void 0;
|
|
6002
6018
|
const callback = isScoped ? {
|
|
6003
|
-
arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess',
|
|
6019
|
+
arg: _nullishCoalesce(_optionalChain([exp, 'optionalAccess', _214 => _214.content, 'optionalAccess', _215 => _215.trim, 'call', _216 => _216()]), () => ( "")),
|
|
6004
6020
|
exp: []
|
|
6005
6021
|
} : void 0;
|
|
6006
6022
|
checkPropIsDynamicKey(ctx, directive);
|
|
@@ -6008,7 +6024,7 @@ function resolveVSlotProp(directive, ir, ctx) {
|
|
|
6008
6024
|
type: 2 /* SLOT */,
|
|
6009
6025
|
name,
|
|
6010
6026
|
rawName: _nullishCoalesce(directive.rawName, () => ( "default")),
|
|
6011
|
-
isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess',
|
|
6027
|
+
isStatic: _nullishCoalesce(_optionalChain([arg, 'optionalAccess', _217 => _217.isStatic]), () => ( true)),
|
|
6012
6028
|
isScoped,
|
|
6013
6029
|
content,
|
|
6014
6030
|
callback
|
|
@@ -6071,7 +6087,7 @@ function resolveElementNode(node, ir, ctx, siblingNodesIR) {
|
|
|
6071
6087
|
if (routerAdapter) {
|
|
6072
6088
|
if (!ctx.route) ctx.route = true;
|
|
6073
6089
|
nodeIR.isRoute = true;
|
|
6074
|
-
recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess',
|
|
6090
|
+
recordImport(ctx, _optionalChain([routerAdapter, 'optionalAccess', _218 => _218.package]), routerAdapter.target);
|
|
6075
6091
|
}
|
|
6076
6092
|
resolveProps(node, ir, ctx, nodeIR, siblingNodesIR);
|
|
6077
6093
|
return nodeIR;
|
|
@@ -6218,7 +6234,7 @@ function resolveSlotProps(node, ctx) {
|
|
|
6218
6234
|
for (const prop of node.props) {
|
|
6219
6235
|
if (prop.type === _compilercore.NodeTypes.ATTRIBUTE) {
|
|
6220
6236
|
const attr = prop.name;
|
|
6221
|
-
const value = _optionalChain([prop, 'access',
|
|
6237
|
+
const value = _optionalChain([prop, 'access', _219 => _219.value, 'optionalAccess', _220 => _220.content, 'access', _221 => _221.trim, 'call', _222 => _222()]);
|
|
6222
6238
|
if (attr === "name" && value) {
|
|
6223
6239
|
result.name = camelCase(value);
|
|
6224
6240
|
} else {
|
|
@@ -6308,19 +6324,19 @@ function resolveTemplate2(root, ctx) {
|
|
|
6308
6324
|
// src/core/transform/sfc/index.ts
|
|
6309
6325
|
function transform(ast, ctx, options) {
|
|
6310
6326
|
const { template, script, style } = ast;
|
|
6311
|
-
const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess',
|
|
6312
|
-
const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess',
|
|
6327
|
+
const templateIR = resolveTemplate2(_optionalChain([template, 'optionalAccess', _223 => _223.ast]), ctx);
|
|
6328
|
+
const scriptIR = resolveScript2(_optionalChain([script, 'optionalAccess', _224 => _224.ast]), ctx);
|
|
6313
6329
|
const result = {
|
|
6314
6330
|
template: templateIR,
|
|
6315
6331
|
script: scriptIR,
|
|
6316
|
-
style: _optionalChain([style, 'optionalAccess',
|
|
6332
|
+
style: _optionalChain([style, 'optionalAccess', _225 => _225.source, 'optionalAccess', _226 => _226.content])
|
|
6317
6333
|
};
|
|
6318
|
-
executePlugins(_optionalChain([options, 'optionalAccess',
|
|
6334
|
+
executePlugins(_optionalChain([options, 'optionalAccess', _227 => _227.plugins]), result, ctx);
|
|
6319
6335
|
return result;
|
|
6320
6336
|
}
|
|
6321
6337
|
|
|
6322
6338
|
// package.json
|
|
6323
|
-
var version = "1.6.
|
|
6339
|
+
var version = "1.6.2";
|
|
6324
6340
|
var bin = {
|
|
6325
6341
|
vureact: "./bin/vureact.js"
|
|
6326
6342
|
};
|
|
@@ -6514,7 +6530,7 @@ var Helper = (_class5 = class {
|
|
|
6514
6530
|
__init8() {this.outDir = "react-app"}
|
|
6515
6531
|
constructor(opts) {;_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);
|
|
6516
6532
|
this.compilerOpts = opts;
|
|
6517
|
-
if (_optionalChain([opts, 'access',
|
|
6533
|
+
if (_optionalChain([opts, 'access', _228 => _228.output, 'optionalAccess', _229 => _229.workspace])) {
|
|
6518
6534
|
this.workspaceDir = opts.output.workspace;
|
|
6519
6535
|
}
|
|
6520
6536
|
const excludePatterns = PathFilter.withDefaults(opts.exclude || []);
|
|
@@ -6551,7 +6567,7 @@ var Helper = (_class5 = class {
|
|
|
6551
6567
|
}
|
|
6552
6568
|
getOutDirName() {
|
|
6553
6569
|
const { output } = this.compilerOpts;
|
|
6554
|
-
return _optionalChain([output, 'optionalAccess',
|
|
6570
|
+
return _optionalChain([output, 'optionalAccess', _230 => _230.outDir]) || this.outDir;
|
|
6555
6571
|
}
|
|
6556
6572
|
getWorkspaceDir() {
|
|
6557
6573
|
return _path2.default.resolve(this.getProjectRoot(), this.workspaceDir);
|
|
@@ -6565,7 +6581,7 @@ var Helper = (_class5 = class {
|
|
|
6565
6581
|
}
|
|
6566
6582
|
getIgnoreAssets() {
|
|
6567
6583
|
const { output } = this.compilerOpts;
|
|
6568
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
6584
|
+
if (_optionalChain([output, 'optionalAccess', _231 => _231.ignoreAssets])) {
|
|
6569
6585
|
return new Set(output.ignoreAssets.map(normalizePath));
|
|
6570
6586
|
}
|
|
6571
6587
|
return /* @__PURE__ */ new Set([
|
|
@@ -6648,12 +6664,12 @@ var Helper = (_class5 = class {
|
|
|
6648
6664
|
*/
|
|
6649
6665
|
async formatCode({ code, fileInfo }) {
|
|
6650
6666
|
const { format } = this.compilerOpts;
|
|
6651
|
-
if (!_optionalChain([format, 'optionalAccess',
|
|
6652
|
-
if (_optionalChain([format, 'optionalAccess',
|
|
6667
|
+
if (!_optionalChain([format, 'optionalAccess', _232 => _232.enabled])) return code;
|
|
6668
|
+
if (_optionalChain([format, 'optionalAccess', _233 => _233.formatter]) === "builtin") {
|
|
6653
6669
|
return simpleFormat(code);
|
|
6654
6670
|
}
|
|
6655
|
-
const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess',
|
|
6656
|
-
return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess',
|
|
6671
|
+
const { lang } = _nullishCoalesce(_optionalChain([fileInfo, 'optionalAccess', _234 => _234.jsx]), () => ( _optionalChain([fileInfo, 'optionalAccess', _235 => _235.script])));
|
|
6672
|
+
return await formatWithPrettier(code, lang, _optionalChain([format, 'optionalAccess', _236 => _236.prettierOptions]));
|
|
6657
6673
|
}
|
|
6658
6674
|
/**
|
|
6659
6675
|
* 通用的缓存校验工具函数
|
|
@@ -6687,7 +6703,7 @@ var Helper = (_class5 = class {
|
|
|
6687
6703
|
* @param options.lock - 是否启用文件锁(默认false)
|
|
6688
6704
|
*/
|
|
6689
6705
|
async writeFileWithDir(filePath, content, options) {
|
|
6690
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6706
|
+
if (_optionalChain([options, 'optionalAccess', _237 => _237.lock])) {
|
|
6691
6707
|
await fileLock.updateFile(filePath, async () => content, options);
|
|
6692
6708
|
} else {
|
|
6693
6709
|
await _fs2.default.promises.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
@@ -6812,7 +6828,7 @@ var Helper = (_class5 = class {
|
|
|
6812
6828
|
* 获取需要排除编译的文件
|
|
6813
6829
|
*/
|
|
6814
6830
|
getExcludes() {
|
|
6815
|
-
if (!_optionalChain([this, 'access',
|
|
6831
|
+
if (!_optionalChain([this, 'access', _238 => _238.compilerOpts, 'access', _239 => _239.exclude, 'optionalAccess', _240 => _240.length])) {
|
|
6816
6832
|
return PathFilter.withDefaults();
|
|
6817
6833
|
}
|
|
6818
6834
|
return this.compilerOpts.exclude;
|
|
@@ -6910,7 +6926,7 @@ function parseOnlyStyle(source, ctx, options) {
|
|
|
6910
6926
|
ast: void 0
|
|
6911
6927
|
}
|
|
6912
6928
|
};
|
|
6913
|
-
executePlugins(_optionalChain([options, 'optionalAccess',
|
|
6929
|
+
executePlugins(_optionalChain([options, 'optionalAccess', _241 => _241.plugins]), result, ctx);
|
|
6914
6930
|
return result;
|
|
6915
6931
|
}
|
|
6916
6932
|
|
|
@@ -7044,16 +7060,16 @@ var BaseCompiler = (_class7 = class extends Helper {
|
|
|
7044
7060
|
});
|
|
7045
7061
|
const genOptions = this.prepareGenerateOptions(filename);
|
|
7046
7062
|
const resolveSFCAndScriptFile = () => {
|
|
7047
|
-
const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess',
|
|
7048
|
-
const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess',
|
|
7063
|
+
const ast = parse(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _242 => _242.parser]) });
|
|
7064
|
+
const ir = transform(ast, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _243 => _243.transformer]) });
|
|
7049
7065
|
const gen = generate(ir, ctx.data, {
|
|
7050
7066
|
...genOptions,
|
|
7051
|
-
plugins: _optionalChain([plugins, 'optionalAccess',
|
|
7067
|
+
plugins: _optionalChain([plugins, 'optionalAccess', _244 => _244.codegen])
|
|
7052
7068
|
});
|
|
7053
7069
|
return this.resolveMainResult(ir, gen, ctx.data);
|
|
7054
7070
|
};
|
|
7055
7071
|
const resolveStyleFile = () => {
|
|
7056
|
-
const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess',
|
|
7072
|
+
const result = parseOnlyStyle(source, ctx.data, { plugins: _optionalChain([plugins, 'optionalAccess', _245 => _245.parser]) });
|
|
7057
7073
|
return this.resolveStyleResult(result, ctx.data);
|
|
7058
7074
|
};
|
|
7059
7075
|
try {
|
|
@@ -7092,9 +7108,9 @@ var BaseCompiler = (_class7 = class extends Helper {
|
|
|
7092
7108
|
lang
|
|
7093
7109
|
},
|
|
7094
7110
|
css: {
|
|
7095
|
-
file: _optionalChain([styleData, 'optionalAccess',
|
|
7096
|
-
hash: _optionalChain([styleData, 'optionalAccess',
|
|
7097
|
-
code: _optionalChain([ir, 'optionalAccess',
|
|
7111
|
+
file: _optionalChain([styleData, 'optionalAccess', _246 => _246.filePath]),
|
|
7112
|
+
hash: _optionalChain([styleData, 'optionalAccess', _247 => _247.scopeId]),
|
|
7113
|
+
code: _optionalChain([ir, 'optionalAccess', _248 => _248.style])
|
|
7098
7114
|
}
|
|
7099
7115
|
},
|
|
7100
7116
|
...base
|
|
@@ -7164,7 +7180,7 @@ var AssetManager = (_class8 = class {
|
|
|
7164
7180
|
const relativeToRoot = normalizePath(this.fileCompiler.relativePath(p));
|
|
7165
7181
|
const filename = _path2.default.basename(p).toLowerCase();
|
|
7166
7182
|
const ext = _path2.default.extname(p).toLowerCase();
|
|
7167
|
-
if (!_optionalChain([options, 'access',
|
|
7183
|
+
if (!_optionalChain([options, 'access', _249 => _249.output, 'optionalAccess', _250 => _250.ignoreAssets])) {
|
|
7168
7184
|
const shouldExclude = Array.from(exclusions).some((pattern) => {
|
|
7169
7185
|
if (pattern.endsWith(".")) {
|
|
7170
7186
|
return filename.startsWith(pattern);
|
|
@@ -7261,12 +7277,12 @@ var CacheManager = (_class9 = class {
|
|
|
7261
7277
|
const meta = { ...unit };
|
|
7262
7278
|
delete meta.source;
|
|
7263
7279
|
if (key === "sfc" /* SFC */) {
|
|
7264
|
-
_optionalChainDelete([meta, 'access',
|
|
7265
|
-
_optionalChainDelete([meta, 'access',
|
|
7280
|
+
_optionalChainDelete([meta, 'access', _251 => _251.output, 'optionalAccess', _252 => _252.jsx, 'access', _253 => delete _253.code]);
|
|
7281
|
+
_optionalChainDelete([meta, 'access', _254 => _254.output, 'optionalAccess', _255 => _255.css, 'access', _256 => delete _256.code]);
|
|
7266
7282
|
} else if (key === "script" /* SCRIPT */) {
|
|
7267
|
-
_optionalChainDelete([meta, 'access',
|
|
7283
|
+
_optionalChainDelete([meta, 'access', _257 => _257.output, 'optionalAccess', _258 => _258.script, 'access', _259 => delete _259.code]);
|
|
7268
7284
|
} else if (key === "style" /* STYLE */) {
|
|
7269
|
-
_optionalChainDelete([meta, 'access',
|
|
7285
|
+
_optionalChainDelete([meta, 'access', _260 => _260.output, 'optionalAccess', _261 => _261.style, 'access', _262 => delete _262.code]);
|
|
7270
7286
|
}
|
|
7271
7287
|
if (!this.pendingUpdates.has(key)) {
|
|
7272
7288
|
this.pendingUpdates.set(key, []);
|
|
@@ -7336,7 +7352,7 @@ var CleanupManager = class {
|
|
|
7336
7352
|
meta = m;
|
|
7337
7353
|
const { jsx, css } = meta.output;
|
|
7338
7354
|
await this.fileCompiler.removeOutputFile(jsx.file);
|
|
7339
|
-
if (_optionalChain([css, 'optionalAccess',
|
|
7355
|
+
if (_optionalChain([css, 'optionalAccess', _263 => _263.file])) {
|
|
7340
7356
|
await this.fileCompiler.removeOutputFile(css.file);
|
|
7341
7357
|
}
|
|
7342
7358
|
break;
|
|
@@ -7397,7 +7413,7 @@ var CompilationUnitProcessor = class {
|
|
|
7397
7413
|
const isScriptFile = key === "script" /* SCRIPT */;
|
|
7398
7414
|
const isStyleFile = key === "style" /* STYLE */;
|
|
7399
7415
|
if (isSFC || isScriptFile) {
|
|
7400
|
-
unit.hasRoute = _optionalChain([result, 'optionalAccess',
|
|
7416
|
+
unit.hasRoute = _optionalChain([result, 'optionalAccess', _264 => _264.hasRoute]);
|
|
7401
7417
|
}
|
|
7402
7418
|
const resolveFileInfo = () => {
|
|
7403
7419
|
if (isSFC) {
|
|
@@ -7417,7 +7433,7 @@ var CompilationUnitProcessor = class {
|
|
|
7417
7433
|
const { script } = result.fileInfo;
|
|
7418
7434
|
unit.output = {
|
|
7419
7435
|
script: {
|
|
7420
|
-
file: _optionalChain([script, 'optionalAccess',
|
|
7436
|
+
file: _optionalChain([script, 'optionalAccess', _265 => _265.file]),
|
|
7421
7437
|
code
|
|
7422
7438
|
}
|
|
7423
7439
|
};
|
|
@@ -7494,7 +7510,7 @@ var FileProcessor = (_class10 = class {
|
|
|
7494
7510
|
const absPath = this.fileCompiler.getAbsPath(filePath);
|
|
7495
7511
|
const fileMeta = await this.fileCompiler.getFileMeta(absPath);
|
|
7496
7512
|
const cache = (this.fileCompiler.getIsCache() ? existingCache : void 0) || await this.fileCompiler.loadCache(key);
|
|
7497
|
-
const record = _optionalChain([cache, 'optionalAccess',
|
|
7513
|
+
const record = _optionalChain([cache, 'optionalAccess', _266 => _266.target, 'access', _267 => _267.find, 'call', _268 => _268((c) => c.file === absPath)]);
|
|
7498
7514
|
const { shouldCompile, hash } = await this.fileCompiler.checkCacheStatus(
|
|
7499
7515
|
fileMeta,
|
|
7500
7516
|
record,
|
|
@@ -7516,10 +7532,10 @@ var FileProcessor = (_class10 = class {
|
|
|
7516
7532
|
hash: hash || this.fileCompiler.genHash(source)
|
|
7517
7533
|
};
|
|
7518
7534
|
const processed = await this.compilationUnitProcessor.resolve(initUnit, key);
|
|
7519
|
-
if (_optionalChain([processed, 'optionalAccess',
|
|
7535
|
+
if (_optionalChain([processed, 'optionalAccess', _269 => _269.output])) {
|
|
7520
7536
|
await this.compilationUnitProcessor.saveCompiledFiles(processed, key);
|
|
7521
7537
|
if (key === "sfc" /* SFC */ || key === "script" /* SCRIPT */) {
|
|
7522
|
-
if (_optionalChain([processed, 'optionalAccess',
|
|
7538
|
+
if (_optionalChain([processed, 'optionalAccess', _270 => _270.hasRoute])) {
|
|
7523
7539
|
await this.addRouterToPackageJson();
|
|
7524
7540
|
await this.updateEntryWithRouterProvider();
|
|
7525
7541
|
}
|
|
@@ -7533,13 +7549,13 @@ var FileProcessor = (_class10 = class {
|
|
|
7533
7549
|
*/
|
|
7534
7550
|
async addRouterToPackageJson() {
|
|
7535
7551
|
const { output } = this.fileCompiler.options;
|
|
7536
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
7552
|
+
if (_optionalChain([output, 'optionalAccess', _271 => _271.bootstrapVite]) === false) {
|
|
7537
7553
|
return;
|
|
7538
7554
|
}
|
|
7539
7555
|
const { router } = RUNTIME_PACKAGES;
|
|
7540
7556
|
const filePath = this.fileCompiler.getOutputPkgPath();
|
|
7541
7557
|
const packageJson = await this.fileCompiler.resolvePackageFile(filePath);
|
|
7542
|
-
if (_optionalChain([packageJson, 'optionalAccess',
|
|
7558
|
+
if (_optionalChain([packageJson, 'optionalAccess', _272 => _272.dependencies, 'optionalAccess', _273 => _273[router.name]])) {
|
|
7543
7559
|
return;
|
|
7544
7560
|
}
|
|
7545
7561
|
if (!packageJson.dependencies) {
|
|
@@ -7558,7 +7574,7 @@ var FileProcessor = (_class10 = class {
|
|
|
7558
7574
|
const { exclude, output, router } = this.fileCompiler.options;
|
|
7559
7575
|
const inputPath = this.fileCompiler.getInputPath();
|
|
7560
7576
|
const outputPath = this.fileCompiler.getOuputPath(true);
|
|
7561
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
7577
|
+
if (_optionalChain([output, 'optionalAccess', _274 => _274.bootstrapVite]) === false || _optionalChain([router, 'optionalAccess', _275 => _275.autoUpdateEntry]) === false || !_optionalChain([router, 'optionalAccess', _276 => _276.configFile])) {
|
|
7562
7578
|
return;
|
|
7563
7579
|
}
|
|
7564
7580
|
const getMainFile = async (filename) => {
|
|
@@ -7579,7 +7595,7 @@ var FileProcessor = (_class10 = class {
|
|
|
7579
7595
|
const prepareRouterEntry = () => {
|
|
7580
7596
|
const importPath = this.fileCompiler.resolveRelativePath(inputPath, router.configFile);
|
|
7581
7597
|
let content = fileData.content;
|
|
7582
|
-
if (_optionalChain([exclude, 'optionalAccess',
|
|
7598
|
+
if (_optionalChain([exclude, 'optionalAccess', _277 => _277.includes, 'call', _278 => _278(router.configFile)]) || _optionalChain([exclude, 'optionalAccess', _279 => _279.includes, 'call', _280 => _280(importPath)])) {
|
|
7583
7599
|
return content;
|
|
7584
7600
|
}
|
|
7585
7601
|
const routerModule = "RouterInstance";
|
|
@@ -7725,7 +7741,7 @@ var ViteBootstrapper = (_class12 = class {
|
|
|
7725
7741
|
const { output } = this.options;
|
|
7726
7742
|
const workspaceDir = this.fileCompiler.getWorkspaceDir();
|
|
7727
7743
|
await _fs2.default.promises.mkdir(workspaceDir, { recursive: true });
|
|
7728
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
7744
|
+
if (_optionalChain([output, 'optionalAccess', _281 => _281.bootstrapVite]) === false) {
|
|
7729
7745
|
return false;
|
|
7730
7746
|
}
|
|
7731
7747
|
if (this.isSingleFile()) {
|
|
@@ -7775,7 +7791,7 @@ var ViteBootstrapper = (_class12 = class {
|
|
|
7775
7791
|
const newDevDeps = resolveDeps(sourcePkg.devDependencies, newPkg.devDependencies, true);
|
|
7776
7792
|
newPkg.dependencies = newDeps;
|
|
7777
7793
|
newPkg.devDependencies = newDevDeps;
|
|
7778
|
-
newPkg = _optionalChain([output, 'optionalAccess',
|
|
7794
|
+
newPkg = _optionalChain([output, 'optionalAccess', _282 => _282.packageJson, 'optionalCall', _283 => _283(newPkg)]) || newPkg;
|
|
7779
7795
|
await this.fileCompiler.writeFileWithDir(outputPkgPath, JSON.stringify(newPkg, null, 2));
|
|
7780
7796
|
this.spinner.succeed("Standard Vite React environment initialized");
|
|
7781
7797
|
return true;
|
|
@@ -7786,12 +7802,12 @@ var ViteBootstrapper = (_class12 = class {
|
|
|
7786
7802
|
async resolveViteCreateApp() {
|
|
7787
7803
|
const { output } = this.options;
|
|
7788
7804
|
const { viteVersion, template: tmpl } = this.defaultConfig;
|
|
7789
|
-
const bootstrapVite = _optionalChain([output, 'optionalAccess',
|
|
7805
|
+
const bootstrapVite = _optionalChain([output, 'optionalAccess', _284 => _284.bootstrapVite]);
|
|
7790
7806
|
const outDirName = this.fileCompiler.getOutDirName();
|
|
7791
7807
|
const configObject = typeof bootstrapVite === "object" ? bootstrapVite : null;
|
|
7792
|
-
const viteVer = _optionalChain([configObject, 'optionalAccess',
|
|
7793
|
-
const reactVer = _optionalChain([configObject, 'optionalAccess',
|
|
7794
|
-
const template = _optionalChain([configObject, 'optionalAccess',
|
|
7808
|
+
const viteVer = _optionalChain([configObject, 'optionalAccess', _285 => _285.vite]) || viteVersion;
|
|
7809
|
+
const reactVer = _optionalChain([configObject, 'optionalAccess', _286 => _286.react]);
|
|
7810
|
+
const template = _optionalChain([configObject, 'optionalAccess', _287 => _287.template]) || tmpl;
|
|
7795
7811
|
const cmd = `npm create vite${viteVer} ${outDirName} -- --template ${template}`;
|
|
7796
7812
|
_child_process.execSync.call(void 0, cmd, {
|
|
7797
7813
|
cwd: this.fileCompiler.getWorkspaceDir(),
|
|
@@ -7895,7 +7911,7 @@ var FileCompiler = (_class13 = class extends BaseCompiler {
|
|
|
7895
7911
|
const scriptCount = await this.runPipelineWithSpinner("script" /* SCRIPT */);
|
|
7896
7912
|
const styleCount = await this.runPipelineWithSpinner("style" /* STYLE */);
|
|
7897
7913
|
const assetCount = await this.runPipelineWithSpinner("copied" /* ASSET */);
|
|
7898
|
-
await _optionalChain([this, 'access',
|
|
7914
|
+
await _optionalChain([this, 'access', _288 => _288.options, 'access', _289 => _289.onSuccess, 'optionalCall', _290 => _290()]);
|
|
7899
7915
|
const endTime = calcElapsedTime(startTime);
|
|
7900
7916
|
this.printCoreLogs();
|
|
7901
7917
|
this.showCompileStats(endTime, sfcCount, scriptCount, styleCount, assetCount);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vureact/compiler-core v1.6.
|
|
2
|
+
* @vureact/compiler-core v1.6.2
|
|
3
3
|
* (c) 2025-present Ruihong Zhong (Ryan John)
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
@@ -39,7 +39,7 @@ var RUNTIME_PACKAGES = {
|
|
|
39
39
|
},
|
|
40
40
|
runtime: {
|
|
41
41
|
name: PACKAGE_NAME.runtime,
|
|
42
|
-
version: "^1.0
|
|
42
|
+
version: "^1.1.0"
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
var STYLE_MODULE_NAME = "$style";
|
|
@@ -5550,31 +5550,47 @@ function collectComponentRef(tag, ctx) {
|
|
|
5550
5550
|
// src/core/transform/sfc/template/syntax-processor/process/props/resolve-template-key.ts
|
|
5551
5551
|
import {
|
|
5552
5552
|
ConstantTypes,
|
|
5553
|
-
|
|
5553
|
+
ElementTypes as VueElementTypes,
|
|
5554
|
+
NodeTypes as VueNodeTypes
|
|
5554
5555
|
} from "@vue/compiler-core";
|
|
5555
|
-
function resolveTemplateNodeKey(
|
|
5556
|
-
const
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
(
|
|
5556
|
+
function resolveTemplateNodeKey(templNode, keyContent, ctx) {
|
|
5557
|
+
const { filename, source } = ctx;
|
|
5558
|
+
const { children, loc } = templNode;
|
|
5559
|
+
if (children.length > 1) {
|
|
5560
|
+
logger.warn(
|
|
5561
|
+
"Expected <template> with `:key` to have a single parent element; otherwise, the key cannot be transferred to the first child.",
|
|
5562
|
+
{
|
|
5563
|
+
file: filename,
|
|
5564
|
+
source,
|
|
5565
|
+
loc
|
|
5566
|
+
}
|
|
5567
|
+
);
|
|
5568
|
+
return;
|
|
5569
|
+
}
|
|
5570
|
+
const [firstChild] = children;
|
|
5571
|
+
if (firstChild?.type !== VueNodeTypes.ELEMENT || firstChild.tagType === VueElementTypes.TEMPLATE || firstChild.tagType === VueElementTypes.SLOT) {
|
|
5572
|
+
return;
|
|
5573
|
+
}
|
|
5574
|
+
const hasKeyProp = firstChild.props.some(
|
|
5575
|
+
(p) => p.type === VueNodeTypes.DIRECTIVE && p.name === "key"
|
|
5560
5576
|
);
|
|
5561
5577
|
if (hasKeyProp) return;
|
|
5562
|
-
|
|
5578
|
+
firstChild.props.push(createSimpleVueBind("key", keyContent));
|
|
5563
5579
|
}
|
|
5564
5580
|
function createSimpleVueBind(name, value) {
|
|
5565
5581
|
return {
|
|
5566
|
-
type:
|
|
5582
|
+
type: VueNodeTypes.DIRECTIVE,
|
|
5567
5583
|
name: "bind",
|
|
5568
5584
|
rawName: `:${name}`,
|
|
5569
5585
|
exp: {
|
|
5570
|
-
type:
|
|
5586
|
+
type: VueNodeTypes.SIMPLE_EXPRESSION,
|
|
5571
5587
|
content: value,
|
|
5572
5588
|
isStatic: false,
|
|
5573
5589
|
constType: ConstantTypes.NOT_CONSTANT,
|
|
5574
5590
|
loc: {}
|
|
5575
5591
|
},
|
|
5576
5592
|
arg: {
|
|
5577
|
-
type:
|
|
5593
|
+
type: VueNodeTypes.SIMPLE_EXPRESSION,
|
|
5578
5594
|
content: name,
|
|
5579
5595
|
isStatic: true,
|
|
5580
5596
|
constType: ConstantTypes.CAN_STRINGIFY,
|
|
@@ -5601,7 +5617,7 @@ function resolveDynamicAttributeProp(directive, ir, ctx, vueNode, nodeIR) {
|
|
|
5601
5617
|
return;
|
|
5602
5618
|
}
|
|
5603
5619
|
if (vueNode.tag === "template" && name === "key") {
|
|
5604
|
-
resolveTemplateNodeKey(vueNode, content);
|
|
5620
|
+
resolveTemplateNodeKey(vueNode, content, ctx);
|
|
5605
5621
|
return;
|
|
5606
5622
|
}
|
|
5607
5623
|
const propIR = createPropsIR(directive.rawName, name, content);
|
|
@@ -5709,14 +5725,14 @@ function resolveDirectiveProp(directive, ir, ctx, vueNode, nodeIR, siblingNodesI
|
|
|
5709
5725
|
}
|
|
5710
5726
|
|
|
5711
5727
|
// src/core/transform/sfc/template/syntax-processor/process/props/resolve-props.ts
|
|
5712
|
-
import { NodeTypes as
|
|
5728
|
+
import { NodeTypes as NodeTypes6 } from "@vue/compiler-core";
|
|
5713
5729
|
function resolveProps(vueNode, ir, ctx, nodeIR, siblingNodesIR) {
|
|
5714
5730
|
for (const prop of vueNode.props) {
|
|
5715
|
-
if (prop.type ===
|
|
5731
|
+
if (prop.type === NodeTypes6.ATTRIBUTE) {
|
|
5716
5732
|
resolveAttributeProp(prop, ir, ctx, nodeIR);
|
|
5717
5733
|
continue;
|
|
5718
5734
|
}
|
|
5719
|
-
if (prop.type ===
|
|
5735
|
+
if (prop.type === NodeTypes6.DIRECTIVE) {
|
|
5720
5736
|
const stop = resolveDirectiveProp(
|
|
5721
5737
|
prop,
|
|
5722
5738
|
ir,
|
|
@@ -5851,7 +5867,7 @@ function resolveVMemo(directive, _ir, ctx, nodeIR) {
|
|
|
5851
5867
|
// src/core/transform/sfc/template/syntax-processor/process/props/resolve-v-model.ts
|
|
5852
5868
|
import {
|
|
5853
5869
|
ElementTypes,
|
|
5854
|
-
NodeTypes as
|
|
5870
|
+
NodeTypes as NodeTypes7
|
|
5855
5871
|
} from "@vue/compiler-core";
|
|
5856
5872
|
function resolveVModel(directive, ir, ctx, vueNode, nodeIR) {
|
|
5857
5873
|
const arg = directive.arg;
|
|
@@ -5903,7 +5919,7 @@ function resolveModelPropName(inputType, isComponent = false) {
|
|
|
5903
5919
|
}
|
|
5904
5920
|
function getRadioValue(vueNode) {
|
|
5905
5921
|
const valueAttr = vueNode.props.find(
|
|
5906
|
-
(prop) => prop.type ===
|
|
5922
|
+
(prop) => prop.type === NodeTypes7.ATTRIBUTE && prop.name === "value"
|
|
5907
5923
|
);
|
|
5908
5924
|
if (!valueAttr?.value?.content) return '""';
|
|
5909
5925
|
const content = valueAttr.value.content;
|
|
@@ -5913,7 +5929,7 @@ function resolveHtmlInput(node, isComponent) {
|
|
|
5913
5929
|
if (isComponent) return;
|
|
5914
5930
|
if (node.tag !== "input") return node.tag;
|
|
5915
5931
|
const typeProp = node.props.find(
|
|
5916
|
-
(prop) => prop.type ===
|
|
5932
|
+
(prop) => prop.type === NodeTypes7.ATTRIBUTE && prop.name === "type"
|
|
5917
5933
|
);
|
|
5918
5934
|
return typeProp?.value?.content?.toLowerCase();
|
|
5919
5935
|
}
|
|
@@ -6103,20 +6119,20 @@ function resolveInterpolationNode(node, _ir, ctx, childrenIR) {
|
|
|
6103
6119
|
}
|
|
6104
6120
|
|
|
6105
6121
|
// src/core/transform/sfc/template/syntax-processor/process/resolve-slot-outlet-node.ts
|
|
6106
|
-
import { NodeTypes as
|
|
6122
|
+
import { NodeTypes as NodeTypes9 } from "@vue/compiler-core";
|
|
6107
6123
|
|
|
6108
6124
|
// src/core/transform/sfc/template/syntax-processor/process/resolve-template-children.ts
|
|
6109
6125
|
import {
|
|
6110
6126
|
isSlotOutlet as isSlotOutlet2,
|
|
6111
|
-
NodeTypes as
|
|
6127
|
+
NodeTypes as VueNodeTypes2
|
|
6112
6128
|
} from "@vue/compiler-core";
|
|
6113
6129
|
|
|
6114
6130
|
// src/core/transform/sfc/template/syntax-processor/process/resolve-template-v-slot-node.ts
|
|
6115
|
-
import { NodeTypes as
|
|
6131
|
+
import { NodeTypes as NodeTypes8 } from "@vue/compiler-core";
|
|
6116
6132
|
function resolveTemplateVSlotNode(node, ir, ctx, nodeIR) {
|
|
6117
6133
|
let slotIR = {};
|
|
6118
6134
|
for (const prop of node.props) {
|
|
6119
|
-
if (prop.type ===
|
|
6135
|
+
if (prop.type === NodeTypes8.DIRECTIVE) {
|
|
6120
6136
|
slotIR = resolveVSlotProp(prop, ir, ctx);
|
|
6121
6137
|
}
|
|
6122
6138
|
}
|
|
@@ -6146,7 +6162,7 @@ function resolveTemplateChildren(node, nodeIR, ctx) {
|
|
|
6146
6162
|
}
|
|
6147
6163
|
function resolveChildNodes(node, nodeIR, ctx, parentIR, childrenIR) {
|
|
6148
6164
|
for (const child of node.children) {
|
|
6149
|
-
if (child.type ===
|
|
6165
|
+
if (child.type === VueNodeTypes2.ELEMENT) {
|
|
6150
6166
|
if (isSlotOutlet2(child)) {
|
|
6151
6167
|
resolveSlotOutletNode(child, nodeIR, ctx, parentIR, childrenIR);
|
|
6152
6168
|
continue;
|
|
@@ -6165,15 +6181,15 @@ function resolveChildNodes(node, nodeIR, ctx, parentIR, childrenIR) {
|
|
|
6165
6181
|
}
|
|
6166
6182
|
continue;
|
|
6167
6183
|
}
|
|
6168
|
-
if (child.type ===
|
|
6184
|
+
if (child.type === VueNodeTypes2.INTERPOLATION) {
|
|
6169
6185
|
resolveInterpolationNode(child, nodeIR, ctx, childrenIR);
|
|
6170
6186
|
continue;
|
|
6171
6187
|
}
|
|
6172
|
-
if (child.type ===
|
|
6188
|
+
if (child.type === VueNodeTypes2.TEXT) {
|
|
6173
6189
|
resolveTextNode(child, nodeIR, ctx, childrenIR);
|
|
6174
6190
|
continue;
|
|
6175
6191
|
}
|
|
6176
|
-
if (child.type ===
|
|
6192
|
+
if (child.type === VueNodeTypes2.COMMENT) {
|
|
6177
6193
|
resolveCommentNode(child, nodeIR, ctx, childrenIR);
|
|
6178
6194
|
}
|
|
6179
6195
|
}
|
|
@@ -6216,7 +6232,7 @@ function resolveSlotProps(node, ctx) {
|
|
|
6216
6232
|
});
|
|
6217
6233
|
};
|
|
6218
6234
|
for (const prop of node.props) {
|
|
6219
|
-
if (prop.type ===
|
|
6235
|
+
if (prop.type === NodeTypes9.ATTRIBUTE) {
|
|
6220
6236
|
const attr = prop.name;
|
|
6221
6237
|
const value = prop.value?.content.trim();
|
|
6222
6238
|
if (attr === "name" && value) {
|
|
@@ -6226,7 +6242,7 @@ function resolveSlotProps(node, ctx) {
|
|
|
6226
6242
|
}
|
|
6227
6243
|
continue;
|
|
6228
6244
|
}
|
|
6229
|
-
if (prop.type ===
|
|
6245
|
+
if (prop.type === NodeTypes9.DIRECTIVE) {
|
|
6230
6246
|
const arg = prop.arg;
|
|
6231
6247
|
const exp = prop.exp;
|
|
6232
6248
|
warnUnsupportedVueDollarVar(ctx, prop);
|
|
@@ -6258,7 +6274,7 @@ function resolveSlotNode(parentIR, node, nodeIR, slotContext, ctx) {
|
|
|
6258
6274
|
}
|
|
6259
6275
|
if (fallback.length === 1) {
|
|
6260
6276
|
const child = fallback[0];
|
|
6261
|
-
if (child.type ===
|
|
6277
|
+
if (child.type === NodeTypes9.TEXT) {
|
|
6262
6278
|
fallbackResolved = true;
|
|
6263
6279
|
expression += ` ?? ${JSON.stringify(child.content.trim())}`;
|
|
6264
6280
|
}
|
|
@@ -6320,7 +6336,7 @@ function transform(ast, ctx, options) {
|
|
|
6320
6336
|
}
|
|
6321
6337
|
|
|
6322
6338
|
// package.json
|
|
6323
|
-
var version = "1.6.
|
|
6339
|
+
var version = "1.6.2";
|
|
6324
6340
|
var bin = {
|
|
6325
6341
|
vureact: "./bin/vureact.js"
|
|
6326
6342
|
};
|
package/lib/cli.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @vureact/compiler-core v1.6.
|
|
3
|
+
* @vureact/compiler-core v1.6.2
|
|
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-SRBJ5B5X.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.6.
|
|
3
|
+
* @vureact/compiler-core v1.6.2
|
|
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 _chunkFLZ5AUPGjs = require('./chunk-FLZ5AUPG.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, _chunkFLZ5AUPGjs.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,
|
|
114
|
+
cmpHelper.printCompileInfo(filePath, _chunkFLZ5AUPGjs.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(
|
|
123
|
+
_kleur2.default.dim(_chunkFLZ5AUPGjs.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(
|
|
136
|
+
_kleur2.default.dim(_chunkFLZ5AUPGjs.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,
|
|
169
|
+
const compiler = new (0, _chunkFLZ5AUPGjs.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 =
|
|
192
|
+
var __dirname = _chunkFLZ5AUPGjs.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(
|
|
232
|
+
var [programName] = Object.keys(_chunkFLZ5AUPGjs.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(
|
|
243
|
+
cli.help().version(_chunkFLZ5AUPGjs.version).parse();
|
package/lib/compiler-core.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vureact/compiler-core v1.6.
|
|
2
|
+
* @vureact/compiler-core v1.6.2
|
|
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-SRBJ5B5X.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.6.
|
|
2
|
+
* @vureact/compiler-core v1.6.2
|
|
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 _chunkFLZ5AUPGjs = require('./chunk-FLZ5AUPG.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -33,4 +33,4 @@ var _chunkZOTZLL4Ujs = require('./chunk-ZOTZLL4U.js');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
exports.BaseCompiler =
|
|
36
|
+
exports.BaseCompiler = _chunkFLZ5AUPGjs.BaseCompiler; exports.CacheKey = _chunkFLZ5AUPGjs.CacheKey; exports.FileCompiler = _chunkFLZ5AUPGjs.FileCompiler; exports.Helper = _chunkFLZ5AUPGjs.Helper; exports.VuReact = _chunkFLZ5AUPGjs.VuReact; exports.defineConfig = _chunkFLZ5AUPGjs.defineConfig; exports.generate = _chunkFLZ5AUPGjs.generate; exports.generateComponent = _chunkFLZ5AUPGjs.generateComponent; exports.generateOnlyScript = _chunkFLZ5AUPGjs.generateOnlyScript; exports.parse = _chunkFLZ5AUPGjs.parse; exports.parseOnlyScript = _chunkFLZ5AUPGjs.parseOnlyScript; exports.parseSFC = _chunkFLZ5AUPGjs.parseSFC; exports.transform = _chunkFLZ5AUPGjs.transform;
|