vxrn 2.0.0-beta.99.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/dist/backgroundComputation.mjs +145 -0
  2. package/dist/backgroundComputation.mjs.map +1 -0
  3. package/dist/backgroundComputation.native.js +163 -0
  4. package/dist/backgroundComputation.native.js.map +1 -0
  5. package/dist/backgroundComputationNative.mjs +16 -0
  6. package/dist/backgroundComputationNative.mjs.map +1 -0
  7. package/dist/backgroundComputationNative.native.js +18 -0
  8. package/dist/backgroundComputationNative.native.js.map +1 -0
  9. package/dist/config/getBaseViteConfigOnly.mjs +6 -10
  10. package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
  11. package/dist/config/getBaseViteConfigOnly.native.js +6 -10
  12. package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
  13. package/dist/config/getOptimizeDeps.mjs +2 -1
  14. package/dist/config/getOptimizeDeps.mjs.map +1 -1
  15. package/dist/config/getOptimizeDeps.native.js +2 -1
  16. package/dist/config/getOptimizeDeps.native.js.map +1 -1
  17. package/dist/config/getViteServerConfig.mjs +13 -0
  18. package/dist/config/getViteServerConfig.mjs.map +1 -1
  19. package/dist/config/getViteServerConfig.native.js +15 -1
  20. package/dist/config/getViteServerConfig.native.js.map +1 -1
  21. package/dist/constants/defaults.mjs +4 -0
  22. package/dist/constants/defaults.mjs.map +1 -1
  23. package/dist/constants/defaults.native.js +4 -0
  24. package/dist/constants/defaults.native.js.map +1 -1
  25. package/dist/exports/build.native.js +1 -1
  26. package/dist/exports/build.native.js.map +1 -1
  27. package/dist/exports/clean.native.js +1 -1
  28. package/dist/exports/clean.native.js.map +1 -1
  29. package/dist/exports/createServer.native.js +2 -2
  30. package/dist/exports/createServer.native.js.map +1 -1
  31. package/dist/exports/dev.mjs +3 -0
  32. package/dist/exports/dev.mjs.map +1 -1
  33. package/dist/exports/dev.native.js +6 -3
  34. package/dist/exports/dev.native.js.map +1 -1
  35. package/dist/exports/loadEnv.native.js +1 -1
  36. package/dist/exports/loadEnv.native.js.map +1 -1
  37. package/dist/exports/patch.native.js +1 -1
  38. package/dist/exports/patch.native.js.map +1 -1
  39. package/dist/exports/prebuild.mjs +0 -22
  40. package/dist/exports/prebuild.mjs.map +1 -1
  41. package/dist/exports/prebuild.native.js +1 -23
  42. package/dist/exports/prebuild.native.js.map +1 -1
  43. package/dist/exports/prebuildWithoutExpo.mjs +1116 -178
  44. package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
  45. package/dist/exports/prebuildWithoutExpo.native.js +1592 -243
  46. package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
  47. package/dist/exports/runAndroid.native.js +1 -1
  48. package/dist/exports/runAndroid.native.js.map +1 -1
  49. package/dist/exports/runIos.native.js +1 -1
  50. package/dist/exports/runIos.native.js.map +1 -1
  51. package/dist/exports/serve.native.js +1 -1
  52. package/dist/exports/serve.native.js.map +1 -1
  53. package/dist/exports/serveStaticAssets.native.js +1 -1
  54. package/dist/exports/serveStaticAssets.native.js.map +1 -1
  55. package/dist/index.js +4 -1
  56. package/dist/index.mjs +4 -1
  57. package/dist/index.native.js +4 -1
  58. package/dist/native-source-contract.mjs +3 -0
  59. package/dist/native-source-contract.native.js +3 -0
  60. package/dist/patches/builtInDepPatches.mjs +0 -13
  61. package/dist/patches/builtInDepPatches.mjs.map +1 -1
  62. package/dist/patches/builtInDepPatches.native.js +0 -13
  63. package/dist/patches/builtInDepPatches.native.js.map +1 -1
  64. package/dist/plugins/autoDepOptimizePlugin.mjs +3 -2
  65. package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
  66. package/dist/plugins/autoDepOptimizePlugin.native.js +6 -3
  67. package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
  68. package/dist/plugins/backgroundComputationPlugin.mjs +27 -0
  69. package/dist/plugins/backgroundComputationPlugin.mjs.map +1 -0
  70. package/dist/plugins/backgroundComputationPlugin.native.js +32 -0
  71. package/dist/plugins/backgroundComputationPlugin.native.js.map +1 -0
  72. package/dist/plugins/reactNativeCommonJsPlugin.native.js +3 -3
  73. package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
  74. package/dist/plugins/reactNativeDevAssetPlugin.mjs +2 -1
  75. package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
  76. package/dist/plugins/reactNativeDevAssetPlugin.native.js +3 -2
  77. package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
  78. package/dist/plugins/reactNativeDevServer.mjs +87 -24
  79. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  80. package/dist/plugins/reactNativeDevServer.native.js +162 -45
  81. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  82. package/dist/plugins/workletImportsPlugin.mjs +9 -30
  83. package/dist/plugins/workletImportsPlugin.mjs.map +1 -1
  84. package/dist/plugins/workletImportsPlugin.native.js +10 -35
  85. package/dist/plugins/workletImportsPlugin.native.js.map +1 -1
  86. package/dist/rn-commands/bundle/buildBundle.mjs +3 -3
  87. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  88. package/dist/rn-commands/bundle/buildBundle.native.js +3 -3
  89. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  90. package/dist/runtime/hmr-client.native.js +3 -7
  91. package/dist/runtime/hmr-client.native.js.map +1 -1
  92. package/dist/runtime/hmr-runtime.native.js +32 -40
  93. package/dist/runtime/hmr-runtime.native.js.map +1 -1
  94. package/dist/serve/node.native.js +2 -2
  95. package/dist/serve/node.native.js.map +1 -1
  96. package/dist/swift-package-id.mjs +3 -0
  97. package/dist/swift-package-id.native.js +3 -0
  98. package/dist/user-interface/index.native.js +6 -6
  99. package/dist/user-interface/index.native.js.map +1 -1
  100. package/dist/utils/compileNativeDevBytecode.mjs +93 -0
  101. package/dist/utils/compileNativeDevBytecode.mjs.map +1 -0
  102. package/dist/utils/compileNativeDevBytecode.native.js +98 -0
  103. package/dist/utils/compileNativeDevBytecode.native.js.map +1 -0
  104. package/dist/utils/createNativeDevEngine.mjs +227 -20
  105. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  106. package/dist/utils/createNativeDevEngine.native.js +249 -37
  107. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  108. package/dist/utils/execSync.native.js +1 -1
  109. package/dist/utils/execSync.native.js.map +1 -1
  110. package/dist/utils/getServerEntry.native.js +2 -2
  111. package/dist/utils/getServerEntry.native.js.map +1 -1
  112. package/dist/utils/nativeRun.mjs +32 -16
  113. package/dist/utils/nativeRun.mjs.map +1 -1
  114. package/dist/utils/nativeRun.native.js +43 -18
  115. package/dist/utils/nativeRun.native.js.map +1 -1
  116. package/dist/utils/nativeSourceContract.mjs +1823 -0
  117. package/dist/utils/nativeSourceContract.mjs.map +1 -0
  118. package/dist/utils/nativeSourceContract.native.js +2425 -0
  119. package/dist/utils/nativeSourceContract.native.js.map +1 -0
  120. package/dist/utils/patches.native.js +15 -24
  121. package/dist/utils/patches.native.js.map +1 -1
  122. package/dist/utils/printServerUrls.native.js +1 -1
  123. package/dist/utils/printServerUrls.native.js.map +1 -1
  124. package/dist/utils/scanDepsToOptimize.mjs +7 -1
  125. package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
  126. package/dist/utils/scanDepsToOptimize.native.js +27 -2
  127. package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
  128. package/dist/utils/swiftPackageId.mjs +31 -2
  129. package/dist/utils/swiftPackageId.mjs.map +1 -1
  130. package/dist/utils/swiftPackageId.native.js +50 -2
  131. package/dist/utils/swiftPackageId.native.js.map +1 -1
  132. package/dist/vxrn-vite-plugin.native.js +1 -1
  133. package/dist/vxrn-vite-plugin.native.js.map +1 -1
  134. package/expo-plugin.cjs +792 -2
  135. package/native-project-patches.cjs +201 -10
  136. package/package.json +34 -15
  137. package/src/backgroundComputation.ts +220 -0
  138. package/src/backgroundComputationNative.ts +23 -0
  139. package/src/config/getBaseViteConfigOnly.ts +8 -9
  140. package/src/config/getOptimizeDeps.ts +3 -1
  141. package/src/config/getViteServerConfig.ts +16 -0
  142. package/src/config/glbAssets.test.ts +228 -0
  143. package/src/constants/defaults.ts +6 -0
  144. package/src/exports/dev.ts +5 -1
  145. package/src/exports/expoPlugin.test.mjs +337 -15
  146. package/src/exports/prebuild.ts +0 -31
  147. package/src/exports/prebuildWithoutExpo.test.ts +1588 -48
  148. package/src/exports/prebuildWithoutExpo.ts +1573 -213
  149. package/src/index.ts +8 -0
  150. package/src/native-source-contract.ts +16 -0
  151. package/src/patches/builtInDepPatches.ts +0 -21
  152. package/src/plugins/autoDepOptimizePlugin.ts +7 -2
  153. package/src/plugins/backgroundComputationPlugin.test.ts +77 -0
  154. package/src/plugins/backgroundComputationPlugin.ts +29 -0
  155. package/src/plugins/reactNativeDevAssetPlugin.ts +5 -1
  156. package/src/plugins/reactNativeDevServer.test.ts +74 -0
  157. package/src/plugins/reactNativeDevServer.ts +145 -28
  158. package/src/plugins/rnCodegenPlugin.test.ts +30 -0
  159. package/src/plugins/workletImportsPlugin.ts +19 -37
  160. package/src/rn-commands/bundle/buildBundle.ts +5 -3
  161. package/src/swift-package-id.ts +1 -0
  162. package/src/utils/compileNativeDevBytecode.test.ts +168 -0
  163. package/src/utils/compileNativeDevBytecode.ts +117 -0
  164. package/src/utils/createNativeDevEngine.test.ts +643 -18
  165. package/src/utils/createNativeDevEngine.ts +278 -48
  166. package/src/utils/nativeRun.test.ts +125 -23
  167. package/src/utils/nativeRun.ts +51 -23
  168. package/src/utils/nativeSourceArtifacts.test.ts +39 -0
  169. package/src/utils/nativeSourceContract.test.ts +600 -0
  170. package/src/utils/nativeSourceContract.ts +1897 -0
  171. package/src/utils/scanDepsToOptimize.test.ts +80 -0
  172. package/src/utils/scanDepsToOptimize.ts +18 -7
  173. package/src/utils/swiftPackageId.ts +25 -1
  174. package/types/backgroundComputation.d.ts +28 -0
  175. package/types/backgroundComputation.d.ts.map +1 -0
  176. package/types/backgroundComputationNative.d.ts +2 -0
  177. package/types/backgroundComputationNative.d.ts.map +1 -0
  178. package/types/config/getBaseViteConfigOnly.d.ts.map +1 -1
  179. package/types/config/getOptimizeDeps.d.ts.map +1 -1
  180. package/types/config/getViteServerConfig.d.ts.map +1 -1
  181. package/types/constants/defaults.d.ts.map +1 -1
  182. package/types/exports/dev.d.ts.map +1 -1
  183. package/types/exports/prebuild.d.ts.map +1 -1
  184. package/types/exports/prebuildWithoutExpo.d.ts +6 -0
  185. package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
  186. package/types/index.d.ts +2 -0
  187. package/types/index.d.ts.map +1 -1
  188. package/types/native-source-contract.d.ts +2 -0
  189. package/types/native-source-contract.d.ts.map +1 -0
  190. package/types/patches/builtInDepPatches.d.ts.map +1 -1
  191. package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -1
  192. package/types/plugins/backgroundComputationPlugin.d.ts +3 -0
  193. package/types/plugins/backgroundComputationPlugin.d.ts.map +1 -0
  194. package/types/plugins/reactNativeDevAssetPlugin.d.ts.map +1 -1
  195. package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
  196. package/types/plugins/workletImportsPlugin.d.ts.map +1 -1
  197. package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -1
  198. package/types/swift-package-id.d.ts +2 -0
  199. package/types/swift-package-id.d.ts.map +1 -0
  200. package/types/utils/compileNativeDevBytecode.d.ts +3 -0
  201. package/types/utils/compileNativeDevBytecode.d.ts.map +1 -0
  202. package/types/utils/createNativeDevEngine.d.ts +7 -22
  203. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  204. package/types/utils/nativeRun.d.ts.map +1 -1
  205. package/types/utils/nativeSourceContract.d.ts +121 -0
  206. package/types/utils/nativeSourceContract.d.ts.map +1 -0
  207. package/types/utils/scanDepsToOptimize.d.ts +1 -0
  208. package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
  209. package/types/utils/swiftPackageId.d.ts +1 -0
  210. package/types/utils/swiftPackageId.d.ts.map +1 -1
