@blotch/rsbuild-plugin-angular-lynx 22.2.6 → 22.2.7
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
|
@@ -36,6 +36,7 @@ export default defineConfig({
|
|
|
36
36
|
- Runs Tailwind CSS 3 from a `tailwind.config.*`, and rewrites the CSS Tailwind CSS 4 writes (layers, `@property`, nesting, `oklch()` and `color-mix()`, logical properties, `translate`/`rotate`/`scale`) into CSS Lynx reads, for the device and the web preview alike. See [Tailwind CSS](https://angularlynx.js.org/guide/tailwindcss)
|
|
37
37
|
- Registers `CUSTOM_ELEMENTS_SCHEMA` so Angular accepts Lynx elements (`<view>`, `<text>`, etc.)
|
|
38
38
|
- Enforces the build target's `budgets` with `ng build`'s units and messages: a warning is printed, an error fails the build
|
|
39
|
+
- Applies the build target's `fileReplacements`, as Angular's builders do: both threads' bundles are built from each `with` file instead of its `replace` file, and a watch build rebuilds when it changes
|
|
39
40
|
|
|
40
41
|
## Budgets
|
|
41
42
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
|
|
2
|
+
/**
|
|
3
|
+
* Swaps each of angular.json's `fileReplacements` into the bundle: a module
|
|
4
|
+
* that resolves to a `replace` file is built from its `with` file instead.
|
|
5
|
+
*
|
|
6
|
+
* Angular's compiler host only redirects TypeScript's module resolution (see
|
|
7
|
+
* `fileReplacements` in angular.ts), so the compiled program type-checks and
|
|
8
|
+
* emits the `with` file. The compiled code still imports the `replace` path,
|
|
9
|
+
* though, and the bundler resolves imports itself. Angular's own builders
|
|
10
|
+
* redirect them too: the esbuild one when it loads the module (TypeScript,
|
|
11
|
+
* JavaScript and JSON files), and the webpack one, which this mirrors, with a
|
|
12
|
+
* `NormalModuleReplacementPlugin` for each replacement.
|
|
13
|
+
*
|
|
14
|
+
* Replacing the module rather than its contents makes rspack treat the `with`
|
|
15
|
+
* file as the module: its own imports resolve from its folder, wherever it is
|
|
16
|
+
* (`../common/environments/environment.prod.ts`), the loader finds its
|
|
17
|
+
* compiled output, and a watch build rebuilds when it changes. Every
|
|
18
|
+
* environment gets the plugins, and every module request goes through them,
|
|
19
|
+
* so both threads' bundles and the generated background entry get the `with`
|
|
20
|
+
* file.
|
|
21
|
+
*
|
|
22
|
+
* @param fileReplacements - The `replace` files' absolute paths, mapped to
|
|
23
|
+
* their `with` files' (`normalizeBuildOptions`).
|
|
24
|
+
*/
|
|
25
|
+
export declare const applyFileReplacements: (api: Pick<RsbuildPluginAPI, "modifyBundlerChain">, fileReplacements: Readonly<Record<string, string>> | undefined) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -638,6 +638,17 @@ const applyBudgets = (api, { budgets, componentStyleSizes, underAngularCli })=>{
|
|
|
638
638
|
]);
|
|
639
639
|
});
|
|
640
640
|
};
|
|
641
|
+
const file_replacements_PLUGIN_NAME = 'lynx:angular:file-replacement';
|
|
642
|
+
const exactPath = (file)=>new RegExp(`^${file.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&')}$`);
|
|
643
|
+
const applyFileReplacements = (api, fileReplacements)=>{
|
|
644
|
+
if (!fileReplacements) return;
|
|
645
|
+
api.modifyBundlerChain((chain, { rspack })=>{
|
|
646
|
+
for (const [replace, replacement] of Object.entries(fileReplacements))chain.plugin(`${file_replacements_PLUGIN_NAME}:${replace}`).use(rspack.NormalModuleReplacementPlugin, [
|
|
647
|
+
exactPath(replace),
|
|
648
|
+
replacement
|
|
649
|
+
]);
|
|
650
|
+
});
|
|
651
|
+
};
|
|
641
652
|
const injectLynxSchema = (source)=>{
|
|
642
653
|
if (source.includes('CUSTOM_ELEMENTS_SCHEMA') || source.includes('NO_ERRORS_SCHEMA')) return source;
|
|
643
654
|
const importLine = `import { CUSTOM_ELEMENTS_SCHEMA as __LynxCES__ } from '@angular/core';\n`;
|
|
@@ -1719,6 +1730,7 @@ const applyAngularRules = async (api, pluginOptions, backgroundEntries, appEntri
|
|
|
1719
1730
|
cli
|
|
1720
1731
|
});
|
|
1721
1732
|
applyAngularConfig(api, buildOptions);
|
|
1733
|
+
applyFileReplacements(api, buildOptions.fileReplacements);
|
|
1722
1734
|
const componentStyleSizes = new Map();
|
|
1723
1735
|
applyBudgets(api, {
|
|
1724
1736
|
budgets: buildOptions.budgets,
|
|
@@ -1771,6 +1783,7 @@ const applyAngularRules = async (api, pluginOptions, backgroundEntries, appEntri
|
|
|
1771
1783
|
result = await compilation.initialize(tsconfig, {
|
|
1772
1784
|
processWebWorker: (workerFile, _containingFile)=>workerFile,
|
|
1773
1785
|
transformStylesheet,
|
|
1786
|
+
fileReplacements: buildOptions.fileReplacements,
|
|
1774
1787
|
modifiedFiles: changedFiles && new Set([
|
|
1775
1788
|
...changedFiles
|
|
1776
1789
|
].filter((file)=>!seededFiles.has(file)))
|
package/dist/polyfills.js
CHANGED
|
@@ -1,3 +1,1147 @@
|
|
|
1
|
+
const definePolyfillOverride = (target, name, value)=>{
|
|
2
|
+
Object.defineProperty(target, name, {
|
|
3
|
+
value,
|
|
4
|
+
writable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
enumerable: false
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
const definePolyfill = (target, name, value)=>{
|
|
10
|
+
if (target && 'function' != typeof target[name]) definePolyfillOverride(target, name, value);
|
|
11
|
+
};
|
|
12
|
+
const definePolyfills = (target, methods)=>{
|
|
13
|
+
for (const name of Object.keys(methods))definePolyfill(target, name, methods[name]);
|
|
14
|
+
};
|
|
15
|
+
const isObject = (value)=>'object' == typeof value && null !== value || 'function' == typeof value;
|
|
16
|
+
const requireCallable = (value)=>{
|
|
17
|
+
if ('function' != typeof value) throw new TypeError('Expected a function');
|
|
18
|
+
return value;
|
|
19
|
+
};
|
|
20
|
+
const toObject = (value)=>{
|
|
21
|
+
if (null == value) throw new TypeError('Cannot convert undefined or null to object');
|
|
22
|
+
return Object(value);
|
|
23
|
+
};
|
|
24
|
+
const toThisString = (value)=>String(toObject(value));
|
|
25
|
+
const toIntegerOrInfinity = (value)=>Math.trunc(+value) || 0;
|
|
26
|
+
const lengthOf = (object)=>Math.min(Math.max(toIntegerOrInfinity(object.length), 0), Number.MAX_SAFE_INTEGER);
|
|
27
|
+
const isConstructor = (value)=>{
|
|
28
|
+
if ('function' != typeof value) return false;
|
|
29
|
+
try {
|
|
30
|
+
Reflect.construct(String, [], value);
|
|
31
|
+
return true;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const createDataProperty = (object, key, value)=>{
|
|
37
|
+
Object.defineProperty(object, key, {
|
|
38
|
+
value,
|
|
39
|
+
writable: true,
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const iteratorRecord = (iterator)=>({
|
|
45
|
+
iterator,
|
|
46
|
+
next: iterator.next
|
|
47
|
+
});
|
|
48
|
+
const DONE = {};
|
|
49
|
+
const stepValue = (record)=>{
|
|
50
|
+
const result = record.next.call(record.iterator);
|
|
51
|
+
if (!isObject(result)) throw new TypeError('Iterator result is not an object');
|
|
52
|
+
return result.done ? DONE : result.value;
|
|
53
|
+
};
|
|
54
|
+
const closeIterator = (iterator)=>{
|
|
55
|
+
const method = iterator.return;
|
|
56
|
+
if (null == method) return;
|
|
57
|
+
if (!isObject(requireCallable(method).call(iterator))) throw new TypeError('Iterator result is not an object');
|
|
58
|
+
};
|
|
59
|
+
const closeAndThrow = (iterator, error)=>{
|
|
60
|
+
try {
|
|
61
|
+
const method = iterator.return;
|
|
62
|
+
if (null != method) method.call(iterator);
|
|
63
|
+
} catch {}
|
|
64
|
+
throw error;
|
|
65
|
+
};
|
|
66
|
+
const relativeIndex = (object, index)=>{
|
|
67
|
+
const length = lengthOf(object);
|
|
68
|
+
let n = toIntegerOrInfinity(index);
|
|
69
|
+
if (n < 0) n += length;
|
|
70
|
+
if (n < 0 || n >= length) return;
|
|
71
|
+
return 'string' == typeof object ? object.charAt(n) : object[n];
|
|
72
|
+
};
|
|
73
|
+
const requireComparator = (comparator)=>{
|
|
74
|
+
if (void 0 !== comparator && 'function' != typeof comparator) throw new TypeError('The comparison function must be a function');
|
|
75
|
+
};
|
|
76
|
+
const createArray = (length)=>{
|
|
77
|
+
const array = [];
|
|
78
|
+
array.length = length;
|
|
79
|
+
return array;
|
|
80
|
+
};
|
|
81
|
+
const copyArrayLike = (object, length)=>{
|
|
82
|
+
const copy = createArray(length);
|
|
83
|
+
for(let index = 0; index < length; index++)copy[index] = object[index];
|
|
84
|
+
return copy;
|
|
85
|
+
};
|
|
86
|
+
const actualIndex = (index, length)=>{
|
|
87
|
+
const relative = toIntegerOrInfinity(index);
|
|
88
|
+
const actual = relative < 0 ? length + relative : relative;
|
|
89
|
+
if (actual < 0 || actual >= length) throw new RangeError('Invalid index');
|
|
90
|
+
return actual;
|
|
91
|
+
};
|
|
92
|
+
definePolyfills(Array.prototype, {
|
|
93
|
+
at (index) {
|
|
94
|
+
return relativeIndex(toObject(this), index);
|
|
95
|
+
},
|
|
96
|
+
findLast (predicate) {
|
|
97
|
+
const object = toObject(this);
|
|
98
|
+
const length = lengthOf(object);
|
|
99
|
+
requireCallable(predicate);
|
|
100
|
+
const thisArg = arguments[1];
|
|
101
|
+
for(let index = length - 1; index >= 0; index--){
|
|
102
|
+
const value = object[index];
|
|
103
|
+
if (predicate.call(thisArg, value, index, object)) return value;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
findLastIndex (predicate) {
|
|
107
|
+
const object = toObject(this);
|
|
108
|
+
const length = lengthOf(object);
|
|
109
|
+
requireCallable(predicate);
|
|
110
|
+
const thisArg = arguments[1];
|
|
111
|
+
for(let index = length - 1; index >= 0; index--)if (predicate.call(thisArg, object[index], index, object)) return index;
|
|
112
|
+
return -1;
|
|
113
|
+
},
|
|
114
|
+
toReversed () {
|
|
115
|
+
const object = toObject(this);
|
|
116
|
+
const length = lengthOf(object);
|
|
117
|
+
const result = createArray(length);
|
|
118
|
+
for(let index = 0; index < length; index++)result[index] = object[length - 1 - index];
|
|
119
|
+
return result;
|
|
120
|
+
},
|
|
121
|
+
toSorted (comparator) {
|
|
122
|
+
requireComparator(comparator);
|
|
123
|
+
const object = toObject(this);
|
|
124
|
+
return copyArrayLike(object, lengthOf(object)).sort(comparator);
|
|
125
|
+
},
|
|
126
|
+
toSpliced (start, skipCount) {
|
|
127
|
+
const object = toObject(this);
|
|
128
|
+
const length = lengthOf(object);
|
|
129
|
+
const relativeStart = toIntegerOrInfinity(start);
|
|
130
|
+
const actualStart = relativeStart < 0 ? Math.max(length + relativeStart, 0) : Math.min(relativeStart, length);
|
|
131
|
+
const actualSkipCount = 0 === arguments.length ? 0 : 1 === arguments.length ? length - actualStart : Math.min(Math.max(toIntegerOrInfinity(skipCount), 0), length - actualStart);
|
|
132
|
+
const newLength = length + Math.max(arguments.length - 2, 0) - actualSkipCount;
|
|
133
|
+
if (newLength > Number.MAX_SAFE_INTEGER) throw new TypeError('Invalid array length');
|
|
134
|
+
const result = createArray(newLength);
|
|
135
|
+
let to = 0;
|
|
136
|
+
for(let from = 0; from < actualStart; from++)result[to++] = object[from];
|
|
137
|
+
for(let item = 2; item < arguments.length; item++)result[to++] = arguments[item];
|
|
138
|
+
for(let from = actualStart + actualSkipCount; from < length; from++)result[to++] = object[from];
|
|
139
|
+
return result;
|
|
140
|
+
},
|
|
141
|
+
with (index, value) {
|
|
142
|
+
const object = toObject(this);
|
|
143
|
+
const length = lengthOf(object);
|
|
144
|
+
const actual = actualIndex(index, length);
|
|
145
|
+
const result = createArray(length);
|
|
146
|
+
for(let k = 0; k < length; k++)result[k] = k === actual ? value : object[k];
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
const TypedArrayPrototype = 'function' == typeof Int8Array ? Object.getPrototypeOf(Int8Array.prototype) : void 0;
|
|
151
|
+
const typedArrayName = TypedArrayPrototype && Object.getOwnPropertyDescriptor(TypedArrayPrototype, Symbol.toStringTag).get;
|
|
152
|
+
const typedArrayLength = TypedArrayPrototype && Object.getOwnPropertyDescriptor(TypedArrayPrototype, 'length').get;
|
|
153
|
+
const typedArrayKind = (value)=>{
|
|
154
|
+
const name = typedArrayName.call(value);
|
|
155
|
+
if (void 0 === name) throw new TypeError('Expected a typed array');
|
|
156
|
+
return globalThis[name];
|
|
157
|
+
};
|
|
158
|
+
if (TypedArrayPrototype) definePolyfills(TypedArrayPrototype, {
|
|
159
|
+
at (index) {
|
|
160
|
+
typedArrayKind(this);
|
|
161
|
+
return relativeIndex(this, index);
|
|
162
|
+
},
|
|
163
|
+
toReversed () {
|
|
164
|
+
const Kind = typedArrayKind(this);
|
|
165
|
+
const length = typedArrayLength.call(this);
|
|
166
|
+
const result = new Kind(length);
|
|
167
|
+
for(let index = 0; index < length; index++)result[index] = this[length - 1 - index];
|
|
168
|
+
return result;
|
|
169
|
+
},
|
|
170
|
+
toSorted (comparator) {
|
|
171
|
+
requireComparator(comparator);
|
|
172
|
+
const Kind = typedArrayKind(this);
|
|
173
|
+
const length = typedArrayLength.call(this);
|
|
174
|
+
const result = new Kind(length);
|
|
175
|
+
for(let index = 0; index < length; index++)result[index] = this[index];
|
|
176
|
+
return result.sort(comparator);
|
|
177
|
+
},
|
|
178
|
+
with (index, value) {
|
|
179
|
+
const Kind = typedArrayKind(this);
|
|
180
|
+
const length = typedArrayLength.call(this);
|
|
181
|
+
const relative = toIntegerOrInfinity(index);
|
|
182
|
+
const actual = relative < 0 ? length + relative : relative;
|
|
183
|
+
const converted = new Kind(1);
|
|
184
|
+
converted[0] = value;
|
|
185
|
+
if (actual < 0 || actual >= length) throw new RangeError('Invalid index');
|
|
186
|
+
const result = new Kind(length);
|
|
187
|
+
for(let k = 0; k < length; k++)result[k] = k === actual ? converted[0] : this[k];
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const loneSurrogateIndex = (string, from)=>{
|
|
192
|
+
for(let index = from; index < string.length; index++){
|
|
193
|
+
const code = string.charCodeAt(index);
|
|
194
|
+
if (!(code < 0xd800) && !(code > 0xdfff)) {
|
|
195
|
+
if (code <= 0xdbff) {
|
|
196
|
+
const next = string.charCodeAt(index + 1);
|
|
197
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
198
|
+
index++;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return index;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return -1;
|
|
206
|
+
};
|
|
207
|
+
definePolyfills(String.prototype, {
|
|
208
|
+
at (index) {
|
|
209
|
+
return relativeIndex(toThisString(this), index);
|
|
210
|
+
},
|
|
211
|
+
isWellFormed () {
|
|
212
|
+
return -1 === loneSurrogateIndex(toThisString(this), 0);
|
|
213
|
+
},
|
|
214
|
+
toWellFormed () {
|
|
215
|
+
const string = toThisString(this);
|
|
216
|
+
let result = '';
|
|
217
|
+
let start = 0;
|
|
218
|
+
for(let index = loneSurrogateIndex(string, 0); -1 !== index; index = loneSurrogateIndex(string, start)){
|
|
219
|
+
result += string.slice(start, index) + '\uFFFD';
|
|
220
|
+
start = index + 1;
|
|
221
|
+
}
|
|
222
|
+
return result + string.slice(start);
|
|
223
|
+
},
|
|
224
|
+
replaceAll (search, replacement) {
|
|
225
|
+
const subject = toThisString(this);
|
|
226
|
+
if (search instanceof RegExp) {
|
|
227
|
+
if (!search.global) throw new TypeError('replaceAll must be called with a global RegExp');
|
|
228
|
+
return subject.replace(search, replacement);
|
|
229
|
+
}
|
|
230
|
+
const pattern = new RegExp(String(search).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
|
|
231
|
+
return subject.replace(pattern, replacement);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const groupItems = (items, callback, add)=>{
|
|
235
|
+
if (null == items) throw new TypeError('Cannot group undefined or null');
|
|
236
|
+
requireCallable(callback);
|
|
237
|
+
let index = 0;
|
|
238
|
+
for (const item of items)add(callback(item, index++), item);
|
|
239
|
+
};
|
|
240
|
+
definePolyfills(Object, {
|
|
241
|
+
groupBy (items, callback) {
|
|
242
|
+
const groups = Object.create(null);
|
|
243
|
+
groupItems(items, callback, (key, item)=>{
|
|
244
|
+
const property = 'symbol' == typeof key ? key : String(key);
|
|
245
|
+
const group = groups[property];
|
|
246
|
+
if (group) group.push(item);
|
|
247
|
+
else groups[property] = [
|
|
248
|
+
item
|
|
249
|
+
];
|
|
250
|
+
});
|
|
251
|
+
return groups;
|
|
252
|
+
},
|
|
253
|
+
hasOwn (object, key) {
|
|
254
|
+
return Object.prototype.hasOwnProperty.call(toObject(object), key);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
definePolyfills(Map, {
|
|
258
|
+
groupBy (items, callback) {
|
|
259
|
+
const groups = new Map();
|
|
260
|
+
groupItems(items, callback, (key, item)=>{
|
|
261
|
+
const group = groups.get(key);
|
|
262
|
+
if (group) group.push(item);
|
|
263
|
+
else groups.set(key, [
|
|
264
|
+
item
|
|
265
|
+
]);
|
|
266
|
+
});
|
|
267
|
+
return groups;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
const promiseCapability = (Constructor)=>{
|
|
271
|
+
let resolve;
|
|
272
|
+
let reject;
|
|
273
|
+
const promise = new Constructor((resolveFn, rejectFn)=>{
|
|
274
|
+
resolve = resolveFn;
|
|
275
|
+
reject = rejectFn;
|
|
276
|
+
});
|
|
277
|
+
return {
|
|
278
|
+
promise,
|
|
279
|
+
resolve,
|
|
280
|
+
reject
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
definePolyfills(Promise, {
|
|
284
|
+
allSettled (promises) {
|
|
285
|
+
return this.all(Array.from(promises, (promise)=>this.resolve(promise).then((value)=>({
|
|
286
|
+
status: 'fulfilled',
|
|
287
|
+
value
|
|
288
|
+
}), (reason)=>({
|
|
289
|
+
status: 'rejected',
|
|
290
|
+
reason
|
|
291
|
+
}))));
|
|
292
|
+
},
|
|
293
|
+
any (promises) {
|
|
294
|
+
const capability = promiseCapability(this);
|
|
295
|
+
try {
|
|
296
|
+
const resolve = requireCallable(this.resolve);
|
|
297
|
+
const errors = [];
|
|
298
|
+
let remaining = 1;
|
|
299
|
+
const rejectIfAllRejected = ()=>{
|
|
300
|
+
if (0 === --remaining) capability.reject(new AggregateError(errors, 'All promises were rejected'));
|
|
301
|
+
};
|
|
302
|
+
for (const promise of promises){
|
|
303
|
+
const index = errors.length;
|
|
304
|
+
errors.push(void 0);
|
|
305
|
+
remaining++;
|
|
306
|
+
let rejected = false;
|
|
307
|
+
resolve.call(this, promise).then(capability.resolve, (error)=>{
|
|
308
|
+
if (rejected) return;
|
|
309
|
+
rejected = true;
|
|
310
|
+
errors[index] = error;
|
|
311
|
+
rejectIfAllRejected();
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
rejectIfAllRejected();
|
|
315
|
+
} catch (error) {
|
|
316
|
+
capability.reject(error);
|
|
317
|
+
}
|
|
318
|
+
return capability.promise;
|
|
319
|
+
},
|
|
320
|
+
withResolvers () {
|
|
321
|
+
return promiseCapability(this);
|
|
322
|
+
},
|
|
323
|
+
try (callback, ...args) {
|
|
324
|
+
const capability = promiseCapability(this);
|
|
325
|
+
let value;
|
|
326
|
+
try {
|
|
327
|
+
value = callback(...args);
|
|
328
|
+
} catch (error) {
|
|
329
|
+
capability.reject(error);
|
|
330
|
+
return capability.promise;
|
|
331
|
+
}
|
|
332
|
+
capability.resolve(value);
|
|
333
|
+
return capability.promise;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
const fromAsync = async (Constructor, items, mapper, thisArg)=>{
|
|
337
|
+
if (void 0 !== mapper) requireCallable(mapper);
|
|
338
|
+
const isAsync = null != items[Symbol.asyncIterator];
|
|
339
|
+
if (isAsync || null != items[Symbol.iterator]) {
|
|
340
|
+
const result = isConstructor(Constructor) ? new Constructor() : [];
|
|
341
|
+
let index = 0;
|
|
342
|
+
const add = async (value)=>{
|
|
343
|
+
createDataProperty(result, index, void 0 === mapper ? value : await mapper.call(thisArg, value, index));
|
|
344
|
+
index++;
|
|
345
|
+
};
|
|
346
|
+
if (isAsync) for await (const value of items)await add(value);
|
|
347
|
+
else for (const value of items)await add(await value);
|
|
348
|
+
result.length = index;
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
351
|
+
const arrayLike = Object(items);
|
|
352
|
+
const length = lengthOf(arrayLike);
|
|
353
|
+
const result = isConstructor(Constructor) ? new Constructor(length) : createArray(length);
|
|
354
|
+
for(let index = 0; index < length; index++){
|
|
355
|
+
const value = await arrayLike[index];
|
|
356
|
+
createDataProperty(result, index, void 0 === mapper ? value : await mapper.call(thisArg, value, index));
|
|
357
|
+
}
|
|
358
|
+
result.length = length;
|
|
359
|
+
return result;
|
|
360
|
+
};
|
|
361
|
+
definePolyfills(Array, {
|
|
362
|
+
fromAsync (items) {
|
|
363
|
+
return fromAsync(this, items, arguments[1], arguments[2]);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
const setSize = Object.getOwnPropertyDescriptor(Set.prototype, 'size').get;
|
|
367
|
+
const setHas = Set.prototype.has;
|
|
368
|
+
const setAdd = Set.prototype.add;
|
|
369
|
+
const setDelete = Set.prototype.delete;
|
|
370
|
+
const setValues = Set.prototype.values;
|
|
371
|
+
const getSetRecord = (other)=>{
|
|
372
|
+
if (!isObject(other)) throw new TypeError('Expected a set-like object');
|
|
373
|
+
const size = +other.size;
|
|
374
|
+
if (size !== size) throw new TypeError("The set-like's size is not a number");
|
|
375
|
+
const integerSize = toIntegerOrInfinity(size);
|
|
376
|
+
if (integerSize < 0) throw new RangeError("The set-like's size is negative");
|
|
377
|
+
const has = requireCallable(other.has);
|
|
378
|
+
const keys = requireCallable(other.keys);
|
|
379
|
+
return {
|
|
380
|
+
set: other,
|
|
381
|
+
size: integerSize,
|
|
382
|
+
has,
|
|
383
|
+
keys
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
const copySet = (set)=>{
|
|
387
|
+
const copy = new Set();
|
|
388
|
+
for (const value of setValues.call(set))setAdd.call(copy, value);
|
|
389
|
+
return copy;
|
|
390
|
+
};
|
|
391
|
+
const keysOf = (record)=>{
|
|
392
|
+
const iterator = record.keys.call(record.set);
|
|
393
|
+
if (!isObject(iterator)) throw new TypeError('keys() must return an object');
|
|
394
|
+
return iteratorRecord(iterator);
|
|
395
|
+
};
|
|
396
|
+
const someKey = (keys, visit)=>{
|
|
397
|
+
for(let key = stepValue(keys); key !== DONE; key = stepValue(keys))if (visit(0 === key ? 0 : key)) {
|
|
398
|
+
closeIterator(keys.iterator);
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
return false;
|
|
402
|
+
};
|
|
403
|
+
definePolyfills(Set.prototype, {
|
|
404
|
+
union (other) {
|
|
405
|
+
setSize.call(this);
|
|
406
|
+
const keys = keysOf(getSetRecord(other));
|
|
407
|
+
const result = copySet(this);
|
|
408
|
+
someKey(keys, (key)=>{
|
|
409
|
+
setAdd.call(result, key);
|
|
410
|
+
});
|
|
411
|
+
return result;
|
|
412
|
+
},
|
|
413
|
+
intersection (other) {
|
|
414
|
+
const size = setSize.call(this);
|
|
415
|
+
const record = getSetRecord(other);
|
|
416
|
+
const result = new Set();
|
|
417
|
+
if (size <= record.size) {
|
|
418
|
+
for (const value of setValues.call(this))if (record.has.call(record.set, value)) setAdd.call(result, value);
|
|
419
|
+
} else someKey(keysOf(record), (key)=>{
|
|
420
|
+
if (setHas.call(this, key)) setAdd.call(result, key);
|
|
421
|
+
});
|
|
422
|
+
return result;
|
|
423
|
+
},
|
|
424
|
+
difference (other) {
|
|
425
|
+
const size = setSize.call(this);
|
|
426
|
+
const record = getSetRecord(other);
|
|
427
|
+
const result = copySet(this);
|
|
428
|
+
if (size <= record.size) {
|
|
429
|
+
for (const value of setValues.call(result))if (record.has.call(record.set, value)) setDelete.call(result, value);
|
|
430
|
+
} else someKey(keysOf(record), (key)=>{
|
|
431
|
+
setDelete.call(result, key);
|
|
432
|
+
});
|
|
433
|
+
return result;
|
|
434
|
+
},
|
|
435
|
+
symmetricDifference (other) {
|
|
436
|
+
setSize.call(this);
|
|
437
|
+
const keys = keysOf(getSetRecord(other));
|
|
438
|
+
const result = copySet(this);
|
|
439
|
+
someKey(keys, (key)=>{
|
|
440
|
+
if (setHas.call(this, key)) setDelete.call(result, key);
|
|
441
|
+
else setAdd.call(result, key);
|
|
442
|
+
});
|
|
443
|
+
return result;
|
|
444
|
+
},
|
|
445
|
+
isSubsetOf (other) {
|
|
446
|
+
const size = setSize.call(this);
|
|
447
|
+
const record = getSetRecord(other);
|
|
448
|
+
if (size > record.size) return false;
|
|
449
|
+
for (const value of setValues.call(this))if (!record.has.call(record.set, value)) return false;
|
|
450
|
+
return true;
|
|
451
|
+
},
|
|
452
|
+
isSupersetOf (other) {
|
|
453
|
+
const size = setSize.call(this);
|
|
454
|
+
const record = getSetRecord(other);
|
|
455
|
+
if (size < record.size) return false;
|
|
456
|
+
return !someKey(keysOf(record), (key)=>!setHas.call(this, key));
|
|
457
|
+
},
|
|
458
|
+
isDisjointFrom (other) {
|
|
459
|
+
const size = setSize.call(this);
|
|
460
|
+
const record = getSetRecord(other);
|
|
461
|
+
if (size <= record.size) {
|
|
462
|
+
for (const value of setValues.call(this))if (record.has.call(record.set, value)) return false;
|
|
463
|
+
return true;
|
|
464
|
+
}
|
|
465
|
+
return !someKey(keysOf(record), (key)=>setHas.call(this, key));
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
const IteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
|
469
|
+
const iteratorOrIterable = (value, allowStrings)=>{
|
|
470
|
+
if (!isObject(value) && !(allowStrings && 'string' == typeof value)) throw new TypeError('Expected an iterator or an iterable');
|
|
471
|
+
const method = value[Symbol.iterator];
|
|
472
|
+
const iterator = null == method ? value : requireCallable(method).call(value);
|
|
473
|
+
if (!isObject(iterator)) throw new TypeError('Expected an iterator');
|
|
474
|
+
return iteratorRecord(iterator);
|
|
475
|
+
};
|
|
476
|
+
const IteratorHelperPrototype = Object.create(IteratorPrototype);
|
|
477
|
+
const helperStates = new WeakMap();
|
|
478
|
+
const createHelper = (step, close)=>{
|
|
479
|
+
const helper = Object.create(IteratorHelperPrototype);
|
|
480
|
+
helperStates.set(helper, {
|
|
481
|
+
step,
|
|
482
|
+
close,
|
|
483
|
+
running: false,
|
|
484
|
+
done: false
|
|
485
|
+
});
|
|
486
|
+
return helper;
|
|
487
|
+
};
|
|
488
|
+
const helperState = (helper)=>{
|
|
489
|
+
const state = helperStates.get(helper);
|
|
490
|
+
if (!state) throw new TypeError('Expected an Iterator Helper');
|
|
491
|
+
if (state.running) throw new TypeError('Iterator Helper is already running');
|
|
492
|
+
return state;
|
|
493
|
+
};
|
|
494
|
+
definePolyfills(IteratorHelperPrototype, {
|
|
495
|
+
next () {
|
|
496
|
+
const state = helperState(this);
|
|
497
|
+
if (state.done) return {
|
|
498
|
+
value: void 0,
|
|
499
|
+
done: true
|
|
500
|
+
};
|
|
501
|
+
state.running = true;
|
|
502
|
+
let value;
|
|
503
|
+
try {
|
|
504
|
+
value = state.step();
|
|
505
|
+
} catch (error) {
|
|
506
|
+
state.done = true;
|
|
507
|
+
throw error;
|
|
508
|
+
} finally{
|
|
509
|
+
state.running = false;
|
|
510
|
+
}
|
|
511
|
+
if (value === DONE) {
|
|
512
|
+
state.done = true;
|
|
513
|
+
return {
|
|
514
|
+
value: void 0,
|
|
515
|
+
done: true
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
value,
|
|
520
|
+
done: false
|
|
521
|
+
};
|
|
522
|
+
},
|
|
523
|
+
return () {
|
|
524
|
+
const state = helperState(this);
|
|
525
|
+
if (!state.done) {
|
|
526
|
+
state.done = true;
|
|
527
|
+
state.close();
|
|
528
|
+
}
|
|
529
|
+
return {
|
|
530
|
+
value: void 0,
|
|
531
|
+
done: true
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
Object.defineProperty(IteratorHelperPrototype, Symbol.toStringTag, {
|
|
536
|
+
value: 'Iterator Helper',
|
|
537
|
+
configurable: true
|
|
538
|
+
});
|
|
539
|
+
const thisIterator = (value)=>{
|
|
540
|
+
if (!isObject(value)) throw new TypeError('Expected an iterator object');
|
|
541
|
+
return value;
|
|
542
|
+
};
|
|
543
|
+
const callableOrClose = (iterator, value)=>{
|
|
544
|
+
if ('function' != typeof value) closeAndThrow(iterator, new TypeError('Expected a function'));
|
|
545
|
+
};
|
|
546
|
+
const limitOrClose = (iterator, limit)=>{
|
|
547
|
+
let number;
|
|
548
|
+
try {
|
|
549
|
+
number = +limit;
|
|
550
|
+
} catch (error) {
|
|
551
|
+
closeAndThrow(iterator, error);
|
|
552
|
+
}
|
|
553
|
+
const integer = toIntegerOrInfinity(number);
|
|
554
|
+
if (number !== number || integer < 0) closeAndThrow(iterator, new RangeError('Expected a non-negative limit'));
|
|
555
|
+
return integer;
|
|
556
|
+
};
|
|
557
|
+
const findMatch = (receiver, predicate, wanted)=>{
|
|
558
|
+
const iterator = thisIterator(receiver);
|
|
559
|
+
callableOrClose(iterator, predicate);
|
|
560
|
+
const record = iteratorRecord(iterator);
|
|
561
|
+
let counter = 0;
|
|
562
|
+
for(let value = stepValue(record); value !== DONE; value = stepValue(record)){
|
|
563
|
+
let result;
|
|
564
|
+
try {
|
|
565
|
+
result = predicate(value, counter++);
|
|
566
|
+
} catch (error) {
|
|
567
|
+
closeAndThrow(iterator, error);
|
|
568
|
+
}
|
|
569
|
+
if (!!result === wanted) {
|
|
570
|
+
closeIterator(iterator);
|
|
571
|
+
return {
|
|
572
|
+
value
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
definePolyfills(IteratorPrototype, {
|
|
578
|
+
map (mapper) {
|
|
579
|
+
const iterator = thisIterator(this);
|
|
580
|
+
callableOrClose(iterator, mapper);
|
|
581
|
+
const record = iteratorRecord(iterator);
|
|
582
|
+
let counter = 0;
|
|
583
|
+
return createHelper(()=>{
|
|
584
|
+
const value = stepValue(record);
|
|
585
|
+
if (value === DONE) return DONE;
|
|
586
|
+
try {
|
|
587
|
+
return mapper(value, counter++);
|
|
588
|
+
} catch (error) {
|
|
589
|
+
closeAndThrow(iterator, error);
|
|
590
|
+
}
|
|
591
|
+
}, ()=>closeIterator(iterator));
|
|
592
|
+
},
|
|
593
|
+
filter (predicate) {
|
|
594
|
+
const iterator = thisIterator(this);
|
|
595
|
+
callableOrClose(iterator, predicate);
|
|
596
|
+
const record = iteratorRecord(iterator);
|
|
597
|
+
let counter = 0;
|
|
598
|
+
return createHelper(()=>{
|
|
599
|
+
for(;;){
|
|
600
|
+
const value = stepValue(record);
|
|
601
|
+
if (value === DONE) return DONE;
|
|
602
|
+
let selected;
|
|
603
|
+
try {
|
|
604
|
+
selected = predicate(value, counter++);
|
|
605
|
+
} catch (error) {
|
|
606
|
+
closeAndThrow(iterator, error);
|
|
607
|
+
}
|
|
608
|
+
if (selected) return value;
|
|
609
|
+
}
|
|
610
|
+
}, ()=>closeIterator(iterator));
|
|
611
|
+
},
|
|
612
|
+
take (limit) {
|
|
613
|
+
const iterator = thisIterator(this);
|
|
614
|
+
let remaining = limitOrClose(iterator, limit);
|
|
615
|
+
const record = iteratorRecord(iterator);
|
|
616
|
+
return createHelper(()=>{
|
|
617
|
+
if (0 === remaining) {
|
|
618
|
+
closeIterator(iterator);
|
|
619
|
+
return DONE;
|
|
620
|
+
}
|
|
621
|
+
if (remaining !== 1 / 0) remaining--;
|
|
622
|
+
return stepValue(record);
|
|
623
|
+
}, ()=>closeIterator(iterator));
|
|
624
|
+
},
|
|
625
|
+
drop (limit) {
|
|
626
|
+
const iterator = thisIterator(this);
|
|
627
|
+
let remaining = limitOrClose(iterator, limit);
|
|
628
|
+
const record = iteratorRecord(iterator);
|
|
629
|
+
return createHelper(()=>{
|
|
630
|
+
while(remaining > 0){
|
|
631
|
+
if (remaining !== 1 / 0) remaining--;
|
|
632
|
+
if (stepValue(record) === DONE) return DONE;
|
|
633
|
+
}
|
|
634
|
+
return stepValue(record);
|
|
635
|
+
}, ()=>closeIterator(iterator));
|
|
636
|
+
},
|
|
637
|
+
flatMap (mapper) {
|
|
638
|
+
const iterator = thisIterator(this);
|
|
639
|
+
callableOrClose(iterator, mapper);
|
|
640
|
+
const record = iteratorRecord(iterator);
|
|
641
|
+
let counter = 0;
|
|
642
|
+
let inner;
|
|
643
|
+
return createHelper(()=>{
|
|
644
|
+
for(;;){
|
|
645
|
+
if (inner) {
|
|
646
|
+
let value;
|
|
647
|
+
try {
|
|
648
|
+
value = stepValue(inner);
|
|
649
|
+
} catch (error) {
|
|
650
|
+
closeAndThrow(iterator, error);
|
|
651
|
+
}
|
|
652
|
+
if (value !== DONE) return value;
|
|
653
|
+
inner = void 0;
|
|
654
|
+
}
|
|
655
|
+
const value = stepValue(record);
|
|
656
|
+
if (value === DONE) return DONE;
|
|
657
|
+
try {
|
|
658
|
+
inner = iteratorOrIterable(mapper(value, counter++), false);
|
|
659
|
+
} catch (error) {
|
|
660
|
+
closeAndThrow(iterator, error);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}, ()=>{
|
|
664
|
+
if (inner) try {
|
|
665
|
+
closeIterator(inner.iterator);
|
|
666
|
+
} catch (error) {
|
|
667
|
+
closeAndThrow(iterator, error);
|
|
668
|
+
}
|
|
669
|
+
closeIterator(iterator);
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
reduce (reducer) {
|
|
673
|
+
const iterator = thisIterator(this);
|
|
674
|
+
callableOrClose(iterator, reducer);
|
|
675
|
+
const record = iteratorRecord(iterator);
|
|
676
|
+
let accumulator;
|
|
677
|
+
let counter = 0;
|
|
678
|
+
if (arguments.length < 2) {
|
|
679
|
+
accumulator = stepValue(record);
|
|
680
|
+
if (accumulator === DONE) throw new TypeError('Reduce of empty iterator with no initial value');
|
|
681
|
+
counter = 1;
|
|
682
|
+
} else accumulator = arguments[1];
|
|
683
|
+
for(let value = stepValue(record); value !== DONE; value = stepValue(record))try {
|
|
684
|
+
accumulator = reducer(accumulator, value, counter++);
|
|
685
|
+
} catch (error) {
|
|
686
|
+
closeAndThrow(iterator, error);
|
|
687
|
+
}
|
|
688
|
+
return accumulator;
|
|
689
|
+
},
|
|
690
|
+
toArray () {
|
|
691
|
+
const record = iteratorRecord(thisIterator(this));
|
|
692
|
+
const items = [];
|
|
693
|
+
for(let value = stepValue(record); value !== DONE; value = stepValue(record))items.push(value);
|
|
694
|
+
return items;
|
|
695
|
+
},
|
|
696
|
+
forEach (callback) {
|
|
697
|
+
const iterator = thisIterator(this);
|
|
698
|
+
callableOrClose(iterator, callback);
|
|
699
|
+
const record = iteratorRecord(iterator);
|
|
700
|
+
let counter = 0;
|
|
701
|
+
for(let value = stepValue(record); value !== DONE; value = stepValue(record))try {
|
|
702
|
+
callback(value, counter++);
|
|
703
|
+
} catch (error) {
|
|
704
|
+
closeAndThrow(iterator, error);
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
some (predicate) {
|
|
708
|
+
return void 0 !== findMatch(this, predicate, true);
|
|
709
|
+
},
|
|
710
|
+
every (predicate) {
|
|
711
|
+
return void 0 === findMatch(this, predicate, false);
|
|
712
|
+
},
|
|
713
|
+
find (predicate) {
|
|
714
|
+
const match = findMatch(this, predicate, true);
|
|
715
|
+
return void 0 === match ? void 0 : match.value;
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
if ('function' != typeof globalThis.Iterator) {
|
|
719
|
+
const Iterator = function Iterator() {
|
|
720
|
+
if (new.target === void 0 || new.target === Iterator) throw new TypeError('Abstract class Iterator not directly constructable');
|
|
721
|
+
};
|
|
722
|
+
Object.defineProperty(Iterator, 'prototype', {
|
|
723
|
+
value: IteratorPrototype,
|
|
724
|
+
writable: false
|
|
725
|
+
});
|
|
726
|
+
definePolyfillOverride(IteratorPrototype, 'constructor', Iterator);
|
|
727
|
+
definePolyfillOverride(IteratorPrototype, Symbol.toStringTag, 'Iterator');
|
|
728
|
+
definePolyfillOverride(globalThis, 'Iterator', Iterator);
|
|
729
|
+
}
|
|
730
|
+
const WrapForValidIteratorPrototype = Object.create(IteratorPrototype);
|
|
731
|
+
const wrappedRecords = new WeakMap();
|
|
732
|
+
const wrappedRecord = (wrapper)=>{
|
|
733
|
+
const record = wrappedRecords.get(wrapper);
|
|
734
|
+
if (!record) throw new TypeError('Expected an iterator from Iterator.from');
|
|
735
|
+
return record;
|
|
736
|
+
};
|
|
737
|
+
definePolyfills(WrapForValidIteratorPrototype, {
|
|
738
|
+
next () {
|
|
739
|
+
const record = wrappedRecord(this);
|
|
740
|
+
return record.next.call(record.iterator);
|
|
741
|
+
},
|
|
742
|
+
return () {
|
|
743
|
+
const { iterator } = wrappedRecord(this);
|
|
744
|
+
const method = iterator.return;
|
|
745
|
+
if (null == method) return {
|
|
746
|
+
value: void 0,
|
|
747
|
+
done: true
|
|
748
|
+
};
|
|
749
|
+
return requireCallable(method).call(iterator);
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
definePolyfills(globalThis.Iterator, {
|
|
753
|
+
from (value) {
|
|
754
|
+
const record = iteratorOrIterable(value, true);
|
|
755
|
+
if (IteratorPrototype.isPrototypeOf(record.iterator)) return record.iterator;
|
|
756
|
+
const wrapper = Object.create(WrapForValidIteratorPrototype);
|
|
757
|
+
wrappedRecords.set(wrapper, record);
|
|
758
|
+
return wrapper;
|
|
759
|
+
},
|
|
760
|
+
concat () {
|
|
761
|
+
const iterables = [];
|
|
762
|
+
for(let index = 0; index < arguments.length; index++){
|
|
763
|
+
const iterable = arguments[index];
|
|
764
|
+
if (!isObject(iterable)) throw new TypeError('Expected an iterable');
|
|
765
|
+
iterables.push({
|
|
766
|
+
iterable,
|
|
767
|
+
open: requireCallable(iterable[Symbol.iterator])
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
let position = 0;
|
|
771
|
+
let current;
|
|
772
|
+
return createHelper(()=>{
|
|
773
|
+
for(;;){
|
|
774
|
+
if (!current) {
|
|
775
|
+
if (position === iterables.length) return DONE;
|
|
776
|
+
const { iterable, open } = iterables[position++];
|
|
777
|
+
const iterator = open.call(iterable);
|
|
778
|
+
if (!isObject(iterator)) throw new TypeError('Expected an iterator');
|
|
779
|
+
current = iteratorRecord(iterator);
|
|
780
|
+
}
|
|
781
|
+
const value = stepValue(current);
|
|
782
|
+
if (value !== DONE) return value;
|
|
783
|
+
current = void 0;
|
|
784
|
+
}
|
|
785
|
+
}, ()=>{
|
|
786
|
+
if (current) closeIterator(current.iterator);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
const CONTROL_ESCAPES = {
|
|
791
|
+
'\t': 't',
|
|
792
|
+
'\n': 'n',
|
|
793
|
+
'\v': 'v',
|
|
794
|
+
'\f': 'f',
|
|
795
|
+
'\r': 'r'
|
|
796
|
+
};
|
|
797
|
+
const hexEscape = (code, digits)=>(2 === digits ? '\\x' : '\\u') + code.toString(16).padStart(digits, '0');
|
|
798
|
+
definePolyfills(RegExp, {
|
|
799
|
+
escape (string) {
|
|
800
|
+
if ('string' != typeof string) throw new TypeError('Expected a string');
|
|
801
|
+
let escaped = '';
|
|
802
|
+
for (const char of string){
|
|
803
|
+
const code = char.codePointAt(0);
|
|
804
|
+
if ('' === escaped && /[0-9A-Za-z]/.test(char)) escaped += hexEscape(code, 2);
|
|
805
|
+
else if ('^$\\.*+?()[]{}|/'.includes(char)) escaped += '\\' + char;
|
|
806
|
+
else if (char in CONTROL_ESCAPES) escaped += '\\' + CONTROL_ESCAPES[char];
|
|
807
|
+
else if (',-=<>#&!%:;@~\'`"'.includes(char) || /[ \u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/.test(char) || code >= 0xd800 && code <= 0xdfff) escaped += code <= 0xff ? hexEscape(code, 2) : hexEscape(code, 4);
|
|
808
|
+
else escaped += char;
|
|
809
|
+
}
|
|
810
|
+
return escaped;
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
const roundHalfEven = (value)=>{
|
|
814
|
+
const floor = Math.floor(value);
|
|
815
|
+
const fraction = value - floor;
|
|
816
|
+
if (0.5 !== fraction) return fraction < 0.5 ? floor : floor + 1;
|
|
817
|
+
return floor % 2 === 0 ? floor : floor + 1;
|
|
818
|
+
};
|
|
819
|
+
const MAX_ULP = 2 ** 971;
|
|
820
|
+
const twoSum = (x, y)=>{
|
|
821
|
+
const high = x + y;
|
|
822
|
+
return {
|
|
823
|
+
high,
|
|
824
|
+
low: y - (high - x)
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
const sumPartials = (partials, overflow)=>{
|
|
828
|
+
let n = partials.length - 1;
|
|
829
|
+
let high = 0;
|
|
830
|
+
let low = 0;
|
|
831
|
+
if (0 !== overflow) {
|
|
832
|
+
const next = n >= 0 ? partials[n] : 0;
|
|
833
|
+
n--;
|
|
834
|
+
if (Math.abs(overflow) > 1 || overflow > 0 && next > 0 || overflow < 0 && next < 0) return overflow > 0 ? 1 / 0 : -1 / 0;
|
|
835
|
+
({ high, low } = twoSum(overflow * 2 ** 1023, next / 2));
|
|
836
|
+
low *= 2;
|
|
837
|
+
if (Math.abs(2 * high) === 1 / 0) {
|
|
838
|
+
if (high > 0) return high === 2 ** 1023 && low === -(MAX_ULP / 2) && n >= 0 && partials[n] < 0 ? Number.MAX_VALUE : 1 / 0;
|
|
839
|
+
return high === -(2 ** 1023) && low === MAX_ULP / 2 && n >= 0 && partials[n] > 0 ? -Number.MAX_VALUE : -1 / 0;
|
|
840
|
+
}
|
|
841
|
+
if (0 !== low) {
|
|
842
|
+
partials[++n] = low;
|
|
843
|
+
low = 0;
|
|
844
|
+
}
|
|
845
|
+
high *= 2;
|
|
846
|
+
}
|
|
847
|
+
while(n >= 0){
|
|
848
|
+
({ high, low } = twoSum(high, partials[n--]));
|
|
849
|
+
if (0 !== low) break;
|
|
850
|
+
}
|
|
851
|
+
if (n >= 0 && (low < 0 && partials[n] < 0 || low > 0 && partials[n] > 0)) {
|
|
852
|
+
const y = 2 * low;
|
|
853
|
+
const x = high + y;
|
|
854
|
+
if (y === x - high) high = x;
|
|
855
|
+
}
|
|
856
|
+
return high;
|
|
857
|
+
};
|
|
858
|
+
definePolyfills(Math, {
|
|
859
|
+
f16round (value) {
|
|
860
|
+
const x = +value;
|
|
861
|
+
if (x !== x || 0 === x || x === 1 / 0 || x === -1 / 0) return x;
|
|
862
|
+
const magnitude = Math.abs(x);
|
|
863
|
+
let exponent = Math.floor(Math.log2(magnitude));
|
|
864
|
+
if (2 ** exponent > magnitude) exponent--;
|
|
865
|
+
else if (2 ** (exponent + 1) <= magnitude) exponent++;
|
|
866
|
+
const step = 2 ** (Math.max(exponent, -14) - 10);
|
|
867
|
+
const rounded = roundHalfEven(magnitude / step) * step;
|
|
868
|
+
const result = rounded > 65504 ? 1 / 0 : rounded;
|
|
869
|
+
return x < 0 ? -result : result;
|
|
870
|
+
},
|
|
871
|
+
sumPrecise (items) {
|
|
872
|
+
if (null == items) throw new TypeError('Expected an iterable of numbers');
|
|
873
|
+
const partials = [];
|
|
874
|
+
let overflow = 0;
|
|
875
|
+
let special = 0;
|
|
876
|
+
let onlyMinusZero = true;
|
|
877
|
+
for (const value of items){
|
|
878
|
+
if ('number' != typeof value) throw new TypeError('Math.sumPrecise expects only numbers');
|
|
879
|
+
if (special === special) {
|
|
880
|
+
if (value !== value) special = NaN;
|
|
881
|
+
else if (value === 1 / 0 || value === -1 / 0) special = special === -value ? NaN : value;
|
|
882
|
+
else if (0 === special && !Object.is(value, -0)) {
|
|
883
|
+
onlyMinusZero = false;
|
|
884
|
+
let x = value;
|
|
885
|
+
let used = 0;
|
|
886
|
+
for(let index = 0; index < partials.length; index++){
|
|
887
|
+
let y = partials[index];
|
|
888
|
+
if (Math.abs(x) < Math.abs(y)) [x, y] = [
|
|
889
|
+
y,
|
|
890
|
+
x
|
|
891
|
+
];
|
|
892
|
+
let { high, low } = twoSum(x, y);
|
|
893
|
+
if (Math.abs(high) === 1 / 0) {
|
|
894
|
+
const sign = high > 0 ? 1 : -1;
|
|
895
|
+
overflow += sign;
|
|
896
|
+
x = x - sign * 2 ** 1023 - sign * 2 ** 1023;
|
|
897
|
+
if (Math.abs(x) < Math.abs(y)) [x, y] = [
|
|
898
|
+
y,
|
|
899
|
+
x
|
|
900
|
+
];
|
|
901
|
+
({ high, low } = twoSum(x, y));
|
|
902
|
+
}
|
|
903
|
+
if (0 !== low) partials[used++] = low;
|
|
904
|
+
x = high;
|
|
905
|
+
}
|
|
906
|
+
partials.length = used;
|
|
907
|
+
if (0 !== x) partials.push(x);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
if (0 !== special) return special;
|
|
912
|
+
return onlyMinusZero ? -0 : sumPartials(partials, overflow);
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
definePolyfills(Error, {
|
|
916
|
+
isError (value) {
|
|
917
|
+
return isObject(value) && '[object Error]' === Object.prototype.toString.call(value);
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
const BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
921
|
+
const BASE64URL = BASE64.slice(0, 62) + '-_';
|
|
922
|
+
const ALPHABETS = [
|
|
923
|
+
'base64',
|
|
924
|
+
'base64url'
|
|
925
|
+
];
|
|
926
|
+
const LAST_CHUNK_HANDLINGS = [
|
|
927
|
+
'loose',
|
|
928
|
+
'strict',
|
|
929
|
+
'stop-before-partial'
|
|
930
|
+
];
|
|
931
|
+
const requireOptions = (options)=>{
|
|
932
|
+
if (void 0 !== options && !isObject(options)) throw new TypeError('Options must be an object');
|
|
933
|
+
};
|
|
934
|
+
const readOption = (options, name, values)=>{
|
|
935
|
+
const value = void 0 === options ? void 0 : options[name];
|
|
936
|
+
if (void 0 === value) return values[0];
|
|
937
|
+
if (!values.includes(value)) throw new TypeError(`Invalid ${name} option`);
|
|
938
|
+
return value;
|
|
939
|
+
};
|
|
940
|
+
const skipAsciiWhitespace = (string, index)=>{
|
|
941
|
+
while(index < string.length && '\t\n\f\r '.includes(string[index]))index++;
|
|
942
|
+
return index;
|
|
943
|
+
};
|
|
944
|
+
const decodeBase64Chunk = (chunk, strict, bytes)=>{
|
|
945
|
+
let n = 0;
|
|
946
|
+
for (const char of (chunk + 'AA').slice(0, 4))n = 64 * n + BASE64.indexOf(char);
|
|
947
|
+
const decoded = [
|
|
948
|
+
n >> 16,
|
|
949
|
+
n >> 8 & 255,
|
|
950
|
+
255 & n
|
|
951
|
+
];
|
|
952
|
+
const count = chunk.length - 1;
|
|
953
|
+
if (strict && count < 3 && 0 !== decoded[count]) return new SyntaxError('Extra bits in a base64 chunk');
|
|
954
|
+
for(let index = 0; index < count; index++)bytes.push(decoded[index]);
|
|
955
|
+
};
|
|
956
|
+
const decodeBase64 = (string, alphabet, lastChunkHandling, maxLength)=>{
|
|
957
|
+
const bytes = [];
|
|
958
|
+
let read = 0;
|
|
959
|
+
let chunk = '';
|
|
960
|
+
let index = 0;
|
|
961
|
+
const result = (error)=>({
|
|
962
|
+
read,
|
|
963
|
+
bytes,
|
|
964
|
+
error
|
|
965
|
+
});
|
|
966
|
+
const syntaxError = ()=>result(new SyntaxError('Invalid base64 string'));
|
|
967
|
+
if (0 === maxLength) return result();
|
|
968
|
+
for(;;){
|
|
969
|
+
index = skipAsciiWhitespace(string, index);
|
|
970
|
+
if (index === string.length) {
|
|
971
|
+
if (chunk.length > 0) {
|
|
972
|
+
if ('stop-before-partial' === lastChunkHandling) return result();
|
|
973
|
+
if ('strict' === lastChunkHandling || 1 === chunk.length) return syntaxError();
|
|
974
|
+
decodeBase64Chunk(chunk, false, bytes);
|
|
975
|
+
}
|
|
976
|
+
read = string.length;
|
|
977
|
+
return result();
|
|
978
|
+
}
|
|
979
|
+
let char = string[index++];
|
|
980
|
+
if ('=' === char) {
|
|
981
|
+
if (chunk.length < 2) return syntaxError();
|
|
982
|
+
index = skipAsciiWhitespace(string, index);
|
|
983
|
+
if (2 === chunk.length) {
|
|
984
|
+
if (index === string.length) return 'stop-before-partial' === lastChunkHandling ? result() : syntaxError();
|
|
985
|
+
if ('=' === string[index]) index = skipAsciiWhitespace(string, index + 1);
|
|
986
|
+
}
|
|
987
|
+
if (index < string.length) return syntaxError();
|
|
988
|
+
const error = decodeBase64Chunk(chunk, 'strict' === lastChunkHandling, bytes);
|
|
989
|
+
if (error) return result(error);
|
|
990
|
+
read = string.length;
|
|
991
|
+
return result();
|
|
992
|
+
}
|
|
993
|
+
if ('base64url' === alphabet) {
|
|
994
|
+
if ('+' === char || '/' === char) return syntaxError();
|
|
995
|
+
if ('-' === char) char = '+';
|
|
996
|
+
else if ('_' === char) char = '/';
|
|
997
|
+
}
|
|
998
|
+
if (!BASE64.includes(char)) return syntaxError();
|
|
999
|
+
const remaining = maxLength - bytes.length;
|
|
1000
|
+
if (1 === remaining && 2 === chunk.length || 2 === remaining && 3 === chunk.length) return result();
|
|
1001
|
+
chunk += char;
|
|
1002
|
+
if (4 === chunk.length) {
|
|
1003
|
+
decodeBase64Chunk(chunk, false, bytes);
|
|
1004
|
+
chunk = '';
|
|
1005
|
+
read = index;
|
|
1006
|
+
if (bytes.length === maxLength) return result();
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
const decodeHex = (string, maxLength)=>{
|
|
1011
|
+
const bytes = [];
|
|
1012
|
+
let read = 0;
|
|
1013
|
+
if (string.length % 2 !== 0) return {
|
|
1014
|
+
read,
|
|
1015
|
+
bytes,
|
|
1016
|
+
error: new SyntaxError('A hex string must have an even length')
|
|
1017
|
+
};
|
|
1018
|
+
while(read < string.length && bytes.length < maxLength){
|
|
1019
|
+
const pair = string.slice(read, read + 2);
|
|
1020
|
+
if (!/^[0-9a-fA-F]{2}$/.test(pair)) return {
|
|
1021
|
+
read,
|
|
1022
|
+
bytes,
|
|
1023
|
+
error: new SyntaxError('Invalid hex string')
|
|
1024
|
+
};
|
|
1025
|
+
read += 2;
|
|
1026
|
+
bytes.push(parseInt(pair, 16));
|
|
1027
|
+
}
|
|
1028
|
+
return {
|
|
1029
|
+
read,
|
|
1030
|
+
bytes,
|
|
1031
|
+
error: void 0
|
|
1032
|
+
};
|
|
1033
|
+
};
|
|
1034
|
+
const requireString = (value)=>{
|
|
1035
|
+
if ('string' != typeof value) throw new TypeError('Expected a string');
|
|
1036
|
+
};
|
|
1037
|
+
const requireUint8Array = (value)=>{
|
|
1038
|
+
if ('Uint8Array' !== typedArrayName.call(value)) throw new TypeError('Expected a Uint8Array');
|
|
1039
|
+
};
|
|
1040
|
+
const writeDecoded = (target, { read, bytes, error })=>{
|
|
1041
|
+
for(let index = 0; index < bytes.length; index++)target[index] = bytes[index];
|
|
1042
|
+
if (error) throw error;
|
|
1043
|
+
return {
|
|
1044
|
+
read,
|
|
1045
|
+
written: bytes.length
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
if ('function' == typeof Uint8Array) {
|
|
1049
|
+
definePolyfills(Uint8Array, {
|
|
1050
|
+
fromBase64 (string) {
|
|
1051
|
+
requireString(string);
|
|
1052
|
+
const options = arguments[1];
|
|
1053
|
+
requireOptions(options);
|
|
1054
|
+
const alphabet = readOption(options, 'alphabet', ALPHABETS);
|
|
1055
|
+
const lastChunkHandling = readOption(options, 'lastChunkHandling', LAST_CHUNK_HANDLINGS);
|
|
1056
|
+
const { bytes, error } = decodeBase64(string, alphabet, lastChunkHandling, 1 / 0);
|
|
1057
|
+
if (error) throw error;
|
|
1058
|
+
return new Uint8Array(bytes);
|
|
1059
|
+
},
|
|
1060
|
+
fromHex (string) {
|
|
1061
|
+
requireString(string);
|
|
1062
|
+
const { bytes, error } = decodeHex(string, 1 / 0);
|
|
1063
|
+
if (error) throw error;
|
|
1064
|
+
return new Uint8Array(bytes);
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
definePolyfills(Uint8Array.prototype, {
|
|
1068
|
+
toBase64 () {
|
|
1069
|
+
requireUint8Array(this);
|
|
1070
|
+
const options = arguments[0];
|
|
1071
|
+
requireOptions(options);
|
|
1072
|
+
const table = 'base64' === readOption(options, 'alphabet', ALPHABETS) ? BASE64 : BASE64URL;
|
|
1073
|
+
const padding = void 0 !== options && options.omitPadding ? '' : '=';
|
|
1074
|
+
const length = typedArrayLength.call(this);
|
|
1075
|
+
let encoded = '';
|
|
1076
|
+
for(let index = 0; index < length; index += 3){
|
|
1077
|
+
const left = length - index;
|
|
1078
|
+
const n = this[index] << 16 | (left > 1 ? this[index + 1] << 8 : 0) | (left > 2 ? this[index + 2] : 0);
|
|
1079
|
+
encoded += table[n >> 18] + table[n >> 12 & 63] + (left > 1 ? table[n >> 6 & 63] : padding) + (left > 2 ? table[63 & n] : padding);
|
|
1080
|
+
}
|
|
1081
|
+
return encoded;
|
|
1082
|
+
},
|
|
1083
|
+
toHex () {
|
|
1084
|
+
requireUint8Array(this);
|
|
1085
|
+
const length = typedArrayLength.call(this);
|
|
1086
|
+
let hex = '';
|
|
1087
|
+
for(let index = 0; index < length; index++)hex += this[index].toString(16).padStart(2, '0');
|
|
1088
|
+
return hex;
|
|
1089
|
+
},
|
|
1090
|
+
setFromBase64 (string) {
|
|
1091
|
+
requireUint8Array(this);
|
|
1092
|
+
requireString(string);
|
|
1093
|
+
const options = arguments[1];
|
|
1094
|
+
requireOptions(options);
|
|
1095
|
+
const alphabet = readOption(options, 'alphabet', ALPHABETS);
|
|
1096
|
+
const lastChunkHandling = readOption(options, 'lastChunkHandling', LAST_CHUNK_HANDLINGS);
|
|
1097
|
+
return writeDecoded(this, decodeBase64(string, alphabet, lastChunkHandling, typedArrayLength.call(this)));
|
|
1098
|
+
},
|
|
1099
|
+
setFromHex (string) {
|
|
1100
|
+
requireUint8Array(this);
|
|
1101
|
+
requireString(string);
|
|
1102
|
+
return writeDecoded(this, decodeHex(string, typedArrayLength.call(this)));
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
const defineUpsert = (Kind, requireKey)=>{
|
|
1107
|
+
const { has, get, set } = Kind.prototype;
|
|
1108
|
+
definePolyfills(Kind.prototype, {
|
|
1109
|
+
getOrInsert (key, value) {
|
|
1110
|
+
if (has.call(this, key)) return get.call(this, key);
|
|
1111
|
+
set.call(this, key, value);
|
|
1112
|
+
return value;
|
|
1113
|
+
},
|
|
1114
|
+
getOrInsertComputed (key, callback) {
|
|
1115
|
+
requireCallable(callback);
|
|
1116
|
+
requireKey(key);
|
|
1117
|
+
if (has.call(this, key)) return get.call(this, key);
|
|
1118
|
+
const stored = 0 === key ? 0 : key;
|
|
1119
|
+
const value = callback(stored);
|
|
1120
|
+
set.call(this, stored, value);
|
|
1121
|
+
return value;
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
};
|
|
1125
|
+
defineUpsert(Map, ()=>{});
|
|
1126
|
+
defineUpsert(WeakMap, (key)=>{
|
|
1127
|
+
if (!isObject(key) && !('symbol' == typeof key && void 0 === Symbol.keyFor(key))) throw new TypeError('Invalid value used as weak map key');
|
|
1128
|
+
});
|
|
1129
|
+
if ("u" < typeof Intl) definePolyfillOverride(Number.prototype, 'toLocaleString', function(_locales, options) {
|
|
1130
|
+
const value = Number(this);
|
|
1131
|
+
if (Number.isNaN(value)) return 'NaN';
|
|
1132
|
+
if (!Number.isFinite(value)) return value > 0 ? '∞' : '-∞';
|
|
1133
|
+
const opts = options || {};
|
|
1134
|
+
const min = opts.minimumFractionDigits ?? 0;
|
|
1135
|
+
const max = Math.max(min, opts.maximumFractionDigits ?? Math.max(min, 3));
|
|
1136
|
+
const fixed = Math.abs(value).toFixed(max);
|
|
1137
|
+
const dot = fixed.indexOf('.');
|
|
1138
|
+
let integer = dot < 0 ? fixed : fixed.slice(0, dot);
|
|
1139
|
+
let fraction = dot < 0 ? '' : fixed.slice(dot + 1).replace(/0+$/, '');
|
|
1140
|
+
while(fraction.length < min)fraction += '0';
|
|
1141
|
+
if (false !== opts.useGrouping) integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
1142
|
+
const sign = value < 0 && 0 !== Number(fixed) ? '-' : '';
|
|
1143
|
+
return sign + integer + (fraction ? `.${fraction}` : '');
|
|
1144
|
+
});
|
|
1
1145
|
if ("u" < typeof AbortController) {
|
|
2
1146
|
class LynxAbortSignal {
|
|
3
1147
|
constructor(){
|
|
@@ -39,70 +1183,6 @@ if ("u" < typeof AbortController) {
|
|
|
39
1183
|
}
|
|
40
1184
|
};
|
|
41
1185
|
}
|
|
42
|
-
if ('function' != typeof Object.hasOwn) Object.hasOwn = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
43
|
-
const definePolyfillOverride = (proto, name, value)=>{
|
|
44
|
-
Object.defineProperty(proto, name, {
|
|
45
|
-
value,
|
|
46
|
-
writable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
enumerable: false
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
const definePolyfill = (proto, name, value)=>{
|
|
52
|
-
if (proto && 'function' != typeof proto[name]) definePolyfillOverride(proto, name, value);
|
|
53
|
-
};
|
|
54
|
-
const relativeIndex = function(index) {
|
|
55
|
-
const length = this.length;
|
|
56
|
-
let n = Math.trunc(Number(index)) || 0;
|
|
57
|
-
if (n < 0) n += length;
|
|
58
|
-
if (n < 0 || n >= length) return;
|
|
59
|
-
return 'string' == typeof this ? this.charAt(n) : this[n];
|
|
60
|
-
};
|
|
61
|
-
definePolyfill(Array.prototype, 'at', relativeIndex);
|
|
62
|
-
definePolyfill(String.prototype, 'at', function(index) {
|
|
63
|
-
return relativeIndex.call(String(this), index);
|
|
64
|
-
});
|
|
65
|
-
if ('function' == typeof Int8Array) definePolyfill(Object.getPrototypeOf(Int8Array.prototype), 'at', relativeIndex);
|
|
66
|
-
definePolyfill(Array.prototype, 'findLastIndex', function(predicate, thisArg) {
|
|
67
|
-
for(let i = this.length - 1; i >= 0; i--)if (predicate.call(thisArg, this[i], i, this)) return i;
|
|
68
|
-
return -1;
|
|
69
|
-
});
|
|
70
|
-
definePolyfill(Array.prototype, 'findLast', function(predicate, thisArg) {
|
|
71
|
-
for(let i = this.length - 1; i >= 0; i--)if (predicate.call(thisArg, this[i], i, this)) return this[i];
|
|
72
|
-
});
|
|
73
|
-
definePolyfill(String.prototype, 'replaceAll', function(search, replacement) {
|
|
74
|
-
const subject = String(this);
|
|
75
|
-
if (search instanceof RegExp) {
|
|
76
|
-
if (!search.global) throw new TypeError('replaceAll must be called with a global RegExp');
|
|
77
|
-
return subject.replace(search, replacement);
|
|
78
|
-
}
|
|
79
|
-
const needle = String(search);
|
|
80
|
-
const pattern = new RegExp(needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g');
|
|
81
|
-
return subject.replace(pattern, replacement);
|
|
82
|
-
});
|
|
83
|
-
if ("u" < typeof Intl) definePolyfillOverride(Number.prototype, 'toLocaleString', function(_locales, options) {
|
|
84
|
-
const value = Number(this);
|
|
85
|
-
if (Number.isNaN(value)) return 'NaN';
|
|
86
|
-
if (!Number.isFinite(value)) return value > 0 ? '∞' : '-∞';
|
|
87
|
-
const opts = options || {};
|
|
88
|
-
const min = opts.minimumFractionDigits ?? 0;
|
|
89
|
-
const max = Math.max(min, opts.maximumFractionDigits ?? Math.max(min, 3));
|
|
90
|
-
const fixed = Math.abs(value).toFixed(max);
|
|
91
|
-
const dot = fixed.indexOf('.');
|
|
92
|
-
let integer = dot < 0 ? fixed : fixed.slice(0, dot);
|
|
93
|
-
let fraction = dot < 0 ? '' : fixed.slice(dot + 1).replace(/0+$/, '');
|
|
94
|
-
while(fraction.length < min)fraction += '0';
|
|
95
|
-
if (false !== opts.useGrouping) integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
96
|
-
const sign = value < 0 && 0 !== Number(fixed) ? '-' : '';
|
|
97
|
-
return sign + integer + (fraction ? `.${fraction}` : '');
|
|
98
|
-
});
|
|
99
|
-
if ('function' != typeof Promise.allSettled) Promise.allSettled = (promises)=>Promise.all(Array.from(promises, (p)=>Promise.resolve(p).then((value)=>({
|
|
100
|
-
status: 'fulfilled',
|
|
101
|
-
value
|
|
102
|
-
}), (reason)=>({
|
|
103
|
-
status: 'rejected',
|
|
104
|
-
reason
|
|
105
|
-
}))));
|
|
106
1186
|
if ("u" < typeof performance) globalThis.performance = void 0;
|
|
107
1187
|
if ("u" < typeof queueMicrotask) {
|
|
108
1188
|
globalThis.queueMicrotaskPromiseCache = Promise.resolve();
|
package/package.json
CHANGED
|
File without changes
|