@tmsfe/tmskit 0.0.6 → 0.0.7
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/README.md +27 -27
- package/dist/index.cjs.js +332 -407
- package/main.js +3 -3
- package/package.json +75 -75
- package/src/config/constant.js +71 -71
- package/src/config/defaultTmsConfig.js +16 -16
- package/src/entry.js +60 -60
- package/src/gulp/build.js +5 -5
- package/src/gulp/compile.js +81 -87
- package/src/gulp/dev.js +102 -102
- package/src/gulp/plugins/less.js +116 -116
- package/src/gulp/plugins/mpCommonDep.js +131 -131
- package/src/gulp/plugins/mpJsonDep.js +108 -108
- package/src/gulp/plugins/mpWxmlDep.js +194 -194
- package/src/gulp/plugins/postcss-font-base64.js +72 -72
- package/src/gulp/plugins/replaceEnv.js +29 -29
- package/src/gulp/plugins/utils/pluginError.js +25 -25
- package/src/index.js +62 -62
- package/src/init.js +33 -33
- package/src/scripts/create/ask.js +63 -63
- package/src/scripts/create/generator.js +25 -25
- package/src/scripts/create/ignoreFiles.js +7 -7
- package/src/scripts/create/index.js +72 -72
- package/src/scripts/create/render.js +19 -19
- package/src/scripts/run/build/index.js +17 -17
- package/src/scripts/run/dev/index.js +84 -84
- package/src/scripts/run/index.js +68 -68
- package/src/scripts/run/init/index.js +87 -87
- package/src/scripts/run/install/index.js +29 -29
- package/src/utils/buildAppJson.js +221 -221
- package/src/utils/checkDependencies.js +77 -77
- package/src/utils/cliUtils.js +35 -35
- package/src/utils/cloneModules.js +116 -116
- package/src/utils/findCssImport.js +30 -30
- package/src/utils/global.js +36 -36
- package/src/utils/handleError.js +16 -16
- package/src/utils/io.js +106 -106
- package/src/utils/log.js +44 -44
- package/src/utils/mpCiUtils.js +73 -73
- package/src/utils/npmUtils.js +166 -166
- package/src/utils/tkitUtils.js +158 -158
- package/src/utils/widgets.js +167 -167
package/dist/index.cjs.js
CHANGED
|
@@ -21,11 +21,9 @@ var require$$0$7 = require('through2');
|
|
|
21
21
|
var require$$0$8 = require('strip-comments');
|
|
22
22
|
var require$$1$4 = require('precinct');
|
|
23
23
|
var require$$1$5 = require('htmlparser2');
|
|
24
|
-
var require$$0$9 = require('
|
|
25
|
-
var require$$0$a = require('gulp');
|
|
24
|
+
var require$$0$9 = require('gulp');
|
|
26
25
|
var require$$1$6 = require('gulp-px-to-rpx');
|
|
27
|
-
var require$$2$2 = require('gulp-
|
|
28
|
-
var require$$3$2 = require('gulp-watch');
|
|
26
|
+
var require$$2$2 = require('gulp-watch');
|
|
29
27
|
var require$$1$7 = require('semver');
|
|
30
28
|
|
|
31
29
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
@@ -52,10 +50,8 @@ var require$$0__default$8 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8);
|
|
|
52
50
|
var require$$1__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$1$4);
|
|
53
51
|
var require$$1__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$1$5);
|
|
54
52
|
var require$$0__default$9 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
|
|
55
|
-
var require$$0__default$a = /*#__PURE__*/_interopDefaultLegacy(require$$0$a);
|
|
56
53
|
var require$$1__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$1$6);
|
|
57
54
|
var require$$2__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$2$2);
|
|
58
|
-
var require$$3__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$3$2);
|
|
59
55
|
var require$$1__default$7 = /*#__PURE__*/_interopDefaultLegacy(require$$1$7);
|
|
60
56
|
|
|
61
57
|
function getAugmentedNamespace(n) {
|
|
@@ -78,8 +74,8 @@ var src$2 = {};
|
|
|
78
74
|
const program$1 = require$$0__default;
|
|
79
75
|
const leven = require$$1__default;
|
|
80
76
|
const ora = require$$2__default;
|
|
81
|
-
const path$
|
|
82
|
-
const fs$
|
|
77
|
+
const path$a = require$$3__default;
|
|
78
|
+
const fs$d = require$$0__default$1;
|
|
83
79
|
const shelljs$6 = require$$4__default;
|
|
84
80
|
const download = require$$6__default;
|
|
85
81
|
const chalk$3 = require$$0__default$2;
|
|
@@ -90,18 +86,18 @@ const shelljsOptions = {
|
|
|
90
86
|
const cwd = process.cwd();
|
|
91
87
|
|
|
92
88
|
function resolve$d(...args) {
|
|
93
|
-
return path$
|
|
89
|
+
return path$a.resolve(cwd, ...args);
|
|
94
90
|
}
|
|
95
|
-
/**
|
|
96
|
-
* 封装logs
|
|
97
|
-
* @returns {Undefined} 无需返回值
|
|
91
|
+
/**
|
|
92
|
+
* 封装logs
|
|
93
|
+
* @returns {Undefined} 无需返回值
|
|
98
94
|
*/
|
|
99
95
|
|
|
100
96
|
const log$3 = (...args) => console.log(...args);
|
|
101
|
-
/**
|
|
102
|
-
* 用户输入命令时,进行提示
|
|
103
|
-
* @param {String} unknownCommand 非预期的命令
|
|
104
|
-
* @returns {Undefined} 无需返回值
|
|
97
|
+
/**
|
|
98
|
+
* 用户输入命令时,进行提示
|
|
99
|
+
* @param {String} unknownCommand 非预期的命令
|
|
100
|
+
* @returns {Undefined} 无需返回值
|
|
105
101
|
*/
|
|
106
102
|
|
|
107
103
|
|
|
@@ -120,31 +116,31 @@ const suggestCommands$1 = unknownCommand => {
|
|
|
120
116
|
log$3(` ${chalk$3.red(`Did you mean ${chalk$3.yellow(suggestion)}?`)}`);
|
|
121
117
|
}
|
|
122
118
|
};
|
|
123
|
-
/**
|
|
124
|
-
* 判断变量是否是一个数组
|
|
125
|
-
* @param { unknown } obj 变量
|
|
126
|
-
* @returns { boolean } 是否是一个数组
|
|
119
|
+
/**
|
|
120
|
+
* 判断变量是否是一个数组
|
|
121
|
+
* @param { unknown } obj 变量
|
|
122
|
+
* @returns { boolean } 是否是一个数组
|
|
127
123
|
*/
|
|
128
124
|
|
|
129
125
|
|
|
130
126
|
function isObject$2(obj) {
|
|
131
127
|
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
132
128
|
}
|
|
133
|
-
/**
|
|
134
|
-
* 判断变量是否是一个对象
|
|
135
|
-
* @param { unknown } obj 变量
|
|
136
|
-
* @returns { boolean } 是否是一个对象
|
|
129
|
+
/**
|
|
130
|
+
* 判断变量是否是一个对象
|
|
131
|
+
* @param { unknown } obj 变量
|
|
132
|
+
* @returns { boolean } 是否是一个对象
|
|
137
133
|
*/
|
|
138
134
|
|
|
139
135
|
|
|
140
136
|
function isArray$1(obj) {
|
|
141
137
|
return Object.prototype.toString.call(obj) === '[object Array]';
|
|
142
138
|
}
|
|
143
|
-
/**
|
|
144
|
-
* 下载模块到目标目录
|
|
145
|
-
* @param { string } dest 目标地址
|
|
146
|
-
* @param { object } downloadOptions 模块下载配置 { repoUrl-仓库地址, gitUrl-git地址, branch-分支或者tag }
|
|
147
|
-
* @returns { undefined } no return
|
|
139
|
+
/**
|
|
140
|
+
* 下载模块到目标目录
|
|
141
|
+
* @param { string } dest 目标地址
|
|
142
|
+
* @param { object } downloadOptions 模块下载配置 { repoUrl-仓库地址, gitUrl-git地址, branch-分支或者tag }
|
|
143
|
+
* @returns { undefined } no return
|
|
148
144
|
*/
|
|
149
145
|
|
|
150
146
|
|
|
@@ -159,7 +155,7 @@ function downloadRepo(dest, downloadOptions = {
|
|
|
159
155
|
branch
|
|
160
156
|
} = downloadOptions;
|
|
161
157
|
|
|
162
|
-
if (fs$
|
|
158
|
+
if (fs$d.existsSync(dest)) {
|
|
163
159
|
shelljs$6.rm('-rf', dest);
|
|
164
160
|
}
|
|
165
161
|
|
|
@@ -178,12 +174,12 @@ function downloadRepo(dest, downloadOptions = {
|
|
|
178
174
|
});
|
|
179
175
|
});
|
|
180
176
|
}
|
|
181
|
-
/**
|
|
182
|
-
* 下载模块到目标目录备用方案
|
|
183
|
-
* @param { string } url 模块地址
|
|
184
|
-
* @param { string } dest 目标地址
|
|
185
|
-
* @param { string } branch 分支名
|
|
186
|
-
* @returns { undefined } no return
|
|
177
|
+
/**
|
|
178
|
+
* 下载模块到目标目录备用方案
|
|
179
|
+
* @param { string } url 模块地址
|
|
180
|
+
* @param { string } dest 目标地址
|
|
181
|
+
* @param { string } branch 分支名
|
|
182
|
+
* @returns { undefined } no return
|
|
187
183
|
*/
|
|
188
184
|
|
|
189
185
|
|
|
@@ -191,8 +187,8 @@ function downloadRepoForGit$2(url, dest, branch) {
|
|
|
191
187
|
const cwd = process.cwd();
|
|
192
188
|
return new Promise((resolve, reject) => {
|
|
193
189
|
// 如果目标目录不存在
|
|
194
|
-
if (fs$
|
|
195
|
-
shelljs$6.rm('-rf', path$
|
|
190
|
+
if (fs$d.existsSync(dest)) {
|
|
191
|
+
shelljs$6.rm('-rf', path$a.join(dest));
|
|
196
192
|
}
|
|
197
193
|
|
|
198
194
|
shelljs$6.mkdir('-p', dest);
|
|
@@ -207,20 +203,20 @@ function downloadRepoForGit$2(url, dest, branch) {
|
|
|
207
203
|
resolve();
|
|
208
204
|
});
|
|
209
205
|
}
|
|
210
|
-
/**
|
|
211
|
-
* 计算各项任务耗时
|
|
212
|
-
* @param {Number} start 任务开始时间
|
|
213
|
-
* @returns {Undefined} 无需返回值
|
|
206
|
+
/**
|
|
207
|
+
* 计算各项任务耗时
|
|
208
|
+
* @param {Number} start 任务开始时间
|
|
209
|
+
* @returns {Undefined} 无需返回值
|
|
214
210
|
*/
|
|
215
211
|
|
|
216
212
|
|
|
217
213
|
const cost = start => Date.now() - start;
|
|
218
|
-
/**
|
|
219
|
-
* 创建构建子任务
|
|
220
|
-
* @param {Function} task 子任务执行函数
|
|
221
|
-
* @param {String} startText 任务开始前提示语
|
|
222
|
-
* @param {String} endText 任务结束后提示语
|
|
223
|
-
* @returns {Undefined} 无需返回值
|
|
214
|
+
/**
|
|
215
|
+
* 创建构建子任务
|
|
216
|
+
* @param {Function} task 子任务执行函数
|
|
217
|
+
* @param {String} startText 任务开始前提示语
|
|
218
|
+
* @param {String} endText 任务结束后提示语
|
|
219
|
+
* @returns {Undefined} 无需返回值
|
|
224
220
|
*/
|
|
225
221
|
|
|
226
222
|
|
|
@@ -236,10 +232,10 @@ function createTask$4(task, startText, endText) {
|
|
|
236
232
|
return result;
|
|
237
233
|
};
|
|
238
234
|
}
|
|
239
|
-
/**
|
|
240
|
-
* 字符串驼峰化处理
|
|
241
|
-
* @param {String} str 需要处理的字符串
|
|
242
|
-
* @returns {String} 经过驼峰处理的字符串
|
|
235
|
+
/**
|
|
236
|
+
* 字符串驼峰化处理
|
|
237
|
+
* @param {String} str 需要处理的字符串
|
|
238
|
+
* @returns {String} 经过驼峰处理的字符串
|
|
243
239
|
*/
|
|
244
240
|
|
|
245
241
|
const camelize = str => str.replace(/-(\w)/g, (a, c) => c ? c.toUpperCase() : '');
|
|
@@ -256,18 +252,18 @@ var widgets = {
|
|
|
256
252
|
camelize
|
|
257
253
|
};
|
|
258
254
|
|
|
259
|
-
const path$
|
|
255
|
+
const path$9 = require('path'); // 用户目录
|
|
260
256
|
|
|
261
257
|
|
|
262
258
|
const HOME_DIR = process.env.HOME; // 所有文件的缓存目录
|
|
263
259
|
|
|
264
|
-
const CACHE_DIR$1 = path$
|
|
260
|
+
const CACHE_DIR$1 = path$9.resolve(HOME_DIR, '.tmskit'); // 脚手架模板代码所在目录
|
|
265
261
|
|
|
266
|
-
const TEMPLATE_DIR$1 = path$
|
|
262
|
+
const TEMPLATE_DIR$1 = path$9.resolve(CACHE_DIR$1, 'template'); // 第三方模块源码存放的临时缓存目录
|
|
267
263
|
|
|
268
|
-
const MODULE_CODE_DIR$1 = path$
|
|
264
|
+
const MODULE_CODE_DIR$1 = path$9.resolve(CACHE_DIR$1, 'modules_code'); // 脚手架模板代码的具体路径
|
|
269
265
|
|
|
270
|
-
const TEMPLATE_PATH$1 = path$
|
|
266
|
+
const TEMPLATE_PATH$1 = path$9.resolve(TEMPLATE_DIR$1, 'tools/tms-cli-template'); // 脚手架的名称
|
|
271
267
|
|
|
272
268
|
const TMS_NAME$2 = 'tmskit'; // 脚手架的配置名称
|
|
273
269
|
|
|
@@ -279,7 +275,7 @@ const DEFAULT_MODULE_DIR = 'modules'; // 模块的配置文件的名称
|
|
|
279
275
|
const MODULE_CONFIG_FILENAME$3 = 'module.config.json'; // 默认的webpack entry
|
|
280
276
|
|
|
281
277
|
const DEFAULT_WEBPACK_ENTRY = {
|
|
282
|
-
app: path$
|
|
278
|
+
app: path$9.resolve(process.cwd(), 'app')
|
|
283
279
|
}; // 默认从源码拷贝到编译后的配置
|
|
284
280
|
|
|
285
281
|
const DEFAULT_COPY_CONFIG$1 = ['package.json', 'sitemap.json']; // 开发模式
|
|
@@ -317,34 +313,34 @@ var constant = /*#__PURE__*/Object.freeze({
|
|
|
317
313
|
|
|
318
314
|
var require$$3 = /*@__PURE__*/getAugmentedNamespace(constant);
|
|
319
315
|
|
|
320
|
-
const fs$
|
|
321
|
-
const path$
|
|
322
|
-
/**
|
|
323
|
-
* 判断目录是否为空
|
|
324
|
-
* @param {string} dirname 目录名
|
|
325
|
-
* @returns
|
|
316
|
+
const fs$c = require$$0__default$1;
|
|
317
|
+
const path$8 = require$$3__default;
|
|
318
|
+
/**
|
|
319
|
+
* 判断目录是否为空
|
|
320
|
+
* @param {string} dirname 目录名
|
|
321
|
+
* @returns
|
|
326
322
|
*/
|
|
327
323
|
|
|
328
|
-
const isDirEmpty = dirname => fs$
|
|
324
|
+
const isDirEmpty = dirname => fs$c.promises.readdir(dirname).then(files => files.length === 0); // 判断是否是文件
|
|
329
325
|
|
|
330
326
|
|
|
331
327
|
const isFile = pathName => {
|
|
332
328
|
try {
|
|
333
|
-
const stat = fs$
|
|
329
|
+
const stat = fs$c.lstatSync(pathName);
|
|
334
330
|
return stat.isFile();
|
|
335
331
|
} catch {
|
|
336
332
|
return false;
|
|
337
333
|
}
|
|
338
334
|
};
|
|
339
|
-
/**
|
|
340
|
-
* 确保目录存在,不存在就创建一个
|
|
341
|
-
* @param {*} dirname 目录名
|
|
335
|
+
/**
|
|
336
|
+
* 确保目录存在,不存在就创建一个
|
|
337
|
+
* @param {*} dirname 目录名
|
|
342
338
|
*/
|
|
343
339
|
|
|
344
340
|
|
|
345
341
|
const ensureDirExist = dirname => {
|
|
346
|
-
if (!fs$
|
|
347
|
-
fs$
|
|
342
|
+
if (!fs$c.existsSync(dirname)) {
|
|
343
|
+
fs$c.mkdirSync(dirname, {
|
|
348
344
|
recursive: true
|
|
349
345
|
});
|
|
350
346
|
}
|
|
@@ -352,20 +348,20 @@ const ensureDirExist = dirname => {
|
|
|
352
348
|
|
|
353
349
|
|
|
354
350
|
const copyFile = function (src, dest) {
|
|
355
|
-
if (fs$
|
|
356
|
-
fs$
|
|
351
|
+
if (fs$c.existsSync(dest)) {
|
|
352
|
+
fs$c.unlinkSync(dest);
|
|
357
353
|
}
|
|
358
354
|
|
|
359
|
-
const dir = path$
|
|
355
|
+
const dir = path$8.dirname(dest);
|
|
360
356
|
ensureDirExist(dir);
|
|
361
|
-
fs$
|
|
357
|
+
fs$c.copyFileSync(src, dest);
|
|
362
358
|
}; // 判断文件内容是否一致,不一致再进行拷贝
|
|
363
359
|
|
|
364
360
|
|
|
365
361
|
function diffContentCopyFile$3(originFile, destFile) {
|
|
366
|
-
if (fs$
|
|
367
|
-
const depDestContent = fs$
|
|
368
|
-
const depOriginContent = fs$
|
|
362
|
+
if (fs$c.existsSync(destFile)) {
|
|
363
|
+
const depDestContent = fs$c.readFileSync(destFile, 'utf8');
|
|
364
|
+
const depOriginContent = fs$c.readFileSync(originFile, 'utf8');
|
|
369
365
|
|
|
370
366
|
if (depDestContent !== depOriginContent) {
|
|
371
367
|
console.log(`拷贝${originFile}内容到${destFile}`);
|
|
@@ -383,7 +379,7 @@ function ext$3(filePath, extensions) {
|
|
|
383
379
|
let extPath = ''; // try catch需要包裹:用来处理'./lib/timer'没有后缀的情况
|
|
384
380
|
|
|
385
381
|
try {
|
|
386
|
-
const stat = fs$
|
|
382
|
+
const stat = fs$c.lstatSync(newFilePath);
|
|
387
383
|
|
|
388
384
|
if (stat.isDirectory()) {
|
|
389
385
|
extPath = newFilePath[newFilePath.length - 1] === '/' ? 'index' : '/index';
|
|
@@ -394,7 +390,7 @@ function ext$3(filePath, extensions) {
|
|
|
394
390
|
for (const ext of extensions) {
|
|
395
391
|
const file = newFilePath.endsWith(ext) ? newFilePath : newFilePath + ext;
|
|
396
392
|
|
|
397
|
-
if (fs$
|
|
393
|
+
if (fs$c.existsSync(file)) {
|
|
398
394
|
return {
|
|
399
395
|
ext,
|
|
400
396
|
extPath: extPath + ext,
|
|
@@ -412,11 +408,11 @@ function ext$3(filePath, extensions) {
|
|
|
412
408
|
|
|
413
409
|
|
|
414
410
|
const fileInDir$3 = (dir, file) => {
|
|
415
|
-
if (!fs$
|
|
411
|
+
if (!fs$c.existsSync(dir) || !fs$c.existsSync(file)) {
|
|
416
412
|
return false;
|
|
417
413
|
}
|
|
418
414
|
|
|
419
|
-
const relativePath = path$
|
|
415
|
+
const relativePath = path$8.relative(dir, file);
|
|
420
416
|
|
|
421
417
|
if (relativePath.startsWith('..')) {
|
|
422
418
|
return false;
|
|
@@ -436,29 +432,29 @@ var io$2 = {
|
|
|
436
432
|
};
|
|
437
433
|
|
|
438
434
|
const chalk$2 = require$$0__default$2;
|
|
439
|
-
/**
|
|
440
|
-
* 本文件提供无依赖的在终端打印彩色文字的方法。
|
|
435
|
+
/**
|
|
436
|
+
* 本文件提供无依赖的在终端打印彩色文字的方法。
|
|
441
437
|
*/
|
|
442
438
|
|
|
443
439
|
const resetCfg = decodeURIComponent('%1B%5B0m'); // \033[0m转义后的字符按,用来还原属性
|
|
444
440
|
|
|
445
|
-
/**
|
|
446
|
-
* 打印红底黑字格式的文字
|
|
447
|
-
* @param {String} message 需要打印的文字信息
|
|
448
|
-
* @returns {undefined} 无
|
|
441
|
+
/**
|
|
442
|
+
* 打印红底黑字格式的文字
|
|
443
|
+
* @param {String} message 需要打印的文字信息
|
|
444
|
+
* @returns {undefined} 无
|
|
449
445
|
*/
|
|
450
446
|
|
|
451
|
-
const fail$
|
|
447
|
+
const fail$9 = (message = '') => {
|
|
452
448
|
const redStyleConfig = decodeURIComponent('%1B%5B41%3B30m'); // \033[41;30m转义后的字符按,console时输出红色文字
|
|
453
449
|
|
|
454
450
|
const greenFontStyleConfig = decodeURIComponent('%1B%5B41%3B37m'); // \033[41;30m转义后的字符按,console时输出红底白色文字
|
|
455
451
|
|
|
456
452
|
console.log(`${redStyleConfig} ERROR ${greenFontStyleConfig} ${message}${resetCfg}`); // eslint-disable-line no-console
|
|
457
453
|
};
|
|
458
|
-
/**
|
|
459
|
-
* 打印绿底黑字格式的文字
|
|
460
|
-
* @param {String} message 需要打印的文字信息
|
|
461
|
-
* @returns {undefined} 无
|
|
454
|
+
/**
|
|
455
|
+
* 打印绿底黑字格式的文字
|
|
456
|
+
* @param {String} message 需要打印的文字信息
|
|
457
|
+
* @returns {undefined} 无
|
|
462
458
|
*/
|
|
463
459
|
|
|
464
460
|
|
|
@@ -469,10 +465,10 @@ const succeed$1 = (message = '') => {
|
|
|
469
465
|
|
|
470
466
|
console.log(`${greenStyleConfig} Success ${greenFontStyleConfig} ${message}${resetCfg}`); // eslint-disable-line no-console
|
|
471
467
|
};
|
|
472
|
-
/**
|
|
473
|
-
* 打印warn提示
|
|
474
|
-
* @param {String} message 需要打印的文字信息
|
|
475
|
-
* @returns {undefined} 无
|
|
468
|
+
/**
|
|
469
|
+
* 打印warn提示
|
|
470
|
+
* @param {String} message 需要打印的文字信息
|
|
471
|
+
* @returns {undefined} 无
|
|
476
472
|
*/
|
|
477
473
|
|
|
478
474
|
|
|
@@ -481,7 +477,7 @@ const warn = message => {
|
|
|
481
477
|
};
|
|
482
478
|
|
|
483
479
|
var log$2 = {
|
|
484
|
-
fail: fail$
|
|
480
|
+
fail: fail$9,
|
|
485
481
|
succeed: succeed$1,
|
|
486
482
|
warn
|
|
487
483
|
};
|
|
@@ -506,7 +502,7 @@ const render$1 = (files, metalsmith, next) => {
|
|
|
506
502
|
|
|
507
503
|
var render_1 = render$1;
|
|
508
504
|
|
|
509
|
-
const fs$
|
|
505
|
+
const fs$b = require$$0__default$1;
|
|
510
506
|
const inquirer = require$$1__default$2;
|
|
511
507
|
const {
|
|
512
508
|
resolve: resolve$c
|
|
@@ -514,21 +510,21 @@ const {
|
|
|
514
510
|
const {
|
|
515
511
|
TEMPLATE_TKIT_DIR: TEMPLATE_TKIT_DIR$1
|
|
516
512
|
} = require$$3;
|
|
517
|
-
/**
|
|
518
|
-
* 获取模板内的问题
|
|
519
|
-
* @param {string} dir questions.json所在的目录
|
|
520
|
-
* @returns {Array} inquirer 问题数组
|
|
513
|
+
/**
|
|
514
|
+
* 获取模板内的问题
|
|
515
|
+
* @param {string} dir questions.json所在的目录
|
|
516
|
+
* @returns {Array} inquirer 问题数组
|
|
521
517
|
*/
|
|
522
518
|
|
|
523
519
|
const parseTemplateQuestions = dir => {
|
|
524
520
|
let prompts = [];
|
|
525
521
|
|
|
526
|
-
if (!fs$
|
|
522
|
+
if (!fs$b.existsSync(`${dir}/questions.json`)) {
|
|
527
523
|
return prompts;
|
|
528
524
|
}
|
|
529
525
|
|
|
530
526
|
try {
|
|
531
|
-
const json = JSON.parse(fs$
|
|
527
|
+
const json = JSON.parse(fs$b.readFileSync(`${dir}/questions.json`));
|
|
532
528
|
|
|
533
529
|
if (Array.isArray(json) && json.length > 0) {
|
|
534
530
|
json.forEach((item, index) => {
|
|
@@ -603,8 +599,8 @@ const generator$1 = (buildDir, distDir, preMetadata) => new Promise((resolve, re
|
|
|
603
599
|
|
|
604
600
|
var generator_1 = generator$1;
|
|
605
601
|
|
|
606
|
-
const path$
|
|
607
|
-
const fs$
|
|
602
|
+
const path$7 = require$$3__default;
|
|
603
|
+
const fs$a = require$$0__default$1;
|
|
608
604
|
const shelljs$5 = require$$4__default;
|
|
609
605
|
const {
|
|
610
606
|
TEMPLATE_DIR,
|
|
@@ -618,37 +614,37 @@ const {
|
|
|
618
614
|
} = widgets;
|
|
619
615
|
const io$1 = io$2;
|
|
620
616
|
const {
|
|
621
|
-
fail: fail$
|
|
617
|
+
fail: fail$8,
|
|
622
618
|
succeed
|
|
623
619
|
} = log$2;
|
|
624
620
|
const generator = generator_1;
|
|
625
|
-
/**
|
|
626
|
-
* 如果该目录下面存在文件,换个名字
|
|
627
|
-
* @param { string } targetDir 当前文件夹
|
|
628
|
-
* @returns { undefined }
|
|
621
|
+
/**
|
|
622
|
+
* 如果该目录下面存在文件,换个名字
|
|
623
|
+
* @param { string } targetDir 当前文件夹
|
|
624
|
+
* @returns { undefined }
|
|
629
625
|
*/
|
|
630
626
|
|
|
631
627
|
async function createAppDir(targetDir) {
|
|
632
628
|
// 如果目录非空或者已经存在,提示用户,做选择
|
|
633
|
-
if (fs$
|
|
629
|
+
if (fs$a.existsSync(targetDir)) {
|
|
634
630
|
if (!(await io$1.isDirEmpty(targetDir))) {
|
|
635
|
-
fail$
|
|
631
|
+
fail$8('该目录名已经存在,换个项目名字吧~');
|
|
636
632
|
process.exit(1);
|
|
637
633
|
}
|
|
638
634
|
} else {
|
|
639
635
|
shelljs$5.mkdir('-p', targetDir);
|
|
640
636
|
}
|
|
641
637
|
}
|
|
642
|
-
/**
|
|
643
|
-
* 创建本地小程序运行环境
|
|
644
|
-
* @param { string } appType 项目类型
|
|
645
|
-
* @param { string } appName 项目名称
|
|
638
|
+
/**
|
|
639
|
+
* 创建本地小程序运行环境
|
|
640
|
+
* @param { string } appType 项目类型
|
|
641
|
+
* @param { string } appName 项目名称
|
|
646
642
|
*/
|
|
647
643
|
|
|
648
644
|
|
|
649
645
|
async function create(appName) {
|
|
650
646
|
const cwd = process.cwd();
|
|
651
|
-
const targetDir = path$
|
|
647
|
+
const targetDir = path$7.resolve(cwd, appName);
|
|
652
648
|
const appType = 'mp';
|
|
653
649
|
await createAppDir(targetDir); // 创建缓存目录
|
|
654
650
|
|
|
@@ -656,7 +652,7 @@ async function create(appName) {
|
|
|
656
652
|
|
|
657
653
|
await createTask$3(downloadRepoForGit$1, '拉取模板仓库', '拉取模板仓库完成')('https://git.woa.com/tmsfe/tms-frontend.git', TEMPLATE_DIR, 'master'); // 生成模板(1. 询问问题, 2. ejs生成模板 3.生成到目标目录)
|
|
658
654
|
|
|
659
|
-
generator(path$
|
|
655
|
+
generator(path$7.join(TEMPLATE_PATH, appType), targetDir, {
|
|
660
656
|
appName,
|
|
661
657
|
appType
|
|
662
658
|
}).then(() => {
|
|
@@ -679,7 +675,7 @@ async function create(appName) {
|
|
|
679
675
|
shelljs$5.rm('-rf', resolve$b(appName, TEMPLATE_TKIT_DIR));
|
|
680
676
|
succeed('项目创建完成.');
|
|
681
677
|
}).catch(err => {
|
|
682
|
-
fail$
|
|
678
|
+
fail$8(err.message);
|
|
683
679
|
console.log('详细的错误信息:', err);
|
|
684
680
|
});
|
|
685
681
|
}
|
|
@@ -687,16 +683,16 @@ async function create(appName) {
|
|
|
687
683
|
var create_1 = create;
|
|
688
684
|
|
|
689
685
|
const {
|
|
690
|
-
fail: fail$
|
|
686
|
+
fail: fail$7
|
|
691
687
|
} = log$2;
|
|
692
688
|
|
|
693
689
|
function handleError$3(error, isDev = false) {
|
|
694
690
|
const errMsg = typeof error === 'object' ? error.message : error;
|
|
695
691
|
|
|
696
692
|
if (isDev) {
|
|
697
|
-
fail$
|
|
693
|
+
fail$7(errMsg);
|
|
698
694
|
} else {
|
|
699
|
-
fail$
|
|
695
|
+
fail$7(errMsg);
|
|
700
696
|
process.exit(1);
|
|
701
697
|
}
|
|
702
698
|
}
|
|
@@ -705,13 +701,13 @@ var handleError_1 = {
|
|
|
705
701
|
handleError: handleError$3
|
|
706
702
|
};
|
|
707
703
|
|
|
708
|
-
const fs$
|
|
704
|
+
const fs$9 = require$$0__default$1;
|
|
709
705
|
const {
|
|
710
706
|
MODULE_CONFIG_FILENAME: MODULE_CONFIG_FILENAME$2,
|
|
711
707
|
MODULE_CONFIG_INVALID_KEY
|
|
712
708
|
} = require$$3;
|
|
713
709
|
const {
|
|
714
|
-
fail: fail$
|
|
710
|
+
fail: fail$6
|
|
715
711
|
} = log$2;
|
|
716
712
|
const {
|
|
717
713
|
resolve: resolve$a,
|
|
@@ -721,10 +717,10 @@ const {
|
|
|
721
717
|
const {
|
|
722
718
|
handleError: handleError$2
|
|
723
719
|
} = handleError_1;
|
|
724
|
-
/**
|
|
725
|
-
* 获取每个模块下面的信息,并且收集,后续更新到appJson里面
|
|
726
|
-
* @param { object } file 操作目录下面所有的文件
|
|
727
|
-
* @param { string } appName 小程序的名称
|
|
720
|
+
/**
|
|
721
|
+
* 获取每个模块下面的信息,并且收集,后续更新到appJson里面
|
|
722
|
+
* @param { object } file 操作目录下面所有的文件
|
|
723
|
+
* @param { string } appName 小程序的名称
|
|
728
724
|
*/
|
|
729
725
|
|
|
730
726
|
function setModuleConfig$1(file, appName) {
|
|
@@ -751,8 +747,8 @@ function setModuleConfig$1(file, appName) {
|
|
|
751
747
|
|
|
752
748
|
return content;
|
|
753
749
|
}
|
|
754
|
-
/**
|
|
755
|
-
* 递归获取本地所有模块的配置信息
|
|
750
|
+
/**
|
|
751
|
+
* 递归获取本地所有模块的配置信息
|
|
756
752
|
*/
|
|
757
753
|
|
|
758
754
|
|
|
@@ -763,18 +759,18 @@ function getLocalModuleConfig(modules = [], appName, moduleConfigFilename) {
|
|
|
763
759
|
}) => {
|
|
764
760
|
const moduleConfigPath = resolve$a(path, moduleConfigFilename);
|
|
765
761
|
|
|
766
|
-
if (fs$
|
|
767
|
-
const content = fs$
|
|
762
|
+
if (fs$9.existsSync(moduleConfigPath)) {
|
|
763
|
+
const content = fs$9.readFileSync(moduleConfigPath, 'utf-8');
|
|
768
764
|
modulesConfig[moduleConfigPath] = setModuleConfig$1(content, appName);
|
|
769
765
|
}
|
|
770
766
|
});
|
|
771
767
|
return modulesConfig;
|
|
772
768
|
}
|
|
773
|
-
/**
|
|
774
|
-
* 更新appJson里面的首页配置
|
|
775
|
-
* @param { object } appJson appJson信息
|
|
776
|
-
* @param { array } mainPackages 小程序主包信息
|
|
777
|
-
* @returns { object } appJson小程序主页配置信息
|
|
769
|
+
/**
|
|
770
|
+
* 更新appJson里面的首页配置
|
|
771
|
+
* @param { object } appJson appJson信息
|
|
772
|
+
* @param { array } mainPackages 小程序主包信息
|
|
773
|
+
* @returns { object } appJson小程序主页配置信息
|
|
778
774
|
*/
|
|
779
775
|
|
|
780
776
|
|
|
@@ -789,7 +785,7 @@ function updateMainPackages(appJson, mainPackages = []) {
|
|
|
789
785
|
|
|
790
786
|
foundMainPackages.forEach(subpackage => {
|
|
791
787
|
if (!subpackage.pages || !subpackage.pages.length) {
|
|
792
|
-
fail$
|
|
788
|
+
fail$6(`主包 ${subpackage} 不能没有 pages`);
|
|
793
789
|
process.exit(-1);
|
|
794
790
|
}
|
|
795
791
|
|
|
@@ -807,20 +803,20 @@ function updateMainPackages(appJson, mainPackages = []) {
|
|
|
807
803
|
appJson.subpackages = appJson.subpackages.filter(subpackage => !foundMainPackageNames.includes(subpackage.name));
|
|
808
804
|
return appJson;
|
|
809
805
|
}
|
|
810
|
-
/**
|
|
811
|
-
* 获取app.json内容
|
|
812
|
-
* @param {string} sourceAppJsonPath
|
|
813
|
-
* @returns
|
|
806
|
+
/**
|
|
807
|
+
* 获取app.json内容
|
|
808
|
+
* @param {string} sourceAppJsonPath
|
|
809
|
+
* @returns
|
|
814
810
|
*/
|
|
815
811
|
|
|
816
812
|
|
|
817
813
|
const getAppJsonContent = sourceAppJsonPath => {
|
|
818
|
-
if (!fs$
|
|
819
|
-
fail$
|
|
814
|
+
if (!fs$9.existsSync(sourceAppJsonPath)) {
|
|
815
|
+
fail$6(`当前路径 ${sourceAppJsonPath} 没找到app.json`);
|
|
820
816
|
process.exit(1);
|
|
821
817
|
}
|
|
822
818
|
|
|
823
|
-
const appJson = JSON.parse(fs$
|
|
819
|
+
const appJson = JSON.parse(fs$9.readFileSync(sourceAppJsonPath), 'utf-8'); // 加入默认值
|
|
824
820
|
|
|
825
821
|
appJson.subpackages = [];
|
|
826
822
|
appJson.pages = []; // appJson.plugins = {};
|
|
@@ -828,10 +824,10 @@ const getAppJsonContent = sourceAppJsonPath => {
|
|
|
828
824
|
delete appJson.entranceDeclare;
|
|
829
825
|
return appJson;
|
|
830
826
|
};
|
|
831
|
-
/**
|
|
832
|
-
* 更新app.json中的subpackages
|
|
833
|
-
* @param {Object} appJson
|
|
834
|
-
* @param {Object} modulesConfig
|
|
827
|
+
/**
|
|
828
|
+
* 更新app.json中的subpackages
|
|
829
|
+
* @param {Object} appJson
|
|
830
|
+
* @param {Object} modulesConfig
|
|
835
831
|
*/
|
|
836
832
|
|
|
837
833
|
|
|
@@ -845,10 +841,10 @@ const updateSubpackages = (appJson, modulesConfig) => {
|
|
|
845
841
|
appJson.subpackages = appJson.subpackages.concat(validModules);
|
|
846
842
|
}
|
|
847
843
|
};
|
|
848
|
-
/**
|
|
849
|
-
* 过滤页面为空的分包
|
|
850
|
-
* @param {Array} moduleCfg 模块配置内容
|
|
851
|
-
* @returns pages不为空的分包
|
|
844
|
+
/**
|
|
845
|
+
* 过滤页面为空的分包
|
|
846
|
+
* @param {Array} moduleCfg 模块配置内容
|
|
847
|
+
* @returns pages不为空的分包
|
|
852
848
|
*/
|
|
853
849
|
|
|
854
850
|
|
|
@@ -857,9 +853,9 @@ const getValidModules$1 = moduleCfg => {
|
|
|
857
853
|
const validModules = moduleCfg.filter(item => item.pages.length > 0);
|
|
858
854
|
return validModules;
|
|
859
855
|
};
|
|
860
|
-
/**
|
|
861
|
-
* 处理合并subpackages后的appjson, 整理重复不合法的地方
|
|
862
|
-
* @param {Object} appJson appjson
|
|
856
|
+
/**
|
|
857
|
+
* 处理合并subpackages后的appjson, 整理重复不合法的地方
|
|
858
|
+
* @param {Object} appJson appjson
|
|
863
859
|
*/
|
|
864
860
|
|
|
865
861
|
|
|
@@ -902,7 +898,7 @@ const processAppJson = appJson => {
|
|
|
902
898
|
});
|
|
903
899
|
|
|
904
900
|
if (invalidKeys.length) {
|
|
905
|
-
fail$
|
|
901
|
+
fail$6(`不支持分包${subp === null || subp === void 0 ? void 0 : subp.name}配置${invalidKeys.join(',')}\n`);
|
|
906
902
|
} // eslint-disable-next-line
|
|
907
903
|
|
|
908
904
|
|
|
@@ -919,17 +915,17 @@ const processAppJson = appJson => {
|
|
|
919
915
|
}).reduce((pre, cur) => pre + cur, '');
|
|
920
916
|
|
|
921
917
|
if (pluginsErrMsg) {
|
|
922
|
-
fail$
|
|
918
|
+
fail$6(`plugins配置出现错误:${pluginsErrMsg}`);
|
|
923
919
|
} // eslint-disable-next-line
|
|
924
920
|
|
|
925
921
|
|
|
926
922
|
appJson.subpackages = subps;
|
|
927
923
|
};
|
|
928
|
-
/**
|
|
929
|
-
* 动态生成编译后的app.json
|
|
930
|
-
* @param {object} tmsConfig
|
|
931
|
-
* @param {array} modules
|
|
932
|
-
* @returns
|
|
924
|
+
/**
|
|
925
|
+
* 动态生成编译后的app.json
|
|
926
|
+
* @param {object} tmsConfig
|
|
927
|
+
* @param {array} modules
|
|
928
|
+
* @returns
|
|
933
929
|
*/
|
|
934
930
|
|
|
935
931
|
|
|
@@ -945,7 +941,7 @@ function buildOutputAppJson$1(tmsConfig, modules, isDev) {
|
|
|
945
941
|
processAppJson(appJson); // 更新主包,需在subpackages处理完成后执行, pages/
|
|
946
942
|
|
|
947
943
|
updateMainPackages(appJson, tmsConfig.mainPackages);
|
|
948
|
-
fs$
|
|
944
|
+
fs$9.writeFileSync(resolve$a(`${tmsConfig.outputDir}/app.json`), JSON.stringify(appJson, null, 2), 'utf8');
|
|
949
945
|
return appJson;
|
|
950
946
|
} catch (e) {
|
|
951
947
|
handleError$2(`生成app.json出现错误: ${e}`, isDev);
|
|
@@ -1013,7 +1009,7 @@ var defaultTmsConfig$1 = {
|
|
|
1013
1009
|
};
|
|
1014
1010
|
|
|
1015
1011
|
const loadash = require$$0__default$5;
|
|
1016
|
-
const fs$
|
|
1012
|
+
const fs$8 = require$$0__default$1;
|
|
1017
1013
|
const {
|
|
1018
1014
|
TMS_NAME: TMS_NAME$1,
|
|
1019
1015
|
TMS_CONFIG_FILENAME,
|
|
@@ -1030,19 +1026,19 @@ const {
|
|
|
1030
1026
|
} = buildAppJson;
|
|
1031
1027
|
const defaultTmsConfig = defaultTmsConfig$1;
|
|
1032
1028
|
const {
|
|
1033
|
-
fail: fail$
|
|
1029
|
+
fail: fail$5
|
|
1034
1030
|
} = log$2;
|
|
1035
|
-
const path$
|
|
1036
|
-
/**
|
|
1037
|
-
* 读取tms.config.js
|
|
1038
|
-
* @param env {string} 环境变量
|
|
1031
|
+
const path$6 = require$$3__default;
|
|
1032
|
+
/**
|
|
1033
|
+
* 读取tms.config.js
|
|
1034
|
+
* @param env {string} 环境变量
|
|
1039
1035
|
*/
|
|
1040
1036
|
|
|
1041
1037
|
const readTmsConfig$1 = function (env) {
|
|
1042
1038
|
const tmsConfigPath = resolve$9(TMS_CONFIG_FILENAME);
|
|
1043
1039
|
|
|
1044
|
-
if (!fs$
|
|
1045
|
-
fail$
|
|
1040
|
+
if (!fs$8.existsSync(tmsConfigPath)) {
|
|
1041
|
+
fail$5('当前执行目录没有tms.config.js的配置项,请进行配置');
|
|
1046
1042
|
process.exit(1);
|
|
1047
1043
|
}
|
|
1048
1044
|
|
|
@@ -1067,14 +1063,14 @@ const convertModules = modules => {
|
|
|
1067
1063
|
if (typeof module === 'string') {
|
|
1068
1064
|
// 路径字符串
|
|
1069
1065
|
Object.assign(newModule, {
|
|
1070
|
-
name: path$
|
|
1066
|
+
name: path$6.basename(module),
|
|
1071
1067
|
path: module
|
|
1072
1068
|
});
|
|
1073
1069
|
} else if (typeof module === 'object') {
|
|
1074
1070
|
Object.assign(newModule, module);
|
|
1075
1071
|
|
|
1076
1072
|
if (module.name === undefined) {
|
|
1077
|
-
newModule.name = path$
|
|
1073
|
+
newModule.name = path$6.basename(module.path);
|
|
1078
1074
|
}
|
|
1079
1075
|
}
|
|
1080
1076
|
|
|
@@ -1082,8 +1078,8 @@ const convertModules = modules => {
|
|
|
1082
1078
|
});
|
|
1083
1079
|
return newModules;
|
|
1084
1080
|
};
|
|
1085
|
-
/**
|
|
1086
|
-
* 读取tms.private.js
|
|
1081
|
+
/**
|
|
1082
|
+
* 读取tms.private.js
|
|
1087
1083
|
*/
|
|
1088
1084
|
|
|
1089
1085
|
|
|
@@ -1091,17 +1087,17 @@ const readTmsPrivateCf$2 = function () {
|
|
|
1091
1087
|
let tmsPrivateCg;
|
|
1092
1088
|
const tmsPrivatePath = resolve$9(TMS_PRIVATE_FILENAME);
|
|
1093
1089
|
|
|
1094
|
-
if (fs$
|
|
1090
|
+
if (fs$8.existsSync(tmsPrivatePath)) {
|
|
1095
1091
|
tmsPrivateCg = require(tmsPrivatePath);
|
|
1096
1092
|
}
|
|
1097
1093
|
|
|
1098
1094
|
return tmsPrivateCg;
|
|
1099
1095
|
};
|
|
1100
|
-
/**
|
|
1101
|
-
* 从tms.config.json中检索用户传入的有效modules
|
|
1102
|
-
* @param { object } tmsConfig
|
|
1103
|
-
* @param { array } modules
|
|
1104
|
-
* @returns
|
|
1096
|
+
/**
|
|
1097
|
+
* 从tms.config.json中检索用户传入的有效modules
|
|
1098
|
+
* @param { object } tmsConfig
|
|
1099
|
+
* @param { array } modules
|
|
1100
|
+
* @returns
|
|
1105
1101
|
*/
|
|
1106
1102
|
|
|
1107
1103
|
|
|
@@ -1113,18 +1109,18 @@ const checkModules$1 = function (tmsConfig, modules) {
|
|
|
1113
1109
|
});
|
|
1114
1110
|
|
|
1115
1111
|
if (targetModules.length === 0) {
|
|
1116
|
-
fail$
|
|
1112
|
+
fail$5(`你启动的模块无效,尝试 ${TMS_NAME$1} -m moduleName`);
|
|
1117
1113
|
process.exit(1);
|
|
1118
1114
|
}
|
|
1119
1115
|
|
|
1120
1116
|
return targetModules;
|
|
1121
1117
|
};
|
|
1122
|
-
/**
|
|
1123
|
-
* tms.config.js的modules 合并 module.config.json的配置项
|
|
1124
|
-
* @param {array} modules
|
|
1125
|
-
* @param {string} appName
|
|
1126
|
-
* @param {string} moduleDir
|
|
1127
|
-
* @returns
|
|
1118
|
+
/**
|
|
1119
|
+
* tms.config.js的modules 合并 module.config.json的配置项
|
|
1120
|
+
* @param {array} modules
|
|
1121
|
+
* @param {string} appName
|
|
1122
|
+
* @param {string} moduleDir
|
|
1123
|
+
* @returns
|
|
1128
1124
|
*/
|
|
1129
1125
|
|
|
1130
1126
|
|
|
@@ -1136,9 +1132,9 @@ const tmsModulesMergeLocalModuleCfg$3 = (modules, appName) => {
|
|
|
1136
1132
|
}, moduleIndex) => {
|
|
1137
1133
|
const moduleConfigPath = resolve$9(relativePath, MODULE_CONFIG_FILENAME$1);
|
|
1138
1134
|
|
|
1139
|
-
if (fs$
|
|
1135
|
+
if (fs$8.existsSync(moduleConfigPath)) {
|
|
1140
1136
|
try {
|
|
1141
|
-
let moduleConfigContent = fs$
|
|
1137
|
+
let moduleConfigContent = fs$8.readFileSync(moduleConfigPath, 'utf-8');
|
|
1142
1138
|
moduleConfigContent = setModuleConfig(moduleConfigContent, appName);
|
|
1143
1139
|
const moduleContentArr = isObject(moduleConfigContent) ? [moduleConfigContent] : moduleConfigContent;
|
|
1144
1140
|
getValidModules(moduleContentArr).forEach(({
|
|
@@ -1151,7 +1147,7 @@ const tmsModulesMergeLocalModuleCfg$3 = (modules, appName) => {
|
|
|
1151
1147
|
}
|
|
1152
1148
|
});
|
|
1153
1149
|
} catch (e) {
|
|
1154
|
-
fail$
|
|
1150
|
+
fail$5(`${moduleConfigPath}配置错误: ${e}`);
|
|
1155
1151
|
newModules.push({ ...modules[moduleIndex]
|
|
1156
1152
|
});
|
|
1157
1153
|
}
|
|
@@ -1162,12 +1158,12 @@ const tmsModulesMergeLocalModuleCfg$3 = (modules, appName) => {
|
|
|
1162
1158
|
});
|
|
1163
1159
|
return newModules;
|
|
1164
1160
|
};
|
|
1165
|
-
/**
|
|
1166
|
-
* 分包依赖了分包的模块 合并所依赖的modules
|
|
1167
|
-
* @param { object } tmsConfig
|
|
1168
|
-
* @param {array} modules
|
|
1169
|
-
* @param {string} moduleDir
|
|
1170
|
-
* @returns
|
|
1161
|
+
/**
|
|
1162
|
+
* 分包依赖了分包的模块 合并所依赖的modules
|
|
1163
|
+
* @param { object } tmsConfig
|
|
1164
|
+
* @param {array} modules
|
|
1165
|
+
* @param {string} moduleDir
|
|
1166
|
+
* @returns
|
|
1171
1167
|
*/
|
|
1172
1168
|
|
|
1173
1169
|
|
|
@@ -1217,18 +1213,18 @@ const {
|
|
|
1217
1213
|
readTmsPrivateCf: readTmsPrivateCf$1
|
|
1218
1214
|
} = tkitUtils;
|
|
1219
1215
|
const {
|
|
1220
|
-
fail: fail$
|
|
1216
|
+
fail: fail$4
|
|
1221
1217
|
} = log$2;
|
|
1222
|
-
const fs$
|
|
1218
|
+
const fs$7 = require$$0__default$1;
|
|
1223
1219
|
const shelljs$4 = require$$4__default;
|
|
1224
1220
|
const {
|
|
1225
1221
|
handleError: handleError$1
|
|
1226
1222
|
} = handleError_1;
|
|
1227
|
-
/**
|
|
1228
|
-
* 处理用户没有clone git仓库权限问题——拼接账号信息
|
|
1229
|
-
* @param {*} httpRepoUrl
|
|
1230
|
-
* @param {*} moduleName
|
|
1231
|
-
* @returns
|
|
1223
|
+
/**
|
|
1224
|
+
* 处理用户没有clone git仓库权限问题——拼接账号信息
|
|
1225
|
+
* @param {*} httpRepoUrl
|
|
1226
|
+
* @param {*} moduleName
|
|
1227
|
+
* @returns
|
|
1232
1228
|
*/
|
|
1233
1229
|
|
|
1234
1230
|
function replaceGitUrlAccount(httpRepoUrl, moduleName, privateCf) {
|
|
@@ -1247,12 +1243,12 @@ function replaceGitUrlAccount(httpRepoUrl, moduleName, privateCf) {
|
|
|
1247
1243
|
|
|
1248
1244
|
return gitUrl;
|
|
1249
1245
|
}
|
|
1250
|
-
/**
|
|
1251
|
-
* 对克隆下来的模块进行相应的文件处理操作,比如收集处理模块信息,进行信息缓存等操作
|
|
1252
|
-
* @param { string } sourceDir 缓存文件夹
|
|
1253
|
-
* @param { string } targetDir 目标文件夹
|
|
1254
|
-
* @param { arrary } ignore
|
|
1255
|
-
* @returns { undefined } no return
|
|
1246
|
+
/**
|
|
1247
|
+
* 对克隆下来的模块进行相应的文件处理操作,比如收集处理模块信息,进行信息缓存等操作
|
|
1248
|
+
* @param { string } sourceDir 缓存文件夹
|
|
1249
|
+
* @param { string } targetDir 目标文件夹
|
|
1250
|
+
* @param { arrary } ignore
|
|
1251
|
+
* @returns { undefined } no return
|
|
1256
1252
|
*/
|
|
1257
1253
|
|
|
1258
1254
|
|
|
@@ -1261,7 +1257,7 @@ function moveFile(sourceDir, targetDir, ignore = []) {
|
|
|
1261
1257
|
return new Promise((resolve, reject) => {
|
|
1262
1258
|
MetalSmith(__dirname).ignore(ignore).source(sourceDir).destination(targetDir).build(e => {
|
|
1263
1259
|
if (e) {
|
|
1264
|
-
fail$
|
|
1260
|
+
fail$4(`${sourceDir} moveFile ${targetDir}出现错误: ${e}`);
|
|
1265
1261
|
reject(e);
|
|
1266
1262
|
}
|
|
1267
1263
|
|
|
@@ -1269,12 +1265,12 @@ function moveFile(sourceDir, targetDir, ignore = []) {
|
|
|
1269
1265
|
});
|
|
1270
1266
|
});
|
|
1271
1267
|
}
|
|
1272
|
-
/**
|
|
1273
|
-
* 下载目标模块
|
|
1274
|
-
* @param { string } sourceDir 缓存文件夹
|
|
1275
|
-
* @param { string } targetDir 目标文件夹
|
|
1276
|
-
* @param { boolean } isDev 是否是dev
|
|
1277
|
-
* @returns { array } modules 描述模块的列表
|
|
1268
|
+
/**
|
|
1269
|
+
* 下载目标模块
|
|
1270
|
+
* @param { string } sourceDir 缓存文件夹
|
|
1271
|
+
* @param { string } targetDir 目标文件夹
|
|
1272
|
+
* @param { boolean } isDev 是否是dev
|
|
1273
|
+
* @returns { array } modules 描述模块的列表
|
|
1278
1274
|
*/
|
|
1279
1275
|
|
|
1280
1276
|
|
|
@@ -1288,12 +1284,12 @@ async function cloneModules$1(sourceDir, targetDir, modules, isDev) {
|
|
|
1288
1284
|
}
|
|
1289
1285
|
}
|
|
1290
1286
|
}
|
|
1291
|
-
/**
|
|
1292
|
-
* 下载模块信息并且将它移动到对应的位置
|
|
1293
|
-
* @param { string } sourceDir 代码缓存文件夹
|
|
1294
|
-
* @param { string } targetDir 代码要放到的目标文件夹
|
|
1295
|
-
* @param { boolean } isDev 是否是dev
|
|
1296
|
-
* @returns { array } moduleInfo 描述模块的信息
|
|
1287
|
+
/**
|
|
1288
|
+
* 下载模块信息并且将它移动到对应的位置
|
|
1289
|
+
* @param { string } sourceDir 代码缓存文件夹
|
|
1290
|
+
* @param { string } targetDir 代码要放到的目标文件夹
|
|
1291
|
+
* @param { boolean } isDev 是否是dev
|
|
1292
|
+
* @returns { array } moduleInfo 描述模块的信息
|
|
1297
1293
|
*/
|
|
1298
1294
|
|
|
1299
1295
|
|
|
@@ -1326,7 +1322,7 @@ async function downLoadAndMoveModule(sourceDir, targetDir, moduleInfo, privateCf
|
|
|
1326
1322
|
sourcePath = globalInstance.getModuleCache(httpRepoUrl, cloneBranch).dest;
|
|
1327
1323
|
}
|
|
1328
1324
|
|
|
1329
|
-
if (fs$
|
|
1325
|
+
if (fs$7.existsSync(targetPath)) {
|
|
1330
1326
|
shelljs$4.rm('-rf', `${targetPath}/*`);
|
|
1331
1327
|
}
|
|
1332
1328
|
|
|
@@ -1341,10 +1337,10 @@ var cloneModules_1 = {
|
|
|
1341
1337
|
};
|
|
1342
1338
|
|
|
1343
1339
|
const ci = require$$0__default$6;
|
|
1344
|
-
const path$
|
|
1345
|
-
/**
|
|
1346
|
-
* 获取小程序ci的Project对象
|
|
1347
|
-
* @returns {Object} 小程序ci对象
|
|
1340
|
+
const path$5 = require$$3__default;
|
|
1341
|
+
/**
|
|
1342
|
+
* 获取小程序ci的Project对象
|
|
1343
|
+
* @returns {Object} 小程序ci对象
|
|
1348
1344
|
*/
|
|
1349
1345
|
|
|
1350
1346
|
const getMpCi = ({
|
|
@@ -1355,7 +1351,7 @@ const getMpCi = ({
|
|
|
1355
1351
|
}) => {
|
|
1356
1352
|
var _cfgJsonContent$packO;
|
|
1357
1353
|
|
|
1358
|
-
const cfgJsonContent = require(path$
|
|
1354
|
+
const cfgJsonContent = require(path$5.join(projectPath, 'project.config.json'));
|
|
1359
1355
|
|
|
1360
1356
|
const ignores = (cfgJsonContent === null || cfgJsonContent === void 0 ? void 0 : (_cfgJsonContent$packO = cfgJsonContent.packOptions) === null || _cfgJsonContent$packO === void 0 ? void 0 : _cfgJsonContent$packO.ignore.map(({
|
|
1361
1357
|
value
|
|
@@ -1375,10 +1371,10 @@ const packMpProject = async project => {
|
|
|
1375
1371
|
ignores: ['cloud/**/*']
|
|
1376
1372
|
});
|
|
1377
1373
|
};
|
|
1378
|
-
/**
|
|
1379
|
-
* 格式化构建npm结果信息
|
|
1380
|
-
* @param {Array<String>} warning 构建时的告警信息
|
|
1381
|
-
* @returns {String} npm构建错误信息
|
|
1374
|
+
/**
|
|
1375
|
+
* 格式化构建npm结果信息
|
|
1376
|
+
* @param {Array<String>} warning 构建时的告警信息
|
|
1377
|
+
* @returns {String} npm构建错误信息
|
|
1382
1378
|
*/
|
|
1383
1379
|
|
|
1384
1380
|
|
|
@@ -1391,9 +1387,9 @@ const formatPackNpmWarning = warning => {
|
|
|
1391
1387
|
\t@ ${it.jsPath}:${it.tips}`).join('---------------\n');
|
|
1392
1388
|
return result;
|
|
1393
1389
|
};
|
|
1394
|
-
/**
|
|
1395
|
-
* 构建miniprogram_npm
|
|
1396
|
-
* @returns {Object} 小程序ci对象
|
|
1390
|
+
/**
|
|
1391
|
+
* 构建miniprogram_npm
|
|
1392
|
+
* @returns {Object} 小程序ci对象
|
|
1397
1393
|
*/
|
|
1398
1394
|
|
|
1399
1395
|
|
|
@@ -1421,13 +1417,13 @@ var mpCiUtils = {
|
|
|
1421
1417
|
buildMpNpm: buildMpNpm$1
|
|
1422
1418
|
};
|
|
1423
1419
|
|
|
1424
|
-
/**
|
|
1425
|
-
* 本文件主要负责项目或者分包依赖的npm的安装
|
|
1420
|
+
/**
|
|
1421
|
+
* 本文件主要负责项目或者分包依赖的npm的安装
|
|
1426
1422
|
*/
|
|
1427
|
-
const fs$
|
|
1423
|
+
const fs$6 = require$$0__default$1;
|
|
1428
1424
|
const fsExtra = require$$1__default$3;
|
|
1429
1425
|
const crypto = require$$2__default$1;
|
|
1430
|
-
const path$
|
|
1426
|
+
const path$4 = require$$3__default;
|
|
1431
1427
|
const shell = require$$4__default;
|
|
1432
1428
|
const glob = require$$5__default;
|
|
1433
1429
|
const LOG = log$2;
|
|
@@ -1439,7 +1435,7 @@ const dirPath = process.cwd(); // 项目根目录
|
|
|
1439
1435
|
|
|
1440
1436
|
const install$3 = async (packageJsonPath = '', retry = true, cacheDir) => {
|
|
1441
1437
|
const obj = {};
|
|
1442
|
-
const packageContent = fs$
|
|
1438
|
+
const packageContent = fs$6.readFileSync(packageJsonPath);
|
|
1443
1439
|
const packageJson = JSON.parse(packageContent);
|
|
1444
1440
|
obj.dependencies = packageJson.dependencies || {}; // obj.devDependencies = packageJson.devDependencies || {};
|
|
1445
1441
|
// dependencies和devDependencies字段为空,没有需要安装的npm包,直接return
|
|
@@ -1454,8 +1450,8 @@ const install$3 = async (packageJsonPath = '', retry = true, cacheDir) => {
|
|
|
1454
1450
|
|
|
1455
1451
|
const str = JSON.stringify(obj);
|
|
1456
1452
|
const key = crypto.createHash('md5').update(str).digest('hex');
|
|
1457
|
-
const keyPath = path$
|
|
1458
|
-
const tarFile = path$
|
|
1453
|
+
const keyPath = path$4.join(cacheDir, key);
|
|
1454
|
+
const tarFile = path$4.join(keyPath, 'node_modules.tar.gz'); // npm缓存路径不存在
|
|
1459
1455
|
// 或者缓存的包大小小于512byte,认为缓存不合法
|
|
1460
1456
|
// 清空缓存目录,重新下载npm包缓存
|
|
1461
1457
|
|
|
@@ -1483,8 +1479,8 @@ const install$3 = async (packageJsonPath = '', retry = true, cacheDir) => {
|
|
|
1483
1479
|
shell.exec('rm -rf ./node_modules', shellJsOption);
|
|
1484
1480
|
}
|
|
1485
1481
|
|
|
1486
|
-
shell.cp('-Rf', tarFile, `${path$
|
|
1487
|
-
shell.cd(path$
|
|
1482
|
+
shell.cp('-Rf', tarFile, `${path$4.dirname(packageJsonPath)}/`);
|
|
1483
|
+
shell.cd(path$4.dirname(packageJsonPath));
|
|
1488
1484
|
shell.exec('tar -xzvf ./node_modules.tar.gz -C ./', shellJsOption);
|
|
1489
1485
|
shell.exec('rm -rf ./node_modules.tar.gz', shellJsOption);
|
|
1490
1486
|
return {
|
|
@@ -1498,26 +1494,26 @@ const mpNpmInstallAll$1 = async (modules, contextDir, cacheDir) => {
|
|
|
1498
1494
|
const packageJsonFiles = await findAllPackageJson(modules, contextDir);
|
|
1499
1495
|
await Promise.all(packageJsonFiles.map(file => install$3(file, true, cacheDir)));
|
|
1500
1496
|
};
|
|
1501
|
-
/**
|
|
1502
|
-
* 递归查找指定条件的文件
|
|
1503
|
-
* @param {String} startPath 开始查找的根路径
|
|
1504
|
-
* @param {String} filter 匹配的字符串
|
|
1505
|
-
* @returns {Array<String>} 查找到的文件路径列表
|
|
1497
|
+
/**
|
|
1498
|
+
* 递归查找指定条件的文件
|
|
1499
|
+
* @param {String} startPath 开始查找的根路径
|
|
1500
|
+
* @param {String} filter 匹配的字符串
|
|
1501
|
+
* @returns {Array<String>} 查找到的文件路径列表
|
|
1506
1502
|
*/
|
|
1507
1503
|
|
|
1508
1504
|
|
|
1509
1505
|
const findFilesByFilter = (startPath, filter) => {
|
|
1510
1506
|
const result = [];
|
|
1511
|
-
/**
|
|
1512
|
-
* 根据指定的筛选器查找文件
|
|
1513
|
-
* @param {String} startPath 开始查找的文件夹路径
|
|
1514
|
-
* @param {String} filter 筛选器
|
|
1515
|
-
* @returns {Undefined} 无需返回值
|
|
1507
|
+
/**
|
|
1508
|
+
* 根据指定的筛选器查找文件
|
|
1509
|
+
* @param {String} startPath 开始查找的文件夹路径
|
|
1510
|
+
* @param {String} filter 筛选器
|
|
1511
|
+
* @returns {Undefined} 无需返回值
|
|
1516
1512
|
*/
|
|
1517
1513
|
|
|
1518
1514
|
const find = (startPath, filter) => {
|
|
1519
1515
|
// 目录不存在
|
|
1520
|
-
if (!fs$
|
|
1516
|
+
if (!fs$6.existsSync(startPath)) {
|
|
1521
1517
|
LOG.fail(`${startPath}目录不存在`);
|
|
1522
1518
|
process.exit(-1);
|
|
1523
1519
|
return;
|
|
@@ -1530,10 +1526,10 @@ const findFilesByFilter = (startPath, filter) => {
|
|
|
1530
1526
|
return;
|
|
1531
1527
|
}
|
|
1532
1528
|
|
|
1533
|
-
const files = fs$
|
|
1529
|
+
const files = fs$6.readdirSync(startPath);
|
|
1534
1530
|
files.forEach(file => {
|
|
1535
|
-
const filename = path$
|
|
1536
|
-
const stat = fs$
|
|
1531
|
+
const filename = path$4.join(startPath, file);
|
|
1532
|
+
const stat = fs$6.lstatSync(filename); // 当前文件是文件夹类型,继续递归
|
|
1537
1533
|
|
|
1538
1534
|
if (stat.isDirectory()) {
|
|
1539
1535
|
find(filename, filter);
|
|
@@ -1547,11 +1543,11 @@ const findFilesByFilter = (startPath, filter) => {
|
|
|
1547
1543
|
find(startPath, filter);
|
|
1548
1544
|
return result;
|
|
1549
1545
|
};
|
|
1550
|
-
/**
|
|
1551
|
-
* 找到项目中所有的package.json文件
|
|
1552
|
-
* @param {Array<String>} subRoots 需要安装npm依赖的路径
|
|
1553
|
-
* @param {String} contextDir 命令运行的目录
|
|
1554
|
-
* @returns {Array<String>} 找到的所有package.json文件的路径
|
|
1546
|
+
/**
|
|
1547
|
+
* 找到项目中所有的package.json文件
|
|
1548
|
+
* @param {Array<String>} subRoots 需要安装npm依赖的路径
|
|
1549
|
+
* @param {String} contextDir 命令运行的目录
|
|
1550
|
+
* @returns {Array<String>} 找到的所有package.json文件的路径
|
|
1555
1551
|
*/
|
|
1556
1552
|
|
|
1557
1553
|
|
|
@@ -1559,7 +1555,7 @@ const findAllPackageJson = (subRoots = [], contextDir) => {
|
|
|
1559
1555
|
const packageJsonName = 'package.json'; // 查找文件名
|
|
1560
1556
|
|
|
1561
1557
|
const cwd = contextDir || dirPath;
|
|
1562
|
-
const result = [path$
|
|
1558
|
+
const result = [path$4.join(cwd, packageJsonName)]; // 默认填充根目录下的package.json
|
|
1563
1559
|
|
|
1564
1560
|
subRoots.forEach(subRoot => {
|
|
1565
1561
|
if (!subRoot.root) {
|
|
@@ -1567,7 +1563,7 @@ const findAllPackageJson = (subRoots = [], contextDir) => {
|
|
|
1567
1563
|
process.exit(1);
|
|
1568
1564
|
}
|
|
1569
1565
|
|
|
1570
|
-
const toppath = path$
|
|
1566
|
+
const toppath = path$4.join(cwd, subRoot.root); // 从该目录开始查找package.json文件
|
|
1571
1567
|
|
|
1572
1568
|
const list = findFilesByFilter(toppath, packageJsonName);
|
|
1573
1569
|
result.push(...list);
|
|
@@ -1583,7 +1579,7 @@ function cloudNpmInstall$1(contextDir) {
|
|
|
1583
1579
|
}
|
|
1584
1580
|
|
|
1585
1581
|
files.forEach(file => {
|
|
1586
|
-
const dir = path$
|
|
1582
|
+
const dir = path$4.dirname(file);
|
|
1587
1583
|
shell.cd(dir);
|
|
1588
1584
|
shell.exec('npx npm install --production --registry http://mirrors.tencent.com/npm/', {
|
|
1589
1585
|
silent: false
|
|
@@ -1631,7 +1627,7 @@ async function install$2(tmsConfig, modules, isCloud = false) {
|
|
|
1631
1627
|
var install_1 = install$2;
|
|
1632
1628
|
|
|
1633
1629
|
const shelljs$3 = require$$4__default;
|
|
1634
|
-
const fs$
|
|
1630
|
+
const fs$5 = require$$0__default$1;
|
|
1635
1631
|
const io = io$2;
|
|
1636
1632
|
const {
|
|
1637
1633
|
resolve: resolve$6,
|
|
@@ -1652,22 +1648,22 @@ const {
|
|
|
1652
1648
|
subModulesMergeDepModules: subModulesMergeDepModules$1
|
|
1653
1649
|
} = tkitUtils;
|
|
1654
1650
|
const {
|
|
1655
|
-
fail: fail$
|
|
1651
|
+
fail: fail$3
|
|
1656
1652
|
} = log$2;
|
|
1657
1653
|
const install$1 = install_1;
|
|
1658
|
-
/**
|
|
1659
|
-
* 拷贝相关配置文件到编译输出目录
|
|
1660
|
-
* @param { object } tmsConfig
|
|
1661
|
-
* @param { array } modules
|
|
1662
|
-
* @param { array } defaultFiles 默认需要拷贝的配置项
|
|
1663
|
-
* @returns
|
|
1654
|
+
/**
|
|
1655
|
+
* 拷贝相关配置文件到编译输出目录
|
|
1656
|
+
* @param { object } tmsConfig
|
|
1657
|
+
* @param { array } modules
|
|
1658
|
+
* @param { array } defaultFiles 默认需要拷贝的配置项
|
|
1659
|
+
* @returns
|
|
1664
1660
|
*/
|
|
1665
1661
|
|
|
1666
1662
|
const cpFilesToOutput = function (tmsConfig, targetModules, defaultFiles) {
|
|
1667
1663
|
const outputDir = resolve$6(tmsConfig.outputDir);
|
|
1668
1664
|
io.ensureDirExist(outputDir);
|
|
1669
1665
|
defaultFiles.forEach(item => {
|
|
1670
|
-
if (fs$
|
|
1666
|
+
if (fs$5.existsSync(resolve$6(item))) {
|
|
1671
1667
|
shelljs$3.cp('-rf', resolve$6(item), resolve$6(tmsConfig.outputDir, item));
|
|
1672
1668
|
}
|
|
1673
1669
|
}); // 拷贝模块的package.json到编译输出目录
|
|
@@ -1675,14 +1671,14 @@ const cpFilesToOutput = function (tmsConfig, targetModules, defaultFiles) {
|
|
|
1675
1671
|
targetModules.forEach(item => {
|
|
1676
1672
|
const outputModuleDir = resolve$6(`${tmsConfig.outputDir}/${item.root}`);
|
|
1677
1673
|
|
|
1678
|
-
if (!fs$
|
|
1679
|
-
fail$
|
|
1674
|
+
if (!fs$5.existsSync(resolve$6(item.path))) {
|
|
1675
|
+
fail$3(`${item.path}模块代码路径不存在, 请检查tms.config.js的${item.name}模块的path`);
|
|
1680
1676
|
process.exit(1);
|
|
1681
1677
|
}
|
|
1682
1678
|
|
|
1683
1679
|
io.ensureDirExist(outputModuleDir);
|
|
1684
1680
|
const modulePackagePath = resolve$6(item.path, 'package.json');
|
|
1685
|
-
if (fs$
|
|
1681
|
+
if (fs$5.existsSync(modulePackagePath)) shelljs$3.cp('-Rf', modulePackagePath, outputModuleDir);
|
|
1686
1682
|
});
|
|
1687
1683
|
};
|
|
1688
1684
|
|
|
@@ -1710,7 +1706,7 @@ async function init$5(tmsConfig, targetModules, isDev) {
|
|
|
1710
1706
|
};
|
|
1711
1707
|
} catch (error) {
|
|
1712
1708
|
const errMsg = typeof error === 'object' ? error.message : error;
|
|
1713
|
-
fail$
|
|
1709
|
+
fail$3(`init流程出现错误${errMsg}`);
|
|
1714
1710
|
process.exit(1);
|
|
1715
1711
|
}
|
|
1716
1712
|
}
|
|
@@ -1754,10 +1750,10 @@ var replaceEnv_1 = replaceEnv$1;
|
|
|
1754
1750
|
const strip = require$$0__default$8; // 匹配规则
|
|
1755
1751
|
|
|
1756
1752
|
const MATCH_RULE = new RegExp(/@import *(?:url\(['"]?([^'")]+)['"]?\)|['"]([^'"]+)['"]);?/g);
|
|
1757
|
-
/**
|
|
1758
|
-
* 获取样式文件中的@import语句
|
|
1759
|
-
* @param code 代码片段
|
|
1760
|
-
* @returns 结果数组
|
|
1753
|
+
/**
|
|
1754
|
+
* 获取样式文件中的@import语句
|
|
1755
|
+
* @param code 代码片段
|
|
1756
|
+
* @returns 结果数组
|
|
1761
1757
|
*/
|
|
1762
1758
|
|
|
1763
1759
|
const findCssImports$1 = code => {
|
|
@@ -1786,16 +1782,16 @@ var findCssImport = {
|
|
|
1786
1782
|
|
|
1787
1783
|
/* eslint-disable no-param-reassign */
|
|
1788
1784
|
const {
|
|
1789
|
-
fail: fail$
|
|
1785
|
+
fail: fail$2
|
|
1790
1786
|
} = log$2;
|
|
1791
1787
|
|
|
1792
1788
|
function pluginError$3(error, isWatch) {
|
|
1793
1789
|
const errMsg = error.message;
|
|
1794
1790
|
|
|
1795
1791
|
if (isWatch) {
|
|
1796
|
-
fail$
|
|
1792
|
+
fail$2(errMsg);
|
|
1797
1793
|
} else {
|
|
1798
|
-
fail$
|
|
1794
|
+
fail$2(errMsg);
|
|
1799
1795
|
process.exit(1);
|
|
1800
1796
|
}
|
|
1801
1797
|
}
|
|
@@ -1807,7 +1803,7 @@ var pluginError_1 = {
|
|
|
1807
1803
|
/* eslint-disable no-param-reassign */
|
|
1808
1804
|
const through$2 = require$$0__default$7;
|
|
1809
1805
|
const precinct = require$$1__default$4;
|
|
1810
|
-
const path$
|
|
1806
|
+
const path$3 = require$$3__default;
|
|
1811
1807
|
const {
|
|
1812
1808
|
findCssImports
|
|
1813
1809
|
} = findCssImport;
|
|
@@ -1819,7 +1815,7 @@ const {
|
|
|
1819
1815
|
const {
|
|
1820
1816
|
resolve: resolve$5
|
|
1821
1817
|
} = widgets;
|
|
1822
|
-
const fs$
|
|
1818
|
+
const fs$4 = require$$0__default$1;
|
|
1823
1819
|
const {
|
|
1824
1820
|
pluginError: pluginError$2
|
|
1825
1821
|
} = pluginError_1;
|
|
@@ -1832,16 +1828,16 @@ const dfsFindCommonDep$2 = function (anaFileOriginFile, anaFileDestFile, extensi
|
|
|
1832
1828
|
let contents = '';
|
|
1833
1829
|
|
|
1834
1830
|
try {
|
|
1835
|
-
contents = fs$
|
|
1831
|
+
contents = fs$4.readFileSync(anaFileOriginFile, 'utf8');
|
|
1836
1832
|
} catch (e) {
|
|
1837
1833
|
pluginError$2(e, isWatch);
|
|
1838
1834
|
}
|
|
1839
1835
|
|
|
1840
|
-
const deps = cssFilter.indexOf(path$
|
|
1836
|
+
const deps = cssFilter.indexOf(path$3.extname(anaFileOriginFile)) > -1 ? findCssImports(contents) : precinct(contents);
|
|
1841
1837
|
deps.forEach(depItem => {
|
|
1842
1838
|
if (depItem.startsWith('.')) {
|
|
1843
1839
|
// 被依赖文件的存在的绝对路径
|
|
1844
|
-
const depOriginPath = path$
|
|
1840
|
+
const depOriginPath = path$3.join(path$3.dirname(anaFileOriginFile), depItem); // 被依赖文件加上后缀
|
|
1845
1841
|
|
|
1846
1842
|
const {
|
|
1847
1843
|
ext: extAlias,
|
|
@@ -1849,12 +1845,12 @@ const dfsFindCommonDep$2 = function (anaFileOriginFile, anaFileDestFile, extensi
|
|
|
1849
1845
|
extPath
|
|
1850
1846
|
} = ext$2(depOriginPath, extensions);
|
|
1851
1847
|
|
|
1852
|
-
if (!fs$
|
|
1848
|
+
if (!fs$4.existsSync(depOriginFile)) {
|
|
1853
1849
|
pluginError$2(new Error(`${anaFileOriginFile}引用路径${depOriginFile}文件不存在, 请检查应用路径`), isWatch);
|
|
1854
1850
|
return;
|
|
1855
1851
|
}
|
|
1856
1852
|
|
|
1857
|
-
const depDestPath = resolve$5(path$
|
|
1853
|
+
const depDestPath = resolve$5(path$3.dirname(anaFileDestFile), depItem);
|
|
1858
1854
|
const depDestFile = depDestPath.endsWith(extAlias) ? depDestPath : depDestPath + extPath;
|
|
1859
1855
|
|
|
1860
1856
|
if (!resDep.has(depDestFile)) {
|
|
@@ -1878,19 +1874,19 @@ function mpCommonDep$1(tmsConfig, module, extensions = [], isWatch = true) {
|
|
|
1878
1874
|
const stream = through$2.obj(function (file, enc, cb) {
|
|
1879
1875
|
// 依赖分析的文件
|
|
1880
1876
|
const anaFileOriginFile = file.history[0];
|
|
1881
|
-
const anaFileRelativeModule = path$
|
|
1877
|
+
const anaFileRelativeModule = path$3.relative(resolve$5(module.from), anaFileOriginFile);
|
|
1882
1878
|
const anaFileDestFile = resolve$5(tmsConfig.outputDir, module.to, anaFileRelativeModule);
|
|
1883
1879
|
|
|
1884
1880
|
if (file.isBuffer()) {
|
|
1885
1881
|
let contents = String(file.contents);
|
|
1886
|
-
const deps = cssFilter.indexOf(path$
|
|
1882
|
+
const deps = cssFilter.indexOf(path$3.extname(file.path)) > -1 ? findCssImports(contents) : precinct(contents);
|
|
1887
1883
|
const copyModules = new Map();
|
|
1888
1884
|
Object.keys(tmsConfig.dependencies).forEach(includeName => {
|
|
1889
1885
|
const includePath = tmsConfig.dependencies[includeName];
|
|
1890
1886
|
deps.forEach(depItem => {
|
|
1891
1887
|
if (depItem.indexOf(includeName) > -1) {
|
|
1892
1888
|
// 被依赖文件的存在的绝对路径 (eg: /User/thirdparty/loadsh)
|
|
1893
|
-
const depOriginPath = path$
|
|
1889
|
+
const depOriginPath = path$3.join(path$3.dirname(anaFileOriginFile), depItem); // 被依赖文件加上后缀
|
|
1894
1890
|
|
|
1895
1891
|
const {
|
|
1896
1892
|
ext: extAlias,
|
|
@@ -1916,7 +1912,7 @@ function mpCommonDep$1(tmsConfig, module, extensions = [], isWatch = true) {
|
|
|
1916
1912
|
depOriginFile,
|
|
1917
1913
|
depDestFile,
|
|
1918
1914
|
beforeDepPath: depItem,
|
|
1919
|
-
afterDepPath: path$
|
|
1915
|
+
afterDepPath: path$3.relative(path$3.dirname(anaFileDestFile), depDestPath).replace(/\\/g, '/')
|
|
1920
1916
|
});
|
|
1921
1917
|
}
|
|
1922
1918
|
}
|
|
@@ -1954,7 +1950,7 @@ var mpCommonDep_1 = {
|
|
|
1954
1950
|
|
|
1955
1951
|
/* eslint-disable no-param-reassign */
|
|
1956
1952
|
const through$1 = require$$0__default$7;
|
|
1957
|
-
const path$
|
|
1953
|
+
const path$2 = require$$3__default;
|
|
1958
1954
|
const {
|
|
1959
1955
|
ext: ext$1,
|
|
1960
1956
|
fileInDir: fileInDir$1,
|
|
@@ -1963,7 +1959,7 @@ const {
|
|
|
1963
1959
|
const {
|
|
1964
1960
|
resolve: resolve$4
|
|
1965
1961
|
} = widgets;
|
|
1966
|
-
const fs$
|
|
1962
|
+
const fs$3 = require$$0__default$1;
|
|
1967
1963
|
const {
|
|
1968
1964
|
pluginError: pluginError$1
|
|
1969
1965
|
} = pluginError_1;
|
|
@@ -1975,7 +1971,7 @@ function mpJsonDep$1(tmsConfig, module, extensions = ['.json'], filesExt = ['.wx
|
|
|
1975
1971
|
const stream = through$1.obj(function (file, enc, cb) {
|
|
1976
1972
|
// 当前分析的文件的路径
|
|
1977
1973
|
const anaFileOriginFile = file.history[0];
|
|
1978
|
-
const anaFileRelativeModule = path$
|
|
1974
|
+
const anaFileRelativeModule = path$2.relative(resolve$4(module.from), anaFileOriginFile);
|
|
1979
1975
|
const anaFileDestFile = resolve$4(tmsConfig.outputDir, module.to, anaFileRelativeModule);
|
|
1980
1976
|
|
|
1981
1977
|
if (file.isBuffer()) {
|
|
@@ -1992,7 +1988,7 @@ function mpJsonDep$1(tmsConfig, module, extensions = ['.json'], filesExt = ['.wx
|
|
|
1992
1988
|
const componentPath = contents.usingComponents[componentKey];
|
|
1993
1989
|
|
|
1994
1990
|
if (componentPath.indexOf(includeName) > -1) {
|
|
1995
|
-
const depOriginPath = path$
|
|
1991
|
+
const depOriginPath = path$2.join(path$2.dirname(anaFileOriginFile), componentPath); // 被依赖文件加上后缀
|
|
1996
1992
|
|
|
1997
1993
|
const {
|
|
1998
1994
|
ext: extAlias,
|
|
@@ -2020,7 +2016,7 @@ function mpJsonDep$1(tmsConfig, module, extensions = ['.json'], filesExt = ['.wx
|
|
|
2020
2016
|
depOriginExt: extAlias,
|
|
2021
2017
|
depDestFile,
|
|
2022
2018
|
beforeDepPath: componentPath,
|
|
2023
|
-
afterDepPath: path$
|
|
2019
|
+
afterDepPath: path$2.relative(path$2.dirname(anaFileDestFile), depDestPath).replace(/\\/g, '/')
|
|
2024
2020
|
});
|
|
2025
2021
|
}
|
|
2026
2022
|
}
|
|
@@ -2045,7 +2041,7 @@ function mpJsonDep$1(tmsConfig, module, extensions = ['.json'], filesExt = ['.wx
|
|
|
2045
2041
|
const originFile = depOriginFile.replace(depOriginExt, extKey);
|
|
2046
2042
|
const destFile = depDestFile.replace(depOriginExt, extKey);
|
|
2047
2043
|
|
|
2048
|
-
if (fs$
|
|
2044
|
+
if (fs$3.existsSync(originFile)) {
|
|
2049
2045
|
diffContentCopyFile$1(originFile, destFile);
|
|
2050
2046
|
const extensionsFilter = ['.js', '.ts', '.wxss', '.less'];
|
|
2051
2047
|
|
|
@@ -2079,8 +2075,8 @@ var mpJsonDep_1 = {
|
|
|
2079
2075
|
/* eslint-disable no-param-reassign */
|
|
2080
2076
|
const through = require$$0__default$7;
|
|
2081
2077
|
const htmlparser2 = require$$1__default$5;
|
|
2082
|
-
const fs$
|
|
2083
|
-
const path$
|
|
2078
|
+
const fs$2 = require$$0__default$1;
|
|
2079
|
+
const path$1 = require$$3__default;
|
|
2084
2080
|
const {
|
|
2085
2081
|
diffContentCopyFile,
|
|
2086
2082
|
ext,
|
|
@@ -2126,7 +2122,7 @@ const dfsFindWxmlDep = function (anaFileOriginFile, anaFileDestFile, isWatch = t
|
|
|
2126
2122
|
let contents = '';
|
|
2127
2123
|
|
|
2128
2124
|
try {
|
|
2129
|
-
contents = fs$
|
|
2125
|
+
contents = fs$2.readFileSync(anaFileOriginFile, 'utf8');
|
|
2130
2126
|
} catch (e) {
|
|
2131
2127
|
pluginError(e, isWatch);
|
|
2132
2128
|
}
|
|
@@ -2136,7 +2132,7 @@ const dfsFindWxmlDep = function (anaFileOriginFile, anaFileDestFile, isWatch = t
|
|
|
2136
2132
|
var _attributes$src;
|
|
2137
2133
|
|
|
2138
2134
|
if (attributes !== null && attributes !== void 0 && (_attributes$src = attributes.src) !== null && _attributes$src !== void 0 && _attributes$src.startsWith('.')) {
|
|
2139
|
-
const depOriginPath = path$
|
|
2135
|
+
const depOriginPath = path$1.join(path$1.dirname(anaFileOriginFile), attributes.src); // 被依赖文件加上后缀
|
|
2140
2136
|
|
|
2141
2137
|
const {
|
|
2142
2138
|
ext,
|
|
@@ -2144,12 +2140,12 @@ const dfsFindWxmlDep = function (anaFileOriginFile, anaFileDestFile, isWatch = t
|
|
|
2144
2140
|
extPath
|
|
2145
2141
|
} = extFile(name, depOriginPath);
|
|
2146
2142
|
|
|
2147
|
-
if (!fs$
|
|
2143
|
+
if (!fs$2.existsSync(depOriginFile)) {
|
|
2148
2144
|
pluginError(new Error(`${anaFileOriginFile}引用的路径${depOriginFile}找不到应用文件,请检查引用路径`), isWatch);
|
|
2149
2145
|
return;
|
|
2150
2146
|
}
|
|
2151
2147
|
|
|
2152
|
-
const depDestPath = path$
|
|
2148
|
+
const depDestPath = path$1.join(path$1.dirname(anaFileDestFile), attributes.src);
|
|
2153
2149
|
const depDestFile = depDestPath.endsWith(ext) ? depDestPath : depDestPath + extPath; // 收集wxml依赖
|
|
2154
2150
|
|
|
2155
2151
|
if (['import', 'include'].indexOf(name) > -1) {
|
|
@@ -2201,7 +2197,7 @@ function mpWxmlDep$1(tmsConfig, module, isWatch) {
|
|
|
2201
2197
|
const stream = through.obj(function (file, enc, cb) {
|
|
2202
2198
|
// 依赖分析的文件
|
|
2203
2199
|
const anaFileOriginFile = file.history[0];
|
|
2204
|
-
const anaFileRelativeModule = path$
|
|
2200
|
+
const anaFileRelativeModule = path$1.relative(resolve$3(module.from), anaFileOriginFile);
|
|
2205
2201
|
const anaFileDestFile = resolve$3(tmsConfig.outputDir, module.to, anaFileRelativeModule);
|
|
2206
2202
|
|
|
2207
2203
|
if (file.isBuffer()) {
|
|
@@ -2212,7 +2208,7 @@ function mpWxmlDep$1(tmsConfig, module, isWatch) {
|
|
|
2212
2208
|
const nameFilter = ['import', 'include', 'wxs'];
|
|
2213
2209
|
|
|
2214
2210
|
if (nameFilter.indexOf(name) > -1 && attributes.src) {
|
|
2215
|
-
const depOriginPath = path$
|
|
2211
|
+
const depOriginPath = path$1.join(path$1.dirname(anaFileOriginFile), attributes.src); // 处理后缀(源码引入依赖时,后缀不全的情况)
|
|
2216
2212
|
|
|
2217
2213
|
const {
|
|
2218
2214
|
ext,
|
|
@@ -2241,7 +2237,7 @@ function mpWxmlDep$1(tmsConfig, module, isWatch) {
|
|
|
2241
2237
|
depOriginFile,
|
|
2242
2238
|
depDestFile,
|
|
2243
2239
|
beforeDepPath: attributes.src,
|
|
2244
|
-
afterDepPath: path$
|
|
2240
|
+
afterDepPath: path$1.relative(path$1.dirname(anaFileDestFile), depDestFile).replace(/\\/g, '/')
|
|
2245
2241
|
});
|
|
2246
2242
|
}
|
|
2247
2243
|
}
|
|
@@ -2260,7 +2256,7 @@ function mpWxmlDep$1(tmsConfig, module, isWatch) {
|
|
|
2260
2256
|
beforeDepPath,
|
|
2261
2257
|
afterDepPath
|
|
2262
2258
|
}) => {
|
|
2263
|
-
if (fs$
|
|
2259
|
+
if (fs$2.existsSync(depOriginFile)) {
|
|
2264
2260
|
diffContentCopyFile(depOriginFile, depDestFile);
|
|
2265
2261
|
const reg = new RegExp(`['"]${beforeDepPath}["']`, 'g');
|
|
2266
2262
|
contents = contents.replace(reg, `"${afterDepPath}"`);
|
|
@@ -2296,81 +2292,13 @@ var mpWxmlDep_1 = {
|
|
|
2296
2292
|
dfsFindWxmlDep
|
|
2297
2293
|
};
|
|
2298
2294
|
|
|
2299
|
-
/* eslint-disable no-param-reassign */
|
|
2300
|
-
const postcss$1 = require$$0__default$9;
|
|
2301
|
-
const fs$2 = require$$0__default$1;
|
|
2302
|
-
const path$1 = require$$3__default;
|
|
2303
|
-
const {
|
|
2304
|
-
fail: fail$2
|
|
2305
|
-
} = log$2;
|
|
2306
|
-
var postcssFontBase64 = postcss$1.plugin('postcss-font-base64', options => {
|
|
2307
|
-
options = { ...options,
|
|
2308
|
-
...{
|
|
2309
|
-
match: {
|
|
2310
|
-
Scrabble: ['fakefont']
|
|
2311
|
-
},
|
|
2312
|
-
format: ['eot', 'woff', 'woff2', 'ttf']
|
|
2313
|
-
}
|
|
2314
|
-
};
|
|
2315
|
-
return function (css, result) {
|
|
2316
|
-
css.walkAtRules('font-face', fontFace => {
|
|
2317
|
-
const fileTypeRegex = getRegexStringForFileTypes(options.format);
|
|
2318
|
-
fontFace.replaceValues(new RegExp(`url\\(["']?.+\\.${fileTypeRegex}["']?\\)`), attr => {
|
|
2319
|
-
const fontRePath = attr.replace(/(url|'|"|\(|\)|\?#iefix)/g, '');
|
|
2320
|
-
const fontAbPath = path$1.join(path$1.dirname(result.opts.from), fontRePath);
|
|
2321
|
-
const res64 = base64Encode(fontAbPath);
|
|
2322
|
-
const newUrlStr = 'url(data:'.concat(getMimeType(attr)).concat(';charset=utf-8;base64,').concat(res64).concat(')');
|
|
2323
|
-
return res64 ? newUrlStr : attr;
|
|
2324
|
-
});
|
|
2325
|
-
});
|
|
2326
|
-
|
|
2327
|
-
function getRegexStringForFileTypes(fileTypes) {
|
|
2328
|
-
const regex = fileTypes.map(fileType => fileType === 'eot' ? fileType.concat('(\\?#iefix)?') : fileType).join('|');
|
|
2329
|
-
return regex ? `(${regex})` : '';
|
|
2330
|
-
} // helper functions
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
function getMimeType(attribute) {
|
|
2334
|
-
const formats = {
|
|
2335
|
-
'.woff': 'application/font-woff',
|
|
2336
|
-
'.woff2': 'font/woff2',
|
|
2337
|
-
'.ttf': 'application/font-sfnt',
|
|
2338
|
-
'.eot': 'application/vnd.ms-fontobject',
|
|
2339
|
-
'.otf': 'application/font-sfnt'
|
|
2340
|
-
};
|
|
2341
|
-
let match = '';
|
|
2342
|
-
const extension = attribute.match(/\.[a-z]{3,4}/)[0];
|
|
2343
|
-
|
|
2344
|
-
if (extension in formats) {
|
|
2345
|
-
match = formats[extension];
|
|
2346
|
-
}
|
|
2347
|
-
return match;
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
function base64Encode(file) {
|
|
2351
|
-
if (fs$2.existsSync(file)) {
|
|
2352
|
-
return readAndEncodeFile(file);
|
|
2353
|
-
}
|
|
2354
|
-
|
|
2355
|
-
fail$2(`${file} does not exist.`);
|
|
2356
|
-
return '';
|
|
2357
|
-
}
|
|
2358
|
-
|
|
2359
|
-
function readAndEncodeFile(file) {
|
|
2360
|
-
const bitmap = fs$2.readFileSync(file);
|
|
2361
|
-
return Buffer.from(bitmap).toString('base64');
|
|
2362
|
-
}
|
|
2363
|
-
};
|
|
2364
|
-
});
|
|
2365
|
-
|
|
2366
2295
|
const {
|
|
2367
2296
|
src: src$1,
|
|
2368
2297
|
dest,
|
|
2369
2298
|
lastRun
|
|
2370
|
-
} = require$$0__default$
|
|
2299
|
+
} = require$$0__default$9;
|
|
2371
2300
|
const px2rpx = require$$1__default$6;
|
|
2372
|
-
const
|
|
2373
|
-
const watch = require$$3__default$1; // const cache = require('gulp-cache');
|
|
2301
|
+
const watch = require$$2__default$2; // const cache = require('gulp-cache');
|
|
2374
2302
|
// const image = require('gulp-image');
|
|
2375
2303
|
|
|
2376
2304
|
const replaceEnv = replaceEnv_1;
|
|
@@ -2383,7 +2311,6 @@ const {
|
|
|
2383
2311
|
const {
|
|
2384
2312
|
mpWxmlDep
|
|
2385
2313
|
} = mpWxmlDep_1;
|
|
2386
|
-
const base64 = postcssFontBase64;
|
|
2387
2314
|
const {
|
|
2388
2315
|
fail: fail$1
|
|
2389
2316
|
} = log$2;
|
|
@@ -2421,9 +2348,7 @@ var compile = function (tmsConfig, {
|
|
|
2421
2348
|
break;
|
|
2422
2349
|
|
|
2423
2350
|
case 'wxss':
|
|
2424
|
-
srcPipe.pipe(mpCommonDep(tmsConfig, module, ['.wxss', '.less'], isWatch)).pipe(
|
|
2425
|
-
fail$1(`postcss编译报错${err}`);
|
|
2426
|
-
}).pipe(px2rpx({
|
|
2351
|
+
srcPipe.pipe(mpCommonDep(tmsConfig, module, ['.wxss', '.less'], isWatch)).pipe(px2rpx({
|
|
2427
2352
|
designWidth: 375,
|
|
2428
2353
|
// 设计稿宽度,默认为750
|
|
2429
2354
|
precision: 2 // 小数最大精度,默认为6
|
|
@@ -2457,7 +2382,7 @@ var compile = function (tmsConfig, {
|
|
|
2457
2382
|
};
|
|
2458
2383
|
|
|
2459
2384
|
(function (module) {
|
|
2460
|
-
const watch = require$$
|
|
2385
|
+
const watch = require$$2__default$2;
|
|
2461
2386
|
const {
|
|
2462
2387
|
resolve
|
|
2463
2388
|
} = widgets;
|
|
@@ -2598,12 +2523,12 @@ const getLatestVersion = npmName => {
|
|
|
2598
2523
|
const data = shelljs$2.exec(`npm view ${npmName} version`);
|
|
2599
2524
|
return data.stdout || '0.0.0';
|
|
2600
2525
|
};
|
|
2601
|
-
/**
|
|
2602
|
-
* 检查package.json的依赖大于node_module的版本,则返回true
|
|
2603
|
-
* @param {*} modules 模块
|
|
2604
|
-
* @param {*} cwd 待检查package.json所在的目录 (eg: 当前执行脚本的目录)
|
|
2605
|
-
* @param {*} outputDir 待检查node_modules存放的目录 (eg: dist/node_modules)
|
|
2606
|
-
* @returns
|
|
2526
|
+
/**
|
|
2527
|
+
* 检查package.json的依赖大于node_module的版本,则返回true
|
|
2528
|
+
* @param {*} modules 模块
|
|
2529
|
+
* @param {*} cwd 待检查package.json所在的目录 (eg: 当前执行脚本的目录)
|
|
2530
|
+
* @param {*} outputDir 待检查node_modules存放的目录 (eg: dist/node_modules)
|
|
2531
|
+
* @returns
|
|
2607
2532
|
*/
|
|
2608
2533
|
|
|
2609
2534
|
|
|
@@ -2926,7 +2851,7 @@ var entry = [{
|
|
|
2926
2851
|
|
|
2927
2852
|
var require$$6 = {
|
|
2928
2853
|
name: "@tmsfe/tmskit",
|
|
2929
|
-
version: "0.0.
|
|
2854
|
+
version: "0.0.7",
|
|
2930
2855
|
description: "tmskit",
|
|
2931
2856
|
main: "main.js",
|
|
2932
2857
|
bin: {
|
|
@@ -3008,11 +2933,11 @@ const {
|
|
|
3008
2933
|
} = widgets;
|
|
3009
2934
|
const requiredVersion = packageJson.engines.node;
|
|
3010
2935
|
const packName = packageJson.name;
|
|
3011
|
-
/**
|
|
3012
|
-
* 检查node版本
|
|
3013
|
-
* @param {String} wanted 希望的node版本
|
|
3014
|
-
* @param {String} id 某node特性
|
|
3015
|
-
* @returns {Undefined} 无需返回值
|
|
2936
|
+
/**
|
|
2937
|
+
* 检查node版本
|
|
2938
|
+
* @param {String} wanted 希望的node版本
|
|
2939
|
+
* @param {String} id 某node特性
|
|
2940
|
+
* @returns {Undefined} 无需返回值
|
|
3016
2941
|
*/
|
|
3017
2942
|
|
|
3018
2943
|
const checkNodeVersion = (wanted, id) => {
|
|
@@ -3023,9 +2948,9 @@ const checkNodeVersion = (wanted, id) => {
|
|
|
3023
2948
|
process.exit(1);
|
|
3024
2949
|
}
|
|
3025
2950
|
};
|
|
3026
|
-
/**
|
|
3027
|
-
* 检查运行环境
|
|
3028
|
-
* @returns {Undefined} 无需返回值
|
|
2951
|
+
/**
|
|
2952
|
+
* 检查运行环境
|
|
2953
|
+
* @returns {Undefined} 无需返回值
|
|
3029
2954
|
*/
|
|
3030
2955
|
|
|
3031
2956
|
|