@vxrn/compiler 2.0.0-beta.33.1 → 2.0.0-beta.362.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 (115) hide show
  1. package/dist/cjs/cache.cjs +112 -109
  2. package/dist/cjs/configure.cjs +26 -28
  3. package/dist/cjs/constants.cjs +56 -60
  4. package/dist/cjs/index.cjs +428 -438
  5. package/dist/cjs/reactNativeCodegen.cjs +105 -114
  6. package/dist/cjs/reactNativeViewConfig.cjs +362 -381
  7. package/dist/cjs/refresh-runtime.cjs +390 -397
  8. package/dist/cjs/transformBabel.cjs +247 -221
  9. package/dist/cjs/transformHermesAsync.cjs +36 -47
  10. package/dist/cjs/transformHermesClasses.cjs +51 -0
  11. package/dist/cjs/transformHermesLoops.cjs +279 -281
  12. package/dist/cjs/transformSWC.cjs +183 -200
  13. package/dist/cjs/transformWorklets.cjs +107 -95
  14. package/dist/cjs/types.cjs +9 -11
  15. package/dist/cjs/workletUtils.cjs +30 -0
  16. package/dist/cjs/worklets/autoworklet.cjs +277 -222
  17. package/dist/cjs/worklets/globals.cjs +145 -60
  18. package/dist/cjs/worklets/hash.cjs +23 -27
  19. package/dist/cjs/worklets/scope.cjs +338 -359
  20. package/dist/cjs/worklets/serialize.cjs +73 -75
  21. package/dist/cjs/worklets/transform.cjs +217 -222
  22. package/dist/cjs/worklets/types.cjs +9 -11
  23. package/dist/esm/cache.mjs +96 -89
  24. package/dist/esm/cache.mjs.map +1 -1
  25. package/dist/esm/configure.mjs +11 -10
  26. package/dist/esm/configure.mjs.map +1 -1
  27. package/dist/esm/constants.mjs +41 -41
  28. package/dist/esm/constants.mjs.map +1 -1
  29. package/dist/esm/index.js +426 -420
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/index.mjs +426 -420
  32. package/dist/esm/index.mjs.map +1 -1
  33. package/dist/esm/reactNativeCodegen.mjs +90 -88
  34. package/dist/esm/reactNativeCodegen.mjs.map +1 -1
  35. package/dist/esm/reactNativeViewConfig.mjs +347 -362
  36. package/dist/esm/reactNativeViewConfig.mjs.map +1 -1
  37. package/dist/esm/refresh-runtime.mjs +372 -376
  38. package/dist/esm/refresh-runtime.mjs.map +1 -1
  39. package/dist/esm/transformBabel.mjs +231 -198
  40. package/dist/esm/transformBabel.mjs.map +1 -1
  41. package/dist/esm/transformHermesAsync.mjs +20 -21
  42. package/dist/esm/transformHermesAsync.mjs.map +1 -1
  43. package/dist/esm/transformHermesClasses.mjs +25 -0
  44. package/dist/esm/transformHermesClasses.mjs.map +1 -0
  45. package/dist/esm/transformHermesLoops.mjs +264 -255
  46. package/dist/esm/transformHermesLoops.mjs.map +1 -1
  47. package/dist/esm/transformSWC.mjs +163 -171
  48. package/dist/esm/transformSWC.mjs.map +1 -1
  49. package/dist/esm/transformWorklets.mjs +89 -69
  50. package/dist/esm/transformWorklets.mjs.map +1 -1
  51. package/dist/esm/types.mjs +0 -2
  52. package/dist/esm/workletUtils.mjs +5 -0
  53. package/dist/esm/worklets/autoworklet.mjs +258 -200
  54. package/dist/esm/worklets/autoworklet.mjs.map +1 -1
  55. package/dist/esm/worklets/globals.mjs +130 -42
  56. package/dist/esm/worklets/globals.mjs.map +1 -1
  57. package/dist/esm/worklets/hash.mjs +10 -9
  58. package/dist/esm/worklets/hash.mjs.map +1 -1
  59. package/dist/esm/worklets/scope.mjs +325 -341
  60. package/dist/esm/worklets/scope.mjs.map +1 -1
  61. package/dist/esm/worklets/serialize.mjs +60 -58
  62. package/dist/esm/worklets/serialize.mjs.map +1 -1
  63. package/dist/esm/worklets/transform.mjs +201 -197
  64. package/dist/esm/worklets/transform.mjs.map +1 -1
  65. package/dist/esm/worklets/types.mjs +0 -2
  66. package/package.json +15 -6
  67. package/src/cache.ts +37 -7
  68. package/src/index.ts +44 -19
  69. package/src/reactNativeViewConfig.ts +6 -1
  70. package/src/transformBabel.test.ts +351 -17
  71. package/src/transformBabel.ts +137 -96
  72. package/src/transformHermesClasses.ts +34 -0
  73. package/src/transformSWC.ts +12 -1
  74. package/src/transformWorklets.test.ts +80 -5
  75. package/src/workletUtils.ts +4 -0
  76. package/src/worklets/autoworklet.ts +5 -2
  77. package/src/worklets/globals.ts +23 -0
  78. package/src/worklets/serialize.ts +1 -1
  79. package/types/cache.d.ts +2 -2
  80. package/types/cache.d.ts.map +1 -1
  81. package/types/index.d.ts +1 -0
  82. package/types/index.d.ts.map +1 -1
  83. package/types/reactNativeViewConfig.d.ts.map +1 -1
  84. package/types/transformBabel.d.ts +16 -1
  85. package/types/transformBabel.d.ts.map +1 -1
  86. package/types/transformHermesClasses.d.ts +5 -0
  87. package/types/transformHermesClasses.d.ts.map +1 -0
  88. package/types/transformSWC.d.ts +1 -4
  89. package/types/transformSWC.d.ts.map +1 -1
  90. package/types/workletUtils.d.ts +4 -0
  91. package/types/workletUtils.d.ts.map +1 -0
  92. package/types/worklets/autoworklet.d.ts.map +1 -1
  93. package/types/worklets/globals.d.ts.map +1 -1
  94. package/dist/cjs/transformBabel.test.cjs +0 -360
  95. package/dist/cjs/transformHermesLoops.test.cjs +0 -257
  96. package/dist/cjs/transformSWC.test.cjs +0 -117
  97. package/dist/cjs/transformWorklets.test.cjs +0 -604
  98. package/dist/esm/transformBabel.test.mjs +0 -337
  99. package/dist/esm/transformBabel.test.mjs.map +0 -1
  100. package/dist/esm/transformHermesLoops.test.mjs +0 -234
  101. package/dist/esm/transformHermesLoops.test.mjs.map +0 -1
  102. package/dist/esm/transformSWC.test.mjs +0 -118
  103. package/dist/esm/transformSWC.test.mjs.map +0 -1
  104. package/dist/esm/transformWorklets.test.mjs +0 -581
  105. package/dist/esm/transformWorklets.test.mjs.map +0 -1
  106. package/dist/esm/types.mjs.map +0 -1
  107. package/dist/esm/worklets/types.mjs.map +0 -1
  108. package/types/transformBabel.test.d.ts +0 -2
  109. package/types/transformBabel.test.d.ts.map +0 -1
  110. package/types/transformHermesLoops.test.d.ts +0 -2
  111. package/types/transformHermesLoops.test.d.ts.map +0 -1
  112. package/types/transformSWC.test.d.ts +0 -2
  113. package/types/transformSWC.test.d.ts.map +0 -1
  114. package/types/transformWorklets.test.d.ts +0 -2
  115. package/types/transformWorklets.test.d.ts.map +0 -1
