setupin 3.1.0 → 3.1.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.
- package/README.md +2 -0
- package/README.zh-CN.md +1 -0
- package/dist/main.js +161 -161
- package/dist/main.prod.js +95 -90
- package/package.json +3 -5
package/dist/main.js
CHANGED
|
@@ -51,26 +51,29 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
};
|
|
52
52
|
(function() {
|
|
53
53
|
"use strict";
|
|
54
|
-
const ASCII_LOGO = "
|
|
54
|
+
const ASCII_LOGO = "/***************************************\r\n** _ _ **\r\n** ___ ___| |_ _ _ _ __ (_)_ __ **\r\n** / __|/ _ \\ __| | | | '_ \\| | '_ \\ **\r\n** \\__ \\ __/ |_| |_| | |_/ | | | | | **\r\n** |___/\\___|\\__|\\__,_| .__/|_|_| |_| **\r\n** |_| **\r\n***************************************/";
|
|
55
55
|
const APP_VAR_NAME = "APP$";
|
|
56
56
|
const REPO_NAME = "setupin";
|
|
57
|
-
const
|
|
57
|
+
const IMPORTS_TAG_CODE = `
|
|
58
|
+
<script ${REPO_NAME} type="importmap">
|
|
59
|
+
${JSON.stringify({ imports: { vue: "https://unpkg.com/vue@latest/dist/vue.runtime.esm-browser.js" } })}
|
|
60
|
+
<\/script>
|
|
61
|
+
`;
|
|
58
62
|
const INIT_CODE = `
|
|
59
|
-
|
|
60
|
-
import * as Vue from "vue";
|
|
61
|
-
let ${APP_VAR_NAME} = Object.create(null);
|
|
63
|
+
let ${APP_VAR_NAME} = {}
|
|
62
64
|
`;
|
|
63
65
|
const CREATE_APP_CODE = `
|
|
64
|
-
|
|
66
|
+
import { createApp as _createApp, defineComponent as _defineComponent, h as _h, Suspense as _Suspense } from 'vue'
|
|
67
|
+
_createApp(_defineComponent(
|
|
65
68
|
String(${APP_VAR_NAME}.setup).startsWith('async')
|
|
66
|
-
? () => () =>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
69
|
+
? () => () => _h(_Suspense, null, {
|
|
70
|
+
default: _h(${APP_VAR_NAME}),
|
|
71
|
+
fallback: _h('div', 'Loading...'),
|
|
72
|
+
})
|
|
71
73
|
: ${APP_VAR_NAME}
|
|
72
74
|
)).mount(document.body)
|
|
73
75
|
`;
|
|
76
|
+
const SCOPED_ID_CODE = `${APP_VAR_NAME}.__scopeId = "data-v-${REPO_NAME}"`;
|
|
74
77
|
/**
|
|
75
78
|
* @vue/compiler-sfc v3.5.12
|
|
76
79
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
@@ -18050,7 +18053,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
18050
18053
|
}
|
|
18051
18054
|
}
|
|
18052
18055
|
function createTransformContext(root2, {
|
|
18053
|
-
filename
|
|
18056
|
+
filename = "",
|
|
18054
18057
|
prefixIdentifiers = false,
|
|
18055
18058
|
hoistStatic = false,
|
|
18056
18059
|
hmr = false,
|
|
@@ -18073,10 +18076,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
18073
18076
|
onWarn = defaultOnWarn,
|
|
18074
18077
|
compatConfig
|
|
18075
18078
|
}) {
|
|
18076
|
-
const nameMatch =
|
|
18079
|
+
const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/);
|
|
18077
18080
|
const context = {
|
|
18078
18081
|
// options
|
|
18079
|
-
filename
|
|
18082
|
+
filename,
|
|
18080
18083
|
selfName: nameMatch && capitalize(camelize(nameMatch[1])),
|
|
18081
18084
|
prefixIdentifiers,
|
|
18082
18085
|
hoistStatic,
|
|
@@ -18982,7 +18985,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
18982
18985
|
SourceMapGenerator.prototype._version = 3;
|
|
18983
18986
|
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
|
|
18984
18987
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
18985
|
-
var
|
|
18988
|
+
var generator2 = new SourceMapGenerator(Object.assign(generatorOps || {}, {
|
|
18986
18989
|
file: aSourceMapConsumer.file,
|
|
18987
18990
|
sourceRoot
|
|
18988
18991
|
}));
|
|
@@ -19006,22 +19009,22 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
19006
19009
|
newMapping.name = mapping.name;
|
|
19007
19010
|
}
|
|
19008
19011
|
}
|
|
19009
|
-
|
|
19012
|
+
generator2.addMapping(newMapping);
|
|
19010
19013
|
});
|
|
19011
19014
|
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
19012
19015
|
var sourceRelative = sourceFile;
|
|
19013
19016
|
if (sourceRoot !== null) {
|
|
19014
19017
|
sourceRelative = util2.relative(sourceRoot, sourceFile);
|
|
19015
19018
|
}
|
|
19016
|
-
if (!
|
|
19017
|
-
|
|
19019
|
+
if (!generator2._sources.has(sourceRelative)) {
|
|
19020
|
+
generator2._sources.add(sourceRelative);
|
|
19018
19021
|
}
|
|
19019
19022
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
19020
19023
|
if (content != null) {
|
|
19021
|
-
|
|
19024
|
+
generator2.setSourceContent(sourceFile, content);
|
|
19022
19025
|
}
|
|
19023
19026
|
});
|
|
19024
|
-
return
|
|
19027
|
+
return generator2;
|
|
19025
19028
|
};
|
|
19026
19029
|
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
19027
19030
|
var generated = util2.getArg(aArgs, "generated");
|
|
@@ -20285,7 +20288,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
20285
20288
|
mode = "function",
|
|
20286
20289
|
prefixIdentifiers = mode === "module",
|
|
20287
20290
|
sourceMap: sourceMap2 = false,
|
|
20288
|
-
filename
|
|
20291
|
+
filename = `template.vue.html`,
|
|
20289
20292
|
scopeId = null,
|
|
20290
20293
|
optimizeImports = false,
|
|
20291
20294
|
runtimeGlobalName = `Vue`,
|
|
@@ -20299,7 +20302,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
20299
20302
|
mode,
|
|
20300
20303
|
prefixIdentifiers,
|
|
20301
20304
|
sourceMap: sourceMap2,
|
|
20302
|
-
filename
|
|
20305
|
+
filename,
|
|
20303
20306
|
scopeId,
|
|
20304
20307
|
optimizeImports,
|
|
20305
20308
|
runtimeGlobalName,
|
|
@@ -20381,14 +20384,14 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
20381
20384
|
// source-map column is 0 based
|
|
20382
20385
|
generatedLine: context.line,
|
|
20383
20386
|
generatedColumn: context.column - 1,
|
|
20384
|
-
source:
|
|
20387
|
+
source: filename,
|
|
20385
20388
|
name
|
|
20386
20389
|
});
|
|
20387
20390
|
}
|
|
20388
20391
|
if (sourceMap2) {
|
|
20389
20392
|
context.map = new sourceMapExports.SourceMapGenerator();
|
|
20390
|
-
context.map.setSourceContent(
|
|
20391
|
-
context.map._sources.add(
|
|
20393
|
+
context.map.setSourceContent(filename, context.source);
|
|
20394
|
+
context.map._sources.add(filename);
|
|
20392
20395
|
}
|
|
20393
20396
|
return context;
|
|
20394
20397
|
}
|
|
@@ -24673,7 +24676,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24673
24676
|
}
|
|
24674
24677
|
const {
|
|
24675
24678
|
sourceMap: sourceMap2 = true,
|
|
24676
|
-
filename
|
|
24679
|
+
filename = DEFAULT_FILENAME,
|
|
24677
24680
|
sourceRoot = "",
|
|
24678
24681
|
pad: pad2 = false,
|
|
24679
24682
|
ignoreEmpty = true,
|
|
@@ -24681,7 +24684,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24681
24684
|
templateParseOptions = {}
|
|
24682
24685
|
} = options;
|
|
24683
24686
|
const descriptor = {
|
|
24684
|
-
filename
|
|
24687
|
+
filename,
|
|
24685
24688
|
source,
|
|
24686
24689
|
template: null,
|
|
24687
24690
|
script: null,
|
|
@@ -24796,7 +24799,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24796
24799
|
const genMap = (block, columnOffset = 0) => {
|
|
24797
24800
|
if (block && !block.src) {
|
|
24798
24801
|
block.map = generateSourceMap(
|
|
24799
|
-
|
|
24802
|
+
filename,
|
|
24800
24803
|
source,
|
|
24801
24804
|
block.content,
|
|
24802
24805
|
sourceRoot,
|
|
@@ -24866,13 +24869,13 @@ ${defaultVar}.setup = __setup__
|
|
|
24866
24869
|
const splitRE = /\r?\n/g;
|
|
24867
24870
|
const emptyRE = /^(?:\/\/)?\s*$/;
|
|
24868
24871
|
const replaceRE = /./g;
|
|
24869
|
-
function generateSourceMap(
|
|
24872
|
+
function generateSourceMap(filename, source, generated, sourceRoot, lineOffset, columnOffset) {
|
|
24870
24873
|
const map2 = new sourceMapExports.SourceMapGenerator({
|
|
24871
|
-
file:
|
|
24874
|
+
file: filename.replace(/\\/g, "/"),
|
|
24872
24875
|
sourceRoot: sourceRoot.replace(/\\/g, "/")
|
|
24873
24876
|
});
|
|
24874
|
-
map2.setSourceContent(
|
|
24875
|
-
map2._sources.add(
|
|
24877
|
+
map2.setSourceContent(filename, source);
|
|
24878
|
+
map2._sources.add(filename);
|
|
24876
24879
|
generated.split(splitRE).forEach((line, index) => {
|
|
24877
24880
|
if (!emptyRE.test(line)) {
|
|
24878
24881
|
const originalLine = index + 1 + lineOffset;
|
|
@@ -24884,7 +24887,7 @@ ${defaultVar}.setup = __setup__
|
|
|
24884
24887
|
originalColumn: i + columnOffset,
|
|
24885
24888
|
generatedLine,
|
|
24886
24889
|
generatedColumn: i,
|
|
24887
|
-
source:
|
|
24890
|
+
source: filename,
|
|
24888
24891
|
name: null
|
|
24889
24892
|
});
|
|
24890
24893
|
}
|
|
@@ -24973,8 +24976,8 @@ ${defaultVar}.setup = __setup__
|
|
|
24973
24976
|
return parts;
|
|
24974
24977
|
}
|
|
24975
24978
|
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
24976
|
-
var splitPath = function(
|
|
24977
|
-
return splitPathRe.exec(
|
|
24979
|
+
var splitPath = function(filename) {
|
|
24980
|
+
return splitPathRe.exec(filename).slice(1);
|
|
24978
24981
|
};
|
|
24979
24982
|
function resolve() {
|
|
24980
24983
|
var resolvedPath = "", resolvedAbsolute = false;
|
|
@@ -29656,12 +29659,12 @@ ${defaultVar}.setup = __setup__
|
|
|
29656
29659
|
return a;
|
|
29657
29660
|
};
|
|
29658
29661
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
29659
|
-
function preprocess$1({ source, filename
|
|
29662
|
+
function preprocess$1({ source, filename, preprocessOptions }, preprocessor) {
|
|
29660
29663
|
let res = "";
|
|
29661
29664
|
let err = null;
|
|
29662
29665
|
preprocessor.render(
|
|
29663
29666
|
source,
|
|
29664
|
-
__spreadValues$6({ filename
|
|
29667
|
+
__spreadValues$6({ filename }, preprocessOptions),
|
|
29665
29668
|
(_err, _res) => {
|
|
29666
29669
|
if (_err) err = _err;
|
|
29667
29670
|
res = _res;
|
|
@@ -29709,7 +29712,7 @@ ${defaultVar}.setup = __setup__
|
|
|
29709
29712
|
}
|
|
29710
29713
|
}
|
|
29711
29714
|
function doCompileTemplate({
|
|
29712
|
-
filename
|
|
29715
|
+
filename,
|
|
29713
29716
|
id: id2,
|
|
29714
29717
|
scoped,
|
|
29715
29718
|
slotted,
|
|
@@ -29775,7 +29778,7 @@ ${defaultVar}.setup = __setup__
|
|
|
29775
29778
|
}, compilerOptions), {
|
|
29776
29779
|
hmr: !isProd,
|
|
29777
29780
|
nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
|
|
29778
|
-
filename
|
|
29781
|
+
filename,
|
|
29779
29782
|
onError: (e) => errors2.push(e),
|
|
29780
29783
|
onWarn: (w) => warnings.push(w)
|
|
29781
29784
|
}));
|
|
@@ -29834,17 +29837,17 @@ ${generateCodeFrame(
|
|
|
29834
29837
|
name: origPosInOldMap.name
|
|
29835
29838
|
});
|
|
29836
29839
|
});
|
|
29837
|
-
const
|
|
29840
|
+
const generator2 = mergedMapGenerator;
|
|
29838
29841
|
oldMapConsumer.sources.forEach((sourceFile) => {
|
|
29839
|
-
|
|
29842
|
+
generator2._sources.add(sourceFile);
|
|
29840
29843
|
const sourceContent = oldMapConsumer.sourceContentFor(sourceFile);
|
|
29841
29844
|
if (sourceContent != null) {
|
|
29842
29845
|
mergedMapGenerator.setSourceContent(sourceFile, sourceContent);
|
|
29843
29846
|
}
|
|
29844
29847
|
});
|
|
29845
|
-
|
|
29846
|
-
|
|
29847
|
-
return
|
|
29848
|
+
generator2._sourceRoot = oldMap.sourceRoot;
|
|
29849
|
+
generator2._file = oldMap.file;
|
|
29850
|
+
return generator2.toJSON();
|
|
29848
29851
|
}
|
|
29849
29852
|
function patchErrors(errors2, source, inMap) {
|
|
29850
29853
|
const originalSource = inMap.sourcesContent[0];
|
|
@@ -32109,7 +32112,7 @@ ${generateCodeFrame(
|
|
|
32109
32112
|
SourceMapGenerator.prototype._version = 3;
|
|
32110
32113
|
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
|
|
32111
32114
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
32112
|
-
var
|
|
32115
|
+
var generator2 = new SourceMapGenerator(Object.assign(generatorOps || {}, {
|
|
32113
32116
|
file: aSourceMapConsumer.file,
|
|
32114
32117
|
sourceRoot
|
|
32115
32118
|
}));
|
|
@@ -32133,22 +32136,22 @@ ${generateCodeFrame(
|
|
|
32133
32136
|
newMapping.name = mapping.name;
|
|
32134
32137
|
}
|
|
32135
32138
|
}
|
|
32136
|
-
|
|
32139
|
+
generator2.addMapping(newMapping);
|
|
32137
32140
|
});
|
|
32138
32141
|
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
32139
32142
|
var sourceRelative = sourceFile;
|
|
32140
32143
|
if (sourceRoot !== null) {
|
|
32141
32144
|
sourceRelative = util2.relative(sourceRoot, sourceFile);
|
|
32142
32145
|
}
|
|
32143
|
-
if (!
|
|
32144
|
-
|
|
32146
|
+
if (!generator2._sources.has(sourceRelative)) {
|
|
32147
|
+
generator2._sources.add(sourceRelative);
|
|
32145
32148
|
}
|
|
32146
32149
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
32147
32150
|
if (content != null) {
|
|
32148
|
-
|
|
32151
|
+
generator2.setSourceContent(sourceFile, content);
|
|
32149
32152
|
}
|
|
32150
32153
|
});
|
|
32151
|
-
return
|
|
32154
|
+
return generator2;
|
|
32152
32155
|
};
|
|
32153
32156
|
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
32154
32157
|
var generated = util2.getArg(aArgs, "generated");
|
|
@@ -36767,10 +36770,10 @@ ${generateCodeFrame(
|
|
|
36767
36770
|
})(comment, comment.exports);
|
|
36768
36771
|
return comment.exports;
|
|
36769
36772
|
}
|
|
36770
|
-
var id
|
|
36773
|
+
var id = { exports: {} };
|
|
36771
36774
|
var hasRequiredId;
|
|
36772
36775
|
function requireId() {
|
|
36773
|
-
if (hasRequiredId) return id
|
|
36776
|
+
if (hasRequiredId) return id.exports;
|
|
36774
36777
|
hasRequiredId = 1;
|
|
36775
36778
|
(function(module, exports) {
|
|
36776
36779
|
exports.__esModule = true;
|
|
@@ -36808,8 +36811,8 @@ ${generateCodeFrame(
|
|
|
36808
36811
|
}(_node["default"]);
|
|
36809
36812
|
exports["default"] = ID;
|
|
36810
36813
|
module.exports = exports.default;
|
|
36811
|
-
})(id
|
|
36812
|
-
return id
|
|
36814
|
+
})(id, id.exports);
|
|
36815
|
+
return id.exports;
|
|
36813
36816
|
}
|
|
36814
36817
|
var tag = { exports: {} };
|
|
36815
36818
|
var namespace = { exports: {} };
|
|
@@ -40039,7 +40042,7 @@ ${generateCodeFrame(
|
|
|
40039
40042
|
SourceMapGenerator.prototype._version = 3;
|
|
40040
40043
|
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
|
|
40041
40044
|
var sourceRoot = aSourceMapConsumer.sourceRoot;
|
|
40042
|
-
var
|
|
40045
|
+
var generator2 = new SourceMapGenerator({
|
|
40043
40046
|
file: aSourceMapConsumer.file,
|
|
40044
40047
|
sourceRoot
|
|
40045
40048
|
});
|
|
@@ -40063,22 +40066,22 @@ ${generateCodeFrame(
|
|
|
40063
40066
|
newMapping.name = mapping.name;
|
|
40064
40067
|
}
|
|
40065
40068
|
}
|
|
40066
|
-
|
|
40069
|
+
generator2.addMapping(newMapping);
|
|
40067
40070
|
});
|
|
40068
40071
|
aSourceMapConsumer.sources.forEach(function(sourceFile) {
|
|
40069
40072
|
var sourceRelative = sourceFile;
|
|
40070
40073
|
if (sourceRoot !== null) {
|
|
40071
40074
|
sourceRelative = util2.relative(sourceRoot, sourceFile);
|
|
40072
40075
|
}
|
|
40073
|
-
if (!
|
|
40074
|
-
|
|
40076
|
+
if (!generator2._sources.has(sourceRelative)) {
|
|
40077
|
+
generator2._sources.add(sourceRelative);
|
|
40075
40078
|
}
|
|
40076
40079
|
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
|
|
40077
40080
|
if (content != null) {
|
|
40078
|
-
|
|
40081
|
+
generator2.setSourceContent(sourceFile, content);
|
|
40079
40082
|
}
|
|
40080
40083
|
});
|
|
40081
|
-
return
|
|
40084
|
+
return generator2;
|
|
40082
40085
|
};
|
|
40083
40086
|
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
|
|
40084
40087
|
var generated = util2.getArg(aArgs, "generated");
|
|
@@ -41433,10 +41436,10 @@ ${generateCodeFrame(
|
|
|
41433
41436
|
return { code: "", errors: [e], dependencies: [] };
|
|
41434
41437
|
}
|
|
41435
41438
|
};
|
|
41436
|
-
function getSource(source,
|
|
41439
|
+
function getSource(source, filename, additionalData) {
|
|
41437
41440
|
if (!additionalData) return source;
|
|
41438
41441
|
if (isFunction$1(additionalData)) {
|
|
41439
|
-
return additionalData(source,
|
|
41442
|
+
return additionalData(source, filename);
|
|
41440
41443
|
}
|
|
41441
41444
|
return additionalData + source;
|
|
41442
41445
|
}
|
|
@@ -41473,7 +41476,7 @@ ${generateCodeFrame(
|
|
|
41473
41476
|
}
|
|
41474
41477
|
function doCompileStyle(options) {
|
|
41475
41478
|
const {
|
|
41476
|
-
filename
|
|
41479
|
+
filename,
|
|
41477
41480
|
id: id2,
|
|
41478
41481
|
scoped = false,
|
|
41479
41482
|
trim = true,
|
|
@@ -41507,8 +41510,8 @@ ${generateCodeFrame(
|
|
|
41507
41510
|
}
|
|
41508
41511
|
}
|
|
41509
41512
|
const postCSSOptions = __spreadProps$3(__spreadValues$4({}, postcssOptions), {
|
|
41510
|
-
to:
|
|
41511
|
-
from:
|
|
41513
|
+
to: filename,
|
|
41514
|
+
from: filename
|
|
41512
41515
|
});
|
|
41513
41516
|
if (map2) {
|
|
41514
41517
|
postCSSOptions.map = {
|
|
@@ -41523,7 +41526,7 @@ ${generateCodeFrame(
|
|
|
41523
41526
|
const dependencies = new Set(
|
|
41524
41527
|
preProcessedSource ? preProcessedSource.dependencies : []
|
|
41525
41528
|
);
|
|
41526
|
-
dependencies.delete(
|
|
41529
|
+
dependencies.delete(filename);
|
|
41527
41530
|
const errors2 = [];
|
|
41528
41531
|
if (preProcessedSource && preProcessedSource.errors.length) {
|
|
41529
41532
|
errors2.push(...preProcessedSource.errors);
|
|
@@ -42772,9 +42775,9 @@ ${generateCodeFrame(
|
|
|
42772
42775
|
this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
|
|
42773
42776
|
this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
|
|
42774
42777
|
const customElement = options.customElement;
|
|
42775
|
-
const
|
|
42778
|
+
const filename = this.descriptor.filename;
|
|
42776
42779
|
if (customElement) {
|
|
42777
|
-
this.isCE = typeof customElement === "boolean" ? customElement : customElement(
|
|
42780
|
+
this.isCE = typeof customElement === "boolean" ? customElement : customElement(filename);
|
|
42778
42781
|
}
|
|
42779
42782
|
const plugins = resolveParserPlugins(
|
|
42780
42783
|
scriptLang || scriptSetupLang,
|
|
@@ -43016,8 +43019,8 @@ export default ${defaultVar}`;
|
|
|
43016
43019
|
};
|
|
43017
43020
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
43018
43021
|
class TypeScope {
|
|
43019
|
-
constructor(
|
|
43020
|
-
this.filename =
|
|
43022
|
+
constructor(filename, source, offset = 0, imports = /* @__PURE__ */ Object.create(null), types2 = /* @__PURE__ */ Object.create(null), declares = /* @__PURE__ */ Object.create(null)) {
|
|
43023
|
+
this.filename = filename;
|
|
43021
43024
|
this.source = source;
|
|
43022
43025
|
this.offset = offset;
|
|
43023
43026
|
this.imports = imports;
|
|
@@ -43615,11 +43618,11 @@ Note: both in 3.2 or with the ignore, the properties in the base type are treate
|
|
|
43615
43618
|
if (!resolved) {
|
|
43616
43619
|
if (source.startsWith("..")) {
|
|
43617
43620
|
const osSpecificJoinFn = joinPaths;
|
|
43618
|
-
const
|
|
43619
|
-
resolved = resolveExt(
|
|
43621
|
+
const filename = osSpecificJoinFn(dirname(scope.filename), source);
|
|
43622
|
+
resolved = resolveExt(filename, fs);
|
|
43620
43623
|
} else if (source[0] === ".") {
|
|
43621
|
-
const
|
|
43622
|
-
resolved = resolveExt(
|
|
43624
|
+
const filename = joinPaths(dirname(scope.filename), source);
|
|
43625
|
+
resolved = resolveExt(filename, fs);
|
|
43623
43626
|
} else {
|
|
43624
43627
|
{
|
|
43625
43628
|
return ctx.error(
|
|
@@ -43644,35 +43647,35 @@ Note: both in 3.2 or with the ignore, the properties in the base type are treate
|
|
|
43644
43647
|
);
|
|
43645
43648
|
}
|
|
43646
43649
|
}
|
|
43647
|
-
function resolveExt(
|
|
43648
|
-
|
|
43649
|
-
const tryResolve = (
|
|
43650
|
-
if (fs.fileExists(
|
|
43650
|
+
function resolveExt(filename, fs) {
|
|
43651
|
+
filename = filename.replace(/\.js$/, "");
|
|
43652
|
+
const tryResolve = (filename2) => {
|
|
43653
|
+
if (fs.fileExists(filename2)) return filename2;
|
|
43651
43654
|
};
|
|
43652
|
-
return tryResolve(
|
|
43655
|
+
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
43656
|
}
|
|
43654
43657
|
const fileToScopeCache = createCache();
|
|
43655
|
-
function fileToScope(ctx,
|
|
43656
|
-
const cached = fileToScopeCache.get(
|
|
43658
|
+
function fileToScope(ctx, filename, asGlobal = false) {
|
|
43659
|
+
const cached = fileToScopeCache.get(filename);
|
|
43657
43660
|
if (cached) {
|
|
43658
43661
|
return cached;
|
|
43659
43662
|
}
|
|
43660
43663
|
const fs = resolveFS(ctx);
|
|
43661
|
-
const source = fs.readFile(
|
|
43662
|
-
const body = parseFile(
|
|
43663
|
-
const scope = new TypeScope(
|
|
43664
|
+
const source = fs.readFile(filename) || "";
|
|
43665
|
+
const body = parseFile(filename, source, ctx.options.babelParserPlugins);
|
|
43666
|
+
const scope = new TypeScope(filename, source, 0, recordImports(body));
|
|
43664
43667
|
recordTypes(ctx, body, scope, asGlobal);
|
|
43665
|
-
fileToScopeCache.set(
|
|
43668
|
+
fileToScopeCache.set(filename, scope);
|
|
43666
43669
|
return scope;
|
|
43667
43670
|
}
|
|
43668
|
-
function parseFile(
|
|
43669
|
-
const ext = extname(
|
|
43671
|
+
function parseFile(filename, content, parserPlugins) {
|
|
43672
|
+
const ext = extname(filename);
|
|
43670
43673
|
if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") {
|
|
43671
43674
|
return libExports.parse(content, {
|
|
43672
43675
|
plugins: resolveParserPlugins(
|
|
43673
43676
|
ext.slice(1),
|
|
43674
43677
|
parserPlugins,
|
|
43675
|
-
/\.d\.m?ts$/.test(
|
|
43678
|
+
/\.d\.m?ts$/.test(filename)
|
|
43676
43679
|
),
|
|
43677
43680
|
sourceType: "module"
|
|
43678
43681
|
}).program.body;
|
|
@@ -45080,7 +45083,7 @@ Upgrade your vite or vue-loader version for compatibility with the latest experi
|
|
|
45080
45083
|
);
|
|
45081
45084
|
}
|
|
45082
45085
|
const ctx = new ScriptCompileContext(sfc, options);
|
|
45083
|
-
const { script, scriptSetup, source, filename
|
|
45086
|
+
const { script, scriptSetup, source, filename } = sfc;
|
|
45084
45087
|
const hoistStatic = options.hoistStatic !== false && !script;
|
|
45085
45088
|
const scopeId = options.id ? options.id.replace(/^data-v-/, "") : "";
|
|
45086
45089
|
const scriptLang = script && script.lang;
|
|
@@ -45553,7 +45556,7 @@ let __temp${any}, __restore${any}
|
|
|
45553
45556
|
hasInlinedSsrRenderFn = true;
|
|
45554
45557
|
}
|
|
45555
45558
|
const { code, ast, preamble, tips, errors: errors2 } = compileTemplate(__spreadProps2(__spreadValues$1({
|
|
45556
|
-
filename
|
|
45559
|
+
filename,
|
|
45557
45560
|
ast: sfc.template.ast,
|
|
45558
45561
|
source: sfc.template.content,
|
|
45559
45562
|
inMap: sfc.template.map
|
|
@@ -45618,8 +45621,8 @@ return ${returned}
|
|
|
45618
45621
|
}
|
|
45619
45622
|
const genDefaultAs = options.genDefaultAs ? `const ${options.genDefaultAs} =` : `export default`;
|
|
45620
45623
|
let runtimeOptions = ``;
|
|
45621
|
-
if (!ctx.hasDefaultExportName &&
|
|
45622
|
-
const match =
|
|
45624
|
+
if (!ctx.hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) {
|
|
45625
|
+
const match = filename.match(/([^/\\]+)\.\w+$/);
|
|
45623
45626
|
if (match) {
|
|
45624
45627
|
runtimeOptions += `
|
|
45625
45628
|
__name: '${match[1]}',`;
|
|
@@ -45689,7 +45692,7 @@ ${exposeCall}`
|
|
|
45689
45692
|
imports: ctx.userImports,
|
|
45690
45693
|
content: ctx.s.toString(),
|
|
45691
45694
|
map: options.sourceMap !== false ? ctx.s.generateMap({
|
|
45692
|
-
source:
|
|
45695
|
+
source: filename,
|
|
45693
45696
|
hires: true,
|
|
45694
45697
|
includeContent: true
|
|
45695
45698
|
}) : void 0,
|
|
@@ -45871,46 +45874,53 @@ ${exposeCall}`
|
|
|
45871
45874
|
};
|
|
45872
45875
|
__spreadValues2(__spreadValues2({}, errorMessages$1), DOMErrorMessages);
|
|
45873
45876
|
libExports.parse;
|
|
45874
|
-
|
|
45875
|
-
|
|
45876
|
-
function compilerSfc(source) {
|
|
45877
|
-
var _a2, _b2;
|
|
45878
|
-
const sfcParseResult = parse$2(source, { filename });
|
|
45879
|
-
sfcParseResult.errors.forEach((e) => {
|
|
45880
|
-
console.warn(e);
|
|
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 : "",
|
|
45877
|
+
function appCompiler(descriptor, info) {
|
|
45878
|
+
const sfcAppBlock = compileScript(descriptor, __spreadProps(__spreadValues({}, info), {
|
|
45887
45879
|
isProd: false
|
|
45888
|
-
});
|
|
45889
|
-
|
|
45890
|
-
|
|
45891
|
-
|
|
45892
|
-
|
|
45880
|
+
}));
|
|
45881
|
+
sfcAppBlock.isScoped = descriptor.styles.some((s) => s.scoped);
|
|
45882
|
+
return sfcAppBlock;
|
|
45883
|
+
}
|
|
45884
|
+
function stylesCompiler(styles, info) {
|
|
45885
|
+
return styles.map((style) => {
|
|
45886
|
+
const sfcStyleCompileResults = compileStyle(__spreadProps(__spreadValues({}, info), {
|
|
45893
45887
|
source: style.content,
|
|
45894
45888
|
scoped: style.scoped,
|
|
45895
45889
|
isProd: false
|
|
45896
|
-
});
|
|
45890
|
+
}));
|
|
45891
|
+
sfcStyleCompileResults.errors.forEach((e) => console.warn(e));
|
|
45892
|
+
return sfcStyleCompileResults;
|
|
45897
45893
|
});
|
|
45894
|
+
}
|
|
45895
|
+
function templateCompiler(template, info) {
|
|
45896
|
+
var _a2;
|
|
45897
|
+
const sfcTemplateCompileResults = compileTemplate(__spreadProps(__spreadValues({}, info), {
|
|
45898
|
+
source: (_a2 = template == null ? void 0 : template.content) != null ? _a2 : "",
|
|
45899
|
+
isProd: false
|
|
45900
|
+
}));
|
|
45901
|
+
sfcTemplateCompileResults.errors.forEach((e) => console.warn(e));
|
|
45902
|
+
return sfcTemplateCompileResults;
|
|
45903
|
+
}
|
|
45904
|
+
function compilerSfc(source) {
|
|
45905
|
+
const info = { id: REPO_NAME, filename: `${REPO_NAME}.vue` };
|
|
45906
|
+
const { descriptor, errors: errors2 } = parse$2(source, info);
|
|
45907
|
+
errors2.forEach((e) => console.warn(e));
|
|
45898
45908
|
return {
|
|
45899
|
-
|
|
45900
|
-
|
|
45901
|
-
|
|
45909
|
+
sfcStyleCompileResultsList: stylesCompiler(descriptor.styles, info),
|
|
45910
|
+
sfcAppBlock: appCompiler(descriptor, info),
|
|
45911
|
+
sfcTemplateCompileResults: templateCompiler(descriptor.template, info)
|
|
45902
45912
|
};
|
|
45903
45913
|
}
|
|
45904
45914
|
function createDom(row, inner) {
|
|
45905
45915
|
var _a2;
|
|
45906
|
-
const container2 = document.createElement("
|
|
45916
|
+
const container2 = document.createElement("main");
|
|
45907
45917
|
container2.insertAdjacentHTML("afterbegin", row);
|
|
45908
45918
|
const sample = container2.firstElementChild;
|
|
45919
|
+
if (!sample) return;
|
|
45909
45920
|
const dom = document.createElement(sample.tagName);
|
|
45910
45921
|
dom.innerHTML = inner != null ? inner : sample.innerHTML;
|
|
45911
|
-
for (const n2 of sample.getAttributeNames())
|
|
45922
|
+
for (const n2 of sample.getAttributeNames())
|
|
45912
45923
|
dom.setAttribute(n2, (_a2 = sample.getAttribute(n2)) != null ? _a2 : "");
|
|
45913
|
-
}
|
|
45914
45924
|
return {
|
|
45915
45925
|
mount: (el) => el.appendChild(dom)
|
|
45916
45926
|
};
|
|
@@ -45919,15 +45929,10 @@ ${exposeCall}`
|
|
|
45919
45929
|
const carrier = [];
|
|
45920
45930
|
return new Promise((resolve2) => {
|
|
45921
45931
|
const observer = new MutationObserver((mutations) => {
|
|
45922
|
-
for (const
|
|
45923
|
-
|
|
45924
|
-
node2 instanceof HTMLElement && handler(node2, carrier);
|
|
45925
|
-
});
|
|
45926
|
-
}
|
|
45927
|
-
});
|
|
45928
|
-
observer.observe(document.head, {
|
|
45929
|
-
childList: true
|
|
45932
|
+
for (const { addedNodes } of mutations)
|
|
45933
|
+
addedNodes.forEach((n2) => n2 instanceof HTMLElement && handler(n2, carrier));
|
|
45930
45934
|
});
|
|
45935
|
+
observer.observe(document.head, { childList: true });
|
|
45931
45936
|
document.addEventListener("DOMContentLoaded", () => {
|
|
45932
45937
|
resolve2(carrier);
|
|
45933
45938
|
observer.disconnect();
|
|
@@ -45937,48 +45942,43 @@ ${exposeCall}`
|
|
|
45937
45942
|
function awaitCompileSfc(handler) {
|
|
45938
45943
|
return __async(this, null, function* () {
|
|
45939
45944
|
const clientCodeList = yield watchRoot((node2, clientCodeList2) => {
|
|
45940
|
-
if (!/^(?:script|template|style)$/.test(node2.localName))
|
|
45941
|
-
|
|
45942
|
-
if (node2.hasAttribute("src"))
|
|
45943
|
-
return;
|
|
45945
|
+
if (!/^(?:script|template|style)$/.test(node2.localName)) return;
|
|
45946
|
+
if (node2.hasAttribute("src")) return;
|
|
45944
45947
|
clientCodeList2.push(node2.outerHTML);
|
|
45945
45948
|
node2.localName === "style" ? node2.onload = node2.remove : node2.remove();
|
|
45946
45949
|
});
|
|
45947
45950
|
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);
|
|
45951
|
+
hasScript || clientCodeList.unshift("<script>/* empty script */<\/script>");
|
|
45952
|
+
handler(compilerSfc(clientCodeList.join("\n")));
|
|
45952
45953
|
});
|
|
45953
45954
|
}
|
|
45954
|
-
function
|
|
45955
|
+
function generateCssCode(sfcStyleCompileResultsList) {
|
|
45955
45956
|
return sfcStyleCompileResultsList.map((style) => style.code).join("\n");
|
|
45956
45957
|
}
|
|
45957
|
-
function generateEsmCode(
|
|
45958
|
-
|
|
45959
|
-
|
|
45960
|
-
|
|
45961
|
-
|
|
45962
|
-
|
|
45963
|
-
|
|
45964
|
-
|
|
45965
|
-
|
|
45966
|
-
|
|
45967
|
-
|
|
45968
|
-
|
|
45969
|
-
}
|
|
45970
|
-
|
|
45971
|
-
|
|
45972
|
-
|
|
45973
|
-
|
|
45974
|
-
}
|
|
45975
|
-
}
|
|
45976
|
-
awaitCompileSfc((compiledStyleList, ...compiledSetupAndRender) => {
|
|
45977
|
-
_toHead(`<script ${REPO_NAME} type="importmap">${IMPORTS_JSON}<\/script>`);
|
|
45978
|
-
_toHead(`<script ${REPO_NAME} type="module">`, generateEsmCode(...compiledSetupAndRender));
|
|
45979
|
-
_toHead(`<style ${REPO_NAME}>`, generateStyleCode(compiledStyleList));
|
|
45980
|
-
});
|
|
45981
|
-
function _toHead(...args) {
|
|
45982
|
-
createDom(...args).mount(document.head);
|
|
45958
|
+
function generateEsmCode(sfcAppBlock, sfcTemplateCompileResults) {
|
|
45959
|
+
const _scriptTransform = ({ content }) => content.replace("export default", `${APP_VAR_NAME} =`).replace(/Object\.defineProperty\(__returned__.*/, "");
|
|
45960
|
+
const _templateTransform = ({ code }) => code.replace("export function render", `${APP_VAR_NAME}.render = function`);
|
|
45961
|
+
return [
|
|
45962
|
+
INIT_CODE,
|
|
45963
|
+
_scriptTransform(sfcAppBlock),
|
|
45964
|
+
_templateTransform(sfcTemplateCompileResults),
|
|
45965
|
+
sfcAppBlock.isScoped ? SCOPED_ID_CODE : "",
|
|
45966
|
+
CREATE_APP_CODE
|
|
45967
|
+
].join("\n");
|
|
45968
|
+
}
|
|
45969
|
+
function generator(compiledSfc) {
|
|
45970
|
+
const { sfcAppBlock, sfcStyleCompileResultsList, sfcTemplateCompileResults } = compiledSfc;
|
|
45971
|
+
return {
|
|
45972
|
+
esmCode: generateEsmCode(sfcAppBlock, sfcTemplateCompileResults),
|
|
45973
|
+
cssCode: generateCssCode(sfcStyleCompileResultsList)
|
|
45974
|
+
};
|
|
45983
45975
|
}
|
|
45976
|
+
awaitCompileSfc((compiledSfc) => {
|
|
45977
|
+
var _a2, _b2, _c;
|
|
45978
|
+
const site = document["head"];
|
|
45979
|
+
const { cssCode, esmCode } = generator(compiledSfc);
|
|
45980
|
+
(_a2 = createDom(IMPORTS_TAG_CODE)) == null ? void 0 : _a2.mount(site);
|
|
45981
|
+
(_b2 = createDom(`<script ${REPO_NAME} type="module">`, ASCII_LOGO + esmCode)) == null ? void 0 : _b2.mount(site);
|
|
45982
|
+
(_c = createDom(cssCode && `<style ${REPO_NAME}>`, cssCode)) == null ? void 0 : _c.mount(document.head);
|
|
45983
|
+
});
|
|
45984
45984
|
})();
|