expo 58.0.2 → 58.0.4
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/runtime.native.js +0 -2
- package/build/winter/runtime.native.js.map +1 -1
- package/bundledNativeModules.json +37 -36
- package/ios/Expo/ExpoAppSceneDelegate.swift +5 -0
- package/ios/Tests/ExpoAppSceneDelegateTests.swift +25 -0
- package/package.json +17 -17
- package/scripts/spm/app-target.js +4 -2
- package/src/async-require/__tests__/loadBundle.test.ios.ts +2 -2
- package/src/winter/__tests__/{TextDecoderStream.test.ios.ts → TextDecoderStream.test.native.ts} +23 -2
- package/src/winter/runtime.native.ts +0 -2
- package/template.tgz +0 -0
- package/build/winter/TextDecoder.d.ts +0 -13
- package/build/winter/TextDecoder.js +0 -357
- package/build/winter/TextDecoder.js.map +0 -1
- package/src/winter/TextDecoder.ts +0 -427
- package/src/winter/__tests__/TextDecoder.test.native.ts +0 -549
package/android/build.gradle
CHANGED
|
@@ -10,7 +10,7 @@ buildscript {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
group = 'host.exp.exponent'
|
|
13
|
-
version = '58.0.
|
|
13
|
+
version = '58.0.4'
|
|
14
14
|
|
|
15
15
|
expoModule {
|
|
16
16
|
// We can't prebuild the module because it depends on the generated files.
|
|
@@ -21,7 +21,7 @@ android {
|
|
|
21
21
|
namespace "expo.core"
|
|
22
22
|
defaultConfig {
|
|
23
23
|
versionCode 1
|
|
24
|
-
versionName "58.0.
|
|
24
|
+
versionName "58.0.4"
|
|
25
25
|
consumerProguardFiles("proguard-rules.pro")
|
|
26
26
|
}
|
|
27
27
|
testOptions {
|
|
@@ -6,8 +6,6 @@ import './setupReactNativeEnvironment';
|
|
|
6
6
|
import '../../types';
|
|
7
7
|
import { installFormDataPatch } from './FormData';
|
|
8
8
|
import { installGlobal as install } from './installGlobal';
|
|
9
|
-
// https://encoding.spec.whatwg.org/#textdecoder
|
|
10
|
-
install('TextDecoder', ()=>require('./TextDecoder').TextDecoder);
|
|
11
9
|
// https://encoding.spec.whatwg.org/#interface-textdecoderstream
|
|
12
10
|
install('TextDecoderStream', ()=>require('./TextDecoderStream').TextDecoderStream);
|
|
13
11
|
// https://encoding.spec.whatwg.org/#interface-textencoderstream
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["winter/runtime.native.ts"],"sourcesContent":[null],"names":["installFormDataPatch","installGlobal","install","require","
|
|
1
|
+
{"version":3,"sources":["winter/runtime.native.ts"],"sourcesContent":[null],"names":["installFormDataPatch","installGlobal","install","require","TextDecoderStream","TextEncoderStream","URL","URLSearchParams","DOMException","ImportMetaRegistry","default","FormData","Symbol","asyncIterator","for","useRnFetch","process","env","EXPO_PUBLIC_USE_RN_FETCH","globalThis","Headers","Error","fetch"],"mappings":"AAAA,wFAAwF;AACxF,wBAAwB;AAExB,+FAA+F;AAC/F,iGAAiG;AACjG,OAAO,gCAAgC;AACvC,OAAO,cAAc;AACrB,SAASA,oBAAoB,QAAQ,aAAa;AAClD,SAASC,iBAAiBC,OAAO,QAAQ,kBAAkB;AAE3D,gEAAgE;AAChEA,QAAQ,qBAAqB,IAAMC,QAAQ,uBAAuBC,iBAAiB;AACnF,gEAAgE;AAChEF,QAAQ,qBAAqB,IAAMC,QAAQ,uBAAuBE,iBAAiB;AACnF,mCAAmC;AACnCH,QAAQ,OAAO,IAAMC,QAAQ,SAASG,GAAG;AACzC,+CAA+C;AAC/CJ,QAAQ,mBAAmB,IAAMC,QAAQ,SAASI,eAAe;AACjE,mDAAmD;AACnDL,QAAQ,gBAAgB,IAAMC,QAAQ,kBAAkBK,YAAY;AACpE,sCAAsC;AACtC,kDAAkD;AAElDN,QAAQ,4BAA4B,IAAMC,QAAQ,wBAAwBM,kBAAkB;AAE5F,8EAA8E;AAC9EP,QAAQ,mBAAmB,IAAMC,QAAQ,2BAA2BO,OAAO;AAE3EV,qBAAqBW;AAErB,6CAA6C;AAC7C,+EAA+E;AAC/EC,OAAOC,aAAa,KAAKD,OAAOE,GAAG,CAAC;AAEpC,MAAMC,aACJC,QAAQC,GAAG,CAACC,wBAAwB,KAAK,OAAOF,QAAQC,GAAG,CAACC,wBAAwB,KAAK;AAE3F,IAAI,CAACH,YAAY;IACf,sEAAsE;IACtE,sEAAsE;IACtE,IAAI,CAACI,WAAWC,OAAO,EAAE;QACvB,MAAM,IAAIC,MACR;IAEJ;IACAnB,QAAQ,SAAS,IAAMC,QAAQ,WAAWmB,KAAK;AACjD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@expo/dom-webview": "~58.0.2",
|
|
3
|
-
"@expo/fingerprint": "~0.21.
|
|
4
|
-
"@expo/metro-runtime": "~58.0.
|
|
3
|
+
"@expo/fingerprint": "~0.21.3",
|
|
4
|
+
"@expo/metro-runtime": "~58.0.11",
|
|
5
5
|
"@expo/vector-icons": "^15.0.2",
|
|
6
|
-
"@expo/ui": "~58.0.
|
|
6
|
+
"@expo/ui": "~58.0.13",
|
|
7
7
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
8
8
|
"@react-native-community/datetimepicker": "9.2.1",
|
|
9
9
|
"@react-native-masked-view/masked-view": "0.3.2",
|
|
@@ -16,93 +16,94 @@
|
|
|
16
16
|
"eslint-config-expo": "~58.0.4",
|
|
17
17
|
"expo-analytics-amplitude": "~11.3.0",
|
|
18
18
|
"expo-app-auth": "~11.1.0",
|
|
19
|
-
"expo-app-intents": "~0.5.
|
|
19
|
+
"expo-app-intents": "~0.5.2",
|
|
20
20
|
"expo-app-loader-provider": "~8.0.0",
|
|
21
21
|
"expo-app-metrics": "~58.0.11",
|
|
22
22
|
"expo-apple-authentication": "~58.0.2",
|
|
23
|
-
"expo-application": "~58.0.
|
|
24
|
-
"expo-asset": "~58.0.
|
|
25
|
-
"expo-audio": "~58.0.
|
|
26
|
-
"expo-auth-session": "~58.0.
|
|
23
|
+
"expo-application": "~58.0.4",
|
|
24
|
+
"expo-asset": "~58.0.12",
|
|
25
|
+
"expo-audio": "~58.0.6",
|
|
26
|
+
"expo-auth-session": "~58.0.9",
|
|
27
27
|
"expo-background-fetch": "~58.0.10",
|
|
28
28
|
"expo-background-task": "~58.0.10",
|
|
29
29
|
"expo-battery": "~58.0.3",
|
|
30
30
|
"expo-blur": "~58.0.3",
|
|
31
31
|
"expo-brightness": "~58.0.2",
|
|
32
|
-
"expo-brownfield": "~58.0.
|
|
33
|
-
"expo-build-properties": "~58.0.
|
|
32
|
+
"expo-brownfield": "~58.0.11",
|
|
33
|
+
"expo-build-properties": "~58.0.10",
|
|
34
34
|
"expo-calendar": "~58.0.6",
|
|
35
|
-
"expo-camera": "~58.0.
|
|
35
|
+
"expo-camera": "~58.0.9",
|
|
36
36
|
"expo-cellular": "~58.0.2",
|
|
37
37
|
"expo-checkbox": "~58.0.2",
|
|
38
38
|
"expo-clipboard": "~58.0.3",
|
|
39
|
-
"expo-constants": "~58.0.
|
|
40
|
-
"expo-contacts": "~58.0.
|
|
41
|
-
"expo-crypto": "~58.0.
|
|
42
|
-
"expo-dev-client": "~58.0.
|
|
39
|
+
"expo-constants": "~58.0.10",
|
|
40
|
+
"expo-contacts": "~58.0.5",
|
|
41
|
+
"expo-crypto": "~58.0.5",
|
|
42
|
+
"expo-dev-client": "~58.0.11",
|
|
43
43
|
"expo-device": "~58.0.5",
|
|
44
44
|
"expo-document-picker": "~58.0.4",
|
|
45
45
|
"expo-eas-client": "~58.0.2",
|
|
46
46
|
"expo-file-system": "~58.0.5",
|
|
47
|
-
"expo-font": "~58.0.
|
|
47
|
+
"expo-font": "~58.0.6",
|
|
48
48
|
"expo-gl": "~58.0.3",
|
|
49
49
|
"expo-glass-effect": "~58.0.3",
|
|
50
50
|
"expo-google-app-auth": "~8.3.0",
|
|
51
|
-
"expo-haptics": "~58.0.
|
|
52
|
-
"expo-
|
|
51
|
+
"expo-haptics": "~58.0.5",
|
|
52
|
+
"expo-hinge": "~58.0.0",
|
|
53
|
+
"expo-image": "~58.0.12",
|
|
53
54
|
"expo-image-loader": "~58.0.3",
|
|
54
|
-
"expo-image-manipulator": "~58.0.
|
|
55
|
+
"expo-image-manipulator": "~58.0.12",
|
|
55
56
|
"expo-image-picker": "~58.0.10",
|
|
56
57
|
"expo-intent-launcher": "~58.0.3",
|
|
57
58
|
"expo-insights": "~58.0.11",
|
|
58
59
|
"expo-keep-awake": "~58.0.3",
|
|
59
60
|
"expo-linear-gradient": "~58.0.3",
|
|
60
|
-
"expo-linking": "~58.0.
|
|
61
|
+
"expo-linking": "~58.0.11",
|
|
61
62
|
"expo-local-authentication": "~58.0.2",
|
|
62
63
|
"expo-localization": "~58.0.3",
|
|
63
|
-
"expo-location": "~58.0.
|
|
64
|
+
"expo-location": "~58.0.12",
|
|
64
65
|
"expo-mail-composer": "~58.0.3",
|
|
65
66
|
"expo-manifests": "~58.0.1",
|
|
66
|
-
"expo-maps": "~58.0.
|
|
67
|
+
"expo-maps": "~58.0.5",
|
|
67
68
|
"expo-mcp": "~0.2.1",
|
|
68
|
-
"expo-media-library": "~58.0.
|
|
69
|
+
"expo-media-library": "~58.0.6",
|
|
69
70
|
"expo-mesh-gradient": "~58.0.3",
|
|
70
71
|
"expo-module-template": "~58.0.5",
|
|
71
|
-
"expo-modules-core": "~58.0.
|
|
72
|
+
"expo-modules-core": "~58.0.13",
|
|
72
73
|
"expo-navigation-bar": "~58.0.4",
|
|
73
74
|
"expo-network": "~58.0.3",
|
|
74
|
-
"expo-notifications": "~58.
|
|
75
|
+
"expo-notifications": "~58.1.1",
|
|
75
76
|
"expo-observe": "~58.0.13",
|
|
76
77
|
"expo-print": "~58.0.4",
|
|
77
78
|
"expo-live-photo": "~58.0.3",
|
|
78
|
-
"expo-router": "~58.0.
|
|
79
|
+
"expo-router": "~58.0.14",
|
|
79
80
|
"expo-screen-capture": "~58.0.5",
|
|
80
81
|
"expo-screen-orientation": "~58.0.2",
|
|
81
82
|
"expo-secure-store": "~58.0.2",
|
|
82
83
|
"expo-sensors": "~58.0.2",
|
|
83
|
-
"expo-server": "~58.0.
|
|
84
|
-
"expo-sharing": "~58.0.
|
|
84
|
+
"expo-server": "~58.0.3",
|
|
85
|
+
"expo-sharing": "~58.0.15",
|
|
85
86
|
"expo-sms": "~58.0.2",
|
|
86
87
|
"expo-speech": "~58.0.3",
|
|
87
|
-
"expo-splash-screen": "~58.0.
|
|
88
|
-
"expo-sqlite": "~58.0.
|
|
88
|
+
"expo-splash-screen": "~58.0.6",
|
|
89
|
+
"expo-sqlite": "~58.0.10",
|
|
89
90
|
"expo-status-bar": "~58.0.3",
|
|
90
91
|
"expo-store-review": "~58.0.2",
|
|
91
|
-
"expo-symbols": "~58.0.
|
|
92
|
+
"expo-symbols": "~58.0.4",
|
|
92
93
|
"expo-system-ui": "~58.0.5",
|
|
93
94
|
"expo-task-manager": "~58.0.11",
|
|
94
95
|
"expo-tracking-transparency": "~58.0.2",
|
|
95
|
-
"expo-updates": "~58.0.
|
|
96
|
+
"expo-updates": "~58.0.15",
|
|
96
97
|
"expo-video-thumbnails": "~58.0.2",
|
|
97
98
|
"expo-video": "~58.0.6",
|
|
98
|
-
"expo-web-browser": "~58.0.
|
|
99
|
-
"expo-widgets": "~58.0.
|
|
100
|
-
"jest-expo": "~58.0.
|
|
99
|
+
"expo-web-browser": "~58.0.6",
|
|
100
|
+
"expo-widgets": "~58.0.13",
|
|
101
|
+
"jest-expo": "~58.0.7",
|
|
101
102
|
"lottie-react-native": "~7.5.0",
|
|
102
103
|
"react": "19.3.0",
|
|
103
104
|
"react-dom": "19.3.0",
|
|
104
105
|
"react-native": "0.88.0-rc.3",
|
|
105
|
-
"react-native-web": "~0.21.
|
|
106
|
+
"react-native-web": "~0.21.3",
|
|
106
107
|
"react-native-gesture-handler": "~3.2.1",
|
|
107
108
|
"react-native-keyboard-controller": "1.22.4",
|
|
108
109
|
"react-native-maps": "1.29.0",
|
|
@@ -26,6 +26,10 @@ open class ExpoAppSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
26
26
|
|
|
27
27
|
let forwarder = SceneEventForwarder()
|
|
28
28
|
|
|
29
|
+
open var initialProperties: [AnyHashable: Any]? {
|
|
30
|
+
return nil
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
open func scene(
|
|
30
34
|
_ scene: UIScene,
|
|
31
35
|
willConnectTo session: UISceneSession,
|
|
@@ -62,6 +66,7 @@ open class ExpoAppSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
62
66
|
factory.startReactNative(
|
|
63
67
|
withModuleName: provider.reactNativeFactoryModuleName,
|
|
64
68
|
in: window,
|
|
69
|
+
initialProperties: initialProperties,
|
|
65
70
|
launchOptions: Self.launchOptions(
|
|
66
71
|
url: connectionOptions.urlContexts.first?.url,
|
|
67
72
|
userActivity: browsingWebActivity
|
|
@@ -345,6 +345,23 @@ struct ExpoAppSceneDelegateTests {
|
|
|
345
345
|
}
|
|
346
346
|
#endif
|
|
347
347
|
|
|
348
|
+
@Test
|
|
349
|
+
@MainActor
|
|
350
|
+
func `passes no root properties by default`() {
|
|
351
|
+
// The app-delegate life cycle started React Native with no initial properties, so adopting the
|
|
352
|
+
// scene life cycle must not start handing the root component properties it never had.
|
|
353
|
+
#expect(ExpoAppSceneDelegate().initialProperties == nil)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
@Test
|
|
357
|
+
@MainActor
|
|
358
|
+
func `lets a subclass supply root properties`() {
|
|
359
|
+
// Restores what `RCTAppDelegate.initialProps` gave apps before React Native moved its startup
|
|
360
|
+
// into `scene(_:willConnectTo:)`.
|
|
361
|
+
let properties = PropertySupplyingSceneDelegate().initialProperties
|
|
362
|
+
#expect(properties?["myProperty"] as? Bool == true)
|
|
363
|
+
}
|
|
364
|
+
|
|
348
365
|
@Test
|
|
349
366
|
@MainActor
|
|
350
367
|
func `forwards to the app delegate of the running application`() {
|
|
@@ -422,6 +439,14 @@ private final class UserActivityRecordingSubscriber: NSObject, ExpoAppDelegateSu
|
|
|
422
439
|
}
|
|
423
440
|
}
|
|
424
441
|
|
|
442
|
+
/// Scene delegate shaped like an app that supplies its own root properties, the way apps did with
|
|
443
|
+
/// `RCTAppDelegate.initialProps` under the app-delegate life cycle.
|
|
444
|
+
private final class PropertySupplyingSceneDelegate: ExpoAppSceneDelegate {
|
|
445
|
+
override var initialProperties: [AnyHashable: Any]? {
|
|
446
|
+
return ["myProperty": true]
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
425
450
|
/// App delegate shaped like the SDK ≤ 57 templates, which call `RCTLinkingManager` from their own
|
|
426
451
|
/// overrides. See `packages/expo-updates/e2e/fixtures/custom_init/AppDelegate.swift`.
|
|
427
452
|
private final class LegacyLinkingAppDelegate: ExpoAppDelegate {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.4",
|
|
4
4
|
"description": "The Expo SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo"
|
|
@@ -178,6 +178,7 @@
|
|
|
178
178
|
"./dom/entry.js": "./dom/entry.js",
|
|
179
179
|
"./dom/entry": "./dom/entry.js",
|
|
180
180
|
"./AppEntry.js": "./AppEntry.js",
|
|
181
|
+
"./template.tgz": "./template.tgz",
|
|
181
182
|
"./virtual/*.js": "./virtual/*.js",
|
|
182
183
|
"./virtual/*": "./virtual/*.js",
|
|
183
184
|
"./scripts/*.js": "./scripts/*.js",
|
|
@@ -201,36 +202,35 @@
|
|
|
201
202
|
},
|
|
202
203
|
"dependencies": {
|
|
203
204
|
"@babel/runtime": "^7.20.0",
|
|
204
|
-
"@expo/cli": "^58.1.
|
|
205
|
-
"@expo/config": "~58.0.
|
|
206
|
-
"@expo/config-plugins": "~58.0.
|
|
205
|
+
"@expo/cli": "^58.1.3",
|
|
206
|
+
"@expo/config": "~58.0.3",
|
|
207
|
+
"@expo/config-plugins": "~58.0.6",
|
|
207
208
|
"@expo/devtools": "~58.0.2",
|
|
208
209
|
"@expo/dom-webview": "~58.0.2",
|
|
209
|
-
"@expo/fingerprint": "^0.21.
|
|
210
|
-
"@expo/local-build-cache-provider": "^58.0.
|
|
211
|
-
"@expo/log-box": "^58.0.
|
|
210
|
+
"@expo/fingerprint": "^0.21.3",
|
|
211
|
+
"@expo/local-build-cache-provider": "^58.0.3",
|
|
212
|
+
"@expo/log-box": "^58.0.9",
|
|
212
213
|
"@expo/log-box-utils": "^58.0.1",
|
|
213
214
|
"@expo/metro": "~58.0.0-rc.0",
|
|
214
|
-
"@expo/metro-config": "~58.0.
|
|
215
|
+
"@expo/metro-config": "~58.0.9",
|
|
215
216
|
"@ungap/structured-clone": "^1.3.0",
|
|
216
|
-
"babel-preset-expo": "~58.0.
|
|
217
|
-
"expo-asset": "~58.0.
|
|
218
|
-
"expo-constants": "~58.0.
|
|
217
|
+
"babel-preset-expo": "~58.0.10",
|
|
218
|
+
"expo-asset": "~58.0.12",
|
|
219
|
+
"expo-constants": "~58.0.10",
|
|
219
220
|
"expo-file-system": "~58.0.5",
|
|
220
|
-
"expo-font": "~58.0.
|
|
221
|
+
"expo-font": "~58.0.6",
|
|
221
222
|
"expo-keep-awake": "~58.0.3",
|
|
222
|
-
"expo-modules-autolinking": "~58.0.
|
|
223
|
-
"expo-modules-core": "~58.0.
|
|
223
|
+
"expo-modules-autolinking": "~58.0.9",
|
|
224
|
+
"expo-modules-core": "~58.0.13",
|
|
224
225
|
"pretty-format": "^29.7.0",
|
|
225
226
|
"react-refresh": "^0.14.2",
|
|
226
227
|
"whatwg-url-minimum": "^0.2.0"
|
|
227
228
|
},
|
|
228
229
|
"devDependencies": {
|
|
229
|
-
"@expo/
|
|
230
|
-
"@expo/metro-runtime": "58.0.10",
|
|
230
|
+
"@expo/metro-runtime": "58.0.11",
|
|
231
231
|
"@types/node": "^22.14.0",
|
|
232
232
|
"@types/react": "~19.3.0",
|
|
233
|
-
"expo-updates": "58.0.
|
|
233
|
+
"expo-updates": "58.0.15",
|
|
234
234
|
"npm-run-all2": "^8.0.4",
|
|
235
235
|
"react": "19.3.0",
|
|
236
236
|
"react-dom": "19.3.0",
|
|
@@ -208,8 +208,10 @@ function resolveAppTarget(appRoot) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
|
-
* Podfile.properties.json
|
|
212
|
-
*
|
|
211
|
+
* Podfile.properties.json. Missing → {}; present but unusable → throw, since every gate would
|
|
212
|
+
* silently fall to its default. This intentionally differs from
|
|
213
|
+
* precompiled_modules.rb#read_podfile_properties and the Podfile template, which both rescue an
|
|
214
|
+
* invalid file to {}.
|
|
213
215
|
*/
|
|
214
216
|
function readPodfileProperties(propertiesPath) {
|
|
215
217
|
if (typeof propertiesPath !== 'string' || propertiesPath.length === 0) return {};
|
|
@@ -42,8 +42,8 @@ it('asserts in production when attempting to load a bundle and the user-defined
|
|
|
42
42
|
'Second.bundle?platform=ios&modulesOnly=true&runModule=false&runtimeBytecodeVersion='
|
|
43
43
|
)
|
|
44
44
|
).rejects.toThrow();
|
|
45
|
-
expect(HMRClient.registerBundle).not.
|
|
46
|
-
expect(fetchThenEvalAsync).not.
|
|
45
|
+
expect(HMRClient.registerBundle).not.toHaveBeenCalled();
|
|
46
|
+
expect(fetchThenEvalAsync).not.toHaveBeenCalled();
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
it('loads a bundle in production with user-defined location.origin', async () => {
|
package/src/winter/__tests__/{TextDecoderStream.test.ios.ts → TextDecoderStream.test.native.ts}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
describe('TextDecoderStream', () => {
|
|
2
2
|
it(`uses the Expo built-in APIs`, () => {
|
|
3
|
-
expect((TextDecoder as any)[Symbol.for('expo.builtin')]).toBe(true);
|
|
4
3
|
expect((TextDecoderStream as any)[Symbol.for('expo.builtin')]).toBe(true);
|
|
5
4
|
});
|
|
6
5
|
|
|
@@ -101,6 +100,28 @@ describe('TextDecoderStream', () => {
|
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
|
|
103
|
+
it.each([
|
|
104
|
+
[
|
|
105
|
+
'latin1',
|
|
106
|
+
[
|
|
107
|
+
[0x63, 0x61],
|
|
108
|
+
[0x66, 0xe9],
|
|
109
|
+
],
|
|
110
|
+
'café',
|
|
111
|
+
],
|
|
112
|
+
['utf-16le', [[0x63], [0, 0x61, 0, 0x66, 0, 0xe9], [0]], 'café'],
|
|
113
|
+
])('streams %s using the runtime decoder', async (encoding, chunks, expected) => {
|
|
114
|
+
const stream = createStreamFromChunks(chunks.map((chunk) => new Uint8Array(chunk)));
|
|
115
|
+
const reader = stream.pipeThrough(new TextDecoderStream(encoding)).getReader();
|
|
116
|
+
let text = '';
|
|
117
|
+
while (true) {
|
|
118
|
+
const { value, done } = await reader.read();
|
|
119
|
+
if (done) break;
|
|
120
|
+
text += value;
|
|
121
|
+
}
|
|
122
|
+
expect(text).toBe(expected);
|
|
123
|
+
});
|
|
124
|
+
|
|
104
125
|
it('decodes simple UTF-8 text', async () => {
|
|
105
126
|
const text = 'Hello, world!';
|
|
106
127
|
const encoded = new TextEncoder().encode(text);
|
|
@@ -145,7 +166,7 @@ describe('TextDecoderStream', () => {
|
|
|
145
166
|
|
|
146
167
|
const reader = stream.pipeThrough(decoder).getReader();
|
|
147
168
|
|
|
148
|
-
await expect(reader.read()).rejects.toThrow(TypeError);
|
|
169
|
+
await expect(reader.read()).rejects.toThrow(expect.objectContaining({ name: 'TypeError' }));
|
|
149
170
|
});
|
|
150
171
|
|
|
151
172
|
it('respects ignoreBOM: true (preserves BOM)', async () => {
|
|
@@ -8,8 +8,6 @@ import '../../types';
|
|
|
8
8
|
import { installFormDataPatch } from './FormData';
|
|
9
9
|
import { installGlobal as install } from './installGlobal';
|
|
10
10
|
|
|
11
|
-
// https://encoding.spec.whatwg.org/#textdecoder
|
|
12
|
-
install('TextDecoder', () => require('./TextDecoder').TextDecoder);
|
|
13
11
|
// https://encoding.spec.whatwg.org/#interface-textdecoderstream
|
|
14
12
|
install('TextDecoderStream', () => require('./TextDecoderStream').TextDecoderStream);
|
|
15
13
|
// https://encoding.spec.whatwg.org/#interface-textencoderstream
|
package/template.tgz
CHANGED
|
Binary file
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class TextDecoder {
|
|
2
|
-
private readonly _state;
|
|
3
|
-
constructor(label?: string, options?: {
|
|
4
|
-
fatal?: boolean;
|
|
5
|
-
ignoreBOM?: boolean;
|
|
6
|
-
});
|
|
7
|
-
get encoding(): string;
|
|
8
|
-
get fatal(): boolean;
|
|
9
|
-
get ignoreBOM(): boolean;
|
|
10
|
-
decode(input?: ArrayBuffer | ArrayBufferView, options?: {
|
|
11
|
-
stream?: boolean;
|
|
12
|
-
}): string;
|
|
13
|
-
}
|