@@ -5,39 +5,32 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
22
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
- value: mod,
30
- enumerable: true
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
31
26
  }) : target, mod));
32
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
33
- value: true
34
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
28
  var index_exports = {};
36
29
  __export(index_exports, {
37
- JS_GLOBALS: () => import_globals.JS_GLOBALS,
38
- clearTransformCache: () => import_cache2.clearTransformCache,
39
- createVXRNCompilerPlugin: () => createVXRNCompilerPlugin,
40
- getClosureVariables: () => import_scope.getClosureVariables
30
+ JS_GLOBALS: () => import_globals.JS_GLOBALS,
31
+ clearTransformCache: () => import_cache2.clearTransformCache,
32
+ createVXRNCompilerPlugin: () => createVXRNCompilerPlugin,
33
+ getClosureVariables: () => import_scope.getClosureVariables
41
34
  });
42
35
  module.exports = __toCommonJS(index_exports);
43
36
  var import_node_fs = require("node:fs");
@@ -59,443 +52,439 @@ __reExport(index_exports, require("./transformWorklets.cjs"), module.exports);
59
52
  __reExport(index_exports, require("./reactNativeCodegen.cjs"), module.exports);
60
53
  __reExport(index_exports, require("./transformHermesLoops.cjs"), module.exports);
61
54
  __reExport(index_exports, require("./transformHermesAsync.cjs"), module.exports);
55
+ __reExport(index_exports, require("./transformHermesClasses.cjs"), module.exports);
62
56
  var import_cache2 = require("./cache.cjs");
63
57
  var import_globals = require("./worklets/globals.cjs");
64
58
  var import_scope = require("./worklets/scope.cjs");
65
59
  const import_meta = {};
66
60
  const perfStats = {
67
- babel: {
68
- totalCalls: 0,
69
- totalTransforms: 0,
70
- totalTime: 0,
71
- byEnvironment: {}
72
- },
73
- optimizeDeps: {
74
- byEnvironment: {}
75
- }
61
+ babel: {
62
+ totalCalls: 0,
63
+ totalTransforms: 0,
64
+ totalTime: 0,
65
+ byEnvironment: {}
66
+ },
67
+ optimizeDeps: { byEnvironment: {} }
76
68
  };
77
69
  function logPerfSummary() {
78
- if (!process.env.DEBUG_COMPILER_PERF) {
79
- return;
80
- }
81
- console.info("\n\u{1F4CA} [Compiler Performance Summary]");
82
- console.info(`Babel: ${perfStats.babel.totalTransforms} transforms / ${perfStats.babel.totalCalls} calls (${(perfStats.babel.totalTransforms / Math.max(perfStats.babel.totalCalls, 1) * 100).toFixed(1)}% transform rate)`);
83
- console.info(`Babel total time: ${perfStats.babel.totalTime}ms`);
84
- for (const [env, stats] of Object.entries(perfStats.babel.byEnvironment)) {
85
- if (stats.transforms > 0) {
86
- console.info(` ${env}: ${stats.transforms} transforms, ${stats.time}ms (${(stats.time / stats.transforms).toFixed(1)}ms avg)`);
87
- }
88
- }
89
- for (const [env, stats] of Object.entries(perfStats.optimizeDeps.byEnvironment)) {
90
- const elapsed = Date.now() - stats.startTime;
91
- console.info(`optimizeDeps ${env}: checked ${stats.filesChecked} files, transformed ${stats.filesTransformed} (${elapsed}ms)`);
92
- }
70
+ if (!process.env.DEBUG_COMPILER_PERF) {
71
+ return;
72
+ }
73
+ console.info("\n📊 [Compiler Performance Summary]");
74
+ console.info(`Babel: ${perfStats.babel.totalTransforms} transforms / ${perfStats.babel.totalCalls} calls (${(perfStats.babel.totalTransforms / Math.max(perfStats.babel.totalCalls, 1) * 100).toFixed(1)}% transform rate)`);
75
+ console.info(`Babel total time: ${perfStats.babel.totalTime}ms`);
76
+ for (const [env, stats] of Object.entries(perfStats.babel.byEnvironment)) {
77
+ if (stats.transforms > 0) {
78
+ console.info(` ${env}: ${stats.transforms} transforms, ${stats.time}ms (${(stats.time / stats.transforms).toFixed(1)}ms avg)`);
79
+ }
80
+ }
81
+ for (const [env, stats] of Object.entries(perfStats.optimizeDeps.byEnvironment)) {
82
+ const elapsed = Date.now() - stats.startTime;
83
+ console.info(`optimizeDeps ${env}: checked ${stats.filesChecked} files, transformed ${stats.filesTransformed} (${elapsed}ms)`);
84
+ }
93
85
  }
