whistle.global-magic-preview-component-local-resource 1.0.5 → 1.0.6

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,42 +1,2 @@
1
- headRes: [object Response]
2
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
3
- headRes: [object Response]
4
- headRes: [object Response]
5
- headRes: [object Response]
6
- headRes: [object Response]
7
- headRes: [object Response]
8
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
9
- headRes: [object Response]
10
- headRes: [object Response]
11
- headRes: [object Response]
12
- headRes: [object Response]
13
- headRes: [object Response]
14
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
15
- headRes: [object Response]
16
- headRes: [object Response]
17
- headRes: [object Response]
18
- headRes: [object Response]
19
- headRes: [object Response]
20
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
21
- headRes: [object Response]
22
- headRes: [object Response]
23
- headRes: [object Response]
24
- headRes: [object Response]
25
- componentName: common-component-button, port: 8080, url: http://127.0.0.1:8080/common-component-button_index.js
26
- headRes: [object Response]
27
- headRes: [object Response]
28
- headRes: [object Response]
29
- headRes: [object Response]
30
- componentName: common-component-image, port: 8082, url: http://127.0.0.1:8082/common-component-image_index.js
31
- headRes: [object Response]
32
- headRes: undefined
33
- headRes: [object Response]
34
- headRes: undefined
35
- headRes: [object Response]
36
- headRes: undefined
37
- headRes: undefined
38
- headRes: undefined
39
- headRes: undefined
40
- headRes: undefined
41
- headRes: undefined
42
- headRes: undefined
1
+ componentName: tiktok-component-InfraRewardList, port: 8080, url: http://127.0.0.1:8080/tiktok-component-InfraRewardList_index.js
2
+ componentName: tiktok-component-InfraRewardList, port: 8080, url: http://127.0.0.1:8080/tiktok-component-InfraRewardList_index.js
@@ -32,12 +32,13 @@ const checkResPort = async (ports, index = 0, componentName) => {
32
32
  module.exports = async (server) => {
33
33
  server.on('request', async (req, res) => {
34
34
  const { url, method } = req;
35
- const reg = /common-component-[^_]+/
35
+ const reg = /otter_(.+)-component-[^_]+/
36
36
  const [componentName] = url.match(reg) || [];
37
37
  const ports = [8080, 8082, 8084, 8086, 8088]
38
- const headRes = await checkResPort(ports, 0, componentName)
38
+ const [, name] = componentName?.split("_") || []
39
+ const headRes = await checkResPort(ports, 0, name)
39
40
  if (headRes?.ok && method === "GET") {
40
- console.log(`componentName: ${componentName}, port: ${headRes.port}, url: ${headRes.url}`)
41
+ console.log(`componentName: ${name}, port: ${headRes.port}, url: ${headRes.url}`)
41
42
  res.end(`https://sf16-website.neutral.ttwstatic.com${url} ${headRes.url}`);
42
43
  } else {
43
44
  res.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.global-magic-preview-component-local-resource",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "将线上JS资源转发到本地IP对应的文件",
5
5
  "main": "index.js",
6
6
  "publicConfig": {
package/rules.txt CHANGED
@@ -1 +1 @@
1
- /common-component-[^_]+/ whistle.global-magic-preview-component-local-resource://
1
+ /otter_(.+)-component-[^_]+/ whistle.global-magic-preview-component-local-resource://