@wyw-in-js/transform 2.0.0-alpha.0 → 2.0.0-alpha.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 (270) hide show
  1. package/esm/cache.js +7 -0
  2. package/esm/cache.js.map +1 -1
  3. package/esm/debug/fileReporter.js +35 -1
  4. package/esm/debug/fileReporter.js.map +1 -1
  5. package/esm/eval/broker.js +230 -89
  6. package/esm/eval/broker.js.map +1 -1
  7. package/esm/eval/protocol.js.map +1 -1
  8. package/esm/eval/runner.js +143 -24
  9. package/esm/eval/runner.js.map +1 -1
  10. package/esm/module.js +70 -43
  11. package/esm/module.js.map +1 -1
  12. package/esm/transform/Entrypoint.types.js.map +1 -1
  13. package/esm/transform/generators/processEntrypoint.js +35 -20
  14. package/esm/transform/generators/processEntrypoint.js.map +1 -1
  15. package/esm/transform/generators/resolveImports.js +48 -2
  16. package/esm/transform/generators/resolveImports.js.map +1 -1
  17. package/esm/transform/generators/resolveStaticOxcValues/cache.js +182 -0
  18. package/esm/transform/generators/resolveStaticOxcValues/cache.js.map +1 -0
  19. package/esm/transform/generators/resolveStaticOxcValues/candidateResolver.js +146 -0
  20. package/esm/transform/generators/resolveStaticOxcValues/candidateResolver.js.map +1 -0
  21. package/esm/transform/generators/resolveStaticOxcValues/dependencies.js +33 -0
  22. package/esm/transform/generators/resolveStaticOxcValues/dependencies.js.map +1 -0
  23. package/esm/transform/generators/resolveStaticOxcValues/environment.js +29 -0
  24. package/esm/transform/generators/resolveStaticOxcValues/environment.js.map +1 -0
  25. package/esm/transform/generators/resolveStaticOxcValues/exportResolver.js +351 -0
  26. package/esm/transform/generators/resolveStaticOxcValues/exportResolver.js.map +1 -0
  27. package/esm/transform/generators/resolveStaticOxcValues/exportTargets.js +253 -0
  28. package/esm/transform/generators/resolveStaticOxcValues/exportTargets.js.map +1 -0
  29. package/esm/transform/generators/resolveStaticOxcValues/objectAssign.js +310 -0
  30. package/esm/transform/generators/resolveStaticOxcValues/objectAssign.js.map +1 -0
  31. package/esm/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js +74 -0
  32. package/esm/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js.map +1 -0
  33. package/esm/transform/generators/resolveStaticOxcValues/opaqueRuntime.js +229 -0
  34. package/esm/transform/generators/resolveStaticOxcValues/opaqueRuntime.js.map +1 -0
  35. package/esm/transform/generators/resolveStaticOxcValues/processorStaticExport.js +172 -0
  36. package/esm/transform/generators/resolveStaticOxcValues/processorStaticExport.js.map +1 -0
  37. package/esm/transform/generators/resolveStaticOxcValues/processorStaticModel.js +476 -0
  38. package/esm/transform/generators/resolveStaticOxcValues/processorStaticModel.js.map +1 -0
  39. package/esm/transform/generators/resolveStaticOxcValues/processorTarget.js +55 -0
  40. package/esm/transform/generators/resolveStaticOxcValues/processorTarget.js.map +1 -0
  41. package/esm/transform/generators/resolveStaticOxcValues/programAnalysis.js +123 -0
  42. package/esm/transform/generators/resolveStaticOxcValues/programAnalysis.js.map +1 -0
  43. package/esm/transform/generators/resolveStaticOxcValues/prune.js +186 -0
  44. package/esm/transform/generators/resolveStaticOxcValues/prune.js.map +1 -0
  45. package/esm/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js +183 -0
  46. package/esm/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js.map +1 -0
  47. package/esm/transform/generators/resolveStaticOxcValues/staticExpression.js +298 -0
  48. package/esm/transform/generators/resolveStaticOxcValues/staticExpression.js.map +1 -0
  49. package/esm/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js +298 -0
  50. package/esm/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js.map +1 -0
  51. package/esm/transform/generators/resolveStaticOxcValues/types.js +3 -0
  52. package/esm/transform/generators/resolveStaticOxcValues/types.js.map +1 -0
  53. package/esm/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js +59 -0
  54. package/esm/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js.map +1 -0
  55. package/esm/transform/generators/resolveStaticOxcValues.js +1 -2910
  56. package/esm/transform/generators/resolveStaticOxcValues.js.map +1 -1
  57. package/esm/transform/generators/transform.js +57 -45
  58. package/esm/transform/generators/transform.js.map +1 -1
  59. package/esm/transform/helpers/loadWywOptions.js +33 -4
  60. package/esm/transform/helpers/loadWywOptions.js.map +1 -1
  61. package/esm/transform.js +3 -1
  62. package/esm/transform.js.map +1 -1
  63. package/esm/utils/EventEmitter.js +42 -9
  64. package/esm/utils/EventEmitter.js.map +1 -1
  65. package/esm/utils/applyOxcProcessors/applyOxcProcessors.js +160 -0
  66. package/esm/utils/applyOxcProcessors/applyOxcProcessors.js.map +1 -0
  67. package/esm/utils/applyOxcProcessors/cleanupBindings.js +157 -0
  68. package/esm/utils/applyOxcProcessors/cleanupBindings.js.map +1 -0
  69. package/esm/utils/applyOxcProcessors/cleanupRemovals.js +431 -0
  70. package/esm/utils/applyOxcProcessors/cleanupRemovals.js.map +1 -0
  71. package/esm/utils/applyOxcProcessors/displayName.js +93 -0
  72. package/esm/utils/applyOxcProcessors/displayName.js.map +1 -0
  73. package/esm/utils/applyOxcProcessors/expressionValues.js +152 -0
  74. package/esm/utils/applyOxcProcessors/expressionValues.js.map +1 -0
  75. package/esm/utils/applyOxcProcessors/processorFactory.js +62 -0
  76. package/esm/utils/applyOxcProcessors/processorFactory.js.map +1 -0
  77. package/esm/utils/applyOxcProcessors/processorUsages.js +143 -0
  78. package/esm/utils/applyOxcProcessors/processorUsages.js.map +1 -0
  79. package/esm/utils/applyOxcProcessors/sameFileStaticValues.js +207 -0
  80. package/esm/utils/applyOxcProcessors/sameFileStaticValues.js.map +1 -0
  81. package/esm/utils/applyOxcProcessors/shared.js +29 -0
  82. package/esm/utils/applyOxcProcessors/shared.js.map +1 -0
  83. package/esm/utils/applyOxcProcessors/types.js +2 -0
  84. package/esm/utils/applyOxcProcessors/types.js.map +1 -0
  85. package/esm/utils/applyOxcProcessors.js +1 -1216
  86. package/esm/utils/applyOxcProcessors.js.map +1 -1
  87. package/esm/utils/collectOxcRuntime/normalizeRuntimeCode.js +157 -0
  88. package/esm/utils/collectOxcRuntime/normalizeRuntimeCode.js.map +1 -0
  89. package/esm/utils/collectOxcRuntime/sourceMap.js +36 -0
  90. package/esm/utils/collectOxcRuntime/sourceMap.js.map +1 -0
  91. package/esm/utils/collectOxcRuntime/types.js +2 -0
  92. package/esm/utils/collectOxcRuntime/types.js.map +1 -0
  93. package/esm/utils/collectOxcRuntime.js +5 -193
  94. package/esm/utils/collectOxcRuntime.js.map +1 -1
  95. package/esm/utils/collectOxcTemplateDependencies/expressionExtraction.js +496 -0
  96. package/esm/utils/collectOxcTemplateDependencies/expressionExtraction.js.map +1 -0
  97. package/esm/utils/collectOxcTemplateDependencies/expressionReplacements.js +113 -0
  98. package/esm/utils/collectOxcTemplateDependencies/expressionReplacements.js.map +1 -0
  99. package/esm/utils/collectOxcTemplateDependencies/scopeAnalysis.js +387 -0
  100. package/esm/utils/collectOxcTemplateDependencies/scopeAnalysis.js.map +1 -0
  101. package/esm/utils/collectOxcTemplateDependencies/staticBindings.js +17 -0
  102. package/esm/utils/collectOxcTemplateDependencies/staticBindings.js.map +1 -0
  103. package/esm/utils/collectOxcTemplateDependencies/staticEvaluator.js +540 -0
  104. package/esm/utils/collectOxcTemplateDependencies/staticEvaluator.js.map +1 -0
  105. package/esm/utils/collectOxcTemplateDependencies/types.js +2 -0
  106. package/esm/utils/collectOxcTemplateDependencies/types.js.map +1 -0
  107. package/esm/utils/collectOxcTemplateDependencies.js +3 -1397
  108. package/esm/utils/collectOxcTemplateDependencies.js.map +1 -1
  109. package/esm/utils/nativeResolver.js +93 -0
  110. package/esm/utils/nativeResolver.js.map +1 -0
  111. package/esm/utils/oxc/ast.js +28 -0
  112. package/esm/utils/oxc/ast.js.map +1 -0
  113. package/esm/utils/oxc/parse.js +3 -0
  114. package/esm/utils/oxc/parse.js.map +1 -0
  115. package/esm/utils/oxc/replacements.js +14 -0
  116. package/esm/utils/oxc/replacements.js.map +1 -0
  117. package/esm/utils/oxc/sourceLocations.js +59 -0
  118. package/esm/utils/oxc/sourceLocations.js.map +1 -0
  119. package/esm/utils/oxcPreevalStage/evalStrategy.js +3 -0
  120. package/esm/utils/oxcPreevalStage/evalStrategy.js.map +1 -0
  121. package/esm/utils/oxcPreevalStage/prepareCode.js +21 -0
  122. package/esm/utils/oxcPreevalStage/prepareCode.js.map +1 -0
  123. package/esm/utils/oxcPreevalStage/prevalExport.js +23 -0
  124. package/esm/utils/oxcPreevalStage/prevalExport.js.map +1 -0
  125. package/esm/utils/oxcPreevalStage/processors.js +17 -0
  126. package/esm/utils/oxcPreevalStage/processors.js.map +1 -0
  127. package/esm/utils/oxcPreevalStage/staticOverlay.js +18 -0
  128. package/esm/utils/oxcPreevalStage/staticOverlay.js.map +1 -0
  129. package/esm/utils/oxcPreevalStage/types.js +2 -0
  130. package/esm/utils/oxcPreevalStage/types.js.map +1 -0
  131. package/esm/utils/oxcPreevalStage.js +17 -73
  132. package/esm/utils/oxcPreevalStage.js.map +1 -1
  133. package/esm/utils/oxcPreevalTransforms.js +12 -1
  134. package/esm/utils/oxcPreevalTransforms.js.map +1 -1
  135. package/esm/utils/processorStaticSemantics.js +157 -0
  136. package/esm/utils/processorStaticSemantics.js.map +1 -0
  137. package/esm/utils/resolveWithConditions.js +3 -3
  138. package/esm/utils/resolveWithConditions.js.map +1 -1
  139. package/package.json +4 -3
  140. package/types/cache.js +8 -0
  141. package/types/debug/fileReporter.js +46 -1
  142. package/types/eval/broker.d.ts +6 -2
  143. package/types/eval/broker.js +244 -95
  144. package/types/eval/protocol.d.ts +15 -1
  145. package/types/module.d.ts +4 -1
  146. package/types/module.js +97 -48
  147. package/types/transform/Entrypoint.types.d.ts +3 -0
  148. package/types/transform/generators/resolveImports.d.ts +3 -1
  149. package/types/transform/generators/resolveImports.js +49 -2
  150. package/types/transform/generators/resolveStaticOxcValues/cache.d.ts +25 -0
  151. package/types/transform/generators/resolveStaticOxcValues/cache.js +182 -0
  152. package/types/transform/generators/resolveStaticOxcValues/candidateResolver.d.ts +5 -0
  153. package/types/transform/generators/resolveStaticOxcValues/candidateResolver.js +149 -0
  154. package/types/transform/generators/resolveStaticOxcValues/dependencies.d.ts +6 -0
  155. package/types/transform/generators/resolveStaticOxcValues/dependencies.js +37 -0
  156. package/types/transform/generators/resolveStaticOxcValues/environment.d.ts +12 -0
  157. package/types/transform/generators/resolveStaticOxcValues/environment.js +32 -0
  158. package/types/transform/generators/resolveStaticOxcValues/exportResolver.d.ts +4 -0
  159. package/types/transform/generators/resolveStaticOxcValues/exportResolver.js +358 -0
  160. package/types/transform/generators/resolveStaticOxcValues/exportTargets.d.ts +20 -0
  161. package/types/transform/generators/resolveStaticOxcValues/exportTargets.js +285 -0
  162. package/types/transform/generators/resolveStaticOxcValues/objectAssign.d.ts +41 -0
  163. package/types/transform/generators/resolveStaticOxcValues/objectAssign.js +352 -0
  164. package/types/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.d.ts +6 -0
  165. package/types/transform/generators/resolveStaticOxcValues/objectAssignStaticExport.js +88 -0
  166. package/types/transform/generators/resolveStaticOxcValues/opaqueRuntime.d.ts +13 -0
  167. package/types/transform/generators/resolveStaticOxcValues/opaqueRuntime.js +263 -0
  168. package/types/transform/generators/resolveStaticOxcValues/processorStaticExport.d.ts +4 -0
  169. package/types/transform/generators/resolveStaticOxcValues/processorStaticExport.js +191 -0
  170. package/types/transform/generators/resolveStaticOxcValues/processorStaticModel.d.ts +40 -0
  171. package/types/transform/generators/resolveStaticOxcValues/processorStaticModel.js +516 -0
  172. package/types/transform/generators/resolveStaticOxcValues/processorTarget.d.ts +5 -0
  173. package/types/transform/generators/resolveStaticOxcValues/processorTarget.js +62 -0
  174. package/types/transform/generators/resolveStaticOxcValues/programAnalysis.d.ts +11 -0
  175. package/types/transform/generators/resolveStaticOxcValues/programAnalysis.js +133 -0
  176. package/types/transform/generators/resolveStaticOxcValues/prune.d.ts +15 -0
  177. package/types/transform/generators/resolveStaticOxcValues/prune.js +220 -0
  178. package/types/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.d.ts +2 -0
  179. package/types/transform/generators/resolveStaticOxcValues/resolveStaticOxcPreevalValues.js +197 -0
  180. package/types/transform/generators/resolveStaticOxcValues/staticExpression.d.ts +25 -0
  181. package/types/transform/generators/resolveStaticOxcValues/staticExpression.js +391 -0
  182. package/types/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.d.ts +14 -0
  183. package/types/transform/generators/resolveStaticOxcValues/staticExpressionDependencies.js +304 -0
  184. package/types/transform/generators/resolveStaticOxcValues/types.d.ts +99 -0
  185. package/types/transform/generators/resolveStaticOxcValues/types.js +2 -0
  186. package/types/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.d.ts +7 -0
  187. package/types/transform/generators/resolveStaticOxcValues/zeroArgFunctionStaticExport.js +64 -0
  188. package/types/transform/generators/resolveStaticOxcValues.d.ts +1 -2
  189. package/types/transform/generators/resolveStaticOxcValues.js +1 -3235
  190. package/types/transform/generators/transform.js +63 -49
  191. package/types/transform/helpers/loadWywOptions.js +23 -3
  192. package/types/transform.js +3 -1
  193. package/types/utils/EventEmitter.d.ts +16 -1
  194. package/types/utils/EventEmitter.js +44 -9
  195. package/types/utils/applyOxcProcessors/applyOxcProcessors.d.ts +8 -0
  196. package/types/utils/applyOxcProcessors/applyOxcProcessors.js +167 -0
  197. package/types/utils/applyOxcProcessors/cleanupBindings.d.ts +12 -0
  198. package/types/utils/applyOxcProcessors/cleanupBindings.js +189 -0
  199. package/types/utils/applyOxcProcessors/cleanupRemovals.d.ts +16 -0
  200. package/types/utils/applyOxcProcessors/cleanupRemovals.js +482 -0
  201. package/types/utils/applyOxcProcessors/displayName.d.ts +9 -0
  202. package/types/utils/applyOxcProcessors/displayName.js +113 -0
  203. package/types/utils/applyOxcProcessors/expressionValues.d.ts +11 -0
  204. package/types/utils/applyOxcProcessors/expressionValues.js +170 -0
  205. package/types/utils/applyOxcProcessors/processorFactory.d.ts +7 -0
  206. package/types/utils/applyOxcProcessors/processorFactory.js +70 -0
  207. package/types/utils/applyOxcProcessors/processorUsages.d.ts +16 -0
  208. package/types/utils/applyOxcProcessors/processorUsages.js +163 -0
  209. package/types/utils/applyOxcProcessors/sameFileStaticValues.d.ts +23 -0
  210. package/types/utils/applyOxcProcessors/sameFileStaticValues.js +211 -0
  211. package/types/utils/applyOxcProcessors/shared.d.ts +10 -0
  212. package/types/utils/applyOxcProcessors/shared.js +37 -0
  213. package/types/utils/applyOxcProcessors/types.d.ts +88 -0
  214. package/types/utils/applyOxcProcessors/types.js +1 -0
  215. package/types/utils/applyOxcProcessors.d.ts +1 -16
  216. package/types/utils/applyOxcProcessors.js +1 -1391
  217. package/types/utils/collectOxcRuntime/normalizeRuntimeCode.d.ts +1 -0
  218. package/types/utils/collectOxcRuntime/normalizeRuntimeCode.js +185 -0
  219. package/types/utils/collectOxcRuntime/sourceMap.d.ts +2 -0
  220. package/types/utils/collectOxcRuntime/sourceMap.js +37 -0
  221. package/types/utils/collectOxcRuntime/types.d.ts +16 -0
  222. package/types/utils/collectOxcRuntime/types.js +1 -0
  223. package/types/utils/collectOxcRuntime.d.ts +2 -12
  224. package/types/utils/collectOxcRuntime.js +5 -224
  225. package/types/utils/collectOxcTemplateDependencies/expressionExtraction.d.ts +6 -0
  226. package/types/utils/collectOxcTemplateDependencies/expressionExtraction.js +550 -0
  227. package/types/utils/collectOxcTemplateDependencies/expressionReplacements.d.ts +11 -0
  228. package/types/utils/collectOxcTemplateDependencies/expressionReplacements.js +131 -0
  229. package/types/utils/collectOxcTemplateDependencies/scopeAnalysis.d.ts +20 -0
  230. package/types/utils/collectOxcTemplateDependencies/scopeAnalysis.js +434 -0
  231. package/types/utils/collectOxcTemplateDependencies/staticBindings.d.ts +7 -0
  232. package/types/utils/collectOxcTemplateDependencies/staticBindings.js +13 -0
  233. package/types/utils/collectOxcTemplateDependencies/staticEvaluator.d.ts +13 -0
  234. package/types/utils/collectOxcTemplateDependencies/staticEvaluator.js +626 -0
  235. package/types/utils/collectOxcTemplateDependencies/types.d.ts +116 -0
  236. package/types/utils/collectOxcTemplateDependencies/types.js +1 -0
  237. package/types/utils/collectOxcTemplateDependencies.d.ts +4 -38
  238. package/types/utils/collectOxcTemplateDependencies.js +3 -1580
  239. package/types/utils/nativeResolver.d.ts +13 -0
  240. package/types/utils/nativeResolver.js +91 -0
  241. package/types/utils/oxc/ast.d.ts +4 -0
  242. package/types/utils/oxc/ast.js +37 -0
  243. package/types/utils/oxc/parse.d.ts +3 -0
  244. package/types/utils/oxc/parse.js +2 -0
  245. package/types/utils/oxc/replacements.d.ts +12 -0
  246. package/types/utils/oxc/replacements.js +18 -0
  247. package/types/utils/oxc/sourceLocations.d.ts +5 -0
  248. package/types/utils/oxc/sourceLocations.js +63 -0
  249. package/types/utils/oxcPreevalStage/evalStrategy.d.ts +3 -0
  250. package/types/utils/oxcPreevalStage/evalStrategy.js +2 -0
  251. package/types/utils/oxcPreevalStage/prepareCode.d.ts +3 -0
  252. package/types/utils/oxcPreevalStage/prepareCode.js +20 -0
  253. package/types/utils/oxcPreevalStage/prevalExport.d.ts +1 -0
  254. package/types/utils/oxcPreevalStage/prevalExport.js +22 -0
  255. package/types/utils/oxcPreevalStage/processors.d.ts +10 -0
  256. package/types/utils/oxcPreevalStage/processors.js +16 -0
  257. package/types/utils/oxcPreevalStage/staticOverlay.d.ts +3 -0
  258. package/types/utils/oxcPreevalStage/staticOverlay.js +23 -0
  259. package/types/utils/oxcPreevalStage/types.d.ts +22 -0
  260. package/types/utils/oxcPreevalStage/types.js +1 -0
  261. package/types/utils/oxcPreevalStage.d.ts +2 -18
  262. package/types/utils/oxcPreevalStage.js +17 -79
  263. package/types/utils/oxcPreevalTransforms.js +14 -1
  264. package/types/utils/processorStaticSemantics.d.ts +13 -0
  265. package/types/utils/processorStaticSemantics.js +191 -0
  266. package/types/utils/resolveWithConditions.js +3 -3
  267. package/esm/eval/resolverStrategy.js +0 -51
  268. package/esm/eval/resolverStrategy.js.map +0 -1
  269. package/types/eval/resolverStrategy.d.ts +0 -13
  270. package/types/eval/resolverStrategy.js +0 -46
