@expo/metro-runtime 0.0.0 → 0.0.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 (70) hide show
  1. package/async-require.d.ts +1 -0
  2. package/async-require.js +1 -0
  3. package/build/{asyncRequire → async-require}/buildAsyncRequire.d.ts +0 -0
  4. package/build/async-require/buildAsyncRequire.d.ts.map +1 -0
  5. package/build/{asyncRequire → async-require}/buildAsyncRequire.js +1 -0
  6. package/build/async-require/buildAsyncRequire.js.map +1 -0
  7. package/build/{asyncRequire → async-require}/buildUrlForBundle.d.ts +0 -0
  8. package/build/async-require/buildUrlForBundle.d.ts.map +1 -0
  9. package/build/{asyncRequire → async-require}/buildUrlForBundle.js +0 -0
  10. package/build/async-require/buildUrlForBundle.js.map +1 -0
  11. package/build/{asyncRequire → async-require}/buildUrlForBundle.native.d.ts +0 -0
  12. package/build/async-require/buildUrlForBundle.native.d.ts.map +1 -0
  13. package/build/{asyncRequire → async-require}/buildUrlForBundle.native.js +0 -0
  14. package/build/async-require/buildUrlForBundle.native.js.map +1 -0
  15. package/build/{asyncRequire → async-require}/fetchAsync.d.ts +0 -0
  16. package/build/async-require/fetchAsync.d.ts.map +1 -0
  17. package/build/{asyncRequire → async-require}/fetchAsync.js +0 -0
  18. package/build/async-require/fetchAsync.js.map +1 -0
  19. package/build/{asyncRequire → async-require}/fetchAsync.native.d.ts +0 -0
  20. package/build/async-require/fetchAsync.native.d.ts.map +1 -0
  21. package/build/{asyncRequire → async-require}/fetchAsync.native.js +0 -0
  22. package/build/async-require/fetchAsync.native.js.map +1 -0
  23. package/build/{asyncRequire → async-require}/fetchThenEval.d.ts +0 -0
  24. package/build/async-require/fetchThenEval.d.ts.map +1 -0
  25. package/build/{asyncRequire → async-require}/fetchThenEval.js +0 -0
  26. package/build/async-require/fetchThenEval.js.map +1 -0
  27. package/build/{asyncRequire → async-require}/fetchThenEval.web.d.ts +0 -0
  28. package/build/async-require/fetchThenEval.web.d.ts.map +1 -0
  29. package/build/async-require/fetchThenEval.web.js +66 -0
  30. package/build/async-require/fetchThenEval.web.js.map +1 -0
  31. package/build/{asyncRequire → async-require}/index.d.ts +0 -0
  32. package/build/{asyncRequire → async-require}/index.d.ts.map +1 -1
  33. package/build/{asyncRequire → async-require}/index.js +0 -0
  34. package/build/async-require/index.js.map +1 -0
  35. package/build/{asyncRequire → async-require}/loadBundle.android.d.ts +0 -0
  36. package/build/async-require/loadBundle.android.d.ts.map +1 -0
  37. package/build/{asyncRequire → async-require}/loadBundle.android.js +0 -0
  38. package/build/async-require/loadBundle.android.js.map +1 -0
  39. package/build/{asyncRequire → async-require}/loadBundle.d.ts +0 -0
  40. package/build/async-require/loadBundle.d.ts.map +1 -0
  41. package/build/{asyncRequire → async-require}/loadBundle.js +0 -0
  42. package/build/async-require/loadBundle.js.map +1 -0
  43. package/build/{asyncRequire → async-require}/loadBundlePolyfill.d.ts +0 -0
  44. package/build/async-require/loadBundlePolyfill.d.ts.map +1 -0
  45. package/build/{asyncRequire → async-require}/loadBundlePolyfill.js +0 -0
  46. package/build/async-require/loadBundlePolyfill.js.map +1 -0
  47. package/package.json +3 -2
  48. package/asyncRequire.js +0 -1
  49. package/build/asyncRequire/buildAsyncRequire.d.ts.map +0 -1
  50. package/build/asyncRequire/buildAsyncRequire.js.map +0 -1
  51. package/build/asyncRequire/buildUrlForBundle.d.ts.map +0 -1
  52. package/build/asyncRequire/buildUrlForBundle.js.map +0 -1
  53. package/build/asyncRequire/buildUrlForBundle.native.d.ts.map +0 -1
  54. package/build/asyncRequire/buildUrlForBundle.native.js.map +0 -1
  55. package/build/asyncRequire/fetchAsync.d.ts.map +0 -1
  56. package/build/asyncRequire/fetchAsync.js.map +0 -1
  57. package/build/asyncRequire/fetchAsync.native.d.ts.map +0 -1
  58. package/build/asyncRequire/fetchAsync.native.js.map +0 -1
  59. package/build/asyncRequire/fetchThenEval.d.ts.map +0 -1
  60. package/build/asyncRequire/fetchThenEval.js.map +0 -1
  61. package/build/asyncRequire/fetchThenEval.web.d.ts.map +0 -1
  62. package/build/asyncRequire/fetchThenEval.web.js +0 -29
  63. package/build/asyncRequire/fetchThenEval.web.js.map +0 -1
  64. package/build/asyncRequire/index.js.map +0 -1
  65. package/build/asyncRequire/loadBundle.android.d.ts.map +0 -1
  66. package/build/asyncRequire/loadBundle.android.js.map +0 -1
  67. package/build/asyncRequire/loadBundle.d.ts.map +0 -1
  68. package/build/asyncRequire/loadBundle.js.map +0 -1
  69. package/build/asyncRequire/loadBundlePolyfill.d.ts.map +0 -1
  70. package/build/asyncRequire/loadBundlePolyfill.js.map +0 -1
@@ -0,0 +1 @@
1
+ export * from "./build/async-require/index";
@@ -0,0 +1 @@
1
+ module.exports = require("./build/async-require");
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildAsyncRequire.d.ts","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":"AAMA,aAAK,YAAY,GAAG;IAClB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,GAAG,CAAC;CAChC,CAAC;AAMF;;;;;GAKG;AACH,aAAK,YAAY,GAAG;IAClB,CAAC,OAAO,EACN,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QAAE,cAAc,EAAE,OAAO,CAAA;KAAE,GACpC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;IAEtD,2FAA2F;IAC3F,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,CAoE1E"}
@@ -11,6 +11,7 @@ function buildAsyncRequire(metroRequire) {
11
11
  return importBundleNames[moduleID];
12
12
  }
