@we-debug/gulp-tool 0.45.0 → 0.47.0
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/CHANGELOG.md +19 -0
- package/dist/index.js +7 -2
- package/dist/types.d.ts +3 -1
- package/package.json +2 -2
- package/src/index.ts +7 -2
- package/src/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.47.0](https://github.com/dlhandsome/we-debug/compare/v0.46.1...v0.47.0) (2025-05-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* support auto inject custom mask props ([6b2df07](https://github.com/dlhandsome/we-debug/commit/6b2df071b1137f516e1e61001e73531aeb983ef6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.46.0](https://github.com/dlhandsome/we-debug/compare/v0.45.2...v0.46.0) (2025-03-11)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @we-debug/gulp-tool
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.45.0](https://github.com/dlhandsome/we-debug/compare/v0.44.2...v0.45.0) (2025-03-11)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @we-debug/gulp-tool
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var hasInit = false;
|
|
|
29
29
|
function mpGlobalComp(options) {
|
|
30
30
|
if (options === void 0) { options = {}; }
|
|
31
31
|
var baseDir = options.baseDir || 'src';
|
|
32
|
-
var wxmlRaw = options.wxml ||
|
|
32
|
+
var wxmlRaw = options.wxml || (function (props) { return "<we-debug useCustomMask=\"{{".concat(props.useCustomMask, "}}\" />"); });
|
|
33
33
|
var filter = options.filter || '';
|
|
34
34
|
var compName = options.compName || 'we-debug';
|
|
35
35
|
var compPath = options.compPath || '@we-debug/miniprogram/index/index';
|
|
@@ -84,7 +84,12 @@ function mpGlobalComp(options) {
|
|
|
84
84
|
if ((0, belongs_1.belongsPage)(file.path, pages)) {
|
|
85
85
|
plugin_1.default.execLifecycle('beforeInsertWxml', file);
|
|
86
86
|
var code = file.contents.toString();
|
|
87
|
-
|
|
87
|
+
var injectWxml = typeof wxmlRaw === 'function'
|
|
88
|
+
? wxmlRaw({
|
|
89
|
+
useCustomMask: code.indexOf('<page-container') > -1
|
|
90
|
+
})
|
|
91
|
+
: wxmlRaw;
|
|
92
|
+
code += injectWxml;
|
|
88
93
|
file.contents = Buffer.from(code);
|
|
89
94
|
plugin_1.default.execLifecycle('afterInsertWxml', file);
|
|
90
95
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -48,7 +48,9 @@ export interface ICompilerPluginOption<T extends IAnyObject = IAnyObject> {
|
|
|
48
48
|
}
|
|
49
49
|
export interface ICompilerOption<T extends IAnyObject = IAnyObject> {
|
|
50
50
|
baseDir?: string;
|
|
51
|
-
wxml?: string
|
|
51
|
+
wxml?: string | ((props: {
|
|
52
|
+
useCustomMask: boolean;
|
|
53
|
+
}) => string);
|
|
52
54
|
filter?: FilterOption;
|
|
53
55
|
compName?: string;
|
|
54
56
|
compPath?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@we-debug/gulp-tool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "we-debug, gulp",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types.d.ts",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"readme": "ERROR: No README data found!",
|
|
33
33
|
"_id": "@we-debug/gulp-tool@0.1.3",
|
|
34
34
|
"_commitid": "f35f53c",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "ecf84321e58ca53b603a73002298c66d06908e8e"
|
|
36
36
|
}
|
package/src/index.ts
CHANGED
|
@@ -28,7 +28,7 @@ let hasInit = false;
|
|
|
28
28
|
function mpGlobalComp(options: ICompilerOption = {}) {
|
|
29
29
|
//
|
|
30
30
|
let baseDir = options.baseDir || 'src';
|
|
31
|
-
const wxmlRaw = options.wxml ||
|
|
31
|
+
const wxmlRaw = options.wxml || ((props) => `<we-debug useCustomMask="{{${props.useCustomMask}}}" />`);
|
|
32
32
|
const filter = options.filter || '';
|
|
33
33
|
let compName = options.compName || 'we-debug';
|
|
34
34
|
let compPath = options.compPath || '@we-debug/miniprogram/index/index';
|
|
@@ -101,8 +101,13 @@ function mpGlobalComp(options: ICompilerOption = {}) {
|
|
|
101
101
|
// 插入 we-debug 片段之前执行
|
|
102
102
|
plugin.execLifecycle('beforeInsertWxml', file);
|
|
103
103
|
let code = file.contents.toString();
|
|
104
|
+
let injectWxml = typeof wxmlRaw === 'function'
|
|
105
|
+
? wxmlRaw({
|
|
106
|
+
useCustomMask: code.indexOf('<page-container') > -1
|
|
107
|
+
})
|
|
108
|
+
: wxmlRaw;
|
|
104
109
|
|
|
105
|
-
code +=
|
|
110
|
+
code += injectWxml;
|
|
106
111
|
|
|
107
112
|
file.contents = Buffer.from(code);
|
|
108
113
|
// 插入 we-debug 片段之后执行
|
package/src/types.ts
CHANGED
|
@@ -85,7 +85,7 @@ export interface ICompilerPluginOption<T extends IAnyObject = IAnyObject> {
|
|
|
85
85
|
export interface ICompilerOption<T extends IAnyObject = IAnyObject> {
|
|
86
86
|
/** */
|
|
87
87
|
baseDir?: string;
|
|
88
|
-
wxml?: string;
|
|
88
|
+
wxml?: string | ((props: { useCustomMask: boolean }) => string);
|
|
89
89
|
filter?: FilterOption;
|
|
90
90
|
compName?: string;
|
|
91
91
|
compPath?: string;
|