@@ -0,0 +1,145 @@
1
+ import MagicString from "magic-string";
2
+ import { parse } from "sucrase/dist/parser/index.js";
3
+ import { IdentifierRole } from "sucrase/dist/parser/tokenizer/index.js";
4
+ import { TokenType } from "sucrase/dist/parser/tokenizer/types.js";
5
+
6
+ const marker = ".__one_background_worker_";
7
+ const hex = (name) => [...new TextEncoder().encode(name)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
8
+ function loadBackgroundComputationModule(id) {
9
+ const match = id.match(/^(.*?)\.__one_background_worker_([a-f0-9]+)\.js(?:\?.*)?$/);
10
+ if (!match) return;
11
+ const [, calculate, encoded] = match;
12
+ const name = new TextDecoder().decode(Uint8Array.from(encoded.match(/../g), (byte) => Number.parseInt(byte, 16)));
13
+ return {
14
+ id,
15
+ calculate,
16
+ name,
17
+ platform: "web",
18
+ source: `import { ${name} as calculate } from ${JSON.stringify(calculate)};
19
+ self.onmessage = ({ data: { revision, input } }) => {
20
+ try {
21
+ const value = calculate(input);
22
+ if (value instanceof Promise) throw new TypeError('background computations must be synchronous');
23
+ self.postMessage({ ok: true, result: { revision, value } });
24
+ } catch (error) {
25
+ self.postMessage({ ok: false, revision, error: String(error) });
26
+ }
27
+ };`
28
+ };
29
+ }
30
+ function transformBackgroundComputations(source, id, options) {
31
+ if (!source.includes("defineBackgroundComputation") || id.includes(marker)) return;
32
+ const file = parse(source, !/\.[cm]?ts(?:\?|$)/.test(id), /\.[cm]?tsx?(?:\?|$)/.test(id), false);
33
+ const { tokens } = file;
34
+ const text = (index) => tokens[index] ? source.slice(tokens[index].start, tokens[index].end) : "";
35
+ const imports = /* @__PURE__ */ new Map();
36
+ const definitions = /* @__PURE__ */ new Set();
37
+ for (let index = 0; index < tokens.length; index++) {
38
+ if (text(index) !== "import" || tokens[index].isType || text(index + 1) !== "{") continue;
39
+ const start = index + 2;
40
+ let end = start;
41
+ while (end < tokens.length && text(end) !== "}") end++;
42
+ if (text(end + 1) !== "from" || tokens[end + 2]?.type !== TokenType.string) continue;
43
+ const specifier = text(end + 2).slice(1, -1);
44
+ for (let binding = start; binding < end; binding++) {
45
+ if (tokens[binding].isType || tokens[binding].type !== TokenType.name) continue;
46
+ const name = text(binding);
47
+ const local = text(binding + 1) === "as" ? text(binding + 2) : name;
48
+ imports.set(local, {
49
+ source: specifier,
50
+ name
51
+ });
52
+ if (specifier === "one/background" && name === "defineBackgroundComputation") definitions.add(local);
53
+ if (local !== name) binding += 2;
54
+ }
55
+ index = end + 2;
56
+ }
57
+ if (!definitions.size) return;
58
+ const code = new MagicString(source);
59
+ const modules = [];
60
+ for (let index = 0; index < tokens.length; index++) {
61
+ const token = tokens[index];
62
+ if (token.identifierRole !== IdentifierRole.Access || !definitions.has(text(index))) continue;
63
+ let opening = index + 1;
64
+ while (tokens[opening]?.isType) opening++;
65
+ if (text(opening) !== "(") continue;
66
+ let binding = index - 2;
67
+ while (tokens[binding]?.isType) binding--;
68
+ if (token.scopeDepth !== 0 || text(index - 1) !== "=" || tokens[binding]?.identifierRole !== IdentifierRole.TopLevelDeclaration) throw new Error(`[one background] ${id}: definitions must be module-scope variables`);
69
+ const argument = tokens[opening + 1];
70
+ const calculate = argument?.type === TokenType.name ? imports.get(text(opening + 1)) : void 0;
71
+ if (!calculate || !calculate.source.startsWith(".") || text(opening + 2) !== ")") throw new Error(`[one background] ${id}: defineBackgroundComputation requires one named import from a relative pure module at module scope`);
72
+ const resolved = options.resolve(calculate.source, id);
73
+ if (options.platform === "native") {
74
+ const local = `__oneBackgroundCalculate${modules.length}`;
75
+ const module = {
76
+ id: `${resolved}.__one_background_native_${hex(calculate.name)}.js`,
77
+ source: `export { ${calculate.name} } from ${JSON.stringify(resolved)};`,
78
+ calculate: resolved,
79
+ name: calculate.name,
80
+ platform: "native"
81
+ };
82
+ const selected = options.nativeModule ? options.nativeModule(module) : `${calculate.source}?one-background=${encodeURIComponent(calculate.name)}`;
83
+ code.prepend(`import { ${calculate.name} as ${local} } from ${JSON.stringify(selected)};
84
+ `);
85
+ code.overwrite(argument.start, argument.end, local);
86
+ modules.push(module);
87
+ } else {
88
+ const module = loadBackgroundComputationModule(`${resolved}${marker}${hex(calculate.name)}.js`);
89
+ const factory = options.workerFactory ? options.workerFactory(module) : `() => new Worker(new URL(${JSON.stringify(module.id)}, import.meta.url), { type: 'module' })`;
90
+ code.appendLeft(tokens[opening + 2].start, `, ${factory}`);
91
+ modules.push(module);
92
+ }
93
+ }
94
+ if (!modules.length) return;
95
+ return {
96
+ code: code.toString(),
97
+ map: code.generateMap({ hires: true }),
98
+ modules
99
+ };
100
+ }
101
+ function createBackgroundWorkletModule(bundle, names, key) {
102
+ const loader = `__oneLoadWorkletModule_${key}`;
103
+ return `function ${loader}() {
104
+ 'worklet';
105
+ const cache = globalThis.__oneWorkletImportCache || (globalThis.__oneWorkletImportCache = new WeakMap());
106
+ let namespace = cache.get(${loader});
107
+ if (namespace === undefined) {
108
+ ${bundle}
109
+ namespace = __oneWorkletBundle;
110
+ cache.set(${loader}, namespace);
111
+ }
112
+ return namespace;
113
+ }
114
+ ${names.map((name, index) => `function __oneExport${index}(...args) {
115
+ 'worklet';
116
+ return (0, ${loader}().__export${index})(...args);
117
+ }
118
+ export { __oneExport${index} as ${name} };`).join("\n")}`;
119
+ }
120
+ function assertBackgroundDependency(source) {
121
+ const name = source.replaceAll("\\", "/");
122
+ if (name.startsWith("node:") || /(?:^|\/node_modules\/)(?:react|react-native|react-native-worklets|react-native-reanimated|@react-native)(?:\/|$)/.test(name)) throw new Error(`[one background] runtime dependency ${source} is not pure JavaScript`);
123
+ }
124
+ function bundleBackgroundGraph(modules, entry, names) {
125
+ return `var __oneWorkletBundle = (function () {
126
+ const factories = { ${modules.map((module) => `${module.id}: function(global, _require, _importDefault, _importAll, module, exports, _dependencyMap) {
127
+ ${module.code}
128
+ }`).join(",\n")} };
129
+ const dependencies = ${JSON.stringify(Object.fromEntries(modules.map((module) => [module.id, module.dependencies])))};
130
+ const cache = Object.create(null);
131
+ function require(id) {
132
+ if (cache[id]) return cache[id].exports;
133
+ const module = cache[id] = { exports: {} };
134
+ factories[id](globalThis, require, importDefault, importAll, module, module.exports, dependencies[id]);
135
+ return module.exports;
136
+ }
137
+ function importDefault(id) { const value = require(id); return value && value.__esModule ? value.default : value; }
138
+ function importAll(id) { const value = require(id); return value && value.__esModule ? value : Object.assign({ default: value }, value); }
139
+ const namespace = require(${entry});
140
+ return { ${names.map((name, index) => `__export${index}: namespace[${JSON.stringify(name)}]`).join(", ")} };
141
+ })();`;
142
+ }
143
+
144
+ export { assertBackgroundDependency, bundleBackgroundGraph, createBackgroundWorkletModule, loadBackgroundComputationModule, transformBackgroundComputations };
145
+ //# sourceMappingURL=backgroundComputation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backgroundComputation.js","names":[],"sources":["backgroundComputation.js"],"sourcesContent":["import MagicString from \"magic-string\";\nimport { parse } from \"sucrase/dist/parser/index.js\";\nimport { IdentifierRole } from \"sucrase/dist/parser/tokenizer/index.js\";\nimport { TokenType } from \"sucrase/dist/parser/tokenizer/types.js\";\nconst marker = \".__one_background_worker_\";\nconst hex = (name) => [...new TextEncoder().encode(name)].map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\nfunction loadBackgroundComputationModule(id) {\n const match = id.match(/^(.*?)\\.__one_background_worker_([a-f0-9]+)\\.js(?:\\?.*)?$/);\n if (!match) return;\n const [, calculate, encoded] = match;\n const name = new TextDecoder().decode(\n Uint8Array.from(encoded.match(/../g), (byte) => Number.parseInt(byte, 16))\n );\n return {\n id,\n calculate,\n name,\n platform: \"web\",\n source: `import { ${name} as calculate } from ${JSON.stringify(calculate)};\nself.onmessage = ({ data: { revision, input } }) => {\n try {\n const value = calculate(input);\n if (value instanceof Promise) throw new TypeError('background computations must be synchronous');\n self.postMessage({ ok: true, result: { revision, value } });\n } catch (error) {\n self.postMessage({ ok: false, revision, error: String(error) });\n }\n};`\n };\n}\nfunction transformBackgroundComputations(source, id, options) {\n if (!source.includes(\"defineBackgroundComputation\") || id.includes(marker)) return;\n const file = parse(\n source,\n !/\\.[cm]?ts(?:\\?|$)/.test(id),\n /\\.[cm]?tsx?(?:\\?|$)/.test(id),\n false\n );\n const { tokens } = file;\n const text = (index) => tokens[index] ? source.slice(tokens[index].start, tokens[index].end) : \"\";\n const imports = /* @__PURE__ */ new Map();\n const definitions = /* @__PURE__ */ new Set();\n for (let index = 0; index < tokens.length; index++) {\n if (text(index) !== \"import\" || tokens[index].isType || text(index + 1) !== \"{\")\n continue;\n const start = index + 2;\n let end = start;\n while (end < tokens.length && text(end) !== \"}\") end++;\n if (text(end + 1) !== \"from\" || tokens[end + 2]?.type !== TokenType.string) continue;\n const specifier = text(end + 2).slice(1, -1);\n for (let binding = start; binding < end; binding++) {\n if (tokens[binding].isType || tokens[binding].type !== TokenType.name) continue;\n const name = text(binding);\n const local = text(binding + 1) === \"as\" ? text(binding + 2) : name;\n imports.set(local, { source: specifier, name });\n if (specifier === \"one/background\" && name === \"defineBackgroundComputation\")\n definitions.add(local);\n if (local !== name) binding += 2;\n }\n index = end + 2;\n }\n if (!definitions.size) return;\n const code = new MagicString(source);\n const modules = [];\n for (let index = 0; index < tokens.length; index++) {\n const token = tokens[index];\n if (token.identifierRole !== IdentifierRole.Access || !definitions.has(text(index)))\n continue;\n let opening = index + 1;\n while (tokens[opening]?.isType) opening++;\n if (text(opening) !== \"(\") continue;\n let binding = index - 2;\n while (tokens[binding]?.isType) binding--;\n if (token.scopeDepth !== 0 || text(index - 1) !== \"=\" || tokens[binding]?.identifierRole !== IdentifierRole.TopLevelDeclaration)\n throw new Error(\n `[one background] ${id}: definitions must be module-scope variables`\n );\n const argument = tokens[opening + 1];\n const calculate = argument?.type === TokenType.name ? imports.get(text(opening + 1)) : void 0;\n if (!calculate || !calculate.source.startsWith(\".\") || text(opening + 2) !== \")\")\n throw new Error(\n `[one background] ${id}: defineBackgroundComputation requires one named import from a relative pure module at module scope`\n );\n const resolved = options.resolve(calculate.source, id);\n if (options.platform === \"native\") {\n const local = `__oneBackgroundCalculate${modules.length}`;\n const module = {\n id: `${resolved}.__one_background_native_${hex(calculate.name)}.js`,\n source: `export { ${calculate.name} } from ${JSON.stringify(resolved)};`,\n calculate: resolved,\n name: calculate.name,\n platform: \"native\"\n };\n const selected = options.nativeModule ? options.nativeModule(module) : `${calculate.source}?one-background=${encodeURIComponent(calculate.name)}`;\n code.prepend(\n `import { ${calculate.name} as ${local} } from ${JSON.stringify(selected)};\n`\n );\n code.overwrite(argument.start, argument.end, local);\n modules.push(module);\n } else {\n const module = loadBackgroundComputationModule(\n `${resolved}${marker}${hex(calculate.name)}.js`\n );\n const factory = options.workerFactory ? options.workerFactory(module) : `() => new Worker(new URL(${JSON.stringify(module.id)}, import.meta.url), { type: 'module' })`;\n code.appendLeft(tokens[opening + 2].start, `, ${factory}`);\n modules.push(module);\n }\n }\n if (!modules.length) return;\n return { code: code.toString(), map: code.generateMap({ hires: true }), modules };\n}\nfunction createBackgroundWorkletModule(bundle, names, key) {\n const loader = `__oneLoadWorkletModule_${key}`;\n return `function ${loader}() {\n 'worklet';\n const cache = globalThis.__oneWorkletImportCache || (globalThis.__oneWorkletImportCache = new WeakMap());\n let namespace = cache.get(${loader});\n if (namespace === undefined) {\n ${bundle}\n namespace = __oneWorkletBundle;\n cache.set(${loader}, namespace);\n }\n return namespace;\n}\n${names.map(\n (name, index) => `function __oneExport${index}(...args) {\n 'worklet';\n return (0, ${loader}().__export${index})(...args);\n}\nexport { __oneExport${index} as ${name} };`\n ).join(\"\\n\")}`;\n}\nfunction assertBackgroundDependency(source) {\n const name = source.replaceAll(\"\\\\\", \"/\");\n if (name.startsWith(\"node:\") || /(?:^|\\/node_modules\\/)(?:react|react-native|react-native-worklets|react-native-reanimated|@react-native)(?:\\/|$)/.test(\n name\n ))\n throw new Error(\n `[one background] runtime dependency ${source} is not pure JavaScript`\n );\n}\nfunction bundleBackgroundGraph(modules, entry, names) {\n return `var __oneWorkletBundle = (function () {\n const factories = { ${modules.map((module) => `${module.id}: function(global, _require, _importDefault, _importAll, module, exports, _dependencyMap) {\n${module.code}\n}`).join(\",\\n\")} };\n const dependencies = ${JSON.stringify(Object.fromEntries(modules.map((module) => [module.id, module.dependencies])))};\n const cache = Object.create(null);\n function require(id) {\n if (cache[id]) return cache[id].exports;\n const module = cache[id] = { exports: {} };\n factories[id](globalThis, require, importDefault, importAll, module, module.exports, dependencies[id]);\n return module.exports;\n }\n function importDefault(id) { const value = require(id); return value && value.__esModule ? value.default : value; }\n function importAll(id) { const value = require(id); return value && value.__esModule ? value : Object.assign({ default: value }, value); }\n const namespace = require(${entry});\n return { ${names.map((name, index) => `__export${index}: namespace[${JSON.stringify(name)}]`).join(\", \")} };\n})();`;\n}\nexport {\n assertBackgroundDependency,\n bundleBackgroundGraph,\n createBackgroundWorkletModule,\n loadBackgroundComputationModule,\n transformBackgroundComputations\n};\n//# sourceMappingURL=backgroundComputation.js.map\n"],"mappings":";;;;;;AAIA,MAAM,SAAS;AACf,MAAM,OAAO,SAAS,CAAC,GAAG,IAAI,YAAY,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AACnH,SAAS,gCAAgC,IAAI;CAC3C,MAAM,QAAQ,GAAG,MAAM,2DAA2D;CAClF,IAAI,CAAC,OAAO;CACZ,MAAM,GAAG,WAAW,WAAW;CAC/B,MAAM,OAAO,IAAI,YAAY,CAAC,CAAC,OAC7B,WAAW,KAAK,QAAQ,MAAM,KAAK,IAAI,SAAS,OAAO,SAAS,MAAM,EAAE,CAAC,CAC3E;CACA,OAAO;EACL;EACA;EACA;EACA,UAAU;EACV,QAAQ,YAAY,KAAK,uBAAuB,KAAK,UAAU,SAAS,EAAE;;;;;;;;;;CAU5E;AACF;AACA,SAAS,gCAAgC,QAAQ,IAAI,SAAS;CAC5D,IAAI,CAAC,OAAO,SAAS,6BAA6B,KAAK,GAAG,SAAS,MAAM,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,CAAC,KAAK,IAAI,EAAE;;AAE3G"}
@@ -0,0 +1,163 @@
1
+ import MagicString from "magic-string";
2
+ import { parse } from "sucrase/dist/parser/index.js";
3
+ import { IdentifierRole } from "sucrase/dist/parser/tokenizer/index.js";
4
+ import { TokenType } from "sucrase/dist/parser/tokenizer/types.js";
5
+
6
+ var marker = ".__one_background_worker_";
7
+ var hex = function hex2(name) {
8
+ return [...new TextEncoder().encode(name)].map(function(byte) {
9
+ return byte.toString(16).padStart(2, "0");
10
+ }).join("");
11
+ };
12
+ function loadBackgroundComputationModule(id) {
13
+ var match = id.match(/^(.*?)\.__one_background_worker_([a-f0-9]+)\.js(?:\?.*)?$/);
14
+ if (!match) return;
15
+ var [, calculate, encoded] = match;
16
+ var name = new TextDecoder().decode(Uint8Array.from(encoded.match(/../g), function(byte) {
17
+ return Number.parseInt(byte, 16);
18
+ }));
19
+ return {
20
+ id,
21
+ calculate,
22
+ name,
23
+ platform: "web",
24
+ source: `import { ${name} as calculate } from ${JSON.stringify(calculate)};
25
+ self.onmessage = ({ data: { revision, input } }) => {
26
+ try {
27
+ const value = calculate(input);
28
+ if (value instanceof Promise) throw new TypeError('background computations must be synchronous');
29
+ self.postMessage({ ok: true, result: { revision, value } });
30
+ } catch (error) {
31
+ self.postMessage({ ok: false, revision, error: String(error) });
32
+ }
33
+ };`
34
+ };
35
+ }
36
+ function transformBackgroundComputations(source, id, options) {
37
+ if (!source.includes("defineBackgroundComputation") || id.includes(marker)) return;
38
+ var file = parse(source, !/\.[cm]?ts(?:\?|$)/.test(id), /\.[cm]?tsx?(?:\?|$)/.test(id), false);
39
+ var { tokens } = file;
40
+ var text = function text2(index2) {
41
+ return tokens[index2] ? source.slice(tokens[index2].start, tokens[index2].end) : "";
42
+ };
43
+ var imports = /* @__PURE__ */ new Map();
44
+ var definitions = /* @__PURE__ */ new Set();
45
+ for (var index = 0; index < tokens.length; index++) {
46
+ var _tokens_;
47
+ if (text(index) !== "import" || tokens[index].isType || text(index + 1) !== "{") continue;
48
+ var start = index + 2;
49
+ var end = start;
50
+ while (end < tokens.length && text(end) !== "}") end++;
51
+ if (text(end + 1) !== "from" || ((_tokens_ = tokens[end + 2]) === null || _tokens_ === void 0 ? void 0 : _tokens_.type) !== TokenType.string) continue;
52
+ var specifier = text(end + 2).slice(1, -1);
53
+ for (var binding = start; binding < end; binding++) {
54
+ if (tokens[binding].isType || tokens[binding].type !== TokenType.name) continue;
55
+ var name = text(binding);
56
+ var local = text(binding + 1) === "as" ? text(binding + 2) : name;
57
+ imports.set(local, {
58
+ source: specifier,
59
+ name
60
+ });
61
+ if (specifier === "one/background" && name === "defineBackgroundComputation") definitions.add(local);
62
+ if (local !== name) binding += 2;
63
+ }
64
+ index = end + 2;
65
+ }
66
+ if (!definitions.size) return;
67
+ var code = new MagicString(source);
68
+ var modules = [];
69
+ for (var index1 = 0; index1 < tokens.length; index1++) {
70
+ var _tokens_opening, _tokens_binding, _tokens_binding1;
71
+ var token = tokens[index1];
72
+ if (token.identifierRole !== IdentifierRole.Access || !definitions.has(text(index1))) continue;
73
+ var opening = index1 + 1;
74
+ while ((_tokens_opening = tokens[opening]) === null || _tokens_opening === void 0 ? void 0 : _tokens_opening.isType) opening++;
75
+ if (text(opening) !== "(") continue;
76
+ var binding1 = index1 - 2;
77
+ while ((_tokens_binding = tokens[binding1]) === null || _tokens_binding === void 0 ? void 0 : _tokens_binding.isType) binding1--;
78
+ if (token.scopeDepth !== 0 || text(index1 - 1) !== "=" || ((_tokens_binding1 = tokens[binding1]) === null || _tokens_binding1 === void 0 ? void 0 : _tokens_binding1.identifierRole) !== IdentifierRole.TopLevelDeclaration) throw new Error(`[one background] ${id}: definitions must be module-scope variables`);
79
+ var argument = tokens[opening + 1];
80
+ var calculate = (argument === null || argument === void 0 ? void 0 : argument.type) === TokenType.name ? imports.get(text(opening + 1)) : void 0;
81
+ if (!calculate || !calculate.source.startsWith(".") || text(opening + 2) !== ")") throw new Error(`[one background] ${id}: defineBackgroundComputation requires one named import from a relative pure module at module scope`);
82
+ var resolved = options.resolve(calculate.source, id);
83
+ if (options.platform === "native") {
84
+ var local1 = `__oneBackgroundCalculate${modules.length}`;
85
+ var module = {
86
+ id: `${resolved}.__one_background_native_${hex(calculate.name)}.js`,
87
+ source: `export { ${calculate.name} } from ${JSON.stringify(resolved)};`,
88
+ calculate: resolved,
89
+ name: calculate.name,
90
+ platform: "native"
91
+ };
92
+ var selected = options.nativeModule ? options.nativeModule(module) : `${calculate.source}?one-background=${encodeURIComponent(calculate.name)}`;
93
+ code.prepend(`import { ${calculate.name} as ${local1} } from ${JSON.stringify(selected)};
94
+ `);
95
+ code.overwrite(argument.start, argument.end, local1);
96
+ modules.push(module);
97
+ } else {
98
+ var module1 = loadBackgroundComputationModule(`${resolved}${marker}${hex(calculate.name)}.js`);
99
+ var factory = options.workerFactory ? options.workerFactory(module1) : `() => new Worker(new URL(${JSON.stringify(module1.id)}, import.meta.url), { type: 'module' })`;
100
+ code.appendLeft(tokens[opening + 2].start, `, ${factory}`);
101
+ modules.push(module1);
102
+ }
103
+ }
104
+ if (!modules.length) return;
105
+ return {
106
+ code: code.toString(),
107
+ map: code.generateMap({ hires: true }),
108
+ modules
109
+ };
110
+ }
111
+ function createBackgroundWorkletModule(bundle, names, key) {
112
+ var loader = `__oneLoadWorkletModule_${key}`;
113
+ return `function ${loader}() {
114
+ 'worklet';
115
+ const cache = globalThis.__oneWorkletImportCache || (globalThis.__oneWorkletImportCache = new WeakMap());
116
+ let namespace = cache.get(${loader});
117
+ if (namespace === undefined) {
118
+ ${bundle}
119
+ namespace = __oneWorkletBundle;
120
+ cache.set(${loader}, namespace);
121
+ }
122
+ return namespace;
123
+ }
124
+ ${names.map(function(name, index) {
125
+ return `function __oneExport${index}(...args) {
126
+ 'worklet';
127
+ return (0, ${loader}().__export${index})(...args);
128
+ }
129
+ export { __oneExport${index} as ${name} };`;
130
+ }).join("\n")}`;
131
+ }
132
+ function assertBackgroundDependency(source) {
133
+ var name = source.replaceAll("\\", "/");
134
+ if (name.startsWith("node:") || /(?:^|\/node_modules\/)(?:react|react-native|react-native-worklets|react-native-reanimated|@react-native)(?:\/|$)/.test(name)) throw new Error(`[one background] runtime dependency ${source} is not pure JavaScript`);
135
+ }
136
+ function bundleBackgroundGraph(modules, entry, names) {
137
+ return `var __oneWorkletBundle = (function () {
138
+ const factories = { ${modules.map(function(module) {
139
+ return `${module.id}: function(global, _require, _importDefault, _importAll, module, exports, _dependencyMap) {
140
+ ${module.code}
141
+ }`;
142
+ }).join(",\n")} };
143
+ const dependencies = ${JSON.stringify(Object.fromEntries(modules.map(function(module) {
144
+ return [module.id, module.dependencies];
145
+ })))};
146
+ const cache = Object.create(null);
147
+ function require(id) {
148
+ if (cache[id]) return cache[id].exports;
149
+ const module = cache[id] = { exports: {} };
150
+ factories[id](globalThis, require, importDefault, importAll, module, module.exports, dependencies[id]);
151
+ return module.exports;
152
+ }
153
+ function importDefault(id) { const value = require(id); return value && value.__esModule ? value.default : value; }
154
+ function importAll(id) { const value = require(id); return value && value.__esModule ? value : Object.assign({ default: value }, value); }
155
+ const namespace = require(${entry});
156
+ return { ${names.map(function(name, index) {
157
+ return `__export${index}: namespace[${JSON.stringify(name)}]`;
158
+ }).join(", ")} };
159
+ })();`;
160
+ }
161
+
162
+ export { assertBackgroundDependency, bundleBackgroundGraph, createBackgroundWorkletModule, loadBackgroundComputationModule, transformBackgroundComputations };
163
+ //# sourceMappingURL=backgroundComputation.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backgroundComputation.native.js","names":[],"sources":["backgroundComputation.native.js"],"sourcesContent":["import MagicString from \"magic-string\";\nimport { parse } from \"sucrase/dist/parser/index.js\";\nimport { IdentifierRole } from \"sucrase/dist/parser/tokenizer/index.js\";\nimport { TokenType } from \"sucrase/dist/parser/tokenizer/types.js\";\nvar marker = \".__one_background_worker_\";\nvar hex = function hex2(name) {\n return [\n ...new TextEncoder().encode(name)\n ].map(function(byte) {\n return byte.toString(16).padStart(2, \"0\");\n }).join(\"\");\n};\nfunction loadBackgroundComputationModule(id) {\n var match = id.match(/^(.*?)\\.__one_background_worker_([a-f0-9]+)\\.js(?:\\?.*)?$/);\n if (!match) return;\n var [, calculate, encoded] = match;\n var name = new TextDecoder().decode(Uint8Array.from(encoded.match(/../g), function(byte) {\n return Number.parseInt(byte, 16);\n }));\n return {\n id,\n calculate,\n name,\n platform: \"web\",\n source: `import { ${name} as calculate } from ${JSON.stringify(calculate)};\nself.onmessage = ({ data: { revision, input } }) => {\n try {\n const value = calculate(input);\n if (value instanceof Promise) throw new TypeError('background computations must be synchronous');\n self.postMessage({ ok: true, result: { revision, value } });\n } catch (error) {\n self.postMessage({ ok: false, revision, error: String(error) });\n }\n};`\n };\n}\nfunction transformBackgroundComputations(source, id, options) {\n if (!source.includes(\"defineBackgroundComputation\") || id.includes(marker)) return;\n var file = parse(source, !/\\.[cm]?ts(?:\\?|$)/.test(id), /\\.[cm]?tsx?(?:\\?|$)/.test(id), false);\n var { tokens } = file;\n var text = function text2(index2) {\n return tokens[index2] ? source.slice(tokens[index2].start, tokens[index2].end) : \"\";\n };\n var imports = /* @__PURE__ */ new Map();\n var definitions = /* @__PURE__ */ new Set();\n for (var index = 0; index < tokens.length; index++) {\n var _tokens_;\n if (text(index) !== \"import\" || tokens[index].isType || text(index + 1) !== \"{\") continue;\n var start = index + 2;\n var end = start;\n while (end < tokens.length && text(end) !== \"}\") end++;\n if (text(end + 1) !== \"from\" || ((_tokens_ = tokens[end + 2]) === null || _tokens_ === void 0 ? void 0 : _tokens_.type) !== TokenType.string) continue;\n var specifier = text(end + 2).slice(1, -1);\n for (var binding = start; binding < end; binding++) {\n if (tokens[binding].isType || tokens[binding].type !== TokenType.name) continue;\n var name = text(binding);\n var local = text(binding + 1) === \"as\" ? text(binding + 2) : name;\n imports.set(local, {\n source: specifier,\n name\n });\n if (specifier === \"one/background\" && name === \"defineBackgroundComputation\") definitions.add(local);\n if (local !== name) binding += 2;\n }\n index = end + 2;\n }\n if (!definitions.size) return;\n var code = new MagicString(source);\n var modules = [];\n for (var index1 = 0; index1 < tokens.length; index1++) {\n var _tokens_opening, _tokens_binding, _tokens_binding1;\n var token = tokens[index1];\n if (token.identifierRole !== IdentifierRole.Access || !definitions.has(text(index1))) continue;\n var opening = index1 + 1;\n while ((_tokens_opening = tokens[opening]) === null || _tokens_opening === void 0 ? void 0 : _tokens_opening.isType) opening++;\n if (text(opening) !== \"(\") continue;\n var binding1 = index1 - 2;\n while ((_tokens_binding = tokens[binding1]) === null || _tokens_binding === void 0 ? void 0 : _tokens_binding.isType) binding1--;\n if (token.scopeDepth !== 0 || text(index1 - 1) !== \"=\" || ((_tokens_binding1 = tokens[binding1]) === null || _tokens_binding1 === void 0 ? void 0 : _tokens_binding1.identifierRole) !== IdentifierRole.TopLevelDeclaration) throw new Error(`[one background] ${id}: definitions must be module-scope variables`);\n var argument = tokens[opening + 1];\n var calculate = (argument === null || argument === void 0 ? void 0 : argument.type) === TokenType.name ? imports.get(text(opening + 1)) : void 0;\n if (!calculate || !calculate.source.startsWith(\".\") || text(opening + 2) !== \")\") throw new Error(`[one background] ${id}: defineBackgroundComputation requires one named import from a relative pure module at module scope`);\n var resolved = options.resolve(calculate.source, id);\n if (options.platform === \"native\") {\n var local1 = `__oneBackgroundCalculate${modules.length}`;\n var module = {\n id: `${resolved}.__one_background_native_${hex(calculate.name)}.js`,\n source: `export { ${calculate.name} } from ${JSON.stringify(resolved)};`,\n calculate: resolved,\n name: calculate.name,\n platform: \"native\"\n };\n var selected = options.nativeModule ? options.nativeModule(module) : `${calculate.source}?one-background=${encodeURIComponent(calculate.name)}`;\n code.prepend(`import { ${calculate.name} as ${local1} } from ${JSON.stringify(selected)};\n`);\n code.overwrite(argument.start, argument.end, local1);\n modules.push(module);\n } else {\n var module1 = loadBackgroundComputationModule(`${resolved}${marker}${hex(calculate.name)}.js`);\n var factory = options.workerFactory ? options.workerFactory(module1) : `() => new Worker(new URL(${JSON.stringify(module1.id)}, import.meta.url), { type: 'module' })`;\n code.appendLeft(tokens[opening + 2].start, `, ${factory}`);\n modules.push(module1);\n }\n }\n if (!modules.length) return;\n return {\n code: code.toString(),\n map: code.generateMap({\n hires: true\n }),\n modules\n };\n}\nfunction createBackgroundWorkletModule(bundle, names, key) {\n var loader = `__oneLoadWorkletModule_${key}`;\n return `function ${loader}() {\n 'worklet';\n const cache = globalThis.__oneWorkletImportCache || (globalThis.__oneWorkletImportCache = new WeakMap());\n let namespace = cache.get(${loader});\n if (namespace === undefined) {\n ${bundle}\n namespace = __oneWorkletBundle;\n cache.set(${loader}, namespace);\n }\n return namespace;\n}\n${names.map(function(name, index) {\n return `function __oneExport${index}(...args) {\n 'worklet';\n return (0, ${loader}().__export${index})(...args);\n}\nexport { __oneExport${index} as ${name} };`;\n }).join(\"\\n\")}`;\n}\nfunction assertBackgroundDependency(source) {\n var name = source.replaceAll(\"\\\\\", \"/\");\n if (name.startsWith(\"node:\") || /(?:^|\\/node_modules\\/)(?:react|react-native|react-native-worklets|react-native-reanimated|@react-native)(?:\\/|$)/.test(name)) throw new Error(`[one background] runtime dependency ${source} is not pure JavaScript`);\n}\nfunction bundleBackgroundGraph(modules, entry, names) {\n return `var __oneWorkletBundle = (function () {\n const factories = { ${modules.map(function(module) {\n return `${module.id}: function(global, _require, _importDefault, _importAll, module, exports, _dependencyMap) {\n${module.code}\n}`;\n }).join(\",\\n\")} };\n const dependencies = ${JSON.stringify(Object.fromEntries(modules.map(function(module) {\n return [\n module.id,\n module.dependencies\n ];\n })))};\n const cache = Object.create(null);\n function require(id) {\n if (cache[id]) return cache[id].exports;\n const module = cache[id] = { exports: {} };\n factories[id](globalThis, require, importDefault, importAll, module, module.exports, dependencies[id]);\n return module.exports;\n }\n function importDefault(id) { const value = require(id); return value && value.__esModule ? value.default : value; }\n function importAll(id) { const value = require(id); return value && value.__esModule ? value : Object.assign({ default: value }, value); }\n const namespace = require(${entry});\n return { ${names.map(function(name, index) {\n return `__export${index}: namespace[${JSON.stringify(name)}]`;\n }).join(\", \")} };\n})();`;\n}\nexport {\n assertBackgroundDependency,\n bundleBackgroundGraph,\n createBackgroundWorkletModule,\n loadBackgroundComputationModule,\n transformBackgroundComputations\n};\n//# sourceMappingURL=backgroundComputation.js.map\n"],"mappings":";;;;;;AAIA,IAAI,SAAS;AACb,IAAI,MAAM,SAAS,KAAK,MAAM;CAC5B,OAAO,CACL,GAAG,IAAI,YAAY,CAAC,CAAC,OAAO,IAAI,CAClC,CAAC,CAAC,IAAI,SAAS,MAAM;EACnB,OAAO,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;CAC1C,CAAC,CAAC,CAAC,KAAK,EAAE;AACZ;AACA,SAAS,gCAAgC,IAAI;CAC3C,IAAI,QAAQ,GAAG,MAAM,2DAA2D;CAChF,IAAI,CAAC,OAAO;CACZ,IAAI,GAAG,WAAW,WAAW;CAC7B,IAAI,OAAO,IAAI,YAAY,CAAC,CAAC,OAAO,WAAW,KAAK,QAAQ,MAAM,KAAK,GAAG,SAAS,MAAM;EACvF,OAAO,OAAO,SAAS,MAAM,EAAE;CACjC,CAAC,CAAC;CACF,OAAO;EACL;EACA;EACA;EACA,UAAU;EACV,QAAQ,YAAY,KAAK,uBAAuB,KAAK,UAAU,SAAS,EAAE;;;;;;;;;;CAU5E;AACF;AACA,SAAS,gCAAgC,QAAQ,IAAI,SAAS;CAC5D,IAAI,CAAC,OAAO,SAAS,6BAA6B,KAAK,GAAG,SAAS,MAAM,GAAG;CAC5E,IAAI,OAAO,MAAM,QAAQ,CAAC,oBAAoB,KAAK,EAAE,GAAG,sBAAsB,KAAK,EAAE,GAAG,KAAK;CAC7F,IAAI,EAAE,WAAW;CACjB,IAAI,OAAO,SAAS,MAAM,QAAQ;EAChC,OAAO,OAAO,UAAU,OAAO,MAAM,OAAO,OAAO,CAAC,OAAO,OAAO,OAAO,CAAC,GAAG,IAAI;CACnF;CACA,IAAI,0BAA0B,IAAI,IAAI;CACtC,IAAI,8BAA8B,IAAI,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AAS,MAAM,OAAO;EACzC,OAAO,WAAW,MAAM,cAAc,KAAK,UAAU,IAAI,EAAE;CAC7D,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;;AAEhB"}
@@ -0,0 +1,16 @@
1
+ import { JS_GLOBALS, getClosureVariables, transformHermesLoops } from "@vxrn/compiler/worklet-utils";
2
+ import { parseSync } from "oxc-parser";
3
+
4
+ function prepareBackgroundWorkletModule(source, id) {
5
+ const code = transformHermesLoops(source, id)?.code ?? source;
6
+ const parsed = parseSync(id, code, { lang: "js" });
7
+ if (parsed.errors.length) throw new Error(parsed.errors[0].message);
8
+ const captures = getClosureVariables(parsed.program.body[0], /* @__PURE__ */ new Set([...JS_GLOBALS, "arguments"]));
9
+ if (captures.length) {
10
+ throw new Error(`[worklet imports] ${id} requires unsupported runtime globals: ${captures.join(", ")}`);
11
+ }
12
+ return code;
13
+ }
14
+
15
+ export { prepareBackgroundWorkletModule };
16
+ //# sourceMappingURL=backgroundComputationNative.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backgroundComputationNative.js","names":[],"sources":["backgroundComputationNative.js"],"sourcesContent":["import {\n getClosureVariables,\n JS_GLOBALS,\n transformHermesLoops\n} from \"@vxrn/compiler/worklet-utils\";\nimport { parseSync } from \"oxc-parser\";\nfunction prepareBackgroundWorkletModule(source, id) {\n const code = transformHermesLoops(source, id)?.code ?? source;\n const parsed = parseSync(id, code, { lang: \"js\" });\n if (parsed.errors.length) throw new Error(parsed.errors[0].message);\n const captures = getClosureVariables(\n parsed.program.body[0],\n /* @__PURE__ */ new Set([...JS_GLOBALS, \"arguments\"])\n );\n if (captures.length) {\n throw new Error(\n `[worklet imports] ${id} requires unsupported runtime globals: ${captures.join(\", \")}`\n );\n }\n return code;\n}\nexport {\n prepareBackgroundWorkletModule\n};\n//# sourceMappingURL=backgroundComputationNative.js.map\n"],"mappings":";;;;AAMA,SAAS,+BAA+B,QAAQ,IAAI;CAClD,MAAM,OAAO,qBAAqB,QAAQ,EAAE,CAAC,EAAE,QAAQ;CACvD,MAAM,SAAS,UAAU,IAAI,MAAM,EAAE,MAAM,KAAK,CAAC;CACjD,IAAI,OAAO,OAAO,QAAQ,MAAM,IAAI,MAAM,OAAO,OAAO,EAAE,CAAC,OAAO;CAClE,MAAM,WAAW,oBACf,OAAO,QAAQ,KAAK,oBACJ,IAAI,IAAI,CAAC,GAAG,YAAY,WAAW,CAAC,CACtD;CACA,IAAI,SAAS,QAAQ;EACnB,MAAM,IAAI,MACR,qBAAqB,GAAG,yCAAyC,SAAS,KAAK,IAAI,GACrF;CACF;CACA,OAAO;AACT"}
@@ -0,0 +1,18 @@
1
+ import { JS_GLOBALS, getClosureVariables, transformHermesLoops } from "@vxrn/compiler/worklet-utils";
2
+ import { parseSync } from "oxc-parser";
3
+
4
+ function prepareBackgroundWorkletModule(source, id) {
5
+ var _ref;
6
+ var _transformHermesLoops;
7
+ var code = (_ref = (_transformHermesLoops = transformHermesLoops(source, id)) === null || _transformHermesLoops === void 0 ? void 0 : _transformHermesLoops.code) !== null && _ref !== void 0 ? _ref : source;
8
+ var parsed = parseSync(id, code, { lang: "js" });
9
+ if (parsed.errors.length) throw new Error(parsed.errors[0].message);
10
+ var captures = getClosureVariables(parsed.program.body[0], /* @__PURE__ */ new Set([...JS_GLOBALS, "arguments"]));
11
+ if (captures.length) {
12
+ throw new Error(`[worklet imports] ${id} requires unsupported runtime globals: ${captures.join(", ")}`);
13
+ }
14
+ return code;
15
+ }
16
+
17
+ export { prepareBackgroundWorkletModule };
18
+ //# sourceMappingURL=backgroundComputationNative.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backgroundComputationNative.native.js","names":[],"sources":["backgroundComputationNative.native.js"],"sourcesContent":["import { getClosureVariables, JS_GLOBALS, transformHermesLoops } from \"@vxrn/compiler/worklet-utils\";\nimport { parseSync } from \"oxc-parser\";\nfunction prepareBackgroundWorkletModule(source, id) {\n var _ref;\n var _transformHermesLoops;\n var code = (_ref = (_transformHermesLoops = transformHermesLoops(source, id)) === null || _transformHermesLoops === void 0 ? void 0 : _transformHermesLoops.code) !== null && _ref !== void 0 ? _ref : source;\n var parsed = parseSync(id, code, {\n lang: \"js\"\n });\n if (parsed.errors.length) throw new Error(parsed.errors[0].message);\n var captures = getClosureVariables(parsed.program.body[0], /* @__PURE__ */ new Set([\n ...JS_GLOBALS,\n \"arguments\"\n ]));\n if (captures.length) {\n throw new Error(`[worklet imports] ${id} requires unsupported runtime globals: ${captures.join(\", \")}`);\n }\n return code;\n}\nexport {\n prepareBackgroundWorkletModule\n};\n//# sourceMappingURL=backgroundComputationNative.js.map\n"],"mappings":";;;;AAEA,SAAS,+BAA+B,QAAQ,IAAI;CAClD,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ,QAAQ,wBAAwB,qBAAqB,QAAQ,EAAE,OAAO,QAAQ,0BAA0B,KAAK,IAAI,KAAK,IAAI,sBAAsB,UAAU,QAAQ,SAAS,KAAK,IAAI,OAAO;CACvM,IAAI,SAAS,UAAU,IAAI,MAAM,EAC/B,MAAM,KACR,CAAC;CACD,IAAI,OAAO,OAAO,QAAQ,MAAM,IAAI,MAAM,OAAO,OAAO,EAAE,CAAC,OAAO;CAClE,IAAI,WAAW,oBAAoB,OAAO,QAAQ,KAAK,oBAAoB,IAAI,IAAI,CACjF,GAAG,YACH,WACF,CAAC,CAAC;CACF,IAAI,SAAS,QAAQ;EACnB,MAAM,IAAI,MAAM,qBAAqB,GAAG,yCAAyC,SAAS,KAAK,IAAI,GAAG;CACxG;CACA,OAAO;AACT"}
@@ -4,7 +4,6 @@ import { join } from "node:path";
4
4
 
5
5
  const dedupe = [
6
6
  "one",
7
- "@vxrn/safe-area",
8
7
  "react",
9
8
  "react-dom",
10
9
  "react-dom/client",
@@ -17,11 +16,11 @@ const dedupe = [
17
16
  "@react-navigation/bottom-tabs",
18
17
  "@tamagui/core",
19
18
  "@tamagui/web",
19
+ "@tamagui/adapt",
20
20
  "@tamagui/react-native-web",
21
21
  "@tamagui/react-native-web-lite",
22
22
  "tamagui",
23
- "react-native-reanimated",
24
- "escape-string-regexp"
23
+ "react-native-reanimated"
25
24
  ];
26
25
  async function getBaseViteConfig(config) {
27
26
  const { root, mode } = config;
@@ -39,6 +38,7 @@ async function getBaseViteConfig(config) {
39
38
  const { version } = await FSExtra.readJSON(reactNativePackageJsonPath);
40
39
  return {
41
40
  mode,
41
+ assetsInclude: ["**/*.glb"],
42
42
  css: postCSSConfigPath ? { postcss: postCSSConfigPath } : {
43
43
  transformer: "lightningcss",
44
44
  lightningcss: { targets: { safari: 15 << 16 | 2 << 8 } }
@@ -56,19 +56,15 @@ async function getBaseViteConfig(config) {
56
56
  },
57
57
  {
58
58
  find: /^(react-native\/asset-registry|@react-native\/assets-registry\/registry)$/,
59
- replacement: resolvePath("react-native-web/dist/modules/AssetRegistry", root)
59
+ replacement: "react-native-web/dist/modules/AssetRegistry"
60
60
  },
61
61
  {
62
62
  find: "react-native/package.json",
63
- replacement: resolvePath("react-native-web/package.json", root)
63
+ replacement: "react-native-web/package.json"
64
64
  },
65
65
  {
66
66
  find: "react-native",
67
- replacement: resolvePath("react-native-web", root)
68
- },
69
- {
70
- find: "react-native-safe-area-context",
71
- replacement: resolvePath("@vxrn/safe-area", root)
67
+ replacement: "react-native-web"
72
68
  },
73
69
  {
74
70
  find: "query-string",
@@ -1 +1 @@
1
- {"version":3,"file":"getBaseViteConfigOnly.js","names":[],"sources":["config/getBaseViteConfigOnly.js"],"sourcesContent":["import { resolvePath } from \"@vxrn/resolve\";\nimport FSExtra from \"fs-extra\";\nimport { join } from \"node:path\";\nconst dedupe = [\n \"one\",\n \"@vxrn/safe-area\",\n \"react\",\n \"react-dom\",\n \"react-dom/client\",\n \"react-native-web\",\n \"react-native-web-lite\",\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"@react-navigation/elements\",\n \"@react-navigation/native-stack\",\n \"@react-navigation/bottom-tabs\",\n \"@tamagui/core\",\n \"@tamagui/web\",\n \"@tamagui/react-native-web\",\n \"@tamagui/react-native-web-lite\",\n \"tamagui\",\n \"react-native-reanimated\",\n \"escape-string-regexp\"\n];\nasync function getBaseViteConfig(config) {\n const { root, mode } = config;\n const postCSSPaths = [\n join(root, \"postcss.config.js\"),\n join(root, \"postcss.config.ts\"),\n join(root, \"postcss.config.json\")\n ];\n const postCSSConfigPath = (await Promise.all(\n postCSSPaths.map(async (x) => {\n if (await FSExtra.pathExists(x)) {\n return x;\n }\n })\n )).find((x) => typeof x === \"string\");\n const reactNativePackageJsonPath = resolvePath(\"react-native/package.json\", root);\n const { version } = await FSExtra.readJSON(reactNativePackageJsonPath);\n return {\n mode,\n // we load the config ourselves\n // if you disable this is disables auto-reloading config changes\n // configFile: false,\n // TODO make this documented / configurable through the plugins\n css: postCSSConfigPath ? {\n postcss: postCSSConfigPath\n } : {\n transformer: \"lightningcss\",\n lightningcss: {\n targets: {\n safari: 15 << 16 | 2 << 8\n }\n }\n },\n define: {\n __DEV__: `${mode === \"development\"}`,\n \"process.env.NODE_ENV\": `\"${mode}\"`,\n \"process.env.REACT_NATIVE_VERSION\": `\"${version}\"`\n },\n resolve: {\n alias: [\n // deep react-native/Libraries/* paths must be caught BEFORE the general\n // react-native → react-native-web alias, since react-native-web doesn't\n // have these native-only subpaths\n {\n find: /^react-native\\/Libraries\\/.*/,\n replacement: resolvePath(\"@vxrn/vite-plugin-metro/empty\", import.meta.dirname)\n },\n {\n // react native 0.87 removed @react-native/assets-registry, but libraries\n // like react-native-svg still import its registry\n find: /^(react-native\\/asset-registry|@react-native\\/assets-registry\\/registry)$/,\n replacement: resolvePath(\"react-native-web/dist/modules/AssetRegistry\", root)\n },\n {\n find: \"react-native/package.json\",\n replacement: resolvePath(\"react-native-web/package.json\", root)\n },\n {\n find: \"react-native\",\n replacement: resolvePath(\"react-native-web\", root)\n },\n {\n find: \"react-native-safe-area-context\",\n replacement: resolvePath(\"@vxrn/safe-area\", root)\n },\n // bundle size optimizations\n {\n find: \"query-string\",\n replacement: resolvePath(\"@vxrn/query-string\", root)\n },\n {\n find: \"url-parse\",\n replacement: resolvePath(\"@vxrn/url-parse\", root)\n }\n ],\n // TODO auto dedupe all include optimize deps?\n dedupe\n },\n build: {},\n // enable OXC React Refresh so component registration ($RefreshReg$) is\n // injected into TSX/JSX output; the one:react-refresh-web compiler plugin\n // then wraps the output with the runtime preamble and import.meta.hot.accept\n // only enable in dev mode - in production the refresh plugin doesn't run,\n // leaving $RefreshReg$ undefined which crashes client-side JS\n oxc: {\n jsx: {\n refresh: mode === \"development\"\n }\n }\n };\n}\nexport {\n dedupe,\n getBaseViteConfig\n};\n//# sourceMappingURL=getBaseViteConfigOnly.js.map\n"],"mappings":";;;;;AAGA,MAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,eAAe,kBAAkB,QAAQ;CACvC,MAAM,EAAE,MAAM,SAAS;CACvB,MAAM,eAAe;EACnB,KAAK,MAAM,mBAAmB;EAC9B,KAAK,MAAM,mBAAmB;EAC9B,KAAK,MAAM,qBAAqB;CAClC;CACA,MAAM,qBAAqB,MAAM,QAAQ,IACvC,aAAa,IAAI,OAAO,MAAM;EAC5B,IAAI,MAAM,QAAQ,WAAW,CAAC,GAAG;GAC/B,OAAO;EACT;CACF,CAAC,CACH,EAAC,CAAE,MAAM,MAAM,OAAO,MAAM,QAAQ;CACpC,MAAM,6BAA6B,YAAY,6BAA6B,IAAI;CAChF,MAAM,EAAE,YAAY,MAAM,QAAQ,SAAS,0BAA0B;CACrE,OAAO;EACL;EAKA,KAAK,oBAAoB,EACvB,SAAS,kBACX,IAAI;GACF,aAAa;GACb,cAAc,EACZ,SAAS,EACP,QAAQ,MAAM,KAAK,KAAK,EAC1B,EACF;EACF;EACA,QAAQ;GACN,SAAS,GAAG,SAAS;GACrB,wBAAwB,IAAI,KAAK;GACjC,oCAAoC,IAAI,QAAQ;EAClD;EACA,SAAS;GACP,OAAO;IAIL;KACE,MAAM;KACN,aAAa,YAAY,iCAAiC,YAAY,OAAO;IAC/E;IACA;KAGE,MAAM;KACN,aAAa,YAAY,+CAA+C,IAAI;IAC9E;IACA;KACE,MAAM;KACN,aAAa,YAAY,iCAAiC,IAAI;IAChE;IACA;KACE,MAAM;KACN,aAAa,YAAY,oBAAoB,IAAI;IACnD;IACA;KACE,MAAM;KACN,aAAa,YAAY,mBAAmB,IAAI;IAClD;IAEA;KACE,MAAM;KACN,aAAa,YAAY,sBAAsB,IAAI;IACrD;IACA;KACE,MAAM;KACN,aAAa,YAAY,mBAAmB,IAAI;IAClD;GACF;GAEA;EACF;EACA,OAAO,CAAC;EAMR,KAAK,EACH,KAAK,EACH,SAAS,SAAS,cACpB,EACF;CACF;AACF"}
1
+ {"version":3,"file":"getBaseViteConfigOnly.js","names":[],"sources":["config/getBaseViteConfigOnly.js"],"sourcesContent":["import { resolvePath } from \"@vxrn/resolve\";\nimport FSExtra from \"fs-extra\";\nimport { join } from \"node:path\";\nconst dedupe = [\n \"one\",\n \"react\",\n \"react-dom\",\n \"react-dom/client\",\n \"react-native-web\",\n \"react-native-web-lite\",\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"@react-navigation/elements\",\n \"@react-navigation/native-stack\",\n \"@react-navigation/bottom-tabs\",\n \"@tamagui/core\",\n \"@tamagui/web\",\n \"@tamagui/adapt\",\n \"@tamagui/react-native-web\",\n \"@tamagui/react-native-web-lite\",\n \"tamagui\",\n \"react-native-reanimated\"\n];\nasync function getBaseViteConfig(config) {\n const { root, mode } = config;\n const postCSSPaths = [\n join(root, \"postcss.config.js\"),\n join(root, \"postcss.config.ts\"),\n join(root, \"postcss.config.json\")\n ];\n const postCSSConfigPath = (await Promise.all(\n postCSSPaths.map(async (x) => {\n if (await FSExtra.pathExists(x)) {\n return x;\n }\n })\n )).find((x) => typeof x === \"string\");\n const reactNativePackageJsonPath = resolvePath(\"react-native/package.json\", root);\n const { version } = await FSExtra.readJSON(reactNativePackageJsonPath);\n return {\n mode,\n assetsInclude: [\"**/*.glb\"],\n // we load the config ourselves\n // if you disable this is disables auto-reloading config changes\n // configFile: false,\n // TODO make this documented / configurable through the plugins\n css: postCSSConfigPath ? {\n postcss: postCSSConfigPath\n } : {\n transformer: \"lightningcss\",\n lightningcss: {\n targets: {\n safari: 15 << 16 | 2 << 8\n }\n }\n },\n define: {\n __DEV__: `${mode === \"development\"}`,\n \"process.env.NODE_ENV\": `\"${mode}\"`,\n \"process.env.REACT_NATIVE_VERSION\": `\"${version}\"`\n },\n resolve: {\n alias: [\n // deep react-native/Libraries/* paths must be caught BEFORE the general\n // react-native → react-native-web alias, since react-native-web doesn't\n // have these native-only subpaths\n {\n find: /^react-native\\/Libraries\\/.*/,\n replacement: resolvePath(\"@vxrn/vite-plugin-metro/empty\", import.meta.dirname)\n },\n {\n // react native 0.87 removed @react-native/assets-registry, but libraries\n // like react-native-svg still import its registry\n find: /^(react-native\\/asset-registry|@react-native\\/assets-registry\\/registry)$/,\n replacement: \"react-native-web/dist/modules/AssetRegistry\"\n },\n {\n find: \"react-native/package.json\",\n replacement: \"react-native-web/package.json\"\n },\n // named by package so it resolves (from the root, through dedupe) only\n // once something imports react-native: an app with no react-native\n // imports needs no react-native-web.\n {\n find: \"react-native\",\n replacement: \"react-native-web\"\n },\n // bundle size optimizations\n {\n find: \"query-string\",\n replacement: resolvePath(\"@vxrn/query-string\", root)\n },\n {\n find: \"url-parse\",\n replacement: resolvePath(\"@vxrn/url-parse\", root)\n }\n ],\n // TODO auto dedupe all include optimize deps?\n dedupe\n },\n build: {},\n // enable OXC React Refresh so component registration ($RefreshReg$) is\n // injected into TSX/JSX output; the one:react-refresh-web compiler plugin\n // then wraps the output with the runtime preamble and import.meta.hot.accept\n // only enable in dev mode - in production the refresh plugin doesn't run,\n // leaving $RefreshReg$ undefined which crashes client-side JS\n oxc: {\n jsx: {\n refresh: mode === \"development\"\n }\n }\n };\n}\nexport {\n dedupe,\n getBaseViteConfig\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;CACF;AACF"}
@@ -4,7 +4,6 @@ import { join } from "path";
4
4
 
5
5
  var dedupe = [
6
6
  "one",
7
- "@vxrn/safe-area",
8
7
  "react",
9
8
  "react-dom",
10
9
  "react-dom/client",
@@ -17,11 +16,11 @@ var dedupe = [
17
16
  "@react-navigation/bottom-tabs",
18
17
  "@tamagui/core",
19
18
  "@tamagui/web",
19
+ "@tamagui/adapt",
20
20
  "@tamagui/react-native-web",
21
21
  "@tamagui/react-native-web-lite",
22
22
  "tamagui",
23
- "react-native-reanimated",
24
- "escape-string-regexp"
23
+ "react-native-reanimated"
25
24
  ];
26
25
  async function getBaseViteConfig(config) {
27
26
  var { root, mode } = config;
@@ -41,6 +40,7 @@ async function getBaseViteConfig(config) {
41
40
  var { version } = await FSExtra.readJSON(reactNativePackageJsonPath);
42
41
  return {
43
42
  mode,
43
+ assetsInclude: ["**/*.glb"],
44
44
  css: postCSSConfigPath ? { postcss: postCSSConfigPath } : {
45
45
  transformer: "lightningcss",
46
46
  lightningcss: { targets: { safari: 15 << 16 | 2 << 8 } }
@@ -58,19 +58,15 @@ async function getBaseViteConfig(config) {
58
58
  },
59
59
  {
60
60
  find: /^(react-native\/asset-registry|@react-native\/assets-registry\/registry)$/,
61
- replacement: resolvePath("react-native-web/dist/modules/AssetRegistry", root)
61
+ replacement: "react-native-web/dist/modules/AssetRegistry"
62
62
  },
63
63
  {
64
64
  find: "react-native/package.json",
65
- replacement: resolvePath("react-native-web/package.json", root)
65
+ replacement: "react-native-web/package.json"
66
66
  },
67
67
  {
68
68
  find: "react-native",
69
- replacement: resolvePath("react-native-web", root)
70
- },
71
- {
72
- find: "react-native-safe-area-context",
73
- replacement: resolvePath("@vxrn/safe-area", root)
69
+ replacement: "react-native-web"
74
70
  },
75
71
  {
76
72
  find: "query-string",
@@ -1 +1 @@
1
- {"version":3,"file":"getBaseViteConfigOnly.native.js","names":[],"sources":["config/getBaseViteConfigOnly.native.js"],"sourcesContent":["import { resolvePath } from \"@vxrn/resolve\";\nimport FSExtra from \"fs-extra\";\nimport { join } from \"path\";\nvar dedupe = [\n \"one\",\n \"@vxrn/safe-area\",\n \"react\",\n \"react-dom\",\n \"react-dom/client\",\n \"react-native-web\",\n \"react-native-web-lite\",\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"@react-navigation/elements\",\n \"@react-navigation/native-stack\",\n \"@react-navigation/bottom-tabs\",\n \"@tamagui/core\",\n \"@tamagui/web\",\n \"@tamagui/react-native-web\",\n \"@tamagui/react-native-web-lite\",\n \"tamagui\",\n \"react-native-reanimated\",\n \"escape-string-regexp\"\n];\nasync function getBaseViteConfig(config) {\n var { root, mode } = config;\n var postCSSPaths = [\n join(root, \"postcss.config.js\"),\n join(root, \"postcss.config.ts\"),\n join(root, \"postcss.config.json\")\n ];\n var postCSSConfigPath = (await Promise.all(postCSSPaths.map(async function(x) {\n if (await FSExtra.pathExists(x)) {\n return x;\n }\n }))).find(function(x) {\n return typeof x === \"string\";\n });\n var reactNativePackageJsonPath = resolvePath(\"react-native/package.json\", root);\n var { version } = await FSExtra.readJSON(reactNativePackageJsonPath);\n return {\n mode,\n // we load the config ourselves\n // if you disable this is disables auto-reloading config changes\n // configFile: false,\n // TODO make this documented / configurable through the plugins\n css: postCSSConfigPath ? {\n postcss: postCSSConfigPath\n } : {\n transformer: \"lightningcss\",\n lightningcss: {\n targets: {\n safari: 15 << 16 | 2 << 8\n }\n }\n },\n define: {\n __DEV__: `${mode === \"development\"}`,\n \"process.env.NODE_ENV\": `\"${mode}\"`,\n \"process.env.REACT_NATIVE_VERSION\": `\"${version}\"`\n },\n resolve: {\n alias: [\n // deep react-native/Libraries/* paths must be caught BEFORE the general\n // react-native → react-native-web alias, since react-native-web doesn't\n // have these native-only subpaths\n {\n find: /^react-native\\/Libraries\\/.*/,\n replacement: resolvePath(\"@vxrn/vite-plugin-metro/empty\", import.meta.dirname)\n },\n {\n // react native 0.87 removed @react-native/assets-registry, but libraries\n // like react-native-svg still import its registry\n find: /^(react-native\\/asset-registry|@react-native\\/assets-registry\\/registry)$/,\n replacement: resolvePath(\"react-native-web/dist/modules/AssetRegistry\", root)\n },\n {\n find: \"react-native/package.json\",\n replacement: resolvePath(\"react-native-web/package.json\", root)\n },\n {\n find: \"react-native\",\n replacement: resolvePath(\"react-native-web\", root)\n },\n {\n find: \"react-native-safe-area-context\",\n replacement: resolvePath(\"@vxrn/safe-area\", root)\n },\n // bundle size optimizations\n {\n find: \"query-string\",\n replacement: resolvePath(\"@vxrn/query-string\", root)\n },\n {\n find: \"url-parse\",\n replacement: resolvePath(\"@vxrn/url-parse\", root)\n }\n ],\n // TODO auto dedupe all include optimize deps?\n dedupe\n },\n build: {},\n // enable OXC React Refresh so component registration ($RefreshReg$) is\n // injected into TSX/JSX output; the one:react-refresh-web compiler plugin\n // then wraps the output with the runtime preamble and import.meta.hot.accept\n // only enable in dev mode - in production the refresh plugin doesn't run,\n // leaving $RefreshReg$ undefined which crashes client-side JS\n oxc: {\n jsx: {\n refresh: mode === \"development\"\n }\n }\n };\n}\nexport {\n dedupe,\n getBaseViteConfig\n};\n//# sourceMappingURL=getBaseViteConfigOnly.js.map\n"],"mappings":";;;;;AAGA,IAAI,SAAS;CACX;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,eAAe,kBAAkB,QAAQ;CACvC,IAAI,EAAE,MAAM,SAAS;CACrB,IAAI,eAAe;EACjB,KAAK,MAAM,mBAAmB;EAC9B,KAAK,MAAM,mBAAmB;EAC9B,KAAK,MAAM,qBAAqB;CAClC;CACA,IAAI,qBAAqB,MAAM,QAAQ,IAAI,aAAa,IAAI,eAAe,GAAG;EAC5E,IAAI,MAAM,QAAQ,WAAW,CAAC,GAAG;GAC/B,OAAO;EACT;CACF,CAAC,CAAC,EAAC,CAAE,KAAK,SAAS,GAAG;EACpB,OAAO,OAAO,MAAM;CACtB,CAAC;CACD,IAAI,6BAA6B,YAAY,6BAA6B,IAAI;CAC9E,IAAI,EAAE,YAAY,MAAM,QAAQ,SAAS,0BAA0B;CACnE,OAAO;EACL;EAKA,KAAK,oBAAoB,EACvB,SAAS,kBACX,IAAI;GACF,aAAa;GACb,cAAc,EACZ,SAAS,EACP,QAAQ,MAAM,KAAK,KAAK,EAC1B,EACF;EACF;EACA,QAAQ;GACN,SAAS,GAAG,SAAS;GACrB,wBAAwB,IAAI,KAAK;GACjC,oCAAoC,IAAI,QAAQ;EAClD;EACA,SAAS;GACP,OAAO;IAIL;KACE,MAAM;KACN,aAAa,YAAY,iCAAiC,YAAY,OAAO;IAC/E;IACA;KAGE,MAAM;KACN,aAAa,YAAY,+CAA+C,IAAI;IAC9E;IACA;KACE,MAAM;KACN,aAAa,YAAY,iCAAiC,IAAI;IAChE;IACA;KACE,MAAM;KACN,aAAa,YAAY,oBAAoB,IAAI;IACnD;IACA;KACE,MAAM;KACN,aAAa,YAAY,mBAAmB,IAAI;IAClD;IAEA;KACE,MAAM;KACN,aAAa,YAAY,sBAAsB,IAAI;IACrD;IACA;KACE,MAAM;KACN,aAAa,YAAY,mBAAmB,IAAI;IAClD;GACF;GAEA;EACF;EACA,OAAO,CAAC;EAMR,KAAK,EACH,KAAK,EACH,SAAS,SAAS,cACpB,EACF;CACF;AACF"}
1
+ {"version":3,"file":"getBaseViteConfigOnly.native.js","names":[],"sources":["config/getBaseViteConfigOnly.native.js"],"sourcesContent":["import { resolvePath } from \"@vxrn/resolve\";\nimport FSExtra from \"fs-extra\";\nimport { join } from \"path\";\nvar dedupe = [\n \"one\",\n \"react\",\n \"react-dom\",\n \"react-dom/client\",\n \"react-native-web\",\n \"react-native-web-lite\",\n \"@react-navigation/core\",\n \"@react-navigation/native\",\n \"@react-navigation/elements\",\n \"@react-navigation/native-stack\",\n \"@react-navigation/bottom-tabs\",\n \"@tamagui/core\",\n \"@tamagui/web\",\n \"@tamagui/adapt\",\n \"@tamagui/react-native-web\",\n \"@tamagui/react-native-web-lite\",\n \"tamagui\",\n \"react-native-reanimated\"\n];\nasync function getBaseViteConfig(config) {\n var { root, mode } = config;\n var postCSSPaths = [\n join(root, \"postcss.config.js\"),\n join(root, \"postcss.config.ts\"),\n join(root, \"postcss.config.json\")\n ];\n var postCSSConfigPath = (await Promise.all(postCSSPaths.map(async function(x) {\n if (await FSExtra.pathExists(x)) {\n return x;\n }\n }))).find(function(x) {\n return typeof x === \"string\";\n });\n var reactNativePackageJsonPath = resolvePath(\"react-native/package.json\", root);\n var { version } = await FSExtra.readJSON(reactNativePackageJsonPath);\n return {\n mode,\n assetsInclude: [\n \"**/*.glb\"\n ],\n // we load the config ourselves\n // if you disable this is disables auto-reloading config changes\n // configFile: false,\n // TODO make this documented / configurable through the plugins\n css: postCSSConfigPath ? {\n postcss: postCSSConfigPath\n } : {\n transformer: \"lightningcss\",\n lightningcss: {\n targets: {\n safari: 15 << 16 | 2 << 8\n }\n }\n },\n define: {\n __DEV__: `${mode === \"development\"}`,\n \"process.env.NODE_ENV\": `\"${mode}\"`,\n \"process.env.REACT_NATIVE_VERSION\": `\"${version}\"`\n },\n resolve: {\n alias: [\n // deep react-native/Libraries/* paths must be caught BEFORE the general\n // react-native → react-native-web alias, since react-native-web doesn't\n // have these native-only subpaths\n {\n find: /^react-native\\/Libraries\\/.*/,\n replacement: resolvePath(\"@vxrn/vite-plugin-metro/empty\", import.meta.dirname)\n },\n {\n // react native 0.87 removed @react-native/assets-registry, but libraries\n // like react-native-svg still import its registry\n find: /^(react-native\\/asset-registry|@react-native\\/assets-registry\\/registry)$/,\n replacement: \"react-native-web/dist/modules/AssetRegistry\"\n },\n {\n find: \"react-native/package.json\",\n replacement: \"react-native-web/package.json\"\n },\n // named by package so it resolves (from the root, through dedupe) only\n // once something imports react-native: an app with no react-native\n // imports needs no react-native-web.\n {\n find: \"react-native\",\n replacement: \"react-native-web\"\n },\n // bundle size optimizations\n {\n find: \"query-string\",\n replacement: resolvePath(\"@vxrn/query-string\", root)\n },\n {\n find: \"url-parse\",\n replacement: resolvePath(\"@vxrn/url-parse\", root)\n }\n ],\n // TODO auto dedupe all include optimize deps?\n dedupe\n },\n build: {},\n // enable OXC React Refresh so component registration ($RefreshReg$) is\n // injected into TSX/JSX output; the one:react-refresh-web compiler plugin\n // then wraps the output with the runtime preamble and import.meta.hot.accept\n // only enable in dev mode - in production the refresh plugin doesn't run,\n // leaving $RefreshReg$ undefined which crashes client-side JS\n oxc: {\n jsx: {\n refresh: mode === \"development\"\n }\n }\n };\n}\nexport {\n dedupe,\n getBaseViteConfig\n};\n//# sourceMappingURL=getBaseViteConfigOnly.js.map\n"],"mappings":";;;;;AAGA,IAAI,SAAS;CACX;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,eAAe,kBAAkB,QAAQ;CACvC,IAAI,EAAE,MAAM,SAAS;CACrB,IAAI,eAAe;EACjB,KAAK,MAAM,mBAAmB;EAC9B,KAAK,MAAM,mBAAmB;EAC9B,KAAK,MAAM,qBAAqB;CAClC;CACA,IAAI,qBAAqB,MAAM,QAAQ,IAAI,aAAa,IAAI,eAAe,GAAG;EAC5E,IAAI,MAAM,QAAQ,WAAW,CAAC,GAAG;GAC/B,OAAO;EACT;CACF,CAAC,CAAC,EAAC,CAAE,KAAK,SAAS,GAAG;EACpB,OAAO,OAAO,MAAM;CACtB,CAAC;CACD,IAAI,6BAA6B,YAAY,6BAA6B,IAAI;CAC9E,IAAI,EAAE,YAAY,MAAM,QAAQ,SAAS,0BAA0B;CACnE,OAAO;EACL;EACA,eAAe,CACb,UACF;EAKA,KAAK,oBAAoB,EACvB,SAAS,kBACX,IAAI;GACF,aAAa;GACb,cAAc,EACZ,SAAS,EACP,QAAQ,MAAM,KAAK,KAAK,EAC1B,EACF;EACF;EACA,QAAQ;GACN,SAAS,GAAG,SAAS;GACrB,wBAAwB,IAAI,KAAK;GACjC,oCAAoC,IAAI,QAAQ;EAClD;EACA,SAAS;GACP,OAAO;IAIL;KACE,MAAM;KACN,aAAa,YAAY,iCAAiC,YAAY,OAAO;IAC/E;IACA;KAGE,MAAM;KACN,aAAa;IACf;IACA;KACE,MAAM;KACN,aAAa;IACf;IAIA;KACE,MAAM;KACN,aAAa;IACf;IAEA;KACE,MAAM;KACN,aAAa,YAAY,sBAAsB,IAAI;IACrD;IACA;KACE,MAAM;KACN,aAAa,YAAY,mBAAmB,IAAI;IAClD;GACF;GAEA;EACF;EACA,OAAO,CAAC;EAMR,KAAK,EACH,KAAK,EACH,SAAS,SAAS,cACpB,EACF;CACF;AACF"}
@@ -8,7 +8,6 @@ function getOptimizeDeps(mode) {
8
8
  "react-native-css-interop",
9
9
  "secure-json-parse",
10
10
  "@react-native/normalize-colors",
11
- "@vxrn/safe-area",
12
11
  "@vxrn/vendor/react-19-prod",
13
12
  "@vxrn/vendor/react-19",
14
13
  "@vxrn/vendor/react-19-compiler-runtime",
@@ -71,6 +70,8 @@ function getOptimizeDeps(mode) {
71
70
  "@react-navigation/bottom-tabs",
72
71
  "@react-navigation/native-stack",
73
72
  "one",
73
+ "one/drawer",
74
+ "react-native-safe-area-context",
74
75
  "styleq",
75
76
  "fbjs",
76
77
  "@vxrn/universal-color-scheme",