@utilix-tech/sdk 0.47.0 → 0.48.0
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 +4 -0
- package/README.md +11 -5
- package/dist/{chunk-JR354NH4.js → chunk-4TIY6COQ.js} +64 -1
- package/dist/{chunk-S3OA5VCX.js → chunk-Y7YY733Z.js} +49 -1
- package/dist/{data-BKpEOcOX.d.cts → data-BJVJ879p.d.cts} +30 -2
- package/dist/{data-BKpEOcOX.d.ts → data-BJVJ879p.d.ts} +30 -2
- package/dist/index.cjs +118 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{network-BG0XDx5W.d.ts → network-DelcJeJa.d.cts} +32 -2
- package/dist/{network-BG0XDx5W.d.cts → network-DelcJeJa.d.ts} +32 -2
- package/dist/tools/data.cjs +63 -0
- package/dist/tools/data.d.cts +1 -1
- package/dist/tools/data.d.ts +1 -1
- package/dist/tools/data.js +1 -1
- package/dist/tools/network.cjs +48 -0
- package/dist/tools/network.d.cts +1 -1
- package/dist/tools/network.d.ts +1 -1
- package/dist/tools/network.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.48.0
|
|
6
|
+
- Add `resolveYamlAnchors` (yaml-anchor-resolver): expand YAML anchors, aliases, and merge keys inline, and list which anchors were referenced vs. left unused.
|
|
7
|
+
- Add `splitSitemap` (sitemap-index-splitter): split a URL list exceeding the sitemaps.org 50,000-URL cap into multiple sitemap.xml files plus a sitemap index file.
|
|
8
|
+
|
|
5
9
|
## 0.47.0
|
|
6
10
|
- Add `buildContentDisposition`, `parseContentDisposition` (content-disposition-builder): build a `Content-Disposition` response header from a disposition type and filename, with an RFC 5987 `filename*` extended parameter for non-ASCII filenames, or parse an existing header into its type, filename, and raw parameters.
|
|
7
11
|
- Add `inspectGifFrames` (gif-frame-inspector): walk a GIF87a/89a file's block structure to report frame count, total animation duration, and loop count, without decoding any LZW-compressed pixel data.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @utilix-tech/sdk
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**634 developer utility functions for Node.js: runs locally, no API key required.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
6
6
|
[](https://www.npmjs.com/package/@utilix-tech/sdk)
|
|
@@ -201,7 +201,7 @@ analyzeKeywordDensity("machine learning models power machine learning systems");
|
|
|
201
201
|
### `/data`: CSV / YAML / TOML / XML / INI / NDJSON / .env diff / subtitles / Markdown front matter & TOC
|
|
202
202
|
|
|
203
203
|
```ts
|
|
204
|
-
import { parseCsv, csvToJson, validateYaml, tomlToJson, jsonToToml,
|
|
204
|
+
import { parseCsv, csvToJson, validateYaml, resolveYamlAnchors, tomlToJson, jsonToToml,
|
|
205
205
|
formatXml, xmlToJson, jsonToXml, parseIni,
|
|
206
206
|
validateNdjson, formatNdjson, ndjsonToJsonArray, diffEnvExample,
|
|
207
207
|
parseSubtitles, convertSubtitles, shiftSubtitles, parseFrontMatter,
|
|
@@ -213,6 +213,8 @@ csvToJson("name,age\nalice,30"); // [{ name: "alice", age: "30" }]
|
|
|
213
213
|
|
|
214
214
|
// YAML
|
|
215
215
|
validateYaml("key: value\nlist:\n - a\n - b");
|
|
216
|
+
resolveYamlAnchors("defaults: &defaults\n timeout: 30\nprod:\n <<: *defaults\n timeout: 60\n");
|
|
217
|
+
// { resolvedYaml: "defaults:\n timeout: 30\nprod:\n timeout: 60\n", anchors: [...], unusedAnchors: [], aliasCount: 1 }
|
|
216
218
|
|
|
217
219
|
// TOML
|
|
218
220
|
tomlToJson('[server]\nhost = "localhost"\nport = 8080');
|
|
@@ -447,7 +449,7 @@ calculateDepreciationSchedule(10000, 1000, 5, "straight-line");
|
|
|
447
449
|
```ts
|
|
448
450
|
import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
|
|
449
451
|
searchStatusCodes, buildGeoUrl, countryCodeToFlag,
|
|
450
|
-
parseHar, validateSitemap, validateRobotsTxt,
|
|
452
|
+
parseHar, validateSitemap, splitSitemap, validateRobotsTxt,
|
|
451
453
|
parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader, checkSetCookieHeader, analyzeEmailHeaders,
|
|
452
454
|
buildRangeHeader, parseContentRangeHeader, buildVaryHeader, parseVaryHeader, validateManifest,
|
|
453
455
|
buildPermissionsPolicy, parsePermissionsPolicy, buildClientHints, parseClientHintHeaders,
|
|
@@ -478,6 +480,10 @@ parseHar(har);
|
|
|
478
480
|
validateSitemap('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://example.com/</loc></url></urlset>');
|
|
479
481
|
// { type: "urlset", urlCount: 1, entries: [...], issues: [...], valid: true }
|
|
480
482
|
|
|
483
|
+
// Split a URL list exceeding the 50,000-URL sitemap cap into multiple sitemap.xml files + a sitemap index
|
|
484
|
+
splitSitemap("https://example.com/a\nhttps://example.com/b\nhttps://example.com/c", { baseUrl: "https://example.com", urlsPerFile: 2 });
|
|
485
|
+
// { files: [{ filename: "sitemap-1.xml", urlCount: 2, xml: "..." }, { filename: "sitemap-2.xml", urlCount: 1, xml: "..." }], indexXml: "...", totalUrls: 3 }
|
|
486
|
+
|
|
481
487
|
// Validate a robots.txt file: User-agent groups, rules, and syntax mistakes
|
|
482
488
|
validateRobotsTxt("User-agent: *\nDisallow: /admin\nSitemap: https://example.com/sitemap.xml");
|
|
483
489
|
// { groups: [...], sitemaps: [...], issues: [...], valid: true }
|
|
@@ -794,11 +800,11 @@ inspectGifFrames(new Uint8Array(gifBytes));
|
|
|
794
800
|
| `@utilix-tech/sdk/encoding` | Base64, URL, HTML entities, Base32/Base58/Base62 encode/decode |
|
|
795
801
|
| `@utilix-tech/sdk/hashing` | MD5, SHA-1/256/512, bcrypt, HMAC, .htpasswd, SRI hashes, content-hash ETag generation |
|
|
796
802
|
| `@utilix-tech/sdk/text` | Case convert, slugify, word count, lorem ipsum, line ops, HTML→Markdown, Levenshtein/Damerau string distance, readability scoring, sentence length distribution, emoji lookup |
|
|
797
|
-
| `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert, SRT/WebVTT subtitles, Markdown front matter parser |
|
|
803
|
+
| `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert, SRT/WebVTT subtitles, Markdown front matter parser, YAML anchor/alias resolver |
|
|
798
804
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data |
|
|
799
805
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
800
806
|
| `@utilix-tech/sdk/units` | Bytes, CSS px/rem, number bases, currency format, credit card/IBAN/barcode/ISBN validation, loan calculator, EMI calculator, compound/simple interest calculators, VAT/sales tax calculator, tip/bill split calculator, break-even point calculator, Rule of 72 calculator, savings goal calculator, ROI calculator, cash denomination/till calculator, payback period calculator, CD maturity calculator |
|
|
801
|
-
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser, Content-Disposition header builder/parser |
|
|
807
|
+
| `@utilix-tech/sdk/network` | HTTP status codes, IP validation, country flags, geolocation URLs, HAR file parsing, User-Agent parsing, IPv6 address compress/expand, Permissions-Policy header builder, Client Hints header builder/parser, Content-Disposition header builder/parser, sitemap.xml validator, sitemap index splitter |
|
|
802
808
|
| `@utilix-tech/sdk/api` | cURL build/parse, JWT decode/sign, JWKS parse, CORS headers, CSP header |
|
|
803
809
|
| `@utilix-tech/sdk/code` | SQL format/minify, HTML format/minify, regex tester, GraphQL format, MIME type lookup, GitHub URL parsing, regex ReDoS detector, Conventional Commits linter |
|
|
804
810
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
@@ -40,6 +40,7 @@ __export(data_exports, {
|
|
|
40
40
|
parseSubtitleTimestamp: () => parseSubtitleTimestamp,
|
|
41
41
|
parseSubtitles: () => parseSubtitles,
|
|
42
42
|
parseXmlToObject: () => parseXmlToObject,
|
|
43
|
+
resolveYamlAnchors: () => resolveYamlAnchors,
|
|
43
44
|
serializeSubtitles: () => serializeSubtitles,
|
|
44
45
|
shiftSubtitles: () => shiftSubtitles,
|
|
45
46
|
stringifyIni: () => stringifyIni,
|
|
@@ -1560,5 +1561,67 @@ function findCsvDuplicateRows(input, options) {
|
|
|
1560
1561
|
uniqueRowCount: parsed.rows.length - duplicateRowCount + duplicateGroups.length
|
|
1561
1562
|
};
|
|
1562
1563
|
}
|
|
1564
|
+
var _YAML_ANCHOR_RE = /(?:^|\s)&([A-Za-z0-9_.-]+)/g;
|
|
1565
|
+
var _YAML_ALIAS_RE = /(?:^|\s)\*([A-Za-z0-9_.-]+)/g;
|
|
1566
|
+
function _stripYamlLineComment(line) {
|
|
1567
|
+
let inSingle = false;
|
|
1568
|
+
let inDouble = false;
|
|
1569
|
+
for (let i = 0; i < line.length; i++) {
|
|
1570
|
+
const ch = line[i];
|
|
1571
|
+
if (ch === "'" && !inDouble) {
|
|
1572
|
+
inSingle = !inSingle;
|
|
1573
|
+
} else if (ch === '"' && !inSingle) {
|
|
1574
|
+
inDouble = !inDouble;
|
|
1575
|
+
} else if (ch === "#" && !inSingle && !inDouble && (i === 0 || /\s/.test(line[i - 1]))) {
|
|
1576
|
+
return line.slice(0, i);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return line;
|
|
1580
|
+
}
|
|
1581
|
+
function resolveYamlAnchors(yamlText) {
|
|
1582
|
+
if (!yamlText || !yamlText.trim()) return { error: "Input is empty" };
|
|
1583
|
+
const anchorDefs = [];
|
|
1584
|
+
const referencedNames = /* @__PURE__ */ new Set();
|
|
1585
|
+
let aliasCount = 0;
|
|
1586
|
+
const lines = yamlText.split("\n");
|
|
1587
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1588
|
+
const line = _stripYamlLineComment(lines[i]);
|
|
1589
|
+
const lineNum = i + 1;
|
|
1590
|
+
_YAML_ANCHOR_RE.lastIndex = 0;
|
|
1591
|
+
let m;
|
|
1592
|
+
while ((m = _YAML_ANCHOR_RE.exec(line)) !== null) {
|
|
1593
|
+
anchorDefs.push({ name: m[1], line: lineNum });
|
|
1594
|
+
}
|
|
1595
|
+
_YAML_ALIAS_RE.lastIndex = 0;
|
|
1596
|
+
while ((m = _YAML_ALIAS_RE.exec(line)) !== null) {
|
|
1597
|
+
referencedNames.add(m[1]);
|
|
1598
|
+
aliasCount++;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
let parsed;
|
|
1602
|
+
try {
|
|
1603
|
+
parsed = yaml.load(yamlText);
|
|
1604
|
+
} catch (e) {
|
|
1605
|
+
const err = e;
|
|
1606
|
+
return { error: err.reason ?? err.message };
|
|
1607
|
+
}
|
|
1608
|
+
let resolvedYaml;
|
|
1609
|
+
try {
|
|
1610
|
+
resolvedYaml = yaml.dump(parsed, { noRefs: true, lineWidth: -1 });
|
|
1611
|
+
} catch (e) {
|
|
1612
|
+
return { error: e instanceof Error ? e.message : String(e) };
|
|
1613
|
+
}
|
|
1614
|
+
const anchors = anchorDefs.map((a) => ({
|
|
1615
|
+
name: a.name,
|
|
1616
|
+
line: a.line,
|
|
1617
|
+
referenced: referencedNames.has(a.name)
|
|
1618
|
+
}));
|
|
1619
|
+
const seenAnchorNames = [];
|
|
1620
|
+
for (const a of anchorDefs) {
|
|
1621
|
+
if (!seenAnchorNames.includes(a.name)) seenAnchorNames.push(a.name);
|
|
1622
|
+
}
|
|
1623
|
+
const unusedAnchors = seenAnchorNames.filter((name) => !referencedNames.has(name));
|
|
1624
|
+
return { resolvedYaml, anchors, unusedAnchors, aliasCount };
|
|
1625
|
+
}
|
|
1563
1626
|
|
|
1564
|
-
export { convertSubtitles, csvToJson, csvToSqlInsert, data_exports, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson };
|
|
1627
|
+
export { convertSubtitles, csvToJson, csvToSqlInsert, data_exports, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson };
|
|
@@ -49,6 +49,7 @@ __export(network_exports, {
|
|
|
49
49
|
parseVaryHeader: () => parseVaryHeader,
|
|
50
50
|
searchHeaders: () => searchHeaders,
|
|
51
51
|
searchStatusCodes: () => searchStatusCodes,
|
|
52
|
+
splitSitemap: () => splitSitemap,
|
|
52
53
|
statusCodeToText: () => statusCodeToText,
|
|
53
54
|
typeNumberToLabel: () => typeNumberToLabel,
|
|
54
55
|
validateDomain: () => validateDomain,
|
|
@@ -1554,6 +1555,53 @@ function validateSitemap(xml) {
|
|
|
1554
1555
|
const valid = !issues.some((i) => i.severity === "error");
|
|
1555
1556
|
return { type, urlCount: entries.length, entries, issues, valid };
|
|
1556
1557
|
}
|
|
1558
|
+
var SITEMAP_SPLITTER_MAX_URLS_PER_FILE = 5e4;
|
|
1559
|
+
function escapeXmlUrl(url) {
|
|
1560
|
+
return url.replace(/&(?!amp;|lt;|gt;|apos;|quot;|#\d+;)/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1561
|
+
}
|
|
1562
|
+
function splitSitemap(urlsText, options) {
|
|
1563
|
+
const urls = (urlsText ?? "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
1564
|
+
if (urls.length === 0) return { error: "No URLs provided" };
|
|
1565
|
+
for (let i = 0; i < urls.length; i++) {
|
|
1566
|
+
if (!/^https?:\/\//i.test(urls[i])) {
|
|
1567
|
+
return { error: `Line ${i + 1}: "${urls[i]}" is not an absolute URL starting with http:// or https://` };
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
if (!options || !/^https?:\/\//i.test(options.baseUrl ?? "")) {
|
|
1571
|
+
return { error: "baseUrl must be an absolute URL starting with http:// or https://" };
|
|
1572
|
+
}
|
|
1573
|
+
const baseUrl = options.baseUrl.replace(/\/+$/, "") + "/";
|
|
1574
|
+
let urlsPerFile = options.urlsPerFile ?? SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
1575
|
+
if (urlsPerFile <= 0) urlsPerFile = SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
1576
|
+
if (urlsPerFile > SITEMAP_SPLITTER_MAX_URLS_PER_FILE) urlsPerFile = SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
1577
|
+
const filePrefix = (options.filePrefix || "sitemap").replace(/[^A-Za-z0-9_-]/g, "");
|
|
1578
|
+
const files = [];
|
|
1579
|
+
for (let i = 0; i < urls.length; i += urlsPerFile) {
|
|
1580
|
+
const chunk = urls.slice(i, i + urlsPerFile);
|
|
1581
|
+
const fileIndex = files.length + 1;
|
|
1582
|
+
const filename = `${filePrefix}-${fileIndex}.xml`;
|
|
1583
|
+
const urlLines = chunk.map((url) => ` <url>
|
|
1584
|
+
<loc>${escapeXmlUrl(url)}</loc>
|
|
1585
|
+
</url>`).join("\n");
|
|
1586
|
+
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1587
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
1588
|
+
${urlLines}
|
|
1589
|
+
</urlset>
|
|
1590
|
+
`;
|
|
1591
|
+
files.push({ filename, urlCount: chunk.length, xml });
|
|
1592
|
+
}
|
|
1593
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
1594
|
+
const indexEntries = files.map((f) => ` <sitemap>
|
|
1595
|
+
<loc>${escapeXmlUrl(baseUrl + f.filename)}</loc>
|
|
1596
|
+
<lastmod>${today}</lastmod>
|
|
1597
|
+
</sitemap>`).join("\n");
|
|
1598
|
+
const indexXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1599
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
1600
|
+
${indexEntries}
|
|
1601
|
+
</sitemapindex>
|
|
1602
|
+
`;
|
|
1603
|
+
return { files, indexXml, totalUrls: urls.length };
|
|
1604
|
+
}
|
|
1557
1605
|
var KNOWN_ROBOTS_DIRECTIVES = /* @__PURE__ */ new Set(["user-agent", "disallow", "allow", "sitemap", "crawl-delay", "host"]);
|
|
1558
1606
|
function validateRobotsTxt(text) {
|
|
1559
1607
|
if (!text || !text.trim()) return { error: "Input is empty" };
|
|
@@ -2728,4 +2776,4 @@ function parseContentDisposition(header) {
|
|
|
2728
2776
|
return { type, filename, filenameIsExtended, params };
|
|
2729
2777
|
}
|
|
2730
2778
|
|
|
2731
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
|
2779
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap };
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - markdown-toc-generator: generateMarkdownToc
|
|
18
18
|
* - csv-to-sql-insert-generator: csvToSqlInsert
|
|
19
19
|
* - csv-duplicate-row-finder: findCsvDuplicateRows
|
|
20
|
+
* - yaml-anchor-resolver: resolveYamlAnchors
|
|
20
21
|
*/
|
|
21
22
|
interface ValidationResult {
|
|
22
23
|
valid: boolean;
|
|
@@ -372,6 +373,29 @@ interface CsvDuplicateResult {
|
|
|
372
373
|
declare function findCsvDuplicateRows(input: string, options?: CsvDuplicateOptions): CsvDuplicateResult | {
|
|
373
374
|
error: string;
|
|
374
375
|
};
|
|
376
|
+
interface YamlAnchorInfo {
|
|
377
|
+
name: string;
|
|
378
|
+
line: number;
|
|
379
|
+
referenced: boolean;
|
|
380
|
+
}
|
|
381
|
+
interface YamlAnchorResolveResult {
|
|
382
|
+
resolvedYaml: string;
|
|
383
|
+
anchors: YamlAnchorInfo[];
|
|
384
|
+
unusedAnchors: string[];
|
|
385
|
+
aliasCount: number;
|
|
386
|
+
}
|
|
387
|
+
interface YamlAnchorResolveError {
|
|
388
|
+
error: string;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Expand every YAML anchor, alias, and merge key in the input inline, and
|
|
392
|
+
* report which anchors were referenced vs. left unused. Unlike
|
|
393
|
+
* `validateYaml`, which only checks syntax, this fully resolves the
|
|
394
|
+
* document via js-yaml (which already implements anchor/alias/merge-key
|
|
395
|
+
* resolution per the YAML spec) and re-serializes it with no `&`/`*`
|
|
396
|
+
* syntax remaining.
|
|
397
|
+
*/
|
|
398
|
+
declare function resolveYamlAnchors(yamlText: string): YamlAnchorResolveResult | YamlAnchorResolveError;
|
|
375
399
|
|
|
376
400
|
type data_ConvertedSubtitles = ConvertedSubtitles;
|
|
377
401
|
type data_CsvDuplicateGroup = CsvDuplicateGroup;
|
|
@@ -401,6 +425,9 @@ type data_TomlFormatResult = TomlFormatResult;
|
|
|
401
425
|
type data_ValidationResult = ValidationResult;
|
|
402
426
|
type data_XmlFormatResult = XmlFormatResult;
|
|
403
427
|
type data_XmlToJsonOptions = XmlToJsonOptions;
|
|
428
|
+
type data_YamlAnchorInfo = YamlAnchorInfo;
|
|
429
|
+
type data_YamlAnchorResolveError = YamlAnchorResolveError;
|
|
430
|
+
type data_YamlAnchorResolveResult = YamlAnchorResolveResult;
|
|
404
431
|
declare const data_convertSubtitles: typeof convertSubtitles;
|
|
405
432
|
declare const data_csvToJson: typeof csvToJson;
|
|
406
433
|
declare const data_csvToSqlInsert: typeof csvToSqlInsert;
|
|
@@ -436,6 +463,7 @@ declare const data_parseIni: typeof parseIni;
|
|
|
436
463
|
declare const data_parseSubtitleTimestamp: typeof parseSubtitleTimestamp;
|
|
437
464
|
declare const data_parseSubtitles: typeof parseSubtitles;
|
|
438
465
|
declare const data_parseXmlToObject: typeof parseXmlToObject;
|
|
466
|
+
declare const data_resolveYamlAnchors: typeof resolveYamlAnchors;
|
|
439
467
|
declare const data_serializeSubtitles: typeof serializeSubtitles;
|
|
440
468
|
declare const data_shiftSubtitles: typeof shiftSubtitles;
|
|
441
469
|
declare const data_stringifyIni: typeof stringifyIni;
|
|
@@ -449,7 +477,7 @@ declare const data_validateXml: typeof validateXml;
|
|
|
449
477
|
declare const data_validateYaml: typeof validateYaml;
|
|
450
478
|
declare const data_xmlToJson: typeof xmlToJson;
|
|
451
479
|
declare namespace data {
|
|
452
|
-
export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
480
|
+
export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, type data_YamlAnchorInfo as YamlAnchorInfo, type data_YamlAnchorResolveError as YamlAnchorResolveError, type data_YamlAnchorResolveResult as YamlAnchorResolveResult, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_resolveYamlAnchors as resolveYamlAnchors, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
453
481
|
}
|
|
454
482
|
|
|
455
|
-
export {
|
|
483
|
+
export { jsonToIni as $, envToExport as A, envToJson as B, type ConvertedSubtitles as C, findCsvDuplicateRows as D, type EnvDiffError as E, type FrontMatterError as F, formatNdjson as G, formatSubtitleTimestamp as H, type IniSection as I, formatToml as J, formatXml as K, generateMarkdownToc as L, type MarkdownTocEntry as M, type NdjsonLineResult as N, getSection as O, type ParseOptions as P, getSectionNames as Q, getTomlStats as R, type SubtitleCue as S, type TomlFormatResult as T, getXmlStats as U, type ValidationResult as V, getYamlStats as W, type XmlFormatResult as X, type YamlAnchorInfo as Y, iniToJson as Z, jsonArrayToNdjson as _, type CsvDuplicateGroup as a, jsonToToml as a0, jsonToXml as a1, minifyNdjson as a2, minifyToml as a3, minifyXml as a4, ndjsonToJsonArray as a5, parseCsv as a6, parseEnv as a7, parseFrontMatter as a8, parseIni as a9, parseSubtitleTimestamp as aa, parseSubtitles as ab, parseXmlToObject as ac, resolveYamlAnchors as ad, serializeSubtitles as ae, shiftSubtitles as af, stringifyIni as ag, toCsvString as ah, tomlToJson as ai, validateEnvKey as aj, validateIni as ak, validateNdjson as al, validateToml as am, validateXml as an, validateYaml as ao, xmlToJson as ap, type CsvDuplicateOptions as b, type CsvDuplicateResult as c, data as d, type CsvParseResult as e, type CsvToSqlOptions as f, type CsvToSqlResult as g, type EnvDiffResult as h, type EnvEntry as i, type EnvParseResult as j, type FrontMatterResult as k, type MarkdownTocOptions as l, type MarkdownTocResult as m, type NdjsonValidateResult as n, type ParsedIni as o, type ParsedSubtitles as p, type SubtitleFormat as q, type XmlToJsonOptions as r, type YamlAnchorResolveError as s, type YamlAnchorResolveResult as t, convertSubtitles as u, csvToJson as v, csvToSqlInsert as w, detectDelimiter as x, detectSubtitleFormat as y, diffEnvExample as z };
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* - markdown-toc-generator: generateMarkdownToc
|
|
18
18
|
* - csv-to-sql-insert-generator: csvToSqlInsert
|
|
19
19
|
* - csv-duplicate-row-finder: findCsvDuplicateRows
|
|
20
|
+
* - yaml-anchor-resolver: resolveYamlAnchors
|
|
20
21
|
*/
|
|
21
22
|
interface ValidationResult {
|
|
22
23
|
valid: boolean;
|
|
@@ -372,6 +373,29 @@ interface CsvDuplicateResult {
|
|
|
372
373
|
declare function findCsvDuplicateRows(input: string, options?: CsvDuplicateOptions): CsvDuplicateResult | {
|
|
373
374
|
error: string;
|
|
374
375
|
};
|
|
376
|
+
interface YamlAnchorInfo {
|
|
377
|
+
name: string;
|
|
378
|
+
line: number;
|
|
379
|
+
referenced: boolean;
|
|
380
|
+
}
|
|
381
|
+
interface YamlAnchorResolveResult {
|
|
382
|
+
resolvedYaml: string;
|
|
383
|
+
anchors: YamlAnchorInfo[];
|
|
384
|
+
unusedAnchors: string[];
|
|
385
|
+
aliasCount: number;
|
|
386
|
+
}
|
|
387
|
+
interface YamlAnchorResolveError {
|
|
388
|
+
error: string;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Expand every YAML anchor, alias, and merge key in the input inline, and
|
|
392
|
+
* report which anchors were referenced vs. left unused. Unlike
|
|
393
|
+
* `validateYaml`, which only checks syntax, this fully resolves the
|
|
394
|
+
* document via js-yaml (which already implements anchor/alias/merge-key
|
|
395
|
+
* resolution per the YAML spec) and re-serializes it with no `&`/`*`
|
|
396
|
+
* syntax remaining.
|
|
397
|
+
*/
|
|
398
|
+
declare function resolveYamlAnchors(yamlText: string): YamlAnchorResolveResult | YamlAnchorResolveError;
|
|
375
399
|
|
|
376
400
|
type data_ConvertedSubtitles = ConvertedSubtitles;
|
|
377
401
|
type data_CsvDuplicateGroup = CsvDuplicateGroup;
|
|
@@ -401,6 +425,9 @@ type data_TomlFormatResult = TomlFormatResult;
|
|
|
401
425
|
type data_ValidationResult = ValidationResult;
|
|
402
426
|
type data_XmlFormatResult = XmlFormatResult;
|
|
403
427
|
type data_XmlToJsonOptions = XmlToJsonOptions;
|
|
428
|
+
type data_YamlAnchorInfo = YamlAnchorInfo;
|
|
429
|
+
type data_YamlAnchorResolveError = YamlAnchorResolveError;
|
|
430
|
+
type data_YamlAnchorResolveResult = YamlAnchorResolveResult;
|
|
404
431
|
declare const data_convertSubtitles: typeof convertSubtitles;
|
|
405
432
|
declare const data_csvToJson: typeof csvToJson;
|
|
406
433
|
declare const data_csvToSqlInsert: typeof csvToSqlInsert;
|
|
@@ -436,6 +463,7 @@ declare const data_parseIni: typeof parseIni;
|
|
|
436
463
|
declare const data_parseSubtitleTimestamp: typeof parseSubtitleTimestamp;
|
|
437
464
|
declare const data_parseSubtitles: typeof parseSubtitles;
|
|
438
465
|
declare const data_parseXmlToObject: typeof parseXmlToObject;
|
|
466
|
+
declare const data_resolveYamlAnchors: typeof resolveYamlAnchors;
|
|
439
467
|
declare const data_serializeSubtitles: typeof serializeSubtitles;
|
|
440
468
|
declare const data_shiftSubtitles: typeof shiftSubtitles;
|
|
441
469
|
declare const data_stringifyIni: typeof stringifyIni;
|
|
@@ -449,7 +477,7 @@ declare const data_validateXml: typeof validateXml;
|
|
|
449
477
|
declare const data_validateYaml: typeof validateYaml;
|
|
450
478
|
declare const data_xmlToJson: typeof xmlToJson;
|
|
451
479
|
declare namespace data {
|
|
452
|
-
export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
480
|
+
export { type data_ConvertedSubtitles as ConvertedSubtitles, type data_CsvDuplicateGroup as CsvDuplicateGroup, type data_CsvDuplicateOptions as CsvDuplicateOptions, type data_CsvDuplicateResult as CsvDuplicateResult, type data_CsvParseResult as CsvParseResult, type data_CsvToSqlOptions as CsvToSqlOptions, type data_CsvToSqlResult as CsvToSqlResult, type data_EnvDiffError as EnvDiffError, type data_EnvDiffResult as EnvDiffResult, type data_EnvEntry as EnvEntry, type data_EnvParseResult as EnvParseResult, type data_FrontMatterError as FrontMatterError, type data_FrontMatterResult as FrontMatterResult, type data_IniSection as IniSection, type data_MarkdownTocEntry as MarkdownTocEntry, type data_MarkdownTocOptions as MarkdownTocOptions, type data_MarkdownTocResult as MarkdownTocResult, type data_NdjsonLineResult as NdjsonLineResult, type data_NdjsonValidateResult as NdjsonValidateResult, type data_ParseOptions as ParseOptions, type data_ParsedIni as ParsedIni, type data_ParsedSubtitles as ParsedSubtitles, type data_SubtitleCue as SubtitleCue, type data_SubtitleFormat as SubtitleFormat, type data_TomlFormatResult as TomlFormatResult, type data_ValidationResult as ValidationResult, type data_XmlFormatResult as XmlFormatResult, type data_XmlToJsonOptions as XmlToJsonOptions, type data_YamlAnchorInfo as YamlAnchorInfo, type data_YamlAnchorResolveError as YamlAnchorResolveError, type data_YamlAnchorResolveResult as YamlAnchorResolveResult, data_convertSubtitles as convertSubtitles, data_csvToJson as csvToJson, data_csvToSqlInsert as csvToSqlInsert, data_detectDelimiter as detectDelimiter, data_detectSubtitleFormat as detectSubtitleFormat, data_diffEnvExample as diffEnvExample, data_envToExport as envToExport, data_envToJson as envToJson, data_findCsvDuplicateRows as findCsvDuplicateRows, data_formatNdjson as formatNdjson, data_formatSubtitleTimestamp as formatSubtitleTimestamp, data_formatToml as formatToml, data_formatXml as formatXml, data_generateMarkdownToc as generateMarkdownToc, data_getSection as getSection, data_getSectionNames as getSectionNames, data_getTomlStats as getTomlStats, data_getXmlStats as getXmlStats, data_getYamlStats as getYamlStats, data_iniToJson as iniToJson, data_jsonArrayToNdjson as jsonArrayToNdjson, data_jsonToIni as jsonToIni, data_jsonToToml as jsonToToml, data_jsonToXml as jsonToXml, data_minifyNdjson as minifyNdjson, data_minifyToml as minifyToml, data_minifyXml as minifyXml, data_ndjsonToJsonArray as ndjsonToJsonArray, data_parseCsv as parseCsv, data_parseEnv as parseEnv, data_parseFrontMatter as parseFrontMatter, data_parseIni as parseIni, data_parseSubtitleTimestamp as parseSubtitleTimestamp, data_parseSubtitles as parseSubtitles, data_parseXmlToObject as parseXmlToObject, data_resolveYamlAnchors as resolveYamlAnchors, data_serializeSubtitles as serializeSubtitles, data_shiftSubtitles as shiftSubtitles, data_stringifyIni as stringifyIni, data_toCsvString as toCsvString, data_tomlToJson as tomlToJson, data_validateEnvKey as validateEnvKey, data_validateIni as validateIni, data_validateNdjson as validateNdjson, data_validateToml as validateToml, data_validateXml as validateXml, data_validateYaml as validateYaml, data_xmlToJson as xmlToJson };
|
|
453
481
|
}
|
|
454
482
|
|
|
455
|
-
export {
|
|
483
|
+
export { jsonToIni as $, envToExport as A, envToJson as B, type ConvertedSubtitles as C, findCsvDuplicateRows as D, type EnvDiffError as E, type FrontMatterError as F, formatNdjson as G, formatSubtitleTimestamp as H, type IniSection as I, formatToml as J, formatXml as K, generateMarkdownToc as L, type MarkdownTocEntry as M, type NdjsonLineResult as N, getSection as O, type ParseOptions as P, getSectionNames as Q, getTomlStats as R, type SubtitleCue as S, type TomlFormatResult as T, getXmlStats as U, type ValidationResult as V, getYamlStats as W, type XmlFormatResult as X, type YamlAnchorInfo as Y, iniToJson as Z, jsonArrayToNdjson as _, type CsvDuplicateGroup as a, jsonToToml as a0, jsonToXml as a1, minifyNdjson as a2, minifyToml as a3, minifyXml as a4, ndjsonToJsonArray as a5, parseCsv as a6, parseEnv as a7, parseFrontMatter as a8, parseIni as a9, parseSubtitleTimestamp as aa, parseSubtitles as ab, parseXmlToObject as ac, resolveYamlAnchors as ad, serializeSubtitles as ae, shiftSubtitles as af, stringifyIni as ag, toCsvString as ah, tomlToJson as ai, validateEnvKey as aj, validateIni as ak, validateNdjson as al, validateToml as am, validateXml as an, validateYaml as ao, xmlToJson as ap, type CsvDuplicateOptions as b, type CsvDuplicateResult as c, data as d, type CsvParseResult as e, type CsvToSqlOptions as f, type CsvToSqlResult as g, type EnvDiffResult as h, type EnvEntry as i, type EnvParseResult as j, type FrontMatterResult as k, type MarkdownTocOptions as l, type MarkdownTocResult as m, type NdjsonValidateResult as n, type ParsedIni as o, type ParsedSubtitles as p, type SubtitleFormat as q, type XmlToJsonOptions as r, type YamlAnchorResolveError as s, type YamlAnchorResolveResult as t, convertSubtitles as u, csvToJson as v, csvToSqlInsert as w, detectDelimiter as x, detectSubtitleFormat as y, diffEnvExample as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var yaml2 = require('js-yaml');
|
|
4
4
|
var crypto = require('crypto');
|
|
5
5
|
var md5 = require('blueimp-md5');
|
|
6
6
|
var bcrypt = require('bcryptjs');
|
|
@@ -28,7 +28,7 @@ function _interopNamespace(e) {
|
|
|
28
28
|
return Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var yaml2__namespace = /*#__PURE__*/_interopNamespace(yaml2);
|
|
32
32
|
var md5__default = /*#__PURE__*/_interopDefault(md5);
|
|
33
33
|
var bcrypt__default = /*#__PURE__*/_interopDefault(bcrypt);
|
|
34
34
|
var QRCode__default = /*#__PURE__*/_interopDefault(QRCode);
|
|
@@ -867,7 +867,7 @@ function yamlToJson(input, pretty = true) {
|
|
|
867
867
|
try {
|
|
868
868
|
const trimmed = input.trim();
|
|
869
869
|
if (trimmed === "") return JSON.stringify(null, null, pretty ? 2 : void 0);
|
|
870
|
-
const parsed =
|
|
870
|
+
const parsed = yaml2__namespace.load(trimmed);
|
|
871
871
|
const value = parsed === void 0 ? null : parsed;
|
|
872
872
|
return JSON.stringify(value, null, pretty ? 2 : void 0);
|
|
873
873
|
} catch (err) {
|
|
@@ -877,7 +877,7 @@ function yamlToJson(input, pretty = true) {
|
|
|
877
877
|
function jsonToYaml(input) {
|
|
878
878
|
try {
|
|
879
879
|
const parsed = JSON.parse(input);
|
|
880
|
-
return
|
|
880
|
+
return yaml2__namespace.dump(parsed);
|
|
881
881
|
} catch (err) {
|
|
882
882
|
return { error: err instanceof Error ? err.message : String(err) };
|
|
883
883
|
}
|
|
@@ -5186,6 +5186,7 @@ __export(data_exports, {
|
|
|
5186
5186
|
parseSubtitleTimestamp: () => parseSubtitleTimestamp,
|
|
5187
5187
|
parseSubtitles: () => parseSubtitles,
|
|
5188
5188
|
parseXmlToObject: () => parseXmlToObject,
|
|
5189
|
+
resolveYamlAnchors: () => resolveYamlAnchors,
|
|
5189
5190
|
serializeSubtitles: () => serializeSubtitles,
|
|
5190
5191
|
shiftSubtitles: () => shiftSubtitles,
|
|
5191
5192
|
stringifyIni: () => stringifyIni,
|
|
@@ -5205,7 +5206,7 @@ function validateYaml(input) {
|
|
|
5205
5206
|
}
|
|
5206
5207
|
try {
|
|
5207
5208
|
const docs = [];
|
|
5208
|
-
|
|
5209
|
+
yaml2__namespace.loadAll(input, (doc) => docs.push(doc));
|
|
5209
5210
|
const first = docs[0];
|
|
5210
5211
|
const keyCount = first && typeof first === "object" && first !== null ? Object.keys(first).length : 0;
|
|
5211
5212
|
return { valid: true, documentCount: docs.length, keyCount };
|
|
@@ -5239,7 +5240,7 @@ function _yamlCountKeys(value) {
|
|
|
5239
5240
|
function getYamlStats(input) {
|
|
5240
5241
|
if (!input.trim()) return { lines: 0, keys: 0, depth: 0 };
|
|
5241
5242
|
try {
|
|
5242
|
-
const doc =
|
|
5243
|
+
const doc = yaml2__namespace.load(input);
|
|
5243
5244
|
return {
|
|
5244
5245
|
lines: input.split("\n").length,
|
|
5245
5246
|
keys: _yamlCountKeys(doc),
|
|
@@ -6706,6 +6707,68 @@ function findCsvDuplicateRows(input, options) {
|
|
|
6706
6707
|
uniqueRowCount: parsed.rows.length - duplicateRowCount + duplicateGroups.length
|
|
6707
6708
|
};
|
|
6708
6709
|
}
|
|
6710
|
+
var _YAML_ANCHOR_RE = /(?:^|\s)&([A-Za-z0-9_.-]+)/g;
|
|
6711
|
+
var _YAML_ALIAS_RE = /(?:^|\s)\*([A-Za-z0-9_.-]+)/g;
|
|
6712
|
+
function _stripYamlLineComment(line) {
|
|
6713
|
+
let inSingle = false;
|
|
6714
|
+
let inDouble = false;
|
|
6715
|
+
for (let i = 0; i < line.length; i++) {
|
|
6716
|
+
const ch = line[i];
|
|
6717
|
+
if (ch === "'" && !inDouble) {
|
|
6718
|
+
inSingle = !inSingle;
|
|
6719
|
+
} else if (ch === '"' && !inSingle) {
|
|
6720
|
+
inDouble = !inDouble;
|
|
6721
|
+
} else if (ch === "#" && !inSingle && !inDouble && (i === 0 || /\s/.test(line[i - 1]))) {
|
|
6722
|
+
return line.slice(0, i);
|
|
6723
|
+
}
|
|
6724
|
+
}
|
|
6725
|
+
return line;
|
|
6726
|
+
}
|
|
6727
|
+
function resolveYamlAnchors(yamlText) {
|
|
6728
|
+
if (!yamlText || !yamlText.trim()) return { error: "Input is empty" };
|
|
6729
|
+
const anchorDefs = [];
|
|
6730
|
+
const referencedNames = /* @__PURE__ */ new Set();
|
|
6731
|
+
let aliasCount = 0;
|
|
6732
|
+
const lines = yamlText.split("\n");
|
|
6733
|
+
for (let i = 0; i < lines.length; i++) {
|
|
6734
|
+
const line = _stripYamlLineComment(lines[i]);
|
|
6735
|
+
const lineNum = i + 1;
|
|
6736
|
+
_YAML_ANCHOR_RE.lastIndex = 0;
|
|
6737
|
+
let m;
|
|
6738
|
+
while ((m = _YAML_ANCHOR_RE.exec(line)) !== null) {
|
|
6739
|
+
anchorDefs.push({ name: m[1], line: lineNum });
|
|
6740
|
+
}
|
|
6741
|
+
_YAML_ALIAS_RE.lastIndex = 0;
|
|
6742
|
+
while ((m = _YAML_ALIAS_RE.exec(line)) !== null) {
|
|
6743
|
+
referencedNames.add(m[1]);
|
|
6744
|
+
aliasCount++;
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
let parsed;
|
|
6748
|
+
try {
|
|
6749
|
+
parsed = yaml2__namespace.load(yamlText);
|
|
6750
|
+
} catch (e) {
|
|
6751
|
+
const err = e;
|
|
6752
|
+
return { error: err.reason ?? err.message };
|
|
6753
|
+
}
|
|
6754
|
+
let resolvedYaml;
|
|
6755
|
+
try {
|
|
6756
|
+
resolvedYaml = yaml2__namespace.dump(parsed, { noRefs: true, lineWidth: -1 });
|
|
6757
|
+
} catch (e) {
|
|
6758
|
+
return { error: e instanceof Error ? e.message : String(e) };
|
|
6759
|
+
}
|
|
6760
|
+
const anchors = anchorDefs.map((a) => ({
|
|
6761
|
+
name: a.name,
|
|
6762
|
+
line: a.line,
|
|
6763
|
+
referenced: referencedNames.has(a.name)
|
|
6764
|
+
}));
|
|
6765
|
+
const seenAnchorNames = [];
|
|
6766
|
+
for (const a of anchorDefs) {
|
|
6767
|
+
if (!seenAnchorNames.includes(a.name)) seenAnchorNames.push(a.name);
|
|
6768
|
+
}
|
|
6769
|
+
const unusedAnchors = seenAnchorNames.filter((name) => !referencedNames.has(name));
|
|
6770
|
+
return { resolvedYaml, anchors, unusedAnchors, aliasCount };
|
|
6771
|
+
}
|
|
6709
6772
|
|
|
6710
6773
|
// src/tools/generators.ts
|
|
6711
6774
|
var generators_exports = {};
|
|
@@ -10229,6 +10292,7 @@ __export(network_exports, {
|
|
|
10229
10292
|
parseVaryHeader: () => parseVaryHeader,
|
|
10230
10293
|
searchHeaders: () => searchHeaders,
|
|
10231
10294
|
searchStatusCodes: () => searchStatusCodes,
|
|
10295
|
+
splitSitemap: () => splitSitemap,
|
|
10232
10296
|
statusCodeToText: () => statusCodeToText,
|
|
10233
10297
|
typeNumberToLabel: () => typeNumberToLabel,
|
|
10234
10298
|
validateDomain: () => validateDomain,
|
|
@@ -11734,6 +11798,53 @@ function validateSitemap(xml) {
|
|
|
11734
11798
|
const valid = !issues.some((i) => i.severity === "error");
|
|
11735
11799
|
return { type, urlCount: entries.length, entries, issues, valid };
|
|
11736
11800
|
}
|
|
11801
|
+
var SITEMAP_SPLITTER_MAX_URLS_PER_FILE = 5e4;
|
|
11802
|
+
function escapeXmlUrl(url) {
|
|
11803
|
+
return url.replace(/&(?!amp;|lt;|gt;|apos;|quot;|#\d+;)/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
11804
|
+
}
|
|
11805
|
+
function splitSitemap(urlsText, options) {
|
|
11806
|
+
const urls = (urlsText ?? "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
11807
|
+
if (urls.length === 0) return { error: "No URLs provided" };
|
|
11808
|
+
for (let i = 0; i < urls.length; i++) {
|
|
11809
|
+
if (!/^https?:\/\//i.test(urls[i])) {
|
|
11810
|
+
return { error: `Line ${i + 1}: "${urls[i]}" is not an absolute URL starting with http:// or https://` };
|
|
11811
|
+
}
|
|
11812
|
+
}
|
|
11813
|
+
if (!options || !/^https?:\/\//i.test(options.baseUrl ?? "")) {
|
|
11814
|
+
return { error: "baseUrl must be an absolute URL starting with http:// or https://" };
|
|
11815
|
+
}
|
|
11816
|
+
const baseUrl = options.baseUrl.replace(/\/+$/, "") + "/";
|
|
11817
|
+
let urlsPerFile = options.urlsPerFile ?? SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
11818
|
+
if (urlsPerFile <= 0) urlsPerFile = SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
11819
|
+
if (urlsPerFile > SITEMAP_SPLITTER_MAX_URLS_PER_FILE) urlsPerFile = SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
11820
|
+
const filePrefix = (options.filePrefix || "sitemap").replace(/[^A-Za-z0-9_-]/g, "");
|
|
11821
|
+
const files = [];
|
|
11822
|
+
for (let i = 0; i < urls.length; i += urlsPerFile) {
|
|
11823
|
+
const chunk = urls.slice(i, i + urlsPerFile);
|
|
11824
|
+
const fileIndex = files.length + 1;
|
|
11825
|
+
const filename = `${filePrefix}-${fileIndex}.xml`;
|
|
11826
|
+
const urlLines = chunk.map((url) => ` <url>
|
|
11827
|
+
<loc>${escapeXmlUrl(url)}</loc>
|
|
11828
|
+
</url>`).join("\n");
|
|
11829
|
+
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
11830
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
11831
|
+
${urlLines}
|
|
11832
|
+
</urlset>
|
|
11833
|
+
`;
|
|
11834
|
+
files.push({ filename, urlCount: chunk.length, xml });
|
|
11835
|
+
}
|
|
11836
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
11837
|
+
const indexEntries = files.map((f) => ` <sitemap>
|
|
11838
|
+
<loc>${escapeXmlUrl(baseUrl + f.filename)}</loc>
|
|
11839
|
+
<lastmod>${today}</lastmod>
|
|
11840
|
+
</sitemap>`).join("\n");
|
|
11841
|
+
const indexXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
11842
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
11843
|
+
${indexEntries}
|
|
11844
|
+
</sitemapindex>
|
|
11845
|
+
`;
|
|
11846
|
+
return { files, indexXml, totalUrls: urls.length };
|
|
11847
|
+
}
|
|
11737
11848
|
var KNOWN_ROBOTS_DIRECTIVES = /* @__PURE__ */ new Set(["user-agent", "disallow", "allow", "sitemap", "crawl-delay", "host"]);
|
|
11738
11849
|
function validateRobotsTxt(text) {
|
|
11739
11850
|
if (!text || !text.trim()) return { error: "Input is empty" };
|
|
@@ -16293,7 +16404,7 @@ function parseSpec(input) {
|
|
|
16293
16404
|
raw = JSON.parse(input);
|
|
16294
16405
|
} catch {
|
|
16295
16406
|
try {
|
|
16296
|
-
raw =
|
|
16407
|
+
raw = yaml2.load(input);
|
|
16297
16408
|
} catch (e) {
|
|
16298
16409
|
return { error: `Failed to parse input as JSON or YAML: ${String(e)}` };
|
|
16299
16410
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,11 +2,11 @@ export { j as json } from './json-Ta9JykSB.cjs';
|
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.cjs';
|
|
4
4
|
export { t as text } from './text-DWUcY8H1.cjs';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-BJVJ879p.cjs';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
8
|
export { u as units } from './units-DU4Pisfx.cjs';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-DelcJeJa.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export { j as json } from './json-Ta9JykSB.js';
|
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CJjlvqS_.js';
|
|
4
4
|
export { t as text } from './text-DWUcY8H1.js';
|
|
5
|
-
export { d as data } from './data-
|
|
5
|
+
export { d as data } from './data-BJVJ879p.js';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
8
|
export { u as units } from './units-DU4Pisfx.js';
|
|
9
|
-
export { n as network } from './network-
|
|
9
|
+
export { n as network } from './network-DelcJeJa.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
11
|
export { c as code } from './code-KXoRsHtl.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-226EH3ZI.js';
|
|
2
2
|
export { units_exports as units } from './chunk-KMQHBUYO.js';
|
|
3
|
-
export { network_exports as network } from './chunk-
|
|
3
|
+
export { network_exports as network } from './chunk-Y7YY733Z.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
5
|
export { code_exports as code } from './chunk-JL7YTXRB.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
@@ -11,7 +11,7 @@ export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
|
|
13
13
|
export { text_exports as text } from './chunk-P7TXG7CI.js';
|
|
14
|
-
export { data_exports as data } from './chunk-
|
|
14
|
+
export { data_exports as data } from './chunk-4TIY6COQ.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-3TYWIX3B.js';
|
|
16
16
|
export { time_exports as time } from './chunk-IEPWZERQ.js';
|
|
17
17
|
import './chunk-MLKGABMK.js';
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* - http-headers : HTTP header reference lookup and validation
|
|
10
10
|
* - har-viewer : parseHar
|
|
11
11
|
* - sitemap-validator: validateSitemap
|
|
12
|
+
* - sitemap-index-splitter: splitSitemap
|
|
12
13
|
* - robots-txt-validator: validateRobotsTxt
|
|
13
14
|
* - user-agent-parser: parseUserAgent
|
|
14
15
|
* - cache-control-builder: buildCacheControl
|
|
@@ -201,6 +202,31 @@ interface SitemapValidationResult {
|
|
|
201
202
|
declare function validateSitemap(xml: string): SitemapValidationResult | {
|
|
202
203
|
error: string;
|
|
203
204
|
};
|
|
205
|
+
interface SitemapSplitFile {
|
|
206
|
+
filename: string;
|
|
207
|
+
urlCount: number;
|
|
208
|
+
xml: string;
|
|
209
|
+
}
|
|
210
|
+
interface SplitSitemapResult {
|
|
211
|
+
files: SitemapSplitFile[];
|
|
212
|
+
indexXml: string;
|
|
213
|
+
totalUrls: number;
|
|
214
|
+
}
|
|
215
|
+
interface SplitSitemapOptions {
|
|
216
|
+
baseUrl: string;
|
|
217
|
+
urlsPerFile?: number;
|
|
218
|
+
filePrefix?: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Split a newline-separated URL list exceeding the sitemaps.org 50,000-URL
|
|
222
|
+
* cap into multiple sitemap.xml files plus a sitemap index file. Validation
|
|
223
|
+
* of each URL line is reported 1-indexed against the list of non-empty
|
|
224
|
+
* lines (blank lines are dropped before counting/validating, so a blank
|
|
225
|
+
* line does not shift the reported line number of a later error).
|
|
226
|
+
*/
|
|
227
|
+
declare function splitSitemap(urlsText: string, options: SplitSitemapOptions): SplitSitemapResult | {
|
|
228
|
+
error: string;
|
|
229
|
+
};
|
|
204
230
|
interface RobotsRule {
|
|
205
231
|
type: 'allow' | 'disallow';
|
|
206
232
|
value: string;
|
|
@@ -739,8 +765,11 @@ declare const network_STATUS_CODES: typeof STATUS_CODES;
|
|
|
739
765
|
type network_SameSiteValue = SameSiteValue;
|
|
740
766
|
type network_SitemapIndexEntry = SitemapIndexEntry;
|
|
741
767
|
type network_SitemapIssue = SitemapIssue;
|
|
768
|
+
type network_SitemapSplitFile = SitemapSplitFile;
|
|
742
769
|
type network_SitemapUrlEntry = SitemapUrlEntry;
|
|
743
770
|
type network_SitemapValidationResult = SitemapValidationResult;
|
|
771
|
+
type network_SplitSitemapOptions = SplitSitemapOptions;
|
|
772
|
+
type network_SplitSitemapResult = SplitSitemapResult;
|
|
744
773
|
type network_StatusCode = StatusCode;
|
|
745
774
|
type network_UaDeviceType = UaDeviceType;
|
|
746
775
|
type network_UserAgentInfo = UserAgentInfo;
|
|
@@ -785,6 +814,7 @@ declare const network_parseUserAgent: typeof parseUserAgent;
|
|
|
785
814
|
declare const network_parseVaryHeader: typeof parseVaryHeader;
|
|
786
815
|
declare const network_searchHeaders: typeof searchHeaders;
|
|
787
816
|
declare const network_searchStatusCodes: typeof searchStatusCodes;
|
|
817
|
+
declare const network_splitSitemap: typeof splitSitemap;
|
|
788
818
|
declare const network_statusCodeToText: typeof statusCodeToText;
|
|
789
819
|
declare const network_typeNumberToLabel: typeof typeNumberToLabel;
|
|
790
820
|
declare const network_validateDomain: typeof validateDomain;
|
|
@@ -794,7 +824,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
794
824
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
795
825
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
796
826
|
declare namespace network {
|
|
797
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
827
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapSplitFile as SitemapSplitFile, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_SplitSitemapOptions as SplitSitemapOptions, type network_SplitSitemapResult as SplitSitemapResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_splitSitemap as splitSitemap, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
798
828
|
}
|
|
799
829
|
|
|
800
|
-
export { type ReferrerPolicyResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type LinkHeaderResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type LinkRel as J, type ManifestIssue as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ManifestValidationResult as N, type ParsedClientHint as O, PERMISSIONS_POLICY_FEATURES as P, type ParsedDnsResult as Q, type ParsedGeoResult as R, type PermissionsPolicyDirective as S, type PermissionsPolicyFeatureInput as T, type PermissionsPolicyResult as U, REFERRER_POLICY_VALUES as V, type RangeEntry as W, type RangeEntryInput as X, type RangeHeaderResult as Y, type ReceivedHop as Z, type ReferrerPolicyEntry as _, type CacheControlDirective as a, type ReferrerPolicyValue as a0, type RobotsGroup as a1, type RobotsIssue as a2, type RobotsRule as a3, type RobotsValidationResult as a4, STATUS_CODES as a5, type SameSiteValue as a6, type SitemapIndexEntry as a7, type SitemapIssue as a8, type
|
|
830
|
+
export { type ReferrerPolicyResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type LinkHeaderResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type LinkRel as J, type ManifestIssue as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ManifestValidationResult as N, type ParsedClientHint as O, PERMISSIONS_POLICY_FEATURES as P, type ParsedDnsResult as Q, type ParsedGeoResult as R, type PermissionsPolicyDirective as S, type PermissionsPolicyFeatureInput as T, type PermissionsPolicyResult as U, REFERRER_POLICY_VALUES as V, type RangeEntry as W, type RangeEntryInput as X, type RangeHeaderResult as Y, type ReceivedHop as Z, type ReferrerPolicyEntry as _, type CacheControlDirective as a, validateHeaderValue as a$, type ReferrerPolicyValue as a0, type RobotsGroup as a1, type RobotsIssue as a2, type RobotsRule as a3, type RobotsValidationResult as a4, STATUS_CODES as a5, type SameSiteValue as a6, type SitemapIndexEntry as a7, type SitemapIssue as a8, type SitemapSplitFile as a9, getHeader as aA, getHeadersByCategory as aB, getStatusByCategory as aC, getStatusCode as aD, isClientError as aE, isServerError as aF, isSuccess as aG, isValidIp as aH, isValidIpv4 as aI, isValidIpv6 as aJ, parseClientHintHeaders as aK, parseContentDisposition as aL, parseContentRangeHeader as aM, parseDnsResponse as aN, parseGeoResponse as aO, parseHar as aP, parseIpv6Address as aQ, parsePermissionsPolicy as aR, parseUserAgent as aS, parseVaryHeader as aT, searchHeaders as aU, searchStatusCodes as aV, splitSitemap as aW, statusCodeToText as aX, typeNumberToLabel as aY, validateDomain as aZ, validateHeaderName as a_, type SitemapUrlEntry as aa, type SitemapValidationResult as ab, type SplitSitemapOptions as ac, type SplitSitemapResult as ad, type StatusCode as ae, type UaDeviceType as af, type UserAgentInfo as ag, type VaryHeaderEntry as ah, type VaryHeaderResult as ai, analyzeEmailHeaders as aj, buildCacheControl as ak, buildClientHints as al, buildContentDisposition as am, buildDnsQueryUrl as an, buildGeoUrl as ao, buildLinkHeader as ap, buildMapUrl as aq, buildPermissionsPolicy as ar, buildRangeHeader as as, buildReferrerPolicy as at, buildVaryHeader as au, checkSetCookieHeader as av, countryCodeToFlag as aw, formatCoordinates as ax, formatTtl as ay, getByCategory as az, type CacheControlOptions as b, validateManifest as b0, validateRobotsTxt as b1, validateSitemap as b2, type CacheControlResult as c, type ClientHintDef as d, type ClientHintValueType as e, type ClientHintsBuildResult as f, type ClientHintsParseResult as g, type ContentDispositionBuildOptions as h, type ContentDispositionBuildResult as i, type ContentDispositionParseResult as j, type ContentRangeResult as k, type CookieAttributes as l, type CookieCheckResult as m, network as n, type DnsRecord as o, type DnsRecordType as p, type DnsResponse as q, type EmailHeaderField as r, type HarEntry as s, type HarParseResult as t, type HarSummary as u, type HeaderCategory as v, type HttpHeader as w, type Ipv6ParseResult as x, type LinkHeaderEntry as y, type LinkHeaderEntryInput as z };
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* - http-headers : HTTP header reference lookup and validation
|
|
10
10
|
* - har-viewer : parseHar
|
|
11
11
|
* - sitemap-validator: validateSitemap
|
|
12
|
+
* - sitemap-index-splitter: splitSitemap
|
|
12
13
|
* - robots-txt-validator: validateRobotsTxt
|
|
13
14
|
* - user-agent-parser: parseUserAgent
|
|
14
15
|
* - cache-control-builder: buildCacheControl
|
|
@@ -201,6 +202,31 @@ interface SitemapValidationResult {
|
|
|
201
202
|
declare function validateSitemap(xml: string): SitemapValidationResult | {
|
|
202
203
|
error: string;
|
|
203
204
|
};
|
|
205
|
+
interface SitemapSplitFile {
|
|
206
|
+
filename: string;
|
|
207
|
+
urlCount: number;
|
|
208
|
+
xml: string;
|
|
209
|
+
}
|
|
210
|
+
interface SplitSitemapResult {
|
|
211
|
+
files: SitemapSplitFile[];
|
|
212
|
+
indexXml: string;
|
|
213
|
+
totalUrls: number;
|
|
214
|
+
}
|
|
215
|
+
interface SplitSitemapOptions {
|
|
216
|
+
baseUrl: string;
|
|
217
|
+
urlsPerFile?: number;
|
|
218
|
+
filePrefix?: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Split a newline-separated URL list exceeding the sitemaps.org 50,000-URL
|
|
222
|
+
* cap into multiple sitemap.xml files plus a sitemap index file. Validation
|
|
223
|
+
* of each URL line is reported 1-indexed against the list of non-empty
|
|
224
|
+
* lines (blank lines are dropped before counting/validating, so a blank
|
|
225
|
+
* line does not shift the reported line number of a later error).
|
|
226
|
+
*/
|
|
227
|
+
declare function splitSitemap(urlsText: string, options: SplitSitemapOptions): SplitSitemapResult | {
|
|
228
|
+
error: string;
|
|
229
|
+
};
|
|
204
230
|
interface RobotsRule {
|
|
205
231
|
type: 'allow' | 'disallow';
|
|
206
232
|
value: string;
|
|
@@ -739,8 +765,11 @@ declare const network_STATUS_CODES: typeof STATUS_CODES;
|
|
|
739
765
|
type network_SameSiteValue = SameSiteValue;
|
|
740
766
|
type network_SitemapIndexEntry = SitemapIndexEntry;
|
|
741
767
|
type network_SitemapIssue = SitemapIssue;
|
|
768
|
+
type network_SitemapSplitFile = SitemapSplitFile;
|
|
742
769
|
type network_SitemapUrlEntry = SitemapUrlEntry;
|
|
743
770
|
type network_SitemapValidationResult = SitemapValidationResult;
|
|
771
|
+
type network_SplitSitemapOptions = SplitSitemapOptions;
|
|
772
|
+
type network_SplitSitemapResult = SplitSitemapResult;
|
|
744
773
|
type network_StatusCode = StatusCode;
|
|
745
774
|
type network_UaDeviceType = UaDeviceType;
|
|
746
775
|
type network_UserAgentInfo = UserAgentInfo;
|
|
@@ -785,6 +814,7 @@ declare const network_parseUserAgent: typeof parseUserAgent;
|
|
|
785
814
|
declare const network_parseVaryHeader: typeof parseVaryHeader;
|
|
786
815
|
declare const network_searchHeaders: typeof searchHeaders;
|
|
787
816
|
declare const network_searchStatusCodes: typeof searchStatusCodes;
|
|
817
|
+
declare const network_splitSitemap: typeof splitSitemap;
|
|
788
818
|
declare const network_statusCodeToText: typeof statusCodeToText;
|
|
789
819
|
declare const network_typeNumberToLabel: typeof typeNumberToLabel;
|
|
790
820
|
declare const network_validateDomain: typeof validateDomain;
|
|
@@ -794,7 +824,7 @@ declare const network_validateManifest: typeof validateManifest;
|
|
|
794
824
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
795
825
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
796
826
|
declare namespace network {
|
|
797
|
-
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
827
|
+
export { type network_AuthResultEntry as AuthResultEntry, type network_BuildRangeHeaderOptions as BuildRangeHeaderOptions, network_CLIENT_HINTS as CLIENT_HINTS, type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, type network_ClientHintDef as ClientHintDef, type network_ClientHintValueType as ClientHintValueType, type network_ClientHintsBuildResult as ClientHintsBuildResult, type network_ClientHintsParseResult as ClientHintsParseResult, type network_ContentDispositionBuildOptions as ContentDispositionBuildOptions, type network_ContentDispositionBuildResult as ContentDispositionBuildResult, type network_ContentDispositionParseResult as ContentDispositionParseResult, type network_ContentRangeResult as ContentRangeResult, type network_CookieAttributes as CookieAttributes, type network_CookieCheckResult as CookieCheckResult, network_DNS_RECORD_TYPES as DNS_RECORD_TYPES, type network_DnsRecord as DnsRecord, type network_DnsRecordType as DnsRecordType, type network_DnsResponse as DnsResponse, type network_EmailHeaderAnalysis as EmailHeaderAnalysis, type network_EmailHeaderField as EmailHeaderField, type network_GeoResult as GeoResult, network_HTTP_HEADERS as HTTP_HEADERS, type network_HarEntry as HarEntry, type network_HarParseResult as HarParseResult, type network_HarSummary as HarSummary, type network_HeaderCategory as HeaderCategory, type network_HttpHeader as HttpHeader, type network_Ipv6AddressType as Ipv6AddressType, type network_Ipv6ParseResult as Ipv6ParseResult, network_LINK_REL_VALUES as LINK_REL_VALUES, type network_LinkHeaderEntry as LinkHeaderEntry, type network_LinkHeaderEntryInput as LinkHeaderEntryInput, type network_LinkHeaderResult as LinkHeaderResult, type network_LinkRel as LinkRel, type network_ManifestIconInfo as ManifestIconInfo, type network_ManifestIssue as ManifestIssue, type network_ManifestValidationResult as ManifestValidationResult, network_PERMISSIONS_POLICY_FEATURES as PERMISSIONS_POLICY_FEATURES, type network_ParsedClientHint as ParsedClientHint, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, type network_PermissionsPolicyDirective as PermissionsPolicyDirective, type network_PermissionsPolicyFeatureInput as PermissionsPolicyFeatureInput, type network_PermissionsPolicyResult as PermissionsPolicyResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, type network_RangeEntry as RangeEntry, type network_RangeEntryInput as RangeEntryInput, type network_RangeHeaderResult as RangeHeaderResult, type network_ReceivedHop as ReceivedHop, type network_ReferrerPolicyEntry as ReferrerPolicyEntry, type network_ReferrerPolicyResult as ReferrerPolicyResult, type network_ReferrerPolicyValue as ReferrerPolicyValue, type network_RobotsGroup as RobotsGroup, type network_RobotsIssue as RobotsIssue, type network_RobotsRule as RobotsRule, type network_RobotsValidationResult as RobotsValidationResult, network_STATUS_CODES as STATUS_CODES, type network_SameSiteValue as SameSiteValue, type network_SitemapIndexEntry as SitemapIndexEntry, type network_SitemapIssue as SitemapIssue, type network_SitemapSplitFile as SitemapSplitFile, type network_SitemapUrlEntry as SitemapUrlEntry, type network_SitemapValidationResult as SitemapValidationResult, type network_SplitSitemapOptions as SplitSitemapOptions, type network_SplitSitemapResult as SplitSitemapResult, type network_StatusCode as StatusCode, type network_UaDeviceType as UaDeviceType, type network_UserAgentInfo as UserAgentInfo, type network_VaryHeaderEntry as VaryHeaderEntry, type network_VaryHeaderResult as VaryHeaderResult, network_analyzeEmailHeaders as analyzeEmailHeaders, network_buildCacheControl as buildCacheControl, network_buildClientHints as buildClientHints, network_buildContentDisposition as buildContentDisposition, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildPermissionsPolicy as buildPermissionsPolicy, network_buildRangeHeader as buildRangeHeader, network_buildReferrerPolicy as buildReferrerPolicy, network_buildVaryHeader as buildVaryHeader, network_checkSetCookieHeader as checkSetCookieHeader, network_countryCodeToFlag as countryCodeToFlag, network_formatCoordinates as formatCoordinates, network_formatTtl as formatTtl, network_getByCategory as getByCategory, network_getHeader as getHeader, network_getHeadersByCategory as getHeadersByCategory, network_getStatusByCategory as getStatusByCategory, network_getStatusCode as getStatusCode, network_isClientError as isClientError, network_isServerError as isServerError, network_isSuccess as isSuccess, network_isValidIp as isValidIp, network_isValidIpv4 as isValidIpv4, network_isValidIpv6 as isValidIpv6, network_parseClientHintHeaders as parseClientHintHeaders, network_parseContentDisposition as parseContentDisposition, network_parseContentRangeHeader as parseContentRangeHeader, network_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parsePermissionsPolicy as parsePermissionsPolicy, network_parseUserAgent as parseUserAgent, network_parseVaryHeader as parseVaryHeader, network_searchHeaders as searchHeaders, network_searchStatusCodes as searchStatusCodes, network_splitSitemap as splitSitemap, network_statusCodeToText as statusCodeToText, network_typeNumberToLabel as typeNumberToLabel, network_validateDomain as validateDomain, network_validateHeaderName as validateHeaderName, network_validateHeaderValue as validateHeaderValue, network_validateManifest as validateManifest, network_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
|
|
798
828
|
}
|
|
799
829
|
|
|
800
|
-
export { type ReferrerPolicyResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type LinkHeaderResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type LinkRel as J, type ManifestIssue as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ManifestValidationResult as N, type ParsedClientHint as O, PERMISSIONS_POLICY_FEATURES as P, type ParsedDnsResult as Q, type ParsedGeoResult as R, type PermissionsPolicyDirective as S, type PermissionsPolicyFeatureInput as T, type PermissionsPolicyResult as U, REFERRER_POLICY_VALUES as V, type RangeEntry as W, type RangeEntryInput as X, type RangeHeaderResult as Y, type ReceivedHop as Z, type ReferrerPolicyEntry as _, type CacheControlDirective as a, type ReferrerPolicyValue as a0, type RobotsGroup as a1, type RobotsIssue as a2, type RobotsRule as a3, type RobotsValidationResult as a4, STATUS_CODES as a5, type SameSiteValue as a6, type SitemapIndexEntry as a7, type SitemapIssue as a8, type
|
|
830
|
+
export { type ReferrerPolicyResult as $, type AuthResultEntry as A, type BuildRangeHeaderOptions as B, CLIENT_HINTS as C, DNS_RECORD_TYPES as D, type EmailHeaderAnalysis as E, type LinkHeaderResult as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, type LinkRel as J, type ManifestIssue as K, LINK_REL_VALUES as L, type ManifestIconInfo as M, type ManifestValidationResult as N, type ParsedClientHint as O, PERMISSIONS_POLICY_FEATURES as P, type ParsedDnsResult as Q, type ParsedGeoResult as R, type PermissionsPolicyDirective as S, type PermissionsPolicyFeatureInput as T, type PermissionsPolicyResult as U, REFERRER_POLICY_VALUES as V, type RangeEntry as W, type RangeEntryInput as X, type RangeHeaderResult as Y, type ReceivedHop as Z, type ReferrerPolicyEntry as _, type CacheControlDirective as a, validateHeaderValue as a$, type ReferrerPolicyValue as a0, type RobotsGroup as a1, type RobotsIssue as a2, type RobotsRule as a3, type RobotsValidationResult as a4, STATUS_CODES as a5, type SameSiteValue as a6, type SitemapIndexEntry as a7, type SitemapIssue as a8, type SitemapSplitFile as a9, getHeader as aA, getHeadersByCategory as aB, getStatusByCategory as aC, getStatusCode as aD, isClientError as aE, isServerError as aF, isSuccess as aG, isValidIp as aH, isValidIpv4 as aI, isValidIpv6 as aJ, parseClientHintHeaders as aK, parseContentDisposition as aL, parseContentRangeHeader as aM, parseDnsResponse as aN, parseGeoResponse as aO, parseHar as aP, parseIpv6Address as aQ, parsePermissionsPolicy as aR, parseUserAgent as aS, parseVaryHeader as aT, searchHeaders as aU, searchStatusCodes as aV, splitSitemap as aW, statusCodeToText as aX, typeNumberToLabel as aY, validateDomain as aZ, validateHeaderName as a_, type SitemapUrlEntry as aa, type SitemapValidationResult as ab, type SplitSitemapOptions as ac, type SplitSitemapResult as ad, type StatusCode as ae, type UaDeviceType as af, type UserAgentInfo as ag, type VaryHeaderEntry as ah, type VaryHeaderResult as ai, analyzeEmailHeaders as aj, buildCacheControl as ak, buildClientHints as al, buildContentDisposition as am, buildDnsQueryUrl as an, buildGeoUrl as ao, buildLinkHeader as ap, buildMapUrl as aq, buildPermissionsPolicy as ar, buildRangeHeader as as, buildReferrerPolicy as at, buildVaryHeader as au, checkSetCookieHeader as av, countryCodeToFlag as aw, formatCoordinates as ax, formatTtl as ay, getByCategory as az, type CacheControlOptions as b, validateManifest as b0, validateRobotsTxt as b1, validateSitemap as b2, type CacheControlResult as c, type ClientHintDef as d, type ClientHintValueType as e, type ClientHintsBuildResult as f, type ClientHintsParseResult as g, type ContentDispositionBuildOptions as h, type ContentDispositionBuildResult as i, type ContentDispositionParseResult as j, type ContentRangeResult as k, type CookieAttributes as l, type CookieCheckResult as m, network as n, type DnsRecord as o, type DnsRecordType as p, type DnsResponse as q, type EmailHeaderField as r, type HarEntry as s, type HarParseResult as t, type HarSummary as u, type HeaderCategory as v, type HttpHeader as w, type Ipv6ParseResult as x, type LinkHeaderEntry as y, type LinkHeaderEntryInput as z };
|
package/dist/tools/data.cjs
CHANGED
|
@@ -1531,6 +1531,68 @@ function findCsvDuplicateRows(input, options) {
|
|
|
1531
1531
|
uniqueRowCount: parsed.rows.length - duplicateRowCount + duplicateGroups.length
|
|
1532
1532
|
};
|
|
1533
1533
|
}
|
|
1534
|
+
var _YAML_ANCHOR_RE = /(?:^|\s)&([A-Za-z0-9_.-]+)/g;
|
|
1535
|
+
var _YAML_ALIAS_RE = /(?:^|\s)\*([A-Za-z0-9_.-]+)/g;
|
|
1536
|
+
function _stripYamlLineComment(line) {
|
|
1537
|
+
let inSingle = false;
|
|
1538
|
+
let inDouble = false;
|
|
1539
|
+
for (let i = 0; i < line.length; i++) {
|
|
1540
|
+
const ch = line[i];
|
|
1541
|
+
if (ch === "'" && !inDouble) {
|
|
1542
|
+
inSingle = !inSingle;
|
|
1543
|
+
} else if (ch === '"' && !inSingle) {
|
|
1544
|
+
inDouble = !inDouble;
|
|
1545
|
+
} else if (ch === "#" && !inSingle && !inDouble && (i === 0 || /\s/.test(line[i - 1]))) {
|
|
1546
|
+
return line.slice(0, i);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
return line;
|
|
1550
|
+
}
|
|
1551
|
+
function resolveYamlAnchors(yamlText) {
|
|
1552
|
+
if (!yamlText || !yamlText.trim()) return { error: "Input is empty" };
|
|
1553
|
+
const anchorDefs = [];
|
|
1554
|
+
const referencedNames = /* @__PURE__ */ new Set();
|
|
1555
|
+
let aliasCount = 0;
|
|
1556
|
+
const lines = yamlText.split("\n");
|
|
1557
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1558
|
+
const line = _stripYamlLineComment(lines[i]);
|
|
1559
|
+
const lineNum = i + 1;
|
|
1560
|
+
_YAML_ANCHOR_RE.lastIndex = 0;
|
|
1561
|
+
let m;
|
|
1562
|
+
while ((m = _YAML_ANCHOR_RE.exec(line)) !== null) {
|
|
1563
|
+
anchorDefs.push({ name: m[1], line: lineNum });
|
|
1564
|
+
}
|
|
1565
|
+
_YAML_ALIAS_RE.lastIndex = 0;
|
|
1566
|
+
while ((m = _YAML_ALIAS_RE.exec(line)) !== null) {
|
|
1567
|
+
referencedNames.add(m[1]);
|
|
1568
|
+
aliasCount++;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
let parsed;
|
|
1572
|
+
try {
|
|
1573
|
+
parsed = yaml__namespace.load(yamlText);
|
|
1574
|
+
} catch (e) {
|
|
1575
|
+
const err = e;
|
|
1576
|
+
return { error: err.reason ?? err.message };
|
|
1577
|
+
}
|
|
1578
|
+
let resolvedYaml;
|
|
1579
|
+
try {
|
|
1580
|
+
resolvedYaml = yaml__namespace.dump(parsed, { noRefs: true, lineWidth: -1 });
|
|
1581
|
+
} catch (e) {
|
|
1582
|
+
return { error: e instanceof Error ? e.message : String(e) };
|
|
1583
|
+
}
|
|
1584
|
+
const anchors = anchorDefs.map((a) => ({
|
|
1585
|
+
name: a.name,
|
|
1586
|
+
line: a.line,
|
|
1587
|
+
referenced: referencedNames.has(a.name)
|
|
1588
|
+
}));
|
|
1589
|
+
const seenAnchorNames = [];
|
|
1590
|
+
for (const a of anchorDefs) {
|
|
1591
|
+
if (!seenAnchorNames.includes(a.name)) seenAnchorNames.push(a.name);
|
|
1592
|
+
}
|
|
1593
|
+
const unusedAnchors = seenAnchorNames.filter((name) => !referencedNames.has(name));
|
|
1594
|
+
return { resolvedYaml, anchors, unusedAnchors, aliasCount };
|
|
1595
|
+
}
|
|
1534
1596
|
|
|
1535
1597
|
exports.convertSubtitles = convertSubtitles;
|
|
1536
1598
|
exports.csvToJson = csvToJson;
|
|
@@ -1567,6 +1629,7 @@ exports.parseIni = parseIni;
|
|
|
1567
1629
|
exports.parseSubtitleTimestamp = parseSubtitleTimestamp;
|
|
1568
1630
|
exports.parseSubtitles = parseSubtitles;
|
|
1569
1631
|
exports.parseXmlToObject = parseXmlToObject;
|
|
1632
|
+
exports.resolveYamlAnchors = resolveYamlAnchors;
|
|
1570
1633
|
exports.serializeSubtitles = serializeSubtitles;
|
|
1571
1634
|
exports.shiftSubtitles = shiftSubtitles;
|
|
1572
1635
|
exports.stringifyIni = stringifyIni;
|
package/dist/tools/data.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ConvertedSubtitles, a as CsvDuplicateGroup, b as CsvDuplicateOptions, c as CsvDuplicateResult, e as CsvParseResult, f as CsvToSqlOptions, g as CsvToSqlResult, E as EnvDiffError, h as EnvDiffResult, i as EnvEntry, j as EnvParseResult, F as FrontMatterError, k as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, l as MarkdownTocOptions, m as MarkdownTocResult, N as NdjsonLineResult, n as NdjsonValidateResult, P as ParseOptions, o as ParsedIni, p as ParsedSubtitles, S as SubtitleCue, q as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, r as XmlToJsonOptions, s as
|
|
1
|
+
export { C as ConvertedSubtitles, a as CsvDuplicateGroup, b as CsvDuplicateOptions, c as CsvDuplicateResult, e as CsvParseResult, f as CsvToSqlOptions, g as CsvToSqlResult, E as EnvDiffError, h as EnvDiffResult, i as EnvEntry, j as EnvParseResult, F as FrontMatterError, k as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, l as MarkdownTocOptions, m as MarkdownTocResult, N as NdjsonLineResult, n as NdjsonValidateResult, P as ParseOptions, o as ParsedIni, p as ParsedSubtitles, S as SubtitleCue, q as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, r as XmlToJsonOptions, Y as YamlAnchorInfo, s as YamlAnchorResolveError, t as YamlAnchorResolveResult, u as convertSubtitles, v as csvToJson, w as csvToSqlInsert, x as detectDelimiter, y as detectSubtitleFormat, z as diffEnvExample, A as envToExport, B as envToJson, D as findCsvDuplicateRows, G as formatNdjson, H as formatSubtitleTimestamp, J as formatToml, K as formatXml, L as generateMarkdownToc, O as getSection, Q as getSectionNames, R as getTomlStats, U as getXmlStats, W as getYamlStats, Z as iniToJson, _ as jsonArrayToNdjson, $ as jsonToIni, a0 as jsonToToml, a1 as jsonToXml, a2 as minifyNdjson, a3 as minifyToml, a4 as minifyXml, a5 as ndjsonToJsonArray, a6 as parseCsv, a7 as parseEnv, a8 as parseFrontMatter, a9 as parseIni, aa as parseSubtitleTimestamp, ab as parseSubtitles, ac as parseXmlToObject, ad as resolveYamlAnchors, ae as serializeSubtitles, af as shiftSubtitles, ag as stringifyIni, ah as toCsvString, ai as tomlToJson, aj as validateEnvKey, ak as validateIni, al as validateNdjson, am as validateToml, an as validateXml, ao as validateYaml, ap as xmlToJson } from '../data-BJVJ879p.cjs';
|
package/dist/tools/data.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ConvertedSubtitles, a as CsvDuplicateGroup, b as CsvDuplicateOptions, c as CsvDuplicateResult, e as CsvParseResult, f as CsvToSqlOptions, g as CsvToSqlResult, E as EnvDiffError, h as EnvDiffResult, i as EnvEntry, j as EnvParseResult, F as FrontMatterError, k as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, l as MarkdownTocOptions, m as MarkdownTocResult, N as NdjsonLineResult, n as NdjsonValidateResult, P as ParseOptions, o as ParsedIni, p as ParsedSubtitles, S as SubtitleCue, q as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, r as XmlToJsonOptions, s as
|
|
1
|
+
export { C as ConvertedSubtitles, a as CsvDuplicateGroup, b as CsvDuplicateOptions, c as CsvDuplicateResult, e as CsvParseResult, f as CsvToSqlOptions, g as CsvToSqlResult, E as EnvDiffError, h as EnvDiffResult, i as EnvEntry, j as EnvParseResult, F as FrontMatterError, k as FrontMatterResult, I as IniSection, M as MarkdownTocEntry, l as MarkdownTocOptions, m as MarkdownTocResult, N as NdjsonLineResult, n as NdjsonValidateResult, P as ParseOptions, o as ParsedIni, p as ParsedSubtitles, S as SubtitleCue, q as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, r as XmlToJsonOptions, Y as YamlAnchorInfo, s as YamlAnchorResolveError, t as YamlAnchorResolveResult, u as convertSubtitles, v as csvToJson, w as csvToSqlInsert, x as detectDelimiter, y as detectSubtitleFormat, z as diffEnvExample, A as envToExport, B as envToJson, D as findCsvDuplicateRows, G as formatNdjson, H as formatSubtitleTimestamp, J as formatToml, K as formatXml, L as generateMarkdownToc, O as getSection, Q as getSectionNames, R as getTomlStats, U as getXmlStats, W as getYamlStats, Z as iniToJson, _ as jsonArrayToNdjson, $ as jsonToIni, a0 as jsonToToml, a1 as jsonToXml, a2 as minifyNdjson, a3 as minifyToml, a4 as minifyXml, a5 as ndjsonToJsonArray, a6 as parseCsv, a7 as parseEnv, a8 as parseFrontMatter, a9 as parseIni, aa as parseSubtitleTimestamp, ab as parseSubtitles, ac as parseXmlToObject, ad as resolveYamlAnchors, ae as serializeSubtitles, af as shiftSubtitles, ag as stringifyIni, ah as toCsvString, ai as tomlToJson, aj as validateEnvKey, ak as validateIni, al as validateNdjson, am as validateToml, an as validateXml, ao as validateYaml, ap as xmlToJson } from '../data-BJVJ879p.js';
|
package/dist/tools/data.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertSubtitles, csvToJson, csvToSqlInsert, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-
|
|
1
|
+
export { convertSubtitles, csvToJson, csvToSqlInsert, detectDelimiter, detectSubtitleFormat, diffEnvExample, envToExport, envToJson, findCsvDuplicateRows, formatNdjson, formatSubtitleTimestamp, formatToml, formatXml, generateMarkdownToc, getSection, getSectionNames, getTomlStats, getXmlStats, getYamlStats, iniToJson, jsonArrayToNdjson, jsonToIni, jsonToToml, jsonToXml, minifyNdjson, minifyToml, minifyXml, ndjsonToJsonArray, parseCsv, parseEnv, parseFrontMatter, parseIni, parseSubtitleTimestamp, parseSubtitles, parseXmlToObject, resolveYamlAnchors, serializeSubtitles, shiftSubtitles, stringifyIni, toCsvString, tomlToJson, validateEnvKey, validateIni, validateNdjson, validateToml, validateXml, validateYaml, xmlToJson } from '../chunk-4TIY6COQ.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/network.cjs
CHANGED
|
@@ -1497,6 +1497,53 @@ function validateSitemap(xml) {
|
|
|
1497
1497
|
const valid = !issues.some((i) => i.severity === "error");
|
|
1498
1498
|
return { type, urlCount: entries.length, entries, issues, valid };
|
|
1499
1499
|
}
|
|
1500
|
+
var SITEMAP_SPLITTER_MAX_URLS_PER_FILE = 5e4;
|
|
1501
|
+
function escapeXmlUrl(url) {
|
|
1502
|
+
return url.replace(/&(?!amp;|lt;|gt;|apos;|quot;|#\d+;)/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1503
|
+
}
|
|
1504
|
+
function splitSitemap(urlsText, options) {
|
|
1505
|
+
const urls = (urlsText ?? "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
1506
|
+
if (urls.length === 0) return { error: "No URLs provided" };
|
|
1507
|
+
for (let i = 0; i < urls.length; i++) {
|
|
1508
|
+
if (!/^https?:\/\//i.test(urls[i])) {
|
|
1509
|
+
return { error: `Line ${i + 1}: "${urls[i]}" is not an absolute URL starting with http:// or https://` };
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
if (!options || !/^https?:\/\//i.test(options.baseUrl ?? "")) {
|
|
1513
|
+
return { error: "baseUrl must be an absolute URL starting with http:// or https://" };
|
|
1514
|
+
}
|
|
1515
|
+
const baseUrl = options.baseUrl.replace(/\/+$/, "") + "/";
|
|
1516
|
+
let urlsPerFile = options.urlsPerFile ?? SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
1517
|
+
if (urlsPerFile <= 0) urlsPerFile = SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
1518
|
+
if (urlsPerFile > SITEMAP_SPLITTER_MAX_URLS_PER_FILE) urlsPerFile = SITEMAP_SPLITTER_MAX_URLS_PER_FILE;
|
|
1519
|
+
const filePrefix = (options.filePrefix || "sitemap").replace(/[^A-Za-z0-9_-]/g, "");
|
|
1520
|
+
const files = [];
|
|
1521
|
+
for (let i = 0; i < urls.length; i += urlsPerFile) {
|
|
1522
|
+
const chunk = urls.slice(i, i + urlsPerFile);
|
|
1523
|
+
const fileIndex = files.length + 1;
|
|
1524
|
+
const filename = `${filePrefix}-${fileIndex}.xml`;
|
|
1525
|
+
const urlLines = chunk.map((url) => ` <url>
|
|
1526
|
+
<loc>${escapeXmlUrl(url)}</loc>
|
|
1527
|
+
</url>`).join("\n");
|
|
1528
|
+
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1529
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
1530
|
+
${urlLines}
|
|
1531
|
+
</urlset>
|
|
1532
|
+
`;
|
|
1533
|
+
files.push({ filename, urlCount: chunk.length, xml });
|
|
1534
|
+
}
|
|
1535
|
+
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
1536
|
+
const indexEntries = files.map((f) => ` <sitemap>
|
|
1537
|
+
<loc>${escapeXmlUrl(baseUrl + f.filename)}</loc>
|
|
1538
|
+
<lastmod>${today}</lastmod>
|
|
1539
|
+
</sitemap>`).join("\n");
|
|
1540
|
+
const indexXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1541
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
1542
|
+
${indexEntries}
|
|
1543
|
+
</sitemapindex>
|
|
1544
|
+
`;
|
|
1545
|
+
return { files, indexXml, totalUrls: urls.length };
|
|
1546
|
+
}
|
|
1500
1547
|
var KNOWN_ROBOTS_DIRECTIVES = /* @__PURE__ */ new Set(["user-agent", "disallow", "allow", "sitemap", "crawl-delay", "host"]);
|
|
1501
1548
|
function validateRobotsTxt(text) {
|
|
1502
1549
|
if (!text || !text.trim()) return { error: "Input is empty" };
|
|
@@ -2717,6 +2764,7 @@ exports.parseUserAgent = parseUserAgent;
|
|
|
2717
2764
|
exports.parseVaryHeader = parseVaryHeader;
|
|
2718
2765
|
exports.searchHeaders = searchHeaders;
|
|
2719
2766
|
exports.searchStatusCodes = searchStatusCodes;
|
|
2767
|
+
exports.splitSitemap = splitSitemap;
|
|
2720
2768
|
exports.statusCodeToText = statusCodeToText;
|
|
2721
2769
|
exports.typeNumberToLabel = typeNumberToLabel;
|
|
2722
2770
|
exports.validateDomain = validateDomain;
|
package/dist/tools/network.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as ContentDispositionBuildOptions, i as ContentDispositionBuildResult, j as ContentDispositionParseResult, k as ContentRangeResult, l as CookieAttributes, m as CookieCheckResult, D as DNS_RECORD_TYPES, o as DnsRecord, p as DnsRecordType, q as DnsResponse, E as EmailHeaderAnalysis, r as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, s as HarEntry, t as HarParseResult, u as HarSummary, v as HeaderCategory, w as HttpHeader, I as Ipv6AddressType, x as Ipv6ParseResult, L as LINK_REL_VALUES, y as LinkHeaderEntry, z as LinkHeaderEntryInput, F as LinkHeaderResult, J as LinkRel, M as ManifestIconInfo, K as ManifestIssue, N as ManifestValidationResult, P as PERMISSIONS_POLICY_FEATURES, O as ParsedClientHint, Q as ParsedDnsResult, R as ParsedGeoResult, S as PermissionsPolicyDirective, T as PermissionsPolicyFeatureInput, U as PermissionsPolicyResult, V as REFERRER_POLICY_VALUES, W as RangeEntry, X as RangeEntryInput, Y as RangeHeaderResult, Z as ReceivedHop, _ as ReferrerPolicyEntry, $ as ReferrerPolicyResult, a0 as ReferrerPolicyValue, a1 as RobotsGroup, a2 as RobotsIssue, a3 as RobotsRule, a4 as RobotsValidationResult, a5 as STATUS_CODES, a6 as SameSiteValue, a7 as SitemapIndexEntry, a8 as SitemapIssue, a9 as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as ContentDispositionBuildOptions, i as ContentDispositionBuildResult, j as ContentDispositionParseResult, k as ContentRangeResult, l as CookieAttributes, m as CookieCheckResult, D as DNS_RECORD_TYPES, o as DnsRecord, p as DnsRecordType, q as DnsResponse, E as EmailHeaderAnalysis, r as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, s as HarEntry, t as HarParseResult, u as HarSummary, v as HeaderCategory, w as HttpHeader, I as Ipv6AddressType, x as Ipv6ParseResult, L as LINK_REL_VALUES, y as LinkHeaderEntry, z as LinkHeaderEntryInput, F as LinkHeaderResult, J as LinkRel, M as ManifestIconInfo, K as ManifestIssue, N as ManifestValidationResult, P as PERMISSIONS_POLICY_FEATURES, O as ParsedClientHint, Q as ParsedDnsResult, R as ParsedGeoResult, S as PermissionsPolicyDirective, T as PermissionsPolicyFeatureInput, U as PermissionsPolicyResult, V as REFERRER_POLICY_VALUES, W as RangeEntry, X as RangeEntryInput, Y as RangeHeaderResult, Z as ReceivedHop, _ as ReferrerPolicyEntry, $ as ReferrerPolicyResult, a0 as ReferrerPolicyValue, a1 as RobotsGroup, a2 as RobotsIssue, a3 as RobotsRule, a4 as RobotsValidationResult, a5 as STATUS_CODES, a6 as SameSiteValue, a7 as SitemapIndexEntry, a8 as SitemapIssue, a9 as SitemapSplitFile, aa as SitemapUrlEntry, ab as SitemapValidationResult, ac as SplitSitemapOptions, ad as SplitSitemapResult, ae as StatusCode, af as UaDeviceType, ag as UserAgentInfo, ah as VaryHeaderEntry, ai as VaryHeaderResult, aj as analyzeEmailHeaders, ak as buildCacheControl, al as buildClientHints, am as buildContentDisposition, an as buildDnsQueryUrl, ao as buildGeoUrl, ap as buildLinkHeader, aq as buildMapUrl, ar as buildPermissionsPolicy, as as buildRangeHeader, at as buildReferrerPolicy, au as buildVaryHeader, av as checkSetCookieHeader, aw as countryCodeToFlag, ax as formatCoordinates, ay as formatTtl, az as getByCategory, aA as getHeader, aB as getHeadersByCategory, aC as getStatusByCategory, aD as getStatusCode, aE as isClientError, aF as isServerError, aG as isSuccess, aH as isValidIp, aI as isValidIpv4, aJ as isValidIpv6, aK as parseClientHintHeaders, aL as parseContentDisposition, aM as parseContentRangeHeader, aN as parseDnsResponse, aO as parseGeoResponse, aP as parseHar, aQ as parseIpv6Address, aR as parsePermissionsPolicy, aS as parseUserAgent, aT as parseVaryHeader, aU as searchHeaders, aV as searchStatusCodes, aW as splitSitemap, aX as statusCodeToText, aY as typeNumberToLabel, aZ as validateDomain, a_ as validateHeaderName, a$ as validateHeaderValue, b0 as validateManifest, b1 as validateRobotsTxt, b2 as validateSitemap } from '../network-DelcJeJa.cjs';
|
package/dist/tools/network.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as ContentDispositionBuildOptions, i as ContentDispositionBuildResult, j as ContentDispositionParseResult, k as ContentRangeResult, l as CookieAttributes, m as CookieCheckResult, D as DNS_RECORD_TYPES, o as DnsRecord, p as DnsRecordType, q as DnsResponse, E as EmailHeaderAnalysis, r as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, s as HarEntry, t as HarParseResult, u as HarSummary, v as HeaderCategory, w as HttpHeader, I as Ipv6AddressType, x as Ipv6ParseResult, L as LINK_REL_VALUES, y as LinkHeaderEntry, z as LinkHeaderEntryInput, F as LinkHeaderResult, J as LinkRel, M as ManifestIconInfo, K as ManifestIssue, N as ManifestValidationResult, P as PERMISSIONS_POLICY_FEATURES, O as ParsedClientHint, Q as ParsedDnsResult, R as ParsedGeoResult, S as PermissionsPolicyDirective, T as PermissionsPolicyFeatureInput, U as PermissionsPolicyResult, V as REFERRER_POLICY_VALUES, W as RangeEntry, X as RangeEntryInput, Y as RangeHeaderResult, Z as ReceivedHop, _ as ReferrerPolicyEntry, $ as ReferrerPolicyResult, a0 as ReferrerPolicyValue, a1 as RobotsGroup, a2 as RobotsIssue, a3 as RobotsRule, a4 as RobotsValidationResult, a5 as STATUS_CODES, a6 as SameSiteValue, a7 as SitemapIndexEntry, a8 as SitemapIssue, a9 as
|
|
1
|
+
export { A as AuthResultEntry, B as BuildRangeHeaderOptions, C as CLIENT_HINTS, a as CacheControlDirective, b as CacheControlOptions, c as CacheControlResult, d as ClientHintDef, e as ClientHintValueType, f as ClientHintsBuildResult, g as ClientHintsParseResult, h as ContentDispositionBuildOptions, i as ContentDispositionBuildResult, j as ContentDispositionParseResult, k as ContentRangeResult, l as CookieAttributes, m as CookieCheckResult, D as DNS_RECORD_TYPES, o as DnsRecord, p as DnsRecordType, q as DnsResponse, E as EmailHeaderAnalysis, r as EmailHeaderField, G as GeoResult, H as HTTP_HEADERS, s as HarEntry, t as HarParseResult, u as HarSummary, v as HeaderCategory, w as HttpHeader, I as Ipv6AddressType, x as Ipv6ParseResult, L as LINK_REL_VALUES, y as LinkHeaderEntry, z as LinkHeaderEntryInput, F as LinkHeaderResult, J as LinkRel, M as ManifestIconInfo, K as ManifestIssue, N as ManifestValidationResult, P as PERMISSIONS_POLICY_FEATURES, O as ParsedClientHint, Q as ParsedDnsResult, R as ParsedGeoResult, S as PermissionsPolicyDirective, T as PermissionsPolicyFeatureInput, U as PermissionsPolicyResult, V as REFERRER_POLICY_VALUES, W as RangeEntry, X as RangeEntryInput, Y as RangeHeaderResult, Z as ReceivedHop, _ as ReferrerPolicyEntry, $ as ReferrerPolicyResult, a0 as ReferrerPolicyValue, a1 as RobotsGroup, a2 as RobotsIssue, a3 as RobotsRule, a4 as RobotsValidationResult, a5 as STATUS_CODES, a6 as SameSiteValue, a7 as SitemapIndexEntry, a8 as SitemapIssue, a9 as SitemapSplitFile, aa as SitemapUrlEntry, ab as SitemapValidationResult, ac as SplitSitemapOptions, ad as SplitSitemapResult, ae as StatusCode, af as UaDeviceType, ag as UserAgentInfo, ah as VaryHeaderEntry, ai as VaryHeaderResult, aj as analyzeEmailHeaders, ak as buildCacheControl, al as buildClientHints, am as buildContentDisposition, an as buildDnsQueryUrl, ao as buildGeoUrl, ap as buildLinkHeader, aq as buildMapUrl, ar as buildPermissionsPolicy, as as buildRangeHeader, at as buildReferrerPolicy, au as buildVaryHeader, av as checkSetCookieHeader, aw as countryCodeToFlag, ax as formatCoordinates, ay as formatTtl, az as getByCategory, aA as getHeader, aB as getHeadersByCategory, aC as getStatusByCategory, aD as getStatusCode, aE as isClientError, aF as isServerError, aG as isSuccess, aH as isValidIp, aI as isValidIpv4, aJ as isValidIpv6, aK as parseClientHintHeaders, aL as parseContentDisposition, aM as parseContentRangeHeader, aN as parseDnsResponse, aO as parseGeoResponse, aP as parseHar, aQ as parseIpv6Address, aR as parsePermissionsPolicy, aS as parseUserAgent, aT as parseVaryHeader, aU as searchHeaders, aV as searchStatusCodes, aW as splitSitemap, aX as statusCodeToText, aY as typeNumberToLabel, aZ as validateDomain, a_ as validateHeaderName, a$ as validateHeaderValue, b0 as validateManifest, b1 as validateRobotsTxt, b2 as validateSitemap } from '../network-DelcJeJa.js';
|
package/dist/tools/network.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-
|
|
1
|
+
export { CLIENT_HINTS, DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, PERMISSIONS_POLICY_FEATURES, REFERRER_POLICY_VALUES, STATUS_CODES, analyzeEmailHeaders, buildCacheControl, buildClientHints, buildContentDisposition, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildPermissionsPolicy, buildRangeHeader, buildReferrerPolicy, buildVaryHeader, checkSetCookieHeader, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseClientHintHeaders, parseContentDisposition, parseContentRangeHeader, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parsePermissionsPolicy, parseUserAgent, parseVaryHeader, searchHeaders, searchStatusCodes, splitSitemap, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateManifest, validateRobotsTxt, validateSitemap } from '../chunk-Y7YY733Z.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|