@aws-amplify/react-native 1.0.1-console-preview.deaebd5.0 → 1.0.1-console-preview.b5a42af.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +10 -0
- package/lib/apis/index.js.map +1 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +10 -5
- package/lib/index.js.map +1 -1
- package/lib/moduleLoaders/index.d.ts +5 -0
- package/lib/moduleLoaders/index.js +16 -0
- package/lib/moduleLoaders/index.js.map +1 -0
- package/lib/moduleLoaders/loadAsyncStorage.d.ts +2 -0
- package/lib/moduleLoaders/loadAsyncStorage.js +26 -0
- package/lib/moduleLoaders/loadAsyncStorage.js.map +1 -0
- package/lib/moduleLoaders/loadBuffer.d.ts +22 -0
- package/lib/moduleLoaders/loadBuffer.js +9 -0
- package/lib/moduleLoaders/loadBuffer.js.map +1 -0
- package/lib/moduleLoaders/loadGetRandomValues.d.ts +1 -0
- package/lib/moduleLoaders/loadGetRandomValues.js +21 -0
- package/lib/moduleLoaders/loadGetRandomValues.js.map +1 -0
- package/lib/moduleLoaders/loadNetInfo.d.ts +4 -0
- package/lib/moduleLoaders/loadNetInfo.js +26 -0
- package/lib/moduleLoaders/loadNetInfo.js.map +1 -0
- package/lib/moduleLoaders/loadUrlPolyfill.d.ts +1 -0
- package/lib/moduleLoaders/loadUrlPolyfill.js +21 -0
- package/lib/moduleLoaders/loadUrlPolyfill.js.map +1 -0
- package/lib-esm/apis/index.d.ts +2 -0
- package/lib-esm/apis/index.js +5 -0
- package/lib-esm/apis/index.js.map +1 -0
- package/lib-esm/index.d.ts +2 -2
- package/lib-esm/index.js +2 -2
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/moduleLoaders/index.d.ts +5 -0
- package/lib-esm/moduleLoaders/index.js +8 -0
- package/lib-esm/moduleLoaders/index.js.map +1 -0
- package/lib-esm/moduleLoaders/loadAsyncStorage.d.ts +2 -0
- package/lib-esm/moduleLoaders/loadAsyncStorage.js +22 -0
- package/lib-esm/moduleLoaders/loadAsyncStorage.js.map +1 -0
- package/lib-esm/moduleLoaders/loadBuffer.d.ts +22 -0
- package/lib-esm/moduleLoaders/loadBuffer.js +5 -0
- package/lib-esm/moduleLoaders/loadBuffer.js.map +1 -0
- package/lib-esm/moduleLoaders/loadGetRandomValues.d.ts +1 -0
- package/lib-esm/moduleLoaders/loadGetRandomValues.js +17 -0
- package/lib-esm/moduleLoaders/loadGetRandomValues.js.map +1 -0
- package/lib-esm/moduleLoaders/loadNetInfo.d.ts +4 -0
- package/lib-esm/moduleLoaders/loadNetInfo.js +22 -0
- package/lib-esm/moduleLoaders/loadNetInfo.js.map +1 -0
- package/lib-esm/moduleLoaders/loadUrlPolyfill.d.ts +1 -0
- package/lib-esm/moduleLoaders/loadUrlPolyfill.js +17 -0
- package/lib-esm/moduleLoaders/loadUrlPolyfill.js.map +1 -0
- package/package.json +13 -3
- package/src/apis/index.ts +5 -0
- package/src/index.ts +8 -2
- package/src/moduleLoaders/index.ts +8 -0
- package/src/moduleLoaders/loadAsyncStorage.ts +29 -0
- package/src/moduleLoaders/loadBuffer.ts +6 -0
- package/src/moduleLoaders/loadGetRandomValues.ts +19 -0
- package/src/moduleLoaders/loadNetInfo.ts +31 -0
- package/src/moduleLoaders/loadUrlPolyfill.ts +19 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.computeS = exports.computeModPow = void 0;
|
|
6
|
+
var computeModPow_1 = require("./computeModPow");
|
|
7
|
+
Object.defineProperty(exports, "computeModPow", { enumerable: true, get: function () { return computeModPow_1.computeModPow; } });
|
|
8
|
+
var computeS_1 = require("./computeS");
|
|
9
|
+
Object.defineProperty(exports, "computeS", { enumerable: true, get: function () { return computeS_1.computeS; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { computeModPow } from './apis
|
|
2
|
-
export {
|
|
1
|
+
export { computeModPow, computeS } from './apis';
|
|
2
|
+
export { loadAsyncStorage, loadNetInfo, loadBuffer, loadUrlPolyfill, loadGetRandomValues, } from './moduleLoaders';
|
package/lib/index.js
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.computeS = exports.computeModPow = void 0;
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "computeModPow", { enumerable: true, get: function () { return
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.loadGetRandomValues = exports.loadUrlPolyfill = exports.loadBuffer = exports.loadNetInfo = exports.loadAsyncStorage = exports.computeS = exports.computeModPow = void 0;
|
|
6
|
+
var apis_1 = require("./apis");
|
|
7
|
+
Object.defineProperty(exports, "computeModPow", { enumerable: true, get: function () { return apis_1.computeModPow; } });
|
|
8
|
+
Object.defineProperty(exports, "computeS", { enumerable: true, get: function () { return apis_1.computeS; } });
|
|
9
|
+
var moduleLoaders_1 = require("./moduleLoaders");
|
|
10
|
+
Object.defineProperty(exports, "loadAsyncStorage", { enumerable: true, get: function () { return moduleLoaders_1.loadAsyncStorage; } });
|
|
11
|
+
Object.defineProperty(exports, "loadNetInfo", { enumerable: true, get: function () { return moduleLoaders_1.loadNetInfo; } });
|
|
12
|
+
Object.defineProperty(exports, "loadBuffer", { enumerable: true, get: function () { return moduleLoaders_1.loadBuffer; } });
|
|
13
|
+
Object.defineProperty(exports, "loadUrlPolyfill", { enumerable: true, get: function () { return moduleLoaders_1.loadUrlPolyfill; } });
|
|
14
|
+
Object.defineProperty(exports, "loadGetRandomValues", { enumerable: true, get: function () { return moduleLoaders_1.loadGetRandomValues; } });
|
|
10
15
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,+BAAiD;AAAxC,qGAAA,aAAa,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAChC,iDAMyB;AALxB,iHAAA,gBAAgB,OAAA;AAChB,4GAAA,WAAW,OAAA;AACX,2GAAA,UAAU,OAAA;AACV,gHAAA,eAAe,OAAA;AACf,oHAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadGetRandomValues = exports.loadUrlPolyfill = exports.loadBuffer = exports.loadNetInfo = exports.loadAsyncStorage = void 0;
|
|
6
|
+
var loadAsyncStorage_1 = require("./loadAsyncStorage");
|
|
7
|
+
Object.defineProperty(exports, "loadAsyncStorage", { enumerable: true, get: function () { return loadAsyncStorage_1.loadAsyncStorage; } });
|
|
8
|
+
var loadNetInfo_1 = require("./loadNetInfo");
|
|
9
|
+
Object.defineProperty(exports, "loadNetInfo", { enumerable: true, get: function () { return loadNetInfo_1.loadNetInfo; } });
|
|
10
|
+
var loadBuffer_1 = require("./loadBuffer");
|
|
11
|
+
Object.defineProperty(exports, "loadBuffer", { enumerable: true, get: function () { return loadBuffer_1.loadBuffer; } });
|
|
12
|
+
var loadUrlPolyfill_1 = require("./loadUrlPolyfill");
|
|
13
|
+
Object.defineProperty(exports, "loadUrlPolyfill", { enumerable: true, get: function () { return loadUrlPolyfill_1.loadUrlPolyfill; } });
|
|
14
|
+
var loadGetRandomValues_1 = require("./loadGetRandomValues");
|
|
15
|
+
Object.defineProperty(exports, "loadGetRandomValues", { enumerable: true, get: function () { return loadGetRandomValues_1.loadGetRandomValues; } });
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/moduleLoaders/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadAsyncStorage = void 0;
|
|
6
|
+
const loadAsyncStorage = () => {
|
|
7
|
+
try {
|
|
8
|
+
// metro bundler requires static string for loading module.
|
|
9
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
10
|
+
const module = require('@react-native-async-storage/async-storage')
|
|
11
|
+
?.default;
|
|
12
|
+
if (module) {
|
|
13
|
+
return module;
|
|
14
|
+
}
|
|
15
|
+
throw new Error('Ensure `@react-native-async-storage/async-storage` is installed and linked.');
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
19
|
+
// would be confused when there is a `import` in the same file importing
|
|
20
|
+
// another module and that causes error
|
|
21
|
+
const message = e.message.replace(/undefined/g, '@react-native-async-storage/async-storage');
|
|
22
|
+
throw new Error(message);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.loadAsyncStorage = loadAsyncStorage;
|
|
26
|
+
//# sourceMappingURL=loadAsyncStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadAsyncStorage.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadAsyncStorage.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAI/B,MAAM,gBAAgB,GAAG,GAAuB,EAAE;IACxD,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,MAAM,MAAM,GAAG,OAAO,CAAC,2CAA2C,CAAC;YAClE,EAAE,OAA6B,CAAC;QACjC,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC;SACd;QAED,MAAM,IAAI,KAAK,CACd,6EAA6E,CAC7E,CAAC;KACF;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,2CAA2C,CAC3C,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC;AAvBW,QAAA,gBAAgB,oBAuB3B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const loadBuffer: () => {
|
|
3
|
+
new (str: string, encoding?: string | undefined): Buffer;
|
|
4
|
+
new (size: number): Buffer;
|
|
5
|
+
new (array: Uint8Array): Buffer;
|
|
6
|
+
new (arrayBuffer: ArrayBuffer): Buffer;
|
|
7
|
+
new (array: readonly any[]): Buffer;
|
|
8
|
+
new (buffer: Buffer): Buffer;
|
|
9
|
+
prototype: Buffer;
|
|
10
|
+
from(arrayBuffer: ArrayBuffer, byteOffset?: number | undefined, length?: number | undefined): Buffer;
|
|
11
|
+
from(data: string | readonly any[] | Buffer | ArrayBuffer): Buffer;
|
|
12
|
+
from(str: string, encoding?: string | undefined): Buffer;
|
|
13
|
+
isBuffer(obj: any): obj is Buffer;
|
|
14
|
+
isEncoding(encoding: string): boolean;
|
|
15
|
+
byteLength(string: string | Buffer | ArrayBuffer | DataView, encoding?: string | undefined): number;
|
|
16
|
+
concat(list: readonly Buffer[], totalLength?: number | undefined): Buffer;
|
|
17
|
+
compare(buf1: Buffer, buf2: Buffer): number;
|
|
18
|
+
alloc(size: number, fill?: string | number | Buffer | undefined, encoding?: string | undefined): Buffer;
|
|
19
|
+
allocUnsafe(size: number): Buffer;
|
|
20
|
+
allocUnsafeSlow(size: number): Buffer;
|
|
21
|
+
poolSize: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadBuffer = void 0;
|
|
6
|
+
const buffer_1 = require("buffer");
|
|
7
|
+
const loadBuffer = () => buffer_1.Buffer;
|
|
8
|
+
exports.loadBuffer = loadBuffer;
|
|
9
|
+
//# sourceMappingURL=loadBuffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadBuffer.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadBuffer.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,mCAAgC;AAEzB,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,eAAM,CAAC;AAA1B,QAAA,UAAU,cAAgB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadGetRandomValues: () => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadGetRandomValues = void 0;
|
|
6
|
+
const loadGetRandomValues = () => {
|
|
7
|
+
try {
|
|
8
|
+
// metro bundler requires static string for loading module.
|
|
9
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
10
|
+
require('react-native-get-random-values');
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
14
|
+
// would be confused when there is a `import` in the same file importing
|
|
15
|
+
// another module and that causes error
|
|
16
|
+
const message = e.message.replace(/undefined/g, '@react-native-community/netinfo');
|
|
17
|
+
throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.loadGetRandomValues = loadGetRandomValues;
|
|
21
|
+
//# sourceMappingURL=loadGetRandomValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadGetRandomValues.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadGetRandomValues.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAE/B,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACvC,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,OAAO,CAAC,gCAAgC,CAAC,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,iCAAiC,CACjC,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC;AAfW,QAAA,mBAAmB,uBAe9B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadNetInfo = void 0;
|
|
6
|
+
const loadNetInfo = () => {
|
|
7
|
+
try {
|
|
8
|
+
// metro bundler requires static string for loading module.
|
|
9
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
10
|
+
const module = require('@react-native-community/netinfo')
|
|
11
|
+
?.default;
|
|
12
|
+
if (module) {
|
|
13
|
+
return module;
|
|
14
|
+
}
|
|
15
|
+
throw new Error('Ensure `@react-native-community/netinfo` is installed and linked.');
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
19
|
+
// would be confused when there is a `import` in the same file importing
|
|
20
|
+
// another module and that causes error
|
|
21
|
+
const message = e.message.replace(/undefined/g, '@react-native-community/netinfo');
|
|
22
|
+
throw new Error(message);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.loadNetInfo = loadNetInfo;
|
|
26
|
+
//# sourceMappingURL=loadNetInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadNetInfo.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadNetInfo.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAM/B,MAAM,WAAW,GAAG,GAAkB,EAAE;IAC9C,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,MAAM,MAAM,GAAG,OAAO,CAAC,iCAAiC,CAAC;YACxD,EAAE,OAAwB,CAAC;QAC5B,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC;SACd;QAED,MAAM,IAAI,KAAK,CACd,mEAAmE,CACnE,CAAC;KACF;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,iCAAiC,CACjC,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC;AAvBW,QAAA,WAAW,eAuBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadUrlPolyfill: () => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.loadUrlPolyfill = void 0;
|
|
6
|
+
const loadUrlPolyfill = () => {
|
|
7
|
+
try {
|
|
8
|
+
// metro bundler requires static string for loading module.
|
|
9
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
10
|
+
require('react-native-url-polyfill/auto');
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
14
|
+
// would be confused when there is a `import` in the same file importing
|
|
15
|
+
// another module and that causes error
|
|
16
|
+
const message = e.message.replace(/undefined/g, '@react-native-community/netinfo');
|
|
17
|
+
throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.loadUrlPolyfill = loadUrlPolyfill;
|
|
21
|
+
//# sourceMappingURL=loadUrlPolyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadUrlPolyfill.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadUrlPolyfill.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAE/B,MAAM,eAAe,GAAG,GAAG,EAAE;IACnC,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,OAAO,CAAC,gCAAgC,CAAC,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,iCAAiC,CACjC,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC;AAfW,QAAA,eAAe,mBAe1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/lib-esm/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { computeModPow } from './apis
|
|
2
|
-
export {
|
|
1
|
+
export { computeModPow, computeS } from './apis';
|
|
2
|
+
export { loadAsyncStorage, loadNetInfo, loadBuffer, loadUrlPolyfill, loadGetRandomValues, } from './moduleLoaders';
|
package/lib-esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export { computeModPow } from './apis
|
|
4
|
-
export {
|
|
3
|
+
export { computeModPow, computeS } from './apis';
|
|
4
|
+
export { loadAsyncStorage, loadNetInfo, loadBuffer, loadUrlPolyfill, loadGetRandomValues, } from './moduleLoaders';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/lib-esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EACN,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,eAAe,EACf,mBAAmB,GACnB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { loadAsyncStorage } from './loadAsyncStorage';
|
|
4
|
+
export { loadNetInfo } from './loadNetInfo';
|
|
5
|
+
export { loadBuffer } from './loadBuffer';
|
|
6
|
+
export { loadUrlPolyfill } from './loadUrlPolyfill';
|
|
7
|
+
export { loadGetRandomValues } from './loadGetRandomValues';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/moduleLoaders/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export const loadAsyncStorage = () => {
|
|
4
|
+
try {
|
|
5
|
+
// metro bundler requires static string for loading module.
|
|
6
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
7
|
+
const module = require('@react-native-async-storage/async-storage')
|
|
8
|
+
?.default;
|
|
9
|
+
if (module) {
|
|
10
|
+
return module;
|
|
11
|
+
}
|
|
12
|
+
throw new Error('Ensure `@react-native-async-storage/async-storage` is installed and linked.');
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
16
|
+
// would be confused when there is a `import` in the same file importing
|
|
17
|
+
// another module and that causes error
|
|
18
|
+
const message = e.message.replace(/undefined/g, '@react-native-async-storage/async-storage');
|
|
19
|
+
throw new Error(message);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=loadAsyncStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadAsyncStorage.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadAsyncStorage.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAuB,EAAE;IACxD,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,MAAM,MAAM,GAAG,OAAO,CAAC,2CAA2C,CAAC;YAClE,EAAE,OAA6B,CAAC;QACjC,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC;SACd;QAED,MAAM,IAAI,KAAK,CACd,6EAA6E,CAC7E,CAAC;KACF;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,2CAA2C,CAC3C,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const loadBuffer: () => {
|
|
3
|
+
new (str: string, encoding?: string | undefined): Buffer;
|
|
4
|
+
new (size: number): Buffer;
|
|
5
|
+
new (array: Uint8Array): Buffer;
|
|
6
|
+
new (arrayBuffer: ArrayBuffer): Buffer;
|
|
7
|
+
new (array: readonly any[]): Buffer;
|
|
8
|
+
new (buffer: Buffer): Buffer;
|
|
9
|
+
prototype: Buffer;
|
|
10
|
+
from(arrayBuffer: ArrayBuffer, byteOffset?: number | undefined, length?: number | undefined): Buffer;
|
|
11
|
+
from(data: string | readonly any[] | Buffer | ArrayBuffer): Buffer;
|
|
12
|
+
from(str: string, encoding?: string | undefined): Buffer;
|
|
13
|
+
isBuffer(obj: any): obj is Buffer;
|
|
14
|
+
isEncoding(encoding: string): boolean;
|
|
15
|
+
byteLength(string: string | Buffer | ArrayBuffer | DataView, encoding?: string | undefined): number;
|
|
16
|
+
concat(list: readonly Buffer[], totalLength?: number | undefined): Buffer;
|
|
17
|
+
compare(buf1: Buffer, buf2: Buffer): number;
|
|
18
|
+
alloc(size: number, fill?: string | number | Buffer | undefined, encoding?: string | undefined): Buffer;
|
|
19
|
+
allocUnsafe(size: number): Buffer;
|
|
20
|
+
allocUnsafeSlow(size: number): Buffer;
|
|
21
|
+
poolSize: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadBuffer.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadBuffer.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadGetRandomValues: () => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export const loadGetRandomValues = () => {
|
|
4
|
+
try {
|
|
5
|
+
// metro bundler requires static string for loading module.
|
|
6
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
7
|
+
require('react-native-get-random-values');
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
11
|
+
// would be confused when there is a `import` in the same file importing
|
|
12
|
+
// another module and that causes error
|
|
13
|
+
const message = e.message.replace(/undefined/g, '@react-native-community/netinfo');
|
|
14
|
+
throw new Error(message);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=loadGetRandomValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadGetRandomValues.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadGetRandomValues.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACvC,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,OAAO,CAAC,gCAAgC,CAAC,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,iCAAiC,CACjC,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export const loadNetInfo = () => {
|
|
4
|
+
try {
|
|
5
|
+
// metro bundler requires static string for loading module.
|
|
6
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
7
|
+
const module = require('@react-native-community/netinfo')
|
|
8
|
+
?.default;
|
|
9
|
+
if (module) {
|
|
10
|
+
return module;
|
|
11
|
+
}
|
|
12
|
+
throw new Error('Ensure `@react-native-community/netinfo` is installed and linked.');
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
16
|
+
// would be confused when there is a `import` in the same file importing
|
|
17
|
+
// another module and that causes error
|
|
18
|
+
const message = e.message.replace(/undefined/g, '@react-native-community/netinfo');
|
|
19
|
+
throw new Error(message);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=loadNetInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadNetInfo.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadNetInfo.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAMtC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAkB,EAAE;IAC9C,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,MAAM,MAAM,GAAG,OAAO,CAAC,iCAAiC,CAAC;YACxD,EAAE,OAAwB,CAAC;QAC5B,IAAI,MAAM,EAAE;YACX,OAAO,MAAM,CAAC;SACd;QAED,MAAM,IAAI,KAAK,CACd,mEAAmE,CACnE,CAAC;KACF;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,iCAAiC,CACjC,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loadUrlPolyfill: () => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export const loadUrlPolyfill = () => {
|
|
4
|
+
try {
|
|
5
|
+
// metro bundler requires static string for loading module.
|
|
6
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
7
|
+
require('react-native-url-polyfill/auto');
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
11
|
+
// would be confused when there is a `import` in the same file importing
|
|
12
|
+
// another module and that causes error
|
|
13
|
+
const message = e.message.replace(/undefined/g, '@react-native-community/netinfo');
|
|
14
|
+
throw new Error(message);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=loadUrlPolyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadUrlPolyfill.js","sourceRoot":"","sources":["../../src/moduleLoaders/loadUrlPolyfill.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IACnC,IAAI;QACH,2DAA2D;QAC3D,kFAAkF;QAClF,OAAO,CAAC,gCAAgC,CAAC,CAAC;KAC1C;IAAC,OAAO,CAAC,EAAE;QACX,wEAAwE;QACxE,wEAAwE;QACxE,uCAAuC;QACvC,MAAM,OAAO,GAAI,CAAW,CAAC,OAAO,CAAC,OAAO,CAC3C,YAAY,EACZ,iCAAiC,CACjC,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KACzB;AACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/react-native",
|
|
3
|
-
"version": "1.0.1-console-preview.
|
|
3
|
+
"version": "1.0.1-console-preview.b5a42af.0+b5a42af",
|
|
4
4
|
"description": "React Native core module for aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -23,12 +23,22 @@
|
|
|
23
23
|
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
|
|
24
24
|
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88.21"
|
|
25
25
|
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"base-64": "^1.0.0",
|
|
28
|
+
"buffer": "^6.0.3",
|
|
29
|
+
"react-native-url-polyfill": "^2.0.0"
|
|
30
|
+
},
|
|
26
31
|
"peerDependencies": {
|
|
27
|
-
"react-native": ">=0.70"
|
|
32
|
+
"react-native": ">=0.70",
|
|
33
|
+
"react-native-get-random-values": ">=1.9.0"
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
36
|
+
"@react-native-async-storage/async-storage": "^1.17.12",
|
|
37
|
+
"@react-native-community/netinfo": "4.7.0",
|
|
38
|
+
"@types/base-64": "1.0.0",
|
|
30
39
|
"@types/react-native": "0.70.0",
|
|
31
40
|
"react-native": "0.70.0",
|
|
41
|
+
"react-native-get-random-values": "1.9.0",
|
|
32
42
|
"typescript": "5.1.6"
|
|
33
43
|
},
|
|
34
44
|
"react-native": {
|
|
@@ -53,5 +63,5 @@
|
|
|
53
63
|
"src"
|
|
54
64
|
],
|
|
55
65
|
"source": "src/index",
|
|
56
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "b5a42af519fb741bb8056a814addd8804c8f60ec"
|
|
57
67
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
export { computeModPow } from './apis
|
|
5
|
-
export {
|
|
4
|
+
export { computeModPow, computeS } from './apis';
|
|
5
|
+
export {
|
|
6
|
+
loadAsyncStorage,
|
|
7
|
+
loadNetInfo,
|
|
8
|
+
loadBuffer,
|
|
9
|
+
loadUrlPolyfill,
|
|
10
|
+
loadGetRandomValues,
|
|
11
|
+
} from './moduleLoaders';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export { loadAsyncStorage } from './loadAsyncStorage';
|
|
5
|
+
export { loadNetInfo } from './loadNetInfo';
|
|
6
|
+
export { loadBuffer } from './loadBuffer';
|
|
7
|
+
export { loadUrlPolyfill } from './loadUrlPolyfill';
|
|
8
|
+
export { loadGetRandomValues } from './loadGetRandomValues';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { AsyncStorageStatic } from '@react-native-async-storage/async-storage';
|
|
5
|
+
|
|
6
|
+
export const loadAsyncStorage = (): AsyncStorageStatic => {
|
|
7
|
+
try {
|
|
8
|
+
// metro bundler requires static string for loading module.
|
|
9
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
10
|
+
const module = require('@react-native-async-storage/async-storage')
|
|
11
|
+
?.default as AsyncStorageStatic;
|
|
12
|
+
if (module) {
|
|
13
|
+
return module;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
throw new Error(
|
|
17
|
+
'Ensure `@react-native-async-storage/async-storage` is installed and linked.'
|
|
18
|
+
);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
21
|
+
// would be confused when there is a `import` in the same file importing
|
|
22
|
+
// another module and that causes error
|
|
23
|
+
const message = (e as Error).message.replace(
|
|
24
|
+
/undefined/g,
|
|
25
|
+
'@react-native-async-storage/async-storage'
|
|
26
|
+
);
|
|
27
|
+
throw new Error(message);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export const loadGetRandomValues = () => {
|
|
5
|
+
try {
|
|
6
|
+
// metro bundler requires static string for loading module.
|
|
7
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
8
|
+
require('react-native-get-random-values');
|
|
9
|
+
} catch (e) {
|
|
10
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
11
|
+
// would be confused when there is a `import` in the same file importing
|
|
12
|
+
// another module and that causes error
|
|
13
|
+
const message = (e as Error).message.replace(
|
|
14
|
+
/undefined/g,
|
|
15
|
+
'@react-native-community/netinfo'
|
|
16
|
+
);
|
|
17
|
+
throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type NetInfo from '@react-native-community/netinfo';
|
|
5
|
+
|
|
6
|
+
type NetInfoModule = typeof NetInfo;
|
|
7
|
+
|
|
8
|
+
export const loadNetInfo = (): NetInfoModule => {
|
|
9
|
+
try {
|
|
10
|
+
// metro bundler requires static string for loading module.
|
|
11
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
12
|
+
const module = require('@react-native-community/netinfo')
|
|
13
|
+
?.default as NetInfoModule;
|
|
14
|
+
if (module) {
|
|
15
|
+
return module;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
throw new Error(
|
|
19
|
+
'Ensure `@react-native-community/netinfo` is installed and linked.'
|
|
20
|
+
);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
23
|
+
// would be confused when there is a `import` in the same file importing
|
|
24
|
+
// another module and that causes error
|
|
25
|
+
const message = (e as Error).message.replace(
|
|
26
|
+
/undefined/g,
|
|
27
|
+
'@react-native-community/netinfo'
|
|
28
|
+
);
|
|
29
|
+
throw new Error(message);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export const loadUrlPolyfill = () => {
|
|
5
|
+
try {
|
|
6
|
+
// metro bundler requires static string for loading module.
|
|
7
|
+
// See: https://facebook.github.io/metro/docs/configuration/#dynamicdepsinpackages
|
|
8
|
+
require('react-native-url-polyfill/auto');
|
|
9
|
+
} catch (e) {
|
|
10
|
+
// The error parsing logic cannot be extract as with metro the `require`
|
|
11
|
+
// would be confused when there is a `import` in the same file importing
|
|
12
|
+
// another module and that causes error
|
|
13
|
+
const message = (e as Error).message.replace(
|
|
14
|
+
/undefined/g,
|
|
15
|
+
'@react-native-community/netinfo'
|
|
16
|
+
);
|
|
17
|
+
throw new Error(message);
|
|
18
|
+
}
|
|
19
|
+
};
|