@pagepocket/lighterceptor-adapter 0.4.2
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/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/package.json +27 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NetworkInterceptorAdapter, SnapshotData } from "@pagepocket/lib";
|
|
2
|
+
import { type LighterceptorOptions } from "@pagepocket/lighterceptor";
|
|
3
|
+
type LighterceptorAdapterOptions = LighterceptorOptions & {
|
|
4
|
+
title?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class LighterceptorAdapter implements NetworkInterceptorAdapter {
|
|
7
|
+
private options;
|
|
8
|
+
constructor(options?: LighterceptorAdapterOptions);
|
|
9
|
+
run(url: string): Promise<SnapshotData>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,yBAAyB,EACzB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAErF,KAAK,2BAA2B,GAAG,oBAAoB,GAAG;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,oBAAqB,YAAW,yBAAyB;IACpE,OAAO,CAAC,OAAO,CAA8B;gBAEjC,OAAO,GAAE,2BAAgC;IAI/C,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAkB9C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Lighterceptor } from "@pagepocket/lighterceptor";
|
|
2
|
+
export class LighterceptorAdapter {
|
|
3
|
+
constructor(options = {}) {
|
|
4
|
+
this.options = options;
|
|
5
|
+
}
|
|
6
|
+
async run(url) {
|
|
7
|
+
const { title, ...lighterceptorOptions } = this.options;
|
|
8
|
+
const result = await new Lighterceptor(url, {
|
|
9
|
+
recursion: true,
|
|
10
|
+
...lighterceptorOptions
|
|
11
|
+
}).run();
|
|
12
|
+
const capturedNetworkRecords = (result.networkRecords ?? []);
|
|
13
|
+
return {
|
|
14
|
+
url,
|
|
15
|
+
title: title ?? result.title ?? "snapshot",
|
|
16
|
+
capturedAt: result.capturedAt ?? new Date().toISOString(),
|
|
17
|
+
fetchXhrRecords: [],
|
|
18
|
+
networkRecords: capturedNetworkRecords,
|
|
19
|
+
resources: []
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAA6B,MAAM,2BAA2B,CAAC;AAMrF,MAAM,OAAO,oBAAoB;IAG/B,YAAY,UAAuC,EAAE;QACnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,MAAM,EAAE,KAAK,EAAE,GAAG,oBAAoB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACxD,MAAM,MAAM,GAAG,MAAM,IAAI,aAAa,CAAC,GAAG,EAAE;YAC1C,SAAS,EAAE,IAAI;YACf,GAAG,oBAAoB;SACxB,CAAC,CAAC,GAAG,EAAE,CAAC;QAET,MAAM,sBAAsB,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,CAA4B,CAAC;QAExF,OAAO;YACL,GAAG;YACH,KAAK,EAAE,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,UAAU;YAC1C,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACzD,eAAe,EAAE,EAAE;YACnB,cAAc,EAAE,sBAAsB;YACtC,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pagepocket/lighterceptor-adapter",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Lighterceptor adapter for PagePocket network interception.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@pagepocket/lib": "0.4.2",
|
|
16
|
+
"@pagepocket/lighterceptor": "0.4.2"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^20.17.12",
|
|
20
|
+
"tsx": "^4.21.0",
|
|
21
|
+
"typescript": "^5.7.2"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc -p tsconfig.json",
|
|
25
|
+
"test": "tsx --test specs/**/*.test.ts"
|
|
26
|
+
}
|
|
27
|
+
}
|