13
13
  function asyncRequire(moduleID, moduleName = "", options = { isPrefetchOnly: false }) {
14
+ console.log("async require:", moduleID, moduleName, options);
14
15
  if (options.isPrefetchOnly) {
15
16
  return Promise.resolve();
16
17
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildAsyncRequire.js","sourceRoot":"","sources":["../../src/async-require/buildAsyncRequire.ts"],"names":[],"mappings":";;;AAAA,6CAA+C;AAmC/C,iFAAiF;AACjF,SAAgB,iBAAiB,CAAC,YAA0B;IAC1D,MAAM,iBAAiB,GAAsB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,oBAAoB,GAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEvE,8FAA8F;IAC9F,SAAS,aAAa,CAAC,QAAgB;QACrC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,YAAY,CACnB,QAAgB,EAChB,aAAqB,EAAE,EACvB,UAAuC,EAAE,cAAc,EAAE,KAAK,EAAE;QAEhE,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QAC7D,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B;QAED,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE;YACd,kDAAkD;YAClD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE;gBACzC,oBAAoB,CAAC,cAAc,CAAC,GAAG,IAAA,4BAAe,EAAC,UAAU,CAAC,CAAC,IAAI,CACrE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAC7B,CAAC;aACH;YACD,kCAAkC;YAClC,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC;SAC7C;QAED,OAAO,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,YAAY,CAAC,QAAQ,GAAG,UACtB,QAAgB,EAChB,UAAkB;QAElB,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5E,IAAI,MAAM,YAAY,OAAO,EAAE;YAC7B,MAAM,CAAC,IAAI,CACT,GAAG,EAAE,GAAE,CAAC,EACR,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;SACH;IACH,CAAC,CAAC;IAEF,YAAY,CAAC,QAAQ,GAAG,UACtB,QAAgB,EAChB,UAAkB;QAElB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC,CAAC;IAEF;;;;;OAKG;IACH,YAAY,CAAC,oBAAoB,GAAG,UAClC,KAA6B;QAE7B,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC;AApED,8CAoEC","sourcesContent":["import { loadBundleAsync } from \"./loadBundle\";\n\ntype ImportBundleNames = Record<string, string> & {\n __proto__: null;\n};\n\ntype MetroRequire = {\n (id: number): any;\n importAll: (id: number) => any;\n};\n\ntype ImportBundlePromises = Record<string, Promise<any>> & {\n __proto__?: null;\n};\n\n/**\n * Must satisfy the requirements of the Metro bundler.\n * https://github.com/facebook/metro/blob/f9fe277986ff7e7e53ae0418040f3aa1eb1c7056/packages/metro/src/ModuleGraph/worker/collectDependencies.js#L629-L639\n *\n * And https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/getAppendScripts.js#L54-L56\n */\ntype AsyncRequire = {\n <TModule>(\n moduleID: number,\n moduleName?: string,\n options?: { isPrefetchOnly: boolean }\n ): Promise<TModule | void> | TModule;\n prefetch(moduleID: number, moduleName: string): void;\n /** NOTE(EvanBacon): Unclear what this should return `__jsResource` ?? */\n resource(moduleID: number, moduleName: string): never;\n\n /** Register the 'moduleID<>bundle path' that can be loaded via `asyncRequire(moduleID)` */\n addImportBundleNames(names: Record<string, string>): void;\n};\n\n/** Create an `asyncRequire` function in the expected shape for Metro bundler. */\nexport function buildAsyncRequire(metroRequire: MetroRequire): AsyncRequire {\n const importBundleNames: ImportBundleNames = Object.create(null);\n const importBundlePromises: ImportBundlePromises = Object.create(null);\n\n // This is basically `__webpack_require__.u` -> returns the bundle path for a numeric moduleID\n function getBundlePath(moduleID: string): string | undefined {\n return importBundleNames[moduleID];\n }\n\n function asyncRequire<TModule>(\n moduleID: number,\n moduleName: string = \"\",\n options: { isPrefetchOnly: boolean } = { isPrefetchOnly: false }\n ): Promise<TModule | void> | TModule {\n console.log(\"async require:\", moduleID, moduleName, options);\n if (options.isPrefetchOnly) {\n return Promise.resolve();\n }\n\n const stringModuleID = String(moduleID);\n const bundlePath = getBundlePath(stringModuleID);\n if (bundlePath) {\n // Prevent loading the same module more than once.\n if (!importBundlePromises[stringModuleID]) {\n importBundlePromises[stringModuleID] = loadBundleAsync(bundlePath).then(\n () => metroRequire(moduleID)\n );\n }\n // Return for the user to resolve.\n return importBundlePromises[stringModuleID];\n }\n\n return metroRequire.importAll(moduleID);\n }\n\n asyncRequire.prefetch = function (\n moduleID: number,\n moduleName: string\n ): void {\n const result = asyncRequire(moduleID, moduleName, { isPrefetchOnly: true });\n if (result instanceof Promise) {\n result.then(\n () => {},\n () => {}\n );\n }\n };\n\n asyncRequire.resource = function (\n moduleID: number,\n moduleName: string\n ): never {\n throw new Error(\"Unimplemented Metro runtime feature\");\n };\n\n /**\n * Register modules that can be loaded async.\n * Key is a numeric string and value is a string denoting the bundle path.\n *\n * @example { '1': 'Second' }\n */\n asyncRequire.addImportBundleNames = function (\n names: Record<string, string>\n ): void {\n Object.assign(importBundleNames, names);\n };\n\n return asyncRequire;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAM,GACzC,MAAM,CAaR"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAwC,EAAE;IAE1C,iFAAiF;IACjF,kFAAkF;IAElF,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC/B,GAAG,IAAI,GAAG,CAAC;KACZ;IAED,MAAM,KAAK,GAAG,YAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,GAAG,GAAG,UAAU,GAAG,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC;AAhBD,8CAgBC","sourcesContent":["import qs from \"qs\";\n\n/**\n * Given a path and some optional additional query parameters, create the dev server bundle URL.\n * @param bundlePath like `/foobar`\n * @param params like `{ platform: \"web\" }`\n * @returns a URL like \"/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\"\n */\nexport function buildUrlForBundle(\n bundlePath: string,\n params: Record<string, string | null> = {}\n): string {\n // NOTE(EvanBacon): This must come from the window origin (at least in dev mode).\n // Otherwise Metro will crash from attempting to load a bundle that doesn't exist.\n\n let url = \"\";\n\n if (!bundlePath.startsWith(\"/\")) {\n url += \"/\";\n }\n\n const query = qs.stringify(params);\n\n return url + bundlePath + \".bundle\" + (query ? \"?\" + query : \"\");\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.native.d.ts","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAM,GACzC,MAAM,CAoBR"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/async-require/buildUrlForBundle.native.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,mEAA2C;AAE3C,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAwC,EAAE;IAE1C,MAAM,EACJ,aAAa,EACb,GAAG,EAAE,SAAS,EACd,sBAAsB,GACvB,GAAG,IAAA,sBAAY,GAAE,CAAC;IACnB,IAAI,CAAC,sBAAsB,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,6JAA6J,CAC9J,CAAC;KACH;IACD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,aAAa,IAAI,IAAI,EAAE;QACzB,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,KAAK,GAAG,YAAE,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;SAC3D;KACF;IACD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAvBD,8CAuBC","sourcesContent":["import qs from \"qs\";\n\nimport getDevServer from \"../getDevServer\";\n\nexport function buildUrlForBundle(\n bundlePath: string,\n params: Record<string, string | null> = {}\n): string {\n const {\n fullBundleUrl,\n url: serverUrl,\n bundleLoadedFromServer,\n } = getDevServer();\n if (!bundleLoadedFromServer) {\n throw new Error(\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 let query = {};\n if (fullBundleUrl != null) {\n const queryStart = fullBundleUrl.indexOf(\"?\");\n if (queryStart !== -1) {\n query = qs.parse(fullBundleUrl.substring(queryStart + 1));\n }\n }\n Object.assign(query, params);\n return serverUrl + bundlePath + \".bundle?\" + qs.stringify(query);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAsync.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchAsync.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAY7C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAsync.js","sourceRoot":"","sources":["../../src/async-require/fetchAsync.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAEjC,KAAK,UAAU,UAAU,CAC9B,GAAW;IAEX,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,wEAAwE;YACxE,eAAe,EAAE,uBAAQ,CAAC,EAAE;SAC7B;KACF,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;QAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC;AAdD,gCAcC","sourcesContent":["import { Platform } from \"react-native\";\n\nexport async function fetchAsync(\n url: string\n): Promise<{ body: string; headers: Headers }> {\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n // No real reason for this but we try to use this format for everything.\n \"expo-platform\": Platform.OS,\n },\n });\n return {\n body: await response.text(),\n headers: response.headers,\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAsync.native.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchAsync.native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CA2D5D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchAsync.native.js","sourceRoot":"","sources":["../../src/async-require/fetchAsync.native.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,+CAAwC;AACxC,mBAAmB;AACnB,iGAAsE;AAEtE,SAAgB,UAAU,CACxB,GAAW;IAEX,IAAI,EAAE,GAAkB,IAAI,CAAC;IAC7B,IAAI,YAAY,GAAkB,IAAI,CAAC;IACvC,IAAI,OAAO,GAA2B,EAAE,CAAC;IACzC,IAAI,YAAY,GAAkC,IAAI,CAAC;IACvD,IAAI,gBAAgB,GAAkC,IAAI,CAAC;IAC3D,IAAI,gBAAgB,GAAkC,IAAI,CAAC;IAC3D,OAAO,IAAI,OAAO,CAChB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAClB,YAAY,GAAG,uBAAU,CAAC,WAAW,CACnC,uBAAuB,EACvB,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE;YACxB,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,YAAY,GAAG,QAAQ,CAAC;aACzB;QACH,CAAC,CACF,CAAC;QACF,gBAAgB,GAAG,uBAAU,CAAC,WAAW,CACvC,2BAA2B,EAC3B,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,EAAE;YACvC,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,OAAO,GAAG,eAAe,CAAC;aAC3B;QACH,CAAC,CACF,CAAC;QACF,gBAAgB,GAAG,uBAAU,CAAC,WAAW,CACvC,4BAA4B,EAC5B,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;YACrB,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;qBAAM;oBACL,OAAO,CAAC,EAAE,IAAI,EAAE,YAAa,EAAE,OAAO,EAAE,CAAC,CAAC;iBAC3C;aACF;QACH,CAAC,CACF,CAAC;QACF,uBAAU,CAAC,WAAW,CACpB,KAAK,EACL,cAAc,EACd,GAAG,EACH;YACE,eAAe,EAAE,uBAAQ,CAAC,EAAE;SAC7B,EACD,EAAE,EACF,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,SAAS,EAAE,EAAE;YACZ,EAAE,GAAG,SAAS,CAAC;QACjB,CAAC,EACD,IAAI,CACL,CAAC;IACJ,CAAC,CACF,CAAC,OAAO,CAAC,GAAG,EAAE;QACb,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,EAAE,CAAC;QACvB,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAM,EAAE,CAAC;QAC3B,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAM,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AA7DD,gCA6DC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Facebook, Inc. and its 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 { Platform } from \"react-native\";\n// @ts-expect-error\nimport Networking from \"react-native/Libraries/Network/RCTNetworking\";\n\nexport function fetchAsync(\n url: string\n): Promise<{ body: string; headers: Record<string, string> }> {\n let id: string | null = null;\n let responseText: string | null = null;\n let headers: Record<string, string> = {};\n let dataListener: { remove: () => void } | null = null;\n let completeListener: { remove: () => void } | null = null;\n let responseListener: { remove: () => void } | null = null;\n return new Promise<{ body: string; headers: Record<string, string> }>(\n (resolve, reject) => {\n dataListener = Networking.addListener(\n \"didReceiveNetworkData\",\n ([requestId, response]) => {\n if (requestId === id) {\n responseText = response;\n }\n }\n );\n responseListener = Networking.addListener(\n \"didReceiveNetworkResponse\",\n ([requestId, status, responseHeaders]) => {\n if (requestId === id) {\n headers = responseHeaders;\n }\n }\n );\n completeListener = Networking.addListener(\n \"didCompleteNetworkResponse\",\n ([requestId, error]) => {\n if (requestId === id) {\n if (error) {\n reject(error);\n } else {\n resolve({ body: responseText!, headers });\n }\n }\n }\n );\n Networking.sendRequest(\n \"GET\",\n \"asyncRequest\",\n url,\n {\n \"expo-platform\": Platform.OS,\n },\n \"\",\n \"text\",\n false,\n 0,\n (requestId) => {\n id = requestId;\n },\n true\n );\n }\n ).finally(() => {\n dataListener?.remove();\n completeListener?.remove();\n responseListener?.remove();\n });\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchThenEval.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB7D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchThenEval.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAM1C;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,IACE,OAAO,CAAC,cAAc,CAAC,IAAI,IAAI;YAC/B,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,EACxD;YACA,+BAA+B;YAC/B,MAAM,IAAI,KAAK,CACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,2BAA2B,GAAG,GAAG,CAC9D,CAAC;SACH;QAED,gFAAgF;QAEhF,oEAAoE;QACpE,qEAAqE;QACrE,IAAI,MAAM,CAAC,uBAAuB,EAAE;YAClC,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC3C;aAAM;YACL,mCAAmC;YACnC,IAAI,CAAC,IAAI,CAAC,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,gDAuBC","sourcesContent":["import { fetchAsync } from \"./fetchAsync\";\n\ndeclare let global: {\n globalEvalWithSourceUrl?: any;\n};\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.\n */\nexport function fetchThenEvalAsync(url: string): Promise<void> {\n return fetchAsync(url).then(({ body, headers }) => {\n if (\n headers[\"Content-Type\"] != null &&\n headers[\"Content-Type\"].indexOf(\"application/json\") >= 0\n ) {\n // Errors are returned as JSON.\n throw new Error(\n JSON.parse(body).message || `Unknown error fetching '${url}'`\n );\n }\n\n // NOTE(EvanBacon): All of this code is ignored in development mode at the root.\n\n // Some engines do not support `sourceURL` as a comment. We expose a\n // `globalEvalWithSourceUrl` function to handle updates in that case.\n if (global.globalEvalWithSourceUrl) {\n global.globalEvalWithSourceUrl(body, url);\n } else {\n // eslint-disable-next-line no-eval\n eval(body);\n }\n });\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchThenEval.web.d.ts","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,GACZ,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACpE,OAAO,CAAC,IAAI,CAAC,CAuDf"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchThenEvalAsync = void 0;
4
+ // Basically `__webpack_require__.l`.
5
+ function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
6
+ return new Promise((resolve, reject) => {
7
+ const script = document.createElement("script");
8
+ if (scriptType)
9
+ script.type = scriptType;
10
+ if (nonce)
11
+ script.setAttribute("nonce", nonce);
12
+ // script.setAttribute('data-expo-metro', ...);
13
+ script.src = url;
14
+ if (crossOrigin && script.src.indexOf(window.location.origin + "/") !== 0) {
15
+ script.crossOrigin = crossOrigin;
16
+ }
17
+ script.onload = () => {
18
+ script.parentNode && script.parentNode.removeChild(script);
19
+ resolve();
20
+ };
21
+ // Create a new error object to preserve the original stack trace.
22
+ const error = new AsyncRequireError();
23
+ // Server error or network error.
24
+ script.onerror = (ev) => {
25
+ var _a;
26
+ let event;
27
+ if (typeof ev === "string") {
28
+ event = {
29
+ type: "error",
30
+ target: {
31
+ // @ts-expect-error
32
+ src: event,
33
+ },
34
+ };
35
+ }
36
+ else {
37
+ event = ev;
38
+ }
39
+ const errorType = event && (event.type === "load" ? "missing" : event.type);
40
+ // @ts-expect-error
41
+ const realSrc = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.src;
42
+ error.message =
43
+ "Loading module " +
44
+ url +
45
+ " failed.\n(" +
46
+ errorType +
47
+ ": " +
48
+ realSrc +
49
+ ")";
50
+ error.type = errorType;
51
+ error.request = realSrc;
52
+ script.parentNode && script.parentNode.removeChild(script);
53
+ reject(error);
54
+ };
55
+ document.head.appendChild(script);
56
+ document.head.appendChild(script);
57
+ });
58
+ }
59
+ exports.fetchThenEvalAsync = fetchThenEvalAsync;
60
+ class AsyncRequireError extends Error {
61
+ constructor() {
62
+ super(...arguments);
63
+ this.name = "AsyncRequireError";
64
+ }
65
+ }
66
+ //# sourceMappingURL=fetchThenEval.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/async-require/fetchThenEval.web.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,SAAgB,kBAAkB,CAChC,GAAW,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,MACsD,EAAE;IAErE,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QACzC,IAAI,KAAK;YAAE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,+CAA+C;QAC/C,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;QAEjB,IAAI,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;YACzE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;SAClC;QAED,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,kEAAkE;QAClE,MAAM,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAEtC,iCAAiC;QACjC,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,EAAE;;YACtB,IAAI,KAAY,CAAC;YACjB,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;gBAC1B,KAAK,GAAG;oBACN,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE;wBACN,mBAAmB;wBACnB,GAAG,EAAE,KAAK;qBACX;iBACF,CAAC;aACH;iBAAM;gBACL,KAAK,GAAG,EAAE,CAAC;aACZ;YAED,MAAM,SAAS,GACb,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5D,mBAAmB;YACnB,MAAM,OAAO,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,0CAAE,GAAG,CAAC;YACnC,KAAK,CAAC,OAAO;gBACX,iBAAiB;oBACjB,GAAG;oBACH,aAAa;oBACb,SAAS;oBACT,IAAI;oBACJ,OAAO;oBACP,GAAG,CAAC;YACN,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YAExB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AA9DD,gDA8DC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAArC;;QACW,SAAI,GAAG,mBAAmB,CAAC;IAGtC,CAAC;CAAA","sourcesContent":["// Basically `__webpack_require__.l`.\nexport function fetchThenEvalAsync(\n url: string,\n {\n scriptType,\n nonce,\n crossOrigin,\n }: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement(\"script\");\n if (scriptType) script.type = scriptType;\n if (nonce) script.setAttribute(\"nonce\", nonce);\n // script.setAttribute('data-expo-metro', ...);\n script.src = url;\n\n if (crossOrigin && script.src.indexOf(window.location.origin + \"/\") !== 0) {\n script.crossOrigin = crossOrigin;\n }\n\n script.onload = () => {\n script.parentNode && script.parentNode.removeChild(script);\n resolve();\n };\n // Create a new error object to preserve the original stack trace.\n const error = new AsyncRequireError();\n\n // Server error or network error.\n script.onerror = (ev) => {\n let event: Event;\n if (typeof ev === \"string\") {\n event = {\n type: \"error\",\n target: {\n // @ts-expect-error\n src: event,\n },\n };\n } else {\n event = ev;\n }\n\n const errorType =\n event && (event.type === \"load\" ? \"missing\" : event.type);\n // @ts-expect-error\n const realSrc = event?.target?.src;\n error.message =\n \"Loading module \" +\n url +\n \" failed.\\n(\" +\n errorType +\n \": \" +\n realSrc +\n \")\";\n error.type = errorType;\n error.request = realSrc;\n\n script.parentNode && script.parentNode.removeChild(script);\n reject(error);\n };\n document.head.appendChild(script);\n document.head.appendChild(script);\n });\n}\n\nclass AsyncRequireError extends Error {\n readonly name = \"AsyncRequireError\";\n type?: string;\n request?: string;\n}\n"]}
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/async-require/index.ts"],"names":[],"mappings":";;AAAA,2DAAwD;AAExD,MAAM,CAAC,OAAO,GAAG,IAAA,qCAAiB,EAAC,OAAc,CAAC,CAAC","sourcesContent":["import { buildAsyncRequire } from \"./buildAsyncRequire\";\n\nmodule.exports = buildAsyncRequire(require as any);\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundle.android.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.android.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAYhE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundle.android.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.android.ts"],"names":[],"mappings":";;;;;;AAAA,6HAAqG;AAErG,6DAAkF;AAElF,SAAgB,eAAe,CAAC,UAAkB;IAChD;IACE,gDAAgD;IAChD,oCAA0B,aAA1B,oCAA0B,uBAA1B,oCAA0B,CAAE,UAAU,EACtC;QACA,OAAO,oCAA0B,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACnE,uEAAuE;YACvE,2EAA2E;YAC3E,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,IAAA,oCAAuB,EAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAZD,0CAYC","sourcesContent":["import NativeDevSplitBundleLoader from \"react-native/Libraries/Utilities/NativeDevSplitBundleLoader\";\n\nimport { loadBundleAsync as loadBundlePolyfillAsync } from \"./loadBundlePolyfill\";\n\nexport function loadBundleAsync(bundlePath: string): Promise<any> {\n if (\n // NOTE(EvanBacon): This is broken on iOS afaict\n NativeDevSplitBundleLoader?.loadBundle\n ) {\n return NativeDevSplitBundleLoader.loadBundle(bundlePath).catch((e) => {\n // On Android 'e' is not an instance of Error, which seems to be a bug.\n // As a workaround, re-throw an Error to not break the error handling code.\n throw new Error(e.message);\n });\n }\n return loadBundlePolyfillAsync(bundlePath);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/async-require/loadBundle.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAA9C,qHAAA,eAAe,OAAA","sourcesContent":["export { loadBundleAsync } from \"./loadBundlePolyfill\";\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundlePolyfill.d.ts","sourceRoot":"","sources":["../../src/async-require/loadBundlePolyfill.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBjE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadBundlePolyfill.js","sourceRoot":"","sources":["../../src/async-require/loadBundlePolyfill.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAwC;AAExC,6DAAqC;AACrC,iEAAyC;AACzC,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,EAAE;QAC/C,WAAW,EAAE,MAAM;QACnB,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,uBAAQ,CAAC,EAAE;QACrB,mDAAmD;QACnD,sBAAsB,EAAE,IAAI;KAC7B,CAAC,CAAC;IAEH,qEAAqE;IACrE,qBAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAClD,eAAe,EAAE,CAAC;IAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;SAClC,IAAI,CAAC,GAAG,EAAE;QACT,mBAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,EAAE,eAAe,EAAE;YACtB,qBAAW,CAAC,IAAI,EAAE,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAtBD,0CAsBC","sourcesContent":["import { Platform } from \"react-native\";\n\nimport HMRClient from \"../HMRClient\";\nimport LoadingView from \"../LoadingView\";\nimport { buildUrlForBundle } from \"./buildUrlForBundle\";\nimport { fetchThenEvalAsync } from \"./fetchThenEval\";\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.\n */\nexport function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath, {\n modulesOnly: \"true\",\n runModule: \"false\",\n platform: Platform.OS,\n // The JavaScript loader does not support bytecode.\n runtimeBytecodeVersion: null,\n });\n\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage(\"Downloading...\", \"load\");\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n HMRClient.registerBundle(requestUrl);\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n}\n"]}
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@expo/metro-runtime",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "Tools for making experimental Metro bundler features work",
5
5
  "main": "build",
6
6
  "files": [
7
7
  "build",
8
- "asyncRequire.js",
8
+ "async-require.js",
9
+ "async-require.d.ts",
9
10
  "error-overlay.js",
10
11
  "error-overlay.d.ts",
11
12
  "assets"
package/asyncRequire.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("./build/asyncRequire");
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildAsyncRequire.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/buildAsyncRequire.ts"],"names":[],"mappings":"AAMA,aAAK,YAAY,GAAG;IAClB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,GAAG,CAAC;CAChC,CAAC;AAMF;;;;;GAKG;AACH,aAAK,YAAY,GAAG;IAClB,CAAC,OAAO,EACN,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QAAE,cAAc,EAAE,OAAO,CAAA;KAAE,GACpC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;IAEtD,2FAA2F;IAC3F,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,CAmE1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildAsyncRequire.js","sourceRoot":"","sources":["../../src/asyncRequire/buildAsyncRequire.ts"],"names":[],"mappings":";;;AAAA,6CAA+C;AAmC/C,iFAAiF;AACjF,SAAgB,iBAAiB,CAAC,YAA0B;IAC1D,MAAM,iBAAiB,GAAsB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjE,MAAM,oBAAoB,GAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEvE,8FAA8F;IAC9F,SAAS,aAAa,CAAC,QAAgB;QACrC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,SAAS,YAAY,CACnB,QAAgB,EAChB,aAAqB,EAAE,EACvB,UAAuC,EAAE,cAAc,EAAE,KAAK,EAAE;QAEhE,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B;QAED,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE;YACd,kDAAkD;YAClD,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE;gBACzC,oBAAoB,CAAC,cAAc,CAAC,GAAG,IAAA,4BAAe,EAAC,UAAU,CAAC,CAAC,IAAI,CACrE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAC7B,CAAC;aACH;YACD,kCAAkC;YAClC,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC;SAC7C;QAED,OAAO,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,YAAY,CAAC,QAAQ,GAAG,UACtB,QAAgB,EAChB,UAAkB;QAElB,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5E,IAAI,MAAM,YAAY,OAAO,EAAE;YAC7B,MAAM,CAAC,IAAI,CACT,GAAG,EAAE,GAAE,CAAC,EACR,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;SACH;IACH,CAAC,CAAC;IAEF,YAAY,CAAC,QAAQ,GAAG,UACtB,QAAgB,EAChB,UAAkB;QAElB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC,CAAC;IAEF;;;;;OAKG;IACH,YAAY,CAAC,oBAAoB,GAAG,UAClC,KAA6B;QAE7B,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC;AAnED,8CAmEC","sourcesContent":["import { loadBundleAsync } from \"./loadBundle\";\n\ntype ImportBundleNames = Record<string, string> & {\n __proto__: null;\n};\n\ntype MetroRequire = {\n (id: number): any;\n importAll: (id: number) => any;\n};\n\ntype ImportBundlePromises = Record<string, Promise<any>> & {\n __proto__?: null;\n};\n\n/**\n * Must satisfy the requirements of the Metro bundler.\n * https://github.com/facebook/metro/blob/f9fe277986ff7e7e53ae0418040f3aa1eb1c7056/packages/metro/src/ModuleGraph/worker/collectDependencies.js#L629-L639\n *\n * And https://github.com/facebook/metro/blob/fc29a1177f883144674cf85a813b58567f69d545/packages/metro/src/lib/getAppendScripts.js#L54-L56\n */\ntype AsyncRequire = {\n <TModule>(\n moduleID: number,\n moduleName?: string,\n options?: { isPrefetchOnly: boolean }\n ): Promise<TModule | void> | TModule;\n prefetch(moduleID: number, moduleName: string): void;\n /** NOTE(EvanBacon): Unclear what this should return `__jsResource` ?? */\n resource(moduleID: number, moduleName: string): never;\n\n /** Register the 'moduleID<>bundle path' that can be loaded via `asyncRequire(moduleID)` */\n addImportBundleNames(names: Record<string, string>): void;\n};\n\n/** Create an `asyncRequire` function in the expected shape for Metro bundler. */\nexport function buildAsyncRequire(metroRequire: MetroRequire): AsyncRequire {\n const importBundleNames: ImportBundleNames = Object.create(null);\n const importBundlePromises: ImportBundlePromises = Object.create(null);\n\n // This is basically `__webpack_require__.u` -> returns the bundle path for a numeric moduleID\n function getBundlePath(moduleID: string): string | undefined {\n return importBundleNames[moduleID];\n }\n\n function asyncRequire<TModule>(\n moduleID: number,\n moduleName: string = \"\",\n options: { isPrefetchOnly: boolean } = { isPrefetchOnly: false }\n ): Promise<TModule | void> | TModule {\n if (options.isPrefetchOnly) {\n return Promise.resolve();\n }\n\n const stringModuleID = String(moduleID);\n const bundlePath = getBundlePath(stringModuleID);\n if (bundlePath) {\n // Prevent loading the same module more than once.\n if (!importBundlePromises[stringModuleID]) {\n importBundlePromises[stringModuleID] = loadBundleAsync(bundlePath).then(\n () => metroRequire(moduleID)\n );\n }\n // Return for the user to resolve.\n return importBundlePromises[stringModuleID];\n }\n\n return metroRequire.importAll(moduleID);\n }\n\n asyncRequire.prefetch = function (\n moduleID: number,\n moduleName: string\n ): void {\n const result = asyncRequire(moduleID, moduleName, { isPrefetchOnly: true });\n if (result instanceof Promise) {\n result.then(\n () => {},\n () => {}\n );\n }\n };\n\n asyncRequire.resource = function (\n moduleID: number,\n moduleName: string\n ): never {\n throw new Error(\"Unimplemented Metro runtime feature\");\n };\n\n /**\n * Register modules that can be loaded async.\n * Key is a numeric string and value is a string denoting the bundle path.\n *\n * @example { '1': 'Second' }\n */\n asyncRequire.addImportBundleNames = function (\n names: Record<string, string>\n ): void {\n Object.assign(importBundleNames, names);\n };\n\n return asyncRequire;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildUrlForBundle.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/buildUrlForBundle.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAM,GACzC,MAAM,CAaR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildUrlForBundle.js","sourceRoot":"","sources":["../../src/asyncRequire/buildUrlForBundle.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAwC,EAAE;IAE1C,iFAAiF;IACjF,kFAAkF;IAElF,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC/B,GAAG,IAAI,GAAG,CAAC;KACZ;IAED,MAAM,KAAK,GAAG,YAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,GAAG,GAAG,UAAU,GAAG,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC;AAhBD,8CAgBC","sourcesContent":["import qs from \"qs\";\n\n/**\n * Given a path and some optional additional query parameters, create the dev server bundle URL.\n * @param bundlePath like `/foobar`\n * @param params like `{ platform: \"web\" }`\n * @returns a URL like \"/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null\"\n */\nexport function buildUrlForBundle(\n bundlePath: string,\n params: Record<string, string | null> = {}\n): string {\n // NOTE(EvanBacon): This must come from the window origin (at least in dev mode).\n // Otherwise Metro will crash from attempting to load a bundle that doesn't exist.\n\n let url = \"\";\n\n if (!bundlePath.startsWith(\"/\")) {\n url += \"/\";\n }\n\n const query = qs.stringify(params);\n\n return url + bundlePath + \".bundle\" + (query ? \"?\" + query : \"\");\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildUrlForBundle.native.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/buildUrlForBundle.native.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAM,GACzC,MAAM,CAoBR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildUrlForBundle.native.js","sourceRoot":"","sources":["../../src/asyncRequire/buildUrlForBundle.native.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,mEAA2C;AAE3C,SAAgB,iBAAiB,CAC/B,UAAkB,EAClB,SAAwC,EAAE;IAE1C,MAAM,EACJ,aAAa,EACb,GAAG,EAAE,SAAS,EACd,sBAAsB,GACvB,GAAG,IAAA,sBAAY,GAAE,CAAC;IACnB,IAAI,CAAC,sBAAsB,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,6JAA6J,CAC9J,CAAC;KACH;IACD,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,aAAa,IAAI,IAAI,EAAE;QACzB,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE;YACrB,KAAK,GAAG,YAAE,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;SAC3D;KACF;IACD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAvBD,8CAuBC","sourcesContent":["import qs from \"qs\";\n\nimport getDevServer from \"../getDevServer\";\n\nexport function buildUrlForBundle(\n bundlePath: string,\n params: Record<string, string | null> = {}\n): string {\n const {\n fullBundleUrl,\n url: serverUrl,\n bundleLoadedFromServer,\n } = getDevServer();\n if (!bundleLoadedFromServer) {\n throw new Error(\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 let query = {};\n if (fullBundleUrl != null) {\n const queryStart = fullBundleUrl.indexOf(\"?\");\n if (queryStart !== -1) {\n query = qs.parse(fullBundleUrl.substring(queryStart + 1));\n }\n }\n Object.assign(query, params);\n return serverUrl + bundlePath + \".bundle?\" + qs.stringify(query);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchAsync.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/fetchAsync.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAY7C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchAsync.js","sourceRoot":"","sources":["../../src/asyncRequire/fetchAsync.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAEjC,KAAK,UAAU,UAAU,CAC9B,GAAW;IAEX,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAChC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,wEAAwE;YACxE,eAAe,EAAE,uBAAQ,CAAC,EAAE;SAC7B;KACF,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;QAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC;AAdD,gCAcC","sourcesContent":["import { Platform } from \"react-native\";\n\nexport async function fetchAsync(\n url: string\n): Promise<{ body: string; headers: Headers }> {\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n // No real reason for this but we try to use this format for everything.\n \"expo-platform\": Platform.OS,\n },\n });\n return {\n body: await response.text(),\n headers: response.headers,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchAsync.native.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/fetchAsync.native.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CA2D5D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchAsync.native.js","sourceRoot":"","sources":["../../src/asyncRequire/fetchAsync.native.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,+CAAwC;AACxC,mBAAmB;AACnB,iGAAsE;AAEtE,SAAgB,UAAU,CACxB,GAAW;IAEX,IAAI,EAAE,GAAkB,IAAI,CAAC;IAC7B,IAAI,YAAY,GAAkB,IAAI,CAAC;IACvC,IAAI,OAAO,GAA2B,EAAE,CAAC;IACzC,IAAI,YAAY,GAAkC,IAAI,CAAC;IACvD,IAAI,gBAAgB,GAAkC,IAAI,CAAC;IAC3D,IAAI,gBAAgB,GAAkC,IAAI,CAAC;IAC3D,OAAO,IAAI,OAAO,CAChB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAClB,YAAY,GAAG,uBAAU,CAAC,WAAW,CACnC,uBAAuB,EACvB,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE;YACxB,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,YAAY,GAAG,QAAQ,CAAC;aACzB;QACH,CAAC,CACF,CAAC;QACF,gBAAgB,GAAG,uBAAU,CAAC,WAAW,CACvC,2BAA2B,EAC3B,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,EAAE;YACvC,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,OAAO,GAAG,eAAe,CAAC;aAC3B;QACH,CAAC,CACF,CAAC;QACF,gBAAgB,GAAG,uBAAU,CAAC,WAAW,CACvC,4BAA4B,EAC5B,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;YACrB,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;qBAAM;oBACL,OAAO,CAAC,EAAE,IAAI,EAAE,YAAa,EAAE,OAAO,EAAE,CAAC,CAAC;iBAC3C;aACF;QACH,CAAC,CACF,CAAC;QACF,uBAAU,CAAC,WAAW,CACpB,KAAK,EACL,cAAc,EACd,GAAG,EACH;YACE,eAAe,EAAE,uBAAQ,CAAC,EAAE;SAC7B,EACD,EAAE,EACF,MAAM,EACN,KAAK,EACL,CAAC,EACD,CAAC,SAAS,EAAE,EAAE;YACZ,EAAE,GAAG,SAAS,CAAC;QACjB,CAAC,EACD,IAAI,CACL,CAAC;IACJ,CAAC,CACF,CAAC,OAAO,CAAC,GAAG,EAAE;QACb,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,EAAE,CAAC;QACvB,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAM,EAAE,CAAC;QAC3B,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,MAAM,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AA7DD,gCA6DC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Facebook, Inc. and its 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 { Platform } from \"react-native\";\n// @ts-expect-error\nimport Networking from \"react-native/Libraries/Network/RCTNetworking\";\n\nexport function fetchAsync(\n url: string\n): Promise<{ body: string; headers: Record<string, string> }> {\n let id: string | null = null;\n let responseText: string | null = null;\n let headers: Record<string, string> = {};\n let dataListener: { remove: () => void } | null = null;\n let completeListener: { remove: () => void } | null = null;\n let responseListener: { remove: () => void } | null = null;\n return new Promise<{ body: string; headers: Record<string, string> }>(\n (resolve, reject) => {\n dataListener = Networking.addListener(\n \"didReceiveNetworkData\",\n ([requestId, response]) => {\n if (requestId === id) {\n responseText = response;\n }\n }\n );\n responseListener = Networking.addListener(\n \"didReceiveNetworkResponse\",\n ([requestId, status, responseHeaders]) => {\n if (requestId === id) {\n headers = responseHeaders;\n }\n }\n );\n completeListener = Networking.addListener(\n \"didCompleteNetworkResponse\",\n ([requestId, error]) => {\n if (requestId === id) {\n if (error) {\n reject(error);\n } else {\n resolve({ body: responseText!, headers });\n }\n }\n }\n );\n Networking.sendRequest(\n \"GET\",\n \"asyncRequest\",\n url,\n {\n \"expo-platform\": Platform.OS,\n },\n \"\",\n \"text\",\n false,\n 0,\n (requestId) => {\n id = requestId;\n },\n true\n );\n }\n ).finally(() => {\n dataListener?.remove();\n completeListener?.remove();\n responseListener?.remove();\n });\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchThenEval.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/fetchThenEval.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB7D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchThenEval.js","sourceRoot":"","sources":["../../src/asyncRequire/fetchThenEval.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAM1C;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,IACE,OAAO,CAAC,cAAc,CAAC,IAAI,IAAI;YAC/B,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,EACxD;YACA,+BAA+B;YAC/B,MAAM,IAAI,KAAK,CACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,IAAI,2BAA2B,GAAG,GAAG,CAC9D,CAAC;SACH;QAED,gFAAgF;QAEhF,oEAAoE;QACpE,qEAAqE;QACrE,IAAI,MAAM,CAAC,uBAAuB,EAAE;YAClC,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC3C;aAAM;YACL,mCAAmC;YACnC,IAAI,CAAC,IAAI,CAAC,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,gDAuBC","sourcesContent":["import { fetchAsync } from \"./fetchAsync\";\n\ndeclare let global: {\n globalEvalWithSourceUrl?: any;\n};\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.\n */\nexport function fetchThenEvalAsync(url: string): Promise<void> {\n return fetchAsync(url).then(({ body, headers }) => {\n if (\n headers[\"Content-Type\"] != null &&\n headers[\"Content-Type\"].indexOf(\"application/json\") >= 0\n ) {\n // Errors are returned as JSON.\n throw new Error(\n JSON.parse(body).message || `Unknown error fetching '${url}'`\n );\n }\n\n // NOTE(EvanBacon): All of this code is ignored in development mode at the root.\n\n // Some engines do not support `sourceURL` as a comment. We expose a\n // `globalEvalWithSourceUrl` function to handle updates in that case.\n if (global.globalEvalWithSourceUrl) {\n global.globalEvalWithSourceUrl(body, url);\n } else {\n // eslint-disable-next-line no-eval\n eval(body);\n }\n });\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchThenEval.web.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/fetchThenEval.web.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,GACZ,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACpE,OAAO,CAAC,IAAI,CAAC,CAuBf"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchThenEvalAsync = void 0;
4
- // Basically `__webpack_require__.l`.
5
- function fetchThenEvalAsync(url, { scriptType, nonce, crossOrigin, } = {}) {
6
- return new Promise((resolve, reject) => {
7
- const script = document.createElement("script");
8
- if (scriptType)
9
- script.type = scriptType;
10
- if (nonce)
11
- script.setAttribute("nonce", nonce);
12
- // script.setAttribute('data-expo-metro', ...);
13
- script.src = url;
14
- if (crossOrigin && script.src.indexOf(window.location.origin + "/") !== 0) {
15
- script.crossOrigin = crossOrigin;
16
- }
17
- script.onload = () => {
18
- script.parentNode && script.parentNode.removeChild(script);
19
- resolve();
20
- };
21
- script.onerror = (error) => {
22
- script.parentNode && script.parentNode.removeChild(script);
23
- reject(error);
24
- };
25
- document.head.appendChild(script);
26
- });
27
- }
28
- exports.fetchThenEvalAsync = fetchThenEvalAsync;
29
- //# sourceMappingURL=fetchThenEval.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchThenEval.web.js","sourceRoot":"","sources":["../../src/asyncRequire/fetchThenEval.web.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,SAAgB,kBAAkB,CAChC,GAAW,EACX,EACE,UAAU,EACV,KAAK,EACL,WAAW,MACsD,EAAE;IAErE,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;QACzC,IAAI,KAAK;YAAE,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,+CAA+C;QAC/C,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC;QAEjB,IAAI,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;YACzE,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;SAClC;QAED,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC3D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AA9BD,gDA8BC","sourcesContent":["// Basically `__webpack_require__.l`.\nexport function fetchThenEvalAsync(\n url: string,\n {\n scriptType,\n nonce,\n crossOrigin,\n }: { scriptType?: string; nonce?: string; crossOrigin?: string } = {}\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement(\"script\");\n if (scriptType) script.type = scriptType;\n if (nonce) script.setAttribute(\"nonce\", nonce);\n // script.setAttribute('data-expo-metro', ...);\n script.src = url;\n\n if (crossOrigin && script.src.indexOf(window.location.origin + \"/\") !== 0) {\n script.crossOrigin = crossOrigin;\n }\n\n script.onload = () => {\n script.parentNode && script.parentNode.removeChild(script);\n resolve();\n };\n\n script.onerror = (error) => {\n script.parentNode && script.parentNode.removeChild(script);\n reject(error);\n };\n document.head.appendChild(script);\n });\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/asyncRequire/index.ts"],"names":[],"mappings":";;AAAA,2DAAwD;AAExD,MAAM,CAAC,OAAO,GAAG,IAAA,qCAAiB,EAAC,OAAc,CAAC,CAAC","sourcesContent":["import { buildAsyncRequire } from \"./buildAsyncRequire\";\n\nmodule.exports = buildAsyncRequire(require as any);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadBundle.android.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/loadBundle.android.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAYhE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadBundle.android.js","sourceRoot":"","sources":["../../src/asyncRequire/loadBundle.android.ts"],"names":[],"mappings":";;;;;;AAAA,6HAAqG;AAErG,6DAAkF;AAElF,SAAgB,eAAe,CAAC,UAAkB;IAChD;IACE,gDAAgD;IAChD,oCAA0B,aAA1B,oCAA0B,uBAA1B,oCAA0B,CAAE,UAAU,EACtC;QACA,OAAO,oCAA0B,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACnE,uEAAuE;YACvE,2EAA2E;YAC3E,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,IAAA,oCAAuB,EAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAZD,0CAYC","sourcesContent":["import NativeDevSplitBundleLoader from \"react-native/Libraries/Utilities/NativeDevSplitBundleLoader\";\n\nimport { loadBundleAsync as loadBundlePolyfillAsync } from \"./loadBundlePolyfill\";\n\nexport function loadBundleAsync(bundlePath: string): Promise<any> {\n if (\n // NOTE(EvanBacon): This is broken on iOS afaict\n NativeDevSplitBundleLoader?.loadBundle\n ) {\n return NativeDevSplitBundleLoader.loadBundle(bundlePath).catch((e) => {\n // On Android 'e' is not an instance of Error, which seems to be a bug.\n // As a workaround, re-throw an Error to not break the error handling code.\n throw new Error(e.message);\n });\n }\n return loadBundlePolyfillAsync(bundlePath);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadBundle.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/loadBundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadBundle.js","sourceRoot":"","sources":["../../src/asyncRequire/loadBundle.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAA9C,qHAAA,eAAe,OAAA","sourcesContent":["export { loadBundleAsync } from \"./loadBundlePolyfill\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadBundlePolyfill.d.ts","sourceRoot":"","sources":["../../src/asyncRequire/loadBundlePolyfill.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBjE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"loadBundlePolyfill.js","sourceRoot":"","sources":["../../src/asyncRequire/loadBundlePolyfill.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAwC;AAExC,6DAAqC;AACrC,iEAAyC;AACzC,2DAAwD;AACxD,mDAAqD;AAErD,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,SAAgB,eAAe,CAAC,UAAkB;IAChD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,EAAE;QAC/C,WAAW,EAAE,MAAM;QACnB,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,uBAAQ,CAAC,EAAE;QACrB,mDAAmD;QACnD,sBAAsB,EAAE,IAAI;KAC7B,CAAC,CAAC;IAEH,qEAAqE;IACrE,qBAAW,CAAC,WAAW,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAClD,eAAe,EAAE,CAAC;IAElB,OAAO,IAAA,kCAAkB,EAAC,UAAU,CAAC;SAClC,IAAI,CAAC,GAAG,EAAE;QACT,mBAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,EAAE,eAAe,EAAE;YACtB,qBAAW,CAAC,IAAI,EAAE,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAtBD,0CAsBC","sourcesContent":["import { Platform } from \"react-native\";\n\nimport HMRClient from \"../HMRClient\";\nimport LoadingView from \"../LoadingView\";\nimport { buildUrlForBundle } from \"./buildUrlForBundle\";\nimport { fetchThenEvalAsync } from \"./fetchThenEval\";\n\nlet pendingRequests = 0;\n\n/**\n * Load a bundle for a URL using fetch + eval on native and script tag injection on web.\n *\n * @param bundlePath Given a statement like `import('./Bacon')` `bundlePath` would be `Bacon`.\n */\nexport function loadBundleAsync(bundlePath: string): Promise<void> {\n const requestUrl = buildUrlForBundle(bundlePath, {\n modulesOnly: \"true\",\n runModule: \"false\",\n platform: Platform.OS,\n // The JavaScript loader does not support bytecode.\n runtimeBytecodeVersion: null,\n });\n\n // Send a signal to the `expo` package to show the loading indicator.\n LoadingView.showMessage(\"Downloading...\", \"load\");\n pendingRequests++;\n\n return fetchThenEvalAsync(requestUrl)\n .then(() => {\n HMRClient.registerBundle(requestUrl);\n })\n .finally(() => {\n if (!--pendingRequests) {\n LoadingView.hide();\n }\n });\n}\n"]}