@wyw-in-js/transform 1.1.0 → 2.0.0-alpha.0

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 (603) hide show
  1. package/esm/cache.js +426 -289
  2. package/esm/cache.js.map +1 -1
  3. package/esm/debug/fileReporter.js +137 -134
  4. package/esm/debug/fileReporter.js.map +1 -1
  5. package/esm/eval/broker.js +2134 -0
  6. package/esm/eval/broker.js.map +1 -0
  7. package/esm/eval/lru.js +36 -0
  8. package/esm/eval/lru.js.map +1 -0
  9. package/esm/eval/prepareModuleOnDemand.js +21 -0
  10. package/esm/eval/prepareModuleOnDemand.js.map +1 -0
  11. package/esm/eval/protocol.js +2 -0
  12. package/esm/eval/protocol.js.map +1 -0
  13. package/esm/eval/resolverStrategy.js +51 -0
  14. package/esm/eval/resolverStrategy.js.map +1 -0
  15. package/esm/eval/runner.js +1759 -0
  16. package/esm/eval/runner.js.map +1 -0
  17. package/esm/eval/serialize.js +333 -0
  18. package/esm/eval/serialize.js.map +1 -0
  19. package/esm/eval/writeQueue.js +81 -0
  20. package/esm/eval/writeQueue.js.map +1 -0
  21. package/esm/evaluators/index.js +11 -12
  22. package/esm/evaluators/index.js.map +1 -1
  23. package/esm/index.js +25 -29
  24. package/esm/index.js.map +1 -1
  25. package/esm/module.js +896 -520
  26. package/esm/module.js.map +1 -1
  27. package/esm/shaker.js +14 -80
  28. package/esm/shaker.js.map +1 -1
  29. package/esm/transform/BaseEntrypoint.js +162 -164
  30. package/esm/transform/BaseEntrypoint.js.map +1 -1
  31. package/esm/transform/Entrypoint.helpers.js +96 -253
  32. package/esm/transform/Entrypoint.helpers.js.map +1 -1
  33. package/esm/transform/Entrypoint.js +336 -270
  34. package/esm/transform/Entrypoint.js.map +1 -1
  35. package/esm/transform/Entrypoint.types.js +1 -1
  36. package/esm/transform/Entrypoint.types.js.map +1 -1
  37. package/esm/transform/EvaluatedEntrypoint.js +10 -4
  38. package/esm/transform/EvaluatedEntrypoint.js.map +1 -1
  39. package/esm/transform/actions/AbortError.js +6 -6
  40. package/esm/transform/actions/AbortError.js.map +1 -1
  41. package/esm/transform/actions/BaseAction.js +140 -136
  42. package/esm/transform/actions/BaseAction.js.map +1 -1
  43. package/esm/transform/actions/UnprocessedEntrypointError.js +6 -6
  44. package/esm/transform/actions/UnprocessedEntrypointError.js.map +1 -1
  45. package/esm/transform/actions/actionRunner.js +63 -66
  46. package/esm/transform/actions/actionRunner.js.map +1 -1
  47. package/esm/transform/actions/types.js +1 -1
  48. package/esm/transform/actions/types.js.map +1 -1
  49. package/esm/transform/barrelManifest.types.js +2 -0
  50. package/esm/transform/barrelManifest.types.js.map +1 -0
  51. package/esm/transform/generators/baseProcessingHandlers.js +15 -17
  52. package/esm/transform/generators/baseProcessingHandlers.js.map +1 -1
  53. package/esm/transform/generators/collect.js +27 -55
  54. package/esm/transform/generators/collect.js.map +1 -1
  55. package/esm/transform/generators/createStylisPreprocessor.js +353 -321
  56. package/esm/transform/generators/createStylisPreprocessor.js.map +1 -1
  57. package/esm/transform/generators/evalFile.js +48 -47
  58. package/esm/transform/generators/evalFile.js.map +1 -1
  59. package/esm/transform/generators/extract.js +78 -90
  60. package/esm/transform/generators/extract.js.map +1 -1
  61. package/esm/transform/generators/getExports.js +57 -74
  62. package/esm/transform/generators/getExports.js.map +1 -1
  63. package/esm/transform/generators/index.js +11 -11
  64. package/esm/transform/generators/index.js.map +1 -1
  65. package/esm/transform/generators/processEntrypoint.js +78 -67
  66. package/esm/transform/generators/processEntrypoint.js.map +1 -1
  67. package/esm/transform/generators/processImports.js +102 -67
  68. package/esm/transform/generators/processImports.js.map +1 -1
  69. package/esm/transform/generators/resolveImports.js +165 -196
  70. package/esm/transform/generators/resolveImports.js.map +1 -1
  71. package/esm/transform/generators/resolveStaticOxcValues.js +2911 -0
  72. package/esm/transform/generators/resolveStaticOxcValues.js.map +1 -0
  73. package/esm/transform/generators/rewriteOxcBarrelImports.js +822 -0
  74. package/esm/transform/generators/rewriteOxcBarrelImports.js.map +1 -0
  75. package/esm/transform/generators/transform.js +239 -248
  76. package/esm/transform/generators/transform.js.map +1 -1
  77. package/esm/transform/generators/workflow.js +87 -90
  78. package/esm/transform/generators/workflow.js.map +1 -1
  79. package/esm/transform/helpers/loadWywOptions.js +154 -74
  80. package/esm/transform/helpers/loadWywOptions.js.map +1 -1
  81. package/esm/transform/helpers/withDefaultServices.js +13 -22
  82. package/esm/transform/helpers/withDefaultServices.js.map +1 -1
  83. package/esm/transform/isStaticallyEvaluatableModule.js +140 -152
  84. package/esm/transform/isStaticallyEvaluatableModule.js.map +1 -1
  85. package/esm/transform/oxcBarrelManifest.js +349 -0
  86. package/esm/transform/oxcBarrelManifest.js.map +1 -0
  87. package/esm/transform/rootLog.js +3 -3
  88. package/esm/transform/rootLog.js.map +1 -1
  89. package/esm/transform/syntax.js +2 -0
  90. package/esm/transform/syntax.js.map +1 -0
  91. package/esm/transform/types.js +2 -2
  92. package/esm/transform/types.js.map +1 -1
  93. package/esm/transform.js +123 -147
  94. package/esm/transform.js.map +1 -1
  95. package/esm/types.js +4 -1
  96. package/esm/types.js.map +1 -1
  97. package/esm/utils/EventEmitter.js +46 -48
  98. package/esm/utils/EventEmitter.js.map +1 -1
  99. package/esm/utils/ShakerMetadata.js +2 -2
  100. package/esm/utils/ShakerMetadata.js.map +1 -1
  101. package/esm/utils/TransformDiagnostics.js +9 -9
  102. package/esm/utils/TransformDiagnostics.js.map +1 -1
  103. package/esm/utils/TransformMetadata.js +24 -26
  104. package/esm/utils/TransformMetadata.js.map +1 -1
  105. package/esm/utils/applyOxcProcessors.js +1217 -0
  106. package/esm/utils/applyOxcProcessors.js.map +1 -0
  107. package/esm/utils/collectOxcExportsAndImports.js +934 -0
  108. package/esm/utils/collectOxcExportsAndImports.js.map +1 -0
  109. package/esm/utils/collectOxcRuntime.js +220 -0
  110. package/esm/utils/collectOxcRuntime.js.map +1 -0
  111. package/esm/utils/collectOxcTemplateDependencies.js +1398 -0
  112. package/esm/utils/collectOxcTemplateDependencies.js.map +1 -0
  113. package/esm/utils/dispose-polyfill.js +3 -4
  114. package/esm/utils/dispose-polyfill.js.map +1 -1
  115. package/esm/utils/getFileIdx.js +6 -6
  116. package/esm/utils/getFileIdx.js.map +1 -1
  117. package/esm/utils/getPluginKey.js +12 -12
  118. package/esm/utils/getPluginKey.js.map +1 -1
  119. package/esm/utils/getVisitorKeys.js +9 -3
  120. package/esm/utils/getVisitorKeys.js.map +1 -1
  121. package/esm/utils/hasCachedWywPrevalExport.js +23 -0
  122. package/esm/utils/hasCachedWywPrevalExport.js.map +1 -0
  123. package/esm/utils/hasWywPreval.js +5 -5
  124. package/esm/utils/hasWywPreval.js.map +1 -1
  125. package/esm/utils/importOverrides.js +75 -90
  126. package/esm/utils/importOverrides.js.map +1 -1
  127. package/esm/utils/isNode.js +2 -2
  128. package/esm/utils/isNode.js.map +1 -1
  129. package/esm/utils/isNotNull.js +2 -2
  130. package/esm/utils/isNotNull.js.map +1 -1
  131. package/esm/utils/isSerializable.js +11 -11
  132. package/esm/utils/isSerializable.js.map +1 -1
  133. package/esm/utils/oxcAstService.js +121 -0
  134. package/esm/utils/oxcAstService.js.map +1 -0
  135. package/esm/utils/oxcEmit.js +447 -0
  136. package/esm/utils/oxcEmit.js.map +1 -0
  137. package/esm/utils/oxcPreevalStage.js +97 -0
  138. package/esm/utils/oxcPreevalStage.js.map +1 -0
  139. package/esm/utils/oxcPreevalTransforms.js +1054 -0
  140. package/esm/utils/oxcPreevalTransforms.js.map +1 -0
  141. package/esm/utils/oxcShaker.js +662 -0
  142. package/esm/utils/oxcShaker.js.map +1 -0
  143. package/esm/utils/parseOxc.js +37 -0
  144. package/esm/utils/parseOxc.js.map +1 -0
  145. package/esm/utils/parseRequest.js +27 -27
  146. package/esm/utils/parseRequest.js.map +1 -1
  147. package/esm/utils/peek.js +1 -1
  148. package/esm/utils/peek.js.map +1 -1
  149. package/esm/utils/processorLookup.js +125 -0
  150. package/esm/utils/processorLookup.js.map +1 -0
  151. package/esm/utils/resolveWithConditions.js +99 -0
  152. package/esm/utils/resolveWithConditions.js.map +1 -0
  153. package/esm/vm/createVmContext.js +140 -141
  154. package/esm/vm/createVmContext.js.map +1 -1
  155. package/esm/vm/process.js +11 -13
  156. package/esm/vm/process.js.map +1 -1
  157. package/package.json +18 -26
  158. package/types/cache.d.ts +17 -8
  159. package/types/cache.js +237 -95
  160. package/types/debug/fileReporter.js +22 -22
  161. package/types/eval/broker.d.ts +88 -0
  162. package/types/eval/broker.js +2262 -0
  163. package/types/eval/lru.d.ts +10 -0
  164. package/types/eval/lru.js +36 -0
  165. package/types/eval/prepareModuleOnDemand.d.ts +7 -0
  166. package/types/eval/prepareModuleOnDemand.js +24 -0
  167. package/types/eval/protocol.d.ts +97 -0
  168. package/types/eval/protocol.js +1 -0
  169. package/types/eval/resolverStrategy.d.ts +13 -0
  170. package/types/eval/resolverStrategy.js +46 -0
  171. package/types/eval/serialize.d.ts +78 -0
  172. package/types/eval/serialize.js +357 -0
  173. package/types/eval/writeQueue.d.ts +13 -0
  174. package/types/eval/writeQueue.js +80 -0
  175. package/types/evaluators/index.d.ts +2 -2
  176. package/types/evaluators/index.js +6 -9
  177. package/types/index.d.ts +3 -6
  178. package/types/index.js +24 -82
  179. package/types/module.d.ts +35 -7
  180. package/types/module.js +535 -163
  181. package/types/shaker.d.ts +2 -10
  182. package/types/shaker.js +10 -100
  183. package/types/transform/BaseEntrypoint.js +6 -11
  184. package/types/transform/Entrypoint.d.ts +15 -15
  185. package/types/transform/Entrypoint.helpers.d.ts +2 -5
  186. package/types/transform/Entrypoint.helpers.js +43 -203
  187. package/types/transform/Entrypoint.js +130 -53
  188. package/types/transform/Entrypoint.types.d.ts +28 -6
  189. package/types/transform/Entrypoint.types.js +1 -2
  190. package/types/transform/EvaluatedEntrypoint.d.ts +13 -2
  191. package/types/transform/EvaluatedEntrypoint.js +7 -6
  192. package/types/transform/actions/AbortError.js +2 -7
  193. package/types/transform/actions/BaseAction.js +4 -8
  194. package/types/transform/actions/UnprocessedEntrypointError.js +2 -7
  195. package/types/transform/actions/actionRunner.js +8 -12
  196. package/types/transform/actions/types.d.ts +2 -2
  197. package/types/transform/actions/types.js +1 -2
  198. package/types/transform/{barrelManifest.d.ts → barrelManifest.types.d.ts} +0 -2
  199. package/types/transform/barrelManifest.types.js +1 -0
  200. package/types/transform/generators/baseProcessingHandlers.d.ts +4 -5
  201. package/types/transform/generators/baseProcessingHandlers.js +10 -14
  202. package/types/transform/generators/collect.js +13 -39
  203. package/types/transform/generators/createStylisPreprocessor.js +19 -60
  204. package/types/transform/generators/evalFile.d.ts +2 -2
  205. package/types/transform/generators/evalFile.js +26 -28
  206. package/types/transform/generators/extract.js +5 -8
  207. package/types/transform/generators/getExports.js +23 -30
  208. package/types/transform/generators/index.d.ts +2 -2
  209. package/types/transform/generators/index.js +11 -14
  210. package/types/transform/generators/processEntrypoint.d.ts +2 -2
  211. package/types/transform/generators/processEntrypoint.js +60 -26
  212. package/types/transform/generators/processImports.d.ts +0 -3
  213. package/types/transform/generators/processImports.js +60 -20
  214. package/types/transform/generators/resolveImports.js +18 -22
  215. package/types/transform/generators/resolveStaticOxcValues.d.ts +2 -0
  216. package/types/transform/generators/resolveStaticOxcValues.js +3235 -0
  217. package/types/transform/generators/{rewriteBarrelImports.d.ts → rewriteOxcBarrelImports.d.ts} +2 -3
  218. package/types/transform/generators/{rewriteBarrelImports.js → rewriteOxcBarrelImports.js} +282 -225
  219. package/types/transform/generators/transform.d.ts +3 -7
  220. package/types/transform/generators/transform.js +203 -199
  221. package/types/transform/generators/workflow.js +62 -45
  222. package/types/transform/helpers/loadWywOptions.js +94 -20
  223. package/types/transform/helpers/withDefaultServices.d.ts +1 -1
  224. package/types/transform/helpers/withDefaultServices.js +6 -44
  225. package/types/transform/isStaticallyEvaluatableModule.d.ts +1 -2
  226. package/types/transform/isStaticallyEvaluatableModule.js +125 -126
  227. package/types/transform/oxcBarrelManifest.d.ts +2 -0
  228. package/types/transform/{barrelManifest.js → oxcBarrelManifest.js} +156 -97
  229. package/types/transform/rootLog.js +2 -5
  230. package/types/transform/syntax.d.ts +38 -0
  231. package/types/transform/syntax.js +1 -0
  232. package/types/transform/types.d.ts +9 -6
  233. package/types/transform/types.js +1 -4
  234. package/types/transform.d.ts +2 -2
  235. package/types/transform.js +88 -101
  236. package/types/types.d.ts +0 -23
  237. package/types/types.js +1 -2
  238. package/types/utils/EventEmitter.js +3 -9
  239. package/types/utils/ShakerMetadata.js +1 -5
  240. package/types/utils/TransformDiagnostics.js +3 -7
  241. package/types/utils/TransformMetadata.js +8 -16
  242. package/types/utils/applyOxcProcessors.d.ts +16 -0
  243. package/types/utils/applyOxcProcessors.js +1391 -0
  244. package/types/utils/collectOxcExportsAndImports.d.ts +35 -0
  245. package/types/utils/collectOxcExportsAndImports.js +957 -0
  246. package/types/utils/collectOxcRuntime.d.ts +14 -0
  247. package/types/utils/collectOxcRuntime.js +250 -0
  248. package/types/utils/collectOxcTemplateDependencies.d.ts +38 -0
  249. package/types/utils/collectOxcTemplateDependencies.js +1580 -0
  250. package/types/utils/getFileIdx.js +1 -4
  251. package/types/utils/getPluginKey.d.ts +5 -2
  252. package/types/utils/getPluginKey.js +2 -6
  253. package/types/utils/getVisitorKeys.d.ts +4 -4
  254. package/types/utils/getVisitorKeys.js +9 -6
  255. package/types/utils/hasCachedWywPrevalExport.d.ts +14 -0
  256. package/types/utils/hasCachedWywPrevalExport.js +30 -0
  257. package/types/utils/hasWywPreval.js +1 -4
  258. package/types/utils/importOverrides.js +17 -27
  259. package/types/utils/isNode.d.ts +2 -2
  260. package/types/utils/isNode.js +2 -6
  261. package/types/utils/isNotNull.js +1 -4
  262. package/types/utils/isSerializable.js +3 -6
  263. package/types/utils/oxcAstService.d.ts +11 -0
  264. package/types/utils/oxcAstService.js +79 -0
  265. package/types/utils/oxcEmit.d.ts +19 -0
  266. package/types/utils/oxcEmit.js +506 -0
  267. package/types/utils/oxcPreevalStage.d.ts +20 -0
  268. package/types/utils/oxcPreevalStage.js +102 -0
  269. package/types/utils/oxcPreevalTransforms.d.ts +13 -0
  270. package/types/utils/oxcPreevalTransforms.js +1179 -0
  271. package/types/utils/oxcShaker.d.ts +13 -0
  272. package/types/utils/oxcShaker.js +751 -0
  273. package/types/utils/parseOxc.d.ts +11 -0
  274. package/types/utils/parseOxc.js +38 -0
  275. package/types/utils/parseRequest.js +2 -7
  276. package/types/utils/peek.js +1 -5
  277. package/types/utils/processorLookup.d.ts +8 -0
  278. package/types/utils/processorLookup.js +135 -0
  279. package/types/utils/resolveWithConditions.d.ts +12 -0
  280. package/types/utils/resolveWithConditions.js +103 -0
  281. package/types/vm/createVmContext.d.ts +2 -2
  282. package/types/vm/createVmContext.js +25 -62
  283. package/types/vm/process.js +20 -26
  284. package/esm/babel.js +0 -2
  285. package/esm/babel.js.map +0 -1
  286. package/esm/options/buildOptions.js +0 -168
  287. package/esm/options/buildOptions.js.map +0 -1
  288. package/esm/options/buildOptions.test.js +0 -138
  289. package/esm/options/buildOptions.test.js.map +0 -1
  290. package/esm/options/loadBabelOptions.js +0 -24
  291. package/esm/options/loadBabelOptions.js.map +0 -1
  292. package/esm/plugins/babel-transform.js +0 -53
  293. package/esm/plugins/babel-transform.js.map +0 -1
  294. package/esm/plugins/collector.js +0 -60
  295. package/esm/plugins/collector.js.map +0 -1
  296. package/esm/plugins/dynamic-import.js +0 -56
  297. package/esm/plugins/dynamic-import.js.map +0 -1
  298. package/esm/plugins/preeval.js +0 -73
  299. package/esm/plugins/preeval.js.map +0 -1
  300. package/esm/plugins/shaker.js +0 -680
  301. package/esm/plugins/shaker.js.map +0 -1
  302. package/esm/transform/barrelManifest.js +0 -291
  303. package/esm/transform/barrelManifest.js.map +0 -1
  304. package/esm/transform/generators/explodeReexports.js +0 -64
  305. package/esm/transform/generators/explodeReexports.js.map +0 -1
  306. package/esm/transform/generators/rewriteBarrelImports.js +0 -733
  307. package/esm/transform/generators/rewriteBarrelImports.js.map +0 -1
  308. package/esm/utils/addIdentifierToWywPreval.js +0 -68
  309. package/esm/utils/addIdentifierToWywPreval.js.map +0 -1
  310. package/esm/utils/collectExportsAndImports.js +0 -1157
  311. package/esm/utils/collectExportsAndImports.js.map +0 -1
  312. package/esm/utils/collectTemplateDependencies.js +0 -228
  313. package/esm/utils/collectTemplateDependencies.js.map +0 -1
  314. package/esm/utils/createId.js +0 -6
  315. package/esm/utils/createId.js.map +0 -1
  316. package/esm/utils/findIdentifiers.js +0 -62
  317. package/esm/utils/findIdentifiers.js.map +0 -1
  318. package/esm/utils/getConstantStringValue.js +0 -58
  319. package/esm/utils/getConstantStringValue.js.map +0 -1
  320. package/esm/utils/getMemberExpressionPropertyName.js +0 -11
  321. package/esm/utils/getMemberExpressionPropertyName.js.map +0 -1
  322. package/esm/utils/getScope.js +0 -6
  323. package/esm/utils/getScope.js.map +0 -1
  324. package/esm/utils/getSource.js +0 -15
  325. package/esm/utils/getSource.js.map +0 -1
  326. package/esm/utils/getTagProcessor.js +0 -404
  327. package/esm/utils/getTagProcessor.js.map +0 -1
  328. package/esm/utils/isExports.js +0 -22
  329. package/esm/utils/isExports.js.map +0 -1
  330. package/esm/utils/isGlobal.js +0 -6
  331. package/esm/utils/isGlobal.js.map +0 -1
  332. package/esm/utils/isNodePath.js +0 -4
  333. package/esm/utils/isNodePath.js.map +0 -1
  334. package/esm/utils/isRemoved.js +0 -46
  335. package/esm/utils/isRemoved.js.map +0 -1
  336. package/esm/utils/isRequire.js +0 -13
  337. package/esm/utils/isRequire.js.map +0 -1
  338. package/esm/utils/isTypedNode.js +0 -6
  339. package/esm/utils/isTypedNode.js.map +0 -1
  340. package/esm/utils/isUnnecessaryReactCall.js +0 -72
  341. package/esm/utils/isUnnecessaryReactCall.js.map +0 -1
  342. package/esm/utils/removeDangerousCode.js +0 -276
  343. package/esm/utils/removeDangerousCode.js.map +0 -1
  344. package/esm/utils/replaceImportMetaEnv.js +0 -44
  345. package/esm/utils/replaceImportMetaEnv.js.map +0 -1
  346. package/esm/utils/scopeHelpers.js +0 -527
  347. package/esm/utils/scopeHelpers.js.map +0 -1
  348. package/esm/utils/traversalCache.js +0 -23
  349. package/esm/utils/traversalCache.js.map +0 -1
  350. package/esm/utils/unwrapExpression.js +0 -18
  351. package/esm/utils/unwrapExpression.js.map +0 -1
  352. package/esm/utils/unwrapSequence.js +0 -14
  353. package/esm/utils/unwrapSequence.js.map +0 -1
  354. package/esm/utils/valueToLiteral.js +0 -59
  355. package/esm/utils/valueToLiteral.js.map +0 -1
  356. package/esm/utils/visitors/JSXElementsRemover.js +0 -51
  357. package/esm/utils/visitors/JSXElementsRemover.js.map +0 -1
  358. package/lib/babel.js +0 -2
  359. package/lib/babel.js.map +0 -1
  360. package/lib/cache.js +0 -308
  361. package/lib/cache.js.map +0 -1
  362. package/lib/debug/fileReporter.js +0 -153
  363. package/lib/debug/fileReporter.js.map +0 -1
  364. package/lib/evaluators/index.js +0 -20
  365. package/lib/evaluators/index.js.map +0 -1
  366. package/lib/index.js +0 -286
  367. package/lib/index.js.map +0 -1
  368. package/lib/module.js +0 -552
  369. package/lib/module.js.map +0 -1
  370. package/lib/options/buildOptions.js +0 -176
  371. package/lib/options/buildOptions.js.map +0 -1
  372. package/lib/options/buildOptions.test.js +0 -141
  373. package/lib/options/buildOptions.test.js.map +0 -1
  374. package/lib/options/loadBabelOptions.js +0 -31
  375. package/lib/options/loadBabelOptions.js.map +0 -1
  376. package/lib/plugins/babel-transform.js +0 -60
  377. package/lib/plugins/babel-transform.js.map +0 -1
  378. package/lib/plugins/collector.js +0 -70
  379. package/lib/plugins/collector.js.map +0 -1
  380. package/lib/plugins/dynamic-import.js +0 -61
  381. package/lib/plugins/dynamic-import.js.map +0 -1
  382. package/lib/plugins/preeval.js +0 -81
  383. package/lib/plugins/preeval.js.map +0 -1
  384. package/lib/plugins/shaker.js +0 -691
  385. package/lib/plugins/shaker.js.map +0 -1
  386. package/lib/shaker.js +0 -95
  387. package/lib/shaker.js.map +0 -1
  388. package/lib/transform/BaseEntrypoint.js +0 -179
  389. package/lib/transform/BaseEntrypoint.js.map +0 -1
  390. package/lib/transform/Entrypoint.helpers.js +0 -279
  391. package/lib/transform/Entrypoint.helpers.js.map +0 -1
  392. package/lib/transform/Entrypoint.js +0 -289
  393. package/lib/transform/Entrypoint.js.map +0 -1
  394. package/lib/transform/Entrypoint.types.js +0 -2
  395. package/lib/transform/Entrypoint.types.js.map +0 -1
  396. package/lib/transform/EvaluatedEntrypoint.js +0 -13
  397. package/lib/transform/EvaluatedEntrypoint.js.map +0 -1
  398. package/lib/transform/actions/AbortError.js +0 -16
  399. package/lib/transform/actions/AbortError.js.map +0 -1
  400. package/lib/transform/actions/BaseAction.js +0 -150
  401. package/lib/transform/actions/BaseAction.js.map +0 -1
  402. package/lib/transform/actions/UnprocessedEntrypointError.js +0 -16
  403. package/lib/transform/actions/UnprocessedEntrypointError.js.map +0 -1
  404. package/lib/transform/actions/actionRunner.js +0 -82
  405. package/lib/transform/actions/actionRunner.js.map +0 -1
  406. package/lib/transform/actions/types.js +0 -2
  407. package/lib/transform/actions/types.js.map +0 -1
  408. package/lib/transform/barrelManifest.js +0 -300
  409. package/lib/transform/barrelManifest.js.map +0 -1
  410. package/lib/transform/generators/baseProcessingHandlers.js +0 -27
  411. package/lib/transform/generators/baseProcessingHandlers.js.map +0 -1
  412. package/lib/transform/generators/collect.js +0 -66
  413. package/lib/transform/generators/collect.js.map +0 -1
  414. package/lib/transform/generators/createStylisPreprocessor.js +0 -372
  415. package/lib/transform/generators/createStylisPreprocessor.js.map +0 -1
  416. package/lib/transform/generators/evalFile.js +0 -57
  417. package/lib/transform/generators/evalFile.js.map +0 -1
  418. package/lib/transform/generators/explodeReexports.js +0 -71
  419. package/lib/transform/generators/explodeReexports.js.map +0 -1
  420. package/lib/transform/generators/extract.js +0 -102
  421. package/lib/transform/generators/extract.js.map +0 -1
  422. package/lib/transform/generators/getExports.js +0 -85
  423. package/lib/transform/generators/getExports.js.map +0 -1
  424. package/lib/transform/generators/index.js +0 -19
  425. package/lib/transform/generators/index.js.map +0 -1
  426. package/lib/transform/generators/processEntrypoint.js +0 -76
  427. package/lib/transform/generators/processEntrypoint.js.map +0 -1
  428. package/lib/transform/generators/processImports.js +0 -82
  429. package/lib/transform/generators/processImports.js.map +0 -1
  430. package/lib/transform/generators/resolveImports.js +0 -221
  431. package/lib/transform/generators/resolveImports.js.map +0 -1
  432. package/lib/transform/generators/rewriteBarrelImports.js +0 -743
  433. package/lib/transform/generators/rewriteBarrelImports.js.map +0 -1
  434. package/lib/transform/generators/transform.js +0 -272
  435. package/lib/transform/generators/transform.js.map +0 -1
  436. package/lib/transform/generators/workflow.js +0 -100
  437. package/lib/transform/generators/workflow.js.map +0 -1
  438. package/lib/transform/helpers/loadWywOptions.js +0 -88
  439. package/lib/transform/helpers/loadWywOptions.js.map +0 -1
  440. package/lib/transform/helpers/withDefaultServices.js +0 -31
  441. package/lib/transform/helpers/withDefaultServices.js.map +0 -1
  442. package/lib/transform/isStaticallyEvaluatableModule.js +0 -159
  443. package/lib/transform/isStaticallyEvaluatableModule.js.map +0 -1
  444. package/lib/transform/rootLog.js +0 -9
  445. package/lib/transform/rootLog.js.map +0 -1
  446. package/lib/transform/types.js +0 -8
  447. package/lib/transform/types.js.map +0 -1
  448. package/lib/transform.js +0 -160
  449. package/lib/transform.js.map +0 -1
  450. package/lib/types.js +0 -2
  451. package/lib/types.js.map +0 -1
  452. package/lib/utils/EventEmitter.js +0 -61
  453. package/lib/utils/EventEmitter.js.map +0 -1
  454. package/lib/utils/ShakerMetadata.js +0 -9
  455. package/lib/utils/ShakerMetadata.js.map +0 -1
  456. package/lib/utils/TransformDiagnostics.js +0 -20
  457. package/lib/utils/TransformDiagnostics.js.map +0 -1
  458. package/lib/utils/TransformMetadata.js +0 -45
  459. package/lib/utils/TransformMetadata.js.map +0 -1
  460. package/lib/utils/addIdentifierToWywPreval.js +0 -75
  461. package/lib/utils/addIdentifierToWywPreval.js.map +0 -1
  462. package/lib/utils/collectExportsAndImports.js +0 -1173
  463. package/lib/utils/collectExportsAndImports.js.map +0 -1
  464. package/lib/utils/collectTemplateDependencies.js +0 -242
  465. package/lib/utils/collectTemplateDependencies.js.map +0 -1
  466. package/lib/utils/createId.js +0 -13
  467. package/lib/utils/createId.js.map +0 -1
  468. package/lib/utils/dispose-polyfill.js +0 -9
  469. package/lib/utils/dispose-polyfill.js.map +0 -1
  470. package/lib/utils/findIdentifiers.js +0 -73
  471. package/lib/utils/findIdentifiers.js.map +0 -1
  472. package/lib/utils/getConstantStringValue.js +0 -66
  473. package/lib/utils/getConstantStringValue.js.map +0 -1
  474. package/lib/utils/getFileIdx.js +0 -16
  475. package/lib/utils/getFileIdx.js.map +0 -1
  476. package/lib/utils/getMemberExpressionPropertyName.js +0 -18
  477. package/lib/utils/getMemberExpressionPropertyName.js.map +0 -1
  478. package/lib/utils/getPluginKey.js +0 -21
  479. package/lib/utils/getPluginKey.js.map +0 -1
  480. package/lib/utils/getScope.js +0 -12
  481. package/lib/utils/getScope.js.map +0 -1
  482. package/lib/utils/getSource.js +0 -24
  483. package/lib/utils/getSource.js.map +0 -1
  484. package/lib/utils/getTagProcessor.js +0 -424
  485. package/lib/utils/getTagProcessor.js.map +0 -1
  486. package/lib/utils/getVisitorKeys.js +0 -11
  487. package/lib/utils/getVisitorKeys.js.map +0 -1
  488. package/lib/utils/hasWywPreval.js +0 -13
  489. package/lib/utils/hasWywPreval.js.map +0 -1
  490. package/lib/utils/importOverrides.js +0 -119
  491. package/lib/utils/importOverrides.js.map +0 -1
  492. package/lib/utils/isExports.js +0 -27
  493. package/lib/utils/isExports.js.map +0 -1
  494. package/lib/utils/isGlobal.js +0 -13
  495. package/lib/utils/isGlobal.js.map +0 -1
  496. package/lib/utils/isNode.js +0 -9
  497. package/lib/utils/isNode.js.map +0 -1
  498. package/lib/utils/isNodePath.js +0 -10
  499. package/lib/utils/isNodePath.js.map +0 -1
  500. package/lib/utils/isNotNull.js +0 -10
  501. package/lib/utils/isNotNull.js.map +0 -1
  502. package/lib/utils/isRemoved.js +0 -52
  503. package/lib/utils/isRemoved.js.map +0 -1
  504. package/lib/utils/isRequire.js +0 -18
  505. package/lib/utils/isRequire.js.map +0 -1
  506. package/lib/utils/isSerializable.js +0 -19
  507. package/lib/utils/isSerializable.js.map +0 -1
  508. package/lib/utils/isTypedNode.js +0 -13
  509. package/lib/utils/isTypedNode.js.map +0 -1
  510. package/lib/utils/isUnnecessaryReactCall.js +0 -81
  511. package/lib/utils/isUnnecessaryReactCall.js.map +0 -1
  512. package/lib/utils/parseRequest.js +0 -37
  513. package/lib/utils/parseRequest.js.map +0 -1
  514. package/lib/utils/peek.js +0 -9
  515. package/lib/utils/peek.js.map +0 -1
  516. package/lib/utils/removeDangerousCode.js +0 -284
  517. package/lib/utils/removeDangerousCode.js.map +0 -1
  518. package/lib/utils/replaceImportMetaEnv.js +0 -50
  519. package/lib/utils/replaceImportMetaEnv.js.map +0 -1
  520. package/lib/utils/scopeHelpers.js +0 -557
  521. package/lib/utils/scopeHelpers.js.map +0 -1
  522. package/lib/utils/traversalCache.js +0 -31
  523. package/lib/utils/traversalCache.js.map +0 -1
  524. package/lib/utils/unwrapExpression.js +0 -25
  525. package/lib/utils/unwrapExpression.js.map +0 -1
  526. package/lib/utils/unwrapSequence.js +0 -20
  527. package/lib/utils/unwrapSequence.js.map +0 -1
  528. package/lib/utils/valueToLiteral.js +0 -65
  529. package/lib/utils/valueToLiteral.js.map +0 -1
  530. package/lib/utils/visitors/JSXElementsRemover.js +0 -57
  531. package/lib/utils/visitors/JSXElementsRemover.js.map +0 -1
  532. package/lib/vm/createVmContext.js +0 -166
  533. package/lib/vm/createVmContext.js.map +0 -1
  534. package/lib/vm/process.js +0 -38
  535. package/lib/vm/process.js.map +0 -1
  536. package/types/babel.d.ts +0 -2
  537. package/types/babel.js +0 -2
  538. package/types/options/buildOptions.d.ts +0 -6
  539. package/types/options/buildOptions.js +0 -178
  540. package/types/options/loadBabelOptions.d.ts +0 -3
  541. package/types/options/loadBabelOptions.js +0 -26
  542. package/types/plugins/babel-transform.d.ts +0 -4
  543. package/types/plugins/babel-transform.js +0 -49
  544. package/types/plugins/collector.d.ts +0 -23
  545. package/types/plugins/collector.js +0 -62
  546. package/types/plugins/dynamic-import.d.ts +0 -6
  547. package/types/plugins/dynamic-import.js +0 -60
  548. package/types/plugins/preeval.d.ts +0 -16
  549. package/types/plugins/preeval.js +0 -69
  550. package/types/plugins/shaker.d.ts +0 -14
  551. package/types/plugins/shaker.js +0 -724
  552. package/types/transform/generators/explodeReexports.d.ts +0 -7
  553. package/types/transform/generators/explodeReexports.js +0 -65
  554. package/types/utils/addIdentifierToWywPreval.d.ts +0 -4
  555. package/types/utils/addIdentifierToWywPreval.js +0 -74
  556. package/types/utils/collectExportsAndImports.d.ts +0 -31
  557. package/types/utils/collectExportsAndImports.js +0 -1147
  558. package/types/utils/collectTemplateDependencies.d.ts +0 -17
  559. package/types/utils/collectTemplateDependencies.js +0 -220
  560. package/types/utils/createId.d.ts +0 -2
  561. package/types/utils/createId.js +0 -9
  562. package/types/utils/findIdentifiers.d.ts +0 -6
  563. package/types/utils/findIdentifiers.js +0 -67
  564. package/types/utils/getConstantStringValue.d.ts +0 -2
  565. package/types/utils/getConstantStringValue.js +0 -94
  566. package/types/utils/getMemberExpressionPropertyName.d.ts +0 -2
  567. package/types/utils/getMemberExpressionPropertyName.js +0 -46
  568. package/types/utils/getScope.d.ts +0 -2
  569. package/types/utils/getScope.js +0 -10
  570. package/types/utils/getSource.d.ts +0 -2
  571. package/types/utils/getSource.js +0 -22
  572. package/types/utils/getTagProcessor.d.ts +0 -13
  573. package/types/utils/getTagProcessor.js +0 -411
  574. package/types/utils/isExports.d.ts +0 -6
  575. package/types/utils/isExports.js +0 -19
  576. package/types/utils/isGlobal.d.ts +0 -2
  577. package/types/utils/isGlobal.js +0 -9
  578. package/types/utils/isNodePath.d.ts +0 -3
  579. package/types/utils/isNodePath.js +0 -6
  580. package/types/utils/isRemoved.d.ts +0 -5
  581. package/types/utils/isRemoved.js +0 -41
  582. package/types/utils/isRequire.d.ts +0 -6
  583. package/types/utils/isRequire.js +0 -14
  584. package/types/utils/isTypedNode.d.ts +0 -5
  585. package/types/utils/isTypedNode.js +0 -9
  586. package/types/utils/isUnnecessaryReactCall.d.ts +0 -3
  587. package/types/utils/isUnnecessaryReactCall.js +0 -75
  588. package/types/utils/removeDangerousCode.d.ts +0 -4
  589. package/types/utils/removeDangerousCode.js +0 -326
  590. package/types/utils/replaceImportMetaEnv.d.ts +0 -3
  591. package/types/utils/replaceImportMetaEnv.js +0 -39
  592. package/types/utils/scopeHelpers.d.ts +0 -12
  593. package/types/utils/scopeHelpers.js +0 -580
  594. package/types/utils/traversalCache.d.ts +0 -4
  595. package/types/utils/traversalCache.js +0 -27
  596. package/types/utils/unwrapExpression.d.ts +0 -2
  597. package/types/utils/unwrapExpression.js +0 -57
  598. package/types/utils/unwrapSequence.d.ts +0 -8
  599. package/types/utils/unwrapSequence.js +0 -16
  600. package/types/utils/valueToLiteral.d.ts +0 -3
  601. package/types/utils/valueToLiteral.js +0 -63
  602. package/types/utils/visitors/JSXElementsRemover.d.ts +0 -3
  603. package/types/utils/visitors/JSXElementsRemover.js +0 -51
