@vxrn/compiler 2.0.0-beta.150.1 → 2.0.0-beta.158.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.
@@ -52,6 +52,7 @@ __reExport(index_exports, require("./transformWorklets.cjs"), module.exports);
52
52
  __reExport(index_exports, require("./reactNativeCodegen.cjs"), module.exports);
53
53
  __reExport(index_exports, require("./transformHermesLoops.cjs"), module.exports);
54
54
  __reExport(index_exports, require("./transformHermesAsync.cjs"), module.exports);
55
+ __reExport(index_exports, require("./transformHermesClasses.cjs"), module.exports);
55
56
  var import_cache2 = require("./cache.cjs");
56
57
  var import_globals = require("./worklets/globals.cjs");
57
58
  var import_scope = require("./worklets/scope.cjs");
@@ -80,6 +80,7 @@ function getBabelOptions(props) {
80
80
  if (typeof props.userSetting === "undefined" || typeof props.userSetting === "object" && props.userSetting.transform === "babel") {
81
81
  if (props.userSetting?.excludeDefaultPlugins) {
82
82
  return {
83
+ caller: getBabelCaller(props),
83
84
  ...props.userSetting,
84
85
  ...userBabelConfig ? {
85
86
  configFile: userBabelConfig,
@@ -123,6 +124,7 @@ const getOptions = (props, force = false, userBabelConfig = null) => {
123
124
  if (plugins.length || userBabelConfig) {
124
125
  return {
125
126
  plugins,
127
+ caller: getBabelCaller(props),
126
128
  ...userBabelConfig ? {
127
129
  configFile: userBabelConfig,
128
130
  babelrc: true
@@ -131,6 +133,14 @@ const getOptions = (props, force = false, userBabelConfig = null) => {
131
133
  }
132
134
  return null;
133
135
  };
136
+ function getBabelCaller(props) {
137
+ const caller = {
138
+ name: "vxrn",
139
+ platform: props.environment === "ios" || props.environment === "android" ? props.environment : "web",
140
+ isDev: props.development
141
+ };
142
+ return caller;
143
+ }
134
144
  async function transformOxcReactCompiler(id, code, optionsOrTarget = "19", sourceMap = false) {
135
145
  const { transform } = await import("oxc-transform-react");
136
146
  const compilerOptions = typeof optionsOrTarget === "string" ? { target: optionsOrTarget } : optionsOrTarget || {};
@@ -171,8 +181,13 @@ async function transformBabel(id, code, options) {
171
181
  sourceMaps: false,
172
182
  minified: false,
173
183
  ...options,
184
+ ...!isTS ? { parserOpts: {
185
+ ...options.parserOpts,
186
+ plugins: [...options.parserOpts?.plugins || [], "jsx"]
187
+ } } : {},
174
188
  caller: {
175
189
  name: "vxrn",
190
+ ...options.caller,
176
191
  supportsStaticESM: true,
177
192
  supportsDynamicImport: true
178
193
  },
@@ -0,0 +1,50 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
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;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var transformHermesClasses_exports = {};
28
+ __export(transformHermesClasses_exports, { transformHermesClasses: () => transformHermesClasses });
29
+ module.exports = __toCommonJS(transformHermesClasses_exports);
30
+ async function transformHermesClasses(code, filename, sourceMaps = false) {
31
+ if (!/\b(?:class(?:\s|\{)|(?:let|const)\s)/.test(code)) return;
32
+ const [{ transformAsync }, { default: transformClasses }, { default: transformBlockScoping }] = await Promise.all([
33
+ import("@babel/core"),
34
+ import("@babel/plugin-transform-classes"),
35
+ import("@babel/plugin-transform-block-scoping")
36
+ ]);
37
+ const result = await transformAsync(code, {
38
+ filename,
39
+ babelrc: false,
40
+ configFile: false,
41
+ sourceMaps,
42
+ parserOpts: { plugins: ["jsx"] },
43
+ plugins: [transformClasses, transformBlockScoping]
44
+ });
45
+ if (!result?.code) return;
46
+ return {
47
+ code: result.code,
48
+ map: result.map
49
+ };
50
+ }
@@ -46,7 +46,7 @@ function shouldStripFlow(id, code) {
46
46
  return true;
47
47
  }
48
48
  const header = code.match(/^(?:#![^\r\n]*(?:\r?\n|$))?(?:\s|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)*/)?.[0] || "";
49
- return /@flow\b/.test(header) || /\b(?:import|export)\s+type\b/.test(code);
49
+ return /@flow\b/.test(header) || /\b(?:import|export)\s+type\b/.test(code) || /\(\s*(?:\.\.\.)?[\w$]+\??\s*:\s*/.test(code) || /\)\s*:\s*(?:[\w$]+(?:<[^;{}]*>)?(?:\[\])?\s*)(?:=>|\{)/.test(code) || /^\s*[\w$]+\??\s*:\s*(?:string|number|boolean|any|mixed|void|[A-Z][\w$]*)(?:[^;\r\n=]*)(?:=[^;\r\n]*)?;/m.test(code) || /\b(?:opaque\s+)?type\s+[\w$]+(?:\s*<[^;{}]*>)?\s*=/.test(code);
50
50
  }
51
51
  async function transformSWC(id, code, options, swcOptions) {
52
52
  id = (0, import_vite.normalizePath)(id.split("?")[0]).replace((0, import_vite.normalizePath)(process.cwd()), "");
@@ -119,7 +119,28 @@ const DEFAULT_GLOBALS = /* @__PURE__ */ new Set([
119
119
  "setInterval",
120
120
  "clearInterval",
121
121
  "HermesInternal",
122
- "_WORKLET"
122
+ "_WORKLET",
123
+ "ReanimatedError",
124
+ "__reanimatedLoggerConfig",
125
+ "_IS_FABRIC",
126
+ "_log",
127
+ "_toString",
128
+ "_scheduleHostFunctionOnJS",
129
+ "_scheduleRemoteFunctionOnJS",
130
+ "_scheduleOnRuntime",
131
+ "_makeShareableClone",
132
+ "_updatePropsPaper",
133
+ "_updatePropsFabric",
134
+ "_measurePaper",
135
+ "_measureFabric",
136
+ "_scrollToPaper",
137
+ "_dispatchCommandPaper",
138
+ "_dispatchCommandFabric",
139
+ "_setGestureState",
140
+ "_notifyAboutProgress",
141
+ "_notifyAboutEnd",
142
+ "_runOnUIQueue",
143
+ "_getAnimationTimestamp"
123
144
  ]);
124
145
  function createGlobalsSet(customGlobals, strictGlobal) {
125
146
  const set = /* @__PURE__ */ new Set();
package/dist/esm/index.js CHANGED
@@ -27,6 +27,8 @@ export * from "./transformHermesLoops.mjs"
27
27
 
28
28
  export * from "./transformHermesAsync.mjs"
29
29
 
30
+ export * from "./transformHermesClasses.mjs"
31
+
30
32
  const perfStats = {
31
33
  babel: {
32
34
  totalCalls: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, extname, join, relative, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { resolvePath } from \"@vxrn/utils\";\nimport { cssToReactNativeRuntime } from \"react-native-css-interop/css-to-rn/index.js\";\nimport { configuration, isNativeWorkletsEnabled } from \"./configure\";\nimport { debug, runtimePublicPath, validParsers } from \"./constants\";\nimport {\n getBabelOptions,\n transformBabel,\n transformOxcReactCompiler\n} from \"./transformBabel\";\nimport { shouldSourceMap } from \"./transformSWC\";\nimport {\n prepareWorkletsForReactCompiler,\n shouldTransformWorklets,\n transformWorklets\n} from \"./transformWorklets\";\nimport { getCachedTransform, logCacheStats, setCachedTransform } from \"./cache\";\nexport * from \"./configure\";\nexport * from \"./transformBabel\";\nexport * from \"./transformSWC\";\nexport * from \"./transformWorklets\";\nexport * from \"./reactNativeCodegen\";\nexport * from \"./transformHermesLoops\";\nexport * from \"./transformHermesAsync\";\nimport { clearTransformCache } from \"./cache\";\nimport { JS_GLOBALS } from \"./worklets/globals\";\nimport { getClosureVariables } from \"./worklets/scope\";\nconst perfStats = {\n babel: {\n totalCalls: 0,\n totalTransforms: 0,\n totalTime: 0,\n byEnvironment: {}\n },\n optimizeDeps: {\n byEnvironment: {}\n }\n};\nfunction logPerfSummary() {\n if (!process.env.DEBUG_COMPILER_PERF) {\n return;\n }\n console.info(\"\\n\\u{1F4CA} [Compiler Performance Summary]\");\n console.info(\n `Babel: ${perfStats.babel.totalTransforms} transforms / ${perfStats.babel.totalCalls} calls (${(perfStats.babel.totalTransforms / Math.max(perfStats.babel.totalCalls, 1) * 100).toFixed(1)}% transform rate)`\n );\n console.info(`Babel total time: ${perfStats.babel.totalTime}ms`);\n for (const [env, stats] of Object.entries(perfStats.babel.byEnvironment)) {\n if (stats.transforms > 0) {\n console.info(\n ` ${env}: ${stats.transforms} transforms, ${stats.time}ms (${(stats.time / stats.transforms).toFixed(1)}ms avg)`\n );\n }\n }\n for (const [env, stats] of Object.entries(perfStats.optimizeDeps.byEnvironment)) {\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `optimizeDeps ${env}: checked ${stats.filesChecked} files, transformed ${stats.filesTransformed} (${elapsed}ms)`\n );\n }\n}\nconst compilerLog = {\n compiled: 0,\n cached: 0,\n time: 0,\n // typed loose because the dom lib types setTimeout as number, but node gives\n // us a Timeout we need to unref so the debounce never holds the process open\n timer: null\n};\nfunction logCompiled(cached, ms) {\n if (cached) {\n compilerLog.cached++;\n } else {\n compilerLog.compiled++;\n compilerLog.time += ms;\n }\n if (compilerLog.timer) clearTimeout(compilerLog.timer);\n compilerLog.timer = setTimeout(() => {\n const total = compilerLog.compiled + compilerLog.cached;\n const detail = compilerLog.compiled ? `${compilerLog.compiled} compiled in ${compilerLog.time}ms${compilerLog.cached ? `, ${compilerLog.cached} cached` : \"\"}` : `all cached`;\n console.info(` \\u{1FA84} [compiler] ${total} file${total === 1 ? \"\" : \"s\"} (${detail})`);\n compilerLog.compiled = 0;\n compilerLog.cached = 0;\n compilerLog.time = 0;\n compilerLog.timer = null;\n }, 500);\n compilerLog.timer.unref?.();\n}\nasync function performBabelTransform({\n id,\n code,\n projectRoot,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n}) {\n perfStats.babel.totalCalls++;\n if (!perfStats.babel.byEnvironment[environment]) {\n perfStats.babel.byEnvironment[environment] = { calls: 0, transforms: 0, time: 0 };\n }\n perfStats.babel.byEnvironment[environment].calls++;\n const transformProps = {\n id,\n code,\n projectRoot,\n development: !production,\n environment,\n reactForRNVersion\n };\n const userTransform = optionsIn?.transform?.(transformProps);\n if (userTransform === false) {\n return null;\n }\n if (userTransform !== \"swc\" && userTransform !== \"oxc\") {\n const babelOptions = getBabelOptions({\n ...transformProps,\n userSetting: userTransform\n });\n if (babelOptions) {\n const hasCompilerPlugin = babelOptions.plugins?.some(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n );\n const userBabelConfigPath = typeof babelOptions.configFile === \"string\" ? babelOptions.configFile : null;\n const cached = getCachedTransform(id, code, environment, userBabelConfigPath);\n if (cached) {\n perfStats.babel.byEnvironment[environment].transforms++;\n if (hasCompilerPlugin && (cached.code.includes(\"react/compiler-runtime\") || cached.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (cached)`);\n logCompiled(true, 0);\n }\n debug?.(`[babel/cached] ${id}`);\n return cached;\n }\n const isWorkletPlugin = (entry) => {\n if (!entry) return false;\n const name = typeof entry === \"string\" ? entry : Array.isArray(entry) ? entry[0] : null;\n return typeof name === \"string\" && (name.includes(\"react-native-worklets\") || name.includes(\"react-native-reanimated\"));\n };\n const workletEntry = babelOptions.plugins?.find(isWorkletPlugin);\n const workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;\n const useWorklets = isNativeWorkletsEnabled() && (Boolean(workletEntry) || shouldTransformWorklets({ id, code }));\n let curCode = code;\n let workletPreparation = null;\n let compilerOut = null;\n const compilerPluginIndex = babelOptions.plugins?.findIndex(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n ) ?? -1;\n if (compilerPluginIndex !== -1) {\n const compilerPluginConfig = babelOptions.plugins[compilerPluginIndex];\n const compilerPluginOptions = compilerPluginConfig[1] || {};\n const useBabelCompiler = compilerPluginOptions.compiler === \"babel\" || process.env.ONE_REACT_COMPILER === \"babel\" || process.env.VXRN_REACT_COMPILER === \"babel\";\n if (!useBabelCompiler) {\n if (useWorklets) {\n workletPreparation = prepareWorkletsForReactCompiler(\n id,\n curCode,\n shouldSourceMap()\n );\n if (workletPreparation) curCode = workletPreparation.code;\n }\n compilerOut = await transformOxcReactCompiler(\n id,\n curCode,\n compilerPluginOptions,\n shouldSourceMap()\n );\n if (compilerOut) curCode = compilerOut.code;\n babelOptions.plugins.splice(compilerPluginIndex, 1);\n }\n }\n let workletsOut = null;\n if (useWorklets) {\n workletsOut = await transformWorklets(id, curCode, shouldSourceMap(), {\n projectRoot,\n ...workletPluginOptions\n });\n babelOptions.plugins = babelOptions.plugins?.filter(\n (entry) => !isWorkletPlugin(entry)\n );\n curCode = workletsOut.code;\n }\n const startTime = Date.now();\n let babelOut = null;\n if (babelOptions.plugins?.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) {\n let finalMap = void 0;\n if (shouldSourceMap()) {\n const intermediateMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (intermediateMaps.length === 1) {\n finalMap = intermediateMaps[0];\n } else if (intermediateMaps.length > 1) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n finalMap = remapping(intermediateMaps.slice().reverse(), () => null);\n }\n }\n babelOut = { code: curCode, map: finalMap };\n } else {\n const babelOptsWithMap = shouldSourceMap() && (workletsOut?.map || compilerOut?.map || workletPreparation?.map) ? { ...babelOptions, sourceMaps: true } : babelOptions;\n babelOut = await transformBabel(id, curCode, babelOptsWithMap);\n if (shouldSourceMap() && babelOut?.map) {\n const priorMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (priorMaps.length > 0) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n babelOut.map = remapping(\n [babelOut.map, ...priorMaps.slice().reverse()],\n () => null\n );\n }\n }\n }\n const babelTime = Date.now() - startTime;\n if (babelOut?.code) {\n perfStats.babel.totalTransforms++;\n perfStats.babel.totalTime += babelTime;\n perfStats.babel.byEnvironment[environment].transforms++;\n perfStats.babel.byEnvironment[environment].time += babelTime;\n if (hasCompilerPlugin && (babelOut.code.includes(\"react/compiler-runtime\") || babelOut.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (${babelTime}ms)`);\n logCompiled(false, babelTime);\n }\n debug?.(`[babel] ${id}`);\n const outCode = `${babelOut.code}\n// vxrn-did-babel`;\n const result = { code: outCode, map: babelOut.map };\n setCachedTransform(id, code, result, environment, userBabelConfigPath);\n return result;\n }\n }\n }\n return null;\n}\nasync function createVXRNCompilerPlugin(optionsIn) {\n const reactVersion = await (async () => {\n const path = resolvePath(\"react/package.json\");\n const json = JSON.parse(await readFile(path, \"utf-8\"));\n return json.version;\n })();\n const envNames = {\n ios: true,\n android: true,\n client: true,\n ssr: true\n };\n function getEnvName(name) {\n if (name === \"worker\") return \"ssr\";\n if (!envNames[name]) throw new Error(`Invalid env: ${name}`);\n return name;\n }\n const reactForRNVersion = reactVersion.split(\".\")[0];\n const cssTransformCache = /* @__PURE__ */ new Map();\n const rolldownPath = resolvePath(\"rolldown\");\n const rolldownNodeMods = rolldownPath.slice(\n 0,\n rolldownPath.indexOf(sep + \"node_modules\")\n );\n let config;\n return [\n {\n name: \"one:compiler-resolve-refresh-runtime\",\n apply: \"serve\",\n enforce: \"pre\",\n // Run before Vite default resolve to avoid syscalls\n resolveId: (id) => id === runtimePublicPath || id === `${runtimePublicPath}.map` ? id : void 0,\n load: (id) => {\n const basePath = dirname(fileURLToPath(import.meta.url));\n if (id === runtimePublicPath) {\n return readFileSync(join(basePath, \"refresh-runtime.mjs\"), \"utf-8\").replace(\n /\\/\\/# sourceMappingURL=.*/,\n \"\"\n );\n }\n if (id === `${runtimePublicPath}.map`) {\n return JSON.stringify({ version: 3, sources: [], mappings: \"\" });\n }\n return void 0;\n }\n },\n {\n name: `one:compiler-css-to-js`,\n // only .css files can match, so let rust reject everything else\n transform: {\n filter: { id: /\\.css$/ },\n handler(codeIn, id) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n {\n const data = JSON.stringify(\n cssToReactNativeRuntime(codeIn, { inlineRem: 16 })\n );\n const code = `require(\"nativewind/dist/index.js\").require().StyleSheet.registerCompiled(${data})`;\n const newId = `${id}.js`;\n const cssId = newId.replace(rolldownNodeMods + sep, \"\");\n cssTransformCache.set(cssId, code);\n return {\n code,\n id: newId,\n map: null\n };\n }\n }\n }\n },\n generateBundle(_, bundle) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n const rootJSName = Object.keys(bundle).find((i) => {\n const chunk = bundle[i];\n return chunk.type == \"chunk\" && chunk.fileName.match(/.[cm]?js(?:\\?.+)?$/) != null;\n });\n if (!rootJSName) {\n throw new Error(`Can't find root js, internal one error`);\n }\n const rootJS = bundle[rootJSName];\n const cssAssets = Object.keys(bundle).filter(\n (i) => bundle[i].fileName.endsWith(\".css.js\")\n );\n for (const name of cssAssets) {\n delete bundle[name];\n const jsCSS = cssTransformCache.get(name);\n rootJS.code = `\n${jsCSS}\n${rootJS.code}\n`;\n }\n }\n }\n },\n {\n name: \"one:compiler\",\n enforce: \"pre\",\n config: () => {\n const nodeModulesFilter = /node_modules[/\\\\].*\\.(tsx?|jsx?|mjs|cjs)$/;\n const createEnvironmentConfig = (environment) => {\n if (!perfStats.optimizeDeps.byEnvironment[environment]) {\n perfStats.optimizeDeps.byEnvironment[environment] = {\n filesChecked: 0,\n filesTransformed: 0,\n startTime: Date.now()\n };\n }\n return {\n optimizeDeps: {\n rolldownOptions: {\n plugins: [\n {\n name: `transform-before-optimize-deps-${environment}`,\n async transform(code, id) {\n if (!nodeModulesFilter.test(id)) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesChecked++;\n const production = process.env.NODE_ENV === \"production\" || process.env.NODE_ENV === \"test\";\n debug?.(`[rolldown optimizeDeps] ${id}`);\n const result = await performBabelTransform({\n id,\n code,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n if (!result) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesTransformed++;\n return {\n code: result.code,\n map: result.map\n };\n },\n buildEnd() {\n if (process.env.DEBUG_COMPILER_PERF) {\n const stats = perfStats.optimizeDeps.byEnvironment[environment];\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `[optimizeDeps ${environment}] Done: ${stats.filesChecked} files checked, ${stats.filesTransformed} transformed (${elapsed}ms)`\n );\n }\n const allDone = Object.keys(perfStats.optimizeDeps.byEnvironment).length >= 2;\n if (allDone) {\n logCacheStats();\n logPerfSummary();\n }\n }\n }\n ]\n }\n },\n define: {\n \"process.env.NATIVEWIND_OS\": JSON.stringify(\n environment === \"ios\" || environment === \"android\" ? \"native\" : \"web\"\n )\n }\n };\n };\n return {\n environments: {\n ios: createEnvironmentConfig(\"ios\"),\n android: createEnvironmentConfig(\"android\"),\n client: createEnvironmentConfig(\"client\"),\n ssr: createEnvironmentConfig(\"ssr\")\n }\n };\n },\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n async transform(codeIn, _id) {\n let code = codeIn;\n const environment = getEnvName(this.environment.name);\n const isNative = environment === \"ios\" || environment === \"android\";\n const production = config.command === \"build\" || process.env.NODE_ENV === \"production\" || JSON.parse(\n this.environment.config?.define?.[\"process.env.NODE_ENV\"] || '\"\"'\n ) === \"production\";\n const isEntry = _id.includes(\"one-entry-native\");\n if (isEntry) {\n if (isNative && !production) {\n code = `import '@vxrn/vite-native-client'\n${code}`;\n }\n if (isNative && configuration.enableNativewind) {\n code = `import * as x from 'nativewind'\n${code}`;\n }\n return code;\n }\n const id = _id.split(\"?\")[0];\n const extension = extname(id);\n if (extension === \".css\" || !validParsers.has(extension)) {\n return;\n }\n if (id.includes(`virtual:`)) {\n return;\n }\n if (codeIn.endsWith(`// vxrn-did-babel`)) {\n debug?.(`[skip babel] ${id}`);\n return;\n }\n return performBabelTransform({\n id,\n code: codeIn,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n }\n },\n // wraps client-side TSX/JSX with React Refresh preamble + import.meta.hot.accept\n // runs after vite:oxc (no enforce:'pre') so it sees the already-transformed code\n {\n name: \"one:react-refresh-web\",\n apply: \"serve\",\n transform(code, _id) {\n if (this.environment.name !== \"client\") return;\n if (code.includes(runtimePublicPath)) return;\n if (/[?&](?:worker|sharedworker|raw|url)\\b/.test(_id)) return;\n const id = _id.split(\"?\")[0];\n if (id.includes(\"node_modules\")) return;\n if (id.includes(\"virtual:\")) return;\n if (id === runtimePublicPath) return;\n const ext = extname(id);\n if (ext !== \".tsx\" && ext !== \".jsx\") return;\n const hasRefreshCalls = /\\$RefreshReg\\$\\(/.test(code);\n let out = `import * as RefreshRuntime from \"${runtimePublicPath}\";\n\n`;\n if (hasRefreshCalls) {\n out += `if (!window.$RefreshReg$) throw new Error(\"React refresh preamble was not loaded. Something is wrong.\");\nconst prevRefreshReg = window.$RefreshReg$;\nconst prevRefreshSig = window.$RefreshSig$;\nwindow.$RefreshReg$ = RefreshRuntime.getRefreshReg(\"${id}\");\nwindow.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\n\n`;\n }\n out += code;\n if (hasRefreshCalls) {\n out += `\n\nwindow.$RefreshReg$ = prevRefreshReg;\nwindow.$RefreshSig$ = prevRefreshSig;\n`;\n }\n out += `\nRefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {\n RefreshRuntime.registerExportsForReactRefresh(\"${id}\", currentExports);\n import.meta.hot.accept((nextExports) => {\n if (!nextExports) return;\n const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(\"${id}\", currentExports, nextExports);\n if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);\n });\n});\n`;\n return { code: out, map: null };\n }\n }\n ];\n}\nexport {\n JS_GLOBALS,\n clearTransformCache,\n createVXRNCompilerPlugin,\n getClosureVariables\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,YAAY;CAChB,OAAO;EACL,YAAY;EACZ,iBAAiB;EACjB,WAAW;EACX,eAAe,CAAC;CAClB;CACA,cAAc,EACZ,eAAe,CAAC,EAClB;AACF;AACA,SAAS,iBAAiB;CACxB,IAAI,CAAC,QAAQ,IAAI,qBAAqB;EACpC;CACF;CACA,QAAQ,KAAK,qCAA4C;CACzD,QAAQ,KACN,UAAU,UAAU,MAAM,gBAAgB,gBAAgB,UAAU,MAAM,WAAW,WAAW,UAAU,MAAM,kBAAkB,KAAK,IAAI,UAAU,MAAM,YAAY,CAAC,IAAI,IAAG,CAAE,QAAQ,CAAC,EAAE,kBAC9L;CACA,QAAQ,KAAK,qBAAqB,UAAU,MAAM,UAAU,GAAG;CAC/D,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,MAAM,aAAa,GAAG;EACxE,IAAI,MAAM,aAAa,GAAG;GACxB,QAAQ,KACN,KAAK,IAAI,IAAI,MAAM,WAAW,eAAe,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,WAAU,CAAE,QAAQ,CAAC,EAAE,QAC3G;EACF;CACF;CACA,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,aAAa,aAAa,GAAG;EAC/E,MAAM,UAAU,KAAK,IAAI,IAAI,MAAM;EACnC,QAAQ,KACN,gBAAgB,IAAI,YAAY,MAAM,aAAa,sBAAsB,MAAM,iBAAiB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KAC5B;IACF;IACA,OAAO,sBAAsB;KAC3B;KACA,MAAM;KACN,aAAa,OAAO;KACpB;KACA;KACA;KACA;IACF,CAAC;GACH;EACF;EAGA;GACE,MAAM;GACN,OAAO;GACP,UAAU,MAAM,KAAK;IACnB,IAAI,KAAK,YAAY,SAAS,UAAU;IACxC,IAAI,KAAK,SAAS,iBAAiB,GAAG;IACtC,IAAI,wCAAwC,KAAK,GAAG,GAAG;IACvD,MAAM,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC;IAC1B,IAAI,GAAG,SAAS,cAAc,GAAG;IACjC,IAAI,GAAG,SAAS,UAAU,GAAG;IAC7B,IAAI,OAAO,mBAAmB;IAC9B,MAAM,MAAM,QAAQ,EAAE;IACtB,IAAI,QAAQ,UAAU,QAAQ,QAAQ;IACtC,MAAM,kBAAkB,mBAAmB,KAAK,IAAI;IACpD,IAAI,MAAM,oCAAoC,kBAAkB;;;IAGhE,IAAI,iBAAiB;KACnB,OAAO;;;sDAGqC,GAAG;;;;IAIjD;IACA,OAAO;IACP,IAAI,iBAAiB;KACnB,OAAO;;;;;IAKT;IACA,OAAO;;mDAEoC,GAAG;;;wFAGkC,GAAG;;;;;IAKnF,OAAO;KAAE,MAAM;KAAK,KAAK;IAAK;GAChC;EACF;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, extname, join, relative, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { resolvePath } from \"@vxrn/utils\";\nimport { cssToReactNativeRuntime } from \"react-native-css-interop/css-to-rn/index.js\";\nimport { configuration, isNativeWorkletsEnabled } from \"./configure\";\nimport { debug, runtimePublicPath, validParsers } from \"./constants\";\nimport {\n getBabelOptions,\n transformBabel,\n transformOxcReactCompiler\n} from \"./transformBabel\";\nimport { shouldSourceMap } from \"./transformSWC\";\nimport {\n prepareWorkletsForReactCompiler,\n shouldTransformWorklets,\n transformWorklets\n} from \"./transformWorklets\";\nimport { getCachedTransform, logCacheStats, setCachedTransform } from \"./cache\";\nexport * from \"./configure\";\nexport * from \"./transformBabel\";\nexport * from \"./transformSWC\";\nexport * from \"./transformWorklets\";\nexport * from \"./reactNativeCodegen\";\nexport * from \"./transformHermesLoops\";\nexport * from \"./transformHermesAsync\";\nexport * from \"./transformHermesClasses\";\nimport { clearTransformCache } from \"./cache\";\nimport { JS_GLOBALS } from \"./worklets/globals\";\nimport { getClosureVariables } from \"./worklets/scope\";\nconst perfStats = {\n babel: {\n totalCalls: 0,\n totalTransforms: 0,\n totalTime: 0,\n byEnvironment: {}\n },\n optimizeDeps: {\n byEnvironment: {}\n }\n};\nfunction logPerfSummary() {\n if (!process.env.DEBUG_COMPILER_PERF) {\n return;\n }\n console.info(\"\\n\\u{1F4CA} [Compiler Performance Summary]\");\n console.info(\n `Babel: ${perfStats.babel.totalTransforms} transforms / ${perfStats.babel.totalCalls} calls (${(perfStats.babel.totalTransforms / Math.max(perfStats.babel.totalCalls, 1) * 100).toFixed(1)}% transform rate)`\n );\n console.info(`Babel total time: ${perfStats.babel.totalTime}ms`);\n for (const [env, stats] of Object.entries(perfStats.babel.byEnvironment)) {\n if (stats.transforms > 0) {\n console.info(\n ` ${env}: ${stats.transforms} transforms, ${stats.time}ms (${(stats.time / stats.transforms).toFixed(1)}ms avg)`\n );\n }\n }\n for (const [env, stats] of Object.entries(perfStats.optimizeDeps.byEnvironment)) {\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `optimizeDeps ${env}: checked ${stats.filesChecked} files, transformed ${stats.filesTransformed} (${elapsed}ms)`\n );\n }\n}\nconst compilerLog = {\n compiled: 0,\n cached: 0,\n time: 0,\n // typed loose because the dom lib types setTimeout as number, but node gives\n // us a Timeout we need to unref so the debounce never holds the process open\n timer: null\n};\nfunction logCompiled(cached, ms) {\n if (cached) {\n compilerLog.cached++;\n } else {\n compilerLog.compiled++;\n compilerLog.time += ms;\n }\n if (compilerLog.timer) clearTimeout(compilerLog.timer);\n compilerLog.timer = setTimeout(() => {\n const total = compilerLog.compiled + compilerLog.cached;\n const detail = compilerLog.compiled ? `${compilerLog.compiled} compiled in ${compilerLog.time}ms${compilerLog.cached ? `, ${compilerLog.cached} cached` : \"\"}` : `all cached`;\n console.info(` \\u{1FA84} [compiler] ${total} file${total === 1 ? \"\" : \"s\"} (${detail})`);\n compilerLog.compiled = 0;\n compilerLog.cached = 0;\n compilerLog.time = 0;\n compilerLog.timer = null;\n }, 500);\n compilerLog.timer.unref?.();\n}\nasync function performBabelTransform({\n id,\n code,\n projectRoot,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n}) {\n perfStats.babel.totalCalls++;\n if (!perfStats.babel.byEnvironment[environment]) {\n perfStats.babel.byEnvironment[environment] = { calls: 0, transforms: 0, time: 0 };\n }\n perfStats.babel.byEnvironment[environment].calls++;\n const transformProps = {\n id,\n code,\n projectRoot,\n development: !production,\n environment,\n reactForRNVersion\n };\n const userTransform = optionsIn?.transform?.(transformProps);\n if (userTransform === false) {\n return null;\n }\n if (userTransform !== \"swc\" && userTransform !== \"oxc\") {\n const babelOptions = getBabelOptions({\n ...transformProps,\n userSetting: userTransform\n });\n if (babelOptions) {\n const hasCompilerPlugin = babelOptions.plugins?.some(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n );\n const userBabelConfigPath = typeof babelOptions.configFile === \"string\" ? babelOptions.configFile : null;\n const cached = getCachedTransform(id, code, environment, userBabelConfigPath);\n if (cached) {\n perfStats.babel.byEnvironment[environment].transforms++;\n if (hasCompilerPlugin && (cached.code.includes(\"react/compiler-runtime\") || cached.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (cached)`);\n logCompiled(true, 0);\n }\n debug?.(`[babel/cached] ${id}`);\n return cached;\n }\n const isWorkletPlugin = (entry) => {\n if (!entry) return false;\n const name = typeof entry === \"string\" ? entry : Array.isArray(entry) ? entry[0] : null;\n return typeof name === \"string\" && (name.includes(\"react-native-worklets\") || name.includes(\"react-native-reanimated\"));\n };\n const workletEntry = babelOptions.plugins?.find(isWorkletPlugin);\n const workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;\n const useWorklets = isNativeWorkletsEnabled() && (Boolean(workletEntry) || shouldTransformWorklets({ id, code }));\n let curCode = code;\n let workletPreparation = null;\n let compilerOut = null;\n const compilerPluginIndex = babelOptions.plugins?.findIndex(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n ) ?? -1;\n if (compilerPluginIndex !== -1) {\n const compilerPluginConfig = babelOptions.plugins[compilerPluginIndex];\n const compilerPluginOptions = compilerPluginConfig[1] || {};\n const useBabelCompiler = compilerPluginOptions.compiler === \"babel\" || process.env.ONE_REACT_COMPILER === \"babel\" || process.env.VXRN_REACT_COMPILER === \"babel\";\n if (!useBabelCompiler) {\n if (useWorklets) {\n workletPreparation = prepareWorkletsForReactCompiler(\n id,\n curCode,\n shouldSourceMap()\n );\n if (workletPreparation) curCode = workletPreparation.code;\n }\n compilerOut = await transformOxcReactCompiler(\n id,\n curCode,\n compilerPluginOptions,\n shouldSourceMap()\n );\n if (compilerOut) curCode = compilerOut.code;\n babelOptions.plugins.splice(compilerPluginIndex, 1);\n }\n }\n let workletsOut = null;\n if (useWorklets) {\n workletsOut = await transformWorklets(id, curCode, shouldSourceMap(), {\n projectRoot,\n ...workletPluginOptions\n });\n babelOptions.plugins = babelOptions.plugins?.filter(\n (entry) => !isWorkletPlugin(entry)\n );\n curCode = workletsOut.code;\n }\n const startTime = Date.now();\n let babelOut = null;\n if (babelOptions.plugins?.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) {\n let finalMap = void 0;\n if (shouldSourceMap()) {\n const intermediateMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (intermediateMaps.length === 1) {\n finalMap = intermediateMaps[0];\n } else if (intermediateMaps.length > 1) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n finalMap = remapping(intermediateMaps.slice().reverse(), () => null);\n }\n }\n babelOut = { code: curCode, map: finalMap };\n } else {\n const babelOptsWithMap = shouldSourceMap() && (workletsOut?.map || compilerOut?.map || workletPreparation?.map) ? { ...babelOptions, sourceMaps: true } : babelOptions;\n babelOut = await transformBabel(id, curCode, babelOptsWithMap);\n if (shouldSourceMap() && babelOut?.map) {\n const priorMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (priorMaps.length > 0) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n babelOut.map = remapping(\n [babelOut.map, ...priorMaps.slice().reverse()],\n () => null\n );\n }\n }\n }\n const babelTime = Date.now() - startTime;\n if (babelOut?.code) {\n perfStats.babel.totalTransforms++;\n perfStats.babel.totalTime += babelTime;\n perfStats.babel.byEnvironment[environment].transforms++;\n perfStats.babel.byEnvironment[environment].time += babelTime;\n if (hasCompilerPlugin && (babelOut.code.includes(\"react/compiler-runtime\") || babelOut.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (${babelTime}ms)`);\n logCompiled(false, babelTime);\n }\n debug?.(`[babel] ${id}`);\n const outCode = `${babelOut.code}\n// vxrn-did-babel`;\n const result = { code: outCode, map: babelOut.map };\n setCachedTransform(id, code, result, environment, userBabelConfigPath);\n return result;\n }\n }\n }\n return null;\n}\nasync function createVXRNCompilerPlugin(optionsIn) {\n const reactVersion = await (async () => {\n const path = resolvePath(\"react/package.json\");\n const json = JSON.parse(await readFile(path, \"utf-8\"));\n return json.version;\n })();\n const envNames = {\n ios: true,\n android: true,\n client: true,\n ssr: true\n };\n function getEnvName(name) {\n if (name === \"worker\") return \"ssr\";\n if (!envNames[name]) throw new Error(`Invalid env: ${name}`);\n return name;\n }\n const reactForRNVersion = reactVersion.split(\".\")[0];\n const cssTransformCache = /* @__PURE__ */ new Map();\n const rolldownPath = resolvePath(\"rolldown\");\n const rolldownNodeMods = rolldownPath.slice(\n 0,\n rolldownPath.indexOf(sep + \"node_modules\")\n );\n let config;\n return [\n {\n name: \"one:compiler-resolve-refresh-runtime\",\n apply: \"serve\",\n enforce: \"pre\",\n // Run before Vite default resolve to avoid syscalls\n resolveId: (id) => id === runtimePublicPath || id === `${runtimePublicPath}.map` ? id : void 0,\n load: (id) => {\n const basePath = dirname(fileURLToPath(import.meta.url));\n if (id === runtimePublicPath) {\n return readFileSync(join(basePath, \"refresh-runtime.mjs\"), \"utf-8\").replace(\n /\\/\\/# sourceMappingURL=.*/,\n \"\"\n );\n }\n if (id === `${runtimePublicPath}.map`) {\n return JSON.stringify({ version: 3, sources: [], mappings: \"\" });\n }\n return void 0;\n }\n },\n {\n name: `one:compiler-css-to-js`,\n // only .css files can match, so let rust reject everything else\n transform: {\n filter: { id: /\\.css$/ },\n handler(codeIn, id) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n {\n const data = JSON.stringify(\n cssToReactNativeRuntime(codeIn, { inlineRem: 16 })\n );\n const code = `require(\"nativewind/dist/index.js\").require().StyleSheet.registerCompiled(${data})`;\n const newId = `${id}.js`;\n const cssId = newId.replace(rolldownNodeMods + sep, \"\");\n cssTransformCache.set(cssId, code);\n return {\n code,\n id: newId,\n map: null\n };\n }\n }\n }\n },\n generateBundle(_, bundle) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n const rootJSName = Object.keys(bundle).find((i) => {\n const chunk = bundle[i];\n return chunk.type == \"chunk\" && chunk.fileName.match(/.[cm]?js(?:\\?.+)?$/) != null;\n });\n if (!rootJSName) {\n throw new Error(`Can't find root js, internal one error`);\n }\n const rootJS = bundle[rootJSName];\n const cssAssets = Object.keys(bundle).filter(\n (i) => bundle[i].fileName.endsWith(\".css.js\")\n );\n for (const name of cssAssets) {\n delete bundle[name];\n const jsCSS = cssTransformCache.get(name);\n rootJS.code = `\n${jsCSS}\n${rootJS.code}\n`;\n }\n }\n }\n },\n {\n name: \"one:compiler\",\n enforce: \"pre\",\n config: () => {\n const nodeModulesFilter = /node_modules[/\\\\].*\\.(tsx?|jsx?|mjs|cjs)$/;\n const createEnvironmentConfig = (environment) => {\n if (!perfStats.optimizeDeps.byEnvironment[environment]) {\n perfStats.optimizeDeps.byEnvironment[environment] = {\n filesChecked: 0,\n filesTransformed: 0,\n startTime: Date.now()\n };\n }\n return {\n optimizeDeps: {\n rolldownOptions: {\n plugins: [\n {\n name: `transform-before-optimize-deps-${environment}`,\n async transform(code, id) {\n if (!nodeModulesFilter.test(id)) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesChecked++;\n const production = process.env.NODE_ENV === \"production\" || process.env.NODE_ENV === \"test\";\n debug?.(`[rolldown optimizeDeps] ${id}`);\n const result = await performBabelTransform({\n id,\n code,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n if (!result) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesTransformed++;\n return {\n code: result.code,\n map: result.map\n };\n },\n buildEnd() {\n if (process.env.DEBUG_COMPILER_PERF) {\n const stats = perfStats.optimizeDeps.byEnvironment[environment];\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `[optimizeDeps ${environment}] Done: ${stats.filesChecked} files checked, ${stats.filesTransformed} transformed (${elapsed}ms)`\n );\n }\n const allDone = Object.keys(perfStats.optimizeDeps.byEnvironment).length >= 2;\n if (allDone) {\n logCacheStats();\n logPerfSummary();\n }\n }\n }\n ]\n }\n },\n define: {\n \"process.env.NATIVEWIND_OS\": JSON.stringify(\n environment === \"ios\" || environment === \"android\" ? \"native\" : \"web\"\n )\n }\n };\n };\n return {\n environments: {\n ios: createEnvironmentConfig(\"ios\"),\n android: createEnvironmentConfig(\"android\"),\n client: createEnvironmentConfig(\"client\"),\n ssr: createEnvironmentConfig(\"ssr\")\n }\n };\n },\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n async transform(codeIn, _id) {\n let code = codeIn;\n const environment = getEnvName(this.environment.name);\n const isNative = environment === \"ios\" || environment === \"android\";\n const production = config.command === \"build\" || process.env.NODE_ENV === \"production\" || JSON.parse(\n this.environment.config?.define?.[\"process.env.NODE_ENV\"] || '\"\"'\n ) === \"production\";\n const isEntry = _id.includes(\"one-entry-native\");\n if (isEntry) {\n if (isNative && !production) {\n code = `import '@vxrn/vite-native-client'\n${code}`;\n }\n if (isNative && configuration.enableNativewind) {\n code = `import * as x from 'nativewind'\n${code}`;\n }\n return code;\n }\n const id = _id.split(\"?\")[0];\n const extension = extname(id);\n if (extension === \".css\" || !validParsers.has(extension)) {\n return;\n }\n if (id.includes(`virtual:`)) {\n return;\n }\n if (codeIn.endsWith(`// vxrn-did-babel`)) {\n debug?.(`[skip babel] ${id}`);\n return;\n }\n return performBabelTransform({\n id,\n code: codeIn,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n }\n },\n // wraps client-side TSX/JSX with React Refresh preamble + import.meta.hot.accept\n // runs after vite:oxc (no enforce:'pre') so it sees the already-transformed code\n {\n name: \"one:react-refresh-web\",\n apply: \"serve\",\n transform(code, _id) {\n if (this.environment.name !== \"client\") return;\n if (code.includes(runtimePublicPath)) return;\n if (/[?&](?:worker|sharedworker|raw|url)\\b/.test(_id)) return;\n const id = _id.split(\"?\")[0];\n if (id.includes(\"node_modules\")) return;\n if (id.includes(\"virtual:\")) return;\n if (id === runtimePublicPath) return;\n const ext = extname(id);\n if (ext !== \".tsx\" && ext !== \".jsx\") return;\n const hasRefreshCalls = /\\$RefreshReg\\$\\(/.test(code);\n let out = `import * as RefreshRuntime from \"${runtimePublicPath}\";\n\n`;\n if (hasRefreshCalls) {\n out += `if (!window.$RefreshReg$) throw new Error(\"React refresh preamble was not loaded. Something is wrong.\");\nconst prevRefreshReg = window.$RefreshReg$;\nconst prevRefreshSig = window.$RefreshSig$;\nwindow.$RefreshReg$ = RefreshRuntime.getRefreshReg(\"${id}\");\nwindow.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\n\n`;\n }\n out += code;\n if (hasRefreshCalls) {\n out += `\n\nwindow.$RefreshReg$ = prevRefreshReg;\nwindow.$RefreshSig$ = prevRefreshSig;\n`;\n }\n out += `\nRefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {\n RefreshRuntime.registerExportsForReactRefresh(\"${id}\", currentExports);\n import.meta.hot.accept((nextExports) => {\n if (!nextExports) return;\n const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(\"${id}\", currentExports, nextExports);\n if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);\n });\n});\n`;\n return { code: out, map: null };\n }\n }\n ];\n}\nexport {\n JS_GLOBALS,\n clearTransformCache,\n createVXRNCompilerPlugin,\n getClosureVariables\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,YAAY;CAChB,OAAO;EACL,YAAY;EACZ,iBAAiB;EACjB,WAAW;EACX,eAAe,CAAC;CAClB;CACA,cAAc,EACZ,eAAe,CAAC,EAClB;AACF;AACA,SAAS,iBAAiB;CACxB,IAAI,CAAC,QAAQ,IAAI,qBAAqB;EACpC;CACF;CACA,QAAQ,KAAK,qCAA4C;CACzD,QAAQ,KACN,UAAU,UAAU,MAAM,gBAAgB,gBAAgB,UAAU,MAAM,WAAW,WAAW,UAAU,MAAM,kBAAkB,KAAK,IAAI,UAAU,MAAM,YAAY,CAAC,IAAI,IAAG,CAAE,QAAQ,CAAC,EAAE,kBAC9L;CACA,QAAQ,KAAK,qBAAqB,UAAU,MAAM,UAAU,GAAG;CAC/D,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,MAAM,aAAa,GAAG;EACxE,IAAI,MAAM,aAAa,GAAG;GACxB,QAAQ,KACN,KAAK,IAAI,IAAI,MA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O;EACjB;KACQ;KACA,OAAO;IACT;IACA,MAAM,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC;IAC1B,MAAM,YAAY,QAAQ,EAAE;IAC5B,IAAI,cAAc,UAAU,CAAC,aAAa,IAAI,SAAS,GAAG;KACxD;IACF;IACA,IAAI,GAAG,SAAS,UAAU,GAAG;KAC3B;IACF;IACA,IAAI,OAAO,SAAS,mBAAmB,GAAG;KACxC,QAAQ,gBAAgB,IAAI;KAC5B;IACF;IACA,OAAO,sBAAsB;KAC3B;KACA,MAAM;KACN,aAAa,OAAO;KACpB;KACA;KACA;KACA;IACF,CAAC;GACH;EACF;EAGA;GACE,MAAM;GACN,OAAO;GACP,UAAU,MAAM,KAAK;IACnB,IAAI,KAAK,YAAY,SAAS,UAAU;IACxC,IAAI,KAAK,SAAS,iBAAiB,GAAG;IACtC,IAAI,wCAAwC,KAAK,GAAG,GAAG;IACvD,MAAM,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC;IAC1B,IAAI,GAAG,SAAS,cAAc,GAAG;IACjC,IAAI,GAAG,SAAS,UAAU,GAAG;IAC7B,IAAI,OAAO,mBAAmB;IAC9B,MAAM,MAAM,QAAQ,EAAE;IACtB,IAAI,QAAQ,UAAU,QAAQ,QAAQ;IACtC,MAAM,kBAAkB,mBAAmB,KAAK,IAAI;IACpD,IAAI,MAAM,oCAAoC,kBAAkB;;;IAGhE,IAAI,iBAAiB;KACnB,OAAO;;;sDAGqC,GAAG;;;;IAIjD;IACA,OAAO;IACP,IAAI,iBAAiB;KACnB,OAAO;;;;;IAKT;IACA,OAAO;;mDAEoC,GAAG;;;wFAGkC,GAAG;;;;;IAKnF,OAAO;KAAE,MAAM;KAAK,KAAK;IAAK;GAChC;EACF;CACF;AACF"}
@@ -27,6 +27,8 @@ export * from "./transformHermesLoops.mjs"
27
27
 
28
28
  export * from "./transformHermesAsync.mjs"
29
29
 
30
+ export * from "./transformHermesClasses.mjs"
31
+
30
32
  const perfStats = {
31
33
  babel: {
32
34
  totalCalls: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, extname, join, relative, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { resolvePath } from \"@vxrn/utils\";\nimport { cssToReactNativeRuntime } from \"react-native-css-interop/css-to-rn/index.js\";\nimport { configuration, isNativeWorkletsEnabled } from \"./configure\";\nimport { debug, runtimePublicPath, validParsers } from \"./constants\";\nimport {\n getBabelOptions,\n transformBabel,\n transformOxcReactCompiler\n} from \"./transformBabel\";\nimport { shouldSourceMap } from \"./transformSWC\";\nimport {\n prepareWorkletsForReactCompiler,\n shouldTransformWorklets,\n transformWorklets\n} from \"./transformWorklets\";\nimport { getCachedTransform, logCacheStats, setCachedTransform } from \"./cache\";\nexport * from \"./configure\";\nexport * from \"./transformBabel\";\nexport * from \"./transformSWC\";\nexport * from \"./transformWorklets\";\nexport * from \"./reactNativeCodegen\";\nexport * from \"./transformHermesLoops\";\nexport * from \"./transformHermesAsync\";\nimport { clearTransformCache } from \"./cache\";\nimport { JS_GLOBALS } from \"./worklets/globals\";\nimport { getClosureVariables } from \"./worklets/scope\";\nconst perfStats = {\n babel: {\n totalCalls: 0,\n totalTransforms: 0,\n totalTime: 0,\n byEnvironment: {}\n },\n optimizeDeps: {\n byEnvironment: {}\n }\n};\nfunction logPerfSummary() {\n if (!process.env.DEBUG_COMPILER_PERF) {\n return;\n }\n console.info(\"\\n\\u{1F4CA} [Compiler Performance Summary]\");\n console.info(\n `Babel: ${perfStats.babel.totalTransforms} transforms / ${perfStats.babel.totalCalls} calls (${(perfStats.babel.totalTransforms / Math.max(perfStats.babel.totalCalls, 1) * 100).toFixed(1)}% transform rate)`\n );\n console.info(`Babel total time: ${perfStats.babel.totalTime}ms`);\n for (const [env, stats] of Object.entries(perfStats.babel.byEnvironment)) {\n if (stats.transforms > 0) {\n console.info(\n ` ${env}: ${stats.transforms} transforms, ${stats.time}ms (${(stats.time / stats.transforms).toFixed(1)}ms avg)`\n );\n }\n }\n for (const [env, stats] of Object.entries(perfStats.optimizeDeps.byEnvironment)) {\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `optimizeDeps ${env}: checked ${stats.filesChecked} files, transformed ${stats.filesTransformed} (${elapsed}ms)`\n );\n }\n}\nconst compilerLog = {\n compiled: 0,\n cached: 0,\n time: 0,\n // typed loose because the dom lib types setTimeout as number, but node gives\n // us a Timeout we need to unref so the debounce never holds the process open\n timer: null\n};\nfunction logCompiled(cached, ms) {\n if (cached) {\n compilerLog.cached++;\n } else {\n compilerLog.compiled++;\n compilerLog.time += ms;\n }\n if (compilerLog.timer) clearTimeout(compilerLog.timer);\n compilerLog.timer = setTimeout(() => {\n const total = compilerLog.compiled + compilerLog.cached;\n const detail = compilerLog.compiled ? `${compilerLog.compiled} compiled in ${compilerLog.time}ms${compilerLog.cached ? `, ${compilerLog.cached} cached` : \"\"}` : `all cached`;\n console.info(` \\u{1FA84} [compiler] ${total} file${total === 1 ? \"\" : \"s\"} (${detail})`);\n compilerLog.compiled = 0;\n compilerLog.cached = 0;\n compilerLog.time = 0;\n compilerLog.timer = null;\n }, 500);\n compilerLog.timer.unref?.();\n}\nasync function performBabelTransform({\n id,\n code,\n projectRoot,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n}) {\n perfStats.babel.totalCalls++;\n if (!perfStats.babel.byEnvironment[environment]) {\n perfStats.babel.byEnvironment[environment] = { calls: 0, transforms: 0, time: 0 };\n }\n perfStats.babel.byEnvironment[environment].calls++;\n const transformProps = {\n id,\n code,\n projectRoot,\n development: !production,\n environment,\n reactForRNVersion\n };\n const userTransform = optionsIn?.transform?.(transformProps);\n if (userTransform === false) {\n return null;\n }\n if (userTransform !== \"swc\" && userTransform !== \"oxc\") {\n const babelOptions = getBabelOptions({\n ...transformProps,\n userSetting: userTransform\n });\n if (babelOptions) {\n const hasCompilerPlugin = babelOptions.plugins?.some(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n );\n const userBabelConfigPath = typeof babelOptions.configFile === \"string\" ? babelOptions.configFile : null;\n const cached = getCachedTransform(id, code, environment, userBabelConfigPath);\n if (cached) {\n perfStats.babel.byEnvironment[environment].transforms++;\n if (hasCompilerPlugin && (cached.code.includes(\"react/compiler-runtime\") || cached.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (cached)`);\n logCompiled(true, 0);\n }\n debug?.(`[babel/cached] ${id}`);\n return cached;\n }\n const isWorkletPlugin = (entry) => {\n if (!entry) return false;\n const name = typeof entry === \"string\" ? entry : Array.isArray(entry) ? entry[0] : null;\n return typeof name === \"string\" && (name.includes(\"react-native-worklets\") || name.includes(\"react-native-reanimated\"));\n };\n const workletEntry = babelOptions.plugins?.find(isWorkletPlugin);\n const workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;\n const useWorklets = isNativeWorkletsEnabled() && (Boolean(workletEntry) || shouldTransformWorklets({ id, code }));\n let curCode = code;\n let workletPreparation = null;\n let compilerOut = null;\n const compilerPluginIndex = babelOptions.plugins?.findIndex(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n ) ?? -1;\n if (compilerPluginIndex !== -1) {\n const compilerPluginConfig = babelOptions.plugins[compilerPluginIndex];\n const compilerPluginOptions = compilerPluginConfig[1] || {};\n const useBabelCompiler = compilerPluginOptions.compiler === \"babel\" || process.env.ONE_REACT_COMPILER === \"babel\" || process.env.VXRN_REACT_COMPILER === \"babel\";\n if (!useBabelCompiler) {\n if (useWorklets) {\n workletPreparation = prepareWorkletsForReactCompiler(\n id,\n curCode,\n shouldSourceMap()\n );\n if (workletPreparation) curCode = workletPreparation.code;\n }\n compilerOut = await transformOxcReactCompiler(\n id,\n curCode,\n compilerPluginOptions,\n shouldSourceMap()\n );\n if (compilerOut) curCode = compilerOut.code;\n babelOptions.plugins.splice(compilerPluginIndex, 1);\n }\n }\n let workletsOut = null;\n if (useWorklets) {\n workletsOut = await transformWorklets(id, curCode, shouldSourceMap(), {\n projectRoot,\n ...workletPluginOptions\n });\n babelOptions.plugins = babelOptions.plugins?.filter(\n (entry) => !isWorkletPlugin(entry)\n );\n curCode = workletsOut.code;\n }\n const startTime = Date.now();\n let babelOut = null;\n if (babelOptions.plugins?.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) {\n let finalMap = void 0;\n if (shouldSourceMap()) {\n const intermediateMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (intermediateMaps.length === 1) {\n finalMap = intermediateMaps[0];\n } else if (intermediateMaps.length > 1) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n finalMap = remapping(intermediateMaps.slice().reverse(), () => null);\n }\n }\n babelOut = { code: curCode, map: finalMap };\n } else {\n const babelOptsWithMap = shouldSourceMap() && (workletsOut?.map || compilerOut?.map || workletPreparation?.map) ? { ...babelOptions, sourceMaps: true } : babelOptions;\n babelOut = await transformBabel(id, curCode, babelOptsWithMap);\n if (shouldSourceMap() && babelOut?.map) {\n const priorMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (priorMaps.length > 0) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n babelOut.map = remapping(\n [babelOut.map, ...priorMaps.slice().reverse()],\n () => null\n );\n }\n }\n }\n const babelTime = Date.now() - startTime;\n if (babelOut?.code) {\n perfStats.babel.totalTransforms++;\n perfStats.babel.totalTime += babelTime;\n perfStats.babel.byEnvironment[environment].transforms++;\n perfStats.babel.byEnvironment[environment].time += babelTime;\n if (hasCompilerPlugin && (babelOut.code.includes(\"react/compiler-runtime\") || babelOut.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (${babelTime}ms)`);\n logCompiled(false, babelTime);\n }\n debug?.(`[babel] ${id}`);\n const outCode = `${babelOut.code}\n// vxrn-did-babel`;\n const result = { code: outCode, map: babelOut.map };\n setCachedTransform(id, code, result, environment, userBabelConfigPath);\n return result;\n }\n }\n }\n return null;\n}\nasync function createVXRNCompilerPlugin(optionsIn) {\n const reactVersion = await (async () => {\n const path = resolvePath(\"react/package.json\");\n const json = JSON.parse(await readFile(path, \"utf-8\"));\n return json.version;\n })();\n const envNames = {\n ios: true,\n android: true,\n client: true,\n ssr: true\n };\n function getEnvName(name) {\n if (name === \"worker\") return \"ssr\";\n if (!envNames[name]) throw new Error(`Invalid env: ${name}`);\n return name;\n }\n const reactForRNVersion = reactVersion.split(\".\")[0];\n const cssTransformCache = /* @__PURE__ */ new Map();\n const rolldownPath = resolvePath(\"rolldown\");\n const rolldownNodeMods = rolldownPath.slice(\n 0,\n rolldownPath.indexOf(sep + \"node_modules\")\n );\n let config;\n return [\n {\n name: \"one:compiler-resolve-refresh-runtime\",\n apply: \"serve\",\n enforce: \"pre\",\n // Run before Vite default resolve to avoid syscalls\n resolveId: (id) => id === runtimePublicPath || id === `${runtimePublicPath}.map` ? id : void 0,\n load: (id) => {\n const basePath = dirname(fileURLToPath(import.meta.url));\n if (id === runtimePublicPath) {\n return readFileSync(join(basePath, \"refresh-runtime.mjs\"), \"utf-8\").replace(\n /\\/\\/# sourceMappingURL=.*/,\n \"\"\n );\n }\n if (id === `${runtimePublicPath}.map`) {\n return JSON.stringify({ version: 3, sources: [], mappings: \"\" });\n }\n return void 0;\n }\n },\n {\n name: `one:compiler-css-to-js`,\n // only .css files can match, so let rust reject everything else\n transform: {\n filter: { id: /\\.css$/ },\n handler(codeIn, id) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n {\n const data = JSON.stringify(\n cssToReactNativeRuntime(codeIn, { inlineRem: 16 })\n );\n const code = `require(\"nativewind/dist/index.js\").require().StyleSheet.registerCompiled(${data})`;\n const newId = `${id}.js`;\n const cssId = newId.replace(rolldownNodeMods + sep, \"\");\n cssTransformCache.set(cssId, code);\n return {\n code,\n id: newId,\n map: null\n };\n }\n }\n }\n },\n generateBundle(_, bundle) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n const rootJSName = Object.keys(bundle).find((i) => {\n const chunk = bundle[i];\n return chunk.type == \"chunk\" && chunk.fileName.match(/.[cm]?js(?:\\?.+)?$/) != null;\n });\n if (!rootJSName) {\n throw new Error(`Can't find root js, internal one error`);\n }\n const rootJS = bundle[rootJSName];\n const cssAssets = Object.keys(bundle).filter(\n (i) => bundle[i].fileName.endsWith(\".css.js\")\n );\n for (const name of cssAssets) {\n delete bundle[name];\n const jsCSS = cssTransformCache.get(name);\n rootJS.code = `\n${jsCSS}\n${rootJS.code}\n`;\n }\n }\n }\n },\n {\n name: \"one:compiler\",\n enforce: \"pre\",\n config: () => {\n const nodeModulesFilter = /node_modules[/\\\\].*\\.(tsx?|jsx?|mjs|cjs)$/;\n const createEnvironmentConfig = (environment) => {\n if (!perfStats.optimizeDeps.byEnvironment[environment]) {\n perfStats.optimizeDeps.byEnvironment[environment] = {\n filesChecked: 0,\n filesTransformed: 0,\n startTime: Date.now()\n };\n }\n return {\n optimizeDeps: {\n rolldownOptions: {\n plugins: [\n {\n name: `transform-before-optimize-deps-${environment}`,\n async transform(code, id) {\n if (!nodeModulesFilter.test(id)) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesChecked++;\n const production = process.env.NODE_ENV === \"production\" || process.env.NODE_ENV === \"test\";\n debug?.(`[rolldown optimizeDeps] ${id}`);\n const result = await performBabelTransform({\n id,\n code,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n if (!result) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesTransformed++;\n return {\n code: result.code,\n map: result.map\n };\n },\n buildEnd() {\n if (process.env.DEBUG_COMPILER_PERF) {\n const stats = perfStats.optimizeDeps.byEnvironment[environment];\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `[optimizeDeps ${environment}] Done: ${stats.filesChecked} files checked, ${stats.filesTransformed} transformed (${elapsed}ms)`\n );\n }\n const allDone = Object.keys(perfStats.optimizeDeps.byEnvironment).length >= 2;\n if (allDone) {\n logCacheStats();\n logPerfSummary();\n }\n }\n }\n ]\n }\n },\n define: {\n \"process.env.NATIVEWIND_OS\": JSON.stringify(\n environment === \"ios\" || environment === \"android\" ? \"native\" : \"web\"\n )\n }\n };\n };\n return {\n environments: {\n ios: createEnvironmentConfig(\"ios\"),\n android: createEnvironmentConfig(\"android\"),\n client: createEnvironmentConfig(\"client\"),\n ssr: createEnvironmentConfig(\"ssr\")\n }\n };\n },\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n async transform(codeIn, _id) {\n let code = codeIn;\n const environment = getEnvName(this.environment.name);\n const isNative = environment === \"ios\" || environment === \"android\";\n const production = config.command === \"build\" || process.env.NODE_ENV === \"production\" || JSON.parse(\n this.environment.config?.define?.[\"process.env.NODE_ENV\"] || '\"\"'\n ) === \"production\";\n const isEntry = _id.includes(\"one-entry-native\");\n if (isEntry) {\n if (isNative && !production) {\n code = `import '@vxrn/vite-native-client'\n${code}`;\n }\n if (isNative && configuration.enableNativewind) {\n code = `import * as x from 'nativewind'\n${code}`;\n }\n return code;\n }\n const id = _id.split(\"?\")[0];\n const extension = extname(id);\n if (extension === \".css\" || !validParsers.has(extension)) {\n return;\n }\n if (id.includes(`virtual:`)) {\n return;\n }\n if (codeIn.endsWith(`// vxrn-did-babel`)) {\n debug?.(`[skip babel] ${id}`);\n return;\n }\n return performBabelTransform({\n id,\n code: codeIn,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n }\n },\n // wraps client-side TSX/JSX with React Refresh preamble + import.meta.hot.accept\n // runs after vite:oxc (no enforce:'pre') so it sees the already-transformed code\n {\n name: \"one:react-refresh-web\",\n apply: \"serve\",\n transform(code, _id) {\n if (this.environment.name !== \"client\") return;\n if (code.includes(runtimePublicPath)) return;\n if (/[?&](?:worker|sharedworker|raw|url)\\b/.test(_id)) return;\n const id = _id.split(\"?\")[0];\n if (id.includes(\"node_modules\")) return;\n if (id.includes(\"virtual:\")) return;\n if (id === runtimePublicPath) return;\n const ext = extname(id);\n if (ext !== \".tsx\" && ext !== \".jsx\") return;\n const hasRefreshCalls = /\\$RefreshReg\\$\\(/.test(code);\n let out = `import * as RefreshRuntime from \"${runtimePublicPath}\";\n\n`;\n if (hasRefreshCalls) {\n out += `if (!window.$RefreshReg$) throw new Error(\"React refresh preamble was not loaded. Something is wrong.\");\nconst prevRefreshReg = window.$RefreshReg$;\nconst prevRefreshSig = window.$RefreshSig$;\nwindow.$RefreshReg$ = RefreshRuntime.getRefreshReg(\"${id}\");\nwindow.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\n\n`;\n }\n out += code;\n if (hasRefreshCalls) {\n out += `\n\nwindow.$RefreshReg$ = prevRefreshReg;\nwindow.$RefreshSig$ = prevRefreshSig;\n`;\n }\n out += `\nRefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {\n RefreshRuntime.registerExportsForReactRefresh(\"${id}\", currentExports);\n import.meta.hot.accept((nextExports) => {\n if (!nextExports) return;\n const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(\"${id}\", currentExports, nextExports);\n if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);\n });\n});\n`;\n return { code: out, map: null };\n }\n }\n ];\n}\nexport {\n JS_GLOBALS,\n clearTransformCache,\n createVXRNCompilerPlugin,\n getClosureVariables\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,YAAY;CAChB,OAAO;EACL,YAAY;EACZ,iBAAiB;EACjB,WAAW;EACX,eAAe,CAAC;CAClB;CACA,cAAc,EACZ,eAAe,CAAC,EAClB;AACF;AACA,SAAS,iBAAiB;CACxB,IAAI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BAAkB,mBAAmB,KAAK,IAAI;IACpD,IAAI,MAAM,oCAAoC,kBAAkB;;;IAGhE,IAAI,iBAAiB;KACnB,OAAO;;;sDAGqC,GAAG;;;;IAIjD;IACA,OAAO;IACP,IAAI,iBAAiB;KACnB,OAAO;;;;;IAKT;IACA,OAAO;;mDAEoC,GAAG;;;wFAGkC,GAAG;;;;;IAKnF,OAAO;KAAE,MAAM;KAAK,KAAK;IAAK;GAChC;EACF;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { dirname, extname, join, relative, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { resolvePath } from \"@vxrn/utils\";\nimport { cssToReactNativeRuntime } from \"react-native-css-interop/css-to-rn/index.js\";\nimport { configuration, isNativeWorkletsEnabled } from \"./configure\";\nimport { debug, runtimePublicPath, validParsers } from \"./constants\";\nimport {\n getBabelOptions,\n transformBabel,\n transformOxcReactCompiler\n} from \"./transformBabel\";\nimport { shouldSourceMap } from \"./transformSWC\";\nimport {\n prepareWorkletsForReactCompiler,\n shouldTransformWorklets,\n transformWorklets\n} from \"./transformWorklets\";\nimport { getCachedTransform, logCacheStats, setCachedTransform } from \"./cache\";\nexport * from \"./configure\";\nexport * from \"./transformBabel\";\nexport * from \"./transformSWC\";\nexport * from \"./transformWorklets\";\nexport * from \"./reactNativeCodegen\";\nexport * from \"./transformHermesLoops\";\nexport * from \"./transformHermesAsync\";\nexport * from \"./transformHermesClasses\";\nimport { clearTransformCache } from \"./cache\";\nimport { JS_GLOBALS } from \"./worklets/globals\";\nimport { getClosureVariables } from \"./worklets/scope\";\nconst perfStats = {\n babel: {\n totalCalls: 0,\n totalTransforms: 0,\n totalTime: 0,\n byEnvironment: {}\n },\n optimizeDeps: {\n byEnvironment: {}\n }\n};\nfunction logPerfSummary() {\n if (!process.env.DEBUG_COMPILER_PERF) {\n return;\n }\n console.info(\"\\n\\u{1F4CA} [Compiler Performance Summary]\");\n console.info(\n `Babel: ${perfStats.babel.totalTransforms} transforms / ${perfStats.babel.totalCalls} calls (${(perfStats.babel.totalTransforms / Math.max(perfStats.babel.totalCalls, 1) * 100).toFixed(1)}% transform rate)`\n );\n console.info(`Babel total time: ${perfStats.babel.totalTime}ms`);\n for (const [env, stats] of Object.entries(perfStats.babel.byEnvironment)) {\n if (stats.transforms > 0) {\n console.info(\n ` ${env}: ${stats.transforms} transforms, ${stats.time}ms (${(stats.time / stats.transforms).toFixed(1)}ms avg)`\n );\n }\n }\n for (const [env, stats] of Object.entries(perfStats.optimizeDeps.byEnvironment)) {\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `optimizeDeps ${env}: checked ${stats.filesChecked} files, transformed ${stats.filesTransformed} (${elapsed}ms)`\n );\n }\n}\nconst compilerLog = {\n compiled: 0,\n cached: 0,\n time: 0,\n // typed loose because the dom lib types setTimeout as number, but node gives\n // us a Timeout we need to unref so the debounce never holds the process open\n timer: null\n};\nfunction logCompiled(cached, ms) {\n if (cached) {\n compilerLog.cached++;\n } else {\n compilerLog.compiled++;\n compilerLog.time += ms;\n }\n if (compilerLog.timer) clearTimeout(compilerLog.timer);\n compilerLog.timer = setTimeout(() => {\n const total = compilerLog.compiled + compilerLog.cached;\n const detail = compilerLog.compiled ? `${compilerLog.compiled} compiled in ${compilerLog.time}ms${compilerLog.cached ? `, ${compilerLog.cached} cached` : \"\"}` : `all cached`;\n console.info(` \\u{1FA84} [compiler] ${total} file${total === 1 ? \"\" : \"s\"} (${detail})`);\n compilerLog.compiled = 0;\n compilerLog.cached = 0;\n compilerLog.time = 0;\n compilerLog.timer = null;\n }, 500);\n compilerLog.timer.unref?.();\n}\nasync function performBabelTransform({\n id,\n code,\n projectRoot,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n}) {\n perfStats.babel.totalCalls++;\n if (!perfStats.babel.byEnvironment[environment]) {\n perfStats.babel.byEnvironment[environment] = { calls: 0, transforms: 0, time: 0 };\n }\n perfStats.babel.byEnvironment[environment].calls++;\n const transformProps = {\n id,\n code,\n projectRoot,\n development: !production,\n environment,\n reactForRNVersion\n };\n const userTransform = optionsIn?.transform?.(transformProps);\n if (userTransform === false) {\n return null;\n }\n if (userTransform !== \"swc\" && userTransform !== \"oxc\") {\n const babelOptions = getBabelOptions({\n ...transformProps,\n userSetting: userTransform\n });\n if (babelOptions) {\n const hasCompilerPlugin = babelOptions.plugins?.some(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n );\n const userBabelConfigPath = typeof babelOptions.configFile === \"string\" ? babelOptions.configFile : null;\n const cached = getCachedTransform(id, code, environment, userBabelConfigPath);\n if (cached) {\n perfStats.babel.byEnvironment[environment].transforms++;\n if (hasCompilerPlugin && (cached.code.includes(\"react/compiler-runtime\") || cached.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (cached)`);\n logCompiled(true, 0);\n }\n debug?.(`[babel/cached] ${id}`);\n return cached;\n }\n const isWorkletPlugin = (entry) => {\n if (!entry) return false;\n const name = typeof entry === \"string\" ? entry : Array.isArray(entry) ? entry[0] : null;\n return typeof name === \"string\" && (name.includes(\"react-native-worklets\") || name.includes(\"react-native-reanimated\"));\n };\n const workletEntry = babelOptions.plugins?.find(isWorkletPlugin);\n const workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;\n const useWorklets = isNativeWorkletsEnabled() && (Boolean(workletEntry) || shouldTransformWorklets({ id, code }));\n let curCode = code;\n let workletPreparation = null;\n let compilerOut = null;\n const compilerPluginIndex = babelOptions.plugins?.findIndex(\n (x) => Array.isArray(x) && x[0] === \"babel-plugin-react-compiler\"\n ) ?? -1;\n if (compilerPluginIndex !== -1) {\n const compilerPluginConfig = babelOptions.plugins[compilerPluginIndex];\n const compilerPluginOptions = compilerPluginConfig[1] || {};\n const useBabelCompiler = compilerPluginOptions.compiler === \"babel\" || process.env.ONE_REACT_COMPILER === \"babel\" || process.env.VXRN_REACT_COMPILER === \"babel\";\n if (!useBabelCompiler) {\n if (useWorklets) {\n workletPreparation = prepareWorkletsForReactCompiler(\n id,\n curCode,\n shouldSourceMap()\n );\n if (workletPreparation) curCode = workletPreparation.code;\n }\n compilerOut = await transformOxcReactCompiler(\n id,\n curCode,\n compilerPluginOptions,\n shouldSourceMap()\n );\n if (compilerOut) curCode = compilerOut.code;\n babelOptions.plugins.splice(compilerPluginIndex, 1);\n }\n }\n let workletsOut = null;\n if (useWorklets) {\n workletsOut = await transformWorklets(id, curCode, shouldSourceMap(), {\n projectRoot,\n ...workletPluginOptions\n });\n babelOptions.plugins = babelOptions.plugins?.filter(\n (entry) => !isWorkletPlugin(entry)\n );\n curCode = workletsOut.code;\n }\n const startTime = Date.now();\n let babelOut = null;\n if (babelOptions.plugins?.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) {\n let finalMap = void 0;\n if (shouldSourceMap()) {\n const intermediateMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (intermediateMaps.length === 1) {\n finalMap = intermediateMaps[0];\n } else if (intermediateMaps.length > 1) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n finalMap = remapping(intermediateMaps.slice().reverse(), () => null);\n }\n }\n babelOut = { code: curCode, map: finalMap };\n } else {\n const babelOptsWithMap = shouldSourceMap() && (workletsOut?.map || compilerOut?.map || workletPreparation?.map) ? { ...babelOptions, sourceMaps: true } : babelOptions;\n babelOut = await transformBabel(id, curCode, babelOptsWithMap);\n if (shouldSourceMap() && babelOut?.map) {\n const priorMaps = [\n workletPreparation?.map,\n compilerOut?.map,\n workletsOut?.map\n ].filter(Boolean);\n if (priorMaps.length > 0) {\n const remapping = (await import(\"@jridgewell/remapping\")).default;\n babelOut.map = remapping(\n [babelOut.map, ...priorMaps.slice().reverse()],\n () => null\n );\n }\n }\n }\n const babelTime = Date.now() - startTime;\n if (babelOut?.code) {\n perfStats.babel.totalTransforms++;\n perfStats.babel.totalTime += babelTime;\n perfStats.babel.byEnvironment[environment].transforms++;\n perfStats.babel.byEnvironment[environment].time += babelTime;\n if (hasCompilerPlugin && (babelOut.code.includes(\"react/compiler-runtime\") || babelOut.code.includes(\"react-compiler-runtime\"))) {\n debug?.(` \\u{1FA84} [compiler] ${relative(process.cwd(), id)} (${babelTime}ms)`);\n logCompiled(false, babelTime);\n }\n debug?.(`[babel] ${id}`);\n const outCode = `${babelOut.code}\n// vxrn-did-babel`;\n const result = { code: outCode, map: babelOut.map };\n setCachedTransform(id, code, result, environment, userBabelConfigPath);\n return result;\n }\n }\n }\n return null;\n}\nasync function createVXRNCompilerPlugin(optionsIn) {\n const reactVersion = await (async () => {\n const path = resolvePath(\"react/package.json\");\n const json = JSON.parse(await readFile(path, \"utf-8\"));\n return json.version;\n })();\n const envNames = {\n ios: true,\n android: true,\n client: true,\n ssr: true\n };\n function getEnvName(name) {\n if (name === \"worker\") return \"ssr\";\n if (!envNames[name]) throw new Error(`Invalid env: ${name}`);\n return name;\n }\n const reactForRNVersion = reactVersion.split(\".\")[0];\n const cssTransformCache = /* @__PURE__ */ new Map();\n const rolldownPath = resolvePath(\"rolldown\");\n const rolldownNodeMods = rolldownPath.slice(\n 0,\n rolldownPath.indexOf(sep + \"node_modules\")\n );\n let config;\n return [\n {\n name: \"one:compiler-resolve-refresh-runtime\",\n apply: \"serve\",\n enforce: \"pre\",\n // Run before Vite default resolve to avoid syscalls\n resolveId: (id) => id === runtimePublicPath || id === `${runtimePublicPath}.map` ? id : void 0,\n load: (id) => {\n const basePath = dirname(fileURLToPath(import.meta.url));\n if (id === runtimePublicPath) {\n return readFileSync(join(basePath, \"refresh-runtime.mjs\"), \"utf-8\").replace(\n /\\/\\/# sourceMappingURL=.*/,\n \"\"\n );\n }\n if (id === `${runtimePublicPath}.map`) {\n return JSON.stringify({ version: 3, sources: [], mappings: \"\" });\n }\n return void 0;\n }\n },\n {\n name: `one:compiler-css-to-js`,\n // only .css files can match, so let rust reject everything else\n transform: {\n filter: { id: /\\.css$/ },\n handler(codeIn, id) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n {\n const data = JSON.stringify(\n cssToReactNativeRuntime(codeIn, { inlineRem: 16 })\n );\n const code = `require(\"nativewind/dist/index.js\").require().StyleSheet.registerCompiled(${data})`;\n const newId = `${id}.js`;\n const cssId = newId.replace(rolldownNodeMods + sep, \"\");\n cssTransformCache.set(cssId, code);\n return {\n code,\n id: newId,\n map: null\n };\n }\n }\n }\n },\n generateBundle(_, bundle) {\n const environment = getEnvName(this.environment.name);\n if (configuration.enableNativeCSS && (environment === \"ios\" || environment === \"android\")) {\n const rootJSName = Object.keys(bundle).find((i) => {\n const chunk = bundle[i];\n return chunk.type == \"chunk\" && chunk.fileName.match(/.[cm]?js(?:\\?.+)?$/) != null;\n });\n if (!rootJSName) {\n throw new Error(`Can't find root js, internal one error`);\n }\n const rootJS = bundle[rootJSName];\n const cssAssets = Object.keys(bundle).filter(\n (i) => bundle[i].fileName.endsWith(\".css.js\")\n );\n for (const name of cssAssets) {\n delete bundle[name];\n const jsCSS = cssTransformCache.get(name);\n rootJS.code = `\n${jsCSS}\n${rootJS.code}\n`;\n }\n }\n }\n },\n {\n name: \"one:compiler\",\n enforce: \"pre\",\n config: () => {\n const nodeModulesFilter = /node_modules[/\\\\].*\\.(tsx?|jsx?|mjs|cjs)$/;\n const createEnvironmentConfig = (environment) => {\n if (!perfStats.optimizeDeps.byEnvironment[environment]) {\n perfStats.optimizeDeps.byEnvironment[environment] = {\n filesChecked: 0,\n filesTransformed: 0,\n startTime: Date.now()\n };\n }\n return {\n optimizeDeps: {\n rolldownOptions: {\n plugins: [\n {\n name: `transform-before-optimize-deps-${environment}`,\n async transform(code, id) {\n if (!nodeModulesFilter.test(id)) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesChecked++;\n const production = process.env.NODE_ENV === \"production\" || process.env.NODE_ENV === \"test\";\n debug?.(`[rolldown optimizeDeps] ${id}`);\n const result = await performBabelTransform({\n id,\n code,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n if (!result) {\n return null;\n }\n perfStats.optimizeDeps.byEnvironment[environment].filesTransformed++;\n return {\n code: result.code,\n map: result.map\n };\n },\n buildEnd() {\n if (process.env.DEBUG_COMPILER_PERF) {\n const stats = perfStats.optimizeDeps.byEnvironment[environment];\n const elapsed = Date.now() - stats.startTime;\n console.info(\n `[optimizeDeps ${environment}] Done: ${stats.filesChecked} files checked, ${stats.filesTransformed} transformed (${elapsed}ms)`\n );\n }\n const allDone = Object.keys(perfStats.optimizeDeps.byEnvironment).length >= 2;\n if (allDone) {\n logCacheStats();\n logPerfSummary();\n }\n }\n }\n ]\n }\n },\n define: {\n \"process.env.NATIVEWIND_OS\": JSON.stringify(\n environment === \"ios\" || environment === \"android\" ? \"native\" : \"web\"\n )\n }\n };\n };\n return {\n environments: {\n ios: createEnvironmentConfig(\"ios\"),\n android: createEnvironmentConfig(\"android\"),\n client: createEnvironmentConfig(\"client\"),\n ssr: createEnvironmentConfig(\"ssr\")\n }\n };\n },\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n async transform(codeIn, _id) {\n let code = codeIn;\n const environment = getEnvName(this.environment.name);\n const isNative = environment === \"ios\" || environment === \"android\";\n const production = config.command === \"build\" || process.env.NODE_ENV === \"production\" || JSON.parse(\n this.environment.config?.define?.[\"process.env.NODE_ENV\"] || '\"\"'\n ) === \"production\";\n const isEntry = _id.includes(\"one-entry-native\");\n if (isEntry) {\n if (isNative && !production) {\n code = `import '@vxrn/vite-native-client'\n${code}`;\n }\n if (isNative && configuration.enableNativewind) {\n code = `import * as x from 'nativewind'\n${code}`;\n }\n return code;\n }\n const id = _id.split(\"?\")[0];\n const extension = extname(id);\n if (extension === \".css\" || !validParsers.has(extension)) {\n return;\n }\n if (id.includes(`virtual:`)) {\n return;\n }\n if (codeIn.endsWith(`// vxrn-did-babel`)) {\n debug?.(`[skip babel] ${id}`);\n return;\n }\n return performBabelTransform({\n id,\n code: codeIn,\n projectRoot: config.root,\n environment,\n production,\n reactForRNVersion,\n optionsIn\n });\n }\n },\n // wraps client-side TSX/JSX with React Refresh preamble + import.meta.hot.accept\n // runs after vite:oxc (no enforce:'pre') so it sees the already-transformed code\n {\n name: \"one:react-refresh-web\",\n apply: \"serve\",\n transform(code, _id) {\n if (this.environment.name !== \"client\") return;\n if (code.includes(runtimePublicPath)) return;\n if (/[?&](?:worker|sharedworker|raw|url)\\b/.test(_id)) return;\n const id = _id.split(\"?\")[0];\n if (id.includes(\"node_modules\")) return;\n if (id.includes(\"virtual:\")) return;\n if (id === runtimePublicPath) return;\n const ext = extname(id);\n if (ext !== \".tsx\" && ext !== \".jsx\") return;\n const hasRefreshCalls = /\\$RefreshReg\\$\\(/.test(code);\n let out = `import * as RefreshRuntime from \"${runtimePublicPath}\";\n\n`;\n if (hasRefreshCalls) {\n out += `if (!window.$RefreshReg$) throw new Error(\"React refresh preamble was not loaded. Something is wrong.\");\nconst prevRefreshReg = window.$RefreshReg$;\nconst prevRefreshSig = window.$RefreshSig$;\nwindow.$RefreshReg$ = RefreshRuntime.getRefreshReg(\"${id}\");\nwindow.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\n\n`;\n }\n out += code;\n if (hasRefreshCalls) {\n out += `\n\nwindow.$RefreshReg$ = prevRefreshReg;\nwindow.$RefreshSig$ = prevRefreshSig;\n`;\n }\n out += `\nRefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {\n RefreshRuntime.registerExportsForReactRefresh(\"${id}\", currentExports);\n import.meta.hot.accept((nextExports) => {\n if (!nextExports) return;\n const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(\"${id}\", currentExports, nextExports);\n if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);\n });\n});\n`;\n return { code: out, map: null };\n }\n }\n ];\n}\nexport {\n JS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iBAAiB,GAAG;IACtC,IAAI,wCAAwC,KAAK,GAAG,GAAG;IACvD,MAAM,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC;IAC1B,IAAI,GAAG,SAAS,cAAc,GAAG;IACjC,IAAI,GAAG,SAAS,UAAU,GAAG;IAC7B,IAAI,OAAO,mBAAmB;IAC9B,MAAM,MAAM,QAAQ,EAAE;IACtB,IAAI,QAAQ,UAAU,QAAQ,QAAQ;IACtC,MAAM,kBAAkB,mBAAmB,KAAK,IAAI;IACpD,IAAI,MAAM,oCAAoC,kBAAkB;;;IAGhE,IAAI,iBAAiB;KACnB,OAAO;;;sDAGqC,GAAG;;;;IAIjD;IACA,OAAO;IACP,IAAI,iBAAiB;KACnB,OAAO;;;;;IAKT;IACA,OAAO;;mDAEoC,GAAG;;;wFAGkC,GAAG;;;;;IAKnF,OAAO;KAAE,MAAM;KAAK,KAAK;IAAK;GAChC;EACF;CACF;AACF"}
@@ -46,6 +46,7 @@ function getBabelOptions(props) {
46
46
  if (typeof props.userSetting === "undefined" || typeof props.userSetting === "object" && props.userSetting.transform === "babel") {
47
47
  if (props.userSetting?.excludeDefaultPlugins) {
48
48
  return {
49
+ caller: getBabelCaller(props),
49
50
  ...props.userSetting,
50
51
  ...userBabelConfig ? {
51
52
  configFile: userBabelConfig,
@@ -89,6 +90,7 @@ const getOptions = (props, force = false, userBabelConfig = null) => {
89
90
  if (plugins.length || userBabelConfig) {
90
91
  return {
91
92
  plugins,
93
+ caller: getBabelCaller(props),
92
94
  ...userBabelConfig ? {
93
95
  configFile: userBabelConfig,
94
96
  babelrc: true
@@ -97,6 +99,14 @@ const getOptions = (props, force = false, userBabelConfig = null) => {
97
99
  }
98
100
  return null;
99
101
  };
102
+ function getBabelCaller(props) {
103
+ const caller = {
104
+ name: "vxrn",
105
+ platform: props.environment === "ios" || props.environment === "android" ? props.environment : "web",
106
+ isDev: props.development
107
+ };
108
+ return caller;
109
+ }
100
110
  async function transformOxcReactCompiler(id, code, optionsOrTarget = "19", sourceMap = false) {
101
111
  const { transform } = await import("oxc-transform-react");
102
112
  const compilerOptions = typeof optionsOrTarget === "string" ? { target: optionsOrTarget } : optionsOrTarget || {};
@@ -137,8 +147,13 @@ async function transformBabel(id, code, options) {
137
147
  sourceMaps: false,
138
148
  minified: false,
139
149
  ...options,
150
+ ...!isTS ? { parserOpts: {
151
+ ...options.parserOpts,
152
+ plugins: [...options.parserOpts?.plugins || [], "jsx"]
153
+ } } : {},
140
154
  caller: {
141
155
  name: "vxrn",
156
+ ...options.caller,
142
157
  supportsStaticESM: true,
143
158
  supportsDynamicImport: true
144
159
  },
@@ -1 +1 @@
1
- {"version":3,"file":"transformBabel.js","names":[],"sources":["esm/transformBabel.js"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { extname, join, relative } from \"node:path\";\nimport { resolvePath } from \"@vxrn/utils\";\nimport { normalizePath } from \"vite\";\nimport { configuration } from \"./configure\";\nimport { asyncGeneratorRegex, debug } from \"./constants\";\nconst USER_BABEL_CONFIG_FILES = [\n \"babel.config.js\",\n \"babel.config.cjs\",\n \"babel.config.mjs\",\n \"babel.config.json\",\n \".babelrc\",\n \".babelrc.js\",\n \".babelrc.json\"\n];\nconst ONE_GENERATED_MARKER = \"@one/generated bundler-config\";\nfunction findUserBabelConfig(projectRoot) {\n if (!projectRoot) return null;\n for (const name of USER_BABEL_CONFIG_FILES) {\n const fullPath = join(projectRoot, name);\n if (existsSync(fullPath)) {\n try {\n const content = readFileSync(fullPath, \"utf8\");\n if (content.includes(ONE_GENERATED_MARKER)) {\n continue;\n }\n } catch {\n continue;\n }\n return fullPath;\n }\n }\n return null;\n}\nfunction getBabelOptions(props) {\n props = { ...props, id: normalizePath(props.id.split(\"?\")[0]) };\n const isProjectFile = !props.id.includes(\"node_modules\");\n const userBabelConfig = isProjectFile && props.projectRoot ? findUserBabelConfig(props.projectRoot) : null;\n if (props.userSetting === \"babel\") {\n return getOptions(props, true, userBabelConfig);\n }\n if (typeof props.userSetting === \"undefined\" || typeof props.userSetting === \"object\" && props.userSetting.transform === \"babel\") {\n if (props.userSetting?.excludeDefaultPlugins) {\n return {\n ...props.userSetting,\n ...userBabelConfig ? { configFile: userBabelConfig, babelrc: true } : {}\n };\n }\n return getOptions(props, false, userBabelConfig);\n }\n const userSetting = props.userSetting;\n if (userSetting === \"swc\" || userSetting === \"oxc\" || userSetting === false || typeof userSetting === \"object\" && userSetting !== null && (userSetting.transform === \"swc\" || userSetting.transform === \"oxc\")) {\n return null;\n }\n if (userBabelConfig) {\n return getOptions(props, false, userBabelConfig);\n }\n return null;\n}\nconst getOptions = (props, force = false, userBabelConfig = null) => {\n let plugins = [];\n if (force || shouldBabelGenerators(props)) {\n plugins = getBasePlugins(props);\n }\n const enableNativewind = configuration.enableNativewind && (props.environment === \"ios\" || props.environment === \"android\") && // if reanimated gets wrapped in transform it causes circular dep issues\n !/node_modules/.test(props.id) && // only needed for createElement calls, so be a bit conservative\n props.code.includes(\"createElement\");\n if (enableNativewind) {\n if (!props.id.includes(\"node_modules\")) {\n plugins.push(resolvePath(\"react-native-css-interop/dist/babel-plugin.js\"));\n }\n }\n if (enableNativewind || shouldBabelReanimated(props)) {\n try {\n const workletsPlugin = resolvePath(\n \"react-native-worklets/plugin\",\n props.projectRoot\n );\n debug?.(`Using babel worklets on file ${props.id}`);\n plugins.push(workletsPlugin);\n } catch {\n }\n }\n if (shouldBabelReactCompiler(props)) {\n debug?.(`Using babel react compiler on file`);\n plugins.push(getBabelReactCompilerPlugin(props));\n }\n if (plugins.length || userBabelConfig) {\n return {\n plugins,\n ...userBabelConfig ? { configFile: userBabelConfig, babelrc: true } : {}\n };\n }\n return null;\n};\nasync function transformOxcReactCompiler(id, code, optionsOrTarget = \"19\", sourceMap = false) {\n const { transform } = await import(\"oxc-transform-react\");\n const compilerOptions = typeof optionsOrTarget === \"string\" ? { target: optionsOrTarget } : optionsOrTarget || {};\n const target = compilerOptions.target ?? \"19\";\n const result = await transform(id, code, {\n jsx: \"preserve\",\n sourcemap: sourceMap,\n reactCompiler: {\n target,\n ...compilerOptions,\n environment: {\n enableCustomTypeDefinitionForReanimated: true,\n ...compilerOptions.environment\n }\n }\n });\n if (result.fatal) {\n throw new Error(\n `[vxrn:compiler] oxc react compiler failed on ${id}: ${(result.errors ?? []).map((e) => e.message ?? String(e)).join(\", \")}`\n );\n }\n if (result.errors?.length) {\n debug?.(\n `[compiler/bailout] ${id}: ${result.errors.map((e) => e.message ?? String(e)).join(\", \")}`\n );\n }\n return {\n code: result.code,\n map: sourceMap ? result.map : void 0\n };\n}\nasync function transformBabel(id, code, options) {\n const [{ default: babelCore }, { default: hermesParserPlugin }] = await Promise.all([\n import(\"@babel/core\"),\n import(\"babel-plugin-syntax-hermes-parser\")\n ]);\n const extension = extname(id);\n const isTSX = extension === \".tsx\";\n const isTS = isTSX || extension === \".ts\";\n const babelOptions = {\n filename: id,\n compact: false,\n babelrc: options.babelrc ?? false,\n configFile: options.configFile ?? false,\n sourceMaps: false,\n minified: false,\n ...options,\n // vite and rolldown own module syntax and import.meta, so presets written for\n // metro (babel-preset-expo) must keep esm instead of rewriting it for metro's runtime\n caller: {\n name: \"vxrn\",\n supportsStaticESM: true,\n supportsDynamicImport: true\n },\n presets: [\n isTS ? [\n \"@babel/preset-typescript\",\n {\n isTSX,\n allExtensions: isTSX\n }\n ] : \"\",\n ...options.presets || []\n ].filter(Boolean),\n // non-TS files use React Native's Flow dialect. RN's own component specs are\n // Flow `.js` (`import type`, `codegenNativeComponent<T>(…)`, `(expr: Type)` casts).\n // enable Hermes Flow parsing + stripping, mirroring the TypeScript preset above\n // (`@react-native/babel-preset` uses the same parser for JS). without it babel\n // can't parse current RN Flow syntax such as `call<T>(...) as HostComponent<T>`, so\n // plugins like\n // @react-native/babel-plugin-codegen silently fail on RN specs and the runtime\n // \"Codegen didn't run\" warning fires. TS path is byte-identical (empty slice).\n plugins: [\n ...isTS ? [] : [\n [hermesParserPlugin, { parseLangTypes: \"flow\", reactRuntimeTarget: \"19\" }],\n \"babel-plugin-transform-flow-enums\"\n ],\n ...options.plugins || [],\n ...isTS ? [] : [\"@babel/plugin-transform-flow-strip-types\"]\n ]\n };\n return await new Promise((res, rej) => {\n babelCore.transform(code, babelOptions, (err, result) => {\n if (!result || err) {\n return rej(err || new Error(`[vxrn:compiler] babel returned no result for ${id}`));\n }\n res(result);\n });\n });\n}\nasync function stripFlowTypes(id, code, sourceMaps = true) {\n const result = await transformBabel(id, code, { sourceMaps });\n return {\n code: result.code,\n map: result.map\n };\n}\nconst getBasePlugins = ({ development }) => [\n [\"@babel/plugin-transform-destructuring\"],\n [\"@babel/plugin-transform-react-jsx\", { development }],\n [\"@babel/plugin-transform-async-generator-functions\"],\n [\"@babel/plugin-transform-async-to-generator\"],\n [\n \"@babel/plugin-transform-runtime\",\n {\n helpers: true,\n // NOTE THIS WAS SPELLED WRONG BEFOER THIS COMMIT MAYBE IT WAS UNINTENTIONALLY WORKING\n regenerator: false\n }\n ]\n];\nconst shouldBabelReactCompiler = (props) => {\n if (props.environment === \"ssr\") {\n return false;\n }\n if (!configuration.enableCompiler) {\n return false;\n }\n const { enableCompiler } = configuration;\n if (typeof enableCompiler === \"object\" && !Array.isArray(enableCompiler) && !(enableCompiler instanceof RegExp)) {\n const isNative = props.environment === \"ios\" || props.environment === \"android\";\n const filter = isNative ? enableCompiler.native : enableCompiler.web;\n if (!filter) return false;\n return applyCompilerFilter(filter, props);\n }\n if (typeof enableCompiler === \"function\") {\n return enableCompiler(props.id, props.environment);\n }\n if (enableCompiler instanceof RegExp) {\n return enableCompiler.test(props.id);\n }\n if (Array.isArray(enableCompiler)) {\n if (!enableCompiler.includes(props.environment)) {\n return false;\n }\n }\n return applyDefaultFilters(props);\n};\nfunction applyCompilerFilter(filter, props) {\n if (typeof filter === \"function\") {\n return filter(props.id, props.environment);\n }\n if (filter instanceof RegExp) {\n return filter.test(props.id);\n }\n if (filter === true) {\n return applyDefaultFilters(props);\n }\n return false;\n}\nfunction applyDefaultFilters(props) {\n if (!/(\\.tsx?)$/.test(props.id)) return false;\n if (props.id.includes(\"node_modules\")) return false;\n if (props.id.includes(\"+api.\")) return false;\n if (props.code.startsWith(\"// disable-compiler\")) return false;\n return true;\n}\nconst getBabelReactCompilerPlugin = (props) => {\n const target = props.reactForRNVersion === \"18\" && (props.environment === \"ios\" || props.environment === \"android\") ? \"18\" : \"19\";\n return [\"babel-plugin-react-compiler\", { target }];\n};\nfunction shouldBabelGenerators({ code }) {\n if (process.env.VXRN_USE_BABEL_FOR_GENERATORS) {\n return asyncGeneratorRegex.test(code);\n }\n}\nconst REANIMATED_AUTOWORKLETIZATION_KEYWORDS = [\n \"worklet\",\n \"useAnimatedGestureHandler\",\n \"useAnimatedScrollHandler\",\n \"useFrameCallback\",\n \"useAnimatedStyle\",\n \"useAnimatedProps\",\n \"createAnimatedPropAdapter\",\n \"useDerivedValue\",\n \"useAnimatedReaction\",\n \"useWorkletCallback\",\n \"withTiming\",\n \"withSpring\",\n \"withDecay\",\n \"withRepeat\",\n \"runOnUI\",\n \"executeOnUIRuntimeSync\"\n];\nconst REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join(\"|\"));\nconst REANIMATED_IGNORED_PATHS = [\n // Prebuilt/vendored react-native that shouldn't be transformed\n \"react-native-prebuilt\",\n \"node_modules/.vxrn/react-native\",\n // Known false positives - they mention worklet keywords in comments/strings but don't use them\n \"node_modules/react/\",\n \"node_modules/react-dom/\",\n \"node_modules/react-native/\",\n \"node_modules/react-native-web/\"\n];\nconst REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join(\"|\"));\nfunction shouldBabelReanimated({ code, id }) {\n if (!configuration.enableReanimated) {\n return false;\n }\n if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {\n return false;\n }\n if (REANIMATED_REGEX.test(code)) {\n const location = id.includes(\"node_modules\") ? \"node_modules\" : \"user-code\";\n debug?.(` \\u{1FA84} [reanimated/${location}] ${relative(process.cwd(), id)}`);\n return true;\n }\n return false;\n}\nexport {\n findUserBabelConfig,\n getBabelOptions,\n stripFlowTypes,\n transformBabel,\n transformOxcReactCompiler\n};\n//# sourceMappingURL=transformBabel.js.map\n"],"mappings":";;;;;;;;AAMA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,uBAAuB;AAC7B,SAAS,oBAAoB,aAAa;CACxC,IAAI,CAAC,aAAa,OAAO;CACzB,KAAK,MAAM,QAAQ,yBAAyB;EAC1C,MAAM,WAAW,KAAK,aAAa,IAAI;EACvC,IAAI,WAAW,QAAQ,GAAG;GACxB,IAAI;IACF,MAAM,UAAU,aAAa,UAAU,MAAM;IAC7C,IAAI,QAAQ,SAAS,oBAAoB,GAAG;KAC1C;IACF;GACF,QAAQ;IACN;GACF;GACA,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,SAAS,gBAAgB,OAAO;CAC9B,QAAQ;EAAE,GAAG;EAAO,IAAI,cAAc,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE;CAAE;CAC9D,MAAM,gBAAgB,CAAC,MAAM,GAAG,SAAS,cAAc;CACvD,MAAM,kBAAkB,iBAAiB,MAAM,cAAc,oBAAoB,MAAM,WAAW,IAAI;CACtG,IAAI,MAAM,gBAAgB,SAAS;EACjC,OAAO,WAAW,OAAO,MAAM,eAAe;CAChD;CACA,IAAI,OAAO,MAAM,gBAAgB,eAAe,OAAO,MAAM,gBAAgB,YAAY,MAAM,YAAY,cAAc,SAAS;EAChI,IAAI,MAAM,aAAa,uBAAuB;GAC5C,OAAO;IACL,GAAG,MAAM;IACT,GAAG,kBAAkB;KAAE,YAAY;KAAiB,SAAS;IAAK,IAAI,CAAC;GACzE;EACF;EACA,OAAO,WAAW,OAAO,OAAO,eAAe;CACjD;CACA,MAAM,cAAc,MAAM;CAC1B,IAAI,gBAAgB,SAAS,gBAAgB,SAAS,gBAAgB,SAAS,OAAO,gBAAgB,Y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ACT;CACA,IAAI,iBAAiB,KAAK,IAAI,GAAG;EAC/B,MAAM,WAAW,GAAG,SAAS,cAAc,IAAI,iBAAiB;EAChE,QAAQ,0BAA0B,SAAS,IAAI,SAAS,QAAQ,IAAI,GAAG,EAAE,GAAG;EAC5E,OAAO;CACT;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"transformBabel.js","names":[],"sources":["esm/transformBabel.js"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { extname, join, relative } from \"node:path\";\nimport { resolvePath } from \"@vxrn/utils\";\nimport { normalizePath } from \"vite\";\nimport { configuration } from \"./configure\";\nimport { asyncGeneratorRegex, debug } from \"./constants\";\nconst USER_BABEL_CONFIG_FILES = [\n \"babel.config.js\",\n \"babel.config.cjs\",\n \"babel.config.mjs\",\n \"babel.config.json\",\n \".babelrc\",\n \".babelrc.js\",\n \".babelrc.json\"\n];\nconst ONE_GENERATED_MARKER = \"@one/generated bundler-config\";\nfunction findUserBabelConfig(projectRoot) {\n if (!projectRoot) return null;\n for (const name of USER_BABEL_CONFIG_FILES) {\n const fullPath = join(projectRoot, name);\n if (existsSync(fullPath)) {\n try {\n const content = readFileSync(fullPath, \"utf8\");\n if (content.includes(ONE_GENERATED_MARKER)) {\n continue;\n }\n } catch {\n continue;\n }\n return fullPath;\n }\n }\n return null;\n}\nfunction getBabelOptions(props) {\n props = { ...props, id: normalizePath(props.id.split(\"?\")[0]) };\n const isProjectFile = !props.id.includes(\"node_modules\");\n const userBabelConfig = isProjectFile && props.projectRoot ? findUserBabelConfig(props.projectRoot) : null;\n if (props.userSetting === \"babel\") {\n return getOptions(props, true, userBabelConfig);\n }\n if (typeof props.userSetting === \"undefined\" || typeof props.userSetting === \"object\" && props.userSetting.transform === \"babel\") {\n if (props.userSetting?.excludeDefaultPlugins) {\n return {\n caller: getBabelCaller(props),\n ...props.userSetting,\n ...userBabelConfig ? { configFile: userBabelConfig, babelrc: true } : {}\n };\n }\n return getOptions(props, false, userBabelConfig);\n }\n const userSetting = props.userSetting;\n if (userSetting === \"swc\" || userSetting === \"oxc\" || userSetting === false || typeof userSetting === \"object\" && userSetting !== null && (userSetting.transform === \"swc\" || userSetting.transform === \"oxc\")) {\n return null;\n }\n if (userBabelConfig) {\n return getOptions(props, false, userBabelConfig);\n }\n return null;\n}\nconst getOptions = (props, force = false, userBabelConfig = null) => {\n let plugins = [];\n if (force || shouldBabelGenerators(props)) {\n plugins = getBasePlugins(props);\n }\n const enableNativewind = configuration.enableNativewind && (props.environment === \"ios\" || props.environment === \"android\") && // if reanimated gets wrapped in transform it causes circular dep issues\n !/node_modules/.test(props.id) && // only needed for createElement calls, so be a bit conservative\n props.code.includes(\"createElement\");\n if (enableNativewind) {\n if (!props.id.includes(\"node_modules\")) {\n plugins.push(resolvePath(\"react-native-css-interop/dist/babel-plugin.js\"));\n }\n }\n if (enableNativewind || shouldBabelReanimated(props)) {\n try {\n const workletsPlugin = resolvePath(\n \"react-native-worklets/plugin\",\n props.projectRoot\n );\n debug?.(`Using babel worklets on file ${props.id}`);\n plugins.push(workletsPlugin);\n } catch {\n }\n }\n if (shouldBabelReactCompiler(props)) {\n debug?.(`Using babel react compiler on file`);\n plugins.push(getBabelReactCompilerPlugin(props));\n }\n if (plugins.length || userBabelConfig) {\n return {\n plugins,\n caller: getBabelCaller(props),\n ...userBabelConfig ? { configFile: userBabelConfig, babelrc: true } : {}\n };\n }\n return null;\n};\nfunction getBabelCaller(props) {\n const caller = {\n name: \"vxrn\",\n platform: props.environment === \"ios\" || props.environment === \"android\" ? props.environment : \"web\",\n isDev: props.development\n };\n return caller;\n}\nasync function transformOxcReactCompiler(id, code, optionsOrTarget = \"19\", sourceMap = false) {\n const { transform } = await import(\"oxc-transform-react\");\n const compilerOptions = typeof optionsOrTarget === \"string\" ? { target: optionsOrTarget } : optionsOrTarget || {};\n const target = compilerOptions.target ?? \"19\";\n const result = await transform(id, code, {\n jsx: \"preserve\",\n sourcemap: sourceMap,\n reactCompiler: {\n target,\n ...compilerOptions,\n environment: {\n enableCustomTypeDefinitionForReanimated: true,\n ...compilerOptions.environment\n }\n }\n });\n if (result.fatal) {\n throw new Error(\n `[vxrn:compiler] oxc react compiler failed on ${id}: ${(result.errors ?? []).map((e) => e.message ?? String(e)).join(\", \")}`\n );\n }\n if (result.errors?.length) {\n debug?.(\n `[compiler/bailout] ${id}: ${result.errors.map((e) => e.message ?? String(e)).join(\", \")}`\n );\n }\n return {\n code: result.code,\n map: sourceMap ? result.map : void 0\n };\n}\nasync function transformBabel(id, code, options) {\n const [{ default: babelCore }, { default: hermesParserPlugin }] = await Promise.all([\n import(\"@babel/core\"),\n import(\"babel-plugin-syntax-hermes-parser\")\n ]);\n const extension = extname(id);\n const isTSX = extension === \".tsx\";\n const isTS = isTSX || extension === \".ts\";\n const babelOptions = {\n filename: id,\n compact: false,\n babelrc: options.babelrc ?? false,\n configFile: options.configFile ?? false,\n sourceMaps: false,\n minified: false,\n ...options,\n ...!isTS ? {\n parserOpts: {\n ...options.parserOpts,\n plugins: [...options.parserOpts?.plugins || [], \"jsx\"]\n }\n } : {},\n // vite and rolldown own module syntax and import.meta, so presets written for\n // metro (babel-preset-expo) must keep esm instead of rewriting it for metro's runtime\n caller: {\n name: \"vxrn\",\n ...options.caller,\n supportsStaticESM: true,\n supportsDynamicImport: true\n },\n presets: [\n isTS ? [\n \"@babel/preset-typescript\",\n {\n isTSX,\n allExtensions: isTSX\n }\n ] : \"\",\n ...options.presets || []\n ].filter(Boolean),\n // non-TS files use React Native's Flow dialect. RN's own component specs are\n // Flow `.js` (`import type`, `codegenNativeComponent<T>(…)`, `(expr: Type)` casts).\n // enable Hermes Flow parsing + stripping, mirroring the TypeScript preset above\n // (`@react-native/babel-preset` uses the same parser for JS). without it babel\n // can't parse current RN Flow syntax such as `call<T>(...) as HostComponent<T>`, so\n // plugins like\n // @react-native/babel-plugin-codegen silently fail on RN specs and the runtime\n // \"Codegen didn't run\" warning fires. TS path is byte-identical (empty slice).\n plugins: [\n ...isTS ? [] : [\n [hermesParserPlugin, { parseLangTypes: \"flow\", reactRuntimeTarget: \"19\" }],\n \"babel-plugin-transform-flow-enums\"\n ],\n ...options.plugins || [],\n ...isTS ? [] : [\"@babel/plugin-transform-flow-strip-types\"]\n ]\n };\n return await new Promise((res, rej) => {\n babelCore.transform(code, babelOptions, (err, result) => {\n if (!result || err) {\n return rej(err || new Error(`[vxrn:compiler] babel returned no result for ${id}`));\n }\n res(result);\n });\n });\n}\nasync function stripFlowTypes(id, code, sourceMaps = true) {\n const result = await transformBabel(id, code, { sourceMaps });\n return {\n code: result.code,\n map: result.map\n };\n}\nconst getBasePlugins = ({ development }) => [\n [\"@babel/plugin-transform-destructuring\"],\n [\"@babel/plugin-transform-react-jsx\", { development }],\n [\"@babel/plugin-transform-async-generator-functions\"],\n [\"@babel/plugin-transform-async-to-generator\"],\n [\n \"@babel/plugin-transform-runtime\",\n {\n helpers: true,\n // NOTE THIS WAS SPELLED WRONG BEFOER THIS COMMIT MAYBE IT WAS UNINTENTIONALLY WORKING\n regenerator: false\n }\n ]\n];\nconst shouldBabelReactCompiler = (props) => {\n if (props.environment === \"ssr\") {\n return false;\n }\n if (!configuration.enableCompiler) {\n return false;\n }\n const { enableCompiler } = configuration;\n if (typeof enableCompiler === \"object\" && !Array.isArray(enableCompiler) && !(enableCompiler instanceof RegExp)) {\n const isNative = props.environment === \"ios\" || props.environment === \"android\";\n const filter = isNative ? enableCompiler.native : enableCompiler.web;\n if (!filter) return false;\n return applyCompilerFilter(filter, props);\n }\n if (typeof enableCompiler === \"function\") {\n return enableCompiler(props.id, props.environment);\n }\n if (enableCompiler instanceof RegExp) {\n return enableCompiler.test(props.id);\n }\n if (Array.isArray(enableCompiler)) {\n if (!enableCompiler.includes(props.environment)) {\n return false;\n }\n }\n return applyDefaultFilters(props);\n};\nfunction applyCompilerFilter(filter, props) {\n if (typeof filter === \"function\") {\n return filter(props.id, props.environment);\n }\n if (filter instanceof RegExp) {\n return filter.test(props.id);\n }\n if (filter === true) {\n return applyDefaultFilters(props);\n }\n return false;\n}\nfunction applyDefaultFilters(props) {\n if (!/(\\.tsx?)$/.test(props.id)) return false;\n if (props.id.includes(\"node_modules\")) return false;\n if (props.id.includes(\"+api.\")) return false;\n if (props.code.startsWith(\"// disable-compiler\")) return false;\n return true;\n}\nconst getBabelReactCompilerPlugin = (props) => {\n const target = props.reactForRNVersion === \"18\" && (props.environment === \"ios\" || props.environment === \"android\") ? \"18\" : \"19\";\n return [\"babel-plugin-react-compiler\", { target }];\n};\nfunction shouldBabelGenerators({ code }) {\n if (process.env.VXRN_USE_BABEL_FOR_GENERATORS) {\n return asyncGeneratorRegex.test(code);\n }\n}\nconst REANIMATED_AUTOWORKLETIZATION_KEYWORDS = [\n \"worklet\",\n \"useAnimatedGestureHandler\",\n \"useAnimatedScrollHandler\",\n \"useFrameCallback\",\n \"useAnimatedStyle\",\n \"useAnimatedProps\",\n \"createAnimatedPropAdapter\",\n \"useDerivedValue\",\n \"useAnimatedReaction\",\n \"useWorkletCallback\",\n \"withTiming\",\n \"withSpring\",\n \"withDecay\",\n \"withRepeat\",\n \"runOnUI\",\n \"executeOnUIRuntimeSync\"\n];\nconst REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join(\"|\"));\nconst REANIMATED_IGNORED_PATHS = [\n // Prebuilt/vendored react-native that shouldn't be transformed\n \"react-native-prebuilt\",\n \"node_modules/.vxrn/react-native\",\n // Known false positives - they mention worklet keywords in comments/strings but don't use them\n \"node_modules/react/\",\n \"node_modules/react-dom/\",\n \"node_modules/react-native/\",\n \"node_modules/react-native-web/\"\n];\nconst REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join(\"|\"));\nfunction shouldBabelReanimated({ code, id }) {\n if (!configuration.enableReanimated) {\n return false;\n }\n if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {\n return false;\n }\n if (REANIMATED_REGEX.test(code)) {\n const location = id.includes(\"node_modules\") ? \"node_modules\" : \"user-code\";\n debug?.(` \\u{1FA84} [reanimated/${location}] ${relative(process.cwd(), id)}`);\n return true;\n }\n return false;\n}\nexport {\n findUserBabelConfig,\n getBabelOptions,\n stripFlowTypes,\n transformBabel,\n transformOxcReactCompiler\n};\n//# sourceMappingURL=transformBabel.js.map\n"],"mappings":";;;;;;;;AAMA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,uBAAuB;AAC7B,SAAS,oBAAoB,aAAa;CACxC,IAAI,CAAC,aAAa,OAAO;CACzB,KAAK,MAAM,QAAQ,yBAAyB;EAC1C,MAAM,WAAW,KAAK,aAAa,IAAI;EACvC,IAAI,WAAW,QAAQ,GAAG;GACxB,IAAI;IACF,MAAM,UAAU,aAAa,UAAU,MAAM;IAC7C,IAAI,QAAQ,SAAS,oBAAoB,GAAG;KAC1C;IACF;GACF,QAAQ;IACN;GACF;GACA,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,SAAS,gBAAgB,OAAO;CAC9B,QAAQ;EAAE,GAAG;EAAO,IAAI,cAAc,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE;CAAE;CAC9D,MAAM,gBAAgB,CAAC,MAAM,GAAG,SAAS,cAAc;CACvD,MAAM,kBAAkB,iBAAiB,MAAM,cAAc,oBAAoB,MAAM,WAAW,IAAI;CACtG,IAAI,MAAM,gBAAgB,SAAS;EACjC,OAAO,WAAW,OAAO,MAAM,eAAe;CAChD;CACA,IAAI,OAAO,MAAM,gBAAgB,eAAe,OAAO,MAAM,gBAAgB,YAAY,MAAM,YAAY,cAAc,SAAS;EAChI,IAAI,MAAM,aAAa,uBAAuB;GAC5C,OAAO;IACL,QAAQ,eAAe,KAAK;IAC5B,GAAG,MAAM;IACT,GAAG,kBAAkB;KAAE,YAAY;KAAiB,SAAS;IAAK,IAAI,CAAC;GACzE;EACF;EACA,OAAO,WAAW,OAAO,OAAO,eAAe;CACjD;CACA,MAAM,cAAc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A,MAAM,yCAAyC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,mBAAmB,IAAI,OAAO,uCAAuC,KAAK,GAAG,CAAC;AACpF,MAAM,2BAA2B;CAE/B;CACA;CAEA;CACA;CACA;CACA;AACF;AACA,MAAM,iCAAiC,IAAI,OAAO,yBAAyB,KAAK,GAAG,CAAC;AACpF,SAAS,sBAAsB,EAAE,MAAM,MAAM;CAC3C,IAAI,CAAC,cAAc,kBAAkB;EACnC,OAAO;CACT;CACA,IAAI,+BAA+B,KAAK,EAAE,GAAG;EAC3C,OAAO;CACT;CACA,IAAI,iBAAiB,KAAK,IAAI,GAAG;EAC/B,MAAM,WAAW,GAAG,SAAS,cAAc,IAAI,iBAAiB;EAChE,QAAQ,0BAA0B,SAAS,IAAI,SAAS,QAAQ,IAAI,GAAG,EAAE,GAAG;EAC5E,OAAO;CACT;CACA,OAAO;AACT"}
@@ -0,0 +1,24 @@
1
+ async function transformHermesClasses(code, filename, sourceMaps = false) {
2
+ if (!/\b(?:class(?:\s|\{)|(?:let|const)\s)/.test(code)) return;
3
+ const [{ transformAsync }, { default: transformClasses }, { default: transformBlockScoping }] = await Promise.all([
4
+ import("@babel/core"),
5
+ import("@babel/plugin-transform-classes"),
6
+ import("@babel/plugin-transform-block-scoping")
7
+ ]);
8
+ const result = await transformAsync(code, {
9
+ filename,
10
+ babelrc: false,
11
+ configFile: false,
12
+ sourceMaps,
13
+ parserOpts: { plugins: ["jsx"] },
14
+ plugins: [transformClasses, transformBlockScoping]
15
+ });
16
+ if (!result?.code) return;
17
+ return {
18
+ code: result.code,
19
+ map: result.map
20
+ };
21
+ }
22
+
23
+ export { transformHermesClasses };
24
+ //# sourceMappingURL=transformHermesClasses.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformHermesClasses.js","names":[],"sources":["esm/transformHermesClasses.js"],"sourcesContent":["async function transformHermesClasses(code, filename, sourceMaps = false) {\n if (!/\\b(?:class(?:\\s|\\{)|(?:let|const)\\s)/.test(code)) return;\n const [\n { transformAsync },\n { default: transformClasses },\n { default: transformBlockScoping }\n ] = await Promise.all([\n import(\"@babel/core\"),\n import(\"@babel/plugin-transform-classes\"),\n import(\"@babel/plugin-transform-block-scoping\")\n ]);\n const result = await transformAsync(code, {\n filename,\n babelrc: false,\n configFile: false,\n sourceMaps,\n parserOpts: { plugins: [\"jsx\"] },\n // Legacy Hermes hoists lexical names, including in class-free functions.\n // Lower block scope so minification cannot shadow parameters or constructors.\n plugins: [transformClasses, transformBlockScoping]\n });\n if (!result?.code) return;\n return { code: result.code, map: result.map };\n}\nexport {\n transformHermesClasses\n};\n//# sourceMappingURL=transformHermesClasses.js.map\n"],"mappings":";AAAA,eAAe,uBAAuB,MAAM,UAAU,aAAa,OAAO;CACxE,IAAI,CAAC,uCAAuC,KAAK,IAAI,GAAG;CACxD,MAAM,CACJ,EAAE,kBACF,EAAE,SAAS,oBACX,EAAE,SAAS,2BACT,MAAM,QAAQ,IAAI;EACpB,OAAO;EACP,OAAO;EACP,OAAO;CACT,CAAC;CACD,MAAM,SAAS,MAAM,eAAe,MAAM;EACxC;EACA,SAAS;EACT,YAAY;EACZ;EACA,YAAY,EAAE,SAAS,CAAC,KAAK,EAAE;EAG/B,SAAS,CAAC,kBAAkB,qBAAqB;CACnD,CAAC;CACD,IAAI,CAAC,QAAQ,MAAM;CACnB,OAAO;EAAE,MAAM,OAAO;EAAM,KAAK,OAAO;CAAI;AAC9C"}
@@ -11,7 +11,7 @@ function shouldStripFlow(id, code) {
11
11
  return true;
12
12
  }
13
13
  const header = code.match(/^(?:#![^\r\n]*(?:\r?\n|$))?(?:\s|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)*/)?.[0] || "";
14
- return /@flow\b/.test(header) || /\b(?:import|export)\s+type\b/.test(code);
14
+ return /@flow\b/.test(header) || /\b(?:import|export)\s+type\b/.test(code) || /\(\s*(?:\.\.\.)?[\w$]+\??\s*:\s*/.test(code) || /\)\s*:\s*(?:[\w$]+(?:<[^;{}]*>)?(?:\[\])?\s*)(?:=>|\{)/.test(code) || /^\s*[\w$]+\??\s*:\s*(?:string|number|boolean|any|mixed|void|[A-Z][\w$]*)(?:[^;\r\n=]*)(?:=[^;\r\n]*)?;/m.test(code) || /\b(?:opaque\s+)?type\s+[\w$]+(?:\s*<[^;{}]*>)?\s*=/.test(code);
15
15
  }
16
16
  async function transformSWC(id, code, options, swcOptions) {
17
17
  id = normalizePath(id.split("?")[0]).replace(normalizePath(process.cwd()), "");
@@ -1 +1 @@
1
- {"version":3,"file":"transformSWC.js","names":[],"sources":["esm/transformSWC.js"],"sourcesContent":["import { extname } from \"node:path\";\nimport { normalizePath } from \"vite\";\nimport { configuration } from \"./configure\";\nimport { asyncGeneratorRegex, debug, runtimePublicPath } from \"./constants\";\nconst ignoreId = /node_modules\\/(\\.vite|vite)\\//;\nfunction shouldStripFlow(id, code) {\n const filename = id.split(\"?\")[0];\n if (!/\\.jsx?$/.test(filename)) return false;\n if (/node_modules[\\\\/](?:react-native|@react-native)[\\\\/].*\\.js$/.test(filename)) {\n return true;\n }\n const header = code.match(/^(?:#![^\\r\\n]*(?:\\r?\\n|$))?(?:\\s|\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*)*/)?.[0] || \"\";\n return /@flow\\b/.test(header) || /\\b(?:import|export)\\s+type\\b/.test(code);\n}\nasync function transformSWC(id, code, options, swcOptions) {\n id = normalizePath(id.split(\"?\")[0]).replace(normalizePath(process.cwd()), \"\");\n if (ignoreId.test(id)) {\n return;\n }\n if (id === runtimePublicPath) {\n return;\n }\n const lang = getLang(id, options.forceJSX);\n if (!lang) {\n return;\n }\n const refresh = options.environment !== \"ssr\" && !options.production && !options.noHMR && !options.forceJSX && !id.includes(\"node_modules\");\n const importSource = configuration.enableNativewind && !id.includes(\"node_modules\") ? \"nativewind\" : \"react\";\n const shouldEs5Transform = options.es5 || !process.env.VXRN_USE_BABEL_FOR_GENERATORS && asyncGeneratorRegex.test(code);\n const target = shouldEs5Transform ? \"es2015\" : \"es2020\";\n const sourceMaps = swcOptions?.sourceMaps !== void 0 ? Boolean(swcOptions.sourceMaps) : shouldSourceMap();\n const oxcOptions = {\n lang,\n target,\n assumptions: {\n setPublicClassFields: true,\n ...swcOptions?.assumptions || {}\n },\n sourcemap: sourceMaps,\n jsx: {\n runtime: \"automatic\",\n development: !options.forceJSX && !options.production,\n refresh: Boolean(refresh),\n importSource\n }\n };\n const { transformSync } = await import(\"oxc-transform\");\n const result = (() => {\n try {\n debug?.(\n `transformSWC (oxc) ${id} using options:\n${JSON.stringify(oxcOptions, null, 2)}`\n );\n const res = transformSync(id, code, oxcOptions);\n if (res.errors?.length) {\n const err = res.errors[0];\n const error = new Error(\n err.message + (err.codeframe ? `\n${err.codeframe}` : \"\")\n );\n if (err.labels?.[0]) {\n error.start = err.labels[0].start;\n error.end = err.labels[0].end;\n }\n throw error;\n }\n return {\n code: res.code,\n map: res.map\n };\n } catch (e) {\n throw e;\n }\n })();\n if (configuration.enableNativeCSS) {\n if (result.code.includes(`createInteropElement(`)) {\n result.code = `import { createInteropElement, Fragment as _InteropFragment } from 'react-native-css-interop/jsx-dev-runtime'\n${result.code}`;\n }\n }\n const hasRefreshRuntime = refresh && refreshContentRE.test(result.code);\n if (options.fixNonTypeSpecificImports || id.includes(\"node_modules\") && (lang === \"ts\" || lang === \"tsx\")) {\n const typeExportsMatch = code.match(/^\\s*export\\s+type\\s+([^\\s]+)/gi);\n if (typeExportsMatch) {\n for (const typeExport of Array.from(typeExportsMatch)) {\n const [_export, _type, name] = typeExport.split(/\\s+/);\n if (name.startsWith(\"{\")) continue;\n if (name.includes(\"<\")) continue;\n const alreadyExported = new RegExp(\n `export (const|let|class|function) ${name}\\\\s+`\n ).test(result.code);\n if (!alreadyExported) {\n const fakeExport = `export let ${name} = {};`;\n console.info(\n ` \\u26A0\\uFE0F Fixing non-type-specific import in node_module, this should be fixed upstream: ${fakeExport} in ${id}`\n );\n result.code += `\n${fakeExport}\n`;\n }\n }\n }\n }\n if (result && !options.production && !options.noHMR) {\n return wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime);\n }\n return result;\n}\nconst transformOxc = transformSWC;\nfunction wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime) {\n if (options.environment === \"ssr\") {\n return result;\n }\n if (options.environment === \"client\") {\n return wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime);\n }\n return wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime);\n}\nfunction wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime) {\n const sourceMap = result.map ? typeof result.map === \"string\" ? JSON.parse(result.map) : { ...result.map } : void 0;\n if (sourceMap) {\n sourceMap.mappings = \";;\" + sourceMap.mappings;\n }\n result.code = `import * as RefreshRuntime from \"${runtimePublicPath}\";\n\n${result.code}`;\n if (hasRefreshRuntime) {\n if (sourceMap) {\n sourceMap.mappings = \";;;;;;\" + sourceMap.mappings;\n }\n result.code = `if (!window.$RefreshReg$) throw new Error(\"React refresh preamble was not loaded. Something is wrong.\");\nconst prevRefreshReg = window.$RefreshReg$;\nconst prevRefreshSig = window.$RefreshSig$;\nwindow.$RefreshReg$ = RefreshRuntime.getRefreshReg(\"${id}\");\nwindow.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\n\n${result.code}\n\nwindow.$RefreshReg$ = prevRefreshReg;\nwindow.$RefreshSig$ = prevRefreshSig;\n`;\n }\n result.code += `\nRefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {\n RefreshRuntime.registerExportsForReactRefresh(\"${id}\", currentExports);\n import.meta.hot.accept((nextExports) => {\n if (!nextExports) return;\n const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(\"${id}\", currentExports, nextExports);\n if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);\n });\n});\n`;\n return { code: result.code, map: sourceMap };\n}\nfunction wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime) {\n const postfixCode = `if (module.hot) {\n if (module.hot.accept) {\n module.hot.accept((nextExports) => {\n RefreshRuntime.performReactRefresh()\n });\n }\n}`;\n if (hasRefreshRuntime) {\n const prefixCode = `const RefreshRuntime = __cachedModules[\"react-refresh/cjs/react-refresh-runtime.development\"];\nconst prevRefreshReg = globalThis.$RefreshReg$;\nconst prevRefreshSig = globalThis.$RefreshSig$ || (() => {\n console.info(\"no react refresh setup!\")\n return (x) => x\n});\nglobalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, \"${id}\" + \" \" + id);\nglobalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\nmodule.url = '${id}'\nmodule.hot = createHotContext(module.url)`;\n const sourceMap = result.map ? typeof result.map === \"string\" ? JSON.parse(result.map) : { ...result.map } : void 0;\n if (sourceMap) {\n const prefixLen = prefixCode.split(\"\\n\").length + 1;\n sourceMap.mappings = new Array(prefixLen).fill(\";\").join(\"\") + sourceMap.mappings;\n }\n return {\n code: `${prefixCode}\n${result.code}\n\nif (module.hot) {\n globalThis.$RefreshReg$ = prevRefreshReg;\n globalThis.$RefreshSig$ = prevRefreshSig;\n globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))\n}\n\n${postfixCode}\n`,\n map: sourceMap\n };\n }\n result.code += postfixCode;\n return result;\n}\nconst refreshContentRE = /\\$Refresh(?:Reg|Sig)\\$\\(/;\nfunction shouldSourceMap() {\n return process.env.VXRN_ENABLE_SOURCE_MAP === \"1\";\n}\nfunction getLang(id, forceJSX = false) {\n if (id.endsWith(\"one-entry-native\")) {\n return \"tsx\";\n }\n const extension = extname(id);\n if (extension === \".tsx\") return \"tsx\";\n if (extension === \".ts\") return \"ts\";\n if (extension === \".jsx\" || extension === \".mdx\") return \"jsx\";\n if (extension === \".js\" || extension === \".mjs\" || extension === \".cjs\") {\n return \"jsx\";\n }\n if (!extension) {\n return forceJSX ? \"jsx\" : \"js\";\n }\n return void 0;\n}\nconst transformSWCStripJSX = async (id, code) => {\n const lang = getLang(id);\n if (!lang) return;\n const { transformSync } = await import(\"oxc-transform\");\n const res = transformSync(id, code, {\n lang,\n target: \"es2020\",\n assumptions: {\n setPublicClassFields: true\n },\n sourcemap: shouldSourceMap(),\n jsx: {\n runtime: \"automatic\",\n development: true,\n refresh: false\n }\n });\n if (res.errors?.length) {\n const err = res.errors[0];\n throw new Error(err.message + (err.codeframe ? `\n${err.codeframe}` : \"\"));\n }\n return { code: res.code, map: res.map };\n};\nconst transformOxcStripJSX = transformSWCStripJSX;\nexport {\n shouldSourceMap,\n shouldStripFlow,\n transformOxc,\n transformOxcStripJSX,\n transformSWC,\n transformSWCStripJSX\n};\n//# sourceMappingURL=transformSWC.js.map\n"],"mappings":";;;;;;AAIA,MAAM,WAAW;AACjB,SAAS,gBAAgB,IAAI,MAAM;CACjC,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC;CAC/B,IAAI,CAAC,UAAU,KAAK,QAAQ,GAAG,OAAO;CACtC,IAAI,8DAA8D,KAAK,QAAQ,GAAG;EAChF,OAAO;CACT;CACA,MAAM,SAAS,KAAK,MAAM,kEAAkE,CAAC,GAAG,MAAM;CACtG,OAAO,UAAU,KAAK,MAAM,KAAK,+BAA+B,KAAK,IAAI;AAC3E;AACA,eAAe,aAAa,IAAI,MAAM,SAAS,YAAY;CACzD,KAAK,cAAc,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,cAAc,QAAQ,IAAI,CAAC,GAAG,EAAE;CAC7E,IAAI,SAAS,KAAK,EAAE,GAAG;EACrB;CACF;CACA,IAAI,OAAO,mBAAmB;EAC5B;CACF;CACA,MAAM,OAAO,QAAQ,IAAI,QAAQ,QAAQ;CACzC,IAAI,CAAC,MAAM;EACT;CACF;CACA,MAAM,UAAU,QAAQ,gBAAgB,SAAS,CAAC,QAAQ,cAAc,CAAC,QAAQ,SAAS,CAAC,QAAQ,Y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AAM,uBAAuB,OAAO,IAAI,SAAS;CAC/C,MAAM,OAAO,QAAQ,EAAE;CACvB,IAAI,CAAC,MAAM;CACX,MAAM,EAAE,kBAAkB,MAAM,OAAO;CACvC,MAAM,MAAM,cAAc,IAAI,MAAM;EAClC;EACA,QAAQ;EACR,aAAa,EACX,sBAAsB,KACxB;EACA,WAAW,gBAAgB;EAC3B,KAAK;GACH,SAAS;GACT,aAAa;GACb,SAAS;EACX;CACF,CAAC;CACD,IAAI,IAAI,QAAQ,QAAQ;EACtB,MAAM,MAAM,IAAI,OAAO;EACvB,MAAM,IAAI,MAAM,IAAI,WAAW,IAAI,YAAY;EACjD,IAAI,cAAc,GAAG;CACrB;CACA,OAAO;EAAE,MAAM,IAAI;EAAM,KAAK,IAAI;CAAI;AACxC;AACA,MAAM,uBAAuB"}
1
+ {"version":3,"file":"transformSWC.js","names":[],"sources":["esm/transformSWC.js"],"sourcesContent":["import { extname } from \"node:path\";\nimport { normalizePath } from \"vite\";\nimport { configuration } from \"./configure\";\nimport { asyncGeneratorRegex, debug, runtimePublicPath } from \"./constants\";\nconst ignoreId = /node_modules\\/(\\.vite|vite)\\//;\nfunction shouldStripFlow(id, code) {\n const filename = id.split(\"?\")[0];\n if (!/\\.jsx?$/.test(filename)) return false;\n if (/node_modules[\\\\/](?:react-native|@react-native)[\\\\/].*\\.js$/.test(filename)) {\n return true;\n }\n const header = code.match(/^(?:#![^\\r\\n]*(?:\\r?\\n|$))?(?:\\s|\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*)*/)?.[0] || \"\";\n return /@flow\\b/.test(header) || /\\b(?:import|export)\\s+type\\b/.test(code) || // Some published Flow sources omit the pragma and use ordinary imports.\n // Typed function returns, declarations, and class fields still need stripping.\n /\\(\\s*(?:\\.\\.\\.)?[\\w$]+\\??\\s*:\\s*/.test(code) || /\\)\\s*:\\s*(?:[\\w$]+(?:<[^;{}]*>)?(?:\\[\\])?\\s*)(?:=>|\\{)/.test(code) || /^\\s*[\\w$]+\\??\\s*:\\s*(?:string|number|boolean|any|mixed|void|[A-Z][\\w$]*)(?:[^;\\r\\n=]*)(?:=[^;\\r\\n]*)?;/m.test(\n code\n ) || /\\b(?:opaque\\s+)?type\\s+[\\w$]+(?:\\s*<[^;{}]*>)?\\s*=/.test(code);\n}\nasync function transformSWC(id, code, options, swcOptions) {\n id = normalizePath(id.split(\"?\")[0]).replace(normalizePath(process.cwd()), \"\");\n if (ignoreId.test(id)) {\n return;\n }\n if (id === runtimePublicPath) {\n return;\n }\n const lang = getLang(id, options.forceJSX);\n if (!lang) {\n return;\n }\n const refresh = options.environment !== \"ssr\" && !options.production && !options.noHMR && !options.forceJSX && !id.includes(\"node_modules\");\n const importSource = configuration.enableNativewind && !id.includes(\"node_modules\") ? \"nativewind\" : \"react\";\n const shouldEs5Transform = options.es5 || !process.env.VXRN_USE_BABEL_FOR_GENERATORS && asyncGeneratorRegex.test(code);\n const target = shouldEs5Transform ? \"es2015\" : \"es2020\";\n const sourceMaps = swcOptions?.sourceMaps !== void 0 ? Boolean(swcOptions.sourceMaps) : shouldSourceMap();\n const oxcOptions = {\n lang,\n target,\n assumptions: {\n setPublicClassFields: true,\n ...swcOptions?.assumptions || {}\n },\n sourcemap: sourceMaps,\n jsx: {\n runtime: \"automatic\",\n development: !options.forceJSX && !options.production,\n refresh: Boolean(refresh),\n importSource\n }\n };\n const { transformSync } = await import(\"oxc-transform\");\n const result = (() => {\n try {\n debug?.(\n `transformSWC (oxc) ${id} using options:\n${JSON.stringify(oxcOptions, null, 2)}`\n );\n const res = transformSync(id, code, oxcOptions);\n if (res.errors?.length) {\n const err = res.errors[0];\n const error = new Error(\n err.message + (err.codeframe ? `\n${err.codeframe}` : \"\")\n );\n if (err.labels?.[0]) {\n error.start = err.labels[0].start;\n error.end = err.labels[0].end;\n }\n throw error;\n }\n return {\n code: res.code,\n map: res.map\n };\n } catch (e) {\n throw e;\n }\n })();\n if (configuration.enableNativeCSS) {\n if (result.code.includes(`createInteropElement(`)) {\n result.code = `import { createInteropElement, Fragment as _InteropFragment } from 'react-native-css-interop/jsx-dev-runtime'\n${result.code}`;\n }\n }\n const hasRefreshRuntime = refresh && refreshContentRE.test(result.code);\n if (options.fixNonTypeSpecificImports || id.includes(\"node_modules\") && (lang === \"ts\" || lang === \"tsx\")) {\n const typeExportsMatch = code.match(/^\\s*export\\s+type\\s+([^\\s]+)/gi);\n if (typeExportsMatch) {\n for (const typeExport of Array.from(typeExportsMatch)) {\n const [_export, _type, name] = typeExport.split(/\\s+/);\n if (name.startsWith(\"{\")) continue;\n if (name.includes(\"<\")) continue;\n const alreadyExported = new RegExp(\n `export (const|let|class|function) ${name}\\\\s+`\n ).test(result.code);\n if (!alreadyExported) {\n const fakeExport = `export let ${name} = {};`;\n console.info(\n ` \\u26A0\\uFE0F Fixing non-type-specific import in node_module, this should be fixed upstream: ${fakeExport} in ${id}`\n );\n result.code += `\n${fakeExport}\n`;\n }\n }\n }\n }\n if (result && !options.production && !options.noHMR) {\n return wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime);\n }\n return result;\n}\nconst transformOxc = transformSWC;\nfunction wrapSourceInRefreshRuntime(id, result, options, hasRefreshRuntime) {\n if (options.environment === \"ssr\") {\n return result;\n }\n if (options.environment === \"client\") {\n return wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime);\n }\n return wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime);\n}\nfunction wrapSourceInRefreshRuntimeWeb(id, result, hasRefreshRuntime) {\n const sourceMap = result.map ? typeof result.map === \"string\" ? JSON.parse(result.map) : { ...result.map } : void 0;\n if (sourceMap) {\n sourceMap.mappings = \";;\" + sourceMap.mappings;\n }\n result.code = `import * as RefreshRuntime from \"${runtimePublicPath}\";\n\n${result.code}`;\n if (hasRefreshRuntime) {\n if (sourceMap) {\n sourceMap.mappings = \";;;;;;\" + sourceMap.mappings;\n }\n result.code = `if (!window.$RefreshReg$) throw new Error(\"React refresh preamble was not loaded. Something is wrong.\");\nconst prevRefreshReg = window.$RefreshReg$;\nconst prevRefreshSig = window.$RefreshSig$;\nwindow.$RefreshReg$ = RefreshRuntime.getRefreshReg(\"${id}\");\nwindow.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\n\n${result.code}\n\nwindow.$RefreshReg$ = prevRefreshReg;\nwindow.$RefreshSig$ = prevRefreshSig;\n`;\n }\n result.code += `\nRefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {\n RefreshRuntime.registerExportsForReactRefresh(\"${id}\", currentExports);\n import.meta.hot.accept((nextExports) => {\n if (!nextExports) return;\n const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(\"${id}\", currentExports, nextExports);\n if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);\n });\n});\n`;\n return { code: result.code, map: sourceMap };\n}\nfunction wrapSourceInRefreshRuntimeNative(id, result, options, hasRefreshRuntime) {\n const postfixCode = `if (module.hot) {\n if (module.hot.accept) {\n module.hot.accept((nextExports) => {\n RefreshRuntime.performReactRefresh()\n });\n }\n}`;\n if (hasRefreshRuntime) {\n const prefixCode = `const RefreshRuntime = __cachedModules[\"react-refresh/cjs/react-refresh-runtime.development\"];\nconst prevRefreshReg = globalThis.$RefreshReg$;\nconst prevRefreshSig = globalThis.$RefreshSig$ || (() => {\n console.info(\"no react refresh setup!\")\n return (x) => x\n});\nglobalThis.$RefreshReg$ = (type, id) => RefreshRuntime.register(type, \"${id}\" + \" \" + id);\nglobalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;\nmodule.url = '${id}'\nmodule.hot = createHotContext(module.url)`;\n const sourceMap = result.map ? typeof result.map === \"string\" ? JSON.parse(result.map) : { ...result.map } : void 0;\n if (sourceMap) {\n const prefixLen = prefixCode.split(\"\\n\").length + 1;\n sourceMap.mappings = new Array(prefixLen).fill(\";\").join(\"\") + sourceMap.mappings;\n }\n return {\n code: `${prefixCode}\n${result.code}\n\nif (module.hot) {\n globalThis.$RefreshReg$ = prevRefreshReg;\n globalThis.$RefreshSig$ = prevRefreshSig;\n globalThis['lastHmrExports'] = JSON.stringify(Object.keys(exports))\n}\n\n${postfixCode}\n`,\n map: sourceMap\n };\n }\n result.code += postfixCode;\n return result;\n}\nconst refreshContentRE = /\\$Refresh(?:Reg|Sig)\\$\\(/;\nfunction shouldSourceMap() {\n return process.env.VXRN_ENABLE_SOURCE_MAP === \"1\";\n}\nfunction getLang(id, forceJSX = false) {\n if (id.endsWith(\"one-entry-native\")) {\n return \"tsx\";\n }\n const extension = extname(id);\n if (extension === \".tsx\") return \"tsx\";\n if (extension === \".ts\") return \"ts\";\n if (extension === \".jsx\" || extension === \".mdx\") return \"jsx\";\n if (extension === \".js\" || extension === \".mjs\" || extension === \".cjs\") {\n return \"jsx\";\n }\n if (!extension) {\n return forceJSX ? \"jsx\" : \"js\";\n }\n return void 0;\n}\nconst transformSWCStripJSX = async (id, code) => {\n const lang = getLang(id);\n if (!lang) return;\n const { transformSync } = await import(\"oxc-transform\");\n const res = transformSync(id, code, {\n lang,\n target: \"es2020\",\n assumptions: {\n setPublicClassFields: true\n },\n sourcemap: shouldSourceMap(),\n jsx: {\n runtime: \"automatic\",\n development: true,\n refresh: false\n }\n });\n if (res.errors?.length) {\n const err = res.errors[0];\n throw new Error(err.message + (err.codeframe ? `\n${err.codeframe}` : \"\"));\n }\n return { code: res.code, map: res.map };\n};\nconst transformOxcStripJSX = transformSWCStripJSX;\nexport {\n shouldSourceMap,\n shouldStripFlow,\n transformOxc,\n transformOxcStripJSX,\n transformSWC,\n transformSWCStripJSX\n};\n//# sourceMappingURL=transformSWC.js.map\n"],"mappings":";;;;;;AAIA,MAAM,WAAW;AACjB,SAAS,gBAAgB,IAAI,MAAM;CACjC,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,CAAC;CAC/B,IAAI,CAAC,UAAU,KAAK,QAAQ,GAAG,OAAO;CACtC,IAAI,8DAA8D,KAAK,QAAQ,GAAG;EAChF,OAAO;C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
94
  "HermesInternal",
95
- "_WORKLET"
95
+ "_WORKLET",
96
+ "ReanimatedError",
97
+ "__reanimatedLoggerConfig",
98
+ "_IS_FABRIC",
99
+ "_log",
100
+ "_toString",
101
+ "_scheduleHostFunctionOnJS",
102
+ "_scheduleRemoteFunctionOnJS",
103
+ "_scheduleOnRuntime",
104
+ "_makeShareableClone",
105
+ "_updatePropsPaper",
106
+ "_updatePropsFabric",
107
+ "_measurePaper",
108
+ "_measureFabric",
109
+ "_scrollToPaper",
110
+ "_dispatchCommandPaper",
111
+ "_dispatchCommandFabric",
112
+ "_setGestureState",
113
+ "_notifyAboutProgress",
114
+ "_notifyAboutEnd",
115
+ "_runOnUIQueue",
116
+ "_getAnimationTimestamp"
96
117
  ]);
97
118
  function createGlobalsSet(customGlobals, strictGlobal) {
98
119
  const set = /* @__PURE__ */ new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"globals.js","names":[],"sources":["esm/worklets/globals.js"],"sourcesContent":["const JS_GLOBALS = /* @__PURE__ */ new Set([\n // Value properties\n \"globalThis\",\n \"Infinity\",\n \"NaN\",\n \"undefined\",\n // Function properties\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\",\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // Error objects\n \"Error\",\n \"AggregateError\",\n \"EvalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\",\n \"InternalError\",\n // Numbers and dates\n \"Number\",\n \"BigInt\",\n \"Math\",\n \"Date\",\n // Text processing\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Uint16Array\",\n \"Int32Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Float32Array\",\n \"Float64Array\",\n // Keyed collections\n \"Map\",\n \"Set\",\n \"WeakMap\",\n \"WeakSet\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"DataView\",\n \"Atomics\",\n \"JSON\",\n // Managing memory\n \"WeakRef\",\n \"FinalizationRegistry\",\n // Control abstraction objects\n \"Iterator\",\n \"AsyncIterator\",\n \"Promise\",\n \"GeneratorFunction\",\n \"AsyncGeneratorFunction\",\n \"Generator\",\n \"AsyncGenerator\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\"\n]);\nconst DEFAULT_GLOBALS = /* @__PURE__ */ new Set([\n ...JS_GLOBALS,\n // Environment / Runtime\n \"null\",\n \"this\",\n \"global\",\n \"window\",\n \"self\",\n \"console\",\n \"performance\",\n \"arguments\",\n \"require\",\n \"fetch\",\n \"XMLHttpRequest\",\n \"WebSocket\",\n \"queueMicrotask\",\n \"requestAnimationFrame\",\n \"cancelAnimationFrame\",\n \"setTimeout\",\n \"clearTimeout\",\n \"setImmediate\",\n \"clearImmediate\",\n \"setInterval\",\n \"clearInterval\",\n \"HermesInternal\",\n \"_WORKLET\"\n]);\nfunction createGlobalsSet(customGlobals, strictGlobal) {\n const set = /* @__PURE__ */ new Set();\n if (!strictGlobal) {\n for (const g of DEFAULT_GLOBALS) {\n set.add(g);\n }\n }\n if (customGlobals) {\n for (const g of customGlobals) {\n set.add(g);\n }\n }\n return set;\n}\nexport {\n DEFAULT_GLOBALS,\n JS_GLOBALS,\n createGlobalsSet\n};\n//# sourceMappingURL=globals.js.map\n"],"mappings":";AAAA,MAAM,6BAA6B,IAAI,IAAI;CAEzC;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;AACF,CAAC;AACD,MAAM,kCAAkC,IAAI,IAAI;CAC9C,GAAG;CAEH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,iBAAiB,eAAe,cAAc;CACrD,MAAM,sBAAsB,IAAI,IAAI;CACpC,IAAI,CAAC,cAAc;EACjB,KAAK,MAAM,KAAK,iBAAiB;GAC/B,IAAI,IAAI,CAAC;EACX;CACF;CACA,IAAI,eAAe;EACjB,KAAK,MAAM,KAAK,eAAe;GAC7B,IAAI,IAAI,CAAC;EACX;CACF;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"globals.js","names":[],"sources":["esm/worklets/globals.js"],"sourcesContent":["const JS_GLOBALS = /* @__PURE__ */ new Set([\n // Value properties\n \"globalThis\",\n \"Infinity\",\n \"NaN\",\n \"undefined\",\n // Function properties\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\",\n // Fundamental objects\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Symbol\",\n // Error objects\n \"Error\",\n \"AggregateError\",\n \"EvalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\",\n \"InternalError\",\n // Numbers and dates\n \"Number\",\n \"BigInt\",\n \"Math\",\n \"Date\",\n // Text processing\n \"String\",\n \"RegExp\",\n // Indexed collections\n \"Array\",\n \"Int8Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Int16Array\",\n \"Uint16Array\",\n \"Int32Array\",\n \"Uint32Array\",\n \"BigInt64Array\",\n \"BigUint64Array\",\n \"Float32Array\",\n \"Float64Array\",\n // Keyed collections\n \"Map\",\n \"Set\",\n \"WeakMap\",\n \"WeakSet\",\n // Structured data\n \"ArrayBuffer\",\n \"SharedArrayBuffer\",\n \"DataView\",\n \"Atomics\",\n \"JSON\",\n // Managing memory\n \"WeakRef\",\n \"FinalizationRegistry\",\n // Control abstraction objects\n \"Iterator\",\n \"AsyncIterator\",\n \"Promise\",\n \"GeneratorFunction\",\n \"AsyncGeneratorFunction\",\n \"Generator\",\n \"AsyncGenerator\",\n \"AsyncFunction\",\n // Reflection\n \"Reflect\",\n \"Proxy\",\n // Internationalization\n \"Intl\"\n]);\nconst DEFAULT_GLOBALS = /* @__PURE__ */ new Set([\n ...JS_GLOBALS,\n // Environment / Runtime\n \"null\",\n \"this\",\n \"global\",\n \"window\",\n \"self\",\n \"console\",\n \"performance\",\n \"arguments\",\n \"require\",\n \"fetch\",\n \"XMLHttpRequest\",\n \"WebSocket\",\n \"queueMicrotask\",\n \"requestAnimationFrame\",\n \"cancelAnimationFrame\",\n \"setTimeout\",\n \"clearTimeout\",\n \"setImmediate\",\n \"clearImmediate\",\n \"setInterval\",\n \"clearInterval\",\n \"HermesInternal\",\n \"_WORKLET\",\n // Reanimated installs these in the UI runtime. Capturing them on the JS\n // thread fails before its value unpacker can initialize (Reanimated 3).\n \"ReanimatedError\",\n \"__reanimatedLoggerConfig\",\n \"_IS_FABRIC\",\n \"_log\",\n \"_toString\",\n \"_scheduleHostFunctionOnJS\",\n \"_scheduleRemoteFunctionOnJS\",\n \"_scheduleOnRuntime\",\n \"_makeShareableClone\",\n \"_updatePropsPaper\",\n \"_updatePropsFabric\",\n \"_measurePaper\",\n \"_measureFabric\",\n \"_scrollToPaper\",\n \"_dispatchCommandPaper\",\n \"_dispatchCommandFabric\",\n \"_setGestureState\",\n \"_notifyAboutProgress\",\n \"_notifyAboutEnd\",\n \"_runOnUIQueue\",\n \"_getAnimationTimestamp\"\n]);\nfunction createGlobalsSet(customGlobals, strictGlobal) {\n const set = /* @__PURE__ */ new Set();\n if (!strictGlobal) {\n for (const g of DEFAULT_GLOBALS) {\n set.add(g);\n }\n }\n if (customGlobals) {\n for (const g of customGlobals) {\n set.add(g);\n }\n }\n return set;\n}\nexport {\n DEFAULT_GLOBALS,\n JS_GLOBALS,\n createGlobalsSet\n};\n//# sourceMappingURL=globals.js.map\n"],"mappings":";AAAA,MAAM,6BAA6B,IAAI,IAAI;CAEzC;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;AACF,CAAC;AACD,MAAM,kCAAkC,IAAI,IAAI;CAC9C,GAAG;CAEH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,iBAAiB,eAAe,cAAc;CACrD,MAAM,sBAAsB,IAAI,IAAI;CACpC,IAAI,CAAC,cAAc;EACjB,KAAK,MAAM,KAAK,iBAAiB;GAC/B,IAAI,IAAI,CAAC;EACX;CACF;CACA,IAAI,eAAe;EACjB,KAAK,MAAM,KAAK,eAAe;GAC7B,IAAI,IAAI,CAAC;EACX;CACF;CACA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxrn/compiler",
3
- "version": "2.0.0-beta.150.1",
3
+ "version": "2.0.0-beta.158.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -31,13 +31,15 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/core": "^7.28.5",
34
+ "@babel/plugin-transform-block-scoping": "^7.28.6",
35
+ "@babel/plugin-transform-classes": "^7.28.6",
34
36
  "@babel/plugin-transform-destructuring": "^7.28.5",
35
37
  "@babel/plugin-transform-flow-strip-types": "^7.27.1",
36
38
  "@babel/plugin-transform-react-jsx": "^7.27.1",
37
39
  "@babel/plugin-transform-regenerator": "^7.28.4",
38
40
  "@jridgewell/remapping": "^2.3.0",
39
- "@vxrn/utils": "2.0.0-beta.150.1",
40
- "@vxrn/vite-native-client": "2.0.0-beta.150.1",
41
+ "@vxrn/utils": "2.0.0-beta.158.1",
42
+ "@vxrn/vite-native-client": "2.0.0-beta.158.1",
41
43
  "babel-plugin-react-compiler": "^1.0.0",
42
44
  "babel-plugin-syntax-hermes-parser": "^0.36.1",
43
45
  "babel-plugin-transform-flow-enums": "^0.0.2",
package/src/index.ts CHANGED
@@ -35,6 +35,7 @@ export * from './transformWorklets'
35
35
  export * from './reactNativeCodegen'
36
36
  export * from './transformHermesLoops'
37
37
  export * from './transformHermesAsync'
38
+ export * from './transformHermesClasses'
38
39
  export { clearTransformCache } from './cache'
39
40
  export { JS_GLOBALS } from './worklets/globals'
40
41
  export { getClosureVariables } from './worklets/scope'
@@ -6,6 +6,7 @@ import { configureVXRNCompilerPlugin } from './configure'
6
6
  import {
7
7
  findUserBabelConfig,
8
8
  getBabelOptions,
9
+ stripFlowTypes,
9
10
  transformBabel,
10
11
  transformOxcReactCompiler,
11
12
  } from './transformBabel'
@@ -474,30 +475,40 @@ describe('findUserBabelConfig and user Babel config respect', () => {
474
475
  }
475
476
  })
476
477
 
477
- it('tells user babel config it runs in a bundler that keeps static esm', async () => {
478
- const projectRoot = fs.realpathSync(
479
- fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-babel-conf-'))
480
- )
481
- const userConfig = path.join(projectRoot, 'babel.config.js')
482
- // presets such as babel-preset-expo read this caller to decide whether to
483
- // rewrite esm to commonjs and import.meta to a metro runtime global
484
- fs.writeFileSync(
485
- userConfig,
486
- `module.exports = (api) => ({
487
- comments: !api.caller((c) => c?.name === 'vxrn' && c?.supportsStaticESM === true),
478
+ it.each(['ios', 'android', 'client', 'ssr'] as const)(
479
+ 'tells user babel config the %s platform and that the bundler keeps static esm',
480
+ async (environment) => {
481
+ const projectRoot = fs.realpathSync(
482
+ fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-babel-conf-'))
483
+ )
484
+ const userConfig = path.join(projectRoot, 'babel.config.js')
485
+ // presets such as babel-preset-expo read this caller to decide whether to
486
+ // rewrite esm to commonjs and import.meta to a metro runtime global
487
+ fs.writeFileSync(
488
+ userConfig,
489
+ `module.exports = (api) => ({
490
+ comments: !api.caller((c) => c?.name === 'vxrn' && c?.supportsStaticESM === true && c?.platform === '${environment === 'ios' || environment === 'android' ? environment : 'web'}'),
488
491
  })`
489
- )
490
- try {
491
- const res = await transformBabel(
492
- path.join(projectRoot, 'src', 'index.ts'),
493
- '/* remove me */ export const x = 1',
494
- { configFile: userConfig, babelrc: true }
495
492
  )
496
- expect(res.code).not.toContain('remove me')
497
- } finally {
498
- fs.rmSync(projectRoot, { recursive: true, force: true })
493
+ try {
494
+ const id = path.join(projectRoot, 'src', 'index.ts')
495
+ const code = '/* remove me */ export const x = 1'
496
+ const options = getBabelOptions({
497
+ id,
498
+ code,
499
+ projectRoot,
500
+ environment,
501
+ development: false,
502
+ reactForRNVersion: '19',
503
+ })
504
+ expect(options).not.toBeNull()
505
+ const res = await transformBabel(id, code, options!)
506
+ expect(res.code).not.toContain('remove me')
507
+ } finally {
508
+ fs.rmSync(projectRoot, { recursive: true, force: true })
509
+ }
499
510
  }
500
- })
511
+ )
501
512
  })
502
513
  describe('explicit swc/oxc per-file choice with a user babel config', () => {
503
514
  it('returns null for swc/oxc string and object forms', () => {
@@ -656,3 +667,14 @@ describe('user babel config end-to-end through the compiler plugin', () => {
656
667
  }
657
668
  })
658
669
  })
670
+
671
+ describe('Flow and JSX parsing', () => {
672
+ it('strips Flow types while retaining JSX in published JavaScript', async () => {
673
+ const result = await stripFlowTypes(
674
+ '/app/VideoView.js',
675
+ `export function View(props: {value: string}) { return <NativeView {...props} /> }`
676
+ )
677
+ expect(result.code).not.toContain('value: string')
678
+ expect(result.code).toContain('<NativeView')
679
+ })
680
+ })
@@ -66,6 +66,7 @@ export function getBabelOptions(props: Props): babel.TransformOptions | null {
66
66
  ) {
67
67
  if (props.userSetting?.excludeDefaultPlugins) {
68
68
  return {
69
+ caller: getBabelCaller(props),
69
70
  ...props.userSetting,
70
71
  ...(userBabelConfig ? { configFile: userBabelConfig, babelrc: true } : {}),
71
72
  }
@@ -135,6 +136,7 @@ const getOptions = (
135
136
  if (plugins.length || userBabelConfig) {
136
137
  return {
137
138
  plugins,
139
+ caller: getBabelCaller(props),
138
140
  ...(userBabelConfig ? { configFile: userBabelConfig, babelrc: true } : {}),
139
141
  }
140
142
  }
@@ -142,6 +144,21 @@ const getOptions = (
142
144
  return null
143
145
  }
144
146
 
147
+ function getBabelCaller(props: Props): babel.TransformOptions['caller'] {
148
+ // babel hands every caller field to presets (babel-preset-expo reads platform
149
+ // and isDev), but its types list only the esm support flags, so the extra
150
+ // fields go through a named value rather than a checked literal.
151
+ const caller = {
152
+ name: 'vxrn',
153
+ platform:
154
+ props.environment === 'ios' || props.environment === 'android'
155
+ ? props.environment
156
+ : 'web',
157
+ isDev: props.development,
158
+ }
159
+ return caller
160
+ }
161
+
145
162
  /**
146
163
  * Run the react compiler through oxc's rust port instead of babel.
147
164
  *
@@ -216,7 +233,7 @@ export async function transformBabel(
216
233
  const extension = extname(id)
217
234
  const isTSX = extension === '.tsx'
218
235
  const isTS = isTSX || extension === '.ts'
219
- const babelOptions = {
236
+ const babelOptions: babel.TransformOptions = {
220
237
  filename: id,
221
238
  compact: false,
222
239
  babelrc: options.babelrc ?? false,
@@ -224,10 +241,19 @@ export async function transformBabel(
224
241
  sourceMaps: false,
225
242
  minified: false,
226
243
  ...options,
244
+ ...(!isTS
245
+ ? {
246
+ parserOpts: {
247
+ ...options.parserOpts,
248
+ plugins: [...(options.parserOpts?.plugins || []), 'jsx'],
249
+ },
250
+ }
251
+ : {}),
227
252
  // vite and rolldown own module syntax and import.meta, so presets written for
228
253
  // metro (babel-preset-expo) must keep esm instead of rewriting it for metro's runtime
229
254
  caller: {
230
255
  name: 'vxrn',
256
+ ...options.caller,
231
257
  supportsStaticESM: true,
232
258
  supportsDynamicImport: true,
233
259
  },
@@ -0,0 +1,30 @@
1
+ // Hermes before V1 cannot parse ES6 classes. Oxc lowers fields but has an
2
+ // ES2015 target floor, so classes and lexical bindings need Babel afterward.
3
+ export async function transformHermesClasses(
4
+ code: string,
5
+ filename: string,
6
+ sourceMaps = false
7
+ ): Promise<{ code: string; map?: any } | undefined> {
8
+ if (!/\b(?:class(?:\s|\{)|(?:let|const)\s)/.test(code)) return
9
+ const [
10
+ { transformAsync },
11
+ { default: transformClasses },
12
+ { default: transformBlockScoping },
13
+ ] = await Promise.all([
14
+ import('@babel/core'),
15
+ import('@babel/plugin-transform-classes'),
16
+ import('@babel/plugin-transform-block-scoping'),
17
+ ])
18
+ const result = await transformAsync(code, {
19
+ filename,
20
+ babelrc: false,
21
+ configFile: false,
22
+ sourceMaps,
23
+ parserOpts: { plugins: ['jsx'] },
24
+ // Legacy Hermes hoists lexical names, including in class-free functions.
25
+ // Lower block scope so minification cannot shadow parameters or constructors.
26
+ plugins: [transformClasses, transformBlockScoping],
27
+ })
28
+ if (!result?.code) return
29
+ return { code: result.code, map: result.map }
30
+ }
@@ -22,7 +22,18 @@ export function shouldStripFlow(id: string, code: string): boolean {
22
22
  const header =
23
23
  code.match(/^(?:#![^\r\n]*(?:\r?\n|$))?(?:\s|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)*/)?.[0] ||
24
24
  ''
25
- return /@flow\b/.test(header) || /\b(?:import|export)\s+type\b/.test(code)
25
+ return (
26
+ /@flow\b/.test(header) ||
27
+ /\b(?:import|export)\s+type\b/.test(code) ||
28
+ // Some published Flow sources omit the pragma and use ordinary imports.
29
+ // Typed function returns, declarations, and class fields still need stripping.
30
+ /\(\s*(?:\.\.\.)?[\w$]+\??\s*:\s*/.test(code) ||
31
+ /\)\s*:\s*(?:[\w$]+(?:<[^;{}]*>)?(?:\[\])?\s*)(?:=>|\{)/.test(code) ||
32
+ /^\s*[\w$]+\??\s*:\s*(?:string|number|boolean|any|mixed|void|[A-Z][\w$]*)(?:[^;\r\n=]*)(?:=[^;\r\n]*)?;/m.test(
33
+ code
34
+ ) ||
35
+ /\b(?:opaque\s+)?type\s+[\w$]+(?:\s*<[^;{}]*>)?\s*=/.test(code)
36
+ )
26
37
  }
27
38
 
28
39
  export async function transformSWC(
@@ -2,6 +2,7 @@ import fs from 'node:fs'
2
2
  import os from 'node:os'
3
3
  import { createRequire } from 'node:module'
4
4
  import path from 'node:path'
5
+ import { runInNewContext } from 'node:vm'
5
6
  import { afterEach, describe, expect, it } from 'vitest'
6
7
  import { configureVXRNCompilerPlugin } from './configure'
7
8
  import { shouldTransformWorklets, transformWorklets } from './transformWorklets'
@@ -174,6 +175,32 @@ describe('transformWorklets', () => {
174
175
  expect(init![0]).toContain('flushQueue')
175
176
  })
176
177
 
178
+ it('keeps Reanimated UI-runtime globals out of the JavaScript closure', async () => {
179
+ const result = await transformWorklets(
180
+ '/app/valueUnpacker.ts',
181
+ `function valueUnpacker(value) { 'worklet'; return _toString(value) }
182
+ globalThis.__unpacker = valueUnpacker`,
183
+ false,
184
+ { pluginVersion: '3.19.1' }
185
+ )
186
+ const mainRuntime: any = {}
187
+ runInNewContext(result.code, mainRuntime)
188
+ expect(Object.keys(mainRuntime.__unpacker.__closure)).toEqual([])
189
+ const uiRuntime: any = { _toString: String }
190
+ const unpack = runInNewContext(mainRuntime.__unpacker.__initData.code, uiRuntime)
191
+ expect(unpack(42)).toBe('42')
192
+ })
193
+
194
+ it('keeps strict global configuration explicit for UI-runtime helpers', async () => {
195
+ const result = await transformWorklets(
196
+ '/app/strictGlobals.ts',
197
+ `function unpack(value) { 'worklet'; return _toString(value) }`,
198
+ false,
199
+ { pluginVersion: '3.19.1', strictGlobal: true }
200
+ )
201
+ expect(result.code).toMatch(/__closure = \{\s*_toString/)
202
+ })
203
+
177
204
  it('honors no-worklet-closure and limit-init-data-hoisting the way the worklets runtime needs', async () => {
178
205
  // this is the shape react-native-worklets uses for its unpacker installers.
179
206
  // the outer worklet is serialized to a string and evaluated on a worklet
@@ -108,6 +108,29 @@ export const DEFAULT_GLOBALS = new Set([
108
108
  'clearInterval',
109
109
  'HermesInternal',
110
110
  '_WORKLET',
111
+ // Reanimated installs these in the UI runtime. Capturing them on the JS
112
+ // thread fails before its value unpacker can initialize (Reanimated 3).
113
+ 'ReanimatedError',
114
+ '__reanimatedLoggerConfig',
115
+ '_IS_FABRIC',
116
+ '_log',
117
+ '_toString',
118
+ '_scheduleHostFunctionOnJS',
119
+ '_scheduleRemoteFunctionOnJS',
120
+ '_scheduleOnRuntime',
121
+ '_makeShareableClone',
122
+ '_updatePropsPaper',
123
+ '_updatePropsFabric',
124
+ '_measurePaper',
125
+ '_measureFabric',
126
+ '_scrollToPaper',
127
+ '_dispatchCommandPaper',
128
+ '_dispatchCommandFabric',
129
+ '_setGestureState',
130
+ '_notifyAboutProgress',
131
+ '_notifyAboutEnd',
132
+ '_runOnUIQueue',
133
+ '_getAnimationTimestamp',
111
134
  ])
112
135
 
113
136
  export function createGlobalsSet(
package/types/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from './transformWorklets';
12
12
  export * from './reactNativeCodegen';
13
13
  export * from './transformHermesLoops';
14
14
  export * from './transformHermesAsync';
15
+ export * from './transformHermesClasses';
15
16
  export { clearTransformCache } from './cache';
16
17
  export { JS_GLOBALS } from './worklets/globals';
17
18
  export { getClosureVariables } from './worklets/scope';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,MAAM,CAAA;AAcpE,OAAO,KAAK,EAAkC,OAAO,EAAE,MAAM,SAAS,CAAA;AAGtE,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA0S3C,wBAAsB,wBAAwB,CAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC,CAkWzB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,YAAY,EAA8B,MAAM,MAAM,CAAA;AAcpE,OAAO,KAAK,EAAkC,OAAO,EAAE,MAAM,SAAS,CAAA;AAGtE,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,OAAO,EAAE,mBAAm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,EAAE,MAAM,EAAE,UAAU,UAAO;;;;;;;;;;;GAM/E"}
1
+ {"version":3,"file":"transformBabel.d.ts","sourceRoot":"","sources":["../src/transformBabel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAA;AAKzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEtE,KAAK,KAAK,GAAG,iBAAiB,GAAG;IAC/B,WAAW,CAAC,EAAE,oBAAoB,CAAA;CACnC,CAAA;AAeD,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBvE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,gBAAgB,GAAG,IAAI,CA4C3E;AAqED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,eAAe,GAAE,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,CAAQ,EACtF,SAAS,UAAQ;;;GA4ClB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,CAAC,gBAAgB,kCAyEhC;AAED,wBAAsB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,UAAO;;;;;;;;;;;GAM/E"}
@@ -0,0 +1,5 @@
1
+ export declare function transformHermesClasses(code: string, filename: string, sourceMaps?: boolean): Promise<{
2
+ code: string;
3
+ map?: any;
4
+ } | undefined>;
5
+ //# sourceMappingURL=transformHermesClasses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformHermesClasses.d.ts","sourceRoot":"","sources":["../src/transformHermesClasses.ts"],"names":[],"mappings":"AAEA,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,UAAQ,GACjB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,SAAS,CAAC,CAuBlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"transformSWC.d.ts","sourceRoot":"","sources":["../src/transformSWC.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAKD,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAWjE;AAED,wBAAsB,YAAY,CAChC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GAAG;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EACpC,UAAU,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkI7B;AAED,eAAO,MAAM,YAAY,qBAAe,CAAA;AA+HxC,wBAAgB,eAAe,YAE9B;AAyBD,eAAO,MAAM,oBAAoB,OAAc,MAAM,QAAQ,MAAM;;SAwBxB,GAAG;cAC7C,CAAA;AAED,eAAO,MAAM,oBAAoB,6BAAuB,CAAA"}
1
+ {"version":3,"file":"transformSWC.d.ts","sourceRoot":"","sources":["../src/transformSWC.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAKD,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAsBjE;AAED,wBAAsB,YAAY,CAChC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GAAG;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,EACpC,UAAU,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkI7B;AAED,eAAO,MAAM,YAAY,qBAAe,CAAA;AA+HxC,wBAAgB,eAAe,YAE9B;AAyBD,eAAO,MAAM,oBAAoB,OAAc,MAAM,QAAQ,MAAM;;SAwBxB,GAAG;cAC7C,CAAA;AAED,eAAO,MAAM,oBAAoB,6BAAuB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../src/worklets/globals.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,aAkFrB,CAAA;AAEF,eAAO,MAAM,eAAe,aA0B1B,CAAA;AAEF,wBAAgB,gBAAgB,CAC9B,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,YAAY,CAAC,EAAE,OAAO,GACrB,GAAG,CAAC,MAAM,CAAC,CAab"}
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../src/worklets/globals.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,aAkFrB,CAAA;AAEF,eAAO,MAAM,eAAe,aAiD1B,CAAA;AAEF,wBAAgB,gBAAgB,CAC9B,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,YAAY,CAAC,EAAE,OAAO,GACrB,GAAG,CAAC,MAAM,CAAC,CAab"}