@tamagui/static 2.7.7 → 3.0.0-beta.643.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 (329) hide show
  1. package/dist/cjs/check-dep-versions.cjs +355 -0
  2. package/dist/cjs/checkDeps.cjs +302 -0
  3. package/dist/cjs/compiler.cjs +286 -0
  4. package/dist/cjs/compilerHost.cjs +1695 -0
  5. package/dist/cjs/constants.cjs +33 -0
  6. package/dist/cjs/domStructuralPass.cjs +112 -0
  7. package/dist/cjs/exports.cjs +42 -0
  8. package/dist/cjs/extractor/addLocalExports.cjs +64 -0
  9. package/dist/cjs/extractor/bundle.cjs +203 -0
  10. package/dist/cjs/extractor/bundleConfig.cjs +747 -0
  11. package/dist/cjs/extractor/concatClassName.cjs +117 -0
  12. package/dist/cjs/extractor/detectModuleFormat.cjs +54 -0
  13. package/dist/cjs/extractor/esbuildAliasPlugin.cjs +47 -0
  14. package/dist/cjs/extractor/esbuildTsconfigPaths.cjs +92 -0
  15. package/dist/cjs/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +38 -0
  16. package/dist/cjs/extractor/loadTamagui.cjs +344 -0
  17. package/dist/cjs/extractor/regenerateConfig.cjs +161 -0
  18. package/dist/cjs/extractor/watchTamaguiConfig.cjs +64 -0
  19. package/dist/cjs/getPragmaOptions.cjs +67 -0
  20. package/dist/cjs/helpers/memoize.cjs +42 -0
  21. package/dist/cjs/helpers/requireTamaguiCore.cjs +40 -0
  22. package/dist/cjs/index.cjs +34 -0
  23. package/dist/cjs/registerRequire.cjs +220 -0
  24. package/dist/cjs/server.cjs +66 -0
  25. package/dist/cjs/staticEvaluationIgnoredModules.cjs +86 -0
  26. package/dist/cjs/types.cjs +17 -0
  27. package/dist/cjs/zero/artifact.cjs +145 -0
  28. package/dist/cjs/zero/graph.cjs +209 -0
  29. package/dist/cjs/zero/identity.cjs +61 -0
  30. package/dist/cjs/zero/index.cjs +26 -0
  31. package/dist/cjs/zero/islands.cjs +232 -0
  32. package/dist/cjs/zero/options.cjs +163 -0
  33. package/dist/cjs/zero/ownership.cjs +79 -0
  34. package/dist/cjs/zero/theme.cjs +328 -0
  35. package/dist/cjs/zero/transform.cjs +203 -0
  36. package/dist/esm/check-dep-versions.mjs +329 -0
  37. package/dist/esm/check-dep-versions.mjs.map +1 -0
  38. package/dist/esm/checkDeps.mjs +279 -0
  39. package/dist/esm/checkDeps.mjs.map +1 -0
  40. package/dist/esm/compiler.mjs +255 -0
  41. package/dist/esm/compiler.mjs.map +1 -0
  42. package/dist/esm/compilerHost.mjs +1675 -0
  43. package/dist/esm/compilerHost.mjs.map +1 -0
  44. package/dist/esm/constants.mjs +7 -0
  45. package/dist/esm/constants.mjs.map +1 -0
  46. package/dist/esm/domStructuralPass.mjs +92 -0
  47. package/dist/esm/domStructuralPass.mjs.map +1 -0
  48. package/dist/esm/exports.mjs +26 -0
  49. package/dist/esm/extractor/addLocalExports.mjs +44 -0
  50. package/dist/esm/extractor/addLocalExports.mjs.map +1 -0
  51. package/dist/esm/extractor/bundle.mjs +173 -0
  52. package/dist/esm/extractor/bundle.mjs.map +1 -0
  53. package/dist/esm/extractor/bundleConfig.mjs +706 -0
  54. package/dist/esm/extractor/bundleConfig.mjs.map +1 -0
  55. package/dist/esm/extractor/concatClassName.mjs +96 -0
  56. package/dist/esm/extractor/concatClassName.mjs.map +1 -0
  57. package/dist/esm/extractor/detectModuleFormat.mjs +31 -0
  58. package/dist/esm/extractor/detectModuleFormat.mjs.map +1 -0
  59. package/dist/esm/extractor/esbuildAliasPlugin.mjs +26 -0
  60. package/dist/esm/extractor/esbuildAliasPlugin.mjs.map +1 -0
  61. package/dist/esm/extractor/esbuildTsconfigPaths.mjs +63 -0
  62. package/dist/esm/extractor/esbuildTsconfigPaths.mjs.map +1 -0
  63. package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs +18 -0
  64. package/dist/esm/extractor/getTamaguiConfigPathFromOptionsConfig.mjs.map +1 -0
  65. package/dist/esm/extractor/loadTamagui.mjs +306 -0
  66. package/dist/esm/extractor/loadTamagui.mjs.map +1 -0
  67. package/dist/esm/extractor/regenerateConfig.mjs +131 -0
  68. package/dist/esm/extractor/regenerateConfig.mjs.map +1 -0
  69. package/dist/esm/extractor/watchTamaguiConfig.mjs +43 -0
  70. package/dist/esm/extractor/watchTamaguiConfig.mjs.map +1 -0
  71. package/dist/esm/getPragmaOptions.mjs +46 -0
  72. package/dist/esm/getPragmaOptions.mjs.map +1 -0
  73. package/dist/esm/helpers/memoize.mjs +21 -0
  74. package/dist/esm/helpers/memoize.mjs.map +1 -0
  75. package/dist/esm/helpers/requireTamaguiCore.mjs +19 -0
  76. package/dist/esm/helpers/requireTamaguiCore.mjs.map +1 -0
  77. package/dist/esm/index.mjs +8 -0
  78. package/dist/esm/index.mjs.map +1 -0
  79. package/dist/esm/registerRequire.mjs +195 -0
  80. package/dist/esm/registerRequire.mjs.map +1 -0
  81. package/dist/esm/server.mjs +40 -0
  82. package/dist/esm/server.mjs.map +1 -0
  83. package/dist/esm/setup.mjs +0 -0
  84. package/dist/esm/staticEvaluationIgnoredModules.mjs +61 -0
  85. package/dist/esm/staticEvaluationIgnoredModules.mjs.map +1 -0
  86. package/dist/esm/types.mjs +0 -0
  87. package/dist/esm/zero/artifact.mjs +119 -0
  88. package/dist/esm/zero/artifact.mjs.map +1 -0
  89. package/dist/esm/zero/graph.mjs +170 -0
  90. package/dist/esm/zero/graph.mjs.map +1 -0
  91. package/dist/esm/zero/identity.mjs +36 -0
  92. package/dist/esm/zero/identity.mjs.map +1 -0
  93. package/dist/esm/zero/index.mjs +15 -0
  94. package/dist/esm/zero/islands.mjs +197 -0
  95. package/dist/esm/zero/islands.mjs.map +1 -0
  96. package/dist/esm/zero/options.mjs +129 -0
  97. package/dist/esm/zero/options.mjs.map +1 -0
  98. package/dist/esm/zero/ownership.mjs +48 -0
  99. package/dist/esm/zero/ownership.mjs.map +1 -0
  100. package/dist/esm/zero/theme.mjs +303 -0
  101. package/dist/esm/zero/theme.mjs.map +1 -0
  102. package/dist/esm/zero/transform.mjs +177 -0
  103. package/dist/esm/zero/transform.mjs.map +1 -0
  104. package/package.json +33 -43
  105. package/src/check-dep-versions.ts +2 -2
  106. package/src/checkDeps.ts +3 -2
  107. package/src/compiler.ts +425 -0
  108. package/src/compilerHost.ts +3125 -0
  109. package/src/constants.ts +0 -5
  110. package/src/domStructuralPass.ts +170 -0
  111. package/src/exports.ts +3 -6
  112. package/src/extractor/addLocalExports.ts +49 -0
  113. package/src/extractor/bundle.ts +20 -35
  114. package/src/extractor/bundleConfig.ts +334 -187
  115. package/src/extractor/concatClassName.ts +13 -20
  116. package/src/extractor/getTamaguiConfigPathFromOptionsConfig.ts +5 -4
  117. package/src/extractor/loadTamagui.ts +196 -143
  118. package/src/extractor/regenerateConfig.ts +65 -13
  119. package/src/extractor/watchTamaguiConfig.ts +6 -1
  120. package/src/helpers/requireTamaguiCore.ts +6 -1
  121. package/src/registerRequire.ts +94 -132
  122. package/src/staticEvaluationIgnoredModules.ts +74 -0
  123. package/src/types.ts +2 -107
  124. package/src/zero/artifact.ts +142 -0
  125. package/src/zero/graph.ts +359 -0
  126. package/src/zero/identity.ts +73 -0
  127. package/src/zero/index.ts +8 -0
  128. package/src/zero/islands.ts +262 -0
  129. package/src/zero/options.ts +239 -0
  130. package/src/zero/ownership.ts +113 -0
  131. package/src/zero/theme.ts +478 -0
  132. package/src/zero/transform.ts +320 -0
  133. package/types/check-dep-versions.d.ts.map +1 -1
  134. package/types/checkDeps.d.ts.map +1 -1
  135. package/types/compiler.d.ts +117 -0
  136. package/types/compiler.d.ts.map +1 -0
  137. package/types/compilerHost.d.ts +25 -0
  138. package/types/compilerHost.d.ts.map +1 -0
  139. package/types/constants.d.ts +0 -1
  140. package/types/constants.d.ts.map +1 -1
  141. package/types/domStructuralPass.d.ts +3 -0
  142. package/types/domStructuralPass.d.ts.map +1 -0
  143. package/types/exports.d.ts +3 -6
  144. package/types/exports.d.ts.map +1 -1
  145. package/types/extractor/addLocalExports.d.ts +3 -0
  146. package/types/extractor/addLocalExports.d.ts.map +1 -0
  147. package/types/extractor/bundle.d.ts +66 -65
  148. package/types/extractor/bundle.d.ts.map +1 -1
  149. package/types/extractor/bundleConfig.d.ts +19 -4
  150. package/types/extractor/bundleConfig.d.ts.map +1 -1
  151. package/types/extractor/esbuildAliasPlugin.d.ts.map +1 -1
  152. package/types/extractor/getTamaguiConfigPathFromOptionsConfig.d.ts +1 -1
  153. package/types/extractor/getTamaguiConfigPathFromOptionsConfig.d.ts.map +1 -1
  154. package/types/extractor/loadTamagui.d.ts +26 -3
  155. package/types/extractor/loadTamagui.d.ts.map +1 -1
  156. package/types/extractor/regenerateConfig.d.ts +1 -1
  157. package/types/extractor/regenerateConfig.d.ts.map +1 -1
  158. package/types/extractor/watchTamaguiConfig.d.ts.map +1 -1
  159. package/types/getPragmaOptions.d.ts +1 -1
  160. package/types/helpers/memoize.d.ts +1 -1
  161. package/types/helpers/memoize.d.ts.map +1 -1
  162. package/types/helpers/requireTamaguiCore.d.ts.map +1 -1
  163. package/types/index.d.ts.map +1 -1
  164. package/types/registerRequire.d.ts +2 -2
  165. package/types/registerRequire.d.ts.map +1 -1
  166. package/types/staticEvaluationIgnoredModules.d.ts +9 -0
  167. package/types/staticEvaluationIgnoredModules.d.ts.map +1 -0
  168. package/types/types.d.ts +2 -90
  169. package/types/types.d.ts.map +1 -1
  170. package/types/zero/artifact.d.ts +44 -0
  171. package/types/zero/artifact.d.ts.map +1 -0
  172. package/types/zero/graph.d.ts +139 -0
  173. package/types/zero/graph.d.ts.map +1 -0
  174. package/types/zero/identity.d.ts +33 -0
  175. package/types/zero/identity.d.ts.map +1 -0
  176. package/types/zero/index.d.ts +9 -0
  177. package/types/zero/index.d.ts.map +1 -0
  178. package/types/zero/islands.d.ts +56 -0
  179. package/types/zero/islands.d.ts.map +1 -0
  180. package/types/zero/options.d.ts +58 -0
  181. package/types/zero/options.d.ts.map +1 -0
  182. package/types/zero/ownership.d.ts +51 -0
  183. package/types/zero/ownership.d.ts.map +1 -0
  184. package/types/zero/theme.d.ts +83 -0
  185. package/types/zero/theme.d.ts.map +1 -0
  186. package/types/zero/transform.d.ts +53 -0
  187. package/types/zero/transform.d.ts.map +1 -0
  188. package/dist/check-dep-versions.cjs +0 -372
  189. package/dist/checkDeps.cjs +0 -271
  190. package/dist/constants.cjs +0 -51
  191. package/dist/exports.cjs +0 -48
  192. package/dist/extractor/accessSafe.cjs +0 -48
  193. package/dist/extractor/babelParse.cjs +0 -56
  194. package/dist/extractor/buildClassName.cjs +0 -86
  195. package/dist/extractor/bundle.cjs +0 -234
  196. package/dist/extractor/bundleConfig.cjs +0 -729
  197. package/dist/extractor/concatClassName.cjs +0 -129
  198. package/dist/extractor/createEvaluator.cjs +0 -88
  199. package/dist/extractor/createExtractor.cjs +0 -1968
  200. package/dist/extractor/createLogger.cjs +0 -50
  201. package/dist/extractor/detectModuleFormat.cjs +0 -55
  202. package/dist/extractor/ensureImportingConcat.cjs +0 -54
  203. package/dist/extractor/errors.cjs +0 -28
  204. package/dist/extractor/esbuildAliasPlugin.cjs +0 -56
  205. package/dist/extractor/esbuildTsconfigPaths.cjs +0 -108
  206. package/dist/extractor/evaluateAstNode.cjs +0 -128
  207. package/dist/extractor/extractHelpers.cjs +0 -182
  208. package/dist/extractor/extractMediaStyle.cjs +0 -169
  209. package/dist/extractor/extractToClassNames.cjs +0 -475
  210. package/dist/extractor/extractToNative.cjs +0 -369
  211. package/dist/extractor/findTopmostFunction.cjs +0 -43
  212. package/dist/extractor/generatedUid.cjs +0 -58
  213. package/dist/extractor/getPrefixLogs.cjs +0 -31
  214. package/dist/extractor/getPropValueFromAttributes.cjs +0 -85
  215. package/dist/extractor/getSourceModule.cjs +0 -100
  216. package/dist/extractor/getStaticBindingsForScope.cjs +0 -213
  217. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +0 -41
  218. package/dist/extractor/hasTopLevelAwait.cjs +0 -62
  219. package/dist/extractor/hoistClassNames.cjs +0 -76
  220. package/dist/extractor/literalToAst.cjs +0 -109
  221. package/dist/extractor/loadFile.cjs +0 -17
  222. package/dist/extractor/loadTamagui.cjs +0 -373
  223. package/dist/extractor/logLines.cjs +0 -43
  224. package/dist/extractor/normalizeTernaries.cjs +0 -100
  225. package/dist/extractor/propsToFontFamilyCache.cjs +0 -42
  226. package/dist/extractor/regenerateConfig.cjs +0 -178
  227. package/dist/extractor/removeUnusedHooks.cjs +0 -108
  228. package/dist/extractor/timer.cjs +0 -52
  229. package/dist/extractor/validHTMLAttributes.cjs +0 -79
  230. package/dist/extractor/watchTamaguiConfig.cjs +0 -70
  231. package/dist/getPragmaOptions.cjs +0 -73
  232. package/dist/helpers/memoize.cjs +0 -45
  233. package/dist/helpers/requireTamaguiCore.cjs +0 -40
  234. package/dist/index.cjs +0 -42
  235. package/dist/registerRequire.cjs +0 -209
  236. package/dist/server.cjs +0 -82
  237. package/dist/types.cjs +0 -18
  238. package/dist/worker.cjs +0 -111
  239. package/src/extractor/accessSafe.ts +0 -22
  240. package/src/extractor/babelParse.ts +0 -38
  241. package/src/extractor/buildClassName.ts +0 -76
  242. package/src/extractor/createEvaluator.ts +0 -82
  243. package/src/extractor/createExtractor.ts +0 -2970
  244. package/src/extractor/createLogger.ts +0 -41
  245. package/src/extractor/ensureImportingConcat.ts +0 -36
  246. package/src/extractor/errors.ts +0 -1
  247. package/src/extractor/evaluateAstNode.ts +0 -136
  248. package/src/extractor/extractHelpers.ts +0 -211
  249. package/src/extractor/extractMediaStyle.ts +0 -194
  250. package/src/extractor/extractToClassNames.ts +0 -733
  251. package/src/extractor/extractToNative.ts +0 -506
  252. package/src/extractor/findTopmostFunction.ts +0 -24
  253. package/src/extractor/generatedUid.ts +0 -41
  254. package/src/extractor/getPrefixLogs.ts +0 -9
  255. package/src/extractor/getPropValueFromAttributes.ts +0 -95
  256. package/src/extractor/getSourceModule.ts +0 -96
  257. package/src/extractor/getStaticBindingsForScope.ts +0 -237
  258. package/src/extractor/hasTopLevelAwait.ts +0 -28
  259. package/src/extractor/hoistClassNames.ts +0 -52
  260. package/src/extractor/literalToAst.ts +0 -85
  261. package/src/extractor/loadFile.ts +0 -17
  262. package/src/extractor/logLines.ts +0 -16
  263. package/src/extractor/normalizeTernaries.ts +0 -89
  264. package/src/extractor/propsToFontFamilyCache.ts +0 -18
  265. package/src/extractor/removeUnusedHooks.ts +0 -83
  266. package/src/extractor/timer.ts +0 -25
  267. package/src/extractor/validHTMLAttributes.ts +0 -52
  268. package/src/worker.ts +0 -142
  269. package/types/extractor/accessSafe.d.ts +0 -3
  270. package/types/extractor/accessSafe.d.ts.map +0 -1
  271. package/types/extractor/babelParse.d.ts +0 -5
  272. package/types/extractor/babelParse.d.ts.map +0 -1
  273. package/types/extractor/buildClassName.d.ts +0 -7
  274. package/types/extractor/buildClassName.d.ts.map +0 -1
  275. package/types/extractor/createEvaluator.d.ts +0 -12
  276. package/types/extractor/createEvaluator.d.ts.map +0 -1
  277. package/types/extractor/createExtractor.d.ts +0 -32
  278. package/types/extractor/createExtractor.d.ts.map +0 -1
  279. package/types/extractor/createLogger.d.ts +0 -3
  280. package/types/extractor/createLogger.d.ts.map +0 -1
  281. package/types/extractor/ensureImportingConcat.d.ts +0 -4
  282. package/types/extractor/ensureImportingConcat.d.ts.map +0 -1
  283. package/types/extractor/errors.d.ts +0 -3
  284. package/types/extractor/errors.d.ts.map +0 -1
  285. package/types/extractor/evaluateAstNode.d.ts +0 -3
  286. package/types/extractor/evaluateAstNode.d.ts.map +0 -1
  287. package/types/extractor/extractHelpers.d.ts +0 -28
  288. package/types/extractor/extractHelpers.d.ts.map +0 -1
  289. package/types/extractor/extractMediaStyle.d.ts +0 -11
  290. package/types/extractor/extractMediaStyle.d.ts.map +0 -1
  291. package/types/extractor/extractToClassNames.d.ts +0 -25
  292. package/types/extractor/extractToClassNames.d.ts.map +0 -1
  293. package/types/extractor/extractToNative.d.ts +0 -13
  294. package/types/extractor/extractToNative.d.ts.map +0 -1
  295. package/types/extractor/findTopmostFunction.d.ts +0 -4
  296. package/types/extractor/findTopmostFunction.d.ts.map +0 -1
  297. package/types/extractor/generatedUid.d.ts +0 -5
  298. package/types/extractor/generatedUid.d.ts.map +0 -1
  299. package/types/extractor/getPrefixLogs.d.ts +0 -3
  300. package/types/extractor/getPrefixLogs.d.ts.map +0 -1
  301. package/types/extractor/getPropValueFromAttributes.d.ts +0 -19
  302. package/types/extractor/getPropValueFromAttributes.d.ts.map +0 -1
  303. package/types/extractor/getSourceModule.d.ts +0 -16
  304. package/types/extractor/getSourceModule.d.ts.map +0 -1
  305. package/types/extractor/getStaticBindingsForScope.d.ts +0 -5
  306. package/types/extractor/getStaticBindingsForScope.d.ts.map +0 -1
  307. package/types/extractor/hasTopLevelAwait.d.ts +0 -2
  308. package/types/extractor/hasTopLevelAwait.d.ts.map +0 -1
  309. package/types/extractor/hoistClassNames.d.ts +0 -6
  310. package/types/extractor/hoistClassNames.d.ts.map +0 -1
  311. package/types/extractor/literalToAst.d.ts +0 -4
  312. package/types/extractor/literalToAst.d.ts.map +0 -1
  313. package/types/extractor/loadFile.d.ts +0 -1
  314. package/types/extractor/loadFile.d.ts.map +0 -1
  315. package/types/extractor/logLines.d.ts +0 -2
  316. package/types/extractor/logLines.d.ts.map +0 -1
  317. package/types/extractor/normalizeTernaries.d.ts +0 -5
  318. package/types/extractor/normalizeTernaries.d.ts.map +0 -1
  319. package/types/extractor/propsToFontFamilyCache.d.ts +0 -4
  320. package/types/extractor/propsToFontFamilyCache.d.ts.map +0 -1
  321. package/types/extractor/removeUnusedHooks.d.ts +0 -3
  322. package/types/extractor/removeUnusedHooks.d.ts.map +0 -1
  323. package/types/extractor/timer.d.ts +0 -5
  324. package/types/extractor/timer.d.ts.map +0 -1
  325. package/types/extractor/validHTMLAttributes.d.ts +0 -52
  326. package/types/extractor/validHTMLAttributes.d.ts.map +0 -1
  327. package/types/worker.d.ts +0 -46
  328. package/types/worker.d.ts.map +0 -1
  329. /package/dist/{setup.cjs → cjs/setup.cjs} +0 -0
