@abtnode/core 1.8.28 → 1.8.30
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/lib/blocklet/manager/disk.js +4 -3
- package/lib/states/blocklet.js +1 -1
- package/lib/util/blocklet.js +21 -0
- package/package.json +17 -17
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
2
|
/* eslint-disable no-await-in-loop */
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
|
+
const { fileURLToPath } = require('url');
|
|
4
5
|
const path = require('path');
|
|
5
6
|
const get = require('lodash/get');
|
|
6
7
|
const pick = require('lodash/pick');
|
|
@@ -871,7 +872,7 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
871
872
|
x.value = await descriptionSchema.validateAsync(x.value);
|
|
872
873
|
}
|
|
873
874
|
|
|
874
|
-
if (x.key
|
|
875
|
+
if (['BLOCKLET_APP_LOGO', 'BLOCKLET_APP_LOGO_SQUARE'].includes(x.key)) {
|
|
875
876
|
x.value = await logoSchema.validateAsync(x.value);
|
|
876
877
|
}
|
|
877
878
|
|
|
@@ -3013,14 +3014,14 @@ class BlockletManager extends BaseBlockletManager {
|
|
|
3013
3014
|
|
|
3014
3015
|
const tarballPath = path.join(cwd, tarballName);
|
|
3015
3016
|
|
|
3016
|
-
const { protocol
|
|
3017
|
+
const { protocol } = new URL(url);
|
|
3017
3018
|
|
|
3018
3019
|
const cachedTarFile = await this._getCachedTarFile(integrity);
|
|
3019
3020
|
if (cachedTarFile) {
|
|
3020
3021
|
logger.info('found cache tarFile', { did, tarballName, integrity });
|
|
3021
3022
|
await fs.move(cachedTarFile, tarballPath, { overwrite: true });
|
|
3022
3023
|
} else if (protocol.startsWith('file')) {
|
|
3023
|
-
await fs.copy(decodeURIComponent(
|
|
3024
|
+
await fs.copy(decodeURIComponent(fileURLToPath(url)), tarballPath);
|
|
3024
3025
|
} else {
|
|
3025
3026
|
const cancelCtrl = new downloadFile.CancelCtrl();
|
|
3026
3027
|
|
package/lib/states/blocklet.js
CHANGED
|
@@ -319,7 +319,7 @@ class BlockletState extends BaseState {
|
|
|
319
319
|
defaultPort = 0,
|
|
320
320
|
} = {}) {
|
|
321
321
|
try {
|
|
322
|
-
const blocklets = await this.getBlocklets({}, { port: 1, ports: 1, 'meta.interfaces': 1 });
|
|
322
|
+
const blocklets = await this.getBlocklets({}, { port: 1, ports: 1, 'meta.interfaces': 1, children: 1 });
|
|
323
323
|
|
|
324
324
|
const occupiedExternalPorts = new Map();
|
|
325
325
|
const occupiedInternalPorts = new Map();
|
package/lib/util/blocklet.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const shelljs = require('shelljs');
|
|
5
6
|
const os = require('os');
|
|
6
7
|
const tar = require('tar');
|
|
7
8
|
const get = require('lodash/get');
|
|
@@ -23,6 +24,8 @@ const hashFiles = require('@abtnode/util/lib/hash-files');
|
|
|
23
24
|
const isPathPrefixEqual = require('@abtnode/util/lib/is-path-prefix-equal');
|
|
24
25
|
const { BLOCKLET_MAX_MEM_LIMIT_IN_MB } = require('@abtnode/constant');
|
|
25
26
|
|
|
27
|
+
const SCRIPT_ENGINES_WHITE_LIST = ['npm', 'npx', 'pnpm', 'yarn'];
|
|
28
|
+
|
|
26
29
|
const {
|
|
27
30
|
BlockletStatus,
|
|
28
31
|
BlockletSource,
|
|
@@ -491,6 +494,24 @@ const startBlockletProcess = async (
|
|
|
491
494
|
options.env.BROWSER = 'none';
|
|
492
495
|
options.env.PORT = options.env[BLOCKLET_DEFAULT_PORT_NAME];
|
|
493
496
|
options.script = appMain;
|
|
497
|
+
|
|
498
|
+
if (process.platform === 'win32') {
|
|
499
|
+
const [cmd, ...args] = options.script.split(' ').filter(Boolean);
|
|
500
|
+
|
|
501
|
+
if (!SCRIPT_ENGINES_WHITE_LIST.includes(cmd)) {
|
|
502
|
+
throw new Error(`${cmd} script is not supported, ${SCRIPT_ENGINES_WHITE_LIST.join(', ')} are supported`);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const { stdout: nodejsBinPath } = shelljs.which('node');
|
|
506
|
+
|
|
507
|
+
const cmdPath = path.join(path.dirname(nodejsBinPath), 'node_modules', cmd);
|
|
508
|
+
|
|
509
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(cmdPath, 'package.json')));
|
|
510
|
+
const cmdBinPath = pkg.bin[cmd];
|
|
511
|
+
|
|
512
|
+
options.script = path.resolve(cmdPath, cmdBinPath);
|
|
513
|
+
options.args = [...args].join(' ');
|
|
514
|
+
}
|
|
494
515
|
} else {
|
|
495
516
|
const blockletEngineInfo = getBlockletEngine(b.meta);
|
|
496
517
|
options.args = blockletEngineInfo.args || [];
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.30",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/auth": "1.8.
|
|
23
|
-
"@abtnode/certificate-manager": "1.8.
|
|
24
|
-
"@abtnode/constant": "1.8.
|
|
25
|
-
"@abtnode/cron": "1.8.
|
|
26
|
-
"@abtnode/db": "1.8.
|
|
27
|
-
"@abtnode/logger": "1.8.
|
|
28
|
-
"@abtnode/queue": "1.8.
|
|
29
|
-
"@abtnode/rbac": "1.8.
|
|
30
|
-
"@abtnode/router-provider": "1.8.
|
|
31
|
-
"@abtnode/static-server": "1.8.
|
|
32
|
-
"@abtnode/timemachine": "1.8.
|
|
33
|
-
"@abtnode/util": "1.8.
|
|
22
|
+
"@abtnode/auth": "1.8.30",
|
|
23
|
+
"@abtnode/certificate-manager": "1.8.30",
|
|
24
|
+
"@abtnode/constant": "1.8.30",
|
|
25
|
+
"@abtnode/cron": "1.8.30",
|
|
26
|
+
"@abtnode/db": "1.8.30",
|
|
27
|
+
"@abtnode/logger": "1.8.30",
|
|
28
|
+
"@abtnode/queue": "1.8.30",
|
|
29
|
+
"@abtnode/rbac": "1.8.30",
|
|
30
|
+
"@abtnode/router-provider": "1.8.30",
|
|
31
|
+
"@abtnode/static-server": "1.8.30",
|
|
32
|
+
"@abtnode/timemachine": "1.8.30",
|
|
33
|
+
"@abtnode/util": "1.8.30",
|
|
34
34
|
"@arcblock/did": "1.17.23",
|
|
35
35
|
"@arcblock/did-motif": "^1.1.10",
|
|
36
36
|
"@arcblock/did-util": "1.17.23",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@arcblock/jwt": "^1.17.23",
|
|
39
39
|
"@arcblock/pm2-events": "^0.0.5",
|
|
40
40
|
"@arcblock/vc": "1.17.23",
|
|
41
|
-
"@blocklet/constant": "1.8.
|
|
42
|
-
"@blocklet/meta": "1.8.
|
|
43
|
-
"@blocklet/sdk": "1.8.
|
|
41
|
+
"@blocklet/constant": "1.8.30",
|
|
42
|
+
"@blocklet/meta": "1.8.30",
|
|
43
|
+
"@blocklet/sdk": "1.8.30",
|
|
44
44
|
"@fidm/x509": "^1.2.1",
|
|
45
45
|
"@ocap/mcrypto": "1.17.23",
|
|
46
46
|
"@ocap/util": "1.17.23",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"express": "^4.18.2",
|
|
82
82
|
"jest": "^27.5.1"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "cb294f4ee7382c6ef7692b6c2c33ad080fced13e"
|
|
85
85
|
}
|