polite-crawler 0.6.0 → 0.6.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/README.md +61 -0
- package/build/api.d.mts +396 -0
- package/build/api.mjs +325 -0
- package/build/api.mjs.map +1 -0
- package/build/{browser-DCd_d0oU.mjs → browser-C_dFMvO3.mjs} +2 -2
- package/build/{browser-DCd_d0oU.mjs.map → browser-C_dFMvO3.mjs.map} +1 -1
- package/build/classify.d.mts +1 -2
- package/build/{cli-daemon-BTT_6ec8.mjs → cli-daemon-DBvq5TU3.mjs} +2 -2
- package/build/{cli-daemon-BTT_6ec8.mjs.map → cli-daemon-DBvq5TU3.mjs.map} +1 -1
- package/build/{cli-recipes-m_vX7Fu-.mjs → cli-recipes-C--_YyuP.mjs} +2 -2
- package/build/{cli-recipes-m_vX7Fu-.mjs.map → cli-recipes-C--_YyuP.mjs.map} +1 -1
- package/build/cli.mjs +19 -19
- package/build/cli.mjs.map +1 -1
- package/build/{daemon-CWpToMtq.mjs → daemon-BkJp3wXR.mjs} +5 -5
- package/build/{daemon-CWpToMtq.mjs.map → daemon-BkJp3wXR.mjs.map} +1 -1
- package/build/{diff-9UN0TNNe.mjs → diff-DcbpHrxv.mjs} +3 -3
- package/build/{diff-9UN0TNNe.mjs.map → diff-DcbpHrxv.mjs.map} +1 -1
- package/build/{extract-CW-Pzo2l.mjs → extract-DpycIF0M.mjs} +3 -3
- package/build/{extract-CW-Pzo2l.mjs.map → extract-DpycIF0M.mjs.map} +1 -1
- package/build/hours.d.mts +1 -2
- package/build/hours.mjs +1 -1
- package/build/hours.mjs.map +1 -1
- package/build/html-oS_ueu9U.d.mts +1 -2
- package/build/index.d.mts +2 -3
- package/build/index.mjs +14 -14
- package/build/log-CB5bADmd.mjs.map +1 -1
- package/build/{ollama-BDZjLDOK.mjs → ollama-B7eNmGhl.mjs} +2 -2
- package/build/{ollama-BDZjLDOK.mjs.map → ollama-B7eNmGhl.mjs.map} +1 -1
- package/build/{open-D-PoX1Lt.mjs → open-BIvV3pHE.mjs} +11 -11
- package/build/{open-D-PoX1Lt.mjs.map → open-BIvV3pHE.mjs.map} +1 -1
- package/build/politeness.d.mts +1 -2
- package/build/politeness.mjs.map +1 -1
- package/build/reaction-BWTIe95J.mjs +82 -0
- package/build/reaction-BWTIe95J.mjs.map +1 -0
- package/build/{recipe-product-DbuYUSYG.mjs → recipe-product-tVKjy4xu.mjs} +4 -4
- package/build/{recipe-product-DbuYUSYG.mjs.map → recipe-product-tVKjy4xu.mjs.map} +1 -1
- package/build/{recipe-CJrxYoRL.mjs → recipe-rECpzNa-.mjs} +3 -3
- package/build/{recipe-CJrxYoRL.mjs.map → recipe-rECpzNa-.mjs.map} +1 -1
- package/build/render-B0NrFDkJ.mjs.map +1 -1
- package/build/robots.d.mts +1 -2
- package/build/rolldown-runtime-D3KUYPsf.mjs +12 -0
- package/build/{runtime-jYXBNvyC.mjs → runtime-Hyr9qD0-.mjs} +30 -46
- package/build/runtime-Hyr9qD0-.mjs.map +1 -0
- package/build/signals.d.mts +1 -2
- package/build/{transformers-C_ziG8yf.mjs → transformers-Cb-KaPge.mjs} +2 -2
- package/build/{transformers-C_ziG8yf.mjs.map → transformers-Cb-KaPge.mjs.map} +1 -1
- package/build/urls.d.mts +1 -2
- package/build/{version-D6jptm-z.mjs → version-D1VudHdM.mjs} +2 -2
- package/build/{version-D6jptm-z.mjs.map → version-D1VudHdM.mjs.map} +1 -1
- package/build/{wacz-e3aVS4rN.mjs → wacz-D_Onr46C.mjs} +4 -4
- package/build/{wacz-e3aVS4rN.mjs.map → wacz-D_Onr46C.mjs.map} +1 -1
- package/build/{warc-Cn9IXXKK.mjs → warc-l7lECYMZ.mjs} +3 -3
- package/build/{warc-Cn9IXXKK.mjs.map → warc-l7lECYMZ.mjs.map} +1 -1
- package/build/{webbotauth-W3GXY3dy.mjs → webbotauth-DbiWmibz.mjs} +2 -2
- package/build/{webbotauth-W3GXY3dy.mjs.map → webbotauth-DbiWmibz.mjs.map} +1 -1
- package/package.json +5 -1
- package/build/rolldown-runtime-BJohB4LM.mjs +0 -13
- package/build/runtime-jYXBNvyC.mjs.map +0 -1
package/build/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as durationMs, r as VERSION } from "./version-
|
|
2
|
+
import { i as durationMs, r as VERSION } from "./version-D1VudHdM.mjs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { isIP } from "node:net";
|
|
@@ -204,12 +204,12 @@ const OWNER = {
|
|
|
204
204
|
const COMMANDS = {
|
|
205
205
|
fetch: {
|
|
206
206
|
min: 1,
|
|
207
|
-
max:
|
|
207
|
+
max: 1e400,
|
|
208
208
|
wants: "fetch wants at least one URL"
|
|
209
209
|
},
|
|
210
210
|
find: {
|
|
211
211
|
min: 1,
|
|
212
|
-
max:
|
|
212
|
+
max: 1e400,
|
|
213
213
|
wants: "find wants a query"
|
|
214
214
|
},
|
|
215
215
|
read: {
|
|
@@ -219,7 +219,7 @@ const COMMANDS = {
|
|
|
219
219
|
},
|
|
220
220
|
verify: {
|
|
221
221
|
min: 2,
|
|
222
|
-
max:
|
|
222
|
+
max: 1e400,
|
|
223
223
|
wants: "verify wants a document id and a quote"
|
|
224
224
|
},
|
|
225
225
|
reindex: {
|
|
@@ -244,7 +244,7 @@ const COMMANDS = {
|
|
|
244
244
|
},
|
|
245
245
|
crawl: {
|
|
246
246
|
min: 1,
|
|
247
|
-
max:
|
|
247
|
+
max: 1e400,
|
|
248
248
|
wants: "crawl wants at least one URL"
|
|
249
249
|
},
|
|
250
250
|
diff: {
|
|
@@ -254,7 +254,7 @@ const COMMANDS = {
|
|
|
254
254
|
},
|
|
255
255
|
watch: {
|
|
256
256
|
min: 1,
|
|
257
|
-
max:
|
|
257
|
+
max: 1e400,
|
|
258
258
|
wants: "watch wants add, remove, list or run"
|
|
259
259
|
},
|
|
260
260
|
daemon: {
|
|
@@ -442,8 +442,8 @@ const versionOf = (name, text) => {
|
|
|
442
442
|
return DATE_START.test(text) ? { at: timeOf(name, text) } : text;
|
|
443
443
|
};
|
|
444
444
|
const ACTIONS = {
|
|
445
|
-
add: [1,
|
|
446
|
-
remove: [1,
|
|
445
|
+
add: [1, 1e400],
|
|
446
|
+
remove: [1, 1e400],
|
|
447
447
|
list: [0, 0],
|
|
448
448
|
run: [0, 0]
|
|
449
449
|
};
|
|
@@ -1333,13 +1333,13 @@ Exit codes:
|
|
|
1333
1333
|
* command line first. The export only reads the store: it makes no store, and it sends no request.
|
|
1334
1334
|
*/
|
|
1335
1335
|
const exportCommand = async (plan, dir, json) => {
|
|
1336
|
-
const result = plan.format === "wacz" ? await (await import("./wacz-
|
|
1336
|
+
const result = plan.format === "wacz" ? await (await import("./wacz-D_Onr46C.mjs").then((n) => n.n)).exportWacz(dir, plan.options) : await (await import("./warc-l7lECYMZ.mjs").then((n) => n.a)).exportWarc(dir, plan.options);
|
|
1337
1337
|
process.stdout.write(`${json ? JSON.stringify(result, null, 2) : describeExport(result, plan.options.includeRefusals)}\n`);
|
|
1338
1338
|
return 0;
|
|
1339
1339
|
};
|
|
1340
1340
|
/** This function prints the key directory of a key file, and tells where to host it. */
|
|
1341
1341
|
const keyDirectoryCommand = async (key, agent) => {
|
|
1342
|
-
const { KEY_DIRECTORY_PATH, KEY_DIRECTORY_TYPE, keyDirectory } = await import("./webbotauth-
|
|
1342
|
+
const { KEY_DIRECTORY_PATH, KEY_DIRECTORY_TYPE, keyDirectory } = await import("./webbotauth-DbiWmibz.mjs").then((n) => n.s);
|
|
1343
1343
|
let directory;
|
|
1344
1344
|
try {
|
|
1345
1345
|
directory = keyDirectory([key]);
|
|
@@ -1455,7 +1455,7 @@ const runWatchCommand = async (crawler, line, values, limits, json, out) => {
|
|
|
1455
1455
|
};
|
|
1456
1456
|
/** This function gives the text of a diff for a person: the two captures, then the text of `formatDiff`. */
|
|
1457
1457
|
const describeDiff = async (diff) => {
|
|
1458
|
-
const { formatDiff } = await import("./diff-
|
|
1458
|
+
const { formatDiff } = await import("./diff-DcbpHrxv.mjs").then((n) => n.i);
|
|
1459
1459
|
return [
|
|
1460
1460
|
`${diff.doc} ${diff.from.capture} (${diff.from.fetched_at}) -> ${diff.to.capture} (${diff.to.fetched_at})`,
|
|
1461
1461
|
formatDiff(diff),
|
|
@@ -1465,7 +1465,7 @@ const describeDiff = async (diff) => {
|
|
|
1465
1465
|
};
|
|
1466
1466
|
/** This function checks the fields against a stored document, and prints a line for each field. The exit code is 0 when each field is verified or normalized. */
|
|
1467
1467
|
const runExtract = async (crawler, doc, fields, options, json, out) => {
|
|
1468
|
-
const { extractDocument } = await import("./extract-
|
|
1468
|
+
const { extractDocument } = await import("./extract-DpycIF0M.mjs").then((n) => n.i);
|
|
1469
1469
|
const claims = fields;
|
|
1470
1470
|
const result = crawler.extract === void 0 ? await extractDocument(crawler.runtime, doc, claims, options) : await crawler.extract(doc, claims, options);
|
|
1471
1471
|
if (json) out(JSON.stringify(result, null, 2));
|
|
@@ -1479,14 +1479,14 @@ const runExtract = async (crawler, doc, fields, options, json, out) => {
|
|
|
1479
1479
|
const embedderFor = async (choice, dir) => {
|
|
1480
1480
|
try {
|
|
1481
1481
|
if (choice.kind === "ollama") {
|
|
1482
|
-
const { ollamaEmbedder } = await import("./ollama-
|
|
1482
|
+
const { ollamaEmbedder } = await import("./ollama-B7eNmGhl.mjs").then((n) => n.a);
|
|
1483
1483
|
return ollamaEmbedder({
|
|
1484
1484
|
...choice.model === void 0 ? {} : { model: choice.model },
|
|
1485
1485
|
...choice.url === void 0 ? {} : { baseUrl: choice.url },
|
|
1486
1486
|
allowRemote: choice.allowRemote
|
|
1487
1487
|
});
|
|
1488
1488
|
}
|
|
1489
|
-
const { transformersEmbedder } = await import("./transformers-
|
|
1489
|
+
const { transformersEmbedder } = await import("./transformers-Cb-KaPge.mjs").then((n) => n.i);
|
|
1490
1490
|
return transformersEmbedder({
|
|
1491
1491
|
...choice.model === void 0 ? {} : { model: choice.model },
|
|
1492
1492
|
cacheDir: join(dir, "models")
|
|
@@ -1530,7 +1530,7 @@ const main = async (args) => {
|
|
|
1530
1530
|
if (command === "key-directory") return keyDirectoryCommand(keyFile(signKey), signatureAgent);
|
|
1531
1531
|
let signer;
|
|
1532
1532
|
if (signKey !== void 0 && signatureAgent !== void 0) {
|
|
1533
|
-
const { createWebBotAuthSigner } = await import("./webbotauth-
|
|
1533
|
+
const { createWebBotAuthSigner } = await import("./webbotauth-DbiWmibz.mjs").then((n) => n.s);
|
|
1534
1534
|
const privateKey = keyFile(signKey);
|
|
1535
1535
|
try {
|
|
1536
1536
|
signer = createWebBotAuthSigner({
|
|
@@ -1568,7 +1568,7 @@ const main = async (args) => {
|
|
|
1568
1568
|
return 0;
|
|
1569
1569
|
}
|
|
1570
1570
|
if (command === "daemon") {
|
|
1571
|
-
const { daemonCommand } = await import("./cli-daemon-
|
|
1571
|
+
const { daemonCommand } = await import("./cli-daemon-DBvq5TU3.mjs");
|
|
1572
1572
|
return daemonCommand(line.daemonLine, options, {
|
|
1573
1573
|
allowUserProvided: line.allowUserProvided,
|
|
1574
1574
|
json: values.json === true,
|
|
@@ -1577,14 +1577,14 @@ const main = async (args) => {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
if (line.exportPlan !== void 0) return exportCommand(line.exportPlan, dir, values.json === true);
|
|
1579
1579
|
const recipeLine = line.recipeLine;
|
|
1580
|
-
const recipes = recipeLine === void 0 ? void 0 : await import("./cli-recipes-
|
|
1580
|
+
const recipes = recipeLine === void 0 ? void 0 : await import("./cli-recipes-C--_YyuP.mjs");
|
|
1581
1581
|
const recipeInput = recipes === void 0 || recipeLine === void 0 ? void 0 : recipes.prepareRecipe(recipeLine);
|
|
1582
|
-
const { openCrawler } = await import("./open-
|
|
1582
|
+
const { openCrawler } = await import("./open-BIvV3pHE.mjs").then((n) => n.a);
|
|
1583
1583
|
let renderOff;
|
|
1584
1584
|
let renderer = options.renderer;
|
|
1585
1585
|
if (!(command === "fetch" || command === "crawl" || recipeLine !== void 0 || watchLine?.action === "run") || render === "never") renderer = false;
|
|
1586
1586
|
else if (renderer === void 0) {
|
|
1587
|
-
const { browserMissing } = await import("./browser-
|
|
1587
|
+
const { browserMissing } = await import("./browser-C_dFMvO3.mjs").then((n) => n.n);
|
|
1588
1588
|
renderOff = await browserMissing();
|
|
1589
1589
|
if (renderOff !== void 0) renderer = false;
|
|
1590
1590
|
}
|