whistle.global-magic-preview-component-local-resource 1.0.3 → 1.0.4

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/.console.log CHANGED
@@ -1,4 +1,24 @@
1
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
2
- componentName: common-component-image, port: 8082, url: http://127.0.0.1:8082/common-component-image_index.js
3
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
4
- componentName: common-component-image, port: 8082, url: http://127.0.0.1:8082/common-component-image_index.js
1
+ componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
2
+ componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
3
+
4
+ From: whistle.global-magic-preview-component-local-resource@1.0.3
5
+ Node: v16.20.2
6
+ Host: GL7TGHYG23
7
+ Date: 12/24/2025, 3:56:02 PM
8
+ TypeError: Cannot read properties of undefined (reading 'ok')
9
+ at checkResPort (/Users/bytedance/Desktop/package/lib/rulesServer.js:13:15)
10
+ at processTicksAndRejections (node:internal/process/task_queues:96:5)
11
+ at async Server.<anonymous> (/Users/bytedance/Desktop/package/lib/rulesServer.js:36:21)componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
12
+
13
+ From: whistle.global-magic-preview-component-local-resource@1.0.3
14
+ Node: v16.20.2
15
+ Host: GL7TGHYG23
16
+ Date: 12/24/2025, 3:56:03 PM
17
+ TypeError: Cannot read properties of undefined (reading 'ok')
18
+ at checkResPort (/Users/bytedance/Desktop/package/lib/rulesServer.js:13:15)
19
+ at processTicksAndRejections (node:internal/process/task_queues:96:5)
20
+ at async Server.<anonymous> (/Users/bytedance/Desktop/package/lib/rulesServer.js:36:21)componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
21
+ componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
22
+ componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
23
+ componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
24
+ componentName: common-component-button, port: 8080, url: http://100.84.145.19:8080/common-component-button_index.js
@@ -10,6 +10,9 @@ const checkResPort = async (ports, index = 0, componentName) => {
10
10
  }
11
11
  }
12
12
  const headRes = await fetch(`${url}`, { method: "HEAD" }).catch(() => { });
13
+ if (!headRes && index + 1 < ports.length) {
14
+ return checkResPort(ports, index + 1, componentName)
15
+ }
13
16
  if (headRes.ok) {
14
17
  return {
15
18
  ok: headRes.ok,
@@ -17,14 +20,6 @@ const checkResPort = async (ports, index = 0, componentName) => {
17
20
  url
18
21
  }
19
22
  }
20
- if (index + 1 < ports.length) {
21
- return checkResPort(ports, index + 1, componentName)
22
- }
23
- return {
24
- ok: false,
25
- port: ports[index],
26
- url
27
- }
28
23
  }
29
24
 
30
25
  module.exports = async (server) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.global-magic-preview-component-local-resource",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "将线上JS资源转发到本地IP对应的文件",
5
5
  "main": "index.js",
6
6
  "publicConfig": {
package/rules.txt CHANGED
@@ -1,2 +1 @@
1
- # 写法 A (推荐): 匹配的URL whistle.你的插件名://
2
1
  /common-component-[^_]+/ whistle.global-magic-preview-component-local-resource://