@expofp/loader 1.0.78 → 1.0.91

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 (96) hide show
  1. package/dist/bundle/ImportHttpRuntime.node-B85BNHJG.js +92 -0
  2. package/dist/bundle/ImportHttpRuntime.node-B85BNHJG.js.map +1 -0
  3. package/dist/bundle/bundle.js +236 -768
  4. package/dist/bundle/bundle.js.map +1 -1
  5. package/dist/bundle/fetch-retry.umd-g1itNdNw.js +115 -0
  6. package/dist/bundle/fetch-retry.umd-g1itNdNw.js.map +1 -0
  7. package/dist/esm/ImportHttpRuntime.node.d.ts +28 -0
  8. package/dist/esm/ImportHttpRuntime.node.js +139 -0
  9. package/dist/esm/_OLD_resolveRuntimeUrl.d.ts +1 -0
  10. package/dist/esm/_OLD_resolveRuntimeUrl.js +10 -0
  11. package/dist/esm/fetch.d.ts +1 -0
  12. package/dist/esm/fetch.js +14 -0
  13. package/dist/esm/importHttpRuntime.d.ts +1 -0
  14. package/dist/esm/importHttpRuntime.js +12 -0
  15. package/dist/esm/index.d.ts +10 -7
  16. package/dist/esm/index.js +40 -19
  17. package/dist/esm/resolve.d.ts +10 -44
  18. package/dist/esm/resolve.js +91 -295
  19. package/dist/esm/types.d.ts +11 -26
  20. package/package.json +3 -1
  21. package/dist/bundle/cssTextAssetResolver.offlineFunc-CWvHnYni.js +0 -19
  22. package/dist/bundle/cssTextAssetResolver.offlineFunc-CWvHnYni.js.map +0 -1
  23. package/dist/bundle/downloadOfflineZip-CNz_lUGZ.js +0 -2344
  24. package/dist/bundle/downloadOfflineZip-CNz_lUGZ.js.map +0 -1
  25. package/dist/bundle/legacyDataUrlBaseResolver.offlineFunc-DPaSp_zV.js +0 -87
  26. package/dist/bundle/legacyDataUrlBaseResolver.offlineFunc-DPaSp_zV.js.map +0 -1
  27. package/dist/bundle/makeOffline-Dj-0o5_7.js +0 -76
  28. package/dist/bundle/makeOffline-Dj-0o5_7.js.map +0 -1
  29. package/dist/bundle/makeOfflineBundle-D8tePWGI.js +0 -70
  30. package/dist/bundle/makeOfflineBundle-D8tePWGI.js.map +0 -1
  31. package/dist/bundle/saveOfflineZip.browser-BTQeRUY_.js +0 -7
  32. package/dist/bundle/saveOfflineZip.browser-BTQeRUY_.js.map +0 -1
  33. package/dist/bundle/tools-D0u8lBvQ.js +0 -102
  34. package/dist/bundle/tools-D0u8lBvQ.js.map +0 -1
  35. package/dist/esm/_OLD_fetchWithRetry.d.ts +0 -1
  36. package/dist/esm/_OLD_fetchWithRetry.js +0 -101
  37. package/dist/esm/importJson.d.ts +0 -2
  38. package/dist/esm/importJson.js +0 -57
  39. package/dist/esm/loadScript.d.ts +0 -16
  40. package/dist/esm/loadScript.js +0 -167
  41. package/dist/esm/logger.d.ts +0 -1
  42. package/dist/esm/logger.js +0 -5
  43. package/dist/esm/mutateManifest.d.ts +0 -2
  44. package/dist/esm/mutateManifest.js +0 -10
  45. package/dist/esm/offline/downloadOfflineZip.d.ts +0 -4
  46. package/dist/esm/offline/downloadOfflineZip.js +0 -15
  47. package/dist/esm/offline/generateZip.d.ts +0 -4
  48. package/dist/esm/offline/generateZip.js +0 -41
  49. package/dist/esm/offline/hashString.d.ts +0 -1
  50. package/dist/esm/offline/hashString.js +0 -16
  51. package/dist/esm/offline/index.d.ts +0 -14
  52. package/dist/esm/offline/index.js +0 -41
  53. package/dist/esm/offline/makeOffline.d.ts +0 -2
  54. package/dist/esm/offline/makeOffline.js +0 -144
  55. package/dist/esm/offline/makeOfflineBundle.d.ts +0 -4
  56. package/dist/esm/offline/makeOfflineBundle.js +0 -92
  57. package/dist/esm/offline/saveOfflineZip.browser.d.ts +0 -1
  58. package/dist/esm/offline/saveOfflineZip.browser.js +0 -3
  59. package/dist/esm/offline/saveOfflineZip.d.ts +0 -1
  60. package/dist/esm/offline/saveOfflineZip.js +0 -16
  61. package/dist/esm/offline/slugify.d.ts +0 -1
  62. package/dist/esm/offline/slugify.js +0 -61
  63. package/dist/esm/offline/tools.d.ts +0 -3
  64. package/dist/esm/offline/tools.js +0 -85
  65. package/dist/esm/resolvers/_OLD_expoResolver.d.ts +0 -1
  66. package/dist/esm/resolvers/_OLD_expoResolver.js +0 -49
  67. package/dist/esm/resolvers/assetResolver.d.ts +0 -6
  68. package/dist/esm/resolvers/assetResolver.js +0 -26
  69. package/dist/esm/resolvers/bundleAssetsResolver.d.ts +0 -2
  70. package/dist/esm/resolvers/bundleAssetsResolver.js +0 -20
  71. package/dist/esm/resolvers/cssTextAssetResolver.d.ts +0 -8
  72. package/dist/esm/resolvers/cssTextAssetResolver.js +0 -15
  73. package/dist/esm/resolvers/cssTextAssetResolver.offlineFunc.d.ts +0 -2
  74. package/dist/esm/resolvers/cssTextAssetResolver.offlineFunc.js +0 -22
  75. package/dist/esm/resolvers/expoRuntimeBranchResolver.d.ts +0 -2
  76. package/dist/esm/resolvers/expoRuntimeBranchResolver.js +0 -20
  77. package/dist/esm/resolvers/expoRuntimeGetBranchResolver.d.ts +0 -2
  78. package/dist/esm/resolvers/expoRuntimeGetBranchResolver.js +0 -14
  79. package/dist/esm/resolvers/expoRuntimeResolver.d.ts +0 -2
  80. package/dist/esm/resolvers/expoRuntimeResolver.js +0 -39
  81. package/dist/esm/resolvers/httpResolver.d.ts +0 -5
  82. package/dist/esm/resolvers/httpResolver.js +0 -14
  83. package/dist/esm/resolvers/index.d.ts +0 -2
  84. package/dist/esm/resolvers/index.js +0 -22
  85. package/dist/esm/resolvers/legacyAssetUrlsResolver.d.ts +0 -9
  86. package/dist/esm/resolvers/legacyAssetUrlsResolver.js +0 -116
  87. package/dist/esm/resolvers/legacyDataResolver.d.ts +0 -8
  88. package/dist/esm/resolvers/legacyDataResolver.js +0 -20
  89. package/dist/esm/resolvers/legacyDataUrlBaseResolver.d.ts +0 -8
  90. package/dist/esm/resolvers/legacyDataUrlBaseResolver.js +0 -15
  91. package/dist/esm/resolvers/legacyDataUrlBaseResolver.offlineFunc.d.ts +0 -2
  92. package/dist/esm/resolvers/legacyDataUrlBaseResolver.offlineFunc.js +0 -129
  93. package/dist/esm/returnCachedRef.d.ts +0 -1
  94. package/dist/esm/returnCachedRef.js +0 -12
  95. package/dist/esm/shared.d.ts +0 -8
  96. package/dist/esm/shared.js +0 -273
