@dcloudio/uni-cli-shared 3.0.0-3081220230817001 → 3.0.0-3090520231028001
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/constants.d.ts +4 -0
- package/dist/constants.js +11 -6
- package/dist/easycom.d.ts +3 -2
- package/dist/easycom.js +8 -6
- package/dist/index.d.ts +1 -1
- package/dist/json/app/manifest/index.d.ts +1 -0
- package/dist/json/app/manifest/index.js +3 -1
- package/dist/json/pages.js +3 -3
- package/dist/json/uniAppX.js +4 -0
- package/dist/logs/index.d.ts +1 -0
- package/dist/logs/index.js +8 -1
- package/dist/messages/en.d.ts +3 -0
- package/dist/messages/en.js +3 -0
- package/dist/messages/index.d.ts +6 -0
- package/dist/messages/zh_CN.d.ts +3 -0
- package/dist/messages/zh_CN.js +3 -0
- package/dist/mp/usingComponents.js +1 -1
- package/dist/platform.js +1 -0
- package/dist/preprocess/context.d.ts +1 -1
- package/dist/preprocess/context.js +9 -1
- package/dist/resolve.js +4 -3
- package/dist/uni_modules.d.ts +3 -3
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +16 -3
- package/dist/vite/plugins/copy.js +10 -6
- package/dist/vite/plugins/cssScoped.js +2 -1
- package/dist/vite/plugins/index.d.ts +4 -3
- package/dist/vite/plugins/index.js +5 -2
- package/dist/vite/plugins/{utsPlugin.d.ts → uts/app.d.ts} +1 -1
- package/dist/vite/plugins/{utsPlugin.js → uts/app.js} +6 -5
- package/dist/vite/plugins/uts/h5.d.ts +2 -0
- package/dist/vite/plugins/uts/h5.js +33 -0
- package/dist/vite/plugins/vitejs/plugins/asset.d.ts +4 -1
- package/dist/vite/plugins/vitejs/plugins/asset.js +48 -12
- package/dist/vite/plugins/vitejs/plugins/css.js +1 -1
- package/dist/vite/plugins/vitejs/utils.d.ts +13 -0
- package/dist/vite/plugins/vitejs/utils.js +12 -3
- package/dist/vite/utils/ast.d.ts +2 -1
- package/dist/vite/utils/ast.js +5 -1
- package/dist/vite/utils/plugin.d.ts +3 -1
- package/dist/vite/utils/plugin.js +2 -2
- package/dist/vite/utils/url.js +5 -1
- package/dist/watcher.js +1 -1
- package/lib/preprocess/lib/preprocess.js +2 -1
- package/package.json +4 -4
package/dist/constants.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ export declare const PUBLIC_DIR = "static";
|
|
|
2
2
|
export declare const EXTNAME_JS: string[];
|
|
3
3
|
export declare const EXTNAME_TS: string[];
|
|
4
4
|
export declare const EXTNAME_VUE: string[];
|
|
5
|
+
export declare const X_EXTNAME_VUE: string[];
|
|
5
6
|
export declare const EXTNAME_VUE_TEMPLATE: string[];
|
|
6
7
|
export declare const EXTNAME_VUE_RE: RegExp;
|
|
7
8
|
export declare const EXTNAME_JS_RE: RegExp;
|
|
8
9
|
export declare const EXTNAME_TS_RE: RegExp;
|
|
9
10
|
export declare const extensions: string[];
|
|
11
|
+
export declare const uni_app_x_extensions: string[];
|
|
10
12
|
export declare const PAGES_JSON_JS = "pages-json-js";
|
|
11
13
|
export declare const PAGES_JSON_UTS = "pages-json-uts";
|
|
12
14
|
export declare const MANIFEST_JSON_JS = "manifest-json-js";
|
|
@@ -22,6 +24,8 @@ export declare const APP_CONFIG_SERVICE = "app-config-service.js";
|
|
|
22
24
|
export declare const BINDING_COMPONENTS = "__BINDING_COMPONENTS__";
|
|
23
25
|
export declare const PAGE_EXTNAME_APP: string[];
|
|
24
26
|
export declare const PAGE_EXTNAME: string[];
|
|
27
|
+
export declare const X_PAGE_EXTNAME: string[];
|
|
28
|
+
export declare const X_PAGE_EXTNAME_APP: string[];
|
|
25
29
|
export declare const H5_API_STYLE_PATH = "@dcloudio/uni-h5/style/api/";
|
|
26
30
|
export declare const H5_FRAMEWORK_STYLE_PATH = "@dcloudio/uni-h5/style/framework/";
|
|
27
31
|
export declare const H5_COMPONENTS_STYLE_PATH = "@dcloudio/uni-h5/style/";
|
package/dist/constants.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
3
|
+
exports.TEXT_STYLE = exports.DEFAULT_ASSETS_RE = exports.KNOWN_ASSET_TYPES = exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.X_PAGE_EXTNAME_APP = exports.X_PAGE_EXTNAME = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_CONFIG_SERVICE = exports.APP_CONFIG = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_UTS = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_UTS = exports.PAGES_JSON_JS = exports.uni_app_x_extensions = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.X_EXTNAME_VUE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
4
4
|
exports.PUBLIC_DIR = 'static';
|
|
5
5
|
exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx'];
|
|
6
6
|
exports.EXTNAME_TS = ['.ts', '.tsx'];
|
|
7
|
-
exports.EXTNAME_VUE = ['.vue', '.nvue'];
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
7
|
+
exports.EXTNAME_VUE = ['.vue', '.nvue', '.uvue'];
|
|
8
|
+
exports.X_EXTNAME_VUE = ['.uvue', '.vue'];
|
|
9
|
+
exports.EXTNAME_VUE_TEMPLATE = ['.vue', '.nvue', '.uvue', '.jsx', '.tsx'];
|
|
10
|
+
exports.EXTNAME_VUE_RE = /\.(vue|nvue|uvue)$/;
|
|
10
11
|
exports.EXTNAME_JS_RE = /\.(js|jsx|ts|tsx|mjs)$/;
|
|
11
12
|
exports.EXTNAME_TS_RE = /\.tsx?$/;
|
|
12
|
-
|
|
13
|
+
const COMMON_EXTENSIONS = [
|
|
13
14
|
'.uts',
|
|
14
15
|
'.mjs',
|
|
15
16
|
'.js',
|
|
@@ -17,7 +18,9 @@ exports.extensions = [
|
|
|
17
18
|
'.jsx',
|
|
18
19
|
'.tsx',
|
|
19
20
|
'.json',
|
|
20
|
-
]
|
|
21
|
+
];
|
|
22
|
+
exports.extensions = COMMON_EXTENSIONS.concat(exports.EXTNAME_VUE);
|
|
23
|
+
exports.uni_app_x_extensions = COMMON_EXTENSIONS.concat(['.uvue', '.vue']);
|
|
21
24
|
exports.PAGES_JSON_JS = 'pages-json-js';
|
|
22
25
|
exports.PAGES_JSON_UTS = 'pages-json-uts';
|
|
23
26
|
exports.MANIFEST_JSON_JS = 'manifest-json-js';
|
|
@@ -35,6 +38,8 @@ exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__';
|
|
|
35
38
|
exports.PAGE_EXTNAME_APP = ['.nvue', '.vue', '.tsx', '.jsx', '.js'];
|
|
36
39
|
// 其他平台解析页面后缀的优先级
|
|
37
40
|
exports.PAGE_EXTNAME = ['.vue', '.nvue', '.tsx', '.jsx', '.js'];
|
|
41
|
+
exports.X_PAGE_EXTNAME = ['.vue', '.uvue', '.tsx', '.jsx', '.js'];
|
|
42
|
+
exports.X_PAGE_EXTNAME_APP = ['.uvue', '.tsx', '.jsx', '.js'];
|
|
38
43
|
exports.H5_API_STYLE_PATH = '@dcloudio/uni-h5/style/api/';
|
|
39
44
|
exports.H5_FRAMEWORK_STYLE_PATH = '@dcloudio/uni-h5/style/framework/';
|
|
40
45
|
exports.H5_COMPONENTS_STYLE_PATH = '@dcloudio/uni-h5/style/';
|
package/dist/easycom.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface EasycomOption {
|
|
2
2
|
dirs?: string[];
|
|
3
3
|
rootDir: string;
|
|
4
|
-
extensions
|
|
4
|
+
extensions: string[];
|
|
5
5
|
autoscan?: boolean;
|
|
6
6
|
custom?: EasycomCustom;
|
|
7
7
|
}
|
|
@@ -13,9 +13,10 @@ export interface EasycomMatcher {
|
|
|
13
13
|
interface EasycomCustom {
|
|
14
14
|
[key: string]: string;
|
|
15
15
|
}
|
|
16
|
-
export declare function initEasycoms(inputDir: string, { dirs, platform }: {
|
|
16
|
+
export declare function initEasycoms(inputDir: string, { dirs, platform, isX, }: {
|
|
17
17
|
dirs: string[];
|
|
18
18
|
platform: UniApp.PLATFORM;
|
|
19
|
+
isX?: boolean;
|
|
19
20
|
}): {
|
|
20
21
|
options: EasycomOption;
|
|
21
22
|
filter: (id: unknown) => boolean;
|
package/dist/easycom.js
CHANGED
|
@@ -24,7 +24,7 @@ function clearEasycom() {
|
|
|
24
24
|
easycomsCache.clear();
|
|
25
25
|
easycomsInvalidCache.clear();
|
|
26
26
|
}
|
|
27
|
-
function initEasycoms(inputDir, { dirs, platform }) {
|
|
27
|
+
function initEasycoms(inputDir, { dirs, platform, isX, }) {
|
|
28
28
|
const componentsDir = path_1.default.resolve(inputDir, 'components');
|
|
29
29
|
const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
30
30
|
const initEasycomOptions = (pagesJson) => {
|
|
@@ -41,6 +41,7 @@ function initEasycoms(inputDir, { dirs, platform }) {
|
|
|
41
41
|
rootDir: inputDir,
|
|
42
42
|
autoscan: !!(easycom && easycom.autoscan),
|
|
43
43
|
custom: (easycom && easycom.custom) || {},
|
|
44
|
+
extensions: [...(isX ? ['.uvue'] : []), ...['.vue', '.jsx', '.tsx']],
|
|
44
45
|
};
|
|
45
46
|
debugEasycom(easycomOptions);
|
|
46
47
|
return easycomOptions;
|
|
@@ -59,13 +60,14 @@ function initEasycoms(inputDir, { dirs, platform }) {
|
|
|
59
60
|
};
|
|
60
61
|
initEasycom(options);
|
|
61
62
|
initUTSEasycom();
|
|
63
|
+
const componentExtNames = isX ? 'uvue|vue' : 'vue';
|
|
62
64
|
const res = {
|
|
63
65
|
options,
|
|
64
66
|
filter: (0, pluginutils_1.createFilter)([
|
|
65
|
-
'components/*/*.(
|
|
66
|
-
'uni_modules/*/components/*/*.(
|
|
67
|
-
'utssdk/*/**/*.
|
|
68
|
-
'uni_modules/*/utssdk/*/*.
|
|
67
|
+
'components/*/*.(' + componentExtNames + '|jsx|tsx)',
|
|
68
|
+
'uni_modules/*/components/*/*.(' + componentExtNames + '|jsx|tsx)',
|
|
69
|
+
'utssdk/*/**/*.(' + componentExtNames + ')',
|
|
70
|
+
'uni_modules/*/utssdk/*/*.(' + componentExtNames + ')',
|
|
69
71
|
], [], {
|
|
70
72
|
resolve: inputDir,
|
|
71
73
|
}),
|
|
@@ -94,7 +96,7 @@ function initUniModulesEasycomDirs(uniModulesDir) {
|
|
|
94
96
|
})
|
|
95
97
|
.filter(Boolean);
|
|
96
98
|
}
|
|
97
|
-
function initEasycom({ dirs, rootDir, custom, extensions
|
|
99
|
+
function initEasycom({ dirs, rootDir, custom, extensions }) {
|
|
98
100
|
clearEasycom();
|
|
99
101
|
const easycomsObj = Object.create(null);
|
|
100
102
|
if (dirs && dirs.length && rootDir) {
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export * from './esbuild';
|
|
|
21
21
|
export * from './resolve';
|
|
22
22
|
export * from './scripts';
|
|
23
23
|
export * from './platform';
|
|
24
|
-
export { parseUniExtApis, parseInjects } from './uni_modules';
|
|
24
|
+
export { parseUniExtApis, parseInjects, Define, DefineOptions, Defines, } from './uni_modules';
|
|
25
25
|
export { M } from './messages';
|
|
26
26
|
export * from './exports';
|
|
27
27
|
export { checkUpdate } from './checkUpdate';
|
|
@@ -2,3 +2,4 @@ export declare function normalizeAppManifestJson(userManifestJson: Record<string
|
|
|
2
2
|
export * from './env';
|
|
3
3
|
export { APP_CONFUSION_FILENAME, isConfusionFile, hasConfusionFile, } from './confusion';
|
|
4
4
|
export { getNVueCompiler, getNVueStyleCompiler, getNVueFlexDirection, } from './nvue';
|
|
5
|
+
export { parseArguments } from './arguments';
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0;
|
|
17
|
+
exports.parseArguments = exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0;
|
|
18
18
|
const shared_1 = require("@vue/shared");
|
|
19
19
|
const merge_1 = require("./merge");
|
|
20
20
|
const defaultManifestJson_1 = require("./defaultManifestJson");
|
|
@@ -59,3 +59,5 @@ var nvue_2 = require("./nvue");
|
|
|
59
59
|
Object.defineProperty(exports, "getNVueCompiler", { enumerable: true, get: function () { return nvue_2.getNVueCompiler; } });
|
|
60
60
|
Object.defineProperty(exports, "getNVueStyleCompiler", { enumerable: true, get: function () { return nvue_2.getNVueStyleCompiler; } });
|
|
61
61
|
Object.defineProperty(exports, "getNVueFlexDirection", { enumerable: true, get: function () { return nvue_2.getNVueFlexDirection; } });
|
|
62
|
+
var arguments_2 = require("./arguments");
|
|
63
|
+
Object.defineProperty(exports, "parseArguments", { enumerable: true, get: function () { return arguments_2.parseArguments; } });
|
package/dist/json/pages.js
CHANGED
|
@@ -215,9 +215,9 @@ function normalizePageStyle(pagePath, pageStyle, platform) {
|
|
|
215
215
|
}
|
|
216
216
|
if (pageStyle) {
|
|
217
217
|
if (platform === 'h5') {
|
|
218
|
-
(0, shared_1.extend)(pageStyle, pageStyle['app'] || pageStyle['app-plus']);
|
|
218
|
+
(0, shared_1.extend)(pageStyle, pageStyle['app'] || pageStyle['app-plus'], pageStyle['web'] || pageStyle['h5']);
|
|
219
219
|
}
|
|
220
|
-
if (platform === 'app') {
|
|
220
|
+
else if (platform === 'app') {
|
|
221
221
|
(0, shared_1.extend)(pageStyle, pageStyle['app'] || pageStyle['app-plus']);
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
@@ -383,7 +383,7 @@ function normalizeFilepath(filepath) {
|
|
|
383
383
|
}
|
|
384
384
|
return filepath;
|
|
385
385
|
}
|
|
386
|
-
const platforms = ['h5', 'app', 'mp-', 'quickapp'];
|
|
386
|
+
const platforms = ['h5', 'app', 'mp-', 'quickapp', 'web'];
|
|
387
387
|
function removePlatformStyle(pageStyle) {
|
|
388
388
|
Object.keys(pageStyle).forEach((name) => {
|
|
389
389
|
if (platforms.find((prefix) => name.startsWith(prefix))) {
|
package/dist/json/uniAppX.js
CHANGED
|
@@ -42,6 +42,10 @@ function normalizeUniAppXAppPagesJson(jsonStr) {
|
|
|
42
42
|
if (userPagesJson.tabBar) {
|
|
43
43
|
pagesJson.tabBar = userPagesJson.tabBar;
|
|
44
44
|
}
|
|
45
|
+
// condition
|
|
46
|
+
if (userPagesJson.condition) {
|
|
47
|
+
pagesJson.condition = userPagesJson.condition;
|
|
48
|
+
}
|
|
45
49
|
return pagesJson;
|
|
46
50
|
}
|
|
47
51
|
exports.normalizeUniAppXAppPagesJson = normalizeUniAppXAppPagesJson;
|
package/dist/logs/index.d.ts
CHANGED
package/dist/logs/index.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.output = exports.formatWarnMsg = exports.formatInfoMsg = exports.formatErrMsg = void 0;
|
|
3
|
+
exports.output = exports.resetOutput = exports.formatWarnMsg = exports.formatInfoMsg = exports.formatErrMsg = void 0;
|
|
4
4
|
var format_1 = require("./format");
|
|
5
5
|
Object.defineProperty(exports, "formatErrMsg", { enumerable: true, get: function () { return format_1.formatErrMsg; } });
|
|
6
6
|
Object.defineProperty(exports, "formatInfoMsg", { enumerable: true, get: function () { return format_1.formatInfoMsg; } });
|
|
7
7
|
Object.defineProperty(exports, "formatWarnMsg", { enumerable: true, get: function () { return format_1.formatWarnMsg; } });
|
|
8
8
|
let lastType;
|
|
9
9
|
let lastMsg;
|
|
10
|
+
function resetOutput(type) {
|
|
11
|
+
if (type === lastType) {
|
|
12
|
+
lastType = undefined;
|
|
13
|
+
lastMsg = '';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.resetOutput = resetOutput;
|
|
10
17
|
function output(type, msg) {
|
|
11
18
|
if (type === lastType && msg === lastMsg) {
|
|
12
19
|
return;
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ declare const _default: {
|
|
|
2
2
|
readonly 'app.compiler.version': "Compiler version: {version}";
|
|
3
3
|
readonly compiling: "Compiling...";
|
|
4
4
|
readonly 'dev.performance': "Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.";
|
|
5
|
+
readonly 'dev.exclusion': "Please configure the antivirus software to set up an exclusion list for scanning, reducing system resource consumption. [详情](https://uniapp.dcloud.net.cn/uni-app-x/compiler/#tips)";
|
|
5
6
|
readonly 'dev.performance.nvue': "Especially the sourcemap of app-nvue has a greater impact";
|
|
6
7
|
readonly 'dev.performance.mp': "To officially release, please click the release menu or use the cli release command to release";
|
|
7
8
|
readonly 'build.done': "DONE Build complete.";
|
|
@@ -9,6 +10,7 @@ declare const _default: {
|
|
|
9
10
|
readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
|
|
10
11
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
11
12
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
13
|
+
readonly 'build.failed': "DONE Build failed.";
|
|
12
14
|
readonly 'compiler.build.failed': "Build failed with errors.";
|
|
13
15
|
readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
|
|
14
16
|
readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
|
|
@@ -39,5 +41,6 @@ declare const _default: {
|
|
|
39
41
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "Huawei Quick App Devtools";
|
|
40
42
|
readonly 'prompt.run.devtools.quickapp-webview-union': "Quick App Alliance Devtools";
|
|
41
43
|
readonly 'uvue.unsupported': "uvue does not support {platform} platform";
|
|
44
|
+
readonly 'uvue.dev.watching.end.empty': "The compilation outcome remains unchanged; there is no need to synchronize.";
|
|
42
45
|
};
|
|
43
46
|
export default _default;
|
package/dist/messages/en.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.default = {
|
|
|
4
4
|
'app.compiler.version': 'Compiler version: {version}',
|
|
5
5
|
compiling: 'Compiling...',
|
|
6
6
|
'dev.performance': 'Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.',
|
|
7
|
+
'dev.exclusion': 'Please configure the antivirus software to set up an exclusion list for scanning, reducing system resource consumption. [详情](https://uniapp.dcloud.net.cn/uni-app-x/compiler/#tips)',
|
|
7
8
|
'dev.performance.nvue': 'Especially the sourcemap of app-nvue has a greater impact',
|
|
8
9
|
'dev.performance.mp': 'To officially release, please click the release menu or use the cli release command to release',
|
|
9
10
|
'build.done': 'DONE Build complete.',
|
|
@@ -11,6 +12,7 @@ exports.default = {
|
|
|
11
12
|
'dev.watching.end': 'DONE Build complete. Watching for changes...',
|
|
12
13
|
'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
|
|
13
14
|
'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
|
|
15
|
+
'build.failed': 'DONE Build failed.',
|
|
14
16
|
'compiler.build.failed': 'Build failed with errors.',
|
|
15
17
|
'stat.warn.appid': 'The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303',
|
|
16
18
|
'stat.warn.version': 'The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat',
|
|
@@ -41,4 +43,5 @@ exports.default = {
|
|
|
41
43
|
'prompt.run.devtools.quickapp-webview-huawei': 'Huawei Quick App Devtools',
|
|
42
44
|
'prompt.run.devtools.quickapp-webview-union': 'Quick App Alliance Devtools',
|
|
43
45
|
'uvue.unsupported': 'uvue does not support {platform} platform',
|
|
46
|
+
'uvue.dev.watching.end.empty': 'The compilation outcome remains unchanged; there is no need to synchronize.',
|
|
44
47
|
};
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const M: {
|
|
|
2
2
|
readonly 'app.compiler.version': "编译器版本:{version}";
|
|
3
3
|
readonly compiling: "正在编译中...";
|
|
4
4
|
readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
|
|
5
|
+
readonly 'dev.exclusion': "请在杀毒软件中设置扫描排除名单,减少系统资源消耗。[详情](https://uniapp.dcloud.net.cn/uni-app-x/compiler/#tips)";
|
|
5
6
|
readonly 'dev.performance.nvue': "尤其是 app-nvue 的 sourcemap 影响较大";
|
|
6
7
|
readonly 'dev.performance.mp': "若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布";
|
|
7
8
|
readonly 'build.done': "DONE Build complete.";
|
|
@@ -9,6 +10,7 @@ export declare const M: {
|
|
|
9
10
|
readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
|
|
10
11
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
11
12
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
13
|
+
readonly 'build.failed': "DONE Build failed.";
|
|
12
14
|
readonly 'compiler.build.failed': "编译失败";
|
|
13
15
|
readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
|
|
14
16
|
readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
|
|
@@ -39,10 +41,12 @@ export declare const M: {
|
|
|
39
41
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "华为快应用开发者工具";
|
|
40
42
|
readonly 'prompt.run.devtools.quickapp-webview-union': "快应用联盟开发者工具";
|
|
41
43
|
readonly 'uvue.unsupported': "uvue 暂不支持 {platform} 平台";
|
|
44
|
+
readonly 'uvue.dev.watching.end.empty': "本次代码变更,编译结果未发生变化,跳过同步手机端程序文件。";
|
|
42
45
|
} | {
|
|
43
46
|
readonly 'app.compiler.version': "Compiler version: {version}";
|
|
44
47
|
readonly compiling: "Compiling...";
|
|
45
48
|
readonly 'dev.performance': "Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.";
|
|
49
|
+
readonly 'dev.exclusion': "Please configure the antivirus software to set up an exclusion list for scanning, reducing system resource consumption. [详情](https://uniapp.dcloud.net.cn/uni-app-x/compiler/#tips)";
|
|
46
50
|
readonly 'dev.performance.nvue': "Especially the sourcemap of app-nvue has a greater impact";
|
|
47
51
|
readonly 'dev.performance.mp': "To officially release, please click the release menu or use the cli release command to release";
|
|
48
52
|
readonly 'build.done': "DONE Build complete.";
|
|
@@ -50,6 +54,7 @@ export declare const M: {
|
|
|
50
54
|
readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
|
|
51
55
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
52
56
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
57
|
+
readonly 'build.failed': "DONE Build failed.";
|
|
53
58
|
readonly 'compiler.build.failed': "Build failed with errors.";
|
|
54
59
|
readonly 'stat.warn.appid': "The current application is not configured with Appid, and uni statistics cannot be used. For details, see https://ask.dcloud.net.cn/article/36303";
|
|
55
60
|
readonly 'stat.warn.version': "The uni statistics version is not configured. The default version is 1.0.uni statistics version 2.0 is recommended, private deployment data is more secure and code is open source and customizable. details: https://uniapp.dcloud.io/uni-stat";
|
|
@@ -80,4 +85,5 @@ export declare const M: {
|
|
|
80
85
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "Huawei Quick App Devtools";
|
|
81
86
|
readonly 'prompt.run.devtools.quickapp-webview-union': "Quick App Alliance Devtools";
|
|
82
87
|
readonly 'uvue.unsupported': "uvue does not support {platform} platform";
|
|
88
|
+
readonly 'uvue.dev.watching.end.empty': "The compilation outcome remains unchanged; there is no need to synchronize.";
|
|
83
89
|
};
|
package/dist/messages/zh_CN.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ declare const _default: {
|
|
|
2
2
|
readonly 'app.compiler.version': "编译器版本:{version}";
|
|
3
3
|
readonly compiling: "正在编译中...";
|
|
4
4
|
readonly 'dev.performance': "请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。";
|
|
5
|
+
readonly 'dev.exclusion': "请在杀毒软件中设置扫描排除名单,减少系统资源消耗。[详情](https://uniapp.dcloud.net.cn/uni-app-x/compiler/#tips)";
|
|
5
6
|
readonly 'dev.performance.nvue': "尤其是 app-nvue 的 sourcemap 影响较大";
|
|
6
7
|
readonly 'dev.performance.mp': "若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布";
|
|
7
8
|
readonly 'build.done': "DONE Build complete.";
|
|
@@ -9,6 +10,7 @@ declare const _default: {
|
|
|
9
10
|
readonly 'dev.watching.end': "DONE Build complete. Watching for changes...";
|
|
10
11
|
readonly 'dev.watching.end.pages': "DONE Build complete. PAGES:{pages}";
|
|
11
12
|
readonly 'dev.watching.end.files': "DONE Build complete. FILES:{files}";
|
|
13
|
+
readonly 'build.failed': "DONE Build failed.";
|
|
12
14
|
readonly 'compiler.build.failed': "编译失败";
|
|
13
15
|
readonly 'stat.warn.appid': "当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303";
|
|
14
16
|
readonly 'stat.warn.version': "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat";
|
|
@@ -39,5 +41,6 @@ declare const _default: {
|
|
|
39
41
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "华为快应用开发者工具";
|
|
40
42
|
readonly 'prompt.run.devtools.quickapp-webview-union': "快应用联盟开发者工具";
|
|
41
43
|
readonly 'uvue.unsupported': "uvue 暂不支持 {platform} 平台";
|
|
44
|
+
readonly 'uvue.dev.watching.end.empty': "本次代码变更,编译结果未发生变化,跳过同步手机端程序文件。";
|
|
42
45
|
};
|
|
43
46
|
export default _default;
|
package/dist/messages/zh_CN.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.default = {
|
|
|
4
4
|
'app.compiler.version': '编译器版本:{version}',
|
|
5
5
|
compiling: '正在编译中...',
|
|
6
6
|
'dev.performance': '请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。',
|
|
7
|
+
'dev.exclusion': '请在杀毒软件中设置扫描排除名单,减少系统资源消耗。[详情](https://uniapp.dcloud.net.cn/uni-app-x/compiler/#tips)',
|
|
7
8
|
'dev.performance.nvue': '尤其是 app-nvue 的 sourcemap 影响较大',
|
|
8
9
|
'dev.performance.mp': '若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布',
|
|
9
10
|
'build.done': 'DONE Build complete.',
|
|
@@ -11,6 +12,7 @@ exports.default = {
|
|
|
11
12
|
'dev.watching.end': 'DONE Build complete. Watching for changes...',
|
|
12
13
|
'dev.watching.end.pages': 'DONE Build complete. PAGES:{pages}',
|
|
13
14
|
'dev.watching.end.files': 'DONE Build complete. FILES:{files}',
|
|
15
|
+
'build.failed': 'DONE Build failed.',
|
|
14
16
|
'compiler.build.failed': '编译失败',
|
|
15
17
|
'stat.warn.appid': '当前应用未配置 appid,无法使用 uni 统计,详情参考:https://ask.dcloud.net.cn/article/36303',
|
|
16
18
|
'stat.warn.version': '当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:https://uniapp.dcloud.io/uni-stat',
|
|
@@ -41,4 +43,5 @@ exports.default = {
|
|
|
41
43
|
'prompt.run.devtools.quickapp-webview-huawei': '华为快应用开发者工具',
|
|
42
44
|
'prompt.run.devtools.quickapp-webview-union': '快应用联盟开发者工具',
|
|
43
45
|
'uvue.unsupported': 'uvue 暂不支持 {platform} 平台',
|
|
46
|
+
'uvue.dev.watching.end.empty': '本次代码变更,编译结果未发生变化,跳过同步手机端程序文件。',
|
|
44
47
|
};
|
|
@@ -185,7 +185,7 @@ async function parseTemplateDescriptor(filename, ast, options) {
|
|
|
185
185
|
exports.parseTemplateDescriptor = parseTemplateDescriptor;
|
|
186
186
|
async function parseGlobalDescriptor(filename, ast, resolve) {
|
|
187
187
|
// 外置时查找所有 vue component import
|
|
188
|
-
const imports = (await parseVueComponentImports(filename, ast.body.filter((node) => (0, types_1.isImportDeclaration)(node)), resolve)).filter((item) => !(0, utils_2.cleanUrl)(item.source.value)
|
|
188
|
+
const imports = (await parseVueComponentImports(filename, ast.body.filter((node) => (0, types_1.isImportDeclaration)(node)), resolve)).filter((item) => !(0, utils_1.isAppVue)((0, utils_2.cleanUrl)(item.source.value)));
|
|
189
189
|
return {
|
|
190
190
|
bindingComponents: parseGlobalComponents(ast),
|
|
191
191
|
imports,
|
package/dist/platform.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function getPreVueContext(): any;
|
|
2
2
|
export declare function getPreNVueContext(): any;
|
|
3
3
|
export declare function getPreUVueContext(): any;
|
|
4
|
-
export declare function initPreContext(platform: UniApp.PLATFORM, userPreContext?: Record<string, boolean> | string, utsPlatform?: typeof process.env.UNI_UTS_PLATFORM): void;
|
|
4
|
+
export declare function initPreContext(platform: UniApp.PLATFORM, userPreContext?: Record<string, boolean> | string, utsPlatform?: typeof process.env.UNI_UTS_PLATFORM, isX?: boolean): void;
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initPreContext = exports.getPreUVueContext = exports.getPreNVueContext = exports.getPreVueContext = void 0;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const DEFAULT_KEYS = [
|
|
6
|
+
'UNI_APP_X',
|
|
6
7
|
'APP',
|
|
8
|
+
'APP_UVUE',
|
|
7
9
|
'APP_NVUE',
|
|
8
10
|
'APP_PLUS',
|
|
9
11
|
'APP_PLUS_NVUE',
|
|
@@ -44,7 +46,7 @@ function getPreUVueContext() {
|
|
|
44
46
|
return preUVueContext;
|
|
45
47
|
}
|
|
46
48
|
exports.getPreUVueContext = getPreUVueContext;
|
|
47
|
-
function initPreContext(platform, userPreContext, utsPlatform) {
|
|
49
|
+
function initPreContext(platform, userPreContext, utsPlatform, isX) {
|
|
48
50
|
const vueContext = Object.create(null);
|
|
49
51
|
const nvueContext = Object.create(null);
|
|
50
52
|
const uvueContext = Object.create(null);
|
|
@@ -52,10 +54,16 @@ function initPreContext(platform, userPreContext, utsPlatform) {
|
|
|
52
54
|
DEFAULT_KEYS.forEach((key) => {
|
|
53
55
|
defaultContext[key] = false;
|
|
54
56
|
});
|
|
57
|
+
defaultContext.uniVersion = parseFloat(process.env.UNI_COMPILER_VERSION) || 0;
|
|
55
58
|
defaultContext[normalizeKey(platform)] = true;
|
|
56
59
|
vueContext.VUE3 = true;
|
|
57
60
|
nvueContext.VUE3 = true;
|
|
58
61
|
uvueContext.VUE3 = true;
|
|
62
|
+
if (isX) {
|
|
63
|
+
vueContext.UNI_APP_X = true;
|
|
64
|
+
nvueContext.UNI_APP_X = true;
|
|
65
|
+
uvueContext.UNI_APP_X = true;
|
|
66
|
+
}
|
|
59
67
|
if (platform === 'app' || platform === 'app-plus') {
|
|
60
68
|
defaultContext.APP = true;
|
|
61
69
|
defaultContext.APP_PLUS = true;
|
package/dist/resolve.js
CHANGED
|
@@ -19,7 +19,7 @@ exports.requireResolve = requireResolve;
|
|
|
19
19
|
function resolveWithSymlinks(id, basedir) {
|
|
20
20
|
return resolve_1.default.sync(id, {
|
|
21
21
|
basedir,
|
|
22
|
-
extensions: constants_1.extensions,
|
|
22
|
+
extensions: process.env.UNI_APP_X === 'true' ? constants_1.uni_app_x_extensions : constants_1.extensions,
|
|
23
23
|
// necessary to work with pnpm
|
|
24
24
|
preserveSymlinks: true,
|
|
25
25
|
});
|
|
@@ -102,11 +102,12 @@ exports.resolveVueI18nRuntime = resolveVueI18nRuntime;
|
|
|
102
102
|
let componentsLibPath = '';
|
|
103
103
|
function resolveComponentsLibPath() {
|
|
104
104
|
if (!componentsLibPath) {
|
|
105
|
+
const dir = process.env.UNI_APP_X === 'true' ? '../lib-x' : '../lib';
|
|
105
106
|
if ((0, env_1.isInHBuilderX)()) {
|
|
106
|
-
componentsLibPath = path_1.default.join(resolveBuiltIn('@dcloudio/uni-components/package.json'),
|
|
107
|
+
componentsLibPath = path_1.default.join(resolveBuiltIn('@dcloudio/uni-components/package.json'), dir);
|
|
107
108
|
}
|
|
108
109
|
else {
|
|
109
|
-
componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.env.UNI_INPUT_DIR),
|
|
110
|
+
componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.env.UNI_INPUT_DIR), dir);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
return componentsLibPath;
|
package/dist/uni_modules.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UTSTargetLanguage } from './uts';
|
|
2
|
-
type DefineOptions = {
|
|
2
|
+
export type DefineOptions = {
|
|
3
3
|
name?: string;
|
|
4
4
|
app?: boolean | {
|
|
5
5
|
js?: boolean;
|
|
@@ -8,8 +8,8 @@ type DefineOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
};
|
|
11
|
-
type Define = string | string[] | Record<string, string | DefineOptions> | false;
|
|
12
|
-
type Defines = {
|
|
11
|
+
export type Define = string | string[] | Record<string, string | DefineOptions> | false;
|
|
12
|
+
export type Defines = {
|
|
13
13
|
[name: string]: Define;
|
|
14
14
|
};
|
|
15
15
|
export interface Exports {
|
package/dist/utils.d.ts
CHANGED
|
@@ -18,3 +18,5 @@ export declare function pathToGlob(pathString: string, glob: string, options?: {
|
|
|
18
18
|
}): string;
|
|
19
19
|
export declare function resolveSourceMapPath(outputDir?: string, platform?: UniApp.PLATFORM): string;
|
|
20
20
|
export declare function installDepTips(type: 'dependencies' | 'devDependencies', module: string, version?: string): string;
|
|
21
|
+
export declare function isAppVue(filename: string): boolean;
|
|
22
|
+
export declare function resolveAppVue(inputDir: string): string;
|
package/dist/utils.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.installDepTips = exports.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.version = exports.hash = void 0;
|
|
6
|
+
exports.resolveAppVue = exports.isAppVue = exports.installDepTips = exports.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.version = exports.hash = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -33,9 +33,10 @@ function normalizeIdentifier(str) {
|
|
|
33
33
|
exports.normalizeIdentifier = normalizeIdentifier;
|
|
34
34
|
function normalizePagePath(pagePath, platform) {
|
|
35
35
|
const absolutePagePath = path_1.default.resolve(process.env.UNI_INPUT_DIR, pagePath);
|
|
36
|
-
|
|
36
|
+
const isX = process.env.UNI_APP_X === 'true';
|
|
37
|
+
let extensions = isX ? constants_1.X_PAGE_EXTNAME : constants_1.PAGE_EXTNAME;
|
|
37
38
|
if (platform === 'app') {
|
|
38
|
-
extensions = constants_1.PAGE_EXTNAME_APP;
|
|
39
|
+
extensions = isX ? constants_1.X_PAGE_EXTNAME_APP : constants_1.PAGE_EXTNAME_APP;
|
|
39
40
|
}
|
|
40
41
|
for (let i = 0; i < extensions.length; i++) {
|
|
41
42
|
const extname = extensions[i];
|
|
@@ -111,3 +112,15 @@ function installDepTips(type, module, version) {
|
|
|
111
112
|
Please run \`${picocolors_1.default.cyan(`${getInstallCommand(process.cwd())} ${module + (version ? '@' + version : '')}${type === 'devDependencies' ? ' -D' : ''}`)}\` and try again.`;
|
|
112
113
|
}
|
|
113
114
|
exports.installDepTips = installDepTips;
|
|
115
|
+
function isAppVue(filename) {
|
|
116
|
+
return filename.endsWith('App.vue') || filename.endsWith('App.uvue');
|
|
117
|
+
}
|
|
118
|
+
exports.isAppVue = isAppVue;
|
|
119
|
+
function resolveAppVue(inputDir) {
|
|
120
|
+
const appUVue = path_1.default.resolve(inputDir, 'App.uvue');
|
|
121
|
+
if (fs_1.default.existsSync(appUVue)) {
|
|
122
|
+
return normalizePath(appUVue);
|
|
123
|
+
}
|
|
124
|
+
return normalizePath(path_1.default.resolve(inputDir, 'App.vue'));
|
|
125
|
+
}
|
|
126
|
+
exports.resolveAppVue = resolveAppVue;
|
|
@@ -4,6 +4,7 @@ exports.uniViteCopyPlugin = void 0;
|
|
|
4
4
|
const watcher_1 = require("../../watcher");
|
|
5
5
|
const messages_1 = require("../../messages");
|
|
6
6
|
const logs_1 = require("../../logs");
|
|
7
|
+
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
7
8
|
function uniViteCopyPlugin({ targets, verbose, }) {
|
|
8
9
|
let resolvedConfig;
|
|
9
10
|
let initialized = false;
|
|
@@ -24,6 +25,11 @@ function uniViteCopyPlugin({ targets, verbose, }) {
|
|
|
24
25
|
return new Promise((resolve) => {
|
|
25
26
|
Promise.all(targets.map(({ watchOptions, ...target }) => {
|
|
26
27
|
return new Promise((resolve) => {
|
|
28
|
+
// 防抖,可能短时间触发很多次add,unlink
|
|
29
|
+
const onChange = (0, uni_shared_1.debounce)(() => {
|
|
30
|
+
(0, logs_1.resetOutput)('log');
|
|
31
|
+
(0, logs_1.output)('log', messages_1.M['dev.watching.end']);
|
|
32
|
+
}, 100, { setTimeout, clearTimeout });
|
|
27
33
|
new watcher_1.FileWatcher({
|
|
28
34
|
verbose,
|
|
29
35
|
...target,
|
|
@@ -31,8 +37,9 @@ function uniViteCopyPlugin({ targets, verbose, }) {
|
|
|
31
37
|
cwd: process.env.UNI_INPUT_DIR,
|
|
32
38
|
...watchOptions,
|
|
33
39
|
}, (watcher) => {
|
|
34
|
-
if (process.env.NODE_ENV !== 'development'
|
|
35
|
-
|
|
40
|
+
if (process.env.NODE_ENV !== 'development' ||
|
|
41
|
+
process.env.UNI_AUTOMATOR_CONFIG) {
|
|
42
|
+
// 生产或自动化测试模式下,延迟 close,否则会影响 chokidar 初始化的 add 等事件
|
|
36
43
|
setTimeout(() => {
|
|
37
44
|
watcher.close().then(() => resolve(void 0));
|
|
38
45
|
}, 2000);
|
|
@@ -40,10 +47,7 @@ function uniViteCopyPlugin({ targets, verbose, }) {
|
|
|
40
47
|
else {
|
|
41
48
|
resolve(void 0);
|
|
42
49
|
}
|
|
43
|
-
},
|
|
44
|
-
// TODO 目前初始化编译时,也会不停地触发此函数。
|
|
45
|
-
(0, logs_1.output)('log', messages_1.M['dev.watching.end']);
|
|
46
|
-
});
|
|
50
|
+
}, onChange);
|
|
47
51
|
});
|
|
48
52
|
})).then(() => resolve());
|
|
49
53
|
});
|
|
@@ -9,6 +9,7 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
9
9
|
const constants_1 = require("../../constants");
|
|
10
10
|
const preprocess_1 = require("../../preprocess");
|
|
11
11
|
const parse_1 = require("../../vue/parse");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
12
13
|
const debugScoped = (0, debug_1.default)('uni:scoped');
|
|
13
14
|
const SCOPED_RE = /<style\s[^>]*scoped[^>]*>/i;
|
|
14
15
|
function addScoped(code) {
|
|
@@ -60,7 +61,7 @@ function uniCssScopedPlugin({ filter } = { filter: () => false }) {
|
|
|
60
61
|
if (!constants_1.EXTNAME_VUE.includes(path_1.default.extname(ctx.file))) {
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
const scoped = !ctx.file
|
|
64
|
+
const scoped = !(0, utils_1.isAppVue)(ctx.file);
|
|
64
65
|
debugScoped('hmr', ctx.file);
|
|
65
66
|
const oldRead = ctx.read;
|
|
66
67
|
ctx.read = async () => {
|
|
@@ -5,7 +5,8 @@ export * from './mainJs';
|
|
|
5
5
|
export * from './jsonJs';
|
|
6
6
|
export * from './console';
|
|
7
7
|
export * from './dynamicImportPolyfill';
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
8
|
+
export * from './uts/app';
|
|
9
|
+
export * from './uts/h5';
|
|
10
|
+
export { assetPlugin, parseAssets, getAssetHash } from './vitejs/plugins/asset';
|
|
10
11
|
export { isCSSRequest, cssPlugin, cssPostPlugin, minifyCSS, cssLangRE, commonjsProxyRE, } from './vitejs/plugins/css';
|
|
11
|
-
export { generateCodeFrame } from './vitejs/utils';
|
|
12
|
+
export { generateCodeFrame, locToStartAndEnd } from './vitejs/utils';
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.generateCodeFrame = exports.commonjsProxyRE = exports.cssLangRE = exports.minifyCSS = exports.cssPostPlugin = exports.cssPlugin = exports.isCSSRequest = exports.getAssetHash = exports.assetPlugin = void 0;
|
|
17
|
+
exports.locToStartAndEnd = exports.generateCodeFrame = exports.commonjsProxyRE = exports.cssLangRE = exports.minifyCSS = exports.cssPostPlugin = exports.cssPlugin = exports.isCSSRequest = exports.getAssetHash = exports.parseAssets = exports.assetPlugin = void 0;
|
|
18
18
|
__exportStar(require("./cssScoped"), exports);
|
|
19
19
|
__exportStar(require("./copy"), exports);
|
|
20
20
|
__exportStar(require("./inject"), exports);
|
|
@@ -22,9 +22,11 @@ __exportStar(require("./mainJs"), exports);
|
|
|
22
22
|
__exportStar(require("./jsonJs"), exports);
|
|
23
23
|
__exportStar(require("./console"), exports);
|
|
24
24
|
__exportStar(require("./dynamicImportPolyfill"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
25
|
+
__exportStar(require("./uts/app"), exports);
|
|
26
|
+
__exportStar(require("./uts/h5"), exports);
|
|
26
27
|
var asset_1 = require("./vitejs/plugins/asset");
|
|
27
28
|
Object.defineProperty(exports, "assetPlugin", { enumerable: true, get: function () { return asset_1.assetPlugin; } });
|
|
29
|
+
Object.defineProperty(exports, "parseAssets", { enumerable: true, get: function () { return asset_1.parseAssets; } });
|
|
28
30
|
Object.defineProperty(exports, "getAssetHash", { enumerable: true, get: function () { return asset_1.getAssetHash; } });
|
|
29
31
|
var css_1 = require("./vitejs/plugins/css");
|
|
30
32
|
Object.defineProperty(exports, "isCSSRequest", { enumerable: true, get: function () { return css_1.isCSSRequest; } });
|
|
@@ -35,3 +37,4 @@ Object.defineProperty(exports, "cssLangRE", { enumerable: true, get: function ()
|
|
|
35
37
|
Object.defineProperty(exports, "commonjsProxyRE", { enumerable: true, get: function () { return css_1.commonjsProxyRE; } });
|
|
36
38
|
var utils_1 = require("./vitejs/utils");
|
|
37
39
|
Object.defineProperty(exports, "generateCodeFrame", { enumerable: true, get: function () { return utils_1.generateCodeFrame; } });
|
|
40
|
+
Object.defineProperty(exports, "locToStartAndEnd", { enumerable: true, get: function () { return utils_1.locToStartAndEnd; } });
|
|
@@ -4,5 +4,5 @@ interface UniUTSPluginOptions {
|
|
|
4
4
|
extApis?: Record<string, [string, string]>;
|
|
5
5
|
}
|
|
6
6
|
export declare const utsPlugins: Set<string>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function uniUTSAppPlugin(options?: UniUTSPluginOptions): Plugin;
|
|
8
8
|
export {};
|
|
@@ -3,18 +3,18 @@ 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.
|
|
6
|
+
exports.uniUTSAppPlugin = exports.utsPlugins = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
9
|
-
const uts_1 = require("
|
|
10
|
-
const utils_1 = require("
|
|
9
|
+
const uts_1 = require("../../../uts");
|
|
10
|
+
const utils_1 = require("../../utils");
|
|
11
11
|
const UTSProxyRE = /\?uts-proxy$/;
|
|
12
12
|
function isUTSProxy(id) {
|
|
13
13
|
return UTSProxyRE.test(id);
|
|
14
14
|
}
|
|
15
15
|
const utsModuleCaches = new Map();
|
|
16
16
|
exports.utsPlugins = new Set();
|
|
17
|
-
function
|
|
17
|
+
function uniUTSAppPlugin(options = {}) {
|
|
18
18
|
process.env.UNI_UTS_USING_ROLLUP = 'true';
|
|
19
19
|
return {
|
|
20
20
|
name: 'uni:uts',
|
|
@@ -68,6 +68,7 @@ function uniUTSPlugin(options = {}) {
|
|
|
68
68
|
isX: !!options.x,
|
|
69
69
|
isPlugin: true,
|
|
70
70
|
extApis: options.extApis,
|
|
71
|
+
sourceMap: process.env.NODE_ENV === 'development',
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
74
|
utsModuleCaches.set(pluginDir, compile);
|
|
@@ -85,4 +86,4 @@ function uniUTSPlugin(options = {}) {
|
|
|
85
86
|
},
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
exports.
|
|
89
|
+
exports.uniUTSAppPlugin = uniUTSAppPlugin;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uniUTSJsPlugin = void 0;
|
|
4
|
+
const vue_1 = require("../../../vue");
|
|
5
|
+
function uniUTSJsPlugin(options = {}) {
|
|
6
|
+
process.env.UNI_UTS_USING_ROLLUP = 'true';
|
|
7
|
+
return {
|
|
8
|
+
name: 'uni:uts',
|
|
9
|
+
enforce: 'pre',
|
|
10
|
+
configResolved(config) {
|
|
11
|
+
// 移除自带的 esbuild 处理 ts 文件
|
|
12
|
+
const index = config.plugins.findIndex((p) => p.name === 'vite:esbuild');
|
|
13
|
+
if (index > -1) {
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
config.plugins.splice(index, 1);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
transform(code, id) {
|
|
19
|
+
if (!(0, vue_1.isVueSfcFile)(id)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return code.replace(/<script([^>]*)>/gi, (match, attributes) => {
|
|
23
|
+
// 如果 <script> 标签中没有 lang 属性,添加 lang="uts"
|
|
24
|
+
if (!/lang=["']?[^"']*["']?/.test(attributes)) {
|
|
25
|
+
return `<script${attributes} lang="uts">`;
|
|
26
|
+
}
|
|
27
|
+
// 否则,将现有的 lang 属性替换为 lang="uts"
|
|
28
|
+
return match.replace(/lang=["']?ts["']?/, 'lang="uts"');
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.uniUTSJsPlugin = uniUTSJsPlugin;
|
|
@@ -7,7 +7,10 @@ export declare const chunkToEmittedAssetsMap: WeakMap<RenderedChunk, Set<string>
|
|
|
7
7
|
/**
|
|
8
8
|
* Also supports loading plain strings with import text from './foo.txt?raw'
|
|
9
9
|
*/
|
|
10
|
-
export declare function assetPlugin(config: ResolvedConfig
|
|
10
|
+
export declare function assetPlugin(config: ResolvedConfig, options?: {
|
|
11
|
+
isAppX: boolean;
|
|
12
|
+
}): Plugin;
|
|
13
|
+
export declare function parseAssets(config: ResolvedConfig, code: string): string;
|
|
11
14
|
export declare function registerAssetToChunk(chunk: RenderedChunk, file: string): void;
|
|
12
15
|
export declare function checkPublicFile(url: string, { publicDir }: ResolvedConfig): string | undefined;
|
|
13
16
|
export declare function fileToUrl(id: string, config: ResolvedConfig, ctx: PluginContext, canInline?: boolean): string;
|
|
@@ -26,11 +26,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.urlToBuiltUrl = exports.getAssetHash = exports.assetFileNamesToFileName = exports.getAssetFilename = exports.fileToUrl = exports.checkPublicFile = exports.registerAssetToChunk = exports.assetPlugin = exports.chunkToEmittedAssetsMap = exports.assetUrlRE = void 0;
|
|
29
|
+
exports.urlToBuiltUrl = exports.getAssetHash = exports.assetFileNamesToFileName = exports.getAssetFilename = exports.fileToUrl = exports.checkPublicFile = exports.registerAssetToChunk = exports.parseAssets = exports.assetPlugin = exports.chunkToEmittedAssetsMap = exports.assetUrlRE = void 0;
|
|
30
30
|
const path_1 = __importDefault(require("path"));
|
|
31
31
|
const url_1 = require("url");
|
|
32
32
|
const lite_1 = __importDefault(require("mime/lite"));
|
|
33
|
-
const
|
|
33
|
+
const fs_extra_1 = __importStar(require("fs-extra"));
|
|
34
34
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
35
35
|
const crypto_1 = require("crypto");
|
|
36
36
|
const utils_1 = require("../utils");
|
|
@@ -38,9 +38,6 @@ const utils_2 = require("../../../../vite/utils/utils");
|
|
|
38
38
|
const shared_1 = require("@vue/shared");
|
|
39
39
|
const utils_3 = require("../../../../utils");
|
|
40
40
|
exports.assetUrlRE = /__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?/g;
|
|
41
|
-
// urls in JS must be quoted as strings, so when replacing them we need
|
|
42
|
-
// a different regex
|
|
43
|
-
const assetUrlQuotedRE = /"__VITE_ASSET__([a-z\d]{8})__(?:\$_(.*?)__)?"/g;
|
|
44
41
|
const rawRE = /(\?|&)raw(?:&|$)/;
|
|
45
42
|
const urlRE = /(\?|&)url(?:&|$)/;
|
|
46
43
|
exports.chunkToEmittedAssetsMap = new WeakMap();
|
|
@@ -51,7 +48,7 @@ const emittedHashMap = new WeakMap();
|
|
|
51
48
|
/**
|
|
52
49
|
* Also supports loading plain strings with import text from './foo.txt?raw'
|
|
53
50
|
*/
|
|
54
|
-
function assetPlugin(config) {
|
|
51
|
+
function assetPlugin(config, options) {
|
|
55
52
|
// assetHashToFilenameMap initialization in buildStart causes getAssetFilename to return undefined
|
|
56
53
|
assetHashToFilenameMap.set(config, new Map());
|
|
57
54
|
return {
|
|
@@ -81,19 +78,39 @@ function assetPlugin(config) {
|
|
|
81
78
|
if (rawRE.test(id)) {
|
|
82
79
|
const file = checkPublicFile(id, config) || (0, utils_1.cleanUrl)(id);
|
|
83
80
|
// raw query, read file and return as string
|
|
84
|
-
return `export default ${JSON.stringify(await
|
|
81
|
+
return `export default ${JSON.stringify(await fs_extra_1.promises.readFile(file, 'utf-8'))}`;
|
|
85
82
|
}
|
|
86
83
|
if (!config.assetsInclude((0, utils_1.cleanUrl)(id)) && !urlRE.test(id)) {
|
|
87
84
|
return;
|
|
88
85
|
}
|
|
89
86
|
id = id.replace(urlRE, '$1').replace(/[\?&]$/, '');
|
|
90
|
-
const url = await fileToUrl(id, config,
|
|
87
|
+
const url = await fileToUrl(id, config, options?.isAppX
|
|
88
|
+
? {
|
|
89
|
+
emitFile(emittedFile) {
|
|
90
|
+
// 直接写入目标目录
|
|
91
|
+
fs_extra_1.default.outputFileSync(path_1.default.resolve(process.env.UNI_OUTPUT_DIR, emittedFile.fileName), emittedFile.source);
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
: this);
|
|
95
|
+
if (options?.isAppX) {
|
|
96
|
+
this.emitFile({
|
|
97
|
+
type: 'asset',
|
|
98
|
+
fileName: (0, utils_3.normalizeNodeModules)(path_1.default.relative(process.env.UNI_INPUT_DIR, id) + '.uts'),
|
|
99
|
+
source: `export default ${JSON.stringify(parseAssets(config, url))}`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
91
102
|
return `export default ${JSON.stringify(url)}`;
|
|
92
103
|
},
|
|
93
104
|
renderChunk(code, chunk) {
|
|
94
105
|
let match;
|
|
95
106
|
let s;
|
|
96
|
-
|
|
107
|
+
exports.assetUrlRE.lastIndex = 0;
|
|
108
|
+
// Urls added with JS using e.g.
|
|
109
|
+
// imgElement.src = "__VITE_ASSET__5aa0ddc0__" are using quotes
|
|
110
|
+
// Urls added in CSS that is imported in JS end up like
|
|
111
|
+
// var inlined = ".inlined{color:green;background:url(__VITE_ASSET__5aa0ddc0__)}\n";
|
|
112
|
+
// In both cases, the wrapping should already be fine
|
|
113
|
+
while ((match = exports.assetUrlRE.exec(code))) {
|
|
97
114
|
s = s || (s = new magic_string_1.default(code));
|
|
98
115
|
const [full, hash, postfix = ''] = match;
|
|
99
116
|
// some internal plugins may still need to emit chunks (e.g. worker) so
|
|
@@ -101,7 +118,7 @@ function assetPlugin(config) {
|
|
|
101
118
|
const file = getAssetFilename(hash, config) || this.getFileName(hash);
|
|
102
119
|
registerAssetToChunk(chunk, file);
|
|
103
120
|
const outputFilepath = config.base + file + postfix;
|
|
104
|
-
s.overwrite(match.index, match.index + full.length,
|
|
121
|
+
s.overwrite(match.index, match.index + full.length, outputFilepath);
|
|
105
122
|
}
|
|
106
123
|
if (s) {
|
|
107
124
|
return {
|
|
@@ -116,6 +133,25 @@ function assetPlugin(config) {
|
|
|
116
133
|
};
|
|
117
134
|
}
|
|
118
135
|
exports.assetPlugin = assetPlugin;
|
|
136
|
+
function parseAssets(config, code) {
|
|
137
|
+
let match;
|
|
138
|
+
let s;
|
|
139
|
+
exports.assetUrlRE.lastIndex = 0;
|
|
140
|
+
while ((match = exports.assetUrlRE.exec(code))) {
|
|
141
|
+
s = s || (s = new magic_string_1.default(code));
|
|
142
|
+
const [full, hash, postfix = ''] = match;
|
|
143
|
+
// some internal plugins may still need to emit chunks (e.g. worker) so
|
|
144
|
+
// fallback to this.getFileName for that.
|
|
145
|
+
const file = getAssetFilename(hash, config);
|
|
146
|
+
const outputFilepath = config.base + file + postfix;
|
|
147
|
+
s.overwrite(match.index, match.index + full.length, outputFilepath);
|
|
148
|
+
}
|
|
149
|
+
if (s) {
|
|
150
|
+
return s.toString();
|
|
151
|
+
}
|
|
152
|
+
return code;
|
|
153
|
+
}
|
|
154
|
+
exports.parseAssets = parseAssets;
|
|
119
155
|
function registerAssetToChunk(chunk, file) {
|
|
120
156
|
let emitted = exports.chunkToEmittedAssetsMap.get(chunk);
|
|
121
157
|
if (!emitted) {
|
|
@@ -132,7 +168,7 @@ function checkPublicFile(url, { publicDir }) {
|
|
|
132
168
|
return;
|
|
133
169
|
}
|
|
134
170
|
const publicFile = path_1.default.join(publicDir, (0, utils_1.cleanUrl)(url));
|
|
135
|
-
if (
|
|
171
|
+
if (fs_extra_1.default.existsSync(publicFile)) {
|
|
136
172
|
return publicFile;
|
|
137
173
|
}
|
|
138
174
|
else {
|
|
@@ -235,7 +271,7 @@ function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, canI
|
|
|
235
271
|
return cached;
|
|
236
272
|
}
|
|
237
273
|
const file = (0, utils_1.cleanUrl)(id);
|
|
238
|
-
const content =
|
|
274
|
+
const content = fs_extra_1.default.readFileSync(file);
|
|
239
275
|
let url;
|
|
240
276
|
if (canInline && content.length < Number(config.build.assetsInlineLimit)) {
|
|
241
277
|
// base64 inlined as a string
|
|
@@ -177,7 +177,7 @@ function cssPostPlugin(config, { platform, isJsCode, chunkCssFilename, chunkCssC
|
|
|
177
177
|
const filename = chunkCssFilename(id);
|
|
178
178
|
if (filename) {
|
|
179
179
|
if (platform === 'app' &&
|
|
180
|
-
(filename === 'app.css' || filename.startsWith('App.
|
|
180
|
+
(filename === 'app.css' || filename.startsWith('App.style'))) {
|
|
181
181
|
// 获取 unocss 的样式文件信息
|
|
182
182
|
const ids = Object.keys(chunk.modules).filter((id) => styles.has(id) &&
|
|
183
183
|
(id.includes('__uno.css') || id.includes('-unocss-')));
|
|
@@ -19,6 +19,19 @@ export declare function posToNumber(source: string, pos: number | {
|
|
|
19
19
|
line: number;
|
|
20
20
|
column: number;
|
|
21
21
|
}): number;
|
|
22
|
+
export declare function locToStartAndEnd(source: string, loc: {
|
|
23
|
+
start: {
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
};
|
|
27
|
+
end: {
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
};
|
|
31
|
+
}): {
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
};
|
|
22
35
|
export declare function generateCodeFrame(source: string, start?: number | {
|
|
23
36
|
line: number;
|
|
24
37
|
column: number;
|
|
@@ -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.combineSourcemaps = exports.processSrcSet = exports.generateCodeFrame = exports.posToNumber = exports.pad = exports.isObject = exports.asyncReplace = exports.multilineCommentsRE = exports.isDataUrl = exports.dataUrlRE = exports.isExternalUrl = exports.externalRE = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.normalizePath = exports.isWindows = exports.deepImportRE = exports.bareImportRE = exports.slash = void 0;
|
|
6
|
+
exports.combineSourcemaps = exports.processSrcSet = exports.generateCodeFrame = exports.locToStartAndEnd = exports.posToNumber = exports.pad = exports.isObject = exports.asyncReplace = exports.multilineCommentsRE = exports.isDataUrl = exports.dataUrlRE = exports.isExternalUrl = exports.externalRE = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.normalizePath = exports.isWindows = exports.deepImportRE = exports.bareImportRE = exports.slash = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* https://github.com/vitejs/vite/blob/main/packages/vite/src/node/utils.ts
|
|
9
9
|
*/
|
|
@@ -60,14 +60,23 @@ function posToNumber(source, pos) {
|
|
|
60
60
|
if (typeof pos === 'number')
|
|
61
61
|
return pos;
|
|
62
62
|
const lines = source.split(splitRE);
|
|
63
|
-
|
|
63
|
+
return posToNumberByLines(lines, pos.line, pos.column);
|
|
64
|
+
}
|
|
65
|
+
exports.posToNumber = posToNumber;
|
|
66
|
+
function posToNumberByLines(lines, line, column) {
|
|
64
67
|
let start = 0;
|
|
65
68
|
for (let i = 0; i < line - 1; i++) {
|
|
66
69
|
start += lines[i].length + 1;
|
|
67
70
|
}
|
|
68
71
|
return start + column;
|
|
69
72
|
}
|
|
70
|
-
|
|
73
|
+
function locToStartAndEnd(source, loc) {
|
|
74
|
+
const lines = source.split(splitRE);
|
|
75
|
+
const start = posToNumberByLines(lines, loc.start.line, loc.start.column);
|
|
76
|
+
const end = posToNumberByLines(lines, loc.end.line, loc.end.column);
|
|
77
|
+
return { start, end };
|
|
78
|
+
}
|
|
79
|
+
exports.locToStartAndEnd = locToStartAndEnd;
|
|
71
80
|
function generateCodeFrame(source, start = 0, end) {
|
|
72
81
|
start = posToNumber(source, start);
|
|
73
82
|
end = end || start;
|
package/dist/vite/utils/ast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Literal, BaseNode, Property, Identifier, CallExpression, AssignmentExpression, MemberExpression, MethodDefinition, ExportSpecifier } from 'estree';
|
|
2
|
-
import { Node, ElementNode, DirectiveNode, SimpleExpressionNode, AttributeNode } from '@vue/compiler-core';
|
|
2
|
+
import { Node, ElementNode, DirectiveNode, SimpleExpressionNode, AttributeNode, CompoundExpressionNode } from '@vue/compiler-core';
|
|
3
3
|
export declare const isProperty: (node: BaseNode) => node is Property;
|
|
4
4
|
export declare const isIdentifier: (node: BaseNode) => node is Identifier;
|
|
5
5
|
export declare const isAssignmentExpression: (node: BaseNode) => node is AssignmentExpression;
|
|
@@ -16,3 +16,4 @@ export declare function isElementNode(node: Node): node is ElementNode;
|
|
|
16
16
|
export declare function isAttributeNode(node: Node): node is AttributeNode;
|
|
17
17
|
export declare function isDirectiveNode(node: Node): node is DirectiveNode;
|
|
18
18
|
export declare function isSimpleExpressionNode(node: Node): node is SimpleExpressionNode;
|
|
19
|
+
export declare function isCompoundExpressionNode(node: Node): node is CompoundExpressionNode;
|
package/dist/vite/utils/ast.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSimpleExpressionNode = exports.isDirectiveNode = exports.isAttributeNode = exports.isElementNode = exports.parseVue = exports.createCallExpression = exports.createIdentifier = exports.createLiteral = exports.isReference = exports.isExportSpecifier = exports.isMethodDefinition = exports.isMemberExpression = exports.isCallExpression = exports.isAssignmentExpression = exports.isIdentifier = exports.isProperty = void 0;
|
|
3
|
+
exports.isCompoundExpressionNode = exports.isSimpleExpressionNode = exports.isDirectiveNode = exports.isAttributeNode = exports.isElementNode = exports.parseVue = exports.createCallExpression = exports.createIdentifier = exports.createLiteral = exports.isReference = exports.isExportSpecifier = exports.isMethodDefinition = exports.isMemberExpression = exports.isCallExpression = exports.isAssignmentExpression = exports.isIdentifier = exports.isProperty = void 0;
|
|
4
4
|
const compiler_dom_1 = require("@vue/compiler-dom");
|
|
5
5
|
const isProperty = (node) => node.type === 'Property';
|
|
6
6
|
exports.isProperty = isProperty;
|
|
@@ -87,3 +87,7 @@ function isSimpleExpressionNode(node) {
|
|
|
87
87
|
return node.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */;
|
|
88
88
|
}
|
|
89
89
|
exports.isSimpleExpressionNode = isSimpleExpressionNode;
|
|
90
|
+
function isCompoundExpressionNode(node) {
|
|
91
|
+
return node.type === 8 /* NodeTypes.COMPOUND_EXPRESSION */;
|
|
92
|
+
}
|
|
93
|
+
exports.isCompoundExpressionNode = isCompoundExpressionNode;
|
|
@@ -4,7 +4,9 @@ export interface UniViteFilterPluginOptions {
|
|
|
4
4
|
resolvedConfig: ResolvedConfig;
|
|
5
5
|
filter: (id: string) => boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function injectAssetPlugin(config: ResolvedConfig
|
|
7
|
+
export declare function injectAssetPlugin(config: ResolvedConfig, options?: {
|
|
8
|
+
isAppX: boolean;
|
|
9
|
+
}): void;
|
|
8
10
|
export declare function injectCssPlugin(config: ResolvedConfig): void;
|
|
9
11
|
export declare function injectCssPostPlugin(config: ResolvedConfig, newCssPostPlugin: Plugin): void;
|
|
10
12
|
export declare function replacePlugins(plugins: Plugin[], config: ResolvedConfig): void;
|
|
@@ -4,8 +4,8 @@ exports.insertBeforePlugin = exports.removePlugins = exports.replacePlugins = ex
|
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
5
|
const asset_1 = require("../plugins/vitejs/plugins/asset");
|
|
6
6
|
const css_1 = require("../plugins/vitejs/plugins/css");
|
|
7
|
-
function injectAssetPlugin(config) {
|
|
8
|
-
replacePlugins([(0, asset_1.assetPlugin)(config)], config);
|
|
7
|
+
function injectAssetPlugin(config, options) {
|
|
8
|
+
replacePlugins([(0, asset_1.assetPlugin)(config, options)], config);
|
|
9
9
|
}
|
|
10
10
|
exports.injectAssetPlugin = injectAssetPlugin;
|
|
11
11
|
function injectCssPlugin(config) {
|
package/dist/vite/utils/url.js
CHANGED
|
@@ -61,7 +61,11 @@ function isJsFile(id) {
|
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
const isVueJs = constants_1.EXTNAME_VUE.includes(path_1.default.extname(filename)) &&
|
|
64
|
-
(!query.vue ||
|
|
64
|
+
(!query.vue ||
|
|
65
|
+
query.setup ||
|
|
66
|
+
(0, shared_1.hasOwn)(query, 'lang.ts') ||
|
|
67
|
+
(0, shared_1.hasOwn)(query, 'lang.js') ||
|
|
68
|
+
(0, shared_1.hasOwn)(query, 'lang.uts'));
|
|
65
69
|
if (isVueJs) {
|
|
66
70
|
return true;
|
|
67
71
|
}
|
package/dist/watcher.js
CHANGED
|
@@ -53,7 +53,7 @@ class FileWatcher {
|
|
|
53
53
|
copy(from) {
|
|
54
54
|
const to = this.to(from);
|
|
55
55
|
this.info('copy', from + '=>' + to);
|
|
56
|
-
let content;
|
|
56
|
+
let content = '';
|
|
57
57
|
if (this.transform) {
|
|
58
58
|
const filename = this.from(from);
|
|
59
59
|
content = this.transform(fs_extra_1.default.readFileSync(filename), filename);
|
|
@@ -375,7 +375,8 @@ function getTestTemplate(test) {
|
|
|
375
375
|
test = test.trim();
|
|
376
376
|
|
|
377
377
|
// force single equals replacement
|
|
378
|
-
|
|
378
|
+
// fixed by xxxxxx 不替换,会影响 >= 等判断
|
|
379
|
+
// test = test.replace(/([^=!])=([^=])/g, '$1==$2');
|
|
379
380
|
// fixed by xxxxxx
|
|
380
381
|
test = test.replace(/-/g, '_')
|
|
381
382
|
return new Function("context", "with (context||{}){ return ( " + test + " ); }");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-3090520231028001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@babel/core": "^7.21.3",
|
|
26
26
|
"@babel/parser": "^7.16.4",
|
|
27
27
|
"@babel/types": "^7.20.7",
|
|
28
|
-
"@dcloudio/uni-i18n": "3.0.0-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-
|
|
28
|
+
"@dcloudio/uni-i18n": "3.0.0-3090520231028001",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-3090520231028001",
|
|
30
30
|
"@intlify/core-base": "9.1.9",
|
|
31
31
|
"@intlify/shared": "9.1.9",
|
|
32
32
|
"@intlify/vue-devtools": "9.1.9",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@dcloudio/uni-uts-v1": "3.0.0-
|
|
67
|
+
"@dcloudio/uni-uts-v1": "3.0.0-3090520231028001",
|
|
68
68
|
"@types/babel__core": "^7.1.19",
|
|
69
69
|
"@types/debug": "^4.1.7",
|
|
70
70
|
"@types/estree": "^0.0.51",
|