setupin 3.1.0 → 3.1.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/dist/main.js +131 -115
- package/dist/main.prod.js +76 -76
- package/package.json +3 -5
package/dist/main.js
CHANGED
|
@@ -18050,7 +18050,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
18050
18050
|
}
|
|
18051
18051
|
}
|
|
18052
18052
|
function createTransformContext(root2, {
|
|
18053
|
-
filename
|
|
18053
|
+
filename = "",
|
|
18054
18054
|
prefixIdentifiers = false,
|
|
18055
18055
|
hoistStatic = false,
|
|
18056
18056
|
hmr = false,
|
|
@@ -18073,10 +18073,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
18073
18073
|
onWarn = defaultOnWarn,
|
|
18074
18074
|
compatConfig
|
|
18075
18075
|
}) {
|
|
18076
|
-
const nameMatch =
|
|
18076
|
+
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
18077
18077
|
const context = {
|
|
18078
18078
|
// options
|
|
18079
|
-
filename
|
|
18079
|
+
filename,
|
|
18080
18080
|
selfName: nameMatch && capitalize(camelize(nameMatch[1])),
|
|
18081
18081
|
prefixIdentifiers,
|
|
18082
18082
|
hoistStatic,
|
|
@@ -18982,7 +18982,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
18982
18982
|
SourceMapGenerator.prototype._version = 3;
|
|
18983
18983
|
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
|
|
18984
18984
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
18985
|
-
var
|
|
18985
|
+
var generator2 = new SourceMapGenerator(Object.assign(generatorOps || {}, {
|
|
18986
18986
|
file: aSourceMapConsumer.file,
|
|
18987
18987
|
sourceRoot
|
|
18988
18988
|
}));
|
|
@@ -19006,22 +19006,22 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
19006
19006
|
newMapping.name = mapping.name;
|
|
19007
19007
|
}
|
|
19008
19008
|
}
|
|
19009
|
-
|
|
19009
|
+
generator2.addMapping(newMapping);
|
|
19010
19010
|
});
|
|
19011
19011
|
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
19012
19012
|
var sourceRelative = sourceFile;
|
|
19013
19013
|
if (sourceRoot !== null) {
|
|
19014
19014
|
sourceRelative = util2.relative(sourceRoot, sourceFile);
|
|
19015
19015
|
}
|
|
19016
|
-
if (!
|
|
19017
|
-
|
|
19016
|
+
if (!generator2._sources.has(sourceRelative)) {
|
|
19017
|
+
generator2._sources.add(sourceRelative);
|
|
19018
19018
|
}
|
|
19019
19019
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
19020
19020
|
if (content != null) {
|
|
19021
|
-
|
|
19021
|
+
generator2.setSourceContent(sourceFile, content);
|
|
19022
19022
|
}
|
|
19023
19023
|
});
|
|
19024
|
-
return
|
|
19024
|
+
return generator2;
|
|
19025
19025
|
};
|
|
19026
19026
|
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
19027
19027
|
var generated = util2.getArg(aArgs, "generated");
|
|
@@ -20285,7 +20285,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
20285
20285
|
mode = "function",
|
|
20286
20286
|
prefixIdentifiers = mode === "module",
|
|
20287
20287
|
sourceMap: sourceMap2 = false,
|
|
20288
|
-
filename
|
|
20288
|
+
filename = `template.vue.html`,
|
|
20289
20289
|
scopeId = null,
|
|
20290
20290
|
optimizeImports = false,
|
|
20291
20291
|
runtimeGlobalName = `Vue`,
|
|
@@ -20299,7 +20299,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
20299
20299
|
mode,
|
|
20300
20300
|
prefixIdentifiers,
|
|
20301
20301
|
sourceMap: sourceMap2,
|
|
20302
|
-
filename
|
|
20302
|
+
filename,
|
|
20303
20303
|
scopeId,
|
|
20304
20304
|
optimizeImports,
|
|
20305
20305
|
runtimeGlobalName,
|
|
@@ -20381,14 +20381,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
20381
20381
|
// source-map column is 0 based
|
|
20382
20382
|
generatedLine: context.line,
|
|
20383
20383
|
generatedColumn: context.column - 1,
|
|
20384
|
-
source:
|
|
20384
|
+
source: filename,
|
|
20385
20385
|
name
|
|
20386
20386
|
});
|
|
20387
20387
|
}
|
|
20388
20388
|
if (sourceMap2) {
|
|
20389
20389
|
context.map = new sourceMapExports.SourceMapGenerator();
|
|
20390
|
-
context.map.setSourceContent(
|
|
20391
|
-
context.map._sources.add(
|
|
20390
|
+
context.map.setSourceContent(filename, context.source);
|
|
20391
|
+
context.map._sources.add(filename);
|
|
20392
20392
|
}
|
|
20393
20393
|
return context;
|
|
20394
20394
|
}
|
|
@@ -24673,7 +24673,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24673
24673
|
}
|
|
24674
24674
|
const {
|
|
24675
24675
|
sourceMap: sourceMap2 = true,
|
|
24676
|
-
filename
|
|
24676
|
+
filename = DEFAULT_FILENAME,
|
|
24677
24677
|
sourceRoot = "",
|
|
24678
24678
|
pad: pad2 = false,
|
|
24679
24679
|
ignoreEmpty = true,
|
|
@@ -24681,7 +24681,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24681
24681
|
templateParseOptions = {}
|
|
24682
24682
|
} = options;
|
|
24683
24683
|
const descriptor = {
|
|
24684
|
-
filename
|
|
24684
|
+
filename,
|
|
24685
24685
|
source,
|
|
24686
24686
|
template: null,
|
|
24687
24687
|
script: null,
|
|
@@ -24796,7 +24796,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24796
24796
|
const genMap = (block, columnOffset = 0) => {
|
|
24797
24797
|
if (block && !block.src) {
|
|
24798
24798
|
block.map = generateSourceMap(
|
|
24799
|
-
|
|
24799
|
+
filename,
|
|
24800
24800
|
source,
|
|
24801
24801
|
block.content,
|
|
24802
24802
|
sourceRoot,
|
|
@@ -24866,13 +24866,13 @@ ${defaultVar}.setup = __setup__
|
|
|
24866
24866
|
const splitRE = /\r?\n/g;
|
|
24867
24867
|
const emptyRE = /^(?:\/\/)?\s*$/;
|
|
24868
24868
|
const replaceRE = /./g;
|
|
24869
|
-
function generateSourceMap(
|
|
24869
|
+
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset, columnOffset) {
|
|
24870
24870
|
const map2 = new sourceMapExports.SourceMapGenerator({
|
|
24871
|
-
file:
|
|
24871
|
+
file: filename.replace(/\\/g, "/"),
|
|
24872
24872
|
sourceRoot: sourceRoot.replace(/\\/g, "/")
|
|
24873
24873
|
});
|
|
24874
|
-
map2.setSourceContent(
|
|
24875
|
-
map2._sources.add(
|
|
24874
|
+
map2.setSourceContent(filename, source);
|
|
24875
|
+
map2._sources.add(filename);
|
|
24876
24876
|
generated.split(splitRE).forEach((line, index) => {
|
|
24877
24877
|
if (!emptyRE.test(line)) {
|
|
24878
24878
|
const originalLine = index + 1 + lineOffset;
|
|
@@ -24884,7 +24884,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24884
24884
|
originalColumn: i + columnOffset,
|
|
24885
24885
|
generatedLine,
|
|
24886
24886
|
generatedColumn: i,
|
|
24887
|
-
source:
|
|
24887
|
+
source: filename,
|
|
24888
24888
|
name: null
|
|
24889
24889
|
});
|
|
24890
24890
|
}
|
|
@@ -24973,8 +24973,8 @@ ${defaultVar}.setup = __setup__
|
|
|
24973
24973
|
return parts;
|
|
24974
24974
|
}
|
|
24975
24975
|
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
24976
|
-
var splitPath = function(
|
|
24977
|
-
return splitPathRe.exec(
|
|
24976
|
+
var splitPath = function(filename) {
|
|
24977
|
+
return splitPathRe.exec(filename).slice(1);
|
|
24978
24978
|
};
|
|
24979
24979
|
function resolve() {
|
|
24980
24980
|
var resolvedPath = "", resolvedAbsolute = false;
|
|
@@ -29656,12 +29656,12 @@ ${defaultVar}.setup = __setup__
|
|
|
29656
29656
|
return a;
|
|
29657
29657
|
};
|
|
29658
29658
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
29659
|
-
function preprocess$1({ source, filename
|
|
29659
|
+
function preprocess$1({ source, filename, preprocessOptions }, preprocessor) {
|
|
29660
29660
|
let res = "";
|
|
29661
29661
|
let err = null;
|
|
29662
29662
|
preprocessor.render(
|
|
29663
29663
|
source,
|
|
29664
|
-
__spreadValues$6({ filename
|
|
29664
|
+
__spreadValues$6({ filename }, preprocessOptions),
|
|
29665
29665
|
(_err, _res) => {
|
|
29666
29666
|
if (_err) err = _err;
|
|
29667
29667
|
res = _res;
|
|
@@ -29709,7 +29709,7 @@ ${defaultVar}.setup = __setup__
|
|
|
29709
29709
|
}
|
|
29710
29710
|
}
|
|
29711
29711
|
function doCompileTemplate({
|
|
29712
|
-
filename
|
|
29712
|
+
filename,
|
|
29713
29713
|
id: id2,
|
|
29714
29714
|
scoped,
|
|
29715
29715
|
slotted,
|
|
@@ -29775,7 +29775,7 @@ ${defaultVar}.setup = __setup__
|
|
|
29775
29775
|
}, compilerOptions), {
|
|
29776
29776
|
hmr: !isProd,
|
|
29777
29777
|
nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
|
|
29778
|
-
filename
|
|
29778
|
+
filename,
|
|
29779
29779
|
onError: (e) => errors2.push(e),
|
|
29780
29780
|
onWarn: (w) => warnings.push(w)
|
|
29781
29781
|
}));
|
|
@@ -29834,17 +29834,17 @@ ${generateCodeFrame(
|
|
|
29834
29834
|
name: origPosInOldMap.name
|
|
29835
29835
|
});
|
|
29836
29836
|
});
|
|
29837
|
-
const
|
|
29837
|
+
const generator2 = mergedMapGenerator;
|
|
29838
29838
|
oldMapConsumer.sources.forEach((sourceFile) => {
|
|
29839
|
-
|
|
29839
|
+
generator2._sources.add(sourceFile);
|
|
29840
29840
|
const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
|
|
29841
29841
|
if (sourceContent != null) {
|
|
29842
29842
|
mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
|
|
29843
29843
|
}
|
|
29844
29844
|
});
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
return
|
|
29845
|
+
generator2._sourceRoot = oldMap.sourceRoot;
|
|
29846
|
+
generator2._file = oldMap.file;
|
|
29847
|
+
return generator2.toJSON();
|
|
29848
29848
|
}
|
|
29849
29849
|
function patchErrors(errors2, source, inMap) {
|
|
29850
29850
|
const originalSource = inMap.sourcesContent[0];
|
|
@@ -32109,7 +32109,7 @@ ${generateCodeFrame(
|
|
|
32109
32109
|
SourceMapGenerator.prototype._version = 3;
|
|
32110
32110
|
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
|
|
32111
32111
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
32112
|
-
var
|
|
32112
|
+
var generator2 = new SourceMapGenerator(Object.assign(generatorOps || {}, {
|
|
32113
32113
|
file: aSourceMapConsumer.file,
|
|
32114
32114
|
sourceRoot
|
|
32115
32115
|
}));
|
|
@@ -32133,22 +32133,22 @@ ${generateCodeFrame(
|
|
|
32133
32133
|
newMapping.name = mapping.name;
|
|
32134
32134
|
}
|
|
32135
32135
|
}
|
|
32136
|
-
|
|
32136
|
+
generator2.addMapping(newMapping);
|
|
32137
32137
|
});
|
|
32138
32138
|
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
32139
32139
|
var sourceRelative = sourceFile;
|
|
32140
32140
|
if (sourceRoot !== null) {
|
|
32141
32141
|
sourceRelative = util2.relative(sourceRoot, sourceFile);
|
|
32142
32142
|
}
|
|
32143
|
-
if (!
|
|
32144
|
-
|
|
32143
|
+
if (!generator2._sources.has(sourceRelative)) {
|
|
32144
|
+
generator2._sources.add(sourceRelative);
|
|
32145
32145
|
}
|
|
32146
32146
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
32147
32147
|
if (content != null) {
|
|
32148
|
-
|
|
32148
|
+
generator2.setSourceContent(sourceFile, content);
|
|
32149
32149
|
}
|
|
32150
32150
|
});
|
|
32151
|
-
return
|
|
32151
|
+
return generator2;
|
|
32152
32152
|
};
|
|
32153
32153
|
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
32154
32154
|
var generated = util2.getArg(aArgs, "generated");
|
|
@@ -36767,10 +36767,10 @@ ${generateCodeFrame(
|
|
|
36767
36767
|
})(comment, comment.exports);
|
|
36768
36768
|
return comment.exports;
|
|
36769
36769
|
}
|
|
36770
|
-
var id
|
|
36770
|
+
var id = { exports: {} };
|
|
36771
36771
|
var hasRequiredId;
|
|
36772
36772
|
function requireId() {
|
|
36773
|
-
if (hasRequiredId) return id
|
|
36773
|
+
if (hasRequiredId) return id.exports;
|
|
36774
36774
|
hasRequiredId = 1;
|
|
36775
36775
|
(function(module, exports) {
|
|
36776
36776
|
exports.__esModule = true;
|
|
@@ -36808,8 +36808,8 @@ ${generateCodeFrame(
|
|
|
36808
36808
|
}(_node["default"]);
|
|
36809
36809
|
exports["default"] = ID;
|
|
36810
36810
|
module.exports = exports.default;
|
|
36811
|
-
})(id
|
|
36812
|
-
return id
|
|
36811
|
+
})(id, id.exports);
|
|
36812
|
+
return id.exports;
|
|
36813
36813
|
}
|
|
36814
36814
|
var tag = { exports: {} };
|
|
36815
36815
|
var namespace = { exports: {} };
|
|
@@ -40039,7 +40039,7 @@ ${generateCodeFrame(
|
|
|
40039
40039
|
SourceMapGenerator.prototype._version = 3;
|
|
40040
40040
|
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
|
40041
40041
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
40042
|
-
var
|
|
40042
|
+
var generator2 = new SourceMapGenerator({
|
|
40043
40043
|
file: aSourceMapConsumer.file,
|
|
40044
40044
|
sourceRoot
|
|
40045
40045
|
});
|
|
@@ -40063,22 +40063,22 @@ ${generateCodeFrame(
|
|
|
40063
40063
|
newMapping.name = mapping.name;
|
|
40064
40064
|
}
|
|
40065
40065
|
}
|
|
40066
|
-
|
|
40066
|
+
generator2.addMapping(newMapping);
|
|
40067
40067
|
});
|
|
40068
40068
|
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
40069
40069
|
var sourceRelative = sourceFile;
|
|
40070
40070
|
if (sourceRoot !== null) {
|
|
40071
40071
|
sourceRelative = util2.relative(sourceRoot, sourceFile);
|
|
40072
40072
|
}
|
|
40073
|
-
if (!
|
|
40074
|
-
|
|
40073
|
+
if (!generator2._sources.has(sourceRelative)) {
|
|
40074
|
+
generator2._sources.add(sourceRelative);
|
|
40075
40075
|
}
|
|
40076
40076
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
40077
40077
|
if (content != null) {
|
|
40078
|
-
|
|
40078
|
+
generator2.setSourceContent(sourceFile, content);
|
|
40079
40079
|
}
|
|
40080
40080
|
});
|
|
40081
|
-
return
|
|
40081
|
+
return generator2;
|
|
40082
40082
|
};
|
|
40083
40083
|
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
40084
40084
|
var generated = util2.getArg(aArgs, "generated");
|
|
@@ -41433,10 +41433,10 @@ ${generateCodeFrame(
|
|
|
41433
41433
|
return { code: "", errors: [e], dependencies: [] };
|
|
41434
41434
|
}
|
|
41435
41435
|
};
|
|
41436
|
-
function getSource(source,
|
|
41436
|
+
function getSource(source, filename, additionalData) {
|
|
41437
41437
|
if (!additionalData) return source;
|
|
41438
41438
|
if (isFunction$1(additionalData)) {
|
|
41439
|
-
return additionalData(source,
|
|
41439
|
+
return additionalData(source, filename);
|
|
41440
41440
|
}
|
|
41441
41441
|
return additionalData + source;
|
|
41442
41442
|
}
|
|
@@ -41473,7 +41473,7 @@ ${generateCodeFrame(
|
|
|
41473
41473
|
}
|
|
41474
41474
|
function doCompileStyle(options) {
|
|
41475
41475
|
const {
|
|
41476
|
-
filename
|
|
41476
|
+
filename,
|
|
41477
41477
|
id: id2,
|
|
41478
41478
|
scoped = false,
|
|
41479
41479
|
trim = true,
|
|
@@ -41507,8 +41507,8 @@ ${generateCodeFrame(
|
|
|
41507
41507
|
}
|
|
41508
41508
|
}
|
|
41509
41509
|
const postCSSOptions = __spreadProps$3(__spreadValues$4({}, postcssOptions), {
|
|
41510
|
-
to:
|
|
41511
|
-
from:
|
|
41510
|
+
to: filename,
|
|
41511
|
+
from: filename
|
|
41512
41512
|
});
|
|
41513
41513
|
if (map2) {
|
|
41514
41514
|
postCSSOptions.map = {
|
|
@@ -41523,7 +41523,7 @@ ${generateCodeFrame(
|
|
|
41523
41523
|
const dependencies = new Set(
|
|
41524
41524
|
preProcessedSource ? preProcessedSource.dependencies : []
|
|
41525
41525
|
);
|
|
41526
|
-
dependencies.delete(
|
|
41526
|
+
dependencies.delete(filename);
|
|
41527
41527
|
const errors2 = [];
|
|
41528
41528
|
if (preProcessedSource && preProcessedSource.errors.length) {
|
|
41529
41529
|
errors2.push(...preProcessedSource.errors);
|
|
@@ -42772,9 +42772,9 @@ ${generateCodeFrame(
|
|
|
42772
42772
|
this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
|
|
42773
42773
|
this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
|
|
42774
42774
|
const customElement = options.customElement;
|
|
42775
|
-
const
|
|
42775
|
+
const filename = this.descriptor.filename;
|
|
42776
42776
|
if (customElement) {
|
|
42777
|
-
this.isCE = typeof customElement === "boolean" ? customElement : customElement(
|
|
42777
|
+
this.isCE = typeof customElement === "boolean" ? customElement : customElement(filename);
|
|
42778
42778
|
}
|
|
42779
42779
|
const plugins = resolveParserPlugins(
|
|
42780
42780
|
scriptLang || scriptSetupLang,
|
|
@@ -43016,8 +43016,8 @@ export default ${defaultVar}`;
|
|
|
43016
43016
|
};
|
|
43017
43017
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
43018
43018
|
class TypeScope {
|
|
43019
|
-
constructor(
|
|
43020
|
-
this.filename =
|
|
43019
|
+
constructor(filename, source, offset = 0, imports = /* @__PURE__ */ Object.create(null), types2 = /* @__PURE__ */ Object.create(null), declares = /* @__PURE__ */ Object.create(null)) {
|
|
43020
|
+
this.filename = filename;
|
|
43021
43021
|
this.source = source;
|
|
43022
43022
|
this.offset = offset;
|
|
43023
43023
|
this.imports = imports;
|
|
@@ -43615,11 +43615,11 @@ Note: both in 3.2 or with the ignore, the properties in the base type are treate
|
|
|
43615
43615
|
if (!resolved) {
|
|
43616
43616
|
if (source.startsWith("..")) {
|
|
43617
43617
|
const osSpecificJoinFn = joinPaths;
|
|
43618
|
-
const
|
|
43619
|
-
resolved = resolveExt(
|
|
43618
|
+
const filename = osSpecificJoinFn(dirname(scope.filename), source);
|
|
43619
|
+
resolved = resolveExt(filename, fs);
|
|
43620
43620
|
} else if (source[0] === ".") {
|
|
43621
|
-
const
|
|
43622
|
-
resolved = resolveExt(
|
|
43621
|
+
const filename = joinPaths(dirname(scope.filename), source);
|
|
43622
|
+
resolved = resolveExt(filename, fs);
|
|
43623
43623
|
} else {
|
|
43624
43624
|
{
|
|
43625
43625
|
return ctx.error(
|
|
@@ -43644,35 +43644,35 @@ Note: both in 3.2 or with the ignore, the properties in the base type are treate
|
|
|
43644
43644
|
);
|
|
43645
43645
|
}
|
|
43646
43646
|
}
|
|
43647
|
-
function resolveExt(
|
|
43648
|
-
|
|
43649
|
-
const tryResolve = (
|
|
43650
|
-
if (fs.fileExists(
|
|
43647
|
+
function resolveExt(filename, fs) {
|
|
43648
|
+
filename = filename.replace(/\.js$/, "");
|
|
43649
|
+
const tryResolve = (filename2) => {
|
|
43650
|
+
if (fs.fileExists(filename2)) return filename2;
|
|
43651
43651
|
};
|
|
43652
|
-
return tryResolve(
|
|
43652
|
+
return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`));
|
|
43653
43653
|
}
|
|
43654
43654
|
const fileToScopeCache = createCache();
|
|
43655
|
-
function fileToScope(ctx,
|
|
43656
|
-
const cached = fileToScopeCache.get(
|
|
43655
|
+
function fileToScope(ctx, filename, asGlobal = false) {
|
|
43656
|
+
const cached = fileToScopeCache.get(filename);
|
|
43657
43657
|
if (cached) {
|
|
43658
43658
|
return cached;
|
|
43659
43659
|
}
|
|
43660
43660
|
const fs = resolveFS(ctx);
|
|
43661
|
-
const source = fs.readFile(
|
|
43662
|
-
const body = parseFile(
|
|
43663
|
-
const scope = new TypeScope(
|
|
43661
|
+
const source = fs.readFile(filename) || "";
|
|
43662
|
+
const body = parseFile(filename, source, ctx.options.babelParserPlugins);
|
|
43663
|
+
const scope = new TypeScope(filename, source, 0, recordImports(body));
|
|
43664
43664
|
recordTypes(ctx, body, scope, asGlobal);
|
|
43665
|
-
fileToScopeCache.set(
|
|
43665
|
+
fileToScopeCache.set(filename, scope);
|
|
43666
43666
|
return scope;
|
|
43667
43667
|
}
|
|
43668
|
-
function parseFile(
|
|
43669
|
-
const ext = extname(
|
|
43668
|
+
function parseFile(filename, content, parserPlugins) {
|
|
43669
|
+
const ext = extname(filename);
|
|
43670
43670
|
if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") {
|
|
43671
43671
|
return libExports.parse(content, {
|
|
43672
43672
|
plugins: resolveParserPlugins(
|
|
43673
43673
|
ext.slice(1),
|
|
43674
43674
|
parserPlugins,
|
|
43675
|
-
/\.d\.m?ts$/.test(
|
|
43675
|
+
/\.d\.m?ts$/.test(filename)
|
|
43676
43676
|
),
|
|
43677
43677
|
sourceType: "module"
|
|
43678
43678
|
}).program.body;
|
|
@@ -45080,7 +45080,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
|
|
|
45080
45080
|
);
|
|
45081
45081
|
}
|
|
45082
45082
|
const ctx = new ScriptCompileContext(sfc, options);
|
|
45083
|
-
const { script, scriptSetup, source, filename
|
|
45083
|
+
const { script, scriptSetup, source, filename } = sfc;
|
|
45084
45084
|
const hoistStatic = options.hoistStatic !== false && !script;
|
|
45085
45085
|
const scopeId = options.id ? options.id.replace(/^data-v-/, "") : "";
|
|
45086
45086
|
const scriptLang = script && script.lang;
|
|
@@ -45553,7 +45553,7 @@ let __temp${any}, __restore${any}
|
|
|
45553
45553
|
hasInlinedSsrRenderFn = true;
|
|
45554
45554
|
}
|
|
45555
45555
|
const { code, ast, preamble, tips, errors: errors2 } = compileTemplate(__spreadProps2(__spreadValues$1({
|
|
45556
|
-
filename
|
|
45556
|
+
filename,
|
|
45557
45557
|
ast: sfc.template.ast,
|
|
45558
45558
|
source: sfc.template.content,
|
|
45559
45559
|
inMap: sfc.template.map
|
|
@@ -45618,8 +45618,8 @@ return ${returned}
|
|
|
45618
45618
|
}
|
|
45619
45619
|
const genDefaultAs = options.genDefaultAs ? `const ${options.genDefaultAs} =` : `export default`;
|
|
45620
45620
|
let runtimeOptions = ``;
|
|
45621
|
-
if (!ctx.hasDefaultExportName &&
|
|
45622
|
-
const match =
|
|
45621
|
+
if (!ctx.hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
|
|
45622
|
+
const match = filename.match(/([^/\\]+)\.\w+$/);
|
|
45623
45623
|
if (match) {
|
|
45624
45624
|
runtimeOptions += `
|
|
45625
45625
|
__name: '${match[1]}',`;
|
|
@@ -45689,7 +45689,7 @@ ${exposeCall}`
|
|
|
45689
45689
|
imports: ctx.userImports,
|
|
45690
45690
|
content: ctx.s.toString(),
|
|
45691
45691
|
map: options.sourceMap !== false ? ctx.s.generateMap({
|
|
45692
|
-
source:
|
|
45692
|
+
source: filename,
|
|
45693
45693
|
hires: true,
|
|
45694
45694
|
includeContent: true
|
|
45695
45695
|
}) : void 0,
|
|
@@ -45871,34 +45871,45 @@ ${exposeCall}`
|
|
|
45871
45871
|
};
|
|
45872
45872
|
__spreadValues2(__spreadValues2({}, errorMessages$1), DOMErrorMessages);
|
|
45873
45873
|
libExports.parse;
|
|
45874
|
-
const filename = `${REPO_NAME}.vue`;
|
|
45875
|
-
const id = REPO_NAME;
|
|
45876
45874
|
function compilerSfc(source) {
|
|
45877
45875
|
var _a2, _b2;
|
|
45876
|
+
const id2 = REPO_NAME;
|
|
45877
|
+
const filename = `${REPO_NAME}.vue`;
|
|
45878
45878
|
const sfcParseResult = parse$2(source, { filename });
|
|
45879
45879
|
sfcParseResult.errors.forEach((e) => {
|
|
45880
45880
|
console.warn(e);
|
|
45881
45881
|
});
|
|
45882
|
-
const sfcScriptBlock = compileScript(sfcParseResult.descriptor, { id, isProd: false });
|
|
45883
|
-
const sfcTemplateCompileResults = compileTemplate({
|
|
45884
|
-
id,
|
|
45885
|
-
filename,
|
|
45886
|
-
source: (_b2 = (_a2 = sfcParseResult.descriptor.template) == null ? void 0 : _a2.content) != null ? _b2 : "",
|
|
45887
|
-
isProd: false
|
|
45888
|
-
});
|
|
45889
45882
|
const sfcStyleCompileResultsList = sfcParseResult.descriptor.styles.map((style) => {
|
|
45890
|
-
|
|
45891
|
-
id,
|
|
45883
|
+
const sfcStyleCompileResults = compileStyle({
|
|
45884
|
+
id: id2,
|
|
45892
45885
|
filename,
|
|
45893
45886
|
source: style.content,
|
|
45894
45887
|
scoped: style.scoped,
|
|
45895
45888
|
isProd: false
|
|
45896
45889
|
});
|
|
45890
|
+
sfcStyleCompileResults.errors.forEach((e) => {
|
|
45891
|
+
console.warn(e);
|
|
45892
|
+
});
|
|
45893
|
+
return sfcStyleCompileResults;
|
|
45894
|
+
});
|
|
45895
|
+
const sfcAppBlock = compileScript(sfcParseResult.descriptor, {
|
|
45896
|
+
id: id2,
|
|
45897
|
+
isProd: false
|
|
45898
|
+
});
|
|
45899
|
+
sfcAppBlock.isScoped = sfcParseResult.descriptor.styles.some((s) => s.scoped);
|
|
45900
|
+
const sfcTemplateCompileResults = compileTemplate({
|
|
45901
|
+
id: id2,
|
|
45902
|
+
filename,
|
|
45903
|
+
source: (_b2 = (_a2 = sfcParseResult.descriptor.template) == null ? void 0 : _a2.content) != null ? _b2 : "",
|
|
45904
|
+
isProd: false
|
|
45905
|
+
});
|
|
45906
|
+
sfcTemplateCompileResults.errors.forEach((e) => {
|
|
45907
|
+
console.warn(e);
|
|
45897
45908
|
});
|
|
45898
45909
|
return {
|
|
45899
|
-
|
|
45900
|
-
|
|
45901
|
-
|
|
45910
|
+
sfcStyleCompileResultsList,
|
|
45911
|
+
sfcAppBlock,
|
|
45912
|
+
sfcTemplateCompileResults
|
|
45902
45913
|
};
|
|
45903
45914
|
}
|
|
45904
45915
|
function createDom(row, inner) {
|
|
@@ -45945,40 +45956,45 @@ ${exposeCall}`
|
|
|
45945
45956
|
node2.localName === "style" ? node2.onload = node2.remove : node2.remove();
|
|
45946
45957
|
});
|
|
45947
45958
|
const hasScript = clientCodeList.some((code) => code.slice(1, 7) === "script");
|
|
45948
|
-
|
|
45949
|
-
|
|
45950
|
-
const { sfcScriptBlock, sfcTemplateCompileResults, sfcStyleCompileResultsList } = compilerSfc(clientCodeList.join("\n"));
|
|
45951
|
-
handler(sfcStyleCompileResultsList, sfcScriptBlock, sfcTemplateCompileResults);
|
|
45959
|
+
hasScript || clientCodeList.push("<script>/* empty script */<\/script>");
|
|
45960
|
+
handler(compilerSfc(clientCodeList.join("\n")));
|
|
45952
45961
|
});
|
|
45953
45962
|
}
|
|
45954
|
-
function
|
|
45963
|
+
function generateCssCode(sfcStyleCompileResultsList) {
|
|
45955
45964
|
return sfcStyleCompileResultsList.map((style) => style.code).join("\n");
|
|
45956
45965
|
}
|
|
45957
|
-
function generateEsmCode(
|
|
45966
|
+
function generateEsmCode(sfcAppBlock, sfcTemplateCompileResults) {
|
|
45958
45967
|
return `
|
|
45959
45968
|
${INIT_CODE}
|
|
45960
|
-
${_scriptTransform(
|
|
45969
|
+
${_scriptTransform(sfcAppBlock)}
|
|
45961
45970
|
${_templateTransform(sfcTemplateCompileResults)}
|
|
45962
45971
|
${CREATE_APP_CODE}
|
|
45963
45972
|
`;
|
|
45964
|
-
function _scriptTransform(
|
|
45965
|
-
const s = new MagicString(
|
|
45973
|
+
function _scriptTransform(sfcAppBlock2) {
|
|
45974
|
+
const s = new MagicString(sfcAppBlock2.content);
|
|
45966
45975
|
s.replace("export default", `${APP_VAR_NAME} =`);
|
|
45967
|
-
s.
|
|
45976
|
+
sfcAppBlock2.isScoped && s.prependLeft(sfcAppBlock2.content.indexOf("__name"), `__scopeId: "data-v-${REPO_NAME}",`);
|
|
45977
|
+
s.replace(/Object\.defineProperty\(__returned__.*/, "");
|
|
45968
45978
|
return s.toString();
|
|
45969
45979
|
}
|
|
45970
45980
|
function _templateTransform(sfcTemplateCompileResults2) {
|
|
45971
|
-
const
|
|
45972
|
-
|
|
45973
|
-
return
|
|
45981
|
+
const s = new MagicString(sfcTemplateCompileResults2.code);
|
|
45982
|
+
s.replace("export function render", `${APP_VAR_NAME}.render = function`);
|
|
45983
|
+
return s.toString();
|
|
45974
45984
|
}
|
|
45975
45985
|
}
|
|
45976
|
-
|
|
45986
|
+
function generator(compiledSfc) {
|
|
45987
|
+
const { sfcAppBlock, sfcStyleCompileResultsList, sfcTemplateCompileResults } = compiledSfc;
|
|
45988
|
+
return {
|
|
45989
|
+
esmCode: generateEsmCode(sfcAppBlock, sfcTemplateCompileResults),
|
|
45990
|
+
cssCode: generateCssCode(sfcStyleCompileResultsList)
|
|
45991
|
+
};
|
|
45992
|
+
}
|
|
45993
|
+
awaitCompileSfc((compiledSfc) => {
|
|
45994
|
+
const _toHead = (...args) => createDom(...args).mount(document.head);
|
|
45995
|
+
const g = generator(compiledSfc);
|
|
45977
45996
|
_toHead(`<script ${REPO_NAME} type="importmap">${IMPORTS_JSON}<\/script>`);
|
|
45978
|
-
_toHead(`<script ${REPO_NAME} type="module">`,
|
|
45979
|
-
_toHead(`<style ${REPO_NAME}>`,
|
|
45997
|
+
_toHead(`<script ${REPO_NAME} type="module">`, g.esmCode);
|
|
45998
|
+
_toHead(`<style ${REPO_NAME}>`, g.cssCode);
|
|
45980
45999
|
});
|
|
45981
|
-
function _toHead(...args) {
|
|
45982
|
-
createDom(...args).mount(document.head);
|
|
45983
|
-
}
|
|
45984
46000
|
})();
|