94
86
  const compilerLog = {
95
- compiled: 0,
96
- cached: 0,
97
- time: 0,
98
- // typed loose because the dom lib types setTimeout as number, but node gives
99
- // us a Timeout we need to unref so the debounce never holds the process open
100
- timer: null
87
+ compiled: 0,
88
+ cached: 0,
89
+ time: 0,
90
+ timer: null
101
91
  };
102
92
  function logCompiled(cached, ms) {
103
- if (cached) {
104
- compilerLog.cached++;
105
- } else {
106
- compilerLog.compiled++;
107
- compilerLog.time += ms;
108
- }
109
- if (compilerLog.timer) clearTimeout(compilerLog.timer);
110
- compilerLog.timer = setTimeout(() => {
111
- const total = compilerLog.compiled + compilerLog.cached;
112
- const detail = compilerLog.compiled ? `${compilerLog.compiled} compiled in ${compilerLog.time}ms${compilerLog.cached ? `, ${compilerLog.cached} cached` : ""}` : `all cached`;
113
- console.info(` \u{1FA84} [compiler] ${total} file${total === 1 ? "" : "s"} (${detail})`);
114
- compilerLog.compiled = 0;
115
- compilerLog.cached = 0;
116
- compilerLog.time = 0;
117
- compilerLog.timer = null;
118
- }, 500);
119
- compilerLog.timer.unref?.();
93
+ if (cached) {
94
+ compilerLog.cached++;
95
+ } else {
96
+ compilerLog.compiled++;
97
+ compilerLog.time += ms;
98
+ }
99
+ if (compilerLog.timer) clearTimeout(compilerLog.timer);
100
+ compilerLog.timer = setTimeout(() => {
101
+ const total = compilerLog.compiled + compilerLog.cached;
102
+ const detail = compilerLog.compiled ? `${compilerLog.compiled} compiled in ${compilerLog.time}ms${compilerLog.cached ? `, ${compilerLog.cached} cached` : ""}` : `all cached`;
103
+ console.info(` \u{1FA84} [compiler] ${total} file${total === 1 ? "" : "s"} (${detail})`);
104
+ compilerLog.compiled = 0;
105
+ compilerLog.cached = 0;
106
+ compilerLog.time = 0;
107
+ compilerLog.timer = null;
108
+ }, 500);
109
+ compilerLog.timer.unref?.();
120
110
  }
