vxrn 1.26.0 → 1.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/plugins/reactNativeDevServer.mjs +123 -42
  2. package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
  3. package/dist/plugins/reactNativeDevServer.native.js +209 -44
  4. package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
  5. package/dist/rn-commands/bundle/buildBundle.mjs +29 -10
  6. package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
  7. package/dist/rn-commands/bundle/buildBundle.native.js +29 -10
  8. package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
  9. package/dist/utils/createNativeDevEngine.mjs +220 -83
  10. package/dist/utils/createNativeDevEngine.mjs.map +1 -1
  11. package/dist/utils/createNativeDevEngine.native.js +257 -84
  12. package/dist/utils/createNativeDevEngine.native.js.map +1 -1
  13. package/dist/utils/createNativeDevEngine.test.mjs +285 -23
  14. package/dist/utils/createNativeDevEngine.test.mjs.map +1 -1
  15. package/dist/utils/createNativeDevEngine.test.native.js +319 -23
  16. package/dist/utils/createNativeDevEngine.test.native.js.map +1 -1
  17. package/dist/utils/patches.test.mjs.map +1 -1
  18. package/dist/utils/patches.test.native.js.map +1 -1
  19. package/dist/utils/symbolicateNativeStack.mjs +66 -0
  20. package/dist/utils/symbolicateNativeStack.mjs.map +1 -0
  21. package/dist/utils/symbolicateNativeStack.native.js +70 -0
  22. package/dist/utils/symbolicateNativeStack.native.js.map +1 -0
  23. package/dist/utils/symbolicateNativeStack.test.mjs +96 -0
  24. package/dist/utils/symbolicateNativeStack.test.mjs.map +1 -0
  25. package/dist/utils/symbolicateNativeStack.test.native.js +96 -0
  26. package/dist/utils/symbolicateNativeStack.test.native.js.map +1 -0
  27. package/package.json +12 -11
  28. package/src/plugins/reactNativeDevServer.ts +162 -50
  29. package/src/rn-commands/bundle/buildBundle.ts +28 -9
  30. package/src/utils/createNativeDevEngine.test.ts +581 -193
  31. package/src/utils/createNativeDevEngine.ts +434 -115
  32. package/src/utils/patches.test.ts +1 -4
  33. package/src/utils/symbolicateNativeStack.test.ts +78 -0
  34. package/src/utils/symbolicateNativeStack.ts +129 -0
  35. package/types/plugins/reactNativeDevServer.d.ts.map +1 -1
  36. package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -1
  37. package/types/utils/createNativeDevEngine.d.ts +23 -4
  38. package/types/utils/createNativeDevEngine.d.ts.map +1 -1
  39. package/types/utils/symbolicateNativeStack.d.ts +46 -0
  40. package/types/utils/symbolicateNativeStack.d.ts.map +1 -0
  41. package/types/utils/symbolicateNativeStack.test.d.ts +2 -0
  42. package/types/utils/symbolicateNativeStack.test.d.ts.map +1 -0
@@ -1,4 +1,5 @@
1
1
  import FSExtra from "fs-extra";
2
+ import { clearTransformCache } from "@vxrn/compiler";
2
3
  import { bundle as metroBundle } from "@vxrn/vite-plugin-metro/rn-commands";
3
4
  import { loadEnv } from "../../exports/loadEnv.mjs";
4
5
  import { buildNativeBundle } from "../../utils/createNativeDevEngine.mjs";
@@ -7,15 +8,29 @@ async function buildBundle(_argv, ctx, args, bundleImpl = null) {
7
8
  platform,
8
9
  // Android is not supported yet.
9
10
  dev,
10
- // bundleEncoding, // Not supported, we are using utf8.
11
- // sourcemapUseAbsolutePath,
12
- // unstableTransformProfile,
13
- // resetCache, // Currently we are not using cache for production builds.
14
- // readGlobalCache,
15
- // entryFile, // Not supported. With VxRN, we are using a static entry file.
16
11
  bundleOutput,
17
- assetsDest
18
- // minify, // Minification is not supported.
12
+ // React Native's `--bundle-encoding` names a Node Buffer encoding.
13
+ bundleEncoding = "utf8",
14
+ assetsDest,
15
+ // `--minify` overrides React Native's default of "minify unless this is a
16
+ // dev bundle". undefined means the flag was not passed.
17
+ minify,
18
+ // `--reset-cache` drops the compiler's transform cache, the only cache a
19
+ // rolldown production build reads.
20
+ resetCache
21
+ // `--entry-file` names the React Native root module. One generates its own
22
+ // native entry from the route tree instead, and __vxrnNativeEntryFile is
23
+ // the supported way to point the build somewhere else.
24
+ // `--read-global-cache` / `--max-workers` / `--config` / `--transformer` /
25
+ // `--resolver-option` configure Metro's global cache, worker pool and
26
+ // resolver. A rolldown production build has none of them: it transforms
27
+ // from source in-process. React Native's own bundle command ignores
28
+ // `--read-global-cache` too.
29
+ // `--unstable-transform-profile` picks a JS engine to target. This pipeline
30
+ // always downlevels for Hermes, which is what every profile it accepts
31
+ // ('default', 'hermes', 'hermes-canary') can run.
32
+ // `--sourcemap-use-absolute-path`, `--sourcemap-sources-root`,
33
+ // `--asset-catalog-dest` and `--indexed-ram-bundle` are not implemented.
19
34
  } = args;
