@utilix-tech/sdk 0.18.0 → 0.20.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 +7 -0
- package/README.md +18 -4
- package/dist/{chunk-F57WMKZO.js → chunk-2I4O5YCT.js} +100 -1
- package/dist/{chunk-L53LAVAD.js → chunk-LXKIPPDG.js} +266 -1
- package/dist/{chunk-3QMUUTBH.js → chunk-Y5OOP6WN.js} +94 -1
- package/dist/{code-Cn9uOIAh.d.ts → code-DaRvff2v.d.cts} +33 -2
- package/dist/{code-Cn9uOIAh.d.cts → code-DaRvff2v.d.ts} +33 -2
- package/dist/index.cjs +457 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{network-DZugNyAQ.d.cts → network-BJOjJnmY.d.cts} +45 -2
- package/dist/{network-DZugNyAQ.d.ts → network-BJOjJnmY.d.ts} +45 -2
- package/dist/{text-Bbx-tZ43.d.cts → text-DS70aMY5.d.cts} +33 -2
- package/dist/{text-Bbx-tZ43.d.ts → text-DS70aMY5.d.ts} +33 -2
- package/dist/tools/code.cjs +265 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/network.cjs +93 -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/dist/tools/text.cjs +99 -0
- package/dist/tools/text.d.cts +1 -1
- package/dist/tools/text.d.ts +1 -1
- package/dist/tools/text.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - sitemap-validator: validateSitemap
|
|
12
12
|
* - robots-txt-validator: validateRobotsTxt
|
|
13
13
|
* - user-agent-parser: parseUserAgent
|
|
14
|
+
* - cache-control-builder: buildCacheControl
|
|
14
15
|
*/
|
|
15
16
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
16
17
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -252,7 +253,48 @@ interface UserAgentInfo {
|
|
|
252
253
|
declare function parseUserAgent(ua: string): UserAgentInfo | {
|
|
253
254
|
error: string;
|
|
254
255
|
};
|
|
256
|
+
interface CacheControlOptions {
|
|
257
|
+
/** `public` (any cache) or `private` (browser only). */
|
|
258
|
+
visibility?: 'public' | 'private' | null;
|
|
259
|
+
noCache?: boolean;
|
|
260
|
+
noStore?: boolean;
|
|
261
|
+
noTransform?: boolean;
|
|
262
|
+
mustRevalidate?: boolean;
|
|
263
|
+
proxyRevalidate?: boolean;
|
|
264
|
+
immutable?: boolean;
|
|
265
|
+
mustUnderstand?: boolean;
|
|
266
|
+
/** Freshness lifetime in seconds. */
|
|
267
|
+
maxAge?: number | null;
|
|
268
|
+
/** Freshness lifetime for shared caches, in seconds. */
|
|
269
|
+
sMaxAge?: number | null;
|
|
270
|
+
staleWhileRevalidate?: number | null;
|
|
271
|
+
staleIfError?: number | null;
|
|
272
|
+
}
|
|
273
|
+
interface CacheControlDirective {
|
|
274
|
+
name: string;
|
|
275
|
+
value: string | null;
|
|
276
|
+
explanation: string;
|
|
277
|
+
}
|
|
278
|
+
interface CacheControlResult {
|
|
279
|
+
header: string;
|
|
280
|
+
headerName: 'Cache-Control';
|
|
281
|
+
snippet: string;
|
|
282
|
+
directives: CacheControlDirective[];
|
|
283
|
+
warnings: string[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Build a `Cache-Control` response-header value from a set of directives,
|
|
287
|
+
* with a plain-English explanation of each and warnings for combinations
|
|
288
|
+
* that cancel each other out. Pure string assembly: it never fetches or
|
|
289
|
+
* validates against a live origin.
|
|
290
|
+
*/
|
|
291
|
+
declare function buildCacheControl(options?: CacheControlOptions): CacheControlResult | {
|
|
292
|
+
error: string;
|
|
293
|
+
};
|
|
255
294
|
|
|
295
|
+
type network_CacheControlDirective = CacheControlDirective;
|
|
296
|
+
type network_CacheControlOptions = CacheControlOptions;
|
|
297
|
+
type network_CacheControlResult = CacheControlResult;
|
|
256
298
|
declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
257
299
|
type network_DnsRecord = DnsRecord;
|
|
258
300
|
type network_DnsRecordType = DnsRecordType;
|
|
@@ -278,6 +320,7 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
278
320
|
type network_StatusCode = StatusCode;
|
|
279
321
|
type network_UaDeviceType = UaDeviceType;
|
|
280
322
|
type network_UserAgentInfo = UserAgentInfo;
|
|
323
|
+
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
281
324
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
282
325
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
283
326
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
@@ -309,7 +352,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
309
352
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
310
353
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
311
354
|
declare namespace network {
|
|
312
|
-
export { 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_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, 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_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, 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_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 };
|
|
355
|
+
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_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, 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_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_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 };
|
|
313
356
|
}
|
|
314
357
|
|
|
315
|
-
export {
|
|
358
|
+
export { statusCodeToText as $, formatCoordinates as A, formatTtl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, getByCategory as E, getHeader as F, type GeoResult as G, HTTP_HEADERS as H, getHeadersByCategory as I, getStatusByCategory as J, getStatusCode as K, isClientError as L, isServerError as M, isSuccess as N, isValidIp as O, type ParsedDnsResult as P, isValidIpv4 as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIpv6 as T, type UaDeviceType as U, parseDnsResponse as V, parseGeoResponse as W, parseHar as X, parseUserAgent as Y, searchHeaders as Z, searchStatusCodes as _, type CacheControlOptions as a, typeNumberToLabel as a0, validateDomain as a1, validateHeaderName as a2, validateHeaderValue as a3, validateRobotsTxt as a4, validateSitemap as a5, 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 ParsedGeoResult as k, type RobotsIssue as l, type RobotsRule as m, network as n, type RobotsValidationResult as o, type SitemapIndexEntry as p, type SitemapIssue as q, type SitemapUrlEntry as r, type SitemapValidationResult as s, type StatusCode as t, type UserAgentInfo as u, buildCacheControl as v, buildDnsQueryUrl as w, buildGeoUrl as x, buildMapUrl as y, countryCodeToFlag as z };
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* - sitemap-validator: validateSitemap
|
|
12
12
|
* - robots-txt-validator: validateRobotsTxt
|
|
13
13
|
* - user-agent-parser: parseUserAgent
|
|
14
|
+
* - cache-control-builder: buildCacheControl
|
|
14
15
|
*/
|
|
15
16
|
declare const DNS_RECORD_TYPES: readonly ["A", "AAAA", "CNAME", "MX", "TXT", "NS", "SOA", "PTR", "SRV", "CAA"];
|
|
16
17
|
type DnsRecordType = typeof DNS_RECORD_TYPES[number];
|
|
@@ -252,7 +253,48 @@ interface UserAgentInfo {
|
|
|
252
253
|
declare function parseUserAgent(ua: string): UserAgentInfo | {
|
|
253
254
|
error: string;
|
|
254
255
|
};
|
|
256
|
+
interface CacheControlOptions {
|
|
257
|
+
/** `public` (any cache) or `private` (browser only). */
|
|
258
|
+
visibility?: 'public' | 'private' | null;
|
|
259
|
+
noCache?: boolean;
|
|
260
|
+
noStore?: boolean;
|
|
261
|
+
noTransform?: boolean;
|
|
262
|
+
mustRevalidate?: boolean;
|
|
263
|
+
proxyRevalidate?: boolean;
|
|
264
|
+
immutable?: boolean;
|
|
265
|
+
mustUnderstand?: boolean;
|
|
266
|
+
/** Freshness lifetime in seconds. */
|
|
267
|
+
maxAge?: number | null;
|
|
268
|
+
/** Freshness lifetime for shared caches, in seconds. */
|
|
269
|
+
sMaxAge?: number | null;
|
|
270
|
+
staleWhileRevalidate?: number | null;
|
|
271
|
+
staleIfError?: number | null;
|
|
272
|
+
}
|
|
273
|
+
interface CacheControlDirective {
|
|
274
|
+
name: string;
|
|
275
|
+
value: string | null;
|
|
276
|
+
explanation: string;
|
|
277
|
+
}
|
|
278
|
+
interface CacheControlResult {
|
|
279
|
+
header: string;
|
|
280
|
+
headerName: 'Cache-Control';
|
|
281
|
+
snippet: string;
|
|
282
|
+
directives: CacheControlDirective[];
|
|
283
|
+
warnings: string[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Build a `Cache-Control` response-header value from a set of directives,
|
|
287
|
+
* with a plain-English explanation of each and warnings for combinations
|
|
288
|
+
* that cancel each other out. Pure string assembly: it never fetches or
|
|
289
|
+
* validates against a live origin.
|
|
290
|
+
*/
|
|
291
|
+
declare function buildCacheControl(options?: CacheControlOptions): CacheControlResult | {
|
|
292
|
+
error: string;
|
|
293
|
+
};
|
|
255
294
|
|
|
295
|
+
type network_CacheControlDirective = CacheControlDirective;
|
|
296
|
+
type network_CacheControlOptions = CacheControlOptions;
|
|
297
|
+
type network_CacheControlResult = CacheControlResult;
|
|
256
298
|
declare const network_DNS_RECORD_TYPES: typeof DNS_RECORD_TYPES;
|
|
257
299
|
type network_DnsRecord = DnsRecord;
|
|
258
300
|
type network_DnsRecordType = DnsRecordType;
|
|
@@ -278,6 +320,7 @@ type network_SitemapValidationResult = SitemapValidationResult;
|
|
|
278
320
|
type network_StatusCode = StatusCode;
|
|
279
321
|
type network_UaDeviceType = UaDeviceType;
|
|
280
322
|
type network_UserAgentInfo = UserAgentInfo;
|
|
323
|
+
declare const network_buildCacheControl: typeof buildCacheControl;
|
|
281
324
|
declare const network_buildDnsQueryUrl: typeof buildDnsQueryUrl;
|
|
282
325
|
declare const network_buildGeoUrl: typeof buildGeoUrl;
|
|
283
326
|
declare const network_buildMapUrl: typeof buildMapUrl;
|
|
@@ -309,7 +352,7 @@ declare const network_validateHeaderValue: typeof validateHeaderValue;
|
|
|
309
352
|
declare const network_validateRobotsTxt: typeof validateRobotsTxt;
|
|
310
353
|
declare const network_validateSitemap: typeof validateSitemap;
|
|
311
354
|
declare namespace network {
|
|
312
|
-
export { 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_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, 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_buildDnsQueryUrl as buildDnsQueryUrl, network_buildGeoUrl as buildGeoUrl, network_buildMapUrl as buildMapUrl, 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_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 };
|
|
355
|
+
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_ParsedDnsResult as ParsedDnsResult, type network_ParsedGeoResult as ParsedGeoResult, 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_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_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 };
|
|
313
356
|
}
|
|
314
357
|
|
|
315
|
-
export {
|
|
358
|
+
export { statusCodeToText as $, formatCoordinates as A, formatTtl as B, type CacheControlDirective as C, DNS_RECORD_TYPES as D, getByCategory as E, getHeader as F, type GeoResult as G, HTTP_HEADERS as H, getHeadersByCategory as I, getStatusByCategory as J, getStatusCode as K, isClientError as L, isServerError as M, isSuccess as N, isValidIp as O, type ParsedDnsResult as P, isValidIpv4 as Q, type RobotsGroup as R, STATUS_CODES as S, isValidIpv6 as T, type UaDeviceType as U, parseDnsResponse as V, parseGeoResponse as W, parseHar as X, parseUserAgent as Y, searchHeaders as Z, searchStatusCodes as _, type CacheControlOptions as a, typeNumberToLabel as a0, validateDomain as a1, validateHeaderName as a2, validateHeaderValue as a3, validateRobotsTxt as a4, validateSitemap as a5, 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 ParsedGeoResult as k, type RobotsIssue as l, type RobotsRule as m, network as n, type RobotsValidationResult as o, type SitemapIndexEntry as p, type SitemapIssue as q, type SitemapUrlEntry as r, type SitemapValidationResult as s, type StatusCode as t, type UserAgentInfo as u, buildCacheControl as v, buildDnsQueryUrl as w, buildGeoUrl as x, buildMapUrl as y, countryCodeToFlag as z };
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
* - html-table : detectDelimiter, parseTableData, generateHtmlTable, generateMarkdownTable, csvToHtml, csvToMarkdown
|
|
19
19
|
* - ascii-art : textToAscii, getAvailableFonts, addBorder, centerText
|
|
20
20
|
* - morse-code : textToMorse, morseToText, isValidMorse, getMorseForChar, getMorseTiming
|
|
21
|
+
* - passive-voice-detector: detectPassiveVoice
|
|
22
|
+
* - readability-score: scoreReadability
|
|
23
|
+
* - filler-word-detector: detectFillerWords
|
|
21
24
|
*/
|
|
22
25
|
interface WordCountResult {
|
|
23
26
|
words: number;
|
|
@@ -275,6 +278,30 @@ interface ReadabilityResult {
|
|
|
275
278
|
* dictionary lookup, so scores are an estimate rather than exact.
|
|
276
279
|
*/
|
|
277
280
|
declare function scoreReadability(text: string): ReadabilityResult;
|
|
281
|
+
type FillerCategory = 'filler' | 'hedge' | 'cliche';
|
|
282
|
+
interface FillerMatch {
|
|
283
|
+
phrase: string;
|
|
284
|
+
category: FillerCategory;
|
|
285
|
+
count: number;
|
|
286
|
+
indices: number[];
|
|
287
|
+
}
|
|
288
|
+
interface FillerWordResult {
|
|
289
|
+
totalWords: number;
|
|
290
|
+
totalMatches: number;
|
|
291
|
+
fillerCount: number;
|
|
292
|
+
hedgeCount: number;
|
|
293
|
+
clicheCount: number;
|
|
294
|
+
/** Matches per 100 words, to one decimal place. */
|
|
295
|
+
density: number;
|
|
296
|
+
matches: FillerMatch[];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Scan text for filler words, hedge phrases, and clichés, returning each
|
|
300
|
+
* matched phrase with its category, occurrence count, and character offsets.
|
|
301
|
+
* This is a dictionary-based heuristic: a flagged word (e.g. "just") is a
|
|
302
|
+
* candidate to reconsider, not always wrong in context.
|
|
303
|
+
*/
|
|
304
|
+
declare function detectFillerWords(text: string): FillerWordResult;
|
|
278
305
|
|
|
279
306
|
type text_AsciiFont = AsciiFont;
|
|
280
307
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -290,6 +317,9 @@ type text_DiffType = DiffType;
|
|
|
290
317
|
type text_DiffViewerLine = DiffViewerLine;
|
|
291
318
|
declare const text_ESCAPE_MODES: typeof ESCAPE_MODES;
|
|
292
319
|
type text_EscapeMode = EscapeMode;
|
|
320
|
+
type text_FillerCategory = FillerCategory;
|
|
321
|
+
type text_FillerMatch = FillerMatch;
|
|
322
|
+
type text_FillerWordResult = FillerWordResult;
|
|
293
323
|
declare const text_LINE_OPS: typeof LINE_OPS;
|
|
294
324
|
type text_LineOp = LineOp;
|
|
295
325
|
type text_LineType = LineType;
|
|
@@ -319,6 +349,7 @@ declare const text_countWords: typeof countWords;
|
|
|
319
349
|
declare const text_csvToHtml: typeof csvToHtml;
|
|
320
350
|
declare const text_csvToMarkdown: typeof csvToMarkdown;
|
|
321
351
|
declare const text_detectDelimiter: typeof detectDelimiter;
|
|
352
|
+
declare const text_detectFillerWords: typeof detectFillerWords;
|
|
322
353
|
declare const text_detectPassiveVoice: typeof detectPassiveVoice;
|
|
323
354
|
declare const text_diffLines: typeof diffLines;
|
|
324
355
|
declare const text_diffLinesSimple: typeof diffLinesSimple;
|
|
@@ -360,7 +391,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
360
391
|
declare const text_unescapeString: typeof unescapeString;
|
|
361
392
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
362
393
|
declare namespace text {
|
|
363
|
-
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
394
|
+
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
364
395
|
}
|
|
365
396
|
|
|
366
|
-
export {
|
|
397
|
+
export { escapeString as $, type AsciiFont as A, applyOp as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, type FillerCategory as F, applyOps as G, centerText as H, convertAll as I, convertCase as J, countWords as K, LINE_OPS as L, MORSE_CODE as M, csvToHtml as N, csvToMarkdown as O, type ParsedDiff as P, detectDelimiter as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, detectFillerWords as U, detectPassiveVoice as V, type WordCountResult as W, diffLines as X, diffLinesSimple as Y, diffStats as Z, escapeAll as _, type AsciiOptions as a, extractHeadings as a0, formatReadingTime as a1, generate as a2, generateDiff as a3, generateHtmlTable as a4, generateMarkdownTable as a5, generateParagraphs as a6, generateSentences as a7, generateWords as a8, getAvailableFonts as a9, getMorseForChar as aa, getMorseTiming as ab, htmlToMarkdown as ac, isValidMorse as ad, markdownToHtml as ae, morseToText as af, numberToOrdinal as ag, numberToRoman as ah, numberToWords as ai, ordinalWords as aj, parseDiff as ak, parseTableData as al, readabilityScore as am, renderMarkdown as an, romanToNumber as ao, scoreReadability as ap, sentenceCount as aq, slugify as ar, slugifyAll as as, syllableCount as at, textToAscii as au, textToMorse as av, unescapeString as aw, wordFrequency as ax, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type FillerMatch as k, type FillerWordResult as l, type LineOp as m, type LineType as n, type LoremUnit as o, type MarkdownResult as p, type MorseOptions as q, type ParsedTable as r, type PassiveVoiceMatch as s, text as t, type PassiveVoiceResult as u, type PassiveVoiceSentence as v, type ReadabilityScore as w, type TextAnalysis as x, addBorder as y, analyzeText as z };
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
* - html-table : detectDelimiter, parseTableData, generateHtmlTable, generateMarkdownTable, csvToHtml, csvToMarkdown
|
|
19
19
|
* - ascii-art : textToAscii, getAvailableFonts, addBorder, centerText
|
|
20
20
|
* - morse-code : textToMorse, morseToText, isValidMorse, getMorseForChar, getMorseTiming
|
|
21
|
+
* - passive-voice-detector: detectPassiveVoice
|
|
22
|
+
* - readability-score: scoreReadability
|
|
23
|
+
* - filler-word-detector: detectFillerWords
|
|
21
24
|
*/
|
|
22
25
|
interface WordCountResult {
|
|
23
26
|
words: number;
|
|
@@ -275,6 +278,30 @@ interface ReadabilityResult {
|
|
|
275
278
|
* dictionary lookup, so scores are an estimate rather than exact.
|
|
276
279
|
*/
|
|
277
280
|
declare function scoreReadability(text: string): ReadabilityResult;
|
|
281
|
+
type FillerCategory = 'filler' | 'hedge' | 'cliche';
|
|
282
|
+
interface FillerMatch {
|
|
283
|
+
phrase: string;
|
|
284
|
+
category: FillerCategory;
|
|
285
|
+
count: number;
|
|
286
|
+
indices: number[];
|
|
287
|
+
}
|
|
288
|
+
interface FillerWordResult {
|
|
289
|
+
totalWords: number;
|
|
290
|
+
totalMatches: number;
|
|
291
|
+
fillerCount: number;
|
|
292
|
+
hedgeCount: number;
|
|
293
|
+
clicheCount: number;
|
|
294
|
+
/** Matches per 100 words, to one decimal place. */
|
|
295
|
+
density: number;
|
|
296
|
+
matches: FillerMatch[];
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Scan text for filler words, hedge phrases, and clichés, returning each
|
|
300
|
+
* matched phrase with its category, occurrence count, and character offsets.
|
|
301
|
+
* This is a dictionary-based heuristic: a flagged word (e.g. "just") is a
|
|
302
|
+
* candidate to reconsider, not always wrong in context.
|
|
303
|
+
*/
|
|
304
|
+
declare function detectFillerWords(text: string): FillerWordResult;
|
|
278
305
|
|
|
279
306
|
type text_AsciiFont = AsciiFont;
|
|
280
307
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -290,6 +317,9 @@ type text_DiffType = DiffType;
|
|
|
290
317
|
type text_DiffViewerLine = DiffViewerLine;
|
|
291
318
|
declare const text_ESCAPE_MODES: typeof ESCAPE_MODES;
|
|
292
319
|
type text_EscapeMode = EscapeMode;
|
|
320
|
+
type text_FillerCategory = FillerCategory;
|
|
321
|
+
type text_FillerMatch = FillerMatch;
|
|
322
|
+
type text_FillerWordResult = FillerWordResult;
|
|
293
323
|
declare const text_LINE_OPS: typeof LINE_OPS;
|
|
294
324
|
type text_LineOp = LineOp;
|
|
295
325
|
type text_LineType = LineType;
|
|
@@ -319,6 +349,7 @@ declare const text_countWords: typeof countWords;
|
|
|
319
349
|
declare const text_csvToHtml: typeof csvToHtml;
|
|
320
350
|
declare const text_csvToMarkdown: typeof csvToMarkdown;
|
|
321
351
|
declare const text_detectDelimiter: typeof detectDelimiter;
|
|
352
|
+
declare const text_detectFillerWords: typeof detectFillerWords;
|
|
322
353
|
declare const text_detectPassiveVoice: typeof detectPassiveVoice;
|
|
323
354
|
declare const text_diffLines: typeof diffLines;
|
|
324
355
|
declare const text_diffLinesSimple: typeof diffLinesSimple;
|
|
@@ -360,7 +391,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
360
391
|
declare const text_unescapeString: typeof unescapeString;
|
|
361
392
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
362
393
|
declare namespace text {
|
|
363
|
-
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
394
|
+
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
364
395
|
}
|
|
365
396
|
|
|
366
|
-
export {
|
|
397
|
+
export { escapeString as $, type AsciiFont as A, applyOp as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, type FillerCategory as F, applyOps as G, centerText as H, convertAll as I, convertCase as J, countWords as K, LINE_OPS as L, MORSE_CODE as M, csvToHtml as N, csvToMarkdown as O, type ParsedDiff as P, detectDelimiter as Q, type ReadabilityResult as R, type SlugSeparator as S, type TableOptions as T, detectFillerWords as U, detectPassiveVoice as V, type WordCountResult as W, diffLines as X, diffLinesSimple as Y, diffStats as Z, escapeAll as _, type AsciiOptions as a, extractHeadings as a0, formatReadingTime as a1, generate as a2, generateDiff as a3, generateHtmlTable as a4, generateMarkdownTable as a5, generateParagraphs as a6, generateSentences as a7, generateWords as a8, getAvailableFonts as a9, getMorseForChar as aa, getMorseTiming as ab, htmlToMarkdown as ac, isValidMorse as ad, markdownToHtml as ae, morseToText as af, numberToOrdinal as ag, numberToRoman as ah, numberToWords as ai, ordinalWords as aj, parseDiff as ak, parseTableData as al, readabilityScore as am, renderMarkdown as an, romanToNumber as ao, scoreReadability as ap, sentenceCount as aq, slugify as ar, slugifyAll as as, syllableCount as at, textToAscii as au, textToMorse as av, unescapeString as aw, wordFrequency as ax, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type FillerMatch as k, type FillerWordResult as l, type LineOp as m, type LineType as n, type LoremUnit as o, type MarkdownResult as p, type MorseOptions as q, type ParsedTable as r, type PassiveVoiceMatch as s, text as t, type PassiveVoiceResult as u, type PassiveVoiceSentence as v, type ReadabilityScore as w, type TextAnalysis as x, addBorder as y, analyzeText as z };
|
package/dist/tools/code.cjs
CHANGED
|
@@ -2425,6 +2425,270 @@ function parseGithubUrl(input) {
|
|
|
2425
2425
|
}
|
|
2426
2426
|
return { error: `Unsupported GitHub URL path: /${rest.join("/")}` };
|
|
2427
2427
|
}
|
|
2428
|
+
var _REDOS_UNBOUNDED = /* @__PURE__ */ new Set(["*", "+"]);
|
|
2429
|
+
function _redosParseQuant(src, i) {
|
|
2430
|
+
const ch = src[i];
|
|
2431
|
+
if (ch === "*" || ch === "+" || ch === "?") {
|
|
2432
|
+
let end = i + 1;
|
|
2433
|
+
if (src[end] === "?" || src[end] === "+") end++;
|
|
2434
|
+
return { unbounded: _REDOS_UNBOUNDED.has(ch), raw: src.slice(i, end), end };
|
|
2435
|
+
}
|
|
2436
|
+
if (ch === "{") {
|
|
2437
|
+
const close = src.indexOf("}", i);
|
|
2438
|
+
if (close === -1) return null;
|
|
2439
|
+
const inner = src.slice(i + 1, close);
|
|
2440
|
+
if (!/^\d+(,\d*)?$/.test(inner)) return null;
|
|
2441
|
+
let end = close + 1;
|
|
2442
|
+
if (src[end] === "?" || src[end] === "+") end++;
|
|
2443
|
+
const unbounded = /^\d+,$/.test(inner);
|
|
2444
|
+
return { unbounded, raw: src.slice(i, end), end };
|
|
2445
|
+
}
|
|
2446
|
+
return null;
|
|
2447
|
+
}
|
|
2448
|
+
function _redosParseAlternation(src, start, endExclusive) {
|
|
2449
|
+
const alternatives = [];
|
|
2450
|
+
let current = [];
|
|
2451
|
+
let i = start;
|
|
2452
|
+
while (i < endExclusive) {
|
|
2453
|
+
const ch = src[i];
|
|
2454
|
+
if (ch === "|") {
|
|
2455
|
+
alternatives.push(current);
|
|
2456
|
+
current = [];
|
|
2457
|
+
i++;
|
|
2458
|
+
continue;
|
|
2459
|
+
}
|
|
2460
|
+
let node;
|
|
2461
|
+
if (ch === "\\") {
|
|
2462
|
+
const atomEnd = i + 2 <= endExclusive ? i + 2 : i + 1;
|
|
2463
|
+
node = { kind: "char", start: i, end: atomEnd, quant: null, quantEnd: atomEnd, raw: src.slice(i, atomEnd) };
|
|
2464
|
+
i = atomEnd;
|
|
2465
|
+
} else if (ch === "[") {
|
|
2466
|
+
let j = i + 1;
|
|
2467
|
+
if (src[j] === "^") j++;
|
|
2468
|
+
if (src[j] === "]") j++;
|
|
2469
|
+
while (j < endExclusive && src[j] !== "]") {
|
|
2470
|
+
j += src[j] === "\\" ? 2 : 1;
|
|
2471
|
+
}
|
|
2472
|
+
const classEnd = j < endExclusive ? j + 1 : endExclusive;
|
|
2473
|
+
node = { kind: "class", start: i, end: classEnd, quant: null, quantEnd: classEnd, raw: src.slice(i, classEnd) };
|
|
2474
|
+
i = classEnd;
|
|
2475
|
+
} else if (ch === "(") {
|
|
2476
|
+
let depth = 1;
|
|
2477
|
+
let j = i + 1;
|
|
2478
|
+
while (j < endExclusive && depth > 0) {
|
|
2479
|
+
const cj = src[j];
|
|
2480
|
+
if (cj === "\\") {
|
|
2481
|
+
j += 2;
|
|
2482
|
+
continue;
|
|
2483
|
+
}
|
|
2484
|
+
if (cj === "[") {
|
|
2485
|
+
j++;
|
|
2486
|
+
if (src[j] === "^") j++;
|
|
2487
|
+
if (src[j] === "]") j++;
|
|
2488
|
+
while (j < endExclusive && src[j] !== "]") {
|
|
2489
|
+
j += src[j] === "\\" ? 2 : 1;
|
|
2490
|
+
}
|
|
2491
|
+
j++;
|
|
2492
|
+
continue;
|
|
2493
|
+
}
|
|
2494
|
+
if (cj === "(") depth++;
|
|
2495
|
+
else if (cj === ")") depth--;
|
|
2496
|
+
j++;
|
|
2497
|
+
}
|
|
2498
|
+
const closeIdx = depth === 0 ? j - 1 : endExclusive;
|
|
2499
|
+
let contentStart = i + 1;
|
|
2500
|
+
let lookaround = false;
|
|
2501
|
+
if (src[i + 1] === "?") {
|
|
2502
|
+
const after = src[i + 2];
|
|
2503
|
+
if (after === ":") contentStart = i + 3;
|
|
2504
|
+
else if (after === "=" || after === "!") {
|
|
2505
|
+
contentStart = i + 3;
|
|
2506
|
+
lookaround = true;
|
|
2507
|
+
} else if (after === "<") {
|
|
2508
|
+
const a3 = src[i + 3];
|
|
2509
|
+
if (a3 === "=" || a3 === "!") {
|
|
2510
|
+
contentStart = i + 4;
|
|
2511
|
+
lookaround = true;
|
|
2512
|
+
} else {
|
|
2513
|
+
const gt = src.indexOf(">", i + 2);
|
|
2514
|
+
contentStart = gt !== -1 && gt < closeIdx ? gt + 1 : i + 3;
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
node = {
|
|
2519
|
+
kind: "group",
|
|
2520
|
+
start: i,
|
|
2521
|
+
end: closeIdx + 1,
|
|
2522
|
+
quant: null,
|
|
2523
|
+
quantEnd: closeIdx + 1,
|
|
2524
|
+
raw: src.slice(i, closeIdx + 1),
|
|
2525
|
+
alternatives: _redosParseAlternation(src, contentStart, closeIdx),
|
|
2526
|
+
lookaround
|
|
2527
|
+
};
|
|
2528
|
+
i = closeIdx + 1;
|
|
2529
|
+
} else if (ch === ".") {
|
|
2530
|
+
node = { kind: "dot", start: i, end: i + 1, quant: null, quantEnd: i + 1, raw: "." };
|
|
2531
|
+
i++;
|
|
2532
|
+
} else if (ch === "^" || ch === "$") {
|
|
2533
|
+
node = { kind: "anchor", start: i, end: i + 1, quant: null, quantEnd: i + 1, raw: ch };
|
|
2534
|
+
i++;
|
|
2535
|
+
} else {
|
|
2536
|
+
node = { kind: "char", start: i, end: i + 1, quant: null, quantEnd: i + 1, raw: ch };
|
|
2537
|
+
i++;
|
|
2538
|
+
}
|
|
2539
|
+
if (node.kind !== "anchor") {
|
|
2540
|
+
const q = _redosParseQuant(src, i);
|
|
2541
|
+
if (q) {
|
|
2542
|
+
node.quant = q;
|
|
2543
|
+
node.quantEnd = q.end;
|
|
2544
|
+
i = q.end;
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
current.push(node);
|
|
2548
|
+
}
|
|
2549
|
+
alternatives.push(current);
|
|
2550
|
+
return alternatives;
|
|
2551
|
+
}
|
|
2552
|
+
var _REDOS_ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ .,-@/:;#%&=";
|
|
2553
|
+
function _redosFirstMatcher(node) {
|
|
2554
|
+
if (node.kind === "dot") return (c) => c !== "\n";
|
|
2555
|
+
if (node.kind === "char") {
|
|
2556
|
+
if (node.raw.startsWith("\\")) {
|
|
2557
|
+
const body = node.raw.slice(1);
|
|
2558
|
+
if (/^[dDwWsS]$/.test(body)) {
|
|
2559
|
+
try {
|
|
2560
|
+
const re = new RegExp("\\" + body);
|
|
2561
|
+
return (c) => re.test(c);
|
|
2562
|
+
} catch {
|
|
2563
|
+
return null;
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
const literal = { n: "\n", t: " ", r: "\r", f: "\f", v: "\v" }[body] ?? body;
|
|
2567
|
+
return (c) => c === literal;
|
|
2568
|
+
}
|
|
2569
|
+
const lit = node.raw;
|
|
2570
|
+
return (c) => c === lit;
|
|
2571
|
+
}
|
|
2572
|
+
if (node.kind === "class") {
|
|
2573
|
+
try {
|
|
2574
|
+
const re = new RegExp(node.raw);
|
|
2575
|
+
return (c) => re.test(c);
|
|
2576
|
+
} catch {
|
|
2577
|
+
return null;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
if (node.kind === "group") {
|
|
2581
|
+
const first = node.alternatives?.[0]?.[0];
|
|
2582
|
+
return first ? _redosFirstMatcher(first) : null;
|
|
2583
|
+
}
|
|
2584
|
+
return null;
|
|
2585
|
+
}
|
|
2586
|
+
function _redosOverlaps(a, b) {
|
|
2587
|
+
const fa = _redosFirstMatcher(a);
|
|
2588
|
+
const fb = _redosFirstMatcher(b);
|
|
2589
|
+
if (!fa || !fb) return false;
|
|
2590
|
+
for (const c of _REDOS_ALPHABET) {
|
|
2591
|
+
if (fa(c) && fb(c)) return true;
|
|
2592
|
+
}
|
|
2593
|
+
return false;
|
|
2594
|
+
}
|
|
2595
|
+
function _redosAnalyzeGroup(node, findings) {
|
|
2596
|
+
const alts = node.alternatives ?? [];
|
|
2597
|
+
const outerUnbounded = node.quant?.unbounded === true && !node.lookaround;
|
|
2598
|
+
if (outerUnbounded) {
|
|
2599
|
+
for (const alt of alts) {
|
|
2600
|
+
const meaningful = alt.filter((n) => n.kind !== "anchor");
|
|
2601
|
+
if (meaningful.length === 1 && meaningful[0].quant?.unbounded) {
|
|
2602
|
+
findings.push({
|
|
2603
|
+
type: "nested-quantifier",
|
|
2604
|
+
severity: "high",
|
|
2605
|
+
message: "Nested unbounded quantifiers: a repeated group whose body is itself unbounded-repeated can match the same input in exponentially many ways, causing catastrophic backtracking.",
|
|
2606
|
+
snippet: node.raw + (node.quant?.raw ?? ""),
|
|
2607
|
+
index: node.start
|
|
2608
|
+
});
|
|
2609
|
+
break;
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
if (alts.length > 1) {
|
|
2613
|
+
const firsts = alts.map((alt) => alt.find((n) => n.kind !== "anchor")).filter((n) => !!n);
|
|
2614
|
+
let flagged = false;
|
|
2615
|
+
for (let x = 0; x < firsts.length && !flagged; x++) {
|
|
2616
|
+
for (let y = x + 1; y < firsts.length; y++) {
|
|
2617
|
+
if (_redosOverlaps(firsts[x], firsts[y])) {
|
|
2618
|
+
findings.push({
|
|
2619
|
+
type: "overlapping-alternation",
|
|
2620
|
+
severity: "medium",
|
|
2621
|
+
message: "Overlapping alternation under a repetition: two branches can match the same starting input, so the engine has multiple ways to split each repeat and may backtrack heavily.",
|
|
2622
|
+
snippet: node.raw + (node.quant?.raw ?? ""),
|
|
2623
|
+
index: node.start
|
|
2624
|
+
});
|
|
2625
|
+
flagged = true;
|
|
2626
|
+
break;
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
for (const alt of alts) {
|
|
2633
|
+
_redosAnalyzeSequence(alt, findings);
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
function _redosAnalyzeSequence(seq, findings) {
|
|
2637
|
+
for (let k = 0; k + 1 < seq.length; k++) {
|
|
2638
|
+
const a = seq[k];
|
|
2639
|
+
const b = seq[k + 1];
|
|
2640
|
+
if (a.quant?.unbounded && b.quant?.unbounded && _redosOverlaps(a, b)) {
|
|
2641
|
+
findings.push({
|
|
2642
|
+
type: "adjacent-quantifier",
|
|
2643
|
+
severity: "medium",
|
|
2644
|
+
message: "Adjacent unbounded quantifiers over overlapping characters: the engine can distribute the same input between them in many ways, causing quadratic backtracking.",
|
|
2645
|
+
snippet: seq[k].raw + (a.quant?.raw ?? "") + seq[k + 1].raw + (b.quant?.raw ?? ""),
|
|
2646
|
+
index: a.start
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
for (const node of seq) {
|
|
2651
|
+
if (node.kind === "group") _redosAnalyzeGroup(node, findings);
|
|
2652
|
+
}
|
|
2653
|
+
}
|
|
2654
|
+
function detectRedos(pattern) {
|
|
2655
|
+
if (typeof pattern !== "string" || pattern === "") {
|
|
2656
|
+
return { error: "Empty pattern" };
|
|
2657
|
+
}
|
|
2658
|
+
if (pattern.length > 5e3) {
|
|
2659
|
+
return { error: "Pattern too long (max 5,000 chars)" };
|
|
2660
|
+
}
|
|
2661
|
+
let valid = true;
|
|
2662
|
+
let compileError;
|
|
2663
|
+
try {
|
|
2664
|
+
new RegExp(pattern);
|
|
2665
|
+
} catch (e) {
|
|
2666
|
+
valid = false;
|
|
2667
|
+
compileError = e instanceof Error ? e.message : String(e);
|
|
2668
|
+
}
|
|
2669
|
+
const findings = [];
|
|
2670
|
+
const alternatives = _redosParseAlternation(pattern, 0, pattern.length);
|
|
2671
|
+
for (const alt of alternatives) {
|
|
2672
|
+
_redosAnalyzeSequence(alt, findings);
|
|
2673
|
+
}
|
|
2674
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2675
|
+
const unique = findings.filter((f) => {
|
|
2676
|
+
const key = `${f.type}:${f.index}`;
|
|
2677
|
+
if (seen.has(key)) return false;
|
|
2678
|
+
seen.add(key);
|
|
2679
|
+
return true;
|
|
2680
|
+
});
|
|
2681
|
+
unique.sort((a, b) => a.index - b.index);
|
|
2682
|
+
const risk = unique.some((f) => f.severity === "high") ? "high" : unique.length > 0 ? "medium" : "none";
|
|
2683
|
+
return {
|
|
2684
|
+
pattern,
|
|
2685
|
+
valid,
|
|
2686
|
+
...compileError ? { compileError } : {},
|
|
2687
|
+
risk,
|
|
2688
|
+
safe: unique.length === 0,
|
|
2689
|
+
findings: unique
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2428
2692
|
|
|
2429
2693
|
exports.ALL_FLAGS = ALL_FLAGS;
|
|
2430
2694
|
exports.CHEATSHEET = CHEATSHEET;
|
|
@@ -2440,6 +2704,7 @@ exports.countProperties = countProperties;
|
|
|
2440
2704
|
exports.countRules = countRules;
|
|
2441
2705
|
exports.detectDialect = detectDialect;
|
|
2442
2706
|
exports.detectOperationType = detectOperationType;
|
|
2707
|
+
exports.detectRedos = detectRedos;
|
|
2443
2708
|
exports.envToExport = envToExport;
|
|
2444
2709
|
exports.envToJson = envToJson;
|
|
2445
2710
|
exports.formatCss = formatCss;
|
package/dist/tools/code.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as CssResult, D as DockerImageRef, E as EnvEntry, f as EnvParseResult, G as GitCommandConfig, g as GitCommandResult, h as GitOperation, i as GithubUrlInfo, j as GithubUrlType, k as GqlFormatResult, H as HtmlFormatResult, l as HtmlMinifyOptions, m as HtmlMinifyResult, J as JsMinifyOptions, n as JsMinifyResult, M as MIME_TABLE, o as MatchResult, p as MimeEntry, q as MimeLookupResult, O as OPERATIONS, P as ParsedSpec, R as
|
|
1
|
+
export { A as ALL_FLAGS, a as ApiEndpoint, b as ApiInfo, C as CHEATSHEET, d as CheatsheetEntry, e as CssResult, D as DockerImageRef, E as EnvEntry, f as EnvParseResult, G as GitCommandConfig, g as GitCommandResult, h as GitOperation, i as GithubUrlInfo, j as GithubUrlType, k as GqlFormatResult, H as HtmlFormatResult, l as HtmlMinifyOptions, m as HtmlMinifyResult, J as JsMinifyOptions, n as JsMinifyResult, M as MIME_TABLE, o as MatchResult, p as MimeEntry, q as MimeLookupResult, O as OPERATIONS, P as ParsedSpec, R as RedosFinding, r as RedosResult, s as RedosSeverity, t as RegexError, u as RegexFlag, v as RegexMatch, w as RegexResult, x as RegexSuccess, S as SQL_DEFAULT_OPTIONS, y as Segment, z as SpecVersion, B as SqlDialect, F as SqlFormatOptions, T as TestPatternResult, I as buildDockerPull, K as buildDockerRun, L as buildGitCommand, N as collapseHtmlWhitespace, Q as collapseJsWhitespace, U as countProperties, V as countRules, W as detectDialect, X as detectOperationType, Y as detectRedos, Z as envToExport, _ as envToJson, $ as formatCss, a0 as formatGql, a1 as formatHtml, a2 as formatSql, a3 as getEndpointsByTag, a4 as getHtmlStats, a5 as getJsStats, a6 as getMethodColor, a7 as isValidTag, a8 as lookupMime, a9 as minifyCss, aa as minifyGql, ab as minifyHtml, ac as minifyJs, ad as minifySql, ae as normalizeRef, af as parseDockerImage, ag as parseEnv, ah as parseGitCommand, ai as parseGithubUrl, aj as parseSpec, ak as removeConsoleCalls, al as removeEmptyAttributes, am as removeHtmlComments, an as removeJsComments, ao as removeRedundantAttributes, ap as searchCheatsheet, aq as searchEndpoints, ar as splitStatements, as as testPattern, at as testRegex, au as validateEnvKey } from '../code-DaRvff2v.cjs';
|