@dcloudio/uni-cli-shared 3.0.0-alpha-3060120220907002 → 3.0.0-alpha-3060120220907003
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/env/define.js +8 -8
- package/dist/hbx/log.js +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/i18n.js +2 -2
- package/dist/json/manifest.d.ts +1 -0
- package/dist/json/manifest.js +10 -1
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +8 -1
- package/dist/postcss/plugins/uniapp.d.ts +1 -1
- package/dist/resolve.js +0 -4
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +4 -3
- package/dist/vite/plugins/vitejs/plugins/css.js +13 -13
- package/dist/vite/utils/ast.js +5 -5
- package/dist/vue/parse.js +7 -7
- package/dist/vue/transforms/templateTransformAssetUrl.js +8 -8
- package/dist/vue/transforms/templateTransformSrcset.js +7 -7
- package/dist/vue/transforms/transformComponent.js +3 -3
- package/dist/vue/transforms/transformRef.js +1 -1
- package/dist/vue/transforms/vOn.js +3 -3
- package/dist/vue/utils.js +7 -7
- package/lib/.DS_Store +0 -0
- package/lib/vue-i18n/.DS_Store +0 -0
- package/package.json +9 -9
package/dist/env/define.js
CHANGED
|
@@ -18,18 +18,18 @@ function initDefine(stringifyBoolean = false) {
|
|
|
18
18
|
'process.env.UNI_APP_VERSION_NAME': JSON.stringify(manifestJson.versionName || ''),
|
|
19
19
|
'process.env.UNI_APP_VERSION_CODE': JSON.stringify(manifestJson.versionCode || ''),
|
|
20
20
|
'process.env.UNI_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM),
|
|
21
|
-
'process.env.UNI_SUB_PLATFORM': JSON.stringify(process.env.UNI_SUB_PLATFORM),
|
|
22
|
-
'process.env.UNI_MP_PLUGIN': JSON.stringify(process.env.UNI_MP_PLUGIN),
|
|
23
|
-
'process.env.UNI_SUBPACKAGE': JSON.stringify(process.env.UNI_SUBPACKAGE),
|
|
24
|
-
'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION),
|
|
21
|
+
'process.env.UNI_SUB_PLATFORM': JSON.stringify(process.env.UNI_SUB_PLATFORM || ''),
|
|
22
|
+
'process.env.UNI_MP_PLUGIN': JSON.stringify(process.env.UNI_MP_PLUGIN || ''),
|
|
23
|
+
'process.env.UNI_SUBPACKAGE': JSON.stringify(process.env.UNI_SUBPACKAGE || ''),
|
|
24
|
+
'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION || ''),
|
|
25
25
|
'process.env.RUN_BY_HBUILDERX': stringifyBoolean
|
|
26
26
|
? JSON.stringify(isRunByHBuilderX)
|
|
27
27
|
: isRunByHBuilderX,
|
|
28
|
-
'process.env.UNI_AUTOMATOR_WS_ENDPOINT': JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT),
|
|
29
|
-
'process.env.UNI_CLOUD_PROVIDER': JSON.stringify(process.env.UNI_CLOUD_PROVIDER),
|
|
30
|
-
'process.env.UNICLOUD_DEBUG': JSON.stringify(process.env.UNICLOUD_DEBUG),
|
|
28
|
+
'process.env.UNI_AUTOMATOR_WS_ENDPOINT': JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT || ''),
|
|
29
|
+
'process.env.UNI_CLOUD_PROVIDER': JSON.stringify(process.env.UNI_CLOUD_PROVIDER || ''),
|
|
30
|
+
'process.env.UNICLOUD_DEBUG': JSON.stringify(process.env.UNICLOUD_DEBUG || ''),
|
|
31
31
|
// 兼容旧版本
|
|
32
|
-
'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM),
|
|
32
|
+
'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM || ''),
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
exports.initDefine = initDefine;
|
package/dist/hbx/log.js
CHANGED
|
@@ -87,7 +87,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
|
87
87
|
constants_1.EXTNAME_VUE_RE.test(err.id)) {
|
|
88
88
|
try {
|
|
89
89
|
const ast = (0, ast_1.parseVue)(fs_1.default.readFileSync(err.id, 'utf8'), []);
|
|
90
|
-
const scriptNode = ast.children.find((node) => node.type === 1 /* ELEMENT */ && node.tag === 'script');
|
|
90
|
+
const scriptNode = ast.children.find((node) => node.type === 1 /* NodeTypes.ELEMENT */ && node.tag === 'script');
|
|
91
91
|
if (scriptNode) {
|
|
92
92
|
const scriptLoc = scriptNode.loc;
|
|
93
93
|
args.push(picocolors_1.default.yellow(pad((0, utils_2.generateCodeFrame)(scriptLoc.source, err.loc))));
|
package/dist/i18n.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export declare const initI18nOptionsOnce: typeof initI18nOptions;
|
|
|
7
7
|
export declare function isUniAppLocaleFile(filepath: string): boolean;
|
|
8
8
|
export declare function getLocaleFiles(cwd: string): string[];
|
|
9
9
|
export declare function initLocales(dir: string, withMessages?: boolean): Record<string, Record<string, string>>;
|
|
10
|
-
export declare function resolveI18nLocale(
|
|
10
|
+
export declare function resolveI18nLocale(platform: UniApp.PLATFORM, locales: string[], locale?: string): string;
|
package/dist/i18n.js
CHANGED
|
@@ -77,12 +77,12 @@ function initLocales(dir, withMessages = true) {
|
|
|
77
77
|
}, {});
|
|
78
78
|
}
|
|
79
79
|
exports.initLocales = initLocales;
|
|
80
|
-
function resolveI18nLocale(
|
|
80
|
+
function resolveI18nLocale(platform, locales, locale) {
|
|
81
81
|
if (locale && locales.includes(locale)) {
|
|
82
82
|
return locale;
|
|
83
83
|
}
|
|
84
84
|
const defaultLocales = ['zh-Hans', 'zh-Hant'];
|
|
85
|
-
if (
|
|
85
|
+
if (platform === 'app' || platform === 'h5') {
|
|
86
86
|
defaultLocales.unshift('en');
|
|
87
87
|
}
|
|
88
88
|
else {
|
package/dist/json/manifest.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare function normalizeNetworkTimeout(networkTimeout?: Partial<typeof
|
|
|
21
21
|
export declare function getUniStatistics(inputDir: string, platform: UniApp.PLATFORM): any;
|
|
22
22
|
export declare function isEnableUniPushV1(inputDir: string, platform: UniApp.PLATFORM): boolean;
|
|
23
23
|
export declare function isEnableUniPushV2(inputDir: string, platform: UniApp.PLATFORM): boolean;
|
|
24
|
+
export declare function isEnableSecureNetwork(inputDir: string, platform: UniApp.PLATFORM): boolean;
|
|
24
25
|
export declare function isUniPushOffline(inputDir: string): boolean;
|
|
25
26
|
export declare function getRouterOptions(manifestJson: Record<string, any>): {
|
|
26
27
|
mode?: 'history' | 'hash';
|
package/dist/json/manifest.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
|
|
6
|
+
exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
@@ -72,6 +72,15 @@ function isEnableUniPushV2(inputDir, platform) {
|
|
|
72
72
|
return ((_g = (_f = manifest[platform]) === null || _f === void 0 ? void 0 : _f.unipush) === null || _g === void 0 ? void 0 : _g.enable) === true;
|
|
73
73
|
}
|
|
74
74
|
exports.isEnableUniPushV2 = isEnableUniPushV2;
|
|
75
|
+
function isEnableSecureNetwork(inputDir, platform) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
78
|
+
if (platform === 'app') {
|
|
79
|
+
return false; // 暂未支持app
|
|
80
|
+
}
|
|
81
|
+
return ((_b = (_a = manifest[platform]) === null || _a === void 0 ? void 0 : _a.secureNetwork) === null || _b === void 0 ? void 0 : _b.enable) === true;
|
|
82
|
+
}
|
|
83
|
+
exports.isEnableSecureNetwork = isEnableSecureNetwork;
|
|
75
84
|
function isUniPushOffline(inputDir) {
|
|
76
85
|
var _a, _b, _c, _d, _e;
|
|
77
86
|
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
package/dist/platform.d.ts
CHANGED
package/dist/platform.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPlatforms = exports.registerPlatform = void 0;
|
|
3
|
+
exports.getPlatformDir = exports.getPlatforms = exports.registerPlatform = void 0;
|
|
4
4
|
const BUILT_IN_PLATFORMS = [
|
|
5
5
|
'app',
|
|
6
6
|
'app-plus',
|
|
@@ -29,3 +29,10 @@ function getPlatforms() {
|
|
|
29
29
|
return platforms;
|
|
30
30
|
}
|
|
31
31
|
exports.getPlatforms = getPlatforms;
|
|
32
|
+
function getPlatformDir() {
|
|
33
|
+
if (process.env.UNI_PLATFORM === 'app' && process.env.UNI_APP_PLATFORM) {
|
|
34
|
+
return process.env.UNI_PLATFORM + '-' + process.env.UNI_APP_PLATFORM;
|
|
35
|
+
}
|
|
36
|
+
return process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM;
|
|
37
|
+
}
|
|
38
|
+
exports.getPlatformDir = getPlatformDir;
|
package/dist/resolve.js
CHANGED
|
@@ -121,10 +121,6 @@ function resolveUtsModule(id, importer, platform) {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
const platformDir = path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', platform);
|
|
124
|
-
// App平台仅支持 uts
|
|
125
|
-
if (platform === 'app-android') {
|
|
126
|
-
return resolveUtsFile(platformDir, ['.uts']);
|
|
127
|
-
}
|
|
128
124
|
return resolveUtsFile(platformDir);
|
|
129
125
|
}
|
|
130
126
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -15,4 +15,4 @@ export declare function pathToGlob(pathString: string, glob: string, options?: {
|
|
|
15
15
|
windows?: boolean;
|
|
16
16
|
escape?: boolean;
|
|
17
17
|
}): string;
|
|
18
|
-
export declare function resolveSourceMapPath(
|
|
18
|
+
export declare function resolveSourceMapPath(): string;
|
package/dist/utils.js
CHANGED
|
@@ -11,6 +11,7 @@ const shared_1 = require("@vue/shared");
|
|
|
11
11
|
var hash_sum_1 = require("hash-sum");
|
|
12
12
|
Object.defineProperty(exports, "hash", { enumerable: true, get: function () { return __importDefault(hash_sum_1).default; } });
|
|
13
13
|
const constants_1 = require("./constants");
|
|
14
|
+
const platform_1 = require("./platform");
|
|
14
15
|
try {
|
|
15
16
|
exports.isRunningWithYarnPnp = Boolean(require('pnpapi'));
|
|
16
17
|
}
|
|
@@ -21,7 +22,7 @@ function normalizePath(id) {
|
|
|
21
22
|
}
|
|
22
23
|
exports.normalizePath = normalizePath;
|
|
23
24
|
function checkElementNodeTag(node, tag) {
|
|
24
|
-
return !!node && node.type === 1 /* ELEMENT */ && node.tag === tag;
|
|
25
|
+
return !!node && node.type === 1 /* NodeTypes.ELEMENT */ && node.tag === tag;
|
|
25
26
|
}
|
|
26
27
|
exports.checkElementNodeTag = checkElementNodeTag;
|
|
27
28
|
function normalizeIdentifier(str) {
|
|
@@ -86,7 +87,7 @@ function pathToGlob(pathString, glob, options = {}) {
|
|
|
86
87
|
return path_1.default.posix.join(safeStr, glob);
|
|
87
88
|
}
|
|
88
89
|
exports.pathToGlob = pathToGlob;
|
|
89
|
-
function resolveSourceMapPath(
|
|
90
|
-
return path_1.default.resolve(
|
|
90
|
+
function resolveSourceMapPath() {
|
|
91
|
+
return path_1.default.resolve(process.env.UNI_OUTPUT_DIR, '../.sourcemap/' + (0, platform_1.getPlatformDir)());
|
|
91
92
|
}
|
|
92
93
|
exports.resolveSourceMapPath = resolveSourceMapPath;
|
|
@@ -281,17 +281,17 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
281
281
|
let opts = (preprocessorOptions && preprocessorOptions[lang]) || {};
|
|
282
282
|
// support @import from node dependencies by default
|
|
283
283
|
switch (lang) {
|
|
284
|
-
case "scss" /* scss */:
|
|
285
|
-
case "sass" /* sass */:
|
|
284
|
+
case "scss" /* PreprocessLang.scss */:
|
|
285
|
+
case "sass" /* PreprocessLang.sass */:
|
|
286
286
|
opts = {
|
|
287
287
|
includePaths: ['node_modules'],
|
|
288
288
|
alias: config.resolve.alias,
|
|
289
289
|
...opts,
|
|
290
290
|
};
|
|
291
291
|
break;
|
|
292
|
-
case "less" /* less */:
|
|
293
|
-
case "styl" /* styl */:
|
|
294
|
-
case "stylus" /* stylus */:
|
|
292
|
+
case "less" /* PreprocessLang.less */:
|
|
293
|
+
case "styl" /* PreprocessLang.styl */:
|
|
294
|
+
case "stylus" /* PreprocessLang.stylus */:
|
|
295
295
|
opts = {
|
|
296
296
|
paths: ['node_modules'],
|
|
297
297
|
alias: config.resolve.alias,
|
|
@@ -712,7 +712,7 @@ function loadPreprocessor(lang, root) {
|
|
|
712
712
|
}
|
|
713
713
|
// .scss/.sass processor
|
|
714
714
|
const scss = async (source, root, options, resolvers, isNVue) => {
|
|
715
|
-
const render = loadPreprocessor("sass" /* sass */, root).render;
|
|
715
|
+
const render = loadPreprocessor("sass" /* PreprocessLang.sass */, root).render;
|
|
716
716
|
const internalImporter = (url, importer, done) => {
|
|
717
717
|
resolvers.sass(url, importer).then((resolved) => {
|
|
718
718
|
if (resolved) {
|
|
@@ -841,7 +841,7 @@ async function rebaseUrls(file, rootFile, alias, isNVue = false) {
|
|
|
841
841
|
}
|
|
842
842
|
// .less
|
|
843
843
|
const less = async (source, root, options, resolvers, isNVue) => {
|
|
844
|
-
const nodeLess = loadPreprocessor("less" /* less */, root);
|
|
844
|
+
const nodeLess = loadPreprocessor("less" /* PreprocessLang.less */, root);
|
|
845
845
|
const viteResolverPlugin = createViteLessPlugin(nodeLess, options.filename, options.alias, resolvers, isNVue);
|
|
846
846
|
const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData, options.enableSourcemap);
|
|
847
847
|
let result;
|
|
@@ -933,7 +933,7 @@ function createViteLessPlugin(less, rootFile, alias, resolvers, isNVue) {
|
|
|
933
933
|
// .styl
|
|
934
934
|
const styl = async (source, root, options) => {
|
|
935
935
|
var _a;
|
|
936
|
-
const nodeStylus = loadPreprocessor("stylus" /* stylus */, root);
|
|
936
|
+
const nodeStylus = loadPreprocessor("stylus" /* PreprocessLang.stylus */, root);
|
|
937
937
|
// Get source with preprocessor options.additionalData. Make sure a new line separator
|
|
938
938
|
// is added to avoid any render error, as added stylus content may not have semi-colon separators
|
|
939
939
|
const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData, options.enableSourcemap, '\n');
|
|
@@ -1002,11 +1002,11 @@ async function getSource(source, filename, additionalData, enableSourcemap, sep
|
|
|
1002
1002
|
};
|
|
1003
1003
|
}
|
|
1004
1004
|
const preProcessors = Object.freeze({
|
|
1005
|
-
["less" /* less */]: less,
|
|
1006
|
-
["sass" /* sass */]: sass,
|
|
1007
|
-
["scss" /* scss */]: scss,
|
|
1008
|
-
["styl" /* styl */]: styl,
|
|
1009
|
-
["stylus" /* stylus */]: styl,
|
|
1005
|
+
["less" /* PreprocessLang.less */]: less,
|
|
1006
|
+
["sass" /* PreprocessLang.sass */]: sass,
|
|
1007
|
+
["scss" /* PreprocessLang.scss */]: scss,
|
|
1008
|
+
["styl" /* PreprocessLang.styl */]: styl,
|
|
1009
|
+
["stylus" /* PreprocessLang.stylus */]: styl,
|
|
1010
1010
|
});
|
|
1011
1011
|
function isPreProcessor(lang) {
|
|
1012
1012
|
return lang && lang in preProcessors;
|
package/dist/vite/utils/ast.js
CHANGED
|
@@ -64,7 +64,7 @@ function parseVue(code, errors) {
|
|
|
64
64
|
return (0, compiler_dom_1.parse)(code, {
|
|
65
65
|
isNativeTag: () => true,
|
|
66
66
|
isPreTag: () => true,
|
|
67
|
-
getTextMode: () => 0 /* DATA */,
|
|
67
|
+
getTextMode: () => 0 /* TextModes.DATA */,
|
|
68
68
|
onError: (e) => {
|
|
69
69
|
errors.push(e);
|
|
70
70
|
},
|
|
@@ -72,18 +72,18 @@ function parseVue(code, errors) {
|
|
|
72
72
|
}
|
|
73
73
|
exports.parseVue = parseVue;
|
|
74
74
|
function isElementNode(node) {
|
|
75
|
-
return node.type === 1 /* ELEMENT */;
|
|
75
|
+
return node.type === 1 /* NodeTypes.ELEMENT */;
|
|
76
76
|
}
|
|
77
77
|
exports.isElementNode = isElementNode;
|
|
78
78
|
function isAttributeNode(node) {
|
|
79
|
-
return node.type === 6 /* ATTRIBUTE */;
|
|
79
|
+
return node.type === 6 /* NodeTypes.ATTRIBUTE */;
|
|
80
80
|
}
|
|
81
81
|
exports.isAttributeNode = isAttributeNode;
|
|
82
82
|
function isDirectiveNode(node) {
|
|
83
|
-
return node.type === 7 /* DIRECTIVE */;
|
|
83
|
+
return node.type === 7 /* NodeTypes.DIRECTIVE */;
|
|
84
84
|
}
|
|
85
85
|
exports.isDirectiveNode = isDirectiveNode;
|
|
86
86
|
function isSimpleExpressionNode(node) {
|
|
87
|
-
return node.type === 4 /* SIMPLE_EXPRESSION */;
|
|
87
|
+
return node.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */;
|
|
88
88
|
}
|
|
89
89
|
exports.isSimpleExpressionNode = isSimpleExpressionNode;
|
package/dist/vue/parse.js
CHANGED
|
@@ -28,7 +28,7 @@ function parseVueCode(code, isNVue = false) {
|
|
|
28
28
|
code = parseWxsCode(wxsNodes, code);
|
|
29
29
|
// add watch
|
|
30
30
|
for (const wxsNode of wxsNodes) {
|
|
31
|
-
const srcProp = wxsNode.props.find((prop) => prop.type === 6 /* ATTRIBUTE */ && prop.name === 'src');
|
|
31
|
+
const srcProp = wxsNode.props.find((prop) => prop.type === 6 /* NodeTypes.ATTRIBUTE */ && prop.name === 'src');
|
|
32
32
|
if (srcProp && srcProp.value) {
|
|
33
33
|
files.push(srcProp.value.content);
|
|
34
34
|
}
|
|
@@ -44,10 +44,10 @@ function traverseNode(node, blockNodes) {
|
|
|
44
44
|
if ((0, ast_1.isElementNode)(node) && node.tag === 'block') {
|
|
45
45
|
blockNodes.push(node);
|
|
46
46
|
}
|
|
47
|
-
if (node.type === 10 /* IF_BRANCH */ ||
|
|
48
|
-
node.type === 11 /* FOR */ ||
|
|
49
|
-
node.type === 1 /* ELEMENT */ ||
|
|
50
|
-
node.type === 0 /* ROOT */) {
|
|
47
|
+
if (node.type === 10 /* NodeTypes.IF_BRANCH */ ||
|
|
48
|
+
node.type === 11 /* NodeTypes.FOR */ ||
|
|
49
|
+
node.type === 1 /* NodeTypes.ELEMENT */ ||
|
|
50
|
+
node.type === 0 /* NodeTypes.ROOT */) {
|
|
51
51
|
traverseChildren(node, blockNodes);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -73,10 +73,10 @@ function parseBlockNode(code, blocks) {
|
|
|
73
73
|
return magicString.toString();
|
|
74
74
|
}
|
|
75
75
|
function parseWxsNodes(ast) {
|
|
76
|
-
return ast.children.filter((node) => node.type === 1 /* ELEMENT */ &&
|
|
76
|
+
return ast.children.filter((node) => node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
77
77
|
node.tag === 'script' &&
|
|
78
78
|
node.props.find((prop) => prop.name === 'lang' &&
|
|
79
|
-
prop.type === 6 /* ATTRIBUTE */ &&
|
|
79
|
+
prop.type === 6 /* NodeTypes.ATTRIBUTE */ &&
|
|
80
80
|
prop.value &&
|
|
81
81
|
WXS_ATTRS.includes(prop.value.content)));
|
|
82
82
|
}
|
|
@@ -51,7 +51,7 @@ exports.createAssetUrlTransformWithOptions = createAssetUrlTransformWithOptions;
|
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
53
|
const transformAssetUrl = (node, context, options = exports.defaultAssetUrlOptions) => {
|
|
54
|
-
if (node.type === 1 /* ELEMENT */) {
|
|
54
|
+
if (node.type === 1 /* NodeTypes.ELEMENT */) {
|
|
55
55
|
if (!node.props.length) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
@@ -69,7 +69,7 @@ const transformAssetUrl = (node, context, options = exports.defaultAssetUrlOptio
|
|
|
69
69
|
// - 非 static 资源转换为 import
|
|
70
70
|
const assetAttrs = (attrs || []).concat(wildCardAttrs || []);
|
|
71
71
|
node.props.forEach((attr, index) => {
|
|
72
|
-
if (attr.type !== 6 /* ATTRIBUTE */ ||
|
|
72
|
+
if (attr.type !== 6 /* NodeTypes.ATTRIBUTE */ ||
|
|
73
73
|
!assetAttrs.includes(attr.name) ||
|
|
74
74
|
!attr.value ||
|
|
75
75
|
(0, templateUtils_1.isExternalUrl)(attr.value.content) ||
|
|
@@ -104,7 +104,7 @@ const transformAssetUrl = (node, context, options = exports.defaultAssetUrlOptio
|
|
|
104
104
|
// absolute url (e.g. webpack file-loader)
|
|
105
105
|
const exp = getImportsExpressionExp(url.path, url.hash, attr.loc, context);
|
|
106
106
|
node.props[index] = {
|
|
107
|
-
type: 7 /* DIRECTIVE */,
|
|
107
|
+
type: 7 /* NodeTypes.DIRECTIVE */,
|
|
108
108
|
name: 'bind',
|
|
109
109
|
arg: (0, compiler_core_1.createSimpleExpression)(attr.name, true, attr.loc),
|
|
110
110
|
exp,
|
|
@@ -126,7 +126,7 @@ function getImportsExpressionExp(path, hash, loc, context) {
|
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
128
|
name = `_imports_${context.imports.length}`;
|
|
129
|
-
exp = (0, compiler_core_1.createSimpleExpression)(name, false, loc, 2 /* CAN_HOIST */);
|
|
129
|
+
exp = (0, compiler_core_1.createSimpleExpression)(name, false, loc, 2 /* ConstantTypes.CAN_HOIST */);
|
|
130
130
|
context.imports.push({ exp, path });
|
|
131
131
|
}
|
|
132
132
|
if (!hash) {
|
|
@@ -135,16 +135,16 @@ function getImportsExpressionExp(path, hash, loc, context) {
|
|
|
135
135
|
const hashExp = `${name} + '${hash}'`;
|
|
136
136
|
const existingHoistIndex = context.hoists.findIndex((h) => {
|
|
137
137
|
return (h &&
|
|
138
|
-
h.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
138
|
+
h.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
139
139
|
!h.isStatic &&
|
|
140
140
|
h.content === hashExp);
|
|
141
141
|
});
|
|
142
142
|
if (existingHoistIndex > -1) {
|
|
143
|
-
return (0, compiler_core_1.createSimpleExpression)(`_hoisted_${existingHoistIndex + 1}`, false, loc, 2 /* CAN_HOIST */);
|
|
143
|
+
return (0, compiler_core_1.createSimpleExpression)(`_hoisted_${existingHoistIndex + 1}`, false, loc, 2 /* ConstantTypes.CAN_HOIST */);
|
|
144
144
|
}
|
|
145
|
-
return context.hoist((0, compiler_core_1.createSimpleExpression)(hashExp, false, loc, 2 /* CAN_HOIST */));
|
|
145
|
+
return context.hoist((0, compiler_core_1.createSimpleExpression)(hashExp, false, loc, 2 /* ConstantTypes.CAN_HOIST */));
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
|
-
return (0, compiler_core_1.createSimpleExpression)(`''`, false, loc, 2 /* CAN_HOIST */);
|
|
148
|
+
return (0, compiler_core_1.createSimpleExpression)(`''`, false, loc, 2 /* ConstantTypes.CAN_HOIST */);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -16,10 +16,10 @@ const createSrcsetTransformWithOptions = (options) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.createSrcsetTransformWithOptions = createSrcsetTransformWithOptions;
|
|
18
18
|
const transformSrcset = (node, context, options = templateTransformAssetUrl_1.defaultAssetUrlOptions) => {
|
|
19
|
-
if (node.type === 1 /* ELEMENT */) {
|
|
19
|
+
if (node.type === 1 /* NodeTypes.ELEMENT */) {
|
|
20
20
|
if (srcsetTags.includes(node.tag) && node.props.length) {
|
|
21
21
|
node.props.forEach((attr, index) => {
|
|
22
|
-
if (attr.name === 'srcset' && attr.type === 6 /* ATTRIBUTE */) {
|
|
22
|
+
if (attr.name === 'srcset' && attr.type === 6 /* NodeTypes.ATTRIBUTE */) {
|
|
23
23
|
if (!attr.value)
|
|
24
24
|
return;
|
|
25
25
|
const value = attr.value.content;
|
|
@@ -80,17 +80,17 @@ const transformSrcset = (node, context, options = templateTransformAssetUrl_1.de
|
|
|
80
80
|
if (path) {
|
|
81
81
|
const existingImportsIndex = context.imports.findIndex((i) => i.path === path);
|
|
82
82
|
if (existingImportsIndex > -1) {
|
|
83
|
-
exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${existingImportsIndex}`, false, attr.loc, 2 /* CAN_HOIST */);
|
|
83
|
+
exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${existingImportsIndex}`, false, attr.loc, 2 /* ConstantTypes.CAN_HOIST */);
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${context.imports.length}`, false, attr.loc, 2 /* CAN_HOIST */);
|
|
86
|
+
exp = (0, compiler_core_1.createSimpleExpression)(`_imports_${context.imports.length}`, false, attr.loc, 2 /* ConstantTypes.CAN_HOIST */);
|
|
87
87
|
context.imports.push({ exp, path });
|
|
88
88
|
}
|
|
89
89
|
compoundExpression.children.push(exp);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
const exp = (0, compiler_core_1.createSimpleExpression)(`"${url}"`, false, attr.loc, 2 /* CAN_HOIST */);
|
|
93
|
+
const exp = (0, compiler_core_1.createSimpleExpression)(`"${url}"`, false, attr.loc, 2 /* ConstantTypes.CAN_HOIST */);
|
|
94
94
|
compoundExpression.children.push(exp);
|
|
95
95
|
}
|
|
96
96
|
const isNotLast = imageCandidates.length - 1 > index;
|
|
@@ -105,9 +105,9 @@ const transformSrcset = (node, context, options = templateTransformAssetUrl_1.de
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
const hoisted = context.hoist(compoundExpression);
|
|
108
|
-
hoisted.constType = 2 /* CAN_HOIST */;
|
|
108
|
+
hoisted.constType = 2 /* ConstantTypes.CAN_HOIST */;
|
|
109
109
|
node.props[index] = {
|
|
110
|
-
type: 7 /* DIRECTIVE */,
|
|
110
|
+
type: 7 /* NodeTypes.DIRECTIVE */,
|
|
111
111
|
name: 'bind',
|
|
112
112
|
arg: (0, compiler_core_1.createSimpleExpression)('srcset', true, attr.loc),
|
|
113
113
|
exp: hoisted,
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createTransformComponentLink = void 0;
|
|
4
4
|
const compiler_core_1 = require("@vue/compiler-core");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
-
function createTransformComponentLink(name, type = 7 /* DIRECTIVE */) {
|
|
6
|
+
function createTransformComponentLink(name, type = 7 /* NodeTypes.DIRECTIVE */) {
|
|
7
7
|
return function transformComponentLink(node, context) {
|
|
8
8
|
if (!(0, utils_1.isUserComponent)(node, context)) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
if (type === 7 /* DIRECTIVE */) {
|
|
11
|
+
if (type === 7 /* NodeTypes.DIRECTIVE */) {
|
|
12
12
|
node.props.push({
|
|
13
|
-
type: 7 /* DIRECTIVE */,
|
|
13
|
+
type: 7 /* NodeTypes.DIRECTIVE */,
|
|
14
14
|
name: 'on',
|
|
15
15
|
modifiers: [],
|
|
16
16
|
loc: compiler_core_1.locStub,
|
|
@@ -27,7 +27,7 @@ function createTransformOn(baseTransformOn, { match } = {
|
|
|
27
27
|
}
|
|
28
28
|
const value = res.props[0].value;
|
|
29
29
|
res.props[0].value = createCustomEventExpr();
|
|
30
|
-
addEventOpts(node.tagType === 1 /* COMPONENT */
|
|
30
|
+
addEventOpts(node.tagType === 1 /* ElementTypes.COMPONENT */
|
|
31
31
|
? (0, uni_shared_1.customizeEvent)(arg.content)
|
|
32
32
|
: arg.content, value, node, context);
|
|
33
33
|
return res;
|
|
@@ -39,7 +39,7 @@ function createCustomEventExpr() {
|
|
|
39
39
|
}
|
|
40
40
|
exports.createCustomEventExpr = createCustomEventExpr;
|
|
41
41
|
function addEventOpts(event, value, node, context) {
|
|
42
|
-
const attrName = node.tagType === 1 /* COMPONENT */
|
|
42
|
+
const attrName = node.tagType === 1 /* ElementTypes.COMPONENT */
|
|
43
43
|
? ATTR_DATA_EVENT_OPTS
|
|
44
44
|
: exports.ATTR_DATASET_EVENT_OPTS;
|
|
45
45
|
const opts = (0, compiler_core_1.findProp)(node, attrName, true);
|
|
@@ -69,7 +69,7 @@ function createDataEventOptsProp(name, event, exp, context) {
|
|
|
69
69
|
children.push(')');
|
|
70
70
|
}
|
|
71
71
|
return {
|
|
72
|
-
type: 7 /* DIRECTIVE */,
|
|
72
|
+
type: 7 /* NodeTypes.DIRECTIVE */,
|
|
73
73
|
name: 'bind',
|
|
74
74
|
loc: compiler_core_1.locStub,
|
|
75
75
|
modifiers: [],
|
package/dist/vue/utils.js
CHANGED
|
@@ -17,8 +17,8 @@ function isVueSfcFile(id) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.isVueSfcFile = isVueSfcFile;
|
|
19
19
|
function isUserComponent(node, context) {
|
|
20
|
-
return (node.type === 1 /* ELEMENT */ &&
|
|
21
|
-
node.tagType === 1 /* COMPONENT */ &&
|
|
20
|
+
return (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
|
21
|
+
node.tagType === 1 /* ElementTypes.COMPONENT */ &&
|
|
22
22
|
!(0, uni_shared_1.isComponentTag)(node.tag) &&
|
|
23
23
|
!(0, compiler_core_1.isCoreComponent)(node.tag) &&
|
|
24
24
|
!context.isBuiltInComponent(node.tag));
|
|
@@ -26,11 +26,11 @@ function isUserComponent(node, context) {
|
|
|
26
26
|
exports.isUserComponent = isUserComponent;
|
|
27
27
|
function createAttributeNode(name, content) {
|
|
28
28
|
return {
|
|
29
|
-
type: 6 /* ATTRIBUTE */,
|
|
29
|
+
type: 6 /* NodeTypes.ATTRIBUTE */,
|
|
30
30
|
loc: compiler_core_1.locStub,
|
|
31
31
|
name,
|
|
32
32
|
value: {
|
|
33
|
-
type: 2 /* TEXT */,
|
|
33
|
+
type: 2 /* NodeTypes.TEXT */,
|
|
34
34
|
loc: compiler_core_1.locStub,
|
|
35
35
|
content,
|
|
36
36
|
},
|
|
@@ -41,7 +41,7 @@ function createClassAttribute(clazz) {
|
|
|
41
41
|
return createAttributeNode('class', clazz);
|
|
42
42
|
}
|
|
43
43
|
function addStaticClass(node, clazz) {
|
|
44
|
-
const classProp = node.props.find((prop) => prop.type === 6 /* ATTRIBUTE */ && prop.name === 'class');
|
|
44
|
+
const classProp = node.props.find((prop) => prop.type === 6 /* NodeTypes.ATTRIBUTE */ && prop.name === 'class');
|
|
45
45
|
if (!classProp) {
|
|
46
46
|
return node.props.unshift(createClassAttribute(clazz));
|
|
47
47
|
}
|
|
@@ -49,7 +49,7 @@ function addStaticClass(node, clazz) {
|
|
|
49
49
|
return (classProp.value.content = classProp.value.content + ' ' + clazz);
|
|
50
50
|
}
|
|
51
51
|
classProp.value = {
|
|
52
|
-
type: 2 /* TEXT */,
|
|
52
|
+
type: 2 /* NodeTypes.TEXT */,
|
|
53
53
|
loc: compiler_core_1.locStub,
|
|
54
54
|
content: clazz,
|
|
55
55
|
};
|
|
@@ -57,7 +57,7 @@ function addStaticClass(node, clazz) {
|
|
|
57
57
|
exports.addStaticClass = addStaticClass;
|
|
58
58
|
function createDirectiveNode(name, arg, exp) {
|
|
59
59
|
return {
|
|
60
|
-
type: 7 /* DIRECTIVE */,
|
|
60
|
+
type: 7 /* NodeTypes.DIRECTIVE */,
|
|
61
61
|
name,
|
|
62
62
|
modifiers: [],
|
|
63
63
|
loc: compiler_core_1.locStub,
|
package/lib/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3060120220907003",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"@babel/core": "^7.17.9",
|
|
23
23
|
"@babel/parser": "^7.17.9",
|
|
24
24
|
"@babel/types": "^7.17.0",
|
|
25
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
26
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
25
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3060120220907003",
|
|
26
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3060120220907003",
|
|
27
27
|
"@intlify/core-base": "9.1.9",
|
|
28
28
|
"@intlify/shared": "9.1.9",
|
|
29
29
|
"@intlify/vue-devtools": "9.1.9",
|
|
30
30
|
"@rollup/pluginutils": "^4.2.0",
|
|
31
|
-
"@vue/compiler-core": "3.2.
|
|
32
|
-
"@vue/compiler-dom": "3.2.
|
|
33
|
-
"@vue/compiler-sfc": "3.2.
|
|
34
|
-
"@vue/server-renderer": "3.2.
|
|
35
|
-
"@vue/shared": "3.2.
|
|
31
|
+
"@vue/compiler-core": "3.2.39",
|
|
32
|
+
"@vue/compiler-dom": "3.2.39",
|
|
33
|
+
"@vue/compiler-sfc": "3.2.39",
|
|
34
|
+
"@vue/server-renderer": "3.2.39",
|
|
35
|
+
"@vue/shared": "3.2.39",
|
|
36
36
|
"autoprefixer": "^10.4.8",
|
|
37
37
|
"base64url": "^3.0.1",
|
|
38
38
|
"chokidar": "^3.5.3",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"@types/sass": "^1.43.1",
|
|
74
74
|
"@types/stylus": "^0.48.36",
|
|
75
75
|
"postcss": "^8.4.13",
|
|
76
|
-
"vue": "3.2.
|
|
76
|
+
"vue": "3.2.39"
|
|
77
77
|
}
|
|
78
78
|
}
|