@utilix-tech/sdk 0.35.0 → 0.36.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 CHANGED
@@ -2,6 +2,9 @@
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.36.0
6
+ - Add `buildLinkHeader` (link-header-builder): build an HTTP Link response header from URL/rel pairs (preload, preconnect, prefetch, canonical, pagination, etc.), including the as/type/crossorigin attributes preload needs, plus a plain-English explanation of each entry and warnings for common mistakes like a preload missing `as`.
7
+
5
8
  ## 0.35.0
6
9
  - Add `calculateRoi` (roi-calculator): return on investment percent from an initial and final value, plus the annualized (CAGR) return given an optional holding period in years.
7
10
  - Add `searchEmoji`, `getEmojiByShortcode`, `getEmojiByChar`, `getEmojiByCategory`, `getEmojiCategories` (emoji-lookup): search a curated table of ~280 common emoji by name, keyword, or GitHub-style shortcode, or look one up exactly.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/sdk
2
2
 
3
- **600 developer utility functions for Node.js: runs locally, no API key required.**
3
+ **602 developer utility functions for Node.js: runs locally, no API key required.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@utilix-tech/sdk?style=flat-square&color=cb3837)](https://www.npmjs.com/package/@utilix-tech/sdk)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@utilix-tech/sdk?style=flat-square)](https://www.npmjs.com/package/@utilix-tech/sdk)
@@ -404,7 +404,7 @@ calculateRoi({ initialValue: 1000, finalValue: 1610.51, years: 5 });
404
404
  import { getStatusCode, isValidIp, isValidIpv4, isValidIpv6,
405
405
  searchStatusCodes, buildGeoUrl, countryCodeToFlag,
406
406
  parseHar, validateSitemap, validateRobotsTxt,
407
- parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address } from "@utilix-tech/sdk/network";
407
+ parseUserAgent, buildCacheControl, buildReferrerPolicy, parseIpv6Address, buildLinkHeader } from "@utilix-tech/sdk/network";
408
408
 
409
409
  getStatusCode(404);
410
410
  // { code: 404, text: "Not Found", description: "...", category: "Client Error" }
@@ -447,6 +447,10 @@ buildReferrerPolicy("strict-origin-when-cross-origin");
447
447
  parseIpv6Address("2001:db8::ff00:42:8329");
448
448
  // { expanded: "2001:0db8:0000:0000:0000:ff00:0042:8329", compressed: "2001:db8::ff00:42:8329",
449
449
  // groups: [...], zoneId: null, addressType: "documentation" }
450
+
451
+ // Build an HTTP Link header from URL/rel pairs (preload, preconnect, canonical, pagination, etc.)
452
+ buildLinkHeader([{ url: "/fonts/inter.woff2", rel: "preload", as: "font", type: "font/woff2", crossorigin: true }]);
453
+ // { header: '</fonts/inter.woff2>; rel="preload"; as="font"; type="font/woff2"; crossorigin', links: [...], warnings: [] }
450
454
  ```
451
455
 
452
456
  ---
@@ -5,11 +5,13 @@ var network_exports = {};
5
5
  __export(network_exports, {
6
6
  DNS_RECORD_TYPES: () => DNS_RECORD_TYPES,
7
7
  HTTP_HEADERS: () => HTTP_HEADERS,
8
+ LINK_REL_VALUES: () => LINK_REL_VALUES,
8
9
  REFERRER_POLICY_VALUES: () => REFERRER_POLICY_VALUES,
9
10
  STATUS_CODES: () => STATUS_CODES,
10
11
  buildCacheControl: () => buildCacheControl,
11
12
  buildDnsQueryUrl: () => buildDnsQueryUrl,
12
13
  buildGeoUrl: () => buildGeoUrl,
14
+ buildLinkHeader: () => buildLinkHeader,
13
15
  buildMapUrl: () => buildMapUrl,
14
16
  buildReferrerPolicy: () => buildReferrerPolicy,
15
17
  countryCodeToFlag: () => countryCodeToFlag,
@@ -1895,6 +1897,73 @@ function buildReferrerPolicy(policies) {
1895
1897
  const metaTag = `<meta name="referrer" content="${last.value}">`;
1896
1898
  return { header, headerName: "Referrer-Policy", snippet, metaTag, policies: entries, warnings };
1897
1899
  }
1900
+ var LINK_REL_VALUES = [
1901
+ "preload",
1902
+ "preconnect",
1903
+ "prefetch",
1904
+ "prerender",
1905
+ "dns-prefetch",
1906
+ "canonical",
1907
+ "next",
1908
+ "prev",
1909
+ "alternate",
1910
+ "stylesheet",
1911
+ "icon",
1912
+ "modulepreload"
1913
+ ];
1914
+ var _LINK_REL_INFO = {
1915
+ preload: "Tells the browser to fetch this resource early, before the parser would otherwise discover it, without blocking rendering. Requires an `as` attribute so the browser applies the right request priority and Content-Security-Policy check; omitting it commonly causes the resource to be fetched twice.",
1916
+ preconnect: "Tells the browser to start the connection handshake (DNS, TCP, TLS) to this origin early, before any real request to it is made, so the first actual request lands faster.",
1917
+ prefetch: "Tells the browser to fetch this resource at low priority for a likely future navigation and cache it. Unlike preload, it does not affect the current page load.",
1918
+ prerender: "Tells the browser to fetch and render this page in the background so navigating to it feels instant, at a real bandwidth and CPU cost if the user never navigates there.",
1919
+ "dns-prefetch": "Tells the browser to resolve this origin's DNS early, a lighter-weight version of preconnect that skips the TCP/TLS handshake.",
1920
+ canonical: "Tells search engines which URL is the authoritative version of this page, used to consolidate duplicate-content signals across query-string or protocol variants.",
1921
+ next: "Marks the next page in a paginated sequence, a hint search engines and some browsers use for pagination.",
1922
+ prev: "Marks the previous page in a paginated sequence.",
1923
+ alternate: "Points to an alternate version of this resource, such as a different language or an RSS feed.",
1924
+ stylesheet: 'Loads an external stylesheet, the same effect as a `<link rel="stylesheet">` tag but delivered as a response header instead.',
1925
+ icon: 'Points to this resource\'s favicon, the same effect as a `<link rel="icon">` tag but delivered as a response header instead.',
1926
+ modulepreload: "Tells the browser to fetch and parse this JavaScript module early, ahead of when the module graph would otherwise discover it."
1927
+ };
1928
+ function buildLinkHeader(links) {
1929
+ if (!Array.isArray(links) || links.length === 0) {
1930
+ return { error: "At least one link entry is required" };
1931
+ }
1932
+ const entries = [];
1933
+ for (const link of links) {
1934
+ const url = typeof link.url === "string" ? link.url.trim() : "";
1935
+ const rel = typeof link.rel === "string" ? link.rel.trim() : "";
1936
+ if (!url) return { error: "Each link entry requires a non-empty url" };
1937
+ if (!rel) return { error: "Each link entry requires a non-empty rel" };
1938
+ if (!LINK_REL_VALUES.includes(rel)) {
1939
+ return { error: `'${rel}' is not a supported rel value. Supported values: ${LINK_REL_VALUES.join(", ")}` };
1940
+ }
1941
+ const as = link.as?.trim() || void 0;
1942
+ const type = link.type?.trim() || void 0;
1943
+ const crossorigin = link.crossorigin === true;
1944
+ let value = `<${url}>; rel="${rel}"`;
1945
+ if (as) value += `; as="${as}"`;
1946
+ if (type) value += `; type="${type}"`;
1947
+ if (crossorigin) value += "; crossorigin";
1948
+ entries.push({ url, rel, as, type, crossorigin: crossorigin || void 0, value, explanation: _LINK_REL_INFO[rel] });
1949
+ }
1950
+ const warnings = [];
1951
+ for (const entry of entries) {
1952
+ if (entry.rel === "preload" && !entry.as) {
1953
+ warnings.push(`preload link for "${entry.url}" is missing an \`as\` attribute \u2014 the browser may fetch it twice or apply the wrong request priority.`);
1954
+ }
1955
+ if ((entry.rel === "preconnect" || entry.rel === "dns-prefetch") && (entry.as || entry.type)) {
1956
+ warnings.push(`${entry.rel} link for "${entry.url}" sets \`as\`/\`type\`, which it ignores since no specific resource is being fetched yet.`);
1957
+ }
1958
+ }
1959
+ const canonicalCount = entries.filter((e) => e.rel === "canonical").length;
1960
+ if (canonicalCount > 1) {
1961
+ warnings.push(`${canonicalCount} canonical links present \u2014 only one canonical URL should be declared per page.`);
1962
+ }
1963
+ const header = entries.map((e) => e.value).join(", ");
1964
+ const snippet = `Link: ${header}`;
1965
+ return { header, headerName: "Link", snippet, links: entries, warnings };
1966
+ }
1898
1967
  function isValidIpv6HexGroup(g) {
1899
1968
  return /^[0-9a-fA-F]{1,4}$/.test(g);
1900
1969
  }
