@vxrn/compiler 1.27.1 → 2.0.0-beta.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/cjs/cache.cjs +106 -117
  2. package/dist/cjs/configure.cjs +26 -28
  3. package/dist/cjs/constants.cjs +56 -60
  4. package/dist/cjs/index.cjs +420 -443
  5. package/dist/cjs/reactNativeCodegen.cjs +105 -114
  6. package/dist/cjs/reactNativeViewConfig.cjs +362 -381
  7. package/dist/cjs/refresh-runtime.cjs +390 -397
  8. package/dist/cjs/transformBabel.cjs +273 -263
  9. package/dist/cjs/transformHermesAsync.cjs +36 -47
  10. package/dist/cjs/transformHermesLoops.cjs +279 -281
  11. package/dist/cjs/transformSWC.cjs +183 -200
  12. package/dist/cjs/transformWorklets.cjs +107 -95
  13. package/dist/cjs/types.cjs +9 -11
  14. package/dist/cjs/worklets/autoworklet.cjs +277 -222
  15. package/dist/cjs/worklets/globals.cjs +124 -60
  16. package/dist/cjs/worklets/hash.cjs +23 -27
  17. package/dist/cjs/worklets/scope.cjs +338 -359
  18. package/dist/cjs/worklets/serialize.cjs +73 -75
  19. package/dist/cjs/worklets/transform.cjs +217 -222
  20. package/dist/cjs/worklets/types.cjs +9 -11
  21. package/dist/esm/cache.mjs +90 -97
  22. package/dist/esm/cache.mjs.map +1 -1
  23. package/dist/esm/configure.mjs +11 -10
  24. package/dist/esm/configure.mjs.map +1 -1
  25. package/dist/esm/constants.mjs +41 -41
  26. package/dist/esm/constants.mjs.map +1 -1
  27. package/dist/esm/index.js +417 -425
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/index.mjs +417 -425
  30. package/dist/esm/index.mjs.map +1 -1
  31. package/dist/esm/reactNativeCodegen.mjs +90 -88
  32. package/dist/esm/reactNativeCodegen.mjs.map +1 -1
  33. package/dist/esm/reactNativeViewConfig.mjs +347 -362
  34. package/dist/esm/reactNativeViewConfig.mjs.map +1 -1
  35. package/dist/esm/refresh-runtime.mjs +372 -376
  36. package/dist/esm/refresh-runtime.mjs.map +1 -1
  37. package/dist/esm/transformBabel.mjs +255 -237
  38. package/dist/esm/transformBabel.mjs.map +1 -1
  39. package/dist/esm/transformHermesAsync.mjs +20 -21
  40. package/dist/esm/transformHermesAsync.mjs.map +1 -1
  41. package/dist/esm/transformHermesLoops.mjs +264 -255
  42. package/dist/esm/transformHermesLoops.mjs.map +1 -1
  43. package/dist/esm/transformSWC.mjs +163 -171
  44. package/dist/esm/transformSWC.mjs.map +1 -1
  45. package/dist/esm/transformWorklets.mjs +89 -69
  46. package/dist/esm/transformWorklets.mjs.map +1 -1
  47. package/dist/esm/types.mjs +0 -2
  48. package/dist/esm/worklets/autoworklet.mjs +258 -200
  49. package/dist/esm/worklets/autoworklet.mjs.map +1 -1
  50. package/dist/esm/worklets/globals.mjs +109 -42
  51. package/dist/esm/worklets/globals.mjs.map +1 -1
  52. package/dist/esm/worklets/hash.mjs +10 -9
  53. package/dist/esm/worklets/hash.mjs.map +1 -1
  54. package/dist/esm/worklets/scope.mjs +325 -341
  55. package/dist/esm/worklets/scope.mjs.map +1 -1
  56. package/dist/esm/worklets/serialize.mjs +60 -58
  57. package/dist/esm/worklets/serialize.mjs.map +1 -1
  58. package/dist/esm/worklets/transform.mjs +201 -197
  59. package/dist/esm/worklets/transform.mjs.map +1 -1
  60. package/dist/esm/worklets/types.mjs +0 -2
  61. package/package.json +7 -6
  62. package/src/transformBabel.test.ts +77 -17
  63. package/src/transformBabel.ts +28 -12
  64. package/types/transformBabel.d.ts +12 -0
  65. package/types/transformBabel.d.ts.map +1 -1
  66. package/types/transformSWC.d.ts +1 -4
  67. package/types/transformSWC.d.ts.map +1 -1
  68. package/dist/cjs/transformBabel.test.cjs +0 -652
  69. package/dist/cjs/transformHermesLoops.test.cjs +0 -257
  70. package/dist/cjs/transformSWC.test.cjs +0 -117
  71. package/dist/cjs/transformWorklets.test.cjs +0 -604
  72. package/dist/esm/transformBabel.test.mjs +0 -629
  73. package/dist/esm/transformBabel.test.mjs.map +0 -1
  74. package/dist/esm/transformHermesLoops.test.mjs +0 -234
  75. package/dist/esm/transformHermesLoops.test.mjs.map +0 -1
  76. package/dist/esm/transformSWC.test.mjs +0 -118
  77. package/dist/esm/transformSWC.test.mjs.map +0 -1
  78. package/dist/esm/transformWorklets.test.mjs +0 -581
  79. package/dist/esm/transformWorklets.test.mjs.map +0 -1
  80. package/dist/esm/types.mjs.map +0 -1
  81. package/dist/esm/worklets/types.mjs.map +0 -1
  82. package/types/transformBabel.test.d.ts +0 -2
  83. package/types/transformBabel.test.d.ts.map +0 -1
  84. package/types/transformHermesLoops.test.d.ts +0 -2
  85. package/types/transformHermesLoops.test.d.ts.map +0 -1
  86. package/types/transformSWC.test.d.ts +0 -2
  87. package/types/transformSWC.test.d.ts.map +0 -1
  88. package/types/transformWorklets.test.d.ts +0 -2
  89. package/types/transformWorklets.test.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["REACT_FORWARD_REF_TYPE","Symbol","for","REACT_MEMO_TYPE","allFamiliesByID","Map","allFamiliesByType","WeakMap","allSignaturesByType","updatedFamiliesByType","pendingUpdates","helpersByRendererID","helpersByRoot","mountedRoots","Set","failedRoots","rootElements","isPerformingRefresh","computeFullKey","signature","fullKey","ownKey","hooks","getCustomHooks","err","forceReset","i","length","hook","nestedHookSignature","get","nestedHookKey","haveEqualSignatures","prevType","nextType","prevSignature","nextSignature","isReactClass","type","prototype","isReactComponent","canPreserveStateBetween","resolveFamily","getProperty","object","property","performReactRefresh","staleFamilies","updatedFamilies","updates","forEach","family","current","set","add","update","helpers","setRefreshHandler","didError","firstError","failedRootsSnapshot","mountedRootsSnapshot","helpersByRootSnapshot","root","Error","has","element","scheduleRoot","scheduleRefresh","register","id","push","render","setSignature","key","collectCustomHooksForSignature","injectIntoGlobalHook","globalObject","__REACT_DEVTOOLS_GLOBAL_HOOK__","nextID","renderers","supportsFiber","inject","injected","onScheduleFiberRoot","children","onCommitFiberRoot","maybePriorityLevel","onCommitFiberUnmount","isDisabled","console","oldInject","apply","arguments","oldOnCommitFiberRoot","oldOnScheduleFiberRoot","delete","alternate","wasMounted","memoizedState","isMounted","createSignatureFunctionForTransform","savedType","hasCustomHooks","didCollectHooks","isLikelyComponentType","ownNames","Object","getOwnPropertyNames","__proto__","name","displayName","test","getRefreshReg","filename","registerExportsForReactRefresh","moduleExports","exportValue","debounce","fn","delay","handle","clearTimeout","setTimeout","window","__registerBeforePerformReactRefresh","cb","enqueueUpdate","Promise","all","map","validateRefreshBoundaryAndEnqueueUpdate","prevExports","nextExports","ignoredExports","predicateOnExport","hasExports","allExportsAreComponentsOrUnchanged","value","predicate","includes","desc","getOwnPropertyDescriptor","__hmr_import","module","refresh_runtime_default"],"sources":["../../src/refresh-runtime.js"],"sourcesContent":[null],"mappings":"AAAA;AAOA,MAAMA,sBAAA,GAAyB,eAAAC,MAAA,CAAOC,GAAA,CAAI,mBAAmB;AAC7D,MAAMC,eAAA,GAAkB,eAAAF,MAAA,CAAOC,GAAA,CAAI,YAAY;AAI/C,IAAIE,eAAA,GAAkB,mBAAIC,GAAA,CAAI;AAC9B,IAAIC,iBAAA,GAAoB,mBAAIC,OAAA,CAAQ;AACpC,IAAIC,mBAAA,GAAsB,mBAAID,OAAA,CAAQ;AAItC,MAAME,qBAAA,GAAwB,mBAAIF,OAAA,CAAQ;AAI1C,IAAIG,cAAA,GAAiB,EAAC;AAGtB,MAAMC,mBAAA,GAAsB,mBAAIN,GAAA,CAAI;AAEpC,MAAMO,aAAA,GAAgB,mBAAIP,GAAA,CAAI;AAG9B,MAAMQ,YAAA,GAAe,mBAAIC,GAAA,CAAI;AAE7B,MAAMC,WAAA,GAAc,mBAAID,GAAA,CAAI;AAK5B,IAAIE,YAAA,GAAe,mBAAIT,OAAA,CAAQ;AAC/B,IAAIU,mBAAA,GAAsB;AAE1B,SAASC,eAAeC,SAAA,EAAW;EACjC,IAAIA,SAAA,CAAUC,OAAA,KAAY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IAC/D,IAAImE,IAAA,IAAQA,IAAA,CAAK/G,GAAA,EAAK,OAAO4C,GAAA;IAC7B,IAAI,CAACiE,SAAA,CAAUjE,GAAA,EAAK0C,aAAA,CAAc1C,GAAG,CAAC,GAAG,OAAOA,GAAA;EAClD;EACA,OAAO;AACT;AAIO,MAAMqE,YAAA,GAAgBC,MAAA,IAAW;AAA0BA,MAAA;AAGlE,IAAOC,uBAAA,GAAQ;EAAErE;AAAqB","ignoreList":[]}
