@abtnode/core 1.17.6-beta-20251219-114550-06c96cf5 → 1.17.6-beta-20251221-021146-1a145a92
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
const { Throttle } = require('stream-throttle');
|
|
4
|
-
|
|
4
|
+
const { DBCache, getAbtNodeRedisAndSQLiteUrl } = require('@abtnode/db-cache');
|
|
5
5
|
const { BLOCKLET_BUNDLE_FOLDER } = require('@blocklet/constant');
|
|
6
6
|
|
|
7
7
|
const defaultLogger = require('@abtnode/logger')('@abtnode/core:resolve-download');
|
|
@@ -12,6 +12,12 @@ const { ensureBlockletExpanded, expandTarball, getBundleDir } = require('../../u
|
|
|
12
12
|
|
|
13
13
|
const asyncFs = fs.promises;
|
|
14
14
|
|
|
15
|
+
const removeLock = new DBCache(() => ({
|
|
16
|
+
prefix: 'resolve-download-lock',
|
|
17
|
+
ttl: 1000 * 60 * 5,
|
|
18
|
+
...getAbtNodeRedisAndSQLiteUrl(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
15
21
|
/**
|
|
16
22
|
* decompress file, format dir and move to installDir
|
|
17
23
|
* @param {string} src file
|
|
@@ -73,22 +79,28 @@ const resolveDownload = async (
|
|
|
73
79
|
if (typeof onProgress === 'function') {
|
|
74
80
|
onProgress({ name: 'blocklet.zip' });
|
|
75
81
|
}
|
|
82
|
+
installDir = getBundleDir(distDir, meta);
|
|
83
|
+
await removeLock.acquire(installDir);
|
|
84
|
+
|
|
76
85
|
await ensureBlockletExpanded(meta, downloadDir);
|
|
77
86
|
|
|
78
|
-
installDir = getBundleDir(distDir, meta);
|
|
79
87
|
if (fs.existsSync(installDir)) {
|
|
80
|
-
fs.
|
|
88
|
+
await fs.remove(installDir);
|
|
81
89
|
logger.info('cleanup blocklet upgrade dir', { name, version, installDir });
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
// 确保父目录存在,但不创建目标目录本身
|
|
93
|
+
await fs.ensureDir(path.dirname(installDir));
|
|
86
94
|
logger.info('Move downloadDir to installDir with full', { downloadDir, installDir, dist: meta.dist });
|
|
87
|
-
await fs.move(downloadDir, installDir, { overwrite: true });
|
|
95
|
+
await fs.move(downloadDir, installDir, { overwrite: true, recursive: true });
|
|
88
96
|
} catch (error) {
|
|
89
|
-
fs.
|
|
90
|
-
fs.
|
|
97
|
+
await fs.remove(downloadDir);
|
|
98
|
+
await fs.remove(tmp);
|
|
91
99
|
throw error;
|
|
100
|
+
} finally {
|
|
101
|
+
if (installDir) {
|
|
102
|
+
await removeLock.releaseLock(installDir);
|
|
103
|
+
}
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
return { meta, installDir };
|
|
@@ -124,6 +136,7 @@ const resolveDiffDownload = async (
|
|
|
124
136
|
}
|
|
125
137
|
logger.info('Copy installDir to downloadDir', { installDir: distDir, downloadDir });
|
|
126
138
|
await fs.copy(getBundleDir(distDir, oldMeta), downloadDir);
|
|
139
|
+
let installDir;
|
|
127
140
|
try {
|
|
128
141
|
// delete
|
|
129
142
|
logger.info('Delete files from downloadDir', { fileNum: deleteSet.length });
|
|
@@ -148,23 +161,26 @@ const resolveDiffDownload = async (
|
|
|
148
161
|
}
|
|
149
162
|
};
|
|
150
163
|
await walkDiff(diffDir);
|
|
151
|
-
fs.
|
|
164
|
+
await fs.remove(baseDiffDir);
|
|
152
165
|
const meta = getBlockletMeta(downloadDir);
|
|
153
166
|
if (dist?.integrity) {
|
|
154
167
|
meta.dist = dist;
|
|
155
168
|
}
|
|
156
169
|
|
|
170
|
+
installDir = getBundleDir(distDir, meta);
|
|
171
|
+
await removeLock.acquire(installDir);
|
|
157
172
|
await ensureBlockletExpanded(meta, downloadDir);
|
|
158
|
-
|
|
159
173
|
// move to installDir
|
|
160
|
-
const installDir = getBundleDir(distDir, meta);
|
|
161
174
|
logger.info('Move downloadDir to installDir with diff', { downloadDir, installDir });
|
|
162
|
-
await fs.move(downloadDir, installDir, { overwrite: true });
|
|
175
|
+
await fs.move(downloadDir, installDir, { overwrite: true, recursive: true });
|
|
163
176
|
|
|
164
177
|
return { meta, installDir };
|
|
165
178
|
} catch (error) {
|
|
166
|
-
|
|
167
|
-
|
|
179
|
+
if (installDir) {
|
|
180
|
+
await removeLock.releaseLock(installDir);
|
|
181
|
+
}
|
|
182
|
+
await fs.remove(downloadDir);
|
|
183
|
+
await fs.remove(diffDir);
|
|
168
184
|
throw error;
|
|
169
185
|
}
|
|
170
186
|
};
|
package/lib/util/blocklet.js
CHANGED
|
@@ -602,10 +602,10 @@ const ensureBlockletExpanded = async (_meta, appDir) => {
|
|
|
602
602
|
try {
|
|
603
603
|
const nodeModulesPath = path.join(appDir, 'node_modules');
|
|
604
604
|
if (fs.existsSync(nodeModulesPath)) {
|
|
605
|
-
fs.
|
|
605
|
+
await fs.remove(nodeModulesPath);
|
|
606
606
|
}
|
|
607
607
|
await expandBundle(bundlePath, appDir);
|
|
608
|
-
fs.
|
|
608
|
+
await fs.remove(bundlePath);
|
|
609
609
|
} catch (err) {
|
|
610
610
|
throw new Error(`Failed to expand blocklet bundle: ${err.message}`);
|
|
611
611
|
}
|
|
@@ -2800,7 +2800,7 @@ const publishDidDocument = async ({ blocklet, ownerInfo, nodeInfo }) => {
|
|
|
2800
2800
|
};
|
|
2801
2801
|
|
|
2802
2802
|
const domains = await Promise.all(
|
|
2803
|
-
blocklet.site
|
|
2803
|
+
(blocklet.site?.domainAliases || []).map(async (item) => {
|
|
2804
2804
|
let type = isCustomDomain(item.value) ? 'custom' : 'internal';
|
|
2805
2805
|
// 如果域名是 appUrl,则设置为 primary
|
|
2806
2806
|
if (isPrimaryDomain(item.value)) {
|
|
@@ -33,7 +33,7 @@ async function installExternalDependencies({ appDir, forceInstall = false, nodeI
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (!(await isSameOs(appDir, isUseDocker))) {
|
|
36
|
-
fs.
|
|
36
|
+
await fs.remove(path.join(appDir, 'node_modules'));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const isNeedInstall = forceInstall || externals.some((dependency) => !isDependencyInstalled(appDir, dependency));
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.6-beta-
|
|
6
|
+
"version": "1.17.6-beta-20251221-021146-1a145a92",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@abtnode/analytics": "1.17.6-beta-
|
|
21
|
-
"@abtnode/auth": "1.17.6-beta-
|
|
22
|
-
"@abtnode/certificate-manager": "1.17.6-beta-
|
|
23
|
-
"@abtnode/constant": "1.17.6-beta-
|
|
24
|
-
"@abtnode/cron": "1.17.6-beta-
|
|
25
|
-
"@abtnode/db-cache": "1.17.6-beta-
|
|
26
|
-
"@abtnode/docker-utils": "1.17.6-beta-
|
|
27
|
-
"@abtnode/logger": "1.17.6-beta-
|
|
28
|
-
"@abtnode/models": "1.17.6-beta-
|
|
29
|
-
"@abtnode/queue": "1.17.6-beta-
|
|
30
|
-
"@abtnode/rbac": "1.17.6-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.17.6-beta-
|
|
32
|
-
"@abtnode/static-server": "1.17.6-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.17.6-beta-
|
|
34
|
-
"@abtnode/util": "1.17.6-beta-
|
|
20
|
+
"@abtnode/analytics": "1.17.6-beta-20251221-021146-1a145a92",
|
|
21
|
+
"@abtnode/auth": "1.17.6-beta-20251221-021146-1a145a92",
|
|
22
|
+
"@abtnode/certificate-manager": "1.17.6-beta-20251221-021146-1a145a92",
|
|
23
|
+
"@abtnode/constant": "1.17.6-beta-20251221-021146-1a145a92",
|
|
24
|
+
"@abtnode/cron": "1.17.6-beta-20251221-021146-1a145a92",
|
|
25
|
+
"@abtnode/db-cache": "1.17.6-beta-20251221-021146-1a145a92",
|
|
26
|
+
"@abtnode/docker-utils": "1.17.6-beta-20251221-021146-1a145a92",
|
|
27
|
+
"@abtnode/logger": "1.17.6-beta-20251221-021146-1a145a92",
|
|
28
|
+
"@abtnode/models": "1.17.6-beta-20251221-021146-1a145a92",
|
|
29
|
+
"@abtnode/queue": "1.17.6-beta-20251221-021146-1a145a92",
|
|
30
|
+
"@abtnode/rbac": "1.17.6-beta-20251221-021146-1a145a92",
|
|
31
|
+
"@abtnode/router-provider": "1.17.6-beta-20251221-021146-1a145a92",
|
|
32
|
+
"@abtnode/static-server": "1.17.6-beta-20251221-021146-1a145a92",
|
|
33
|
+
"@abtnode/timemachine": "1.17.6-beta-20251221-021146-1a145a92",
|
|
34
|
+
"@abtnode/util": "1.17.6-beta-20251221-021146-1a145a92",
|
|
35
35
|
"@aigne/aigne-hub": "^0.10.15",
|
|
36
36
|
"@arcblock/did": "^1.27.15",
|
|
37
37
|
"@arcblock/did-connect-js": "^1.27.15",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"@arcblock/pm2-events": "^0.0.5",
|
|
44
44
|
"@arcblock/validator": "^1.27.15",
|
|
45
45
|
"@arcblock/vc": "^1.27.15",
|
|
46
|
-
"@blocklet/constant": "1.17.6-beta-
|
|
46
|
+
"@blocklet/constant": "1.17.6-beta-20251221-021146-1a145a92",
|
|
47
47
|
"@blocklet/did-space-js": "^1.2.11",
|
|
48
|
-
"@blocklet/env": "1.17.6-beta-
|
|
48
|
+
"@blocklet/env": "1.17.6-beta-20251221-021146-1a145a92",
|
|
49
49
|
"@blocklet/error": "^0.3.5",
|
|
50
|
-
"@blocklet/meta": "1.17.6-beta-
|
|
51
|
-
"@blocklet/resolver": "1.17.6-beta-
|
|
52
|
-
"@blocklet/sdk": "1.17.6-beta-
|
|
53
|
-
"@blocklet/server-js": "1.17.6-beta-
|
|
54
|
-
"@blocklet/store": "1.17.6-beta-
|
|
50
|
+
"@blocklet/meta": "1.17.6-beta-20251221-021146-1a145a92",
|
|
51
|
+
"@blocklet/resolver": "1.17.6-beta-20251221-021146-1a145a92",
|
|
52
|
+
"@blocklet/sdk": "1.17.6-beta-20251221-021146-1a145a92",
|
|
53
|
+
"@blocklet/server-js": "1.17.6-beta-20251221-021146-1a145a92",
|
|
54
|
+
"@blocklet/store": "1.17.6-beta-20251221-021146-1a145a92",
|
|
55
55
|
"@blocklet/theme": "^3.2.19",
|
|
56
56
|
"@fidm/x509": "^1.2.1",
|
|
57
57
|
"@ocap/mcrypto": "^1.27.15",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"express": "^4.18.2",
|
|
117
117
|
"unzipper": "^0.10.11"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "6922b56b5f282ba14c864f6a7969d218e4065104"
|
|
120
120
|
}
|