@expo/metro-runtime 1.0.1 → 1.1.1

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.
Files changed (52) hide show
  1. package/build/async-require/__tests__/buildAsyncRequire.test.d.ts +3 -0
  2. package/build/async-require/__tests__/buildAsyncRequire.test.d.ts.map +1 -0
  3. package/build/async-require/__tests__/buildAsyncRequire.test.js +71 -0
  4. package/build/async-require/__tests__/buildAsyncRequire.test.js.map +1 -0
  5. package/build/async-require/__tests__/buildUrlForBundle.test.native.d.ts +3 -0
  6. package/build/async-require/__tests__/buildUrlForBundle.test.native.d.ts.map +1 -0
  7. package/build/async-require/__tests__/buildUrlForBundle.test.native.js +38 -0
  8. package/build/async-require/__tests__/buildUrlForBundle.test.native.js.map +1 -0
  9. package/build/async-require/__tests__/buildUrlForBundle.test.web.d.ts +2 -0
  10. package/build/async-require/__tests__/buildUrlForBundle.test.web.d.ts.map +1 -0
  11. package/build/async-require/__tests__/buildUrlForBundle.test.web.js +13 -0
  12. package/build/async-require/__tests__/buildUrlForBundle.test.web.js.map +1 -0
  13. package/build/async-require/__tests__/fetchAsync.test.web.d.ts +2 -0
  14. package/build/async-require/__tests__/fetchAsync.test.web.d.ts.map +1 -0
  15. package/build/async-require/__tests__/fetchAsync.test.web.js +22 -0
  16. package/build/async-require/__tests__/fetchAsync.test.web.js.map +1 -0
  17. package/build/async-require/__tests__/loadBundlePolyfill.test.ios.d.ts +2 -0
  18. package/build/async-require/__tests__/loadBundlePolyfill.test.ios.d.ts.map +1 -0
  19. package/build/async-require/__tests__/loadBundlePolyfill.test.ios.js +32 -0
  20. package/build/async-require/__tests__/loadBundlePolyfill.test.ios.js.map +1 -0
  21. package/build/async-require/__tests__/loadBundlePolyfill.test.web.d.ts +2 -0
  22. package/build/async-require/__tests__/loadBundlePolyfill.test.web.d.ts.map +1 -0
  23. package/build/async-require/__tests__/loadBundlePolyfill.test.web.js +31 -0
  24. package/build/async-require/__tests__/loadBundlePolyfill.test.web.js.map +1 -0
  25. package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
  26. package/build/error-overlay/Data/LogBoxData.js +0 -3
  27. package/build/error-overlay/Data/LogBoxData.js.map +1 -1
  28. package/build/error-overlay/Data/parseLogBoxLog.d.ts +2 -2
  29. package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -1
  30. package/build/error-overlay/Data/parseLogBoxLog.js +0 -4
  31. package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
  32. package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -1
  33. package/build/error-overlay/modules/NativeLogBox/index.js +1 -3
  34. package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
  35. package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -1
  36. package/build/error-overlay/modules/stringifySafe/index.js +1 -2
  37. package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
  38. package/build/transformer/css/__tests__/css-transformer.test.web.d.ts +2 -0
  39. package/build/transformer/css/__tests__/css-transformer.test.web.d.ts.map +1 -0
  40. package/build/transformer/css/__tests__/css-transformer.test.web.js +111 -0
  41. package/build/transformer/css/__tests__/css-transformer.test.web.js.map +1 -0
  42. package/build/transformer/css/css-transformer.d.ts +6 -0
  43. package/build/transformer/css/css-transformer.d.ts.map +1 -0
  44. package/build/transformer/css/css-transformer.js +75 -0
  45. package/build/transformer/css/css-transformer.js.map +1 -0
  46. package/build/transformer/index.d.ts +8 -0
  47. package/build/transformer/index.d.ts.map +1 -0
  48. package/build/transformer/index.js +39 -0
  49. package/build/transformer/index.js.map +1 -0
  50. package/package.json +4 -4
  51. package/transformer.d.ts +1 -0
  52. package/transformer.js +1 -0
