@steipete/summarize 0.1.0 → 0.1.1
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/CHANGELOG.md +6 -0
- package/dist/cli.cjs +32 -3
- package/dist/cli.cjs.map +2 -2
- package/dist/esm/content/asset.js +42 -2
- package/dist/esm/content/asset.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/site/404.html +1 -1
- package/docs/site/assets/site.css +1 -1
- package/docs/site/docs/config.html +1 -1
- package/docs/site/docs/extract-only.html +1 -1
- package/docs/site/docs/firecrawl.html +1 -1
- package/docs/site/docs/index.html +1 -1
- package/docs/site/docs/llm.html +1 -1
- package/docs/site/docs/openai.html +1 -1
- package/docs/site/docs/website.html +1 -1
- package/docs/site/docs/youtube.html +1 -1
- package/docs/site/index.html +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.1.1 - 2025-12-19
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- Accept common “pasted URL” patterns like `url (canonical)` and clean up accidental `\\?` / `\\=` / `%5C` before query separators.
|
|
10
|
+
|
|
5
11
|
## 0.1.0 - 2025-12-19
|
|
6
12
|
|
|
7
13
|
First public release.
|
package/dist/cli.cjs
CHANGED
|
@@ -66598,6 +66598,22 @@ var src_default = new Mime_default(standard_default, other_default)._freeze();
|
|
|
66598
66598
|
|
|
66599
66599
|
// src/content/asset.ts
|
|
66600
66600
|
var MAX_ASSET_BYTES_DEFAULT = 50 * 1024 * 1024;
|
|
66601
|
+
function normalizeUrlInput(raw) {
|
|
66602
|
+
return raw.replaceAll(/\\([?&=])/g, "$1").replaceAll(/%5c(?=[?&=])/gi, "");
|
|
66603
|
+
}
|
|
66604
|
+
function trimLikelyUrlPunctuation(raw) {
|
|
66605
|
+
let value = raw.trim();
|
|
66606
|
+
while (value.length > 0 && /[)\].,;:'">}”’»]/.test(value[value.length - 1] ?? "")) {
|
|
66607
|
+
value = value.slice(0, -1);
|
|
66608
|
+
}
|
|
66609
|
+
while (value.length > 0 && /^[('"<{[\]“‘«]/.test(value[0] ?? "")) {
|
|
66610
|
+
value = value.slice(1);
|
|
66611
|
+
}
|
|
66612
|
+
return value;
|
|
66613
|
+
}
|
|
66614
|
+
function extractHttpUrlsFromText(raw) {
|
|
66615
|
+
return [...raw.matchAll(/https?:\/\/\S+/g)].map((match) => trimLikelyUrlPunctuation(match[0] ?? "")).filter((candidate) => candidate.length > 0);
|
|
66616
|
+
}
|
|
66601
66617
|
function normalizeHeaderMediaType(value) {
|
|
66602
66618
|
if (!value) return null;
|
|
66603
66619
|
const trimmed = value.trim();
|
|
@@ -66629,9 +66645,22 @@ function resolveInputTarget(raw) {
|
|
|
66629
66645
|
if ((0, import_node_fs2.existsSync)(asPath)) {
|
|
66630
66646
|
return { kind: "file", filePath: asPath };
|
|
66631
66647
|
}
|
|
66648
|
+
const extractedUrls = extractHttpUrlsFromText(normalized);
|
|
66649
|
+
const extractedLast = extractedUrls.at(-1) ?? null;
|
|
66650
|
+
if (extractedLast && extractedLast !== normalized) {
|
|
66651
|
+
for (let i = extractedUrls.length - 1; i >= 0; i -= 1) {
|
|
66652
|
+
const candidate = extractedUrls[i];
|
|
66653
|
+
if (!candidate) continue;
|
|
66654
|
+
try {
|
|
66655
|
+
return resolveInputTarget(candidate);
|
|
66656
|
+
} catch {
|
|
66657
|
+
}
|
|
66658
|
+
}
|
|
66659
|
+
}
|
|
66632
66660
|
let parsed;
|
|
66661
|
+
const normalizedUrlInput = normalizeUrlInput(normalized);
|
|
66633
66662
|
try {
|
|
66634
|
-
parsed = new URL(
|
|
66663
|
+
parsed = new URL(normalizedUrlInput);
|
|
66635
66664
|
} catch {
|
|
66636
66665
|
throw new Error(`Invalid URL or file path: ${raw}`);
|
|
66637
66666
|
}
|
|
@@ -66651,7 +66680,7 @@ function resolveInputTarget(raw) {
|
|
|
66651
66680
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
66652
66681
|
throw new Error("Only HTTP and HTTPS URLs can be summarized");
|
|
66653
66682
|
}
|
|
66654
|
-
return { kind: "url", url:
|
|
66683
|
+
return { kind: "url", url: normalizedUrlInput };
|
|
66655
66684
|
}
|
|
66656
66685
|
async function classifyUrl({
|
|
66657
66686
|
url: url2,
|
|
@@ -72499,7 +72528,7 @@ function startSpinner({
|
|
|
72499
72528
|
var import_node_fs4 = __toESM(require("node:fs"), 1);
|
|
72500
72529
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
72501
72530
|
var import_node_url = require("node:url");
|
|
72502
|
-
var FALLBACK_VERSION = "0.1.
|
|
72531
|
+
var FALLBACK_VERSION = "0.1.1";
|
|
72503
72532
|
function resolvePackageVersion(importMetaUrl) {
|
|
72504
72533
|
const injected = typeof process !== "undefined" && typeof process.env.SUMMARIZE_VERSION === "string" ? process.env.SUMMARIZE_VERSION.trim() : "";
|
|
72505
72534
|
if (injected.length > 0) return injected;
|