@@ -1984,4 +2053,4 @@ function parseIpv6Address(input) {
1984
2053
  };
1985
2054
  }
1986
2055
 
1987
- export { DNS_RECORD_TYPES, HTTP_HEADERS, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, buildReferrerPolicy, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
2056
+ export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildReferrerPolicy, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, network_exports, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap };
package/dist/index.cjs CHANGED
@@ -9676,11 +9676,13 @@ var network_exports = {};
9676
9676
  __export(network_exports, {
9677
9677
  DNS_RECORD_TYPES: () => DNS_RECORD_TYPES,
9678
9678
  HTTP_HEADERS: () => HTTP_HEADERS,
9679
+ LINK_REL_VALUES: () => LINK_REL_VALUES,
9679
9680
  REFERRER_POLICY_VALUES: () => REFERRER_POLICY_VALUES,
9680
9681
  STATUS_CODES: () => STATUS_CODES,
9681
9682
  buildCacheControl: () => buildCacheControl,
9682
9683
  buildDnsQueryUrl: () => buildDnsQueryUrl,
9683
9684
  buildGeoUrl: () => buildGeoUrl,
9685
+ buildLinkHeader: () => buildLinkHeader,
9684
9686
  buildMapUrl: () => buildMapUrl,
9685
9687
  buildReferrerPolicy: () => buildReferrerPolicy,
9686
9688
  countryCodeToFlag: () => countryCodeToFlag,
@@ -11566,6 +11568,73 @@ function buildReferrerPolicy(policies) {
11566
11568
  const metaTag = `<meta name="referrer" content="${last.value}">`;
11567
11569
  return { header, headerName: "Referrer-Policy", snippet, metaTag, policies: entries, warnings };
11568
11570
  }
11571
+ var LINK_REL_VALUES = [
11572
+ "preload",
11573
+ "preconnect",
11574
+ "prefetch",
11575
+ "prerender",
11576
+ "dns-prefetch",
11577
+ "canonical",
11578
+ "next",
11579
+ "prev",
11580
+ "alternate",
11581
+ "stylesheet",
11582
+ "icon",
11583
+ "modulepreload"
11584
+ ];
11585
+ var _LINK_REL_INFO = {
11586
+ preload: "Tells the browser to fetch this resource early, before the parser would otherwise discover it, without blocking rendering. Requires an `as` attribute so the browser applies the right request priority and Content-Security-Policy check; omitting it commonly causes the resource to be fetched twice.",
11587
+ preconnect: "Tells the browser to start the connection handshake (DNS, TCP, TLS) to this origin early, before any real request to it is made, so the first actual request lands faster.",
11588
+ prefetch: "Tells the browser to fetch this resource at low priority for a likely future navigation and cache it. Unlike preload, it does not affect the current page load.",
11589
+ prerender: "Tells the browser to fetch and render this page in the background so navigating to it feels instant, at a real bandwidth and CPU cost if the user never navigates there.",
11590
+ "dns-prefetch": "Tells the browser to resolve this origin's DNS early, a lighter-weight version of preconnect that skips the TCP/TLS handshake.",
11591
+ canonical: "Tells search engines which URL is the authoritative version of this page, used to consolidate duplicate-content signals across query-string or protocol variants.",
11592
+ next: "Marks the next page in a paginated sequence, a hint search engines and some browsers use for pagination.",
11593
+ prev: "Marks the previous page in a paginated sequence.",
11594
+ alternate: "Points to an alternate version of this resource, such as a different language or an RSS feed.",
11595
+ stylesheet: 'Loads an external stylesheet, the same effect as a `<link rel="stylesheet">` tag but delivered as a response header instead.',
11596
+ icon: 'Points to this resource\'s favicon, the same effect as a `<link rel="icon">` tag but delivered as a response header instead.',
11597
+ modulepreload: "Tells the browser to fetch and parse this JavaScript module early, ahead of when the module graph would otherwise discover it."
11598
+ };
11599
+ function buildLinkHeader(links) {
11600
+ if (!Array.isArray(links) || links.length === 0) {
11601
+ return { error: "At least one link entry is required" };
11602
+ }
11603
+ const entries = [];
11604
+ for (const link of links) {
11605
+ const url = typeof link.url === "string" ? link.url.trim() : "";
11606
+ const rel = typeof link.rel === "string" ? link.rel.trim() : "";
11607
+ if (!url) return { error: "Each link entry requires a non-empty url" };
11608
+ if (!rel) return { error: "Each link entry requires a non-empty rel" };
11609
+ if (!LINK_REL_VALUES.includes(rel)) {
11610
+ return { error: `'${rel}' is not a supported rel value. Supported values: ${LINK_REL_VALUES.join(", ")}` };
11611
+ }
11612
+ const as = link.as?.trim() || void 0;
11613
+ const type = link.type?.trim() || void 0;
11614
+ const crossorigin = link.crossorigin === true;
11615
+ let value = `<${url}>; rel="${rel}"`;
11616
+ if (as) value += `; as="${as}"`;
11617
+ if (type) value += `; type="${type}"`;
11618
+ if (crossorigin) value += "; crossorigin";
11619
+ entries.push({ url, rel, as, type, crossorigin: crossorigin || void 0, value, explanation: _LINK_REL_INFO[rel] });
11620
+ }
11621
+ const warnings = [];
11622
+ for (const entry of entries) {
11623
+ if (entry.rel === "preload" && !entry.as) {
11624
+ warnings.push(`preload link for "${entry.url}" is missing an \`as\` attribute \u2014 the browser may fetch it twice or apply the wrong request priority.`);
11625
+ }
11626
+ if ((entry.rel === "preconnect" || entry.rel === "dns-prefetch") && (entry.as || entry.type)) {
11627
+ warnings.push(`${entry.rel} link for "${entry.url}" sets \`as\`/\`type\`, which it ignores since no specific resource is being fetched yet.`);
11628
+ }
11629
+ }
11630
+ const canonicalCount = entries.filter((e) => e.rel === "canonical").length;
11631
+ if (canonicalCount > 1) {
11632
+ warnings.push(`${canonicalCount} canonical links present \u2014 only one canonical URL should be declared per page.`);
11633
+ }
11634
+ const header = entries.map((e) => e.value).join(", ");
11635
+ const snippet = `Link: ${header}`;
11636
+ return { header, headerName: "Link", snippet, links: entries, warnings };
11637
+ }
11569
11638
  function isValidIpv6HexGroup(g) {
11570
11639
  return /^[0-9a-fA-F]{1,4}$/.test(g);
11571
11640
  }
package/dist/index.d.cts CHANGED
@@ -6,7 +6,7 @@ export { d as data } from './data-CFeS9kes.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-c90DW-OZ.cjs';
9
- export { n as network } from './network-DfY5Ikvr.cjs';
9
+ export { n as network } from './network-X0EfH9Xq.cjs';
10
10
  export { a as api } from './api-DmTNE4c1.cjs';
11
11
  export { c as code } from './code-BK-x8hVx.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { d as data } from './data-CFeS9kes.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-c90DW-OZ.js';
9
- export { n as network } from './network-DfY5Ikvr.js';
9
+ export { n as network } from './network-X0EfH9Xq.js';
10
10
  export { a as api } from './api-DmTNE4c1.js';
11
11
  export { c as code } from './code-BK-x8hVx.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-L6V4W4SU.js';
2
2
  export { units_exports as units } from './chunk-7AJRK57W.js';
3
- export { network_exports as network } from './chunk-3YUKLV5N.js';
3
+ export { network_exports as network } from './chunk-UTHAHRQ7.js';
4
4
  export { api_exports as api } from './chunk-52ZDKSIX.js';
5
5
  export { code_exports as code } from './chunk-UUT5HNST.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
@@ -14,6 +14,7 @@
14
14
  * - cache-control-builder: buildCacheControl
15
15
  * - referrer-policy-builder: buildReferrerPolicy
16
16
  * - ipv6-compressor: parseIpv6Address
17
+ * - link-header-builder: buildLinkHeader
17
18
  */
18
19
  declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
19
20
  type DnsRecordType = typeof DNS_RECORD_TYPES[number];
@@ -319,6 +320,41 @@ declare const REFERRER_POLICY_VALUES: ReferrerPolicyValue[];
319
320
  declare function buildReferrerPolicy(policies: string | string[]): ReferrerPolicyResult | {
320
321
  error: string;
321
322
  };
323
+ type LinkRel = 'preload' | 'preconnect' | 'prefetch' | 'prerender' | 'dns-prefetch' | 'canonical' | 'next' | 'prev' | 'alternate' | 'stylesheet' | 'icon' | 'modulepreload';
324
+ interface LinkHeaderEntryInput {
325
+ url: string;
326
+ rel: string;
327
+ as?: string;
328
+ type?: string;
329
+ crossorigin?: boolean;
330
+ }
331
+ interface LinkHeaderEntry {
332
+ url: string;
333
+ rel: string;
334
+ as?: string;
335
+ type?: string;
336
+ crossorigin?: boolean;
337
+ value: string;
338
+ explanation: string;
339
+ }
340
+ interface LinkHeaderResult {
341
+ header: string;
342
+ headerName: 'Link';
343
+ snippet: string;
344
+ links: LinkHeaderEntry[];
345
+ warnings: string[];
346
+ }
347
+ declare const LINK_REL_VALUES: LinkRel[];
348
+ /**
349
+ * Build an HTTP `Link` response header from a list of URL/rel pairs (preload,
350
+ * preconnect, prefetch, canonical, pagination, etc.), including the `as`/
351
+ * `type`/`crossorigin` attributes preload needs, plus a plain-English
352
+ * explanation of each entry's effect. Pure string assembly and lookup; it
353
+ * never fetches or validates that a URL actually exists.
354
+ */
355
+ declare function buildLinkHeader(links: LinkHeaderEntryInput[]): LinkHeaderResult | {
356
+ error: string;
357
+ };
322
358
  type Ipv6AddressType = 'unspecified' | 'loopback' | 'link-local' | 'unique-local' | 'multicast' | 'ipv4-mapped' | 'documentation' | 'global-unicast';
323
359
  interface Ipv6ParseResult {
324
360
  expanded: string;
@@ -353,6 +389,11 @@ type network_HeaderCategory = HeaderCategory;
353
389
  type network_HttpHeader = HttpHeader;
354
390
  type network_Ipv6AddressType = Ipv6AddressType;
355
391
  type network_Ipv6ParseResult = Ipv6ParseResult;
392
+ declare const network_LINK_REL_VALUES: typeof LINK_REL_VALUES;
393
+ type network_LinkHeaderEntry = LinkHeaderEntry;
394
+ type network_LinkHeaderEntryInput = LinkHeaderEntryInput;
395
+ type network_LinkHeaderResult = LinkHeaderResult;
396
+ type network_LinkRel = LinkRel;
356
397
  type network_ParsedDnsResult = ParsedDnsResult;
357
398
  type network_ParsedGeoResult = ParsedGeoResult;
358
399
  declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
@@ -374,6 +415,7 @@ type network_UserAgentInfo = UserAgentInfo;
374
415
  declare const network_buildCacheControl: typeof buildCacheControl;
375
416
  declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
376
417
  declare const network_buildGeoUrl: typeof buildGeoUrl;
418
+ declare const network_buildLinkHeader: typeof buildLinkHeader;
377
419
  declare const network_buildMapUrl: typeof buildMapUrl;
378
420
  declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
379
421
  declare const network_countryCodeToFlag: typeof countryCodeToFlag;
@@ -405,7 +447,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
405
447
  declare const network_validateRobotsTxt: typeof validateRobotsTxt;
406
448
  declare const network_validateSitemap: typeof validateSitemap;
407
449
  declare namespace network {
408
- export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, 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_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, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, 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_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, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, 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_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, 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_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
450
+ export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, 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_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_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, 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_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, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, 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_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, 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_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
409
451
  }
410
452
 
411
- export { isValidIpv6 as $, buildCacheControl as A, buildDnsQueryUrl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, buildGeoUrl as E, buildMapUrl as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, buildReferrerPolicy as J, countryCodeToFlag as K, formatCoordinates as L, formatTtl as M, getByCategory as N, getHeader as O, type ParsedDnsResult as P, getHeadersByCategory as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, getStatusByCategory as T, type UaDeviceType as U, getStatusCode as V, isClientError as W, isServerError as X, isSuccess as Y, isValidIp as Z, isValidIpv4 as _, type CacheControlOptions as a, parseDnsResponse as a0, parseGeoResponse as a1, parseHar as a2, parseIpv6Address as a3, parseUserAgent as a4, searchHeaders as a5, searchStatusCodes as a6, statusCodeToText as a7, typeNumberToLabel as a8, validateDomain as a9, validateHeaderName as aa, validateHeaderValue as ab, validateRobotsTxt as ac, validateSitemap as ad, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type ParsedGeoResult as l, type ReferrerPolicyEntry as m, network as n, type ReferrerPolicyResult as o, type ReferrerPolicyValue as p, type RobotsGroup as q, type RobotsIssue as r, type RobotsRule as s, type RobotsValidationResult as t, type SitemapIndexEntry as u, type SitemapIssue as v, type SitemapUrlEntry as w, type SitemapValidationResult as x, type StatusCode as y, type UserAgentInfo as z };
453
+ export { getStatusCode as $, type SitemapUrlEntry as A, type SitemapValidationResult as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type StatusCode as E, type UserAgentInfo as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, buildCacheControl as J, buildDnsQueryUrl as K, LINK_REL_VALUES as L, buildGeoUrl as M, buildLinkHeader as N, buildMapUrl as O, type ParsedDnsResult as P, buildReferrerPolicy as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, countryCodeToFlag as T, type UaDeviceType as U, formatCoordinates as V, formatTtl as W, getByCategory as X, getHeader as Y, getHeadersByCategory as Z, getStatusByCategory as _, type CacheControlOptions as a, isClientError as a0, isServerError as a1, isSuccess as a2, isValidIp as a3, isValidIpv4 as a4, isValidIpv6 as a5, parseDnsResponse as a6, parseGeoResponse as a7, parseHar as a8, parseIpv6Address as a9, parseUserAgent as aa, searchHeaders as ab, searchStatusCodes as ac, statusCodeToText as ad, typeNumberToLabel as ae, validateDomain as af, validateHeaderName as ag, validateHeaderValue as ah, validateRobotsTxt as ai, validateSitemap as aj, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type LinkHeaderEntry as l, type LinkHeaderEntryInput as m, network as n, type LinkHeaderResult as o, type LinkRel as p, type ParsedGeoResult as q, type ReferrerPolicyEntry as r, type ReferrerPolicyResult as s, type ReferrerPolicyValue as t, type RobotsGroup as u, type RobotsIssue as v, type RobotsRule as w, type RobotsValidationResult as x, type SitemapIndexEntry as y, type SitemapIssue as z };
@@ -14,6 +14,7 @@
14
14
  * - cache-control-builder: buildCacheControl
15
15
  * - referrer-policy-builder: buildReferrerPolicy
16
16
  * - ipv6-compressor: parseIpv6Address
17
+ * - link-header-builder: buildLinkHeader
17
18
  */
18
19
  declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
19
20
  type DnsRecordType = typeof DNS_RECORD_TYPES[number];
@@ -319,6 +320,41 @@ declare const REFERRER_POLICY_VALUES: ReferrerPolicyValue[];
319
320
  declare function buildReferrerPolicy(policies: string | string[]): ReferrerPolicyResult | {
320
321
  error: string;
321
322
  };
323
+ type LinkRel = 'preload' | 'preconnect' | 'prefetch' | 'prerender' | 'dns-prefetch' | 'canonical' | 'next' | 'prev' | 'alternate' | 'stylesheet' | 'icon' | 'modulepreload';
324
+ interface LinkHeaderEntryInput {
325
+ url: string;
326
+ rel: string;
327
+ as?: string;
328
+ type?: string;
329
+ crossorigin?: boolean;
330
+ }
331
+ interface LinkHeaderEntry {
332
+ url: string;
333
+ rel: string;
334
+ as?: string;
335
+ type?: string;
336
+ crossorigin?: boolean;
337
+ value: string;
338
+ explanation: string;
339
+ }
340
+ interface LinkHeaderResult {
341
+ header: string;
342
+ headerName: 'Link';
343
+ snippet: string;
344
+ links: LinkHeaderEntry[];
345
+ warnings: string[];
346
+ }
347
+ declare const LINK_REL_VALUES: LinkRel[];
348
+ /**
349
+ * Build an HTTP `Link` response header from a list of URL/rel pairs (preload,
350
+ * preconnect, prefetch, canonical, pagination, etc.), including the `as`/
351
+ * `type`/`crossorigin` attributes preload needs, plus a plain-English
352
+ * explanation of each entry's effect. Pure string assembly and lookup; it
353
+ * never fetches or validates that a URL actually exists.
354
+ */
355
+ declare function buildLinkHeader(links: LinkHeaderEntryInput[]): LinkHeaderResult | {
356
+ error: string;
357
+ };
322
358
  type Ipv6AddressType = 'unspecified' | 'loopback' | 'link-local' | 'unique-local' | 'multicast' | 'ipv4-mapped' | 'documentation' | 'global-unicast';
323
359
  interface Ipv6ParseResult {
324
360
  expanded: string;
@@ -353,6 +389,11 @@ type network_HeaderCategory = HeaderCategory;
353
389
  type network_HttpHeader = HttpHeader;
354
390
  type network_Ipv6AddressType = Ipv6AddressType;
355
391
  type network_Ipv6ParseResult = Ipv6ParseResult;
392
+ declare const network_LINK_REL_VALUES: typeof LINK_REL_VALUES;
393
+ type network_LinkHeaderEntry = LinkHeaderEntry;
394
+ type network_LinkHeaderEntryInput = LinkHeaderEntryInput;
395
+ type network_LinkHeaderResult = LinkHeaderResult;
396
+ type network_LinkRel = LinkRel;
356
397
  type network_ParsedDnsResult = ParsedDnsResult;
357
398
  type network_ParsedGeoResult = ParsedGeoResult;
358
399
  declare const network_REFERRER_POLICY_VALUES: typeof REFERRER_POLICY_VALUES;
@@ -374,6 +415,7 @@ type network_UserAgentInfo = UserAgentInfo;
374
415
  declare const network_buildCacheControl: typeof buildCacheControl;
375
416
  declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
376
417
  declare const network_buildGeoUrl: typeof buildGeoUrl;
418
+ declare const network_buildLinkHeader: typeof buildLinkHeader;
377
419
  declare const network_buildMapUrl: typeof buildMapUrl;
378
420
  declare const network_buildReferrerPolicy: typeof buildReferrerPolicy;
379
421
  declare const network_countryCodeToFlag: typeof countryCodeToFlag;
@@ -405,7 +447,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
405
447
  declare const network_validateRobotsTxt: typeof validateRobotsTxt;
406
448
  declare const network_validateSitemap: typeof validateSitemap;
407
449
  declare namespace network {
408
- export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, 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_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, type network_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, 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_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, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, 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_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, 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_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
450
+ export { type network_CacheControlDirective as CacheControlDirective, type network_CacheControlOptions as CacheControlOptions, type network_CacheControlResult as CacheControlResult, 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_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_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, network_REFERRER_POLICY_VALUES as REFERRER_POLICY_VALUES, 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_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, network_buildCacheControl as buildCacheControl, network_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildLinkHeader as buildLinkHeader, network_buildMapUrl as buildMapUrl, network_buildReferrerPolicy as buildReferrerPolicy, 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_parseDnsResponse as parseDnsResponse, network_parseGeoResponse as parseGeoResponse, network_parseHar as parseHar, network_parseIpv6Address as parseIpv6Address, network_parseUserAgent as parseUserAgent, 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_validateRobotsTxt as validateRobotsTxt, network_validateSitemap as validateSitemap };
409
451
  }
410
452
 
411
- export { isValidIpv6 as $, buildCacheControl as A, buildDnsQueryUrl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, buildGeoUrl as E, buildMapUrl as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, buildReferrerPolicy as J, countryCodeToFlag as K, formatCoordinates as L, formatTtl as M, getByCategory as N, getHeader as O, type ParsedDnsResult as P, getHeadersByCategory as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, getStatusByCategory as T, type UaDeviceType as U, getStatusCode as V, isClientError as W, isServerError as X, isSuccess as Y, isValidIp as Z, isValidIpv4 as _, type CacheControlOptions as a, parseDnsResponse as a0, parseGeoResponse as a1, parseHar as a2, parseIpv6Address as a3, parseUserAgent as a4, searchHeaders as a5, searchStatusCodes as a6, statusCodeToText as a7, typeNumberToLabel as a8, validateDomain as a9, validateHeaderName as aa, validateHeaderValue as ab, validateRobotsTxt as ac, validateSitemap as ad, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type ParsedGeoResult as l, type ReferrerPolicyEntry as m, network as n, type ReferrerPolicyResult as o, type ReferrerPolicyValue as p, type RobotsGroup as q, type RobotsIssue as r, type RobotsRule as s, type RobotsValidationResult as t, type SitemapIndexEntry as u, type SitemapIssue as v, type SitemapUrlEntry as w, type SitemapValidationResult as x, type StatusCode as y, type UserAgentInfo as z };
453
+ export { getStatusCode as $, type SitemapUrlEntry as A, type SitemapValidationResult as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, type StatusCode as E, type UserAgentInfo as F, type GeoResult as G, HTTP_HEADERS as H, type Ipv6AddressType as I, buildCacheControl as J, buildDnsQueryUrl as K, LINK_REL_VALUES as L, buildGeoUrl as M, buildLinkHeader as N, buildMapUrl as O, type ParsedDnsResult as P, buildReferrerPolicy as Q, REFERRER_POLICY_VALUES as R, STATUS_CODES as S, countryCodeToFlag as T, type UaDeviceType as U, formatCoordinates as V, formatTtl as W, getByCategory as X, getHeader as Y, getHeadersByCategory as Z, getStatusByCategory as _, type CacheControlOptions as a, isClientError as a0, isServerError as a1, isSuccess as a2, isValidIp as a3, isValidIpv4 as a4, isValidIpv6 as a5, parseDnsResponse as a6, parseGeoResponse as a7, parseHar as a8, parseIpv6Address as a9, parseUserAgent as aa, searchHeaders as ab, searchStatusCodes as ac, statusCodeToText as ad, typeNumberToLabel as ae, validateDomain as af, validateHeaderName as ag, validateHeaderValue as ah, validateRobotsTxt as ai, validateSitemap as aj, type CacheControlResult as b, type DnsRecord as c, type DnsRecordType as d, type DnsResponse as e, type HarEntry as f, type HarParseResult as g, type HarSummary as h, type HeaderCategory as i, type HttpHeader as j, type Ipv6ParseResult as k, type LinkHeaderEntry as l, type LinkHeaderEntryInput as m, network as n, type LinkHeaderResult as o, type LinkRel as p, type ParsedGeoResult as q, type ReferrerPolicyEntry as r, type ReferrerPolicyResult as s, type ReferrerPolicyValue as t, type RobotsGroup as u, type RobotsIssue as v, type RobotsRule as w, type RobotsValidationResult as x, type SitemapIndexEntry as y, type SitemapIssue as z };
@@ -1855,6 +1855,73 @@ function buildReferrerPolicy(policies) {
1855
1855
  const metaTag = `<meta name="referrer" content="${last.value}">`;
1856
1856
  return { header, headerName: "Referrer-Policy", snippet, metaTag, policies: entries, warnings };
1857
1857
  }
1858
+ var LINK_REL_VALUES = [
1859
+ "preload",
1860
+ "preconnect",
1861
+ "prefetch",
1862
+ "prerender",
1863
+ "dns-prefetch",
1864
+ "canonical",
1865
+ "next",
1866
+ "prev",
1867
+ "alternate",
1868
+ "stylesheet",
1869
+ "icon",
1870
+ "modulepreload"
1871
+ ];
1872
+ var _LINK_REL_INFO = {
1873
+ preload: "Tells the browser to fetch this resource early, before the parser would otherwise discover it, without blocking rendering. Requires an `as` attribute so the browser applies the right request priority and Content-Security-Policy check; omitting it commonly causes the resource to be fetched twice.",
1874
+ preconnect: "Tells the browser to start the connection handshake (DNS, TCP, TLS) to this origin early, before any real request to it is made, so the first actual request lands faster.",
1875
+ prefetch: "Tells the browser to fetch this resource at low priority for a likely future navigation and cache it. Unlike preload, it does not affect the current page load.",
1876
+ prerender: "Tells the browser to fetch and render this page in the background so navigating to it feels instant, at a real bandwidth and CPU cost if the user never navigates there.",
1877
+ "dns-prefetch": "Tells the browser to resolve this origin's DNS early, a lighter-weight version of preconnect that skips the TCP/TLS handshake.",
1878
+ canonical: "Tells search engines which URL is the authoritative version of this page, used to consolidate duplicate-content signals across query-string or protocol variants.",
1879
+ next: "Marks the next page in a paginated sequence, a hint search engines and some browsers use for pagination.",
1880
+ prev: "Marks the previous page in a paginated sequence.",
1881
+ alternate: "Points to an alternate version of this resource, such as a different language or an RSS feed.",
1882
+ stylesheet: 'Loads an external stylesheet, the same effect as a `<link rel="stylesheet">` tag but delivered as a response header instead.',
1883
+ icon: 'Points to this resource\'s favicon, the same effect as a `<link rel="icon">` tag but delivered as a response header instead.',
1884
+ modulepreload: "Tells the browser to fetch and parse this JavaScript module early, ahead of when the module graph would otherwise discover it."
1885
+ };
1886
+ function buildLinkHeader(links) {
1887
+ if (!Array.isArray(links) || links.length === 0) {
1888
+ return { error: "At least one link entry is required" };
1889
+ }
1890
+ const entries = [];
1891
+ for (const link of links) {
1892
+ const url = typeof link.url === "string" ? link.url.trim() : "";
1893
+ const rel = typeof link.rel === "string" ? link.rel.trim() : "";
1894
+ if (!url) return { error: "Each link entry requires a non-empty url" };
1895
+ if (!rel) return { error: "Each link entry requires a non-empty rel" };
1896
+ if (!LINK_REL_VALUES.includes(rel)) {
1897
+ return { error: `'${rel}' is not a supported rel value. Supported values: ${LINK_REL_VALUES.join(", ")}` };
1898
+ }
1899
+ const as = link.as?.trim() || void 0;
1900
+ const type = link.type?.trim() || void 0;
1901
+ const crossorigin = link.crossorigin === true;
1902
+ let value = `<${url}>; rel="${rel}"`;
1903
+ if (as) value += `; as="${as}"`;
1904
+ if (type) value += `; type="${type}"`;
1905
+ if (crossorigin) value += "; crossorigin";
1906
+ entries.push({ url, rel, as, type, crossorigin: crossorigin || void 0, value, explanation: _LINK_REL_INFO[rel] });
1907
+ }
1908
+ const warnings = [];
1909
+ for (const entry of entries) {
1910
+ if (entry.rel === "preload" && !entry.as) {
1911
+ warnings.push(`preload link for "${entry.url}" is missing an \`as\` attribute \u2014 the browser may fetch it twice or apply the wrong request priority.`);
1912
+ }
1913
+ if ((entry.rel === "preconnect" || entry.rel === "dns-prefetch") && (entry.as || entry.type)) {
1914
+ warnings.push(`${entry.rel} link for "${entry.url}" sets \`as\`/\`type\`, which it ignores since no specific resource is being fetched yet.`);
1915
+ }
1916
+ }
1917
+ const canonicalCount = entries.filter((e) => e.rel === "canonical").length;
1918
+ if (canonicalCount > 1) {
1919
+ warnings.push(`${canonicalCount} canonical links present \u2014 only one canonical URL should be declared per page.`);
1920
+ }
1921
+ const header = entries.map((e) => e.value).join(", ");
1922
+ const snippet = `Link: ${header}`;
1923
+ return { header, headerName: "Link", snippet, links: entries, warnings };
1924
+ }
1858
1925
  function isValidIpv6HexGroup(g) {
1859
1926
  return /^[0-9a-fA-F]{1,4}$/.test(g);
1860
1927
  }
@@ -1946,11 +2013,13 @@ function parseIpv6Address(input) {
1946
2013
 
1947
2014
  exports.DNS_RECORD_TYPES = DNS_RECORD_TYPES;
1948
2015
  exports.HTTP_HEADERS = HTTP_HEADERS;
2016
+ exports.LINK_REL_VALUES = LINK_REL_VALUES;
1949
2017
  exports.REFERRER_POLICY_VALUES = REFERRER_POLICY_VALUES;
1950
2018
  exports.STATUS_CODES = STATUS_CODES;
1951
2019
  exports.buildCacheControl = buildCacheControl;
1952
2020
  exports.buildDnsQueryUrl = buildDnsQueryUrl;
1953
2021
  exports.buildGeoUrl = buildGeoUrl;
2022
+ exports.buildLinkHeader = buildLinkHeader;
1954
2023
  exports.buildMapUrl = buildMapUrl;
1955
2024
  exports.buildReferrerPolicy = buildReferrerPolicy;
1956
2025
  exports.countryCodeToFlag = countryCodeToFlag;
@@ -1 +1 @@
1
- export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES, c as DnsRecord, d as DnsRecordType, e as DnsResponse, G as GeoResult, H as HTTP_HEADERS, f as HarEntry, g as HarParseResult, h as HarSummary, i as HeaderCategory, j as HttpHeader, I as Ipv6AddressType, k as Ipv6ParseResult, P as ParsedDnsResult, l as ParsedGeoResult, R as REFERRER_POLICY_VALUES, m as ReferrerPolicyEntry, o as ReferrerPolicyResult, p as ReferrerPolicyValue, q as RobotsGroup, r as RobotsIssue, s as RobotsRule, t as RobotsValidationResult, S as STATUS_CODES, u as SitemapIndexEntry, v as SitemapIssue, w as SitemapUrlEntry, x as SitemapValidationResult, y as StatusCode, U as UaDeviceType, z as UserAgentInfo, A as buildCacheControl, B as buildDnsQueryUrl, E as buildGeoUrl, F as buildMapUrl, J as buildReferrerPolicy, K as countryCodeToFlag, L as formatCoordinates, M as formatTtl, N as getByCategory, O as getHeader, Q as getHeadersByCategory, T as getStatusByCategory, V as getStatusCode, W as isClientError, X as isServerError, Y as isSuccess, Z as isValidIp, _ as isValidIpv4, $ as isValidIpv6, a0 as parseDnsResponse, a1 as parseGeoResponse, a2 as parseHar, a3 as parseIpv6Address, a4 as parseUserAgent, a5 as searchHeaders, a6 as searchStatusCodes, a7 as statusCodeToText, a8 as typeNumberToLabel, a9 as validateDomain, aa as validateHeaderName, ab as validateHeaderValue, ac as validateRobotsTxt, ad as validateSitemap } from '../network-DfY5Ikvr.cjs';
1
+ export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES, c as DnsRecord, d as DnsRecordType, e as DnsResponse, G as GeoResult, H as HTTP_HEADERS, f as HarEntry, g as HarParseResult, h as HarSummary, i as HeaderCategory, j as HttpHeader, I as Ipv6AddressType, k as Ipv6ParseResult, L as LINK_REL_VALUES, l as LinkHeaderEntry, m as LinkHeaderEntryInput, o as LinkHeaderResult, p as LinkRel, P as ParsedDnsResult, q as ParsedGeoResult, R as REFERRER_POLICY_VALUES, r as ReferrerPolicyEntry, s as ReferrerPolicyResult, t as ReferrerPolicyValue, u as RobotsGroup, v as RobotsIssue, w as RobotsRule, x as RobotsValidationResult, S as STATUS_CODES, y as SitemapIndexEntry, z as SitemapIssue, A as SitemapUrlEntry, B as SitemapValidationResult, E as StatusCode, U as UaDeviceType, F as UserAgentInfo, J as buildCacheControl, K as buildDnsQueryUrl, M as buildGeoUrl, N as buildLinkHeader, O as buildMapUrl, Q as buildReferrerPolicy, T as countryCodeToFlag, V as formatCoordinates, W as formatTtl, X as getByCategory, Y as getHeader, Z as getHeadersByCategory, _ as getStatusByCategory, $ as getStatusCode, a0 as isClientError, a1 as isServerError, a2 as isSuccess, a3 as isValidIp, a4 as isValidIpv4, a5 as isValidIpv6, a6 as parseDnsResponse, a7 as parseGeoResponse, a8 as parseHar, a9 as parseIpv6Address, aa as parseUserAgent, ab as searchHeaders, ac as searchStatusCodes, ad as statusCodeToText, ae as typeNumberToLabel, af as validateDomain, ag as validateHeaderName, ah as validateHeaderValue, ai as validateRobotsTxt, aj as validateSitemap } from '../network-X0EfH9Xq.cjs';
@@ -1 +1 @@
1
- export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES, c as DnsRecord, d as DnsRecordType, e as DnsResponse, G as GeoResult, H as HTTP_HEADERS, f as HarEntry, g as HarParseResult, h as HarSummary, i as HeaderCategory, j as HttpHeader, I as Ipv6AddressType, k as Ipv6ParseResult, P as ParsedDnsResult, l as ParsedGeoResult, R as REFERRER_POLICY_VALUES, m as ReferrerPolicyEntry, o as ReferrerPolicyResult, p as ReferrerPolicyValue, q as RobotsGroup, r as RobotsIssue, s as RobotsRule, t as RobotsValidationResult, S as STATUS_CODES, u as SitemapIndexEntry, v as SitemapIssue, w as SitemapUrlEntry, x as SitemapValidationResult, y as StatusCode, U as UaDeviceType, z as UserAgentInfo, A as buildCacheControl, B as buildDnsQueryUrl, E as buildGeoUrl, F as buildMapUrl, J as buildReferrerPolicy, K as countryCodeToFlag, L as formatCoordinates, M as formatTtl, N as getByCategory, O as getHeader, Q as getHeadersByCategory, T as getStatusByCategory, V as getStatusCode, W as isClientError, X as isServerError, Y as isSuccess, Z as isValidIp, _ as isValidIpv4, $ as isValidIpv6, a0 as parseDnsResponse, a1 as parseGeoResponse, a2 as parseHar, a3 as parseIpv6Address, a4 as parseUserAgent, a5 as searchHeaders, a6 as searchStatusCodes, a7 as statusCodeToText, a8 as typeNumberToLabel, a9 as validateDomain, aa as validateHeaderName, ab as validateHeaderValue, ac as validateRobotsTxt, ad as validateSitemap } from '../network-DfY5Ikvr.js';
1
+ export { C as CacheControlDirective, a as CacheControlOptions, b as CacheControlResult, D as DNS_RECORD_TYPES, c as DnsRecord, d as DnsRecordType, e as DnsResponse, G as GeoResult, H as HTTP_HEADERS, f as HarEntry, g as HarParseResult, h as HarSummary, i as HeaderCategory, j as HttpHeader, I as Ipv6AddressType, k as Ipv6ParseResult, L as LINK_REL_VALUES, l as LinkHeaderEntry, m as LinkHeaderEntryInput, o as LinkHeaderResult, p as LinkRel, P as ParsedDnsResult, q as ParsedGeoResult, R as REFERRER_POLICY_VALUES, r as ReferrerPolicyEntry, s as ReferrerPolicyResult, t as ReferrerPolicyValue, u as RobotsGroup, v as RobotsIssue, w as RobotsRule, x as RobotsValidationResult, S as STATUS_CODES, y as SitemapIndexEntry, z as SitemapIssue, A as SitemapUrlEntry, B as SitemapValidationResult, E as StatusCode, U as UaDeviceType, F as UserAgentInfo, J as buildCacheControl, K as buildDnsQueryUrl, M as buildGeoUrl, N as buildLinkHeader, O as buildMapUrl, Q as buildReferrerPolicy, T as countryCodeToFlag, V as formatCoordinates, W as formatTtl, X as getByCategory, Y as getHeader, Z as getHeadersByCategory, _ as getStatusByCategory, $ as getStatusCode, a0 as isClientError, a1 as isServerError, a2 as isSuccess, a3 as isValidIp, a4 as isValidIpv4, a5 as isValidIpv6, a6 as parseDnsResponse, a7 as parseGeoResponse, a8 as parseHar, a9 as parseIpv6Address, aa as parseUserAgent, ab as searchHeaders, ac as searchStatusCodes, ad as statusCodeToText, ae as typeNumberToLabel, af as validateDomain, ag as validateHeaderName, ah as validateHeaderValue, ai as validateRobotsTxt, aj as validateSitemap } from '../network-X0EfH9Xq.js';
@@ -1,2 +1,2 @@
1
- export { DNS_RECORD_TYPES, HTTP_HEADERS, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildMapUrl, buildReferrerPolicy, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-3YUKLV5N.js';
1
+ export { DNS_RECORD_TYPES, HTTP_HEADERS, LINK_REL_VALUES, REFERRER_POLICY_VALUES, STATUS_CODES, buildCacheControl, buildDnsQueryUrl, buildGeoUrl, buildLinkHeader, buildMapUrl, buildReferrerPolicy, countryCodeToFlag, formatCoordinates, formatTtl, getByCategory, getHeader, getHeadersByCategory, getStatusByCategory, getStatusCode, isClientError, isServerError, isSuccess, isValidIp, isValidIpv4, isValidIpv6, parseDnsResponse, parseGeoResponse, parseHar, parseIpv6Address, parseUserAgent, searchHeaders, searchStatusCodes, statusCodeToText, typeNumberToLabel, validateDomain, validateHeaderName, validateHeaderValue, validateRobotsTxt, validateSitemap } from '../chunk-UTHAHRQ7.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.35.0",
3
+ "version": "0.36.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",