@dcloudio/uni-cli-shared 2.0.2-4020920240930001 → 2.0.2-4040420241231001
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/components/ad-fullscreen-video.vue +2 -1
- package/components/ad-interstitial.vue +2 -1
- package/components/ad-rewarded-video.vue +4 -3
- package/components/ad.mixin.mp-weixin.js +245 -28
- package/components/uniad.vue +13 -2
- package/components/unicloud-db.vue +1 -1
- package/lib/platform.js +10 -4
- package/lib/preprocess.js +8 -8
- package/lib/uts/dataToEsm.js +154 -0
- package/lib/uts/uni_modules.js +52 -21
- package/lib/uts/uts-loader.js +152 -0
- package/lib/uts/uts-webpack-plugin.js +138 -0
- package/lib/uts/uts.js +240 -41
- package/license.md +1 -1
- package/package.json +3 -2
package/lib/uts/uts.js
CHANGED
|
@@ -3,9 +3,9 @@ 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.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
6
|
+
exports.isUniHelpers = exports.isUTSProxy = exports.tscOutDir = exports.uvueOutDir = exports.genUniExtApiDeclarationFileOnce = exports.initUTSSwiftAutoImportsOnce = exports.initUTSKotlinAutoImportsOnce = exports.resolveUniTypeScript = exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.getUTSComponentAutoImports = exports.isUTSComponent = exports.resolveUTSCompilerVersion = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
7
7
|
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts
|
|
8
|
-
const
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
11
11
|
const hbx_1 = require("./hbx");
|
|
@@ -27,7 +27,7 @@ function once(fn, ctx = null) {
|
|
|
27
27
|
* @param importer
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
|
-
function resolveUTSAppModule(id, importer, includeUTSSDK = true) {
|
|
30
|
+
function resolveUTSAppModule(platform, id, importer, includeUTSSDK = true) {
|
|
31
31
|
id = path_1.default.resolve(importer, id);
|
|
32
32
|
if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) {
|
|
33
33
|
const parts = (0, utils_1.normalizePath)(id).split('/');
|
|
@@ -35,13 +35,29 @@ function resolveUTSAppModule(id, importer, includeUTSSDK = true) {
|
|
|
35
35
|
if (parentDir === 'uni_modules' ||
|
|
36
36
|
(includeUTSSDK && parentDir === 'utssdk')) {
|
|
37
37
|
const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
|
|
38
|
-
if (
|
|
38
|
+
if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') {
|
|
39
|
+
// js engine
|
|
40
|
+
if (parentDir === 'uni_modules') {
|
|
41
|
+
const appJsIndex = path_1.default.resolve(id, basedir, 'app-js', 'index.uts');
|
|
42
|
+
if (fs_extra_1.default.existsSync(appJsIndex)) {
|
|
43
|
+
return appJsIndex;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (fs_extra_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) {
|
|
39
48
|
return id;
|
|
40
49
|
}
|
|
50
|
+
const fileName = id.split('?')[0];
|
|
41
51
|
const resolvePlatformDir = (p) => {
|
|
42
|
-
return path_1.default.resolve(
|
|
52
|
+
return path_1.default.resolve(fileName, basedir, p);
|
|
43
53
|
};
|
|
44
|
-
const extname = ['.uts'];
|
|
54
|
+
const extname = ['.uts', '.vue', '.uvue'];
|
|
55
|
+
if (platform === 'app-harmony') {
|
|
56
|
+
if (resolveUTSFile(resolvePlatformDir(platform), extname)) {
|
|
57
|
+
return id;
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
45
61
|
if (resolveUTSFile(resolvePlatformDir('app-android'), extname)) {
|
|
46
62
|
return id;
|
|
47
63
|
}
|
|
@@ -55,8 +71,9 @@ exports.resolveUTSAppModule = resolveUTSAppModule;
|
|
|
55
71
|
// 仅限 root/uni_modules/test-plugin | root/utssdk/test-plugin 格式
|
|
56
72
|
function resolveUTSModule(id, importer, includeUTSSDK = true) {
|
|
57
73
|
if (process.env.UNI_PLATFORM === 'app' ||
|
|
58
|
-
process.env.UNI_PLATFORM === 'app-plus'
|
|
59
|
-
|
|
74
|
+
process.env.UNI_PLATFORM === 'app-plus' ||
|
|
75
|
+
process.env.UNI_PLATFORM === 'app-harmony') {
|
|
76
|
+
return resolveUTSAppModule(process.env.UNI_UTS_PLATFORM, id, importer);
|
|
60
77
|
}
|
|
61
78
|
id = path_1.default.resolve(importer, id);
|
|
62
79
|
if (id.includes('uni_modules') || (includeUTSSDK && id.includes('utssdk'))) {
|
|
@@ -73,7 +90,7 @@ function resolveUTSModule(id, importer, includeUTSSDK = true) {
|
|
|
73
90
|
return index;
|
|
74
91
|
}
|
|
75
92
|
index = path_1.default.resolve(id, basedir, 'index.uts');
|
|
76
|
-
if (
|
|
93
|
+
if (fs_extra_1.default.existsSync(index)) {
|
|
77
94
|
return index;
|
|
78
95
|
}
|
|
79
96
|
}
|
|
@@ -83,13 +100,17 @@ exports.resolveUTSModule = resolveUTSModule;
|
|
|
83
100
|
function resolveUTSFile(dir, extensions = ['.uts', '.ts', '.js']) {
|
|
84
101
|
for (let i = 0; i < extensions.length; i++) {
|
|
85
102
|
const indexFile = path_1.default.join(dir, 'index' + extensions[i]);
|
|
86
|
-
if (
|
|
103
|
+
if (fs_extra_1.default.existsSync(indexFile)) {
|
|
87
104
|
return indexFile;
|
|
88
105
|
}
|
|
89
106
|
}
|
|
90
107
|
}
|
|
91
|
-
function resolveUTSCompiler() {
|
|
108
|
+
function resolveUTSCompiler(throwError = false) {
|
|
92
109
|
let compilerPath = '';
|
|
110
|
+
if (process.env.UNI_COMPILE_TARGET === 'ext-api' &&
|
|
111
|
+
process.env.UNI_APP_NEXT_WORKSPACE) {
|
|
112
|
+
return require(path_1.default.resolve(process.env.UNI_APP_NEXT_WORKSPACE, 'packages/uni-uts-v1'));
|
|
113
|
+
}
|
|
93
114
|
if ((0, hbx_1.isInHBuilderX)()) {
|
|
94
115
|
try {
|
|
95
116
|
compilerPath = require.resolve(path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'uniapp-uts-v1'));
|
|
@@ -99,36 +120,60 @@ function resolveUTSCompiler() {
|
|
|
99
120
|
if (!compilerPath) {
|
|
100
121
|
try {
|
|
101
122
|
compilerPath = require.resolve('@dcloudio/uni-uts-v1', {
|
|
102
|
-
paths: [process.env.UNI_CLI_CONTEXT],
|
|
123
|
+
paths: [process.env.UNI_CLI_CONTEXT || process.cwd()],
|
|
103
124
|
});
|
|
104
125
|
}
|
|
105
126
|
catch (e) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
utsCompilerVersion = require('../package.json').version;
|
|
109
|
-
}
|
|
110
|
-
catch (e) {
|
|
111
|
-
try {
|
|
112
|
-
// vue2
|
|
113
|
-
utsCompilerVersion = require('../../package.json').version;
|
|
114
|
-
}
|
|
115
|
-
catch (e) { }
|
|
116
|
-
}
|
|
117
|
-
if (utsCompilerVersion.startsWith('2.0.')) {
|
|
118
|
-
utsCompilerVersion = '^3.0.0-alpha-3060920221117001';
|
|
127
|
+
if (throwError) {
|
|
128
|
+
throw `Error: Cannot find module '@dcloudio/uni-uts-v1'`;
|
|
119
129
|
}
|
|
120
|
-
console.error((0, utils_1.installDepTips)('devDependencies', '@dcloudio/uni-uts-v1',
|
|
130
|
+
console.error((0, utils_1.installDepTips)('devDependencies', '@dcloudio/uni-uts-v1', resolveUTSCompilerVersion()));
|
|
121
131
|
process.exit(0);
|
|
122
132
|
}
|
|
123
133
|
}
|
|
124
134
|
return require(compilerPath);
|
|
125
135
|
}
|
|
126
136
|
exports.resolveUTSCompiler = resolveUTSCompiler;
|
|
137
|
+
function resolveUTSCompilerVersion() {
|
|
138
|
+
let utsCompilerVersion = '';
|
|
139
|
+
try {
|
|
140
|
+
utsCompilerVersion = require('../package.json').version;
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
try {
|
|
144
|
+
// vue2
|
|
145
|
+
utsCompilerVersion = require('../../package.json').version;
|
|
146
|
+
}
|
|
147
|
+
catch (e) { }
|
|
148
|
+
}
|
|
149
|
+
if (utsCompilerVersion.startsWith('2.0.')) {
|
|
150
|
+
utsCompilerVersion = '^3.0.0-alpha-3060920221117001';
|
|
151
|
+
}
|
|
152
|
+
return utsCompilerVersion;
|
|
153
|
+
}
|
|
154
|
+
exports.resolveUTSCompilerVersion = resolveUTSCompilerVersion;
|
|
127
155
|
const utsComponents = new Map();
|
|
128
156
|
function isUTSComponent(name) {
|
|
129
157
|
return utsComponents.has(name);
|
|
130
158
|
}
|
|
131
159
|
exports.isUTSComponent = isUTSComponent;
|
|
160
|
+
function getUTSComponentAutoImports(language) {
|
|
161
|
+
const utsComponentAutoImports = {};
|
|
162
|
+
utsComponents.forEach(({ kotlinPackage, swiftModule }, name) => {
|
|
163
|
+
const source = language === 'kotlin' ? kotlinPackage : swiftModule;
|
|
164
|
+
const className = (0, utils_1.capitalize)((0, utils_1.camelize)(name)) + 'Element';
|
|
165
|
+
if (!utsComponentAutoImports[source]) {
|
|
166
|
+
utsComponentAutoImports[source] = [[className]];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
if (!utsComponentAutoImports[source].find((item) => item[0] === className)) {
|
|
170
|
+
utsComponentAutoImports[source].push([className]);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return utsComponentAutoImports;
|
|
175
|
+
}
|
|
176
|
+
exports.getUTSComponentAutoImports = getUTSComponentAutoImports;
|
|
132
177
|
function parseUTSComponent(name, type) {
|
|
133
178
|
const meta = utsComponents.get(name);
|
|
134
179
|
if (meta) {
|
|
@@ -155,9 +200,14 @@ function initUTSComponents(inputDir, platform) {
|
|
|
155
200
|
? path_1.default.basename(path_1.default.dirname(dir))
|
|
156
201
|
: path_1.default.basename(dir);
|
|
157
202
|
if (is_uni_modules_utssdk || is_ussdk) {
|
|
203
|
+
// dir 是 uni_modules/test-plugin/utssdk 或者 utssdk/test-plugin
|
|
204
|
+
// 需要分平台解析,不能直接解析 utssdk 目录下的文件,因为 utssdk 目录下可能存在多个平台的文件
|
|
205
|
+
const cwd = isApp
|
|
206
|
+
? dir
|
|
207
|
+
: path_1.default.join(dir, platform === 'h5' ? 'web' : platform);
|
|
158
208
|
fast_glob_1.default
|
|
159
209
|
.sync('**/*.vue', {
|
|
160
|
-
cwd
|
|
210
|
+
cwd,
|
|
161
211
|
absolute: true,
|
|
162
212
|
})
|
|
163
213
|
.forEach((file) => {
|
|
@@ -168,9 +218,12 @@ function initUTSComponents(inputDir, platform) {
|
|
|
168
218
|
}
|
|
169
219
|
}
|
|
170
220
|
if (name) {
|
|
171
|
-
const
|
|
221
|
+
const source = '@/' +
|
|
222
|
+
(0, utils_1.normalizePath)(isApp
|
|
223
|
+
? path_1.default.relative(inputDir, is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir)
|
|
224
|
+
: path_1.default.relative(inputDir, file));
|
|
172
225
|
easycomsObj[`^${name}$`] = {
|
|
173
|
-
source: isApp ? `${
|
|
226
|
+
source: isApp ? `${source}?uts-proxy` : source,
|
|
174
227
|
kotlinPackage: parseKotlinPackageWithPluginId(pluginId, is_uni_modules_utssdk),
|
|
175
228
|
swiftModule: parseSwiftPackageWithPluginId(pluginId, is_uni_modules_utssdk),
|
|
176
229
|
};
|
|
@@ -198,21 +251,23 @@ exports.initUTSComponents = initUTSComponents;
|
|
|
198
251
|
function resolveUTSComponentDirs(inputDir) {
|
|
199
252
|
const utssdkDir = path_1.default.resolve(inputDir, 'utssdk');
|
|
200
253
|
const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
201
|
-
return
|
|
202
|
-
.sync('*', {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.concat(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
254
|
+
return (fs_extra_1.default.existsSync(utssdkDir)
|
|
255
|
+
? fast_glob_1.default.sync('*', {
|
|
256
|
+
cwd: utssdkDir,
|
|
257
|
+
absolute: true,
|
|
258
|
+
onlyDirectories: true,
|
|
259
|
+
})
|
|
260
|
+
: []).concat(fs_extra_1.default.existsSync(uniModulesDir)
|
|
261
|
+
? fast_glob_1.default.sync('*/utssdk', {
|
|
262
|
+
cwd: uniModulesDir,
|
|
263
|
+
absolute: true,
|
|
264
|
+
onlyDirectories: true,
|
|
265
|
+
})
|
|
266
|
+
: []);
|
|
212
267
|
}
|
|
213
268
|
const nameRE = /name\s*:\s*['|"](.*)['|"]/;
|
|
214
269
|
function parseVueComponentName(file) {
|
|
215
|
-
const content =
|
|
270
|
+
const content = fs_extra_1.default.readFileSync(file, 'utf8');
|
|
216
271
|
const matches = content.match(nameRE);
|
|
217
272
|
if (matches) {
|
|
218
273
|
return matches[1];
|
|
@@ -235,6 +290,54 @@ function parseSwiftPackageWithPluginId(id, is_uni_modules) {
|
|
|
235
290
|
(0, utils_1.capitalize)((0, utils_1.camelize)(prefix(id))));
|
|
236
291
|
}
|
|
237
292
|
exports.parseSwiftPackageWithPluginId = parseSwiftPackageWithPluginId;
|
|
293
|
+
async function parseUniExtApiAutoImports(uniExtApiAutoImports, extApis, parseSource) {
|
|
294
|
+
if (Object.keys(extApis).length) {
|
|
295
|
+
const { parseExportIdentifiers } = resolveUTSCompiler();
|
|
296
|
+
for (const name in extApis) {
|
|
297
|
+
const options = extApis[name];
|
|
298
|
+
if ((0, utils_1.isArray)(options) && options.length >= 2) {
|
|
299
|
+
const pluginId = path_1.default.basename(options[0]);
|
|
300
|
+
const source = parseSource(pluginId);
|
|
301
|
+
if (uniExtApiAutoImports[source]) {
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
uniExtApiAutoImports[source] = [];
|
|
305
|
+
const filename = `uni_modules/${pluginId}/utssdk/interface.uts`;
|
|
306
|
+
const interfaceFileName = path_1.default.resolve(process.env.UNI_INPUT_DIR, filename);
|
|
307
|
+
if (fs_extra_1.default.existsSync(interfaceFileName)) {
|
|
308
|
+
const ids = await parseExportIdentifiers(interfaceFileName);
|
|
309
|
+
ids
|
|
310
|
+
// 过滤掉 Uni
|
|
311
|
+
.filter((id) => id !== 'Uni')
|
|
312
|
+
.forEach((id) => {
|
|
313
|
+
uniExtApiAutoImports[source].push([id]);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return uniExtApiAutoImports;
|
|
320
|
+
}
|
|
321
|
+
let uniExtApiKotlinAutoImports = null;
|
|
322
|
+
async function parseUniExtApiKotlinAutoImportsOnce(extApis) {
|
|
323
|
+
if (uniExtApiKotlinAutoImports) {
|
|
324
|
+
return uniExtApiKotlinAutoImports;
|
|
325
|
+
}
|
|
326
|
+
uniExtApiKotlinAutoImports = {};
|
|
327
|
+
return parseUniExtApiAutoImports(uniExtApiKotlinAutoImports, extApis, (pluginId) => {
|
|
328
|
+
return parseKotlinPackageWithPluginId(pluginId, true);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
let uniExtApiSwiftAutoImports = null;
|
|
332
|
+
async function parseUniExtApiSwiftAutoImportsOnce(extApis) {
|
|
333
|
+
if (uniExtApiSwiftAutoImports) {
|
|
334
|
+
return uniExtApiSwiftAutoImports;
|
|
335
|
+
}
|
|
336
|
+
uniExtApiSwiftAutoImports = {};
|
|
337
|
+
return parseUniExtApiAutoImports(uniExtApiSwiftAutoImports, extApis, (pluginId) => {
|
|
338
|
+
return parseSwiftPackageWithPluginId(pluginId, true);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
238
341
|
exports.parseUniExtApiNamespacesOnce = once((platform, language) => {
|
|
239
342
|
const extApis = (0, exports.parseUniExtApiNamespacesJsOnce)(platform, language);
|
|
240
343
|
const namespaces = {};
|
|
@@ -263,3 +366,99 @@ exports.parseUniExtApiNamespacesJsOnce = once((platform, language) => {
|
|
|
263
366
|
});
|
|
264
367
|
return namespaces;
|
|
265
368
|
});
|
|
369
|
+
function resolveUniTypeScript() {
|
|
370
|
+
if ((0, hbx_1.isInHBuilderX)()) {
|
|
371
|
+
return require(path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'uniapp-uts-v1', 'node_modules', '@dcloudio', 'uni-uts-v1', 'lib', 'typescript'));
|
|
372
|
+
}
|
|
373
|
+
return require('@dcloudio/uni-uts-v1/lib/typescript');
|
|
374
|
+
}
|
|
375
|
+
exports.resolveUniTypeScript = resolveUniTypeScript;
|
|
376
|
+
async function initUTSAutoImports(autoImports, platform, language) {
|
|
377
|
+
const utsComponents = getUTSComponentAutoImports(language);
|
|
378
|
+
Object.keys(utsComponents).forEach((source) => {
|
|
379
|
+
if (autoImports[source]) {
|
|
380
|
+
autoImports[source].push(...utsComponents[source]);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
autoImports[source] = utsComponents[source];
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
const extApis = (0, uni_modules_1.parseUniExtApis)(true, platform, language);
|
|
387
|
+
const extApiImports = await (language === 'kotlin'
|
|
388
|
+
? parseUniExtApiKotlinAutoImportsOnce
|
|
389
|
+
: parseUniExtApiSwiftAutoImportsOnce)(extApis);
|
|
390
|
+
Object.keys(extApiImports).forEach((source) => {
|
|
391
|
+
if (autoImports[source]) {
|
|
392
|
+
autoImports[source].push(...extApiImports[source]);
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
autoImports[source] = extApiImports[source];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
return autoImports;
|
|
399
|
+
}
|
|
400
|
+
let autoKotlinImports = null;
|
|
401
|
+
async function initUTSKotlinAutoImportsOnce() {
|
|
402
|
+
if (autoKotlinImports) {
|
|
403
|
+
return autoKotlinImports;
|
|
404
|
+
}
|
|
405
|
+
autoKotlinImports = {};
|
|
406
|
+
return initUTSAutoImports(autoKotlinImports, 'app-android', 'kotlin');
|
|
407
|
+
}
|
|
408
|
+
exports.initUTSKotlinAutoImportsOnce = initUTSKotlinAutoImportsOnce;
|
|
409
|
+
let autoSwiftImports = null;
|
|
410
|
+
async function initUTSSwiftAutoImportsOnce() {
|
|
411
|
+
if (autoSwiftImports) {
|
|
412
|
+
return autoSwiftImports;
|
|
413
|
+
}
|
|
414
|
+
autoSwiftImports = {};
|
|
415
|
+
return initUTSAutoImports(autoSwiftImports, 'app-ios', 'swift');
|
|
416
|
+
}
|
|
417
|
+
exports.initUTSSwiftAutoImportsOnce = initUTSSwiftAutoImportsOnce;
|
|
418
|
+
exports.genUniExtApiDeclarationFileOnce = once((tscInputDir) => {
|
|
419
|
+
const extApis = (0, uni_modules_1.parseUniExtApis)(true, 'app-android', 'kotlin');
|
|
420
|
+
// 之所以往上一级写,是因为 tscInputDir 会被 empty,目前时机有问题,比如先生成了d.ts,又被empty
|
|
421
|
+
const fileName = path_1.default.resolve(tscInputDir, '../uni-ext-api.d.ts');
|
|
422
|
+
if (fs_extra_1.default.existsSync(fileName)) {
|
|
423
|
+
try {
|
|
424
|
+
// 先删除
|
|
425
|
+
fs_extra_1.default.unlinkSync(fileName);
|
|
426
|
+
}
|
|
427
|
+
catch (e) { }
|
|
428
|
+
}
|
|
429
|
+
if (Object.keys(extApis).length) {
|
|
430
|
+
const apis = [];
|
|
431
|
+
for (const name in extApis) {
|
|
432
|
+
const options = extApis[name];
|
|
433
|
+
if ((0, utils_1.isArray)(options) && options.length >= 2) {
|
|
434
|
+
const api = name.replace('uni.', '');
|
|
435
|
+
apis.push(' ' + api + `: typeof import("${options[0]}")["${options[1]}"]`);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (apis.length) {
|
|
439
|
+
fs_extra_1.default.outputFileSync(fileName, `
|
|
440
|
+
interface Uni {
|
|
441
|
+
${apis.join('\n')}
|
|
442
|
+
}
|
|
443
|
+
`);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
function uvueOutDir(platform) {
|
|
448
|
+
return path_1.default.join(process.env.UNI_APP_X_UVUE_DIR, platform);
|
|
449
|
+
}
|
|
450
|
+
exports.uvueOutDir = uvueOutDir;
|
|
451
|
+
function tscOutDir(platform) {
|
|
452
|
+
return path_1.default.join(process.env.UNI_APP_X_TSC_DIR, platform);
|
|
453
|
+
}
|
|
454
|
+
exports.tscOutDir = tscOutDir;
|
|
455
|
+
const UTSProxyRE = /\?uts-proxy$/;
|
|
456
|
+
const UniHelpersRE = /\?uni_helpers$/;
|
|
457
|
+
function isUTSProxy(id) {
|
|
458
|
+
return UTSProxyRE.test(id);
|
|
459
|
+
}
|
|
460
|
+
exports.isUTSProxy = isUTSProxy;
|
|
461
|
+
function isUniHelpers(id) {
|
|
462
|
+
return UniHelpersRE.test(id);
|
|
463
|
+
}
|
|
464
|
+
exports.isUniHelpers = isUniHelpers;
|
package/license.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[https://
|
|
1
|
+
[https://dcloud.io/license/uni-app.html](https://dcloud.io/license/uni-app.html)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-4040420241231001",
|
|
4
4
|
"description": "uni-cli-shared",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"escape-string-regexp": "^4.0.0",
|
|
23
23
|
"fast-glob": "^3.2.11",
|
|
24
|
+
"fs-extra": "^10.0.0",
|
|
24
25
|
"glob-escape": "^0.0.2",
|
|
25
26
|
"hash-sum": "^1.0.2",
|
|
26
27
|
"postcss-urlrewrite": "^0.2.2",
|
|
27
28
|
"strip-json-comments": "^2.0.1"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "f5a282a67f3eda3204e8fa48882b129f47c17cd3"
|
|
30
31
|
}
|