@@ -0,0 +1,8 @@
1
+ import * as Static1 from "./exports.mjs";
2
+
3
+ export * from "./exports.mjs"
4
+
5
+ var index_default = Static1;
6
+
7
+ export { index_default as default };
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import * as Static1 from \"./exports\";\nexport * from \"./exports\";\nvar index_default = Static1;\nexport {\n index_default as default\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;AAEA,IAAI,gBAAgB"}
@@ -0,0 +1,195 @@
1
+ import { dirname } from "node:path";
2
+ import { buildSync } from "esbuild";
3
+ import { register } from "esbuild-register/dist/node";
4
+ import { createRequire } from "node:module";
5
+ import { esbuildIgnoreFilesRegex } from "./extractor/bundle.mjs";
6
+ import { requireTamaguiCore } from "./helpers/requireTamaguiCore.mjs";
7
+ import { getStaticEvaluationModuleReplacement, isIgnoredStaticEvaluationModule } from "./staticEvaluationIgnoredModules.mjs";
8
+
9
+ const nameToPaths = {};
10
+ const nodeRequire = createRequire(typeof __filename === "string" ? __filename : import.meta.url);
11
+ const getNameToPaths = () => nameToPaths;
12
+ const Module = nodeRequire("node:module");
13
+ let isRegistered = false;
14
+ let og;
15
+ var StaticEvaluationError = class extends Error {
16
+ constructor(moduleName, importer, failedModule, reason, options) {
17
+ super(`[tamagui] Failed to evaluate module "${failedModule}" imported from "${importer}" while loading the Tamagui config and configured components.
18
+ Reason: ${reason}
19
+ Fix the module so it can run in Node during the build. If it is runtime-only and none of its exports create your Tamagui config or components, add "${moduleName}" to dangerouslyIgnoreStaticEvaluationModules in tamagui.build.ts.`, options);
20
+ this.moduleName = moduleName;
21
+ this.importer = importer;
22
+ this.failedModule = failedModule;
23
+ this.reason = reason;
24
+ }
25
+ moduleName;
26
+ importer;
27
+ failedModule;
28
+ reason;
29
+ code = "TAMAGUI_STATIC_EVALUATION_ERROR";
30
+ };
31
+ const compiled = {};
32
+ function setRequireResult(name, result) {
33
+ compiled[name] = result;
34
+ }
35
+ function getStaticExtractionStub(path) {
36
+ switch (path) {
37
+ case "expo-constants": return {
38
+ __esModule: true,
39
+ default: { executionEnvironment: null },
40
+ ExecutionEnvironment: {
41
+ Bare: "bare",
42
+ Standalone: "standalone",
43
+ StoreClient: "storeClient"
44
+ }
45
+ };
46
+ case "expo-updates": return {
47
+ __esModule: true,
48
+ default: {
49
+ isEnabled: false,
50
+ isUsingEmbeddedAssets: true
51
+ },
52
+ checkForUpdateAsync: async () => ({ isAvailable: false }),
53
+ fetchUpdateAsync: async () => ({ isNew: false }),
54
+ reloadAsync: async () => {}
55
+ };
56
+ case "react-native-reanimated": {
57
+ const identity = (value) => value;
58
+ const sharedValue = (value) => ({
59
+ value,
60
+ get: () => value,
61
+ set: (next) => {
62
+ value = typeof next === "function" ? next(value) : next;
63
+ }
64
+ });
65
+ const Animated = {
66
+ createAnimatedComponent: identity,
67
+ View: () => null,
68
+ Text: () => null
69
+ };
70
+ return {
71
+ __esModule: true,
72
+ default: Animated,
73
+ cancelAnimation: () => {},
74
+ runOnJS: identity,
75
+ runOnUI: identity,
76
+ useAnimatedReaction: () => {},
77
+ useAnimatedStyle: (callback) => callback(),
78
+ useDerivedValue: (callback) => sharedValue(callback()),
79
+ useSharedValue: sharedValue,
80
+ withDelay: (_delay, animation) => animation,
81
+ withSpring: identity,
82
+ withTiming: identity
83
+ };
84
+ }
85
+ default: return null;
86
+ }
87
+ }
88
+ function registerRequire(platform, { ignoredModules = [] } = { ignoredModules: [] }) {
89
+ if (isRegistered) {
90
+ return {
91
+ tamaguiRequire: nodeRequire,
92
+ unregister: () => {}
93
+ };
94
+ }
95
+ const originalResolveFilename = Module._resolveFilename;
96
+ const { unregister } = register({
97
+ hookIgnoreNodeModules: false,
98
+ hookMatcher: (filename) => {
99
+ if (filename.includes("@tamagui") || /\/tamagui\/code\/(core|ui|packages)\//.test(filename)) {
100
+ return false;
101
+ }
102
+ return true;
103
+ }
104
+ });
105
+ const tsconfigPatchedResolve = Module._resolveFilename;
106
+ Module._resolveFilename = function(request, ...args) {
107
+ if (request.startsWith("@tamagui/")) {
108
+ return originalResolveFilename.call(this, request, ...args);
109
+ }
110
+ return tsconfigPatchedResolve.call(this, request, ...args);
111
+ };
112
+ if (!og) {
113
+ og = Module.prototype.require;
114
+ }
115
+ isRegistered = true;
116
+ Module.prototype.require = tamaguiRequire;
117
+ function tamaguiRequire(path) {
118
+ const staticExtractionStub = getStaticExtractionStub(path);
119
+ if (staticExtractionStub) {
120
+ return staticExtractionStub;
121
+ }
122
+ if (path === "tamagui" && platform === "native") {
123
+ return og.apply(this, ["tamagui/native"]);
124
+ }
125
+ if (path === "@tamagui/core") {
126
+ return requireTamaguiCore(platform, (path2) => {
127
+ return og.apply(this, [path2]);
128
+ });
129
+ }
130
+ const staticEvaluationReplacement = getStaticEvaluationModuleReplacement(path);
131
+ if (staticEvaluationReplacement) {
132
+ if (!(path in compiled)) {
133
+ const replacementPath = nodeRequire.resolve(staticEvaluationReplacement);
134
+ const output = buildSync({
135
+ entryPoints: [replacementPath],
136
+ bundle: true,
137
+ format: "cjs",
138
+ platform: "node",
139
+ write: false
140
+ }).outputFiles[0].text;
141
+ const replacementModule = new Module(replacementPath, this);
142
+ replacementModule.filename = replacementPath;
143
+ replacementModule.paths = Module._nodeModulePaths(dirname(replacementPath));
144
+ replacementModule._compile(output, replacementPath);
145
+ compiled[path] = replacementModule.exports;
146
+ }
147
+ return compiled[path];
148
+ }
149
+ if (staticEvaluationReplacement === null || isIgnoredStaticEvaluationModule(path, ignoredModules)) {
150
+ return {};
151
+ }
152
+ if (esbuildIgnoreFilesRegex.test(path)) {
153
+ return {};
154
+ }
155
+ if (path in compiled) {
156
+ return compiled[path];
157
+ }
158
+ if (path === "react-native-svg") {
159
+ return og.apply(this, ["@tamagui/react-native-svg"]);
160
+ }
161
+ if (path === "react-native/package.json") {
162
+ return og.apply(this, ["react-native-web/package.json"]);
163
+ }
164
+ if (path === "@tamagui/react-native-web-lite" || path === "react-native" || path.startsWith("react-native/") || path === "react-native-web" || path.startsWith("react-native-web/")) {
165
+ try {
166
+ return og.apply("react-native");
167
+ } catch {
168
+ return og.apply(this, ["@tamagui/react-native-web-lite"]);
169
+ }
170
+ }
171
+ try {
172
+ const out = og.apply(this, arguments);
173
+ return out;
174
+ } catch (err) {
175
+ if (err?.code === "TAMAGUI_STATIC_EVALUATION_ERROR") {
176
+ throw err;
177
+ }
178
+ const importer = this?.filename || this?.id || "<unknown module>";
179
+ const reason = err instanceof Error ? err.message : String(err);
180
+ const failedModule = reason.match(/Cannot find native module ['"]([^'"]+)['"]/)?.[1] || path;
181
+ throw new StaticEvaluationError(path, importer, failedModule, reason, { cause: err });
182
+ }
183
+ }
184
+ return {
185
+ tamaguiRequire,
186
+ unregister: () => {
187
+ unregister();
188
+ isRegistered = false;
189
+ Module.prototype.require = og;
190
+ }
191
+ };
192
+ }
193
+
194
+ export { getNameToPaths, registerRequire, setRequireResult };
195
+ //# sourceMappingURL=registerRequire.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerRequire.js","names":[],"sources":["esm/registerRequire.js"],"sourcesContent":["import { dirname } from \"node:path\";\nimport { buildSync } from \"esbuild\";\nimport { register } from \"esbuild-register/dist/node\";\nimport { createRequire } from \"node:module\";\nimport { esbuildIgnoreFilesRegex } from \"./extractor/bundle\";\nimport { requireTamaguiCore } from \"./helpers/requireTamaguiCore\";\nimport {\n getStaticEvaluationModuleReplacement,\n isIgnoredStaticEvaluationModule\n} from \"./staticEvaluationIgnoredModules\";\nconst nameToPaths = {};\nconst nodeRequire = createRequire(\n typeof __filename === \"string\" ? __filename : import.meta.url\n);\nconst getNameToPaths = () => nameToPaths;\nconst Module = nodeRequire(\"node:module\");\nlet isRegistered = false;\nlet og;\nclass StaticEvaluationError extends Error {\n constructor(moduleName, importer, failedModule, reason, options) {\n super(\n `[tamagui] Failed to evaluate module \"${failedModule}\" imported from \"${importer}\" while loading the Tamagui config and configured components.\nReason: ${reason}\nFix the module so it can run in Node during the build. If it is runtime-only and none of its exports create your Tamagui config or components, add \"${moduleName}\" to dangerouslyIgnoreStaticEvaluationModules in tamagui.build.ts.`,\n options\n );\n this.moduleName = moduleName;\n this.importer = importer;\n this.failedModule = failedModule;\n this.reason = reason;\n }\n moduleName;\n importer;\n failedModule;\n reason;\n code = \"TAMAGUI_STATIC_EVALUATION_ERROR\";\n}\nconst compiled = {};\nfunction setRequireResult(name, result) {\n compiled[name] = result;\n}\nfunction getStaticExtractionStub(path) {\n switch (path) {\n case \"expo-constants\":\n return {\n __esModule: true,\n default: {\n executionEnvironment: null\n },\n ExecutionEnvironment: {\n Bare: \"bare\",\n Standalone: \"standalone\",\n StoreClient: \"storeClient\"\n }\n };\n case \"expo-updates\":\n return {\n __esModule: true,\n default: {\n isEnabled: false,\n isUsingEmbeddedAssets: true\n },\n checkForUpdateAsync: async () => ({ isAvailable: false }),\n fetchUpdateAsync: async () => ({ isNew: false }),\n reloadAsync: async () => {\n }\n };\n case \"react-native-reanimated\": {\n const identity = (value) => value;\n const sharedValue = (value) => ({\n value,\n get: () => value,\n set: (next) => {\n value = typeof next === \"function\" ? next(value) : next;\n }\n });\n const Animated = {\n createAnimatedComponent: identity,\n View: () => null,\n Text: () => null\n };\n return {\n __esModule: true,\n default: Animated,\n cancelAnimation: () => {\n },\n runOnJS: identity,\n runOnUI: identity,\n useAnimatedReaction: () => {\n },\n useAnimatedStyle: (callback) => callback(),\n useDerivedValue: (callback) => sharedValue(callback()),\n useSharedValue: sharedValue,\n withDelay: (_delay, animation) => animation,\n withSpring: identity,\n withTiming: identity\n };\n }\n default:\n return null;\n }\n}\nfunction registerRequire(platform, { ignoredModules = [] } = {\n ignoredModules: []\n}) {\n if (isRegistered) {\n return {\n tamaguiRequire: nodeRequire,\n unregister: () => {\n }\n };\n }\n const originalResolveFilename = Module._resolveFilename;\n const { unregister } = register({\n hookIgnoreNodeModules: false,\n // don't transform @tamagui packages - they have pre-built dist files\n hookMatcher: (filename) => {\n if (filename.includes(\"@tamagui\") || /\\/tamagui\\/code\\/(core|ui|packages)\\//.test(filename)) {\n return false;\n }\n return true;\n }\n });\n const tsconfigPatchedResolve = Module._resolveFilename;\n Module._resolveFilename = function(request, ...args) {\n if (request.startsWith(\"@tamagui/\")) {\n return originalResolveFilename.call(this, request, ...args);\n }\n return tsconfigPatchedResolve.call(this, request, ...args);\n };\n if (!og) {\n og = Module.prototype.require;\n }\n isRegistered = true;\n Module.prototype.require = tamaguiRequire;\n function tamaguiRequire(path) {\n const staticExtractionStub = getStaticExtractionStub(path);\n if (staticExtractionStub) {\n return staticExtractionStub;\n }\n if (path === \"tamagui\" && platform === \"native\") {\n return og.apply(this, [\"tamagui/native\"]);\n }\n if (path === \"@tamagui/core\") {\n return requireTamaguiCore(platform, (path2) => {\n return og.apply(this, [path2]);\n });\n }\n const staticEvaluationReplacement = getStaticEvaluationModuleReplacement(path);\n if (staticEvaluationReplacement) {\n if (!(path in compiled)) {\n const replacementPath = nodeRequire.resolve(staticEvaluationReplacement);\n const output = buildSync({\n entryPoints: [replacementPath],\n bundle: true,\n format: \"cjs\",\n platform: \"node\",\n write: false\n }).outputFiles[0].text;\n const replacementModule = new Module(replacementPath, this);\n replacementModule.filename = replacementPath;\n replacementModule.paths = Module._nodeModulePaths(dirname(replacementPath));\n replacementModule._compile(output, replacementPath);\n compiled[path] = replacementModule.exports;\n }\n return compiled[path];\n }\n if (staticEvaluationReplacement === null || isIgnoredStaticEvaluationModule(path, ignoredModules)) {\n return {};\n }\n if (esbuildIgnoreFilesRegex.test(path)) {\n return {};\n }\n if (path in compiled) {\n return compiled[path];\n }\n if (path === \"react-native-svg\") {\n return og.apply(this, [\"@tamagui/react-native-svg\"]);\n }\n if (path === \"react-native/package.json\") {\n return og.apply(this, [\"react-native-web/package.json\"]);\n }\n if (path === \"@tamagui/react-native-web-lite\" || path === \"react-native\" || path.startsWith(\"react-native/\") || path === \"react-native-web\" || path.startsWith(\"react-native-web/\")) {\n try {\n return og.apply(\"react-native\");\n } catch {\n return og.apply(this, [\"@tamagui/react-native-web-lite\"]);\n }\n }\n try {\n const out = og.apply(this, arguments);\n return out;\n } catch (err) {\n if (err?.code === \"TAMAGUI_STATIC_EVALUATION_ERROR\") {\n throw err;\n }\n const importer = this?.filename || this?.id || \"<unknown module>\";\n const reason = err instanceof Error ? err.message : String(err);\n const failedModule = reason.match(/Cannot find native module ['\"]([^'\"]+)['\"]/)?.[1] || path;\n throw new StaticEvaluationError(path, importer, failedModule, reason, {\n cause: err\n });\n }\n }\n return {\n tamaguiRequire,\n unregister: () => {\n unregister();\n isRegistered = false;\n Module.prototype.require = og;\n }\n };\n}\nexport {\n getNameToPaths,\n registerRequire,\n setRequireResult\n};\n//# sourceMappingURL=registerRequire.js.map\n"],"mappings":"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"}
@@ -0,0 +1,40 @@
1
+ import net from "node:net";
2
+
3
+ async function startServer(options) {
4
+ const port = await getAvailablePort();
5
+ const server = net.createServer();
6
+ server.unref();
7
+ await new Promise((resolve, reject) => {
8
+ server.on("error", reject);
9
+ server.on("connection", (conn) => {
10
+ conn.on("data", (data) => {
11
+ console.info("got", data.toString());
12
+ });
13
+ });
14
+ server.listen({ port }, () => {
15
+ const { port: port2 } = server.address();
16
+ server.close(() => {
17
+ resolve(port2);
18
+ });
19
+ });
20
+ });
21
+ }
22
+ async function getAvailablePort(port = 8089) {
23
+ return checkAvailablePort(port).catch(() => getAvailablePort(port + 1));
24
+ }
25
+ function checkAvailablePort(port) {
26
+ return new Promise((resolve, reject) => {
27
+ const server = net.createServer();
28
+ server.unref();
29
+ server.on("error", reject);
30
+ server.listen({ port }, () => {
31
+ const { port: port2 } = server.address();
32
+ server.close(() => {
33
+ resolve(port2);
34
+ });
35
+ });
36
+ });
37
+ }
38
+
39
+ export { startServer };
40
+ //# sourceMappingURL=server.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","names":[],"sources":["esm/server.js"],"sourcesContent":["import net from \"node:net\";\nasync function startServer(options) {\n const port = await getAvailablePort();\n const server = net.createServer();\n server.unref();\n await new Promise((resolve, reject) => {\n server.on(\"error\", reject);\n server.on(\"connection\", (conn) => {\n conn.on(\"data\", (data) => {\n console.info(\"got\", data.toString());\n });\n });\n server.listen({ port }, () => {\n const { port: port2 } = server.address();\n server.close(() => {\n resolve(port2);\n });\n });\n });\n}\nasync function getAvailablePort(port = 8089) {\n return checkAvailablePort(port).catch(() => getAvailablePort(port + 1));\n}\nfunction checkAvailablePort(port) {\n return new Promise((resolve, reject) => {\n const server = net.createServer();\n server.unref();\n server.on(\"error\", reject);\n server.listen({ port }, () => {\n const { port: port2 } = server.address();\n server.close(() => {\n resolve(port2);\n });\n });\n });\n}\nexport {\n startServer\n};\n//# sourceMappingURL=server.js.map\n"],"mappings":";;;AACA,eAAe,YAAY,SAAS;CAClC,MAAM,OAAO,MAAM,iBAAiB;CACpC,MAAM,SAAS,IAAI,aAAa;CAChC,OAAO,MAAM;CACb,MAAM,IAAI,SAAS,SAAS,WAAW;EACrC,OAAO,GAAG,SAAS,MAAM;EACzB,OAAO,GAAG,eAAe,SAAS;GAChC,KAAK,GAAG,SAAS,SAAS;IACxB,QAAQ,KAAK,OAAO,KAAK,SAAS,CAAC;GACrC,CAAC;EACH,CAAC;EACD,OAAO,OAAO,EAAE,KAAK,SAAS;GAC5B,MAAM,EAAE,MAAM,UAAU,OAAO,QAAQ;GACvC,OAAO,YAAY;IACjB,QAAQ,KAAK;GACf,CAAC;EACH,CAAC;CACH,CAAC;AACH;AACA,eAAe,iBAAiB,OAAO,MAAM;CAC3C,OAAO,mBAAmB,IAAI,EAAE,YAAY,iBAAiB,OAAO,CAAC,CAAC;AACxE;AACA,SAAS,mBAAmB,MAAM;CAChC,OAAO,IAAI,SAAS,SAAS,WAAW;EACtC,MAAM,SAAS,IAAI,aAAa;EAChC,OAAO,MAAM;EACb,OAAO,GAAG,SAAS,MAAM;EACzB,OAAO,OAAO,EAAE,KAAK,SAAS;GAC5B,MAAM,EAAE,MAAM,UAAU,OAAO,QAAQ;GACvC,OAAO,YAAY;IACjB,QAAQ,KAAK;GACf,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
File without changes
@@ -0,0 +1,61 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { dirname } from "node:path";
3
+
4
+ const tamaguiStaticEvaluationModules = Object.freeze({
5
+ "react-native-safe-area-context": null,
6
+ "react-native-worklets": "react-native-worklets/lib/module/mock.js"
7
+ });
8
+ function getStaticEvaluationModuleReplacement(moduleName) {
9
+ return Object.hasOwn(tamaguiStaticEvaluationModules, moduleName) ? tamaguiStaticEvaluationModules[moduleName] : void 0;
10
+ }
11
+ function isIgnoredStaticEvaluationModule(moduleName, userIgnoredModules = []) {
12
+ return getStaticEvaluationModuleReplacement(moduleName) !== void 0 || userIgnoredModules.includes(moduleName);
13
+ }
14
+ function staticEvaluationIgnorePlugin(userIgnoredModules = []) {
15
+ return {
16
+ name: "tamagui-static-evaluation-ignore",
17
+ setup(build) {
18
+ build.onResolve({ filter: /.*/ }, (args) => {
19
+ if (isIgnoredStaticEvaluationModule(args.path, userIgnoredModules)) {
20
+ return {
21
+ path: args.path,
22
+ namespace: "tamagui-static-evaluation-ignore"
23
+ };
24
+ }
25
+ return null;
26
+ });
27
+ build.onLoad({
28
+ filter: /.*/,
29
+ namespace: "tamagui-static-evaluation-ignore"
30
+ }, async (args) => {
31
+ const replacement = getStaticEvaluationModuleReplacement(args.path);
32
+ if (replacement) {
33
+ const resolved = await build.resolve(replacement, {
34
+ kind: "require-call",
35
+ resolveDir: build.initialOptions.absWorkingDir || process.cwd()
36
+ });
37
+ if (resolved.errors.length) {
38
+ return {
39
+ errors: resolved.errors,
40
+ warnings: resolved.warnings
41
+ };
42
+ }
43
+ return {
44
+ contents: await readFile(resolved.path, "utf8"),
45
+ loader: "js",
46
+ resolveDir: dirname(resolved.path),
47
+ warnings: resolved.warnings
48
+ };
49
+ }
50
+ return {
51
+ contents: "module.exports = {}",
52
+ loader: "js",
53
+ resolveDir: build.initialOptions.absWorkingDir || process.cwd()
54
+ };
55
+ });
56
+ }
57
+ };
58
+ }
59
+
60
+ export { getStaticEvaluationModuleReplacement, isIgnoredStaticEvaluationModule, staticEvaluationIgnorePlugin, tamaguiStaticEvaluationModules };
61
+ //# sourceMappingURL=staticEvaluationIgnoredModules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staticEvaluationIgnoredModules.js","names":[],"sources":["esm/staticEvaluationIgnoredModules.js"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nconst tamaguiStaticEvaluationModules = Object.freeze({\n // react-native-safe-area-context evaluates its native codegen spec in Node and\n // calls codegenNativeComponent, which is unavailable during static evaluation.\n \"react-native-safe-area-context\": null,\n // react-native-worklets initializes native JSI in Node, so static evaluation\n // inlines the package's own mock while preserving the authored animation config.\n // the vendor mock mutates _WORKLET, __RUNTIME_KIND, _log,\n // _getAnimationTimestamp, and requestAnimationFrame in the compiler process.\n \"react-native-worklets\": \"react-native-worklets/lib/module/mock.js\"\n});\nfunction getStaticEvaluationModuleReplacement(moduleName) {\n return Object.hasOwn(tamaguiStaticEvaluationModules, moduleName) ? tamaguiStaticEvaluationModules[moduleName] : void 0;\n}\nfunction isIgnoredStaticEvaluationModule(moduleName, userIgnoredModules = []) {\n return getStaticEvaluationModuleReplacement(moduleName) !== void 0 || userIgnoredModules.includes(moduleName);\n}\nfunction staticEvaluationIgnorePlugin(userIgnoredModules = []) {\n return {\n name: \"tamagui-static-evaluation-ignore\",\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (isIgnoredStaticEvaluationModule(args.path, userIgnoredModules)) {\n return { path: args.path, namespace: \"tamagui-static-evaluation-ignore\" };\n }\n return null;\n });\n build.onLoad(\n { filter: /.*/, namespace: \"tamagui-static-evaluation-ignore\" },\n async (args) => {\n const replacement = getStaticEvaluationModuleReplacement(args.path);\n if (replacement) {\n const resolved = await build.resolve(replacement, {\n kind: \"require-call\",\n resolveDir: build.initialOptions.absWorkingDir || process.cwd()\n });\n if (resolved.errors.length) {\n return { errors: resolved.errors, warnings: resolved.warnings };\n }\n return {\n contents: await readFile(resolved.path, \"utf8\"),\n loader: \"js\",\n resolveDir: dirname(resolved.path),\n warnings: resolved.warnings\n };\n }\n return {\n contents: \"module.exports = {}\",\n loader: \"js\",\n resolveDir: build.initialOptions.absWorkingDir || process.cwd()\n };\n }\n );\n }\n };\n}\nexport {\n getStaticEvaluationModuleReplacement,\n isIgnoredStaticEvaluationModule,\n staticEvaluationIgnorePlugin,\n tamaguiStaticEvaluationModules\n};\n//# sourceMappingURL=staticEvaluationIgnoredModules.js.map\n"],"mappings":";;;;AAEA,MAAM,iCAAiC,OAAO,OAAO;CAGnD,kCAAkC;CAKlC,yBAAyB;AAC3B,CAAC;AACD,SAAS,qCAAqC,YAAY;CACxD,OAAO,OAAO,OAAO,gCAAgC,UAAU,IAAI,+BAA+B,cAAc,KAAK;AACvH;AACA,SAAS,gCAAgC,YAAY,qBAAqB,CAAC,GAAG;CAC5E,OAAO,qCAAqC,UAAU,MAAM,KAAK,KAAK,mBAAmB,SAAS,UAAU;AAC9G;AACA,SAAS,6BAA6B,qBAAqB,CAAC,GAAG;CAC7D,OAAO;EACL,MAAM;EACN,MAAM,OAAO;GACX,MAAM,UAAU,EAAE,QAAQ,KAAK,IAAI,SAAS;IAC1C,IAAI,gCAAgC,KAAK,MAAM,kBAAkB,GAAG;KAClE,OAAO;MAAE,MAAM,KAAK;MAAM,WAAW;KAAmC;IAC1E;IACA,OAAO;GACT,CAAC;GACD,MAAM,OACJ;IAAE,QAAQ;IAAM,WAAW;GAAmC,GAC9D,OAAO,SAAS;IACd,MAAM,cAAc,qCAAqC,KAAK,IAAI;IAClE,IAAI,aAAa;KACf,MAAM,WAAW,MAAM,MAAM,QAAQ,aAAa;MAChD,MAAM;MACN,YAAY,MAAM,eAAe,iBAAiB,QAAQ,IAAI;KAChE,CAAC;KACD,IAAI,SAAS,OAAO,QAAQ;MAC1B,OAAO;OAAE,QAAQ,SAAS;OAAQ,UAAU,SAAS;MAAS;KAChE;KACA,OAAO;MACL,UAAU,MAAM,SAAS,SAAS,MAAM,MAAM;MAC9C,QAAQ;MACR,YAAY,QAAQ,SAAS,IAAI;MACjC,UAAU,SAAS;KACrB;IACF;IACA,OAAO;KACL,UAAU;KACV,QAAQ;KACR,YAAY,MAAM,eAAe,iBAAiB,QAAQ,IAAI;IAChE;GACF,CACF;EACF;CACF;AACF"}
File without changes
@@ -0,0 +1,119 @@
1
+ import { createHash } from "node:crypto";
2
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import path from "node:path";
4
+
5
+ var ZeroCSSArtifact = class {
6
+ #config = null;
7
+ #zero = /* @__PURE__ */ new Map();
8
+ #islands = /* @__PURE__ */ new Map();
9
+ #bridges = /* @__PURE__ */ new Map();
10
+ #expectedIslands = [];
11
+ #cssPath;
12
+ constructor(cssPath) {
13
+ this.#cssPath = cssPath;
14
+ }
15
+ get cssPath() {
16
+ return this.#cssPath;
17
+ }
18
+ expectIslands(ids) {
19
+ this.#expectedIslands = [...ids].sort();
20
+ }
21
+ setConfigCSS(css) {
22
+ this.#config = css;
23
+ }
24
+ setZeroModuleCSS(moduleId, css) {
25
+ if (css) this.#zero.set(moduleId, css);
26
+ else this.#zero.delete(moduleId);
27
+ }
28
+ setIslandModuleCSS(islandId, moduleId, css) {
29
+ let bucket = this.#islands.get(islandId);
30
+ if (!bucket) {
31
+ bucket = /* @__PURE__ */ new Map();
32
+ this.#islands.set(islandId, bucket);
33
+ }
34
+ if (css) bucket.set(moduleId, css);
35
+ else bucket.delete(moduleId);
36
+ }
37
+ /** This island's collected rules, in deterministic module order. */
38
+ islandCSS(islandId) {
39
+ const bucket = this.#islands.get(islandId);
40
+ if (!bucket) return [];
41
+ return [...bucket.keys()].sort().map((moduleId) => bucket.get(moduleId));
42
+ }
43
+ /** Marks an island as compiled even when it contributed no atomic rules. */
44
+ markIslandComplete(islandId) {
45
+ if (!this.#islands.has(islandId)) this.#islands.set(islandId, /* @__PURE__ */ new Map());
46
+ }
47
+ /** Collected zero-graph module CSS, for an integration that persists it. */
48
+ zeroModuleEntries() {
49
+ return [...this.#zero.entries()].sort(([left], [right]) => left < right ? -1 : 1);
50
+ }
51
+ bridgeEntries() {
52
+ return [...this.#bridges.entries()].sort(([left], [right]) => left < right ? -1 : 1);
53
+ }
54
+ setBridgeRules(bridgeId, css) {
55
+ if (css) this.#bridges.set(bridgeId, css);
56
+ else this.#bridges.delete(bridgeId);
57
+ }
58
+ clearGraphs() {
59
+ this.#zero.clear();
60
+ this.#islands.clear();
61
+ this.#bridges.clear();
62
+ }
63
+ /** The missing pieces that block deriving TAMAGUI_DID_OUTPUT_CSS. */
64
+ missing() {
65
+ const missing = [];
66
+ if (this.#config === null) missing.push("config CSS");
67
+ for (const id of this.#expectedIslands) {
68
+ if (!this.#islands.has(id)) missing.push(`island ${id}`);
69
+ }
70
+ return missing;
71
+ }
72
+ isComplete() {
73
+ return this.missing().length === 0;
74
+ }
75
+ /** Deterministic order: config, zero atomic, island atomic, bridge classes. */
76
+ css() {
77
+ const parts = [];
78
+ if (this.#config) parts.push(this.#config);
79
+ for (const moduleId of [...this.#zero.keys()].sort()) {
80
+ parts.push(this.#zero.get(moduleId));
81
+ }
82
+ for (const islandId of [...this.#islands.keys()].sort()) {
83
+ const bucket = this.#islands.get(islandId);
84
+ for (const moduleId of [...bucket.keys()].sort()) parts.push(bucket.get(moduleId));
85
+ }
86
+ for (const bridgeId of [...this.#bridges.keys()].sort()) {
87
+ parts.push(this.#bridges.get(bridgeId));
88
+ }
89
+ return parts.join("\n");
90
+ }
91
+ hash() {
92
+ return createHash("sha256").update(this.css()).digest("hex").slice(0, 16);
93
+ }
94
+ /**
95
+ * Writes the artifact and returns whether the derived
96
+ * `TAMAGUI_DID_OUTPUT_CSS='1'` claim is now legal.
97
+ */
98
+ write() {
99
+ const missing = this.missing();
100
+ const css = this.css();
101
+ mkdirSync(path.dirname(this.#cssPath), { recursive: true });
102
+ let existing = null;
103
+ try {
104
+ existing = readFileSync(this.#cssPath, "utf8");
105
+ } catch {
106
+ existing = null;
107
+ }
108
+ if (existing !== css) writeFileSync(this.#cssPath, css);
109
+ return {
110
+ path: this.#cssPath,
111
+ hash: this.hash(),
112
+ complete: missing.length === 0,
113
+ missing
114
+ };
115
+ }
116
+ };
117
+
118
+ export { ZeroCSSArtifact };
119
+ //# sourceMappingURL=artifact.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact.js","names":["#cssPath","#expectedIslands","#config","#zero","#islands","#bridges"],"sources":["esm/zero/artifact.js"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nclass ZeroCSSArtifact {\n #config = null;\n #zero = /* @__PURE__ */ new Map();\n #islands = /* @__PURE__ */ new Map();\n #bridges = /* @__PURE__ */ new Map();\n #expectedIslands = [];\n #cssPath;\n constructor(cssPath) {\n this.#cssPath = cssPath;\n }\n get cssPath() {\n return this.#cssPath;\n }\n expectIslands(ids) {\n this.#expectedIslands = [...ids].sort();\n }\n setConfigCSS(css) {\n this.#config = css;\n }\n setZeroModuleCSS(moduleId, css) {\n if (css) this.#zero.set(moduleId, css);\n else this.#zero.delete(moduleId);\n }\n setIslandModuleCSS(islandId, moduleId, css) {\n let bucket = this.#islands.get(islandId);\n if (!bucket) {\n bucket = /* @__PURE__ */ new Map();\n this.#islands.set(islandId, bucket);\n }\n if (css) bucket.set(moduleId, css);\n else bucket.delete(moduleId);\n }\n /** This island's collected rules, in deterministic module order. */\n islandCSS(islandId) {\n const bucket = this.#islands.get(islandId);\n if (!bucket) return [];\n return [...bucket.keys()].sort().map((moduleId) => bucket.get(moduleId));\n }\n /** Marks an island as compiled even when it contributed no atomic rules. */\n markIslandComplete(islandId) {\n if (!this.#islands.has(islandId)) this.#islands.set(islandId, /* @__PURE__ */ new Map());\n }\n /** Collected zero-graph module CSS, for an integration that persists it. */\n zeroModuleEntries() {\n return [...this.#zero.entries()].sort(([left], [right]) => left < right ? -1 : 1);\n }\n bridgeEntries() {\n return [...this.#bridges.entries()].sort(([left], [right]) => left < right ? -1 : 1);\n }\n setBridgeRules(bridgeId, css) {\n if (css) this.#bridges.set(bridgeId, css);\n else this.#bridges.delete(bridgeId);\n }\n clearGraphs() {\n this.#zero.clear();\n this.#islands.clear();\n this.#bridges.clear();\n }\n /** The missing pieces that block deriving TAMAGUI_DID_OUTPUT_CSS. */\n missing() {\n const missing = [];\n if (this.#config === null) missing.push(\"config CSS\");\n for (const id of this.#expectedIslands) {\n if (!this.#islands.has(id)) missing.push(`island ${id}`);\n }\n return missing;\n }\n isComplete() {\n return this.missing().length === 0;\n }\n /** Deterministic order: config, zero atomic, island atomic, bridge classes. */\n css() {\n const parts = [];\n if (this.#config) parts.push(this.#config);\n for (const moduleId of [...this.#zero.keys()].sort()) {\n parts.push(this.#zero.get(moduleId));\n }\n for (const islandId of [...this.#islands.keys()].sort()) {\n const bucket = this.#islands.get(islandId);\n for (const moduleId of [...bucket.keys()].sort()) parts.push(bucket.get(moduleId));\n }\n for (const bridgeId of [...this.#bridges.keys()].sort()) {\n parts.push(this.#bridges.get(bridgeId));\n }\n return parts.join(\"\\n\");\n }\n hash() {\n return createHash(\"sha256\").update(this.css()).digest(\"hex\").slice(0, 16);\n }\n /**\n * Writes the artifact and returns whether the derived\n * `TAMAGUI_DID_OUTPUT_CSS='1'` claim is now legal.\n */\n write() {\n const missing = this.missing();\n const css = this.css();\n mkdirSync(path.dirname(this.#cssPath), { recursive: true });\n let existing = null;\n try {\n existing = readFileSync(this.#cssPath, \"utf8\");\n } catch {\n existing = null;\n }\n if (existing !== css) writeFileSync(this.#cssPath, css);\n return {\n path: this.#cssPath,\n hash: this.hash(),\n complete: missing.length === 0,\n missing\n };\n }\n}\nexport {\n ZeroCSSArtifact\n};\n//# sourceMappingURL=artifact.js.map\n"],"mappings":"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"}
@@ -0,0 +1,170 @@
1
+ import { ZERO_FAILURE_FOOTER } from "@tamagui/compiler-core";
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import path from "node:path";
4
+
5
+ const ALLOWED_ZERO_MODULE = /animated-number/;
6
+ const owningPackageCache = /* @__PURE__ */ new Map();
7
+ function owningPackageOf(id) {
8
+ const clean = id.split(/[?#]/, 1)[0];
9
+ if (!clean || clean.startsWith("\0") || !path.isAbsolute(clean)) return null;
10
+ return owningPackageOfDir(path.dirname(clean));
11
+ }
12
+ function owningPackageOfDir(from) {
13
+ if (!from || !path.isAbsolute(from)) return null;
14
+ let dir = from;
15
+ const visited = [];
16
+ while (true) {
17
+ const cached = owningPackageCache.get(dir);
18
+ if (cached !== void 0) {
19
+ for (const seen of visited) owningPackageCache.set(seen, cached);
20
+ return cached;
21
+ }
22
+ visited.push(dir);
23
+ const manifest = path.join(dir, "package.json");
24
+ if (existsSync(manifest)) {
25
+ let owner = null;
26
+ try {
27
+ owner = {
28
+ name: JSON.parse(readFileSync(manifest, "utf8")).name ?? null,
29
+ manifest
30
+ };
31
+ } catch {
32
+ owner = {
33
+ name: null,
34
+ manifest
35
+ };
36
+ }
37
+ for (const seen of visited) owningPackageCache.set(seen, owner);
38
+ return owner;
39
+ }
40
+ const parent = path.dirname(dir);
41
+ if (parent === dir) {
42
+ for (const seen of visited) owningPackageCache.set(seen, null);
43
+ return null;
44
+ }
45
+ dir = parent;
46
+ }
47
+ }
48
+ function isTamaguiModuleId(id, ownManifest) {
49
+ const owner = owningPackageOf(id);
50
+ if (!owner?.name) return false;
51
+ if (ownManifest && owner.manifest === ownManifest) return false;
52
+ return owner.name === "tamagui" || owner.name.startsWith("@tamagui/");
53
+ }
54
+ function isForbiddenZeroModuleId(id, ownManifest) {
55
+ if (!isTamaguiModuleId(id, ownManifest)) return false;
56
+ return !ALLOWED_ZERO_MODULE.test(id);
57
+ }
58
+ function shortestChain(target, entries, importersOf) {
59
+ const entrySet = new Set(entries);
60
+ const seen = /* @__PURE__ */ new Set([target]);
61
+ const queue = [[target]];
62
+ let longest = [target];
63
+ while (queue.length) {
64
+ const chain = queue.shift();
65
+ const head = chain[0];
66
+ if (entrySet.has(head)) return chain;
67
+ if (chain.length > longest.length) longest = chain;
68
+ for (const importer of importersOf.get(head) ?? []) {
69
+ if (seen.has(importer)) continue;
70
+ seen.add(importer);
71
+ queue.push([importer, ...chain]);
72
+ }
73
+ }
74
+ return longest;
75
+ }
76
+ function checkZeroGraph(input) {
77
+ const importersOf = new Map(input.importerEdges);
78
+ for (const module of input.modules) {
79
+ if (!importersOf.has(module.id)) importersOf.set(module.id, module.importers ?? []);
80
+ }
81
+ const ownManifest = input.root ? owningPackageOfDir(input.root)?.manifest ?? null : null;
82
+ const tamaguiModules = input.modules.map((module) => module.id).filter((id) => isTamaguiModuleId(id, ownManifest)).sort();
83
+ const forbidden = tamaguiModules.filter((id) => isForbiddenZeroModuleId(id, ownManifest)).map((id) => ({
84
+ id,
85
+ chain: shortestChain(id, input.entries, importersOf),
86
+ owner: owningPackageOf(id)?.name ?? ""
87
+ }));
88
+ return {
89
+ tamaguiModules,
90
+ forbidden
91
+ };
92
+ }
93
+ function formatZeroGraphFailure(receipt) {
94
+ const lines = [`[tamagui zero-runtime] ${receipt.integration} zero entry graph contains ${receipt.forbidden.length} forbidden Tamagui module(s)`, ""];
95
+ for (const entry of receipt.forbidden) {
96
+ lines.push(entry.owner ? `${entry.id} (package ${entry.owner})` : entry.id);
97
+ lines.push(entry.chain.length > 1 ? ` ${entry.chain.join("\n -> ")}` : ` (this bundler exposed no importer edges for that module)`);
98
+ }
99
+ lines.push("");
100
+ lines.push(ZERO_FAILURE_FOOTER);
101
+ return lines.join("\n");
102
+ }
103
+ function writeZeroGraphReceipt(outDir, name, receipt) {
104
+ mkdirSync(outDir, { recursive: true });
105
+ const file = path.join(outDir, `${name}.graph.json`);
106
+ writeFileSync(file, `${JSON.stringify(receipt, null, 2)}
107
+ `);
108
+ return file;
109
+ }
110
+ function sortZeroViolations(sites) {
111
+ return [...sites].sort((left, right) => (left.file < right.file ? -1 : left.file > right.file ? 1 : 0) || left.line - right.line || left.column - right.column || left.rule - right.rule || (left.message < right.message ? -1 : left.message > right.message ? 1 : 0));
112
+ }
113
+ function formatZeroViolations(sites) {
114
+ const sorted = sortZeroViolations(sites);
115
+ const lines = [`[tamagui zero-runtime] build failed with ${sorted.length} violations`, ""];
116
+ for (const site of sorted) {
117
+ lines.push(`Rule ${site.rule} ${site.code}`);
118
+ lines.push(`${site.file}:${site.line}:${site.column}${site.component ? ` ${site.component}` : ""}`);
119
+ lines.push(` ${site.message}`);
120
+ lines.push("");
121
+ }
122
+ lines.push(ZERO_FAILURE_FOOTER);
123
+ return lines.join("\n");
124
+ }
125
+ function writeZeroViolationReport(outDir, name, report) {
126
+ mkdirSync(outDir, { recursive: true });
127
+ const file = path.join(outDir, `${name}.violations.json`);
128
+ writeFileSync(file, `${JSON.stringify({
129
+ integration: report.integration,
130
+ mode: report.mode,
131
+ count: report.violations.length,
132
+ violations: sortZeroViolations(report.violations)
133
+ }, null, 2)}
134
+ `);
135
+ return file;
136
+ }
137
+ function erasedExportEscape(input) {
138
+ for (const [moduleId, names] of input.erasedExports) {
139
+ if (names.length === 0) continue;
140
+ if (!input.importersOf.has(moduleId)) {
141
+ return `[tamagui zero-runtime] ${input.integration} erased the exported definition(s) ${names.join(", ")} from ${moduleId}, and then could not find that module in its own graph, so nothing proved the erasure was safe.
142
+
143
+ ${ZERO_FAILURE_FOOTER}`;
144
+ }
145
+ const untransformed = (input.importersOf.get(moduleId) ?? []).filter((importer) => !input.transformed.has(importer));
146
+ if (untransformed.length === 0) continue;
147
+ return `[tamagui zero-runtime] ${input.integration} erased the exported definition(s) ${names.join(", ")} from ${moduleId}, but ${untransformed.length} importer(s) in this entry graph were never zero-transformed and may still reference them:
148
+ ${untransformed.join("\n ")}
149
+
150
+ ${ZERO_FAILURE_FOOTER}`;
151
+ }
152
+ return null;
153
+ }
154
+ function offsetToLineColumn(source, offset) {
155
+ let line = 1;
156
+ let lineStart = 0;
157
+ for (let index = 0; index < offset && index < source.length; index++) {
158
+ if (source.charCodeAt(index) === 10) {
159
+ line++;
160
+ lineStart = index + 1;
161
+ }
162
+ }
163
+ return {
164
+ line,
165
+ column: offset - lineStart + 1
166
+ };
167
+ }
168
+
169
+ export { checkZeroGraph, erasedExportEscape, formatZeroGraphFailure, formatZeroViolations, isForbiddenZeroModuleId, isTamaguiModuleId, offsetToLineColumn, owningPackageOf, owningPackageOfDir, sortZeroViolations, writeZeroGraphReceipt, writeZeroViolationReport };
170
+ //# sourceMappingURL=graph.mjs.map