@we-debug/gulp-tool 0.51.0 → 0.52.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 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.52.0](https://github.com/dlhandsome/we-debug/compare/v0.51.1...v0.52.0) (2026-12-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * resolve subpackage UI plugin host ([0c73838](https://github.com/dlhandsome/we-debug/commit/0c73838496548038dade71630038e7df09c5c10b))
12
+ * **compiler:** relocate copied npm dependencies ([b45f345](https://github.com/dlhandsome/we-debug/commit/b45f345c2b8a1e0ca0a984616dd57ce7147f8e19))
13
+ * **compiler:** relocate gulp compiled entries ([52cc367](https://github.com/dlhandsome/we-debug/commit/52cc36716b02ffe85dfc50da31816d555bab965f))
14
+ * **compiler:** retain async subpackage modules ([85c500e](https://github.com/dlhandsome/we-debug/commit/85c500e14e06ae3ccaa5d6a0cc90b32f23574847))
15
+
16
+
17
+ ### Features
18
+
19
+ * **gulp-tool:** support subpackage injection mode ([e729ed9](https://github.com/dlhandsome/we-debug/commit/e729ed91fa5e40f9dffe6646a757a0f38d5973c3))
20
+
21
+
22
+
23
+
24
+
6
25
  # [0.51.0](https://github.com/dlhandsome/we-debug/compare/v0.50.0...v0.51.0) (2026-12-01)
7
26
 
8
27
 
package/dist/index.js CHANGED
@@ -44,8 +44,9 @@ function mpGlobalComp(options) {
44
44
  if (!streamInjector)
45
45
  return callback();
46
46
  try {
47
+ streamInjector.warnings.forEach(function (w) { return console.warn("[".concat(constants_1.PLUGIN_NAME, "] ").concat(w)); });
47
48
  var base_1 = streamInjector.options.baseDir;
48
- streamInjector.getUIFiles().forEach(function (f) {
49
+ streamInjector.getOutputFiles().forEach(function (f) {
49
50
  if (!seenExtnames[path_1.default.extname(f.relative)])
50
51
  return;
51
52
  _this.push(new vinyl_1.default({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-debug/gulp-tool",
3
- "version": "0.51.0",
3
+ "version": "0.52.0",
4
4
  "description": "we-debug, gulp",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types.d.ts",
@@ -8,7 +8,7 @@
8
8
  "lib": "lib"
9
9
  },
10
10
  "scripts": {
11
- "test": "node test/index.test.js && node test/ui.test.js && node test/per-call-options.test.js"
11
+ "test": "node test/index.test.js && node test/ui.test.js && node test/per-call-options.test.js && node test/subpackage.test.js"
12
12
  },
13
13
  "keywords": [
14
14
  "we-debug",
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "@types/through2": "^2.0.41",
23
- "@we-debug/compiler-core": "0.51.0",
23
+ "@we-debug/compiler-core": "0.52.0",
24
24
  "crypto": "^1.0.1",
25
25
  "gogocode": "^1.0.55",
26
26
  "lead": "^1.0.0",
@@ -31,5 +31,5 @@
31
31
  "readme": "ERROR: No README data found!",
32
32
  "_id": "@we-debug/gulp-tool@0.1.3",
33
33
  "_commitid": "f35f53c",
34
- "gitHead": "22641ac4972a154619c6dc8f44b1bfdcbb92c8eb"
34
+ "gitHead": "bc98652915ac460bb4015b9918c32f899fe049a5"
35
35
  }
package/src/index.ts CHANGED
@@ -41,8 +41,9 @@ function mpGlobalComp(options: ICompilerOption = {}) {
41
41
  function (this: any, callback: any) {
42
42
  if (!streamInjector) return callback();
43
43
  try {
44
+ streamInjector.warnings.forEach(w => console.warn(`[${PLUGIN_NAME}] ${w}`));
44
45
  const base = streamInjector.options.baseDir;
45
- streamInjector.getUIFiles().forEach(f => {
46
+ streamInjector.getOutputFiles().forEach(f => {
46
47
  if (!seenExtnames[path.extname(f.relative)]) return;
47
48
  this.push(
48
49
  new Vinyl({
@@ -0,0 +1,130 @@
1
+ const fs = require('fs');
2
+ const os = require('os');
3
+ const path = require('path');
4
+ const assert = require('assert');
5
+ const Vinyl = require('vinyl');
6
+ const weDebug = require('../dist');
7
+
8
+ function write(root, files) {
9
+ Object.keys(files).forEach(f => {
10
+ const abs = path.join(root, f);
11
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
12
+ fs.writeFileSync(abs, files[f]);
13
+ });
14
+ }
15
+
16
+ function run(root, relatives, outputBase) {
17
+ const src = path.join(root, 'src');
18
+ const base = outputBase || src;
19
+ return new Promise((resolve, reject) => {
20
+ const out = [];
21
+ const stream = weDebug({
22
+ baseDir: src,
23
+ projectDir: root,
24
+ npmDirname: 'npm',
25
+ entryFile: './utils/we-debug/index',
26
+ subpackage: true
27
+ });
28
+ stream.on('data', file => out.push(file));
29
+ stream.on('error', reject);
30
+ stream.on('end', () => resolve(out));
31
+ relatives.forEach(r => {
32
+ const source = path.join(src, r);
33
+ stream.write(new Vinyl({ cwd: root, base, path: path.join(base, r), contents: fs.readFileSync(source) }));
34
+ });
35
+ stream.end();
36
+ });
37
+ }
38
+
39
+ (async function main() {
40
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'we-debug-gulp-sub-'));
41
+ write(root, {
42
+ 'package.json': JSON.stringify({
43
+ devDependencies: { '@we-debug/miniprogram': '1.0.0', 'demo-plugin': '1.0.0' }
44
+ }),
45
+ 'node_modules/@we-debug/miniprogram/package.json': JSON.stringify({
46
+ name: '@we-debug/miniprogram',
47
+ miniprogram: 'dist'
48
+ }),
49
+ 'node_modules/@we-debug/miniprogram/dist/index/index.js': 'Component({})',
50
+ 'node_modules/@we-debug/miniprogram/dist/index/index.json': JSON.stringify({
51
+ component: true,
52
+ componentGenerics: {
53
+ 'plugin-host': {
54
+ default: '../host-empty/index'
55
+ }
56
+ }
57
+ }),
58
+ 'node_modules/@we-debug/miniprogram/dist/index/index.wxml': '<view />',
59
+ 'node_modules/demo-plugin/package.json': JSON.stringify({
60
+ name: 'demo-plugin',
61
+ miniprogram: 'dist',
62
+ wedebug: { components: { panel: 'panel/index' } }
63
+ }),
64
+ 'node_modules/demo-plugin/dist/index.js': 'module.exports = {}',
65
+ 'node_modules/demo-plugin/dist/panel/index.js': 'Component({})',
66
+ 'node_modules/demo-plugin/dist/panel/index.json': '{"component":true}',
67
+ 'src/app.json': JSON.stringify({ pages: ['pages/index/index'] }),
68
+ 'src/app.js': 'App({})',
69
+ 'src/pages/index/index.wxml': '<view>index</view>',
70
+ 'src/utils/we-debug/index.js': [
71
+ `require("../../npm/@we-debug/miniprogram/index.js")`,
72
+ `require("../../npm/demo-plugin/index.js")`,
73
+ `require("../../npm/unrelated/index.js")`
74
+ ].join('\n')
75
+ });
76
+
77
+ const scripts = await run(root, ['app.js', 'utils/we-debug/index.js']);
78
+ const byPath = {};
79
+ scripts.forEach(file => {
80
+ byPath[file.relative.split(path.sep).join('/')] = file;
81
+ });
82
+ assert.deepStrictEqual(Object.keys(byPath).sort(), [
83
+ 'app.js',
84
+ 'we-debug-pkg/entry/index.js',
85
+ 'we-debug-pkg/miniprogram_npm/@we-debug/miniprogram/index/index.js',
86
+ 'we-debug-pkg/miniprogram_npm/demo-plugin/index.js',
87
+ 'we-debug-pkg/miniprogram_npm/demo-plugin/panel/index.js',
88
+ 'we-debug-pkg/placeholder/index.js',
89
+ 'we-debug-pkg/we-debug-host/index.js',
90
+ 'we-debug-pkg/we-debug-host/manifest.js',
91
+ 'we-debug-stub.js'
92
+ ]);
93
+ assert.strictEqual(byPath['app.js'].contents.toString(), `require('./we-debug-stub.js')\nApp({})`);
94
+ assert.strictEqual(
95
+ byPath['we-debug-pkg/entry/index.js'].contents.toString(),
96
+ [
97
+ `require("../miniprogram_npm/@we-debug/miniprogram/index.js")`,
98
+ `require("../miniprogram_npm/demo-plugin/index.js")`,
99
+ `require("../../npm/unrelated/index.js")`
100
+ ].join('\n')
101
+ );
102
+ assert.strictEqual(
103
+ byPath['we-debug-pkg/placeholder/index.js'].contents.toString(),
104
+ `require('../we-debug-host/manifest.js');\nrequire('../entry/index.js');\nPage({});\n`
105
+ );
106
+ assert.strictEqual(byPath['we-debug-stub.js'].base, path.join(root, 'src'));
107
+ console.log('✓ gulp-tool 分包模式搬迁入口并推送分包文件');
108
+
109
+ const dist = path.join(root, 'dist');
110
+ const compiledScripts = await run(root, ['app.js', 'utils/we-debug/index.js'], dist);
111
+ const compiledByPath = {};
112
+ compiledScripts.forEach(file => {
113
+ compiledByPath[file.relative.split(path.sep).join('/')] = file;
114
+ });
115
+ assert.ok(compiledByPath['we-debug-pkg/entry/index.js']);
116
+ assert.strictEqual(
117
+ compiledByPath['we-debug-pkg/entry/index.js'].contents.toString(),
118
+ [
119
+ `require("../miniprogram_npm/@we-debug/miniprogram/index.js")`,
120
+ `require("../miniprogram_npm/demo-plugin/index.js")`,
121
+ `require("../../npm/unrelated/index.js")`
122
+ ].join('\n')
123
+ );
124
+ assert.strictEqual(compiledByPath['app.js'].contents.toString(), `require('./we-debug-stub.js')\nApp({})`);
125
+ assert.ok(compiledByPath['we-debug-stub.js']);
126
+ console.log('✓ gulp-tool 支持编译后 Vinyl 路径');
127
+ })().catch(e => {
128
+ console.error('✗ gulp-tool 分包模式搬迁入口并推送分包文件\n', e);
129
+ process.exitCode = 1;
130
+ });