20
35
  const {
21
36
  root
@@ -34,6 +49,9 @@ async function buildBundle(_argv, ctx, args, bundleImpl = null) {
34
49
  if (!dev) {
35
50
  process.env.NODE_ENV = "production";
36
51
  }
52
+ if (resetCache) {
53
+ clearTransformCache();
54
+ }
37
55
  console.info(`[vxrn] building native bundle for ${platform}...`);
38
56
  const nativeEntryFile = globalThis.__vxrnNativeEntryFile;
39
57
  const result = await buildNativeBundle({
@@ -46,7 +64,8 @@ async function buildBundle(_argv, ctx, args, bundleImpl = null) {
46
64
  // 'http://one-server.example.com' and runtime loader fetches fail in prod.
47
65
  serverUrl: process.env.ONE_SERVER_URL,
48
66
  assetsDest,
49
- sourcemap: !!args.sourcemapOutput
67
+ sourcemap: !!args.sourcemapOutput,
68
+ minify
50
69
  });
51
70
  const builtBundle = result.code;
52
71
  if (result.map && args.sourcemapOutput) {
@@ -56,7 +75,7 @@ async function buildBundle(_argv, ctx, args, bundleImpl = null) {
56
75
  }
57
76
  console.info(`Writing bundle to ${bundleOutput}...`);
58
77
  FSExtra.writeFileSync(bundleOutput, builtBundle, {
59
- encoding: "utf8"
78
+ encoding: bundleEncoding
60
79
  });
61
80
  console.info("Done.");
62
81
  setTimeout(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["FSExtra","bundle","metroBundle","loadEnv","buildNativeBundle","buildBundle","_argv","ctx","args","bundleImpl","platform","dev","bundleOutput","assetsDest","root","Error","metroBuildBundleFn","getBuildBundleFn","console","info","process","env","IS_VXRN_CLI","NODE_ENV","nativeEntryFile","globalThis","__vxrnNativeEntryFile","result","entryFile","serverUrl","ONE_SERVER_URL","sourcemap","sourcemapOutput","builtBundle","code","map","writeFileSync","encoding","setTimeout","exit"],"sources":["../../../src/rn-commands/bundle/buildBundle.ts"],"sourcesContent":[null],"mappings":"AACA,OAAOA,OAAA,MAAa;AACpB,SACEC,MAAA,IAAUC,WAAA,QAEL;AACP,SAASC,OAAA,QAAe;AACxB,SAASC,iBAAA,QAAyB;AAIlC,eAAsBC,YACpBC,KAAA,EACAC,GAAA,EACAC,IAAA,EACAC,UAAA,GAAkB,MACH;EACf,MAAM;IACJC,QAAA;IAAA;IACAC,GAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAOAC,YAAA;IACAC;IAAA;EAEF,IAAIL,IAAA;EAEJ,MAAM;IAAEM;EAAK,IAAIP,GAAA;EACjB,IAAI,OAAOO,IAAA,KAAS,UAAU;IAC5B,MAAM,IAAIC,KAAA,CAAM,6CAA6C,OAAOD,IAAI,EAAE;EAC5E;EAEA,MAAME,kBAAA,GAAqB,MAAMd,WAAA,CAAYe,gBAAA,CAAiB;EAE9D,IAAID,kBAAA,EAAoB;IACtBE,OAAA,CAAQC,IAAA,CAAK,oDAAoD;IACjE,MAAMH,kBAAA,CAAmBV,KAAA,EAAOC,GAAA,EAAKC,IAAA,EAAMC,UAAU;IAKrD;EACF;EAEAW,OAAA,CAAQC,GAAA,CAAIC,WAAA,GAAc;EAC1BnB,OAAA,CAAQQ,GAAA,GAAM,gBAAgB,cAAcG,IAAI;EAEhD,IAAI,CAACH,GAAA,EAAK;IACRS,OAAA,CAAQC,GAAA,CAAIE,QAAA,GAAW;EACzB;EAEAL,OAAA,CAAQC,IAAA,CAAK,qCAAqCT,QAAQ,KAAK;EAC/D,MAAMc,eAAA,GAAmBC,UAAA,CACtBC,qBAAA;EACH,MAAMC,MAAA,GAAS,MAAMvB,iBAAA,CAAkB;IACrCU,IAAA;IACAJ,QAAA;IACAC,GAAA;IACAiB,SAAA,EAAW,OAAOJ,eAAA,KAAoB,WAAWA,eAAA,GAAkB;IAAA;IAAA;IAAA;IAInEK,SAAA,EAAWT,OAAA,CAAQC,GAAA,CAAIS,cAAA;IACvBjB,UAAA;IACAkB,SAAA,EAAW,CAAC,CAACvB,IAAA,CAAKwB;EACpB,CAAC;EACD,MAAMC,WAAA,GAAcN,MAAA,CAAOO,IAAA;EAG3B,IAAIP,MAAA,CAAOQ,GAAA,IAAO3B,IAAA,CAAKwB,eAAA,EAAiB;IACtChC,OAAA,CAAQoC,aAAA,CAAc5B,IAAA,CAAKwB,eAAA,EAAiBL,MAAA,CAAOQ,GAAA,EAAK;MAAEE,QAAA,EAAU;IAAO,CAAC;EAC9E;EAEAnB,OAAA,CAAQC,IAAA,CAAK,qBAAqBP,YAAY,KAAK;EACnDZ,OAAA,CAAQoC,aAAA,CAAcxB,YAAA,EAAcqB,WAAA,EAAa;IAAEI,QAAA,EAAU;EAAO,CAAC;EACrEnB,OAAA,CAAQC,IAAA,CAAK,OAAO;EAIpBmB,UAAA,CAAW,MAAM;IACfpB,OAAA,CAAQC,IAAA,CAAK,qCAAqC;IAClDC,OAAA,CAAQmB,IAAA,CAAK;EACf,GAAG,GAAK;AACV","ignoreList":[]}
1
+ {"version":3,"names":["FSExtra","clearTransformCache","bundle","metroBundle","loadEnv","buildNativeBundle","buildBundle","_argv","ctx","args","bundleImpl","platform","dev","bundleOutput","bundleEncoding","assetsDest","minify","resetCache","root","Error","metroBuildBundleFn","getBuildBundleFn","console","info","process","env","IS_VXRN_CLI","NODE_ENV","nativeEntryFile","globalThis","__vxrnNativeEntryFile","result","entryFile","serverUrl","ONE_SERVER_URL","sourcemap","sourcemapOutput","builtBundle","code","map","writeFileSync","encoding","setTimeout","exit"],"sources":["../../../src/rn-commands/bundle/buildBundle.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,OAAA,MAAa;AACpB,SAASC,mBAAA,QAA2B;AACpC,SACEC,MAAA,IAAUC,WAAA,QAEL;AACP,SAASC,OAAA,QAAe;AACxB,SAASC,iBAAA,QAAyB;AAIlC,eAAsBC,YACpBC,KAAA,EACAC,GAAA,EACAC,IAAA,EACAC,UAAA,GAAkB,MACH;EACf,MAAM;IACJC,QAAA;IAAA;IACAC,GAAA;IACAC,YAAA;IAAA;IAEAC,cAAA,GAAiB;IACjBC,UAAA;IAAA;IAAA;IAGAC,MAAA;IAAA;IAAA;IAGAC;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAcF,IAAIR,IAAA;EAEJ,MAAM;IAAES;EAAK,IAAIV,GAAA;EACjB,IAAI,OAAOU,IAAA,KAAS,UAAU;IAC5B,MAAM,IAAIC,KAAA,CAAM,6CAA6C,OAAOD,IAAI,EAAE;EAC5E;EAEA,MAAME,kBAAA,GAAqB,MAAMjB,WAAA,CAAYkB,gBAAA,CAAiB;EAE9D,IAAID,kBAAA,EAAoB;IACtBE,OAAA,CAAQC,IAAA,CAAK,oDAAoD;IACjE,MAAMH,kBAAA,CAAmBb,KAAA,EAAOC,GAAA,EAAKC,IAAA,EAAMC,UAAU;IAKrD;EACF;EAEAc,OAAA,CAAQC,GAAA,CAAIC,WAAA,GAAc;EAC1BtB,OAAA,CAAQQ,GAAA,GAAM,gBAAgB,cAAcM,IAAI;EAEhD,IAAI,CAACN,GAAA,EAAK;IACRY,OAAA,CAAQC,GAAA,CAAIE,QAAA,GAAW;EACzB;EAEA,IAAIV,UAAA,EAAY;IACdhB,mBAAA,CAAoB;EACtB;EAEAqB,OAAA,CAAQC,IAAA,CAAK,qCAAqCZ,QAAQ,KAAK;EAC/D,MAAMiB,eAAA,GAAmBC,UAAA,CACtBC,qBAAA;EACH,MAAMC,MAAA,GAAS,MAAM1B,iBAAA,CAAkB;IACrCa,IAAA;IACAP,QAAA;IACAC,GAAA;IACAoB,SAAA,EAAW,OAAOJ,eAAA,KAAoB,WAAWA,eAAA,GAAkB;IAAA;IAAA;IAAA;IAInEK,SAAA,EAAWT,OAAA,CAAQC,GAAA,CAAIS,cAAA;IACvBnB,UAAA;IACAoB,SAAA,EAAW,CAAC,CAAC1B,IAAA,CAAK2B,eAAA;IAClBpB;EACF,CAAC;EACD,MAAMqB,WAAA,GAAcN,MAAA,CAAOO,IAAA;EAG3B,IAAIP,MAAA,CAAOQ,GAAA,IAAO9B,IAAA,CAAK2B,eAAA,EAAiB;IACtCpC,OAAA,CAAQwC,aAAA,CAAc/B,IAAA,CAAK2B,eAAA,EAAiBL,MAAA,CAAOQ,GAAA,EAAK;MAAEE,QAAA,EAAU;IAAO,CAAC;EAC9E;EAEAnB,OAAA,CAAQC,IAAA,CAAK,qBAAqBV,YAAY,KAAK;EACnDb,OAAA,CAAQwC,aAAA,CAAc3B,YAAA,EAAcwB,WAAA,EAAa;IAAEI,QAAA,EAAU3B;EAAe,CAAC;EAC7EQ,OAAA,CAAQC,IAAA,CAAK,OAAO;EAIpBmB,UAAA,CAAW,MAAM;IACfpB,OAAA,CAAQC,IAAA,CAAK,qCAAqC;IAClDC,OAAA,CAAQmB,IAAA,CAAK;EACf,GAAG,GAAK;AACV","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import FSExtra from "fs-extra";
2
+ import { clearTransformCache } from "@vxrn/compiler";
2
3
  import { bundle as metroBundle } from "@vxrn/vite-plugin-metro/rn-commands";
3
4
  import { loadEnv } from "../../exports/loadEnv.native.js";
4
5
  import { buildNativeBundle } from "../../utils/createNativeDevEngine.native.js";
@@ -13,16 +14,30 @@ async function buildBundle(_argv, ctx, args) {
13
14
  platform,
14
15
  // Android is not supported yet.
15
16
  dev,
16
- // bundleEncoding, // Not supported, we are using utf8.
17
- // sourcemapUseAbsolutePath,
18
- // unstableTransformProfile,
19
- // resetCache, // Currently we are not using cache for production builds.
20
- // readGlobalCache,
21
- // entryFile, // Not supported. With VxRN, we are using a static entry file.
22
17
  bundleOutput,
23
- assetsDest
18
+ // React Native's `--bundle-encoding` names a Node Buffer encoding.
19
+ bundleEncoding = "utf8",
20
+ assetsDest,
21
+ // `--minify` overrides React Native's default of "minify unless this is a
22
+ // dev bundle". undefined means the flag was not passed.
23
+ minify,
24
+ // `--reset-cache` drops the compiler's transform cache, the only cache a
25
+ // rolldown production build reads.
26
+ resetCache
24
27
  } =
25
- // minify, // Minification is not supported.
28
+ // `--entry-file` names the React Native root module. One generates its own
29
+ // native entry from the route tree instead, and __vxrnNativeEntryFile is
30
+ // the supported way to point the build somewhere else.
31
+ // `--read-global-cache` / `--max-workers` / `--config` / `--transformer` /
32
+ // `--resolver-option` configure Metro's global cache, worker pool and
33
+ // resolver. A rolldown production build has none of them: it transforms
34
+ // from source in-process. React Native's own bundle command ignores
35
+ // `--read-global-cache` too.
36
+ // `--unstable-transform-profile` picks a JS engine to target. This pipeline
37
+ // always downlevels for Hermes, which is what every profile it accepts
38
+ // ('default', 'hermes', 'hermes-canary') can run.
39
+ // `--sourcemap-use-absolute-path`, `--sourcemap-sources-root`,
40
+ // `--asset-catalog-dest` and `--indexed-ram-bundle` are not implemented.
26
41
  args;
27
42
  var {
28
43
  root
@@ -41,6 +56,9 @@ async function buildBundle(_argv, ctx, args) {
41
56
  if (!dev) {
42
57
  process.env.NODE_ENV = "production";
43
58
  }
59
+ if (resetCache) {
60
+ clearTransformCache();
61
+ }
44
62
  console.info(`[vxrn] building native bundle for ${platform}...`);
45
63
  var nativeEntryFile = globalThis.__vxrnNativeEntryFile;
46
64
  var result = await buildNativeBundle({
@@ -53,7 +71,8 @@ async function buildBundle(_argv, ctx, args) {
53
71
  // 'http://one-server.example.com' and runtime loader fetches fail in prod.
54
72
  serverUrl: process.env.ONE_SERVER_URL,
55
73
  assetsDest,
56
- sourcemap: !!args.sourcemapOutput
74
+ sourcemap: !!args.sourcemapOutput,
75
+ minify
57
76
  });
58
77
  var builtBundle = result.code;
59
78
  if (result.map && args.sourcemapOutput) {
@@ -63,7 +82,7 @@ async function buildBundle(_argv, ctx, args) {
63
82
  }
64
83
  console.info(`Writing bundle to ${bundleOutput}...`);
65
84
  FSExtra.writeFileSync(bundleOutput, builtBundle, {
66
- encoding: "utf8"
85
+ encoding: bundleEncoding
67
86
  });
68
87
  console.info("Done.");
69
88
  setTimeout(function () {
@@ -1 +1 @@
1
- {"version":3,"names":["FSExtra","bundle","metroBundle","loadEnv","buildNativeBundle","_type_of","obj","Symbol","constructor","buildBundle","_argv","ctx","args","bundleImpl","arguments","length","platform","dev","bundleOutput","assetsDest","root","Error","metroBuildBundleFn","getBuildBundleFn","console","info","process","env","IS_VXRN_CLI","NODE_ENV","nativeEntryFile","globalThis","__vxrnNativeEntryFile","result","entryFile","serverUrl","ONE_SERVER_URL","sourcemap","sourcemapOutput","builtBundle","code","map","writeFileSync","encoding"],"sources":["../../../src/rn-commands/bundle/buildBundle.ts"],"sourcesContent":[null],"mappings":"AACA,OAAOA,OAAA,MAAa;AACpB,SAAAC,MAAA,IAAAC,WAAA;AAAA,SACEC,OAAU;AAAA,SAELC,iBAAA;AACP,SAASC,SAAAC,GAAA;EACT,uBAAS;;EAIT,OAAAA,GAAA,IAAsB,OAAAC,MACpB,KACA,WAEA,IAAAD,GAAA,CAAAE,WACe,KAAAD,MAAA,qBAAAD,GAAA;AACf;AAAM,eACJG,YAAAC,KAAA,EAAAC,GAAA,EAAAC,IAAA;EAAA,IAAAC,UAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAAA,IACA;IAAAE,QAAA;IAAA;IAAAC,GAAA;IAAA;IAAA;IAAA;IAOA;IACA;IAAA;IAEFC,YAAI;IAEJC;EACA;EACE;EACFP,IAEA;EAEA,IAAI;IAAAQ;EAAA,IAAAT,GAAA;EACF,WAAQS,IAAK;IACb,MAAM,IAAAC,KAAA,8CAA+C,OAAAD,IAAA,iCAAAf,QAAA,CAAAe,IAAA;EAKrD;EACF,IAAAE,kBAAA,SAAApB,WAAA,CAAAqB,gBAAA;EAEA,IAAAD,kBAAY;IACZE,OAAQ,CAAAC,IAAM,qDAAkC;IAEhD,MAAKH,kBAAK,CAAAZ,KAAA,EAAAC,GAAA,EAAAC,IAAA,EAAAC,UAAA;IACR;EACF;EAEAa,OAAA,CAAQC,GAAA,CAAAC,WAAK;EACbzB,OAAM,CAAAc,GAAA,gBAAmB,eACtB,EAAAG,IAAA;EACH,KAAAH,GAAM;IACJS,OAAA,CAAAC,GAAA,CAAAE,QAAA;EAAA;EACAL,OACA,CAAAC,IAAA,sCAAAT,QAAA;EAAA,IACAc,eAAW,GAAOC,UAAA,CAAAC,qBAA+B;EAAkB,IAAAC,MAAA,SAAA7B,iBAAA;IAAAgB,IAAA;IAAAJ,QAAA;IAInEC,GAAA;IACAiB,SAAA,SAAAJ,eAAA,gBAAAA,eAAA;IACA;IACD;IACD;IAGAK,SAAW,EAAAT,OAAO,CAAAC,GAAK,CAAAS,cAAA;IACrBjB,UAAQ;IACVkB,SAAA,IAAAzB,IAAA,CAAA0B;EAEA;EACA,IAAAC,WAAQ,GAAAN,MAAc,CAAAO,IAAA;EACtB,IAAAP,MAAQ,CAAAQ,GAAK,IAAA7B,IAAO,CAAA0B,eAAA;IAIpBtC,OAAA,CAAA0C,aAAiB,CAAA9B,IAAA,CAAA0B,eAAA,EAAAL,MAAA,CAAAQ,GAAA;MACfE,QAAQ;IACR;EACF;EACFnB,OAAA,CAAAC,IAAA,sBAAAP,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["FSExtra","clearTransformCache","bundle","metroBundle","loadEnv","buildNativeBundle","_type_of","obj","Symbol","constructor","buildBundle","_argv","ctx","args","bundleImpl","arguments","length","platform","dev","bundleOutput","bundleEncoding","assetsDest","minify","resetCache","root","Error","metroBuildBundleFn","getBuildBundleFn","console","info","process","env","IS_VXRN_CLI","NODE_ENV","nativeEntryFile","globalThis","__vxrnNativeEntryFile","result","entryFile","serverUrl","ONE_SERVER_URL","sourcemap","sourcemapOutput","builtBundle","code","map","writeFileSync","encoding"],"sources":["../../../src/rn-commands/bundle/buildBundle.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,OAAA,MAAa;AACpB,SAASC,mBAAA,QAA2B;AACpC,SAAAC,MAAA,IAAAC,WAAA;AAAA,SACEC,OAAU;AAAA,SAELC,iBAAA;AACP,SAASC,SAAAC,GAAA;EACT,uBAAS;;EAIT,OAAAA,GAAA,IAAsB,OAAAC,MACpB,KACA,WAEA,IAAAD,GAAA,CAAAE,WACe,KAAAD,MAAA,qBAAAD,GAAA;AACf;AAAM,eACJG,YAAAC,KAAA,EAAAC,GAAA,EAAAC,IAAA;EAAA,IAAAC,UAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAAA,IACA;IACAE,QAAA;IAAA;IAEAC,GAAA;IACAC,YAAA;IAAA;IAAAC,cAAA;IAGAC,UAAA;IAAA;IAAA;IAGAC,MAAA;IAAA;IAAA;IAAAC;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAcF;EAEA;EACA;EACE;EACFV,IAEA;EAEA,IAAI;IAAAW;EAAA,IAAAZ,GAAA;EACF,WAAQY,IAAK;IACb,MAAM,IAAAC,KAAA,8CAA+C,OAAAD,IAAA,iCAAAlB,QAAA,CAAAkB,IAAA;EAKrD;EACF,IAAAE,kBAAA,SAAAvB,WAAA,CAAAwB,gBAAA;EAEA,IAAAD,kBAAY;IACZE,OAAQ,CAAAC,IAAM,qDAAkC;IAEhD,MAAKH,kBAAK,CAAAf,KAAA,EAAAC,GAAA,EAAAC,IAAA,EAAAC,UAAA;IACR;EACF;EAEAgB,OAAI,CAAAC,GAAA,CAAAC,WAAY;EACd5B,OAAA,CAAAc,GAAA,gBAAoB,iBAAAM,IAAA;EACtB,KAAAN,GAAA;IAEAY,OAAQ,CAAAC,GAAK,CAAAE,QAAA;EACb;EAEA,IAAAV,UAAM,EAAS;IACbtB,mBAAA;EAAA;EACA2B,OACA,CAAAC,IAAA,sCAAAZ,QAAA;EAAA,IACAiB,eAAW,GAAOC,UAAA,CAAAC,qBAA+B;EAAkB,IAAAC,MAAA,SAAAhC,iBAAA;IAAAmB,IAAA;IAAAP,QAAA;IAInEC,GAAA;IACAoB,SAAA,SAAAJ,eAAA,gBAAAA,eAAA;IACA;IACA;IACD;IACDK,SAAM,EAAAT,OAAc,CAAAC,GAAA,CAAAS,cAAO;IAG3BnB,UAAW;IACToB,SAAQ,IAAA5B,IAAA,CAAA6B,eAAmB;IAC7BpB;EAEA;EACA,IAAAqB,WAAQ,GAAAN,MAAc,CAAAO,IAAA;EACtB,IAAAP,MAAQ,CAAAQ,GAAK,IAAAhC,IAAO,CAAA6B,eAAA;IAIpB1C,OAAA,CAAA8C,aAAiB,CAAAjC,IAAA,CAAA6B,eAAA,EAAAL,MAAA,CAAAQ,GAAA;MACfE,QAAQ;IACR;EACF;EACFnB,OAAA,CAAAC,IAAA,sBAAAV,YAAA","ignoreList":[]}
@@ -1,7 +1,8 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { basename, dirname, extname, join, relative, resolve } from "node:path";
3
- import { copyFileSync, mkdirSync, readFileSync, readdirSync, realpathSync } from "node:fs";
3
+ import { copyFileSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
4
4
  import { pathToFileURL } from "node:url";
5
+ import micromatch from "micromatch";
5
6
  import { loadEnv, normalizePath } from "vite";
6
7
  import { shouldStripFlow, transformHermesAsync } from "@vxrn/compiler";
7
8
  import { DEFAULT_ASSET_EXTS } from "../constants/defaults.mjs";
@@ -109,7 +110,12 @@ function getNativeTransformConfig(platform, dev, root) {
109
110
  }
110
111
  };
111
112
  }
112
- function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, onAsset, sourceMaps = false) {
113
+ function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, onAsset, sourceMaps = false, userPlugins = []) {
114
+ const context = {
115
+ root,
116
+ platform,
117
+ dev
118
+ };
113
119
  return [...(globalThis.__vxrnAddNativePlugins || []), serverFileExclusionPlugin(), environmentGuardPlugin(), hmrClientNoopPlugin(), cssStubPlugin(), viteImportGlobPlugin({
114
120
  root
115
121
  }), vxrnCompilerPlugin(platform, dev, root, sourceMaps), rnCodegenPlugin({
@@ -119,25 +125,38 @@ function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest,
119
125
  platform,
120
126
  assetsDest,
121
127
  onAsset
122
- }), hermesCompatSWCPlugin(dev, sourceMaps), hermesLoopsPlugin(sourceMaps)];
128
+ }), hermesCompatSWCPlugin(dev, sourceMaps), hermesLoopsPlugin(sourceMaps), ...userPlugins].map(plugin => plugin.api?.vxrnNative ? plugin.api.vxrnNative(context) : plugin);
123
129
  }
124
- function getNativeOutputOptions(prelude, sourcemap) {
130
+ function getNativeOutputOptions(prelude, sourcemap, minify) {
125
131
  return {
126
132
  format: "esm",
127
133
  sourcemap,
134
+ sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => normalizePath(resolve(dirname(sourcemapPath), relativeSourcePath)),
128
135
  intro: prelude,
129
136
  codeSplitting: false,
130
- strictExecutionOrder: true
137
+ strictExecutionOrder: true,
138
+ minify: minify || "dce-only"
131
139
  };
132
140
  }
133
141
  function normalizeNativeCommonJSInterop(code) {
134
142
  return code.replace(/(\b__toESM(?:\$\d+)?\(\s*(?:require[\w$]*\(\)|__rolldown_runtime__\.loadExports\("(?:\\.|[^"\\])*"\))\s*),\s*1(\s*\))/g, "$1$2");
135
143
  }
144
+ function blankPreservingLines(match) {
145
+ return "\n".repeat(match.match(/\n/g)?.length ?? 0);
146
+ }
147
+ function countLines(code) {
148
+ return (code.match(/\n/g)?.length ?? 0) + 1;
149
+ }
150
+ function assertBundleLinesPreserved(before, after, stage) {
151
+ const beforeLines = countLines(before);
152
+ const afterLines = countLines(after);
153
+ if (beforeLines !== afterLines) throw new Error(`[vxrn] native bundle post-processing (${stage}) changed the line count (${beforeLines} -> ${afterLines}), which invalidates the source map. Every pass after Rolldown emits the map must preserve lines.`);
154
+ }
136
155
  function postProcessNativeBundle(code) {
137
156
  code = normalizeNativeCommonJSInterop(code);
138
157
  code = code.replace(/\btypeof\s+import\.meta\b/g, "\"object\"");
139
- code = code.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm, "");
140
- code = code.replace(/^\s*export\s+default\s+([^;\n]+);?\s*$/gm, "$1;");
158
+ code = code.replace(/^[^\S\n]*export[^\S\n]*\{[^}]*\}[^\S\n]*;?[^\S\n]*$/gm, blankPreservingLines);
159
+ code = code.replace(/^([^\S\n]*)export[^\S\n]+default[^\S\n]+([^;\n]+);?[^\S\n]*$/gm, "$1$2;");
141
160
  code = code.replace(/^if \(import\.meta\.hot\).*$/gm, "");
142
161
  {
143
162
  const idx = code.indexOf("NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;");
@@ -150,7 +169,8 @@ function postProcessNativeBundle(code) {
150
169
  const afterMarker = code.indexOf("})();", idx);
151
170
  if (afterMarker !== -1) {
152
171
  const end = afterMarker + 5;
153
- code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + code.slice(end);
172
+ const removed = code.slice(beforeMarker, end);
173
+ code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + blankPreservingLines(removed) + code.slice(end);
154
174
  }
155
175
  }
156
176
  }
@@ -161,7 +181,7 @@ function postProcessNativeBundle(code) {
161
181
  function wrapNativeBundleModuleScope(code) {
162
182
  const idx = code.indexOf("//#region \\0rolldown/runtime.js");
163
183
  if (idx === -1) return code;
164
- return code.slice(0, idx) + ";(function() {\n" + code.slice(idx) + "\n})();\n";
184
+ return code.slice(0, idx) + ";(function() {" + code.slice(idx) + "\n})();\n";
165
185
  }
166
186
  async function downlevelClassFieldsInBundle(code) {
167
187
  const startMarker = "//#region \\0rolldown/runtime.js";
@@ -191,6 +211,19 @@ ${transformedCode}`;
191
211
  const linePreservingRuntime = transformed + "\n".repeat(originalNewlines - transformedNewlines);
192
212
  return code.slice(0, startIdx) + linePreservingRuntime + code.slice(runtimeEnd);
193
213
  }
214
+ function nativeBundlePostProcessPlugin() {
215
+ return {
216
+ name: "vxrn:native-post-process",
217
+ async renderChunk(code) {
218
+ const processed = await downlevelClassFieldsInBundle(postProcessNativeBundle(code));
219
+ assertBundleLinesPreserved(code, processed, "production");
220
+ return {
221
+ code: processed,
222
+ map: null
223
+ };
224
+ }
225
+ };
226
+ }
194
227
  async function createNativeDevEngine(options) {
195
228
  const {
196
229
  root,
@@ -218,7 +251,16 @@ async function createNativeDevEngine(options) {
218
251
  let bundleReject = null;
219
252
  let bundlePromise = null;
220
253
  const resolvedHost = host === "0.0.0.0" ? "localhost" : host;
221
- const engine = await dev({
254
+ const virtualEntry = nativeVirtualEntryPlugin(root, {
255
+ dev: true
256
+ });
257
+ let engineWork = Promise.resolve();
258
+ const queueEngineWork = work => {
259
+ const result = engineWork.then(work, work);
260
+ engineWork = result.catch(() => {});
261
+ return result;
262
+ };
263
+ const inputOptions = {
222
264
  input: VIRTUAL_NATIVE_ENTRY,
223
265
  cwd: root,
224
266
  platform: "neutral",
@@ -238,72 +280,58 @@ async function createNativeDevEngine(options) {
238
280
  moduleTypes: {
239
281
  ".js": "jsx"
240
282
  },
241
- plugins: [nativeVirtualEntryPlugin(root, {
242
- dev: true
243
- }), ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, false), ...userPlugins]
244
- }, {
245
- ...getNativeOutputOptions(prelude, false),
283
+ plugins: [virtualEntry.plugin, ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, true, userPlugins)]
284
+ };
285
+ const outputOptions = {
286
+ ...getNativeOutputOptions(prelude, true, false),
246
287
  outro: `
247
288
  try {
248
289
  var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
249
290
  var __hmrUrl = 'ws://${resolvedHost}:${port}/hot?platform=${platform}&clientId=' + encodeURIComponent(__rolldown_runtime__.clientId);
250
- var __hmrWS = new __WS(__hmrUrl);
251
- __hmrWS.onmessage = function(event) {
252
- try {
253
- var msg = JSON.parse(event.data);
254
- var g = typeof global !== 'undefined' ? global : globalThis;
255
- if (msg.type === 'hmr:update' && msg.code) {
256
- var applied = __rolldown_runtime__.applyHmrUpdate(msg.code, msg.changedIds, msg.seq);
257
- if (!applied) {
258
- var updateSettings = g.__turboModuleProxy ? g.__turboModuleProxy('DevSettings') : null;
259
- if (updateSettings && updateSettings.reload) updateSettings.reload();
260
- }
261
- } else if (msg.type === 'hmr:reload') {
262
- var ds = g.__turboModuleProxy ? g.__turboModuleProxy('DevSettings') : null;
263
- if (ds && ds.reload) ds.reload();
264
- }
265
- } catch(e) { console.error('[vxrn] HMR eval error:', e); }
291
+ __rolldown_runtime__.setup(new __WS(__hmrUrl));
292
+ } catch(e) {
293
+ // a swallowed failure here leaves the app permanently without Fast Refresh and
294
+ // nothing on screen or in the terminal says so.
295
+ console.error('[vxrn] HMR client failed to start:', (e && e.message) || e);
296
+ }
297
+ `
266
298
  };
267
- __hmrWS.onopen = function() {
268
- if (typeof __rolldown_runtime__ !== 'undefined' && __rolldown_runtime__.setup) {
269
- __rolldown_runtime__.setup(__hmrWS);
270
- }
299
+ let outputProcessed = Promise.resolve();
300
+ let engine;
301
+ const rebuildIfNewRoute = async files => {
302
+ const {
303
+ routeRoot,
304
+ files: knownRoutes,
305
+ isRouteFile
306
+ } = virtualEntry.routes;
307
+ const routeRootPrefix = `${normalizePath(routeRoot)}/`;
308
+ if (!files.some(file => {
309
+ const normalized = normalizePath(file);
310
+ if (isRouteFile(normalized)) return !knownRoutes.has(normalized);
311
+ return normalized.startsWith(routeRootPrefix) && statSync(file, {
312
+ throwIfNoEntry: false
313
+ })?.isDirectory() === true;
314
+ })) return false;
315
+ await queueEngineWork(async () => {
316
+ engine.triggerFullBuild();
317
+ await engine.ensureLatestBuildOutput();
318
+ await outputProcessed;
319
+ });
320
+ onHmrUpdate?.({
321
+ type: "hmr:reload"
322
+ });
323
+ return true;
271
324
  };
272
- __hmrWS.onerror = function(e) { console.warn('[vxrn] HMR connection error:', e.message || e); };
273
- } catch(e) {}
274
- `
275
- }, {
325
+ engine = await dev(inputOptions, outputOptions, {
276
326
  onOutput: async result => {
277
- if (result instanceof Error) {
278
- console.error("[vxrn] native bundle error:", result.message);
279
- if (!currentBundle) {
280
- firstBuildError ||= result;
281
- if (bundleReject) {
282
- const reject = bundleReject;
283
- bundleResolve = null;
284
- bundleReject = null;
285
- bundlePromise = null;
286
- reject(firstBuildError);
287
- }
288
- }
289
- return;
290
- }
291
- const chunk = result.output.find(o => o.type === "chunk" && o.isEntry);
292
- if (chunk && "code" in chunk) {
293
- firstBuildError = null;
294
- let code = postProcessNativeBundle(chunk.code);
295
- code = await downlevelClassFieldsInBundle(code);
296
- code = wrapNativeBundleModuleScope(code);
297
- currentBundle = {
298
- code
299
- };
300
- console.info(`[vxrn] native bundle ready (${Math.round(code.length / 1024)}KB)`);
301
- if (bundleResolve) {
302
- bundleResolve(currentBundle);
303
- bundleResolve = null;
304
- bundleReject = null;
305
- bundlePromise = null;
306
- }
327
+ let finishOutput = () => {};
328
+ outputProcessed = new Promise(resolve2 => {
329
+ finishOutput = resolve2;
330
+ });
331
+ try {
332
+ await handleOutput(result);
333
+ } finally {
334
+ finishOutput();
307
335
  }
308
336
  },
309
337
  onHmrUpdates: async result => {
@@ -314,6 +342,7 @@ try {
314
342
  });
315
343
  return;
316
344
  }
345
+ if (await rebuildIfNewRoute(result.changedFiles)) return;
317
346
  for (const {
318
347
  clientId,
319
348
  update
@@ -331,11 +360,51 @@ try {
331
360
  rebuildStrategy: "never",
332
361
  watch: {}
333
362
  });
363
+ async function handleOutput(result) {
364
+ if (result instanceof Error) {
365
+ console.error("[vxrn] native bundle error:", result.message);
366
+ if (/panic/i.test(result.message)) console.error("[vxrn] rolldown itself panicked. Fast Refresh will full-reload until you restart the dev server.");
367
+ if (!currentBundle) {
368
+ firstBuildError ||= result;
369
+ if (bundleReject) {
370
+ const reject = bundleReject;
371
+ bundleResolve = null;
372
+ bundleReject = null;
373
+ bundlePromise = null;
374
+ reject(firstBuildError);
375
+ }
376
+ }
377
+ return;
378
+ }
379
+ const chunk = result.output.find(o => o.type === "chunk" && o.isEntry);
380
+ if (chunk && "code" in chunk) {
381
+ firstBuildError = null;
382
+ let code = postProcessNativeBundle(chunk.code);
383
+ code = await downlevelClassFieldsInBundle(code);
384
+ assertBundleLinesPreserved(chunk.code, code, "dev");
385
+ code = wrapNativeBundleModuleScope(code);
386
+ if (!chunk.map) throw new Error("[vxrn] rolldown produced no source map for the dev bundle, so /symbolicate cannot resolve a frame");
387
+ currentBundle = {
388
+ code,
389
+ map: chunk.map.toString()
390
+ };
391
+ console.info(`[vxrn] native bundle ready (${Math.round(code.length / 1024)}KB)`);
392
+ if (bundleResolve) {
393
+ bundleResolve(currentBundle);
394
+ bundleResolve = null;
395
+ bundleReject = null;
396
+ bundlePromise = null;
397
+ }
398
+ }
399
+ }
334
400
  await engine.run();
335
401
  return {
336
402
  engine,
337
403
  async getBundle() {
338
- await engine.ensureLatestBuildOutput();
404
+ await queueEngineWork(async () => {
405
+ await engine.ensureLatestBuildOutput();
406
+ await outputProcessed;
407
+ });
339
408
  if (currentBundle) return currentBundle;
340
409
  if (firstBuildError) throw firstBuildError;
341
410
  if (!bundlePromise) {
@@ -364,6 +433,9 @@ try {
364
433
  },
365
434
  async close() {
366
435
  await engine.close();
436
+ },
437
+ async handleAddedFile(file) {
438
+ await rebuildIfNewRoute([file]);
367
439
  }
368
440
  };
369
441
  }
@@ -376,7 +448,8 @@ async function buildNativeBundle(options) {
376
448
  entryFile,
377
449
  assetsDest,
378
450
  plugins: userPlugins = [],
379
- sourcemap = false
451
+ sourcemap = false,
452
+ minify = !dev
380
453
  } = options;
381
454
  const {
382
455
  build
@@ -405,14 +478,13 @@ async function buildNativeBundle(options) {
405
478
  },
406
479
  plugins: [...(entryFile ? [] : [nativeVirtualEntryPlugin(root, {
407
480
  dev
408
- })]), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap), ...userPlugins],
409
- output: getNativeOutputOptions(prelude, sourcemap)
481
+ }).plugin]), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins), nativeBundlePostProcessPlugin()],
482
+ output: getNativeOutputOptions(prelude, sourcemap, minify)
410
483
  })).output.find(o => o.type === "chunk" && o.isEntry);
411
484
  if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
412
- let code = postProcessNativeBundle(chunk.code);
413
- code = await downlevelClassFieldsInBundle(code);
485
+ if (sourcemap && !chunk.map) throw new Error("[vxrn] a source map was requested but rolldown produced none for the production bundle");
414
486
  return {
415
- code,
487
+ code: chunk.code,
416
488
  map: sourcemap ? chunk.map?.toString() : void 0
417
489
  };
418
490
  }
@@ -467,13 +539,43 @@ createApp({
467
539
  linking: ${JSON.stringify(linking)},
468
540
  });
469
541
  `;
542
+ const routeRoot = resolve(root, routerRoot);
543
+ const stripDot = pattern => pattern.replace(/^\.\//, "");
544
+ const includeGlobs = routeGlobs.filter(p => !p.startsWith("!")).map(stripDot);
545
+ const excludeGlobs = routeGlobs.filter(p => p.startsWith("!")).map(p => stripDot(p.slice(1)));
546
+ const isRouteFile = file => {
547
+ const relativeToRoot = normalizePath(relative(root, file));
548
+ return micromatch.isMatch(relativeToRoot, includeGlobs) && !micromatch.isMatch(relativeToRoot, excludeGlobs);
549
+ };
550
+ const routes = {
551
+ routeRoot,
552
+ files: /* @__PURE__ */new Set(),
553
+ isRouteFile
554
+ };
470
555
  return {
471
- name: "vxrn:native-virtual-entry",
472
- resolveId(id) {
473
- if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
474
- },
475
- load(id) {
476
- if (id === resolvedId) return entryCode;
556
+ routes,
557
+ plugin: {
558
+ name: "vxrn:native-virtual-entry",
559
+ resolveId(id) {
560
+ if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
561
+ },
562
+ load(id) {
563
+ if (id !== resolvedId) return;
564
+ routes.files.clear();
565
+ const walkRouteRoot = dir => {
566
+ this.addWatchFile(dir);
567
+ for (const entry of readdirSync(dir, {
568
+ withFileTypes: true
569
+ })) {
570
+ const child = resolve(dir, entry.name);
571
+ if (entry.isDirectory()) walkRouteRoot(child);else if (isRouteFile(child)) routes.files.add(normalizePath(child));
572
+ }
573
+ };
574
+ if (statSync(routeRoot, {
575
+ throwIfNoEntry: false
576
+ })?.isDirectory()) walkRouteRoot(routeRoot);else this.addWatchFile(dirname(routeRoot));
577
+ return entryCode;
578
+ }
477
579
  }
478
580
  };
479
581
  }
@@ -1154,14 +1256,49 @@ class ReactNativeDevRuntime extends BaseDevRuntime {
1154
1256
  }
1155
1257
  }
1156
1258
 
1259
+ reload() {
1260
+ var proxy = globalThis.__turboModuleProxy
1261
+ ? globalThis.__turboModuleProxy('DevSettings')
1262
+ : globalThis.nativeModuleProxy && globalThis.nativeModuleProxy.DevSettings;
1263
+ if (proxy && proxy.reload) proxy.reload();
1264
+ }
1265
+
1157
1266
  setup(socket) {
1158
1267
  if (this._socket) return;
1159
1268
  this._socket = socket;
1269
+ var runtime = this;
1270
+ // addEventListener rather than socket.onmessage: the bundle's WebSocket is
1271
+ // whatever the host platform provides, and a host that does not honor on*
1272
+ // property assignment would otherwise leave the app permanently without
1273
+ // Fast Refresh and say nothing.
1274
+ socket.addEventListener('message', function(event) {
1275
+ var message;
1276
+ try {
1277
+ message = JSON.parse(event.data);
1278
+ } catch (error) {
1279
+ return;
1280
+ }
1281
+ try {
1282
+ if (message.type === 'hmr:update') {
1283
+ // a patch that cannot be applied in place is the reload signal
1284
+ if (!runtime.applyHmrUpdate(message.code, message.changedIds, message.seq)) {
1285
+ runtime.reload();
1286
+ }
1287
+ } else if (message.type === 'hmr:reload') {
1288
+ runtime.reload();
1289
+ }
1290
+ } catch (error) {
1291
+ console.error('[vxrn HMR]: failed to apply update', error);
1292
+ }
1293
+ });
1294
+ socket.addEventListener('error', function(event) {
1295
+ console.warn('[vxrn HMR]: connection error', (event && event.message) || event);
1296
+ });
1160
1297
  }
1161
1298
  }
1162
1299
 
1163
1300
  globalThis.__rolldown_runtime__ = new ReactNativeDevRuntime();
1164
1301
  `;
1165
1302
  }
1166
- export { buildNativeBundle, createNativeDevAssetRegistry, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeAssetData, getNativeTransformConfig, hermesCompatPlugin, hermesCompatSWCPlugin, hermesLoopsPlugin, hmrClientNoopPlugin, nativeAnimatedGuardPlugin, normalizeNativeCommonJSInterop, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
1303
+ export { buildNativeBundle, createNativeDevAssetRegistry, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeAssetData, getNativeTransformConfig, hermesCompatPlugin, hermesCompatSWCPlugin, hermesLoopsPlugin, hmrClientNoopPlugin, nativeAnimatedGuardPlugin, normalizeNativeCommonJSInterop, postProcessNativeBundle, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
1167
1304
  //# sourceMappingURL=createNativeDevEngine.mjs.map