@dcloudio/uni-cli-shared 3.0.0-alpha-3080420230602001 → 3.0.0-alpha-3080520230612001
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 +2 -0
- package/dist/constants.js +3 -1
- package/dist/easycom.d.ts +1 -0
- package/dist/easycom.js +2 -1
- package/dist/hbx/alias.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/json/app/pages/definePage.js +1 -1
- package/dist/json/index.d.ts +1 -0
- package/dist/json/index.js +3 -0
- package/dist/json/pages.js +9 -0
- package/dist/json/uniAppX.d.ts +1 -0
- package/dist/json/uniAppX.js +75 -0
- package/dist/messages/en.d.ts +1 -0
- package/dist/messages/en.js +1 -0
- package/dist/messages/index.d.ts +2 -0
- package/dist/messages/zh_CN.d.ts +1 -0
- package/dist/messages/zh_CN.js +1 -0
- package/dist/postcss/plugins/uniapp.d.ts +2 -1
- package/dist/postcss/plugins/uniapp.js +4 -2
- package/dist/preprocess/context.d.ts +2 -1
- package/dist/preprocess/context.js +17 -2
- package/dist/preprocess/index.d.ts +4 -0
- package/dist/preprocess/index.js +11 -1
- package/dist/resolve.js +4 -0
- package/dist/uni_modules.d.ts +3 -3
- package/dist/uni_modules.js +71 -49
- package/dist/utils.d.ts +1 -1
- package/dist/uts.d.ts +15 -2
- package/dist/uts.js +94 -10
- package/dist/vite/plugins/index.d.ts +1 -0
- package/dist/vite/plugins/index.js +1 -0
- package/dist/vite/plugins/mainJs.js +3 -1
- package/dist/vite/plugins/utsPlugin.d.ts +8 -0
- package/dist/vite/plugins/utsPlugin.js +88 -0
- package/dist/vite/plugins/vitejs/plugins/css.d.ts +2 -1
- package/dist/vite/plugins/vitejs/plugins/css.js +14 -3
- package/dist/vite/utils/plugin.d.ts +1 -0
- package/dist/vite/utils/plugin.js +9 -1
- package/package.json +8 -8
package/dist/constants.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export declare const EXTNAME_JS_RE: RegExp;
|
|
|
8
8
|
export declare const EXTNAME_TS_RE: RegExp;
|
|
9
9
|
export declare const extensions: string[];
|
|
10
10
|
export declare const PAGES_JSON_JS = "pages-json-js";
|
|
11
|
+
export declare const PAGES_JSON_UTS = "pages-json-uts";
|
|
11
12
|
export declare const MANIFEST_JSON_JS = "manifest-json-js";
|
|
13
|
+
export declare const MANIFEST_JSON_UTS = "manifest-json-uts";
|
|
12
14
|
export declare const JSON_JS_MAP: {
|
|
13
15
|
readonly 'pages.json': "pages-json-js";
|
|
14
16
|
readonly 'manifest.json': "manifest-json-js";
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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_JS = 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.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;
|
|
4
4
|
exports.PUBLIC_DIR = 'static';
|
|
5
5
|
exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx'];
|
|
6
6
|
exports.EXTNAME_TS = ['.ts', '.tsx'];
|
|
@@ -19,7 +19,9 @@ exports.extensions = [
|
|
|
19
19
|
'.json',
|
|
20
20
|
].concat(exports.EXTNAME_VUE);
|
|
21
21
|
exports.PAGES_JSON_JS = 'pages-json-js';
|
|
22
|
+
exports.PAGES_JSON_UTS = 'pages-json-uts';
|
|
22
23
|
exports.MANIFEST_JSON_JS = 'manifest-json-js';
|
|
24
|
+
exports.MANIFEST_JSON_UTS = 'manifest-json-uts';
|
|
23
25
|
exports.JSON_JS_MAP = {
|
|
24
26
|
'pages.json': exports.PAGES_JSON_JS,
|
|
25
27
|
'manifest.json': exports.MANIFEST_JSON_JS,
|
package/dist/easycom.d.ts
CHANGED
package/dist/easycom.js
CHANGED
|
@@ -48,7 +48,7 @@ function initEasycoms(inputDir, { dirs, platform }) {
|
|
|
48
48
|
const options = initEasycomOptions((0, pages_1.parsePagesJsonOnce)(inputDir, platform));
|
|
49
49
|
const initUTSEasycom = () => {
|
|
50
50
|
(0, uts_1.initUTSComponents)(inputDir, platform).forEach((item) => {
|
|
51
|
-
const index = easycoms.findIndex((easycom) => item.
|
|
51
|
+
const index = easycoms.findIndex((easycom) => item.name === easycom.name);
|
|
52
52
|
if (index > -1) {
|
|
53
53
|
easycoms.splice(index, 1, item);
|
|
54
54
|
}
|
|
@@ -110,6 +110,7 @@ function initEasycom({ dirs, rootDir, custom, extensions = ['.vue', '.jsx', '.ts
|
|
|
110
110
|
}
|
|
111
111
|
Object.keys(easycomsObj).forEach((name) => {
|
|
112
112
|
easycoms.push({
|
|
113
|
+
name: name.startsWith('^') && name.endsWith('$') ? name.slice(1, -1) : name,
|
|
113
114
|
pattern: new RegExp(name),
|
|
114
115
|
replacement: easycomsObj[name],
|
|
115
116
|
});
|
package/dist/hbx/alias.js
CHANGED
|
@@ -17,15 +17,15 @@ const hbxPlugins = {
|
|
|
17
17
|
};
|
|
18
18
|
function initModuleAlias() {
|
|
19
19
|
const compilerSfcPath = require.resolve('@vue/compiler-sfc');
|
|
20
|
-
|
|
20
|
+
const serverRendererPath = require.resolve('@vue/server-renderer');
|
|
21
21
|
module_alias_1.default.addAliases({
|
|
22
22
|
'@vue/shared': require.resolve('@vue/shared'),
|
|
23
23
|
'@vue/shared/dist/shared.esm-bundler.js': require.resolve('@vue/shared/dist/shared.esm-bundler.js'),
|
|
24
24
|
'@vue/compiler-dom': require.resolve('@vue/compiler-dom'),
|
|
25
25
|
'@vue/compiler-sfc': compilerSfcPath,
|
|
26
|
-
|
|
26
|
+
'@vue/server-renderer': serverRendererPath,
|
|
27
27
|
'vue/compiler-sfc': compilerSfcPath,
|
|
28
|
-
|
|
28
|
+
'vue/server-renderer': serverRendererPath,
|
|
29
29
|
});
|
|
30
30
|
if (process.env.VITEST) {
|
|
31
31
|
module_alias_1.default.addAliases({
|
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 } from './uni_modules';
|
|
24
|
+
export { parseUniExtApis, parseInjects } from './uni_modules';
|
|
25
25
|
export { M } from './messages';
|
|
26
26
|
export * from './exports';
|
|
27
27
|
export { checkUpdate } from './checkUpdate';
|
package/dist/index.js
CHANGED
|
@@ -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.checkUpdate = exports.M = exports.parseUniExtApis = void 0;
|
|
17
|
+
exports.checkUpdate = exports.M = exports.parseInjects = exports.parseUniExtApis = void 0;
|
|
18
18
|
__exportStar(require("./fs"), exports);
|
|
19
19
|
__exportStar(require("./mp"), exports);
|
|
20
20
|
__exportStar(require("./url"), exports);
|
|
@@ -40,6 +40,7 @@ __exportStar(require("./scripts"), exports);
|
|
|
40
40
|
__exportStar(require("./platform"), exports);
|
|
41
41
|
var uni_modules_1 = require("./uni_modules");
|
|
42
42
|
Object.defineProperty(exports, "parseUniExtApis", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApis; } });
|
|
43
|
+
Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function () { return uni_modules_1.parseInjects; } });
|
|
43
44
|
var messages_1 = require("./messages");
|
|
44
45
|
Object.defineProperty(exports, "M", { enumerable: true, get: function () { return messages_1.M; } });
|
|
45
46
|
__exportStar(require("./exports"), exports);
|
|
@@ -34,7 +34,7 @@ function defineNVuePageCode(pagesJson) {
|
|
|
34
34
|
}
|
|
35
35
|
const pagePathWithExtname = (0, utils_1.normalizePagePath)(page.path, 'app');
|
|
36
36
|
if (pagePathWithExtname) {
|
|
37
|
-
importNVuePagesCode.push(`import('./${pagePathWithExtname}').then(()=>{})`);
|
|
37
|
+
importNVuePagesCode.push(`import('./${pagePathWithExtname}').then((res)=>{res.length})`);
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
return importNVuePagesCode.join('\n');
|
package/dist/json/index.d.ts
CHANGED
package/dist/json/index.js
CHANGED
|
@@ -14,9 +14,12 @@ 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.normalizeUniAppXAppPagesJson = void 0;
|
|
17
18
|
__exportStar(require("./mp"), exports);
|
|
18
19
|
__exportStar(require("./app"), exports);
|
|
19
20
|
__exportStar(require("./json"), exports);
|
|
20
21
|
__exportStar(require("./pages"), exports);
|
|
21
22
|
__exportStar(require("./manifest"), exports);
|
|
22
23
|
__exportStar(require("./theme"), exports);
|
|
24
|
+
var uniAppX_1 = require("./uniAppX");
|
|
25
|
+
Object.defineProperty(exports, "normalizeUniAppXAppPagesJson", { enumerable: true, get: function () { return uniAppX_1.normalizeUniAppXAppPagesJson; } });
|
package/dist/json/pages.js
CHANGED
|
@@ -127,6 +127,15 @@ function validatePages(pagesJson, jsonStr) {
|
|
|
127
127
|
else if (!pagesJson.pages.length) {
|
|
128
128
|
throw new Error(`[uni-app] Error: pages.json->pages must contain at least 1 page.`);
|
|
129
129
|
}
|
|
130
|
+
else {
|
|
131
|
+
const pages = [];
|
|
132
|
+
pagesJson.pages.forEach((page) => {
|
|
133
|
+
if (pages.indexOf(page.path) !== -1) {
|
|
134
|
+
throw new Error(`[uni-app] Error: pages.json->${page.path} duplication.`);
|
|
135
|
+
}
|
|
136
|
+
pages.push(page.path);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
130
139
|
}
|
|
131
140
|
exports.validatePages = validatePages;
|
|
132
141
|
function normalizePages(pages, platform) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function normalizeUniAppXAppPagesJson(jsonStr: string): UniApp.PagesJson;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.normalizeUniAppXAppPagesJson = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const shared_1 = require("@vue/shared");
|
|
9
|
+
const json_1 = require("./json");
|
|
10
|
+
const pages_1 = require("./pages");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
function normalizeUniAppXAppPagesJson(jsonStr) {
|
|
13
|
+
const pagesJson = {
|
|
14
|
+
pages: [],
|
|
15
|
+
globalStyle: {},
|
|
16
|
+
};
|
|
17
|
+
let userPagesJson = {
|
|
18
|
+
pages: [],
|
|
19
|
+
globalStyle: {},
|
|
20
|
+
};
|
|
21
|
+
// preprocess
|
|
22
|
+
try {
|
|
23
|
+
userPagesJson = (0, json_1.parseJson)(jsonStr, true);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
console.error(`[vite] Error: pages.json parse failed.\n`, jsonStr, e);
|
|
27
|
+
}
|
|
28
|
+
// pages
|
|
29
|
+
(0, pages_1.validatePages)(userPagesJson, jsonStr);
|
|
30
|
+
userPagesJson.subPackages =
|
|
31
|
+
userPagesJson.subPackages || userPagesJson.subpackages;
|
|
32
|
+
// subPackages
|
|
33
|
+
if (userPagesJson.subPackages) {
|
|
34
|
+
userPagesJson.pages.push(...normalizeSubPackages(userPagesJson.subPackages));
|
|
35
|
+
}
|
|
36
|
+
pagesJson.pages = userPagesJson.pages;
|
|
37
|
+
// pageStyle
|
|
38
|
+
normalizePages(pagesJson.pages);
|
|
39
|
+
// globalStyle
|
|
40
|
+
pagesJson.globalStyle = normalizePageStyle(userPagesJson.globalStyle);
|
|
41
|
+
// tabBar
|
|
42
|
+
if (userPagesJson.tabBar) {
|
|
43
|
+
pagesJson.tabBar = userPagesJson.tabBar;
|
|
44
|
+
}
|
|
45
|
+
return pagesJson;
|
|
46
|
+
}
|
|
47
|
+
exports.normalizeUniAppXAppPagesJson = normalizeUniAppXAppPagesJson;
|
|
48
|
+
function normalizeSubPackages(subPackages) {
|
|
49
|
+
const pages = [];
|
|
50
|
+
if ((0, shared_1.isArray)(subPackages)) {
|
|
51
|
+
subPackages.forEach(({ root, pages: subPages }) => {
|
|
52
|
+
if (root && subPages.length) {
|
|
53
|
+
subPages.forEach((subPage) => {
|
|
54
|
+
subPage.path = (0, utils_1.normalizePath)(path_1.default.join(root, subPage.path));
|
|
55
|
+
subPage.style = subPage.style;
|
|
56
|
+
pages.push(subPage);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return pages;
|
|
62
|
+
}
|
|
63
|
+
function normalizePages(pages) {
|
|
64
|
+
pages.forEach((page) => {
|
|
65
|
+
page.style = normalizePageStyle(page.style);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function normalizePageStyle(pageStyle) {
|
|
69
|
+
if (pageStyle) {
|
|
70
|
+
(0, shared_1.extend)(pageStyle, pageStyle['app']);
|
|
71
|
+
(0, pages_1.removePlatformStyle)(pageStyle);
|
|
72
|
+
return pageStyle;
|
|
73
|
+
}
|
|
74
|
+
return {};
|
|
75
|
+
}
|
package/dist/messages/en.d.ts
CHANGED
|
@@ -36,5 +36,6 @@ declare const _default: {
|
|
|
36
36
|
readonly 'prompt.run.devtools.quickapp-webview': "Quick App Alliance Devtools | Huawei Quick App Devtools";
|
|
37
37
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "Huawei Quick App Devtools";
|
|
38
38
|
readonly 'prompt.run.devtools.quickapp-webview-union': "Quick App Alliance Devtools";
|
|
39
|
+
readonly 'uvue.unsupported': "uvue does not support {platform} platform";
|
|
39
40
|
};
|
|
40
41
|
export default _default;
|
package/dist/messages/en.js
CHANGED
|
@@ -38,4 +38,5 @@ exports.default = {
|
|
|
38
38
|
'prompt.run.devtools.quickapp-webview': 'Quick App Alliance Devtools | Huawei Quick App Devtools',
|
|
39
39
|
'prompt.run.devtools.quickapp-webview-huawei': 'Huawei Quick App Devtools',
|
|
40
40
|
'prompt.run.devtools.quickapp-webview-union': 'Quick App Alliance Devtools',
|
|
41
|
+
'uvue.unsupported': 'uvue does not support {platform} platform',
|
|
41
42
|
};
|
package/dist/messages/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare const M: {
|
|
|
36
36
|
readonly 'prompt.run.devtools.quickapp-webview': "快应用联盟开发者工具 | 华为快应用开发者工具";
|
|
37
37
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "华为快应用开发者工具";
|
|
38
38
|
readonly 'prompt.run.devtools.quickapp-webview-union': "快应用联盟开发者工具";
|
|
39
|
+
readonly 'uvue.unsupported': "uvue 暂不支持 {platform} 平台";
|
|
39
40
|
} | {
|
|
40
41
|
readonly 'app.compiler.version': "Compiler version: {version}";
|
|
41
42
|
readonly compiling: "Compiling...";
|
|
@@ -74,4 +75,5 @@ export declare const M: {
|
|
|
74
75
|
readonly 'prompt.run.devtools.quickapp-webview': "Quick App Alliance Devtools | Huawei Quick App Devtools";
|
|
75
76
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "Huawei Quick App Devtools";
|
|
76
77
|
readonly 'prompt.run.devtools.quickapp-webview-union': "Quick App Alliance Devtools";
|
|
78
|
+
readonly 'uvue.unsupported': "uvue does not support {platform} platform";
|
|
77
79
|
};
|
package/dist/messages/zh_CN.d.ts
CHANGED
|
@@ -36,5 +36,6 @@ declare const _default: {
|
|
|
36
36
|
readonly 'prompt.run.devtools.quickapp-webview': "快应用联盟开发者工具 | 华为快应用开发者工具";
|
|
37
37
|
readonly 'prompt.run.devtools.quickapp-webview-huawei': "华为快应用开发者工具";
|
|
38
38
|
readonly 'prompt.run.devtools.quickapp-webview-union': "快应用联盟开发者工具";
|
|
39
|
+
readonly 'uvue.unsupported': "uvue 暂不支持 {platform} 平台";
|
|
39
40
|
};
|
|
40
41
|
export default _default;
|
package/dist/messages/zh_CN.js
CHANGED
|
@@ -38,4 +38,5 @@ exports.default = {
|
|
|
38
38
|
'prompt.run.devtools.quickapp-webview': '快应用联盟开发者工具 | 华为快应用开发者工具',
|
|
39
39
|
'prompt.run.devtools.quickapp-webview-huawei': '华为快应用开发者工具',
|
|
40
40
|
'prompt.run.devtools.quickapp-webview-union': '快应用联盟开发者工具',
|
|
41
|
+
'uvue.unsupported': 'uvue 暂不支持 {platform} 平台',
|
|
41
42
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Plugin } from 'postcss';
|
|
1
|
+
import type { Plugin, Root } from 'postcss';
|
|
2
2
|
export interface UniAppCssProcessorOptions {
|
|
3
3
|
unit?: string;
|
|
4
4
|
unitRatio?: number;
|
|
5
5
|
unitPrecision?: number;
|
|
6
6
|
}
|
|
7
|
+
export declare function filterPrefersColorScheme(root: Root, force?: boolean): void;
|
|
7
8
|
declare const uniapp: {
|
|
8
9
|
(opts?: UniAppCssProcessorOptions): Plugin;
|
|
9
10
|
postcss: boolean;
|
|
@@ -3,6 +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.filterPrefersColorScheme = void 0;
|
|
6
7
|
const shared_1 = require("@vue/shared");
|
|
7
8
|
const postcss_selector_parser_1 = __importDefault(require("postcss-selector-parser"));
|
|
8
9
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
@@ -56,10 +57,10 @@ function walkDecls(rpx2unit) {
|
|
|
56
57
|
decl.value = rpx2unit(decl.value);
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
function filterPrefersColorScheme(root) {
|
|
60
|
+
function filterPrefersColorScheme(root, force = false) {
|
|
60
61
|
if (process.env.VUE_APP_DARK_MODE !== 'true') {
|
|
61
62
|
const filePath = root.source?.input.file;
|
|
62
|
-
if (filePath && filePath.includes('@dcloudio')) {
|
|
63
|
+
if (force || (filePath && filePath.includes('@dcloudio'))) {
|
|
63
64
|
root.walkAtRules((rule) => {
|
|
64
65
|
if (rule.params.includes('prefers-color-scheme')) {
|
|
65
66
|
rule.remove();
|
|
@@ -68,6 +69,7 @@ function filterPrefersColorScheme(root) {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
}
|
|
72
|
+
exports.filterPrefersColorScheme = filterPrefersColorScheme;
|
|
71
73
|
const baiduTags = {
|
|
72
74
|
navigator: 'nav',
|
|
73
75
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare function getPreVueContext(): any;
|
|
2
2
|
export declare function getPreNVueContext(): any;
|
|
3
|
-
export declare function
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initPreContext = exports.getPreNVueContext = exports.getPreVueContext = void 0;
|
|
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
6
|
'APP',
|
|
@@ -31,6 +31,7 @@ const DEFAULT_KEYS = [
|
|
|
31
31
|
];
|
|
32
32
|
const preVueContext = Object.create(null);
|
|
33
33
|
const preNVueContext = Object.create(null);
|
|
34
|
+
const preUVueContext = Object.create(null);
|
|
34
35
|
function getPreVueContext() {
|
|
35
36
|
return preVueContext;
|
|
36
37
|
}
|
|
@@ -39,9 +40,14 @@ function getPreNVueContext() {
|
|
|
39
40
|
return preNVueContext;
|
|
40
41
|
}
|
|
41
42
|
exports.getPreNVueContext = getPreNVueContext;
|
|
42
|
-
function
|
|
43
|
+
function getPreUVueContext() {
|
|
44
|
+
return preUVueContext;
|
|
45
|
+
}
|
|
46
|
+
exports.getPreUVueContext = getPreUVueContext;
|
|
47
|
+
function initPreContext(platform, userPreContext, utsPlatform) {
|
|
43
48
|
const vueContext = Object.create(null);
|
|
44
49
|
const nvueContext = Object.create(null);
|
|
50
|
+
const uvueContext = Object.create(null);
|
|
45
51
|
const defaultContext = Object.create(null);
|
|
46
52
|
DEFAULT_KEYS.forEach((key) => {
|
|
47
53
|
defaultContext[key] = false;
|
|
@@ -49,12 +55,20 @@ function initPreContext(platform, userPreContext) {
|
|
|
49
55
|
defaultContext[normalizeKey(platform)] = true;
|
|
50
56
|
vueContext.VUE3 = true;
|
|
51
57
|
nvueContext.VUE3 = true;
|
|
58
|
+
uvueContext.VUE3 = true;
|
|
52
59
|
if (platform === 'app' || platform === 'app-plus') {
|
|
53
60
|
defaultContext.APP = true;
|
|
54
61
|
defaultContext.APP_PLUS = true;
|
|
55
62
|
vueContext.APP_VUE = true;
|
|
56
63
|
nvueContext.APP_NVUE = true;
|
|
57
64
|
nvueContext.APP_PLUS_NVUE = true;
|
|
65
|
+
uvueContext.APP_UVUE = true;
|
|
66
|
+
if (utsPlatform === 'app-android') {
|
|
67
|
+
uvueContext.APP_ANDROID = true;
|
|
68
|
+
}
|
|
69
|
+
else if (utsPlatform === 'app-ios') {
|
|
70
|
+
uvueContext.APP_IOS = true;
|
|
71
|
+
}
|
|
58
72
|
}
|
|
59
73
|
else if (platform.startsWith('mp-')) {
|
|
60
74
|
defaultContext.MP = true;
|
|
@@ -80,6 +94,7 @@ function initPreContext(platform, userPreContext) {
|
|
|
80
94
|
}
|
|
81
95
|
(0, shared_1.extend)(preVueContext, defaultContext, vueContext);
|
|
82
96
|
(0, shared_1.extend)(preNVueContext, defaultContext, nvueContext);
|
|
97
|
+
(0, shared_1.extend)(preUVueContext, defaultContext, uvueContext);
|
|
83
98
|
}
|
|
84
99
|
exports.initPreContext = initPreContext;
|
|
85
100
|
function normalizeKey(name) {
|
|
@@ -7,3 +7,7 @@ export declare function preNVueJs(jsCode: string): any;
|
|
|
7
7
|
export declare function preNVueHtml(htmlCode: string): any;
|
|
8
8
|
export declare const preNVueCss: typeof preNVueJs;
|
|
9
9
|
export declare const preNVueJson: typeof preNVueJs;
|
|
10
|
+
export declare function preUVueJs(jsCode: string): any;
|
|
11
|
+
export declare function preUVueHtml(htmlCode: string): any;
|
|
12
|
+
export declare const preUVueCss: typeof preUVueJs;
|
|
13
|
+
export declare const preUVueJson: typeof preUVueJs;
|
package/dist/preprocess/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.preNVueJson = exports.preNVueCss = exports.preNVueHtml = exports.preNVueJs = exports.preJson = exports.preCss = exports.preHtml = exports.preJs = exports.initPreContext = void 0;
|
|
3
|
+
exports.preUVueJson = exports.preUVueCss = exports.preUVueHtml = exports.preUVueJs = exports.preNVueJson = exports.preNVueCss = exports.preNVueHtml = exports.preNVueJs = exports.preJson = exports.preCss = exports.preHtml = exports.preJs = exports.initPreContext = void 0;
|
|
4
4
|
const context_1 = require("./context");
|
|
5
5
|
/* eslint-disable no-restricted-globals */
|
|
6
6
|
const { preprocess } = require('../../lib/preprocess');
|
|
@@ -26,3 +26,13 @@ function preNVueHtml(htmlCode) {
|
|
|
26
26
|
exports.preNVueHtml = preNVueHtml;
|
|
27
27
|
exports.preNVueCss = preNVueJs;
|
|
28
28
|
exports.preNVueJson = preNVueJs;
|
|
29
|
+
function preUVueJs(jsCode) {
|
|
30
|
+
return preprocess(jsCode, (0, context_1.getPreUVueContext)(), { type: 'js' });
|
|
31
|
+
}
|
|
32
|
+
exports.preUVueJs = preUVueJs;
|
|
33
|
+
function preUVueHtml(htmlCode) {
|
|
34
|
+
return preprocess(htmlCode, (0, context_1.getPreUVueContext)(), { type: 'html' });
|
|
35
|
+
}
|
|
36
|
+
exports.preUVueHtml = preUVueHtml;
|
|
37
|
+
exports.preUVueCss = preUVueJs;
|
|
38
|
+
exports.preUVueJson = preUVueJs;
|
package/dist/resolve.js
CHANGED
|
@@ -30,6 +30,10 @@ function relativeFile(from, to) {
|
|
|
30
30
|
}
|
|
31
31
|
exports.relativeFile = relativeFile;
|
|
32
32
|
exports.resolveMainPathOnce = (0, uni_shared_1.once)((inputDir) => {
|
|
33
|
+
const mainUTSPath = path_1.default.resolve(inputDir, 'main.uts');
|
|
34
|
+
if (fs_1.default.existsSync(mainUTSPath)) {
|
|
35
|
+
return (0, utils_1.normalizePath)(mainUTSPath);
|
|
36
|
+
}
|
|
33
37
|
const mainTsPath = path_1.default.resolve(inputDir, 'main.ts');
|
|
34
38
|
if (fs_1.default.existsSync(mainTsPath)) {
|
|
35
39
|
return (0, utils_1.normalizePath)(mainTsPath);
|
package/dist/uni_modules.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UTSTargetLanguage } from './uts';
|
|
1
2
|
type DefineOptions = {
|
|
2
3
|
name?: string;
|
|
3
4
|
app?: boolean | {
|
|
@@ -14,7 +15,7 @@ type Defines = {
|
|
|
14
15
|
export interface Exports {
|
|
15
16
|
[name: string]: Define | Defines | false;
|
|
16
17
|
}
|
|
17
|
-
export declare function parseUniExtApis(vite?:
|
|
18
|
+
export declare function parseUniExtApis(vite: boolean | undefined, platform: typeof process.env.UNI_UTS_PLATFORM, language?: UTSTargetLanguage): Injects;
|
|
18
19
|
type Injects = {
|
|
19
20
|
[name: string]: string | [string, string] | [string, string, DefineOptions['app']] | false;
|
|
20
21
|
};
|
|
@@ -39,6 +40,5 @@ type Injects = {
|
|
|
39
40
|
* @param define
|
|
40
41
|
* @returns
|
|
41
42
|
*/
|
|
42
|
-
export declare function parseInjects(vite: boolean | undefined, platform:
|
|
43
|
-
export declare function parseInject(vite: boolean | undefined, platform: UniApp.PLATFORM, source: string, globalObject: string, define: Define): Injects;
|
|
43
|
+
export declare function parseInjects(vite: boolean | undefined, platform: typeof process.env.UNI_UTS_PLATFORM, language: UTSTargetLanguage, source: string, uniModuleRootDir: string, exports?: Exports): Injects;
|
|
44
44
|
export {};
|
package/dist/uni_modules.js
CHANGED
|
@@ -3,29 +3,25 @@ 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.parseInjects = exports.parseUniExtApis = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
function parseUniExtApis(vite = true, platform, language = 'javascript') {
|
|
10
|
+
if (!process.env.UNI_INPUT_DIR) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
11
13
|
const uniModulesDir = path_1.default.resolve(process.env.UNI_INPUT_DIR, 'uni_modules');
|
|
12
14
|
if (!fs_extra_1.default.existsSync(uniModulesDir)) {
|
|
13
15
|
return {};
|
|
14
16
|
}
|
|
15
|
-
let platform = process.env.UNI_PLATFORM;
|
|
16
|
-
if (platform === 'h5') {
|
|
17
|
-
platform = 'web';
|
|
18
|
-
}
|
|
19
|
-
else if (platform === 'app-plus') {
|
|
20
|
-
platform = 'app';
|
|
21
|
-
}
|
|
22
17
|
const injects = {};
|
|
23
18
|
fs_extra_1.default.readdirSync(uniModulesDir).forEach((uniModuleDir) => {
|
|
24
19
|
// 必须以 uni- 开头
|
|
25
20
|
if (!uniModuleDir.startsWith('uni-')) {
|
|
26
21
|
return;
|
|
27
22
|
}
|
|
28
|
-
const
|
|
23
|
+
const uniModuleRootDir = path_1.default.resolve(uniModulesDir, uniModuleDir);
|
|
24
|
+
const pkgPath = path_1.default.resolve(uniModuleRootDir, 'package.json');
|
|
29
25
|
if (!fs_extra_1.default.existsSync(pkgPath)) {
|
|
30
26
|
return;
|
|
31
27
|
}
|
|
@@ -33,18 +29,7 @@ function parseUniExtApis(vite = true) {
|
|
|
33
29
|
const exports = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))
|
|
34
30
|
?.uni_modules?.['uni-ext-api'];
|
|
35
31
|
if (exports) {
|
|
36
|
-
const curInjects = parseInjects(vite, platform, `@/uni_modules/${uniModuleDir}`, exports);
|
|
37
|
-
if (platform === 'app') {
|
|
38
|
-
Object.keys(curInjects).forEach((name) => {
|
|
39
|
-
const options = curInjects[name];
|
|
40
|
-
// js 平台禁用了
|
|
41
|
-
if (Array.isArray(options) && options.length === 3) {
|
|
42
|
-
if (options[2] && options[2].js === false) {
|
|
43
|
-
delete curInjects[name];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
32
|
+
const curInjects = parseInjects(vite, platform, language, `@/uni_modules/${uniModuleDir}`, uniModuleRootDir, exports);
|
|
48
33
|
Object.assign(injects, curInjects);
|
|
49
34
|
}
|
|
50
35
|
}
|
|
@@ -74,41 +59,43 @@ exports.parseUniExtApis = parseUniExtApis;
|
|
|
74
59
|
* @param define
|
|
75
60
|
* @returns
|
|
76
61
|
*/
|
|
77
|
-
function parseInjects(vite = true, platform, source, exports = {}) {
|
|
62
|
+
function parseInjects(vite = true, platform, language, source, uniModuleRootDir, exports = {}) {
|
|
78
63
|
let rootDefines = {};
|
|
79
64
|
Object.keys(exports).forEach((name) => {
|
|
80
65
|
if (name.startsWith('uni')) {
|
|
81
66
|
rootDefines[name] = exports[name];
|
|
82
67
|
}
|
|
83
68
|
});
|
|
84
|
-
const platformDefines = exports[platform];
|
|
85
|
-
// 该平台不支持
|
|
86
|
-
if (platformDefines === false) {
|
|
87
|
-
return {};
|
|
88
|
-
}
|
|
89
|
-
if (platformDefines) {
|
|
90
|
-
rootDefines = (0, merge_1.recursive)(true, rootDefines, platformDefines);
|
|
91
|
-
}
|
|
92
69
|
const injects = {};
|
|
93
|
-
|
|
94
|
-
|
|
70
|
+
if (Object.keys(rootDefines).length) {
|
|
71
|
+
const hasPlatformFile = uniModuleRootDir
|
|
72
|
+
? fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'index.uts')) ||
|
|
73
|
+
fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', platform))
|
|
74
|
+
: true;
|
|
75
|
+
for (const key in rootDefines) {
|
|
76
|
+
Object.assign(injects, parseInject(vite, platform, language, source, 'uni', rootDefines[key], hasPlatformFile));
|
|
77
|
+
}
|
|
95
78
|
}
|
|
96
79
|
return injects;
|
|
97
80
|
}
|
|
98
81
|
exports.parseInjects = parseInjects;
|
|
99
|
-
function parseInject(vite = true, platform, source, globalObject, define) {
|
|
82
|
+
function parseInject(vite = true, platform, language, source, globalObject, define, hasPlatformFile) {
|
|
100
83
|
const injects = {};
|
|
101
84
|
if (define === false) {
|
|
102
85
|
}
|
|
103
86
|
else if (typeof define === 'string') {
|
|
104
87
|
// {'uni.getBatteryInfo' : '@dcloudio/uni-getbatteryinfo'}
|
|
105
|
-
|
|
88
|
+
if (hasPlatformFile) {
|
|
89
|
+
injects[globalObject + '.' + define] = vite ? source : [source, 'default'];
|
|
90
|
+
}
|
|
106
91
|
}
|
|
107
92
|
else if (Array.isArray(define)) {
|
|
108
93
|
// {'uni.getBatteryInfo' : ['@dcloudio/uni-getbatteryinfo','getBatteryInfo]}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
if (hasPlatformFile) {
|
|
95
|
+
define.forEach((d) => {
|
|
96
|
+
injects[globalObject + '.' + d] = [source, d];
|
|
97
|
+
});
|
|
98
|
+
}
|
|
112
99
|
}
|
|
113
100
|
else {
|
|
114
101
|
const keys = Object.keys(define);
|
|
@@ -118,21 +105,56 @@ function parseInject(vite = true, platform, source, globalObject, define) {
|
|
|
118
105
|
}
|
|
119
106
|
else {
|
|
120
107
|
const defineOptions = define[d];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
defineOptions.app,
|
|
127
|
-
];
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
108
|
+
const p = platform === 'app-android' || platform === 'app-ios'
|
|
109
|
+
? 'app'
|
|
110
|
+
: platform;
|
|
111
|
+
if (!(p in defineOptions)) {
|
|
112
|
+
if (hasPlatformFile) {
|
|
130
113
|
injects[globalObject + '.' + d] = [source, defineOptions.name || d];
|
|
131
114
|
}
|
|
132
115
|
}
|
|
116
|
+
else {
|
|
117
|
+
if (defineOptions[p] !== false) {
|
|
118
|
+
if (p === 'app') {
|
|
119
|
+
const appOptions = defineOptions.app;
|
|
120
|
+
if (isPlainObject(appOptions)) {
|
|
121
|
+
if (language === 'javascript') {
|
|
122
|
+
if (appOptions.js === false) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (language === 'kotlin') {
|
|
127
|
+
if (appOptions.kotlin === false) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else if (language === 'swift') {
|
|
132
|
+
if (appOptions.swift === false) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
injects[globalObject + '.' + d] = [
|
|
138
|
+
source,
|
|
139
|
+
defineOptions.name || d,
|
|
140
|
+
defineOptions.app,
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
injects[globalObject + '.' + d] = [
|
|
145
|
+
source,
|
|
146
|
+
defineOptions.name || d,
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
133
151
|
}
|
|
134
152
|
});
|
|
135
153
|
}
|
|
136
154
|
return injects;
|
|
137
155
|
}
|
|
138
|
-
|
|
156
|
+
const objectToString = Object.prototype.toString;
|
|
157
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
158
|
+
function isPlainObject(val) {
|
|
159
|
+
return toTypeString(val) === '[object Object]';
|
|
160
|
+
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function normalizePagePath(pagePath: string, platform: UniApp.PLA
|
|
|
11
11
|
export declare function removeExt(str: string): string;
|
|
12
12
|
export declare function normalizeNodeModules(str: string): string;
|
|
13
13
|
export declare function normalizeMiniProgramFilename(filename: string, inputDir?: string): string;
|
|
14
|
-
export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]):
|
|
14
|
+
export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]): ParserPlugin[];
|
|
15
15
|
export declare function pathToGlob(pathString: string, glob: string, options?: {
|
|
16
16
|
windows?: boolean;
|
|
17
17
|
escape?: boolean;
|
package/dist/uts.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import * as UTSCompiler from '@dcloudio/uni-uts-v1';
|
|
2
4
|
import type { EasycomMatcher } from './easycom';
|
|
3
5
|
/**
|
|
@@ -6,7 +8,18 @@ import type { EasycomMatcher } from './easycom';
|
|
|
6
8
|
* @param importer
|
|
7
9
|
* @returns
|
|
8
10
|
*/
|
|
9
|
-
export declare function resolveUTSAppModule(id: string, importer: string): string | undefined;
|
|
10
|
-
export declare function resolveUTSModule(id: string, importer: string): string | undefined;
|
|
11
|
+
export declare function resolveUTSAppModule(id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
|
|
12
|
+
export declare function resolveUTSModule(id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
|
|
11
13
|
export declare function resolveUTSCompiler(): typeof UTSCompiler;
|
|
14
|
+
export declare function isUTSComponent(name: string): boolean;
|
|
15
|
+
export declare function parseUTSComponent(name: string, type: 'kotlin' | 'swift'): {
|
|
16
|
+
className: string;
|
|
17
|
+
namespace: string;
|
|
18
|
+
source: string;
|
|
19
|
+
} | undefined;
|
|
12
20
|
export declare function initUTSComponents(inputDir: string, platform: UniApp.PLATFORM): EasycomMatcher[];
|
|
21
|
+
export declare function parseKotlinPackageWithPluginId(id: string, is_uni_modules: boolean): string;
|
|
22
|
+
export declare function parseSwiftPackageWithPluginId(id: string, is_uni_modules: boolean): string;
|
|
23
|
+
export type UTSTargetLanguage = typeof process.env.UNI_UTS_TARGET_LANGUAGE;
|
|
24
|
+
export declare const parseUniExtApiNamespacesOnce: (platform: typeof process.env.UNI_UTS_PLATFORM, language: UTSTargetLanguage) => Record<string, [string, string]>;
|
|
25
|
+
export declare const parseUniExtApiNamespacesJsOnce: (platform: typeof process.env.UNI_UTS_PLATFORM, language: UTSTargetLanguage) => Record<string, [string, string]>;
|
package/dist/uts.js
CHANGED
|
@@ -3,24 +3,28 @@ 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.initUTSComponents = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
6
|
+
exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
|
+
const shared_1 = require("@vue/shared");
|
|
10
11
|
const hbx_1 = require("./hbx");
|
|
11
12
|
const utils_1 = require("./utils");
|
|
13
|
+
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
14
|
+
const uni_modules_1 = require("./uni_modules");
|
|
12
15
|
/**
|
|
13
16
|
* 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可
|
|
14
17
|
* @param id
|
|
15
18
|
* @param importer
|
|
16
19
|
* @returns
|
|
17
20
|
*/
|
|
18
|
-
function resolveUTSAppModule(id, importer) {
|
|
21
|
+
function resolveUTSAppModule(id, importer, includeUTSSDK = true) {
|
|
19
22
|
id = path_1.default.resolve(importer, id);
|
|
20
|
-
if (id.includes('
|
|
23
|
+
if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) {
|
|
21
24
|
const parts = (0, utils_1.normalizePath)(id).split('/');
|
|
22
25
|
const parentDir = parts[parts.length - 2];
|
|
23
|
-
if (parentDir === 'uni_modules' ||
|
|
26
|
+
if (parentDir === 'uni_modules' ||
|
|
27
|
+
(includeUTSSDK && parentDir === 'utssdk')) {
|
|
24
28
|
const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
|
|
25
29
|
if (fs_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) {
|
|
26
30
|
return id;
|
|
@@ -40,16 +44,17 @@ function resolveUTSAppModule(id, importer) {
|
|
|
40
44
|
}
|
|
41
45
|
exports.resolveUTSAppModule = resolveUTSAppModule;
|
|
42
46
|
// 仅限 root/uni_modules/test-plugin | root/utssdk/test-plugin 格式
|
|
43
|
-
function resolveUTSModule(id, importer) {
|
|
47
|
+
function resolveUTSModule(id, importer, includeUTSSDK = true) {
|
|
44
48
|
if (process.env.UNI_PLATFORM === 'app' ||
|
|
45
49
|
process.env.UNI_PLATFORM === 'app-plus') {
|
|
46
50
|
return resolveUTSAppModule(id, importer);
|
|
47
51
|
}
|
|
48
52
|
id = path_1.default.resolve(importer, id);
|
|
49
|
-
if (id.includes('
|
|
53
|
+
if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) {
|
|
50
54
|
const parts = (0, utils_1.normalizePath)(id).split('/');
|
|
51
55
|
const parentDir = parts[parts.length - 2];
|
|
52
|
-
if (parentDir === 'uni_modules' ||
|
|
56
|
+
if (parentDir === 'uni_modules' ||
|
|
57
|
+
(includeUTSSDK && parentDir === 'utssdk')) {
|
|
53
58
|
const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
|
|
54
59
|
const resolvePlatformDir = (p) => {
|
|
55
60
|
return path_1.default.resolve(id, basedir, p);
|
|
@@ -100,16 +105,38 @@ function resolveUTSCompiler() {
|
|
|
100
105
|
return require(compilerPath);
|
|
101
106
|
}
|
|
102
107
|
exports.resolveUTSCompiler = resolveUTSCompiler;
|
|
108
|
+
const utsComponents = new Map();
|
|
109
|
+
function isUTSComponent(name) {
|
|
110
|
+
return utsComponents.has(name);
|
|
111
|
+
}
|
|
112
|
+
exports.isUTSComponent = isUTSComponent;
|
|
113
|
+
function parseUTSComponent(name, type) {
|
|
114
|
+
const meta = utsComponents.get(name);
|
|
115
|
+
if (meta) {
|
|
116
|
+
const namespace = meta[type === 'swift' ? 'swiftModule' : 'kotlinPackage'] || '';
|
|
117
|
+
const className = (0, shared_1.capitalize)((0, shared_1.camelize)(name)) + 'Component';
|
|
118
|
+
return {
|
|
119
|
+
className,
|
|
120
|
+
namespace,
|
|
121
|
+
source: meta.source,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.parseUTSComponent = parseUTSComponent;
|
|
103
126
|
function initUTSComponents(inputDir, platform) {
|
|
127
|
+
utsComponents.clear();
|
|
104
128
|
const components = [];
|
|
105
129
|
if (platform !== 'app' && platform !== 'app-plus') {
|
|
106
130
|
return components;
|
|
107
131
|
}
|
|
108
|
-
const easycomsObj =
|
|
132
|
+
const easycomsObj = {};
|
|
109
133
|
const dirs = resolveUTSComponentDirs(inputDir);
|
|
110
134
|
dirs.forEach((dir) => {
|
|
111
135
|
const is_uni_modules_utssdk = dir.endsWith('utssdk');
|
|
112
136
|
const is_ussdk = !is_uni_modules_utssdk && path_1.default.dirname(dir).endsWith('utssdk');
|
|
137
|
+
const pluginId = is_uni_modules_utssdk
|
|
138
|
+
? path_1.default.basename(path_1.default.dirname(dir))
|
|
139
|
+
: path_1.default.basename(dir);
|
|
113
140
|
if (is_uni_modules_utssdk || is_ussdk) {
|
|
114
141
|
fast_glob_1.default
|
|
115
142
|
.sync('**/*.vue', {
|
|
@@ -125,15 +152,27 @@ function initUTSComponents(inputDir, platform) {
|
|
|
125
152
|
}
|
|
126
153
|
if (name) {
|
|
127
154
|
const importDir = (0, utils_1.normalizePath)(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
|
|
128
|
-
easycomsObj[`^${name}$`] =
|
|
155
|
+
easycomsObj[`^${name}$`] = {
|
|
156
|
+
source: `${importDir}?uts-proxy`,
|
|
157
|
+
kotlinPackage: parseKotlinPackageWithPluginId(pluginId, is_uni_modules_utssdk),
|
|
158
|
+
swiftModule: parseSwiftPackageWithPluginId(pluginId, is_uni_modules_utssdk),
|
|
159
|
+
};
|
|
129
160
|
}
|
|
130
161
|
});
|
|
131
162
|
}
|
|
132
163
|
});
|
|
133
164
|
Object.keys(easycomsObj).forEach((name) => {
|
|
165
|
+
const obj = easycomsObj[name];
|
|
166
|
+
const componentName = name.slice(1, -1);
|
|
134
167
|
components.push({
|
|
168
|
+
name: componentName,
|
|
135
169
|
pattern: new RegExp(name),
|
|
136
|
-
replacement:
|
|
170
|
+
replacement: obj.source,
|
|
171
|
+
});
|
|
172
|
+
utsComponents.set(componentName, {
|
|
173
|
+
source: obj.source,
|
|
174
|
+
kotlinPackage: obj.kotlinPackage,
|
|
175
|
+
swiftModule: obj.swiftModule,
|
|
137
176
|
});
|
|
138
177
|
});
|
|
139
178
|
return components;
|
|
@@ -162,3 +201,48 @@ function parseVueComponentName(file) {
|
|
|
162
201
|
return matches[1];
|
|
163
202
|
}
|
|
164
203
|
}
|
|
204
|
+
function prefix(id) {
|
|
205
|
+
if (process.env.UNI_UTS_MODULE_PREFIX &&
|
|
206
|
+
!id.startsWith(process.env.UNI_UTS_MODULE_PREFIX)) {
|
|
207
|
+
return process.env.UNI_UTS_MODULE_PREFIX + '-' + id;
|
|
208
|
+
}
|
|
209
|
+
return id;
|
|
210
|
+
}
|
|
211
|
+
function parseKotlinPackageWithPluginId(id, is_uni_modules) {
|
|
212
|
+
return 'uts.sdk.' + (is_uni_modules ? 'modules.' : '') + (0, shared_1.camelize)(prefix(id));
|
|
213
|
+
}
|
|
214
|
+
exports.parseKotlinPackageWithPluginId = parseKotlinPackageWithPluginId;
|
|
215
|
+
function parseSwiftPackageWithPluginId(id, is_uni_modules) {
|
|
216
|
+
return ('UTSSDK' +
|
|
217
|
+
(is_uni_modules ? 'Modules' : '') +
|
|
218
|
+
(0, shared_1.capitalize)((0, shared_1.camelize)(prefix(id))));
|
|
219
|
+
}
|
|
220
|
+
exports.parseSwiftPackageWithPluginId = parseSwiftPackageWithPluginId;
|
|
221
|
+
exports.parseUniExtApiNamespacesOnce = (0, uni_shared_1.once)((platform, language) => {
|
|
222
|
+
const extApis = (0, exports.parseUniExtApiNamespacesJsOnce)(platform, language);
|
|
223
|
+
const namespaces = {};
|
|
224
|
+
Object.keys(extApis).forEach((name) => {
|
|
225
|
+
const options = extApis[name];
|
|
226
|
+
let source = options[0];
|
|
227
|
+
const pluginId = path_1.default.basename(options[0]);
|
|
228
|
+
if (language === 'kotlin') {
|
|
229
|
+
source = parseKotlinPackageWithPluginId(pluginId, true);
|
|
230
|
+
}
|
|
231
|
+
else if (language === 'swift') {
|
|
232
|
+
source = parseSwiftPackageWithPluginId(pluginId, true);
|
|
233
|
+
}
|
|
234
|
+
namespaces[name] = [source, options[1]];
|
|
235
|
+
});
|
|
236
|
+
return namespaces;
|
|
237
|
+
});
|
|
238
|
+
exports.parseUniExtApiNamespacesJsOnce = (0, uni_shared_1.once)((platform, language) => {
|
|
239
|
+
const extApis = (0, uni_modules_1.parseUniExtApis)(true, platform, language);
|
|
240
|
+
const namespaces = {};
|
|
241
|
+
Object.keys(extApis).forEach((name) => {
|
|
242
|
+
const options = extApis[name];
|
|
243
|
+
if ((0, shared_1.isArray)(options) && options.length >= 2) {
|
|
244
|
+
namespaces[name.replace('uni.', '')] = [options[0], options[1]];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return namespaces;
|
|
248
|
+
});
|
|
@@ -5,6 +5,7 @@ export * from './mainJs';
|
|
|
5
5
|
export * from './jsonJs';
|
|
6
6
|
export * from './console';
|
|
7
7
|
export * from './dynamicImportPolyfill';
|
|
8
|
+
export * from './utsPlugin';
|
|
8
9
|
export { assetPlugin, getAssetHash } from './vitejs/plugins/asset';
|
|
9
10
|
export { isCSSRequest, cssPlugin, cssPostPlugin, minifyCSS, cssLangRE, commonjsProxyRE, } from './vitejs/plugins/css';
|
|
10
11
|
export { generateCodeFrame } from './vitejs/utils';
|
|
@@ -22,6 +22,7 @@ __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("./utsPlugin"), exports);
|
|
25
26
|
var asset_1 = require("./vitejs/plugins/asset");
|
|
26
27
|
Object.defineProperty(exports, "assetPlugin", { enumerable: true, get: function () { return asset_1.assetPlugin; } });
|
|
27
28
|
Object.defineProperty(exports, "getAssetHash", { enumerable: true, get: function () { return asset_1.getAssetHash; } });
|
|
@@ -10,18 +10,20 @@ function defineUniMainJsPlugin(createUniMainJsPlugin) {
|
|
|
10
10
|
const opts = {
|
|
11
11
|
resolvedConfig: {},
|
|
12
12
|
filter(id) {
|
|
13
|
-
return id === mainJsPath || id === mainTsPath;
|
|
13
|
+
return id === mainJsPath || id === mainTsPath || id === mainUTsPath;
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
const plugin = createUniMainJsPlugin(opts);
|
|
17
17
|
const origConfigResolved = plugin.configResolved;
|
|
18
18
|
let mainJsPath = '';
|
|
19
19
|
let mainTsPath = '';
|
|
20
|
+
let mainUTsPath = '';
|
|
20
21
|
plugin.configResolved = function (config) {
|
|
21
22
|
opts.resolvedConfig = config;
|
|
22
23
|
const mainPath = (0, utils_1.normalizePath)(path_1.default.resolve(process.env.UNI_INPUT_DIR, 'main'));
|
|
23
24
|
mainJsPath = mainPath + '.js';
|
|
24
25
|
mainTsPath = mainPath + '.ts';
|
|
26
|
+
mainUTsPath = mainPath + '.uts';
|
|
25
27
|
return origConfigResolved && origConfigResolved(config);
|
|
26
28
|
};
|
|
27
29
|
return plugin;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
interface UniUTSPluginOptions {
|
|
3
|
+
x?: boolean;
|
|
4
|
+
extApis?: Record<string, [string, string]>;
|
|
5
|
+
}
|
|
6
|
+
export declare const utsPlugins: Set<string>;
|
|
7
|
+
export declare function uniUTSPlugin(options?: UniUTSPluginOptions): Plugin;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.uniUTSPlugin = exports.utsPlugins = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
9
|
+
const uts_1 = require("../../uts");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const UTSProxyRE = /\?uts-proxy$/;
|
|
12
|
+
function isUTSProxy(id) {
|
|
13
|
+
return UTSProxyRE.test(id);
|
|
14
|
+
}
|
|
15
|
+
const utsModuleCaches = new Map();
|
|
16
|
+
exports.utsPlugins = new Set();
|
|
17
|
+
function uniUTSPlugin(options = {}) {
|
|
18
|
+
process.env.UNI_UTS_USING_ROLLUP = 'true';
|
|
19
|
+
return {
|
|
20
|
+
name: 'uni:uts',
|
|
21
|
+
apply: 'build',
|
|
22
|
+
enforce: 'pre',
|
|
23
|
+
resolveId(id, importer) {
|
|
24
|
+
if (isUTSProxy(id)) {
|
|
25
|
+
return id;
|
|
26
|
+
}
|
|
27
|
+
const module = (0, uts_1.resolveUTSAppModule)(id, importer ? path_1.default.dirname(importer) : process.env.UNI_INPUT_DIR, options.x !== true);
|
|
28
|
+
if (module) {
|
|
29
|
+
// prefix the polyfill id with \0 to tell other plugins not to try to load or transform it
|
|
30
|
+
return module + '?uts-proxy';
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
load(id) {
|
|
34
|
+
if (isUTSProxy(id)) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
buildEnd() {
|
|
39
|
+
utsModuleCaches.clear();
|
|
40
|
+
},
|
|
41
|
+
async transform(_, id, opts) {
|
|
42
|
+
if (opts && opts.ssr) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!isUTSProxy(id)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const { filename: pluginDir } = (0, utils_1.parseVueRequest)(id.replace('\0', ''));
|
|
49
|
+
// 当 vue 和 nvue 均引用了相同 uts 插件,解决两套编译器会编译两次 uts 插件的问题
|
|
50
|
+
// 通过缓存,保证同一个 uts 插件只编译一次
|
|
51
|
+
if (utsModuleCaches.get(pluginDir)) {
|
|
52
|
+
return utsModuleCaches.get(pluginDir)().then((result) => {
|
|
53
|
+
if (result) {
|
|
54
|
+
result.deps.forEach((dep) => {
|
|
55
|
+
this.addWatchFile(dep);
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
code: result.code,
|
|
59
|
+
syntheticNamedExports: result.encrypt,
|
|
60
|
+
meta: result.meta,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const compile = (0, uni_shared_1.once)(() => {
|
|
66
|
+
exports.utsPlugins.add(path_1.default.basename(pluginDir));
|
|
67
|
+
return (0, uts_1.resolveUTSCompiler)().compile(pluginDir, {
|
|
68
|
+
isX: !!options.x,
|
|
69
|
+
isPlugin: true,
|
|
70
|
+
extApis: options.extApis,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
utsModuleCaches.set(pluginDir, compile);
|
|
74
|
+
const result = await compile();
|
|
75
|
+
if (result) {
|
|
76
|
+
result.deps.forEach((dep) => {
|
|
77
|
+
this.addWatchFile(dep);
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
code: result.code,
|
|
81
|
+
syntheticNamedExports: result.encrypt,
|
|
82
|
+
meta: result.meta,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
exports.uniUTSPlugin = uniUTSPlugin;
|
|
@@ -34,8 +34,9 @@ export declare function cssPlugin(config: ResolvedConfig): Plugin;
|
|
|
34
34
|
/**
|
|
35
35
|
* Plugin applied after user plugins
|
|
36
36
|
*/
|
|
37
|
-
export declare function cssPostPlugin(config: ResolvedConfig, { platform, chunkCssFilename, chunkCssCode, }: {
|
|
37
|
+
export declare function cssPostPlugin(config: ResolvedConfig, { platform, isJsCode, chunkCssFilename, chunkCssCode, }: {
|
|
38
38
|
platform: UniApp.PLATFORM;
|
|
39
|
+
isJsCode?: boolean;
|
|
39
40
|
chunkCssFilename: (id: string) => string | void;
|
|
40
41
|
chunkCssCode: (filename: string, cssCode: string) => Promise<string> | string;
|
|
41
42
|
}): Plugin;
|
|
@@ -36,7 +36,9 @@ const pluginutils_1 = require("@rollup/pluginutils");
|
|
|
36
36
|
const utils_1 = require("../utils");
|
|
37
37
|
const asset_1 = require("./asset");
|
|
38
38
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
39
|
+
const Postcss = __importStar(require("postcss"));
|
|
39
40
|
const preprocess_1 = require("../../../../preprocess");
|
|
41
|
+
const uniapp_1 = require("../../../../postcss/plugins/uniapp");
|
|
40
42
|
const cleanString_1 = require("../cleanString");
|
|
41
43
|
const shared_1 = require("@vue/shared");
|
|
42
44
|
const constants_1 = require("../../../../constants");
|
|
@@ -122,7 +124,7 @@ function findCssModuleIds(moduleId, cssModuleIds, seen) {
|
|
|
122
124
|
const moduleInfo = this.getModuleInfo(moduleId);
|
|
123
125
|
if (moduleInfo) {
|
|
124
126
|
moduleInfo.importedIds.forEach((id) => {
|
|
125
|
-
if (id.includes(constants_1.PAGES_JSON_JS)) {
|
|
127
|
+
if (id.includes(constants_1.PAGES_JSON_JS) || id.includes(constants_1.PAGES_JSON_UTS)) {
|
|
126
128
|
// 查询main.js时,需要忽略pages.json.js,否则会把所有页面样式加进来
|
|
127
129
|
return;
|
|
128
130
|
}
|
|
@@ -139,7 +141,7 @@ function findCssModuleIds(moduleId, cssModuleIds, seen) {
|
|
|
139
141
|
/**
|
|
140
142
|
* Plugin applied after user plugins
|
|
141
143
|
*/
|
|
142
|
-
function cssPostPlugin(config, { platform, chunkCssFilename, chunkCssCode, }) {
|
|
144
|
+
function cssPostPlugin(config, { platform, isJsCode, chunkCssFilename, chunkCssCode, }) {
|
|
143
145
|
// styles initialization in buildStart causes a styling loss in watch
|
|
144
146
|
const styles = new Map();
|
|
145
147
|
let cssChunks;
|
|
@@ -169,7 +171,8 @@ function cssPostPlugin(config, { platform, chunkCssFilename, chunkCssCode, }) {
|
|
|
169
171
|
if (id) {
|
|
170
172
|
const filename = chunkCssFilename(id);
|
|
171
173
|
if (filename) {
|
|
172
|
-
if (platform === 'app' &&
|
|
174
|
+
if (platform === 'app' &&
|
|
175
|
+
(filename === 'app.css' || filename === 'App.vue.style.uts')) {
|
|
173
176
|
// 获取 unocss 的样式文件信息
|
|
174
177
|
const ids = Object.keys(chunk.modules).filter((id) => styles.has(id) &&
|
|
175
178
|
(id.includes('__uno.css') || id.includes('-unocss-')));
|
|
@@ -215,6 +218,9 @@ function cssPostPlugin(config, { platform, chunkCssFilename, chunkCssCode, }) {
|
|
|
215
218
|
css = css.replace(asset_1.assetUrlRE, (_, fileHash, postfix = '') => {
|
|
216
219
|
return (0, utils_1.normalizePath)(path_1.default.relative(path_1.default.dirname(filename), (0, asset_1.getAssetFilename)(fileHash, config) + postfix));
|
|
217
220
|
});
|
|
221
|
+
if (isJsCode) {
|
|
222
|
+
return chunkCssCode(filename, css);
|
|
223
|
+
}
|
|
218
224
|
// only external @imports and @charset should exist at this point
|
|
219
225
|
// hoist them to the top of the CSS chunk per spec (#1845 and #6333)
|
|
220
226
|
if (css.includes('@import') || css.includes('@charset')) {
|
|
@@ -674,6 +680,11 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
|
|
|
674
680
|
async function minifyCSS(css, config) {
|
|
675
681
|
try {
|
|
676
682
|
const { code, warnings } = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ transform }) => {
|
|
683
|
+
if (process.env.VUE_APP_DARK_MODE !== 'true') {
|
|
684
|
+
const postcssRoot = Postcss.parse(css);
|
|
685
|
+
(0, uniapp_1.filterPrefersColorScheme)(postcssRoot, true);
|
|
686
|
+
css = postcssRoot.toResult().css;
|
|
687
|
+
}
|
|
677
688
|
return transform(css, {
|
|
678
689
|
loader: 'css',
|
|
679
690
|
minify: true,
|
|
@@ -9,3 +9,4 @@ export declare function injectCssPlugin(config: ResolvedConfig): void;
|
|
|
9
9
|
export declare function injectCssPostPlugin(config: ResolvedConfig, newCssPostPlugin: Plugin): void;
|
|
10
10
|
export declare function replacePlugins(plugins: Plugin[], config: ResolvedConfig): void;
|
|
11
11
|
export declare function removePlugins(plugins: string | string[], config: ResolvedConfig): void;
|
|
12
|
+
export declare function insertBeforePlugin(plugin: Plugin, before: string, config: ResolvedConfig): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removePlugins = exports.replacePlugins = exports.injectCssPostPlugin = exports.injectCssPlugin = exports.injectAssetPlugin = void 0;
|
|
3
|
+
exports.insertBeforePlugin = exports.removePlugins = exports.replacePlugins = exports.injectCssPostPlugin = exports.injectCssPlugin = exports.injectAssetPlugin = void 0;
|
|
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");
|
|
@@ -43,3 +43,11 @@ function removePlugins(plugins, config) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
exports.removePlugins = removePlugins;
|
|
46
|
+
function insertBeforePlugin(plugin, before, config) {
|
|
47
|
+
const index = config.plugins.findIndex((p) => p.name === before);
|
|
48
|
+
if (index > -1) {
|
|
49
|
+
;
|
|
50
|
+
config.plugins.splice(index, 0, plugin);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.insertBeforePlugin = insertBeforePlugin;
|
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-3080520230612001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ampproject/remapping": "^2.1.2",
|
|
25
|
-
"@babel/core": "^7.
|
|
26
|
-
"@babel/parser": "^7.
|
|
25
|
+
"@babel/core": "^7.21.3",
|
|
26
|
+
"@babel/parser": "^7.16.4",
|
|
27
27
|
"@babel/types": "^7.20.7",
|
|
28
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
28
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3080520230612001",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3080520230612001",
|
|
30
30
|
"@intlify/core-base": "9.1.9",
|
|
31
31
|
"@intlify/shared": "9.1.9",
|
|
32
32
|
"@intlify/vue-devtools": "9.1.9",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"chokidar": "^3.5.3",
|
|
42
42
|
"compare-versions": "^3.6.0",
|
|
43
43
|
"debug": "^4.3.3",
|
|
44
|
-
"es-module-lexer": "^
|
|
44
|
+
"es-module-lexer": "^1.2.1",
|
|
45
45
|
"esbuild": "^0.17.5",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
47
|
"fast-glob": "^3.2.11",
|
|
48
48
|
"fs-extra": "^10.0.0",
|
|
49
49
|
"hash-sum": "^2.0.0",
|
|
50
50
|
"jsonc-parser": "^3.0.0",
|
|
51
|
-
"magic-string": "^0.
|
|
51
|
+
"magic-string": "^0.30.0",
|
|
52
52
|
"merge": "^2.1.1",
|
|
53
53
|
"mime": "^3.0.0",
|
|
54
54
|
"module-alias": "^2.2.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@dcloudio/uni-uts-v1": "3.0.0-alpha-
|
|
67
|
+
"@dcloudio/uni-uts-v1": "3.0.0-alpha-3080520230612001",
|
|
68
68
|
"@types/babel__core": "^7.1.19",
|
|
69
69
|
"@types/debug": "^4.1.7",
|
|
70
70
|
"@types/estree": "^0.0.51",
|