@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTagProcessor.js","names":["_fs","require","_path","_core","_helperModuleImports","_processorUtils","_shared","_collectExportsAndImports","_collectTemplateDependencies","_getSource","_isNotNull","_scopeHelpers","_traversalCache","last","arr","length","zip","arr1","arr2","result","i","push","buildCodeFrameError","path","message","Error","definedTagsCache","Map","resolvedTagResolverSourceCache","didWarnSkipSymbolMismatch","getResolvedTagResolverSource","source","sourceFile","undefined","key","has","get","resolved","syncResolve","set","getDefinedTagsFromPackage","pkgName","filename","_packageJSON$wywInJ","packageJSONPath","findPackageJSON","packageDir","dirname","packageJSON","JSON","parse","readFileSync","definedTags","tags","normalizedTags","Object","entries","reduce","acc","value","startsWith","join","resolve","paths","isValidProcessorClass","module","BaseProcessor","constructor","getProcessorFromPackage","packageName","tagName","processorPath","Processor","default","getProcessorFromFile","getProcessorForImport","imported","options","tagResolver","customFile","tagResolverMeta","resolvedSource","processor","getBuilderForIdentifier","definedProcessor","imports","_tagPath$parentPath","tagSource","tagPath","parentPath","isMemberExpression","property","node","params","prev","current","_current","_current2","_current3","_current4","isSequenceExpression","expressions","isCallExpression","callee","args","cookedArgs","map","arg","buildError","bind","isExpression","type","getSource","extracted","extractExpression","evaluate","filter","isNotNull","object","isIdentifier","computed","name","isStringLiteral","isTaggedTemplateExpression","tag","quasis","expressionValues","collectTemplateDependencies","replacer","replacement","isPure","mutate","p","next","replaceWith","isNewExpression","addComment","importHelpers","addDefaultImport","importedSource","nameHint","addDefault","addNamedImport","addNamed","astService","Proxy","t","target","prop","receiver","Reflect","_tagPath$node$loc","loc","getDisplayName","idx","displayName","parent","findParent","isObjectProperty","isJSXOpeningElement","isVariableDeclarator","toString","keyPath","isJSXIdentifier","id","basename","test","replace","isTagReferenced","isReferenced","referencePaths","scope","getBinding","counters","WeakMap","getNextIndex","state","_counters$get","counter","getDefinedProcessors","cache","getTraversalCache","defined","forEach","local","createProcessorInstance","fileContext","_cache$get","builder","e","SKIP","description","console","warn","applyProcessors","callback","collectExportsAndImports","explicitImport","definedProcessors","usages","idName","_path$scope$getBindin","includes","split","objBinding","identifier","sort","a","b","_a$identifier$node$st","_b$identifier$node$st","start","usage","instance"],"sources":["../../src/utils/getTagProcessor.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { basename, dirname, join } from 'path';\n\nimport { types as t } from '@babel/core';\nimport { addDefault, addNamed } from '@babel/helper-module-imports';\nimport type { NodePath } from '@babel/traverse';\nimport type {\n Expression,\n Identifier,\n MemberExpression,\n Program,\n SourceLocation,\n} from '@babel/types';\n\nimport { BaseProcessor } from '@wyw-in-js/processor-utils';\nimport type {\n Param,\n Params,\n IFileContext,\n TagSource,\n} from '@wyw-in-js/processor-utils';\nimport { findPackageJSON, syncResolve } from '@wyw-in-js/shared';\nimport type {\n ExpressionValue,\n StrictOptions,\n TagResolverMeta,\n} from '@wyw-in-js/shared';\n\nimport type { IImport } from './collectExportsAndImports';\nimport {\n collectExportsAndImports,\n explicitImport,\n} from './collectExportsAndImports';\nimport {\n collectTemplateDependencies,\n extractExpression,\n} from './collectTemplateDependencies';\nimport { getSource } from './getSource';\nimport { isNotNull } from './isNotNull';\nimport { mutate } from './scopeHelpers';\nimport { getTraversalCache } from './traversalCache';\n\ntype BuilderArgs = ConstructorParameters<typeof BaseProcessor> extends [\n Params,\n TagSource,\n typeof t,\n SourceLocation | null,\n (replacement: Expression, isPure: boolean) => void,\n ...infer T,\n]\n ? T\n : never;\n\ntype Builder = (...args: BuilderArgs) => BaseProcessor;\n\ntype DefinedProcessor = [ProcessorClass, TagSource];\ntype DefinedProcessors = Map<string, DefinedProcessor>;\n\nexport type ProcessorClass = new (\n ...args: ConstructorParameters<typeof BaseProcessor>\n) => BaseProcessor;\n\nconst last = <T>(arr: T[]): T | undefined => arr[arr.length - 1];\n\nfunction zip<T1, T2>(arr1: T1[], arr2: T2[]) {\n const result: (T1 | T2)[] = [];\n for (let i = 0; i < arr1.length; i++) {\n result.push(arr1[i]);\n if (arr2[i]) result.push(arr2[i]);\n }\n\n return result;\n}\n\nfunction buildCodeFrameError(path: NodePath, message: string): Error {\n try {\n return path.buildCodeFrameError(message);\n } catch {\n return new Error(message);\n }\n}\n\nconst definedTagsCache = new Map<string, Record<string, string> | undefined>();\nconst resolvedTagResolverSourceCache = new Map<string, string | undefined>();\nlet didWarnSkipSymbolMismatch = false;\n\nconst getResolvedTagResolverSource = (\n source: string,\n sourceFile: string | null | undefined\n): string | undefined => {\n if (!sourceFile) {\n return undefined;\n }\n\n const key = `${sourceFile}\\0${source}`;\n if (resolvedTagResolverSourceCache.has(key)) {\n return resolvedTagResolverSourceCache.get(key);\n }\n\n try {\n const resolved = syncResolve(source, sourceFile, []);\n resolvedTagResolverSourceCache.set(key, resolved);\n return resolved;\n } catch {\n resolvedTagResolverSourceCache.set(key, undefined);\n return undefined;\n }\n};\n\nconst getDefinedTagsFromPackage = (\n pkgName: string,\n filename: string | null | undefined\n): Record<string, string> | undefined => {\n if (definedTagsCache.has(pkgName)) {\n return definedTagsCache.get(pkgName);\n }\n\n const packageJSONPath = findPackageJSON(pkgName, filename);\n if (!packageJSONPath) {\n return undefined;\n }\n\n const packageDir = dirname(packageJSONPath);\n const packageJSON = JSON.parse(readFileSync(packageJSONPath, 'utf8'));\n const definedTags: Record<string, string> | undefined =\n packageJSON['wyw-in-js']?.tags;\n\n const normalizedTags = definedTags\n ? Object.entries(definedTags).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: value.startsWith('.')\n ? join(packageDir, value)\n : require.resolve(value, { paths: [packageDir] }),\n }),\n {} as Record<string, string>\n )\n : undefined;\n\n definedTagsCache.set(pkgName, normalizedTags);\n\n return normalizedTags;\n};\n\nfunction isValidProcessorClass(module: unknown): module is ProcessorClass {\n return module instanceof BaseProcessor.constructor;\n}\n\nfunction getProcessorFromPackage(\n packageName: string,\n tagName: string,\n filename: string | null | undefined\n): ProcessorClass | null {\n const definedTags = getDefinedTagsFromPackage(packageName, filename);\n const processorPath = definedTags?.[tagName];\n if (!processorPath) {\n return null;\n }\n\n const Processor = require(processorPath).default;\n if (!isValidProcessorClass(Processor)) {\n return null;\n }\n\n return Processor;\n}\n\nfunction getProcessorFromFile(processorPath: string): ProcessorClass | null {\n const Processor = require(processorPath).default;\n if (!isValidProcessorClass(Processor)) {\n return null;\n }\n\n return Processor;\n}\n\nexport function getProcessorForImport(\n { imported, source }: IImport,\n filename: string | null | undefined,\n options: Pick<StrictOptions, 'tagResolver'>\n): [ProcessorClass | null, TagSource] {\n const { tagResolver } = options;\n\n let customFile: string | null = null;\n if (tagResolver) {\n const tagResolverMeta: TagResolverMeta = {\n sourceFile: filename,\n resolvedSource: getResolvedTagResolverSource(source, filename),\n };\n\n customFile = tagResolver(source, imported, tagResolverMeta);\n }\n const processor = customFile\n ? getProcessorFromFile(customFile)\n : getProcessorFromPackage(source, imported, filename);\n return [processor, { imported, source }];\n}\n\nfunction getBuilderForIdentifier(\n definedProcessor: DefinedProcessor,\n path: NodePath<Identifier>,\n imports: IImport[],\n options: Pick<StrictOptions, 'evaluate'>\n): Builder | null {\n const [Processor, tagSource] = definedProcessor;\n let tagPath: NodePath<Identifier | MemberExpression> = path;\n if (tagPath.parentPath?.isMemberExpression({ property: tagPath.node })) {\n tagPath = tagPath.parentPath;\n }\n\n if (!Processor || !tagSource || !tagPath) {\n return null;\n }\n\n const params: Param[] = [['callee', tagPath.node]];\n let prev: NodePath = tagPath;\n let current: NodePath | null = tagPath.parentPath;\n while (current && current !== path) {\n if (\n current?.isSequenceExpression() &&\n last(current.node.expressions) === prev.node\n ) {\n prev = current;\n current = current.parentPath;\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (current?.isCallExpression({ callee: prev.node })) {\n const args = current.get('arguments');\n const cookedArgs = args\n .map((arg) => {\n const buildError = arg.buildCodeFrameError.bind(arg);\n if (!arg.isExpression()) {\n throw buildError(`Unexpected type of an argument ${arg.type}`);\n }\n const source = getSource(arg);\n const extracted = extractExpression(arg, options.evaluate, imports);\n return {\n ...extracted,\n source,\n buildCodeFrameError: buildError,\n } as ExpressionValue;\n })\n .filter(isNotNull);\n\n params.push(['call', ...cookedArgs]);\n prev = current;\n current = current.parentPath;\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (current?.isMemberExpression({ object: prev.node })) {\n const property = current.get('property');\n if (property.isIdentifier() && !current.node.computed) {\n params.push(['member', property.node.name]);\n } else if (property.isStringLiteral()) {\n params.push(['member', property.node.value]);\n } else {\n throw property.buildCodeFrameError(`Unexpected type of a property`);\n }\n\n prev = current;\n current = current.parentPath;\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (current?.isTaggedTemplateExpression({ tag: prev.node })) {\n const [quasis, expressionValues] = collectTemplateDependencies(\n current,\n options.evaluate\n );\n params.push(['template', zip(quasis, expressionValues)]);\n\n prev = current;\n current = current.parentPath;\n // eslint-disable-next-line no-continue\n continue;\n }\n\n break;\n }\n\n const replacer = (\n replacement: Expression | ((tagPath: NodePath) => Expression),\n isPure: boolean\n ) => {\n mutate(prev, (p) => {\n const next =\n typeof replacement === 'function' ? replacement(p) : replacement;\n\n p.replaceWith(next);\n\n if (isPure && (p.isCallExpression() || p.isNewExpression())) {\n p.addComment('leading', '#__PURE__');\n }\n });\n };\n\n const importHelpers = {\n addDefaultImport: (importedSource: string, nameHint?: string) =>\n addDefault(path, importedSource, { nameHint }),\n addNamedImport: (\n name: string,\n importedSource: string,\n nameHint: string = name\n ) => addNamed(path, name, importedSource, { nameHint }),\n };\n\n type AstService = typeof t & typeof importHelpers;\n\n const astService = new Proxy<AstService>(t as AstService, {\n get(target, prop, receiver) {\n if (prop in importHelpers) {\n return importHelpers[prop as keyof typeof importHelpers];\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n\n return (...args: BuilderArgs) =>\n new Processor(\n params,\n tagSource,\n astService,\n tagPath.node.loc ?? null,\n replacer,\n ...args\n );\n}\n\nfunction getDisplayName(\n path: NodePath<Identifier>,\n idx: number,\n filename?: string | null\n): string {\n let displayName: string | undefined;\n\n const parent = path.findParent(\n (p) =>\n p.isObjectProperty() ||\n p.isJSXOpeningElement() ||\n p.isVariableDeclarator()\n );\n\n if (parent) {\n if (parent.isObjectProperty()) {\n if ('name' in parent.node.key) {\n displayName = parent.node.key.name;\n } else if ('value' in parent.node.key) {\n displayName = parent.node.key.value.toString();\n } else {\n const keyPath = parent.get('key');\n displayName = getSource(keyPath);\n }\n } else if (parent.isJSXOpeningElement()) {\n const name = parent.get('name');\n if (name.isJSXIdentifier()) {\n displayName = name.node.name;\n }\n } else if (parent.isVariableDeclarator()) {\n const id = parent.get('id');\n if (id.isIdentifier()) {\n displayName = id.node.name;\n }\n }\n }\n\n if (!displayName) {\n // Try to derive the path from the filename\n displayName = basename(filename ?? 'unknown');\n\n if (filename && /^index\\.[a-z\\d]+$/.test(displayName)) {\n // If the file name is 'index', better to get name from parent folder\n displayName = basename(dirname(filename));\n }\n\n // Remove the file extension\n displayName = displayName.replace(/\\.[a-z\\d]+$/, '');\n\n if (displayName) {\n displayName += idx;\n } else {\n throw new Error(\n \"Couldn't determine a name for the component. Ensure that it's either:\\n\" +\n '- Assigned to a variable\\n' +\n '- Is an object property\\n' +\n '- Is a prop in a JSX element\\n'\n );\n }\n }\n\n return displayName;\n}\n\nfunction isTagReferenced(path: NodePath): boolean {\n // Check if the variable is referenced anywhere for basic DCE\n // Only works when it's assigned to a variable\n let isReferenced = true;\n\n const parent = path.findParent(\n (p) =>\n p.isObjectProperty() ||\n p.isJSXOpeningElement() ||\n p.isVariableDeclarator()\n );\n\n if (parent) {\n if (parent.isVariableDeclarator()) {\n const id = parent.get('id');\n // FIXME: replace with id.isReferencedIdentifier()\n if (id.isIdentifier()) {\n const { referencePaths } = id.scope.getBinding(id.node.name) || {\n referencePaths: [],\n };\n\n isReferenced = referencePaths.length !== 0;\n }\n }\n }\n\n return isReferenced;\n}\n\nconst counters = new WeakMap<IFileContext, number>();\nconst getNextIndex = (state: IFileContext) => {\n const counter = counters.get(state) ?? 0;\n counters.set(state, counter + 1);\n return counter;\n};\n\nexport function getDefinedProcessors(\n imports: IImport[],\n path: NodePath<Program>,\n filename: string | null | undefined,\n options: Pick<StrictOptions, 'tagResolver'>\n): DefinedProcessors {\n const cache = getTraversalCache<DefinedProcessors, NodePath<Program>>(\n path,\n 'getDefinedProcessors'\n );\n\n if (!cache.has(path)) {\n const defined: DefinedProcessors = new Map();\n\n imports.forEach((i) => {\n const [processor, tagSource] = getProcessorForImport(\n i,\n filename,\n options\n );\n const { local } = i;\n if (!processor) {\n return;\n }\n\n let name: string | null = null;\n if (local.isIdentifier()) {\n name = local.node.name;\n }\n\n if (name === null && local.isMemberExpression()) {\n const property = local.get('property');\n const object = local.get('object');\n if (property.isIdentifier() && object.isIdentifier()) {\n name = `${object.node.name}.${property.node.name}`;\n }\n }\n\n if (name === null) {\n return;\n }\n\n defined.set(name, [processor, tagSource]);\n });\n\n cache.set(path, defined);\n }\n\n return cache.get(path)!;\n}\n\nfunction createProcessorInstance(\n definedProcessor: [ProcessorClass, TagSource],\n imports: IImport[],\n path: NodePath<Identifier>,\n fileContext: IFileContext,\n options: Pick<\n StrictOptions,\n 'classNameSlug' | 'displayName' | 'extensions' | 'evaluate' | 'tagResolver'\n >\n): BaseProcessor | null {\n const cache = getTraversalCache<BaseProcessor | null, Identifier>(\n path,\n 'createProcessorInstance'\n );\n\n if (!cache.has(path.node)) {\n try {\n const builder = getBuilderForIdentifier(\n definedProcessor,\n path,\n imports,\n options\n );\n if (builder) {\n // Increment the index of the style we're processing\n // This is used for slug generation to prevent collision\n // Also used for display name if it couldn't be determined\n const idx = getNextIndex(fileContext);\n\n const displayName = getDisplayName(path, idx, fileContext.filename);\n\n const processor = builder(\n displayName,\n isTagReferenced(path),\n idx,\n options,\n fileContext\n );\n\n cache.set(path.node, processor);\n } else {\n cache.set(path.node, null);\n }\n } catch (e) {\n if (e === BaseProcessor.SKIP) {\n cache.set(path.node, null);\n return null;\n }\n\n if (\n typeof e === 'symbol' &&\n e.description === BaseProcessor.SKIP.description\n ) {\n if (!didWarnSkipSymbolMismatch) {\n didWarnSkipSymbolMismatch = true;\n // eslint-disable-next-line no-console\n console.warn(\n [\n \"[wyw-in-js] Processor threw Symbol('skip') that does not match BaseProcessor.SKIP identity.\",\n 'This usually means duplicate copies of @wyw-in-js/processor-utils (or the processor) are bundled/installed.',\n 'Consider deduping dependencies to avoid subtle issues (instanceof checks, sentinels, etc).',\n ].join('\\n')\n );\n }\n\n cache.set(path.node, null);\n return null;\n }\n\n if (e instanceof Error) {\n throw buildCodeFrameError(path, e.message);\n }\n\n throw e;\n }\n }\n\n return cache.get(path.node) ?? null;\n}\n\nexport function applyProcessors(\n path: NodePath<Program>,\n fileContext: IFileContext,\n options: Pick<\n StrictOptions,\n 'classNameSlug' | 'displayName' | 'extensions' | 'evaluate' | 'tagResolver'\n >,\n callback: (processor: BaseProcessor) => void\n) {\n const imports = collectExportsAndImports(path).imports.filter(explicitImport);\n\n const definedProcessors = getDefinedProcessors(\n imports,\n path,\n fileContext.filename,\n options\n );\n\n const usages: {\n identifier: NodePath<Identifier>;\n processor: DefinedProcessor;\n }[] = [];\n\n definedProcessors.forEach((processor, idName) => {\n if (idName.includes('.')) {\n // It's a member expression\n const [object, property] = idName.split('.');\n const objBinding = path.scope.getBinding(object);\n if (!objBinding) {\n return;\n }\n\n objBinding.referencePaths.forEach((p) => {\n const parent = p.parentPath;\n if (!parent?.isMemberExpression()) {\n return;\n }\n\n const identifier = parent.get('property');\n if (identifier.isIdentifier({ name: property })) {\n usages.push({\n identifier,\n processor,\n });\n }\n });\n\n return;\n }\n\n path.scope.getBinding(idName)?.referencePaths.forEach((identifier) => {\n if (identifier.isIdentifier()) {\n usages.push({\n identifier,\n processor,\n });\n }\n });\n });\n\n // The same order, the same slugs\n usages.sort(\n (a, b) => (a.identifier.node.start ?? 0) - (b.identifier.node.start ?? 0)\n );\n\n usages.forEach((usage) => {\n const definedProcessor = usage.processor;\n\n if (!definedProcessor) {\n return;\n }\n\n const instance = createProcessorInstance(\n definedProcessor,\n imports,\n usage.identifier,\n fileContext,\n options\n );\n\n if (instance === null) {\n return;\n }\n\n callback(instance);\n });\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AAUA,IAAAI,eAAA,GAAAJ,OAAA;AAOA,IAAAK,OAAA,GAAAL,OAAA;AAQA,IAAAM,yBAAA,GAAAN,OAAA;AAIA,IAAAO,4BAAA,GAAAP,OAAA;AAIA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,O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AqH,MAAM,CAACO,IAAI,CACT,CAACC,CAAC,EAAEC,CAAC;IAAA,IAAAC,qBAAA,EAAAC,qBAAA;IAAA,OAAK,EAAAD,qBAAA,GAACF,CAAC,CAACF,UAAU,CAACjH,IAAI,CAACuH,KAAK,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,CAAC,MAAAC,qBAAA,GAAKF,CAAC,CAACH,UAAU,CAACjH,IAAI,CAACuH,KAAK,cAAAD,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;EAAA,CAC3E,CAAC;EAEDX,MAAM,CAAChB,OAAO,CAAE6B,KAAK,IAAK;IACxB,MAAMhI,gBAAgB,GAAGgI,KAAK,CAAClI,SAAS;IAExC,IAAI,CAACE,gBAAgB,EAAE;MACrB;IACF;IAEA,MAAMiI,QAAQ,GAAG5B,uBAAuB,CACtCrG,gBAAgB,EAChBC,OAAO,EACP+H,KAAK,CAACP,UAAU,EAChBnB,WAAW,EACX7G,OACF,CAAC;IAED,IAAIwI,QAAQ,KAAK,IAAI,EAAE;MACrB;IACF;IAEAlB,QAAQ,CAACkB,QAAQ,CAAC;EACpB,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getVisitorKeys = getVisitorKeys;
7
- var _core = require("@babel/core");
8
- function getVisitorKeys(node) {
9
- return _core.types.VISITOR_KEYS[node.type];
10
- }
11
- //# sourceMappingURL=getVisitorKeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVisitorKeys.js","names":["_core","require","getVisitorKeys","node","t","VISITOR_KEYS","type"],"sources":["../../src/utils/getVisitorKeys.ts"],"sourcesContent":["import { types as t } from '@babel/core';\nimport type { Node } from '@babel/types';\n\nexport type VisitorKeys<T extends Node> = {\n [K in keyof T]: Exclude<T[K], undefined> extends Node | Node[] | null\n ? K\n : never;\n}[keyof T] &\n string;\n\nexport function getVisitorKeys<TNode extends Node>(\n node: TNode\n): VisitorKeys<TNode>[] {\n return t.VISITOR_KEYS[node.type] as VisitorKeys<TNode>[];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAUO,SAASC,cAAcA,CAC5BC,IAAW,EACW;EACtB,OAAOC,WAAC,CAACC,YAAY,CAACF,IAAI,CAACG,IAAI,CAAC;AAClC","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = hasWywPreval;
7
- function hasWywPreval(exports) {
8
- if (!exports || typeof exports !== 'object') {
9
- return false;
10
- }
11
- return '__wywPreval' in exports;
12
- }
13
- //# sourceMappingURL=hasWywPreval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hasWywPreval.js","names":["hasWywPreval","exports"],"sources":["../../src/utils/hasWywPreval.ts"],"sourcesContent":["import type { Value } from '@wyw-in-js/processor-utils';\n\nexport default function hasWywPreval(exports: unknown): exports is {\n __wywPreval: Record<string, () => Value> | null | undefined;\n} {\n if (!exports || typeof exports !== 'object') {\n return false;\n }\n\n return '__wywPreval' in exports;\n}\n"],"mappings":";;;;;;AAEe,SAASA,YAAYA,CAACC,OAAgB,EAEnD;EACA,IAAI,CAACA,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC3C,OAAO,KAAK;EACd;EAEA,OAAO,aAAa,IAAIA,OAAO;AACjC","ignoreList":[]}
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.applyImportOverrideToOnly = applyImportOverrideToOnly;
7
- exports.getImportOverride = getImportOverride;
8
- exports.resolveMockSpecifier = resolveMockSpecifier;
9
- exports.toCanonicalFileKey = toCanonicalFileKey;
10
- exports.toImportKey = toImportKey;
11
- var _path = _interopRequireDefault(require("path"));
12
- var _shared = require("@wyw-in-js/shared");
13
- var _minimatch = require("minimatch");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function toCanonicalFileKey(resolved, root) {
16
- const rootDir = root ? _path.default.resolve(root) : process.cwd();
17
- const normalizedResolved = _path.default.resolve(resolved);
18
- let relative = _path.default.relative(rootDir, normalizedResolved);
19
- if (_path.default.sep !== _path.default.posix.sep) {
20
- relative = relative.split(_path.default.sep).join(_path.default.posix.sep);
21
- }
22
- if (!relative.startsWith('.')) {
23
- relative = `./${relative}`;
24
- }
25
- return relative;
26
- }
27
- function toImportKey({
28
- source,
29
- resolved,
30
- root
31
- }) {
32
- const isFileImport = source.startsWith('.') || _path.default.isAbsolute(source);
33
- if (isFileImport && resolved) {
34
- return {
35
- key: toCanonicalFileKey(resolved, root),
36
- kind: 'file'
37
- };
38
- }
39
- return {
40
- key: source,
41
- kind: 'package'
42
- };
43
- }
44
- function resolveMockSpecifier({
45
- importer,
46
- mock,
47
- root,
48
- stack
49
- }) {
50
- const specifier = mock.startsWith('.') && root ? _path.default.resolve(root, mock) : mock;
51
- return (0, _shared.syncResolve)(specifier, importer, stack);
52
- }
53
- function applyImportOverrideToOnly(only, override) {
54
- if (override !== null && override !== void 0 && override.noShake) {
55
- return ['*'];
56
- }
57
- return only;
58
- }
59
- const compiledImportOverridesCache = new WeakMap();
60
- const minimatchOptions = {
61
- dot: true,
62
- nocomment: true,
63
- nonegate: true
64
- };
65
- function getPatternSpecificity(pattern) {
66
- let wildcardCount = 0;
67
- let escaped = false;
68
- for (const char of pattern) {
69
- if (escaped) {
70
- escaped = false;
71
- } else if (char === '\\') {
72
- escaped = true;
73
- } else if (char === '*' || char === '?') {
74
- wildcardCount += 1;
75
- }
76
- }
77
- return pattern.length - wildcardCount * 10;
78
- }
79
- function compileImportOverrides(importOverrides) {
80
- const matchers = Object.entries(importOverrides).map(([pattern, override]) => {
81
- return {
82
- matcher: new _minimatch.Minimatch(pattern, minimatchOptions),
83
- override,
84
- pattern,
85
- specificity: getPatternSpecificity(pattern)
86
- };
87
- }).sort((a, b) => {
88
- const bySpecificity = b.specificity - a.specificity;
89
- if (bySpecificity !== 0) return bySpecificity;
90
- const byLength = b.pattern.length - a.pattern.length;
91
- if (byLength !== 0) return byLength;
92
- return a.pattern.localeCompare(b.pattern);
93
- });
94
- return {
95
- matchers
96
- };
97
- }
98
- function getCompiledImportOverrides(importOverrides) {
99
- const cached = compiledImportOverridesCache.get(importOverrides);
100
- if (cached) return cached;
101
- const compiled = compileImportOverrides(importOverrides);
102
- compiledImportOverridesCache.set(importOverrides, compiled);
103
- return compiled;
104
- }
105
- function getImportOverride(importOverrides, key) {
106
- var _matchers$find;
107
- if (!importOverrides) {
108
- return undefined;
109
- }
110
- const direct = importOverrides[key];
111
- if (direct) return direct;
112
- const {
113
- matchers
114
- } = getCompiledImportOverrides(importOverrides);
115
- return (_matchers$find = matchers.find(({
116
- matcher
117
- }) => matcher.match(key))) === null || _matchers$find === void 0 ? void 0 : _matchers$find.override;
118
- }
119
- //# sourceMappingURL=importOverrides.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"importOverrides.js","names":["_path","_interopRequireDefault","require","_shared","_minimatch","e","__esModule","default","toCanonicalFileKey","resolved","root","rootDir","path","resolve","process","cwd","normalizedResolved","relative","sep","posix","split","join","startsWith","toImportKey","source","isFileImport","isAbsolute","key","kind","resolveMockSpecifier","importer","mock","stack","specifier","syncResolve","applyImportOverrideToOnly","only","override","noShake","compiledImportOverridesCache","WeakMap","minimatchOptions","dot","nocomment","nonegate","getPatternSpecificity","pattern","wildcardCount","escaped","char","length","compileImportOverrides","importOverrides","matchers","Object","entries","map","matcher","Minimatch","specificity","sort","a","b","bySpecificity","byLength","localeCompare","getCompiledImportOverrides","cached","get","compiled","set","getImportOverride","_matchers$find","undefined","direct","find","match"],"sources":["../../src/utils/importOverrides.ts"],"sourcesContent":["import path from 'path';\n\nimport {\n syncResolve,\n type ImportOverride,\n type ImportOverrides,\n} from '@wyw-in-js/shared';\nimport { Minimatch } from 'minimatch';\n\nexport type ImportKeyKind = 'file' | 'package';\n\nexport type ImportKey = {\n key: string;\n kind: ImportKeyKind;\n};\n\nexport function toCanonicalFileKey(\n resolved: string,\n root: string | undefined\n): string {\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\nexport function toImportKey({\n source,\n resolved,\n root,\n}: {\n resolved: string | null;\n root: string | undefined;\n source: string;\n}): ImportKey {\n const isFileImport = source.startsWith('.') || path.isAbsolute(source);\n\n if (isFileImport && resolved) {\n return { key: toCanonicalFileKey(resolved, root), kind: 'file' };\n }\n\n return { key: source, kind: 'package' };\n}\n\nexport function resolveMockSpecifier({\n importer,\n mock,\n root,\n stack,\n}: {\n importer: string;\n mock: string;\n root: string | undefined;\n stack: string[];\n}): string {\n const specifier =\n mock.startsWith('.') && root ? path.resolve(root, mock) : mock;\n\n return syncResolve(specifier, importer, stack);\n}\n\nexport function applyImportOverrideToOnly(\n only: string[],\n override: ImportOverride | undefined\n): string[] {\n if (override?.noShake) {\n return ['*'];\n }\n\n return only;\n}\n\ntype CompiledImportOverrides = {\n matchers: Array<{\n matcher: Minimatch;\n override: ImportOverride;\n pattern: string;\n specificity: number;\n }>;\n};\n\nconst compiledImportOverridesCache = new WeakMap<\n ImportOverrides,\n CompiledImportOverrides\n>();\n\nconst minimatchOptions = {\n dot: true,\n nocomment: true,\n nonegate: true,\n} as const;\n\nfunction getPatternSpecificity(pattern: string): number {\n let wildcardCount = 0;\n let escaped = false;\n for (const char of pattern) {\n if (escaped) {\n escaped = false;\n } else if (char === '\\\\') {\n escaped = true;\n } else if (char === '*' || char === '?') {\n wildcardCount += 1;\n }\n }\n\n return pattern.length - wildcardCount * 10;\n}\n\nfunction compileImportOverrides(\n importOverrides: ImportOverrides\n): CompiledImportOverrides {\n const matchers = Object.entries(importOverrides)\n .map(([pattern, override]) => {\n return {\n matcher: new Minimatch(pattern, minimatchOptions),\n override,\n pattern,\n specificity: getPatternSpecificity(pattern),\n };\n })\n .sort((a, b) => {\n const bySpecificity = b.specificity - a.specificity;\n if (bySpecificity !== 0) return bySpecificity;\n\n const byLength = b.pattern.length - a.pattern.length;\n if (byLength !== 0) return byLength;\n\n return a.pattern.localeCompare(b.pattern);\n });\n\n return { matchers };\n}\n\nfunction getCompiledImportOverrides(\n importOverrides: ImportOverrides\n): CompiledImportOverrides {\n const cached = compiledImportOverridesCache.get(importOverrides);\n if (cached) return cached;\n\n const compiled = compileImportOverrides(importOverrides);\n compiledImportOverridesCache.set(importOverrides, compiled);\n return compiled;\n}\n\nexport function getImportOverride(\n importOverrides: ImportOverrides | undefined,\n key: string\n): ImportOverride | undefined {\n if (!importOverrides) {\n return undefined;\n }\n\n const direct = importOverrides[key];\n if (direct) return direct;\n\n const { matchers } = getCompiledImportOverrides(importOverrides);\n return matchers.find(({ matcher }) => matcher.match(key))?.override;\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAF,OAAA;AAAsC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAS/B,SAASG,kBAAkBA,CAChCC,QAAgB,EAChBC,IAAwB,EAChB;EACR,MAAMC,OAAO,GAAGD,IAAI,GAAGE,aAAI,CAACC,OAAO,CAACH,IAAI,CAAC,GAAGI,OAAO,CAACC,GAAG,CAAC,CAAC;EACzD,MAAMC,kBAAkB,GAAGJ,aAAI,CAACC,OAAO,CAACJ,QAAQ,CAAC;EACjD,IAAIQ,QAAQ,GAAGL,aAAI,CAACK,QAAQ,CAACN,OAAO,EAAEK,kBAAkB,CAAC;EAEzD,IAAI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MAAM;IACpD,IAAIc,QAAQ,KAAK,CAAC,EAAE,OAAOA,QAAQ;IAEnC,OAAOH,CAAC,CAACf,OAAO,CAACmB,aAAa,CAACH,CAAC,CAAChB,OAAO,CAAC;EAC3C,CAAC,CAAC;EAEJ,OAAO;IAAEO;EAAS,CAAC;AACrB;AAEA,SAASa,0BAA0BA,CACjCd,eAAgC,EACP;EACzB,MAAMe,MAAM,GAAG5B,4BAA4B,CAAC6B,GAAG,CAAChB,eAAe,CAAC;EAChE,IAAIe,MAAM,EAAE,OAAOA,MAAM;EAEzB,MAAME,QAAQ,GAAGlB,sBAAsB,CAACC,eAAe,CAAC;EACxDb,4BAA4B,CAAC+B,GAAG,CAAClB,eAAe,EAAEiB,QAAQ,CAAC;EAC3D,OAAOA,QAAQ;AACjB;AAEO,SAASE,iBAAiBA,CAC/BnB,eAA4C,EAC5CzB,GAAW,EACiB;EAAA,IAAA6C,cAAA;EAC5B,IAAI,CAACpB,eAAe,EAAE;IACpB,OAAOqB,SAAS;EAClB;EAEA,MAAMC,MAAM,GAAGtB,eAAe,CAACzB,GAAG,CAAC;EACnC,IAAI+C,MAAM,EAAE,OAAOA,MAAM;EAEzB,MAAM;IAAErB;EAAS,CAAC,GAAGa,0BAA0B,CAACd,eAAe,CAAC;EAChE,QAAAoB,cAAA,GAAOnB,QAAQ,CAACsB,IAAI,CAAC,CAAC;IAAElB;EAAQ,CAAC,KAAKA,OAAO,CAACmB,KAAK,CAACjD,GAAG,CAAC,CAAC,cAAA6C,cAAA,uBAAlDA,cAAA,CAAoDnC,QAAQ;AACrE","ignoreList":[]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isExports = isExports;
7
- var _isGlobal = require("./isGlobal");
8
- /**
9
- * Checks that specified Identifier is a global `exports` or `module.exports`
10
- * @param node
11
- */
12
- function isExports(node) {
13
- if (node !== null && node !== void 0 && node.isIdentifier({
14
- name: 'exports'
15
- })) {
16
- return (0, _isGlobal.isGlobal)(node, 'exports');
17
- }
18
- if (node !== null && node !== void 0 && node.isMemberExpression() && node.get('object').isIdentifier({
19
- name: 'module'
20
- }) && node.get('property').isIdentifier({
21
- name: 'exports'
22
- })) {
23
- return (0, _isGlobal.isGlobal)(node, 'module');
24
- }
25
- return false;
26
- }
27
- //# sourceMappingURL=isExports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isExports.js","names":["_isGlobal","require","isExports","node","isIdentifier","name","isGlobal","isMemberExpression","get"],"sources":["../../src/utils/isExports.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\n\nimport { isGlobal } from './isGlobal';\n\n/**\n * Checks that specified Identifier is a global `exports` or `module.exports`\n * @param node\n */\nexport function isExports(node: NodePath | null | undefined) {\n if (node?.isIdentifier({ name: 'exports' })) {\n return isGlobal(node, 'exports');\n }\n\n if (\n node?.isMemberExpression() &&\n node.get('object').isIdentifier({ name: 'module' }) &&\n node.get('property').isIdentifier({ name: 'exports' })\n ) {\n return isGlobal(node, 'module');\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAACC,IAAiC,EAAE;EAC3D,IAAIA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEC,YAAY,CAAC;IAAEC,IAAI,EAAE;EAAU,CAAC,CAAC,EAAE;IAC3C,OAAO,IAAAC,kBAAQ,EAACH,IAAI,EAAE,SAAS,CAAC;EAClC;EAEA,IACEA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEI,kBAAkB,CAAC,CAAC,IAC1BJ,IAAI,CAACK,GAAG,CAAC,QAAQ,CAAC,CAACJ,YAAY,CAAC;IAAEC,IAAI,EAAE;EAAS,CAAC,CAAC,IACnDF,IAAI,CAACK,GAAG,CAAC,UAAU,CAAC,CAACJ,YAAY,CAAC;IAAEC,IAAI,EAAE;EAAU,CAAC,CAAC,EACtD;IACA,OAAO,IAAAC,kBAAQ,EAACH,IAAI,EAAE,QAAQ,CAAC;EACjC;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isGlobal = void 0;
7
- var _getScope = require("./getScope");
8
- const isGlobal = (node, name) => {
9
- const scope = (0, _getScope.getScope)(node);
10
- return scope.getBinding(name) === undefined && scope.hasGlobal(name);
11
- };
12
- exports.isGlobal = isGlobal;
13
- //# sourceMappingURL=isGlobal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isGlobal.js","names":["_getScope","require","isGlobal","node","name","scope","getScope","getBinding","undefined","hasGlobal","exports"],"sources":["../../src/utils/isGlobal.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\n\nimport { getScope } from './getScope';\n\nexport const isGlobal = (node: NodePath, name: string) => {\n const scope = getScope(node);\n\n return scope.getBinding(name) === undefined && scope.hasGlobal(name);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,QAAQ,GAAGA,CAACC,IAAc,EAAEC,IAAY,KAAK;EACxD,MAAMC,KAAK,GAAG,IAAAC,kBAAQ,EAACH,IAAI,CAAC;EAE5B,OAAOE,KAAK,CAACE,UAAU,CAACH,IAAI,CAAC,KAAKI,SAAS,IAAIH,KAAK,CAACI,SAAS,CAACL,IAAI,CAAC;AACtE,CAAC;AAACM,OAAA,CAAAR,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isNode = void 0;
7
- const isNode = obj => typeof obj === 'object' && obj !== null && (obj === null || obj === void 0 ? void 0 : obj.type) !== undefined;
8
- exports.isNode = isNode;
9
- //# sourceMappingURL=isNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNode.js","names":["isNode","obj","type","undefined","exports"],"sources":["../../src/utils/isNode.ts"],"sourcesContent":["import type { Node } from '@babel/types';\n\nexport const isNode = (obj: unknown): obj is Node =>\n typeof obj === 'object' &&\n obj !== null &&\n (obj as { type: unknown })?.type !== undefined;\n"],"mappings":";;;;;;AAEO,MAAMA,MAAM,GAAIC,GAAY,IACjC,OAAOA,GAAG,KAAK,QAAQ,IACvBA,GAAG,KAAK,IAAI,IACZ,CAACA,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAwBC,IAAI,MAAKC,SAAS;AAACC,OAAA,CAAAJ,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isNodePath = isNodePath;
7
- function isNodePath(obj) {
8
- return 'node' in obj && (obj === null || obj === void 0 ? void 0 : obj.node) !== undefined;
9
- }
10
- //# sourceMappingURL=isNodePath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNodePath.js","names":["isNodePath","obj","node","undefined"],"sources":["../../src/utils/isNodePath.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport type { Node } from '@babel/types';\n\nexport function isNodePath<T extends Node>(\n obj: NodePath<T> | T\n): obj is NodePath<T> {\n return 'node' in obj && obj?.node !== undefined;\n}\n"],"mappings":";;;;;;AAGO,SAASA,UAAUA,CACxBC,GAAoB,EACA;EACpB,OAAO,MAAM,IAAIA,GAAG,IAAI,CAAAA,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEC,IAAI,MAAKC,SAAS;AACjD","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isNotNull = isNotNull;
7
- function isNotNull(x) {
8
- return x !== null;
9
- }
10
- //# sourceMappingURL=isNotNull.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isNotNull.js","names":["isNotNull","x"],"sources":["../../src/utils/isNotNull.ts"],"sourcesContent":["export function isNotNull<T>(x: T | null): x is T {\n return x !== null;\n}\n"],"mappings":";;;;;;AAAO,SAASA,SAASA,CAAIC,CAAW,EAAU;EAChD,OAAOA,CAAC,KAAK,IAAI;AACnB","ignoreList":[]}
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isRemoved = isRemoved;
7
- /**
8
- * Checks if a given path has been removed from the AST.
9
- */
10
- function isRemoved(path) {
11
- // Check if the input path has already been removed
12
- if (path.removed) {
13
- return true;
14
- }
15
-
16
- // Check if any of the parent paths have been removed
17
- let currentPath = path;
18
- while (currentPath) {
19
- const parent = currentPath.parentPath;
20
- if (parent) {
21
- // If the parent path has been removed, return true
22
- if (parent.removed || parent.node === null) {
23
- return true;
24
- }
25
- const {
26
- listKey,
27
- key,
28
- node
29
- } = currentPath;
30
- if (listKey) {
31
- // If the current path is part of a list and the current node
32
- // is not presented in this list, return true
33
- const found = parent.get(listKey).find(p => p.node === node);
34
- if (!found) {
35
- return true;
36
- }
37
- }
38
- // If the current path is not part of a list and its node is not the same
39
- // as the node in the parent object at the same key, return true
40
- else if (parent.get(key).node !== node) {
41
- return true;
42
- }
43
- }
44
-
45
- // Set the current path to its parent path and continue the loop
46
- currentPath = parent;
47
- }
48
-
49
- // If the function has not returned true by this point, return false
50
- return false;
51
- }
52
- //# sourceMappingURL=isRemoved.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRemoved.js","names":["isRemoved","path","removed","currentPath","parent","parentPath","node","listKey","key","found","get","find","p"],"sources":["../../src/utils/isRemoved.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\n\n/**\n * Checks if a given path has been removed from the AST.\n */\nexport function isRemoved(path: NodePath): boolean {\n // Check if the input path has already been removed\n if (path.removed) {\n return true;\n }\n\n // Check if any of the parent paths have been removed\n let currentPath: NodePath | null = path;\n while (currentPath) {\n const parent: NodePath | null = currentPath.parentPath;\n\n if (parent) {\n // If the parent path has been removed, return true\n if (parent.removed || parent.node === null) {\n return true;\n }\n\n const { listKey, key, node } = currentPath;\n if (listKey) {\n // If the current path is part of a list and the current node\n // is not presented in this list, return true\n const found = (parent.get(listKey) as NodePath[]).find(\n (p) => p.node === node\n );\n if (!found) {\n return true;\n }\n }\n // If the current path is not part of a list and its node is not the same\n // as the node in the parent object at the same key, return true\n else if ((parent.get(key as string) as NodePath).node !== node) {\n return true;\n }\n }\n\n // Set the current path to its parent path and continue the loop\n currentPath = parent;\n }\n\n // If the function has not returned true by this point, return false\n return false;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACO,SAASA,SAASA,CAACC,IAAc,EAAW;EACjD;EACA,IAAIA,IAAI,CAACC,OAAO,EAAE;IAChB,OAAO,IAAI;EACb;;EAEA;EACA,IAAIC,WAA4B,GAAGF,IAAI;EACvC,OAAOE,WAAW,EAAE;IAClB,MAAMC,MAAuB,GAAGD,WAAW,CAACE,UAAU;IAEtD,IAAID,MAAM,EAAE;MACV;MACA,IAAIA,MAAM,CAACF,OAAO,IAAIE,MAAM,CAACE,IAAI,KAAK,IAAI,EAAE;QAC1C,OAAO,IAAI;MACb;MAEA,MAAM;QAAEC,OAAO;QAAEC,GAAG;QAAEF;MAAK,CAAC,GAAGH,WAAW;MAC1C,IAAII,OAAO,EAAE;QACX;QACA;QACA,MAAME,KAAK,GAAIL,MAAM,CAACM,GAAG,CAACH,OAAO,CAAC,CAAgBI,IAAI,CACnDC,CAAC,IAAKA,CAAC,CAACN,IAAI,KAAKA,IACpB,CAAC;QACD,IAAI,CAACG,KAAK,EAAE;UACV,OAAO,IAAI;QACb;MACF;MACA;MACA;MAAA,KACK,IAAKL,MAAM,CAACM,GAAG,CAACF,GAAa,CAAC,CAAcF,IAAI,KAAKA,IAAI,EAAE;QAC9D,OAAO,IAAI;MACb;IACF;;IAEA;IACAH,WAAW,GAAGC,MAAM;EACtB;;EAEA;EACA,OAAO,KAAK;AACd","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isRequire = isRequire;
7
- var _isGlobal = require("./isGlobal");
8
- /**
9
- * Checks that specified Identifier is a global `require`
10
- * @param id
11
- */
12
- function isRequire(id) {
13
- if (!(id !== null && id !== void 0 && id.isIdentifier()) || id.node.name !== 'require') {
14
- return false;
15
- }
16
- return (0, _isGlobal.isGlobal)(id, 'require');
17
- }
18
- //# sourceMappingURL=isRequire.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRequire.js","names":["_isGlobal","require","isRequire","id","isIdentifier","node","name","isGlobal"],"sources":["../../src/utils/isRequire.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\n\nimport { isGlobal } from './isGlobal';\n\n/**\n * Checks that specified Identifier is a global `require`\n * @param id\n */\nexport function isRequire(id: NodePath | null | undefined) {\n if (!id?.isIdentifier() || id.node.name !== 'require') {\n return false;\n }\n\n return isGlobal(id, 'require');\n}\n"],"mappings":";;;;;;AAEA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAACC,EAA+B,EAAE;EACzD,IAAI,EAACA,EAAE,aAAFA,EAAE,eAAFA,EAAE,CAAEC,YAAY,CAAC,CAAC,KAAID,EAAE,CAACE,IAAI,CAACC,IAAI,KAAK,SAAS,EAAE;IACrD,OAAO,KAAK;EACd;EAEA,OAAO,IAAAC,kBAAQ,EAACJ,EAAE,EAAE,SAAS,CAAC;AAChC","ignoreList":[]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isSerializable = isSerializable;
7
- var _shared = require("@wyw-in-js/shared");
8
- function isSerializable(o) {
9
- if (Array.isArray(o)) {
10
- return o.every(isSerializable);
11
- }
12
- if (o === null) return true;
13
- if ((0, _shared.isBoxedPrimitive)(o)) return true;
14
- if (typeof o === 'object') {
15
- return Object.values(o).every(isSerializable);
16
- }
17
- return typeof o === 'string' || typeof o === 'number' || typeof o === 'boolean';
18
- }
19
- //# sourceMappingURL=isSerializable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isSerializable.js","names":["_shared","require","isSerializable","o","Array","isArray","every","isBoxedPrimitive","Object","values"],"sources":["../../src/utils/isSerializable.ts"],"sourcesContent":["import { isBoxedPrimitive } from '@wyw-in-js/shared';\n\nimport type { Serializable } from '../types';\n\nexport function isSerializable(o: unknown): o is Serializable {\n if (Array.isArray(o)) {\n return o.every(isSerializable);\n }\n\n if (o === null) return true;\n\n if (isBoxedPrimitive(o)) return true;\n\n if (typeof o === 'object') {\n return Object.values(o).every(isSerializable);\n }\n\n return (\n typeof o === 'string' || typeof o === 'number' || typeof o === 'boolean'\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIO,SAASC,cAAcA,CAACC,CAAU,EAAqB;EAC5D,IAAIC,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,EAAE;IACpB,OAAOA,CAAC,CAACG,KAAK,CAACJ,cAAc,CAAC;EAChC;EAEA,IAAIC,CAAC,KAAK,IAAI,EAAE,OAAO,IAAI;EAE3B,IAAI,IAAAI,wBAAgB,EAACJ,CAAC,CAAC,EAAE,OAAO,IAAI;EAEpC,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;IACzB,OAAOK,MAAM,CAACC,MAAM,CAACN,CAAC,CAAC,CAACG,KAAK,CAACJ,cAAc,CAAC;EAC/C;EAEA,OACE,OAAOC,CAAC,KAAK,QAAQ,IAAI,OAAOA,CAAC,KAAK,QAAQ,IAAI,OAAOA,CAAC,KAAK,SAAS;AAE5E","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isTypedNode = void 0;
7
- const isTypedNode = type => {
8
- return p => {
9
- return p.type === type;
10
- };
11
- };
12
- exports.isTypedNode = isTypedNode;
13
- //# sourceMappingURL=isTypedNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isTypedNode.js","names":["isTypedNode","type","p","exports"],"sources":["../../src/utils/isTypedNode.ts"],"sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport type { Node } from '@babel/types';\n\nexport const isTypedNode: <T extends NodePath['type']>(\n type: T\n) => (p: NodePath) => p is NodePath<\n Extract<\n Node,\n {\n type: T;\n }\n >\n> = <T extends NodePath['type']>(type: T) => {\n return (p: NodePath): p is NodePath<Extract<Node, { type: T }>> => {\n return p.type === type;\n };\n};\n"],"mappings":";;;;;;AAGO,MAAMA,WASZ,GAAgCC,IAAO,IAAK;EAC3C,OAAQC,CAAW,IAAgD;IACjE,OAAOA,CAAC,CAACD,IAAI,KAAKA,IAAI;EACxB,CAAC;AACH,CAAC;AAACE,OAAA,CAAAH,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isUnnecessaryReactCall = isUnnecessaryReactCall;
7
- var _collectExportsAndImports = require("./collectExportsAndImports");
8
- var _getScope = require("./getScope");
9
- function getCallee(p) {
10
- const callee = p.get('callee');
11
- if (callee.isSequenceExpression()) {
12
- const expressions = callee.get('expressions');
13
- if (expressions.length === 2 && expressions[0].isNumericLiteral({
14
- value: 0
15
- })) {
16
- return expressions[1];
17
- }
18
- return callee;
19
- }
20
- return callee;
21
- }
22
- const JSXRuntimeSource = 'react/jsx-runtime';
23
- function isJSXRuntime(p, imports) {
24
- var _jsxRuntime$local, _jsxRuntime$local2;
25
- const jsxRuntime = imports.find(i => i.source === JSXRuntimeSource);
26
- const jsxRuntimeName = (jsxRuntime === null || jsxRuntime === void 0 || (_jsxRuntime$local = jsxRuntime.local) === null || _jsxRuntime$local === void 0 ? void 0 : _jsxRuntime$local.isIdentifier()) && (jsxRuntime === null || jsxRuntime === void 0 || (_jsxRuntime$local2 = jsxRuntime.local) === null || _jsxRuntime$local2 === void 0 || (_jsxRuntime$local2 = _jsxRuntime$local2.node) === null || _jsxRuntime$local2 === void 0 ? void 0 : _jsxRuntime$local2.name);
27
- if (jsxRuntime) {
28
- const callee = getCallee(p);
29
- if (jsxRuntimeName && callee.isIdentifier({
30
- name: jsxRuntimeName
31
- })) {
32
- return true;
33
- }
34
- if (callee.isMemberExpression() && imports.find(i => i.source === JSXRuntimeSource && i.local === callee)) {
35
- return true;
36
- }
37
- }
38
- return false;
39
- }
40
- function isHookOrCreateElement(name) {
41
- return name === 'createElement' || /use[A-Z]/.test(name);
42
- }
43
- function isClassicReactRuntime(p, imports) {
44
- const reactImports = imports.filter(i => i.source === 'react' && (i.imported === 'default' || i.imported && isHookOrCreateElement(i.imported)));
45
- if (reactImports.length === 0) return false;
46
- const callee = getCallee(p);
47
- if (callee.isIdentifier() && isHookOrCreateElement(callee.node.name)) {
48
- var _getScope$getBinding;
49
- const bindingPath = (_getScope$getBinding = (0, _getScope.getScope)(callee).getBinding(callee.node.name)) === null || _getScope$getBinding === void 0 ? void 0 : _getScope$getBinding.path;
50
- return reactImports.some(i => bindingPath === null || bindingPath === void 0 ? void 0 : bindingPath.isAncestor(i.local));
51
- }
52
- if (callee.isMemberExpression()) {
53
- var _getScope$getBinding2, _bindingPath$isAncest;
54
- if (reactImports.some(i => i.local === callee)) {
55
- // It's React.createElement in CJS
56
- return true;
57
- }
58
- const object = callee.get('object');
59
- const property = callee.get('property');
60
- const defaultImport = reactImports.find(i => i.imported === 'default');
61
- if (!defaultImport || !defaultImport.local.isIdentifier() || !property.isIdentifier() || !isHookOrCreateElement(property.node.name) || !object.isIdentifier({
62
- name: defaultImport.local.node.name
63
- })) {
64
- return false;
65
- }
66
- const bindingPath = (_getScope$getBinding2 = (0, _getScope.getScope)(object).getBinding(object.node.name)) === null || _getScope$getBinding2 === void 0 ? void 0 : _getScope$getBinding2.path;
67
- return (_bindingPath$isAncest = bindingPath === null || bindingPath === void 0 ? void 0 : bindingPath.isAncestor(defaultImport.local)) !== null && _bindingPath$isAncest !== void 0 ? _bindingPath$isAncest : false;
68
- }
69
- return false;
70
- }
71
- function isUnnecessaryReactCall(path) {
72
- const programPath = path.findParent(p => p.isProgram());
73
- if (!programPath) {
74
- return false;
75
- }
76
- const {
77
- imports
78
- } = (0, _collectExportsAndImports.collectExportsAndImports)(programPath);
79
- return isJSXRuntime(path, imports) || isClassicReactRuntime(path, imports);
80
- }
81
- //# sourceMappingURL=isUnnecessaryReactCall.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isUnnecessaryReactCall.js","names":["_collectExportsAndImports","require","_getScope","getCallee","p","callee","get","isSequenceExpression","expressions","length","isNumericLiteral","value","JSXRuntimeSource","isJSXRuntime","imports","_jsxRuntime$local","_jsxRuntime$local2","jsxRuntime","find","i","source","jsxRuntimeName","local","isIdentifier","node","name","isMemberExpression","isHookOrCreateElement","test","isClassicReactRuntime","reactImports","filter","imported","_getScope$getBinding","bindingPath","getScope","getBinding","path","some","isAncestor","_getScope$getBinding2","_bindingPath$isAncest","object","property","defaultImport","isUnnecessaryReactCall","programPath","findParent","isProgram","collectExportsAndImports"],"sources":["../../src/utils/isUnnecessaryReactCall.ts"],"sourcesContent":["import type { NodePath } from '@babel/core';\nimport type { CallExpression, Program } from '@babel/types';\n\nimport type { IImport, ISideEffectImport } from './collectExportsAndImports';\nimport { collectExportsAndImports } from './collectExportsAndImports';\nimport { getScope } from './getScope';\n\nfunction getCallee(p: NodePath<CallExpression>) {\n const callee = p.get('callee');\n if (callee.isSequenceExpression()) {\n const expressions = callee.get('expressions');\n if (\n expressions.length === 2 &&\n expressions[0].isNumericLiteral({ value: 0 })\n ) {\n return expressions[1];\n }\n\n return callee;\n }\n\n return callee;\n}\n\nconst JSXRuntimeSource = 'react/jsx-runtime';\n\nfunction isJSXRuntime(\n p: NodePath<CallExpression>,\n imports: (IImport | ISideEffectImport)[]\n) {\n const jsxRuntime = imports.find((i) => i.source === JSXRuntimeSource);\n const jsxRuntimeName =\n jsxRuntime?.local?.isIdentifier() && jsxRuntime?.local?.node?.name;\n\n if (jsxRuntime) {\n const callee = getCallee(p);\n if (jsxRuntimeName && callee.isIdentifier({ name: jsxRuntimeName })) {\n return true;\n }\n\n if (\n callee.isMemberExpression() &&\n imports.find((i) => i.source === JSXRuntimeSource && i.local === callee)\n ) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isHookOrCreateElement(name: string): boolean {\n return name === 'createElement' || /use[A-Z]/.test(name);\n}\n\nfunction isClassicReactRuntime(\n p: NodePath<CallExpression>,\n imports: (IImport | ISideEffectImport)[]\n) {\n const reactImports = imports.filter(\n (i) =>\n i.source === 'react' &&\n (i.imported === 'default' ||\n (i.imported && isHookOrCreateElement(i.imported)))\n ) as IImport[];\n\n if (reactImports.length === 0) return false;\n const callee = getCallee(p);\n if (callee.isIdentifier() && isHookOrCreateElement(callee.node.name)) {\n const bindingPath = getScope(callee).getBinding(callee.node.name)?.path;\n return reactImports.some((i) => bindingPath?.isAncestor(i.local));\n }\n\n if (callee.isMemberExpression()) {\n if (reactImports.some((i) => i.local === callee)) {\n // It's React.createElement in CJS\n return true;\n }\n\n const object = callee.get('object');\n const property = callee.get('property');\n const defaultImport = reactImports.find((i) => i.imported === 'default');\n if (\n !defaultImport ||\n !defaultImport.local.isIdentifier() ||\n !property.isIdentifier() ||\n !isHookOrCreateElement(property.node.name) ||\n !object.isIdentifier({ name: defaultImport.local.node.name })\n ) {\n return false;\n }\n\n const bindingPath = getScope(object).getBinding(object.node.name)?.path;\n return bindingPath?.isAncestor(defaultImport.local) ?? false;\n }\n\n return false;\n}\n\nexport function isUnnecessaryReactCall(path: NodePath<CallExpression>) {\n const programPath = path.findParent((p) => p.isProgram()) as\n | NodePath<Program>\n | undefined;\n if (!programPath) {\n return false;\n }\n\n const { imports } = collectExportsAndImports(programPath);\n\n return isJSXRuntime(path, imports) || isClassicReactRuntime(path, imports);\n}\n"],"mappings":";;;;;;AAIA,IA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