@@ -1 +1 @@
1
- {"mappings":";;AAEA,OAAO,QAAQ;AACf,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,gBAAgB,qBAAqB;AAC5C,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B,MAAM,SAAS;CACb,YAAY,SAAS;AACnB,OAAK,UAAU,KAAK,IAAI,GAAG,QAAQ;AACnC,OAAK,MAAM,IAAI,KAAK;;CAGtB,IAAI,KAAK;AACP,MAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAE,QAAO;EAC/B,MAAM,QAAQ,KAAK,IAAI,IAAI,IAAI;AAC/B,OAAK,IAAI,OAAO,IAAI;AACpB,OAAK,IAAI,IAAI,KAAK,MAAM;AACxB,SAAO;;CAGT,IAAI,KAAK,OAAO;AACd,MAAI,KAAK,IAAI,IAAI,IAAI,EAAE;AACrB,QAAK,IAAI,OAAO,IAAI;;AAEtB,OAAK,IAAI,IAAI,KAAK,MAAM;AACxB,MAAI,KAAK,IAAI,OAAO,KAAK,SAAS;GAChC,MAAM,WAAW,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;AACxC,OAAI,aAAa,WAAW;AAC1B,SAAK,IAAI,OAAO,SAAS;;;;CAK/B,OAAO,KAAK;AACV,OAAK,IAAI,OAAO,IAAI;;CAGtB,QAAQ;AACN,OAAK,IAAI,OAAO;;;AAIpB,MAAM,aAAa;;AAGnB,MAAM,gBAAgB,cACpB,IAAI,SAAS,EACX,MAAM,OAAO,MAAM,IAAI;CACrB,MAAM,IAAI,WAAW;CACrB,MAAM,IAAI,MAAM,UAAU;;;CAG1B,MAAM,OAAO,EAAE,SAAS,KAAK,GAAG,OAAO;CACvC,MAAM,OAAO,OAAO,EAAE,MAA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ChC,gBAAc,QAAQ;GACtB;EACF;AAEF,QAAQ,MAAM,GAAG,SAAS,SAAS","names":[],"sources":["../../src/eval/runner.js"],"version":3,"sourcesContent":["/* eslint-disable no-underscore-dangle */\n/* global BigInt */\nimport fs from 'node:fs';\nimport { Console } from 'node:console';\nimport { Writable } from 'node:stream';\nimport vm from 'node:vm';\nimport path from 'node:path';\nimport NativeModule, { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\nimport { Minimatch } from 'minimatch';\n\nclass LruCache {\n constructor(maxSize) {\n this.maxSize = Math.max(1, maxSize);\n this.map = new Map();\n }\n\n get(key) {\n if (!this.map.has(key)) return undefined;\n const value = this.map.get(key);\n this.map.delete(key);\n this.map.set(key, value);\n return value;\n }\n\n set(key, value) {\n if (this.map.has(key)) {\n this.map.delete(key);\n }\n this.map.set(key, value);\n if (this.map.size > this.maxSize) {\n const firstKey = this.map.keys().next().value;\n if (firstKey !== undefined) {\n this.map.delete(firstKey);\n }\n }\n }\n\n delete(key) {\n this.map.delete(key);\n }\n\n clear() {\n this.map.clear();\n }\n}\n\nconst NOOP = () => {};\n\n// stdout is reserved for the JSON IPC protocol; host-side logs must not share it.\nconst prefixStream = (getPrefix) =>\n new Writable({\n write(chunk, _enc, cb) {\n const p = getPrefix();\n const s = chunk.toString();\n // Prefix interior newlines but not the trailing one — avoids\n // double-prefix when consecutive writes each start with a prefix.\n const tail = s.endsWith('\\n') ? '\\n' : '';\n const body = tail ? s.slice(0, -1) : s;\n process.stderr.write(p + body.replaceAll('\\n', `\\n${p}`) + tail, cb);\n },\n });\n\n// require'd modules outside vm use host console — must not write to stdout (IPC channel).\nglobal.console = new Console({\n stdout: prefixStream(() => '[wyw-runner:host stdout] '),\n stderr: prefixStream(() => '[wyw-runner:host stderr] '),\n});\n\nconst VITE_VIRTUAL_PREFIX = '/@';\nconst REACT_REFRESH_VIRTUAL_ID = '/@react-refresh';\nconst reactRefreshRuntime = {\n createSignatureFunctionForTransform: () => () => {},\n};\n\nconst builtins = {\n assert: true,\n buffer: true,\n child_process: false,\n cluster: false,\n console: true,\n constants: true,\n crypto: true,\n dgram: false,\n dns: false,\n domain: true,\n events: true,\n fs: false,\n http: true,\n https: true,\n module: false,\n net: false,\n os: true,\n path: true,\n punycode: true,\n process: true,\n querystring: true,\n readline: false,\n repl: false,\n stream: true,\n string_decoder: true,\n sys: true,\n timers: true,\n tls: false,\n tty: true,\n url: true,\n util: true,\n vm: true,\n zlib: true,\n};\n\nconst RESOLVE_CACHE_SIZE = 5000;\nconst LOAD_CACHE_SIZE = 1000;\nconst MODULE_VARIANT_LIMIT = 8;\n\nconst isBuiltinSpecifier = (specifier) => {\n const normalized = specifier.startsWith('node:')\n ? specifier.slice(5)\n : specifier;\n return (\n NativeModule.builtinModules?.includes(normalized) ||\n NativeModule.builtinModules?.includes(`node:${normalized}`)\n );\n};\n\nconst packageTypeCache = new Map();\n\nconst getPackageType = (filename) => {\n let dir = path.dirname(filename);\n while (dir && dir !== path.dirname(dir)) {\n const cached = packageTypeCache.get(dir);\n if (cached === 'module' || cached === 'commonjs') return cached;\n const pkgPath = path.join(dir, 'package.json');\n if (fs.existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));\n const type = pkg?.type === 'module' ? 'module' : 'commonjs';\n packageTypeCache.set(dir, type);\n return type;\n } catch {\n packageTypeCache.set(dir, null);\n return null;\n }\n }\n packageTypeCache.set(dir, null);\n dir = path.dirname(dir);\n }\n return null;\n};\n\nconst shouldPreferImport = (resolvedFile) => {\n if (!resolvedFile) return false;\n if (!path.isAbsolute(resolvedFile)) return false;\n if (resolvedFile.endsWith('.mjs')) return true;\n if (resolvedFile.endsWith('.cjs')) return false;\n if (!resolvedFile.endsWith('.js')) return false;\n return getPackageType(resolvedFile) === 'module';\n};\n\nconst isPlainObject = (value) => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype === null || prototype === Object.prototype) {\n return true;\n }\n\n return Object.getPrototypeOf(prototype) === null;\n};\n\nconst ENCODED_GLOBAL_ENVELOPE_KEY = '__wyw_eval_global';\nconst ENCODED_GLOBAL_SIGNATURE = 'wyw-eval-global';\nconst ENCODED_GLOBAL_VERSION = 1;\nconst IDENTIFIER_RE = /^[A-Za-z_$][\\w$]*$/u;\nconst ARRAY_INDEX_RE = /^(?:0|[1-9]\\d*)$/;\nconst IPC_SUPPORTED_VALUE_HINT =\n 'Use importOverrides to mock the import or return plain data: null, booleans, strings, numbers, bigint, undefined, arrays, plain objects, and Error.';\n\nconst getObjectTypeName = (value) => {\n const { constructor } = value ?? {};\n if (\n constructor &&\n typeof constructor.name === 'string' &&\n constructor.name.length > 0\n ) {\n return constructor.name;\n }\n\n const tag = Object.prototype.toString.call(value);\n return tag.slice(8, -1) || 'Object';\n};\n\nconst getBoxedPrimitiveValue = (value) => {\n const tag = Object.prototype.toString.call(value);\n\n if (tag === '[object String]') {\n return { kind: 'string', value: String(value.valueOf()) };\n }\n\n if (tag === '[object Number]') {\n return { kind: 'number', value: Number(value.valueOf()) };\n }\n\n if (tag === '[object Boolean]') {\n return { kind: 'boolean', value: Boolean(value.valueOf()) };\n }\n\n return null;\n};\n\nconst formatPath = (rootLabel, pathSegments) =>\n pathSegments.reduce((acc, segment) => {\n if (typeof segment === 'number') {\n return `${acc}[${segment}]`;\n }\n\n if (typeof segment === 'symbol') {\n return `${acc}[${String(segment)}]`;\n }\n\n if (IDENTIFIER_RE.test(segment)) {\n return `${acc}.${segment}`;\n }\n\n return `${acc}[${JSON.stringify(segment)}]`;\n }, rootLabel);\n\nconst formatGlobalsPath = (pathSegments) =>\n formatPath('eval.globals', pathSegments);\n\nconst restoreGlobalFunction = (source, pathSegments) => {\n try {\n // eslint-disable-next-line no-eval\n const restored = eval(`(${source})`);\n if (typeof restored !== 'function') {\n throw new TypeError('decoded source is not a function');\n }\n\n return restored;\n } catch (error) {\n throw new Error(\n `[wyw-in-js] Failed to restore eval.globals function at ${formatGlobalsPath(\n pathSegments\n )}. ` +\n `Ensure the value is a user-defined function expression/arrow function. ` +\n `Native and bound functions are not supported. ` +\n `Original error: ${String(error)}`\n );\n }\n};\n\nconst isEncodedGlobalPayload = (value) => {\n if (!isPlainObject(value)) {\n return false;\n }\n\n if (\n value.signature !== ENCODED_GLOBAL_SIGNATURE ||\n value.version !== ENCODED_GLOBAL_VERSION\n ) {\n return false;\n }\n\n if (value.kind === 'function') {\n return typeof value.source === 'string';\n }\n\n if (value.kind === 'symbol') {\n return typeof value.description === 'string';\n }\n\n return false;\n};\n\nconst isEncodedGlobalEnvelope = (value) => {\n if (!isPlainObject(value)) {\n return false;\n }\n\n const keys = Object.keys(value);\n if (keys.length !== 1 || keys[0] !== ENCODED_GLOBAL_ENVELOPE_KEY) {\n return false;\n }\n\n return isEncodedGlobalPayload(value[ENCODED_GLOBAL_ENVELOPE_KEY]);\n};\n\nconst canonicalizeForSignature = (value) => {\n if (Array.isArray(value)) {\n return value.map((item) => canonicalizeForSignature(item));\n }\n\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.keys(value)\n .sort()\n .map((key) => [key, canonicalizeForSignature(value[key])])\n );\n }\n\n return value;\n};\n\nconst decodeGlobals = (value, pathSegments = []) => {\n if (Array.isArray(value)) {\n return value.map((item, index) =>\n decodeGlobals(item, [...pathSegments, index])\n );\n }\n\n if (isEncodedGlobalEnvelope(value)) {\n const payload = value[ENCODED_GLOBAL_ENVELOPE_KEY];\n if (payload.kind === 'function') {\n return restoreGlobalFunction(payload.source, pathSegments);\n }\n\n return Symbol(payload.description);\n }\n\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n decodeGlobals(item, [...pathSegments, key]),\n ])\n );\n }\n\n return value;\n};\n\nconst getEnumerableSymbolKeys = (value) =>\n Object.getOwnPropertySymbols(value).filter((key) =>\n Object.prototype.propertyIsEnumerable.call(value, key)\n );\n\nconst isLikeError = (value) =>\n typeof value === 'object' &&\n value !== null &&\n !isPlainObject(value) &&\n 'message' in value &&\n typeof value.message === 'string' &&\n ('stack' in value || 'name' in value);\n\nconst throwUnsupportedIpcValue = (rootLabel, pathSegments, description) => {\n throw new Error(\n `[wyw-in-js] ${rootLabel} contains ${description} at ${formatPath(\n rootLabel,\n pathSegments\n )}. ${IPC_SUPPORTED_VALUE_HINT}`\n );\n};\n\nconst serializeValueAtPath = (\n value,\n rootLabel,\n pathSegments,\n seen,\n allowFunctions,\n allowSymbols\n) => {\n if (value === null) {\n return { kind: 'null' };\n }\n if (value === undefined) return { kind: 'undefined' };\n if (typeof value === 'boolean') {\n return { kind: 'boolean', value };\n }\n if (typeof value === 'string') {\n return { kind: 'string', value };\n }\n if (typeof value === 'number') {\n if (Number.isNaN(value)) return { kind: 'nan' };\n if (value === Infinity) return { kind: 'infinity' };\n if (value === -Infinity) return { kind: '-infinity' };\n return { kind: 'number', value };\n }\n if (typeof value === 'bigint') {\n return { kind: 'bigint', value: value.toString() };\n }\n if (typeof value === 'function') {\n if (allowFunctions) {\n // __wywPreval consumers only rely on function-ness, not implementation\n // identity. Preserve that signal explicitly instead of letting JSON\n // coerce to null/undefined.\n return { kind: 'function' };\n }\n\n throwUnsupportedIpcValue(\n rootLabel,\n pathSegments,\n 'an unsupported function'\n );\n }\n if (typeof value === 'symbol') {\n if (allowSymbols) {\n return { kind: 'symbol', description: value.description ?? '' };\n }\n\n throwUnsupportedIpcValue(rootLabel, pathSegments, 'an unsupported symbol');\n }\n if (typeof value === 'object' && value !== null) {\n const boxed = getBoxedPrimitiveValue(value);\n if (boxed) {\n if (boxed.kind === 'number') {\n if (Number.isNaN(boxed.value)) return { kind: 'nan' };\n if (boxed.value === Infinity) return { kind: 'infinity' };\n if (boxed.value === -Infinity) return { kind: '-infinity' };\n }\n\n return boxed;\n }\n }\n if (isLikeError(value)) {\n return {\n kind: 'error',\n error: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n\n const currentPath = formatPath(rootLabel, pathSegments);\n const seenAt = seen.get(value);\n if (seenAt) {\n throw new Error(\n `[wyw-in-js] ${rootLabel} contains a circular reference at ${currentPath} (from ${seenAt}). ${IPC_SUPPORTED_VALUE_HINT}`\n );\n }\n\n if (Array.isArray(value)) {\n const symbolKeys = getEnumerableSymbolKeys(value);\n if (symbolKeys.length > 0) {\n throwUnsupportedIpcValue(\n rootLabel,\n [...pathSegments, symbolKeys[0]],\n 'an unsupported symbol-keyed property'\n );\n }\n\n const extraKey = Object.keys(value).find(\n (key) => !ARRAY_INDEX_RE.test(key) || Number(key) >= value.length\n );\n if (extraKey !== undefined) {\n throwUnsupportedIpcValue(\n rootLabel,\n [...pathSegments, extraKey],\n 'an unsupported non-index array property'\n );\n }\n\n seen.set(value, currentPath);\n try {\n return {\n kind: 'array',\n items: Array.from({ length: value.length }, (_, index) =>\n serializeValueAtPath(\n value[index],\n rootLabel,\n [...pathSegments, index],\n seen,\n allowFunctions,\n allowSymbols\n )\n ),\n };\n } finally {\n seen.delete(value);\n }\n }\n\n if (!isPlainObject(value)) {\n throwUnsupportedIpcValue(\n rootLabel,\n pathSegments,\n `an unsupported non-plain object (${getObjectTypeName(value)})`\n );\n }\n\n const symbolKeys = getEnumerableSymbolKeys(value);\n if (symbolKeys.length > 0) {\n throwUnsupportedIpcValue(\n rootLabel,\n [...pathSegments, symbolKeys[0]],\n 'an unsupported symbol-keyed property'\n );\n }\n\n seen.set(value, currentPath);\n try {\n return {\n kind: 'object',\n entries: Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n serializeValueAtPath(\n item,\n rootLabel,\n [...pathSegments, key],\n seen,\n allowFunctions,\n allowSymbols\n ),\n ])\n ),\n };\n } finally {\n seen.delete(value);\n }\n};\n\nconst isErrRequireEsm = (error) =>\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === 'ERR_REQUIRE_ESM';\n\nconst serializeValue = (value, options = {}) =>\n serializeValueAtPath(\n value,\n options.rootLabel ?? 'value',\n options.path ?? [],\n new WeakMap(),\n options.allowFunctions ?? false,\n options.allowSymbols ?? false\n );\n\nconst deserializeValue = (value) => {\n switch (value?.kind) {\n case 'null':\n return null;\n case 'boolean':\n case 'string':\n case 'number':\n return value.value;\n case 'undefined':\n return undefined;\n case 'bigint':\n return BigInt(value.value);\n case 'nan':\n return Number.NaN;\n case 'infinity':\n return Infinity;\n case '-infinity':\n return -Infinity;\n case 'function':\n return () => {};\n case 'symbol':\n // eslint-disable-next-line symbol-description\n return value.description ? Symbol.for(value.description) : Symbol();\n case 'error': {\n const error = new Error(value.error?.message ?? '');\n if (value.error?.name) {\n error.name = value.error.name;\n }\n if (value.error?.stack) {\n error.stack = value.error.stack;\n }\n return error;\n }\n case 'array':\n return value.items.map((item) => deserializeValue(item));\n case 'object':\n return Object.fromEntries(\n Object.entries(value.entries).map(([key, item]) => [\n key,\n deserializeValue(item),\n ])\n );\n case 'value':\n default:\n return value?.value;\n }\n};\n\nconst IMPORT_META_ENV = '__wyw_import_meta_env';\n\nlet importMetaEnvWarned = false;\nlet happyDomLoadWarned = false;\nlet happyDomUnavailable = false;\nlet happyDomImportPromise = null;\nconst debugEnabled = Boolean(process.env.WYW_EVAL_RUNNER_DEBUG);\nconst debug = (...args) => {\n if (!debugEnabled) return;\n // eslint-disable-next-line no-console\n console.warn('[wyw-eval-runner:debug]', ...args);\n};\n\nconst processShim = {\n nextTick: (fn) => setTimeout(fn, 0),\n platform: 'browser',\n arch: 'browser',\n execPath: 'browser',\n title: 'browser',\n pid: 1,\n browser: true,\n argv: [],\n binding() {\n throw new Error('No such module. (Possibly not yet loaded)');\n },\n cwd: () => '/',\n exit: NOOP,\n kill: NOOP,\n chdir: NOOP,\n umask: NOOP,\n dlopen: NOOP,\n uptime: NOOP,\n memoryUsage: NOOP,\n uvCounters: NOOP,\n features: {},\n env: process.env,\n};\n\nconst createImportMetaEnvProxy = () => {\n const target = Object.create(null);\n const warnOnce = () => {\n if (importMetaEnvWarned) return;\n importMetaEnvWarned = true;\n // eslint-disable-next-line no-console\n console.warn(\n [\n `[wyw-in-js] import.meta.env was accessed during build-time evaluation, but no env values were provided.`,\n ``,\n `If you're using Vite, make sure @wyw-in-js/vite plugin is enabled (it injects Vite env for evaluation).`,\n `Otherwise provide \"__wyw_import_meta_env\" via pluginOptions.overrideContext.`,\n ].join('\\n')\n );\n };\n\n return new Proxy(target, {\n get(obj, key) {\n if (typeof key === 'symbol') return Reflect.get(obj, key);\n warnOnce();\n return obj[key];\n },\n has(obj, key) {\n if (typeof key === 'symbol') return Reflect.has(obj, key);\n warnOnce();\n return Reflect.has(obj, key);\n },\n getOwnPropertyDescriptor(obj, key) {\n return Reflect.getOwnPropertyDescriptor(obj, key);\n },\n ownKeys(obj) {\n return Reflect.ownKeys(obj);\n },\n set(obj, key, value) {\n if (typeof key === 'symbol') return Reflect.set(obj, key, value);\n warnOnce();\n return Reflect.set(obj, key, value);\n },\n });\n};\n\nconst HAPPY_DOM_TIMEOUT_MS = Number(\n process.env.WYW_EVAL_HAPPYDOM_INIT_TIMEOUT_MS ??\n process.env.WYW_HAPPYDOM_TIMEOUT_MS ??\n 15000\n);\n\nconst withTimeout = (promise, timeoutMs, label) => {\n if (!timeoutMs || timeoutMs <= 0) return promise;\n let timeoutId;\n const timeout = new Promise((_, reject) => {\n timeoutId = setTimeout(() => {\n const error = new Error(\n `[wyw-in-js] Timed out while waiting for ${label}.`\n );\n error.code = 'WYW_HAPPYDOM_TIMEOUT';\n reject(error);\n }, timeoutMs);\n });\n return Promise.race([promise, timeout]).finally(() => {\n if (timeoutId) clearTimeout(timeoutId);\n });\n};\n\nconst loadHappyDom = async () => {\n if (!happyDomImportPromise) {\n happyDomImportPromise = import('happy-dom');\n }\n return happyDomImportPromise;\n};\n\nconst createWindow = async () => {\n if (happyDomUnavailable) return undefined;\n try {\n debug('happyDom:import:start');\n const importStart = Date.now();\n const { Window, GlobalWindow } = await withTimeout(\n loadHappyDom(),\n HAPPY_DOM_TIMEOUT_MS,\n 'happy-dom import'\n );\n debug('happyDom:import:done', Date.now() - importStart);\n const HappyWindow = GlobalWindow || Window;\n const windowStart = Date.now();\n const win = new HappyWindow();\n debug('happyDom:window:done', Date.now() - windowStart);\n win.Buffer = Buffer;\n win.Uint8Array = Uint8Array;\n return win;\n } catch (error) {\n happyDomUnavailable = true;\n happyDomImportPromise = null;\n if (!happyDomLoadWarned) {\n happyDomLoadWarned = true;\n // eslint-disable-next-line no-console\n console.warn(\n [\n `[wyw-in-js] DOM emulation is enabled (features.happyDOM), but \"happy-dom\" could not be loaded in this build-time runtime.`,\n `WyW will continue without DOM emulation (as if features.happyDOM:false).`,\n ``,\n `To silence this warning: set features: { happyDOM: false }.`,\n `To restore DOM emulation, ensure \"happy-dom\" can be imported in the build-time runtime.`,\n ].join('\\n')\n );\n }\n return undefined;\n }\n};\n\nconst setReferencePropertyIfNotPresent = (context, key) => {\n if (context[key] === context) return;\n context[key] = context;\n};\n\nconst createBaseContext = (win, additionalContext) => {\n const baseContext = win ?? {};\n setReferencePropertyIfNotPresent(baseContext, 'window');\n setReferencePropertyIfNotPresent(baseContext, 'self');\n setReferencePropertyIfNotPresent(baseContext, 'top');\n setReferencePropertyIfNotPresent(baseContext, 'parent');\n setReferencePropertyIfNotPresent(baseContext, 'global');\n setReferencePropertyIfNotPresent(baseContext, 'process');\n\n baseContext.document = win?.document;\n baseContext.process = processShim;\n\n baseContext.clearImmediate = NOOP;\n baseContext.clearInterval = NOOP;\n baseContext.clearTimeout = NOOP;\n baseContext.setImmediate = NOOP;\n baseContext.requestAnimationFrame = NOOP;\n baseContext.setInterval = NOOP;\n baseContext.setTimeout = NOOP;\n\n Object.assign(baseContext, additionalContext);\n return baseContext;\n};\n\nconst featureMatchers = new Map();\n\nconst isFeatureEnabled = (features, featureName, filename) => {\n const value = features?.[featureName] ?? false;\n if (typeof value === 'boolean') return value;\n if (value === '*' || value === '**/*') return true;\n\n const array = Array.isArray(value) ? value : [value];\n return array\n .map((pattern) => {\n let matcher = featureMatchers.get(pattern);\n if (!matcher) {\n matcher = [pattern.startsWith('!'), new Minimatch(pattern)];\n featureMatchers.set(pattern, matcher);\n }\n return [matcher[0], matcher[1].match(filename)];\n })\n .reduce(\n (acc, [negated, match]) => (negated ? acc && match : acc || match),\n false\n );\n};\n\nconst createVmContext = async (filename, features, globals) => {\n const isHappyDomEnabled = isFeatureEnabled(features, 'happyDOM', filename);\n const win = isHappyDomEnabled ? await createWindow() : undefined;\n const envContext = {\n [IMPORT_META_ENV]: createImportMetaEnvProxy(),\n };\n const baseContext = createBaseContext(win, {\n __filename: filename,\n ...envContext,\n ...globals,\n });\n // Evaluated code must never write to stdout — it is the IPC channel.\n const vmIdent = () => `vm(${path.basename(baseContext.__filename ?? '?')})`;\n baseContext.console = new Console({\n stdout: prefixStream(() => `[wyw-runner:${vmIdent()} stdout] `),\n stderr: prefixStream(() => `[wyw-runner:${vmIdent()} stderr] `),\n });\n const context = vm.createContext(baseContext);\n return {\n context,\n teardown: () => {\n if (win?.happyDOM) {\n win.happyDOM.abort();\n }\n },\n };\n};\n\nconst stripQueryAndHash = (value) =>\n value.split('?')[0]?.split('#')[0] ?? value;\n\nconst normalizeResolvedId = (resolvedId, specifier, importer, extensions) => {\n const stripped = stripQueryAndHash(resolvedId);\n if (!stripped) return resolvedId;\n if (path.extname(stripped)) return resolvedId;\n\n const isFileSpecifier =\n specifier.startsWith('.') || path.isAbsolute(specifier);\n if (!isFileSpecifier && !path.isAbsolute(stripped)) {\n return resolvedId;\n }\n\n let candidate = stripped;\n if (!path.isAbsolute(candidate)) {\n if (!importer) {\n return resolvedId;\n }\n const importerFile = stripQueryAndHash(importer);\n candidate = path.resolve(path.dirname(importerFile), candidate);\n }\n\n const suffix = resolvedId.slice(stripped.length);\n const resolvedExtensions = extensions ?? [];\n for (let index = 0; index < resolvedExtensions.length; index += 1) {\n const ext = resolvedExtensions[index];\n const fileCandidate = `${candidate}${ext}`;\n if (fs.existsSync(fileCandidate)) {\n return `${fileCandidate}${suffix}`;\n }\n\n const indexCandidate = path.join(candidate, `index${ext}`);\n if (fs.existsSync(indexCandidate)) {\n return `${indexCandidate}${suffix}`;\n }\n }\n\n if (importer) {\n try {\n const importerFile = stripQueryAndHash(importer);\n const nodeRequire = createRequire(pathToFileURL(importerFile).href);\n const resolved = nodeRequire.resolve(stripQueryAndHash(specifier));\n if (resolved && resolved !== stripped) {\n return `${resolved}${suffix}`;\n }\n } catch {\n // ignore fallback failures\n }\n }\n\n return resolvedId;\n};\n\nconst isNodeModulesId = (id) => {\n if (!id) return false;\n const normalized = stripQueryAndHash(id).replace(/\\\\/g, '/');\n return normalized.includes('/node_modules/');\n};\n\nconst mergeOnly = (current, next) => {\n if (!current || current.length === 0) return next ?? [];\n if (!next || next.length === 0) return current;\n if (current.includes('*') || next.includes('*')) {\n return ['*'];\n }\n return Array.from(new Set([...current, ...next]));\n};\n\nconst toCanonicalFileKey = (resolved, root) => {\n const rootDir = root ? path.resolve(root) : process.cwd();\n const normalizedResolved = path.resolve(resolved);\n let relative = path.relative(rootDir, normalizedResolved);\n\n if (path.sep !== path.posix.sep) {\n relative = relative.split(path.sep).join(path.posix.sep);\n }\n\n if (!relative.startsWith('.')) {\n relative = `./${relative}`;\n }\n\n return relative;\n};\n\nconst toImportKey = ({ source, resolved, root }) => {\n const isFileImport = source.startsWith('.') || path.isAbsolute(source);\n if (isFileImport && resolved) {\n return { key: toCanonicalFileKey(resolved, root), kind: 'file' };\n }\n return { key: source, kind: 'package' };\n};\n\nconst minimatchOptions = {\n dot: true,\n nocomment: true,\n nonegate: true,\n};\n\nconst compileImportOverrides = (importOverrides) => {\n const matchers = Object.entries(importOverrides)\n .map(([pattern, override]) => ({\n matcher: new Minimatch(pattern, minimatchOptions),\n override,\n pattern,\n }))\n .sort((a, b) => b.pattern.length - a.pattern.length);\n\n return { matchers };\n};\n\nconst compiledOverridesCache = new WeakMap();\n\nconst getImportOverride = (importOverrides, key) => {\n if (!importOverrides) return undefined;\n const direct = importOverrides[key];\n if (direct) return direct;\n\n let compiled = compiledOverridesCache.get(importOverrides);\n if (!compiled) {\n compiled = compileImportOverrides(importOverrides);\n compiledOverridesCache.set(importOverrides, compiled);\n }\n\n return compiled.matchers.find(({ matcher }) => matcher.match(key))?.override;\n};\n\nconst resolveMockSpecifier = ({ mock, importer, root }) => {\n const specifier =\n mock.startsWith('.') && root ? path.resolve(root, mock) : mock;\n const nodeRequire = createRequire(pathToFileURL(importer).href);\n return nodeRequire.resolve(specifier);\n};\n\nconst state = {\n context: null,\n teardown: null,\n happyDomEnabled: null,\n globalsSignature: null,\n evalOptions: {\n mode: 'strict',\n require: 'warn-and-run',\n globals: {},\n importOverrides: undefined,\n root: undefined,\n extensions: [],\n },\n features: {},\n entrypoint: 'eval-runner',\n};\n\nconst moduleCache = new LruCache(LOAD_CACHE_SIZE);\nconst moduleHashes = new Map();\nconst moduleData = new Map();\nconst moduleOnly = new Map();\nconst moduleVariants = new Map();\nconst moduleLastVariant = new Map();\nconst linkPromises = new Map();\nconst loadInFlight = new Map();\nconst externalInFlight = new Map();\nconst resolveCache = new LruCache(RESOLVE_CACHE_SIZE);\nconst resolveInFlight = new Map();\n\nconst pending = new Map();\nconst loadResultChunks = new Map();\nlet nextId = 0;\nconst stdoutWriteQueue = [];\nlet stdoutWriteInFlight = false;\nlet stdoutWriteFailed = null;\nlet shutdownRequested = false;\nlet shutdownFinished = false;\n\nconst resetModuleState = () => {\n moduleCache.clear();\n moduleHashes.clear();\n moduleData.clear();\n moduleOnly.clear();\n moduleVariants.clear();\n moduleLastVariant.clear();\n linkPromises.clear();\n loadInFlight.clear();\n externalInFlight.clear();\n resolveInFlight.clear();\n resolveCache.clear();\n sentNamespaceIdentifiers.clear();\n};\n\n// Tracks the SourceTextModule identifier (versioned with hash) that was last\n// included in an EVAL_RESULT for each id. Reused module variants don't need\n// re-serialization across eval sessions — same variant = same namespace =\n// same exports the broker already has cached.\nconst sentNamespaceIdentifiers = new Map();\n\nconst resetSingleModuleState = (id, cachedModule = moduleCache.get(id)) => {\n if (cachedModule) {\n linkPromises.delete(cachedModule);\n }\n\n const variants = moduleVariants.get(id);\n if (variants) {\n variants.forEach((variant) => linkPromises.delete(variant));\n }\n\n moduleCache.delete(id);\n moduleHashes.delete(id);\n moduleData.delete(id);\n moduleVariants.delete(id);\n moduleLastVariant.delete(id);\n};\n\nconst isFullModuleLoad = (loaded) =>\n !loaded.only || (loaded.only.length === 1 && loaded.only[0] === '*');\n\nconst getModuleVariant = (id, hash) => moduleVariants.get(id)?.get(hash);\n\nconst setModuleVariant = (id, hash, module) => {\n let variants = moduleVariants.get(id);\n if (!variants) {\n variants = new Map();\n moduleVariants.set(id, variants);\n }\n variants.set(hash, module);\n moduleLastVariant.set(id, module);\n\n if (variants.size > MODULE_VARIANT_LIMIT) {\n const oldestHash = variants.keys().next().value;\n if (oldestHash !== undefined) {\n const oldest = variants.get(oldestHash);\n if (oldest) {\n linkPromises.delete(oldest);\n }\n variants.delete(oldestHash);\n }\n }\n};\n\nconst toSourceModuleId = (id) => stripQueryAndHash(String(id));\n\nconst toVersionedModuleIdentifier = (id, hash) => {\n if (!hash) return id;\n const separator = id.includes('?') ? '&' : '?';\n return `${id}${separator}wyw-hash=${hash}`;\n};\n\nconst resetEvaluationState = () => {\n if (state.teardown) {\n state.teardown();\n }\n state.context = null;\n state.teardown = null;\n state.happyDomEnabled = null;\n state.globalsSignature = null;\n resetModuleState();\n};\n\nconst normalizeWriteError = (label, error) => {\n if (error instanceof Error) {\n return error;\n }\n\n return new Error(`[wyw-in-js] Failed to write to ${label}: ${String(error)}`);\n};\n\nconst keepAlive = setInterval(() => {}, 60_000);\n\nconst finishShutdown = (exitCode = 0) => {\n if (shutdownFinished) {\n return;\n }\n\n shutdownFinished = true;\n clearInterval(keepAlive);\n if (state.teardown) {\n state.teardown();\n }\n process.exit(exitCode);\n};\n\nconst flushStdoutWriteQueue = () => {\n if (stdoutWriteInFlight || stdoutWriteFailed) {\n return;\n }\n\n const next = stdoutWriteQueue.shift();\n if (!next) {\n if (shutdownRequested) {\n finishShutdown(0);\n }\n return;\n }\n\n stdoutWriteInFlight = true;\n let settled = false;\n let writeCompleted = false;\n let drainCompleted = true;\n let onClose;\n let onDrain;\n let onError;\n\n const cleanup = () => {\n process.stdout.off('close', onClose);\n process.stdout.off('drain', onDrain);\n process.stdout.off('error', onError);\n };\n\n const finish = (error) => {\n if (settled) {\n return;\n }\n\n if (error) {\n settled = true;\n stdoutWriteInFlight = false;\n cleanup();\n stdoutWriteFailed = normalizeWriteError('eval runner stdout', error);\n next.reject(stdoutWriteFailed);\n while (stdoutWriteQueue.length > 0) {\n stdoutWriteQueue.shift().reject(stdoutWriteFailed);\n }\n process.stderr.write(`[wyw-eval-runner] ${stdoutWriteFailed.message}\\n`);\n finishShutdown(1);\n return;\n }\n\n if (!writeCompleted || !drainCompleted) {\n return;\n }\n\n settled = true;\n stdoutWriteInFlight = false;\n cleanup();\n next.resolve();\n flushStdoutWriteQueue();\n };\n\n onClose = () => {\n finish(\n new Error('eval runner stdout closed before pending write completed')\n );\n };\n\n onDrain = () => {\n drainCompleted = true;\n finish();\n };\n\n onError = (error) => {\n finish(error);\n };\n\n process.stdout.once('close', onClose);\n process.stdout.once('error', onError);\n\n const needsDrain = !process.stdout.write(next.chunk, (error) => {\n writeCompleted = true;\n if (error) {\n finish(error);\n return;\n }\n\n finish();\n });\n\n if (needsDrain) {\n drainCompleted = false;\n process.stdout.once('drain', onDrain);\n }\n};\n\nconst queueStdoutWrite = (chunk) =>\n new Promise((resolve, reject) => {\n if (stdoutWriteFailed) {\n reject(stdoutWriteFailed);\n return;\n }\n\n stdoutWriteQueue.push({ chunk, resolve, reject });\n flushStdoutWriteQueue();\n });\n\nconst sendMessage = (message) => {\n queueStdoutWrite(`${JSON.stringify(message)}\\n`).catch(() => {});\n};\n\nconst shutdown = () => {\n shutdownRequested = true;\n if (!stdoutWriteInFlight && stdoutWriteQueue.length === 0) {\n finishShutdown(0);\n }\n};\n\nconst sendWarn = (warning) => {\n sendMessage({ type: 'WARN', payload: warning });\n};\n\nconst serializeError = (error) => {\n const result = {\n message: error?.message ?? String(error),\n stack: error?.stack,\n };\n if (error?.cause instanceof Error) {\n result.cause = serializeError(error.cause);\n }\n return result;\n};\n\nconst request = (type, payload) => {\n nextId += 1;\n const id = `${nextId}`;\n sendMessage({ type, id, payload });\n return new Promise((resolve, reject) => {\n pending.set(id, { resolve, reject });\n });\n};\n\nconst resolvePending = (id, payload) => {\n const pendingItem = pending.get(id);\n if (!pendingItem) return;\n pending.delete(id);\n pendingItem.resolve(payload);\n};\n\nconst handleLoadResult = (id, payload) => {\n if (\n !payload ||\n typeof payload.codeChunk !== 'string' ||\n typeof payload.chunkIndex !== 'number' ||\n typeof payload.chunkCount !== 'number'\n ) {\n resolvePending(id, payload);\n return;\n }\n\n let entry = loadResultChunks.get(id);\n if (!entry) {\n entry = {\n chunks: new Array(payload.chunkCount),\n received: 0,\n meta: null,\n };\n loadResultChunks.set(id, entry);\n }\n\n if (!entry.chunks[payload.chunkIndex]) {\n entry.received += 1;\n }\n entry.chunks[payload.chunkIndex] = payload.codeChunk;\n\n if (payload.chunkIndex === 0) {\n const { codeChunk, chunkIndex, chunkCount, ...meta } = payload;\n entry.meta = meta;\n }\n\n if (entry.received >= payload.chunkCount) {\n const code = entry.chunks.join('');\n const finalPayload = {\n ...(entry.meta ?? {}),\n code,\n };\n loadResultChunks.delete(id);\n resolvePending(id, finalPayload);\n }\n};\n\nconst buildPreamble = (id) =>\n [\n `const __wyw_module = __wyw_getModule(${JSON.stringify(id)});`,\n `let exports = __wyw_module.exports;`,\n `const module = __wyw_module.module;`,\n `const require = __wyw_module.require;`,\n `const __filename = __wyw_module.filename;`,\n `const __dirname = __wyw_module.dirname;`,\n `const __wyw_dynamic_import = __wyw_module.dynamicImport;`,\n ``,\n ].join('\\n');\n\nconst getImporterPackage = (importer) => {\n const normalized = importer.replace(/\\\\/g, '/');\n const marker = '/node_modules/';\n const idx = normalized.lastIndexOf(marker);\n if (idx === -1) return path.basename(importer);\n const rest = normalized.slice(idx + marker.length);\n if (rest.startsWith('@')) {\n const [scope, name] = rest.split('/').slice(0, 2);\n return `${scope}/${name}`;\n }\n return rest.split('/')[0];\n};\n\nconst warnedRequires = new Set();\n\nconst createRequireFn = (importer) => {\n const importerFile = stripQueryAndHash(importer);\n const nodeRequire = createRequire(pathToFileURL(importerFile).href);\n\n return (specifier, nonLiteralOrResolved, maybeResolved) => {\n const hasNonLiteralFlag = typeof nonLiteralOrResolved === 'boolean';\n const nonLiteral = hasNonLiteralFlag ? nonLiteralOrResolved : false;\n const resolvedOverride = hasNonLiteralFlag\n ? maybeResolved\n : nonLiteralOrResolved;\n const hasResolvedOverride =\n typeof resolvedOverride === 'string' && resolvedOverride.length > 0;\n if (state.evalOptions.require === 'off') {\n throw new Error(\n `[wyw-in-js] require() fallback is disabled by eval.require: 'off'.`\n );\n }\n\n if (nonLiteral || typeof specifier !== 'string') {\n if (state.evalOptions.mode === 'strict') {\n throw new Error(\n `[wyw-in-js] Non-literal require() is not supported during eval.\\n` +\n `importer: ${importerFile}\\n` +\n `hint: make it a string literal or mock the import via importOverrides.`\n );\n }\n\n sendWarn({\n code: 'require-error',\n message:\n '[wyw-in-js] Non-literal require() reached during eval (loose mode).',\n importer: importerFile,\n });\n return {};\n }\n\n if (specifier === REACT_REFRESH_VIRTUAL_ID) {\n return reactRefreshRuntime;\n }\n\n if (\n specifier.startsWith(VITE_VIRTUAL_PREFIX) ||\n specifier.startsWith('virtual:')\n ) {\n return {};\n }\n\n const normalized = specifier.startsWith('node:')\n ? specifier.slice(5)\n : specifier;\n if (\n NativeModule.builtinModules?.includes(normalized) ||\n NativeModule.builtinModules?.includes(`node:${normalized}`)\n ) {\n if (normalized in builtins) {\n if (builtins[normalized]) {\n return nodeRequire(normalized);\n }\n return null;\n }\n }\n\n const extensions = NativeModule._extensions;\n const added = [];\n\n try {\n state.evalOptions.extensions?.forEach((ext) => {\n if (ext === '.cjs' || ext === '.mjs') return;\n if (ext in extensions) return;\n extensions[ext] = NOOP;\n added.push(ext);\n });\n\n let resolved = hasResolvedOverride\n ? stripQueryAndHash(resolvedOverride)\n : nodeRequire.resolve(stripQueryAndHash(specifier));\n\n const isFileSpecifier =\n specifier.startsWith('.') || path.isAbsolute(specifier);\n if (\n isFileSpecifier &&\n path.extname(specifier) === '' &&\n resolved.endsWith('.cjs')\n ) {\n const candidate = `${resolved.slice(0, -4)}.js`;\n if (fs.existsSync(candidate)) {\n resolved = candidate;\n }\n }\n\n const keyInfo = toImportKey({\n source: specifier,\n resolved,\n root: state.evalOptions.root,\n });\n const override = getImportOverride(\n state.evalOptions.importOverrides,\n keyInfo.key\n );\n\n let finalResolved = resolved;\n if (override?.mock) {\n finalResolved = resolveMockSpecifier({\n mock: override.mock,\n importer: importerFile,\n root: state.evalOptions.root,\n stack: [importerFile],\n });\n }\n\n const basePolicy =\n state.evalOptions.require === 'warn-and-run' ? 'warn' : 'error';\n let policy = override?.unknown ?? (override ? 'allow' : basePolicy);\n if (state.evalOptions.require === 'off' && policy !== 'error') {\n policy = 'error';\n }\n\n if (policy === 'error') {\n throw new Error(\n [\n `[wyw-in-js] require() fallback reached during eval but eval.require='error'.`,\n ``,\n `importer: ${importerFile}`,\n `source: ${specifier}`,\n `hint: add importOverrides or set eval.require to \"warn-and-run\".`,\n ].join('\\n')\n );\n }\n\n if (policy === 'warn') {\n const key = `${specifier}::${getImporterPackage(importerFile)}`;\n if (!warnedRequires.has(key)) {\n warnedRequires.add(key);\n sendWarn({\n code: 'require-fallback',\n message: [\n `[wyw-in-js] Runtime require() fallback during eval`,\n ``,\n `importer: ${importerFile}`,\n `source: ${specifier}`,\n `resolved: ${resolved}`,\n override?.mock\n ? `mock: ${override.mock} -> ${finalResolved}`\n : ``,\n ``,\n `hint: use importOverrides to mock runtime-only deps and avoid eval-time requires.`,\n ]\n .filter(Boolean)\n .join('\\n'),\n importer: importerFile,\n specifier,\n resolved,\n });\n }\n }\n\n return nodeRequire(finalResolved);\n } finally {\n added.forEach((ext) => delete extensions[ext]);\n }\n };\n};\n\nfunction createSyntheticModule(id, exportsValue, cache = true) {\n const exportNames = new Set(Object.keys(exportsValue));\n if (!exportNames.has('default')) {\n exportNames.add('default');\n }\n\n const module = new vm.SyntheticModule(\n [...exportNames],\n function init() {\n exportNames.forEach((key) => {\n const value =\n key === 'default' ? exportsValue.default : exportsValue[key];\n this.setExport(key, value);\n });\n },\n { context: state.context, identifier: id }\n );\n\n if (cache) {\n moduleCache.set(id, module);\n }\n return module;\n}\n\nconst toSyntheticExports = (value) => {\n if (value && (typeof value === 'object' || typeof value === 'function')) {\n const exportsValue = {};\n Object.keys(value).forEach((key) => {\n exportsValue[key] = value[key];\n });\n exportsValue.default =\n Object.prototype.hasOwnProperty.call(value, 'default') ||\n Object.prototype.hasOwnProperty.call(exportsValue, 'default')\n ? value.default\n : value;\n return exportsValue;\n }\n return { default: value };\n};\n\nconst loadExternalModule = async (resolvedId, importer, specifier) => {\n const cacheId = resolvedId ?? specifier;\n const cached = moduleCache.get(cacheId);\n if (cached) return cached;\n\n const inFlight = externalInFlight.get(cacheId);\n if (inFlight) return inFlight;\n\n const task = (async () => {\n const start = Date.now();\n debug('external:start', { specifier, resolvedId, importer });\n const requireFn = createRequireFn(importer);\n let value;\n let hasValue = false;\n const resolvedFile = resolvedId ? stripQueryAndHash(resolvedId) : null;\n const importTarget =\n resolvedFile && path.isAbsolute(resolvedFile)\n ? pathToFileURL(resolvedFile).href\n : specifier;\n\n if (shouldPreferImport(resolvedFile)) {\n value = await import(importTarget);\n hasValue = true;\n }\n if (!hasValue) {\n try {\n value = requireFn(specifier, resolvedId ?? null);\n hasValue = true;\n } catch (error) {\n if (!isErrRequireEsm(error)) {\n throw error;\n }\n\n const isFileSpecifier =\n specifier.startsWith('.') || path.isAbsolute(specifier);\n const isPackageSpecifier =\n !isFileSpecifier && !isBuiltinSpecifier(specifier);\n if (resolvedId && isPackageSpecifier) {\n try {\n value = requireFn(specifier, null);\n hasValue = true;\n } catch (retryError) {\n if (!isErrRequireEsm(retryError)) {\n throw retryError;\n }\n }\n }\n\n if (!hasValue) {\n value = await import(importTarget);\n hasValue = true;\n }\n }\n }\n\n const module = createSyntheticModule(cacheId, toSyntheticExports(value));\n debug('external:done', {\n specifier,\n resolvedId,\n durationMs: Date.now() - start,\n });\n return module;\n })();\n\n externalInFlight.set(cacheId, task);\n try {\n return await task;\n } finally {\n externalInFlight.delete(cacheId);\n }\n};\n\nlet resolveModule;\nlet loadModule;\n\nconst linkModule = async (module) => {\n const cached = linkPromises.get(module);\n if (cached) return cached;\n if (module.status !== 'unlinked') return module;\n const linking = (async () => {\n try {\n await module.link((specifier, referencingModule) =>\n resolveModule(specifier, referencingModule.identifier, 'import')\n );\n return module;\n } catch (error) {\n // ERR_VM_MODULE_LINK_FAILURE means a dependency is in \"errored\" state.\n // Node chains .cause through the link failure hierarchy. Walk to the\n // deepest cause to surface the original evaluation error (e.g. a\n // TypeError in user code), not intermediate \"resolved to errored\" hops.\n if (error?.code === 'ERR_VM_MODULE_LINK_FAILURE') {\n let rootCause = error;\n while (rootCause.cause instanceof Error) {\n rootCause = rootCause.cause;\n }\n if (rootCause !== error) {\n const enhanced = new Error(\n `${error.message}\\n` +\n ` Root cause: ${rootCause.name ?? 'Error'}: ${rootCause.message}`\n );\n enhanced.cause = rootCause;\n throw enhanced;\n }\n }\n throw error;\n } finally {\n linkPromises.delete(module);\n }\n })();\n linkPromises.set(module, linking);\n return linking;\n};\n\nresolveModule = async (specifier, importer, kind) => {\n const importerId = toSourceModuleId(importer);\n if (process.env.WYW_DEBUG_EVAL_RESOLVE) {\n process.stderr.write(\n `[wyw-eval-runner:resolve] ${JSON.stringify({\n specifier,\n importer: importerId,\n kind,\n })}\\n`\n );\n }\n if (specifier === REACT_REFRESH_VIRTUAL_ID) {\n return createSyntheticModule(specifier, reactRefreshRuntime);\n }\n\n if (\n specifier.startsWith(VITE_VIRTUAL_PREFIX) ||\n specifier.startsWith('virtual:')\n ) {\n return createSyntheticModule(specifier, { default: {} });\n }\n\n const key = `${kind}:${importerId}:${specifier}`;\n const cached = resolveCache.get(key);\n if (cached) {\n if (!cached.resolvedId) {\n if (state.evalOptions.mode === 'loose') {\n return createSyntheticModule(specifier, { default: undefined });\n }\n throw new Error(\n [\n `[wyw-in-js] Unable to resolve \"${specifier}\" during evaluation.`,\n ``,\n `importer: ${importerId}`,\n `hint: check eval.resolver/customResolver or add importOverrides for this specifier.`,\n ].join('\\n')\n );\n }\n\n const treatExternal =\n cached.external ||\n isBuiltinSpecifier(specifier) ||\n isNodeModulesId(cached.resolvedId);\n\n if (treatExternal) {\n const normalized = normalizeResolvedId(\n cached.resolvedId,\n specifier,\n importerId,\n state.evalOptions.extensions\n );\n const externalModule = await loadExternalModule(\n normalized,\n importerId,\n specifier\n );\n return externalModule;\n }\n\n const normalized = normalizeResolvedId(\n cached.resolvedId,\n specifier,\n importerId,\n state.evalOptions.extensions\n );\n return loadModule(normalized, importerId, specifier);\n }\n\n const inFlight = resolveInFlight.get(key);\n if (inFlight) return inFlight;\n\n const task = (async () => {\n const resolved = await request('RESOLVE', {\n specifier,\n importerId,\n kind,\n });\n\n if (resolved.error) {\n throw new Error(resolved.error.message);\n }\n\n const normalized = resolved.resolvedId\n ? normalizeResolvedId(\n resolved.resolvedId,\n specifier,\n importerId,\n state.evalOptions.extensions\n )\n : resolved.resolvedId;\n if (process.env.WYW_DEBUG_EVAL_RESOLVE) {\n process.stderr.write(\n `[wyw-eval-runner:resolved] ${JSON.stringify({\n specifier,\n importer: importerId,\n resolved: resolved.resolvedId ?? null,\n normalized: normalized ?? null,\n external: Boolean(resolved.external),\n })}\\n`\n );\n }\n\n resolveCache.set(key, {\n resolvedId: normalized,\n external: Boolean(resolved.external),\n });\n\n if (!normalized) {\n if (state.evalOptions.mode === 'loose') {\n return createSyntheticModule(specifier, { default: undefined });\n }\n throw new Error(\n [\n `[wyw-in-js] Unable to resolve \"${specifier}\" during evaluation.`,\n ``,\n `importer: ${importerId}`,\n `hint: check eval.resolver/customResolver or add importOverrides for this specifier.`,\n ].join('\\n')\n );\n }\n\n const treatExternal =\n resolved.external ||\n isBuiltinSpecifier(specifier) ||\n isNodeModulesId(normalized);\n\n if (treatExternal) {\n return loadExternalModule(normalized, importerId, specifier);\n }\n\n return loadModule(normalized, importerId, specifier);\n })();\n\n resolveInFlight.set(key, task);\n try {\n return await task;\n } finally {\n resolveInFlight.delete(key);\n }\n};\n\nloadModule = async (id, importer, requestSpec) => {\n let cached = moduleCache.get(id);\n const inFlight = loadInFlight.get(id);\n if (inFlight) {\n await inFlight;\n cached = moduleCache.get(id);\n }\n\n const task = (async () => {\n const loadStart = Date.now();\n const loaded = await request('LOAD', {\n id,\n importerId: importer,\n request: requestSpec ?? null,\n });\n debug('load:done', {\n id,\n importer,\n durationMs: Date.now() - loadStart,\n });\n if (loaded.error) {\n throw new Error(loaded.error.message);\n }\n\n if (loaded.only) {\n const current = moduleOnly.get(id) ?? [];\n moduleOnly.set(id, mergeOnly(current, loaded.only));\n }\n\n if (loaded.exports) {\n // Serialized exports are a narrow slice — only the keys the importer\n // requested. If we have a fully evaluated module (in moduleCache or as\n // a variant), prefer it: its namespace has ALL exports, so any consumer\n // can link against it without \"does not provide export\" errors.\n //\n // An evaluated variant is only safe to reuse when its namespace covers\n // the serialized key set. A narrow variant that was evaluated first may\n // lack exports that a wider consumer needs (the 4df6e915 race).\n const requiredKeys = Object.keys(loaded.exports);\n const coversKeys = (mod) => {\n const ns = mod.namespace;\n return requiredKeys.every((k) => k in ns);\n };\n\n let evaluated =\n cached && cached.status === 'evaluated' && coversKeys(cached)\n ? cached\n : undefined;\n\n if (!evaluated) {\n const variants = moduleVariants.get(id);\n if (variants) {\n for (const variant of variants.values()) {\n if (variant.status === 'evaluated' && coversKeys(variant)) {\n evaluated = variant;\n break;\n }\n }\n }\n }\n\n if (evaluated) {\n return evaluated;\n }\n\n // Reuse a previously created SyntheticModule for this exact serialized set\n if (loaded.hash) {\n const existing = getModuleVariant(id, loaded.hash);\n if (existing) {\n return existing;\n }\n }\n\n const exportsValue = {};\n Object.entries(loaded.exports).forEach(([key, serialized]) => {\n exportsValue[key] = deserializeValue(serialized);\n });\n const module = createSyntheticModule(id, exportsValue, false);\n if (loaded.hash) {\n setModuleVariant(id, loaded.hash, module);\n }\n return module;\n }\n\n const usePrimaryCache = isFullModuleLoad(loaded);\n if (usePrimaryCache) {\n if (cached && loaded.hash && moduleHashes.get(id) === loaded.hash) {\n return cached;\n }\n } else if (loaded.hash) {\n const variant = getModuleVariant(id, loaded.hash);\n if (variant) {\n return variant;\n }\n }\n\n // The broker only ships empty `code` when it expects the runner to reuse\n // a cached module via the hash-match short-circuit above. Reaching this\n // point with no code means the broker's \"what runner has\" mirror is out\n // of sync with our actual moduleCache/moduleVariants — fail loudly rather\n // than feeding empty source into vm.SourceTextModule.\n if (loaded.code == null || loaded.code === '') {\n throw new Error(\n `[wyw-in-js] LoadResult for ${id} has empty code but no cached module ` +\n `matched hash ${loaded.hash ?? '(none)'}. ` +\n `This indicates a broker/runner cache desync.`\n );\n }\n\n if (usePrimaryCache) {\n resetSingleModuleState(id, cached);\n }\n\n const module = new vm.SourceTextModule(\n `${buildPreamble(id)}${loaded.code ?? ''}`,\n {\n context: state.context,\n identifier: toVersionedModuleIdentifier(id, loaded.hash),\n initializeImportMeta(meta, targetModule) {\n const identifier =\n typeof targetModule.identifier === 'string'\n ? targetModule.identifier\n : id;\n const fileId = stripQueryAndHash(identifier);\n // eslint-disable-next-line no-param-reassign\n meta.url = path.isAbsolute(fileId)\n ? pathToFileURL(fileId).href\n : fileId;\n },\n importModuleDynamically(specifier, referencingModule) {\n return resolveModule(\n specifier,\n referencingModule.identifier,\n 'dynamic-import'\n );\n },\n }\n );\n\n if (usePrimaryCache) {\n moduleCache.set(id, module);\n if (loaded.hash) {\n moduleHashes.set(id, loaded.hash);\n }\n } else if (loaded.hash) {\n setModuleVariant(id, loaded.hash, module);\n }\n return module;\n })();\n\n loadInFlight.set(id, task);\n try {\n return await task;\n } finally {\n loadInFlight.delete(id);\n }\n};\n\nconst createDynamicImportFn = (importer) => {\n return async (specifier) => {\n if (typeof specifier !== 'string') {\n sendWarn({\n code: 'eval-error',\n message:\n '[wyw-in-js] Dynamic import with non-string specifier during eval.',\n importer,\n });\n if (state.evalOptions.mode === 'strict') {\n throw new Error(\n `[wyw-in-js] Dynamic import with non-string specifier is not supported during eval.\\n` +\n `importer: ${importer}\\n` +\n `hint: make it a string literal or mock the import via importOverrides.`\n );\n }\n return createSyntheticModule(`dynamic:${String(specifier)}`, {\n default: undefined,\n });\n }\n\n sendWarn({\n code: 'dynamic-import',\n message: `[wyw-in-js] Dynamic import executed during eval: ${specifier}`,\n importer,\n specifier,\n });\n\n const resolved = await resolveModule(specifier, importer, 'dynamic-import');\n await linkModule(resolved);\n await resolved.evaluate();\n return resolved;\n };\n};\n\nconst getModuleData = (id) => {\n const cached = moduleData.get(id);\n if (cached) return cached;\n\n const filename = stripQueryAndHash(id);\n const exportsValue = {};\n const moduleObj = { exports: exportsValue };\n const data = {\n exports: exportsValue,\n module: moduleObj,\n require: createRequireFn(id),\n filename,\n dirname: path.dirname(filename),\n dynamicImport: createDynamicImportFn(id),\n };\n\n moduleData.set(id, data);\n return data;\n};\n\nconst resolveExportValue = (source, key) => {\n if (key === 'default') {\n if (source && typeof source === 'object' && 'default' in source) {\n return source.default;\n }\n return source;\n }\n\n if (source && (typeof source === 'object' || typeof source === 'function')) {\n if (key in source) {\n return source[key];\n }\n if (\n source.default &&\n typeof source.default === 'object' &&\n key in source.default\n ) {\n return source.default[key];\n }\n }\n\n return undefined;\n};\n\nconst collectModuleExports = () => {\n const exportsByModule = {};\n\n moduleOnly.forEach((only, id) => {\n if (!only || only.length === 0) return;\n\n const module = moduleCache.get(id) ?? moduleLastVariant.get(id);\n const data = moduleData.get(id);\n if (!module || !data) return;\n\n // The broker already has the serialized exports for this exact variant\n // from a prior eval session. Re-serializing here just wastes CPU on the\n // runner side and bloats the EVAL_RESULT payload. Same variant identifier\n // ⇒ same namespace ⇒ no change to send.\n const moduleIdentifier =\n typeof module.identifier === 'string' ? module.identifier : id;\n if (sentNamespaceIdentifiers.get(id) === moduleIdentifier) {\n return;\n }\n\n // .namespace is only safe on fully evaluated modules. Modules that\n // errored or were never evaluated (stale from a prior failed session\n // with reuseModules) have TDZ bindings that crash Object.keys().\n if (module.status !== 'evaluated') {\n sendWarn({\n code: 'eval-stale-module',\n message:\n `[wyw-in-js] Skipping export collection for ${id}: ` +\n `module status is \"${module.status}\" (expected \"evaluated\"). ` +\n `Cached exports for this module may be stale.`,\n });\n return;\n }\n\n const { namespace } = module;\n const hasNamespace =\n namespace &&\n typeof namespace === 'object' &&\n Object.keys(namespace).length;\n const source = hasNamespace ? namespace : data.module.exports;\n\n const discoveredKeys = Object.keys(source ?? {}).filter(\n (key) => key !== '__wywPreval' && key !== 'side-effect' && key !== '*'\n );\n const requestedKeys = only.filter(\n (key) => key !== '__wywPreval' && key !== 'side-effect' && key !== '*'\n );\n const keys = Array.from(new Set([...requestedKeys, ...discoveredKeys]));\n\n if (keys.length === 0) return;\n\n const serialized = {};\n keys.forEach((key) => {\n const value = resolveExportValue(source, key);\n try {\n serialized[key] = serializeValue(value, {\n rootLabel: 'module exports',\n path: [id, key],\n });\n } catch {\n // Skip non-serializable exports when caching eval values.\n }\n });\n\n if (Object.keys(serialized).length) {\n exportsByModule[id] = serialized;\n sentNamespaceIdentifiers.set(id, moduleIdentifier);\n }\n });\n\n return exportsByModule;\n};\n\nasync function evaluateEntrypoint(id) {\n const evalStart = Date.now();\n debug('eval:start', id);\n const module = await loadModule(id, id, id);\n debug('eval:loaded', { id, durationMs: Date.now() - evalStart });\n await linkModule(module);\n debug('eval:linked', { id, durationMs: Date.now() - evalStart });\n await module.evaluate();\n debug('eval:evaluated', { id, durationMs: Date.now() - evalStart });\n\n const data = getModuleData(id);\n const exportsValue = data.module.exports;\n const hasPrevalExport =\n exportsValue &&\n typeof exportsValue === 'object' &&\n '__wywPreval' in exportsValue;\n const { namespace } = module;\n const hasPrevalNamespace =\n namespace && typeof namespace === 'object' && '__wywPreval' in namespace;\n\n const modules = collectModuleExports();\n\n if (!hasPrevalExport && !hasPrevalNamespace) {\n return { values: null, modules };\n }\n\n const preval = hasPrevalExport\n ? exportsValue.__wywPreval\n : namespace.__wywPreval;\n if (!preval || typeof preval !== 'object') {\n return { values: null, modules };\n }\n\n const values = {};\n Object.entries(preval).forEach(([key, lazy]) => {\n let value;\n try {\n value = typeof lazy === 'function' ? lazy() : lazy;\n } catch (error) {\n value = error;\n }\n values[key] = serializeValue(value, {\n allowFunctions: true,\n allowSymbols: true,\n rootLabel: '__wywPreval',\n path: [key],\n });\n });\n\n return { values, modules };\n}\n\nconst handleMessage = async (message) => {\n switch (message.type) {\n case 'INIT': {\n try {\n const initStart = Date.now();\n debug('init:start', message.payload.entrypoint ?? 'eval-runner');\n const encodedGlobals = message.payload.evalOptions.globals ?? {};\n const nextGlobalsSignature = JSON.stringify(\n canonicalizeForSignature(encodedGlobals)\n );\n const nextFeatures = message.payload.features ?? {};\n const nextEntrypoint = message.payload.entrypoint ?? 'eval-runner';\n const nextHappyDomEnabled = isFeatureEnabled(\n nextFeatures,\n 'happyDOM',\n nextEntrypoint\n );\n const globalsChanged =\n state.globalsSignature !== null &&\n state.globalsSignature !== nextGlobalsSignature;\n const nextGlobals =\n !globalsChanged && state.globalsSignature !== null\n ? state.evalOptions.globals\n : decodeGlobals(encodedGlobals);\n const nextEvalOptions = {\n ...state.evalOptions,\n ...message.payload.evalOptions,\n globals: nextGlobals,\n };\n\n const canReuseContext =\n state.context &&\n state.happyDomEnabled === nextHappyDomEnabled &&\n !globalsChanged;\n const reuseModules = Boolean(message.payload.reuseModules);\n\n if (canReuseContext) {\n const modulesReset = !reuseModules;\n if (modulesReset) {\n resetModuleState();\n } else {\n // Clear resolution caches between sessions even when reusing modules.\n // The broker rebuilds onlyByModule from scratch each session (cleared\n // in evaluate()). If the runner's resolveCache persists, RESOLVE\n // requests for previously-seen (importer, specifier) pairs are\n // skipped, preventing the broker from learning what exports are\n // needed. This can cause a barrel module to be served with a stale\n // `only` set that's missing exports a consumer actually imports,\n // leading to \"does not provide an export named 'X'\" link errors.\n resolveCache.clear();\n resolveInFlight.clear();\n loadInFlight.clear();\n }\n state.evalOptions = nextEvalOptions;\n state.features = nextFeatures;\n state.entrypoint = nextEntrypoint;\n Object.assign(state.context, {\n __dirname: path.dirname(nextEntrypoint),\n __filename: nextEntrypoint,\n ...nextEvalOptions.globals,\n __wyw_getModule: (moduleId) => getModuleData(moduleId),\n });\n state.globalsSignature = nextGlobalsSignature;\n debug('init:reuse', Date.now() - initStart);\n sendMessage({ type: 'INIT_ACK', id: message.id, modulesReset });\n break;\n }\n\n resetEvaluationState();\n state.evalOptions = nextEvalOptions;\n state.features = nextFeatures;\n state.entrypoint = nextEntrypoint;\n debug('init:globals', Date.now() - initStart);\n\n const windowStart = Date.now();\n const { context, teardown } = await createVmContext(\n state.entrypoint,\n state.features,\n {\n ...state.evalOptions.globals,\n __wyw_getModule: (moduleId) => getModuleData(moduleId),\n }\n );\n debug('init:context', Date.now() - windowStart);\n state.context = context;\n state.teardown = teardown;\n state.happyDomEnabled = nextHappyDomEnabled;\n state.globalsSignature = nextGlobalsSignature;\n\n // Full context rebuild ⇒ moduleCache was cleared by resetEvaluationState.\n sendMessage({ type: 'INIT_ACK', id: message.id, modulesReset: true });\n debug('init:done', Date.now() - initStart);\n } catch (error) {\n sendMessage({\n type: 'INIT_ACK',\n id: message.id,\n error: serializeError(error),\n });\n }\n break;\n }\n case 'EVAL': {\n try {\n const { values, modules } = await evaluateEntrypoint(\n message.payload.id\n );\n sendMessage({\n type: 'EVAL_RESULT',\n id: message.id,\n payload: {\n values,\n modules,\n },\n });\n } catch (error) {\n sendMessage({\n type: 'EVAL_RESULT',\n id: message.id,\n payload: { values: null },\n error: serializeError(error),\n });\n }\n break;\n }\n case 'RESOLVE_RESULT': {\n resolvePending(message.id, message.payload);\n break;\n }\n case 'LOAD_RESULT': {\n handleLoadResult(message.id, message.payload);\n break;\n }\n default:\n break;\n }\n};\n\nlet buffer = '';\nprocess.stdin.setEncoding('utf8');\nprocess.stdin.resume();\nprocess.stdin.on('data', (chunk) => {\n buffer += chunk;\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n lines.forEach((line) => {\n if (!line.trim()) return;\n const message = JSON.parse(line);\n handleMessage(message);\n });\n});\n\nprocess.stdin.on('close', shutdown);\n"],"file":"runner.js"}
1
+ {"mappings":";;AAEA,OAAO,QAAQ;AACf,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,gBAAgB,qBAAqB;AAC5C,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAE1B,MAAM,SAAS;CACb,YAAY,SAAS;AACnB,OAAK,UAAU,KAAK,IAAI,GAAG,QAAQ;AACnC,OAAK,MAAM,IAAI,KAAK;;CAGtB,IAAI,KAAK;AACP,MAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAE,QAAO;EAC/B,MAAM,QAAQ,KAAK,IAAI,IAAI,IAAI;AAC/B,OAAK,IAAI,OAAO,IAAI;AACpB,OAAK,IAAI,IAAI,KAAK,MAAM;AACxB,SAAO;;CAGT,IAAI,KAAK,OAAO;AACd,MAAI,KAAK,IAAI,IAAI,IAAI,EAAE;AACrB,QAAK,IAAI,OAAO,IAAI;;AAEtB,OAAK,IAAI,IAAI,KAAK,MAAM;AACxB,MAAI,KAAK,IAAI,OAAO,KAAK,SAAS;GAChC,MAAM,WAAW,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;AACxC,OAAI,aAAa,WAAW;AAC1B,SAAK,IAAI,OAAO,SAAS;;;;CAK/B,OAAO,KAAK;AACV,OAAK,IAAI,OAAO,IAAI;;CAGtB,QAAQ;AACN,OAAK,IAAI,OAAO;;;AAIpB,MAAM,aAAa;;AAGnB,MA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M,aAAa,KAAK,KAAK,GAAG,UAAU;YACnC,OAAO;AACd,gBAAY;KACV,MAAM;KACN,IAAI,QAAQ;KACZ,OAAO,eAAe,MAAM;KAC7B,CAAC;;AAEJ;;EAEF,KAAK,QAAQ;AACX,sBAAmB,OAAO;AAC1B,OAAI;IACF,MAAM,EAAE,gBAAgB,QAAQ,YAAY,MAAM,mBAChD,QAAQ,QAAQ,GACjB;AACD,gBAAY;KACV,MAAM;KACN,IAAI,QAAQ;KACZ,SAAS;MACP,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;MAC5C;MACA;MACA,YAAY,MAAM,KAAK,mBAAmB;MAC3C;KACF,CAAC;YACK,OAAO;AACd,gBAAY;KACV,MAAM;KACN,IAAI,QAAQ;KACZ,SAAS;MACP,QAAQ;MACR,YAAY,MAAM,KAAK,mBAAmB;MAC3C;KACD,OAAO,eAAe,MAAM;KAC7B,CAAC;;AAEJ;;EAEF,KAAK,kBAAkB;AACrB,kBAAe,QAAQ,IAAI,QAAQ,QAAQ;AAC3C;;EAEF,KAAK,eAAe;AAClB,oBAAiB,QAAQ,IAAI,QAAQ,QAAQ;AAC7C;;EAEF,QACE;;;AAIN,IAAI,SAAS;AACb,QAAQ,MAAM,YAAY,OAAO;AACjC,QAAQ,MAAM,QAAQ;AACtB,QAAQ,MAAM,GAAG,SAAS,UAAU;AAClC,WAAU;CACV,MAAM,QAAQ,OAAO,MAAM,KAAK;AAChC,UAAS,MAAM,KAAK,IAAI;AACxB,OAAM,SAAS,SAAS;AACtB,MAAI,CAAC,KAAK,MAAM,CAAE;EAClB,MAAM,UAAU,KAAK,MAAM,KAAK;AAChC,gBAAc,QAAQ;GACtB;EACF;AAEF,QAAQ,MAAM,GAAG,SAAS,SAAS","names":[],"sources":["../../src/eval/runner.js"],"version":3,"sourcesContent":["/* eslint-disable no-underscore-dangle */\n/* global BigInt */\nimport fs from 'node:fs';\nimport { Console } from 'node:console';\nimport { Writable } from 'node:stream';\nimport vm from 'node:vm';\nimport path from 'node:path';\nimport NativeModule, { createRequire } from 'node:module';\nimport { pathToFileURL } from 'node:url';\nimport { Minimatch } from 'minimatch';\n\nclass LruCache {\n constructor(maxSize) {\n this.maxSize = Math.max(1, maxSize);\n this.map = new Map();\n }\n\n get(key) {\n if (!this.map.has(key)) return undefined;\n const value = this.map.get(key);\n this.map.delete(key);\n this.map.set(key, value);\n return value;\n }\n\n set(key, value) {\n if (this.map.has(key)) {\n this.map.delete(key);\n }\n this.map.set(key, value);\n if (this.map.size > this.maxSize) {\n const firstKey = this.map.keys().next().value;\n if (firstKey !== undefined) {\n this.map.delete(firstKey);\n }\n }\n }\n\n delete(key) {\n this.map.delete(key);\n }\n\n clear() {\n this.map.clear();\n }\n}\n\nconst NOOP = () => {};\n\n// stdout is reserved for the JSON IPC protocol; host-side logs must not share it.\nconst prefixStream = (getPrefix) =>\n new Writable({\n write(chunk, _enc, cb) {\n const p = getPrefix();\n const s = chunk.toString();\n // Prefix interior newlines but not the trailing one — avoids\n // double-prefix when consecutive writes each start with a prefix.\n const tail = s.endsWith('\\n') ? '\\n' : '';\n const body = tail ? s.slice(0, -1) : s;\n process.stderr.write(p + body.replaceAll('\\n', `\\n${p}`) + tail, cb);\n },\n });\n\n// require'd modules outside vm use host console — must not write to stdout (IPC channel).\nglobal.console = new Console({\n stdout: prefixStream(() => '[wyw-runner:host stdout] '),\n stderr: prefixStream(() => '[wyw-runner:host stderr] '),\n});\n\nconst VITE_VIRTUAL_PREFIX = '/@';\nconst REACT_REFRESH_VIRTUAL_ID = '/@react-refresh';\nconst reactRefreshRuntime = {\n createSignatureFunctionForTransform: () => () => {},\n};\n\nconst builtins = {\n assert: true,\n buffer: true,\n child_process: false,\n cluster: false,\n console: true,\n constants: true,\n crypto: true,\n dgram: false,\n dns: false,\n domain: true,\n events: true,\n fs: false,\n http: true,\n https: true,\n module: false,\n net: false,\n os: true,\n path: true,\n punycode: true,\n process: true,\n querystring: true,\n readline: false,\n repl: false,\n stream: true,\n string_decoder: true,\n sys: true,\n timers: true,\n tls: false,\n tty: true,\n url: true,\n util: true,\n vm: true,\n zlib: true,\n};\n\nconst RESOLVE_CACHE_SIZE = 5000;\nconst LOAD_CACHE_SIZE = 1000;\nconst MODULE_VARIANT_LIMIT = 8;\n\nconst isBuiltinSpecifier = (specifier) => {\n const normalized = specifier.startsWith('node:')\n ? specifier.slice(5)\n : specifier;\n return (\n NativeModule.builtinModules?.includes(normalized) ||\n NativeModule.builtinModules?.includes(`node:${normalized}`)\n );\n};\n\nconst packageTypeCache = new Map();\n\nconst getPackageType = (filename) => {\n let dir = path.dirname(filename);\n while (dir && dir !== path.dirname(dir)) {\n const cached = packageTypeCache.get(dir);\n if (cached === 'module' || cached === 'commonjs') return cached;\n const pkgPath = path.join(dir, 'package.json');\n if (fs.existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));\n const type = pkg?.type === 'module' ? 'module' : 'commonjs';\n packageTypeCache.set(dir, type);\n return type;\n } catch {\n packageTypeCache.set(dir, null);\n return null;\n }\n }\n packageTypeCache.set(dir, null);\n dir = path.dirname(dir);\n }\n return null;\n};\n\nconst shouldPreferImport = (resolvedFile) => {\n if (!resolvedFile) return false;\n if (!path.isAbsolute(resolvedFile)) return false;\n if (resolvedFile.endsWith('.mjs')) return true;\n if (resolvedFile.endsWith('.cjs')) return false;\n if (!resolvedFile.endsWith('.js')) return false;\n return getPackageType(resolvedFile) === 'module';\n};\n\nconst isPlainObject = (value) => {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return false;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype === null || prototype === Object.prototype) {\n return true;\n }\n\n return Object.getPrototypeOf(prototype) === null;\n};\n\nconst ENCODED_GLOBAL_ENVELOPE_KEY = '__wyw_eval_global';\nconst ENCODED_GLOBAL_SIGNATURE = 'wyw-eval-global';\nconst ENCODED_GLOBAL_VERSION = 1;\nconst IDENTIFIER_RE = /^[A-Za-z_$][\\w$]*$/u;\nconst ARRAY_INDEX_RE = /^(?:0|[1-9]\\d*)$/;\nconst IPC_SUPPORTED_VALUE_HINT =\n 'Use importOverrides to mock the import or return plain data: null, booleans, strings, numbers, bigint, undefined, arrays, plain objects, and Error.';\n\nconst getObjectTypeName = (value) => {\n const { constructor } = value ?? {};\n if (\n constructor &&\n typeof constructor.name === 'string' &&\n constructor.name.length > 0\n ) {\n return constructor.name;\n }\n\n const tag = Object.prototype.toString.call(value);\n return tag.slice(8, -1) || 'Object';\n};\n\nconst getBoxedPrimitiveValue = (value) => {\n const tag = Object.prototype.toString.call(value);\n\n if (tag === '[object String]') {\n return { kind: 'string', value: String(value.valueOf()) };\n }\n\n if (tag === '[object Number]') {\n return { kind: 'number', value: Number(value.valueOf()) };\n }\n\n if (tag === '[object Boolean]') {\n return { kind: 'boolean', value: Boolean(value.valueOf()) };\n }\n\n return null;\n};\n\nconst formatPath = (rootLabel, pathSegments) =>\n pathSegments.reduce((acc, segment) => {\n if (typeof segment === 'number') {\n return `${acc}[${segment}]`;\n }\n\n if (typeof segment === 'symbol') {\n return `${acc}[${String(segment)}]`;\n }\n\n if (IDENTIFIER_RE.test(segment)) {\n return `${acc}.${segment}`;\n }\n\n return `${acc}[${JSON.stringify(segment)}]`;\n }, rootLabel);\n\nconst formatGlobalsPath = (pathSegments) =>\n formatPath('eval.globals', pathSegments);\n\nconst restoreGlobalFunction = (source, pathSegments) => {\n try {\n // eslint-disable-next-line no-eval\n const restored = eval(`(${source})`);\n if (typeof restored !== 'function') {\n throw new TypeError('decoded source is not a function');\n }\n\n return restored;\n } catch (error) {\n throw new Error(\n `[wyw-in-js] Failed to restore eval.globals function at ${formatGlobalsPath(\n pathSegments\n )}. ` +\n `Ensure the value is a user-defined function expression/arrow function. ` +\n `Native and bound functions are not supported. ` +\n `Original error: ${String(error)}`\n );\n }\n};\n\nconst isEncodedGlobalPayload = (value) => {\n if (!isPlainObject(value)) {\n return false;\n }\n\n if (\n value.signature !== ENCODED_GLOBAL_SIGNATURE ||\n value.version !== ENCODED_GLOBAL_VERSION\n ) {\n return false;\n }\n\n if (value.kind === 'function') {\n return typeof value.source === 'string';\n }\n\n if (value.kind === 'symbol') {\n return typeof value.description === 'string';\n }\n\n return false;\n};\n\nconst isEncodedGlobalEnvelope = (value) => {\n if (!isPlainObject(value)) {\n return false;\n }\n\n const keys = Object.keys(value);\n if (keys.length !== 1 || keys[0] !== ENCODED_GLOBAL_ENVELOPE_KEY) {\n return false;\n }\n\n return isEncodedGlobalPayload(value[ENCODED_GLOBAL_ENVELOPE_KEY]);\n};\n\nconst canonicalizeForSignature = (value) => {\n if (Array.isArray(value)) {\n return value.map((item) => canonicalizeForSignature(item));\n }\n\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.keys(value)\n .sort()\n .map((key) => [key, canonicalizeForSignature(value[key])])\n );\n }\n\n return value;\n};\n\nconst decodeGlobals = (value, pathSegments = []) => {\n if (Array.isArray(value)) {\n return value.map((item, index) =>\n decodeGlobals(item, [...pathSegments, index])\n );\n }\n\n if (isEncodedGlobalEnvelope(value)) {\n const payload = value[ENCODED_GLOBAL_ENVELOPE_KEY];\n if (payload.kind === 'function') {\n return restoreGlobalFunction(payload.source, pathSegments);\n }\n\n return Symbol(payload.description);\n }\n\n if (isPlainObject(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n decodeGlobals(item, [...pathSegments, key]),\n ])\n );\n }\n\n return value;\n};\n\nconst getEnumerableSymbolKeys = (value) =>\n Object.getOwnPropertySymbols(value).filter((key) =>\n Object.prototype.propertyIsEnumerable.call(value, key)\n );\n\nconst isLikeError = (value) =>\n typeof value === 'object' &&\n value !== null &&\n !isPlainObject(value) &&\n 'message' in value &&\n typeof value.message === 'string' &&\n ('stack' in value || 'name' in value);\n\nconst throwUnsupportedIpcValue = (rootLabel, pathSegments, description) => {\n throw new Error(\n `[wyw-in-js] ${rootLabel} contains ${description} at ${formatPath(\n rootLabel,\n pathSegments\n )}. ${IPC_SUPPORTED_VALUE_HINT}`\n );\n};\n\nconst serializeValueAtPath = (\n value,\n rootLabel,\n pathSegments,\n seen,\n allowFunctions,\n allowSymbols\n) => {\n if (value === null) {\n return { kind: 'null' };\n }\n if (value === undefined) return { kind: 'undefined' };\n if (typeof value === 'boolean') {\n return { kind: 'boolean', value };\n }\n if (typeof value === 'string') {\n return { kind: 'string', value };\n }\n if (typeof value === 'number') {\n if (Number.isNaN(value)) return { kind: 'nan' };\n if (value === Infinity) return { kind: 'infinity' };\n if (value === -Infinity) return { kind: '-infinity' };\n return { kind: 'number', value };\n }\n if (typeof value === 'bigint') {\n return { kind: 'bigint', value: value.toString() };\n }\n if (typeof value === 'function') {\n if (allowFunctions) {\n // __wywPreval consumers only rely on function-ness, not implementation\n // identity. Preserve that signal explicitly instead of letting JSON\n // coerce to null/undefined.\n return { kind: 'function' };\n }\n\n throwUnsupportedIpcValue(\n rootLabel,\n pathSegments,\n 'an unsupported function'\n );\n }\n if (typeof value === 'symbol') {\n if (allowSymbols) {\n return { kind: 'symbol', description: value.description ?? '' };\n }\n\n throwUnsupportedIpcValue(rootLabel, pathSegments, 'an unsupported symbol');\n }\n if (typeof value === 'object' && value !== null) {\n const boxed = getBoxedPrimitiveValue(value);\n if (boxed) {\n if (boxed.kind === 'number') {\n if (Number.isNaN(boxed.value)) return { kind: 'nan' };\n if (boxed.value === Infinity) return { kind: 'infinity' };\n if (boxed.value === -Infinity) return { kind: '-infinity' };\n }\n\n return boxed;\n }\n }\n if (isLikeError(value)) {\n return {\n kind: 'error',\n error: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n\n const currentPath = formatPath(rootLabel, pathSegments);\n const seenAt = seen.get(value);\n if (seenAt) {\n throw new Error(\n `[wyw-in-js] ${rootLabel} contains a circular reference at ${currentPath} (from ${seenAt}). ${IPC_SUPPORTED_VALUE_HINT}`\n );\n }\n\n if (Array.isArray(value)) {\n const symbolKeys = getEnumerableSymbolKeys(value);\n if (symbolKeys.length > 0) {\n throwUnsupportedIpcValue(\n rootLabel,\n [...pathSegments, symbolKeys[0]],\n 'an unsupported symbol-keyed property'\n );\n }\n\n const extraKey = Object.keys(value).find(\n (key) => !ARRAY_INDEX_RE.test(key) || Number(key) >= value.length\n );\n if (extraKey !== undefined) {\n throwUnsupportedIpcValue(\n rootLabel,\n [...pathSegments, extraKey],\n 'an unsupported non-index array property'\n );\n }\n\n seen.set(value, currentPath);\n try {\n return {\n kind: 'array',\n items: Array.from({ length: value.length }, (_, index) =>\n serializeValueAtPath(\n value[index],\n rootLabel,\n [...pathSegments, index],\n seen,\n allowFunctions,\n allowSymbols\n )\n ),\n };\n } finally {\n seen.delete(value);\n }\n }\n\n if (!isPlainObject(value)) {\n throwUnsupportedIpcValue(\n rootLabel,\n pathSegments,\n `an unsupported non-plain object (${getObjectTypeName(value)})`\n );\n }\n\n const symbolKeys = getEnumerableSymbolKeys(value);\n if (symbolKeys.length > 0) {\n throwUnsupportedIpcValue(\n rootLabel,\n [...pathSegments, symbolKeys[0]],\n 'an unsupported symbol-keyed property'\n );\n }\n\n seen.set(value, currentPath);\n try {\n return {\n kind: 'object',\n entries: Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n serializeValueAtPath(\n item,\n rootLabel,\n [...pathSegments, key],\n seen,\n allowFunctions,\n allowSymbols\n ),\n ])\n ),\n };\n } finally {\n seen.delete(value);\n }\n};\n\nconst isErrRequireEsm = (error) =>\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n error.code === 'ERR_REQUIRE_ESM';\n\nconst serializeValue = (value, options = {}) =>\n serializeValueAtPath(\n value,\n options.rootLabel ?? 'value',\n options.path ?? [],\n new WeakMap(),\n options.allowFunctions ?? false,\n options.allowSymbols ?? false\n );\n\nconst deserializeValue = (value) => {\n switch (value?.kind) {\n case 'null':\n return null;\n case 'boolean':\n case 'string':\n case 'number':\n return value.value;\n case 'undefined':\n return undefined;\n case 'bigint':\n return BigInt(value.value);\n case 'nan':\n return Number.NaN;\n case 'infinity':\n return Infinity;\n case '-infinity':\n return -Infinity;\n case 'function':\n return () => {};\n case 'symbol':\n // eslint-disable-next-line symbol-description\n return value.description ? Symbol.for(value.description) : Symbol();\n case 'error': {\n const error = new Error(value.error?.message ?? '');\n if (value.error?.name) {\n error.name = value.error.name;\n }\n if (value.error?.stack) {\n error.stack = value.error.stack;\n }\n return error;\n }\n case 'array':\n return value.items.map((item) => deserializeValue(item));\n case 'object':\n return Object.fromEntries(\n Object.entries(value.entries).map(([key, item]) => [\n key,\n deserializeValue(item),\n ])\n );\n case 'value':\n default:\n return value?.value;\n }\n};\n\nconst IMPORT_META_ENV = '__wyw_import_meta_env';\n\nlet importMetaEnvWarned = false;\nlet happyDomLoadWarned = false;\nlet happyDomUnavailable = false;\nlet happyDomImportPromise = null;\nconst debugEnabled = Boolean(process.env.WYW_EVAL_RUNNER_DEBUG);\nconst debug = (...args) => {\n if (!debugEnabled) return;\n // eslint-disable-next-line no-console\n console.warn('[wyw-eval-runner:debug]', ...args);\n};\n\nconst processShim = {\n nextTick: (fn) => setTimeout(fn, 0),\n platform: 'browser',\n arch: 'browser',\n execPath: 'browser',\n title: 'browser',\n pid: 1,\n browser: true,\n argv: [],\n binding() {\n throw new Error('No such module. (Possibly not yet loaded)');\n },\n cwd: () => '/',\n exit: NOOP,\n kill: NOOP,\n chdir: NOOP,\n umask: NOOP,\n dlopen: NOOP,\n uptime: NOOP,\n memoryUsage: NOOP,\n uvCounters: NOOP,\n features: {},\n env: process.env,\n};\n\nconst createImportMetaEnvProxy = () => {\n const target = Object.create(null);\n const warnOnce = () => {\n if (importMetaEnvWarned) return;\n importMetaEnvWarned = true;\n // eslint-disable-next-line no-console\n console.warn(\n [\n `[wyw-in-js] import.meta.env was accessed during build-time evaluation, but no env values were provided.`,\n ``,\n `If you're using Vite, make sure @wyw-in-js/vite plugin is enabled (it injects Vite env for evaluation).`,\n `Otherwise provide \"__wyw_import_meta_env\" via pluginOptions.overrideContext.`,\n ].join('\\n')\n );\n };\n\n return new Proxy(target, {\n get(obj, key) {\n if (typeof key === 'symbol') return Reflect.get(obj, key);\n warnOnce();\n return obj[key];\n },\n has(obj, key) {\n if (typeof key === 'symbol') return Reflect.has(obj, key);\n warnOnce();\n return Reflect.has(obj, key);\n },\n getOwnPropertyDescriptor(obj, key) {\n return Reflect.getOwnPropertyDescriptor(obj, key);\n },\n ownKeys(obj) {\n return Reflect.ownKeys(obj);\n },\n set(obj, key, value) {\n if (typeof key === 'symbol') return Reflect.set(obj, key, value);\n warnOnce();\n return Reflect.set(obj, key, value);\n },\n });\n};\n\nconst HAPPY_DOM_TIMEOUT_MS = Number(\n process.env.WYW_EVAL_HAPPYDOM_INIT_TIMEOUT_MS ??\n process.env.WYW_HAPPYDOM_TIMEOUT_MS ??\n 15000\n);\n\nconst withTimeout = (promise, timeoutMs, label) => {\n if (!timeoutMs || timeoutMs <= 0) return promise;\n let timeoutId;\n const timeout = new Promise((_, reject) => {\n timeoutId = setTimeout(() => {\n const error = new Error(\n `[wyw-in-js] Timed out while waiting for ${label}.`\n );\n error.code = 'WYW_HAPPYDOM_TIMEOUT';\n reject(error);\n }, timeoutMs);\n });\n return Promise.race([promise, timeout]).finally(() => {\n if (timeoutId) clearTimeout(timeoutId);\n });\n};\n\nconst loadHappyDom = async () => {\n if (!happyDomImportPromise) {\n happyDomImportPromise = import('happy-dom');\n }\n return happyDomImportPromise;\n};\n\nconst createWindow = async () => {\n if (happyDomUnavailable) return undefined;\n try {\n debug('happyDom:import:start');\n const importStart = Date.now();\n const { Window, GlobalWindow } = await withTimeout(\n loadHappyDom(),\n HAPPY_DOM_TIMEOUT_MS,\n 'happy-dom import'\n );\n debug('happyDom:import:done', Date.now() - importStart);\n const HappyWindow = GlobalWindow || Window;\n const windowStart = Date.now();\n const win = new HappyWindow();\n debug('happyDom:window:done', Date.now() - windowStart);\n win.Buffer = Buffer;\n win.Uint8Array = Uint8Array;\n return win;\n } catch (error) {\n happyDomUnavailable = true;\n happyDomImportPromise = null;\n if (!happyDomLoadWarned) {\n happyDomLoadWarned = true;\n // eslint-disable-next-line no-console\n console.warn(\n [\n `[wyw-in-js] DOM emulation is enabled (features.happyDOM), but \"happy-dom\" could not be loaded in this build-time runtime.`,\n `WyW will continue without DOM emulation (as if features.happyDOM:false).`,\n ``,\n `To silence this warning: set features: { happyDOM: false }.`,\n `To restore DOM emulation, ensure \"happy-dom\" can be imported in the build-time runtime.`,\n ].join('\\n')\n );\n }\n return undefined;\n }\n};\n\nconst setReferencePropertyIfNotPresent = (context, key) => {\n if (context[key] === context) return;\n context[key] = context;\n};\n\nconst createBaseContext = (win, additionalContext) => {\n const baseContext = win ?? {};\n setReferencePropertyIfNotPresent(baseContext, 'window');\n setReferencePropertyIfNotPresent(baseContext, 'self');\n setReferencePropertyIfNotPresent(baseContext, 'top');\n setReferencePropertyIfNotPresent(baseContext, 'parent');\n setReferencePropertyIfNotPresent(baseContext, 'global');\n setReferencePropertyIfNotPresent(baseContext, 'process');\n\n baseContext.document = win?.document;\n baseContext.process = processShim;\n\n baseContext.clearImmediate = NOOP;\n baseContext.clearInterval = NOOP;\n baseContext.clearTimeout = NOOP;\n baseContext.setImmediate = NOOP;\n baseContext.requestAnimationFrame = NOOP;\n baseContext.setInterval = NOOP;\n baseContext.setTimeout = NOOP;\n\n Object.assign(baseContext, additionalContext);\n return baseContext;\n};\n\nconst featureMatchers = new Map();\n\nconst isFeatureEnabled = (features, featureName, filename) => {\n const value = features?.[featureName] ?? false;\n if (typeof value === 'boolean') return value;\n if (value === '*' || value === '**/*') return true;\n\n const array = Array.isArray(value) ? value : [value];\n return array\n .map((pattern) => {\n let matcher = featureMatchers.get(pattern);\n if (!matcher) {\n matcher = [pattern.startsWith('!'), new Minimatch(pattern)];\n featureMatchers.set(pattern, matcher);\n }\n return [matcher[0], matcher[1].match(filename)];\n })\n .reduce(\n (acc, [negated, match]) => (negated ? acc && match : acc || match),\n false\n );\n};\n\nconst createVmContext = async (filename, features, globals) => {\n const isHappyDomEnabled = isFeatureEnabled(features, 'happyDOM', filename);\n const win = isHappyDomEnabled ? await createWindow() : undefined;\n const envContext = {\n [IMPORT_META_ENV]: createImportMetaEnvProxy(),\n };\n const baseContext = createBaseContext(win, {\n __filename: filename,\n ...envContext,\n ...globals,\n });\n // Evaluated code must never write to stdout — it is the IPC channel.\n const vmIdent = () => `vm(${path.basename(baseContext.__filename ?? '?')})`;\n baseContext.console = new Console({\n stdout: prefixStream(() => `[wyw-runner:${vmIdent()} stdout] `),\n stderr: prefixStream(() => `[wyw-runner:${vmIdent()} stderr] `),\n });\n const context = vm.createContext(baseContext);\n return {\n context,\n teardown: () => {\n if (win?.happyDOM) {\n win.happyDOM.abort();\n }\n },\n };\n};\n\nconst stripQueryAndHash = (value) =>\n value.split('?')[0]?.split('#')[0] ?? value;\n\nconst normalizeResolvedId = (resolvedId, specifier, importer, extensions) => {\n const stripped = stripQueryAndHash(resolvedId);\n if (!stripped) return resolvedId;\n if (path.extname(stripped)) return resolvedId;\n\n const isFileSpecifier =\n specifier.startsWith('.') || path.isAbsolute(specifier);\n if (!isFileSpecifier && !path.isAbsolute(stripped)) {\n return resolvedId;\n }\n\n let candidate = stripped;\n if (!path.isAbsolute(candidate)) {\n if (!importer) {\n return resolvedId;\n }\n const importerFile = stripQueryAndHash(importer);\n candidate = path.resolve(path.dirname(importerFile), candidate);\n }\n\n const suffix = resolvedId.slice(stripped.length);\n const resolvedExtensions = extensions ?? [];\n for (let index = 0; index < resolvedExtensions.length; index += 1) {\n const ext = resolvedExtensions[index];\n const fileCandidate = `${candidate}${ext}`;\n if (fs.existsSync(fileCandidate)) {\n return `${fileCandidate}${suffix}`;\n }\n\n const indexCandidate = path.join(candidate, `index${ext}`);\n if (fs.existsSync(indexCandidate)) {\n return `${indexCandidate}${suffix}`;\n }\n }\n\n if (importer) {\n try {\n const importerFile = stripQueryAndHash(importer);\n const nodeRequire = createRequire(pathToFileURL(importerFile).href);\n const resolved = nodeRequire.resolve(stripQueryAndHash(specifier));\n if (resolved && resolved !== stripped) {\n return `${resolved}${suffix}`;\n }\n } catch {\n // ignore fallback failures\n }\n }\n\n return resolvedId;\n};\n\nconst isNodeModulesId = (id) => {\n if (!id) return false;\n const normalized = stripQueryAndHash(id).replace(/\\\\/g, '/');\n return normalized.includes('/node_modules/');\n};\n\nconst mergeOnly = (current, next) => {\n if (!current || current.length === 0) return next ?? [];\n if (!next || next.length === 0) return current;\n if (current.includes('*') || next.includes('*')) {\n return ['*'];\n }\n return Array.from(new Set([...current, ...next]));\n};\n\nconst toCanonicalFileKey = (resolved, root) => {\n const rootDir = root ? path.resolve(root) : process.cwd();\n const normalizedResolved = path.resolve(resolved);\n let relative = path.relative(rootDir, normalizedResolved);\n\n if (path.sep !== path.posix.sep) {\n relative = relative.split(path.sep).join(path.posix.sep);\n }\n\n if (!relative.startsWith('.')) {\n relative = `./${relative}`;\n }\n\n return relative;\n};\n\nconst toImportKey = ({ source, resolved, root }) => {\n const isFileImport = source.startsWith('.') || path.isAbsolute(source);\n if (isFileImport && resolved) {\n return { key: toCanonicalFileKey(resolved, root), kind: 'file' };\n }\n return { key: source, kind: 'package' };\n};\n\nconst minimatchOptions = {\n dot: true,\n nocomment: true,\n nonegate: true,\n};\n\nconst compileImportOverrides = (importOverrides) => {\n const matchers = Object.entries(importOverrides)\n .map(([pattern, override]) => ({\n matcher: new Minimatch(pattern, minimatchOptions),\n override,\n pattern,\n }))\n .sort((a, b) => b.pattern.length - a.pattern.length);\n\n return { matchers };\n};\n\nconst compiledOverridesCache = new WeakMap();\n\nconst getImportOverride = (importOverrides, key) => {\n if (!importOverrides) return undefined;\n const direct = importOverrides[key];\n if (direct) return direct;\n\n let compiled = compiledOverridesCache.get(importOverrides);\n if (!compiled) {\n compiled = compileImportOverrides(importOverrides);\n compiledOverridesCache.set(importOverrides, compiled);\n }\n\n return compiled.matchers.find(({ matcher }) => matcher.match(key))?.override;\n};\n\nconst resolveMockSpecifier = ({ mock, importer, root }) => {\n const specifier =\n mock.startsWith('.') && root ? path.resolve(root, mock) : mock;\n const nodeRequire = createRequire(pathToFileURL(importer).href);\n return nodeRequire.resolve(specifier);\n};\n\nconst state = {\n context: null,\n teardown: null,\n happyDomEnabled: null,\n globalsSignature: null,\n evalOptions: {\n errors: 'strict',\n require: 'warn-and-run',\n globals: {},\n importOverrides: undefined,\n root: undefined,\n extensions: [],\n },\n features: {},\n debugEvalFiles: false,\n entrypoint: 'eval-runner',\n};\n\nconst moduleCache = new LruCache(LOAD_CACHE_SIZE);\nconst moduleHashes = new Map();\nconst moduleData = new Map();\nconst moduleOnly = new Map();\nconst moduleVariants = new Map();\nconst moduleLastVariant = new Map();\nconst linkPromises = new Map();\nconst loadInFlight = new Map();\nconst externalInFlight = new Map();\nconst resolveCache = new LruCache(RESOLVE_CACHE_SIZE);\nconst resolveInFlight = new Map();\n\nconst pending = new Map();\nconst loadResultChunks = new Map();\n// Ids evicted during the in-flight EVAL session via resetSingleModuleState.\n// Surfaced in EVAL_RESULT so the broker can drop matching entries from its\n// \"what runner has\" mirror (lastSentLoadByModule) — otherwise the broker would\n// keep short-circuiting subsequent LOADs with empty `code` and the runner\n// would have no way to obtain fresh source.\nconst evictedThisSession = new Set();\nlet nextId = 0;\nconst stdoutWriteQueue = [];\nlet stdoutWriteInFlight = false;\nlet stdoutWriteFailed = null;\nlet shutdownRequested = false;\nlet shutdownFinished = false;\n\n// Tracks the SourceTextModule identifier (versioned with hash) that was last\n// included in an EVAL_RESULT for each id. Reused module variants don't need\n// re-serialization across eval sessions — same variant = same namespace =\n// same exports the broker already has cached.\nconst sentNamespaceIdentifiers = new Map();\n\nconst resetModuleState = () => {\n moduleCache.clear();\n moduleHashes.clear();\n moduleData.clear();\n moduleOnly.clear();\n moduleVariants.clear();\n moduleLastVariant.clear();\n linkPromises.clear();\n loadInFlight.clear();\n externalInFlight.clear();\n resolveInFlight.clear();\n resolveCache.clear();\n sentNamespaceIdentifiers.clear();\n};\n\nconst resetSingleModuleState = (id, cachedModule = moduleCache.get(id)) => {\n if (cachedModule) {\n linkPromises.delete(cachedModule);\n }\n\n const variants = moduleVariants.get(id);\n if (variants) {\n variants.forEach((variant) => linkPromises.delete(variant));\n }\n\n moduleCache.delete(id);\n moduleHashes.delete(id);\n moduleData.delete(id);\n moduleVariants.delete(id);\n moduleLastVariant.delete(id);\n sentNamespaceIdentifiers.delete(id);\n};\n\n// Stronger reset for error paths: clears moduleOnly too and records the id so\n// the broker can drop its lastSentLoadByModule entry. Used when a module's\n// SourceTextModule has reached an unrecoverable state (e.g. link errored\n// against a transient missing import) and should not be reused.\nconst evictPoisonedModule = (id) => {\n resetSingleModuleState(id);\n moduleOnly.delete(id);\n evictedThisSession.add(id);\n};\n\nconst isFullModuleLoad = (loaded) =>\n !loaded.only || (loaded.only.length === 1 && loaded.only[0] === '*');\n\nconst getModuleVariant = (id, hash) => moduleVariants.get(id)?.get(hash);\n\nconst setModuleVariant = (id, hash, module) => {\n let variants = moduleVariants.get(id);\n if (!variants) {\n variants = new Map();\n moduleVariants.set(id, variants);\n }\n variants.set(hash, module);\n moduleLastVariant.set(id, module);\n\n if (variants.size > MODULE_VARIANT_LIMIT) {\n const oldestHash = variants.keys().next().value;\n if (oldestHash !== undefined) {\n const oldest = variants.get(oldestHash);\n if (oldest) {\n linkPromises.delete(oldest);\n }\n variants.delete(oldestHash);\n }\n }\n};\n\nconst toSourceModuleId = (id) => stripQueryAndHash(String(id));\n\nconst toVersionedModuleIdentifier = (id, hash) => {\n if (!hash) return id;\n const separator = id.includes('?') ? '&' : '?';\n return `${id}${separator}wyw-hash=${hash}`;\n};\n\nconst resetEvaluationState = () => {\n if (state.teardown) {\n state.teardown();\n }\n state.context = null;\n state.teardown = null;\n state.happyDomEnabled = null;\n state.globalsSignature = null;\n resetModuleState();\n};\n\nconst normalizeWriteError = (label, error) => {\n if (error instanceof Error) {\n return error;\n }\n\n return new Error(`[wyw-in-js] Failed to write to ${label}: ${String(error)}`);\n};\n\nconst keepAlive = setInterval(() => {}, 60_000);\n\nconst finishShutdown = (exitCode = 0) => {\n if (shutdownFinished) {\n return;\n }\n\n shutdownFinished = true;\n clearInterval(keepAlive);\n if (state.teardown) {\n state.teardown();\n }\n process.exit(exitCode);\n};\n\nconst flushStdoutWriteQueue = () => {\n if (stdoutWriteInFlight || stdoutWriteFailed) {\n return;\n }\n\n const next = stdoutWriteQueue.shift();\n if (!next) {\n if (shutdownRequested) {\n finishShutdown(0);\n }\n return;\n }\n\n stdoutWriteInFlight = true;\n let settled = false;\n let writeCompleted = false;\n let drainCompleted = true;\n let onClose;\n let onDrain;\n let onError;\n\n const cleanup = () => {\n process.stdout.off('close', onClose);\n process.stdout.off('drain', onDrain);\n process.stdout.off('error', onError);\n };\n\n const finish = (error) => {\n if (settled) {\n return;\n }\n\n if (error) {\n settled = true;\n stdoutWriteInFlight = false;\n cleanup();\n stdoutWriteFailed = normalizeWriteError('eval runner stdout', error);\n next.reject(stdoutWriteFailed);\n while (stdoutWriteQueue.length > 0) {\n stdoutWriteQueue.shift().reject(stdoutWriteFailed);\n }\n process.stderr.write(`[wyw-eval-runner] ${stdoutWriteFailed.message}\\n`);\n finishShutdown(1);\n return;\n }\n\n if (!writeCompleted || !drainCompleted) {\n return;\n }\n\n settled = true;\n stdoutWriteInFlight = false;\n cleanup();\n next.resolve();\n flushStdoutWriteQueue();\n };\n\n onClose = () => {\n finish(\n new Error('eval runner stdout closed before pending write completed')\n );\n };\n\n onDrain = () => {\n drainCompleted = true;\n finish();\n };\n\n onError = (error) => {\n finish(error);\n };\n\n process.stdout.once('close', onClose);\n process.stdout.once('error', onError);\n\n const needsDrain = !process.stdout.write(next.chunk, (error) => {\n writeCompleted = true;\n if (error) {\n finish(error);\n return;\n }\n\n finish();\n });\n\n if (needsDrain) {\n drainCompleted = false;\n process.stdout.once('drain', onDrain);\n }\n};\n\nconst queueStdoutWrite = (chunk) =>\n new Promise((resolve, reject) => {\n if (stdoutWriteFailed) {\n reject(stdoutWriteFailed);\n return;\n }\n\n stdoutWriteQueue.push({ chunk, resolve, reject });\n flushStdoutWriteQueue();\n });\n\nconst sendMessage = (message) => {\n queueStdoutWrite(`${JSON.stringify(message)}\\n`).catch(() => {});\n};\n\nconst shutdown = () => {\n shutdownRequested = true;\n if (!stdoutWriteInFlight && stdoutWriteQueue.length === 0) {\n finishShutdown(0);\n }\n};\n\nconst sendWarn = (warning) => {\n sendMessage({ type: 'WARN', payload: warning });\n};\n\nconst reviveSerializedError = (error) => {\n if (error instanceof Error) {\n return error;\n }\n\n const revived = new Error(error?.message ?? String(error));\n if (error?.name) {\n revived.name = error.name;\n }\n if (error?.stack) {\n revived.stack = error.stack;\n }\n if (error?.cause) {\n revived.cause = reviveSerializedError(error.cause);\n }\n return revived;\n};\n\nconst serializeError = (error) => {\n const result = {\n message: error?.message ?? String(error),\n stack: error?.stack,\n };\n if (error?.cause instanceof Error) {\n result.cause = serializeError(error.cause);\n }\n return result;\n};\n\nconst request = (type, payload) => {\n nextId += 1;\n const id = `${nextId}`;\n sendMessage({ type, id, payload });\n return new Promise((resolve, reject) => {\n pending.set(id, { resolve, reject });\n });\n};\n\nconst resolvePending = (id, payload) => {\n const pendingItem = pending.get(id);\n if (!pendingItem) return;\n pending.delete(id);\n pendingItem.resolve(payload);\n};\n\nconst handleLoadResult = (id, payload) => {\n if (\n !payload ||\n typeof payload.codeChunk !== 'string' ||\n typeof payload.chunkIndex !== 'number' ||\n typeof payload.chunkCount !== 'number'\n ) {\n resolvePending(id, payload);\n return;\n }\n\n let entry = loadResultChunks.get(id);\n if (!entry) {\n entry = {\n chunks: new Array(payload.chunkCount),\n received: 0,\n meta: null,\n };\n loadResultChunks.set(id, entry);\n }\n\n if (!entry.chunks[payload.chunkIndex]) {\n entry.received += 1;\n }\n entry.chunks[payload.chunkIndex] = payload.codeChunk;\n\n if (payload.chunkIndex === 0) {\n const { codeChunk, chunkIndex, chunkCount, ...meta } = payload;\n entry.meta = meta;\n }\n\n if (entry.received >= payload.chunkCount) {\n const code = entry.chunks.join('');\n const finalPayload = {\n ...(entry.meta ?? {}),\n code,\n };\n loadResultChunks.delete(id);\n resolvePending(id, finalPayload);\n }\n};\n\nconst buildPreamble = (id) =>\n [\n `const __wyw_module = __wyw_getModule(${JSON.stringify(id)});`,\n `let exports = __wyw_module.exports;`,\n `const module = __wyw_module.module;`,\n `const require = __wyw_module.require;`,\n `const __filename = __wyw_module.filename;`,\n `const __dirname = __wyw_module.dirname;`,\n `const __wyw_dynamic_import = __wyw_module.dynamicImport;`,\n ``,\n ].join('\\n');\n\nconst getImporterPackage = (importer) => {\n const normalized = importer.replace(/\\\\/g, '/');\n const marker = '/node_modules/';\n const idx = normalized.lastIndexOf(marker);\n if (idx === -1) return path.basename(importer);\n const rest = normalized.slice(idx + marker.length);\n if (rest.startsWith('@')) {\n const [scope, name] = rest.split('/').slice(0, 2);\n return `${scope}/${name}`;\n }\n return rest.split('/')[0];\n};\n\nconst warnedRequires = new Set();\n\nconst createRequireFn = (importer) => {\n const importerFile = stripQueryAndHash(importer);\n const nodeRequire = createRequire(pathToFileURL(importerFile).href);\n\n return (specifier, nonLiteralOrResolved, maybeResolved) => {\n const hasNonLiteralFlag = typeof nonLiteralOrResolved === 'boolean';\n const nonLiteral = hasNonLiteralFlag ? nonLiteralOrResolved : false;\n const resolvedOverride = hasNonLiteralFlag\n ? maybeResolved\n : nonLiteralOrResolved;\n const hasResolvedOverride =\n typeof resolvedOverride === 'string' && resolvedOverride.length > 0;\n if (state.evalOptions.require === 'off') {\n throw new Error(\n `[wyw-in-js] require() fallback is disabled by eval.require: 'off'.`\n );\n }\n\n if (nonLiteral || typeof specifier !== 'string') {\n if (state.evalOptions.errors === 'strict') {\n throw new Error(\n `[wyw-in-js] Non-literal require() is not supported during eval.\\n` +\n `importer: ${importerFile}\\n` +\n `hint: make it a string literal or mock the import via importOverrides.`\n );\n }\n\n sendWarn({\n code: 'require-error',\n message:\n '[wyw-in-js] Non-literal require() reached during eval (eval.errors: \"loose\").',\n importer: importerFile,\n });\n return {};\n }\n\n if (specifier === REACT_REFRESH_VIRTUAL_ID) {\n return reactRefreshRuntime;\n }\n\n if (\n specifier.startsWith(VITE_VIRTUAL_PREFIX) ||\n specifier.startsWith('virtual:')\n ) {\n return {};\n }\n\n const normalized = specifier.startsWith('node:')\n ? specifier.slice(5)\n : specifier;\n if (\n NativeModule.builtinModules?.includes(normalized) ||\n NativeModule.builtinModules?.includes(`node:${normalized}`)\n ) {\n if (normalized in builtins) {\n if (builtins[normalized]) {\n return nodeRequire(normalized);\n }\n return null;\n }\n }\n\n const extensions = NativeModule._extensions;\n const added = [];\n\n try {\n state.evalOptions.extensions?.forEach((ext) => {\n if (ext === '.cjs' || ext === '.mjs') return;\n if (ext in extensions) return;\n extensions[ext] = NOOP;\n added.push(ext);\n });\n\n let resolved = hasResolvedOverride\n ? stripQueryAndHash(resolvedOverride)\n : nodeRequire.resolve(stripQueryAndHash(specifier));\n\n const isFileSpecifier =\n specifier.startsWith('.') || path.isAbsolute(specifier);\n if (\n isFileSpecifier &&\n path.extname(specifier) === '' &&\n resolved.endsWith('.cjs')\n ) {\n const candidate = `${resolved.slice(0, -4)}.js`;\n if (fs.existsSync(candidate)) {\n resolved = candidate;\n }\n }\n\n const keyInfo = toImportKey({\n source: specifier,\n resolved,\n root: state.evalOptions.root,\n });\n const override = getImportOverride(\n state.evalOptions.importOverrides,\n keyInfo.key\n );\n\n let finalResolved = resolved;\n if (override?.mock) {\n finalResolved = resolveMockSpecifier({\n mock: override.mock,\n importer: importerFile,\n root: state.evalOptions.root,\n stack: [importerFile],\n });\n }\n\n const basePolicy =\n state.evalOptions.require === 'warn-and-run' ? 'warn' : 'error';\n let policy = override?.unknown ?? (override ? 'allow' : basePolicy);\n if (state.evalOptions.require === 'off' && policy !== 'error') {\n policy = 'error';\n }\n\n if (policy === 'error') {\n throw new Error(\n [\n `[wyw-in-js] require() fallback reached during eval but eval.require='error'.`,\n ``,\n `importer: ${importerFile}`,\n `source: ${specifier}`,\n `hint: add importOverrides or set eval.require to \"warn-and-run\".`,\n ].join('\\n')\n );\n }\n\n if (policy === 'warn') {\n const key = `${specifier}::${getImporterPackage(importerFile)}`;\n if (!warnedRequires.has(key)) {\n warnedRequires.add(key);\n sendWarn({\n code: 'require-fallback',\n message: [\n `[wyw-in-js] Runtime require() fallback during eval`,\n ``,\n `importer: ${importerFile}`,\n `source: ${specifier}`,\n `resolved: ${resolved}`,\n override?.mock\n ? `mock: ${override.mock} -> ${finalResolved}`\n : ``,\n ``,\n `hint: use importOverrides to mock runtime-only deps and avoid eval-time requires.`,\n ]\n .filter(Boolean)\n .join('\\n'),\n importer: importerFile,\n specifier,\n resolved,\n });\n }\n }\n\n return nodeRequire(finalResolved);\n } finally {\n added.forEach((ext) => delete extensions[ext]);\n }\n };\n};\n\nfunction createSyntheticModule(id, exportsValue, cache = true) {\n const exportNames = new Set(Object.keys(exportsValue));\n if (!exportNames.has('default')) {\n exportNames.add('default');\n }\n\n const module = new vm.SyntheticModule(\n [...exportNames],\n function init() {\n exportNames.forEach((key) => {\n const value =\n key === 'default' ? exportsValue.default : exportsValue[key];\n this.setExport(key, value);\n });\n },\n { context: state.context, identifier: id }\n );\n\n if (cache) {\n moduleCache.set(id, module);\n }\n return module;\n}\n\nconst toSyntheticExports = (value) => {\n if (value && (typeof value === 'object' || typeof value === 'function')) {\n const exportsValue = {};\n Object.keys(value).forEach((key) => {\n exportsValue[key] = value[key];\n });\n exportsValue.default =\n Object.prototype.hasOwnProperty.call(value, 'default') ||\n Object.prototype.hasOwnProperty.call(exportsValue, 'default')\n ? value.default\n : value;\n return exportsValue;\n }\n return { default: value };\n};\n\nconst loadExternalModule = async (resolvedId, importer, specifier) => {\n const cacheId = resolvedId ?? specifier;\n const cached = moduleCache.get(cacheId);\n if (cached) return cached;\n\n const inFlight = externalInFlight.get(cacheId);\n if (inFlight) return inFlight;\n\n const task = (async () => {\n const start = Date.now();\n debug('external:start', { specifier, resolvedId, importer });\n const requireFn = createRequireFn(importer);\n let value;\n let hasValue = false;\n const resolvedFile = resolvedId ? stripQueryAndHash(resolvedId) : null;\n const importTarget =\n resolvedFile && path.isAbsolute(resolvedFile)\n ? pathToFileURL(resolvedFile).href\n : specifier;\n\n if (shouldPreferImport(resolvedFile)) {\n value = await import(importTarget);\n hasValue = true;\n }\n if (!hasValue) {\n try {\n value = requireFn(specifier, resolvedId ?? null);\n hasValue = true;\n } catch (error) {\n if (!isErrRequireEsm(error)) {\n throw error;\n }\n\n const isFileSpecifier =\n specifier.startsWith('.') || path.isAbsolute(specifier);\n const isPackageSpecifier =\n !isFileSpecifier && !isBuiltinSpecifier(specifier);\n if (resolvedId && isPackageSpecifier) {\n try {\n value = requireFn(specifier, null);\n hasValue = true;\n } catch (retryError) {\n if (!isErrRequireEsm(retryError)) {\n throw retryError;\n }\n }\n }\n\n if (!hasValue) {\n value = await import(importTarget);\n hasValue = true;\n }\n }\n }\n\n const module = createSyntheticModule(cacheId, toSyntheticExports(value));\n debug('external:done', {\n specifier,\n resolvedId,\n durationMs: Date.now() - start,\n });\n return module;\n })();\n\n externalInFlight.set(cacheId, task);\n try {\n return await task;\n } finally {\n externalInFlight.delete(cacheId);\n }\n};\n\nlet resolveModule;\nlet loadModule;\n\nconst linkModule = async (module) => {\n const cached = linkPromises.get(module);\n if (cached) return cached;\n if (module.status !== 'unlinked') return module;\n const linking = (async () => {\n try {\n await module.link((specifier, referencingModule) =>\n resolveModule(specifier, referencingModule.identifier, 'import')\n );\n return module;\n } catch (error) {\n // The vm SourceTextModule is now in 'errored' (or partially-linked)\n // state and can never be re-linked. With reuseModules:true the cached\n // module would otherwise stick around and short-circuit linkModule's\n // status guard above on the next session — surfacing the original\n // failure forever even after the user fixes the underlying problem.\n // Drop it so the next LOAD rebuilds a fresh SourceTextModule.\n const identifier =\n typeof module.identifier === 'string' ? module.identifier : null;\n if (identifier) {\n evictPoisonedModule(toSourceModuleId(identifier));\n }\n // ERR_VM_MODULE_LINK_FAILURE means a dependency is in \"errored\" state.\n // Node chains .cause through the link failure hierarchy. Walk to the\n // deepest cause to surface the original evaluation error (e.g. a\n // TypeError in user code), not intermediate \"resolved to errored\" hops.\n if (error?.code === 'ERR_VM_MODULE_LINK_FAILURE') {\n let rootCause = error;\n while (rootCause.cause instanceof Error) {\n rootCause = rootCause.cause;\n }\n if (rootCause !== error) {\n const enhanced = new Error(\n `${error.message}\\n` +\n ` Root cause: ${rootCause.name ?? 'Error'}: ${rootCause.message}`\n );\n enhanced.cause = rootCause;\n throw enhanced;\n }\n }\n throw error;\n } finally {\n linkPromises.delete(module);\n }\n })();\n linkPromises.set(module, linking);\n return linking;\n};\n\nresolveModule = async (specifier, importer, kind) => {\n const importerId = toSourceModuleId(importer);\n if (process.env.WYW_DEBUG_EVAL_RESOLVE) {\n process.stderr.write(\n `[wyw-eval-runner:resolve] ${JSON.stringify({\n specifier,\n importer: importerId,\n kind,\n })}\\n`\n );\n }\n if (specifier === REACT_REFRESH_VIRTUAL_ID) {\n return createSyntheticModule(specifier, reactRefreshRuntime);\n }\n\n if (\n specifier.startsWith(VITE_VIRTUAL_PREFIX) ||\n specifier.startsWith('virtual:')\n ) {\n return createSyntheticModule(specifier, { default: {} });\n }\n\n const key = `${kind}:${importerId}:${specifier}`;\n const cached = resolveCache.get(key);\n if (cached) {\n if (!cached.resolvedId) {\n if (state.evalOptions.errors === 'loose') {\n return createSyntheticModule(specifier, { default: undefined });\n }\n throw new Error(\n [\n `[wyw-in-js] Unable to resolve \"${specifier}\" during evaluation.`,\n ``,\n `importer: ${importerId}`,\n `hint: check eval.resolver/customResolver or add importOverrides for this specifier.`,\n ].join('\\n')\n );\n }\n\n const treatExternal =\n cached.external ||\n isBuiltinSpecifier(specifier) ||\n isNodeModulesId(cached.resolvedId);\n\n if (treatExternal) {\n const normalized = normalizeResolvedId(\n cached.resolvedId,\n specifier,\n importerId,\n state.evalOptions.extensions\n );\n const externalModule = await loadExternalModule(\n normalized,\n importerId,\n specifier\n );\n return externalModule;\n }\n\n const normalized = normalizeResolvedId(\n cached.resolvedId,\n specifier,\n importerId,\n state.evalOptions.extensions\n );\n return loadModule(normalized, importerId, specifier);\n }\n\n const inFlight = resolveInFlight.get(key);\n if (inFlight) return inFlight;\n\n const task = (async () => {\n const resolved = await request('RESOLVE', {\n specifier,\n importerId,\n kind,\n });\n\n if (resolved.error) {\n throw new Error(resolved.error.message);\n }\n\n const normalized = resolved.resolvedId\n ? normalizeResolvedId(\n resolved.resolvedId,\n specifier,\n importerId,\n state.evalOptions.extensions\n )\n : resolved.resolvedId;\n if (process.env.WYW_DEBUG_EVAL_RESOLVE) {\n process.stderr.write(\n `[wyw-eval-runner:resolved] ${JSON.stringify({\n specifier,\n importer: importerId,\n resolved: resolved.resolvedId ?? null,\n normalized: normalized ?? null,\n external: Boolean(resolved.external),\n })}\\n`\n );\n }\n\n resolveCache.set(key, {\n resolvedId: normalized,\n external: Boolean(resolved.external),\n });\n\n if (!normalized) {\n if (state.evalOptions.errors === 'loose') {\n return createSyntheticModule(specifier, { default: undefined });\n }\n throw new Error(\n [\n `[wyw-in-js] Unable to resolve \"${specifier}\" during evaluation.`,\n ``,\n `importer: ${importerId}`,\n `hint: check eval.resolver/customResolver or add importOverrides for this specifier.`,\n ].join('\\n')\n );\n }\n\n const treatExternal =\n resolved.external ||\n isBuiltinSpecifier(specifier) ||\n isNodeModulesId(normalized);\n\n if (treatExternal) {\n return loadExternalModule(normalized, importerId, specifier);\n }\n\n return loadModule(normalized, importerId, specifier);\n })();\n\n resolveInFlight.set(key, task);\n try {\n return await task;\n } finally {\n resolveInFlight.delete(key);\n }\n};\n\nloadModule = async (id, importer, requestSpec) => {\n let cached = moduleCache.get(id);\n const inFlight = loadInFlight.get(id);\n if (inFlight) {\n await inFlight;\n cached = moduleCache.get(id);\n }\n\n const task = (async () => {\n const loadStart = Date.now();\n const loaded = await request('LOAD', {\n id,\n importerId: importer,\n request: requestSpec ?? null,\n });\n debug('load:done', {\n id,\n importer,\n durationMs: Date.now() - loadStart,\n });\n if (loaded.error) {\n // Surface the importer + specifier alongside the broker's message.\n // Without this, ENOENT and similar load failures bubble up as a bare\n // path (or, after Node's VM wraps them, as the opaque\n // ERR_VM_MODULE_STATUS) leaving no clue which file's import is broken.\n const detail = [\n `[wyw-in-js] Failed to load module during evaluation.`,\n ` importer: ${importer ?? '(unknown)'}`,\n ` request: ${requestSpec ?? id}`,\n ` resolved: ${id}`,\n ` cause: ${loaded.error.message}`,\n ].join('\\n');\n // The importer's SourceTextModule (if it was already created and\n // cached) compiled this `import` against `id`; reusing it next session\n // would link against the same id and either re-trigger the failure or\n // skip linking via the status guard. Drop both so the next session\n // pulls fresh code for both ends of the broken edge.\n if (importer && importer !== id) {\n evictPoisonedModule(toSourceModuleId(importer));\n }\n evictPoisonedModule(id);\n const enhanced = new Error(detail);\n enhanced.cause = reviveSerializedError(loaded.error);\n throw enhanced;\n }\n\n if (loaded.only) {\n const current = moduleOnly.get(id) ?? [];\n moduleOnly.set(id, mergeOnly(current, loaded.only));\n }\n\n if (loaded.exports) {\n // Serialized exports are a narrow slice — only the keys the importer\n // requested. If we have a fully evaluated module (in moduleCache or as\n // a variant), prefer it: its namespace has ALL exports, so any consumer\n // can link against it without \"does not provide export\" errors.\n //\n // An evaluated variant is only safe to reuse when its namespace covers\n // the serialized key set. A narrow variant that was evaluated first may\n // lack exports that a wider consumer needs (the 4df6e915 race).\n const requiredKeys = Object.keys(loaded.exports);\n const coversKeys = (mod) => {\n const ns = mod.namespace;\n return requiredKeys.every((k) => k in ns);\n };\n\n let evaluated =\n cached && cached.status === 'evaluated' && coversKeys(cached)\n ? cached\n : undefined;\n\n if (!evaluated) {\n const variants = moduleVariants.get(id);\n if (variants) {\n evaluated = Array.from(variants.values()).find(\n (variant) => variant.status === 'evaluated' && coversKeys(variant)\n );\n }\n }\n\n if (evaluated) {\n return evaluated;\n }\n\n // Reuse a previously created SyntheticModule for this exact serialized set\n if (loaded.hash) {\n const existing = getModuleVariant(id, loaded.hash);\n if (existing) {\n return existing;\n }\n }\n\n const exportsValue = {};\n Object.entries(loaded.exports).forEach(([key, serialized]) => {\n exportsValue[key] = deserializeValue(serialized);\n });\n const module = createSyntheticModule(id, exportsValue, false);\n if (loaded.hash) {\n setModuleVariant(id, loaded.hash, module);\n }\n return module;\n }\n\n const usePrimaryCache = isFullModuleLoad(loaded);\n if (usePrimaryCache) {\n if (cached && loaded.hash && moduleHashes.get(id) === loaded.hash) {\n return cached;\n }\n } else if (loaded.hash) {\n const variant = getModuleVariant(id, loaded.hash);\n if (variant) {\n return variant;\n }\n }\n\n // The broker only ships empty `code` when it expects the runner to reuse\n // a cached module via the hash-match short-circuit above. Reaching this\n // point with no code means the broker's \"what runner has\" mirror is out\n // of sync with our actual moduleCache/moduleVariants — fail loudly rather\n // than feeding empty source into vm.SourceTextModule.\n if (loaded.code == null || loaded.code === '') {\n throw new Error(\n `[wyw-in-js] LoadResult for ${id} has empty code but no cached module ` +\n `matched hash ${loaded.hash ?? '(none)'}. ` +\n `This indicates a broker/runner cache desync.`\n );\n }\n\n if (usePrimaryCache) {\n resetSingleModuleState(id, cached);\n }\n\n const module = new vm.SourceTextModule(\n `${buildPreamble(id)}${loaded.code ?? ''}`,\n {\n context: state.context,\n identifier: toVersionedModuleIdentifier(id, loaded.hash),\n initializeImportMeta(meta, targetModule) {\n const identifier =\n typeof targetModule.identifier === 'string'\n ? targetModule.identifier\n : id;\n const fileId = stripQueryAndHash(identifier);\n // eslint-disable-next-line no-param-reassign\n meta.url = path.isAbsolute(fileId)\n ? pathToFileURL(fileId).href\n : fileId;\n },\n importModuleDynamically(specifier, referencingModule) {\n return resolveModule(\n specifier,\n referencingModule.identifier,\n 'dynamic-import'\n );\n },\n }\n );\n\n if (usePrimaryCache) {\n moduleCache.set(id, module);\n if (loaded.hash) {\n moduleHashes.set(id, loaded.hash);\n }\n } else if (loaded.hash) {\n setModuleVariant(id, loaded.hash, module);\n }\n return module;\n })();\n\n loadInFlight.set(id, task);\n try {\n return await task;\n } finally {\n loadInFlight.delete(id);\n }\n};\n\nconst createDynamicImportFn = (importer) => {\n return async (specifier) => {\n if (typeof specifier !== 'string') {\n sendWarn({\n code: 'eval-error',\n message:\n '[wyw-in-js] Dynamic import with non-string specifier during eval.',\n importer,\n });\n if (state.evalOptions.errors === 'strict') {\n throw new Error(\n `[wyw-in-js] Dynamic import with non-string specifier is not supported during eval.\\n` +\n `importer: ${importer}\\n` +\n `hint: make it a string literal or mock the import via importOverrides.`\n );\n }\n return createSyntheticModule(`dynamic:${String(specifier)}`, {\n default: undefined,\n });\n }\n\n sendWarn({\n code: 'dynamic-import',\n message: `[wyw-in-js] Dynamic import executed during eval: ${specifier}`,\n importer,\n specifier,\n });\n\n const resolved = await resolveModule(specifier, importer, 'dynamic-import');\n await linkModule(resolved);\n await resolved.evaluate();\n return resolved;\n };\n};\n\nconst getModuleData = (id) => {\n const cached = moduleData.get(id);\n if (cached) return cached;\n\n const filename = stripQueryAndHash(id);\n const exportsValue = {};\n const moduleObj = { exports: exportsValue };\n const data = {\n exports: exportsValue,\n module: moduleObj,\n require: createRequireFn(id),\n filename,\n dirname: path.dirname(filename),\n dynamicImport: createDynamicImportFn(id),\n };\n\n moduleData.set(id, data);\n return data;\n};\n\nconst resolveExportValue = (source, key) => {\n if (key === 'default') {\n if (source && typeof source === 'object' && 'default' in source) {\n return source.default;\n }\n return source;\n }\n\n if (source && (typeof source === 'object' || typeof source === 'function')) {\n if (key in source) {\n return source[key];\n }\n if (\n source.default &&\n typeof source.default === 'object' &&\n key in source.default\n ) {\n return source.default[key];\n }\n }\n\n return undefined;\n};\n\nconst stringifyDebugValue = (value) => {\n try {\n const json = JSON.stringify(value);\n if (json !== undefined) return json;\n } catch {\n // fall through\n }\n\n try {\n return String(value);\n } catch {\n return Object.prototype.toString.call(value);\n }\n};\n\nconst serializeDebugReason = (error) =>\n error instanceof Error ? error.message : String(error);\n\nconst collectModuleExports = () => {\n const exportsByModule = {};\n const debugEvalFiles = state.debugEvalFiles ? {} : undefined;\n\n moduleOnly.forEach((only, id) => {\n if (!only || only.length === 0) return;\n\n const module = moduleCache.get(id) ?? moduleLastVariant.get(id);\n const data = moduleData.get(id);\n if (!module || !data) return;\n\n // The broker already has the serialized exports for this exact variant\n // from a prior eval session. Re-serializing here just wastes CPU on the\n // runner side and bloats the EVAL_RESULT payload. Same variant identifier\n // ⇒ same namespace ⇒ no change to send.\n const moduleIdentifier =\n typeof module.identifier === 'string' ? module.identifier : id;\n if (sentNamespaceIdentifiers.get(id) === moduleIdentifier) {\n return;\n }\n\n // .namespace is only safe on fully evaluated modules. Modules that\n // errored or were never evaluated (stale from a prior failed session\n // with reuseModules) have TDZ bindings that crash Object.keys().\n if (module.status !== 'evaluated') {\n sendWarn({\n code: 'eval-stale-module',\n message:\n `[wyw-in-js] Skipping export collection for ${id}: ` +\n `module status is \"${module.status}\" (expected \"evaluated\"). ` +\n `Cached exports for this module may be stale.`,\n });\n return;\n }\n\n const { namespace } = module;\n const hasNamespace =\n namespace &&\n typeof namespace === 'object' &&\n Object.keys(namespace).length;\n const source = hasNamespace ? namespace : data.module.exports;\n\n const discoveredKeys = Object.keys(source ?? {}).filter(\n (key) => key !== '__wywPreval' && key !== 'side-effect' && key !== '*'\n );\n const requestedKeys = only.filter(\n (key) => key !== '__wywPreval' && key !== 'side-effect' && key !== '*'\n );\n const keys = Array.from(new Set([...requestedKeys, ...discoveredKeys]));\n\n if (keys.length === 0) return;\n\n const serialized = {};\n const debugExports = state.debugEvalFiles ? {} : undefined;\n keys.forEach((key) => {\n const value = resolveExportValue(source, key);\n try {\n serialized[key] = serializeValue(value, {\n rootLabel: 'module exports',\n path: [id, key],\n });\n if (debugExports) {\n debugExports[key] = {\n serialized: serialized[key],\n status: 'serialized',\n };\n }\n } catch (error) {\n if (debugExports) {\n debugExports[key] = {\n reason: serializeDebugReason(error),\n status: 'stringified',\n stringified: stringifyDebugValue(value),\n };\n }\n // Skip non-serializable exports when caching eval values.\n }\n });\n\n if (debugEvalFiles && debugExports && Object.keys(debugExports).length) {\n debugEvalFiles[id] = {\n exports: debugExports,\n };\n }\n\n if (Object.keys(serialized).length) {\n exportsByModule[id] = serialized;\n sentNamespaceIdentifiers.set(id, moduleIdentifier);\n }\n });\n\n return { debugEvalFiles, modules: exportsByModule };\n};\n\nasync function evaluateEntrypoint(id) {\n const evalStart = Date.now();\n debug('eval:start', id);\n const module = await loadModule(id, id, id);\n debug('eval:loaded', { id, durationMs: Date.now() - evalStart });\n await linkModule(module);\n debug('eval:linked', { id, durationMs: Date.now() - evalStart });\n await module.evaluate();\n debug('eval:evaluated', { id, durationMs: Date.now() - evalStart });\n\n const data = getModuleData(id);\n const exportsValue = data.module.exports;\n const hasPrevalExport =\n exportsValue &&\n typeof exportsValue === 'object' &&\n '__wywPreval' in exportsValue;\n const { namespace } = module;\n const hasPrevalNamespace =\n namespace && typeof namespace === 'object' && '__wywPreval' in namespace;\n\n const { debugEvalFiles, modules } = collectModuleExports();\n\n if (!hasPrevalExport && !hasPrevalNamespace) {\n return { debugEvalFiles, values: null, modules };\n }\n\n const preval = hasPrevalExport\n ? exportsValue.__wywPreval\n : namespace.__wywPreval;\n if (!preval || typeof preval !== 'object') {\n return { debugEvalFiles, values: null, modules };\n }\n\n const values = {};\n const debugPreval = state.debugEvalFiles ? {} : undefined;\n Object.entries(preval).forEach(([key, lazy]) => {\n let value;\n try {\n value = typeof lazy === 'function' ? lazy() : lazy;\n } catch (error) {\n value = error;\n }\n values[key] = serializeValue(value, {\n allowFunctions: true,\n allowSymbols: true,\n rootLabel: '__wywPreval',\n path: [key],\n });\n if (debugPreval) {\n debugPreval[key] = {\n serialized: values[key],\n status: 'serialized',\n };\n }\n });\n\n if (debugEvalFiles && debugPreval && Object.keys(debugPreval).length) {\n debugEvalFiles[id] = {\n ...(debugEvalFiles[id] ?? {}),\n preval: debugPreval,\n };\n }\n\n return { debugEvalFiles, values, modules };\n}\n\nconst handleMessage = async (message) => {\n switch (message.type) {\n case 'INIT': {\n try {\n const initStart = Date.now();\n debug('init:start', message.payload.entrypoint ?? 'eval-runner');\n const encodedGlobals = message.payload.evalOptions.globals ?? {};\n const nextGlobalsSignature = JSON.stringify(\n canonicalizeForSignature(encodedGlobals)\n );\n const nextFeatures = message.payload.features ?? {};\n const nextDebugEvalFiles = Boolean(message.payload.debugEvalFiles);\n const nextEntrypoint = message.payload.entrypoint ?? 'eval-runner';\n const nextHappyDomEnabled = isFeatureEnabled(\n nextFeatures,\n 'happyDOM',\n nextEntrypoint\n );\n const globalsChanged =\n state.globalsSignature !== null &&\n state.globalsSignature !== nextGlobalsSignature;\n const nextGlobals =\n !globalsChanged && state.globalsSignature !== null\n ? state.evalOptions.globals\n : decodeGlobals(encodedGlobals);\n const nextEvalOptions = {\n ...state.evalOptions,\n ...message.payload.evalOptions,\n globals: nextGlobals,\n };\n\n const canReuseContext =\n state.context &&\n state.happyDomEnabled === nextHappyDomEnabled &&\n !globalsChanged;\n const reuseModules = Boolean(message.payload.reuseModules);\n\n if (canReuseContext) {\n const modulesReset = !reuseModules;\n if (modulesReset) {\n resetModuleState();\n } else {\n // Clear resolution caches between sessions even when reusing modules.\n // The broker rebuilds onlyByModule from scratch each session (cleared\n // in evaluate()). If the runner's resolveCache persists, RESOLVE\n // requests for previously-seen (importer, specifier) pairs are\n // skipped, preventing the broker from learning what exports are\n // needed. This can cause a barrel module to be served with a stale\n // `only` set that's missing exports a consumer actually imports,\n // leading to \"does not provide an export named 'X'\" link errors.\n resolveCache.clear();\n resolveInFlight.clear();\n loadInFlight.clear();\n }\n state.evalOptions = nextEvalOptions;\n state.features = nextFeatures;\n state.debugEvalFiles = nextDebugEvalFiles;\n state.entrypoint = nextEntrypoint;\n Object.assign(state.context, {\n __dirname: path.dirname(nextEntrypoint),\n __filename: nextEntrypoint,\n ...nextEvalOptions.globals,\n __wyw_getModule: (moduleId) => getModuleData(moduleId),\n });\n state.globalsSignature = nextGlobalsSignature;\n debug('init:reuse', Date.now() - initStart);\n sendMessage({ type: 'INIT_ACK', id: message.id, modulesReset });\n break;\n }\n\n resetEvaluationState();\n state.evalOptions = nextEvalOptions;\n state.features = nextFeatures;\n state.debugEvalFiles = nextDebugEvalFiles;\n state.entrypoint = nextEntrypoint;\n debug('init:globals', Date.now() - initStart);\n\n const windowStart = Date.now();\n const { context, teardown } = await createVmContext(\n state.entrypoint,\n state.features,\n {\n ...state.evalOptions.globals,\n __wyw_getModule: (moduleId) => getModuleData(moduleId),\n }\n );\n debug('init:context', Date.now() - windowStart);\n state.context = context;\n state.teardown = teardown;\n state.happyDomEnabled = nextHappyDomEnabled;\n state.globalsSignature = nextGlobalsSignature;\n\n // Full context rebuild ⇒ moduleCache was cleared by resetEvaluationState.\n sendMessage({ type: 'INIT_ACK', id: message.id, modulesReset: true });\n debug('init:done', Date.now() - initStart);\n } catch (error) {\n sendMessage({\n type: 'INIT_ACK',\n id: message.id,\n error: serializeError(error),\n });\n }\n break;\n }\n case 'EVAL': {\n evictedThisSession.clear();\n try {\n const { debugEvalFiles, values, modules } = await evaluateEntrypoint(\n message.payload.id\n );\n sendMessage({\n type: 'EVAL_RESULT',\n id: message.id,\n payload: {\n ...(debugEvalFiles ? { debugEvalFiles } : {}),\n values,\n modules,\n evictedIds: Array.from(evictedThisSession),\n },\n });\n } catch (error) {\n sendMessage({\n type: 'EVAL_RESULT',\n id: message.id,\n payload: {\n values: null,\n evictedIds: Array.from(evictedThisSession),\n },\n error: serializeError(error),\n });\n }\n break;\n }\n case 'RESOLVE_RESULT': {\n resolvePending(message.id, message.payload);\n break;\n }\n case 'LOAD_RESULT': {\n handleLoadResult(message.id, message.payload);\n break;\n }\n default:\n break;\n }\n};\n\nlet buffer = '';\nprocess.stdin.setEncoding('utf8');\nprocess.stdin.resume();\nprocess.stdin.on('data', (chunk) => {\n buffer += chunk;\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n lines.forEach((line) => {\n if (!line.trim()) return;\n const message = JSON.parse(line);\n handleMessage(message);\n });\n});\n\nprocess.stdin.on('close', shutdown);\n"],"file":"runner.js"}