vxrn 2.9.2 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/getBaseVitePlugins.mjs +3 -1
- package/dist/config/getBaseVitePlugins.mjs.map +1 -1
- package/dist/config/getBaseVitePlugins.native.js +3 -1
- package/dist/config/getBaseVitePlugins.native.js.map +1 -1
- package/dist/constants.mjs +23 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/constants.native.js +23 -1
- package/dist/constants.native.js.map +1 -1
- package/dist/exports/build.mjs +11 -12
- package/dist/exports/build.mjs.map +1 -1
- package/dist/exports/build.native.js +11 -12
- package/dist/exports/build.native.js.map +1 -1
- package/dist/exports/prebuildWithoutExpo.mjs +16 -1
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
- package/dist/exports/prebuildWithoutExpo.native.js +16 -1
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/dist/index.native.js +2 -1
- package/dist/plugins/reactNativeDevServer.mjs +7 -5
- package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
- package/dist/plugins/reactNativeDevServer.native.js +8 -5
- package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.mjs +9 -0
- package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.native.js +9 -0
- package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/runtime/native-prelude.mjs +7 -1
- package/dist/runtime/native-prelude.mjs.map +1 -1
- package/dist/runtime/native-prelude.native.js +7 -1
- package/dist/runtime/native-prelude.native.js.map +1 -1
- package/dist/utils/compileNativeDevBytecode.mjs +13 -3
- package/dist/utils/compileNativeDevBytecode.mjs.map +1 -1
- package/dist/utils/compileNativeDevBytecode.native.js +13 -3
- package/dist/utils/compileNativeDevBytecode.native.js.map +1 -1
- package/dist/utils/createNativeDevEngine.mjs +375 -173
- package/dist/utils/createNativeDevEngine.mjs.map +1 -1
- package/dist/utils/createNativeDevEngine.native.js +429 -193
- package/dist/utils/createNativeDevEngine.native.js.map +1 -1
- package/dist/utils/environmentUtils.mjs +1 -1
- package/dist/utils/environmentUtils.mjs.map +1 -1
- package/dist/utils/environmentUtils.native.js +1 -1
- package/dist/utils/environmentUtils.native.js.map +1 -1
- package/dist/utils/scanDepsToOptimize.mjs +37 -15
- package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
- package/dist/utils/scanDepsToOptimize.native.js +45 -15
- package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
- package/package.json +13 -13
- package/src/config/getBaseVitePlugins.ts +2 -0
- package/src/constants.ts +24 -0
- package/src/exports/build.lifecycle.test.ts +152 -0
- package/src/exports/build.ts +16 -14
- package/src/exports/prebuildWithoutExpo.ts +16 -1
- package/src/index.ts +1 -0
- package/src/plugins/reactNativeCommonJsPlugin.ts +1 -1
- package/src/plugins/reactNativeDevServer.ts +19 -8
- package/src/rn-commands/bundle/buildBundle.ts +13 -1
- package/src/runtime/native-prelude.ts +7 -1
- package/src/types.ts +1 -1
- package/src/utils/compileNativeDevBytecode.test.ts +8 -8
- package/src/utils/compileNativeDevBytecode.ts +22 -2
- package/src/utils/createNativeDevEngine.test.ts +52 -25
- package/src/utils/createNativeDevEngine.ts +567 -254
- package/src/utils/environmentUtils.ts +6 -1
- package/src/utils/scanDepsToOptimize.test.ts +46 -2
- package/src/utils/scanDepsToOptimize.ts +78 -18
- package/types/config/getBaseVitePlugins.d.ts.map +1 -1
- package/types/constants.d.ts +2 -0
- package/types/constants.d.ts.map +1 -1
- package/types/exports/build.d.ts.map +1 -1
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
- package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -1
- package/types/runtime/native-prelude.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
- package/types/utils/compileNativeDevBytecode.d.ts +2 -1
- package/types/utils/compileNativeDevBytecode.d.ts.map +1 -1
- package/types/utils/createNativeDevEngine.d.ts +11 -5
- package/types/utils/createNativeDevEngine.d.ts.map +1 -1
- package/types/utils/environmentUtils.d.ts.map +1 -1
- package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildBundle.native.js","names":[],"sources":["rn-commands/bundle/buildBundle.native.js"],"sourcesContent":["import FSExtra from \"fs-extra\";\nimport { clearTransformCache } from \"@vxrn/compiler\";\nimport { resolveConfig } from \"vite\";\nimport { loadEnv } from \"../../exports/loadEnv\";\nimport { buildNativeBundle } from \"../../utils/createNativeDevEngine\";\nasync function buildBundle(_argv, ctx, args) {\n var bundleImpl = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;\n var _ctx_vxrnEntries;\n var {\n platform,\n
|
|
1
|
+
{"version":3,"file":"buildBundle.native.js","names":[],"sources":["rn-commands/bundle/buildBundle.native.js"],"sourcesContent":["import FSExtra from \"fs-extra\";\nimport { clearTransformCache } from \"@vxrn/compiler\";\nimport { resolveConfig } from \"vite\";\nimport { dirname, join, resolve } from \"path\";\nimport { loadEnv } from \"../../exports/loadEnv\";\nimport { buildNativeBundle } from \"../../utils/createNativeDevEngine\";\nasync function buildBundle(_argv, ctx, args) {\n var bundleImpl = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;\n var _ctx_vxrnEntries;\n var {\n platform,\n dev,\n bundleOutput,\n // React Native's `--bundle-encoding` names a Node Buffer encoding.\n bundleEncoding = \"utf8\",\n assetsDest,\n // `--minify` overrides React Native's default of \"minify unless this is a\n // dev bundle\". undefined means the flag was not passed.\n minify,\n // `--reset-cache` drops the compiler's transform cache, the only cache a\n // rolldown production build reads.\n resetCache\n } = (\n // `--entry-file` is a placeholder in generated native projects. VxRN apps\n // configure entries.native through vxrn/react-native-commands, while One\n // generates its native entry from the route tree.\n // `--read-global-cache` / `--max-workers` / `--config` / `--transformer` /\n // `--resolver-option` configure Metro's global cache, worker pool and\n // resolver. A rolldown production build has none of them: it transforms\n // from source in-process. React Native's own bundle command ignores\n // `--read-global-cache` too.\n // `--unstable-transform-profile` picks a JS engine to target. This pipeline\n // always downlevels for Hermes, which is what every profile it accepts\n // ('default', 'hermes', 'hermes-canary') can run.\n // `--sourcemap-use-absolute-path`, `--sourcemap-sources-root`,\n // `--asset-catalog-dest` and `--indexed-ram-bundle` are not implemented.\n args\n );\n var { root } = ctx;\n if (typeof root !== \"string\") {\n throw new Error(`Expected ctx.root to be a string, but got ${typeof root}`);\n }\n var viteConfig = await resolveConfig({}, \"build\", \"production\");\n if (globalThis[\"__viteMetroPluginOptions__\"]) {\n console.info(\"Using @vxrn/vite-plugin-metro to build the bundle.\");\n var { bundle } = await import(\"@vxrn/vite-plugin-metro/rn-commands\");\n await bundle.getBuildBundleFn(viteConfig)(_argv, ctx, args, bundleImpl);\n return;\n }\n process.env.IS_VXRN_CLI = \"true\";\n loadEnv(dev ? \"development\" : \"production\", root);\n if (!dev) {\n process.env.NODE_ENV = \"production\";\n }\n if (resetCache) {\n clearTransformCache();\n }\n console.info(`[vxrn] building native bundle for ${platform}...`);\n var nativeEntryFile = (_ctx_vxrnEntries = ctx.vxrnEntries) === null || _ctx_vxrnEntries === void 0 ? void 0 : _ctx_vxrnEntries.native;\n if (nativeEntryFile !== void 0 && typeof nativeEntryFile !== \"string\") {\n throw new Error(\"Expected entries.native to be a string\");\n }\n var result = await buildNativeBundle({\n root,\n platform,\n dev,\n entryFile: nativeEntryFile,\n // pass through ONE_SERVER_URL so the native prelude can inject it into\n // process.env. without this, getURL.native falls back to the dummy\n // 'http://one-server.example.com' and runtime loader fetches fail in prod.\n serverUrl: process.env.ONE_SERVER_URL,\n assetsDest,\n sourcemap: !!args.sourcemapOutput,\n minify\n });\n var builtBundle = result.code;\n if (platform === \"android\" && assetsDest) {\n var source = join(assetsDest, \"one-dom\");\n var destination = join(dirname(bundleOutput), \"one-dom\");\n if (resolve(source) !== resolve(destination)) {\n FSExtra.removeSync(destination);\n if (FSExtra.existsSync(source)) FSExtra.moveSync(source, destination);\n }\n }\n if (result.map && args.sourcemapOutput) {\n FSExtra.outputFileSync(args.sourcemapOutput, result.map, {\n encoding: \"utf8\"\n });\n }\n console.info(`Writing bundle to ${bundleOutput}...`);\n FSExtra.outputFileSync(bundleOutput, builtBundle, {\n encoding: bundleEncoding\n });\n console.info(\"Done.\");\n setTimeout(function() {\n console.info(\"Exiting process to prevent hanging.\");\n process.exit();\n }, 3e4).unref();\n}\nexport {\n buildBundle\n};\n//# sourceMappingURL=buildBundle.js.map\n"],"mappings":";;;;;;;;AAMA,eAAe,YAAY,OAAO,KAAK,MAAM;CAC3C,IAAI,aAAa,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CAClF,IAAI;CACJ,IAAI,EACF,UACA,KACA,cAEA,iBAAiB,QACjB,YAGA,QAGA,eAeA;CAEF,IAAI,EAAE,SAAS;CACf,IAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,IAAI,MAAM,6CAA6C,OAAO,MAAM;CAC5E;CACA,IAAI,aAAa,MAAM,cAAc,CAAC,GAAG,SAAS,YAAY;CAC9D,IAAI,WAAW,+BAA+B;EAC5C,QAAQ,KAAK,oDAAoD;EACjE,IAAI,EAAE,WAAW,MAAM,OAAO;EAC9B,MAAM,OAAO,iBAAiB,UAAU,CAAC,CAAC,OAAO,KAAK,MAAM,UAAU;EACtE;CACF;CACA,QAAQ,IAAI,cAAc;CAC1B,QAAQ,MAAM,gBAAgB,cAAc,IAAI;CAChD,IAAI,CAAC,KAAK;EACR,QAAQ,IAAI,WAAW;CACzB;CACA,IAAI,YAAY;EACd,oBAAoB;CACtB;CACA,QAAQ,KAAK,qCAAqC,SAAS,IAAI;CAC/D,IAAI,mBAAmB,mBAAmB,IAAI,iBAAiB,QAAQ,qBAAqB,KAAK,IAAI,KAAK,IAAI,iBAAiB;CAC/H,IAAI,oBAAoB,KAAK,KAAK,OAAO,oBAAoB,UAAU;EACrE,MAAM,IAAI,MAAM,wCAAwC;CAC1D;CACA,IAAI,SAAS,MAAM,kBAAkB;EACnC;EACA;EACA;EACA,WAAW;EAIX,WAAW,QAAQ,IAAI;EACvB;EACA,WAAW,CAAC,CAAC,KAAK;EAClB;CACF,CAAC;CACD,IAAI,cAAc,OAAO;CACzB,IAAI,aAAa,aAAa,YAAY;EACxC,IAAI,SAAS,KAAK,YAAY,SAAS;EACvC,IAAI,cAAc,KAAK,QAAQ,YAAY,GAAG,SAAS;EACvD,IAAI,QAAQ,MAAM,MAAM,QAAQ,WAAW,GAAG;GAC5C,QAAQ,WAAW,WAAW;GAC9B,IAAI,QAAQ,WAAW,MAAM,GAAG,QAAQ,SAAS,QAAQ,WAAW;EACtE;CACF;CACA,IAAI,OAAO,OAAO,KAAK,iBAAiB;EACtC,QAAQ,eAAe,KAAK,iBAAiB,OAAO,KAAK,EACvD,UAAU,OACZ,CAAC;CACH;CACA,QAAQ,KAAK,qBAAqB,aAAa,IAAI;CACnD,QAAQ,eAAe,cAAc,aAAa,EAChD,UAAU,eACZ,CAAC;CACD,QAAQ,KAAK,OAAO;CACpB,WAAW,WAAW;EACpB,QAAQ,KAAK,qCAAqC;EAClD,QAAQ,KAAK;CACf,GAAG,GAAG,CAAC,CAAC,MAAM;AAChB"}
|
|
@@ -22,7 +22,13 @@ global.performance = global.performance || { now: function() { return Date.now()
|
|
|
22
22
|
// hermes can expose addEventListener without the matching removal API. browser
|
|
23
23
|
// libraries use addEventListener as their capability check, then crash during
|
|
24
24
|
// cleanup. keep the incomplete host API from advertising browser event support.
|
|
25
|
-
|
|
25
|
+
// the bundle runs at script scope, so a module's own top-level
|
|
26
|
+
// function addEventListener declaration is also this global; only a native host function is cleared.
|
|
27
|
+
if (
|
|
28
|
+
typeof global.addEventListener === 'function' &&
|
|
29
|
+
typeof global.removeEventListener !== 'function' &&
|
|
30
|
+
Function.prototype.toString.call(global.addEventListener).indexOf('[native code]') !== -1
|
|
31
|
+
) {
|
|
26
32
|
global.addEventListener = undefined;
|
|
27
33
|
}
|
|
28
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-prelude.js","names":[],"sources":["runtime/native-prelude.js"],"sourcesContent":["function getNativePrelude(options) {\n\treturn `\nvar __BUNDLE_START_TIME__ = globalThis.nativePerformanceNow ? nativePerformanceNow() : Date.now();\n\nvar global = typeof globalThis !== 'undefined' ? globalThis\n : typeof global !== 'undefined' ? global\n : typeof window !== 'undefined' ? window\n : this;\n\nglobalThis.global = global;\nglobalThis.__DEV__ = ${options.dev};\n\n// react native polyfills\nglobal.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__ = false;\nglobal.Event = global.Event || function() { return this; };\nglobal.dispatchEvent = global.dispatchEvent || function() {};\nglobal.window = global.window || global;\nglobal.self = global.self || global;\nglobal.navigator = global.navigator || { product: 'ReactNative', userAgent: '' };\nglobal.performance = global.performance || { now: function() { return Date.now(); } };\n\n// hermes can expose addEventListener without the matching removal API. browser\n// libraries use addEventListener as their capability check, then crash during\n// cleanup. keep the incomplete host API from advertising browser event support.\nif (typeof global.addEventListener === 'function'
|
|
1
|
+
{"version":3,"file":"native-prelude.js","names":[],"sources":["runtime/native-prelude.js"],"sourcesContent":["function getNativePrelude(options) {\n\treturn `\nvar __BUNDLE_START_TIME__ = globalThis.nativePerformanceNow ? nativePerformanceNow() : Date.now();\n\nvar global = typeof globalThis !== 'undefined' ? globalThis\n : typeof global !== 'undefined' ? global\n : typeof window !== 'undefined' ? window\n : this;\n\nglobalThis.global = global;\nglobalThis.__DEV__ = ${options.dev};\n\n// react native polyfills\nglobal.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__ = false;\nglobal.Event = global.Event || function() { return this; };\nglobal.dispatchEvent = global.dispatchEvent || function() {};\nglobal.window = global.window || global;\nglobal.self = global.self || global;\nglobal.navigator = global.navigator || { product: 'ReactNative', userAgent: '' };\nglobal.performance = global.performance || { now: function() { return Date.now(); } };\n\n// hermes can expose addEventListener without the matching removal API. browser\n// libraries use addEventListener as their capability check, then crash during\n// cleanup. keep the incomplete host API from advertising browser event support.\n// the bundle runs at script scope, so a module's own top-level\n// function addEventListener declaration is also this global; only a native host function is cleared.\nif (\n typeof global.addEventListener === 'function' &&\n typeof global.removeEventListener !== 'function' &&\n Function.prototype.toString.call(global.addEventListener).indexOf('[native code]') !== -1\n) {\n global.addEventListener = undefined;\n}\n\n// ErrorUtils - used by RN's error handling system\nif (!global.ErrorUtils) {\n var _handler = null;\n global.ErrorUtils = {\n setGlobalHandler: function(h) { _handler = h; },\n getGlobalHandler: function() { return _handler; },\n reportFatalError: function(e) { if (_handler) _handler(e, true); else throw e; },\n reportError: function(e) { if (_handler) _handler(e, false); },\n applyWithGuard: function(fn, ctx, args) { try { return fn.apply(ctx, args); } catch(e) { this.reportError(e); } },\n };\n}\n\nif (typeof process === 'undefined') {\n globalThis.process = { env: {} };\n}\nprocess.env.NODE_ENV = ${JSON.stringify(options.dev ? \"development\" : \"production\")};\nprocess.env.ONE_PLATFORM = ${JSON.stringify(options.platform)};\nprocess.env.EXPO_OS = ${JSON.stringify(options.platform)};\nprocess.env.TAMAGUI_TARGET = 'native';\n${options.serverUrl ? `process.env.ONE_SERVER_URL = ${JSON.stringify(options.serverUrl)};` : \"\"}\n\n// polyfill setImmediate (used by react-native internals)\nif (typeof globalThis.setImmediate === 'undefined') {\n globalThis.setImmediate = function(fn) { return setTimeout(fn, 0); };\n globalThis.clearImmediate = function(id) { clearTimeout(id); };\n}\n\n// polyfill URLSearchParams early (before whatwg-fetch checks for it)\n// RN's polyfillGlobal sets this up later but some modules check at import time\nif (typeof globalThis.URLSearchParams === 'undefined') {\n // minimal URLSearchParams polyfill - will be overridden by RN's proper one\n globalThis.URLSearchParams = function URLSearchParams(init) {\n this._params = {};\n if (typeof init === 'string') {\n init.replace(/^\\\\?/, '').split('&').forEach(function(p) {\n var kv = p.split('=');\n if (kv[0]) this._params[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1] || '');\n }.bind(this));\n }\n };\n globalThis.URLSearchParams.prototype.get = function(k) { return this._params[k] || null; };\n globalThis.URLSearchParams.prototype.toString = function() {\n return Object.keys(this._params).map(function(k) { return encodeURIComponent(k) + '=' + encodeURIComponent(this._params[k]); }.bind(this)).join('&');\n };\n}\n\n// ensure console exists before any library prelude touches it in release bundles\nglobalThis.console = globalThis.console || {};\nvar console = globalThis.console;\nconsole.log = console.log || function() {};\nconsole.info = console.info || function() {};\nconsole.warn = console.warn || function() {};\nconsole.error = console.error || function() {};\nconsole.debug = console.debug || function() {};\nconsole.trace = console.trace || function() {};\n\n// reanimated compat - these console methods must exist to avoid EXC_BAD_ACCESS crash\nconsole.assert = console.assert || function() {};\nconsole.clear = console.clear || function() {};\nconsole.dir = console.dir || function() {};\nconsole.dirxml = console.dirxml || function() {};\nconsole.profile = console.profile || function() {};\nconsole.profileEnd = console.profileEnd || function() {};\nconsole.table = console.table || function() {};\n\n// react refresh stubs (overridden by react-refresh plugin in dev)\n${options.dev ? `\nvar $RefreshReg$ = function() {};\nvar $RefreshSig$ = function() { return function(v) { return v; }; };\n` : \"\"}\n`.trim();\n}\n\nexport { getNativePrelude };"],"mappings":";AAAA,SAAS,iBAAiB,SAAS;CAClC,OAAO;;;;;;;;;uBASe,QAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAuCV,KAAK,UAAU,QAAQ,MAAM,gBAAgB,YAAY,EAAE;6BACvD,KAAK,UAAU,QAAQ,QAAQ,EAAE;wBACtC,KAAK,UAAU,QAAQ,QAAQ,EAAE;;EAEvD,QAAQ,YAAY,gCAAgC,KAAK,UAAU,QAAQ,SAAS,EAAE,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+C9F,QAAQ,MAAM;;;IAGZ,GAAG;EACL,KAAK;AACP"}
|
|
@@ -22,7 +22,13 @@ global.performance = global.performance || { now: function() { return Date.now()
|
|
|
22
22
|
// hermes can expose addEventListener without the matching removal API. browser
|
|
23
23
|
// libraries use addEventListener as their capability check, then crash during
|
|
24
24
|
// cleanup. keep the incomplete host API from advertising browser event support.
|
|
25
|
-
|
|
25
|
+
// the bundle runs at script scope, so a module's own top-level
|
|
26
|
+
// function addEventListener declaration is also this global; only a native host function is cleared.
|
|
27
|
+
if (
|
|
28
|
+
typeof global.addEventListener === 'function' &&
|
|
29
|
+
typeof global.removeEventListener !== 'function' &&
|
|
30
|
+
Function.prototype.toString.call(global.addEventListener).indexOf('[native code]') !== -1
|
|
31
|
+
) {
|
|
26
32
|
global.addEventListener = undefined;
|
|
27
33
|
}
|
|
28
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-prelude.native.js","names":[],"sources":["runtime/native-prelude.native.js"],"sourcesContent":["function getNativePrelude(options) {\n\treturn `\nvar __BUNDLE_START_TIME__ = globalThis.nativePerformanceNow ? nativePerformanceNow() : Date.now();\n\nvar global = typeof globalThis !== 'undefined' ? globalThis\n : typeof global !== 'undefined' ? global\n : typeof window !== 'undefined' ? window\n : this;\n\nglobalThis.global = global;\nglobalThis.__DEV__ = ${options.dev};\n\n// react native polyfills\nglobal.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__ = false;\nglobal.Event = global.Event || function() { return this; };\nglobal.dispatchEvent = global.dispatchEvent || function() {};\nglobal.window = global.window || global;\nglobal.self = global.self || global;\nglobal.navigator = global.navigator || { product: 'ReactNative', userAgent: '' };\nglobal.performance = global.performance || { now: function() { return Date.now(); } };\n\n// hermes can expose addEventListener without the matching removal API. browser\n// libraries use addEventListener as their capability check, then crash during\n// cleanup. keep the incomplete host API from advertising browser event support.\nif (typeof global.addEventListener === 'function'
|
|
1
|
+
{"version":3,"file":"native-prelude.native.js","names":[],"sources":["runtime/native-prelude.native.js"],"sourcesContent":["function getNativePrelude(options) {\n\treturn `\nvar __BUNDLE_START_TIME__ = globalThis.nativePerformanceNow ? nativePerformanceNow() : Date.now();\n\nvar global = typeof globalThis !== 'undefined' ? globalThis\n : typeof global !== 'undefined' ? global\n : typeof window !== 'undefined' ? window\n : this;\n\nglobalThis.global = global;\nglobalThis.__DEV__ = ${options.dev};\n\n// react native polyfills\nglobal.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__ = false;\nglobal.Event = global.Event || function() { return this; };\nglobal.dispatchEvent = global.dispatchEvent || function() {};\nglobal.window = global.window || global;\nglobal.self = global.self || global;\nglobal.navigator = global.navigator || { product: 'ReactNative', userAgent: '' };\nglobal.performance = global.performance || { now: function() { return Date.now(); } };\n\n// hermes can expose addEventListener without the matching removal API. browser\n// libraries use addEventListener as their capability check, then crash during\n// cleanup. keep the incomplete host API from advertising browser event support.\n// the bundle runs at script scope, so a module's own top-level\n// function addEventListener declaration is also this global; only a native host function is cleared.\nif (\n typeof global.addEventListener === 'function' &&\n typeof global.removeEventListener !== 'function' &&\n Function.prototype.toString.call(global.addEventListener).indexOf('[native code]') !== -1\n) {\n global.addEventListener = undefined;\n}\n\n// ErrorUtils - used by RN's error handling system\nif (!global.ErrorUtils) {\n var _handler = null;\n global.ErrorUtils = {\n setGlobalHandler: function(h) { _handler = h; },\n getGlobalHandler: function() { return _handler; },\n reportFatalError: function(e) { if (_handler) _handler(e, true); else throw e; },\n reportError: function(e) { if (_handler) _handler(e, false); },\n applyWithGuard: function(fn, ctx, args) { try { return fn.apply(ctx, args); } catch(e) { this.reportError(e); } },\n };\n}\n\nif (typeof process === 'undefined') {\n globalThis.process = { env: {} };\n}\nprocess.env.NODE_ENV = ${JSON.stringify(options.dev ? \"development\" : \"production\")};\nprocess.env.ONE_PLATFORM = ${JSON.stringify(options.platform)};\nprocess.env.EXPO_OS = ${JSON.stringify(options.platform)};\nprocess.env.TAMAGUI_TARGET = 'native';\n${options.serverUrl ? `process.env.ONE_SERVER_URL = ${JSON.stringify(options.serverUrl)};` : \"\"}\n\n// polyfill setImmediate (used by react-native internals)\nif (typeof globalThis.setImmediate === 'undefined') {\n globalThis.setImmediate = function(fn) { return setTimeout(fn, 0); };\n globalThis.clearImmediate = function(id) { clearTimeout(id); };\n}\n\n// polyfill URLSearchParams early (before whatwg-fetch checks for it)\n// RN's polyfillGlobal sets this up later but some modules check at import time\nif (typeof globalThis.URLSearchParams === 'undefined') {\n // minimal URLSearchParams polyfill - will be overridden by RN's proper one\n globalThis.URLSearchParams = function URLSearchParams(init) {\n this._params = {};\n if (typeof init === 'string') {\n init.replace(/^\\\\?/, '').split('&').forEach(function(p) {\n var kv = p.split('=');\n if (kv[0]) this._params[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1] || '');\n }.bind(this));\n }\n };\n globalThis.URLSearchParams.prototype.get = function(k) { return this._params[k] || null; };\n globalThis.URLSearchParams.prototype.toString = function() {\n return Object.keys(this._params).map(function(k) { return encodeURIComponent(k) + '=' + encodeURIComponent(this._params[k]); }.bind(this)).join('&');\n };\n}\n\n// ensure console exists before any library prelude touches it in release bundles\nglobalThis.console = globalThis.console || {};\nvar console = globalThis.console;\nconsole.log = console.log || function() {};\nconsole.info = console.info || function() {};\nconsole.warn = console.warn || function() {};\nconsole.error = console.error || function() {};\nconsole.debug = console.debug || function() {};\nconsole.trace = console.trace || function() {};\n\n// reanimated compat - these console methods must exist to avoid EXC_BAD_ACCESS crash\nconsole.assert = console.assert || function() {};\nconsole.clear = console.clear || function() {};\nconsole.dir = console.dir || function() {};\nconsole.dirxml = console.dirxml || function() {};\nconsole.profile = console.profile || function() {};\nconsole.profileEnd = console.profileEnd || function() {};\nconsole.table = console.table || function() {};\n\n// react refresh stubs (overridden by react-refresh plugin in dev)\n${options.dev ? `\nvar $RefreshReg$ = function() {};\nvar $RefreshSig$ = function() { return function(v) { return v; }; };\n` : \"\"}\n`.trim();\n}\n\nexport { getNativePrelude };"],"mappings":";AAAA,SAAS,iBAAiB,SAAS;CAClC,OAAO;;;;;;;;;uBASe,QAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAuCV,KAAK,UAAU,QAAQ,MAAM,gBAAgB,YAAY,EAAE;6BACvD,KAAK,UAAU,QAAQ,QAAQ,EAAE;wBACtC,KAAK,UAAU,QAAQ,QAAQ,EAAE;;EAEvD,QAAQ,YAAY,gCAAgC,KAAK,UAAU,QAAQ,SAAS,EAAE,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+C9F,QAAQ,MAAM;;;IAGZ,GAAG;EACL,KAAK;AACP"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { accessSync, constants, readFileSync, statSync } from "node:fs";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
5
|
import { tmpdir } from "node:os";
|
|
5
6
|
import { dirname, join } from "node:path";
|
|
@@ -47,8 +48,17 @@ function resolvePodHermesc(root) {
|
|
|
47
48
|
}
|
|
48
49
|
return cliPath.replace(/\$\(PODS_ROOT\)|\$\{PODS_ROOT\}/g, pods);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
const
|
|
51
|
+
function resolveNpmHermesc(root) {
|
|
52
|
+
const require2 = createRequire(join(root, "package.json"));
|
|
53
|
+
const reactNativeJson = require2.resolve("react-native/package.json");
|
|
54
|
+
const nested = createRequire(reactNativeJson);
|
|
55
|
+
const compilerJson = nested.resolve("hermes-compiler/package.json");
|
|
56
|
+
const dir = compilerJson.slice(0, -"package.json".length);
|
|
57
|
+
const bin = process.platform === "darwin" ? "osx-bin" : process.platform === "win32" ? "win64-bin" : "linux64-bin";
|
|
58
|
+
return join(dir, "hermesc", bin, process.platform === "win32" ? "hermesc.exe" : "hermesc");
|
|
59
|
+
}
|
|
60
|
+
function nativeDevBytecodeCompiler(root, platform) {
|
|
61
|
+
const compiler = useHermescOverride() ?? (platform === "ios" ? resolvePodHermesc(root) : resolveNpmHermesc(root));
|
|
52
62
|
const compiled = /* @__PURE__ */ new WeakMap();
|
|
53
63
|
return (bundle, sourceURL) => {
|
|
54
64
|
let urls = compiled.get(bundle);
|
|
@@ -89,5 +99,5 @@ function nativeDevBytecodeCompiler(root) {
|
|
|
89
99
|
};
|
|
90
100
|
}
|
|
91
101
|
|
|
92
|
-
export { nativeDevBytecodeCompiler };
|
|
102
|
+
export { nativeDevBytecodeCompiler, resolveNpmHermesc };
|
|
93
103
|
//# sourceMappingURL=compileNativeDevBytecode.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileNativeDevBytecode.js","names":[],"sources":["utils/compileNativeDevBytecode.js"],"sourcesContent":["import { accessSync, constants, readFileSync, statSync } from \"node:fs\";\nimport { execFile } from \"node:child_process\";\nimport { mkdir, mkdtemp, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { promisify } from \"node:util\";\nconst execute = promisify(execFile);\nfunction useHermescOverride() {\n const override = process.env.HERMESC_PATH?.trim();\n if (!override) return void 0;\n let stat;\n try {\n stat = statSync(override);\n } catch {\n stat = void 0;\n }\n if (!stat?.isFile()) {\n throw new Error(\n `[vxrn] HERMESC_PATH is set but points nowhere: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`\n );\n }\n try {\n accessSync(override, constants.X_OK);\n } catch {\n throw new Error(\n `[vxrn] HERMESC_PATH is not executable: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`\n );\n }\n return override;\n}\nfunction resolvePodHermesc(root) {\n const pods = join(root, \"ios/Pods\");\n const podspecPath = join(pods, \"Local Podspecs/hermes-engine.podspec.json\");\n let podspec;\n try {\n podspec = JSON.parse(readFileSync(podspecPath, \"utf8\"));\n } catch (error) {\n throw new Error(\n `[vxrn] native iOS dev bytecode needs the pod hermesc but ${root} has no usable native project: cannot read ${podspecPath} (${error instanceof Error ? error.message : String(error)}). Run prebuild and pod install for this app, or set HERMESC_PATH to the hermesc the native build used.`\n );\n }\n if (!Array.isArray(podspec.subspecs)) {\n throw new Error(\n `[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no subspecs. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`\n );\n }\n const prebuilt = podspec.subspecs.some(\n (spec) => spec.name === \"Pre-built\"\n );\n if (prebuilt) {\n return join(pods, \"hermes-engine/destroot/bin/hermesc\");\n }\n const cliPath = podspec.user_target_xcconfig?.HERMES_CLI_PATH;\n if (!cliPath) {\n throw new Error(\n `[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no HERMES_CLI_PATH. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`\n );\n }\n return cliPath.replace(/\\$\\(PODS_ROOT\\)|\\$\\{PODS_ROOT\\}/g, pods);\n}\nfunction nativeDevBytecodeCompiler(root) {\n const compiler = useHermescOverride() ?? resolvePodHermesc(root);\n const compiled = /* @__PURE__ */ new WeakMap();\n return (bundle, sourceURL) => {\n let urls = compiled.get(bundle);\n if (!urls) compiled.set(bundle, urls = /* @__PURE__ */ new Map());\n const existing = urls.get(sourceURL);\n if (existing) return existing;\n const result = (async () => {\n const directory = await mkdtemp(join(tmpdir(), \"vxrn-dev-hermes-\"));\n try {\n const source = join(directory, sourceURL);\n await mkdir(dirname(source), { recursive: true });\n const output = join(directory, \"index.hbc\");\n await writeFile(source, bundle.code);\n await execute(\n compiler,\n [\"-Og\", \"-g\", \"-emit-binary\", \"-out\", output, sourceURL],\n { cwd: directory, maxBuffer: 16 * 1024 * 1024 }\n );\n return await readFile(output);\n } finally {\n await rm(directory, { recursive: true, force: true });\n }\n })().catch((error) => {\n urls.delete(sourceURL);\n throw error;\n });\n urls.set(sourceURL, result);\n return result;\n };\n}\nexport {\n nativeDevBytecodeCompiler\n};\n//# sourceMappingURL=compileNativeDevBytecode.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"compileNativeDevBytecode.js","names":[],"sources":["utils/compileNativeDevBytecode.js"],"sourcesContent":["import { accessSync, constants, readFileSync, statSync } from \"node:fs\";\nimport { execFile } from \"node:child_process\";\nimport { createRequire } from \"node:module\";\nimport { mkdir, mkdtemp, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport { promisify } from \"node:util\";\nconst execute = promisify(execFile);\nfunction useHermescOverride() {\n const override = process.env.HERMESC_PATH?.trim();\n if (!override) return void 0;\n let stat;\n try {\n stat = statSync(override);\n } catch {\n stat = void 0;\n }\n if (!stat?.isFile()) {\n throw new Error(\n `[vxrn] HERMESC_PATH is set but points nowhere: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`\n );\n }\n try {\n accessSync(override, constants.X_OK);\n } catch {\n throw new Error(\n `[vxrn] HERMESC_PATH is not executable: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`\n );\n }\n return override;\n}\nfunction resolvePodHermesc(root) {\n const pods = join(root, \"ios/Pods\");\n const podspecPath = join(pods, \"Local Podspecs/hermes-engine.podspec.json\");\n let podspec;\n try {\n podspec = JSON.parse(readFileSync(podspecPath, \"utf8\"));\n } catch (error) {\n throw new Error(\n `[vxrn] native iOS dev bytecode needs the pod hermesc but ${root} has no usable native project: cannot read ${podspecPath} (${error instanceof Error ? error.message : String(error)}). Run prebuild and pod install for this app, or set HERMESC_PATH to the hermesc the native build used.`\n );\n }\n if (!Array.isArray(podspec.subspecs)) {\n throw new Error(\n `[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no subspecs. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`\n );\n }\n const prebuilt = podspec.subspecs.some(\n (spec) => spec.name === \"Pre-built\"\n );\n if (prebuilt) {\n return join(pods, \"hermes-engine/destroot/bin/hermesc\");\n }\n const cliPath = podspec.user_target_xcconfig?.HERMES_CLI_PATH;\n if (!cliPath) {\n throw new Error(\n `[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no HERMES_CLI_PATH. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`\n );\n }\n return cliPath.replace(/\\$\\(PODS_ROOT\\)|\\$\\{PODS_ROOT\\}/g, pods);\n}\nfunction resolveNpmHermesc(root) {\n const require2 = createRequire(join(root, \"package.json\"));\n const reactNativeJson = require2.resolve(\"react-native/package.json\");\n const nested = createRequire(reactNativeJson);\n const compilerJson = nested.resolve(\"hermes-compiler/package.json\");\n const dir = compilerJson.slice(0, -\"package.json\".length);\n const bin = process.platform === \"darwin\" ? \"osx-bin\" : process.platform === \"win32\" ? \"win64-bin\" : \"linux64-bin\";\n return join(dir, \"hermesc\", bin, process.platform === \"win32\" ? \"hermesc.exe\" : \"hermesc\");\n}\nfunction nativeDevBytecodeCompiler(root, platform) {\n const compiler = useHermescOverride() ?? (platform === \"ios\" ? resolvePodHermesc(root) : resolveNpmHermesc(root));\n const compiled = /* @__PURE__ */ new WeakMap();\n return (bundle, sourceURL) => {\n let urls = compiled.get(bundle);\n if (!urls) compiled.set(bundle, urls = /* @__PURE__ */ new Map());\n const existing = urls.get(sourceURL);\n if (existing) return existing;\n const result = (async () => {\n const directory = await mkdtemp(join(tmpdir(), \"vxrn-dev-hermes-\"));\n try {\n const source = join(directory, sourceURL);\n await mkdir(dirname(source), { recursive: true });\n const output = join(directory, \"index.hbc\");\n await writeFile(source, bundle.code);\n await execute(\n compiler,\n [\"-Og\", \"-g\", \"-emit-binary\", \"-out\", output, sourceURL],\n { cwd: directory, maxBuffer: 16 * 1024 * 1024 }\n );\n return await readFile(output);\n } finally {\n await rm(directory, { recursive: true, force: true });\n }\n })().catch((error) => {\n urls.delete(sourceURL);\n throw error;\n });\n urls.set(sourceURL, result);\n return result;\n };\n}\nexport {\n nativeDevBytecod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OAAO,SAAS;GACrB,MAAM;EACR,CAAC;EACD,KAAK,IAAI,WAAW,MAAM;EAC1B,OAAO;CACT;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { accessSync, constants, readFileSync, statSync } from "fs";
|
|
2
2
|
import { execFile } from "child_process";
|
|
3
|
+
import { createRequire } from "module";
|
|
3
4
|
import { mkdir, mkdtemp, readFile, rm, writeFile } from "fs/promises";
|
|
4
5
|
import { tmpdir } from "os";
|
|
5
6
|
import { dirname, join } from "path";
|
|
@@ -51,9 +52,18 @@ function resolvePodHermesc(root) {
|
|
|
51
52
|
}
|
|
52
53
|
return cliPath.replace(/\$\(PODS_ROOT\)|\$\{PODS_ROOT\}/g, pods);
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function resolveNpmHermesc(root) {
|
|
56
|
+
var require2 = createRequire(join(root, "package.json"));
|
|
57
|
+
var reactNativeJson = require2.resolve("react-native/package.json");
|
|
58
|
+
var nested = createRequire(reactNativeJson);
|
|
59
|
+
var compilerJson = nested.resolve("hermes-compiler/package.json");
|
|
60
|
+
var dir = compilerJson.slice(0, -"package.json".length);
|
|
61
|
+
var bin = process.platform === "darwin" ? "osx-bin" : process.platform === "win32" ? "win64-bin" : "linux64-bin";
|
|
62
|
+
return join(dir, "hermesc", bin, process.platform === "win32" ? "hermesc.exe" : "hermesc");
|
|
63
|
+
}
|
|
64
|
+
function nativeDevBytecodeCompiler(root, platform) {
|
|
55
65
|
var _useHermescOverride;
|
|
56
|
-
var compiler = (_useHermescOverride = useHermescOverride()) !== null && _useHermescOverride !== void 0 ? _useHermescOverride : resolvePodHermesc(root);
|
|
66
|
+
var compiler = (_useHermescOverride = useHermescOverride()) !== null && _useHermescOverride !== void 0 ? _useHermescOverride : platform === "ios" ? resolvePodHermesc(root) : resolveNpmHermesc(root);
|
|
57
67
|
var compiled = /* @__PURE__ */ new WeakMap();
|
|
58
68
|
return function(bundle, sourceURL) {
|
|
59
69
|
var urls = compiled.get(bundle);
|
|
@@ -94,5 +104,5 @@ function nativeDevBytecodeCompiler(root) {
|
|
|
94
104
|
};
|
|
95
105
|
}
|
|
96
106
|
|
|
97
|
-
export { nativeDevBytecodeCompiler };
|
|
107
|
+
export { nativeDevBytecodeCompiler, resolveNpmHermesc };
|
|
98
108
|
//# sourceMappingURL=compileNativeDevBytecode.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileNativeDevBytecode.native.js","names":[],"sources":["utils/compileNativeDevBytecode.native.js"],"sourcesContent":["import { accessSync, constants, readFileSync, statSync } from \"fs\";\nimport { execFile } from \"child_process\";\nimport { mkdir, mkdtemp, readFile, rm, writeFile } from \"fs/promises\";\nimport { tmpdir } from \"os\";\nimport { dirname, join } from \"path\";\nimport { promisify } from \"util\";\nvar execute = promisify(execFile);\nfunction useHermescOverride() {\n var _process_env_HERMESC_PATH;\n var override = (_process_env_HERMESC_PATH = process.env.HERMESC_PATH) === null || _process_env_HERMESC_PATH === void 0 ? void 0 : _process_env_HERMESC_PATH.trim();\n if (!override) return void 0;\n var stat;\n try {\n stat = statSync(override);\n } catch (unused) {\n stat = void 0;\n }\n if (!(stat === null || stat === void 0 ? void 0 : stat.isFile())) {\n throw new Error(`[vxrn] HERMESC_PATH is set but points nowhere: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`);\n }\n try {\n accessSync(override, constants.X_OK);\n } catch (unused) {\n throw new Error(`[vxrn] HERMESC_PATH is not executable: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`);\n }\n return override;\n}\nfunction resolvePodHermesc(root) {\n var _podspec_user_target_xcconfig;\n var pods = join(root, \"ios/Pods\");\n var podspecPath = join(pods, \"Local Podspecs/hermes-engine.podspec.json\");\n var podspec;\n try {\n podspec = JSON.parse(readFileSync(podspecPath, \"utf8\"));\n } catch (error) {\n throw new Error(`[vxrn] native iOS dev bytecode needs the pod hermesc but ${root} has no usable native project: cannot read ${podspecPath} (${error instanceof Error ? error.message : String(error)}). Run prebuild and pod install for this app, or set HERMESC_PATH to the hermesc the native build used.`);\n }\n if (!Array.isArray(podspec.subspecs)) {\n throw new Error(`[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no subspecs. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`);\n }\n var prebuilt = podspec.subspecs.some(function(spec) {\n return spec.name === \"Pre-built\";\n });\n if (prebuilt) {\n return join(pods, \"hermes-engine/destroot/bin/hermesc\");\n }\n var cliPath = (_podspec_user_target_xcconfig = podspec.user_target_xcconfig) === null || _podspec_user_target_xcconfig === void 0 ? void 0 : _podspec_user_target_xcconfig.HERMES_CLI_PATH;\n if (!cliPath) {\n throw new Error(`[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no HERMES_CLI_PATH. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`);\n }\n return cliPath.replace(/\\$\\(PODS_ROOT\\)|\\$\\{PODS_ROOT\\}/g, pods);\n}\nfunction nativeDevBytecodeCompiler(root) {\n var _useHermescOverride;\n var compiler = (_useHermescOverride = useHermescOverride()) !== null && _useHermescOverride !== void 0 ? _useHermescOverride : resolvePodHermesc(root);\n var compiled = /* @__PURE__ */ new WeakMap();\n return function(bundle, sourceURL) {\n var urls = compiled.get(bundle);\n if (!urls) compiled.set(bundle, urls = /* @__PURE__ */ new Map());\n var existing = urls.get(sourceURL);\n if (existing) return existing;\n var result = (async function() {\n var directory = await mkdtemp(join(tmpdir(), \"vxrn-dev-hermes-\"));\n try {\n var source = join(directory, sourceURL);\n await mkdir(dirname(source), {\n recursive: true\n });\n var output = join(directory, \"index.hbc\");\n await writeFile(source, bundle.code);\n await execute(compiler, [\n \"-Og\",\n \"-g\",\n \"-emit-binary\",\n \"-out\",\n output,\n sourceURL\n ], {\n cwd: directory,\n maxBuffer: 16 * 1024 * 1024\n });\n return await readFile(output);\n } finally {\n await rm(directory, {\n recursive: true,\n force: true\n });\n }\n })().catch(function(error) {\n urls.delete(sourceURL);\n throw error;\n });\n urls.set(sourceURL, result);\n return result;\n };\n}\nexport {\n nativeDevBytecodeCompiler\n};\n//# sourceMappingURL=compileNativeDevBytecode.js.map\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"compileNativeDevBytecode.native.js","names":[],"sources":["utils/compileNativeDevBytecode.native.js"],"sourcesContent":["import { accessSync, constants, readFileSync, statSync } from \"fs\";\nimport { execFile } from \"child_process\";\nimport { createRequire } from \"module\";\nimport { mkdir, mkdtemp, readFile, rm, writeFile } from \"fs/promises\";\nimport { tmpdir } from \"os\";\nimport { dirname, join } from \"path\";\nimport { promisify } from \"util\";\nvar execute = promisify(execFile);\nfunction useHermescOverride() {\n var _process_env_HERMESC_PATH;\n var override = (_process_env_HERMESC_PATH = process.env.HERMESC_PATH) === null || _process_env_HERMESC_PATH === void 0 ? void 0 : _process_env_HERMESC_PATH.trim();\n if (!override) return void 0;\n var stat;\n try {\n stat = statSync(override);\n } catch (unused) {\n stat = void 0;\n }\n if (!(stat === null || stat === void 0 ? void 0 : stat.isFile())) {\n throw new Error(`[vxrn] HERMESC_PATH is set but points nowhere: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`);\n }\n try {\n accessSync(override, constants.X_OK);\n } catch (unused) {\n throw new Error(`[vxrn] HERMESC_PATH is not executable: ${override}. Point it at the hermesc binary the native build used, or unset it to resolve the pod compiler.`);\n }\n return override;\n}\nfunction resolvePodHermesc(root) {\n var _podspec_user_target_xcconfig;\n var pods = join(root, \"ios/Pods\");\n var podspecPath = join(pods, \"Local Podspecs/hermes-engine.podspec.json\");\n var podspec;\n try {\n podspec = JSON.parse(readFileSync(podspecPath, \"utf8\"));\n } catch (error) {\n throw new Error(`[vxrn] native iOS dev bytecode needs the pod hermesc but ${root} has no usable native project: cannot read ${podspecPath} (${error instanceof Error ? error.message : String(error)}). Run prebuild and pod install for this app, or set HERMESC_PATH to the hermesc the native build used.`);\n }\n if (!Array.isArray(podspec.subspecs)) {\n throw new Error(`[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no subspecs. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`);\n }\n var prebuilt = podspec.subspecs.some(function(spec) {\n return spec.name === \"Pre-built\";\n });\n if (prebuilt) {\n return join(pods, \"hermes-engine/destroot/bin/hermesc\");\n }\n var cliPath = (_podspec_user_target_xcconfig = podspec.user_target_xcconfig) === null || _podspec_user_target_xcconfig === void 0 ? void 0 : _podspec_user_target_xcconfig.HERMES_CLI_PATH;\n if (!cliPath) {\n throw new Error(`[vxrn] native iOS dev bytecode needs the pod hermesc but ${podspecPath} declares no HERMES_CLI_PATH. Reinstall pods for this app, or set HERMESC_PATH to the hermesc the native build used.`);\n }\n return cliPath.replace(/\\$\\(PODS_ROOT\\)|\\$\\{PODS_ROOT\\}/g, pods);\n}\nfunction resolveNpmHermesc(root) {\n var require2 = createRequire(join(root, \"package.json\"));\n var reactNativeJson = require2.resolve(\"react-native/package.json\");\n var nested = createRequire(reactNativeJson);\n var compilerJson = nested.resolve(\"hermes-compiler/package.json\");\n var dir = compilerJson.slice(0, -\"package.json\".length);\n var bin = process.platform === \"darwin\" ? \"osx-bin\" : process.platform === \"win32\" ? \"win64-bin\" : \"linux64-bin\";\n return join(dir, \"hermesc\", bin, process.platform === \"win32\" ? \"hermesc.exe\" : \"hermesc\");\n}\nfunction nativeDevBytecodeCompiler(root, platform) {\n var _useHermescOverride;\n var compiler = (_useHermescOverride = useHermescOverride()) !== null && _useHermescOverride !== void 0 ? _useHermescOverride : platform === \"ios\" ? resolvePodHermesc(root) : resolveNpmHermesc(root);\n var compiled = /* @__PURE__ */ new WeakMap();\n return function(bundle, sourceURL) {\n var urls = compiled.get(bundle);\n if (!urls) compiled.set(bundle, urls = /* @__PURE__ */ new Map());\n var existing = urls.get(sourceURL);\n if (existing) return existing;\n var result = (async function() {\n var directory = await mkdtemp(join(tmpdir(), \"vxrn-dev-hermes-\"));\n try {\n var source = join(directory, sourceURL);\n await mkdir(dirname(source), {\n recursive: true\n });\n var output = join(directory, \"index.hbc\");\n await writeFile(source, bundle.code);\n await execute(compiler, [\n \"-Og\",\n \"-g\",\n \"-emit-binary\",\n \"-out\",\n output,\n sourceURL\n ], {\n cwd: directory,\n maxBuffer: 16 * 1024 * 1024\n });\n return await readFile(output);\n } finally {\n await rm(directory, {\n recursive: true,\n force: true\n });\n }\n })().catch(function(error) {\n urls.delete(sourceURL);\n throw error;\n });\n urls.set(sourceURL, result);\n return result;\n };\n}\nexport {\n nativeDevBytecodeCompiler,\n resolveNpmHermesc\n};\n//# sourceMappingURL=compileNativeDevBytecode.js.map\n"],"mappings":";;;;;;;;;AAOA,IAAI,UAAU,UAAU,QAAQ;AAChC,SAAS,qBAAqB;CAC5B,IAAI;CACJ,IAAI,YAAY,4BAA4B,QAAQ,IAAI,kBAAkB,QAAQ,8BAA8B,KAAK,IAAI,KAAK,IAAI,0BAA0B,KAAK;CACjK,IAAI,CAAC,UAAU,OAAO,KAAK;CAC3B,IAAI;CACJ,IAAI;EACF,OAAO,SAAS,QAAQ;CAC1B,SAAS,QAAQ;EACf,OAAO,KAAK;CACd;CACA,IAAI,EAAE,SAAS,QAAQ,SAAS,KAAK,IAAI,KAAK,IAAI,KAAK,OAAO,IAAI;EAChE,MAAM,IAAI,MAAM,kDAAkD,SAAS,iGAAiG;CAC9K;CACA,IAAI;EACF,WAAW,UAAU,UAAU,IAAI;CACrC,SAAS,QAAQ;EACf,MAAM,IAAI,MAAM,0CAA0C,SAAS,iGAAiG;CACtK;CACA,OAAO;AACT;AACA,SAAS,kBAAkB,MAAM;CAC/B,IAAI;CACJ,IAAI,OAAO,KAAK,MAAM,UAAU;CAChC,IAAI,cAAc,KAAK,MAAM,2CAA2C;CACxE,IAAI;CACJ,IAAI;EACF,UAAU,KAAK,MAAM,aAAa,aAAa,MAAM,CAAC;CACxD,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,4DAA4D,KAAK,6CAA6C,YAAY,IAAI,i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