@flighthq/useragent 0.5.1-next.3308.79ae053 → 0.5.1-next.4305.c5b7dc0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/useragent`. The `@fl
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/useragent@0.5.1-next.3308.79ae053](https://github.com/flighthq/flight/tree/79ae05332d95f01cdbd3492cf912bbd3b8f9658a/packages/useragent)
17
- - [License](https://github.com/flighthq/flight/blob/79ae05332d95f01cdbd3492cf912bbd3b8f9658a/LICENSE.md)
16
+ - [Source for @flighthq/useragent@0.5.1-next.4305.c5b7dc0](https://github.com/flighthq/flight/tree/c5b7dc0276d23e5772eb5aa05cdff1a91777141f/packages/useragent)
17
+ - [License](https://github.com/flighthq/flight/blob/c5b7dc0276d23e5772eb5aa05cdff1a91777141f/LICENSE.md)
@@ -1,3 +1,5 @@
1
- export * from './userAgent.ts';
2
- export * from './userAgentParse.ts';
1
+ export { DeviceFormFactorCar, DeviceFormFactorDesktop, DeviceFormFactorPhone, DeviceFormFactorTV, DeviceFormFactorTablet, DeviceFormFactorUnknown, DeviceFormFactorWatch, } from './deviceFormFactor.ts';
2
+ export type { DeviceFormFactor } from './deviceFormFactor.ts';
3
+ export { detectEndianness, parseUserAgentArch, parseUserAgentEngine, parseUserAgentEngineVersion, parseUserAgentKind, parseUserAgentName, parseUserAgentPointerWidth, parseUserAgentRuntime, parseUserAgentVersion, } from './userAgent.ts';
4
+ export { parseUserAgentFormFactor, parseUserAgentOsName, parseUserAgentOsVersion } from './userAgentParse.ts';
3
5
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/contract.js CHANGED
@@ -1,3 +1,6 @@
1
- export * from "./userAgent.js";
2
- export * from "./userAgentParse.js";
1
+ // Generated from crates/flight-useragent/src/lib.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ export { DeviceFormFactorCar, DeviceFormFactorDesktop, DeviceFormFactorPhone, DeviceFormFactorTV, DeviceFormFactorTablet, DeviceFormFactorUnknown, DeviceFormFactorWatch, } from "./deviceFormFactor.js";
4
+ export { detectEndianness, parseUserAgentArch, parseUserAgentEngine, parseUserAgentEngineVersion, parseUserAgentKind, parseUserAgentName, parseUserAgentPointerWidth, parseUserAgentRuntime, parseUserAgentVersion, } from "./userAgent.js";
5
+ export { parseUserAgentFormFactor, parseUserAgentOsName, parseUserAgentOsVersion } from "./userAgentParse.js";
3
6
  //# sourceMappingURL=contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,mEAAmE;AAEnE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Device form-factor identifier (TS `DeviceFormFactor`): the physical class of device a host runs
3
+ * on. An OPEN string domain, as in TS: the seven constants below are the known values, and a
4
+ * custom form factor uses a vendor-prefixed string (e.g. "acme.Console").
5
+ */
6
+ export type DeviceFormFactor = string;
7
+ /**
8
+ * TS `DeviceFormFactorCar`.
9
+ */
10
+ export declare const DeviceFormFactorCar: "Car";
11
+ /**
12
+ * TS `DeviceFormFactorDesktop`.
13
+ */
14
+ export declare const DeviceFormFactorDesktop: "Desktop";
15
+ /**
16
+ * TS `DeviceFormFactorPhone`.
17
+ */
18
+ export declare const DeviceFormFactorPhone: "Phone";
19
+ /**
20
+ * TS `DeviceFormFactorTablet`.
21
+ */
22
+ export declare const DeviceFormFactorTablet: "Tablet";
23
+ /**
24
+ * TS `DeviceFormFactorTV`.
25
+ */
26
+ export declare const DeviceFormFactorTV: "TV";
27
+ /**
28
+ * TS `DeviceFormFactorUnknown`.
29
+ */
30
+ export declare const DeviceFormFactorUnknown: "Unknown";
31
+ /**
32
+ * TS `DeviceFormFactorWatch`.
33
+ */
34
+ export declare const DeviceFormFactorWatch: "Watch";
35
+ //# sourceMappingURL=deviceFormFactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceFormFactor.d.ts","sourceRoot":"","sources":["../src/deviceFormFactor.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAG,KAAc,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAG,SAAkB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAG,OAAgB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAG,QAAiB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAG,IAAa,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAG,SAAkB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAG,OAAgB,CAAC"}
@@ -0,0 +1,31 @@
1
+ // Generated from crates/flight-useragent/src/device_form_factor.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ /**
4
+ * TS `DeviceFormFactorCar`.
5
+ */
6
+ export const DeviceFormFactorCar = 'Car';
7
+ /**
8
+ * TS `DeviceFormFactorDesktop`.
9
+ */
10
+ export const DeviceFormFactorDesktop = 'Desktop';
11
+ /**
12
+ * TS `DeviceFormFactorPhone`.
13
+ */
14
+ export const DeviceFormFactorPhone = 'Phone';
15
+ /**
16
+ * TS `DeviceFormFactorTablet`.
17
+ */
18
+ export const DeviceFormFactorTablet = 'Tablet';
19
+ /**
20
+ * TS `DeviceFormFactorTV`.
21
+ */
22
+ export const DeviceFormFactorTV = 'TV';
23
+ /**
24
+ * TS `DeviceFormFactorUnknown`.
25
+ */
26
+ export const DeviceFormFactorUnknown = 'Unknown';
27
+ /**
28
+ * TS `DeviceFormFactorWatch`.
29
+ */
30
+ export const DeviceFormFactorWatch = 'Watch';
31
+ //# sourceMappingURL=deviceFormFactor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceFormFactor.js","sourceRoot":"","sources":["../src/deviceFormFactor.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,mEAAmE;AASnE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAc,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAkB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAiB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAa,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAkB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAgB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './userAgent.ts';
2
- export * from './userAgentParse.ts';
1
+ export { DeviceFormFactorCar, DeviceFormFactorDesktop, DeviceFormFactorPhone, DeviceFormFactorTV, DeviceFormFactorTablet, DeviceFormFactorUnknown, DeviceFormFactorWatch, detectEndianness, parseUserAgentArch, parseUserAgentEngine, parseUserAgentEngineVersion, parseUserAgentFormFactor, parseUserAgentKind, parseUserAgentName, parseUserAgentOsName, parseUserAgentOsVersion, parseUserAgentPointerWidth, parseUserAgentRuntime, parseUserAgentVersion, } from './contract.ts';
2
+ export type { DeviceFormFactor } from './contract.ts';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
- export * from "./userAgent.js";
2
- export * from "./userAgentParse.js";
1
+ // Generated from crates/flight-useragent/src/lib.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ export { DeviceFormFactorCar, DeviceFormFactorDesktop, DeviceFormFactorPhone, DeviceFormFactorTV, DeviceFormFactorTablet, DeviceFormFactorUnknown, DeviceFormFactorWatch, detectEndianness, parseUserAgentArch, parseUserAgentEngine, parseUserAgentEngineVersion, parseUserAgentFormFactor, parseUserAgentKind, parseUserAgentName, parseUserAgentOsName, parseUserAgentOsVersion, parseUserAgentPointerWidth, parseUserAgentRuntime, parseUserAgentVersion, } from "./contract.js";
3
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,mEAAmE;AAEnE,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * JS `/prefix(class+)/i.exec(text)?.[1]`: the first occurrence of `prefix` followed by at least
3
+ * one `class` char, capturing that greedy run.
4
+ */
5
+ export declare function captureAfter(text: Readonly<number[]>, prefix: string, predicate: (arg0: number) => boolean): string | undefined;
6
+ /**
7
+ * JS `/prefix\s+(class+)/i`: `prefix`, at least one JS whitespace, then at least one `class` char.
8
+ */
9
+ export declare function captureAfterWhitespace(text: Readonly<number[]>, prefix: string, predicate: (arg0: number) => boolean): string | undefined;
10
+ /**
11
+ * The UA as JavaScript UTF-16 code units, for position-based matching.
12
+ */
13
+ export declare function charsOf(text: string): number[];
14
+ /**
15
+ * JS `/needle/i.test(text)`.
16
+ */
17
+ export declare function contains(text: Readonly<number[]>, needle: string): boolean;
18
+ /**
19
+ * JS `/a|b|.../i.test(text)`.
20
+ */
21
+ export declare function containsAny(text: Readonly<number[]>, needles: Readonly<string[]>): boolean;
22
+ /**
23
+ * JS `/first.*second/i.test(text)`: `second` follows some `first` on the same line.
24
+ */
25
+ export declare function containsThenOnLine(text: Readonly<number[]>, first: string, second: string): boolean;
26
+ export declare function isAsciiDigit(c: number): boolean;
27
+ /**
28
+ * `[\d.]`
29
+ */
30
+ export declare function isDigitOrDot(c: number): boolean;
31
+ /**
32
+ * `[\d]`
33
+ */
34
+ export declare function isDigitOrUnderscore(c: number): boolean;
35
+ /**
36
+ * `[\d.]`
37
+ */
38
+ export declare function isDigitUnderscoreOrDot(c: number): boolean;
39
+ /**
40
+ * JS LineTerminator: the characters `.` does not match.
41
+ */
42
+ export declare function isJsLineTerminator(c: number): boolean;
43
+ /**
44
+ * JS `\s`: WhiteSpace (TAB, VT, FF, U+FEFF and the Zs category) plus LineTerminator.
45
+ */
46
+ export declare function isJsWhitespace(c: number): boolean;
47
+ export declare function isNotJsWhitespace(c: number): boolean;
48
+ /**
49
+ * True when `needle` (ASCII, lowercase) matches `text` at `at` under JS non-unicode `/i` folding.
50
+ */
51
+ export declare function matchesAt(text: Readonly<number[]>, at: number, needle: string): boolean;
52
+ /**
53
+ * Every position where `needle` matches, in order (the regex's leftmost start positions).
54
+ */
55
+ export declare function positions(text: Readonly<number[]>, needle: string): number[];
56
+ /**
57
+ * Count of consecutive chars from `at` satisfying `class`.
58
+ */
59
+ export declare function runLen(text: Readonly<number[]>, at: number, predicate: (arg0: number) => boolean): number;
60
+ /**
61
+ * Replaces ASCII underscores with dots in a capture made only of digits, underscores, and dots.
62
+ */
63
+ export declare function underscoresToDots(value: string): string;
64
+ //# sourceMappingURL=jsPattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsPattern.d.ts","sourceRoot":"","sources":["../src/jsPattern.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EACxB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GACnC,MAAM,GAAG,SAAS,CAUpB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EACxB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GACnC,MAAM,GAAG,SAAS,CAcpB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EA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,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQvD"}
@@ -0,0 +1,235 @@
1
+ // Target-native JavaScript UTF-16 and regular-expression semantics for js_pattern.rs.
2
+ /**
3
+ * JS `/prefix(class+)/i.exec(text)?.[1]`: the first occurrence of `prefix` followed by at least
4
+ * one `class` char, capturing that greedy run.
5
+ */
6
+ export function captureAfter(text, prefix, predicate) {
7
+ const prefixLen = utf16Len(prefix);
8
+ for (const at of positions(text, prefix)) {
9
+ const start = at + prefixLen;
10
+ const len = runLen(text, start, predicate);
11
+ if (len > 0) {
12
+ return asciiSliceToString(text, start, start + len);
13
+ }
14
+ }
15
+ return undefined;
16
+ }
17
+ /**
18
+ * JS `/prefix\s+(class+)/i`: `prefix`, at least one JS whitespace, then at least one `class` char.
19
+ */
20
+ export function captureAfterWhitespace(text, prefix, predicate) {
21
+ const prefixLen = utf16Len(prefix);
22
+ for (const at of positions(text, prefix)) {
23
+ const ws = runLen(text, at + prefixLen, isJsWhitespace);
24
+ if (ws === 0) {
25
+ continue;
26
+ }
27
+ const start = at + prefixLen + ws;
28
+ const len = runLen(text, start, predicate);
29
+ if (len > 0) {
30
+ return asciiSliceToString(text, start, start + len);
31
+ }
32
+ }
33
+ return undefined;
34
+ }
35
+ /**
36
+ * The UA as JavaScript UTF-16 code units, for position-based matching.
37
+ */
38
+ export function charsOf(text) {
39
+ return Array.from({ length: text.length }, (_, index) => text.charCodeAt(index));
40
+ }
41
+ /**
42
+ * JS `/needle/i.test(text)`.
43
+ */
44
+ export function contains(text, needle) {
45
+ return findFrom(text, 0, needle) !== undefined;
46
+ }
47
+ /**
48
+ * JS `/a|b|.../i.test(text)`.
49
+ */
50
+ export function containsAny(text, needles) {
51
+ return needles.some((needle) => contains(text, needle));
52
+ }
53
+ /**
54
+ * JS `/first.*second/i.test(text)`: `second` follows some `first` on the same line.
55
+ */
56
+ export function containsThenOnLine(text, first, second) {
57
+ const firstLen = utf16Len(first);
58
+ return positions(text, first).some((at) => {
59
+ let k = at + firstLen;
60
+ for (;;) {
61
+ if (matchesAt(text, k, second)) {
62
+ return true;
63
+ }
64
+ if (k >= text.length || isJsLineTerminator(text[k])) {
65
+ return false;
66
+ }
67
+ k += 1;
68
+ }
69
+ });
70
+ }
71
+ export function isAsciiDigit(c) {
72
+ return Array.from({ length: 0x0039 - 0x0030 + 1 }, (_, index) => 0x0030 + index).includes(c);
73
+ }
74
+ /**
75
+ * The first position at or after `from` where `needle` matches.
76
+ */
77
+ function findFrom(text, from, needle) {
78
+ const len = utf16Len(needle);
79
+ if (len > text.length) {
80
+ return undefined;
81
+ }
82
+ return Array.from({ length: text.length - len - from + 1 }, (_, index) => from + index).find((i) => matchesAt(text, i, needle));
83
+ }
84
+ /**
85
+ * `[\d.]`
86
+ */
87
+ export function isDigitOrDot(c) {
88
+ return isAsciiDigit(c) || c === 0x002e;
89
+ }
90
+ /**
91
+ * `[\d]`
92
+ */
93
+ export function isDigitOrUnderscore(c) {
94
+ return isAsciiDigit(c) || c === 0x005f;
95
+ }
96
+ /**
97
+ * `[\d.]`
98
+ */
99
+ export function isDigitUnderscoreOrDot(c) {
100
+ return isAsciiDigit(c) || c === 0x005f || c === 0x002e;
101
+ }
102
+ /**
103
+ * JS LineTerminator: the characters `.` does not match.
104
+ */
105
+ export function isJsLineTerminator(c) {
106
+ return c === 0x000a || c === 0x000d || c === 0x2028 || c === 0x2029;
107
+ }
108
+ /**
109
+ * JS `\s`: WhiteSpace (TAB, VT, FF, U+FEFF and the Zs category) plus LineTerminator.
110
+ */
111
+ export function isJsWhitespace(c) {
112
+ return (c === 0x0009 ||
113
+ c === 0x000b ||
114
+ c === 0x000c ||
115
+ c === 0x0020 ||
116
+ c === 0x00a0 ||
117
+ c === 0x1680 ||
118
+ Array.from({ length: 0x200a - 0x2000 + 1 }, (_, index) => 0x2000 + index).includes(c) ||
119
+ c === 0x202f ||
120
+ c === 0x205f ||
121
+ c === 0x3000 ||
122
+ c === 0xfeff ||
123
+ isJsLineTerminator(c));
124
+ }
125
+ export function isNotJsWhitespace(c) {
126
+ return !isJsWhitespace(c);
127
+ }
128
+ /**
129
+ * True when `needle` (ASCII, lowercase) matches `text` at `at` under JS non-unicode `/i` folding.
130
+ */
131
+ export function matchesAt(text, at, needle) {
132
+ let i = at;
133
+ for (const p of Array.from({ length: needle.length }, (_, index) => needle.charCodeAt(index))) {
134
+ if (i >= text.length || asciiLower(text[i]) !== p) {
135
+ return false;
136
+ }
137
+ i += 1;
138
+ }
139
+ return true;
140
+ }
141
+ /**
142
+ * Every position where `needle` matches, in order (the regex's leftmost start positions).
143
+ */
144
+ export function positions(text, needle) {
145
+ let out = [0];
146
+ out.length = 0;
147
+ let from = 0;
148
+ for (;;) {
149
+ const found = findFrom(text, from, needle);
150
+ {
151
+ const matchValue = found;
152
+ if (matchValue !== undefined) {
153
+ const at = matchValue;
154
+ out.push(at);
155
+ from = at + 1;
156
+ }
157
+ else if (matchValue === undefined) {
158
+ break;
159
+ }
160
+ }
161
+ }
162
+ return out;
163
+ }
164
+ /**
165
+ * Count of consecutive chars from `at` satisfying `class`.
166
+ */
167
+ export function runLen(text, at, predicate) {
168
+ const start = Math.min(at, text.length);
169
+ let end = start;
170
+ while (end < text.length && predicate(text[end])) {
171
+ end += 1;
172
+ }
173
+ return end - start;
174
+ }
175
+ /**
176
+ * Replaces ASCII underscores with dots in a capture made only of digits, underscores, and dots.
177
+ */
178
+ export function underscoresToDots(value) {
179
+ let units = Array.from({ length: value.length }, (_, index) => value.charCodeAt(index));
180
+ for (let i = 0; i < units.length; i += 1) {
181
+ if (units[i] === 0x005f) {
182
+ units[i] = 0x002e;
183
+ }
184
+ }
185
+ return asciiSliceToString(units, 0, units.length);
186
+ }
187
+ function asciiLower(value) {
188
+ if (Array.from({ length: 0x005a - 0x0041 + 1 }, (_, index) => 0x0041 + index).includes(value)) {
189
+ return value + 0x0020;
190
+ }
191
+ return value;
192
+ }
193
+ function utf16Len(value) {
194
+ const units = Array.from({ length: value.length }, (_, index) => value.charCodeAt(index));
195
+ return units.length;
196
+ }
197
+ function asciiSliceToString(text, start, end) {
198
+ let out = '';
199
+ for (let i = start; i < end; i += 1) {
200
+ const value = (() => {
201
+ const matchValue = text[i];
202
+ switch (matchValue) {
203
+ case 0x002e:
204
+ return '.';
205
+ case 0x0030:
206
+ return '0';
207
+ case 0x0031:
208
+ return '1';
209
+ case 0x0032:
210
+ return '2';
211
+ case 0x0033:
212
+ return '3';
213
+ case 0x0034:
214
+ return '4';
215
+ case 0x0035:
216
+ return '5';
217
+ case 0x0036:
218
+ return '6';
219
+ case 0x0037:
220
+ return '7';
221
+ case 0x0038:
222
+ return '8';
223
+ case 0x0039:
224
+ return '9';
225
+ case 0x005f:
226
+ return '_';
227
+ default:
228
+ return '';
229
+ }
230
+ })();
231
+ out = `${out}${value}`;
232
+ }
233
+ return out;
234
+ }
235
+ //# sourceMappingURL=jsPattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsPattern.js","sourceRoot":"","sources":["../src/jsPattern.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAwB,EACxB,MAAc,EACd,SAAoC;IAEpC,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,KAAK,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,EAAE,GAAG,SAAS,CAAC;QAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3C,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACZ,OAAO,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAC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QACH,CAAC,CAAC,EAAE,CAAC;QACL,GAAG,GAAG,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,11 +1,62 @@
1
- import type { PlatformEndianness, PlatformEngine, PlatformKind, PlatformName, PlatformRuntime } from '@flighthq/types/contract';
1
+ import type { PlatformEndianness, PlatformRuntime, Record, Unknown } from './userAgentNative.ts';
2
+ import { PlatformEngine, PlatformKind, PlatformName } from './userAgentNative.ts';
3
+ /**
4
+ * Pointer width in bits, or `Unknown` when the architecture does not identify one.
5
+ */
6
+ export type UserAgentPointerWidth = 32 | 64 | -1;
7
+ /**
8
+ * Probes host CPU byte order with a local two-byte write-then-read (the source's
9
+ * `Uint16Array`/`Uint8Array` view of one buffer): `Big` when the high byte comes first, `Little`
10
+ * when the low byte does. The source's `Unknown` arm is for runtimes without ArrayBuffer, which
11
+ * cannot occur here.
12
+ */
2
13
  export declare function detectEndianness(): PlatformEndianness;
14
+ /**
15
+ * Parses the canonical CPU architecture token from a UA string: "x64", "arm64", "x86", "arm",
16
+ * "riscv64", "mips64", "mips", or "" when undetectable. A truthy `uadPlatform` (the UA-CH
17
+ * `navigator.userAgentData.platform` hint) is consulted first, case-folded as JS `toLowerCase`
18
+ * does; `undefined` and `Some("")` both skip it, as an empty string is falsy in TS. arm64/aarch64 is
19
+ * tested before arm.
20
+ */
3
21
  export declare function parseUserAgentArch(ua: string, uadPlatform?: string): string;
22
+ /**
23
+ * Parses the browser engine from a UA string. iOS/iPadOS decide first (every browser there runs on
24
+ * the system WebKit); then Firefox (gecko); legacy EdgeHTML (`Edge/<digit>`) is `Unknown`, not
25
+ * blink; then Chrome/Chromium/Edg/OPR/Samsung (blink); then Safari/WebKit; else `Unknown`.
26
+ */
4
27
  export declare function parseUserAgentEngine(ua: string): PlatformEngine;
28
+ /**
29
+ * Extracts the raw browser/engine version token for `engine` ("" when absent or `Unknown`): gecko
30
+ * `Firefox/`; blink `Edg/`, then `OPR/`, then `Chrome/`; webkit `Version/`, then `AppleWebKit/`.
31
+ * Never parsed for semantics.
32
+ */
5
33
  export declare function parseUserAgentEngineVersion(ua: string, engine: PlatformEngine): string;
34
+ /**
35
+ * The platform kind derived from a name: iOS and Android are `Mobile`; everything else is `Web`.
36
+ */
6
37
  export declare function parseUserAgentKind(name: PlatformName): PlatformKind;
38
+ /**
39
+ * The platform name from a UA string, in source precedence (android, iOS devices, `win`, `mac`,
40
+ * linux); `Web` when no known OS is detected.
41
+ */
7
42
  export declare function parseUserAgentName(ua: string): PlatformName;
8
- export declare function parseUserAgentPointerWidth(arch: string): 32 | 64 | -1;
9
- export declare function parseUserAgentRuntime(win: Record<string, unknown> | null | undefined): PlatformRuntime;
43
+ /**
44
+ * Pointer width in bits from a canonical arch token: 64 for "x64"/"arm64", 32 for "x86"/"arm", -1
45
+ * otherwise (TS `32 | 64 | -1`).
46
+ */
47
+ export declare function parseUserAgentPointerWidth(arch: string): UserAgentPointerWidth;
48
+ /**
49
+ * The host shell from browser-global probes on an optional window-like record (TS
50
+ * `win?: Readonly<Record<unknown>>`; `undefined` is omitted/undefined). `Unknown` for no window;
51
+ * `Electron` when `process.versions.electron` is truthy; `Tauri` when `__TAURI__` is truthy;
52
+ * `Capacitor` when `Capacitor` is truthy; else `Web`. Truthiness and property access follow JS (see
53
+ * `isTruthy`): a nested object is a `Record<Unknown>` stored in the `Unknown`.
54
+ */
55
+ export declare function parseUserAgentRuntime(win?: Readonly<Record<Unknown>>): PlatformRuntime;
56
+ /**
57
+ * The raw dotted OS version for `name`: "" for `Linux` (no kernel version in a browser UA), for
58
+ * the `Web` fallback, and when `name` is not the platform the UA describes; otherwise
59
+ * `parseUserAgentOsVersion`.
60
+ */
10
61
  export declare function parseUserAgentVersion(ua: string, name: PlatformName): string;
11
62
  //# sourceMappingURL=userAgent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"userAgent.d.ts","sourceRoot":"","sources":["../src/userAgent.ts"],"names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