@tmsfe/tmskit 0.0.22 → 0.0.23
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/index.cjs.js
CHANGED
|
@@ -464,6 +464,9 @@ const CREATE_TEMPLATE_QUESTION$1 = [{
|
|
|
464
464
|
}, {
|
|
465
465
|
name: '构建工具扩展命令',
|
|
466
466
|
value: 'cmd'
|
|
467
|
+
}, {
|
|
468
|
+
name: '构建工具编译插件',
|
|
469
|
+
value: 'plugin'
|
|
467
470
|
}]
|
|
468
471
|
}];
|
|
469
472
|
var constant = {
|
|
@@ -2587,16 +2590,16 @@ var init_1 = init$3;
|
|
|
2587
2590
|
|
|
2588
2591
|
function mpProjectJson$1() {
|
|
2589
2592
|
return function ({
|
|
2590
|
-
|
|
2591
|
-
|
|
2593
|
+
vinyl,
|
|
2594
|
+
next
|
|
2592
2595
|
}) {
|
|
2593
|
-
if (
|
|
2594
|
-
let contents = String(
|
|
2596
|
+
if (vinyl.isBuffer()) {
|
|
2597
|
+
let contents = String(vinyl.contents);
|
|
2595
2598
|
contents = contents.replace(/"miniprogramRoot"[^,]+,/g, '');
|
|
2596
|
-
|
|
2599
|
+
vinyl.contents = Buffer.from(contents);
|
|
2597
2600
|
}
|
|
2598
2601
|
|
|
2599
|
-
|
|
2602
|
+
next();
|
|
2600
2603
|
};
|
|
2601
2604
|
}
|
|
2602
2605
|
|
|
@@ -2632,17 +2635,17 @@ const addPlugins = function (tmsConfig, srcPipe, pluginParams) {
|
|
|
2632
2635
|
glob: '**/project.config.json',
|
|
2633
2636
|
action: mpProjectJson()
|
|
2634
2637
|
}, ...plugins];
|
|
2635
|
-
return newPlugins.reduce((srcPipe, pluginItem) => srcPipe.pipe(gulpif(
|
|
2636
|
-
const sourceFile =
|
|
2638
|
+
return newPlugins.reduce((srcPipe, pluginItem) => srcPipe.pipe(gulpif(vinyl => minimatch(vinyl.path, pluginItem.glob), through.obj(function (vinyl, enc, next) {
|
|
2639
|
+
const sourceFile = vinyl.history[0];
|
|
2637
2640
|
pluginItem.action({
|
|
2638
2641
|
tmsConfig,
|
|
2639
2642
|
sourceFile,
|
|
2640
|
-
|
|
2643
|
+
vinyl,
|
|
2641
2644
|
targetFile: getTargetFile$1(sourceFile, pluginParams.module, tmsConfig.outputDir),
|
|
2642
2645
|
isDev: pluginParams.isDev,
|
|
2643
|
-
|
|
2646
|
+
next
|
|
2644
2647
|
});
|
|
2645
|
-
this.push(
|
|
2648
|
+
this.push(vinyl);
|
|
2646
2649
|
}))), srcPipe);
|
|
2647
2650
|
};
|
|
2648
2651
|
|
|
@@ -3162,7 +3165,7 @@ var dev$3 = async (tmsConfig, modules, isDev = true) => {
|
|
|
3162
3165
|
|
|
3163
3166
|
var require$$12 = {
|
|
3164
3167
|
name: "@tmsfe/tmskit",
|
|
3165
|
-
version: "0.0.
|
|
3168
|
+
version: "0.0.23",
|
|
3166
3169
|
description: "tmskit",
|
|
3167
3170
|
main: "dist/index.cjs",
|
|
3168
3171
|
bin: {
|
package/package.json
CHANGED
package/src/compile/compile.js
CHANGED
|
@@ -20,18 +20,18 @@ const addPlugins = function (tmsConfig, srcPipe, pluginParams) {
|
|
|
20
20
|
action: mpProjectJson(),
|
|
21
21
|
}, ...plugins];
|
|
22
22
|
return newPlugins.reduce((srcPipe, pluginItem) => srcPipe.pipe(gulpif(
|
|
23
|
-
|
|
24
|
-
through.obj(function (
|
|
25
|
-
const sourceFile =
|
|
23
|
+
vinyl => minimatch(vinyl.path, pluginItem.glob),
|
|
24
|
+
through.obj(function (vinyl, enc, next) {
|
|
25
|
+
const sourceFile = vinyl.history[0];
|
|
26
26
|
pluginItem.action({
|
|
27
27
|
tmsConfig,
|
|
28
28
|
sourceFile,
|
|
29
|
-
|
|
29
|
+
vinyl,
|
|
30
30
|
targetFile: getTargetFile(sourceFile, pluginParams.module, tmsConfig.outputDir),
|
|
31
31
|
isDev: pluginParams.isDev,
|
|
32
|
-
|
|
32
|
+
next,
|
|
33
33
|
});
|
|
34
|
-
this.push(
|
|
34
|
+
this.push(vinyl);
|
|
35
35
|
}),
|
|
36
36
|
)), srcPipe);
|
|
37
37
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
2
|
function mpProjectJson() {
|
|
3
|
-
return function ({
|
|
4
|
-
if (
|
|
5
|
-
let contents = String(
|
|
3
|
+
return function ({ vinyl, next }) {
|
|
4
|
+
if (vinyl.isBuffer()) {
|
|
5
|
+
let contents = String(vinyl.contents);
|
|
6
6
|
contents = contents.replace(/"miniprogramRoot"[^,]+,/g, '');
|
|
7
|
-
|
|
7
|
+
vinyl.contents = Buffer.from(contents);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
next();
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
2
|
function replaceEnv(reg = /process\.env(\.(\w*))?/g, envData) {
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
let contents = String(
|
|
3
|
+
return function ({ vinyl, next }) {
|
|
4
|
+
if (vinyl.isBuffer()) {
|
|
5
|
+
let contents = String(vinyl.contents);
|
|
6
6
|
let resReg;
|
|
7
|
-
// eslint-disable-next-line
|
|
8
7
|
while ((resReg = reg.exec(contents)) !== null) {
|
|
9
8
|
const [reg1, reg2, reg3] = resReg;
|
|
10
9
|
if (reg1 && reg2 && reg3) {
|
|
@@ -14,16 +13,10 @@ function replaceEnv(reg = /process\.env(\.(\w*))?/g, envData) {
|
|
|
14
13
|
contents = contents.replace(reg1, JSON.stringify(envData));
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line
|
|
19
|
-
file.contents = Buffer.from(contents);
|
|
16
|
+
vinyl.contents = Buffer.from(contents);
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
cb();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return stream;
|
|
18
|
+
next();
|
|
19
|
+
};
|
|
27
20
|
}
|
|
28
21
|
|
|
29
22
|
module.exports = replaceEnv;
|