1
+ {"version":3,"file":"refresh-runtime.js","names":[],"sources":["esm/refresh-runtime.js"],"sourcesContent":["/*! Copyright (c) Meta Platforms, Inc. and affiliates. **/\nconst REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for(\"react.forward_ref\");\nconst REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for(\"react.memo\");\nlet allFamiliesByID = /* @__PURE__ */ new Map();\nlet allFamiliesByType = /* @__PURE__ */ new WeakMap();\nlet allSignaturesByType = /* @__PURE__ */ new WeakMap();\nconst updatedFamiliesByType = /* @__PURE__ */ new WeakMap();\nlet pendingUpdates = [];\nconst helpersByRendererID = /* @__PURE__ */ new Map();\nconst helpersByRoot = /* @__PURE__ */ new Map();\nconst mountedRoots = /* @__PURE__ */ new Set();\nconst failedRoots = /* @__PURE__ */ new Set();\nlet rootElements = /* @__PURE__ */ new WeakMap();\nlet isPerformingRefresh = false;\nfunction computeFullKey(signature) {\n if (signature.fullKey !== null) {\n return signature.fullKey;\n }\n let fullKey = signature.ownKey;\n let hooks2;\n try {\n hooks2 = signature.getCustomHooks();\n } catch (err) {\n signature.forceReset = true;\n signature.fullKey = fullKey;\n return fullKey;\n }\n for (let i = 0; i < hooks2.length; i++) {\n const hook = hooks2[i];\n if (typeof hook !== \"function\") {\n signature.forceReset = true;\n signature.fullKey = fullKey;\n return fullKey;\n }\n const nestedHookSignature = allSignaturesByType.get(hook);\n if (nestedHookSignature === void 0) {\n continue;\n }\n const nestedHookKey = computeFullKey(nestedHookSignature);\n if (nestedHookSignature.forceReset) {\n signature.forceReset = true;\n }\n fullKey += \"\\n---\\n\" + nestedHookKey;\n }\n signature.fullKey = fullKey;\n return fullKey;\n}\nfunction haveEqualSignatures(prevType, nextType) {\n const prevSignature = allSignaturesByType.get(prevType);\n const nextSignature = allSignaturesByType.get(nextType);\n if (prevSignature === void 0 && nextSignature === void 0) {\n return true;\n }\n if (prevSignature === void 0 || nextSignature === void 0) {\n return false;\n }\n if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {\n return false;\n }\n if (nextSignature.forceReset) {\n return false;\n }\n return true;\n}\nfunction isReactClass(type) {\n return type.prototype && type.prototype.isReactComponent;\n}\nfunction canPreserveStateBetween(prevType, nextType) {\n if (isReactClass(prevType) || isReactClass(nextType)) {\n return false;\n }\n if (haveEqualSignatures(prevType, nextType)) {\n return true;\n }\n return false;\n}\nfunction resolveFamily(type) {\n return updatedFamiliesByType.get(type);\n}\nfunction getProperty(object, property) {\n try {\n return object[property];\n } catch (err) {\n return void 0;\n }\n}\nfunction performReactRefresh() {\n if (pendingUpdates.length === 0) {\n return null;\n }\n if (isPerformingRefresh) {\n return null;\n }\n isPerformingRefresh = true;\n try {\n const staleFamilies = /* @__PURE__ */ new Set();\n const updatedFamilies = /* @__PURE__ */ new Set();\n const updates = pendingUpdates;\n pendingUpdates = [];\n updates.forEach(([family, nextType]) => {\n const prevType = family.current;\n updatedFamiliesByType.set(prevType, family);\n updatedFamiliesByType.set(nextType, family);\n family.current = nextType;\n if (canPreserveStateBetween(prevType, nextType)) {\n updatedFamilies.add(family);\n } else {\n staleFamilies.add(family);\n }\n });\n const update = {\n updatedFamilies,\n // Families that will re-render preserving state\n staleFamilies\n // Families that will be remounted\n };\n helpersByRendererID.forEach((helpers) => {\n helpers.setRefreshHandler(resolveFamily);\n });\n let didError = false;\n let firstError = null;\n const failedRootsSnapshot = new Set(failedRoots);\n const mountedRootsSnapshot = new Set(mountedRoots);\n const helpersByRootSnapshot = new Map(helpersByRoot);\n failedRootsSnapshot.forEach((root) => {\n const helpers = helpersByRootSnapshot.get(root);\n if (helpers === void 0) {\n throw new Error(\n \"Could not find helpers for a root. This is a bug in React Refresh.\"\n );\n }\n if (!failedRoots.has(root)) {\n }\n if (rootElements === null) {\n return;\n }\n if (!rootElements.has(root)) {\n return;\n }\n const element = rootElements.get(root);\n try {\n helpers.scheduleRoot(root, element);\n } catch (err) {\n if (!didError) {\n didError = true;\n firstError = err;\n }\n }\n });\n mountedRootsSnapshot.forEach((root) => {\n const helpers = helpersByRootSnapshot.get(root);\n if (helpers === void 0) {\n throw new Error(\n \"Could not find helpers for a root. This is a bug in React Refresh.\"\n );\n }\n if (!mountedRoots.has(root)) {\n }\n try {\n helpers.scheduleRefresh(root, update);\n } catch (err) {\n if (!didError) {\n didError = true;\n firstError = err;\n }\n }\n });\n if (didError) {\n throw firstError;\n }\n return update;\n } finally {\n isPerformingRefresh = false;\n }\n}\nfunction register(type, id) {\n if (type === null) {\n return;\n }\n if (typeof type !== \"function\" && typeof type !== \"object\") {\n return;\n }\n if (allFamiliesByType.has(type)) {\n return;\n }\n let family = allFamiliesByID.get(id);\n if (family === void 0) {\n family = { current: type };\n allFamiliesByID.set(id, family);\n } else {\n pendingUpdates.push([family, type]);\n }\n allFamiliesByType.set(type, family);\n if (typeof type === \"object\" && type !== null) {\n switch (getProperty(type, \"$$typeof\")) {\n case REACT_FORWARD_REF_TYPE:\n register(type.render, id + \"$render\");\n break;\n case REACT_MEMO_TYPE:\n register(type.type, id + \"$type\");\n break;\n }\n }\n}\nfunction setSignature(type, key, forceReset, getCustomHooks) {\n if (!allSignaturesByType.has(type)) {\n allSignaturesByType.set(type, {\n forceReset,\n ownKey: key,\n fullKey: null,\n getCustomHooks: getCustomHooks || (() => [])\n });\n }\n if (typeof type === \"object\" && type !== null) {\n switch (getProperty(type, \"$$typeof\")) {\n case REACT_FORWARD_REF_TYPE:\n setSignature(type.render, key, forceReset, getCustomHooks);\n break;\n case REACT_MEMO_TYPE:\n setSignature(type.type, key, forceReset, getCustomHooks);\n break;\n }\n }\n}\nfunction collectCustomHooksForSignature(type) {\n const signature = allSignaturesByType.get(type);\n if (signature !== void 0) {\n computeFullKey(signature);\n }\n}\nfunction injectIntoGlobalHook(globalObject) {\n let hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__;\n if (hook === void 0) {\n let nextID = 0;\n globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {\n renderers: /* @__PURE__ */ new Map(),\n supportsFiber: true,\n inject: (injected) => nextID++,\n onScheduleFiberRoot: (id, root, children) => {\n },\n onCommitFiberRoot: (id, root, maybePriorityLevel, didError) => {\n },\n onCommitFiberUnmount() {\n }\n };\n }\n if (hook.isDisabled) {\n console[\"warn\"](\n \"Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). Fast Refresh is not compatible with this shim and will be disabled.\"\n );\n return;\n }\n const oldInject = hook.inject;\n hook.inject = function(injected) {\n const id = oldInject.apply(this, arguments);\n if (typeof injected.scheduleRefresh === \"function\" && typeof injected.setRefreshHandler === \"function\") {\n helpersByRendererID.set(id, injected);\n }\n return id;\n };\n hook.renderers.forEach((injected, id) => {\n if (typeof injected.scheduleRefresh === \"function\" && typeof injected.setRefreshHandler === \"function\") {\n helpersByRendererID.set(id, injected);\n }\n });\n const oldOnCommitFiberRoot = hook.onCommitFiberRoot;\n const oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || (() => {\n });\n hook.onScheduleFiberRoot = function(id, root, children) {\n if (!isPerformingRefresh) {\n failedRoots.delete(root);\n if (rootElements !== null) {\n rootElements.set(root, children);\n }\n }\n return oldOnScheduleFiberRoot.apply(this, arguments);\n };\n hook.onCommitFiberRoot = function(id, root, maybePriorityLevel, didError) {\n const helpers = helpersByRendererID.get(id);\n if (helpers !== void 0) {\n helpersByRoot.set(root, helpers);\n const current = root.current;\n const alternate = current.alternate;\n if (alternate !== null) {\n const wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null && mountedRoots.has(root);\n const isMounted = current.memoizedState != null && current.memoizedState.element != null;\n if (!wasMounted && isMounted) {\n mountedRoots.add(root);\n failedRoots.delete(root);\n } else if (wasMounted && isMounted) {\n } else if (wasMounted && !isMounted) {\n mountedRoots.delete(root);\n if (didError) {\n failedRoots.add(root);\n } else {\n helpersByRoot.delete(root);\n }\n } else if (!wasMounted && !isMounted) {\n if (didError) {\n failedRoots.add(root);\n }\n }\n } else {\n mountedRoots.add(root);\n }\n }\n return oldOnCommitFiberRoot.apply(this, arguments);\n };\n}\nfunction createSignatureFunctionForTransform() {\n let savedType;\n let hasCustomHooks;\n let didCollectHooks = false;\n return (type, key, forceReset, getCustomHooks) => {\n if (typeof key === \"string\") {\n if (!savedType) {\n savedType = type;\n hasCustomHooks = typeof getCustomHooks === \"function\";\n }\n if (type != null && (typeof type === \"function\" || typeof type === \"object\")) {\n setSignature(type, key, forceReset, getCustomHooks);\n }\n return type;\n }\n if (!didCollectHooks && hasCustomHooks) {\n didCollectHooks = true;\n collectCustomHooksForSignature(savedType);\n }\n };\n}\nfunction isLikelyComponentType(type) {\n switch (typeof type) {\n case \"function\": {\n if (type.prototype != null) {\n if (type.prototype.isReactComponent) {\n return true;\n }\n const ownNames = Object.getOwnPropertyNames(type.prototype);\n if (ownNames.length > 1 || ownNames[0] !== \"constructor\") {\n return false;\n }\n if (type.prototype.__proto__ !== Object.prototype) {\n return false;\n }\n }\n const name = type.name || type.displayName;\n return typeof name === \"string\" && /^[A-Z]/.test(name);\n }\n case \"object\": {\n if (type != null) {\n switch (getProperty(type, \"$$typeof\")) {\n case REACT_FORWARD_REF_TYPE:\n case REACT_MEMO_TYPE:\n return true;\n default:\n return false;\n }\n }\n return false;\n }\n default: {\n return false;\n }\n }\n}\nfunction getRefreshReg(filename) {\n return (type, id) => register(type, filename + \" \" + id);\n}\nfunction registerExportsForReactRefresh(filename, moduleExports) {\n for (const key in moduleExports) {\n if (key === \"__esModule\") continue;\n const exportValue = moduleExports[key];\n if (isLikelyComponentType(exportValue)) {\n register(exportValue, filename + \" export \" + key);\n }\n }\n}\nfunction debounce(fn, delay) {\n let handle;\n return () => {\n clearTimeout(handle);\n handle = setTimeout(fn, delay);\n };\n}\nconst hooks = [];\nwindow.__registerBeforePerformReactRefresh = (cb) => {\n hooks.push(cb);\n};\nconst enqueueUpdate = debounce(async () => {\n if (hooks.length) await Promise.all(hooks.map((cb) => cb()));\n performReactRefresh();\n}, 16);\nfunction validateRefreshBoundaryAndEnqueueUpdate(id, prevExports, nextExports) {\n const ignoredExports = [\"sitemap\", \"loader\", \"generateStaticParams\"];\n if (predicateOnExport(ignoredExports, prevExports, (key) => key in nextExports) !== true) {\n return \"Could not Fast Refresh (export removed)\";\n }\n if (predicateOnExport(ignoredExports, nextExports, (key) => key in prevExports) !== true) {\n return \"Could not Fast Refresh (new export)\";\n }\n let hasExports = false;\n const allExportsAreComponentsOrUnchanged = predicateOnExport(\n ignoredExports,\n nextExports,\n (key, value) => {\n hasExports = true;\n if (isLikelyComponentType(value)) return true;\n return prevExports[key] === nextExports[key];\n }\n );\n if (hasExports && allExportsAreComponentsOrUnchanged === true) {\n enqueueUpdate();\n } else {\n return `Could not Fast Refresh (\"${allExportsAreComponentsOrUnchanged}\" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react-swc#consistent-components-exports`;\n }\n}\nfunction predicateOnExport(ignoredExports, moduleExports, predicate) {\n for (const key in moduleExports) {\n if (key === \"__esModule\") continue;\n if (ignoredExports.includes(key)) continue;\n const desc = Object.getOwnPropertyDescriptor(moduleExports, key);\n if (desc && desc.get) return key;\n if (!predicate(key, moduleExports[key])) return key;\n }\n return true;\n}\nconst __hmr_import = (module) => import(\n /* @vite-ignore */\n module\n);\nvar refresh_runtime_default = { injectIntoGlobalHook };\nexport {\n __hmr_import,\n createSignatureFunctionForTransform,\n refresh_runtime_default as default,\n getRefreshReg,\n injectIntoGlobalHook,\n registerExportsForReactRefresh,\n validateRefreshBoundaryAndEnqueueUpdate\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G,GAAG;EAClC,MAAM,OAAO,OAAO,yBAAyB,eAAe,GAAG;EAC/D,IAAI,QAAQ,KAAK,KAAK,OAAO;EAC7B,IAAI,CAAC,UAAU,KAAK,cAAc,IAAI,GAAG,OAAO;CAClD;CACA,OAAO;AACT;AACA,MAAM,gBAAgB,WAAW;;CAE/B;;AAEF,IAAI,0BAA0B,EAAE,qBAAqB"}
@@ -4,262 +4,280 @@ import { resolvePath } from "@vxrn/utils";
4
4
  import { normalizePath } from "vite";
5
5
  import { configuration } from "./configure.mjs";
6
6
  import { asyncGeneratorRegex, debug } from "./constants.mjs";
7
- const USER_BABEL_CONFIG_FILES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", ".babelrc", ".babelrc.js", ".babelrc.json"];
8
- const ONE_GENERATED_MARKER = "@one-generated";
7
+
8
+ const USER_BABEL_CONFIG_FILES = [
9
+ "babel.config.js",
10
+ "babel.config.cjs",
11
+ "babel.config.mjs",
12
+ "babel.config.json",
13
+ ".babelrc",
14
+ ".babelrc.js",
15
+ ".babelrc.json"
16
+ ];
17
+ const ONE_GENERATED_MARKER = "@one/generated bundler-config";
9
18
  function findUserBabelConfig(projectRoot) {
10
- if (!projectRoot) return null;
11
- for (const name of USER_BABEL_CONFIG_FILES) {
12
- const fullPath = join(projectRoot, name);
13
- if (existsSync(fullPath)) {
14
- try {
15
- const content = readFileSync(fullPath, "utf8");
16
- if (content.includes(ONE_GENERATED_MARKER)) {
17
- continue;
18
- }
19
- } catch {
20
- continue;
21
- }
22
- return fullPath;
23
- }
24
- }
25
- return null;
19
+ if (!projectRoot) return null;
20
+ for (const name of USER_BABEL_CONFIG_FILES) {
21
+ const fullPath = join(projectRoot, name);
22
+ if (existsSync(fullPath)) {
23
+ try {
24
+ const content = readFileSync(fullPath, "utf8");
25
+ if (content.includes(ONE_GENERATED_MARKER)) {
26
+ continue;
27
+ }
28
+ } catch {
29
+ continue;
30
+ }
31
+ return fullPath;
32
+ }
33
+ }
34
+ return null;
26
35
  }
27
36
  function getBabelOptions(props) {
28
- props = {
29
- ...props,
30
- id: normalizePath(props.id.split("?")[0])
31
- };
32
- const isProjectFile = !props.id.includes("node_modules");
33
- const userBabelConfig = isProjectFile && props.projectRoot ? findUserBabelConfig(props.projectRoot) : null;
34
- if (props.userSetting === "babel") {
35
- return getOptions(props, true, userBabelConfig);
36
- }
37
- if (typeof props.userSetting === "undefined" || typeof props.userSetting === "object" && props.userSetting.transform === "babel") {
38
- if (props.userSetting?.excludeDefaultPlugins) {
39
- return {
40
- ...props.userSetting,
41
- ...(userBabelConfig ? {
42
- configFile: userBabelConfig,
43
- babelrc: true
44
- } : {})
45
- };
46
- }
47
- return getOptions(props, false, userBabelConfig);
48
- }
49
- const userSetting = props.userSetting;
50
- if (userSetting === "swc" || userSetting === "oxc" || userSetting === false || typeof userSetting === "object" && userSetting !== null && (userSetting.transform === "swc" || userSetting.transform === "oxc")) {
51
- return null;
52
- }
53
- if (userBabelConfig) {
54
- return getOptions(props, false, userBabelConfig);
55
- }
56
- return null;
37
+ props = {
38
+ ...props,
39
+ id: normalizePath(props.id.split("?")[0])
40
+ };
41
+ const isProjectFile = !props.id.includes("node_modules");
42
+ const userBabelConfig = isProjectFile && props.projectRoot ? findUserBabelConfig(props.projectRoot) : null;
43
+ if (props.userSetting === "babel") {
44
+ return getOptions(props, true, userBabelConfig);
45
+ }
46
+ if (typeof props.userSetting === "undefined" || typeof props.userSetting === "object" && props.userSetting.transform === "babel") {
47
+ if (props.userSetting?.excludeDefaultPlugins) {
48
+ return {
49
+ ...props.userSetting,
50
+ ...userBabelConfig ? {
51
+ configFile: userBabelConfig,
52
+ babelrc: true
53
+ } : {}
54
+ };
55
+ }
56
+ return getOptions(props, false, userBabelConfig);
57
+ }
58
+ const userSetting = props.userSetting;
59
+ if (userSetting === "swc" || userSetting === "oxc" || userSetting === false || typeof userSetting === "object" && userSetting !== null && (userSetting.transform === "swc" || userSetting.transform === "oxc")) {
60
+ return null;
61
+ }
62
+ if (userBabelConfig) {
63
+ return getOptions(props, false, userBabelConfig);
64
+ }
65
+ return null;
57
66
  }
58
67
  const getOptions = (props, force = false, userBabelConfig = null) => {
59
- let plugins = [];
60
- if (force || shouldBabelGenerators(props)) {
61
- plugins = getBasePlugins(props);
62
- }
63
- const enableNativewind = configuration.enableNativewind && (props.environment === "ios" || props.environment === "android") &&
64
- // if reanimated gets wrapped in transform it causes circular dep issues
65
- !/node_modules/.test(props.id) &&
66
- // only needed for createElement calls, so be a bit conservative
67
- props.code.includes("createElement");
68
- if (enableNativewind) {
69
- if (!props.id.includes("node_modules")) {
70
- plugins.push(resolvePath("react-native-css-interop/dist/babel-plugin.js"));
71
- }
72
- }
73
- if (enableNativewind || shouldBabelReanimated(props)) {
74
- try {
75
- const workletsPlugin = resolvePath("react-native-worklets/plugin", props.projectRoot);
76
- debug?.(`Using babel worklets on file ${props.id}`);
77
- plugins.push(workletsPlugin);
78
- } catch {}
79
- }
80
- if (shouldBabelReactCompiler(props)) {
81
- debug?.(`Using babel react compiler on file`);
82
- plugins.push(getBabelReactCompilerPlugin(props));
83
- }
84
- if (plugins.length || userBabelConfig) {
85
- return {
86
- plugins,
87
- ...(userBabelConfig ? {
88
- configFile: userBabelConfig,
89
- babelrc: true
90
- } : {})
91
- };
92
- }
93
- return null;
68
+ let plugins = [];
69
+ if (force || shouldBabelGenerators(props)) {
70
+ plugins = getBasePlugins(props);
71
+ }
72
+ const enableNativewind = configuration.enableNativewind && (props.environment === "ios" || props.environment === "android") && !/node_modules/.test(props.id) && props.code.includes("createElement");
73
+ if (enableNativewind) {
74
+ if (!props.id.includes("node_modules")) {
75
+ plugins.push(resolvePath("react-native-css-interop/dist/babel-plugin.js"));
76
+ }
77
+ }
78
+ if (enableNativewind || shouldBabelReanimated(props)) {
79
+ try {
80
+ const workletsPlugin = resolvePath("react-native-worklets/plugin", props.projectRoot);
81
+ debug?.(`Using babel worklets on file ${props.id}`);
82
+ plugins.push(workletsPlugin);
83
+ } catch {}
84
+ }
85
+ if (shouldBabelReactCompiler(props)) {
86
+ debug?.(`Using babel react compiler on file`);
87
+ plugins.push(getBabelReactCompilerPlugin(props));
88
+ }
89
+ if (plugins.length || userBabelConfig) {
90
+ return {
91
+ plugins,
92
+ ...userBabelConfig ? {
93
+ configFile: userBabelConfig,
94
+ babelrc: true
95
+ } : {}
96
+ };
97
+ }
98
+ return null;
94
99
  };
95
100
  async function transformOxcReactCompiler(id, code, optionsOrTarget = "19", sourceMap = false) {
96
- const {
97
- transform
98
- } = await import("oxc-transform-react");
99
- const compilerOptions = typeof optionsOrTarget === "string" ? {
100
- target: optionsOrTarget
101
- } : optionsOrTarget || {};
102
- const target = compilerOptions.target ?? "19";
103
- const result = await transform(id, code, {
104
- jsx: "preserve",
105
- sourcemap: sourceMap,
106
- reactCompiler: {
107
- target,
108
- ...compilerOptions,
109
- environment: {
110
- enableCustomTypeDefinitionForReanimated: true,
111
- ...compilerOptions.environment
112
- }
113
- }
114
- });
115
- if (result.fatal) {
116
- throw new Error(`[vxrn:compiler] oxc react compiler failed on ${id}: ${(result.errors ?? []).map(e => e.message ?? String(e)).join(", ")}`);
117
- }
118
- if (result.errors?.length) {
119
- debug?.(`[compiler/bailout] ${id}: ${result.errors.map(e => e.message ?? String(e)).join(", ")}`);
120
- }
121
- return {
122
- code: result.code,
123
- map: sourceMap ? result.map : void 0
124
- };
101
+ const { transform } = await import("oxc-transform-react");
102
+ const compilerOptions = typeof optionsOrTarget === "string" ? { target: optionsOrTarget } : optionsOrTarget || {};
103
+ const target = compilerOptions.target ?? "19";
104
+ const result = await transform(id, code, {
105
+ jsx: "preserve",
106
+ sourcemap: sourceMap,
107
+ reactCompiler: {
108
+ target,
109
+ ...compilerOptions,
110
+ environment: {
111
+ enableCustomTypeDefinitionForReanimated: true,
112
+ ...compilerOptions.environment
113
+ }
114
+ }
115
+ });
116
+ if (result.fatal) {
117
+ throw new Error(`[vxrn:compiler] oxc react compiler failed on ${id}: ${(result.errors ?? []).map((e) => e.message ?? String(e)).join(", ")}`);
118
+ }
119
+ if (result.errors?.length) {
120
+ debug?.(`[compiler/bailout] ${id}: ${result.errors.map((e) => e.message ?? String(e)).join(", ")}`);
121
+ }
122
+ return {
123
+ code: result.code,
124
+ map: sourceMap ? result.map : void 0
125
+ };
125
126
  }
126
127
  async function transformBabel(id, code, options) {
127
- const [{
128
- default: babelCore
129
- }, {
130
- default: hermesParserPlugin
131
- }] = await Promise.all([import("@babel/core"), import("babel-plugin-syntax-hermes-parser")]);
132
- const extension = extname(id);
133
- const isTSX = extension === ".tsx";
134
- const isTS = isTSX || extension === ".ts";
135
- const babelOptions = {
136
- filename: id,
137
- compact: false,
138
- babelrc: options.babelrc ?? false,
139
- configFile: options.configFile ?? false,
140
- sourceMaps: false,
141
- minified: false,
142
- ...options,
143
- presets: [isTS ? ["@babel/preset-typescript", {
144
- isTSX,
145
- allExtensions: isTSX
146
- }] : "", ...(options.presets || [])].filter(Boolean),
147
- // non-TS files use React Native's Flow dialect. RN's own component specs are
148
- // Flow `.js` (`import type`, `codegenNativeComponent<T>(…)`, `(expr: Type)` casts).
149
- // enable Hermes Flow parsing + stripping, mirroring the TypeScript preset above
150
- // (`@react-native/babel-preset` uses the same parser for JS). without it babel
151
- // can't parse current RN Flow syntax such as `call<T>(...) as HostComponent<T>`, so
152
- // plugins like
153
- // @react-native/babel-plugin-codegen silently fail on RN specs and the runtime
154
- // "Codegen didn't run" warning fires. TS path is byte-identical (empty slice).
155
- plugins: [...(isTS ? [] : [[hermesParserPlugin, {
156
- parseLangTypes: "flow",
157
- reactRuntimeTarget: "19"
158
- }]]), ...(options.plugins || []), ...(isTS ? [] : ["@babel/plugin-transform-flow-strip-types"])]
159
- };
160
- return await new Promise((res, rej) => {
161
- babelCore.transform(code, babelOptions, (err, result) => {
162
- if (!result || err) {
163
- return rej(err || new Error(`[vxrn:compiler] babel returned no result for ${id}`));
164
- }
165
- res(result);
166
- });
167
- });
128
+ const [{ default: babelCore }, { default: hermesParserPlugin }] = await Promise.all([import("@babel/core"), import("babel-plugin-syntax-hermes-parser")]);
129
+ const extension = extname(id);
130
+ const isTSX = extension === ".tsx";
131
+ const isTS = isTSX || extension === ".ts";
132
+ const babelOptions = {
133
+ filename: id,
134
+ compact: false,
135
+ babelrc: options.babelrc ?? false,
136
+ configFile: options.configFile ?? false,
137
+ sourceMaps: false,
138
+ minified: false,
139
+ ...options,
140
+ caller: {
141
+ name: "vxrn",
142
+ supportsStaticESM: true,
143
+ supportsDynamicImport: true
144
+ },
145
+ presets: [isTS ? ["@babel/preset-typescript", {
146
+ isTSX,
147
+ allExtensions: isTSX
148
+ }] : "", ...options.presets || []].filter(Boolean),
149
+ plugins: [
150
+ ...isTS ? [] : [[hermesParserPlugin, {
151
+ parseLangTypes: "flow",
152
+ reactRuntimeTarget: "19"
153
+ }], "babel-plugin-transform-flow-enums"],
154
+ ...options.plugins || [],
155
+ ...isTS ? [] : ["@babel/plugin-transform-flow-strip-types"]
156
+ ]
157
+ };
158
+ return await new Promise((res, rej) => {
159
+ babelCore.transform(code, babelOptions, (err, result) => {
160
+ if (!result || err) {
161
+ return rej(err || new Error(`[vxrn:compiler] babel returned no result for ${id}`));
162
+ }
163
+ res(result);
164
+ });
165
+ });
168
166
  }
169
- const getBasePlugins = ({
170
- development
171
- }) => [["@babel/plugin-transform-destructuring"], ["@babel/plugin-transform-react-jsx", {
172
- development
173
- }], ["@babel/plugin-transform-async-generator-functions"], ["@babel/plugin-transform-async-to-generator"], ["@babel/plugin-transform-runtime", {
174
- helpers: true,
175
- // NOTE THIS WAS SPELLED WRONG BEFOER THIS COMMIT MAYBE IT WAS UNINTENTIONALLY WORKING
176
- regenerator: false
177
- }]];
178
- const shouldBabelReactCompiler = props => {
179
- if (props.environment === "ssr") {
180
- return false;
181
- }
182
- if (!configuration.enableCompiler) {
183
- return false;
184
- }
185
- const {
186
- enableCompiler
187
- } = configuration;
188
- if (typeof enableCompiler === "object" && !Array.isArray(enableCompiler) && !(enableCompiler instanceof RegExp)) {
189
- const isNative = props.environment === "ios" || props.environment === "android";
190
- const filter = isNative ? enableCompiler.native : enableCompiler.web;
191
- if (!filter) return false;
192
- return applyCompilerFilter(filter, props);
193
- }
194
- if (typeof enableCompiler === "function") {
195
- return enableCompiler(props.id, props.environment);
196
- }
197
- if (enableCompiler instanceof RegExp) {
198
- return enableCompiler.test(props.id);
199
- }
200
- if (Array.isArray(enableCompiler)) {
201
- if (!enableCompiler.includes(props.environment)) {
202
- return false;
203
- }
204
- }
205
- return applyDefaultFilters(props);
167
+ async function stripFlowTypes(id, code, sourceMaps = true) {
168
+ const result = await transformBabel(id, code, { sourceMaps });
169
+ return {
170
+ code: result.code,
171
+ map: result.map
172
+ };
173
+ }
174
+ const getBasePlugins = ({ development }) => [
175
+ ["@babel/plugin-transform-destructuring"],
176
+ ["@babel/plugin-transform-react-jsx", { development }],
177
+ ["@babel/plugin-transform-async-generator-functions"],
178
+ ["@babel/plugin-transform-async-to-generator"],
179
+ ["@babel/plugin-transform-runtime", {
180
+ helpers: true,
181
+ regenerator: false
182
+ }]
183
+ ];
184
+ const shouldBabelReactCompiler = (props) => {
185
+ if (props.environment === "ssr") {
186
+ return false;
187
+ }
188
+ if (!configuration.enableCompiler) {
189
+ return false;
190
+ }
191
+ const { enableCompiler } = configuration;
192
+ if (typeof enableCompiler === "object" && !Array.isArray(enableCompiler) && !(enableCompiler instanceof RegExp)) {
193
+ const isNative = props.environment === "ios" || props.environment === "android";
194
+ const filter = isNative ? enableCompiler.native : enableCompiler.web;
195
+ if (!filter) return false;
196
+ return applyCompilerFilter(filter, props);
197
+ }
198
+ if (typeof enableCompiler === "function") {
199
+ return enableCompiler(props.id, props.environment);
200
+ }
201
+ if (enableCompiler instanceof RegExp) {
202
+ return enableCompiler.test(props.id);
203
+ }
204
+ if (Array.isArray(enableCompiler)) {
205
+ if (!enableCompiler.includes(props.environment)) {
206
+ return false;
207
+ }
208
+ }
209
+ return applyDefaultFilters(props);
206
210
  };
207
211
  function applyCompilerFilter(filter, props) {
208
- if (typeof filter === "function") {
209
- return filter(props.id, props.environment);
210
- }
211
- if (filter instanceof RegExp) {
212
- return filter.test(props.id);
213
- }
214
- if (filter === true) {
215
- return applyDefaultFilters(props);
216
- }
217
- return false;
212
+ if (typeof filter === "function") {
213
+ return filter(props.id, props.environment);
214
+ }
215
+ if (filter instanceof RegExp) {
216
+ return filter.test(props.id);
217
+ }
218
+ if (filter === true) {
219
+ return applyDefaultFilters(props);
220
+ }
221
+ return false;
218
222
  }
219
223
  function applyDefaultFilters(props) {
220
- if (!/(\.tsx?)$/.test(props.id)) return false;
221
- if (props.id.includes("node_modules")) return false;
222
- if (props.id.includes("+api.")) return false;
223
- if (props.code.startsWith("// disable-compiler")) return false;
224
- return true;
224
+ if (!/(\.tsx?)$/.test(props.id)) return false;
225
+ if (props.id.includes("node_modules")) return false;
226
+ if (props.id.includes("+api.")) return false;
227
+ if (props.code.startsWith("// disable-compiler")) return false;
228
+ return true;
225
229
  }
226
- const getBabelReactCompilerPlugin = props => {
227
- const target = props.reactForRNVersion === "18" && (props.environment === "ios" || props.environment === "android") ? "18" : "19";
228
- return ["babel-plugin-react-compiler", {
229
- target
230
- }];
230
+ const getBabelReactCompilerPlugin = (props) => {
231
+ const target = props.reactForRNVersion === "18" && (props.environment === "ios" || props.environment === "android") ? "18" : "19";
232
+ return ["babel-plugin-react-compiler", { target }];
231
233
  };
232
- function shouldBabelGenerators({
233
- code
234
- }) {
235
- if (process.env.VXRN_USE_BABEL_FOR_GENERATORS) {
236
- return asyncGeneratorRegex.test(code);
237
- }
234
+ function shouldBabelGenerators({ code }) {
235
+ if (process.env.VXRN_USE_BABEL_FOR_GENERATORS) {
236
+ return asyncGeneratorRegex.test(code);
237
+ }
238
238
  }
239
- const REANIMATED_AUTOWORKLETIZATION_KEYWORDS = ["worklet", "useAnimatedGestureHandler", "useAnimatedScrollHandler", "useFrameCallback", "useAnimatedStyle", "useAnimatedProps", "createAnimatedPropAdapter", "useDerivedValue", "useAnimatedReaction", "useWorkletCallback", "withTiming", "withSpring", "withDecay", "withRepeat", "runOnUI", "executeOnUIRuntimeSync"];
239
+ const REANIMATED_AUTOWORKLETIZATION_KEYWORDS = [
240
+ "worklet",
241
+ "useAnimatedGestureHandler",
242
+ "useAnimatedScrollHandler",
243
+ "useFrameCallback",
244
+ "useAnimatedStyle",
245
+ "useAnimatedProps",
246
+ "createAnimatedPropAdapter",
247
+ "useDerivedValue",
248
+ "useAnimatedReaction",
249
+ "useWorkletCallback",
250
+ "withTiming",
251
+ "withSpring",
252
+ "withDecay",
253
+ "withRepeat",
254
+ "runOnUI",
255
+ "executeOnUIRuntimeSync"
256
+ ];
240
257
  const REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join("|"));
241
258
  const REANIMATED_IGNORED_PATHS = [
242
- // Prebuilt/vendored react-native that shouldn't be transformed
243
- "react-native-prebuilt", "node_modules/.vxrn/react-native",
244
- // Known false positives - they mention worklet keywords in comments/strings but don't use them
245
- "node_modules/react/", "node_modules/react-dom/", "node_modules/react-native/", "node_modules/react-native-web/"];
259
+ "react-native-prebuilt",
260
+ "node_modules/.vxrn/react-native",
261
+ "node_modules/react/",
262
+ "node_modules/react-dom/",
263
+ "node_modules/react-native/",
264
+ "node_modules/react-native-web/"
265
+ ];
246
266
  const REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join("|"));
247
- function shouldBabelReanimated({
248
- code,
249
- id
250
- }) {
251
- if (!configuration.enableReanimated) {
252
- return false;
253
- }
254
- if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {
255
- return false;
256
- }
257
- if (REANIMATED_REGEX.test(code)) {
258
- const location = id.includes("node_modules") ? "node_modules" : "user-code";
259
- debug?.(` \u{1FA84} [reanimated/${location}] ${relative(process.cwd(), id)}`);
260
- return true;
261
- }
262
- return false;
267
+ function shouldBabelReanimated({ code, id }) {
268
+ if (!configuration.enableReanimated) {
269
+ return false;
270
+ }
271
+ if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {
272
+ return false;
273
+ }
274
+ if (REANIMATED_REGEX.test(code)) {
275
+ const location = id.includes("node_modules") ? "node_modules" : "user-code";
276
+ debug?.(` \u{1FA84} [reanimated/${location}] ${relative(process.cwd(), id)}`);
277
+ return true;
278
+ }
279
+ return false;
263
280
  }
264
- export { findUserBabelConfig, getBabelOptions, transformBabel, transformOxcReactCompiler };
281
+
282
+ export { findUserBabelConfig, getBabelOptions, stripFlowTypes, transformBabel, transformOxcReactCompiler };
265
283
  //# sourceMappingURL=transformBabel.mjs.map