@d-zero/replicator 0.10.15 → 0.10.17
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/dist/child-process.js +7 -2
- package/dist/cli.js +14 -10
- package/package.json +12 -9
package/dist/child-process.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createChildProcess } from '@d-zero/puppeteer-dealer';
|
|
2
2
|
import { beforePageScan, devicePresets } from '@d-zero/puppeteer-page-scan';
|
|
3
3
|
import { scrollAllOver } from '@d-zero/puppeteer-scroll';
|
|
4
|
+
import { disposableListener } from '@d-zero/shared/disposable-listener';
|
|
4
5
|
import { encodeResourcePath } from '@d-zero/shared/encode-resource-path';
|
|
5
6
|
createChildProcess((param) => {
|
|
6
7
|
const { devices, timeout, username, password } = param;
|
|
@@ -37,7 +38,12 @@ createChildProcess((param) => {
|
|
|
37
38
|
// Add resource with MIME encoding if needed
|
|
38
39
|
resourcePaths.add(encodeResourcePath(resourceUrlObj, mimeType));
|
|
39
40
|
};
|
|
40
|
-
|
|
41
|
+
// `using` により、beforePageScan()/scrollAllOver() が throw しても
|
|
42
|
+
// スコープ脱出時に確実にリスナーが解除される。この page は同一
|
|
43
|
+
// 子プロセス内で次の URL にも再利用されるため、例外パスでの
|
|
44
|
+
// 解除漏れはリスナーの累積に直結する。
|
|
45
|
+
using _responseListener = disposableListener(page, 'response', responseHandler);
|
|
46
|
+
void _responseListener;
|
|
41
47
|
if (username && password) {
|
|
42
48
|
await page.authenticate({ username, password });
|
|
43
49
|
}
|
|
@@ -63,7 +69,6 @@ createChildProcess((param) => {
|
|
|
63
69
|
throw error;
|
|
64
70
|
});
|
|
65
71
|
}
|
|
66
|
-
page.off('response', responseHandler);
|
|
67
72
|
logger(`📦 Collected ${resourcePaths.size} resources`);
|
|
68
73
|
return {
|
|
69
74
|
url,
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { createCLI, parseCommonOptions, parseList } from '@d-zero/cli-core';
|
|
3
|
+
import { createCLI, parseCommonOptions, parseList, unwrapSuppressedError, } from '@d-zero/cli-core';
|
|
4
4
|
import { parseDevicesOption } from '@d-zero/puppeteer-page-scan';
|
|
5
5
|
import { replicate } from './index.js';
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
@@ -87,17 +87,21 @@ try {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (
|
|
90
|
+
// SuppressedError(using スコープ内で本体と dispose の両方が例外を投げた場合)
|
|
91
|
+
// を分解し、定型メッセージの裏に隠れる根本原因を両方とも出力する
|
|
92
|
+
for (const cause of unwrapSuppressedError(error)) {
|
|
93
|
+
if (cause instanceof Error) {
|
|
94
94
|
// eslint-disable-next-line no-console
|
|
95
|
-
console.error('
|
|
95
|
+
console.error('❌ Error:', cause.message);
|
|
96
|
+
if (options.verbose) {
|
|
97
|
+
// eslint-disable-next-line no-console
|
|
98
|
+
console.error('Stack trace:', cause.stack);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// eslint-disable-next-line no-console
|
|
103
|
+
console.error('❌ Unknown error:', cause);
|
|
96
104
|
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
// eslint-disable-next-line no-console
|
|
100
|
-
console.error('❌ Unknown error:', error);
|
|
101
105
|
}
|
|
102
106
|
process.exit(1);
|
|
103
107
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/replicator",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.17",
|
|
4
4
|
"description": "Replicate web pages with all their resources to local directories",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=24.11.0"
|
|
12
|
+
},
|
|
10
13
|
"type": "module",
|
|
11
14
|
"exports": {
|
|
12
15
|
".": {
|
|
@@ -24,15 +27,15 @@
|
|
|
24
27
|
"clean": "tsc --build --clean"
|
|
25
28
|
},
|
|
26
29
|
"dependencies": {
|
|
27
|
-
"@d-zero/cli-core": "1.
|
|
28
|
-
"@d-zero/dealer": "1.
|
|
29
|
-
"@d-zero/puppeteer-dealer": "0.7.
|
|
30
|
-
"@d-zero/puppeteer-page-scan": "4.6.
|
|
31
|
-
"@d-zero/puppeteer-scroll": "4.0.
|
|
32
|
-
"@d-zero/shared": "0.
|
|
30
|
+
"@d-zero/cli-core": "1.4.0",
|
|
31
|
+
"@d-zero/dealer": "1.11.0",
|
|
32
|
+
"@d-zero/puppeteer-dealer": "0.7.24",
|
|
33
|
+
"@d-zero/puppeteer-page-scan": "4.6.9",
|
|
34
|
+
"@d-zero/puppeteer-scroll": "4.0.12",
|
|
35
|
+
"@d-zero/shared": "0.23.0",
|
|
33
36
|
"ansi-colors": "4.1.3",
|
|
34
37
|
"minimist": "1.2.8",
|
|
35
|
-
"puppeteer": "25.
|
|
38
|
+
"puppeteer": "25.5.0"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"@types/minimist": "1.2.5"
|
|
@@ -42,5 +45,5 @@
|
|
|
42
45
|
"url": "https://github.com/d-zero-dev/tools.git",
|
|
43
46
|
"directory": "packages/@d-zero/replicator"
|
|
44
47
|
},
|
|
45
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "d48a3ed9c01d32f0ca1a5b00e4abc36c376ce880"
|
|
46
49
|
}
|