@vxrn/compiler 2.0.0-beta.168.1 → 2.0.0-beta.362.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,10 +131,16 @@ async function performBabelTransform({ id, code, projectRoot, environment, produ
131
131
  return null;
132
132
  }
133
133
  if (userTransform !== "swc" && userTransform !== "oxc") {
134
- const babelOptions = (0, import_transformBabel.getBabelOptions)({
134
+ let babelOptions = (0, import_transformBabel.getBabelOptions)({
135
135
  ...transformProps,
136
136
  userSetting: userTransform
137
137
  });
138
+ if (!babelOptions && (0, import_transformWorklets.shouldTransformWorklets)({
139
+ id,
140
+ code
141
+ })) {
142
+ babelOptions = { plugins: [] };
143
+ }
138
144
  if (babelOptions) {
139
145
  const hasCompilerPlugin = babelOptions.plugins?.some((x) => Array.isArray(x) && x[0] === "babel-plugin-react-compiler");
140
146
  const userBabelConfigPath = typeof babelOptions.configFile === "string" ? babelOptions.configFile : null;
@@ -316,7 +316,7 @@ function readCommands(call, decls) {
316
316
  for (const m of commandMembers) {
317
317
  const name = m.key?.name ?? m.key?.value;
318
318
  if (!name) continue;
319
- const fn = m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation;
319
+ const fn = m.type === "TSMethodSignature" ? m : m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation;
320
320
  const params = (fn?.params ?? fn?.parameters ?? []).slice(1);
321
321
  byName.set(name, params.map((p, i) => p.name?.name ?? p.name ?? `arg${i}`));
322
322
  }
@@ -110,13 +110,6 @@ const getOptions = (props, force = false, userBabelConfig = null) => {
110
110
  plugins.push((0, import_utils.resolvePath)("react-native-css-interop/dist/babel-plugin.js"));
111
111
  }
112
112
  }
113
- if (enableNativewind || shouldBabelReanimated(props)) {
114
- try {
115
- const workletsPlugin = (0, import_utils.resolvePath)("react-native-worklets/plugin", props.projectRoot);
116
- (0, import_constants.debug)?.(`Using babel worklets on file ${props.id}`);
117
- plugins.push(workletsPlugin);
118
- } catch {}
119
- }
120
113
  if (shouldBabelReactCompiler(props)) {
121
114
  (0, import_constants.debug)?.(`Using babel react compiler on file`);
122
115
  plugins.push(getBabelReactCompilerPlugin(props));
@@ -285,45 +278,3 @@ function shouldBabelGenerators({ code }) {
285
278
  return import_constants.asyncGeneratorRegex.test(code);
286
279
  }
287
280
  }
288
- const REANIMATED_AUTOWORKLETIZATION_KEYWORDS = [
289
- "worklet",
290
- "useAnimatedGestureHandler",
291
- "useAnimatedScrollHandler",
292
- "useFrameCallback",
293
- "useAnimatedStyle",
294
- "useAnimatedProps",
295
- "createAnimatedPropAdapter",
296
- "useDerivedValue",
297
- "useAnimatedReaction",
298
- "useWorkletCallback",
299
- "withTiming",
300
- "withSpring",
301
- "withDecay",
302
- "withRepeat",
303
- "runOnUI",
304
- "executeOnUIRuntimeSync"
305
- ];
306
- const REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join("|"));
307
- const REANIMATED_IGNORED_PATHS = [
308
- "react-native-prebuilt",
309
- "node_modules/.vxrn/react-native",
310
- "node_modules/react/",
311
- "node_modules/react-dom/",
312
- "node_modules/react-native/",
313
- "node_modules/react-native-web/"
314
- ];
315
- const REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join("|"));
316
- function shouldBabelReanimated({ code, id }) {
317
- if (!import_configure.configuration.enableReanimated) {
318
- return false;
319
- }
320
- if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {
321
- return false;
322
- }
323
- if (REANIMATED_REGEX.test(code)) {
324
- const location = id.includes("node_modules") ? "node_modules" : "user-code";
325
- (0, import_constants.debug)?.(` \u{1FA84} [reanimated/${location}] ${(0, import_node_path.relative)(process.cwd(), id)}`);
326
- return true;
327
- }
328
- return false;
329
- }
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var workletUtils_exports = {};
22
+ __export(workletUtils_exports, {
23
+ JS_GLOBALS: () => import_globals.JS_GLOBALS,
24
+ getClosureVariables: () => import_scope.getClosureVariables,
25
+ transformHermesLoops: () => import_transformHermesLoops.transformHermesLoops
26
+ });
27
+ module.exports = __toCommonJS(workletUtils_exports);
28
+ var import_scope = require("./worklets/scope.cjs");
29
+ var import_globals = require("./worklets/globals.cjs");
30
+ var import_transformHermesLoops = require("./transformHermesLoops.cjs");
package/dist/esm/index.js CHANGED
@@ -103,10 +103,16 @@ async function performBabelTransform({ id, code, projectRoot, environment, produ
103
103
  return null;
104
104
  }
105
105
  if (userTransform !== "swc" && userTransform !== "oxc") {
106
- const babelOptions = getBabelOptions({
106
+ let babelOptions = getBabelOptions({
107
107
  ...transformProps,
108
108
  userSetting: userTransform
109
109
  });
110
+ if (!babelOptions && shouldTransformWorklets({
111
+ id,
112
+ code
113
+ })) {
114
+ babelOptions = { plugins: [] };
115
+ }
110
116
  if (babelOptions) {
111
117
  const hasCompilerPlugin = babelOptions.plugins?.some((x) => Array.isArray(x) && x[0] === "babel-plugin-react-compiler");
112
118
  const userBabelConfigPath = typeof babelOptions.configFile === "string" ? babelOptions.configFile : null;
@@ -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\";\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;C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GhE,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 let babelOptions = getBabelOptions({\n ...transformProps,\n userSetting: userTransform\n });\n if (!babelOptions && shouldTransformWorklets({ id, code })) {\n babelOptions = { plugins: [] };\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,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AAM;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"}
@@ -103,10 +103,16 @@ async function performBabelTransform({ id, code, projectRoot, environment, produ
103
103
  return null;
104
104
  }
105
105
  if (userTransform !== "swc" && userTransform !== "oxc") {
106
- const babelOptions = getBabelOptions({
106
+ let babelOptions = getBabelOptions({
107
107
  ...transformProps,
108
108
  userSetting: userTransform
109
109
  });
110
+ if (!babelOptions && shouldTransformWorklets({
111
+ id,
112
+ code
113
+ })) {
114
+ babelOptions = { plugins: [] };
115
+ }
110
116
  if (babelOptions) {
111
117
  const hasCompilerPlugin = babelOptions.plugins?.some((x) => Array.isArray(x) && x[0] === "babel-plugin-react-compiler");
112
118
  const userBabelConfigPath = typeof babelOptions.configFile === "string" ? babelOptions.configFile : null;
@@ -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\";\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,g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AG;;;;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 let babelOptions = getBabelOptions({\n ...transformProps,\n userSetting: userTransform\n });\n if (!babelOptions && shouldTransformWorklets({ id, code })) {\n babelOptions = { plugins: [] };\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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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"}
@@ -288,7 +288,7 @@ function readCommands(call, decls) {
288
288
  for (const m of commandMembers) {
289
289
  const name = m.key?.name ?? m.key?.value;
290
290
  if (!name) continue;
291
- const fn = m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation;
291
+ const fn = m.type === "TSMethodSignature" ? m : m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation;
292
292
  const params = (fn?.params ?? fn?.parameters ?? []).slice(1);
293
293
  byName.set(name, params.map((p, i) => p.name?.name ?? p.name ?? `arg${i}`));
294
294
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeViewConfig.js","names":[],"sources":["esm/reactNativeViewConfig.js"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { basename, join } from \"node:path\";\nimport { parseSync } from \"oxc-parser\";\nconst SELF_URL = typeof __filename !== \"undefined\" ? __filename : import.meta.url;\nconst COLOR_ATTRIBUTE = \"require('react-native/Libraries/Components/View/ReactNativeStyleAttributes').colorAttribute\";\nconst COLOR_ARRAY_ATTRIBUTE = \"{\\n process: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/StyleSheet/processColorArray'))\\n }\";\nconst IMAGE_ATTRIBUTE = \"{\\n process: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/Image/resolveAssetSource'))\\n }\";\nconst POINT_ATTRIBUTE = \"{\\n diff: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/pointsDiffer'))\\n }\";\nconst EDGE_INSETS_ATTRIBUTE = \"{\\n diff: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/insetsDiffer'))\\n }\";\nconst IMPORT_REGISTRY = \"const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\";\nconst IMPORT_IGNORE = \"const {ConditionallyIgnoredEventHandlers} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');\";\nconst IMPORT_DISPATCH = 'const {dispatchCommand} = require(\"react-native/Libraries/ReactNative/RendererProxy\");';\nconst IMPORT_UIMANAGER = 'const {UIManager} = require(\"react-native\")';\nlet hermesParser = void 0;\nfunction getHermesParser(projectRoot) {\n if (hermesParser === void 0) {\n try {\n const req = projectRoot ? createRequire(join(projectRoot, \"package.json\")) : createRequire(SELF_URL);\n hermesParser = req(\"hermes-parser\");\n } catch {\n try {\n hermesParser = createRequire(SELF_URL)(\"hermes-parser\");\n } catch {\n hermesParser = null;\n }\n }\n }\n return hermesParser;\n}\nfunction readType(node) {\n if (!node) return { name: \"\", args: [] };\n switch (node.type) {\n // flow\n case \"NullableTypeAnnotation\":\n case \"TypeAnnotation\":\n return readType(node.typeAnnotation);\n case \"GenericTypeAnnotation\":\n return {\n name: readTypeName(node.id),\n args: (node.typeParameters?.params ?? []).map(readType)\n };\n case \"ObjectTypeAnnotation\":\n return { name: \"__object\", args: [] };\n case \"StringTypeAnnotation\":\n return { name: \"string\", args: [] };\n case \"BooleanTypeAnnotation\":\n return { name: \"boolean\", args: [] };\n case \"NumberTypeAnnotation\":\n return { name: \"number\", args: [] };\n case \"UnionTypeAnnotation\":\n return readUnion(node);\n case \"FunctionTypeAnnotation\":\n return { name: \"__function\", args: [] };\n // typescript\n case \"TSTypeAnnotation\":\n return readType(node.typeAnnotation);\n case \"TSTypeReference\":\n return {\n name: readTypeName(node.typeName),\n args: (node.typeArguments ?? node.typeParameters)?.params?.map(readType) ?? []\n };\n case \"TSTypeLiteral\":\n return { name: \"__object\", args: [] };\n case \"TSStringKeyword\":\n return { name: \"string\", args: [] };\n case \"TSBooleanKeyword\":\n return { name: \"boolean\", args: [] };\n case \"TSNumberKeyword\":\n return { name: \"number\", args: [] };\n case \"TSUnionType\":\n return readUnion(node);\n case \"TSFunctionType\":\n return { name: \"__function\", args: [] };\n case \"TSArrayType\":\n return { name: \"Array\", args: [readType(node.elementType)] };\n }\n return { name: \"__unknown\", args: [] };\n}\nconst NULLISH_TYPES = /* @__PURE__ */ new Set([\n \"TSUndefinedKeyword\",\n \"TSNullKeyword\",\n \"TSVoidKeyword\",\n \"NullLiteralTypeAnnotation\",\n \"VoidTypeAnnotation\"\n]);\nfunction readUnion(node) {\n const real = (node.types ?? []).filter((t) => !NULLISH_TYPES.has(t.type));\n if (real.length === 1) return readType(real[0]);\n return { name: \"__union\", args: [] };\n}\nfunction readTypeName(id) {\n if (!id) return \"\";\n if (id.type === \"Identifier\") return id.name;\n if (id.type === \"QualifiedTypeIdentifier\") return readTypeName(id.id);\n if (id.type === \"TSQualifiedName\") return readTypeName(id.right);\n return \"\";\n}\nconst READONLY_ARRAYS = /* @__PURE__ */ new Set([\"ReadonlyArray\", \"$ReadOnlyArray\", \"Array\"]);\nconst TRANSPARENT = /* @__PURE__ */ new Set([\"WithDefault\", \"UnsafeMixed\", \"Readonly\", \"$ReadOnly\"]);\nfunction unwrap(type) {\n let cur = type;\n while (TRANSPARENT.has(cur.name) && cur.args.length > 0) {\n cur = cur.args[0];\n }\n return cur;\n}\nfunction attributeValue(type) {\n const t = unwrap(type);\n switch (t.name) {\n case \"ColorValue\":\n case \"ProcessedColorValue\":\n return COLOR_ATTRIBUTE;\n case \"ImageSource\":\n return IMAGE_ATTRIBUTE;\n case \"PointValue\":\n return POINT_ATTRIBUTE;\n case \"EdgeInsetsValue\":\n return EDGE_INSETS_ATTRIBUTE;\n }\n if (READONLY_ARRAYS.has(t.name) && t.args.length === 1) {\n const el = unwrap(t.args[0]);\n if (el.name === \"ColorValue\" || el.name === \"ProcessedColorValue\") {\n return COLOR_ARRAY_ATTRIBUTE;\n }\n }\n return \"true\";\n}\nfunction eventOf(name, type) {\n const t = unwrap(type);\n if (t.name !== \"DirectEventHandler\" && t.name !== \"BubblingEventHandler\") return null;\n const override = t.args[1]?.name;\n return {\n name,\n bubbling: t.name === \"BubblingEventHandler\",\n topName: normalizeInputEventName(\n override && override !== \"__unknown\" ? override : name\n )\n };\n}\nfunction normalizeInputEventName(name) {\n if (name.startsWith(\"on\")) return name.replace(/^on/, \"top\");\n if (!name.startsWith(\"top\")) return `top${name[0].toUpperCase()}${name.slice(1)}`;\n return name;\n}\nfunction collectDeclarations(body) {\n const out = /* @__PURE__ */ new Map();\n for (const raw of body) {\n const node = raw?.type === \"ExportNamedDeclaration\" ? raw.declaration : raw;\n if (!node) continue;\n switch (node.type) {\n case \"TSTypeAliasDeclaration\":\n case \"TypeAlias\":\n case \"TSInterfaceDeclaration\":\n case \"InterfaceDeclaration\":\n if (node.id?.name) out.set(node.id.name, node);\n break;\n }\n }\n return out;\n}\nfunction flattenMembers(typeName, decls, seen = /* @__PURE__ */ new Set()) {\n if (typeName === \"ViewProps\" || seen.has(typeName)) return [];\n seen.add(typeName);\n const decl = decls.get(typeName);\n if (!decl) return [];\n const out = [];\n const heritage = decl.extends ?? decl.heritage ?? [];\n for (const h of heritage) {\n const name = readTypeName(h.id ?? h.expression ?? h.typeName);\n if (name) out.push(...flattenMembers(name, decls, seen));\n }\n const bodyNode = decl.body ?? // interface\n decl.right ?? // type alias\n decl.typeAnnotation;\n out.push(...readObjectMembers(bodyNode, decls, seen));\n return out;\n}\nfunction readObjectMembers(node, decls, seen) {\n if (!node) return [];\n if (node.type === \"TSTypeReference\" || node.type === \"GenericTypeAnnotation\") {\n const name = readTypeName(node.typeName ?? node.id);\n const args = (node.typeArguments ?? node.typeParameters)?.params ?? [];\n if (TRANSPARENT.has(name) && args.length) {\n return readObjectMembers(args[0], decls, seen);\n }\n return flattenMembers(name, decls, seen);\n }\n if (node.type === \"TSIntersectionType\" || node.type === \"IntersectionTypeAnnotation\") {\n const out2 = [];\n for (const t of node.types ?? []) out2.push(...readObjectMembers(t, decls, seen));\n return out2;\n }\n const members = node.members ?? node.body ?? node.properties ?? [];\n const out = [];\n for (const m of members) {\n switch (m.type) {\n case \"TSPropertySignature\":\n case \"ObjectTypeProperty\": {\n const name = m.key?.name ?? m.key?.value;\n if (!name) break;\n out.push({ name, type: readType(m.typeAnnotation ?? m.value) });\n break;\n }\n // flow's `...OtherProps` inside an object type\n case \"ObjectTypeSpreadProperty\": {\n const name = readTypeName(m.argument?.id ?? m.argument);\n if (name) out.push(...flattenMembers(name, decls, seen));\n break;\n }\n }\n }\n return out;\n}\nfunction findComponentCall(body) {\n for (const node of body) {\n if (node.type !== \"ExportDefaultDeclaration\") continue;\n let expr = node.declaration;\n while (expr) {\n if (expr.type === \"CallExpression\") break;\n expr = expr.expression ?? (expr.type === \"SequenceExpression\" ? expr.expressions[expr.expressions.length - 1] : null);\n }\n if (expr?.type === \"CallExpression\" && expr.callee?.name === \"codegenNativeComponent\") {\n return expr;\n }\n }\n return null;\n}\nfunction findCommandsCall(body) {\n for (const raw of body) {\n const node = raw?.type === \"ExportNamedDeclaration\" ? raw.declaration : raw;\n const decl = node?.declarations?.[0];\n let init = decl?.init;\n while (init && init.type !== \"CallExpression\") init = init.expression;\n if (init?.type === \"CallExpression\" && init.callee?.name === \"codegenNativeCommands\") {\n return init;\n }\n }\n return null;\n}\nfunction readStringOption(objectExpression, key) {\n for (const p of objectExpression?.properties ?? []) {\n if ((p.key?.name ?? p.key?.value) === key && typeof p.value?.value === \"string\") {\n return p.value.value;\n }\n }\n return null;\n}\nfunction readCommands(call, decls) {\n const typeName = readTypeName(\n (call.typeArguments ?? call.typeParameters)?.params?.[0]?.typeName ?? (call.typeArguments ?? call.typeParameters)?.params?.[0]?.id\n );\n const supported = [];\n for (const p of call.arguments?.[0]?.properties ?? []) {\n if ((p.key?.name ?? p.key?.value) !== \"supportedCommands\") continue;\n for (const el of p.value?.elements ?? []) {\n if (typeof el?.value === \"string\") supported.push(el.value);\n }\n }\n if (!supported.length) return [];\n const decl = decls.get(typeName);\n const byName = /* @__PURE__ */ new Map();\n const commandMembers = decl?.body?.body ?? decl?.body?.members ?? decl?.body?.properties ?? [];\n for (const m of commandMembers) {\n const name = m.key?.name ?? m.key?.value;\n if (!name) continue;\n const fn = m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation;\n const params = (fn?.params ?? fn?.parameters ?? []).slice(1);\n byName.set(\n name,\n params.map((p, i) => p.name?.name ?? p.name ?? `arg${i}`)\n );\n }\n return supported.map((name) => ({ name, params: byName.get(name) ?? [] }));\n}\nfunction indent(text, spaces) {\n const pad = \" \".repeat(spaces);\n return text.split(\"\\n\").map((line, i) => i === 0 || line === \"\" ? line : pad + line).join(\"\\n\");\n}\nfunction printViewConfig(componentName, attributes, events) {\n const lines = [` uiViewClassName: ${JSON.stringify(componentName)}`];\n const bubbling = events.filter((e) => e.bubbling);\n if (bubbling.length) {\n lines.push(\n ` bubblingEventTypes: {\n${bubbling.map(\n (e) => ` ${e.topName}: {\n phasedRegistrationNames: {\n captured: ${JSON.stringify(\n `${e.name}Capture`\n )},\n bubbled: ${JSON.stringify(e.name)}\n }\n }`\n ).join(\",\\n\")}\n }`\n );\n }\n const direct = events.filter((e) => !e.bubbling);\n if (direct.length) {\n lines.push(\n ` directEventTypes: {\n${direct.map(\n (e) => ` ${e.topName}: {\n registrationName: ${JSON.stringify(e.name)}\n }`\n ).join(\",\\n\")}\n }`\n );\n }\n const attrLines = attributes.map((a) => ` ${a.name}: ${indent(a.value, 4)}`);\n if (events.length) {\n attrLines.push(\n ` ...ConditionallyIgnoredEventHandlers({\n${events.map((e) => ` ${e.name}: true`).join(\",\\n\")}\n })`\n );\n }\n lines.push(\n attrLines.length ? ` validAttributes: {\n${attrLines.join(\",\\n\")}\n }` : \" validAttributes: {}\"\n );\n return `{\n${lines.join(\",\\n\")}\n}`;\n}\nfunction printCommands(commands) {\n return `export const Commands = {\n${commands.map(\n (c) => ` ${c.name}(ref${c.params.map((p) => `, ${p}`).join(\"\")}) {\n dispatchCommand(ref, ${JSON.stringify(\n c.name\n )}, [${c.params.join(\", \")}]);\n }`\n ).join(\",\\n\")}\n};`;\n}\nconst FILE_HEADER = `/**\n * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).\n *\n * Do not edit this file as changes may cause incorrect behavior and will be lost\n * once the code is regenerated.\n *\n * @flow\n *\n * @generated by codegen project: GenerateViewConfigJs.js\n */\n\n'use strict';\n`;\nfunction parseSpec(code, filename, projectRoot) {\n const isTS = /\\.[cm]?tsx?$/.test(filename);\n if (isTS) {\n const result = parseSync(filename, code, {\n lang: filename.endsWith(\"x\") ? \"tsx\" : \"ts\"\n });\n if (result.errors?.length) return null;\n return result.program;\n }\n const hermes = getHermesParser(projectRoot);\n if (!hermes) return null;\n try {\n return hermes.parse(code, {\n babel: false,\n flow: \"all\",\n sourceFilename: filename\n });\n } catch {\n return null;\n }\n}\nfunction generateViewConfig(program) {\n const body = program?.body;\n if (!body) return null;\n const call = findComponentCall(body);\n if (!call) return null;\n const componentNameArg = call.arguments?.[0];\n if (typeof componentNameArg?.value !== \"string\") return null;\n const componentName = componentNameArg.value;\n const options = call.arguments?.[1];\n const paperComponentName = readStringOption(options, \"paperComponentName\");\n const paperComponentNameDeprecated = readStringOption(\n options,\n \"paperComponentNameDeprecated\"\n );\n const propsTypeName = readTypeName(\n (call.typeArguments ?? call.typeParameters)?.params?.[0]?.typeName ?? (call.typeArguments ?? call.typeParameters)?.params?.[0]?.id\n );\n if (!propsTypeName) return null;\n const decls = collectDeclarations(body);\n const members = flattenMembers(propsTypeName, decls);\n const attributes = [];\n const events = [];\n for (const m of members) {\n const event = eventOf(m.name, m.type);\n if (event) {\n events.push(event);\n continue;\n }\n attributes.push({ name: m.name, value: attributeValue(m.type) });\n }\n const commandsCall = findCommandsCall(body);\n const commands = commandsCall ? readCommands(commandsCall, decls) : [];\n const imports = /* @__PURE__ */ new Set([IMPORT_REGISTRY]);\n if (events.length) imports.add(IMPORT_IGNORE);\n if (commands.length) imports.add(IMPORT_DISPATCH);\n if (paperComponentNameDeprecated) imports.add(IMPORT_UIMANAGER);\n const nativeName = paperComponentName ?? componentName;\n const parts = [`let nativeComponentName = '${nativeName}';`];\n if (paperComponentNameDeprecated) {\n parts.push(\n `if (UIManager.hasViewManagerConfig('${componentName}')) {\n nativeComponentName = '${componentName}';\n} else if (UIManager.hasViewManagerConfig('${paperComponentNameDeprecated}')) {\n nativeComponentName = '${paperComponentNameDeprecated}';\n} else {\n throw new Error('Failed to find native component for either \"${componentName}\" or \"${paperComponentNameDeprecated}\"');\n}`\n );\n }\n parts.push(\n `export const __INTERNAL_VIEW_CONFIG = ${printViewConfig(nativeName, attributes, events)};`\n );\n parts.push(\n \"export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);\"\n );\n if (commands.length) parts.push(printCommands(commands));\n return { imports: [...imports].sort(), body: parts.join(\"\\n\") };\n}\nfunction renderViewConfigModule(result) {\n return `\n${FILE_HEADER}\n${result.imports.join(\"\\n\")}\n\n${result.body}\n`;\n}\nfunction getLibraryName(filename) {\n const base = basename(filename);\n const replaced = base.replace(/NativeComponent\\.[cm]?[jt]sx?$/, \"\");\n return replaced === base ? base.replace(/\\.[cm]?[jt]sx?$/, \"\") : replaced;\n}\nexport {\n generateViewConfig,\n getLibraryName,\n parseSpec,\n renderViewConfigModule\n};\n//# sourceM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ChC,MAAM,OAAO,SAAS,QAAQ;CAC9B,MAAM,WAAW,KAAK,QAAQ,kCAAkC,EAAE;CAClE,OAAO,aAAa,OAAO,KAAK,QAAQ,mBAAmB,EAAE,IAAI;AACnE"}
1
+ {"version":3,"file":"reactNativeViewConfig.js","names":[],"sources":["esm/reactNativeViewConfig.js"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { basename, join } from \"node:path\";\nimport { parseSync } from \"oxc-parser\";\nconst SELF_URL = typeof __filename !== \"undefined\" ? __filename : import.meta.url;\nconst COLOR_ATTRIBUTE = \"require('react-native/Libraries/Components/View/ReactNativeStyleAttributes').colorAttribute\";\nconst COLOR_ARRAY_ATTRIBUTE = \"{\\n process: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/StyleSheet/processColorArray'))\\n }\";\nconst IMAGE_ATTRIBUTE = \"{\\n process: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/Image/resolveAssetSource'))\\n }\";\nconst POINT_ATTRIBUTE = \"{\\n diff: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/pointsDiffer'))\\n }\";\nconst EDGE_INSETS_ATTRIBUTE = \"{\\n diff: (req => 'default' in req ? req.default : req)(require('react-native/Libraries/Utilities/differ/insetsDiffer'))\\n }\";\nconst IMPORT_REGISTRY = \"const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\";\nconst IMPORT_IGNORE = \"const {ConditionallyIgnoredEventHandlers} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');\";\nconst IMPORT_DISPATCH = 'const {dispatchCommand} = require(\"react-native/Libraries/ReactNative/RendererProxy\");';\nconst IMPORT_UIMANAGER = 'const {UIManager} = require(\"react-native\")';\nlet hermesParser = void 0;\nfunction getHermesParser(projectRoot) {\n if (hermesParser === void 0) {\n try {\n const req = projectRoot ? createRequire(join(projectRoot, \"package.json\")) : createRequire(SELF_URL);\n hermesParser = req(\"hermes-parser\");\n } catch {\n try {\n hermesParser = createRequire(SELF_URL)(\"hermes-parser\");\n } catch {\n hermesParser = null;\n }\n }\n }\n return hermesParser;\n}\nfunction readType(node) {\n if (!node) return { name: \"\", args: [] };\n switch (node.type) {\n // flow\n case \"NullableTypeAnnotation\":\n case \"TypeAnnotation\":\n return readType(node.typeAnnotation);\n case \"GenericTypeAnnotation\":\n return {\n name: readTypeName(node.id),\n args: (node.typeParameters?.params ?? []).map(readType)\n };\n case \"ObjectTypeAnnotation\":\n return { name: \"__object\", args: [] };\n case \"StringTypeAnnotation\":\n return { name: \"string\", args: [] };\n case \"BooleanTypeAnnotation\":\n return { name: \"boolean\", args: [] };\n case \"NumberTypeAnnotation\":\n return { name: \"number\", args: [] };\n case \"UnionTypeAnnotation\":\n return readUnion(node);\n case \"FunctionTypeAnnotation\":\n return { name: \"__function\", args: [] };\n // typescript\n case \"TSTypeAnnotation\":\n return readType(node.typeAnnotation);\n case \"TSTypeReference\":\n return {\n name: readTypeName(node.typeName),\n args: (node.typeArguments ?? node.typeParameters)?.params?.map(readType) ?? []\n };\n case \"TSTypeLiteral\":\n return { name: \"__object\", args: [] };\n case \"TSStringKeyword\":\n return { name: \"string\", args: [] };\n case \"TSBooleanKeyword\":\n return { name: \"boolean\", args: [] };\n case \"TSNumberKeyword\":\n return { name: \"number\", args: [] };\n case \"TSUnionType\":\n return readUnion(node);\n case \"TSFunctionType\":\n return { name: \"__function\", args: [] };\n case \"TSArrayType\":\n return { name: \"Array\", args: [readType(node.elementType)] };\n }\n return { name: \"__unknown\", args: [] };\n}\nconst NULLISH_TYPES = /* @__PURE__ */ new Set([\n \"TSUndefinedKeyword\",\n \"TSNullKeyword\",\n \"TSVoidKeyword\",\n \"NullLiteralTypeAnnotation\",\n \"VoidTypeAnnotation\"\n]);\nfunction readUnion(node) {\n const real = (node.types ?? []).filter((t) => !NULLISH_TYPES.has(t.type));\n if (real.length === 1) return readType(real[0]);\n return { name: \"__union\", args: [] };\n}\nfunction readTypeName(id) {\n if (!id) return \"\";\n if (id.type === \"Identifier\") return id.name;\n if (id.type === \"QualifiedTypeIdentifier\") return readTypeName(id.id);\n if (id.type === \"TSQualifiedName\") return readTypeName(id.right);\n return \"\";\n}\nconst READONLY_ARRAYS = /* @__PURE__ */ new Set([\"ReadonlyArray\", \"$ReadOnlyArray\", \"Array\"]);\nconst TRANSPARENT = /* @__PURE__ */ new Set([\"WithDefault\", \"UnsafeMixed\", \"Readonly\", \"$ReadOnly\"]);\nfunction unwrap(type) {\n let cur = type;\n while (TRANSPARENT.has(cur.name) && cur.args.length > 0) {\n cur = cur.args[0];\n }\n return cur;\n}\nfunction attributeValue(type) {\n const t = unwrap(type);\n switch (t.name) {\n case \"ColorValue\":\n case \"ProcessedColorValue\":\n return COLOR_ATTRIBUTE;\n case \"ImageSource\":\n return IMAGE_ATTRIBUTE;\n case \"PointValue\":\n return POINT_ATTRIBUTE;\n case \"EdgeInsetsValue\":\n return EDGE_INSETS_ATTRIBUTE;\n }\n if (READONLY_ARRAYS.has(t.name) && t.args.length === 1) {\n const el = unwrap(t.args[0]);\n if (el.name === \"ColorValue\" || el.name === \"ProcessedColorValue\") {\n return COLOR_ARRAY_ATTRIBUTE;\n }\n }\n return \"true\";\n}\nfunction eventOf(name, type) {\n const t = unwrap(type);\n if (t.name !== \"DirectEventHandler\" && t.name !== \"BubblingEventHandler\") return null;\n const override = t.args[1]?.name;\n return {\n name,\n bubbling: t.name === \"BubblingEventHandler\",\n topName: normalizeInputEventName(\n override && override !== \"__unknown\" ? override : name\n )\n };\n}\nfunction normalizeInputEventName(name) {\n if (name.startsWith(\"on\")) return name.replace(/^on/, \"top\");\n if (!name.startsWith(\"top\")) return `top${name[0].toUpperCase()}${name.slice(1)}`;\n return name;\n}\nfunction collectDeclarations(body) {\n const out = /* @__PURE__ */ new Map();\n for (const raw of body) {\n const node = raw?.type === \"ExportNamedDeclaration\" ? raw.declaration : raw;\n if (!node) continue;\n switch (node.type) {\n case \"TSTypeAliasDeclaration\":\n case \"TypeAlias\":\n case \"TSInterfaceDeclaration\":\n case \"InterfaceDeclaration\":\n if (node.id?.name) out.set(node.id.name, node);\n break;\n }\n }\n return out;\n}\nfunction flattenMembers(typeName, decls, seen = /* @__PURE__ */ new Set()) {\n if (typeName === \"ViewProps\" || seen.has(typeName)) return [];\n seen.add(typeName);\n const decl = decls.get(typeName);\n if (!decl) return [];\n const out = [];\n const heritage = decl.extends ?? decl.heritage ?? [];\n for (const h of heritage) {\n const name = readTypeName(h.id ?? h.expression ?? h.typeName);\n if (name) out.push(...flattenMembers(name, decls, seen));\n }\n const bodyNode = decl.body ?? // interface\n decl.right ?? // type alias\n decl.typeAnnotation;\n out.push(...readObjectMembers(bodyNode, decls, seen));\n return out;\n}\nfunction readObjectMembers(node, decls, seen) {\n if (!node) return [];\n if (node.type === \"TSTypeReference\" || node.type === \"GenericTypeAnnotation\") {\n const name = readTypeName(node.typeName ?? node.id);\n const args = (node.typeArguments ?? node.typeParameters)?.params ?? [];\n if (TRANSPARENT.has(name) && args.length) {\n return readObjectMembers(args[0], decls, seen);\n }\n return flattenMembers(name, decls, seen);\n }\n if (node.type === \"TSIntersectionType\" || node.type === \"IntersectionTypeAnnotation\") {\n const out2 = [];\n for (const t of node.types ?? []) out2.push(...readObjectMembers(t, decls, seen));\n return out2;\n }\n const members = node.members ?? node.body ?? node.properties ?? [];\n const out = [];\n for (const m of members) {\n switch (m.type) {\n case \"TSPropertySignature\":\n case \"ObjectTypeProperty\": {\n const name = m.key?.name ?? m.key?.value;\n if (!name) break;\n out.push({ name, type: readType(m.typeAnnotation ?? m.value) });\n break;\n }\n // flow's `...OtherProps` inside an object type\n case \"ObjectTypeSpreadProperty\": {\n const name = readTypeName(m.argument?.id ?? m.argument);\n if (name) out.push(...flattenMembers(name, decls, seen));\n break;\n }\n }\n }\n return out;\n}\nfunction findComponentCall(body) {\n for (const node of body) {\n if (node.type !== \"ExportDefaultDeclaration\") continue;\n let expr = node.declaration;\n while (expr) {\n if (expr.type === \"CallExpression\") break;\n expr = expr.expression ?? (expr.type === \"SequenceExpression\" ? expr.expressions[expr.expressions.length - 1] : null);\n }\n if (expr?.type === \"CallExpression\" && expr.callee?.name === \"codegenNativeComponent\") {\n return expr;\n }\n }\n return null;\n}\nfunction findCommandsCall(body) {\n for (const raw of body) {\n const node = raw?.type === \"ExportNamedDeclaration\" ? raw.declaration : raw;\n const decl = node?.declarations?.[0];\n let init = decl?.init;\n while (init && init.type !== \"CallExpression\") init = init.expression;\n if (init?.type === \"CallExpression\" && init.callee?.name === \"codegenNativeCommands\") {\n return init;\n }\n }\n return null;\n}\nfunction readStringOption(objectExpression, key) {\n for (const p of objectExpression?.properties ?? []) {\n if ((p.key?.name ?? p.key?.value) === key && typeof p.value?.value === \"string\") {\n return p.value.value;\n }\n }\n return null;\n}\nfunction readCommands(call, decls) {\n const typeName = readTypeName(\n (call.typeArguments ?? call.typeParameters)?.params?.[0]?.typeName ?? (call.typeArguments ?? call.typeParameters)?.params?.[0]?.id\n );\n const supported = [];\n for (const p of call.arguments?.[0]?.properties ?? []) {\n if ((p.key?.name ?? p.key?.value) !== \"supportedCommands\") continue;\n for (const el of p.value?.elements ?? []) {\n if (typeof el?.value === \"string\") supported.push(el.value);\n }\n }\n if (!supported.length) return [];\n const decl = decls.get(typeName);\n const byName = /* @__PURE__ */ new Map();\n const commandMembers = decl?.body?.body ?? decl?.body?.members ?? decl?.body?.properties ?? [];\n for (const m of commandMembers) {\n const name = m.key?.name ?? m.key?.value;\n if (!name) continue;\n const fn = m.type === \"TSMethodSignature\" ? m : m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation;\n const params = (fn?.params ?? fn?.parameters ?? []).slice(1);\n byName.set(\n name,\n params.map((p, i) => p.name?.name ?? p.name ?? `arg${i}`)\n );\n }\n return supported.map((name) => ({ name, params: byName.get(name) ?? [] }));\n}\nfunction indent(text, spaces) {\n const pad = \" \".repeat(spaces);\n return text.split(\"\\n\").map((line, i) => i === 0 || line === \"\" ? line : pad + line).join(\"\\n\");\n}\nfunction printViewConfig(componentName, attributes, events) {\n const lines = [` uiViewClassName: ${JSON.stringify(componentName)}`];\n const bubbling = events.filter((e) => e.bubbling);\n if (bubbling.length) {\n lines.push(\n ` bubblingEventTypes: {\n${bubbling.map(\n (e) => ` ${e.topName}: {\n phasedRegistrationNames: {\n captured: ${JSON.stringify(\n `${e.name}Capture`\n )},\n bubbled: ${JSON.stringify(e.name)}\n }\n }`\n ).join(\",\\n\")}\n }`\n );\n }\n const direct = events.filter((e) => !e.bubbling);\n if (direct.length) {\n lines.push(\n ` directEventTypes: {\n${direct.map(\n (e) => ` ${e.topName}: {\n registrationName: ${JSON.stringify(e.name)}\n }`\n ).join(\",\\n\")}\n }`\n );\n }\n const attrLines = attributes.map((a) => ` ${a.name}: ${indent(a.value, 4)}`);\n if (events.length) {\n attrLines.push(\n ` ...ConditionallyIgnoredEventHandlers({\n${events.map((e) => ` ${e.name}: true`).join(\",\\n\")}\n })`\n );\n }\n lines.push(\n attrLines.length ? ` validAttributes: {\n${attrLines.join(\",\\n\")}\n }` : \" validAttributes: {}\"\n );\n return `{\n${lines.join(\",\\n\")}\n}`;\n}\nfunction printCommands(commands) {\n return `export const Commands = {\n${commands.map(\n (c) => ` ${c.name}(ref${c.params.map((p) => `, ${p}`).join(\"\")}) {\n dispatchCommand(ref, ${JSON.stringify(\n c.name\n )}, [${c.params.join(\", \")}]);\n }`\n ).join(\",\\n\")}\n};`;\n}\nconst FILE_HEADER = `/**\n * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).\n *\n * Do not edit this file as changes may cause incorrect behavior and will be lost\n * once the code is regenerated.\n *\n * @flow\n *\n * @generated by codegen project: GenerateViewConfigJs.js\n */\n\n'use strict';\n`;\nfunction parseSpec(code, filename, projectRoot) {\n const isTS = /\\.[cm]?tsx?$/.test(filename);\n if (isTS) {\n const result = parseSync(filename, code, {\n lang: filename.endsWith(\"x\") ? \"tsx\" : \"ts\"\n });\n if (result.errors?.length) return null;\n return result.program;\n }\n const hermes = getHermesParser(projectRoot);\n if (!hermes) return null;\n try {\n return hermes.parse(code, {\n babel: false,\n flow: \"all\",\n sourceFilename: filename\n });\n } catch {\n return null;\n }\n}\nfunction generateViewConfig(program) {\n const body = program?.body;\n if (!body) return null;\n const call = findComponentCall(body);\n if (!call) return null;\n const componentNameArg = call.arguments?.[0];\n if (typeof componentNameArg?.value !== \"string\") return null;\n const componentName = componentNameArg.value;\n const options = call.arguments?.[1];\n const paperComponentName = readStringOption(options, \"paperComponentName\");\n const paperComponentNameDeprecated = readStringOption(\n options,\n \"paperComponentNameDeprecated\"\n );\n const propsTypeName = readTypeName(\n (call.typeArguments ?? call.typeParameters)?.params?.[0]?.typeName ?? (call.typeArguments ?? call.typeParameters)?.params?.[0]?.id\n );\n if (!propsTypeName) return null;\n const decls = collectDeclarations(body);\n const members = flattenMembers(propsTypeName, decls);\n const attributes = [];\n const events = [];\n for (const m of members) {\n const event = eventOf(m.name, m.type);\n if (event) {\n events.push(event);\n continue;\n }\n attributes.push({ name: m.name, value: attributeValue(m.type) });\n }\n const commandsCall = findCommandsCall(body);\n const commands = commandsCall ? readCommands(commandsCall, decls) : [];\n const imports = /* @__PURE__ */ new Set([IMPORT_REGISTRY]);\n if (events.length) imports.add(IMPORT_IGNORE);\n if (commands.length) imports.add(IMPORT_DISPATCH);\n if (paperComponentNameDeprecated) imports.add(IMPORT_UIMANAGER);\n const nativeName = paperComponentName ?? componentName;\n const parts = [`let nativeComponentName = '${nativeName}';`];\n if (paperComponentNameDeprecated) {\n parts.push(\n `if (UIManager.hasViewManagerConfig('${componentName}')) {\n nativeComponentName = '${componentName}';\n} else if (UIManager.hasViewManagerConfig('${paperComponentNameDeprecated}')) {\n nativeComponentName = '${paperComponentNameDeprecated}';\n} else {\n throw new Error('Failed to find native component for either \"${componentName}\" or \"${paperComponentNameDeprecated}\"');\n}`\n );\n }\n parts.push(\n `export const __INTERNAL_VIEW_CONFIG = ${printViewConfig(nativeName, attributes, events)};`\n );\n parts.push(\n \"export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);\"\n );\n if (commands.length) parts.push(printCommands(commands));\n return { imports: [...imports].sort(), body: parts.join(\"\\n\") };\n}\nfunction renderViewConfigModule(result) {\n return `\n${FILE_HEADER}\n${result.imports.join(\"\\n\")}\n\n${result.body}\n`;\n}\nfunction getLibraryName(filename) {\n const base = basename(filename);\n const replaced = base.replace(/NativeComponent\\.[cm]?[jt]sx?$/, \"\");\n return replaced === base ? base.replace(/\\.[cm]?[jt]sx?$/, \"\") : replaced;\n}\nexport {\n generateViewConfig,\n getLibraryName,\n parseSpec,\n renderViewConfigModule\n};\n//# sourceMappingURL=reactNativeViewConfig.js.map\n"],"mappings":";;;;;AAGA,MAAM,WAAW,OAAO,eAAe,cAAc,aAAa,YAAY;AAC9E,MAAM,kBAAkB;AACxB,MAAM,wBAAwB;AAC9B,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AACxB,MAAM,wBAAwB;AAC9B,MAAM,kBAAkB;AACxB,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AACzB,IAAI,eAAe,KAAK;AACxB,SAAS,gBAAgB,aAAa;CACpC,IAAI,iBAAiB,KAAK,GAAG;EAC3B,IAAI;GACF,MAAM,MAAM,cAAc,cAAc,KAAK,aAAa,cAAc,CAAC,IAAI,cAAc,QAAQ;GACnG,eAAe,IAAI,eAAe;EACpC,QAAQ;GACN,IAAI;IACF,eAAe,cAAc,QAAQ,CAAC,CAAC,eAAe;GACxD,QAAQ;IACN,eAAe;GACjB;EACF;CACF;CACA,OAAO;AACT;AACA,SAAS,SAAS,MAAM;CACtB,IAAI,CAAC,MAAM,OAAO;EAAE,MAAM;EAAI,MAAM,CAAC;CAAE;CACvC,QAAQ,KAAK,MAAb;EAEE,KAAK;EACL,KAAK,kBACH,OAAO,SAAS,KAAK,cAAc;EACrC,KAAK,yBACH,OAAO;GACL,MAAM,aAAa,KAAK,EAAE;GAC1B,OAAO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,6BAA6B;;iEAES,cAAc,QAAQ,6BAA6B;EAEhH;CACF;CACA,MAAM,KACJ,yCAAyC,gBAAgB,YAAY,YAAY,MAAM,EAAE,EAC3F;CACA,MAAM,KACJ,gGACF;CACA,IAAI,SAAS,QAAQ,MAAM,KAAK,cAAc,QAAQ,CAAC;CACvD,OAAO;EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK;EAAG,MAAM,MAAM,KAAK,IAAI;CAAE;AAChE;AACA,SAAS,uBAAuB,QAAQ;CACtC,OAAO;EACP,YAAY;EACZ,OAAO,QAAQ,KAAK,IAAI,EAAE;;EAE1B,OAAO,KAAK;;AAEd;AACA,SAAS,eAAe,UAAU;CAChC,MAAM,OAAO,SAAS,QAAQ;CAC9B,MAAM,WAAW,KAAK,QAAQ,kCAAkC,EAAE;CAClE,OAAO,aAAa,OAAO,KAAK,QAAQ,mBAAmB,EAAE,IAAI;AACnE"}
@@ -1,5 +1,5 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
- import { extname, join, relative } from "node:path";
2
+ import { extname, join } from "node:path";
3
3
  import { resolvePath } from "@vxrn/utils";
4
4
  import { normalizePath } from "vite";
5
5
  import { configuration } from "./configure.mjs";
@@ -76,13 +76,6 @@ const getOptions = (props, force = false, userBabelConfig = null) => {
76
76
  plugins.push(resolvePath("react-native-css-interop/dist/babel-plugin.js"));
77
77
  }
78
78
  }
79
- if (enableNativewind || shouldBabelReanimated(props)) {
80
- try {
81
- const workletsPlugin = resolvePath("react-native-worklets/plugin", props.projectRoot);
82
- debug?.(`Using babel worklets on file ${props.id}`);
83
- plugins.push(workletsPlugin);
84
- } catch {}
85
- }
86
79
  if (shouldBabelReactCompiler(props)) {
87
80
  debug?.(`Using babel react compiler on file`);
88
81
  plugins.push(getBabelReactCompilerPlugin(props));
@@ -251,48 +244,6 @@ function shouldBabelGenerators({ code }) {
251
244
  return asyncGeneratorRegex.test(code);
252
245
  }
253
246
  }
254
- const REANIMATED_AUTOWORKLETIZATION_KEYWORDS = [
255
- "worklet",
256
- "useAnimatedGestureHandler",
257
- "useAnimatedScrollHandler",
258
- "useFrameCallback",
259
- "useAnimatedStyle",
260
- "useAnimatedProps",
261
- "createAnimatedPropAdapter",
262
- "useDerivedValue",
263
- "useAnimatedReaction",
264
- "useWorkletCallback",
265
- "withTiming",
266
- "withSpring",
267
- "withDecay",
268
- "withRepeat",
269
- "runOnUI",
270
- "executeOnUIRuntimeSync"
271
- ];
272
- const REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join("|"));
273
- const REANIMATED_IGNORED_PATHS = [
274
- "react-native-prebuilt",
275
- "node_modules/.vxrn/react-native",
276
- "node_modules/react/",
277
- "node_modules/react-dom/",
278
- "node_modules/react-native/",
279
- "node_modules/react-native-web/"
280
- ];
281
- const REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join("|"));
282
- function shouldBabelReanimated({ code, id }) {
283
- if (!configuration.enableReanimated) {
284
- return false;
285
- }
286
- if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {
287
- return false;
288
- }
289
- if (REANIMATED_REGEX.test(code)) {
290
- const location = id.includes("node_modules") ? "node_modules" : "user-code";
291
- debug?.(` \u{1FA84} [reanimated/${location}] ${relative(process.cwd(), id)}`);
292
- return true;
293
- }
294
- return false;
295
- }
296
247
 
297
248
  export { findUserBabelConfig, getBabelOptions, stripFlowTypes, transformBabel, transformOxcReactCompiler };
298
249
  //# sourceMappingURL=transformBabel.mjs.map
@@ -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 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;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,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 } 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 (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}\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;K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LOBALS } from "./worklets/globals.mjs";
3
+ import { transformHermesLoops } from "./transformHermesLoops.mjs";
4
+
5
+ export { JS_GLOBALS, getClosureVariables, transformHermesLoops };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vxrn/compiler",
3
- "version": "2.0.0-beta.168.1",
3
+ "version": "2.0.0-beta.362.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -8,6 +8,11 @@
8
8
  "types": "./types/index.d.ts",
9
9
  "import": "./dist/esm/index.mjs",
10
10
  "require": "./dist/cjs/index.cjs"
11
+ },
12
+ "./worklet-utils": {
13
+ "types": "./types/workletUtils.d.ts",
14
+ "import": "./dist/esm/workletUtils.mjs",
15
+ "require": "./dist/cjs/workletUtils.cjs"
11
16
  }
12
17
  },
13
18
  "main": "dist/cjs",
@@ -38,8 +43,8 @@
38
43
  "@babel/plugin-transform-react-jsx": "^7.27.1",
39
44
  "@babel/plugin-transform-regenerator": "^7.28.4",
40
45
  "@jridgewell/remapping": "^2.3.0",
41
- "@vxrn/utils": "2.0.0-beta.168.1",
42
- "@vxrn/vite-native-client": "2.0.0-beta.168.1",
46
+ "@vxrn/utils": "2.0.0-beta.362.1",
47
+ "@vxrn/vite-native-client": "2.0.0-beta.362.1",
43
48
  "babel-plugin-react-compiler": "^1.0.0",
44
49
  "babel-plugin-syntax-hermes-parser": "^0.36.1",
45
50
  "babel-plugin-transform-flow-enums": "^0.0.2",
@@ -70,6 +75,7 @@
70
75
  "publishConfig": {
71
76
  "access": "public"
72
77
  },
78
+ "releaseSourceCommit": "6b489d521782af129132654d2baeb318f4bc2fdc",
73
79
  "repository": {
74
80
  "type": "git",
75
81
  "url": "git+https://github.com/onejs/one.git",
package/src/index.ts CHANGED
@@ -163,10 +163,14 @@ async function performBabelTransform({
163
163
  }
164
164
 
165
165
  if (userTransform !== 'swc' && userTransform !== 'oxc') {
166
- const babelOptions = getBabelOptions({
166
+ let babelOptions = getBabelOptions({
167
167
  ...transformProps,
168
168
  userSetting: userTransform,
169
169
  })
170
+ // worklets run without requesting a babel pass.
171
+ if (!babelOptions && shouldTransformWorklets({ id, code })) {
172
+ babelOptions = { plugins: [] }
173
+ }
170
174
 
171
175
  if (babelOptions) {
172
176
  const hasCompilerPlugin = babelOptions.plugins?.some(
@@ -389,7 +389,12 @@ function readCommands(call: any, decls: Declarations): Command[] {
389
389
  for (const m of commandMembers) {
390
390
  const name = m.key?.name ?? m.key?.value
391
391
  if (!name) continue
392
- const fn = m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation
392
+ // `setPage(ref, index): void` carries its params on the member itself;
393
+ // `setPage: (ref, index) => void` and flow members carry a function type
394
+ const fn =
395
+ m.type === 'TSMethodSignature'
396
+ ? m
397
+ : (m.typeAnnotation?.typeAnnotation ?? m.value ?? m.typeAnnotation)
393
398
  const params = (fn?.params ?? fn?.parameters ?? []).slice(1)
394
399
  byName.set(
395
400
  name,
@@ -14,8 +14,8 @@ import {
14
14
  afterEach(() => {
15
15
  configureVXRNCompilerPlugin({ enableReanimated: false })
16
16
  })
17
- describe('getBabelOptions Worklets resolution', () => {
18
- it('uses the app-installed Worklets Babel plugin', () => {
17
+ describe('getBabelOptions worklets ownership', () => {
18
+ it('does not add an automatic Worklets Babel pass', () => {
19
19
  const projectRoot = fs.realpathSync(
20
20
  fs.mkdtempSync(path.join(os.tmpdir(), 'vxrn-worklets-'))
21
21
  )
@@ -41,7 +41,7 @@ describe('getBabelOptions Worklets resolution', () => {
41
41
  projectRoot,
42
42
  })
43
43
 
44
- expect(options?.plugins).toContain(pluginPath)
44
+ expect(options).toBeNull()
45
45
  } finally {
46
46
  fs.rmSync(projectRoot, { recursive: true, force: true })
47
47
  }
@@ -248,7 +248,7 @@ export async function* generatorProbe() {
248
248
  })
249
249
 
250
250
  describe('shared compiler worklets backend selection', () => {
251
- it('retains Babel for worklets by default when enableNativeWorklets is false', async () => {
251
+ it('does not fall back to Babel when worklet compilation is disabled', async () => {
252
252
  const { vi } = await import('vitest')
253
253
  const { createVXRNCompilerPlugin } = await import('./index')
254
254
  const workletsModule = await import('./transformWorklets')
@@ -270,8 +270,8 @@ describe('shared compiler worklets backend selection', () => {
270
270
  const hook = plugin.transform.handler || plugin.transform
271
271
  const context = { environment: { name: 'ios' } }
272
272
  const result = await hook.call(context, inputCode, tempFile)
273
- expect(result).toBeDefined()
274
- // With enableNativeWorklets: false, transformWorklets (SWC) is NOT called
273
+ expect(result).toBeNull()
274
+ // disabling the transform does not select a second backend.
275
275
  expect(workletSpy).not.toHaveBeenCalled()
276
276
  } finally {
277
277
  workletSpy.mockRestore()
@@ -283,7 +283,7 @@ describe('shared compiler worklets backend selection', () => {
283
283
  }
284
284
  })
285
285
 
286
- it('uses native SWC for worklets when enableNativeWorklets is true', async () => {
286
+ it('compiles worklets with One when no Babel pass is requested', async () => {
287
287
  const compiler = await import('./index')
288
288
  const { vi } = await import('vitest')
289
289
  const workletsModule = await import('./transformWorklets')
@@ -306,7 +306,8 @@ describe('shared compiler worklets backend selection', () => {
306
306
  const context = { environment: { name: 'ios' } }
307
307
  const result = await hook.call(context, inputCode, tempFile)
308
308
  expect(result).toBeDefined()
309
- // With enableNativeWorklets: true, transformWorklets (SWC) IS called
309
+ expect(result.code).toContain('__workletHash')
310
+ // the worklet-only file still reaches the One transform.
310
311
  expect(workletSpy).toHaveBeenCalled()
311
312
  } finally {
312
313
  workletSpy.mockRestore()
@@ -329,7 +330,7 @@ describe('shared compiler worklets backend selection', () => {
329
330
  fs.writeFileSync(tempFile, inputCode)
330
331
 
331
332
  try {
332
- // Step 1: Run with Babel backend (enableNativeWorklets: false)
333
+ // begin with worklet compilation disabled.
333
334
  configureVXRNCompilerPlugin({
334
335
  enableReanimated: true,
335
336
  enableNativeWorklets: false,
@@ -342,10 +343,10 @@ describe('shared compiler worklets backend selection', () => {
342
343
  const context = { environment: { name: 'ios' } }
343
344
 
344
345
  const res1 = await hook1.call(context, inputCode, tempFile)
345
- expect(res1).toBeDefined()
346
+ expect(res1).toBeNull()
346
347
  expect(workletSpy).toHaveBeenCalledTimes(0)
347
348
 
348
- // Step 2: Toggle to native SWC backend on the SAME file without changes
349
+ // enable the transform on the same unchanged file.
349
350
  configureVXRNCompilerPlugin({
350
351
  enableReanimated: true,
351
352
  enableNativeWorklets: true,
@@ -358,15 +359,16 @@ describe('shared compiler worklets backend selection', () => {
358
359
 
359
360
  const res2 = await hook2.call(context, inputCode, tempFile)
360
361
  expect(res2).toBeDefined()
361
- // Cache must NOT serve the Babel entry; native transformWorklets must be invoked
362
+ expect(res2.code).toContain('__workletHash')
363
+ // the cache must not serve the untransformed entry.
362
364
  expect(workletSpy).toHaveBeenCalledTimes(1)
363
365
 
364
- // Step 3: Call again with native SWC to verify caching works for the native backend
366
+ // reuse the transformed cache entry.
365
367
  const res3 = await hook2.call(context, inputCode, tempFile)
366
368
  expect(res3).toBeDefined()
367
369
  expect(workletSpy).toHaveBeenCalledTimes(1)
368
370
 
369
- // Step 4: Toggle back to Babel backend; cache must not serve SWC entry
371
+ // disable the transform; the cache must not serve a transformed entry.
370
372
  configureVXRNCompilerPlugin({
371
373
  enableReanimated: true,
372
374
  enableNativeWorklets: false,
@@ -378,8 +380,8 @@ describe('shared compiler worklets backend selection', () => {
378
380
  const hook3 = plugin3.transform.handler || plugin3.transform
379
381
 
380
382
  const res4 = await hook3.call(context, inputCode, tempFile)
381
- expect(res4).toBeDefined()
382
- // workletSpy should still have only been called once
383
+ expect(res4).toBeNull()
384
+ // no second transform was requested.
383
385
  expect(workletSpy).toHaveBeenCalledTimes(1)
384
386
  } finally {
385
387
  workletSpy.mockRestore()
@@ -1,5 +1,5 @@
1
1
  import { existsSync, readFileSync } from 'node:fs'
2
- import { extname, join, relative } from 'node:path'
2
+ import { extname, join } from 'node:path'
3
3
  // type-only, so that importing this module does not drag babel in. every metro
4
4
  // worker loads it through the package index, and on the native transform path
5
5
  // babel is never called at all: loading it there is pure startup cost.
@@ -117,17 +117,6 @@ const getOptions = (
117
117
  }
118
118
  }
119
119
 
120
- if (enableNativewind || shouldBabelReanimated(props)) {
121
- try {
122
- const workletsPlugin = resolvePath(
123
- 'react-native-worklets/plugin',
124
- props.projectRoot
125
- )
126
- debug?.(`Using babel worklets on file ${props.id}`)
127
- plugins.push(workletsPlugin)
128
- } catch {}
129
- }
130
-
131
120
  if (shouldBabelReactCompiler(props)) {
132
121
  debug?.(`Using babel react compiler on file`)
133
122
  plugins.push(getBabelReactCompilerPlugin(props))
@@ -417,74 +406,3 @@ function shouldBabelGenerators({ code }: Props) {
417
406
  return asyncGeneratorRegex.test(code)
418
407
  }
419
408
  }
420
-
421
- /**
422
- * ------- reanimated --------
423
- */
424
-
425
- /**
426
- * Taken from https://github.com/software-mansion/react-native-reanimated/blob/3.15.1/packages/react-native-reanimated/plugin/src/autoworkletization.ts#L19-L59, need to check if this is up-to-date when supporting newer versions of react-native-reanimated.
427
- */
428
- const REANIMATED_AUTOWORKLETIZATION_KEYWORDS = [
429
- 'worklet',
430
- 'useAnimatedGestureHandler',
431
- 'useAnimatedScrollHandler',
432
- 'useFrameCallback',
433
- 'useAnimatedStyle',
434
- 'useAnimatedProps',
435
- 'createAnimatedPropAdapter',
436
- 'useDerivedValue',
437
- 'useAnimatedReaction',
438
- 'useWorkletCallback',
439
- 'withTiming',
440
- 'withSpring',
441
- 'withDecay',
442
- 'withRepeat',
443
- 'runOnUI',
444
- 'executeOnUIRuntimeSync',
445
- ]
446
-
447
- /**
448
- * Regex to test if a piece of code should be processed by react-native-reanimated's Babel plugin.
449
- */
450
- const REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join('|'))
451
-
452
- // Packages to skip for reanimated babel transform
453
- // These either have false positives (mention keywords but don't use worklets)
454
- // or cause issues when transformed
455
- const REANIMATED_IGNORED_PATHS = [
456
- // Prebuilt/vendored react-native that shouldn't be transformed
457
- 'react-native-prebuilt',
458
- 'node_modules/.vxrn/react-native',
459
- // Known false positives - they mention worklet keywords in comments/strings but don't use them
460
- 'node_modules/react/',
461
- 'node_modules/react-dom/',
462
- 'node_modules/react-native/',
463
- 'node_modules/react-native-web/',
464
- ]
465
-
466
- // `id`s are normalized to forward slashes at getBabelOptions' entry, so these
467
- // plain forward-slash paths match on every OS. before that normalization the
468
- // backslash `id`s Windows hands us slipped past this list, pushing react-native's
469
- // own files through the reanimated babel pass, which has no JSX/TS parser.
470
- const REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join('|'))
471
-
472
- function shouldBabelReanimated({ code, id }: Props) {
473
- if (!configuration.enableReanimated) {
474
- return false
475
- }
476
-
477
- // Check if path should be ignored
478
- if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {
479
- return false
480
- }
481
-
482
- // Check regex for all files (both node_modules and user code)
483
- if (REANIMATED_REGEX.test(code)) {
484
- const location = id.includes('node_modules') ? 'node_modules' : 'user-code'
485
- debug?.(` 🪄 [reanimated/${location}] ${relative(process.cwd(), id)}`)
486
- return true
487
- }
488
-
489
- return false
490
- }
@@ -0,0 +1,4 @@
1
+ // compiler hosts can load capture analysis without importing Vite.
2
+ export { getClosureVariables } from './worklets/scope'
3
+ export { JS_GLOBALS } from './worklets/globals'
4
+ export { transformHermesLoops } from './transformHermesLoops'
@@ -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,cAAc,0BAA0B,CAAA;AACxC,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,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;AA8S3C,wBAAsB,wBAAwB,CAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC,CAkWzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeViewConfig.d.ts","sourceRoot":"","sources":["../src/reactNativeViewConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA4dH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAuBnF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,GAAG,GACX;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsE5C;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,UAEjF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvD"}
1
+ {"version":3,"file":"reactNativeViewConfig.d.ts","sourceRoot":"","sources":["../src/reactNativeViewConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAieH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAuBnF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,GAAG,GACX;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsE5C;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,UAEjF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvD"}
@@ -1 +1 @@
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;AA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AA0DD;;;;;;;;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,4 @@
1
+ export { getClosureVariables } from './worklets/scope';
2
+ export { JS_GLOBALS } from './worklets/globals';
3
+ export { transformHermesLoops } from './transformHermesLoops';
4
+ //# sourceMappingURL=workletUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workletUtils.d.ts","sourceRoot":"","sources":["../src/workletUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA"}