121
- async function performBabelTransform({
122
- id,
123
- code,
124
- projectRoot,
125
- environment,
126
- production,
127
- reactForRNVersion,
128
- optionsIn
129
- }) {
130
- perfStats.babel.totalCalls++;
131
- if (!perfStats.babel.byEnvironment[environment]) {
132
- perfStats.babel.byEnvironment[environment] = {
133
- calls: 0,
134
- transforms: 0,
135
- time: 0
136
- };
137
- }
138
- perfStats.babel.byEnvironment[environment].calls++;
139
- const transformProps = {
140
- id,
141
- code,
142
- projectRoot,
143
- development: !production,
144
- environment,
145
- reactForRNVersion
146
- };
147
- const userTransform = optionsIn?.transform?.(transformProps);
148
- if (userTransform === false) {
149
- return null;
150
- }
151
- if (userTransform !== "swc" && userTransform !== "oxc") {
152
- const babelOptions = (0, import_transformBabel.getBabelOptions)({
153
- ...transformProps,
154
- userSetting: userTransform
155
- });
156
- if (babelOptions) {
157
- const hasCompilerPlugin = babelOptions.plugins?.some(x => Array.isArray(x) && x[0] === "babel-plugin-react-compiler");
158
- const cached = (0, import_cache.getCachedTransform)(id, code, environment);
159
- if (cached) {
160
- perfStats.babel.byEnvironment[environment].transforms++;
161
- if (hasCompilerPlugin && (cached.code.includes("react/compiler-runtime") || cached.code.includes("react-compiler-runtime"))) {
162
- (0, import_constants.debug)?.(` \u{1FA84} [compiler] ${(0, import_node_path.relative)(process.cwd(), id)} (cached)`);
163
- logCompiled(true, 0);
164
- }
165
- (0, import_constants.debug)?.(`[babel/cached] ${id}`);
166
- return cached;
167
- }
168
- const isWorkletPlugin = entry => {
169
- if (!entry) return false;
170
- const name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : null;
171
- return typeof name === "string" && (name.includes("react-native-worklets") || name.includes("react-native-reanimated"));
172
- };
173
- const workletEntry = babelOptions.plugins?.find(isWorkletPlugin);
174
- const workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;
175
- const useWorklets = (0, import_configure.isNativeWorkletsEnabled)() && (Boolean(workletEntry) || (0, import_transformWorklets.shouldTransformWorklets)({
176
- id,
177
- code
178
- }));
179
- let curCode = code;
180
- let workletPreparation = null;
181
- let compilerOut = null;
182
- const compilerPluginIndex = babelOptions.plugins?.findIndex(x => Array.isArray(x) && x[0] === "babel-plugin-react-compiler") ?? -1;
183
- if (compilerPluginIndex !== -1) {
184
- if (useWorklets) {
185
- workletPreparation = (0, import_transformWorklets.prepareWorkletsForReactCompiler)(id, curCode, (0, import_transformSWC.shouldSourceMap)());
186
- if (workletPreparation) curCode = workletPreparation.code;
187
- }
188
- const compilerTarget = babelOptions.plugins[compilerPluginIndex][1]?.target ?? "19";
189
- compilerOut = await (0, import_transformBabel.transformOxcReactCompiler)(id, curCode, compilerTarget, (0, import_transformSWC.shouldSourceMap)());
190
- if (compilerOut) curCode = compilerOut.code;
191
- babelOptions.plugins.splice(compilerPluginIndex, 1);
192
- }
193
- let workletsOut = null;
194
- if (useWorklets) {
195
- workletsOut = await (0, import_transformWorklets.transformWorklets)(id, curCode, (0, import_transformSWC.shouldSourceMap)(), {
196
- projectRoot,
197
- ...workletPluginOptions
198
- });
199
- babelOptions.plugins = babelOptions.plugins?.filter(entry => !isWorkletPlugin(entry));
200
- curCode = workletsOut.code;
201
- }
202
- const startTime = Date.now();
203
- let babelOut = null;
204
- if (babelOptions.plugins?.length === 0) {
205
- let finalMap = void 0;
206
- if ((0, import_transformSWC.shouldSourceMap)()) {
207
- const intermediateMaps = [workletPreparation?.map, compilerOut?.map, workletsOut?.map].filter(Boolean);
208
- if (intermediateMaps.length === 1) {
209
- finalMap = intermediateMaps[0];
210
- } else if (intermediateMaps.length > 1) {
211
- const remapping = (await import("@jridgewell/remapping")).default;
212
- finalMap = remapping(intermediateMaps.slice().reverse(), () => null);
213
- }
214
- }
215
- babelOut = {
216
- code: curCode,
217
- map: finalMap
218
- };
219
- } else {
220
- const babelOptsWithMap = (0, import_transformSWC.shouldSourceMap)() && (workletsOut?.map || compilerOut?.map || workletPreparation?.map) ? {
221
- ...babelOptions,
222
- sourceMaps: true
223
- } : babelOptions;
224
- babelOut = await (0, import_transformBabel.transformBabel)(id, curCode, babelOptsWithMap);
225
- if ((0, import_transformSWC.shouldSourceMap)() && babelOut?.map) {
226
- const priorMaps = [workletPreparation?.map, compilerOut?.map, workletsOut?.map].filter(Boolean);
227
- if (priorMaps.length > 0) {
228
- const remapping = (await import("@jridgewell/remapping")).default;
229
- babelOut.map = remapping([babelOut.map, ...priorMaps.slice().reverse()], () => null);
230
- }
231
- }
232
- }
233
- const babelTime = Date.now() - startTime;
234
- if (babelOut?.code) {
235
- perfStats.babel.totalTransforms++;
236
- perfStats.babel.totalTime += babelTime;
237
- perfStats.babel.byEnvironment[environment].transforms++;
238
- perfStats.babel.byEnvironment[environment].time += babelTime;
239
- if (hasCompilerPlugin && (babelOut.code.includes("react/compiler-runtime") || babelOut.code.includes("react-compiler-runtime"))) {
240
- (0, import_constants.debug)?.(` \u{1FA84} [compiler] ${(0, import_node_path.relative)(process.cwd(), id)} (${babelTime}ms)`);
241
- logCompiled(false, babelTime);
242
- }
243
- (0, import_constants.debug)?.(`[babel] ${id}`);
244
- const outCode = `${babelOut.code}
111
+ async function performBabelTransform({ id, code, projectRoot, environment, production, reactForRNVersion, optionsIn }) {
112
+ perfStats.babel.totalCalls++;
113
+ if (!perfStats.babel.byEnvironment[environment]) {
114
+ perfStats.babel.byEnvironment[environment] = {
115
+ calls: 0,
116
+ transforms: 0,
117
+ time: 0
118
+ };
119
+ }
120
+ perfStats.babel.byEnvironment[environment].calls++;
121
+ const transformProps = {
122
+ id,
123
+ code,
124
+ projectRoot,
125
+ development: !production,
126
+ environment,
127
+ reactForRNVersion
128
+ };
129
+ const userTransform = optionsIn?.transform?.(transformProps);
130
+ if (userTransform === false) {
131
+ return null;
132
+ }
133
+ if (userTransform !== "swc" && userTransform !== "oxc") {
134
+ let babelOptions = (0, import_transformBabel.getBabelOptions)({
135
+ ...transformProps,
136
+ userSetting: userTransform
137
+ });
138
+ if (!babelOptions && (0, import_transformWorklets.shouldTransformWorklets)({
139
+ id,
140
+ code
141
+ })) {
142
+ babelOptions = { plugins: [] };
143
+ }
144
+ if (babelOptions) {
145
+ const hasCompilerPlugin = babelOptions.plugins?.some((x) => Array.isArray(x) && x[0] === "babel-plugin-react-compiler");
146
+ const userBabelConfigPath = typeof babelOptions.configFile === "string" ? babelOptions.configFile : null;
147
+ const cached = (0, import_cache.getCachedTransform)(id, code, environment, userBabelConfigPath);
148
+ if (cached) {
149
+ perfStats.babel.byEnvironment[environment].transforms++;
150
+ if (hasCompilerPlugin && (cached.code.includes("react/compiler-runtime") || cached.code.includes("react-compiler-runtime"))) {
151
+ (0, import_constants.debug)?.(` \u{1FA84} [compiler] ${(0, import_node_path.relative)(process.cwd(), id)} (cached)`);
152
+ logCompiled(true, 0);
153
+ }
154
+ (0, import_constants.debug)?.(`[babel/cached] ${id}`);
155
+ return cached;
156
+ }
157
+ const isWorkletPlugin = (entry) => {
158
+ if (!entry) return false;
159
+ const name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : null;
160
+ return typeof name === "string" && (name.includes("react-native-worklets") || name.includes("react-native-reanimated"));
161
+ };
162
+ const workletEntry = babelOptions.plugins?.find(isWorkletPlugin);
163
+ const workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;
164
+ const useWorklets = (0, import_configure.isNativeWorkletsEnabled)() && (Boolean(workletEntry) || (0, import_transformWorklets.shouldTransformWorklets)({
165
+ id,
166
+ code
167
+ }));
168
+ let curCode = code;
169
+ let workletPreparation = null;
170
+ let compilerOut = null;
171
+ const compilerPluginIndex = babelOptions.plugins?.findIndex((x) => Array.isArray(x) && x[0] === "babel-plugin-react-compiler") ?? -1;
172
+ if (compilerPluginIndex !== -1) {
173
+ const compilerPluginConfig = babelOptions.plugins[compilerPluginIndex];
174
+ const compilerPluginOptions = compilerPluginConfig[1] || {};
175
+ const useBabelCompiler = compilerPluginOptions.compiler === "babel" || process.env.ONE_REACT_COMPILER === "babel" || process.env.VXRN_REACT_COMPILER === "babel";
176
+ if (!useBabelCompiler) {
177
+ if (useWorklets) {
178
+ workletPreparation = (0, import_transformWorklets.prepareWorkletsForReactCompiler)(id, curCode, (0, import_transformSWC.shouldSourceMap)());
179
+ if (workletPreparation) curCode = workletPreparation.code;
180
+ }
181
+ compilerOut = await (0, import_transformBabel.transformOxcReactCompiler)(id, curCode, compilerPluginOptions, (0, import_transformSWC.shouldSourceMap)());
182
+ if (compilerOut) curCode = compilerOut.code;
183
+ babelOptions.plugins.splice(compilerPluginIndex, 1);
184
+ }
185
+ }
186
+ let workletsOut = null;
187
+ if (useWorklets) {
188
+ workletsOut = await (0, import_transformWorklets.transformWorklets)(id, curCode, (0, import_transformSWC.shouldSourceMap)(), {
189
+ projectRoot,
190
+ ...workletPluginOptions
191
+ });
192
+ babelOptions.plugins = babelOptions.plugins?.filter((entry) => !isWorkletPlugin(entry));
193
+ curCode = workletsOut.code;
194
+ }
195
+ const startTime = Date.now();
196
+ let babelOut = null;
197
+ if (babelOptions.plugins?.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) {
198
+ let finalMap = void 0;
199
+ if ((0, import_transformSWC.shouldSourceMap)()) {
200
+ const intermediateMaps = [
201
+ workletPreparation?.map,
202
+ compilerOut?.map,
203
+ workletsOut?.map
204
+ ].filter(Boolean);
205
+ if (intermediateMaps.length === 1) {
206
+ finalMap = intermediateMaps[0];
207
+ } else if (intermediateMaps.length > 1) {
208
+ const remapping = (await import("@jridgewell/remapping")).default;
209
+ finalMap = remapping(intermediateMaps.slice().reverse(), () => null);
210
+ }
211
+ }
212
+ babelOut = {
213
+ code: curCode,
214
+ map: finalMap
215
+ };
216
+ } else {
217
+ const babelOptsWithMap = (0, import_transformSWC.shouldSourceMap)() && (workletsOut?.map || compilerOut?.map || workletPreparation?.map) ? {
218
+ ...babelOptions,
219
+ sourceMaps: true
220
+ } : babelOptions;
221
+ babelOut = await (0, import_transformBabel.transformBabel)(id, curCode, babelOptsWithMap);
222
+ if ((0, import_transformSWC.shouldSourceMap)() && babelOut?.map) {
223
+ const priorMaps = [
224
+ workletPreparation?.map,
225
+ compilerOut?.map,
226
+ workletsOut?.map
227
+ ].filter(Boolean);
228
+ if (priorMaps.length > 0) {
229
+ const remapping = (await import("@jridgewell/remapping")).default;
230
+ babelOut.map = remapping([babelOut.map, ...priorMaps.slice().reverse()], () => null);
231
+ }
232
+ }
233
+ }
234
+ const babelTime = Date.now() - startTime;
235
+ if (babelOut?.code) {
236
+ perfStats.babel.totalTransforms++;
237
+ perfStats.babel.totalTime += babelTime;
238
+ perfStats.babel.byEnvironment[environment].transforms++;
239
+ perfStats.babel.byEnvironment[environment].time += babelTime;
240
+ if (hasCompilerPlugin && (babelOut.code.includes("react/compiler-runtime") || babelOut.code.includes("react-compiler-runtime"))) {
241
+ (0, import_constants.debug)?.(` \u{1FA84} [compiler] ${(0, import_node_path.relative)(process.cwd(), id)} (${babelTime}ms)`);
242
+ logCompiled(false, babelTime);
243
+ }
244
+ (0, import_constants.debug)?.(`[babel] ${id}`);
245
+ const outCode = `${babelOut.code}
245
246
  // vxrn-did-babel`;
246
- const result = {
247
- code: outCode,
248
- map: babelOut.map
249
- };
250
- (0, import_cache.setCachedTransform)(id, code, result, environment);
251
- return result;
252
- }
253
- }
254
- }
255
- return null;
247
+ const result = {
248
+ code: outCode,
249
+ map: babelOut.map
250
+ };
251
+ (0, import_cache.setCachedTransform)(id, code, result, environment, userBabelConfigPath);
252
+ return result;
253
+ }
254
+ }
255
+ }
256
+ return null;
256
257
  }