@@ -0,0 +1,3 @@
1
+ /// <reference types="jest" />
2
+ export declare const asMock: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
3
+ //# sourceMappingURL=buildAsyncRequire.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildAsyncRequire.test.d.ts","sourceRoot":"","sources":["../../../src/async-require/__tests__/buildAsyncRequire.test.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,MAAM,uBAAwB,GAAG,EAAE,KAAK,GAAG,kCAEC,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asMock = void 0;
4
+ const buildAsyncRequire_1 = require("../buildAsyncRequire");
5
+ const loadBundle_1 = require("../loadBundle");
6
+ const asMock = (fn) => fn;
7
+ exports.asMock = asMock;
8
+ jest.mock("../loadBundle", () => ({
9
+ loadBundleAsync: jest.fn(async () => { }),
10
+ }));
11
+ function getMockRequire() {
12
+ const mockRequire = jest.fn();
13
+ mockRequire.importAll = jest.fn();
14
+ return mockRequire;
15
+ }
16
+ const originalEnv = process.env.NODE_ENV;
17
+ beforeEach(() => {
18
+ process.env.NODE_ENV = "development";
19
+ });
20
+ afterAll(() => {
21
+ process.env.NODE_ENV = originalEnv;
22
+ });
23
+ it(`builds required object`, async () => {
24
+ const _require = getMockRequire();
25
+ const asyncRequire = (0, buildAsyncRequire_1.buildAsyncRequire)(_require);
26
+ expect(asyncRequire).toBeInstanceOf(Function);
27
+ expect(asyncRequire.prefetch).toBeInstanceOf(Function);
28
+ expect(asyncRequire.resource).toBeInstanceOf(Function);
29
+ });
30
+ it(`loads the module with \`loadBundleAsync\` if the module has not been loaded already`, async () => {
31
+ const _require = getMockRequire();
32
+ const asyncRequire = (0, buildAsyncRequire_1.buildAsyncRequire)(_require);
33
+ const myModule = asyncRequire(650, "", { "650": "SixFiveZero" });
34
+ expect(myModule).toEqual(expect.any(Promise));
35
+ // Did attempt to fetch the bundle
36
+ expect(loadBundle_1.loadBundleAsync).toBeCalledWith("SixFiveZero");
37
+ expect(_require.importAll).not.toBeCalled();
38
+ });
39
+ it(`fetches and returns an async module`, async () => {
40
+ const _require = getMockRequire();
41
+ (0, exports.asMock)(_require).mockReturnValueOnce({ foo: "bar" });
42
+ const asyncRequire = (0, buildAsyncRequire_1.buildAsyncRequire)(_require);
43
+ expect(asyncRequire).toBeInstanceOf(Function);
44
+ const myModule = await asyncRequire(2, "", {
45
+ "2": "Two",
46
+ });
47
+ // Fetch and load the bundle into memory.
48
+ expect(loadBundle_1.loadBundleAsync).toBeCalledWith("Two");
49
+ // Ensure the module was required using Metro after the bundle was loaded.
50
+ expect(_require).toBeCalledWith(2);
51
+ // Ensure the module was returned.
52
+ expect(myModule).toEqual({ foo: "bar" });
53
+ });
54
+ it(`disables async requires in production`, async () => {
55
+ process.env.NODE_ENV = "production";
56
+ const _require = getMockRequire();
57
+ (0, exports.asMock)(_require.importAll).mockReturnValueOnce({ foo: "bar" });
58
+ const asyncRequire = (0, buildAsyncRequire_1.buildAsyncRequire)(_require);
59
+ expect(asyncRequire).toBeInstanceOf(Function);
60
+ const myModule = await asyncRequire(2, "", {
61
+ "2": "Two",
62
+ });
63
+ // Fetch and load the bundle into memory.
64
+ expect(loadBundle_1.loadBundleAsync).not.toBeCalled();
65
+ // Ensure the module was required using Metro after the bundle was loaded.
66
+ expect(_require.importAll).toBeCalledWith(2);
67
+ expect(_require).not.toBeCalled();
68
+ // Ensure the module was returned.
69
+ expect(myModule).toEqual({ foo: "bar" });
70
+ });
71
+ //# sourceMappingURL=buildAsyncRequire.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildAsyncRequire.test.js","sourceRoot":"","sources":["../../../src/async-require/__tests__/buildAsyncRequire.test.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AACzD,8CAAgD;AAEzC,MAAM,MAAM,GAAG,CACpB,EAAK,EACmB,EAAE,CAAC,EAA4B,CAAC;AAF7C,QAAA,MAAM,UAEuC;AAE1D,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAChC,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC;CACzC,CAAC,CAAC,CAAC;AAEJ,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AEjD,MAAM,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAE9C,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE;QACzC,GAAG,EAAE,KAAK;KACX,CAAC,CAAC;IAEH,yCAAyC;IACzC,MAAM,CAAC,4BAAe,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAEzC,0EAA0E;IAC1E,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAElC,kCAAkC;IAClC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC","sourcesContent":["import { buildAsyncRequire } from \"../buildAsyncRequire\";\nimport { loadBundleAsync } from \"../loadBundle\";\n\nexport const asMock = <T extends (...args: any[]) => any>(\n fn: T\n): jest.MockedFunction<T> => fn as jest.MockedFunction<T>;\n\njest.mock(\"../loadBundle\", () => ({\n loadBundleAsync: jest.fn(async () => {}),\n}));\n\nfunction getMockRequire() {\n const mockRequire: any = jest.fn();\n mockRequire.importAll = jest.fn();\n\n return mockRequire;\n}\n\nconst originalEnv = process.env.NODE_ENV;\nbeforeEach(() => {\n process.env.NODE_ENV = \"development\";\n});\n\nafterAll(() => {\n process.env.NODE_ENV = originalEnv;\n});\n\nit(`builds required object`, async () => {\n const _require = getMockRequire();\n const asyncRequire = buildAsyncRequire(_require);\n\n expect(asyncRequire).toBeInstanceOf(Function);\n expect(asyncRequire.prefetch).toBeInstanceOf(Function);\n expect(asyncRequire.resource).toBeInstanceOf(Function);\n});\n\nit(`loads the module with \\`loadBundleAsync\\` if the module has not been loaded already`, async () => {\n const _require = getMockRequire();\n const asyncRequire = buildAsyncRequire(_require);\n\n const myModule = asyncRequire(650, \"\", { \"650\": \"SixFiveZero\" });\n expect(myModule).toEqual(expect.any(Promise));\n\n // Did attempt to fetch the bundle\n expect(loadBundleAsync).toBeCalledWith(\"SixFiveZero\");\n expect(_require.importAll).not.toBeCalled();\n});\n\nit(`fetches and returns an async module`, async () => {\n const _require = getMockRequire();\n\n asMock(_require).mockReturnValueOnce({ foo: \"bar\" });\n\n const asyncRequire = buildAsyncRequire(_require);\n\n expect(asyncRequire).toBeInstanceOf(Function);\n\n const myModule = await asyncRequire(2, \"\", {\n \"2\": \"Two\",\n });\n\n // Fetch and load the bundle into memory.\n expect(loadBundleAsync).toBeCalledWith(\"Two\");\n\n // Ensure the module was required using Metro after the bundle was loaded.\n expect(_require).toBeCalledWith(2);\n\n // Ensure the module was returned.\n expect(myModule).toEqual({ foo: \"bar\" });\n});\n\nit(`disables async requires in production`, async () => {\n process.env.NODE_ENV = \"production\";\n const _require = getMockRequire();\n\n asMock(_require.importAll).mockReturnValueOnce({ foo: \"bar\" });\n\n const asyncRequire = buildAsyncRequire(_require);\n\n expect(asyncRequire).toBeInstanceOf(Function);\n\n const myModule = await asyncRequire(2, \"\", {\n \"2\": \"Two\",\n });\n\n // Fetch and load the bundle into memory.\n expect(loadBundleAsync).not.toBeCalled();\n\n // Ensure the module was required using Metro after the bundle was loaded.\n expect(_require.importAll).toBeCalledWith(2);\n expect(_require).not.toBeCalled();\n\n // Ensure the module was returned.\n expect(myModule).toEqual({ foo: \"bar\" });\n});\n"]}
@@ -0,0 +1,3 @@
1
+ /// <reference types="jest" />
2
+ export declare const asMock: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
3
+ //# sourceMappingURL=buildUrlForBundle.test.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.test.native.d.ts","sourceRoot":"","sources":["../../../src/async-require/__tests__/buildUrlForBundle.test.native.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,MAAM,uBAAwB,GAAG,EAAE,KAAK,GAAG,kCAEC,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.asMock = void 0;
7
+ const getDevServer_1 = __importDefault(require("../../getDevServer"));
8
+ const buildUrlForBundle_1 = require("../buildUrlForBundle");
9
+ const asMock = (fn) => fn;
10
+ exports.asMock = asMock;
11
+ jest.mock("../../getDevServer", () => {
12
+ return jest.fn();
13
+ });
14
+ it(`returns an expected URL`, () => {
15
+ (0, exports.asMock)(getDevServer_1.default).mockReturnValueOnce({
16
+ bundleLoadedFromServer: true,
17
+ fullBundleUrl: "http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null",
18
+ url: "http://localhost:19000",
19
+ });
20
+ expect((0, buildUrlForBundle_1.buildUrlForBundle)("/foobar", {})).toEqual("http://localhost:19000/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null");
21
+ });
22
+ it(`returns an expected URL with extra parameters`, () => {
23
+ (0, exports.asMock)(getDevServer_1.default).mockReturnValueOnce({
24
+ bundleLoadedFromServer: true,
25
+ fullBundleUrl: "http://localhost:19000?platform=android",
26
+ url: "http://localhost:19000",
27
+ });
28
+ expect((0, buildUrlForBundle_1.buildUrlForBundle)("/more/than/one", { happy: "meal" })).toEqual("http://localhost:19000/more/than/one.bundle?platform=android&happy=meal");
29
+ });
30
+ it("throws on native when the bundle is not hosted", () => {
31
+ (0, exports.asMock)(getDevServer_1.default).mockReturnValueOnce({
32
+ bundleLoadedFromServer: false,
33
+ fullBundleUrl: "file://",
34
+ url: "file://",
35
+ });
36
+ expect(() => (0, buildUrlForBundle_1.buildUrlForBundle)("foobar", {})).toThrowErrorMatchingInlineSnapshot(`"This bundle was compiled with 'transformer.experimentalImportBundleSupport' in the 'metro.config.js' and can only be used when connected to a Metro server."`);
37
+ });
38
+ //# sourceMappingURL=buildUrlForBundle.test.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.test.native.js","sourceRoot":"","sources":["../../../src/async-require/__tests__/buildUrlForBundle.test.native.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA8C;AAC9C,4DAAyD;AAElD,MAAM,MAAM,GAAG,CACpB,EAAK,EACmB,EAAE,CAAC,EAA4B,CAAC;AAF7C,QAAA,MAAM,UAEuC;AAE1D,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACnC,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC;AACnB,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACjC,IAAA,cAAM,EAAC,sBAAY,CAAC,CAAC,mBAAmB,CAAC;QACvC,sBAAsB,EAAE,IAAI;QAC5B,aAAa,EACX,sGAAsG;QACxG,GAAG,EAAE,wBAAwB;KAC9B,CAAC,CAAC;IAEH,MAAM,CAAC,IAAA,qCAAiB,EAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAC9C,oHAAoH,CACrH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACvD,IAAA,cAAM,EAAC,sBAAY,CAAC,CAAC,mBAAmB,CAAC;QACvC,sBAAsB,EAAE,IAAI;QAC5B,aAAa,EAAE,yCAAyC;QACxD,GAAG,EAAE,wBAAwB;KAC9B,CAAC,CAAC;IAEH,MAAM,CAAC,IAAA,qCAAiB,EAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CACpE,yEAAyE,CAC1E,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;IACxD,IAAA,cAAM,EAAC,sBAAY,CAAC,CAAC,mBAAmB,CAAC;QACvC,sBAAsB,EAAE,KAAK;QAC7B,aAAa,EAAE,SAAS;QACxB,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,EAAE,CACV,IAAA,qCAAiB,EAAC,QAAQ,EAAE,EAAE,CAAC,CAChC,CAAC,kCAAkC,CAClC,+JAA+J,CAChK,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import getDevServer from \"../../getDevServer\";\nimport { buildUrlForBundle } from \"../buildUrlForBundle\";\n\nexport const asMock = <T extends (...args: any[]) => any>(\n fn: T\n): jest.MockedFunction<T> => fn as jest.MockedFunction<T>;\n\njest.mock(\"../../getDevServer\", () => {\n return jest.fn();\n});\n\nit(`returns an expected URL`, () => {\n asMock(getDevServer).mockReturnValueOnce({\n bundleLoadedFromServer: true,\n fullBundleUrl:\n \"http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\",\n url: \"http://localhost:19000\",\n });\n\n expect(buildUrlForBundle(\"/foobar\", {})).toEqual(\n \"http://localhost:19000/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\"\n );\n});\n\nit(`returns an expected URL with extra parameters`, () => {\n asMock(getDevServer).mockReturnValueOnce({\n bundleLoadedFromServer: true,\n fullBundleUrl: \"http://localhost:19000?platform=android\",\n url: \"http://localhost:19000\",\n });\n\n expect(buildUrlForBundle(\"/more/than/one\", { happy: \"meal\" })).toEqual(\n \"http://localhost:19000/more/than/one.bundle?platform=android&happy=meal\"\n );\n});\n\nit(\"throws on native when the bundle is not hosted\", () => {\n asMock(getDevServer).mockReturnValueOnce({\n bundleLoadedFromServer: false,\n fullBundleUrl: \"file://\",\n url: \"file://\",\n });\n\n expect(() =>\n buildUrlForBundle(\"foobar\", {})\n ).toThrowErrorMatchingInlineSnapshot(\n `\"This bundle was compiled with 'transformer.experimentalImportBundleSupport' in the 'metro.config.js' and can only be used when connected to a Metro server.\"`\n );\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=buildUrlForBundle.test.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.test.web.d.ts","sourceRoot":"","sources":["../../../src/async-require/__tests__/buildUrlForBundle.test.web.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const buildUrlForBundle_1 = require("../buildUrlForBundle");
4
+ it(`returns an expected URL with no params`, () => {
5
+ expect((0, buildUrlForBundle_1.buildUrlForBundle)("/foobar", {})).toEqual("/foobar.bundle");
6
+ });
7
+ it(`returns an expected URL with params`, () => {
8
+ expect((0, buildUrlForBundle_1.buildUrlForBundle)("foobar", { platform: "web" })).toEqual("/foobar.bundle?platform=web");
9
+ });
10
+ it(`returns an expected URL with non standard root`, () => {
11
+ expect((0, buildUrlForBundle_1.buildUrlForBundle)("/more/than/one", { happy: "meal" })).toEqual("/more/than/one.bundle?happy=meal");
12
+ });
13
+ //# sourceMappingURL=buildUrlForBundle.test.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.test.web.js","sourceRoot":"","sources":["../../../src/async-require/__tests__/buildUrlForBundle.test.web.ts"],"names":[],"mappings":";;AAAA,4DAAyD;AAEzD,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;IAChD,MAAM,CAAC,IAAA,qCAAiB,EAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACrE,CAAC,CAAC,CAAC;AACH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;IAC7C,MAAM,CAAC,IAAA,qCAAiB,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAC9D,6BAA6B,CAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;IACxD,MAAM,CAAC,IAAA,qCAAiB,EAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CACpE,kCAAkC,CACnC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { buildUrlForBundle } from \"../buildUrlForBundle\";\n\nit(`returns an expected URL with no params`, () => {\n expect(buildUrlForBundle(\"/foobar\", {})).toEqual(\"/foobar.bundle\");\n});\nit(`returns an expected URL with params`, () => {\n expect(buildUrlForBundle(\"foobar\", { platform: \"web\" })).toEqual(\n \"/foobar.bundle?platform=web\"\n );\n});\nit(`returns an expected URL with non standard root`, () => {\n expect(buildUrlForBundle(\"/more/than/one\", { happy: \"meal\" })).toEqual(\n \"/more/than/one.bundle?happy=meal\"\n );\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fetchAsync.test.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAsync.test.web.d.ts","sourceRoot":"","sources":["../../../src/async-require/__tests__/fetchAsync.test.web.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-env jest browser */
4
+ const fetchAsync_1 = require("../fetchAsync");
5
+ const originalFetch = global.fetch;
6
+ beforeAll(() => {
7
+ // eslint-disable-next-line
8
+ global.fetch = jest.fn(() =>
9
+ // eslint-disable-next-line
10
+ Promise.resolve({ body: "", text: jest.fn(() => "mock"), headers: {} }));
11
+ });
12
+ afterAll(() => {
13
+ global.fetch = originalFetch;
14
+ });
15
+ it(`fetches`, async () => {
16
+ await expect((0, fetchAsync_1.fetchAsync)("https://example.com")).resolves.toBeDefined();
17
+ expect(global.fetch).toBeCalledWith("https://example.com", {
18
+ headers: { "expo-platform": "web" },
19
+ method: "GET",
20
+ });
21
+ });
22
+ //# sourceMappingURL=fetchAsync.test.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAsync.test.web.js","sourceRoot":"","sources":["../../../src/async-require/__tests__/fetchAsync.test.web.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,8CAA2C;AAI3C,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;AAEnC,SAAS,CAAC,GAAG,EAAE;IACb,2BAA2B;IAC3B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;IAC1B,2BAA2B;IAC3B,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACxE,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,GAAG,EAAE;IACZ,MAAM,CAAC,KAAK,GAAG,aAAa,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IACvB,MAAM,MAAM,CAAC,IAAA,uBAAU,EAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IACvE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,qBAAqB,EAAE;QACzD,OAAO,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE;QACnC,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-env jest browser */\nimport { fetchAsync } from \"../fetchAsync\";\n\ndeclare const global: any;\n\nconst originalFetch = global.fetch;\n\nbeforeAll(() => {\n // eslint-disable-next-line\n global.fetch = jest.fn(() =>\n // eslint-disable-next-line\n Promise.resolve({ body: \"\", text: jest.fn(() => \"mock\"), headers: {} })\n );\n});\n\nafterAll(() => {\n global.fetch = originalFetch;\n});\n\nit(`fetches`, async () => {\n await expect(fetchAsync(\"https://example.com\")).resolves.toBeDefined();\n expect(global.fetch).toBeCalledWith(\"https://example.com\", {\n headers: { \"expo-platform\": \"web\" },\n method: \"GET\",\n });\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loadBundlePolyfill.test.ios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundlePolyfill.test.ios.d.ts","sourceRoot":"","sources":["../../../src/async-require/__tests__/loadBundlePolyfill.test.ios.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const HMRClient_1 = __importDefault(require("../../HMRClient"));
7
+ const LoadingView_1 = __importDefault(require("../../LoadingView"));
8
+ const fetchThenEval_1 = require("../fetchThenEval");
9
+ const loadBundlePolyfill_1 = require("../loadBundlePolyfill");
10
+ jest.mock("../../getDevServer", () => jest.fn(() => ({
11
+ bundleLoadedFromServer: true,
12
+ fullBundleUrl: "http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null",
13
+ url: "http://localhost:19000/",
14
+ })));
15
+ jest.mock("../fetchThenEval", () => ({
16
+ fetchThenEvalAsync: jest.fn(async () => { }),
17
+ }));
18
+ jest.mock("../../HMRClient", () => ({ registerBundle: jest.fn() }));
19
+ jest.mock("../../LoadingView", () => ({
20
+ showMessage: jest.fn(),
21
+ hide: jest.fn(),
22
+ }));
23
+ // Android uses a native impl
24
+ it("loads a bundle", async () => {
25
+ await (0, loadBundlePolyfill_1.loadBundleAsync)("Second");
26
+ expect(LoadingView_1.default.showMessage).toBeCalledWith("Downloading...", "load");
27
+ expect(LoadingView_1.default.hide).toBeCalledWith();
28
+ const url = "http://localhost:19000/Second.bundle?platform=ios&modulesOnly=true&runModule=false&runtimeBytecodeVersion=";
29
+ expect(HMRClient_1.default.registerBundle).toBeCalledWith(url);
30
+ expect(fetchThenEval_1.fetchThenEvalAsync).toBeCalledWith(url);
31
+ });
32
+ //# sourceMappingURL=loadBundlePolyfill.test.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundlePolyfill.test.ios.js","sourceRoot":"","sources":["../../../src/async-require/__tests__/loadBundlePolyfill.test.ios.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,oEAA4C;AAC5C,oDAAsD;AACtD,8DAAwD;AAExD,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CACnC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACb,sBAAsB,EAAE,IAAI;IAC5B,aAAa,EACX,sGAAsG;IACxG,GAAG,EAAE,yBAAyB;CAC/B,CAAC,CAAC,CACJ,CAAC;AAEF,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC;CAC5C,CAAC,CAAC,CAAC;AACJ,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACpE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;IACtB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;CAChB,CAAC,CAAC,CAAC;AAEJ,6BAA6B;AAE7B,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;IAC9B,MAAM,IAAA,oCAAe,EAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,CAAC,qBAAW,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACzE,MAAM,CAAC,qBAAW,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAC1C,MAAM,GAAG,GACP,4GAA4G,CAAC;IAC/G,MAAM,CAAC,mBAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,CAAC,kCAAkB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC","sourcesContent":["import HMRClient from \"../../HMRClient\";\nimport LoadingView from \"../../LoadingView\";\nimport { fetchThenEvalAsync } from \"../fetchThenEval\";\nimport { loadBundleAsync } from \"../loadBundlePolyfill\";\n\njest.mock(\"../../getDevServer\", () =>\n jest.fn(() => ({\n bundleLoadedFromServer: true,\n fullBundleUrl:\n \"http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\",\n url: \"http://localhost:19000/\",\n }))\n);\n\njest.mock(\"../fetchThenEval\", () => ({\n fetchThenEvalAsync: jest.fn(async () => {}),\n}));\njest.mock(\"../../HMRClient\", () => ({ registerBundle: jest.fn() }));\njest.mock(\"../../LoadingView\", () => ({\n showMessage: jest.fn(),\n hide: jest.fn(),\n}));\n\n// Android uses a native impl\n\nit(\"loads a bundle\", async () => {\n await loadBundleAsync(\"Second\");\n expect(LoadingView.showMessage).toBeCalledWith(\"Downloading...\", \"load\");\n expect(LoadingView.hide).toBeCalledWith();\n const url =\n \"http://localhost:19000/Second.bundle?platform=ios&modulesOnly=true&runModule=false&runtimeBytecodeVersion=\";\n expect(HMRClient.registerBundle).toBeCalledWith(url);\n expect(fetchThenEvalAsync).toBeCalledWith(url);\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loadBundlePolyfill.test.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundlePolyfill.test.web.d.ts","sourceRoot":"","sources":["../../../src/async-require/__tests__/loadBundlePolyfill.test.web.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const HMRClient_1 = __importDefault(require("../../HMRClient"));
7
+ const LoadingView_1 = __importDefault(require("../../LoadingView"));
8
+ const fetchThenEval_1 = require("../fetchThenEval");
9
+ const loadBundlePolyfill_1 = require("../loadBundlePolyfill");
10
+ jest.mock("../../getDevServer", () => jest.fn(() => ({
11
+ bundleLoadedFromServer: true,
12
+ fullBundleUrl: "http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null",
13
+ url: "http://localhost:19000/",
14
+ })));
15
+ jest.mock("../fetchThenEval", () => ({
16
+ fetchThenEvalAsync: jest.fn(async () => { }),
17
+ }));
18
+ jest.mock("../../HMRClient", () => ({ registerBundle: jest.fn() }));
19
+ jest.mock("../../LoadingView", () => ({
20
+ showMessage: jest.fn(),
21
+ hide: jest.fn(),
22
+ }));
23
+ it("loads a bundle", async () => {
24
+ await (0, loadBundlePolyfill_1.loadBundleAsync)("Second");
25
+ expect(LoadingView_1.default.showMessage).toBeCalledWith("Downloading...", "load");
26
+ expect(LoadingView_1.default.hide).toBeCalledWith();
27
+ const url = `/Second.bundle?modulesOnly=true&runModule=false&platform=web&runtimeBytecodeVersion=`;
28
+ expect(HMRClient_1.default.registerBundle).toBeCalledWith(url);
29
+ expect(fetchThenEval_1.fetchThenEvalAsync).toBeCalledWith(url);
30
+ });
31
+ //# sourceMappingURL=loadBundlePolyfill.test.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundlePolyfill.test.web.js","sourceRoot":"","sources":["../../../src/async-require/__tests__/loadBundlePolyfill.test.web.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,oEAA4C;AAC5C,oDAAsD;AACtD,8DAAwD;AAExD,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE,CACnC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACb,sBAAsB,EAAE,IAAI;IAC5B,aAAa,EACX,sGAAsG;IACxG,GAAG,EAAE,yBAAyB;CAC/B,CAAC,CAAC,CACJ,CAAC;AAEF,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC;IACnC,kBAAkB,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC;CAC5C,CAAC,CAAC,CAAC;AAEJ,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACpE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;IACtB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;CAChB,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;IAC9B,MAAM,IAAA,oCAAe,EAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,CAAC,qBAAW,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACzE,MAAM,CAAC,qBAAW,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,sFAAsF,CAAC;IACnG,MAAM,CAAC,mBAAS,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACrD,MAAM,CAAC,kCAAkB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC","sourcesContent":["import HMRClient from \"../../HMRClient\";\nimport LoadingView from \"../../LoadingView\";\nimport { fetchThenEvalAsync } from \"../fetchThenEval\";\nimport { loadBundleAsync } from \"../loadBundlePolyfill\";\n\njest.mock(\"../../getDevServer\", () =>\n jest.fn(() => ({\n bundleLoadedFromServer: true,\n fullBundleUrl:\n \"http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\",\n url: \"http://localhost:19000/\",\n }))\n);\n\njest.mock(\"../fetchThenEval\", () => ({\n fetchThenEvalAsync: jest.fn(async () => {}),\n}));\n\njest.mock(\"../../HMRClient\", () => ({ registerBundle: jest.fn() }));\njest.mock(\"../../LoadingView\", () => ({\n showMessage: jest.fn(),\n hide: jest.fn(),\n}));\n\nit(\"loads a bundle\", async () => {\n await loadBundleAsync(\"Second\");\n expect(LoadingView.showMessage).toBeCalledWith(\"Downloading...\", \"load\");\n expect(LoadingView.hide).toBeCalledWith();\n const url = `/Second.bundle?modulesOnly=true&runModule=false&platform=web&runtimeBytecodeVersion=`;\n expect(HMRClient.registerBundle).toBeCalledWith(url);\n expect(fetchThenEvalAsync).toBeCalledWith(url);\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxData.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EACR,cAAc,EACd,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,KAAK,aAAa,GAAG,GAAG,CAAC;AAEzB,MAAM,MAAM,QAA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AAG,IAAI,CAU/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,QAIhE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,QAIrE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,QAEjE;AAED,wBAAgB,KAAK,IAAI,IAAI,CAK5B;AAED,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAyB7D;AAED,wBAAgB,aAAa,IAAI,IAAI,CAOpC;AAED,wBAAgB,WAAW,IAAI,IAAI,CAQlC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAK5C;AAED,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,IAAI,CA6BjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhD;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAWxD;AAED,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GACjC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAqFzB"}
@@ -314,7 +314,6 @@ function withSubscription(WrappedComponent) {
314
314
  class LogBoxStateSubscription extends React.Component {
315
315
  constructor() {
316
316
  super(...arguments);
317
- // @ts-expect-error
318
317
  this.state = {
319
318
  logs: new Set(),
320
319
  isDisabled: false,
@@ -334,7 +333,6 @@ function withSubscription(WrappedComponent) {
334
333
  else if (selectedLogIndex >= logsArray.length - 1) {
335
334
  setSelectedLog(selectedLogIndex - 1);
336
335
  }
337
- // @ts-expect-error
338
336
  dismiss(logsArray[selectedLogIndex]);
339
337
  }
340
338
  };
@@ -362,7 +360,6 @@ function withSubscription(WrappedComponent) {
362
360
  return (React.createElement(LogContext_1.LogContext.Provider, { value: {
363
361
  selectedLogIndex: this.state.selectedLogIndex,
364
362
  isDisabled: this.state.isDisabled,
365
- // @ts-expect-error
366
363
  logs: Array.from(this.state.logs),
367
364
  } },
368
365
  this.props.children,
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,2CAAmD;AAEnD,6CAA0C;AAC1C,qDAAwD;AAOxD,2EAAmD;AACnD,iFAAyD;AA8CzD,MAAM,SAAS,GAAsC,IAAI,GAAG,EAAE,CAAC;AAC/D,MAAM,cAAc,GAAuB,IAAI,GAAG,EAAE,CAAC;AACrD,IAAI,IAAI,GAAe,IAAI,GAAG,EAAE,CAAC;AACjC,IAAI,aAAa,GAA2C,IAAI,CAAC;AACjE,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,cAAc,GAAG,CAAC,CAAC,CAAC;AAExB,MAAM,oBAAoB,GACxB,wEAAwE,CAAC;AAE3E,SAAS,YAAY;IACnB,OAAO;QACL,IAAI;QACJ,UAAU,EAAE,WAAW;QACvB,gBAAgB,EAAE,cAAc;KACjC,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAC/B,KAAoB,EACpB,cAAuB;IAEvB,MAAM,iBAAiB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAElE,IAAI,cAAc,IAAI,IAAI,EAAE;QAC1B,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;KACvC;IACD,iBAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC;AAVD,8CAUC;AAED,SAAgB,2BAA2B,CACzC,KAAoB,EACpB,cAAuB;IAEvB,KAAK,CAAC,OA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;YACrB,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;QACnD,CAAC;QAYD,MAAM;YACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACvB,oGAAoG;gBACpG,sFAAsF;gBACtF,OAAO,IAAI,CAAC;aACb;YAED,OAAO,CACL,oBAAC,uBAAU,CAAC,QAAQ,IAClB,KAAK,EAAE;oBACL,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB;oBAC7C,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU;oBACjC,mBAAmB;oBACnB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;iBAClC;gBAGA,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACpB,oBAAC,gBAAgB,OAAG,CACA,CACvB,CAAC;QACJ,CAAC;QAED,iBAAiB;YACf,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,oBAAoB;YAClB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE;gBAC9B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;aAClC;QACH,CAAC;KA2BF;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAxFD,4CAwFC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as React from \"react\";\n\nimport { LogBoxLog, StackType } from \"./LogBoxLog\";\nimport type { LogLevel } from \"./LogBoxLog\";\nimport { LogContext } from \"./LogContext\";\nimport { parseLogBoxException } from \"./parseLogBoxLog\";\nimport type {\n Message,\n Category,\n ComponentStack,\n ExtendedExceptionData,\n} from \"./parseLogBoxLog\";\nimport NativeLogBox from \"../modules/NativeLogBox\";\nimport parseErrorStack from \"../modules/parseErrorStack\";\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n \"An error was thrown when attempting to render log messages via LogBox.\";\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(\n error: ExtendedError,\n componentStack?: string\n): void {\n const ExceptionsManager = require(\"../modules/ExceptionsManager\");\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(\n error: ExtendedError,\n componentStack?: string\n): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === \"string\" && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === \"string\" && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediate(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === \"fatal\") {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate(\"component\");\n\n newLog.symbolicate(\"stack\", (status) => {\n if (addPendingLog && status !== \"PENDING\") {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== \"PENDING\") {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === \"syntax\") {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === \"syntax\") {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== \"warn\");\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter(\n (log) => log.level !== \"error\" && log.level !== \"fatal\"\n );\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(\n Array.from(logs).filter((log) => !isMessageIgnored(log.message.content))\n );\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(\n WrappedComponent: React.FC<object>\n): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<Props, State> {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n // @ts-expect-error\n state = {\n logs: new Set(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n // @ts-expect-error\n logs: Array.from(this.state.logs),\n }}\n >\n {/* @ts-expect-error */}\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n // @ts-expect-error\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
1
+ {"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,2CAAmD;AAEnD,6CAA0C;AAC1C,qDAAwD;AAOxD,2EAAmD;AACnD,iFAAyD;AA8CzD,MAAM,SAAS,GAAsC,IAAI,GAAG,EAAE,CAAC;AAC/D,MAAM,cAAc,GAAuB,IAAI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,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,oBAAoB;YAClB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE;gBAC9B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;aAClC;QACH,CAAC;KA0BF;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAvFD,4CAuFC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as React from \"react\";\n\nimport { LogBoxLog, StackType } from \"./LogBoxLog\";\nimport type { LogLevel } from \"./LogBoxLog\";\nimport { LogContext } from \"./LogContext\";\nimport { parseLogBoxException } from \"./parseLogBoxLog\";\nimport type {\n Message,\n Category,\n ComponentStack,\n ExtendedExceptionData,\n} from \"./parseLogBoxLog\";\nimport NativeLogBox from \"../modules/NativeLogBox\";\nimport parseErrorStack from \"../modules/parseErrorStack\";\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n \"An error was thrown when attempting to render log messages via LogBox.\";\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(\n error: ExtendedError,\n componentStack?: string\n): void {\n const ExceptionsManager = require(\"../modules/ExceptionsManager\");\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(\n error: ExtendedError,\n componentStack?: string\n): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === \"string\" && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === \"string\" && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediate(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === \"fatal\") {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate(\"component\");\n\n newLog.symbolicate(\"stack\", (status) => {\n if (addPendingLog && status !== \"PENDING\") {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== \"PENDING\") {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === \"syntax\") {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === \"syntax\") {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== \"warn\");\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter(\n (log) => log.level !== \"error\" && log.level !== \"fatal\"\n );\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(\n Array.from(logs).filter((log) => !isMessageIgnored(log.message.content))\n );\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(\n WrappedComponent: React.FC<object>\n): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<\n React.PropsWithChildren<Props>,\n State\n > {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}\n >\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
@@ -30,10 +30,10 @@ export type Message = {
30
30
  }[];
31
31
  };
32
32
  export type ComponentStack = CodeFrame[];
33
- export declare function parseInterpolation(args: readonly any[]): readonly {
33
+ export declare function parseInterpolation(args: readonly any[]): {
34
34
  category: Category;
35
35
  message: Message;
36
- }[];
36
+ };
37
37
  export declare function parseComponentStack(message: string): ComponentStack;
38
38
  export declare function parseLogBoxException(error: ExtendedExceptionData): LogBoxLogData;
39
39
  export declare function parseLogBoxLog(args: readonly any[]): {
@@ -1 +1 @@
1
- {"version":3,"file":"parseLogBoxLog.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,KAAK,aAAa,GAAG,GAAG,CAAC;AASzB,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,gBAAgB,EAAE,OAAO,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,QAAQ,E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,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IAKjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,EAAE,CAAC;AAIzC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG;IACxD,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAsEA;AAcD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAoCnE;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,qBAAqB,GAC3B,aAAa,CA8Hf;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG;IACpD,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CA4CA"}
@@ -73,7 +73,6 @@ function parseInterpolation(args) {
73
73
  categoryParts.push(...remainingArgs);
74
74
  contentParts.push(...remainingArgs);
75
75
  return {
76
- // @ts-expect-error
77
76
  category: categoryParts.join(" "),
78
77
  message: {
79
78
  content: contentParts.join(" "),
@@ -212,7 +211,6 @@ function parseLogBoxException(error) {
212
211
  }
213
212
  const componentStack = error.componentStack;
214
213
  if (error.isFatal || error.isComponentError) {
215
- // @ts-expect-error
216
214
  return {
217
215
  level: "fatal",
218
216
  stack: error.stack,
@@ -223,7 +221,6 @@ function parseLogBoxException(error) {
223
221
  }
224
222
  if (componentStack != null) {
225
223
  // It is possible that console errors have a componentStack.
226
- // @ts-expect-error
227
224
  return {
228
225
  level: "error",
229
226
  stack: error.stack,
@@ -277,7 +274,6 @@ function parseLogBoxLog(args) {
277
274
  }
278
275
  }
279
276
  }
280
- // @ts-expect-error
281
277
  return {
282
278
  ...parseInterpolation(argsWithoutComponentStack),
283
279
  componentStack,
@@ -1 +1 @@
1
- {"version":3,"file":"parseLogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,mBAAmB;AACnB,qFAA6D;AAG7D,iFAAyD;AACzD,6EAAqD;AAGrD,MAAM,4BAA4B,GAChC,gGAAgG,CAAC;AACnG,MAAM,6BAA6B,GACjC,sGAAsG,CAAC;AACzG,MAAM,kBAAkB,GACtB,6FAA6F,CAAC;AAgChG,MAAM,YAAY,GAAG,qBAAW,CAAC,GAAG,GAAG,IAAI,CAAC;AAE5C,SAAgB,kBAAkB,CAAC,IAAoB;IAIrD,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,mBAAmB,GAAyC,EAAE,CAAC;IAErE,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC5B,IAAI,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;QACpC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/C,MAAM,iBAAiB,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;QACvD,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;QAE7D,IAAI,cAAc,GAAG,EAAE,CAAC;QACxB,IAAI,aAAa,GAAG,EAAE,CAAC;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6C;QAC7C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE;gBACpD,qDAAqD;gBACrD,IAAI,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACnD,IAAI,eAAe,GAAG,CAAC,EAAE;oBACvB,+BAA+B;oBAC/B,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;iBACpC;gBACD,IAAI,eAAe,GAAG,CAAC,EAAE;oBACvB,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;iBAC/D;gBAED,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;aAC3C;iBAAM;gBACL,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACrC;SACF;KACF;IAED,mBAAmB;IACnB,OAAO;QACL,GAAG,kBAAkB,CAAC,yBAAyB,CAAC;QAChD,cAAc;KACf,CAAC;AACJ,CAAC;AAjDD,wCAiDC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// @ts-expect-error\nimport UTFSequence from \"react-native/Libraries/UTFSequence\";\n\nimport type { LogBoxLogData } from \"./LogBoxLog\";\nimport parseErrorStack from \"../modules/parseErrorStack\";\nimport stringifySafe from \"../modules/stringifySafe\";\ntype ExceptionData = any;\n\nconst BABEL_TRANSFORM_ERROR_FORMAT =\n /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/;\nconst BABEL_CODE_FRAME_ERROR_FORMAT =\n /^(?:TransformError )?(?:.*):? (?:.*?)(\\/.*): ([\\s\\S]+?)\\n([ >]{2}[\\d\\s]+ \\|[\\s\\S]+|\\u{001b}[\\s\\S]+)/u;\nconst METRO_ERROR_FORMAT =\n /^(?:InternalError Metro has encountered an error:) (.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/u;\n\nexport type ExtendedExceptionData = ExceptionData & {\n isComponentError: boolean;\n [key: string]: any;\n};\nexport type Category = string;\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\nexport type ComponentStack = CodeFrame[];\n\nconst SUBSTITUTION = UTFSequence.BOM + \"%s\";\n\nexport function parseInterpolation(args: readonly any[]): readonly {\n category: Category;\n message: Message;\n}[] {\n const categoryParts: string[] = [];\n const contentParts: string[] = [];\n const substitutionOffsets: { length: number; offset: number }[] = [];\n\n const remaining = [...args];\n if (typeof remaining[0] === \"string\") {\n const formatString = String(remaining.shift());\n const formatStringParts = formatString.split(\"%s\");\n const substitutionCount = formatStringParts.length - 1;\n const substitutions = remaining.splice(0, substitutionCount);\n\n let categoryString = \"\";\n let contentString = \"\";\n\n let substitutionIndex = 0;\n for (const formatStringPart of formatStringParts) {\n categoryString += formatStringPart;\n contentString += formatStringPart;\n\n if (substitutionIndex < substitutionCount) {\n if (substitutionIndex < substitutions.length) {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n const substitution =\n typeof substitutions[substitutionIndex] === \"string\"\n ? substitutions[substitutionIndex]\n : stringifySafe(substitutions[substitutionIndex]);\n substitutionOffsets.push({\n length: substitution.length,\n offset: contentString.length,\n });\n\n categoryString += SUBSTITUTION;\n contentString += substitution;\n } else {\n substitutionOffsets.push({\n length: 2,\n offset: contentString.length,\n });\n\n categoryString += \"%s\";\n contentString += \"%s\";\n }\n\n substitutionIndex++;\n }\n }\n\n categoryParts.push(categoryString);\n contentParts.push(contentString);\n }\n\n const remainingArgs = remaining.map((arg) => {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n return typeof arg === \"string\" ? arg : stringifySafe(arg);\n });\n categoryParts.push(...remainingArgs);\n contentParts.push(...remainingArgs);\n\n return {\n // @ts-expect-error\n category: categoryParts.join(\" \"),\n message: {\n content: contentParts.join(\" \"),\n substitutions: substitutionOffsets,\n },\n };\n}\n\nfunction isComponentStack(consoleArgument: string) {\n const isOldComponentStackFormat = / {4}in/.test(consoleArgument);\n const isNewComponentStackFormat = / {4}at/.test(consoleArgument);\n const isNewJSCComponentStackFormat = /@.*\\n/.test(consoleArgument);\n\n return (\n isOldComponentStackFormat ||\n isNewComponentStackFormat ||\n isNewJSCComponentStackFormat\n );\n}\n\nexport function parseComponentStack(message: string): ComponentStack {\n // In newer versions of React, the component stack is formatted as a call stack frame.\n // First try to parse the component stack as a call stack frame, and if that doesn't\n // work then we'll fallback to the old custom component stack format parsing.\n const stack = parseErrorStack(message);\n if (stack && stack.length > 0) {\n return stack.map((frame) => ({\n content: frame.methodName,\n collapse: frame.collapse || false,\n fileName: frame.file == null ? \"unknown\" : frame.file,\n location: {\n column: frame.column == null ? -1 : frame.column,\n row: frame.lineNumber == null ? -1 : frame.lineNumber,\n },\n }));\n }\n\n return message\n .split(/\\n {4}in /g)\n .map((s) => {\n if (!s) {\n return null;\n }\n const match = s.match(/(.*) \\(at (.*\\.js):([\\d]+)\\)/);\n if (!match) {\n return null;\n }\n\n const [content, fileName, row] = match.slice(1);\n return {\n content,\n fileName,\n location: { column: -1, row: parseInt(row, 10) },\n };\n })\n .filter(Boolean) as ComponentStack;\n}\n\nexport function parseLogBoxException(\n error: ExtendedExceptionData\n): LogBoxLogData {\n const message =\n error.originalMessage != null ? error.originalMessage : \"Unknown\";\n\n const metroInternalError = message.match(METRO_ERROR_FORMAT);\n if (metroInternalError) {\n const [content, fileName, row, column, codeFrame] =\n metroInternalError.slice(1);\n\n return {\n level: \"fatal\",\n type: \"Metro Error\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelTransformError = message.match(BABEL_TRANSFORM_ERROR_FORMAT);\n if (babelTransformError) {\n // Transform errors are thrown from inside the Babel transformer.\n const [fileName, content, row, column, codeFrame] =\n babelTransformError.slice(1);\n\n return {\n level: \"syntax\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);\n\n if (babelCodeFrameError) {\n // Codeframe errors are thrown from any use of buildCodeFrameError.\n const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);\n return {\n level: \"syntax\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: null, // We are not given the location.\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${1}-${1}`,\n };\n }\n\n if (message.match(/^TransformError /)) {\n return {\n level: \"syntax\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: [],\n message: {\n content: message,\n substitutions: [],\n },\n category: message,\n };\n }\n\n const componentStack = error.componentStack;\n if (error.isFatal || error.isComponentError) {\n // @ts-expect-error\n return {\n level: \"fatal\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack:\n componentStack != null ? parseComponentStack(componentStack) : [],\n ...parseInterpolation([message]),\n };\n }\n\n if (componentStack != null) {\n // It is possible that console errors have a componentStack.\n // @ts-expect-error\n return {\n level: \"error\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: parseComponentStack(componentStack),\n ...parseInterpolation([message]),\n };\n }\n\n // Most `console.error` calls won't have a componentStack. We parse them like\n // regular logs which have the component stack burried in the message.\n return {\n level: \"error\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n ...parseLogBoxLog([message]),\n };\n}\n\nexport function parseLogBoxLog(args: readonly any[]): {\n componentStack: ComponentStack;\n category: Category;\n message: Message;\n} {\n const message = args[0];\n let argsWithoutComponentStack: any[] = [];\n let componentStack: ComponentStack = [];\n\n // Extract component stack from warnings like \"Some warning%s\".\n if (\n typeof message === \"string\" &&\n message.slice(-2) === \"%s\" &&\n args.length > 0\n ) {\n const lastArg = args[args.length - 1];\n if (typeof lastArg === \"string\" && isComponentStack(lastArg)) {\n argsWithoutComponentStack = args.slice(0, -1);\n argsWithoutComponentStack[0] = message.slice(0, -2);\n componentStack = parseComponentStack(lastArg);\n }\n }\n\n if (componentStack.length === 0) {\n // Try finding the component stack elsewhere.\n for (const arg of args) {\n if (typeof arg === \"string\" && isComponentStack(arg)) {\n // Strip out any messages before the component stack.\n let messageEndIndex = arg.search(/\\n {4}(in|at) /);\n if (messageEndIndex < 0) {\n // Handle JSC component stacks.\n messageEndIndex = arg.search(/\\n/);\n }\n if (messageEndIndex > 0) {\n argsWithoutComponentStack.push(arg.slice(0, messageEndIndex));\n }\n\n componentStack = parseComponentStack(arg);\n } else {\n argsWithoutComponentStack.push(arg);\n }\n }\n }\n\n // @ts-expect-error\n return {\n ...parseInterpolation(argsWithoutComponentStack),\n componentStack,\n };\n}\n"]}
1
+ {"version":3,"file":"parseLogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,mBAAmB;AACnB,qFAA6D;AAG7D,iFAAyD;AACzD,6EAAqD;AAGrD,MAAM,4BAA4B,GAChC,gGAAgG,CAAC;AACnG,MAAM,6BAA6B,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;iBAAM;gBACL,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACrC;SACF;KACF;IAED,OAAO;QACL,GAAG,kBAAkB,CAAC,yBAAyB,CAAC;QAChD,cAAc;KACf,CAAC;AACJ,CAAC;AAhDD,wCAgDC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// @ts-expect-error\nimport UTFSequence from \"react-native/Libraries/UTFSequence\";\n\nimport type { LogBoxLogData } from \"./LogBoxLog\";\nimport parseErrorStack from \"../modules/parseErrorStack\";\nimport stringifySafe from \"../modules/stringifySafe\";\ntype ExceptionData = any;\n\nconst BABEL_TRANSFORM_ERROR_FORMAT =\n /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/;\nconst BABEL_CODE_FRAME_ERROR_FORMAT =\n /^(?:TransformError )?(?:.*):? (?:.*?)(\\/.*): ([\\s\\S]+?)\\n([ >]{2}[\\d\\s]+ \\|[\\s\\S]+|\\u{001b}[\\s\\S]+)/u;\nconst METRO_ERROR_FORMAT =\n /^(?:InternalError Metro has encountered an error:) (.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/u;\n\nexport type ExtendedExceptionData = ExceptionData & {\n isComponentError: boolean;\n [key: string]: any;\n};\nexport type Category = string;\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\nexport type ComponentStack = CodeFrame[];\n\nconst SUBSTITUTION = UTFSequence.BOM + \"%s\";\n\nexport function parseInterpolation(args: readonly any[]): {\n category: Category;\n message: Message;\n} {\n const categoryParts: string[] = [];\n const contentParts: string[] = [];\n const substitutionOffsets: { length: number; offset: number }[] = [];\n\n const remaining = [...args];\n if (typeof remaining[0] === \"string\") {\n const formatString = String(remaining.shift());\n const formatStringParts = formatString.split(\"%s\");\n const substitutionCount = formatStringParts.length - 1;\n const substitutions = remaining.splice(0, substitutionCount);\n\n let categoryString = \"\";\n let contentString = \"\";\n\n let substitutionIndex = 0;\n for (const formatStringPart of formatStringParts) {\n categoryString += formatStringPart;\n contentString += formatStringPart;\n\n if (substitutionIndex < substitutionCount) {\n if (substitutionIndex < substitutions.length) {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n const substitution =\n typeof substitutions[substitutionIndex] === \"string\"\n ? substitutions[substitutionIndex]\n : stringifySafe(substitutions[substitutionIndex]);\n substitutionOffsets.push({\n length: substitution.length,\n offset: contentString.length,\n });\n\n categoryString += SUBSTITUTION;\n contentString += substitution;\n } else {\n substitutionOffsets.push({\n length: 2,\n offset: contentString.length,\n });\n\n categoryString += \"%s\";\n contentString += \"%s\";\n }\n\n substitutionIndex++;\n }\n }\n\n categoryParts.push(categoryString);\n contentParts.push(contentString);\n }\n\n const remainingArgs = remaining.map((arg) => {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n return typeof arg === \"string\" ? arg : stringifySafe(arg);\n });\n categoryParts.push(...remainingArgs);\n contentParts.push(...remainingArgs);\n\n return {\n category: categoryParts.join(\" \"),\n message: {\n content: contentParts.join(\" \"),\n substitutions: substitutionOffsets,\n },\n };\n}\n\nfunction isComponentStack(consoleArgument: string) {\n const isOldComponentStackFormat = / {4}in/.test(consoleArgument);\n const isNewComponentStackFormat = / {4}at/.test(consoleArgument);\n const isNewJSCComponentStackFormat = /@.*\\n/.test(consoleArgument);\n\n return (\n isOldComponentStackFormat ||\n isNewComponentStackFormat ||\n isNewJSCComponentStackFormat\n );\n}\n\nexport function parseComponentStack(message: string): ComponentStack {\n // In newer versions of React, the component stack is formatted as a call stack frame.\n // First try to parse the component stack as a call stack frame, and if that doesn't\n // work then we'll fallback to the old custom component stack format parsing.\n const stack = parseErrorStack(message);\n if (stack && stack.length > 0) {\n return stack.map((frame) => ({\n content: frame.methodName,\n collapse: frame.collapse || false,\n fileName: frame.file == null ? \"unknown\" : frame.file,\n location: {\n column: frame.column == null ? -1 : frame.column,\n row: frame.lineNumber == null ? -1 : frame.lineNumber,\n },\n }));\n }\n\n return message\n .split(/\\n {4}in /g)\n .map((s) => {\n if (!s) {\n return null;\n }\n const match = s.match(/(.*) \\(at (.*\\.js):([\\d]+)\\)/);\n if (!match) {\n return null;\n }\n\n const [content, fileName, row] = match.slice(1);\n return {\n content,\n fileName,\n location: { column: -1, row: parseInt(row, 10) },\n };\n })\n .filter(Boolean) as ComponentStack;\n}\n\nexport function parseLogBoxException(\n error: ExtendedExceptionData\n): LogBoxLogData {\n const message =\n error.originalMessage != null ? error.originalMessage : \"Unknown\";\n\n const metroInternalError = message.match(METRO_ERROR_FORMAT);\n if (metroInternalError) {\n const [content, fileName, row, column, codeFrame] =\n metroInternalError.slice(1);\n\n return {\n level: \"fatal\",\n type: \"Metro Error\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelTransformError = message.match(BABEL_TRANSFORM_ERROR_FORMAT);\n if (babelTransformError) {\n // Transform errors are thrown from inside the Babel transformer.\n const [fileName, content, row, column, codeFrame] =\n babelTransformError.slice(1);\n\n return {\n level: \"syntax\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);\n\n if (babelCodeFrameError) {\n // Codeframe errors are thrown from any use of buildCodeFrameError.\n const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);\n return {\n level: \"syntax\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: null, // We are not given the location.\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${1}-${1}`,\n };\n }\n\n if (message.match(/^TransformError /)) {\n return {\n level: \"syntax\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: [],\n message: {\n content: message,\n substitutions: [],\n },\n category: message,\n };\n }\n\n const componentStack = error.componentStack;\n if (error.isFatal || error.isComponentError) {\n return {\n level: \"fatal\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack:\n componentStack != null ? parseComponentStack(componentStack) : [],\n ...parseInterpolation([message]),\n };\n }\n\n if (componentStack != null) {\n // It is possible that console errors have a componentStack.\n return {\n level: \"error\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: parseComponentStack(componentStack),\n ...parseInterpolation([message]),\n };\n }\n\n // Most `console.error` calls won't have a componentStack. We parse them like\n // regular logs which have the component stack burried in the message.\n return {\n level: \"error\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n ...parseLogBoxLog([message]),\n };\n}\n\nexport function parseLogBoxLog(args: readonly any[]): {\n componentStack: ComponentStack;\n category: Category;\n message: Message;\n} {\n const message = args[0];\n let argsWithoutComponentStack: any[] = [];\n let componentStack: ComponentStack = [];\n\n // Extract component stack from warnings like \"Some warning%s\".\n if (\n typeof message === \"string\" &&\n message.slice(-2) === \"%s\" &&\n args.length > 0\n ) {\n const lastArg = args[args.length - 1];\n if (typeof lastArg === \"string\" && isComponentStack(lastArg)) {\n argsWithoutComponentStack = args.slice(0, -1);\n argsWithoutComponentStack[0] = message.slice(0, -2);\n componentStack = parseComponentStack(lastArg);\n }\n }\n\n if (componentStack.length === 0) {\n // Try finding the component stack elsewhere.\n for (const arg of args) {\n if (typeof arg === \"string\" && isComponentStack(arg)) {\n // Strip out any messages before the component stack.\n let messageEndIndex = arg.search(/\\n {4}(in|at) /);\n if (messageEndIndex < 0) {\n // Handle JSC component stacks.\n messageEndIndex = arg.search(/\\n/);\n }\n if (messageEndIndex > 0) {\n argsWithoutComponentStack.push(arg.slice(0, messageEndIndex));\n }\n\n componentStack = parseComponentStack(arg);\n } else {\n argsWithoutComponentStack.push(arg);\n }\n }\n }\n\n return {\n ...parseInterpolation(argsWithoutComponentStack),\n componentStack,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/error-overlay/modules/NativeLogBox/index.tsx"],"names":[],"mappings":";;;;AAGA,wBAyBE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/error-overlay/modules/NativeLogBox/index.tsx"],"names":[],"mappings":";;;;AAGA,wBAwBE"}
@@ -11,14 +11,12 @@ exports.default = {
11
11
  if (currentRoot) {
12
12
  return;
13
13
  }
14
- const ErrorOverlay = require("../../ErrorOverlay")
15
- .default;
14
+ const ErrorOverlay = require("../../ErrorOverlay").default;
16
15
  // Create a new div with ID `error-overlay` element and render LogBoxInspector into it.
17
16
  const div = document.createElement("div");
18
17
  div.id = "error-overlay";
19
18
  document.body.appendChild(div);
20
19
  currentRoot = client_1.default.createRoot(div);
21
- // @ts-expect-error
22
20
  currentRoot.render(react_1.default.createElement(ErrorOverlay, null));
23
21
  },
24
22
  hide() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/error-overlay/modules/NativeLogBox/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,8DAAwC;AACxC,IAAI,WAAW,GAAyB,IAAI,CAAC;AAC7C,kBAAe;IACb,IAAI;QACF,IAAI,WAAW,EAAE;YACf,OAAO;SACR;QACD,MAAM,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;aAC/C,OAAsD,CAAC;QAC1D,uFAAuF;QACvF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,EAAE,GAAG,eAAe,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAE/B,WAAW,GAAG,gBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,mBAAmB;QACnB,WAAW,CAAC,MAAM,CAAC,8BAAC,YAAY,OAAG,CAAC,CAAC;IACvC,CAAC;IACD,IAAI;QACF,qCAAqC;QACrC,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,OAAO,EAAE,CAAC;YACtB,WAAW,GAAG,IAAI,CAAC;SACpB;QACD,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QACrD,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,EAAE,CAAC;IAChB,CAAC;CACF,CAAC","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom/client\";\nlet currentRoot: ReactDOM.Root | null = null;\nexport default {\n show() {\n if (currentRoot) {\n return;\n }\n const ErrorOverlay = require(\"../../ErrorOverlay\")\n .default as typeof import(\"../../ErrorOverlay\").default;\n // Create a new div with ID `error-overlay` element and render LogBoxInspector into it.\n const div = document.createElement(\"div\");\n div.id = \"error-overlay\";\n document.body.appendChild(div);\n\n currentRoot = ReactDOM.createRoot(div);\n // @ts-expect-error\n currentRoot.render(<ErrorOverlay />);\n },\n hide() {\n // Remove div with ID `error-overlay`\n if (currentRoot) {\n currentRoot.unmount();\n currentRoot = null;\n }\n const div = document.getElementById(\"error-overlay\");\n div?.remove();\n },\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/error-overlay/modules/NativeLogBox/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,8DAAwC;AACxC,IAAI,WAAW,GAAyB,IAAI,CAAC;AAC7C,kBAAe;IACb,IAAI;QACF,IAAI,WAAW,EAAE;YACf,OAAO;SACR;QACD,MAAM,YAAY,GAChB,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;QACxC,uFAAuF;QACvF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,EAAE,GAAG,eAAe,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAE/B,WAAW,GAAG,gBAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvC,WAAW,CAAC,MAAM,CAAC,8BAAC,YAAY,OAAG,CAAC,CAAC;IACvC,CAAC;IACD,IAAI;QACF,qCAAqC;QACrC,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,OAAO,EAAE,CAAC;YACtB,WAAW,GAAG,IAAI,CAAC;SACpB;QACD,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QACrD,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,EAAE,CAAC;IAChB,CAAC;CACF,CAAC","sourcesContent":["import React from \"react\";\nimport ReactDOM from \"react-dom/client\";\nlet currentRoot: ReactDOM.Root | null = null;\nexport default {\n show() {\n if (currentRoot) {\n return;\n }\n const ErrorOverlay: React.ComponentType =\n require(\"../../ErrorOverlay\").default;\n // Create a new div with ID `error-overlay` element and render LogBoxInspector into it.\n const div = document.createElement(\"div\");\n div.id = \"error-overlay\";\n document.body.appendChild(div);\n\n currentRoot = ReactDOM.createRoot(div);\n currentRoot.render(<ErrorOverlay />);\n },\n hide() {\n // Remove div with ID `error-overlay`\n if (currentRoot) {\n currentRoot.unmount();\n currentRoot = null;\n }\n const div = document.getElementById(\"error-overlay\");\n div?.remove();\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/error-overlay/modules/stringifySafe/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CA2FvB;AAED,QAAA,MAAM,aAAa,QA7FT,GAAG,KAAK,MAkGhB,CAAC;AAEH,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/error-overlay/modules/stringifySafe/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CA0FvB;AAED,QAAA,MAAM,aAAa,QA5FT,GAAG,KAAK,MAiGhB,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -15,8 +15,7 @@ exports.createStringifySafeWithLimits = void 0;
15
15
  function createStringifySafeWithLimits(limits) {
16
16
  const { maxDepth = Number.POSITIVE_INFINITY, maxStringLimit = Number.POSITIVE_INFINITY, maxArrayLimit = Number.POSITIVE_INFINITY, maxObjectKeysLimit = Number.POSITIVE_INFINITY, } = limits;
17
17
  const stack = [];
18
- function replacer(key, value) {
19
- // @ts-expect-error
18
+ function replacer(_key, value) {
20
19
  while (stack.length && this !== stack[0]) {
21
20
  stack.shift();
22
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.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,OAAO,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;SACtC;aAAM;YACL,8DAA8D;YAC9D,uDAAuD;YACvD,IAAI;gBACF,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBAC1C,IAAI,GAAG,KAAK,SAAS,EAAE;oBACrB,OAAO,IAAI,GAAG,OAAO,GAAG,GAAG,wBAAwB,CAAC;iBACrD;gBACD,OAAO,GAAG,CAAC;aACZ;YAAC,MAAM;gBACN,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU,EAAE;oBACtC,IAAI;wBACF,mFAAmF;wBACnF,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;qBACvB;oBAAC,MAAM,GAAE;iBACX;aACF;SACF;QACD,OAAO,IAAI,GAAG,OAAO,GAAG,GAAG,wBAAwB,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC;AAhGD,sEAgGC;AAED,MAAM,aAAa,GAAG,6BAA6B,CAAC;IAClD,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,GAAG;IACnB,aAAa,EAAE,EAAE;IACjB,kBAAkB,EAAE,EAAE;CACvB,CAAC,CAAC;AAEH,kBAAe,aAAa,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Tries to stringify with JSON.stringify and toString, but catches exceptions\n * (e.g. from circular objects) and always returns a string and never throws.\n */\nexport function createStringifySafeWithLimits(limits: {\n maxDepth?: number;\n maxStringLimit?: number;\n maxArrayLimit?: number;\n maxObjectKeysLimit?: number;\n}): (foo: any) => string {\n const {\n maxDepth = Number.POSITIVE_INFINITY,\n maxStringLimit = Number.POSITIVE_INFINITY,\n maxArrayLimit = Number.POSITIVE_INFINITY,\n maxObjectKeysLimit = Number.POSITIVE_INFINITY,\n } = limits;\n const stack: any[] = [];\n function replacer(key: string, value: any): any {\n // @ts-expect-error\n while (stack.length && this !== stack[0]) {\n stack.shift();\n }\n\n if (typeof value === \"string\") {\n const truncatedString = \"...(truncated)...\";\n if (value.length > maxStringLimit + truncatedString.length) {\n return value.substring(0, maxStringLimit) + truncatedString;\n }\n return value;\n }\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n\n let retval = value;\n if (Array.isArray(value)) {\n if (stack.length >= maxDepth) {\n retval = `[ ... array with ${value.length} values ... ]`;\n } else if (value.length > maxArrayLimit) {\n retval = value\n .slice(0, maxArrayLimit)\n .concat([\n `... extra ${value.length - maxArrayLimit} values truncated ...`,\n ]);\n }\n } else {\n // Add refinement after Array.isArray call.\n if (typeof value !== \"object\") {\n throw new Error(\"This was already found earlier\");\n }\n const keys = Object.keys(value);\n if (stack.length >= maxDepth) {\n retval = `{ ... object with ${keys.length} keys ... }`;\n } else if (keys.length > maxObjectKeysLimit) {\n // Return a sample of the keys.\n retval = {};\n for (const k of keys.slice(0, maxObjectKeysLimit)) {\n retval[k] = value[k];\n }\n const truncatedKey = \"...(truncated keys)...\";\n retval[truncatedKey] = keys.length - maxObjectKeysLimit;\n }\n }\n stack.unshift(retval);\n return retval;\n }\n\n return function stringifySafe(arg: any): string {\n if (arg === undefined) {\n return \"undefined\";\n } else if (arg === null) {\n return \"null\";\n } else if (typeof arg === \"function\") {\n try {\n return arg.toString();\n } catch {\n return \"[function unknown]\";\n }\n } else if (arg instanceof Error) {\n return arg.name + \": \" + arg.message;\n } else {\n // Perform a try catch, just in case the object has a circular\n // reference or stringify throws for some other reason.\n try {\n const ret = JSON.stringify(arg, replacer);\n if (ret === undefined) {\n return '[\"' + typeof arg + '\" failed to stringify]';\n }\n return ret;\n } catch {\n if (typeof arg.toString === \"function\") {\n try {\n // $FlowFixMe[incompatible-use] : toString shouldn't take any arguments in general.\n return arg.toString();\n } catch {}\n }\n }\n }\n return '[\"' + typeof arg + '\" failed to stringify]';\n };\n}\n\nconst stringifySafe = createStringifySafeWithLimits({\n maxDepth: 10,\n maxStringLimit: 100,\n maxArrayLimit: 50,\n maxObjectKeysLimit: 50,\n});\n\nexport default stringifySafe;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/error-overlay/modules/stringifySafe/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;GAGG;AACH,SAAgB,6BAA6B,CAAC,MAK7C;IACC,MAAM,EACJ,QAAQ,GAAG,MAAM,CAAC,iBAAiB,EACnC,cAAc,GAAG,MAAM,CAAC,iBAAiB,EACzC,aAAa,GAAG,MAAM,CAAC,iBAAiB,EACxC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,GAC9C,GAAG,MAAM,CAAC;IACX,MAAM,KAAK,GAAU,EAAE,CAAC;IACxB,SAAS,QAAQ,CAAgB,IAAY,EAAE,KAAU;QACvD,OAAO,KAAK,CAAC,MAAM,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE;YACxC,KAAK,CAAC,KAAK,EAAE,CAAC;SACf;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,eAAe,GAAG,mBAAmB,CAAC;YAC5C,IAAI,KAAK,CAAC,MAAM,GAAG,cAAc,GAAG,eAAe,CAAC,MAAM,EAAE;gBAC1D,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,eAAe,CAAC;aAC7D;YACD,OAAO,KAAK,CAAC;SACd;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;YAC/C,OAAO,KAAK,CAAC;SACd;QAED,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE;gBAC5B,MAAM,GAAG,oBAAoB,KAAK,CAAC,MAAM,eAA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,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;aACvB;YAAC,MAAM;gBACN,OAAO,oBAAoB,CAAC;aAC7B;SACF;aAAM,IAAI,GAAG,YAAY,KAAK,EAAE;YAC/B,OAAO,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;SACtC;aAAM;YACL,8DAA8D;YAC9D,uDAAuD;YACvD,IAAI;gBACF,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBAC1C,IAAI,GAAG,KAAK,SAAS,EAAE;oBACrB,OAAO,IAAI,GAAG,OAAO,GAAG,GAAG,wBAAwB,CAAC;iBACrD;gBACD,OAAO,GAAG,CAAC;aACZ;YAAC,MAAM;gBACN,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,UAAU,EAAE;oBACtC,IAAI;wBACF,mFAAmF;wBACnF,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;qBACvB;oBAAC,MAAM,GAAE;iBACX;aACF;SACF;QACD,OAAO,IAAI,GAAG,OAAO,GAAG,GAAG,wBAAwB,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC;AA/FD,sEA+FC;AAED,MAAM,aAAa,GAAG,6BAA6B,CAAC;IAClD,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,GAAG;IACnB,aAAa,EAAE,EAAE;IACjB,kBAAkB,EAAE,EAAE;CACvB,CAAC,CAAC;AAEH,kBAAe,aAAa,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Tries to stringify with JSON.stringify and toString, but catches exceptions\n * (e.g. from circular objects) and always returns a string and never throws.\n */\nexport function createStringifySafeWithLimits(limits: {\n maxDepth?: number;\n maxStringLimit?: number;\n maxArrayLimit?: number;\n maxObjectKeysLimit?: number;\n}): (foo: any) => string {\n const {\n maxDepth = Number.POSITIVE_INFINITY,\n maxStringLimit = Number.POSITIVE_INFINITY,\n maxArrayLimit = Number.POSITIVE_INFINITY,\n maxObjectKeysLimit = Number.POSITIVE_INFINITY,\n } = limits;\n const stack: any[] = [];\n function replacer(this: unknown, _key: string, value: any): any {\n while (stack.length && this !== stack[0]) {\n stack.shift();\n }\n\n if (typeof value === \"string\") {\n const truncatedString = \"...(truncated)...\";\n if (value.length > maxStringLimit + truncatedString.length) {\n return value.substring(0, maxStringLimit) + truncatedString;\n }\n return value;\n }\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n\n let retval = value;\n if (Array.isArray(value)) {\n if (stack.length >= maxDepth) {\n retval = `[ ... array with ${value.length} values ... ]`;\n } else if (value.length > maxArrayLimit) {\n retval = value\n .slice(0, maxArrayLimit)\n .concat([\n `... extra ${value.length - maxArrayLimit} values truncated ...`,\n ]);\n }\n } else {\n // Add refinement after Array.isArray call.\n if (typeof value !== \"object\") {\n throw new Error(\"This was already found earlier\");\n }\n const keys = Object.keys(value);\n if (stack.length >= maxDepth) {\n retval = `{ ... object with ${keys.length} keys ... }`;\n } else if (keys.length > maxObjectKeysLimit) {\n // Return a sample of the keys.\n retval = {};\n for (const k of keys.slice(0, maxObjectKeysLimit)) {\n retval[k] = value[k];\n }\n const truncatedKey = \"...(truncated keys)...\";\n retval[truncatedKey] = keys.length - maxObjectKeysLimit;\n }\n }\n stack.unshift(retval);\n return retval;\n }\n\n return function stringifySafe(arg: any): string {\n if (arg === undefined) {\n return \"undefined\";\n } else if (arg === null) {\n return \"null\";\n } else if (typeof arg === \"function\") {\n try {\n return arg.toString();\n } catch {\n return \"[function unknown]\";\n }\n } else if (arg instanceof Error) {\n return arg.name + \": \" + arg.message;\n } else {\n // Perform a try catch, just in case the object has a circular\n // reference or stringify throws for some other reason.\n try {\n const ret = JSON.stringify(arg, replacer);\n if (ret === undefined) {\n return '[\"' + typeof arg + '\" failed to stringify]';\n }\n return ret;\n } catch {\n if (typeof arg.toString === \"function\") {\n try {\n // $FlowFixMe[incompatible-use] : toString shouldn't take any arguments in general.\n return arg.toString();\n } catch {}\n }\n }\n }\n return '[\"' + typeof arg + '\" failed to stringify]';\n };\n}\n\nconst stringifySafe = createStringifySafeWithLimits({\n maxDepth: 10,\n maxStringLimit: 100,\n maxArrayLimit: 50,\n maxObjectKeysLimit: 50,\n});\n\nexport default stringifySafe;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=css-transformer.test.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-transformer.test.web.d.ts","sourceRoot":"","sources":["../../../../src/transformer/css/__tests__/css-transformer.test.web.ts"],"names":[],"mappings":""}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const css_transformer_1 = require("../css-transformer");
4
+ describe(css_transformer_1.transform, () => {
5
+ it(`should transform css in dev mode`, async () => {
6
+ const result = await (0, css_transformer_1.transform)({
7
+ filename: "test.css",
8
+ src: "body { color: red; }",
9
+ options: {
10
+ platform: "web",
11
+ dev: true,
12
+ hot: true,
13
+ },
14
+ });
15
+ expect(result.src).toMatchSnapshot();
16
+ expect(result.src).toMatch(/expo-css-hmr/);
17
+ });
18
+ it(`should transform css in prod mode`, async () => {
19
+ const result = await (0, css_transformer_1.transform)({
20
+ filename: "test.css",
21
+ src: "body { color: red; }",
22
+ options: {
23
+ platform: "web",
24
+ dev: false,
25
+ hot: false,
26
+ },
27
+ });
28
+ expect(result.src).toMatchSnapshot();
29
+ expect(result.src).not.toMatch(/expo-css-hmr/);
30
+ });
31
+ it(`should skip transforming css modules`, async () => {
32
+ const result = await (0, css_transformer_1.transform)({
33
+ filename: "test.module.css",
34
+ src: "body { color: red; }",
35
+ options: {
36
+ platform: "web",
37
+ dev: false,
38
+ hot: false,
39
+ },
40
+ });
41
+ expect(result.src).toEqual("module.exports = {}");
42
+ });
43
+ it(`should shim css on native`, async () => {
44
+ const result = await (0, css_transformer_1.transform)({
45
+ filename: "test.css",
46
+ src: "body { color: red; }",
47
+ options: {
48
+ platform: "ios",
49
+ dev: false,
50
+ hot: false,
51
+ },
52
+ });
53
+ expect(result.src).toEqual("");
54
+ });
55
+ it(`should shim css on native with comment in dev`, async () => {
56
+ const result = await (0, css_transformer_1.transform)({
57
+ filename: "test.css",
58
+ src: "body { color: red; }",
59
+ options: {
60
+ platform: "ios",
61
+ dev: true,
62
+ hot: false,
63
+ },
64
+ });
65
+ expect(result.src).toMatchSnapshot();
66
+ });
67
+ });
68
+ describe(css_transformer_1.pathToHtmlSafeName, () => {
69
+ it(`converts filepath to safe name`, () => {
70
+ expect((0, css_transformer_1.pathToHtmlSafeName)("foo")).toEqual("foo");
71
+ expect((0, css_transformer_1.pathToHtmlSafeName)("../123/abc/something.module.css")).toEqual("___123_abc_something_module_css");
72
+ });
73
+ });
74
+ describe(css_transformer_1.getHotReplaceTemplate, () => {
75
+ it(`should generate the correct template`, () => {
76
+ expect((0, css_transformer_1.getHotReplaceTemplate)("foo")).toMatchSnapshot();
77
+ });
78
+ });
79
+ describe(css_transformer_1.matchCssModule, () => {
80
+ it(`should match css modules`, () => {
81
+ [
82
+ "test.module.css",
83
+ "test.module.ios.css",
84
+ "test.module.android.css",
85
+ "test.module.native.css",
86
+ "test.module.web.css",
87
+ ".module.css",
88
+ "something-longer.module.css",
89
+ "../../foo-bar.module.css",
90
+ "./one/two/three/another.module.ios.css",
91
+ ].forEach((file) => expect((0, css_transformer_1.matchCssModule)(file)).toBe(true));
92
+ });
93
+ it(`should not match css modules`, () => {
94
+ [
95
+ "foo.js",
96
+ "something",
97
+ "one/two/three",
98
+ "test.css",
99
+ "test.ios.css",
100
+ "test.android.css",
101
+ "test.native.css",
102
+ "test.web.css",
103
+ "test.scss",
104
+ "test.sass",
105
+ ".css",
106
+ "../../foo-bar.css",
107
+ "./one/two/three/another.ios.css",
108
+ ].forEach((file) => expect((0, css_transformer_1.matchCssModule)(file)).toBe(false));
109
+ });
110
+ });
111
+ //# sourceMappingURL=css-transformer.test.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-transformer.test.web.js","sourceRoot":"","sources":["../../../../src/transformer/css/__tests__/css-transformer.test.web.ts"],"names":[],"mappings":";;AAAA,wDAK4B;AAE5B,QAAQ,CAAC,2BAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAS,EAAC;YAC7B,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,sBAAsB;YAC3B,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,GAAG,EAAE,IAAI;gBACT,GAAG,EAAE,IAAI;aACH;SACT,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC;QAErC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAS,EAAC;YAC7B,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,sBAAsB;YAC3B,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,GAAG,EAAE,KAAK;gBACV,GAAG,EAAE,KAAK;aACJ;SACT,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC;QAErC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAS,EAAC;YAC7B,QAAQ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AAC,iCAAiC,CAAC,CAAC,CAAC,OAAO,CACnE,iCAAiC,CAClC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,uCAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,IAAA,uCAAqB,EAAC,KAAK,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gCAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAClC;YACE,iBAAiB;YACjB,qBAAqB;YACrB,yBAAyB;YACzB,wBAAwB;YACxB,qBAAqB;YAErB,aAAa;YACb,6BAA6B;YAC7B,0BAA0B;YAC1B,wCAAwC;SACzC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAA,gCAAc,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC;YACE,QAAQ;YACR,WAAW;YACX,eAAe;YACf,UAAU;YACV,cAAc;YACd,kBAAkB;YAClB,iBAAiB;YACjB,cAAc;YACd,WAAW;YACX,WAAW;YACX,MAAM;YACN,mBAAmB;YACnB,iCAAiC;SAClC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAA,gCAAc,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n matchCssModule,\n getHotReplaceTemplate,\n transform,\n pathToHtmlSafeName,\n} from \"../css-transformer\";\n\ndescribe(transform, () => {\n it(`should transform css in dev mode`, async () => {\n const result = await transform({\n filename: \"test.css\",\n src: \"body { color: red; }\",\n options: {\n platform: \"web\",\n dev: true,\n hot: true,\n } as any,\n });\n\n expect(result.src).toMatchSnapshot();\n\n expect(result.src).toMatch(/expo-css-hmr/);\n });\n\n it(`should transform css in prod mode`, async () => {\n const result = await transform({\n filename: \"test.css\",\n src: \"body { color: red; }\",\n options: {\n platform: \"web\",\n dev: false,\n hot: false,\n } as any,\n });\n\n expect(result.src).toMatchSnapshot();\n\n expect(result.src).not.toMatch(/expo-css-hmr/);\n });\n\n it(`should skip transforming css modules`, async () => {\n const result = await transform({\n filename: \"test.module.css\",\n src: \"body { color: red; }\",\n options: {\n platform: \"web\",\n dev: false,\n hot: false,\n } as any,\n });\n\n expect(result.src).toEqual(\"module.exports = {}\");\n });\n\n it(`should shim css on native`, async () => {\n const result = await transform({\n filename: \"test.css\",\n src: \"body { color: red; }\",\n options: {\n platform: \"ios\",\n dev: false,\n hot: false,\n } as any,\n });\n\n expect(result.src).toEqual(\"\");\n });\n it(`should shim css on native with comment in dev`, async () => {\n const result = await transform({\n filename: \"test.css\",\n src: \"body { color: red; }\",\n options: {\n platform: \"ios\",\n dev: true,\n hot: false,\n } as any,\n });\n\n expect(result.src).toMatchSnapshot();\n });\n});\n\ndescribe(pathToHtmlSafeName, () => {\n it(`converts filepath to safe name`, () => {\n expect(pathToHtmlSafeName(\"foo\")).toEqual(\"foo\");\n expect(pathToHtmlSafeName(\"../123/abc/something.module.css\")).toEqual(\n \"___123_abc_something_module_css\"\n );\n });\n});\n\ndescribe(getHotReplaceTemplate, () => {\n it(`should generate the correct template`, () => {\n expect(getHotReplaceTemplate(\"foo\")).toMatchSnapshot();\n });\n});\n\ndescribe(matchCssModule, () => {\n it(`should match css modules`, () => {\n [\n \"test.module.css\",\n \"test.module.ios.css\",\n \"test.module.android.css\",\n \"test.module.native.css\",\n \"test.module.web.css\",\n\n \".module.css\",\n \"something-longer.module.css\",\n \"../../foo-bar.module.css\",\n \"./one/two/three/another.module.ios.css\",\n ].forEach((file) => expect(matchCssModule(file)).toBe(true));\n });\n it(`should not match css modules`, () => {\n [\n \"foo.js\",\n \"something\",\n \"one/two/three\",\n \"test.css\",\n \"test.ios.css\",\n \"test.android.css\",\n \"test.native.css\",\n \"test.web.css\",\n \"test.scss\",\n \"test.sass\",\n \".css\",\n \"../../foo-bar.css\",\n \"./one/two/three/another.ios.css\",\n ].forEach((file) => expect(matchCssModule(file)).toBe(false));\n });\n});\n"]}
@@ -0,0 +1,6 @@
1
+ import type { BabelTransformerArgs } from "metro-babel-transformer";
2
+ export declare function pathToHtmlSafeName(path: string): string;
3
+ export declare function getHotReplaceTemplate(id: string): string;
4
+ export declare function matchCssModule(filename: string): boolean;
5
+ export declare function transform(props: BabelTransformerArgs): Promise<BabelTransformerArgs>;
6
+ //# sourceMappingURL=css-transformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-transformer.d.ts","sourceRoot":"","sources":["../../../src/transformer/css/css-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,UAE9C;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,UAW/C;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAsB,SAAS,CAC7B,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CA4C/B"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transform = exports.matchCssModule = exports.getHotReplaceTemplate = exports.pathToHtmlSafeName = void 0;
4
+ function pathToHtmlSafeName(path) {
5
+ return path.replace(/[^a-zA-Z0-9_]/g, "_");
6
+ }
7
+ exports.pathToHtmlSafeName = pathToHtmlSafeName;
8
+ function getHotReplaceTemplate(id) {
9
+ // In dev mode, we need to replace the style tag instead of appending it
10
+ // use the path as the expo-css-hmr attribute to find the style tag
11
+ // to replace.
12
+ const attr = JSON.stringify(pathToHtmlSafeName(id));
13
+ return `
14
+ style.setAttribute('data-expo-css-hmr', ${attr});
15
+ const previousStyle = document.querySelector(\`[data-expo-css-hmr="\${${attr}}"]\`);
16
+ if (previousStyle) {
17
+ previousStyle.parentNode.removeChild(previousStyle);
18
+ }`;
19
+ }
20
+ exports.getHotReplaceTemplate = getHotReplaceTemplate;
21
+ function matchCssModule(filename) {
22
+ return !!filename.match(/\.module(\.(native|ios|android|web))?\.css$/);
23
+ }
24
+ exports.matchCssModule = matchCssModule;
25
+ async function transform(props) {
26
+ if (props.filename.endsWith(".css")) {
27
+ // Is a CSS module
28
+ if (props.filename.match(/\.module(\.(native|ios|android|web))?\.css$/)) {
29
+ // TODO: Support CSS modules
30
+ if (props.options.dev) {
31
+ props.src = `// TODO(EvanBacon): CSS modules are not supported in Metro yet.
32
+ // File: ${props.filename}
33
+ module.exports = {}`;
34
+ }
35
+ else {
36
+ props.src = `module.exports = {}`;
37
+ }
38
+ }
39
+ else {
40
+ if (props.options.platform === "web") {
41
+ const dev = props.options.dev;
42
+ props.src = `
43
+ (() => {
44
+ if (typeof document === 'undefined') {
45
+ return
46
+ }
47
+ const head = document.head || document.getElementsByTagName('head')[0];
48
+ const style = document.createElement('style');
49
+ ${dev ? getHotReplaceTemplate(props.filename) : ``}
50
+ style.setAttribute('data-expo-loader', 'css');
51
+ head.appendChild(style);
52
+ const css = \`${props.src}\`;
53
+ if (style.styleSheet){
54
+ style.styleSheet.cssText = css;
55
+ } else {
56
+ style.appendChild(document.createTextNode(css));
57
+ }
58
+ })();`;
59
+ }
60
+ else {
61
+ // shim on native
62
+ if (props.options.dev) {
63
+ props.src = `// DEBUG: Global CSS is not supported on native platforms.
64
+ // File: ${props.filename}`;
65
+ }
66
+ else {
67
+ props.src = ``;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ return props;
73
+ }
74
+ exports.transform = transform;
75
+ //# sourceMappingURL=css-transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-transformer.js","sourceRoot":"","sources":["../../../src/transformer/css/css-transformer.ts"],"names":[],"mappings":";;;AAEA,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,gDAEC;AAED,SAAgB,qBAAqB,CAAC,EAAU;IAC9C,wEAAwE;IACxE,mEAAmE;IACnE,cAAc;IACd,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;IACpD,OAAO;4CACmC,IAAI;0EAC0B,IAAI;;;IAG1E,CAAC;AACL,CAAC;AAXD,sDAWC;AAED,SAAgB,cAAc,CAAC,QAAgB;IAC7C,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACzE,CAAC;AAFD,wCAEC;AAEM,KAAK,UAAU,SAAS,CAC7B,KAA2B;IAE3B,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACnC,kBAAkB;QAClB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,6CAA6C,CAAC,EAAE;YACvE,4BAA4B;YAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;gBACrB,KAAK,CAAC,GAAG,GAAG;WACT,KAAK,CAAC,QAAQ;oBACL,CAAC;aACd;iBAAM;gBACL,KAAK,CAAC,GAAG,GAAG,qBAAqB,CAAC;aACnC;SACF;aAAM;YACL,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE;gBACpC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;gBAC9B,KAAK,CAAC,GAAG,GAAG;;;;;;;IAOhB,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;;;kBAGlC,KAAK,CAAC,GAAG;;;;;;MAMrB,CAAC;aACA;iBAAM;gBACL,iBAAiB;gBACjB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;oBACrB,KAAK,CAAC,GAAG,GAAG;WACX,KAAK,CAAC,QAAQ,EAAE,CAAC;iBACnB;qBAAM;oBACL,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC;iBAChB;aACF;SACF;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AA9CD,8BA8CC","sourcesContent":["import type { BabelTransformerArgs } from \"metro-babel-transformer\";\n\nexport function pathToHtmlSafeName(path: string) {\n return path.replace(/[^a-zA-Z0-9_]/g, \"_\");\n}\n\nexport function getHotReplaceTemplate(id: string) {\n // In dev mode, we need to replace the style tag instead of appending it\n // use the path as the expo-css-hmr attribute to find the style tag\n // to replace.\n const attr = JSON.stringify(pathToHtmlSafeName(id));\n return `\n style.setAttribute('data-expo-css-hmr', ${attr});\n const previousStyle = document.querySelector(\\`[data-expo-css-hmr=\"\\${${attr}}\"]\\`);\n if (previousStyle) {\n previousStyle.parentNode.removeChild(previousStyle);\n }`;\n}\n\nexport function matchCssModule(filename: string): boolean {\n return !!filename.match(/\\.module(\\.(native|ios|android|web))?\\.css$/);\n}\n\nexport async function transform(\n props: BabelTransformerArgs\n): Promise<BabelTransformerArgs> {\n if (props.filename.endsWith(\".css\")) {\n // Is a CSS module\n if (props.filename.match(/\\.module(\\.(native|ios|android|web))?\\.css$/)) {\n // TODO: Support CSS modules\n if (props.options.dev) {\n props.src = `// TODO(EvanBacon): CSS modules are not supported in Metro yet.\n// File: ${props.filename}\nmodule.exports = {}`;\n } else {\n props.src = `module.exports = {}`;\n }\n } else {\n if (props.options.platform === \"web\") {\n const dev = props.options.dev;\n props.src = `\n(() => {\n if (typeof document === 'undefined') {\n return\n }\n const head = document.head || document.getElementsByTagName('head')[0];\n const style = document.createElement('style');\n ${dev ? getHotReplaceTemplate(props.filename) : ``}\n style.setAttribute('data-expo-loader', 'css');\n head.appendChild(style);\n const css = \\`${props.src}\\`;\n if (style.styleSheet){\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n})();`;\n } else {\n // shim on native\n if (props.options.dev) {\n props.src = `// DEBUG: Global CSS is not supported on native platforms.\n// File: ${props.filename}`;\n } else {\n props.src = ``;\n }\n }\n }\n }\n return props;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /// <reference path="../../../../ts-declarations/metro-source-map/index.d.ts" />
2
+ import type { BabelTransformerArgs } from "metro-babel-transformer";
3
+ export declare function transform(props: BabelTransformerArgs): Promise<{
4
+ ast: import("@babel/types").Node;
5
+ code: string | null;
6
+ functionMap?: import("metro-source-map").FBSourceFunctionMap | null | undefined;
7
+ }>;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transformer/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAKpE,wBAAsB,SAAS,CAAC,KAAK,EAAE,oBAAoB;;;;GAM1D"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.transform = void 0;
30
+ const metro_react_native_babel_transformer_1 = __importDefault(require("metro-react-native-babel-transformer"));
31
+ const CssTransformer = __importStar(require("./css/css-transformer"));
32
+ async function transform(props) {
33
+ // Then pass it to the upstream transformer.
34
+ return metro_react_native_babel_transformer_1.default.transform(
35
+ // Transpile CSS first.
36
+ await CssTransformer.transform(props));
37
+ }
38
+ exports.transform = transform;
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transformer/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gHAAuE;AAEvE,sEAAwD;AAEjD,KAAK,UAAU,SAAS,CAAC,KAA2B;IACzD,4CAA4C;IAC5C,OAAO,8CAAmB,CAAC,SAAS;IAClC,uBAAuB;IACvB,MAAM,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CACtC,CAAC;AACJ,CAAC;AAND,8BAMC","sourcesContent":["import type { BabelTransformerArgs } from \"metro-babel-transformer\";\nimport upstreamTransformer from \"metro-react-native-babel-transformer\";\n\nimport * as CssTransformer from \"./css/css-transformer\";\n\nexport async function transform(props: BabelTransformerArgs) {\n // Then pass it to the upstream transformer.\n return upstreamTransformer.transform(\n // Transpile CSS first.\n await CssTransformer.transform(props)\n );\n}\n"]}
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@expo/metro-runtime",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Tools for making experimental Metro bundler features work",
5
5
  "main": "build",
6
+ "homepage": "https://github.com/expo/router/tree/main/packages/expo-metro-runtime",
6
7
  "files": [
7
8
  "build",
8
9
  "async-require.js",
9
10
  "async-require.d.ts",
10
11
  "error-overlay.js",
11
12
  "error-overlay.d.ts",
13
+ "transformer.js",
14
+ "transformer.d.ts",
12
15
  "assets"
13
16
  ],
14
17
  "scripts": {
@@ -38,8 +41,5 @@
38
41
  "dependencies": {
39
42
  "@bacons/react-views": "^1.1.3",
40
43
  "qs": "^6.10.3"
41
- },
42
- "devDependencies": {
43
- "@types/node": "^18.14.2"
44
44
  }
45
45
  }
@@ -0,0 +1 @@
1
+ export * from "./build/transformer";
package/transformer.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./build/transformer");