package/lib/module.js DELETED
@@ -1,552 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Module = exports.DefaultModuleImplementation = void 0;
7
- var _fs = _interopRequireDefault(require("fs"));
8
- var _module = _interopRequireDefault(require("module"));
9
- var _path = _interopRequireDefault(require("path"));
10
- var _vm = _interopRequireDefault(require("vm"));
11
- var _tsInvariant = require("ts-invariant");
12
- var _shared = require("@wyw-in-js/shared");
13
- require("./utils/dispose-polyfill");
14
- var _Entrypoint = require("./transform/Entrypoint");
15
- var _Entrypoint2 = require("./transform/Entrypoint.helpers");
16
- var _UnprocessedEntrypointError = require("./transform/actions/UnprocessedEntrypointError");
17
- var _importOverrides = require("./utils/importOverrides");
18
- var _parseRequest = require("./utils/parseRequest");
19
- var _createVmContext = require("./vm/createVmContext");
20
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
- /**
22
- * This is a custom implementation for the module system for evaluating code,
23
- * used for resolving values for dependencies interpolated in `css` or `styled`.
24
- *
25
- * This serves 2 purposes:
26
- * - Avoid leakage from evaluated code to module cache in current context, e.g. `babel-register`
27
- * - Allow us to invalidate the module cache without affecting other stuff, necessary for rebuilds
28
- *
29
- * We also use it to transpile the code with Babel by default.
30
- * We also store source maps for it to provide correct error stacktraces.
31
- *
32
- */
33
-
34
- const CJS_DEFAULT_CONDITIONS = ['require', 'node', 'default'];
35
- function expandConditions(conditionNames) {
36
- const result = new Set();
37
- for (const name of conditionNames) {
38
- if (name === '...') {
39
- for (const d of CJS_DEFAULT_CONDITIONS) result.add(d);
40
- } else {
41
- result.add(name);
42
- }
43
- }
44
- return result;
45
- }
46
- function isBarePackageSubpath(id) {
47
- if (id.startsWith('.') || _path.default.isAbsolute(id)) {
48
- return false;
49
- }
50
- if (id.startsWith('@')) {
51
- return id.split('/').length > 2;
52
- }
53
- return id.includes('/');
54
- }
55
- const DefaultModuleImplementation = exports.DefaultModuleImplementation = _module.default;
56
-
57
- // Supported node builtins based on the modules polyfilled by webpack
58
- // `true` means module is polyfilled, `false` means module is empty
59
- const builtins = {
60
- assert: true,
61
- buffer: true,
62
- child_process: false,
63
- cluster: false,
64
- console: true,
65
- constants: true,
66
- crypto: true,
67
- dgram: false,
68
- dns: false,
69
- domain: true,
70
- events: true,
71
- fs: false,
72
- http: true,
73
- https: true,
74
- module: false,
75
- net: false,
76
- os: true,
77
- path: true,
78
- punycode: true,
79
- process: true,
80
- querystring: true,
81
- readline: false,
82
- repl: false,
83
- stream: true,
84
- string_decoder: true,
85
- sys: true,
86
- timers: true,
87
- tls: false,
88
- tty: true,
89
- url: true,
90
- util: true,
91
- vm: true,
92
- zlib: true
93
- };
94
- const VITE_VIRTUAL_PREFIX = '/@';
95
- const REACT_REFRESH_VIRTUAL_ID = '/@react-refresh';
96
- const reactRefreshRuntime = {
97
- createSignatureFunctionForTransform: () => () => {}
98
- };
99
- const NOOP = () => {};
100
- const browserOnlyEvalHintTriggers = ['window is not defined', "evaluating 'window", 'document is not defined', "evaluating 'document", 'navigator is not defined', "evaluating 'navigator", 'self is not defined', "evaluating 'self"];
101
- const getBrowserOnlyEvalHint = error => {
102
- const message = error instanceof Error ? error.message : String(error);
103
- const looksLikeBrowserOnly = browserOnlyEvalHintTriggers.some(trigger => message.includes(trigger));
104
- if (!looksLikeBrowserOnly) return null;
105
- return ['', '[wyw-in-js] Evaluation hint:', 'This usually means browser-only code ran during build-time evaluation.', 'Move browser-only initialization out of evaluated modules, or mock the import via `importOverrides`.', "Example: importOverrides: { 'msw/browser': { mock: './src/__mocks__/msw-browser.js' } }"].join('\n');
106
- };
107
- const warnedUnknownImportsByServices = new WeakMap();
108
- function emitWarning(services, message) {
109
- if (services.emitWarning) {
110
- services.emitWarning(message);
111
- return;
112
- }
113
-
114
- // eslint-disable-next-line no-console
115
- console.warn(message);
116
- }
117
- function getWarnedUnknownImports(services) {
118
- const cached = warnedUnknownImportsByServices.get(services);
119
- if (cached) {
120
- return cached;
121
- }
122
- const created = new Set();
123
- warnedUnknownImportsByServices.set(services, created);
124
- return created;
125
- }
126
- function getUncached(cached, test) {
127
- const cachedSet = new Set(typeof cached === 'string' ? cached.split(',') : cached);
128
- if (cachedSet.has('*')) {
129
- return [];
130
- }
131
- return test.filter(t => !cachedSet.has(t));
132
- }
133
- function resolve(id) {
134
- const {
135
- resolved
136
- } = this.resolveDependency(id);
137
- (0, _tsInvariant.invariant)(resolved, `Unable to resolve "${id}"`);
138
- return resolved;
139
- }
140
- const defaultImportLoaders = {
141
- raw: 'raw',
142
- url: 'url'
143
- };
144
- class Module {
145
- callstack = [];
146
- isEvaluated = false;
147
- require = Object.assign(id => {
148
- if (id === REACT_REFRESH_VIRTUAL_ID) {
149
- this.dependencies.push(id);
150
- this.debug('require', `vite virtual '${id}'`);
151
- return reactRefreshRuntime;
152
- }
153
- if (id.startsWith(VITE_VIRTUAL_PREFIX)) {
154
- this.dependencies.push(id);
155
- this.debug('require', `vite virtual '${id}'`);
156
- return {};
157
- }
158
- if (id in builtins) {
159
- // The module is in the allowed list of builtin node modules
160
- // Ideally we should prevent importing them, but webpack polyfills some
161
- // So we check for the list of polyfills to determine which ones to support
162
- if (builtins[id]) {
163
- this.debug('require', `builtin '${id}'`);
164
- return require(id);
165
- }
166
- return null;
167
- }
168
-
169
- // Resolve module id (and filename) relatively to parent module
170
- const dependency = this.resolveDependency(id);
171
- if (dependency.resolved === id && !_path.default.isAbsolute(id)) {
172
- // The module is a builtin node modules, but not in the allowed list
173
- throw new Error(`Unable to import "${id}". Importing Node builtins is not supported in the sandbox.`);
174
- }
175
- (0, _tsInvariant.invariant)(dependency.resolved, `Dependency ${dependency.source} cannot be resolved`);
176
- const loaded = this.loadByImportLoaders(id, dependency.resolved);
177
- if (loaded.handled) {
178
- this.dependencies.push(id);
179
- this.debug('require', `${id} -> ${dependency.resolved} (loader)`);
180
- return loaded.value;
181
- }
182
- this.dependencies.push(id);
183
- this.debug('require', `${id} -> ${dependency.resolved}`);
184
- const entrypoint = this.getEntrypoint(dependency.resolved, dependency.only, this.debug);
185
- if (entrypoint === null) {
186
- return dependency.resolved;
187
- }
188
- if (entrypoint.evaluated || (0, _Entrypoint2.isSuperSet)(entrypoint.evaluatedOnly, dependency.only)) {
189
- return entrypoint.exports;
190
- }
191
- const m = this.createChild(entrypoint);
192
- m.evaluate();
193
- return entrypoint.exports;
194
- }, {
195
- ensure: NOOP,
196
- resolve: resolve.bind(this)
197
- });
198
- resolve = resolve.bind(this);
199
- #entrypointRef;
200
- constructor(services, entrypoint, parentModule, moduleImpl = DefaultModuleImplementation) {
201
- var _parentModule$ignored, _entrypoint$ignored;
202
- this.services = services;
203
- this.moduleImpl = moduleImpl;
204
- this.cache = services.cache;
205
- this.#entrypointRef = (0, _shared.isFeatureEnabled)(services.options.pluginOptions.features, 'useWeakRefInEval', entrypoint.name) ? new WeakRef(entrypoint) : entrypoint;
206
- this.idx = entrypoint.idx;
207
- this.id = entrypoint.name;
208
- this.filename = entrypoint.name;
209
- this.dependencies = [];
210
- this.debug = entrypoint.log.extend('module');
211
- this.parentIsIgnored = (_parentModule$ignored = parentModule === null || parentModule === void 0 ? void 0 : parentModule.ignored) !== null && _parentModule$ignored !== void 0 ? _parentModule$ignored : false;
212
- this.ignored = (_entrypoint$ignored = entrypoint.ignored) !== null && _entrypoint$ignored !== void 0 ? _entrypoint$ignored : this.parentIsIgnored;
213
- if (parentModule) {
214
- this.callstack = [entrypoint.name, ...parentModule.callstack];
215
- } else {
216
- this.callstack = [entrypoint.name];
217
- }
218
- this.extensions = services.options.pluginOptions.extensions;
219
- this.debug('init', entrypoint.name);
220
- }
221
- get exports() {
222
- return this.entrypoint.exports;
223
- }
224
- set exports(value) {
225
- this.entrypoint.exports = value;
226
- this.debug('the whole exports was overridden with %O', value);
227
- }
228
- get entrypoint() {
229
- const entrypoint = this.#entrypointRef instanceof WeakRef ? this.#entrypointRef.deref() : this.#entrypointRef;
230
- (0, _tsInvariant.invariant)(entrypoint, `Module ${this.idx} is disposed`);
231
- return entrypoint;
232
- }
233
- evaluate() {
234
- const {
235
- entrypoint
236
- } = this;
237
- entrypoint.assertTransformed();
238
- const cached = this.cache.get('entrypoints', entrypoint.name);
239
- let evaluatedCreated = false;
240
- if (!entrypoint.supersededWith) {
241
- this.cache.add('entrypoints', entrypoint.name, entrypoint.createEvaluated());
242
- evaluatedCreated = true;
243
- }
244
- const {
245
- transformedCode: source
246
- } = entrypoint;
247
- const {
248
- pluginOptions
249
- } = this.services.options;
250
- if (!source) {
251
- this.debug(`evaluate`, 'there is nothing to evaluate');
252
- return;
253
- }
254
- if (this.isEvaluated) {
255
- this.debug('evaluate', `is already evaluated`);
256
- return;
257
- }
258
- this.debug('evaluate');
259
- this.debug.extend('source')('%s', source);
260
- this.isEvaluated = true;
261
- const filename = (0, _parseRequest.stripQueryAndHash)(this.filename);
262
- if (/\.json$/.test(filename)) {
263
- // For JSON files, parse it to a JS object similar to Node
264
- this.exports = JSON.parse(source);
265
- return;
266
- }
267
- const {
268
- context,
269
- teardown
270
- } = (0, _createVmContext.createVmContext)(filename, pluginOptions.features, {
271
- module: this,
272
- exports: entrypoint.exports,
273
- require: this.require,
274
- __wyw_dynamic_import: async id => this.require(String(id)),
275
- __dirname: _path.default.dirname(filename)
276
- }, pluginOptions.overrideContext);
277
- try {
278
- const script = new _vm.default.Script(`(function (exports) { ${source}\n})(exports);`, {
279
- filename
280
- });
281
- script.runInContext(context);
282
- } catch (e) {
283
- this.isEvaluated = false;
284
- if (evaluatedCreated) {
285
- this.cache.add('entrypoints', entrypoint.name, cached);
286
- }
287
- if ((0, _UnprocessedEntrypointError.isUnprocessedEntrypointError)(e)) {
288
- // It will be handled by evalFile scenario
289
- throw e;
290
- }
291
- if (e instanceof EvalError) {
292
- this.debug('%O', e);
293
- throw e;
294
- }
295
- this.debug('%O\n%O', e, this.callstack);
296
- const baseMessage = `${e.message} in${this.callstack.join('\n| ')}\n`;
297
- const hint = getBrowserOnlyEvalHint(e);
298
- throw new EvalError(hint ? `${baseMessage}${hint}\n` : baseMessage);
299
- } finally {
300
- teardown();
301
- }
302
- }
303
- getEntrypoint(filename, only, log) {
304
- var _entrypoint$evaluated, _entrypoint;
305
- const strippedFilename = (0, _parseRequest.stripQueryAndHash)(filename);
306
- const extension = _path.default.extname(strippedFilename);
307
- if (extension !== '.json' && !this.extensions.includes(extension)) {
308
- return null;
309
- }
310
- let entrypoint = this.cache.get('entrypoints', filename);
311
- if (entrypoint && (0, _Entrypoint2.isSuperSet)((_entrypoint$evaluated = entrypoint.evaluatedOnly) !== null && _entrypoint$evaluated !== void 0 ? _entrypoint$evaluated : [], only)) {
312
- if (this.cache.checkFreshness(filename, strippedFilename)) {
313
- entrypoint = undefined;
314
- }
315
- if (entrypoint) {
316
- log('✅ file has been already evaluated');
317
- return entrypoint;
318
- }
319
- }
320
- if ((_entrypoint = entrypoint) !== null && _entrypoint !== void 0 && _entrypoint.ignored) {
321
- log('✅ file has been ignored during prepare stage. Original code will be used');
322
- return entrypoint;
323
- }
324
- if (this.ignored) {
325
- log('✅ one of the parent files has been ignored during prepare stage. Original code will be used');
326
- const newEntrypoint = this.entrypoint.createChild(filename, ['*'], _fs.default.readFileSync(strippedFilename, 'utf-8'));
327
- if (newEntrypoint === 'loop') {
328
- const stack = (0, _Entrypoint2.getStack)(this.entrypoint);
329
- throw new Error(`Circular dependency detected: ${stack.join(' -> ')} -> ${filename}`);
330
- }
331
- return newEntrypoint;
332
- }
333
- let uncachedExports = null;
334
- let reprocessOnly = only;
335
- // Requested file can be already prepared for evaluation on the stage 1
336
- if (only && entrypoint) {
337
- var _entrypoint$evaluated2, _entrypoint$only, _entrypoint$evaluated3;
338
- const evaluatedExports = ((_entrypoint$evaluated2 = entrypoint.evaluatedOnly) === null || _entrypoint$evaluated2 === void 0 ? void 0 : _entrypoint$evaluated2.length) !== 0 ? entrypoint.evaluatedOnly : (_entrypoint$only = entrypoint.only) !== null && _entrypoint$only !== void 0 ? _entrypoint$only : [];
339
- uncachedExports = getUncached(evaluatedExports, only);
340
- if (uncachedExports.length === 0) {
341
- log('✅ ready for evaluation');
342
- return entrypoint;
343
- }
344
- if ((_entrypoint$evaluated3 = entrypoint.evaluatedOnly) !== null && _entrypoint$evaluated3 !== void 0 && _entrypoint$evaluated3.length) {
345
- reprocessOnly = (0, _Entrypoint2.mergeOnly)(evaluatedExports, only);
346
- }
347
- log('❌ file has been processed during prepare stage but %o is not evaluated yet (evaluated: %o)', uncachedExports, evaluatedExports);
348
- } else {
349
- log('❌ file has not been processed during prepare stage');
350
- }
351
-
352
- // If code wasn't extracted from cache, it indicates that we were unable
353
- // to process some of the imports on stage1. Let's try to reprocess.
354
- const code = _fs.default.readFileSync(strippedFilename, 'utf-8');
355
- const newEntrypoint = _Entrypoint.Entrypoint.createRoot(this.services, filename, reprocessOnly, code);
356
- if (newEntrypoint.evaluated) {
357
- log('✅ file has been already evaluated');
358
- return newEntrypoint;
359
- }
360
- if (newEntrypoint.ignored) {
361
- log('✅ file has been ignored during prepare stage. Original code will be used');
362
- return newEntrypoint;
363
- }
364
- return newEntrypoint;
365
- }
366
- resolveWithConditions(id, parent, conditions) {
367
- const resolveOptions = conditions ? {
368
- conditions
369
- } : undefined;
370
- const shouldRetryWithExtensions = conditions && _path.default.extname(id) === '' && (id.startsWith('.') || _path.default.isAbsolute(id) || isBarePackageSubpath(id));
371
- try {
372
- return this.moduleImpl._resolveFilename(id, parent, false, resolveOptions);
373
- } catch (e) {
374
- if (shouldRetryWithExtensions && e instanceof Error && e.code === 'MODULE_NOT_FOUND') {
375
- // Extensionless subpath requests (e.g. "pkg/src/*" or "./src/*") may
376
- // resolve to extensionless targets via conditional exports. Retry with
377
- // each known extension, but never rewrite already explicit specifiers.
378
- for (const ext of this.extensions) {
379
- try {
380
- return this.moduleImpl._resolveFilename(id + ext, parent, false, resolveOptions);
381
- } catch {
382
- // try next extension
383
- }
384
- }
385
- }
386
- throw e;
387
- }
388
- }
389
- resolveDependency = id => {
390
- const cached = this.entrypoint.getDependency(id);
391
- (0, _tsInvariant.invariant)(!(cached instanceof Promise), 'Dependency is not resolved yet');
392
- if (cached) {
393
- return cached;
394
- }
395
- if (!this.ignored) {
396
- this.debug('❌ import has not been resolved during prepare stage. Fallback to Node.js resolver');
397
- }
398
- const extensions = this.moduleImpl._extensions;
399
- const added = [];
400
- try {
401
- var _override$unknown;
402
- // Check for supported extensions
403
- this.extensions.forEach(ext => {
404
- if (ext in extensions) {
405
- return;
406
- }
407
-
408
- // When an extension is not supported, add it
409
- // And keep track of it to clean it up after resolving
410
- // Use noop for the transform function since we handle it
411
- extensions[ext] = NOOP;
412
- added.push(ext);
413
- });
414
- const {
415
- filename
416
- } = this;
417
- const strippedId = (0, _parseRequest.stripQueryAndHash)(id);
418
- const parent = {
419
- id: filename,
420
- filename,
421
- paths: this.moduleImpl._nodeModulePaths(_path.default.dirname(filename))
422
- };
423
- const {
424
- conditionNames
425
- } = this.services.options.pluginOptions;
426
- const conditions = conditionNames !== null && conditionNames !== void 0 && conditionNames.length ? expandConditions(conditionNames) : undefined;
427
- let resolved = this.resolveWithConditions(strippedId, parent, conditions);
428
- const isFileSpecifier = strippedId.startsWith('.') || _path.default.isAbsolute(strippedId);
429
- if (isFileSpecifier && _path.default.extname(strippedId) === '' && resolved.endsWith('.cjs') && _fs.default.existsSync(`${resolved.slice(0, -4)}.js`)) {
430
- // When both `.cjs` and `.js` exist for an extensionless specifier, the
431
- // resolver may pick `.cjs` depending on the environment/extensions.
432
- // Prefer `.js` to keep resolved paths stable (e.g. importOverrides keys).
433
- resolved = `${resolved.slice(0, -4)}.js`;
434
- }
435
- const {
436
- root
437
- } = this.services.options;
438
- const keyInfo = (0, _importOverrides.toImportKey)({
439
- source: id,
440
- resolved,
441
- root
442
- });
443
- const override = (0, _importOverrides.getImportOverride)(this.services.options.pluginOptions.importOverrides, keyInfo.key);
444
- const policy = (_override$unknown = override === null || override === void 0 ? void 0 : override.unknown) !== null && _override$unknown !== void 0 ? _override$unknown : override !== null && override !== void 0 && override.mock ? 'allow' : 'warn';
445
- const shouldWarn = !this.ignored && policy === 'warn';
446
- let finalResolved = resolved;
447
- if (override !== null && override !== void 0 && override.mock) {
448
- try {
449
- finalResolved = (0, _importOverrides.resolveMockSpecifier)({
450
- mock: override.mock,
451
- importer: filename,
452
- root,
453
- stack: this.callstack
454
- });
455
- } catch (e) {
456
- var _message;
457
- const errorMessage = String((_message = e === null || e === void 0 ? void 0 : e.message) !== null && _message !== void 0 ? _message : e);
458
- throw new Error(`[wyw-in-js] Failed to resolve import mock for "${keyInfo.key}" (${id} from ${filename}): ${errorMessage}`);
459
- }
460
- }
461
- if (policy === 'error') {
462
- throw new Error([`[wyw-in-js] Unknown import reached during eval (Node resolver fallback)`, ``, `importer: ${filename}`, `source: ${id}`, `resolved: ${resolved}`, override !== null && override !== void 0 && override.mock ? `mock: ${override.mock} -> ${finalResolved}` : ``, ``, `callstack:`, ...this.callstack.map(item => ` ${item}`), ``, `config key: ${keyInfo.key}`].filter(Boolean).join('\n'));
463
- }
464
- const warnedUnknownImports = getWarnedUnknownImports(this.services);
465
- if (shouldWarn && !warnedUnknownImports.has(keyInfo.key)) {
466
- warnedUnknownImports.add(keyInfo.key);
467
- emitWarning(this.services, [`[wyw-in-js] Unknown import reached during eval (Node resolver fallback)`, ``, `importer: ${filename}`, `source: ${id}`, `resolved: ${resolved}`, override !== null && override !== void 0 && override.mock ? `mock: ${override.mock} -> ${finalResolved}` : ``, ``, `callstack:`, ...this.callstack.map(item => ` ${item}`), ``, `config key: ${keyInfo.key}`, `hint: add { importOverrides: { ${JSON.stringify(keyInfo.key)}: { unknown: 'allow' } } } to silence warnings, or use { mock } / { noShake: true } overrides.`].filter(Boolean).join('\n'));
468
- }
469
- return {
470
- source: id,
471
- only: (0, _importOverrides.applyImportOverrideToOnly)(['*'], override),
472
- resolved: finalResolved
473
- };
474
- } finally {
475
- // Cleanup the extensions we added to restore previous behaviour
476
- added.forEach(ext => delete extensions[ext]);
477
- }
478
- };
479
- createChild(entrypoint) {
480
- return new Module(this.services, entrypoint, this, this.moduleImpl);
481
- }
482
- loadByImportLoaders(request, resolved) {
483
- const {
484
- pluginOptions
485
- } = this.services.options;
486
- const importLoaders = pluginOptions.importLoaders === undefined ? defaultImportLoaders : {
487
- ...defaultImportLoaders,
488
- ...pluginOptions.importLoaders
489
- };
490
- const {
491
- query,
492
- hash
493
- } = (0, _parseRequest.parseRequest)(request);
494
- if (!query) return {
495
- handled: false,
496
- value: undefined
497
- };
498
- const params = new URLSearchParams(query);
499
- const matchedKey = Array.from(params.keys()).find(key => importLoaders[key] !== undefined && importLoaders[key] !== false);
500
- if (!matchedKey) return {
501
- handled: false,
502
- value: undefined
503
- };
504
- const loader = importLoaders[matchedKey];
505
- const filename = (0, _parseRequest.stripQueryAndHash)(resolved);
506
- const importer = (0, _parseRequest.stripQueryAndHash)(this.filename);
507
- const importerDir = _path.default.dirname(importer);
508
- const toUrl = () => {
509
- const relative = _path.default.relative(importerDir, filename).replace(/\\/g, _path.default.posix.sep);
510
- if (relative.startsWith('.') || _path.default.isAbsolute(relative)) {
511
- return relative;
512
- }
513
- return `./${relative}`;
514
- };
515
- const readFile = () => _fs.default.readFileSync(filename, 'utf-8');
516
- const context = {
517
- importer,
518
- request,
519
- resolved,
520
- filename,
521
- query,
522
- hash,
523
- emitWarning: message => emitWarning(this.services, message),
524
- readFile,
525
- toUrl
526
- };
527
- if (loader === 'raw') {
528
- return {
529
- handled: true,
530
- value: context.readFile()
531
- };
532
- }
533
- if (loader === 'url') {
534
- return {
535
- handled: true,
536
- value: context.toUrl()
537
- };
538
- }
539
- if (typeof loader === 'function') {
540
- return {
541
- handled: true,
542
- value: loader(context)
543
- };
544
- }
545
- return {
546
- handled: false,
547
- value: undefined
548
- };
549
- }
550
- }
551
- exports.Module = Module;
552
- //# sourceMappingURL=module.js.map
package/lib/module.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.js","names":["_fs","_interopRequireDefault","require","_module","_path","_vm","_tsInvariant","_shared","_Entrypoint","_Entrypoint2","_UnprocessedEntrypointError","_importOverrides","_parseRequest","_createVmContext","e","__esModule","default","CJS_DEFAULT_CONDITIONS","expandConditions","conditionNames","result","Set","name","d","add","isBarePackageSubpath","id","startsWith","path","isAbsolute","split","length","includes","DefaultModuleImplementation","exports","NativeModule","builtins","assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","punycode","process","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","vm","zlib","VITE_VIRTUAL_PREFIX","REACT_REFRESH_VIRTUAL_ID","reactRefreshRuntime","createSignatureFunctionForTransform","NOOP","browserOnlyEvalHintTriggers","getBrowserOnlyEvalHint","error","message","Error","String","looksLikeBrowserOnly","some","trigger","join","warnedUnknownImportsByServices","WeakMap","emitWarning","services","warn","getWarnedUnknownImports","cached","get","created","set","getUncached","test","cachedSet","has","filter","t","resolve","resolved","resolveDependency","invariant","defaultImportLoaders","raw","Module","callstack","isEvaluated","Object","assign","dependencies","push","debug","dependency","source","loaded","loadByImportLoaders","handled","value","entrypoint","getEntrypoint","only","evaluated","isSuperSet","evaluatedOnly","m","createChild","evaluate","ensure","bind","entrypointRef","constructor","parentModule","moduleImpl","_parentModule$ignored","_entrypoint$ignored","cache","isFeatureEnabled","options","pluginOptions","features","WeakRef","idx","filename","log","extend","parentIsIgnored","ignored","extensions","deref","assertTransformed","evaluatedCreated","supersededWith","createEvaluated","transformedCode","stripQueryAndHash","JSON","parse","context","teardown","createVmContext","__wyw_dynamic_import","__dirname","dirname","overrideContext","script","Script","runInContext","isUnprocessedEntrypointError","EvalError","baseMessage","hint","_entrypoint$evaluated","_entrypoint","strippedFilename","extension","extname","checkFreshness","undefined","newEntrypoint","readFileSync","stack","getStack","uncachedExports","reprocessOnly","_entrypoint$evaluated2","_entrypoint$only","_entrypoint$evaluated3","evaluatedExports","mergeOnly","code","Entrypoint","createRoot","resolveWithConditions","parent","conditions","resolveOptions","shouldRetryWithExtensions","_resolveFilename","ext","getDependency","Promise","_extensions","added","_override$unknown","forEach","strippedId","paths","_nodeModulePaths","isFileSpecifier","endsWith","existsSync","slice","root","keyInfo","toImportKey","override","getImportOverride","importOverrides","key","policy","unknown","mock","shouldWarn","finalResolved","resolveMockSpecifier","importer","_message","errorMessage","map","item","Boolean","warnedUnknownImports","stringify","applyImportOverrideToOnly","request","importLoaders","query","hash","parseRequest","params","URLSearchParams","matchedKey","Array","from","keys","find","loader","importerDir","toUrl","relative","replace","posix","sep","readFile"],"sources":["../src/module.ts"],"sourcesContent":["/**\n * This is a custom implementation for the module system for evaluating code,\n * used for resolving values for dependencies interpolated in `css` or `styled`.\n *\n * This serves 2 purposes:\n * - Avoid leakage from evaluated code to module cache in current context, e.g. `babel-register`\n * - Allow us to invalidate the module cache without affecting other stuff, necessary for rebuilds\n *\n * We also use it to transpile the code with Babel by default.\n * We also store source maps for it to provide correct error stacktraces.\n *\n */\n\nimport fs from 'fs';\nimport NativeModule from 'module';\nimport path from 'path';\nimport vm from 'vm';\n\nimport { invariant } from 'ts-invariant';\n\nimport {\n isFeatureEnabled,\n type Debugger,\n type ImportLoaderContext,\n type ImportLoaders,\n} from '@wyw-in-js/shared';\n\nimport './utils/dispose-polyfill';\nimport type { TransformCacheCollection } from './cache';\nimport { Entrypoint } from './transform/Entrypoint';\nimport {\n getStack,\n isSuperSet,\n mergeOnly,\n} from './transform/Entrypoint.helpers';\nimport type { IEntrypointDependency } from './transform/Entrypoint.types';\nimport type { IEvaluatedEntrypoint } from './transform/EvaluatedEntrypoint';\nimport { isUnprocessedEntrypointError } from './transform/actions/UnprocessedEntrypointError';\nimport type { Services } from './transform/types';\nimport {\n applyImportOverrideToOnly,\n getImportOverride,\n resolveMockSpecifier,\n toImportKey,\n} from './utils/importOverrides';\nimport { parseRequest, stripQueryAndHash } from './utils/parseRequest';\nimport { createVmContext } from './vm/createVmContext';\n\ntype HiddenModuleMembers = {\n _extensions: Record<string, () => void>;\n _resolveFilename: (\n id: string,\n options: { filename: string; id: string; paths: string[] },\n isMain?: boolean,\n resolveOptions?: { conditions?: Set<string> }\n ) => string;\n _nodeModulePaths(filename: string): string[];\n};\n\nconst CJS_DEFAULT_CONDITIONS = ['require', 'node', 'default'] as const;\n\nfunction expandConditions(conditionNames: string[]): Set<string> {\n const result = new Set<string>();\n for (const name of conditionNames) {\n if (name === '...') {\n for (const d of CJS_DEFAULT_CONDITIONS) result.add(d);\n } else {\n result.add(name);\n }\n }\n return result;\n}\n\nfunction isBarePackageSubpath(id: string): boolean {\n if (id.startsWith('.') || path.isAbsolute(id)) {\n return false;\n }\n\n if (id.startsWith('@')) {\n return id.split('/').length > 2;\n }\n\n return id.includes('/');\n}\n\nexport const DefaultModuleImplementation = NativeModule as typeof NativeModule &\n HiddenModuleMembers;\n\n// Supported node builtins based on the modules polyfilled by webpack\n// `true` means module is polyfilled, `false` means module is empty\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 VITE_VIRTUAL_PREFIX = '/@';\nconst REACT_REFRESH_VIRTUAL_ID = '/@react-refresh';\nconst reactRefreshRuntime = {\n createSignatureFunctionForTransform: () => () => {},\n};\n\nconst NOOP = () => {};\n\nconst browserOnlyEvalHintTriggers = [\n 'window is not defined',\n \"evaluating 'window\",\n 'document is not defined',\n \"evaluating 'document\",\n 'navigator is not defined',\n \"evaluating 'navigator\",\n 'self is not defined',\n \"evaluating 'self\",\n];\n\nconst getBrowserOnlyEvalHint = (error: unknown): string | null => {\n const message = error instanceof Error ? error.message : String(error);\n const looksLikeBrowserOnly = browserOnlyEvalHintTriggers.some((trigger) =>\n message.includes(trigger)\n );\n if (!looksLikeBrowserOnly) return null;\n\n return [\n '',\n '[wyw-in-js] Evaluation hint:',\n 'This usually means browser-only code ran during build-time evaluation.',\n 'Move browser-only initialization out of evaluated modules, or mock the import via `importOverrides`.',\n \"Example: importOverrides: { 'msw/browser': { mock: './src/__mocks__/msw-browser.js' } }\",\n ].join('\\n');\n};\n\nconst warnedUnknownImportsByServices = new WeakMap<Services, Set<string>>();\n\nfunction emitWarning(services: Services, message: string) {\n if (services.emitWarning) {\n services.emitWarning(message);\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn(message);\n}\n\nfunction getWarnedUnknownImports(services: Services): Set<string> {\n const cached = warnedUnknownImportsByServices.get(services);\n if (cached) {\n return cached;\n }\n\n const created = new Set<string>();\n warnedUnknownImportsByServices.set(services, created);\n return created;\n}\n\nfunction getUncached(cached: string | string[], test: string[]): string[] {\n const cachedSet = new Set(\n typeof cached === 'string' ? cached.split(',') : cached\n );\n\n if (cachedSet.has('*')) {\n return [];\n }\n\n return test.filter((t) => !cachedSet.has(t));\n}\n\nfunction resolve(\n this: { resolveDependency: (id: string) => IEntrypointDependency },\n id: string\n): string {\n const { resolved } = this.resolveDependency(id);\n invariant(resolved, `Unable to resolve \"${id}\"`);\n return resolved;\n}\n\nconst defaultImportLoaders: ImportLoaders = {\n raw: 'raw',\n url: 'url',\n};\n\nexport class Module {\n public readonly callstack: string[] = [];\n\n public readonly debug: Debugger;\n\n public readonly dependencies: string[];\n\n public readonly extensions: string[];\n\n public readonly filename: string;\n\n public id: string;\n\n public readonly idx: string;\n\n public readonly ignored: boolean;\n\n public isEvaluated: boolean = false;\n\n public readonly parentIsIgnored: boolean;\n\n public require: {\n (id: string): unknown;\n ensure: () => void;\n resolve: (id: string) => string;\n } = Object.assign(\n (id: string) => {\n if (id === REACT_REFRESH_VIRTUAL_ID) {\n this.dependencies.push(id);\n this.debug('require', `vite virtual '${id}'`);\n return reactRefreshRuntime;\n }\n\n if (id.startsWith(VITE_VIRTUAL_PREFIX)) {\n this.dependencies.push(id);\n this.debug('require', `vite virtual '${id}'`);\n return {};\n }\n\n if (id in builtins) {\n // The module is in the allowed list of builtin node modules\n // Ideally we should prevent importing them, but webpack polyfills some\n // So we check for the list of polyfills to determine which ones to support\n if (builtins[id as keyof typeof builtins]) {\n this.debug('require', `builtin '${id}'`);\n return require(id);\n }\n\n return null;\n }\n\n // Resolve module id (and filename) relatively to parent module\n const dependency = this.resolveDependency(id);\n if (dependency.resolved === id && !path.isAbsolute(id)) {\n // The module is a builtin node modules, but not in the allowed list\n throw new Error(\n `Unable to import \"${id}\". Importing Node builtins is not supported in the sandbox.`\n );\n }\n\n invariant(\n dependency.resolved,\n `Dependency ${dependency.source} cannot be resolved`\n );\n\n const loaded = this.loadByImportLoaders(id, dependency.resolved);\n if (loaded.handled) {\n this.dependencies.push(id);\n this.debug('require', `${id} -> ${dependency.resolved} (loader)`);\n return loaded.value;\n }\n\n this.dependencies.push(id);\n\n this.debug('require', `${id} -> ${dependency.resolved}`);\n\n const entrypoint = this.getEntrypoint(\n dependency.resolved,\n dependency.only,\n this.debug\n );\n\n if (entrypoint === null) {\n return dependency.resolved;\n }\n\n if (\n entrypoint.evaluated ||\n isSuperSet(entrypoint.evaluatedOnly, dependency.only)\n ) {\n return entrypoint.exports;\n }\n\n const m = this.createChild(entrypoint);\n m.evaluate();\n\n return entrypoint.exports;\n },\n {\n ensure: NOOP,\n resolve: resolve.bind(this),\n }\n );\n\n public resolve = resolve.bind(this);\n\n private cache: TransformCacheCollection;\n\n #entrypointRef: WeakRef<Entrypoint> | Entrypoint;\n\n constructor(\n private services: Services,\n entrypoint: Entrypoint,\n parentModule?: Module,\n private moduleImpl: HiddenModuleMembers = DefaultModuleImplementation\n ) {\n this.cache = services.cache;\n this.#entrypointRef = isFeatureEnabled(\n services.options.pluginOptions.features,\n 'useWeakRefInEval',\n entrypoint.name\n )\n ? new WeakRef(entrypoint)\n : entrypoint;\n this.idx = entrypoint.idx;\n this.id = entrypoint.name;\n this.filename = entrypoint.name;\n this.dependencies = [];\n this.debug = entrypoint.log.extend('module');\n this.parentIsIgnored = parentModule?.ignored ?? false;\n this.ignored = entrypoint.ignored ?? this.parentIsIgnored;\n\n if (parentModule) {\n this.callstack = [entrypoint.name, ...parentModule.callstack];\n } else {\n this.callstack = [entrypoint.name];\n }\n\n this.extensions = services.options.pluginOptions.extensions;\n\n this.debug('init', entrypoint.name);\n }\n\n public get exports() {\n return this.entrypoint.exports;\n }\n\n public set exports(value) {\n this.entrypoint.exports = value;\n\n this.debug('the whole exports was overridden with %O', value);\n }\n\n protected get entrypoint(): Entrypoint {\n const entrypoint =\n this.#entrypointRef instanceof WeakRef\n ? this.#entrypointRef.deref()\n : this.#entrypointRef;\n invariant(entrypoint, `Module ${this.idx} is disposed`);\n return entrypoint;\n }\n\n evaluate(): void {\n const { entrypoint } = this;\n entrypoint.assertTransformed();\n\n const cached = this.cache.get('entrypoints', entrypoint.name)!;\n let evaluatedCreated = false;\n if (!entrypoint.supersededWith) {\n this.cache.add(\n 'entrypoints',\n entrypoint.name,\n entrypoint.createEvaluated()\n );\n evaluatedCreated = true;\n }\n\n const { transformedCode: source } = entrypoint;\n const { pluginOptions } = this.services.options;\n\n if (!source) {\n this.debug(`evaluate`, 'there is nothing to evaluate');\n return;\n }\n\n if (this.isEvaluated) {\n this.debug('evaluate', `is already evaluated`);\n return;\n }\n\n this.debug('evaluate');\n this.debug.extend('source')('%s', source);\n\n this.isEvaluated = true;\n\n const filename = stripQueryAndHash(this.filename);\n\n if (/\\.json$/.test(filename)) {\n // For JSON files, parse it to a JS object similar to Node\n this.exports = JSON.parse(source);\n return;\n }\n\n const { context, teardown } = createVmContext(\n filename,\n pluginOptions.features,\n {\n module: this,\n exports: entrypoint.exports,\n require: this.require,\n __wyw_dynamic_import: async (id: unknown) => this.require(String(id)),\n __dirname: path.dirname(filename),\n },\n pluginOptions.overrideContext\n );\n\n try {\n const script = new vm.Script(\n `(function (exports) { ${source}\\n})(exports);`,\n {\n filename,\n }\n );\n\n script.runInContext(context);\n } catch (e) {\n this.isEvaluated = false;\n if (evaluatedCreated) {\n this.cache.add('entrypoints', entrypoint.name, cached);\n }\n\n if (isUnprocessedEntrypointError(e)) {\n // It will be handled by evalFile scenario\n throw e;\n }\n\n if (e instanceof EvalError) {\n this.debug('%O', e);\n\n throw e;\n }\n\n this.debug('%O\\n%O', e, this.callstack);\n const baseMessage = `${(e as Error).message} in${this.callstack.join(\n '\\n| '\n )}\\n`;\n const hint = getBrowserOnlyEvalHint(e);\n\n throw new EvalError(hint ? `${baseMessage}${hint}\\n` : baseMessage);\n } finally {\n teardown();\n }\n }\n\n getEntrypoint(\n filename: string,\n only: string[],\n log: Debugger\n ): Entrypoint | IEvaluatedEntrypoint | null {\n const strippedFilename = stripQueryAndHash(filename);\n const extension = path.extname(strippedFilename);\n if (extension !== '.json' && !this.extensions.includes(extension)) {\n return null;\n }\n\n let entrypoint = this.cache.get('entrypoints', filename);\n if (entrypoint && isSuperSet(entrypoint.evaluatedOnly ?? [], only)) {\n if (this.cache.checkFreshness(filename, strippedFilename)) {\n entrypoint = undefined;\n }\n\n if (entrypoint) {\n log('✅ file has been already evaluated');\n return entrypoint;\n }\n }\n\n if (entrypoint?.ignored) {\n log(\n '✅ file has been ignored during prepare stage. Original code will be used'\n );\n return entrypoint;\n }\n\n if (this.ignored) {\n log(\n '✅ one of the parent files has been ignored during prepare stage. Original code will be used'\n );\n\n const newEntrypoint = this.entrypoint.createChild(\n filename,\n ['*'],\n fs.readFileSync(strippedFilename, 'utf-8')\n );\n\n if (newEntrypoint === 'loop') {\n const stack = getStack(this.entrypoint);\n throw new Error(\n `Circular dependency detected: ${stack.join(' -> ')} -> ${filename}`\n );\n }\n\n return newEntrypoint;\n }\n\n let uncachedExports: string[] | null = null;\n let reprocessOnly: string[] = only;\n // Requested file can be already prepared for evaluation on the stage 1\n if (only && entrypoint) {\n const evaluatedExports =\n entrypoint.evaluatedOnly?.length !== 0\n ? entrypoint.evaluatedOnly\n : entrypoint.only ?? [];\n uncachedExports = getUncached(evaluatedExports, only);\n if (uncachedExports.length === 0) {\n log('✅ ready for evaluation');\n return entrypoint;\n }\n\n if (entrypoint.evaluatedOnly?.length) {\n reprocessOnly = mergeOnly(evaluatedExports, only);\n }\n\n log(\n '❌ file has been processed during prepare stage but %o is not evaluated yet (evaluated: %o)',\n uncachedExports,\n evaluatedExports\n );\n } else {\n log('❌ file has not been processed during prepare stage');\n }\n\n // If code wasn't extracted from cache, it indicates that we were unable\n // to process some of the imports on stage1. Let's try to reprocess.\n const code = fs.readFileSync(strippedFilename, 'utf-8');\n const newEntrypoint = Entrypoint.createRoot(\n this.services,\n filename,\n reprocessOnly,\n code\n );\n\n if (newEntrypoint.evaluated) {\n log('✅ file has been already evaluated');\n return newEntrypoint;\n }\n\n if (newEntrypoint.ignored) {\n log(\n '✅ file has been ignored during prepare stage. Original code will be used'\n );\n return newEntrypoint;\n }\n\n return newEntrypoint;\n }\n\n private resolveWithConditions(\n id: string,\n parent: { id: string; filename: string; paths: string[] },\n conditions?: Set<string>\n ): string {\n const resolveOptions = conditions ? { conditions } : undefined;\n const shouldRetryWithExtensions =\n conditions &&\n path.extname(id) === '' &&\n (id.startsWith('.') || path.isAbsolute(id) || isBarePackageSubpath(id));\n try {\n return this.moduleImpl._resolveFilename(\n id,\n parent,\n false,\n resolveOptions\n );\n } catch (e: unknown) {\n if (\n shouldRetryWithExtensions &&\n e instanceof Error &&\n (e as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND'\n ) {\n // Extensionless subpath requests (e.g. \"pkg/src/*\" or \"./src/*\") may\n // resolve to extensionless targets via conditional exports. Retry with\n // each known extension, but never rewrite already explicit specifiers.\n for (const ext of this.extensions) {\n try {\n return this.moduleImpl._resolveFilename(\n id + ext,\n parent,\n false,\n resolveOptions\n );\n } catch {\n // try next extension\n }\n }\n }\n throw e;\n }\n }\n\n resolveDependency = (id: string): IEntrypointDependency => {\n const cached = this.entrypoint.getDependency(id);\n invariant(!(cached instanceof Promise), 'Dependency is not resolved yet');\n\n if (cached) {\n return cached;\n }\n\n if (!this.ignored) {\n this.debug(\n '❌ import has not been resolved during prepare stage. Fallback to Node.js resolver'\n );\n }\n\n const extensions = this.moduleImpl._extensions;\n const added: string[] = [];\n\n try {\n // Check for supported extensions\n this.extensions.forEach((ext) => {\n if (ext in extensions) {\n return;\n }\n\n // When an extension is not supported, add it\n // And keep track of it to clean it up after resolving\n // Use noop for the transform function since we handle it\n extensions[ext] = NOOP;\n added.push(ext);\n });\n\n const { filename } = this;\n const strippedId = stripQueryAndHash(id);\n\n const parent = {\n id: filename,\n filename,\n paths: this.moduleImpl._nodeModulePaths(path.dirname(filename)),\n };\n const { conditionNames } = this.services.options.pluginOptions;\n const conditions = conditionNames?.length\n ? expandConditions(conditionNames)\n : undefined;\n\n let resolved = this.resolveWithConditions(strippedId, parent, conditions);\n\n const isFileSpecifier =\n strippedId.startsWith('.') || path.isAbsolute(strippedId);\n\n if (\n isFileSpecifier &&\n path.extname(strippedId) === '' &&\n resolved.endsWith('.cjs') &&\n fs.existsSync(`${resolved.slice(0, -4)}.js`)\n ) {\n // When both `.cjs` and `.js` exist for an extensionless specifier, the\n // resolver may pick `.cjs` depending on the environment/extensions.\n // Prefer `.js` to keep resolved paths stable (e.g. importOverrides keys).\n resolved = `${resolved.slice(0, -4)}.js`;\n }\n\n const { root } = this.services.options;\n const keyInfo = toImportKey({\n source: id,\n resolved,\n root,\n });\n\n const override = getImportOverride(\n this.services.options.pluginOptions.importOverrides,\n keyInfo.key\n );\n\n const policy = override?.unknown ?? (override?.mock ? 'allow' : 'warn');\n const shouldWarn = !this.ignored && policy === 'warn';\n\n let finalResolved = resolved;\n if (override?.mock) {\n try {\n finalResolved = resolveMockSpecifier({\n mock: override.mock,\n importer: filename,\n root,\n stack: this.callstack,\n });\n } catch (e) {\n const errorMessage = String((e as Error)?.message ?? e);\n throw new Error(\n `[wyw-in-js] Failed to resolve import mock for \"${keyInfo.key}\" (${id} from ${filename}): ${errorMessage}`\n );\n }\n }\n\n if (policy === 'error') {\n throw new Error(\n [\n `[wyw-in-js] Unknown import reached during eval (Node resolver fallback)`,\n ``,\n `importer: ${filename}`,\n `source: ${id}`,\n `resolved: ${resolved}`,\n override?.mock\n ? `mock: ${override.mock} -> ${finalResolved}`\n : ``,\n ``,\n `callstack:`,\n ...this.callstack.map((item) => ` ${item}`),\n ``,\n `config key: ${keyInfo.key}`,\n ]\n .filter(Boolean)\n .join('\\n')\n );\n }\n\n const warnedUnknownImports = getWarnedUnknownImports(this.services);\n\n if (shouldWarn && !warnedUnknownImports.has(keyInfo.key)) {\n warnedUnknownImports.add(keyInfo.key);\n emitWarning(\n this.services,\n [\n `[wyw-in-js] Unknown import reached during eval (Node resolver fallback)`,\n ``,\n `importer: ${filename}`,\n `source: ${id}`,\n `resolved: ${resolved}`,\n override?.mock\n ? `mock: ${override.mock} -> ${finalResolved}`\n : ``,\n ``,\n `callstack:`,\n ...this.callstack.map((item) => ` ${item}`),\n ``,\n `config key: ${keyInfo.key}`,\n `hint: add { importOverrides: { ${JSON.stringify(\n keyInfo.key\n )}: { unknown: 'allow' } } } to silence warnings, or use { mock } / { noShake: true } overrides.`,\n ]\n .filter(Boolean)\n .join('\\n')\n );\n }\n\n return {\n source: id,\n only: applyImportOverrideToOnly(['*'], override),\n resolved: finalResolved,\n };\n } finally {\n // Cleanup the extensions we added to restore previous behaviour\n added.forEach((ext) => delete extensions[ext]);\n }\n };\n\n protected createChild(entrypoint: Entrypoint): Module {\n return new Module(this.services, entrypoint, this, this.moduleImpl);\n }\n\n private loadByImportLoaders(\n request: string,\n resolved: string\n ): { handled: boolean; value: unknown } {\n const { pluginOptions } = this.services.options;\n const importLoaders =\n pluginOptions.importLoaders === undefined\n ? defaultImportLoaders\n : { ...defaultImportLoaders, ...pluginOptions.importLoaders };\n\n const { query, hash } = parseRequest(request);\n if (!query) return { handled: false, value: undefined };\n\n const params = new URLSearchParams(query);\n const matchedKey = Array.from(params.keys()).find(\n (key) => importLoaders[key] !== undefined && importLoaders[key] !== false\n );\n\n if (!matchedKey) return { handled: false, value: undefined };\n\n const loader = importLoaders[matchedKey];\n\n const filename = stripQueryAndHash(resolved);\n const importer = stripQueryAndHash(this.filename);\n const importerDir = path.dirname(importer);\n\n const toUrl = () => {\n const relative = path\n .relative(importerDir, filename)\n .replace(/\\\\/g, path.posix.sep);\n\n if (relative.startsWith('.') || path.isAbsolute(relative)) {\n return relative;\n }\n\n return `./${relative}`;\n };\n\n const readFile = () => fs.readFileSync(filename, 'utf-8');\n\n const context: ImportLoaderContext = {\n importer,\n request,\n resolved,\n filename,\n query,\n hash,\n emitWarning: (message) => emitWarning(this.services, message),\n readFile,\n toUrl,\n };\n\n if (loader === 'raw') {\n return { handled: true, value: context.readFile() };\n }\n\n if (loader === 'url') {\n return { handled: true, value: context.toUrl() };\n }\n\n if (typeof loader === 'function') {\n return { handled: true, value: loader(context) };\n }\n\n return { handled: false, value: undefined };\n }\n}\n"],"mappings":";;;;;;AAaA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,GAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAOAA,OAAA;AAEA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAOA,IAAAQ,2BAAA,GAAAR,OAAA;AAEA,IAAAS,gBAAA,GAAAT,OAAA;AAMA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAX,OAAA;AAAuD,SAAAD,uBAAAa,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA9CvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgDA,MAAMG,sBAAsB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAU;AAEtE,SAASC,gBAAgBA,CAACC,cAAwB,EAAe;EAC/D,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAS,CAAC;EAChC,KAAK,MAAMC,IAAI,IAAIH,cAAc,EAAE;IACjC,IAAIG,IAAI,KAAK,KAAK,EAAE;MAClB,KAAK,MAAMC,CAAC,IAAIN,sBAAsB,EAAEG,MAAM,CAACI,GAAG,CAACD,CAAC,CAAC;IACvD,CAAC,MAAM;MACLH,MAAM,CAACI,GAAG,CAACF,IAAI,CAAC;IAClB;EACF;EACA,OAAOF,M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