expo 57.0.11 → 57.0.13
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/android/build.gradle +2 -2
- package/build/winter/TextDecoder.d.ts +2 -8
- package/build/winter/TextDecoder.d.ts.map +1 -1
- package/bundledNativeModules.json +37 -37
- package/ios/AppDelegates/EXBundleConfiguration.h +23 -0
- package/ios/AppDelegates/EXBundleConfiguration.mm +85 -0
- package/ios/AppDelegates/ExpoReactNativeFactory.swift +54 -2
- package/ios/Expo.h +1 -0
- package/package.json +16 -16
- package/src/winter/TextDecoder.ts +361 -361
- package/src/winter/__tests__/TextDecoder.test.native.ts +142 -0
- package/template.tgz +0 -0
|
@@ -249,6 +249,8 @@ describe('TextDecoder', () => {
|
|
|
249
249
|
chars.substring(TypeConstructor.BYTES_PER_ELEMENT, TypeConstructor.BYTES_PER_ELEMENT + 8)
|
|
250
250
|
);
|
|
251
251
|
});
|
|
252
|
+
|
|
253
|
+
expect(decoder.decode(new DataView(buffer, 2, 8))).toBe(chars.substring(2, 10));
|
|
252
254
|
});
|
|
253
255
|
});
|
|
254
256
|
|
|
@@ -274,6 +276,15 @@ describe('TextDecoder', () => {
|
|
|
274
276
|
});
|
|
275
277
|
});
|
|
276
278
|
|
|
279
|
+
it('accepts callable options dictionaries', () => {
|
|
280
|
+
const options = () => {};
|
|
281
|
+
|
|
282
|
+
// @ts-expect-error Web IDL dictionaries accept callable objects
|
|
283
|
+
expect(new TextDecoder('utf-8', options).fatal).toBe(false);
|
|
284
|
+
// @ts-expect-error Web IDL dictionaries accept callable objects
|
|
285
|
+
expect(new TextDecoder().decode(new Uint8Array([0x61]), options)).toBe('a');
|
|
286
|
+
});
|
|
287
|
+
|
|
277
288
|
// https://github.com/inexorabletash/text-encoding/blob/3f330964c0e97e1ed344c2a3e963f4598610a7ad/test/test-misc.js#L383
|
|
278
289
|
it('encode() called with falsy arguments (polyfill bindings)', () => {
|
|
279
290
|
const encoder = new TextEncoder();
|
|
@@ -283,6 +294,137 @@ describe('TextDecoder', () => {
|
|
|
283
294
|
expect([...encoder.encode(0)]).toEqual([48]);
|
|
284
295
|
});
|
|
285
296
|
|
|
297
|
+
describe('indexed UTF-8 decoder', () => {
|
|
298
|
+
it('decodes valid sequences at each UTF-8 boundary', () => {
|
|
299
|
+
const bytes = new Uint8Array([
|
|
300
|
+
0x00, 0x7f, 0xc2, 0x80, 0xdf, 0xbf, 0xe0, 0xa0, 0x80, 0xed, 0x9f, 0xbf, 0xee, 0x80, 0x80,
|
|
301
|
+
0xf0, 0x90, 0x80, 0x80, 0xf4, 0x8f, 0xbf, 0xbf,
|
|
302
|
+
]);
|
|
303
|
+
|
|
304
|
+
expect(new TextDecoder().decode(bytes)).toBe(
|
|
305
|
+
'\u0000\u007f\u0080\u07ff\u0800\ud7ff\ue000\u{10000}\u{10ffff}'
|
|
306
|
+
);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it('reads the stream option once for malformed input', () => {
|
|
310
|
+
let reads = 0;
|
|
311
|
+
const options = {
|
|
312
|
+
get stream() {
|
|
313
|
+
reads++;
|
|
314
|
+
return false;
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
expect(new TextDecoder().decode(new Uint8Array([0xff]), options)).toBe('\ufffd');
|
|
319
|
+
expect(reads).toBe(1);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it('handles incomplete and malformed sequences across every chunk boundary', () => {
|
|
323
|
+
const NativeTextDecoder = require('node:util').TextDecoder;
|
|
324
|
+
const cases = [
|
|
325
|
+
[0xef, 0xbb, 0xbf, 0x61],
|
|
326
|
+
[0xc2, 0xa2, 0xe6, 0xb0, 0xb4, 0xf0, 0x9d, 0x84, 0x9e],
|
|
327
|
+
[0xe0, 0x80, 0x80, 0x61],
|
|
328
|
+
[0xed, 0xa0, 0x80, 0x61],
|
|
329
|
+
[0xf4, 0x90, 0x80, 0x80, 0x61],
|
|
330
|
+
[0xe1, 0x80, 0x41, 0xc2],
|
|
331
|
+
[0xff, 0xef, 0xbb, 0xbf],
|
|
332
|
+
[0x61, 0xef, 0xbb, 0xbf],
|
|
333
|
+
];
|
|
334
|
+
|
|
335
|
+
for (const input of cases) {
|
|
336
|
+
for (let split = 0; split <= input.length; split++) {
|
|
337
|
+
const decoder = new TextDecoder();
|
|
338
|
+
const nativeDecoder = new NativeTextDecoder();
|
|
339
|
+
const first = new Uint8Array(input.slice(0, split));
|
|
340
|
+
const second = new Uint8Array(input.slice(split));
|
|
341
|
+
const actual =
|
|
342
|
+
decoder.decode(first, { stream: true }) +
|
|
343
|
+
decoder.decode(second, { stream: true }) +
|
|
344
|
+
decoder.decode();
|
|
345
|
+
const expected =
|
|
346
|
+
nativeDecoder.decode(first, { stream: true }) +
|
|
347
|
+
nativeDecoder.decode(second, { stream: true }) +
|
|
348
|
+
nativeDecoder.decode();
|
|
349
|
+
|
|
350
|
+
expect(actual).toBe(expected);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('decodes large ASCII and multi-byte inputs', () => {
|
|
356
|
+
const value = 'a'.repeat(9000) + '水𝄞'.repeat(9000);
|
|
357
|
+
const encoded = new TextEncoder().encode(value);
|
|
358
|
+
|
|
359
|
+
expect(new TextDecoder().decode(encoded)).toBe(value);
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it.each([0, 1, 31, 32, 33, 4095, 4096, 4097, 8193])(
|
|
363
|
+
'decodes %i ASCII bytes across conversion boundaries',
|
|
364
|
+
(length) => {
|
|
365
|
+
const bytes = new Uint8Array(length);
|
|
366
|
+
for (let i = 0; i < length; i++) bytes[i] = 32 + (i % 95);
|
|
367
|
+
|
|
368
|
+
const NativeTextDecoder = require('node:util').TextDecoder;
|
|
369
|
+
expect(new TextDecoder().decode(bytes)).toBe(new NativeTextDecoder().decode(bytes));
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
|
|
373
|
+
it('agrees with the native decoder for every two-byte input', () => {
|
|
374
|
+
const NativeTextDecoder = require('node:util').TextDecoder;
|
|
375
|
+
const bytes = new Uint8Array(2);
|
|
376
|
+
for (let first = 0; first <= 0xff; first++) {
|
|
377
|
+
bytes[0] = first;
|
|
378
|
+
for (let second = 0; second <= 0xff; second++) {
|
|
379
|
+
bytes[1] = second;
|
|
380
|
+
expect(new TextDecoder().decode(bytes)).toBe(new NativeTextDecoder().decode(bytes));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
it('agrees with the native decoder for malformed inputs and all streaming splits', () => {
|
|
386
|
+
const NativeTextDecoder = require('node:util').TextDecoder;
|
|
387
|
+
let random = 0x12345678;
|
|
388
|
+
const nextByte = () => {
|
|
389
|
+
random = (Math.imul(random, 1664525) + 1013904223) >>> 0;
|
|
390
|
+
return random >>> 24;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
for (let test = 0; test < 2000; test++) {
|
|
394
|
+
const input = new Uint8Array(test % 9);
|
|
395
|
+
for (let i = 0; i < input.length; i++) input[i] = nextByte();
|
|
396
|
+
expect(new TextDecoder().decode(input)).toBe(new NativeTextDecoder().decode(input));
|
|
397
|
+
|
|
398
|
+
for (let split = 0; split <= input.length; split++) {
|
|
399
|
+
const decoder = new TextDecoder();
|
|
400
|
+
const nativeDecoder = new NativeTextDecoder();
|
|
401
|
+
const actual =
|
|
402
|
+
decoder.decode(input.subarray(0, split), { stream: true }) +
|
|
403
|
+
decoder.decode(input.subarray(split), { stream: true }) +
|
|
404
|
+
decoder.decode();
|
|
405
|
+
const expected =
|
|
406
|
+
nativeDecoder.decode(input.subarray(0, split), { stream: true }) +
|
|
407
|
+
nativeDecoder.decode(input.subarray(split), { stream: true }) +
|
|
408
|
+
nativeDecoder.decode();
|
|
409
|
+
expect(actual).toBe(expected);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it('starts a fresh BOM session after a completed decode', () => {
|
|
415
|
+
const decoder = new TextDecoder();
|
|
416
|
+
expect(decoder.decode(new Uint8Array([0x61]))).toBe('a');
|
|
417
|
+
expect(decoder.decode(new Uint8Array([0xef, 0xbb, 0xbf, 0x62]))).toBe('b');
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
it('recovers cleanly after a fatal streaming error', () => {
|
|
421
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
422
|
+
expect(decoder.decode(new Uint8Array([0xe2]), { stream: true })).toBe('');
|
|
423
|
+
expect(() => decoder.decode(new Uint8Array([0x41]), { stream: true })).toThrow(TypeError);
|
|
424
|
+
expect(decoder.decode(new Uint8Array([0x42]))).toBe('B');
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
|
|
286
428
|
// https://github.com/inexorabletash/text-encoding/blob/master/test/test-utf.js
|
|
287
429
|
describe('UTF-8 - Encode/Decode - reference sample', () => {
|
|
288
430
|
// z, cent, CJK water, G-Clef, Private-use character
|
package/template.tgz
CHANGED
|
Binary file
|