257
258
  async function createVXRNCompilerPlugin(optionsIn) {
258
- const reactVersion = await (async () => {
259
- const path = (0, import_utils.resolvePath)("react/package.json");
260
- const json = JSON.parse(await (0, import_promises.readFile)(path, "utf-8"));
261
- return json.version;
262
- })();
263
- const envNames = {
264
- ios: true,
265
- android: true,
266
- client: true,
267
- ssr: true
268
- };
269
- function getEnvName(name) {
270
- if (name === "worker") return "ssr";
271
- if (!envNames[name]) throw new Error(`Invalid env: ${name}`);
272
- return name;
273
- }
274
- const reactForRNVersion = reactVersion.split(".")[0];
275
- const cssTransformCache = /* @__PURE__ */new Map();
276
- const rolldownPath = (0, import_utils.resolvePath)("rolldown");
277
- const rolldownNodeMods = rolldownPath.slice(0, rolldownPath.indexOf(import_node_path.sep + "node_modules"));
278
- let config;
279
- return [{
280
- name: "one:compiler-resolve-refresh-runtime",
281
- apply: "serve",
282
- enforce: "pre",
283
- // Run before Vite default resolve to avoid syscalls
284
- resolveId: id => id === import_constants.runtimePublicPath || id === `${import_constants.runtimePublicPath}.map` ? id : void 0,
285
- load: id => {
286
- const basePath = (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
287
- if (id === import_constants.runtimePublicPath) {
288
- return (0, import_node_fs.readFileSync)((0, import_node_path.join)(basePath, "refresh-runtime.mjs"), "utf-8").replace(/\/\/# sourceMappingURL=.*/, "");
289
- }
290
- if (id === `${import_constants.runtimePublicPath}.map`) {
291
- return JSON.stringify({
292
- version: 3,
293
- sources: [],
294
- mappings: ""
295
- });
296
- }
297
- return void 0;
298
- }
299
- }, {
300
- name: `one:compiler-css-to-js`,
301
- // only .css files can match, so let rust reject everything else
302
- transform: {
303
- filter: {
304
- id: /\.css$/
305
- },
306
- handler(codeIn, id) {
307
- const environment = getEnvName(this.environment.name);
308
- if (import_configure.configuration.enableNativeCSS && (environment === "ios" || environment === "android")) {
309
- {
310
- const data = JSON.stringify((0, import_css_to_rn.cssToReactNativeRuntime)(codeIn, {
311
- inlineRem: 16
312
- }));
313
- const code = `require("nativewind/dist/index.js").__require().StyleSheet.registerCompiled(${data})`;
314
- const newId = `${id}.js`;
315
- const cssId = newId.replace(rolldownNodeMods + import_node_path.sep, "");
316
- cssTransformCache.set(cssId, code);
317
- return {
318
- code,
319
- id: newId,
320
- map: null
321
- };
322
- }
323
- }
324
- }
325
- },
326
- generateBundle(_, bundle) {
327
- const environment = getEnvName(this.environment.name);
328
- if (import_configure.configuration.enableNativeCSS && (environment === "ios" || environment === "android")) {
329
- const rootJSName = Object.keys(bundle).find(i => {
330
- const chunk = bundle[i];
331
- return chunk.type == "chunk" && chunk.fileName.match(/.[cm]?js(?:\?.+)?$/) != null;
332
- });
333
- if (!rootJSName) {
334
- throw new Error(`Can't find root js, internal one error`);
335
- }
336
- const rootJS = bundle[rootJSName];
337
- const cssAssets = Object.keys(bundle).filter(i => bundle[i].fileName.endsWith(".css.js"));
338
- for (const name of cssAssets) {
339
- delete bundle[name];
340
- const jsCSS = cssTransformCache.get(name);
341
- rootJS.code = `
259
+ const reactVersion = await (async () => {
260
+ const path = (0, import_utils.resolvePath)("react/package.json");
261
+ const json = JSON.parse(await (0, import_promises.readFile)(path, "utf-8"));
262
+ return json.version;
263
+ })();
264
+ const envNames = {
265
+ ios: true,
266
+ android: true,
267
+ client: true,
268
+ ssr: true
269
+ };
270
+ function getEnvName(name) {
271
+ if (name === "worker") return "ssr";
272
+ if (!envNames[name]) throw new Error(`Invalid env: ${name}`);
273
+ return name;
274
+ }
275
+ const reactForRNVersion = reactVersion.split(".")[0];
276
+ const cssTransformCache = /* @__PURE__ */ new Map();
277
+ const rolldownPath = (0, import_utils.resolvePath)("rolldown");
278
+ const rolldownNodeMods = rolldownPath.slice(0, rolldownPath.indexOf(import_node_path.sep + "node_modules"));
279
+ let config;
280
+ return [
281
+ {
282
+ name: "one:compiler-resolve-refresh-runtime",
283
+ apply: "serve",
284
+ enforce: "pre",
285
+ resolveId: (id) => id === import_constants.runtimePublicPath || id === `${import_constants.runtimePublicPath}.map` ? id : void 0,
286
+ load: (id) => {
287
+ const basePath = (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
288
+ if (id === import_constants.runtimePublicPath) {
289
+ return (0, import_node_fs.readFileSync)((0, import_node_path.join)(basePath, "refresh-runtime.mjs"), "utf-8").replace(/\/\/# sourceMappingURL=.*/, "");
290
+ }
291
+ if (id === `${import_constants.runtimePublicPath}.map`) {
292
+ return JSON.stringify({
293
+ version: 3,
294
+ sources: [],
295
+ mappings: ""
296
+ });
297
+ }
298
+ return void 0;
299
+ }
300
+ },
301
+ {
302
+ name: `one:compiler-css-to-js`,
303
+ transform: {
304
+ filter: { id: /\.css$/ },
305
+ handler(codeIn, id) {
306
+ const environment = getEnvName(this.environment.name);
307
+ if (import_configure.configuration.enableNativeCSS && (environment === "ios" || environment === "android")) {
308
+ {
309
+ const data = JSON.stringify((0, import_css_to_rn.cssToReactNativeRuntime)(codeIn, { inlineRem: 16 }));
310
+ const code = `require("nativewind/dist/index.js").__require().StyleSheet.registerCompiled(${data})`;
311
+ const newId = `${id}.js`;
312
+ const cssId = newId.replace(rolldownNodeMods + import_node_path.sep, "");
313
+ cssTransformCache.set(cssId, code);
314
+ return {
315
+ code,
316
+ id: newId,
317
+ map: null
318
+ };
319
+ }
320
+ }
321
+ }
322
+ },
323
+ generateBundle(_, bundle) {
324
+ const environment = getEnvName(this.environment.name);
325
+ if (import_configure.configuration.enableNativeCSS && (environment === "ios" || environment === "android")) {
326
+ const rootJSName = Object.keys(bundle).find((i) => {
327
+ const chunk = bundle[i];
328
+ return chunk.type == "chunk" && chunk.fileName.match(/.[cm]?js(?:\?.+)?$/) != null;
329
+ });
330
+ if (!rootJSName) {
331
+ throw new Error(`Can't find root js, internal one error`);
332
+ }
333
+ const rootJS = bundle[rootJSName];
334
+ const cssAssets = Object.keys(bundle).filter((i) => bundle[i].fileName.endsWith(".css.js"));
335
+ for (const name of cssAssets) {
336
+ delete bundle[name];
337
+ const jsCSS = cssTransformCache.get(name);
338
+ rootJS.code = `
342
339
  ${jsCSS}
343
340
  ${rootJS.code}
344
341
  `;
345
- }
346
- }
347
- }
348
- }, {
349
- name: "one:compiler",
350
- enforce: "pre",
351
- config: () => {
352
- const nodeModulesFilter = /node_modules[/\\].*\.(tsx?|jsx?|mjs|cjs)$/;
353
- const createEnvironmentConfig = environment => {
354
- if (!perfStats.optimizeDeps.byEnvironment[environment]) {
355
- perfStats.optimizeDeps.byEnvironment[environment] = {
356
- filesChecked: 0,
357
- filesTransformed: 0,
358
- startTime: Date.now()
359
- };
360
- }
361
- return {
362
- optimizeDeps: {
363
- rolldownOptions: {
364
- plugins: [{
365
- name: `transform-before-optimize-deps-${environment}`,
366
- async transform(code, id) {
367
- if (!nodeModulesFilter.test(id)) {
368
- return null;
369
- }
370
- perfStats.optimizeDeps.byEnvironment[environment].filesChecked++;
371
- const production = process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test";
372
- (0, import_constants.debug)?.(`[rolldown optimizeDeps] ${id}`);
373
- const result = await performBabelTransform({
374
- id,
375
- code,
376
- projectRoot: config.root,
377
- environment,
378
- production,
379
- reactForRNVersion,
380
- optionsIn
381
- });
382
- if (!result) {
383
- return null;
384
- }
385
- perfStats.optimizeDeps.byEnvironment[environment].filesTransformed++;
386
- return {
387
- code: result.code,
388
- map: result.map
389
- };
390
- },
391
- buildEnd() {
392
- if (process.env.DEBUG_COMPILER_PERF) {
393
- const stats = perfStats.optimizeDeps.byEnvironment[environment];
394
- const elapsed = Date.now() - stats.startTime;
395
- console.info(`[optimizeDeps ${environment}] Done: ${stats.filesChecked} files checked, ${stats.filesTransformed} transformed (${elapsed}ms)`);
396
- }
397
- const allDone = Object.keys(perfStats.optimizeDeps.byEnvironment).length >= 2;
398
- if (allDone) {
399
- (0, import_cache.logCacheStats)();
400
- logPerfSummary();
401
- }
402
- }
403
- }]
404
- }
405
- },
406
- define: {
407
- "process.env.NATIVEWIND_OS": JSON.stringify(environment === "ios" || environment === "android" ? "native" : "web")
408
- }
409
- };
410
- };
411
- return {
412
- environments: {
413
- ios: createEnvironmentConfig("ios"),
414
- android: createEnvironmentConfig("android"),
415
- client: createEnvironmentConfig("client"),
416
- ssr: createEnvironmentConfig("ssr")
417
- }
418
- };
419
- },
420
- configResolved(resolvedConfig) {
421
- config = resolvedConfig;
422
- },
423
- async transform(codeIn, _id) {
424
- let code = codeIn;
425
- const environment = getEnvName(this.environment.name);
426
- const isNative = environment === "ios" || environment === "android";
427
- const production = config.command === "build" || process.env.NODE_ENV === "production" || JSON.parse(this.environment.config?.define?.["process.env.NODE_ENV"] || '""') === "production";
428
- const isEntry = _id.includes("one-entry-native");
429
- if (isEntry) {
430
- if (isNative && !production) {
431
- code = `import '@vxrn/vite-native-client'
342
+ }
343
+ }
344
+ }
345
+ },
346
+ {
347
+ name: "one:compiler",
348
+ enforce: "pre",
349
+ config: () => {
350
+ const nodeModulesFilter = /node_modules[/\\].*\.(tsx?|jsx?|mjs|cjs)$/;
351
+ const createEnvironmentConfig = (environment) => {
352
+ if (!perfStats.optimizeDeps.byEnvironment[environment]) {
353
+ perfStats.optimizeDeps.byEnvironment[environment] = {
354
+ filesChecked: 0,
355
+ filesTransformed: 0,
356
+ startTime: Date.now()
357
+ };
358
+ }
359
+ return {
360
+ optimizeDeps: { rolldownOptions: { plugins: [{
361
+ name: `transform-before-optimize-deps-${environment}`,
362
+ async transform(code, id) {
363
+ if (!nodeModulesFilter.test(id)) {
364
+ return null;
365
+ }
366
+ perfStats.optimizeDeps.byEnvironment[environment].filesChecked++;
367
+ const production = process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test";
368
+ (0, import_constants.debug)?.(`[rolldown optimizeDeps] ${id}`);
369
+ const result = await performBabelTransform({
370
+ id,
371
+ code,
372
+ projectRoot: config.root,
373
+ environment,
374
+ production,
375
+ reactForRNVersion,
376
+ optionsIn
377
+ });
378
+ if (!result) {
379
+ return null;
380
+ }
381
+ perfStats.optimizeDeps.byEnvironment[environment].filesTransformed++;
382
+ return {
383
+ code: result.code,
384
+ map: result.map
385
+ };
386
+ },
387
+ buildEnd() {
388
+ if (process.env.DEBUG_COMPILER_PERF) {
389
+ const stats = perfStats.optimizeDeps.byEnvironment[environment];
390
+ const elapsed = Date.now() - stats.startTime;
391
+ console.info(`[optimizeDeps ${environment}] Done: ${stats.filesChecked} files checked, ${stats.filesTransformed} transformed (${elapsed}ms)`);
392
+ }
393
+ const allDone = Object.keys(perfStats.optimizeDeps.byEnvironment).length >= 2;
394
+ if (allDone) {
395
+ (0, import_cache.logCacheStats)();
396
+ logPerfSummary();
397
+ }
398
+ }
399
+ }] } },
400
+ define: { "process.env.NATIVEWIND_OS": JSON.stringify(environment === "ios" || environment === "android" ? "native" : "web") }
401
+ };
402
+ };
403
+ return { environments: {
404
+ ios: createEnvironmentConfig("ios"),
405
+ android: createEnvironmentConfig("android"),
406
+ client: createEnvironmentConfig("client"),
407
+ ssr: createEnvironmentConfig("ssr")
408
+ } };
409
+ },
410
+ configResolved(resolvedConfig) {
411
+ config = resolvedConfig;
412
+ },
413
+ async transform(codeIn, _id) {
414
+ let code = codeIn;
415
+ const environment = getEnvName(this.environment.name);
416
+ const isNative = environment === "ios" || environment === "android";
417
+ const production = config.command === "build" || process.env.NODE_ENV === "production" || JSON.parse(this.environment.config?.define?.["process.env.NODE_ENV"] || "\"\"") === "production";
418
+ const isEntry = _id.includes("one-entry-native");
419
+ if (isEntry) {
420
+ if (isNative && !production) {
421
+ code = `import '@vxrn/vite-native-client'
432
422
  ${code}`;
433
- }
434
- if (isNative && import_configure.configuration.enableNativewind) {
435
- code = `import * as x from 'nativewind'
423
+ }
424
+ if (isNative && import_configure.configuration.enableNativewind) {
425
+ code = `import * as x from 'nativewind'
436
426
  ${code}`;
437
- }
438
- return code;
439
- }
440
- const id = _id.split("?")[0];
441
- const extension = (0, import_node_path.extname)(id);
442
- if (extension === ".css" || !import_constants.validParsers.has(extension)) {
443
- return;
444
- }
445
- if (id.includes(`virtual:`)) {
446
- return;
447
- }
448
- if (codeIn.endsWith(`// vxrn-did-babel`)) {
449
- (0, import_constants.debug)?.(`[skip babel] ${id}`);
450
- return;
451
- }
452
- return performBabelTransform({
453
- id,
454
- code: codeIn,
455
- projectRoot: config.root,
456
- environment,
457
- production,
458
- reactForRNVersion,
459
- optionsIn
460
- });
461
- }
462
- },
463
- // wraps client-side TSX/JSX with React Refresh preamble + import.meta.hot.accept
464
- // runs after vite:oxc (no enforce:'pre') so it sees the already-transformed code
465
- {
466
- name: "one:react-refresh-web",
467
- apply: "serve",
468
- transform(code, _id) {
469
- if (this.environment.name !== "client") return;
470
- if (code.includes(import_constants.runtimePublicPath)) return;
471
- const id = _id.split("?")[0];
472
- if (id.includes("node_modules")) return;
473
- if (id.includes("virtual:")) return;
474
- if (id === import_constants.runtimePublicPath) return;
475
- const ext = (0, import_node_path.extname)(id);
476
- if (ext !== ".tsx" && ext !== ".jsx") return;
477
- const hasRefreshCalls = /\$RefreshReg\$\(/.test(code);
478
- let out = `import * as RefreshRuntime from "${import_constants.runtimePublicPath}";
427
+ }
428
+ return code;
429
+ }
430
+ const id = _id.split("?")[0];
431
+ const extension = (0, import_node_path.extname)(id);
432
+ if (extension === ".css" || !import_constants.validParsers.has(extension)) {
433
+ return;
434
+ }
435
+ if (id.includes(`virtual:`)) {
436
+ return;
437
+ }
438
+ if (codeIn.endsWith(`// vxrn-did-babel`)) {
439
+ (0, import_constants.debug)?.(`[skip babel] ${id}`);
440
+ return;
441
+ }
442
+ return performBabelTransform({
443
+ id,
444
+ code: codeIn,
445
+ projectRoot: config.root,
446
+ environment,
447
+ production,
448
+ reactForRNVersion,
449
+ optionsIn
450
+ });
451
+ }
452
+ },
453
+ {
454
+ name: "one:react-refresh-web",
455
+ apply: "serve",
456
+ transform(code, _id) {
457
+ if (this.environment.name !== "client") return;
458
+ if (code.includes(import_constants.runtimePublicPath)) return;
459
+ if (/[?&](?:worker|sharedworker|raw|url)\b/.test(_id)) return;
460
+ const id = _id.split("?")[0];
461
+ if (id.includes("node_modules")) return;
462
+ if (id.includes("virtual:")) return;
463
+ if (id === import_constants.runtimePublicPath) return;
464
+ const ext = (0, import_node_path.extname)(id);
465
+ if (ext !== ".tsx" && ext !== ".jsx") return;
466
+ const hasRefreshCalls = /\$RefreshReg\$\(/.test(code);
467
+ let out = `import * as RefreshRuntime from "${import_constants.runtimePublicPath}";
479
468
 
480
469
  `;
481
- if (hasRefreshCalls) {
482
- out += `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
470
+ if (hasRefreshCalls) {
471
+ out += `if (!window.$RefreshReg$) throw new Error("React refresh preamble was not loaded. Something is wrong.");
483
472
  const prevRefreshReg = window.$RefreshReg$;
484
473
  const prevRefreshSig = window.$RefreshSig$;
485
474
  window.$RefreshReg$ = RefreshRuntime.getRefreshReg("${id}");
486
475
  window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
487
476
 
488
477
  `;
489
- }
490
- out += code;
491
- if (hasRefreshCalls) {
492
- out += `
478
+ }
479
+ out += code;
480
+ if (hasRefreshCalls) {
481
+ out += `
493
482
 
494
483
  window.$RefreshReg$ = prevRefreshReg;
495
484
  window.$RefreshSig$ = prevRefreshSig;
496
485
  `;
497
- }
498
- out += `
486
+ }
487
+ out += `
499
488
  RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
500
489
  RefreshRuntime.registerExportsForReactRefresh("${id}", currentExports);
501
490
  import.meta.hot.accept((nextExports) => {
@@ -505,10 +494,11 @@ RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
505
494
  });
506
495
  });
507
496
  `;
508
- return {
509
- code: out,
510
- map: null
511
- };
512
- }
513
- }];
514
- }
497
+ return {
498
+ code: out,
499
+ map: null
500
+ };
501
+ }
502
+ }
503
+ ];
504
+ }