@@ -0,0 +1,92 @@
1
+ import { d as D } from "./bundle.js";
2
+ import I from "node:crypto";
3
+ import g from "node:fs/promises";
4
+ import L from "node:os";
5
+ import o from "node:path";
6
+ import S from "node:url";
7
+ const l = D("efp:loader:nodeImportHttpRuntime"), y = /* @__PURE__ */ new Map();
8
+ function k(t) {
9
+ return I.createHash("sha256").update(t).digest("hex");
10
+ }
11
+ function T(t) {
12
+ const e = new URL(t), n = e.pathname, r = n.lastIndexOf("/");
13
+ return e.pathname = r >= 0 ? n.slice(0, r + 1) : "/", e.search = "", e.hash = "", e;
14
+ }
15
+ function H(t) {
16
+ if (!t || t.startsWith("/") || t.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(t)) return !1;
17
+ const e = o.posix.normalize(t.replace(/\\/g, "/"));
18
+ return !(e.startsWith("..") || e.includes("/../"));
19
+ }
20
+ async function U(t) {
21
+ await g.mkdir(t, { recursive: !0 });
22
+ }
23
+ async function j(t) {
24
+ try {
25
+ return await g.stat(t), !0;
26
+ } catch {
27
+ return !1;
28
+ }
29
+ }
30
+ async function N(t, e) {
31
+ const n = await t(e);
32
+ if (!n.ok) throw new Error(`Failed to fetch JSON ${e}: ${n.status} ${n.statusText}`);
33
+ return await n.json();
34
+ }
35
+ async function W(t, e, n) {
36
+ const r = await t(e);
37
+ if (!r.ok) throw new Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`);
38
+ const i = await r.arrayBuffer();
39
+ await U(o.dirname(n)), await g.writeFile(n, Buffer.from(i));
40
+ }
41
+ function v(t) {
42
+ return t.files.map((e) => e.file);
43
+ }
44
+ async function C(t, e, n) {
45
+ const r = t.slice(), i = Array.from({ length: Math.max(1, e) }, async () => {
46
+ for (; r.length; ) {
47
+ const s = r.shift();
48
+ await n(s);
49
+ }
50
+ });
51
+ await Promise.all(i);
52
+ }
53
+ async function q(t, e = {}) {
54
+ const {
55
+ cacheRootDir: n = o.join(L.tmpdir(), "efp-loader"),
56
+ concurrency: r = 8,
57
+ forceRedownload: i = !1,
58
+ fetchImpl: s = globalThis.fetch
59
+ } = e;
60
+ if (l("Cache root dir: '%s'", n), typeof s != "function")
61
+ throw new Error("No fetch() available. Use Node 18+ or pass fetchImpl (e.g. undici fetch).");
62
+ const u = T(t), c = u.toString();
63
+ if (!i && y.has(c))
64
+ return y.get(c);
65
+ const x = (async () => {
66
+ const F = k(c).slice(0, 16), f = o.join(n, F);
67
+ await U(f);
68
+ const h = new URL("bundle.json", u).toString();
69
+ l("Fetching bundle.json:", h);
70
+ const $ = await N(s, h), m = v($), w = o.posix.basename(new URL(t).pathname);
71
+ m.includes(w) || m.unshift(w);
72
+ const d = m.map((a) => a.replace(/\\/g, "/")).filter((a) => H(a));
73
+ if (d.length === 0)
74
+ throw new Error(`bundle.json from ${h} produced 0 safe files to download`);
75
+ l("Downloading files:", d.length, "->", f), await C(d, r, async (a) => {
76
+ const b = o.join(f, a.split("/").join(o.sep));
77
+ if (!i && await j(b)) return;
78
+ const E = new URL(a, u).toString();
79
+ await W(s, E, b);
80
+ });
81
+ const p = o.join(f, w.split("/").join(o.sep));
82
+ if (!await j(p))
83
+ throw new Error(`Entry file missing after download: ${p} (from ${t})`);
84
+ const R = S.pathToFileURL(p).toString();
85
+ return l("Importing local runtime entry:", R), await import(R);
86
+ })();
87
+ return y.set(c, x), x;
88
+ }
89
+ export {
90
+ q as nodeImportHttpRuntime
91
+ };
92
+ //# sourceMappingURL=ImportHttpRuntime.node-B85BNHJG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImportHttpRuntime.node-B85BNHJG.js","sources":["../../src/ImportHttpRuntime.node.ts"],"sourcesContent":["import debug from 'debug';\nimport crypto from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport url from 'node:url';\n\nconst log = debug('efp:loader:nodeImportHttpRuntime');\n\ntype BundleJson = { files: { file: string }[] };\n\nexport type ImportHttpRuntimeOptions = {\n /**\n * Where to store downloaded runtime bundles.\n * Default: <os.tmpdir()>/efp-loader\n */\n cacheRootDir?: string;\n\n /**\n * Max parallel downloads.\n * Default: 8\n */\n concurrency?: number;\n\n /**\n * If true, will re-download files even if already present.\n * Default: false\n */\n forceRedownload?: boolean;\n\n /**\n * Pass a custom fetch (useful for tests / node < 18).\n * Default: global fetch\n */\n fetchImpl?: typeof fetch;\n};\n\nconst runtimeDirCache = new Map<string, Promise<any>>();\n\nfunction sha256Hex(input: string) {\n return crypto.createHash('sha256').update(input).digest('hex');\n}\n\nfunction toRuntimeDirUrl(runtime: string): URL {\n const u = new URL(runtime);\n // Ensure we treat runtime as a file URL and strip the last segment\n const pathname = u.pathname;\n const idx = pathname.lastIndexOf('/');\n u.pathname = idx >= 0 ? pathname.slice(0, idx + 1) : '/';\n // Keep search/fragment off for directory identity\n u.search = '';\n u.hash = '';\n return u;\n}\n\nfunction isSafeRelative(p: string) {\n // Reject absolute paths, Windows drive paths, and parent traversal.\n if (!p || p.startsWith('/') || p.startsWith('\\\\')) return false;\n if (/^[a-zA-Z]:[\\\\/]/.test(p)) return false;\n const norm = path.posix.normalize(p.replace(/\\\\/g, '/'));\n if (norm.startsWith('..') || norm.includes('/../')) return false;\n return true;\n}\n\nasync function ensureDir(dir: string) {\n await fs.mkdir(dir, { recursive: true });\n}\n\nasync function fileExists(fp: string) {\n try {\n await fs.stat(fp);\n return true;\n } catch {\n return false;\n }\n}\n\nasync function fetchJson(fetchImpl: typeof fetch, url: string): Promise<any> {\n const res = await fetchImpl(url);\n if (!res.ok) throw new Error(`Failed to fetch JSON ${url}: ${res.status} ${res.statusText}`);\n return await res.json();\n}\n\nasync function fetchToFile(fetchImpl: typeof fetch, url: string, outPath: string) {\n const res = await fetchImpl(url);\n if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);\n const ab = await res.arrayBuffer();\n await ensureDir(path.dirname(outPath));\n await fs.writeFile(outPath, Buffer.from(ab));\n}\n\nfunction extractFileList(bundle: BundleJson): string[] {\n return bundle.files.map((f) => f.file);\n // if (Array.isArray(bundle)) return bundle.slice();\n // const fromKnown = bundle.files ?? bundle.assets ?? bundle.entries ?? undefined;\n\n // if (Array.isArray(fromKnown)) return fromKnown.slice();\n\n // // As a last resort, look for the first string[] field\n // for (const v of Object.values(bundle)) {\n // if (Array.isArray(v) && v.every((x) => typeof x === 'string')) {\n // return (v as string[]).slice();\n // }\n // }\n // throw new Error(\n // 'bundle.json has no recognizable file list (expected array or {files/assets/entries})'\n // );\n}\n\nasync function runWithConcurrency<T>(\n items: T[],\n concurrency: number,\n worker: (item: T) => Promise<void>\n) {\n const queue = items.slice();\n const workers = Array.from({ length: Math.max(1, concurrency) }, async () => {\n while (queue.length) {\n const item = queue.shift()!;\n await worker(item);\n }\n });\n await Promise.all(workers);\n}\n\n/**\n * Downloads an HTTP runtime bundle (bundle.json + all referenced files)\n * into a stable temp folder hashed by the runtime directory URL,\n * then imports expofp.js locally via file://.\n */\nexport async function nodeImportHttpRuntime<TModule = any>(\n runtime: string,\n opts: ImportHttpRuntimeOptions = {}\n): Promise<TModule> {\n const {\n cacheRootDir = path.join(os.tmpdir(), 'efp-loader'),\n concurrency = 8,\n forceRedownload = false,\n fetchImpl = globalThis.fetch,\n } = opts;\n\n log(\"Cache root dir: '%s'\", cacheRootDir);\n\n if (typeof fetchImpl !== 'function') {\n throw new Error('No fetch() available. Use Node 18+ or pass fetchImpl (e.g. undici fetch).');\n }\n\n const runtimeDir = toRuntimeDirUrl(runtime);\n const runtimeDirKey = runtimeDir.toString();\n\n // One in-flight download/import per runtime dir\n if (!forceRedownload && runtimeDirCache.has(runtimeDirKey)) {\n return runtimeDirCache.get(runtimeDirKey)! as Promise<TModule>;\n }\n\n const task = (async () => {\n const hash = sha256Hex(runtimeDirKey).slice(0, 16);\n const localRoot = path.join(cacheRootDir, hash);\n\n await ensureDir(localRoot);\n\n const bundleUrl = new URL('bundle.json', runtimeDir).toString();\n log('Fetching bundle.json:', bundleUrl);\n\n const bundle = (await fetchJson(fetchImpl, bundleUrl)) as BundleJson;\n const files = extractFileList(bundle);\n\n // Always include the entry file (from runtime) even if bundle.json forgot it\n const entryName = path.posix.basename(new URL(runtime).pathname);\n if (!files.includes(entryName)) files.unshift(entryName);\n\n // Sanitize + normalize\n const safeFiles = files.map((f) => f.replace(/\\\\/g, '/')).filter((f) => isSafeRelative(f));\n\n if (safeFiles.length === 0) {\n throw new Error(`bundle.json from ${bundleUrl} produced 0 safe files to download`);\n }\n\n log('Downloading files:', safeFiles.length, '->', localRoot);\n\n await runWithConcurrency(safeFiles, concurrency, async (rel) => {\n const outPath = path.join(localRoot, rel.split('/').join(path.sep));\n\n if (!forceRedownload && (await fileExists(outPath))) return;\n\n const fileUrl = new URL(rel, runtimeDir).toString();\n await fetchToFile(fetchImpl, fileUrl, outPath);\n });\n\n const localEntryPath = path.join(localRoot, entryName.split('/').join(path.sep));\n if (!(await fileExists(localEntryPath))) {\n throw new Error(`Entry file missing after download: ${localEntryPath} (from ${runtime})`);\n }\n\n const entryFileUrl = url.pathToFileURL(localEntryPath).toString();\n log('Importing local runtime entry:', entryFileUrl);\n\n // @ts-ignore - dynamic import URL string is fine in Node\n const mod = (await import(entryFileUrl)) as TModule;\n return mod;\n })();\n\n runtimeDirCache.set(runtimeDirKey, task);\n return task;\n}\n"],"names":["log","debug","runtimeDirCache","sha256Hex","input","crypto","toRuntimeDirUrl","runtime","u","pathname","idx","isSafeRelative","p","norm","path","ensureDir","dir","fs","fileExists","fp","fetchJson","fetchImpl","url","res","fetchToFile","outPath","ab","extractFileList","bundle","f","runWithConcurrency","items","concurrency","worker","queue","workers","item","nodeImportHttpRuntime","opts","cacheRootDir","os","forceRedownload","runtimeDir","runtimeDirKey","task","hash","localRoot","bundleUrl","files","entryName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