@dcloudio/uni-cli-shared 3.0.0-alpha-1000920260909822 → 3.0.0-alpha-5020720260921001
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/dom2/script.js +0 -2
- package/dist/hbx/index.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/json/manifest.d.ts +0 -3
- package/dist/json/manifest.js +1 -13
- package/dist/json/mp/jsonFile.d.ts +8 -1
- package/dist/json/mp/jsonFile.js +171 -13
- package/dist/json/uni-x/index.d.ts +0 -1
- package/dist/json/uni-x/index.js +0 -4
- package/dist/logs/console.js +1 -12
- package/dist/mp/usingComponents.d.ts +3 -3
- package/dist/mp/usingComponents.js +29 -9
- package/dist/resolve.js +0 -5
- package/dist/uasm.d.ts +0 -1
- package/dist/uasm.js +5 -11
- package/dist/vite/autoImport.js +2 -8
- package/dist/vite/cloud.js +9 -10
- package/dist/vite/extApi.js +2 -2
- package/dist/vite/index.d.ts +4 -9
- package/dist/vite/plugins/console.js +1 -2
- package/dist/vite/plugins/dynamicImportPolyfill.d.ts +1 -8
- package/dist/vite/plugins/index.d.ts +0 -1
- package/dist/vite/plugins/index.js +0 -1
- package/dist/vite/plugins/inject.js +1 -1
- package/dist/vite/plugins/jsonJs.d.ts +2 -2
- package/dist/vite/plugins/mainJs.d.ts +1 -1
- package/dist/vite/plugins/sourceMap.js +1 -4
- package/dist/vite/plugins/uts/uni_modules.js +15 -9
- package/dist/vite/plugins/uts/uvue.js +44 -103
- package/dist/vite/plugins/vitejs/plugins/asset.d.ts +5 -12
- package/dist/vite/plugins/vitejs/plugins/asset.js +2 -4
- package/dist/vue/transforms/transformTeleport.js +1 -15
- package/dist/watcher.d.ts +0 -1
- package/dist/workers.d.ts +0 -1
- package/dist/workers.js +12 -16
- package/dist/x.d.ts +0 -1
- package/dist/x.js +1 -6
- package/lib/@vue/compiler-core/dist/compiler-core.cjs.js +23 -16
- package/lib/@vue/compiler-core/dist/compiler-core.cjs.prod.js +23 -16
- package/lib/@vue/compiler-core/dist/compiler-core.esm-bundler.js +23 -16
- package/lib/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +66 -23
- package/lib/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +115 -67
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.cjs +2 -6
- package/lib/dom2/app/@vitejs/plugin-vue/dist/index.mjs +2 -6
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.js +237 -249
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.cjs.prod.js +230 -235
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.d.ts +285 -252
- package/lib/dom2/app/@vue/compiler-core/dist/compiler-core.esm-bundler.js +162 -159
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.js +50 -50
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +49 -49
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.d.ts +11 -10
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +214 -210
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +6 -6
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +49 -49
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.js +214 -210
- package/lib/dom2/app/@vue/compiler-dom/dist/compiler-dom.global.prod.js +6 -6
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +377 -656
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.d.ts +137 -138
- package/lib/dom2/app/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +1057 -1222
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +195 -209
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.d.ts +356 -364
- package/lib/dom2/app/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +507 -569
- package/lib/dom2/app/@vue/compiler-vapor-dom2/dist/compiler-vapor-dom2.cjs.js +1 -1
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.js +20 -41
- package/lib/dom2/app/@vue/shared/dist/shared.cjs.prod.js +20 -41
- package/lib/dom2/app/@vue/shared/dist/shared.d.ts +235 -235
- package/lib/dom2/app/@vue/shared/dist/shared.esm-bundler.js +20 -41
- package/package.json +6 -6
- package/dist/uts/scriptMacros.d.ts +0 -13
- package/dist/uts/scriptMacros.js +0 -52
- package/dist/vite/plugins/uts/standardScript.d.ts +0 -15
- package/dist/vite/plugins/uts/standardScript.js +0 -137
package/dist/dom2/script.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.uniVaporScriptPlugin = void 0;
|
|
|
4
4
|
const uts_1 = require("../uts");
|
|
5
5
|
const extApi_1 = require("../uts/extApi");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
|
-
const scriptMacros_1 = require("../uts/scriptMacros");
|
|
8
7
|
const sharedData_1 = require("./sharedData");
|
|
9
8
|
function uniVaporScriptPlugin(options = {}) {
|
|
10
9
|
const { uasm, ...sharedData } = options;
|
|
@@ -15,7 +14,6 @@ function uniVaporScriptPlugin(options = {}) {
|
|
|
15
14
|
: undefined;
|
|
16
15
|
return D2SP({
|
|
17
16
|
typescript: (0, uts_1.resolveUTSCompiler)().getTypeScript(),
|
|
18
|
-
createUniAppXScriptMacrosTransformer: scriptMacros_1.createUniAppXScriptMacrosTransformer,
|
|
19
17
|
extApi,
|
|
20
18
|
uasm,
|
|
21
19
|
sharedData: {
|
package/dist/hbx/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { formatAtFilename, createErrorWithBlockFlag } from './log';
|
|
2
2
|
export * from './env';
|
|
3
3
|
export { initModuleAlias, installHBuilderXPlugin, formatInstallHBuilderXPluginTips, } from './alias';
|
|
4
|
-
export declare function uniHBuilderXConsolePlugin(method?: string): import("vite
|
|
4
|
+
export declare function uniHBuilderXConsolePlugin(method?: string): import("vite").Plugin<any>;
|
|
5
5
|
export declare function isEnableConsole(): boolean;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -24,7 +24,6 @@ __exportStar(require("./ssr"), exports);
|
|
|
24
24
|
__exportStar(require("./vue"), exports);
|
|
25
25
|
__exportStar(require("./uts"), exports);
|
|
26
26
|
__exportStar(require("./uts/extApi"), exports);
|
|
27
|
-
__exportStar(require("./uts/scriptMacros"), exports);
|
|
28
27
|
__exportStar(require("./x"), exports);
|
|
29
28
|
__exportStar(require("./logs"), exports);
|
|
30
29
|
__exportStar(require("./dom2"), exports);
|
package/dist/json/manifest.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export declare const parseManifestJson: (inputDir: string) => any;
|
|
2
2
|
export declare const parseManifestJsonOnce: (inputDir: string) => any;
|
|
3
|
-
export type UniAppXVaporScriptLang = 'js' | 'ts' | 'uts';
|
|
4
|
-
export declare function resolveUniAppXVaporScriptLang(manifestJson: Record<string, any>): UniAppXVaporScriptLang;
|
|
5
|
-
export declare function getUniAppXVaporScriptLang(inputDir?: string): UniAppXVaporScriptLang;
|
|
6
3
|
export declare const parseRpx2UnitOnce: (inputDir: string, platform?: UniApp.PLATFORM) => any;
|
|
7
4
|
export declare function getNativeTags(inputDir?: string, platform?: UniApp.PLATFORM): any;
|
|
8
5
|
interface CompilerCompatConfig {
|
package/dist/json/manifest.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateThemeValue = exports.getPlatformManifestJsonOnce = exports.getPlatformManifestJson = exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.hasPushModule = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.getNativeTags = exports.parseRpx2UnitOnce = exports.
|
|
6
|
+
exports.validateThemeValue = exports.getPlatformManifestJsonOnce = exports.getPlatformManifestJson = exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.hasPushModule = exports.isEnableSecureNetwork = exports.isEnableUniPushV2 = exports.isEnableUniPushV1 = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.getNativeTags = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
@@ -21,18 +21,6 @@ const parseManifestJson = (inputDir) => {
|
|
|
21
21
|
};
|
|
22
22
|
exports.parseManifestJson = parseManifestJson;
|
|
23
23
|
exports.parseManifestJsonOnce = (0, uni_shared_1.once)(exports.parseManifestJson);
|
|
24
|
-
function resolveUniAppXVaporScriptLang(manifestJson) {
|
|
25
|
-
const lang = manifestJson['uni-app-x']?.['vapor-default-script-lang'];
|
|
26
|
-
return lang === 'js' || lang === 'ts' || lang === 'uts' ? lang : 'ts';
|
|
27
|
-
}
|
|
28
|
-
exports.resolveUniAppXVaporScriptLang = resolveUniAppXVaporScriptLang;
|
|
29
|
-
function getUniAppXVaporScriptLang(inputDir) {
|
|
30
|
-
if (!inputDir) {
|
|
31
|
-
return 'ts';
|
|
32
|
-
}
|
|
33
|
-
return resolveUniAppXVaporScriptLang((0, exports.parseManifestJsonOnce)(inputDir));
|
|
34
|
-
}
|
|
35
|
-
exports.getUniAppXVaporScriptLang = getUniAppXVaporScriptLang;
|
|
36
24
|
exports.parseRpx2UnitOnce = (0, uni_shared_1.once)((inputDir, platform = 'h5') => {
|
|
37
25
|
const rpx2unit = platform === 'h5' || platform === 'app' || platform === 'app-harmony'
|
|
38
26
|
? uni_shared_1.defaultRpx2Unit
|
|
@@ -5,9 +5,16 @@ export declare function hasJsonFile(filename: string): boolean;
|
|
|
5
5
|
export declare function getComponentJsonFilenames(): string[];
|
|
6
6
|
export declare function findJsonFile(filename: string): Record<string, any> | ComponentJson | PageWindowOptions | undefined;
|
|
7
7
|
export declare function findUsingComponents(filename: string): UsingComponents | undefined;
|
|
8
|
+
export declare function findMiniProgramSubPackageRoot(filename: string): string | undefined;
|
|
9
|
+
export declare function addMiniProgramComponentPackageRoot(filename: string, packageRoot?: string): void;
|
|
10
|
+
export declare function findMiniProgramComponentPackageRoot(filename: string): string | undefined;
|
|
11
|
+
export declare function findMiniProgramComponentPackageRoots(filename: string): (string | undefined)[] | undefined;
|
|
12
|
+
export declare function resolveMiniProgramComponentPackageRoot(filename: string, packageRoot?: string): string | undefined;
|
|
8
13
|
export declare function normalizeJsonFilename(filename: string): string;
|
|
9
14
|
export declare function findChangedJsonFiles(supportGlobalUsingComponents?: boolean | ((filename: string) => boolean)): Map<string, string>;
|
|
10
|
-
export declare function addMiniProgramAppJson(appJson: Record<string, any
|
|
15
|
+
export declare function addMiniProgramAppJson(appJson: Record<string, any>, options?: {
|
|
16
|
+
subPackages?: boolean;
|
|
17
|
+
}): void;
|
|
11
18
|
export declare function addMiniProgramPageJson(filename: string, json: PageWindowOptions): void;
|
|
12
19
|
export declare function addMiniProgramComponentJson(filename: string, json: ComponentJson): void;
|
|
13
20
|
export declare function addMiniProgramUsingComponents(filename: string, json: UsingComponents): void;
|
package/dist/json/mp/jsonFile.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.findUsingComponentsJson = exports.findMiniProgramUsingComponents = exports.isMiniProgramUsingComponent = exports.resetMiniProgramJsonFiles = exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.findUsingComponents = exports.findJsonFile = exports.getComponentJsonFilenames = exports.hasJsonFile = exports.isMiniProgramPageSfcFile = exports.isMiniProgramPageFile = void 0;
|
|
6
|
+
exports.findUsingComponentsJson = exports.findMiniProgramUsingComponents = exports.isMiniProgramUsingComponent = exports.resetMiniProgramJsonFiles = exports.addMiniProgramUsingComponents = exports.addMiniProgramComponentJson = exports.addMiniProgramPageJson = exports.addMiniProgramAppJson = exports.findChangedJsonFiles = exports.normalizeJsonFilename = exports.resolveMiniProgramComponentPackageRoot = exports.findMiniProgramComponentPackageRoots = exports.findMiniProgramComponentPackageRoot = exports.addMiniProgramComponentPackageRoot = exports.findMiniProgramSubPackageRoot = exports.findUsingComponents = exports.findJsonFile = exports.getComponentJsonFilenames = exports.hasJsonFile = exports.isMiniProgramPageSfcFile = exports.isMiniProgramPageFile = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const shared_1 = require("@vue/shared");
|
|
@@ -12,12 +12,16 @@ const resolve_1 = require("../../resolve");
|
|
|
12
12
|
const utils_2 = require("../../vue/utils");
|
|
13
13
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
14
14
|
const subpackage_1 = require("./subpackage");
|
|
15
|
+
const x_1 = require("../../x");
|
|
15
16
|
let appJsonCache = {};
|
|
17
|
+
let subPackageRootsCache = [];
|
|
16
18
|
let independentRootsCache = [];
|
|
17
19
|
const jsonFilesCache = new Map();
|
|
18
20
|
const jsonPagesCache = new Map();
|
|
19
21
|
const jsonComponentsCache = new Map();
|
|
20
22
|
const jsonUsingComponentsCache = new Map();
|
|
23
|
+
const componentPackageRootsCache = new Map();
|
|
24
|
+
const mainPackageRoot = '';
|
|
21
25
|
function isMiniProgramPageFile(file, inputDir) {
|
|
22
26
|
if (inputDir && path_1.default.isAbsolute(file)) {
|
|
23
27
|
file = (0, utils_1.normalizePath)(path_1.default.relative(inputDir, file));
|
|
@@ -50,6 +54,74 @@ function findUsingComponents(filename) {
|
|
|
50
54
|
return jsonUsingComponentsCache.get(filename);
|
|
51
55
|
}
|
|
52
56
|
exports.findUsingComponents = findUsingComponents;
|
|
57
|
+
function findMiniProgramSubPackageRoot(filename) {
|
|
58
|
+
if (!(0, x_1.isUniAppX)()) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
return findSubPackageRoot(filename, subPackageRootsCache);
|
|
62
|
+
}
|
|
63
|
+
exports.findMiniProgramSubPackageRoot = findMiniProgramSubPackageRoot;
|
|
64
|
+
function addMiniProgramComponentPackageRoot(filename, packageRoot) {
|
|
65
|
+
if (!(0, x_1.isUniAppX)()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const normalizedFilename = normalizeComponentPackageFilename(filename);
|
|
69
|
+
if (!normalizedFilename.startsWith('uni_modules/')) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const roots = componentPackageRootsCache.get(normalizedFilename) || new Set();
|
|
73
|
+
roots.add(packageRoot || mainPackageRoot);
|
|
74
|
+
componentPackageRootsCache.set(normalizedFilename, roots);
|
|
75
|
+
}
|
|
76
|
+
exports.addMiniProgramComponentPackageRoot = addMiniProgramComponentPackageRoot;
|
|
77
|
+
function findMiniProgramComponentPackageRoot(filename) {
|
|
78
|
+
if (!(0, x_1.isUniAppX)()) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const roots = getMiniProgramComponentPackageRoots(filename);
|
|
82
|
+
if (roots?.size === 1) {
|
|
83
|
+
const [root] = [...roots];
|
|
84
|
+
return root || undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.findMiniProgramComponentPackageRoot = findMiniProgramComponentPackageRoot;
|
|
88
|
+
function findMiniProgramComponentPackageRoots(filename) {
|
|
89
|
+
if (!(0, x_1.isUniAppX)()) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const roots = getMiniProgramComponentPackageRoots(filename);
|
|
93
|
+
if (roots) {
|
|
94
|
+
if (roots.has(mainPackageRoot) || roots.size > 1) {
|
|
95
|
+
return [undefined];
|
|
96
|
+
}
|
|
97
|
+
return [...roots].map((root) => root || undefined);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.findMiniProgramComponentPackageRoots = findMiniProgramComponentPackageRoots;
|
|
101
|
+
function resolveMiniProgramComponentPackageRoot(filename, packageRoot) {
|
|
102
|
+
if (!(0, x_1.isUniAppX)()) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const roots = getMiniProgramComponentPackageRoots(filename);
|
|
106
|
+
if (!roots) {
|
|
107
|
+
return packageRoot;
|
|
108
|
+
}
|
|
109
|
+
if (roots.has(mainPackageRoot)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (roots.size > 1) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const normalizedPackageRoot = packageRoot || mainPackageRoot;
|
|
116
|
+
if (roots.has(normalizedPackageRoot)) {
|
|
117
|
+
return packageRoot;
|
|
118
|
+
}
|
|
119
|
+
if (roots.size === 1) {
|
|
120
|
+
const [root] = [...roots];
|
|
121
|
+
return root || undefined;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.resolveMiniProgramComponentPackageRoot = resolveMiniProgramComponentPackageRoot;
|
|
53
125
|
function normalizeJsonFilename(filename) {
|
|
54
126
|
return (0, utils_1.normalizeNodeModules)(filename);
|
|
55
127
|
}
|
|
@@ -57,16 +129,20 @@ exports.normalizeJsonFilename = normalizeJsonFilename;
|
|
|
57
129
|
function findChangedJsonFiles(supportGlobalUsingComponents = true) {
|
|
58
130
|
const changedJsonFiles = new Map();
|
|
59
131
|
function findChangedFile(filename, json) {
|
|
132
|
+
const cacheFilename = filename;
|
|
133
|
+
const outputFilename = (0, x_1.isUniAppX)()
|
|
134
|
+
? normalizeJsonPackageFilename(filename)
|
|
135
|
+
: filename;
|
|
60
136
|
const newJson = JSON.parse(JSON.stringify(json));
|
|
61
137
|
if (!newJson.usingComponents) {
|
|
62
138
|
newJson.usingComponents = {};
|
|
63
139
|
}
|
|
64
|
-
(0, shared_1.extend)(newJson.usingComponents, jsonUsingComponentsCache.get(
|
|
140
|
+
(0, shared_1.extend)(newJson.usingComponents, jsonUsingComponentsCache.get(cacheFilename));
|
|
65
141
|
// 格式化为相对路径,这样作为分包也可以直接运行
|
|
66
142
|
// app.json mp-baidu 在 win 不支持相对路径。所有平台改用绝对路径
|
|
67
|
-
if (
|
|
143
|
+
if (outputFilename !== 'app') {
|
|
68
144
|
let usingComponents = newJson.usingComponents;
|
|
69
|
-
const independentRoot =
|
|
145
|
+
const independentRoot = findSubPackageRoot(outputFilename, independentRootsCache);
|
|
70
146
|
const supportGlobalUsingComponentsForFile = typeof supportGlobalUsingComponents === 'function'
|
|
71
147
|
? supportGlobalUsingComponents(filename)
|
|
72
148
|
: supportGlobalUsingComponents;
|
|
@@ -82,20 +158,22 @@ function findChangedJsonFiles(supportGlobalUsingComponents = true) {
|
|
|
82
158
|
};
|
|
83
159
|
}
|
|
84
160
|
if (independentRoot) {
|
|
85
|
-
validateIndependentUsingComponents(
|
|
161
|
+
validateIndependentUsingComponents(outputFilename, independentRoot, usingComponents);
|
|
86
162
|
}
|
|
87
163
|
Object.keys(usingComponents).forEach((name) => {
|
|
88
|
-
const componentFilename =
|
|
164
|
+
const componentFilename = (0, x_1.isUniAppX)()
|
|
165
|
+
? normalizeUsingComponentPackageFilename(usingComponents[name], outputFilename)
|
|
166
|
+
: usingComponents[name];
|
|
89
167
|
if (componentFilename.startsWith('/')) {
|
|
90
|
-
usingComponents[name] = (0, resolve_1.relativeFile)(
|
|
168
|
+
usingComponents[name] = (0, resolve_1.relativeFile)(outputFilename, componentFilename.slice(1));
|
|
91
169
|
}
|
|
92
170
|
});
|
|
93
171
|
newJson.usingComponents = usingComponents;
|
|
94
172
|
}
|
|
95
173
|
const jsonStr = JSON.stringify(newJson, null, 2);
|
|
96
|
-
if (jsonFilesCache.get(
|
|
97
|
-
changedJsonFiles.set(
|
|
98
|
-
jsonFilesCache.set(
|
|
174
|
+
if (jsonFilesCache.get(outputFilename) !== jsonStr) {
|
|
175
|
+
changedJsonFiles.set(outputFilename, jsonStr);
|
|
176
|
+
jsonFilesCache.set(outputFilename, jsonStr);
|
|
99
177
|
}
|
|
100
178
|
}
|
|
101
179
|
function findChangedFiles(jsonsCache) {
|
|
@@ -111,8 +189,8 @@ function findChangedJsonFiles(supportGlobalUsingComponents = true) {
|
|
|
111
189
|
return changedJsonFiles;
|
|
112
190
|
}
|
|
113
191
|
exports.findChangedJsonFiles = findChangedJsonFiles;
|
|
114
|
-
function
|
|
115
|
-
return
|
|
192
|
+
function findSubPackageRoot(filename, roots) {
|
|
193
|
+
return roots.find((root) => {
|
|
116
194
|
return filename === root || filename.startsWith(root + '/');
|
|
117
195
|
});
|
|
118
196
|
}
|
|
@@ -142,8 +220,13 @@ function isLocalUsingComponent(componentFilename) {
|
|
|
142
220
|
return (!/^(?:plugin|dynamicLib|ext):\/\//.test(componentFilename) &&
|
|
143
221
|
!componentFilename.startsWith('weui-miniprogram'));
|
|
144
222
|
}
|
|
145
|
-
function addMiniProgramAppJson(appJson) {
|
|
223
|
+
function addMiniProgramAppJson(appJson, options = {}) {
|
|
146
224
|
appJsonCache = appJson;
|
|
225
|
+
componentPackageRootsCache.clear();
|
|
226
|
+
subPackageRootsCache =
|
|
227
|
+
!(0, x_1.isUniAppX)() || options.subPackages === false
|
|
228
|
+
? []
|
|
229
|
+
: parseSubPackageRoots(appJson);
|
|
147
230
|
independentRootsCache = (0, subpackage_1.parseIndependentSubPackages)(appJson).map(({ root }) => root);
|
|
148
231
|
}
|
|
149
232
|
exports.addMiniProgramAppJson = addMiniProgramAppJson;
|
|
@@ -161,14 +244,89 @@ function addMiniProgramUsingComponents(filename, json) {
|
|
|
161
244
|
exports.addMiniProgramUsingComponents = addMiniProgramUsingComponents;
|
|
162
245
|
function resetMiniProgramJsonFiles() {
|
|
163
246
|
appJsonCache = {};
|
|
247
|
+
subPackageRootsCache = [];
|
|
164
248
|
independentRootsCache = [];
|
|
165
249
|
(0, subpackage_1.setIndependentSubPackages)([]);
|
|
250
|
+
componentPackageRootsCache.clear();
|
|
166
251
|
jsonFilesCache.clear();
|
|
167
252
|
jsonPagesCache.clear();
|
|
168
253
|
jsonComponentsCache.clear();
|
|
169
254
|
jsonUsingComponentsCache.clear();
|
|
170
255
|
}
|
|
171
256
|
exports.resetMiniProgramJsonFiles = resetMiniProgramJsonFiles;
|
|
257
|
+
function parseSubPackageRoots(pagesJson) {
|
|
258
|
+
const subPackages = pagesJson?.subPackages || pagesJson?.subpackages || [];
|
|
259
|
+
if (!Array.isArray(subPackages)) {
|
|
260
|
+
return [];
|
|
261
|
+
}
|
|
262
|
+
return subPackages
|
|
263
|
+
.map((subPackage) => {
|
|
264
|
+
if (!subPackage ||
|
|
265
|
+
subPackage.independent === true ||
|
|
266
|
+
typeof subPackage.root !== 'string') {
|
|
267
|
+
return '';
|
|
268
|
+
}
|
|
269
|
+
return (0, utils_1.normalizePath)(subPackage.root).replace(/^\/+|\/+$/g, '');
|
|
270
|
+
})
|
|
271
|
+
.filter(Boolean)
|
|
272
|
+
.sort((a, b) => b.length - a.length);
|
|
273
|
+
}
|
|
274
|
+
function normalizeJsonPackageFilename(filename) {
|
|
275
|
+
const unrootedFilename = withoutSubPackageRootForUniModules(filename);
|
|
276
|
+
const ownerRoot = findMiniProgramSubPackageRoot(filename);
|
|
277
|
+
const roots = getMiniProgramComponentPackageRoots(unrootedFilename);
|
|
278
|
+
if (unrootedFilename !== filename &&
|
|
279
|
+
roots &&
|
|
280
|
+
(roots.has(mainPackageRoot) ||
|
|
281
|
+
roots.size > 1 ||
|
|
282
|
+
!ownerRoot ||
|
|
283
|
+
!roots.has(ownerRoot))) {
|
|
284
|
+
return unrootedFilename;
|
|
285
|
+
}
|
|
286
|
+
return filename;
|
|
287
|
+
}
|
|
288
|
+
function normalizeUsingComponentPackageFilename(componentFilename, ownerFilename) {
|
|
289
|
+
if (!componentFilename.startsWith('/')) {
|
|
290
|
+
return componentFilename;
|
|
291
|
+
}
|
|
292
|
+
const normalizedFilename = (0, utils_1.normalizePath)(componentFilename).replace(/^\/+/, '');
|
|
293
|
+
const unrootedFilename = withoutSubPackageRootForUniModules(normalizedFilename);
|
|
294
|
+
if (!unrootedFilename.startsWith('uni_modules/')) {
|
|
295
|
+
return componentFilename;
|
|
296
|
+
}
|
|
297
|
+
const roots = getMiniProgramComponentPackageRoots(unrootedFilename);
|
|
298
|
+
if (!roots) {
|
|
299
|
+
return componentFilename;
|
|
300
|
+
}
|
|
301
|
+
if (roots.has(mainPackageRoot) || roots.size > 1) {
|
|
302
|
+
return '/' + unrootedFilename;
|
|
303
|
+
}
|
|
304
|
+
const ownerRoot = findMiniProgramSubPackageRoot(ownerFilename);
|
|
305
|
+
if (ownerRoot && roots.has(ownerRoot)) {
|
|
306
|
+
return '/' + `${ownerRoot}/${unrootedFilename}`;
|
|
307
|
+
}
|
|
308
|
+
const packageRoot = findMiniProgramComponentPackageRoot(unrootedFilename);
|
|
309
|
+
return '/' + (packageRoot ? `${packageRoot}/` : '') + unrootedFilename;
|
|
310
|
+
}
|
|
311
|
+
function withoutSubPackageRootForUniModules(filename) {
|
|
312
|
+
for (const root of subPackageRootsCache) {
|
|
313
|
+
if (filename.startsWith(`${root}/uni_modules/`)) {
|
|
314
|
+
return filename.slice(root.length + 1);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return filename;
|
|
318
|
+
}
|
|
319
|
+
function normalizeComponentPackageFilename(filename) {
|
|
320
|
+
let normalizedFilename = withoutSubPackageRootForUniModules((0, utils_1.normalizePath)(filename).split('?')[0].replace(/^\/+/, ''));
|
|
321
|
+
const uniModulesIndex = normalizedFilename.indexOf('uni_modules/');
|
|
322
|
+
if (uniModulesIndex > -1) {
|
|
323
|
+
normalizedFilename = normalizedFilename.slice(uniModulesIndex);
|
|
324
|
+
}
|
|
325
|
+
return (0, utils_1.removeExt)(normalizedFilename);
|
|
326
|
+
}
|
|
327
|
+
function getMiniProgramComponentPackageRoots(filename) {
|
|
328
|
+
return componentPackageRootsCache.get(normalizeComponentPackageFilename(filename));
|
|
329
|
+
}
|
|
172
330
|
function isMiniProgramUsingComponent(name, options) {
|
|
173
331
|
return !!findMiniProgramUsingComponents(options)[name];
|
|
174
332
|
}
|
|
@@ -8,7 +8,6 @@ export interface UniXPageOptions {
|
|
|
8
8
|
androidOverscroll?: boolean;
|
|
9
9
|
androidRefresherColor?: string;
|
|
10
10
|
backgroundColor?: string;
|
|
11
|
-
backgroundTextStyle?: 'dark' | 'light';
|
|
12
11
|
}
|
|
13
12
|
export declare function normalizeUniAppXAppPagesJson(jsonStr: string): UniApp.PagesJson;
|
|
14
13
|
export declare function parseUniXPageOptions(filename: string): UniXPageOptions | undefined;
|
package/dist/json/uni-x/index.js
CHANGED
|
@@ -97,7 +97,6 @@ function updateUniXPageOptions(pagesJson) {
|
|
|
97
97
|
function normalizeRootPageOptions(pageStyle, globalStyle) {
|
|
98
98
|
const androidRefresherColor = pageStyle?.androidRefresherColor ?? globalStyle.androidRefresherColor;
|
|
99
99
|
const backgroundColor = pageStyle?.backgroundColor ?? globalStyle.backgroundColor;
|
|
100
|
-
const backgroundTextStyle = pageStyle?.backgroundTextStyle ?? globalStyle.backgroundTextStyle;
|
|
101
100
|
return {
|
|
102
101
|
disableScroll: pageStyle?.disableScroll === true || undefined,
|
|
103
102
|
enablePullDownRefresh: (pageStyle && isEnablePullDownRefresh(pageStyle)) || undefined,
|
|
@@ -112,9 +111,6 @@ function normalizeRootPageOptions(pageStyle, globalStyle) {
|
|
|
112
111
|
backgroundColor: backgroundColor?.startsWith('@')
|
|
113
112
|
? undefined
|
|
114
113
|
: backgroundColor,
|
|
115
|
-
backgroundTextStyle: backgroundTextStyle?.startsWith('@')
|
|
116
|
-
? undefined
|
|
117
|
-
: backgroundTextStyle,
|
|
118
114
|
};
|
|
119
115
|
}
|
|
120
116
|
function initUniXPageOptions() {
|
package/dist/logs/console.js
CHANGED
|
@@ -21,24 +21,13 @@ function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) {
|
|
|
21
21
|
return {
|
|
22
22
|
code: s.toString(),
|
|
23
23
|
map: sourceMap
|
|
24
|
-
?
|
|
24
|
+
? s.generateMap({ hires: (0, x_1.shouldUseHighResolutionSourceMap)() })
|
|
25
25
|
: { mappings: '' },
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
return { code, map: null };
|
|
29
29
|
}
|
|
30
30
|
exports.rewriteConsoleExpr = rewriteConsoleExpr;
|
|
31
|
-
function normalizeSourceMap(map) {
|
|
32
|
-
return {
|
|
33
|
-
...map,
|
|
34
|
-
file: map.file || '',
|
|
35
|
-
names: map.names || [],
|
|
36
|
-
sources: map.sources || [],
|
|
37
|
-
sourcesContent: map.sourcesContent || [],
|
|
38
|
-
toString: () => map.toString(),
|
|
39
|
-
toUrl: () => map.toUrl(),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
31
|
function restoreConsoleExpr(code) {
|
|
43
32
|
return code.replace(/(?:uni\.)?__f__\('([^']+)','at ([^:]+):(\d+)',/g, 'console.$1(');
|
|
44
33
|
}
|
|
@@ -11,8 +11,8 @@ interface MainDescriptor {
|
|
|
11
11
|
template: string;
|
|
12
12
|
}
|
|
13
13
|
export declare function parseMainDescriptor(filename: string, ast: Program, resolve: ParseDescriptor['resolve'], root?: string): Promise<MainDescriptor>;
|
|
14
|
-
export declare function updateMiniProgramComponentsByScriptFilename(scriptFilename: string, inputDir: string, normalizeComponentName: (name: string) => string, root?: string): void;
|
|
15
|
-
export declare function updateMiniProgramComponentsByTemplateFilename(templateFilename: string, inputDir: string, normalizeComponentName: (name: string) => string, root?: string): void;
|
|
14
|
+
export declare function updateMiniProgramComponentsByScriptFilename(scriptFilename: string, inputDir: string, normalizeComponentName: (name: string) => string, root?: string, packageRoot?: string): void;
|
|
15
|
+
export declare function updateMiniProgramComponentsByTemplateFilename(templateFilename: string, inputDir: string, normalizeComponentName: (name: string) => string, root?: string, packageRoot?: string): void;
|
|
16
16
|
export declare function updateMiniProgramGlobalComponents(filename: string, ast: Program, { inputDir, resolve, normalizeComponentName, root, }: {
|
|
17
17
|
inputDir: string;
|
|
18
18
|
resolve: ParseDescriptor['resolve'];
|
|
@@ -21,7 +21,7 @@ export declare function updateMiniProgramGlobalComponents(filename: string, ast:
|
|
|
21
21
|
}): Promise<{
|
|
22
22
|
imports: ImportDeclaration[];
|
|
23
23
|
}>;
|
|
24
|
-
export declare function updateMiniProgramComponentsByMainFilename(mainFilename: string, inputDir: string, normalizeComponentName: (name: string) => string, root?: string): void;
|
|
24
|
+
export declare function updateMiniProgramComponentsByMainFilename(mainFilename: string, inputDir: string, normalizeComponentName: (name: string) => string, root?: string, packageRoot?: string): void;
|
|
25
25
|
export interface TemplateDescriptor {
|
|
26
26
|
bindingComponents: BindingComponents;
|
|
27
27
|
imports: ImportDeclaration[];
|
|
@@ -13,6 +13,7 @@ const messages_1 = require("../messages");
|
|
|
13
13
|
const constants_1 = require("../constants");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
15
|
const utils_2 = require("../vite/utils");
|
|
16
|
+
const x_1 = require("../x");
|
|
16
17
|
const jsonFile_1 = require("../json/mp/jsonFile");
|
|
17
18
|
const subpackage_1 = require("../json/mp/subpackage");
|
|
18
19
|
const mainDescriptors = new Map();
|
|
@@ -94,17 +95,17 @@ function updateMainDescriptorIndex(mainDescriptorKey, descriptor) {
|
|
|
94
95
|
scriptDescriptorMainMap.set(descriptor.script, mainDescriptorKey);
|
|
95
96
|
templateDescriptorMainMap.set(descriptor.template, mainDescriptorKey);
|
|
96
97
|
}
|
|
97
|
-
function updateMiniProgramComponentsByScriptFilename(scriptFilename, inputDir, normalizeComponentName, root) {
|
|
98
|
+
function updateMiniProgramComponentsByScriptFilename(scriptFilename, inputDir, normalizeComponentName, root, packageRoot) {
|
|
98
99
|
const mainFilename = findMainFilenameByScriptFilename(createDescriptorKey(scriptFilename, root));
|
|
99
100
|
if (mainFilename) {
|
|
100
|
-
updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName, root);
|
|
101
|
+
updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName, root, packageRoot);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
exports.updateMiniProgramComponentsByScriptFilename = updateMiniProgramComponentsByScriptFilename;
|
|
104
|
-
function updateMiniProgramComponentsByTemplateFilename(templateFilename, inputDir, normalizeComponentName, root) {
|
|
105
|
+
function updateMiniProgramComponentsByTemplateFilename(templateFilename, inputDir, normalizeComponentName, root, packageRoot) {
|
|
105
106
|
const mainFilename = findMainFilenameByTemplateFilename(createDescriptorKey(templateFilename, root));
|
|
106
107
|
if (mainFilename) {
|
|
107
|
-
updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName, root);
|
|
108
|
+
updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName, root, packageRoot);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
exports.updateMiniProgramComponentsByTemplateFilename = updateMiniProgramComponentsByTemplateFilename;
|
|
@@ -126,14 +127,18 @@ async function updateMiniProgramGlobalComponents(filename, ast, { inputDir, reso
|
|
|
126
127
|
globalComponentSourceMap.set(bindingComponents[name].tag, (0, subpackage_1.withoutIndependentRoot)(value));
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
|
-
(0, jsonFile_1.addMiniProgramUsingComponents)('app', createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName));
|
|
130
|
+
(0, jsonFile_1.addMiniProgramUsingComponents)('app', createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName, undefined, undefined, !!root));
|
|
130
131
|
return {
|
|
131
132
|
imports,
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
exports.updateMiniProgramGlobalComponents = updateMiniProgramGlobalComponents;
|
|
135
|
-
function createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName) {
|
|
136
|
+
function createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName, ownerFilename, ownerPackageRoot, ownerIsIndependent) {
|
|
136
137
|
const usingComponents = {};
|
|
138
|
+
const ownerSubPackageRoot = (0, x_1.isUniAppX)() && !ownerIsIndependent
|
|
139
|
+
? ownerPackageRoot ||
|
|
140
|
+
(ownerFilename && (0, jsonFile_1.findMiniProgramSubPackageRoot)(ownerFilename))
|
|
141
|
+
: undefined;
|
|
137
142
|
imports.forEach(({ source: { value }, specifiers: [specifier] }) => {
|
|
138
143
|
const { name } = specifier.local;
|
|
139
144
|
if (!bindingComponents[name]) {
|
|
@@ -141,12 +146,23 @@ function createUsingComponents(bindingComponents, imports, inputDir, normalizeCo
|
|
|
141
146
|
}
|
|
142
147
|
const componentName = normalizeComponentName((0, shared_1.hyphenate)(bindingComponents[name].tag));
|
|
143
148
|
if (!usingComponents[componentName]) {
|
|
144
|
-
|
|
149
|
+
let componentFilename = (0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)((0, subpackage_1.withoutIndependentRoot)(value), inputDir));
|
|
150
|
+
if ((0, x_1.isUniAppX)() &&
|
|
151
|
+
!ownerIsIndependent &&
|
|
152
|
+
componentFilename.startsWith('uni_modules/')) {
|
|
153
|
+
(0, jsonFile_1.addMiniProgramComponentPackageRoot)(componentFilename, ownerSubPackageRoot);
|
|
154
|
+
const componentPackageRoot = (0, jsonFile_1.resolveMiniProgramComponentPackageRoot)(componentFilename, ownerSubPackageRoot);
|
|
155
|
+
if (ownerSubPackageRoot &&
|
|
156
|
+
componentPackageRoot === ownerSubPackageRoot) {
|
|
157
|
+
componentFilename = `${ownerSubPackageRoot}/${componentFilename}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
usingComponents[componentName] = (0, uni_shared_1.addLeadingSlash)(componentFilename);
|
|
145
161
|
}
|
|
146
162
|
});
|
|
147
163
|
return usingComponents;
|
|
148
164
|
}
|
|
149
|
-
function updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName, root) {
|
|
165
|
+
function updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, normalizeComponentName, root, packageRoot) {
|
|
150
166
|
const mainDescriptor = mainDescriptors.get(createDescriptorKey(mainFilename, root));
|
|
151
167
|
if (!mainDescriptor) {
|
|
152
168
|
return;
|
|
@@ -164,7 +180,11 @@ function updateMiniProgramComponentsByMainFilename(mainFilename, inputDir, norma
|
|
|
164
180
|
...scriptDescriptor.setupBindingComponents,
|
|
165
181
|
}, scriptDescriptor.bindingComponents);
|
|
166
182
|
const imports = parseImports(mainDescriptor.imports, scriptDescriptor.imports, templateDescriptor.imports);
|
|
167
|
-
|
|
183
|
+
const normalizedOwnerFilename = (0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)((0, subpackage_1.withoutIndependentRoot)(mainFilename), inputDir));
|
|
184
|
+
const ownerFilename = packageRoot && normalizedOwnerFilename.startsWith('uni_modules/')
|
|
185
|
+
? `${packageRoot}/${normalizedOwnerFilename}`
|
|
186
|
+
: normalizedOwnerFilename;
|
|
187
|
+
(0, jsonFile_1.addMiniProgramUsingComponents)(ownerFilename, createUsingComponents(bindingComponents, imports, inputDir, normalizeComponentName, ownerFilename, root ? undefined : packageRoot, !!root));
|
|
168
188
|
}
|
|
169
189
|
exports.updateMiniProgramComponentsByMainFilename = updateMiniProgramComponentsByMainFilename;
|
|
170
190
|
function findBindingComponent(tag, bindingComponents) {
|
package/dist/resolve.js
CHANGED
|
@@ -47,11 +47,6 @@ exports.resolveMainPathOnce = (0, uni_shared_1.once)((inputDir) => {
|
|
|
47
47
|
if (fs_1.default.existsSync(mainTsPath)) {
|
|
48
48
|
return (0, utils_1.normalizePath)(mainTsPath);
|
|
49
49
|
}
|
|
50
|
-
if (process.env.UNI_APP_X === 'true' &&
|
|
51
|
-
process.env.UNI_UTS_PLATFORM === 'app-android' &&
|
|
52
|
-
process.env.UNI_APP_X_DOM2 !== 'true') {
|
|
53
|
-
throw new Error('uni-app x Android VDOM 模式仅支持 main.uts 或 main.ts 入口文件');
|
|
54
|
-
}
|
|
55
50
|
return (0, utils_1.normalizePath)(path_1.default.resolve(inputDir, 'main.js'));
|
|
56
51
|
});
|
|
57
52
|
const ownerModules = [
|
package/dist/uasm.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export interface LoadUasmTransformOptions {
|
|
|
12
12
|
}
|
|
13
13
|
export interface LoadUasmTransformerOptions extends LoadUasmTransformOptions {
|
|
14
14
|
typescript: TypeScriptCompiler;
|
|
15
|
-
methodNames?: readonly string[];
|
|
16
15
|
resolveLoader?: (modulePath: string) => ResolvedUasmLoader | undefined;
|
|
17
16
|
onSourceEdit?: (edit: UasmSourceEdit) => void;
|
|
18
17
|
resolveError?: (modulePath: string) => string;
|
package/dist/uasm.js
CHANGED
|
@@ -68,7 +68,6 @@ function initUasmWebTransformOptions() {
|
|
|
68
68
|
createLoadUasmTransformer(options) {
|
|
69
69
|
return createLoadUasmTransformer({
|
|
70
70
|
...options,
|
|
71
|
-
methodNames: ['loadUasm'],
|
|
72
71
|
resolveError(modulePath) {
|
|
73
72
|
const moduleName = parseUasmModuleName(modulePath);
|
|
74
73
|
const entry = moduleName
|
|
@@ -93,7 +92,6 @@ function createUasmDiagnostic(options, sourceFile, node, messageText) {
|
|
|
93
92
|
}
|
|
94
93
|
function createLoadUasmTransformer(options) {
|
|
95
94
|
const { typescript, resolve, reportDiagnostic } = options;
|
|
96
|
-
const methodNames = new Set(options.methodNames || ['loadUasm', 'loadUasmSync']);
|
|
97
95
|
const targetArchs = options.targetArchs?.join(', ') || '未指定';
|
|
98
96
|
return (context) => {
|
|
99
97
|
const { factory } = context;
|
|
@@ -103,14 +101,13 @@ function createLoadUasmTransformer(options) {
|
|
|
103
101
|
if (typescript.isCallExpression(node) &&
|
|
104
102
|
node.arguments.length >= 1 &&
|
|
105
103
|
typescript.isPropertyAccessExpression(node.expression) &&
|
|
106
|
-
|
|
104
|
+
node.expression.name.escapedText === 'loadUASM' &&
|
|
107
105
|
typescript.isIdentifier(node.expression.expression) &&
|
|
108
106
|
node.expression.expression.escapedText === 'uni') {
|
|
109
|
-
const methodName = node.expression.name.text;
|
|
110
107
|
const firstArg = node.arguments[0];
|
|
111
108
|
if (!typescript.isStringLiteral(firstArg) &&
|
|
112
109
|
!typescript.isNoSubstitutionTemplateLiteral(firstArg)) {
|
|
113
|
-
reportDiagnostic(context, createUasmDiagnostic(options, sourceFile, firstArg,
|
|
110
|
+
reportDiagnostic(context, createUasmDiagnostic(options, sourceFile, firstArg, 'uni.loadUASM(modulePath) 的 modulePath 参数必须是字符串字面量'));
|
|
114
111
|
return node;
|
|
115
112
|
}
|
|
116
113
|
const resolved = resolve(firstArg.text);
|
|
@@ -226,7 +223,7 @@ function copyUasmIOSFrameworks(inputDir) {
|
|
|
226
223
|
return;
|
|
227
224
|
}
|
|
228
225
|
const libraryIdentifier = process.env.HX_RUN_DEVICE_TYPE === 'ios_simulator'
|
|
229
|
-
? 'ios-
|
|
226
|
+
? 'ios-arm64-simulator'
|
|
230
227
|
: 'ios-arm64';
|
|
231
228
|
const targetDir = node_path_1.default.resolve(dependenciesDir, 'modules');
|
|
232
229
|
for (const module of Object.values(uasmModules)) {
|
|
@@ -341,9 +338,6 @@ function parseUasmModuleName(modulePath) {
|
|
|
341
338
|
return /^uni_modules\/([^/]+)$/.exec(normalized)?.[1];
|
|
342
339
|
}
|
|
343
340
|
exports.parseUasmModuleName = parseUasmModuleName;
|
|
344
|
-
function resolveUasmLibraryFileName(moduleName) {
|
|
345
|
-
return `libUasm${(0, utils_1.capitalize)((0, utils_1.camelize)(moduleName))}.so`;
|
|
346
|
-
}
|
|
347
341
|
function resolveUasmWebLoad(modulePath) {
|
|
348
342
|
const moduleName = parseUasmModuleName(modulePath);
|
|
349
343
|
const entry = moduleName && uasmModules[moduleName]?.web?.entry;
|
|
@@ -365,7 +359,7 @@ function resolveUasmLoadPath(modulePath, platform, isProduction = (process.env.U
|
|
|
365
359
|
if (platform === 'app-ios') {
|
|
366
360
|
return moduleName;
|
|
367
361
|
}
|
|
368
|
-
const libraryName =
|
|
362
|
+
const libraryName = `lib${moduleName}.so`;
|
|
369
363
|
if (isProduction) {
|
|
370
364
|
return libraryName;
|
|
371
365
|
}
|
|
@@ -435,7 +429,7 @@ function scanUasmPlatform(inputDir, moduleName, platform) {
|
|
|
435
429
|
return;
|
|
436
430
|
}
|
|
437
431
|
const relativeArchDir = (0, utils_1.normalizePath)(node_path_1.default.join(relativeDir, entry.name));
|
|
438
|
-
const file = (0, utils_1.normalizePath)(node_path_1.default.join(relativeArchDir,
|
|
432
|
+
const file = (0, utils_1.normalizePath)(node_path_1.default.join(relativeArchDir, `lib${moduleName}.so`));
|
|
439
433
|
if (!fs_extra_1.default.existsSync(node_path_1.default.resolve(inputDir, file))) {
|
|
440
434
|
return;
|
|
441
435
|
}
|
package/dist/vite/autoImport.js
CHANGED
|
@@ -311,19 +311,13 @@ function initAutoImportOptions(platform, { imports = [], ...userOptions }) {
|
|
|
311
311
|
autoImport.push(utsJsPreset);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
|
|
315
|
-
const exclude = [
|
|
316
|
-
/[\\/]\.git[\\/]/,
|
|
317
|
-
// @dcloudio 包中的 JS 是自带完整导入的官方产物,正则扫描导出别名或继承类时可能误判,
|
|
318
|
-
// 进而产生自引用或重复声明。
|
|
319
|
-
/[\\/]@dcloudio[\\/].*\.js$/,
|
|
320
|
-
];
|
|
314
|
+
const exclude = [/[\\/]\.git[\\/]/];
|
|
321
315
|
if (process.env.UNI_INPUT_DIR) {
|
|
322
316
|
exclude.push(...(0, workers_1.resolveWorkersDir)(process.env.UNI_INPUT_DIR).map((dir) => (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, dir, '*'))));
|
|
323
317
|
}
|
|
324
318
|
return {
|
|
325
319
|
...userOptions,
|
|
326
|
-
include: [/\.
|
|
320
|
+
include: [/\.[u]?ts$/, /\.[u]?vue/],
|
|
327
321
|
exclude,
|
|
328
322
|
imports: imports.concat(
|
|
329
323
|
// 旧版 Android x 仍由专有编译流程处理,Android Vapor 对齐 iOS 走通用自动导入
|