@wyw-in-js/transform 0.1.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 (480) hide show
  1. package/LICENSE +21 -0
  2. package/esm/babel.js +2 -0
  3. package/esm/babel.js.map +1 -0
  4. package/esm/cache.js +80 -0
  5. package/esm/cache.js.map +1 -0
  6. package/esm/debug/fileReporter.js +144 -0
  7. package/esm/debug/fileReporter.js.map +1 -0
  8. package/esm/evaluators/index.js +14 -0
  9. package/esm/evaluators/index.js.map +1 -0
  10. package/esm/index.js +24 -0
  11. package/esm/index.js.map +1 -0
  12. package/esm/module.js +316 -0
  13. package/esm/module.js.map +1 -0
  14. package/esm/options/babel-merge.d.js +2 -0
  15. package/esm/options/babel-merge.d.js.map +1 -0
  16. package/esm/options/buildOptions.js +28 -0
  17. package/esm/options/buildOptions.js.map +1 -0
  18. package/esm/options/loadBabelOptions.js +24 -0
  19. package/esm/options/loadBabelOptions.js.map +1 -0
  20. package/esm/plugins/babel-transform.js +53 -0
  21. package/esm/plugins/babel-transform.js.map +1 -0
  22. package/esm/plugins/collector.js +66 -0
  23. package/esm/plugins/collector.js.map +1 -0
  24. package/esm/plugins/dynamic-import.js +28 -0
  25. package/esm/plugins/dynamic-import.js.map +1 -0
  26. package/esm/plugins/preeval.js +75 -0
  27. package/esm/plugins/preeval.js.map +1 -0
  28. package/esm/plugins/shaker.js +296 -0
  29. package/esm/plugins/shaker.js.map +1 -0
  30. package/esm/shaker.js +50 -0
  31. package/esm/shaker.js.map +1 -0
  32. package/esm/transform/BaseEntrypoint.js +164 -0
  33. package/esm/transform/BaseEntrypoint.js.map +1 -0
  34. package/esm/transform/Entrypoint.helpers.js +168 -0
  35. package/esm/transform/Entrypoint.helpers.js.map +1 -0
  36. package/esm/transform/Entrypoint.js +212 -0
  37. package/esm/transform/Entrypoint.js.map +1 -0
  38. package/esm/transform/Entrypoint.types.js +2 -0
  39. package/esm/transform/Entrypoint.types.js.map +1 -0
  40. package/esm/transform/EvaluatedEntrypoint.js +6 -0
  41. package/esm/transform/EvaluatedEntrypoint.js.map +1 -0
  42. package/esm/transform/actions/AbortError.js +8 -0
  43. package/esm/transform/actions/AbortError.js.map +1 -0
  44. package/esm/transform/actions/BaseAction.js +134 -0
  45. package/esm/transform/actions/BaseAction.js.map +1 -0
  46. package/esm/transform/actions/UnprocessedEntrypointError.js +8 -0
  47. package/esm/transform/actions/UnprocessedEntrypointError.js.map +1 -0
  48. package/esm/transform/actions/actionRunner.js +73 -0
  49. package/esm/transform/actions/actionRunner.js.map +1 -0
  50. package/esm/transform/actions/types.js +2 -0
  51. package/esm/transform/actions/types.js.map +1 -0
  52. package/esm/transform/generators/baseProcessingHandlers.js +22 -0
  53. package/esm/transform/generators/baseProcessingHandlers.js.map +1 -0
  54. package/esm/transform/generators/collect.js +58 -0
  55. package/esm/transform/generators/collect.js.map +1 -0
  56. package/esm/transform/generators/evalFile.js +50 -0
  57. package/esm/transform/generators/evalFile.js.map +1 -0
  58. package/esm/transform/generators/explodeReexports.js +63 -0
  59. package/esm/transform/generators/explodeReexports.js.map +1 -0
  60. package/esm/transform/generators/extract.js +120 -0
  61. package/esm/transform/generators/extract.js.map +1 -0
  62. package/esm/transform/generators/getExports.js +73 -0
  63. package/esm/transform/generators/getExports.js.map +1 -0
  64. package/esm/transform/generators/index.js +13 -0
  65. package/esm/transform/generators/index.js.map +1 -0
  66. package/esm/transform/generators/processEntrypoint.js +43 -0
  67. package/esm/transform/generators/processEntrypoint.js.map +1 -0
  68. package/esm/transform/generators/processImports.js +23 -0
  69. package/esm/transform/generators/processImports.js.map +1 -0
  70. package/esm/transform/generators/resolveImports.js +148 -0
  71. package/esm/transform/generators/resolveImports.js.map +1 -0
  72. package/esm/transform/generators/transform.js +117 -0
  73. package/esm/transform/generators/transform.js.map +1 -0
  74. package/esm/transform/generators/workflow.js +82 -0
  75. package/esm/transform/generators/workflow.js.map +1 -0
  76. package/esm/transform/helpers/loadLinariaOptions.js +66 -0
  77. package/esm/transform/helpers/loadLinariaOptions.js.map +1 -0
  78. package/esm/transform/helpers/withDefaultServices.js +21 -0
  79. package/esm/transform/helpers/withDefaultServices.js.map +1 -0
  80. package/esm/transform/rootLog.js +3 -0
  81. package/esm/transform/rootLog.js.map +1 -0
  82. package/esm/transform/types.js +2 -0
  83. package/esm/transform/types.js.map +1 -0
  84. package/esm/transform.js +121 -0
  85. package/esm/transform.js.map +1 -0
  86. package/esm/types.js +2 -0
  87. package/esm/types.js.map +1 -0
  88. package/esm/utils/EventEmitter.js +52 -0
  89. package/esm/utils/EventEmitter.js.map +1 -0
  90. package/esm/utils/ShakerMetadata.js +2 -0
  91. package/esm/utils/ShakerMetadata.js.map +1 -0
  92. package/esm/utils/TransformMetadata.js +11 -0
  93. package/esm/utils/TransformMetadata.js.map +1 -0
  94. package/esm/utils/addIdentifierToLinariaPreval.js +68 -0
  95. package/esm/utils/addIdentifierToLinariaPreval.js.map +1 -0
  96. package/esm/utils/collectExportsAndImports.js +974 -0
  97. package/esm/utils/collectExportsAndImports.js.map +1 -0
  98. package/esm/utils/collectTemplateDependencies.js +219 -0
  99. package/esm/utils/collectTemplateDependencies.js.map +1 -0
  100. package/esm/utils/createId.js +6 -0
  101. package/esm/utils/createId.js.map +1 -0
  102. package/esm/utils/dispose-polyfill.js +6 -0
  103. package/esm/utils/dispose-polyfill.js.map +1 -0
  104. package/esm/utils/findIdentifiers.js +62 -0
  105. package/esm/utils/findIdentifiers.js.map +1 -0
  106. package/esm/utils/findPackageJSON.js +22 -0
  107. package/esm/utils/findPackageJSON.js.map +1 -0
  108. package/esm/utils/getFileIdx.js +10 -0
  109. package/esm/utils/getFileIdx.js.map +1 -0
  110. package/esm/utils/getPluginKey.js +13 -0
  111. package/esm/utils/getPluginKey.js.map +1 -0
  112. package/esm/utils/getScope.js +6 -0
  113. package/esm/utils/getScope.js.map +1 -0
  114. package/esm/utils/getSource.js +15 -0
  115. package/esm/utils/getSource.js.map +1 -0
  116. package/esm/utils/getTagProcessor.js +304 -0
  117. package/esm/utils/getTagProcessor.js.map +1 -0
  118. package/esm/utils/getVisitorKeys.js +5 -0
  119. package/esm/utils/getVisitorKeys.js.map +1 -0
  120. package/esm/utils/hasLinariaPreval.js +7 -0
  121. package/esm/utils/hasLinariaPreval.js.map +1 -0
  122. package/esm/utils/isExports.js +22 -0
  123. package/esm/utils/isExports.js.map +1 -0
  124. package/esm/utils/isGlobal.js +6 -0
  125. package/esm/utils/isGlobal.js.map +1 -0
  126. package/esm/utils/isNode.js +2 -0
  127. package/esm/utils/isNode.js.map +1 -0
  128. package/esm/utils/isNodePath.js +4 -0
  129. package/esm/utils/isNodePath.js.map +1 -0
  130. package/esm/utils/isNotNull.js +4 -0
  131. package/esm/utils/isNotNull.js.map +1 -0
  132. package/esm/utils/isRemoved.js +46 -0
  133. package/esm/utils/isRemoved.js.map +1 -0
  134. package/esm/utils/isRequire.js +13 -0
  135. package/esm/utils/isRequire.js.map +1 -0
  136. package/esm/utils/isSerializable.js +13 -0
  137. package/esm/utils/isSerializable.js.map +1 -0
  138. package/esm/utils/isTypedNode.js +6 -0
  139. package/esm/utils/isTypedNode.js.map +1 -0
  140. package/esm/utils/isUnnecessaryReactCall.js +72 -0
  141. package/esm/utils/isUnnecessaryReactCall.js.map +1 -0
  142. package/esm/utils/peek.js +2 -0
  143. package/esm/utils/peek.js.map +1 -0
  144. package/esm/utils/processTemplateExpression.js +11 -0
  145. package/esm/utils/processTemplateExpression.js.map +1 -0
  146. package/esm/utils/removeDangerousCode.js +127 -0
  147. package/esm/utils/removeDangerousCode.js.map +1 -0
  148. package/esm/utils/scopeHelpers.js +514 -0
  149. package/esm/utils/scopeHelpers.js.map +1 -0
  150. package/esm/utils/traversalCache.js +28 -0
  151. package/esm/utils/traversalCache.js.map +1 -0
  152. package/esm/utils/unwrapSequence.js +14 -0
  153. package/esm/utils/unwrapSequence.js.map +1 -0
  154. package/esm/utils/valueToLiteral.js +59 -0
  155. package/esm/utils/valueToLiteral.js.map +1 -0
  156. package/esm/utils/visitors/JSXElementsRemover.js +51 -0
  157. package/esm/utils/visitors/JSXElementsRemover.js.map +1 -0
  158. package/esm/vm/createVmContext.js +72 -0
  159. package/esm/vm/createVmContext.js.map +1 -0
  160. package/esm/vm/process.js +29 -0
  161. package/esm/vm/process.js.map +1 -0
  162. package/lib/babel.js +2 -0
  163. package/lib/babel.js.map +1 -0
  164. package/lib/cache.js +87 -0
  165. package/lib/cache.js.map +1 -0
  166. package/lib/debug/fileReporter.js +153 -0
  167. package/lib/debug/fileReporter.js.map +1 -0
  168. package/lib/evaluators/index.js +20 -0
  169. package/lib/evaluators/index.js.map +1 -0
  170. package/lib/index.js +225 -0
  171. package/lib/index.js.map +1 -0
  172. package/lib/module.js +327 -0
  173. package/lib/module.js.map +1 -0
  174. package/lib/options/babel-merge.d.js +2 -0
  175. package/lib/options/babel-merge.d.js.map +1 -0
  176. package/lib/options/buildOptions.js +35 -0
  177. package/lib/options/buildOptions.js.map +1 -0
  178. package/lib/options/loadBabelOptions.js +31 -0
  179. package/lib/options/loadBabelOptions.js.map +1 -0
  180. package/lib/plugins/babel-transform.js +60 -0
  181. package/lib/plugins/babel-transform.js.map +1 -0
  182. package/lib/plugins/collector.js +76 -0
  183. package/lib/plugins/collector.js.map +1 -0
  184. package/lib/plugins/dynamic-import.js +34 -0
  185. package/lib/plugins/dynamic-import.js.map +1 -0
  186. package/lib/plugins/preeval.js +82 -0
  187. package/lib/plugins/preeval.js.map +1 -0
  188. package/lib/plugins/shaker.js +303 -0
  189. package/lib/plugins/shaker.js.map +1 -0
  190. package/lib/shaker.js +58 -0
  191. package/lib/shaker.js.map +1 -0
  192. package/lib/transform/BaseEntrypoint.js +175 -0
  193. package/lib/transform/BaseEntrypoint.js.map +1 -0
  194. package/lib/transform/Entrypoint.helpers.js +182 -0
  195. package/lib/transform/Entrypoint.helpers.js.map +1 -0
  196. package/lib/transform/Entrypoint.js +226 -0
  197. package/lib/transform/Entrypoint.js.map +1 -0
  198. package/lib/transform/Entrypoint.types.js +2 -0
  199. package/lib/transform/Entrypoint.types.js.map +1 -0
  200. package/lib/transform/EvaluatedEntrypoint.js +13 -0
  201. package/lib/transform/EvaluatedEntrypoint.js.map +1 -0
  202. package/lib/transform/actions/AbortError.js +16 -0
  203. package/lib/transform/actions/AbortError.js.map +1 -0
  204. package/lib/transform/actions/BaseAction.js +144 -0
  205. package/lib/transform/actions/BaseAction.js.map +1 -0
  206. package/lib/transform/actions/UnprocessedEntrypointError.js +16 -0
  207. package/lib/transform/actions/UnprocessedEntrypointError.js.map +1 -0
  208. package/lib/transform/actions/actionRunner.js +82 -0
  209. package/lib/transform/actions/actionRunner.js.map +1 -0
  210. package/lib/transform/actions/types.js +2 -0
  211. package/lib/transform/actions/types.js.map +1 -0
  212. package/lib/transform/generators/baseProcessingHandlers.js +27 -0
  213. package/lib/transform/generators/baseProcessingHandlers.js.map +1 -0
  214. package/lib/transform/generators/collect.js +66 -0
  215. package/lib/transform/generators/collect.js.map +1 -0
  216. package/lib/transform/generators/evalFile.js +57 -0
  217. package/lib/transform/generators/evalFile.js.map +1 -0
  218. package/lib/transform/generators/explodeReexports.js +70 -0
  219. package/lib/transform/generators/explodeReexports.js.map +1 -0
  220. package/lib/transform/generators/extract.js +128 -0
  221. package/lib/transform/generators/extract.js.map +1 -0
  222. package/lib/transform/generators/getExports.js +80 -0
  223. package/lib/transform/generators/getExports.js.map +1 -0
  224. package/lib/transform/generators/index.js +19 -0
  225. package/lib/transform/generators/index.js.map +1 -0
  226. package/lib/transform/generators/processEntrypoint.js +49 -0
  227. package/lib/transform/generators/processEntrypoint.js.map +1 -0
  228. package/lib/transform/generators/processImports.js +29 -0
  229. package/lib/transform/generators/processImports.js.map +1 -0
  230. package/lib/transform/generators/resolveImports.js +158 -0
  231. package/lib/transform/generators/resolveImports.js.map +1 -0
  232. package/lib/transform/generators/transform.js +130 -0
  233. package/lib/transform/generators/transform.js.map +1 -0
  234. package/lib/transform/generators/workflow.js +90 -0
  235. package/lib/transform/generators/workflow.js.map +1 -0
  236. package/lib/transform/helpers/loadLinariaOptions.js +73 -0
  237. package/lib/transform/helpers/loadLinariaOptions.js.map +1 -0
  238. package/lib/transform/helpers/withDefaultServices.js +30 -0
  239. package/lib/transform/helpers/withDefaultServices.js.map +1 -0
  240. package/lib/transform/rootLog.js +9 -0
  241. package/lib/transform/rootLog.js.map +1 -0
  242. package/lib/transform/types.js +8 -0
  243. package/lib/transform/types.js.map +1 -0
  244. package/lib/transform.js +128 -0
  245. package/lib/transform.js.map +1 -0
  246. package/lib/types.js +2 -0
  247. package/lib/types.js.map +1 -0
  248. package/lib/utils/EventEmitter.js +61 -0
  249. package/lib/utils/EventEmitter.js.map +1 -0
  250. package/lib/utils/ShakerMetadata.js +9 -0
  251. package/lib/utils/ShakerMetadata.js.map +1 -0
  252. package/lib/utils/TransformMetadata.js +19 -0
  253. package/lib/utils/TransformMetadata.js.map +1 -0
  254. package/lib/utils/addIdentifierToLinariaPreval.js +75 -0
  255. package/lib/utils/addIdentifierToLinariaPreval.js.map +1 -0
  256. package/lib/utils/collectExportsAndImports.js +990 -0
  257. package/lib/utils/collectExportsAndImports.js.map +1 -0
  258. package/lib/utils/collectTemplateDependencies.js +233 -0
  259. package/lib/utils/collectTemplateDependencies.js.map +1 -0
  260. package/lib/utils/createId.js +13 -0
  261. package/lib/utils/createId.js.map +1 -0
  262. package/lib/utils/dispose-polyfill.js +9 -0
  263. package/lib/utils/dispose-polyfill.js.map +1 -0
  264. package/lib/utils/findIdentifiers.js +73 -0
  265. package/lib/utils/findIdentifiers.js.map +1 -0
  266. package/lib/utils/findPackageJSON.js +29 -0
  267. package/lib/utils/findPackageJSON.js.map +1 -0
  268. package/lib/utils/getFileIdx.js +16 -0
  269. package/lib/utils/getFileIdx.js.map +1 -0
  270. package/lib/utils/getPluginKey.js +21 -0
  271. package/lib/utils/getPluginKey.js.map +1 -0
  272. package/lib/utils/getScope.js +12 -0
  273. package/lib/utils/getScope.js.map +1 -0
  274. package/lib/utils/getSource.js +24 -0
  275. package/lib/utils/getSource.js.map +1 -0
  276. package/lib/utils/getTagProcessor.js +318 -0
  277. package/lib/utils/getTagProcessor.js.map +1 -0
  278. package/lib/utils/getVisitorKeys.js +11 -0
  279. package/lib/utils/getVisitorKeys.js.map +1 -0
  280. package/lib/utils/hasLinariaPreval.js +13 -0
  281. package/lib/utils/hasLinariaPreval.js.map +1 -0
  282. package/lib/utils/isExports.js +27 -0
  283. package/lib/utils/isExports.js.map +1 -0
  284. package/lib/utils/isGlobal.js +13 -0
  285. package/lib/utils/isGlobal.js.map +1 -0
  286. package/lib/utils/isNode.js +9 -0
  287. package/lib/utils/isNode.js.map +1 -0
  288. package/lib/utils/isNodePath.js +10 -0
  289. package/lib/utils/isNodePath.js.map +1 -0
  290. package/lib/utils/isNotNull.js +10 -0
  291. package/lib/utils/isNotNull.js.map +1 -0
  292. package/lib/utils/isRemoved.js +52 -0
  293. package/lib/utils/isRemoved.js.map +1 -0
  294. package/lib/utils/isRequire.js +18 -0
  295. package/lib/utils/isRequire.js.map +1 -0
  296. package/lib/utils/isSerializable.js +19 -0
  297. package/lib/utils/isSerializable.js.map +1 -0
  298. package/lib/utils/isTypedNode.js +13 -0
  299. package/lib/utils/isTypedNode.js.map +1 -0
  300. package/lib/utils/isUnnecessaryReactCall.js +81 -0
  301. package/lib/utils/isUnnecessaryReactCall.js.map +1 -0
  302. package/lib/utils/peek.js +9 -0
  303. package/lib/utils/peek.js.map +1 -0
  304. package/lib/utils/processTemplateExpression.js +18 -0
  305. package/lib/utils/processTemplateExpression.js.map +1 -0
  306. package/lib/utils/removeDangerousCode.js +134 -0
  307. package/lib/utils/removeDangerousCode.js.map +1 -0
  308. package/lib/utils/scopeHelpers.js +544 -0
  309. package/lib/utils/scopeHelpers.js.map +1 -0
  310. package/lib/utils/traversalCache.js +38 -0
  311. package/lib/utils/traversalCache.js.map +1 -0
  312. package/lib/utils/unwrapSequence.js +20 -0
  313. package/lib/utils/unwrapSequence.js.map +1 -0
  314. package/lib/utils/valueToLiteral.js +65 -0
  315. package/lib/utils/valueToLiteral.js.map +1 -0
  316. package/lib/utils/visitors/JSXElementsRemover.js +57 -0
  317. package/lib/utils/visitors/JSXElementsRemover.js.map +1 -0
  318. package/lib/vm/createVmContext.js +80 -0
  319. package/lib/vm/createVmContext.js.map +1 -0
  320. package/lib/vm/process.js +38 -0
  321. package/lib/vm/process.js.map +1 -0
  322. package/package.json +63 -0
  323. package/types/babel.d.ts +2 -0
  324. package/types/babel.js +2 -0
  325. package/types/cache.d.ts +24 -0
  326. package/types/cache.js +85 -0
  327. package/types/debug/fileReporter.d.ts +27 -0
  328. package/types/debug/fileReporter.js +151 -0
  329. package/types/evaluators/index.d.ts +10 -0
  330. package/types/evaluators/index.js +15 -0
  331. package/types/index.d.ts +30 -0
  332. package/types/index.js +69 -0
  333. package/types/module.d.ts +62 -0
  334. package/types/module.js +318 -0
  335. package/types/options/buildOptions.d.ts +7 -0
  336. package/types/options/buildOptions.js +35 -0
  337. package/types/options/loadBabelOptions.d.ts +3 -0
  338. package/types/options/loadBabelOptions.js +27 -0
  339. package/types/plugins/babel-transform.d.ts +4 -0
  340. package/types/plugins/babel-transform.js +49 -0
  341. package/types/plugins/collector.d.ts +16 -0
  342. package/types/plugins/collector.js +67 -0
  343. package/types/plugins/dynamic-import.d.ts +6 -0
  344. package/types/plugins/dynamic-import.js +32 -0
  345. package/types/plugins/preeval.d.ts +16 -0
  346. package/types/plugins/preeval.js +69 -0
  347. package/types/plugins/shaker.d.ts +11 -0
  348. package/types/plugins/shaker.js +299 -0
  349. package/types/shaker.d.ts +3 -0
  350. package/types/shaker.js +64 -0
  351. package/types/transform/BaseEntrypoint.d.ts +23 -0
  352. package/types/transform/BaseEntrypoint.js +182 -0
  353. package/types/transform/Entrypoint.d.ts +50 -0
  354. package/types/transform/Entrypoint.helpers.d.ts +14 -0
  355. package/types/transform/Entrypoint.helpers.js +169 -0
  356. package/types/transform/Entrypoint.js +223 -0
  357. package/types/transform/Entrypoint.types.d.ts +23 -0
  358. package/types/transform/Entrypoint.types.js +2 -0
  359. package/types/transform/EvaluatedEntrypoint.d.ts +16 -0
  360. package/types/transform/EvaluatedEntrypoint.js +9 -0
  361. package/types/transform/actions/AbortError.d.ts +4 -0
  362. package/types/transform/actions/AbortError.js +12 -0
  363. package/types/transform/actions/BaseAction.d.ts +40 -0
  364. package/types/transform/actions/BaseAction.js +149 -0
  365. package/types/transform/actions/UnprocessedEntrypointError.d.ts +6 -0
  366. package/types/transform/actions/UnprocessedEntrypointError.js +13 -0
  367. package/types/transform/actions/actionRunner.d.ts +4 -0
  368. package/types/transform/actions/actionRunner.js +86 -0
  369. package/types/transform/actions/types.d.ts +15 -0
  370. package/types/transform/actions/types.js +2 -0
  371. package/types/transform/generators/baseProcessingHandlers.d.ts +17 -0
  372. package/types/transform/generators/baseProcessingHandlers.js +23 -0
  373. package/types/transform/generators/collect.d.ts +6 -0
  374. package/types/transform/generators/collect.js +57 -0
  375. package/types/transform/generators/evalFile.d.ts +6 -0
  376. package/types/transform/generators/evalFile.js +56 -0
  377. package/types/transform/generators/explodeReexports.d.ts +7 -0
  378. package/types/transform/generators/explodeReexports.js +67 -0
  379. package/types/transform/generators/extract.d.ts +8 -0
  380. package/types/transform/generators/extract.js +116 -0
  381. package/types/transform/generators/getExports.d.ts +8 -0
  382. package/types/transform/generators/getExports.js +65 -0
  383. package/types/transform/generators/index.d.ts +15 -0
  384. package/types/transform/generators/index.js +15 -0
  385. package/types/transform/generators/processEntrypoint.d.ts +9 -0
  386. package/types/transform/generators/processEntrypoint.js +88 -0
  387. package/types/transform/generators/processImports.d.ts +5 -0
  388. package/types/transform/generators/processImports.js +21 -0
  389. package/types/transform/generators/resolveImports.d.ts +9 -0
  390. package/types/transform/generators/resolveImports.js +124 -0
  391. package/types/transform/generators/transform.d.ts +17 -0
  392. package/types/transform/generators/transform.js +115 -0
  393. package/types/transform/generators/workflow.d.ts +7 -0
  394. package/types/transform/generators/workflow.js +77 -0
  395. package/types/transform/helpers/loadLinariaOptions.d.ts +6 -0
  396. package/types/transform/helpers/loadLinariaOptions.js +86 -0
  397. package/types/transform/helpers/withDefaultServices.d.ts +5 -0
  398. package/types/transform/helpers/withDefaultServices.js +40 -0
  399. package/types/transform/rootLog.d.ts +3 -0
  400. package/types/transform/rootLog.js +5 -0
  401. package/types/transform/types.d.ts +137 -0
  402. package/types/transform/types.js +4 -0
  403. package/types/transform.d.ts +20 -0
  404. package/types/transform.js +121 -0
  405. package/types/types.d.ts +72 -0
  406. package/types/types.js +5 -0
  407. package/types/utils/EventEmitter.d.ts +58 -0
  408. package/types/utils/EventEmitter.js +61 -0
  409. package/types/utils/ShakerMetadata.d.ts +7 -0
  410. package/types/utils/ShakerMetadata.js +5 -0
  411. package/types/utils/TransformMetadata.d.ts +13 -0
  412. package/types/utils/TransformMetadata.js +17 -0
  413. package/types/utils/addIdentifierToLinariaPreval.d.ts +4 -0
  414. package/types/utils/addIdentifierToLinariaPreval.js +75 -0
  415. package/types/utils/collectExportsAndImports.d.ts +31 -0
  416. package/types/utils/collectExportsAndImports.js +962 -0
  417. package/types/utils/collectTemplateDependencies.d.ts +17 -0
  418. package/types/utils/collectTemplateDependencies.js +212 -0
  419. package/types/utils/createId.d.ts +2 -0
  420. package/types/utils/createId.js +9 -0
  421. package/types/utils/dispose-polyfill.d.ts +0 -0
  422. package/types/utils/dispose-polyfill.js +5 -0
  423. package/types/utils/findIdentifiers.d.ts +6 -0
  424. package/types/utils/findIdentifiers.js +68 -0
  425. package/types/utils/findPackageJSON.d.ts +1 -0
  426. package/types/utils/findPackageJSON.js +29 -0
  427. package/types/utils/getFileIdx.d.ts +1 -0
  428. package/types/utils/getFileIdx.js +13 -0
  429. package/types/utils/getPluginKey.d.ts +2 -0
  430. package/types/utils/getPluginKey.js +16 -0
  431. package/types/utils/getScope.d.ts +2 -0
  432. package/types/utils/getScope.js +11 -0
  433. package/types/utils/getSource.d.ts +2 -0
  434. package/types/utils/getSource.js +22 -0
  435. package/types/utils/getTagProcessor.d.ts +6 -0
  436. package/types/utils/getTagProcessor.js +315 -0
  437. package/types/utils/getVisitorKeys.d.ts +5 -0
  438. package/types/utils/getVisitorKeys.js +8 -0
  439. package/types/utils/hasLinariaPreval.d.ts +4 -0
  440. package/types/utils/hasLinariaPreval.js +9 -0
  441. package/types/utils/isExports.d.ts +6 -0
  442. package/types/utils/isExports.js +20 -0
  443. package/types/utils/isGlobal.d.ts +2 -0
  444. package/types/utils/isGlobal.js +9 -0
  445. package/types/utils/isNode.d.ts +2 -0
  446. package/types/utils/isNode.js +7 -0
  447. package/types/utils/isNodePath.d.ts +3 -0
  448. package/types/utils/isNodePath.js +7 -0
  449. package/types/utils/isNotNull.d.ts +1 -0
  450. package/types/utils/isNotNull.js +7 -0
  451. package/types/utils/isRemoved.d.ts +5 -0
  452. package/types/utils/isRemoved.js +42 -0
  453. package/types/utils/isRequire.d.ts +6 -0
  454. package/types/utils/isRequire.js +15 -0
  455. package/types/utils/isSerializable.d.ts +2 -0
  456. package/types/utils/isSerializable.js +18 -0
  457. package/types/utils/isTypedNode.d.ts +5 -0
  458. package/types/utils/isTypedNode.js +9 -0
  459. package/types/utils/isUnnecessaryReactCall.d.ts +3 -0
  460. package/types/utils/isUnnecessaryReactCall.js +76 -0
  461. package/types/utils/peek.d.ts +1 -0
  462. package/types/utils/peek.js +5 -0
  463. package/types/utils/processTemplateExpression.d.ts +5 -0
  464. package/types/utils/processTemplateExpression.js +17 -0
  465. package/types/utils/removeDangerousCode.d.ts +3 -0
  466. package/types/utils/removeDangerousCode.js +144 -0
  467. package/types/utils/scopeHelpers.d.ts +12 -0
  468. package/types/utils/scopeHelpers.js +568 -0
  469. package/types/utils/traversalCache.d.ts +5 -0
  470. package/types/utils/traversalCache.js +36 -0
  471. package/types/utils/unwrapSequence.d.ts +8 -0
  472. package/types/utils/unwrapSequence.js +17 -0
  473. package/types/utils/valueToLiteral.d.ts +3 -0
  474. package/types/utils/valueToLiteral.js +64 -0
  475. package/types/utils/visitors/JSXElementsRemover.d.ts +3 -0
  476. package/types/utils/visitors/JSXElementsRemover.js +52 -0
  477. package/types/vm/createVmContext.d.ts +7 -0
  478. package/types/vm/createVmContext.js +92 -0
  479. package/types/vm/process.d.ts +25 -0
  480. package/types/vm/process.js +32 -0
package/lib/index.js ADDED
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ slugify: true,
8
+ createFileReporter: true,
9
+ preeval: true,
10
+ getTransformMetadata: true,
11
+ withTransformMetadata: true,
12
+ Module: true,
13
+ DefaultModuleImplementation: true,
14
+ transform: true,
15
+ isUnprocessedEntrypointError: true,
16
+ UnprocessedEntrypointError: true,
17
+ EvaluatedEntrypoint: true,
18
+ parseFile: true,
19
+ baseHandlers: true,
20
+ prepareCode: true,
21
+ Entrypoint: true,
22
+ transformUrl: true,
23
+ asyncResolveImports: true,
24
+ syncResolveImports: true,
25
+ loadLinariaOptions: true,
26
+ withDefaultServices: true,
27
+ isNode: true,
28
+ getTagProcessor: true,
29
+ getVisitorKeys: true,
30
+ peek: true,
31
+ processTemplateExpression: true,
32
+ TransformCacheCollection: true
33
+ };
34
+ Object.defineProperty(exports, "DefaultModuleImplementation", {
35
+ enumerable: true,
36
+ get: function () {
37
+ return _module.DefaultModuleImplementation;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, "Entrypoint", {
41
+ enumerable: true,
42
+ get: function () {
43
+ return _Entrypoint2.Entrypoint;
44
+ }
45
+ });
46
+ Object.defineProperty(exports, "EvaluatedEntrypoint", {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _EvaluatedEntrypoint.EvaluatedEntrypoint;
50
+ }
51
+ });
52
+ Object.defineProperty(exports, "Module", {
53
+ enumerable: true,
54
+ get: function () {
55
+ return _module.Module;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, "TransformCacheCollection", {
59
+ enumerable: true,
60
+ get: function () {
61
+ return _cache.TransformCacheCollection;
62
+ }
63
+ });
64
+ Object.defineProperty(exports, "UnprocessedEntrypointError", {
65
+ enumerable: true,
66
+ get: function () {
67
+ return _UnprocessedEntrypointError.UnprocessedEntrypointError;
68
+ }
69
+ });
70
+ Object.defineProperty(exports, "asyncResolveImports", {
71
+ enumerable: true,
72
+ get: function () {
73
+ return _resolveImports.asyncResolveImports;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "baseHandlers", {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _generators.baseHandlers;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "createFileReporter", {
83
+ enumerable: true,
84
+ get: function () {
85
+ return _fileReporter.createFileReporter;
86
+ }
87
+ });
88
+ Object.defineProperty(exports, "getTagProcessor", {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _getTagProcessor.getTagProcessor;
92
+ }
93
+ });
94
+ Object.defineProperty(exports, "getTransformMetadata", {
95
+ enumerable: true,
96
+ get: function () {
97
+ return _TransformMetadata.getTransformMetadata;
98
+ }
99
+ });
100
+ Object.defineProperty(exports, "getVisitorKeys", {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _getVisitorKeys.getVisitorKeys;
104
+ }
105
+ });
106
+ Object.defineProperty(exports, "isNode", {
107
+ enumerable: true,
108
+ get: function () {
109
+ return _isNode.isNode;
110
+ }
111
+ });
112
+ Object.defineProperty(exports, "isUnprocessedEntrypointError", {
113
+ enumerable: true,
114
+ get: function () {
115
+ return _UnprocessedEntrypointError.isUnprocessedEntrypointError;
116
+ }
117
+ });
118
+ Object.defineProperty(exports, "loadLinariaOptions", {
119
+ enumerable: true,
120
+ get: function () {
121
+ return _loadLinariaOptions.loadLinariaOptions;
122
+ }
123
+ });
124
+ Object.defineProperty(exports, "parseFile", {
125
+ enumerable: true,
126
+ get: function () {
127
+ return _Entrypoint.parseFile;
128
+ }
129
+ });
130
+ Object.defineProperty(exports, "peek", {
131
+ enumerable: true,
132
+ get: function () {
133
+ return _peek.peek;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, "preeval", {
137
+ enumerable: true,
138
+ get: function () {
139
+ return _preeval.default;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, "prepareCode", {
143
+ enumerable: true,
144
+ get: function () {
145
+ return _transform2.prepareCode;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, "processTemplateExpression", {
149
+ enumerable: true,
150
+ get: function () {
151
+ return _processTemplateExpression.processTemplateExpression;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, "slugify", {
155
+ enumerable: true,
156
+ get: function () {
157
+ return _shared.slugify;
158
+ }
159
+ });
160
+ Object.defineProperty(exports, "syncResolveImports", {
161
+ enumerable: true,
162
+ get: function () {
163
+ return _resolveImports.syncResolveImports;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, "transform", {
167
+ enumerable: true,
168
+ get: function () {
169
+ return _transform.transform;
170
+ }
171
+ });
172
+ Object.defineProperty(exports, "transformUrl", {
173
+ enumerable: true,
174
+ get: function () {
175
+ return _extract.transformUrl;
176
+ }
177
+ });
178
+ Object.defineProperty(exports, "withDefaultServices", {
179
+ enumerable: true,
180
+ get: function () {
181
+ return _withDefaultServices.withDefaultServices;
182
+ }
183
+ });
184
+ Object.defineProperty(exports, "withTransformMetadata", {
185
+ enumerable: true,
186
+ get: function () {
187
+ return _TransformMetadata.withTransformMetadata;
188
+ }
189
+ });
190
+ var _shared = require("@wyw-in-js/shared");
191
+ var _fileReporter = require("./debug/fileReporter");
192
+ var _preeval = _interopRequireDefault(require("./plugins/preeval"));
193
+ var _TransformMetadata = require("./utils/TransformMetadata");
194
+ var _module = require("./module");
195
+ var _transform = require("./transform");
196
+ var _UnprocessedEntrypointError = require("./transform/actions/UnprocessedEntrypointError");
197
+ var _types = require("./types");
198
+ Object.keys(_types).forEach(function (key) {
199
+ if (key === "default" || key === "__esModule") return;
200
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
201
+ if (key in exports && exports[key] === _types[key]) return;
202
+ Object.defineProperty(exports, key, {
203
+ enumerable: true,
204
+ get: function () {
205
+ return _types[key];
206
+ }
207
+ });
208
+ });
209
+ var _EvaluatedEntrypoint = require("./transform/EvaluatedEntrypoint");
210
+ var _Entrypoint = require("./transform/Entrypoint.helpers");
211
+ var _generators = require("./transform/generators");
212
+ var _transform2 = require("./transform/generators/transform");
213
+ var _Entrypoint2 = require("./transform/Entrypoint");
214
+ var _extract = require("./transform/generators/extract");
215
+ var _resolveImports = require("./transform/generators/resolveImports");
216
+ var _loadLinariaOptions = require("./transform/helpers/loadLinariaOptions");
217
+ var _withDefaultServices = require("./transform/helpers/withDefaultServices");
218
+ var _isNode = require("./utils/isNode");
219
+ var _getTagProcessor = require("./utils/getTagProcessor");
220
+ var _getVisitorKeys = require("./utils/getVisitorKeys");
221
+ var _peek = require("./utils/peek");
222
+ var _processTemplateExpression = require("./utils/processTemplateExpression");
223
+ var _cache = require("./cache");
224
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
225
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_shared","require","_fileReporter","_preeval","_interopRequireDefault","_TransformMetadata","_module","_transform","_UnprocessedEntrypointError","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_EvaluatedEntrypoint","_Entrypoint","_generators","_transform2","_Entrypoint2","_extract","_resolveImports","_loadLinariaOptions","_withDefaultServices","_isNode","_getTagProcessor","_getVisitorKeys","_peek","_processTemplateExpression","_cache","obj","__esModule","default"],"sources":["../src/index.ts"],"sourcesContent":["export { slugify } from '@wyw-in-js/shared';\n\nexport { createFileReporter } from './debug/fileReporter';\nexport type { IFileReporterOptions } from './debug/fileReporter';\nexport { default as preeval } from './plugins/preeval';\nexport {\n getTransformMetadata,\n withTransformMetadata,\n} from './utils/TransformMetadata';\nexport type { WYWTransformMetadata } from './utils/TransformMetadata';\nexport { Module, DefaultModuleImplementation } from './module';\nexport { transform } from './transform';\nexport {\n isUnprocessedEntrypointError,\n UnprocessedEntrypointError,\n} from './transform/actions/UnprocessedEntrypointError';\nexport * from './types';\nexport { EvaluatedEntrypoint } from './transform/EvaluatedEntrypoint';\nexport type { IEvaluatedEntrypoint } from './transform/EvaluatedEntrypoint';\nexport { parseFile } from './transform/Entrypoint.helpers';\nexport type { LoadAndParseFn } from './transform/Entrypoint.types';\nexport { baseHandlers } from './transform/generators';\nexport { prepareCode } from './transform/generators/transform';\nexport { Entrypoint } from './transform/Entrypoint';\nexport { transformUrl } from './transform/generators/extract';\nexport {\n asyncResolveImports,\n syncResolveImports,\n} from './transform/generators/resolveImports';\nexport { loadLinariaOptions } from './transform/helpers/loadLinariaOptions';\nexport { withDefaultServices } from './transform/helpers/withDefaultServices';\nexport type { Services } from './transform/types';\nexport type { EventEmitter } from './utils/EventEmitter';\nexport { isNode } from './utils/isNode';\nexport { getTagProcessor } from './utils/getTagProcessor';\nexport { getVisitorKeys } from './utils/getVisitorKeys';\nexport type { VisitorKeys } from './utils/getVisitorKeys';\nexport { peek } from './utils/peek';\nexport { processTemplateExpression } from './utils/processTemplateExpression';\nexport { TransformCacheCollection } from './cache';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,2BAAA,GAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAR,OAAA;AAAAS,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,oBAAA,GAAArB,OAAA;AAEA,IAAAsB,WAAA,GAAAtB,OAAA;AAEA,IAAAuB,WAAA,GAAAvB,OAAA;AACA,IAAAwB,WAAA,GAAAxB,OAAA;AACA,IAAAyB,YAAA,GAAAzB,OAAA;AACA,IAAA0B,QAAA,GAAA1B,OAAA;AACA,IAAA2B,eAAA,GAAA3B,OAAA;AAIA,IAAA4B,mBAAA,GAAA5B,OAAA;AACA,IAAA6B,oBAAA,GAAA7B,OAAA;AAGA,IAAA8B,OAAA,GAAA9B,OAAA;AACA,IAAA+B,gBAAA,GAAA/B,OAAA;AACA,IAAAgC,eAAA,GAAAhC,OAAA;AAEA,IAAAiC,KAAA,GAAAjC,OAAA;AACA,IAAAkC,0BAAA,GAAAlC,OAAA;AACA,IAAAmC,MAAA,GAAAnC,OAAA;AAAmD,SAAAG,uBAAAiC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
package/lib/module.js ADDED
@@ -0,0 +1,327 @@
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
+ require("./utils/dispose-polyfill");
13
+ var _Entrypoint = require("./transform/Entrypoint");
14
+ var _Entrypoint2 = require("./transform/Entrypoint.helpers");
15
+ var _UnprocessedEntrypointError = require("./transform/actions/UnprocessedEntrypointError");
16
+ var _createVmContext = require("./vm/createVmContext");
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ /**
19
+ * This is a custom implementation for the module system for evaluating code,
20
+ * used for resolving values for dependencies interpolated in `css` or `styled`.
21
+ *
22
+ * This serves 2 purposes:
23
+ * - Avoid leakage from evaluated code to module cache in current context, e.g. `babel-register`
24
+ * - Allow us to invalidate the module cache without affecting other stuff, necessary for rebuilds
25
+ *
26
+ * We also use it to transpile the code with Babel by default.
27
+ * We also store source maps for it to provide correct error stacktraces.
28
+ *
29
+ */
30
+
31
+ const DefaultModuleImplementation = exports.DefaultModuleImplementation = _module.default;
32
+
33
+ // Supported node builtins based on the modules polyfilled by webpack
34
+ // `true` means module is polyfilled, `false` means module is empty
35
+ const builtins = {
36
+ assert: true,
37
+ buffer: true,
38
+ child_process: false,
39
+ cluster: false,
40
+ console: true,
41
+ constants: true,
42
+ crypto: true,
43
+ dgram: false,
44
+ dns: false,
45
+ domain: true,
46
+ events: true,
47
+ fs: false,
48
+ http: true,
49
+ https: true,
50
+ module: false,
51
+ net: false,
52
+ os: true,
53
+ path: true,
54
+ punycode: true,
55
+ process: true,
56
+ querystring: true,
57
+ readline: false,
58
+ repl: false,
59
+ stream: true,
60
+ string_decoder: true,
61
+ sys: true,
62
+ timers: true,
63
+ tls: false,
64
+ tty: true,
65
+ url: true,
66
+ util: true,
67
+ vm: true,
68
+ zlib: true
69
+ };
70
+ const NOOP = () => {};
71
+ function getUncached(cached, test) {
72
+ const cachedSet = new Set(typeof cached === 'string' ? cached.split(',') : cached);
73
+ if (cachedSet.has('*')) {
74
+ return [];
75
+ }
76
+ return test.filter(t => !cachedSet.has(t));
77
+ }
78
+ function resolve(id) {
79
+ const {
80
+ resolved
81
+ } = this.resolveDependency(id);
82
+ (0, _tsInvariant.invariant)(resolved, `Unable to resolve "${id}"`);
83
+ return resolved;
84
+ }
85
+ class Module {
86
+ callstack = [];
87
+ isEvaluated = false;
88
+ require = Object.assign(id => {
89
+ if (id in builtins) {
90
+ // The module is in the allowed list of builtin node modules
91
+ // Ideally we should prevent importing them, but webpack polyfills some
92
+ // So we check for the list of polyfills to determine which ones to support
93
+ if (builtins[id]) {
94
+ this.debug('require', `builtin '${id}'`);
95
+ return require(id);
96
+ }
97
+ return null;
98
+ }
99
+
100
+ // Resolve module id (and filename) relatively to parent module
101
+ const dependency = this.resolveDependency(id);
102
+ if (dependency.resolved === id && !_path.default.isAbsolute(id)) {
103
+ // The module is a builtin node modules, but not in the allowed list
104
+ throw new Error(`Unable to import "${id}". Importing Node builtins is not supported in the sandbox.`);
105
+ }
106
+ (0, _tsInvariant.invariant)(dependency.resolved, `Dependency ${dependency.source} cannot be resolved`);
107
+ this.dependencies.push(id);
108
+ this.debug('require', `${id} -> ${dependency.resolved}`);
109
+ const entrypoint = this.getEntrypoint(dependency.resolved, dependency.only, this.debug);
110
+ if (entrypoint === null) {
111
+ return dependency.resolved;
112
+ }
113
+ if (entrypoint.evaluated || (0, _Entrypoint2.isSuperSet)(entrypoint.evaluatedOnly, dependency.only)) {
114
+ return entrypoint.exports;
115
+ }
116
+ const m = this.createChild(entrypoint);
117
+ m.evaluate();
118
+ return entrypoint.exports;
119
+ }, {
120
+ ensure: NOOP,
121
+ resolve: resolve.bind(this)
122
+ });
123
+ resolve = resolve.bind(this);
124
+ #entrypointRef;
125
+ constructor(services, entrypoint, parentModule, moduleImpl = DefaultModuleImplementation) {
126
+ var _parentModule$ignored, _entrypoint$ignored;
127
+ this.services = services;
128
+ this.moduleImpl = moduleImpl;
129
+ this.cache = services.cache;
130
+ this.#entrypointRef = new WeakRef(entrypoint);
131
+ this.idx = entrypoint.idx;
132
+ this.id = entrypoint.name;
133
+ this.filename = entrypoint.name;
134
+ this.dependencies = [];
135
+ this.debug = entrypoint.log.extend('module');
136
+ this.parentIsIgnored = (_parentModule$ignored = parentModule === null || parentModule === void 0 ? void 0 : parentModule.ignored) !== null && _parentModule$ignored !== void 0 ? _parentModule$ignored : false;
137
+ this.ignored = (_entrypoint$ignored = entrypoint.ignored) !== null && _entrypoint$ignored !== void 0 ? _entrypoint$ignored : this.parentIsIgnored;
138
+ if (parentModule) {
139
+ this.callstack = [entrypoint.name, ...parentModule.callstack];
140
+ } else {
141
+ this.callstack = [entrypoint.name];
142
+ }
143
+ this.extensions = services.options.pluginOptions.extensions;
144
+ this.debug('init', entrypoint.name);
145
+ }
146
+ get exports() {
147
+ return this.entrypoint.exports;
148
+ }
149
+ set exports(value) {
150
+ this.entrypoint.exports = value;
151
+ this.debug('the whole exports was overridden with %O', value);
152
+ }
153
+ get entrypoint() {
154
+ const entrypoint = this.#entrypointRef.deref();
155
+ (0, _tsInvariant.invariant)(entrypoint, `Module ${this.idx} is disposed`);
156
+ return entrypoint;
157
+ }
158
+ evaluate() {
159
+ const {
160
+ entrypoint
161
+ } = this;
162
+ entrypoint.assertTransformed();
163
+ const cached = this.cache.get('entrypoints', entrypoint.name);
164
+ let evaluatedCreated = false;
165
+ if (!entrypoint.supersededWith) {
166
+ this.cache.add('entrypoints', entrypoint.name, entrypoint.createEvaluated());
167
+ evaluatedCreated = true;
168
+ }
169
+ const {
170
+ transformedCode: source
171
+ } = entrypoint;
172
+ const {
173
+ pluginOptions
174
+ } = this.services.options;
175
+ if (!source) {
176
+ this.debug(`evaluate`, 'there is nothing to evaluate');
177
+ return;
178
+ }
179
+ if (this.isEvaluated) {
180
+ this.debug('evaluate', `is already evaluated`);
181
+ return;
182
+ }
183
+ this.debug('evaluate');
184
+ this.debug.extend('source')('%s', source);
185
+ this.isEvaluated = true;
186
+ const {
187
+ filename
188
+ } = this;
189
+ if (/\.json$/.test(filename)) {
190
+ // For JSON files, parse it to a JS object similar to Node
191
+ this.exports = JSON.parse(source);
192
+ return;
193
+ }
194
+ const {
195
+ context,
196
+ teardown
197
+ } = (0, _createVmContext.createVmContext)(filename, pluginOptions.features, {
198
+ module: this,
199
+ exports: entrypoint.exports,
200
+ require: this.require,
201
+ __wyw_dynamic_import: async id => this.require(id),
202
+ __dirname: _path.default.dirname(filename)
203
+ }, pluginOptions.overrideContext);
204
+ try {
205
+ const script = new _vm.default.Script(`(function (exports) { ${source}\n})(exports);`, {
206
+ filename
207
+ });
208
+ script.runInContext(context);
209
+ } catch (e) {
210
+ this.isEvaluated = false;
211
+ if (evaluatedCreated) {
212
+ this.cache.add('entrypoints', entrypoint.name, cached);
213
+ }
214
+ if ((0, _UnprocessedEntrypointError.isUnprocessedEntrypointError)(e)) {
215
+ // It will be handled by evalFile scenario
216
+ throw e;
217
+ }
218
+ if (e instanceof EvalError) {
219
+ this.debug('%O', e);
220
+ throw e;
221
+ }
222
+ this.debug('%O\n%O', e, this.callstack);
223
+ throw new EvalError(`${e.message} in${this.callstack.join('\n| ')}\n`);
224
+ } finally {
225
+ teardown();
226
+ }
227
+ }
228
+ getEntrypoint(filename, only, log) {
229
+ var _entrypoint$evaluated;
230
+ const extension = _path.default.extname(filename);
231
+ if (extension !== '.json' && !this.extensions.includes(extension)) {
232
+ return null;
233
+ }
234
+ const entrypoint = this.cache.get('entrypoints', filename);
235
+ if (entrypoint && (0, _Entrypoint2.isSuperSet)((_entrypoint$evaluated = entrypoint.evaluatedOnly) !== null && _entrypoint$evaluated !== void 0 ? _entrypoint$evaluated : [], only)) {
236
+ log('✅ file has been already evaluated');
237
+ return entrypoint;
238
+ }
239
+ if (entrypoint !== null && entrypoint !== void 0 && entrypoint.ignored) {
240
+ log('✅ file has been ignored during prepare stage. Original code will be used');
241
+ return entrypoint;
242
+ }
243
+ if (this.ignored) {
244
+ log('✅ one of the parent files has been ignored during prepare stage. Original code will be used');
245
+ const newEntrypoint = this.entrypoint.createChild(filename, ['*'], _fs.default.readFileSync(filename, 'utf-8'));
246
+ if (newEntrypoint === 'loop') {
247
+ const stack = (0, _Entrypoint2.getStack)(this.entrypoint);
248
+ throw new Error(`Circular dependency detected: ${stack.join(' -> ')} -> ${filename}`);
249
+ }
250
+ return newEntrypoint;
251
+ }
252
+
253
+ // Requested file can be already prepared for evaluation on the stage 1
254
+ if (only && entrypoint) {
255
+ var _entrypoint$only;
256
+ const uncachedExports = getUncached((_entrypoint$only = entrypoint.only) !== null && _entrypoint$only !== void 0 ? _entrypoint$only : [], only);
257
+ if (uncachedExports.length === 0) {
258
+ log('✅ ready for evaluation');
259
+ return entrypoint;
260
+ }
261
+ log('❌ file has been processed during prepare stage but %o is not evaluated yet (evaluated: %o)', uncachedExports, entrypoint.only);
262
+ } else {
263
+ log('❌ file has not been processed during prepare stage');
264
+ }
265
+
266
+ // If code wasn't extracted from cache, it indicates that we were unable
267
+ // to process some of the imports on stage1. Let's try to reprocess.
268
+ const code = _fs.default.readFileSync(filename, 'utf-8');
269
+ const newEntrypoint = _Entrypoint.Entrypoint.createRoot(this.services, filename, only, code);
270
+ if (newEntrypoint.evaluated) {
271
+ log('✅ file has been already evaluated');
272
+ return newEntrypoint;
273
+ }
274
+ if (newEntrypoint.ignored) {
275
+ log('✅ file has been ignored during prepare stage. Original code will be used');
276
+ return newEntrypoint;
277
+ }
278
+ return newEntrypoint;
279
+ }
280
+ resolveDependency = id => {
281
+ const cached = this.entrypoint.getDependency(id);
282
+ (0, _tsInvariant.invariant)(!(cached instanceof Promise), 'Dependency is not resolved yet');
283
+ if (cached) {
284
+ return cached;
285
+ }
286
+ if (!this.ignored) {
287
+ this.debug('❌ import has not been resolved during prepare stage. Fallback to Node.js resolver');
288
+ }
289
+ const extensions = this.moduleImpl._extensions;
290
+ const added = [];
291
+ try {
292
+ // Check for supported extensions
293
+ this.extensions.forEach(ext => {
294
+ if (ext in extensions) {
295
+ return;
296
+ }
297
+
298
+ // When an extension is not supported, add it
299
+ // And keep track of it to clean it up after resolving
300
+ // Use noop for the transform function since we handle it
301
+ extensions[ext] = NOOP;
302
+ added.push(ext);
303
+ });
304
+ const {
305
+ filename
306
+ } = this;
307
+ const resolved = this.moduleImpl._resolveFilename(id, {
308
+ id: filename,
309
+ filename,
310
+ paths: this.moduleImpl._nodeModulePaths(_path.default.dirname(filename))
311
+ });
312
+ return {
313
+ source: id,
314
+ only: ['*'],
315
+ resolved
316
+ };
317
+ } finally {
318
+ // Cleanup the extensions we added to restore previous behaviour
319
+ added.forEach(ext => delete extensions[ext]);
320
+ }
321
+ };
322
+ createChild(entrypoint) {
323
+ return new Module(this.services, entrypoint, this, this.moduleImpl);
324
+ }
325
+ }
326
+ exports.Module = Module;
327
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","names":["_fs","_interopRequireDefault","require","_module","_path","_vm","_tsInvariant","_Entrypoint","_Entrypoint2","_UnprocessedEntrypointError","_createVmContext","obj","__esModule","default","DefaultModuleImplementation","exports","NativeModule","builtins","assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","punycode","process","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","vm","zlib","NOOP","getUncached","cached","test","cachedSet","Set","split","has","filter","t","resolve","id","resolved","resolveDependency","invariant","Module","callstack","isEvaluated","Object","assign","debug","dependency","isAbsolute","Error","source","dependencies","push","entrypoint","getEntrypoint","only","evaluated","isSuperSet","evaluatedOnly","m","createChild","evaluate","ensure","bind","entrypointRef","constructor","services","parentModule","moduleImpl","_parentModule$ignored","_entrypoint$ignored","cache","WeakRef","idx","name","filename","log","extend","parentIsIgnored","ignored","extensions","options","pluginOptions","value","deref","assertTransformed","get","evaluatedCreated","supersededWith","add","createEvaluated","transformedCode","JSON","parse","context","teardown","createVmContext","features","__wyw_dynamic_import","__dirname","dirname","overrideContext","script","Script","runInContext","e","isUnprocessedEntrypointError","EvalError","message","join","_entrypoint$evaluated","extension","extname","includes","newEntrypoint","readFileSync","stack","getStack","_entrypoint$only","uncachedExports","length","code","Entrypoint","createRoot","getDependency","Promise","_extensions","added","forEach","ext","_resolveFilename","paths","_nodeModulePaths"],"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 type { Debugger } from '@wyw-in-js/shared';\n\nimport './utils/dispose-polyfill';\nimport type { TransformCacheCollection } from './cache';\nimport { Entrypoint } from './transform/Entrypoint';\nimport { getStack, isSuperSet } 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 { 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 ) => string;\n _nodeModulePaths(filename: string): string[];\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 NOOP = () => {};\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\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 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 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>;\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 = new WeakRef(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 = this.#entrypointRef.deref();\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 } = this;\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: string) => this.require(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 throw new EvalError(\n `${(e as Error).message} in${this.callstack.join('\\n| ')}\\n`\n );\n } finally {\n teardown();\n }\n }\n\n getEntrypoint(\n filename: string,\n only: string[],\n log: Debugger\n ): Entrypoint | IEvaluatedEntrypoint | null {\n const extension = path.extname(filename);\n if (extension !== '.json' && !this.extensions.includes(extension)) {\n return null;\n }\n\n const entrypoint = this.cache.get('entrypoints', filename);\n if (entrypoint && isSuperSet(entrypoint.evaluatedOnly ?? [], only)) {\n log('✅ file has been already evaluated');\n return entrypoint;\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(filename, '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 // Requested file can be already prepared for evaluation on the stage 1\n if (only && entrypoint) {\n const uncachedExports = getUncached(entrypoint.only ?? [], only);\n if (uncachedExports.length === 0) {\n log('✅ ready for evaluation');\n return entrypoint;\n }\n\n log(\n '❌ file has been processed during prepare stage but %o is not evaluated yet (evaluated: %o)',\n uncachedExports,\n entrypoint.only\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(filename, 'utf-8');\n const newEntrypoint = Entrypoint.createRoot(\n this.services,\n filename,\n only,\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 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\n const resolved = this.moduleImpl._resolveFilename(id, {\n id: filename,\n filename,\n paths: this.moduleImpl._nodeModulePaths(path.dirname(filename)),\n });\n\n return {\n source: id,\n only: ['*'],\n resolved,\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 {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,MAAM,CAAC,IAAI,CAACyB,QAAQ,EAAEb,UAAU,EAAE,IAAI,EAAE,IAAI,CAACe,UAAU,CAAC;EACrE;AACF;AAAC9E,OAAA,CAAAmD,MAAA,GAAAA,MAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=babel-merge.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel-merge.d.js","names":[],"sources":["../../src/options/babel-merge.d.ts"],"sourcesContent":["declare module 'babel-merge' {\n import type { TransformOptions } from '@babel/core';\n\n interface Options {\n clone?: boolean;\n customMerge?: (\n key: string,\n options?: Options\n ) => ((x: unknown, y: unknown) => unknown) | undefined;\n arrayMerge?(\n target: unknown[],\n source: unknown[],\n options?: Options\n ): unknown[];\n isMergeableObject?(value: object): boolean;\n }\n\n interface BabelMerge {\n (\n source?: TransformOptions,\n overrides?: TransformOptions,\n deepmergeOpts?: Options\n ): TransformOptions;\n all(\n values: (TransformOptions | undefined)[],\n deepmergeOpts?: Options\n ): TransformOptions;\n }\n\n const babelMerge: BabelMerge;\n\n export = babelMerge;\n}\n"],"mappings":""}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.buildOptions = buildOptions;
7
+ var _babelMerge = _interopRequireDefault(require("babel-merge"));
8
+ var _isNotNull = require("../utils/isNotNull");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
11
+ /// <reference path="./babel-merge.d.ts" />
12
+
13
+ const cache = new WeakMap();
14
+ const merge = (a, b) => {
15
+ if (!cache.has(a)) {
16
+ cache.set(a, new WeakMap());
17
+ }
18
+ const cacheForA = cache.get(a);
19
+ if (cacheForA.has(b)) {
20
+ return cacheForA.get(b);
21
+ }
22
+ const result = (0, _babelMerge.default)(a, b);
23
+ cacheForA.set(b, result);
24
+ return result;
25
+ };
26
+
27
+ /**
28
+ * Merges babel configs together. If a pair of configs were merged before,
29
+ * it will return the cached result.
30
+ */
31
+ function buildOptions(...configs) {
32
+ // Merge all configs together
33
+ return configs.map(i => i !== null && i !== void 0 ? i : null).filter(_isNotNull.isNotNull).reduce(merge);
34
+ }
35
+ //# sourceMappingURL=buildOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildOptions.js","names":["_babelMerge","_interopRequireDefault","require","_isNotNull","obj","__esModule","default","cache","WeakMap","merge","a","b","has","set","cacheForA","get","result","babelMerge","buildOptions","configs","map","i","filter","isNotNull","reduce"],"sources":["../../src/options/buildOptions.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"./babel-merge.d.ts\" />\n\nimport type { TransformOptions } from '@babel/core';\nimport babelMerge from 'babel-merge';\n\nimport { isNotNull } from '../utils/isNotNull';\n\nconst cache = new WeakMap<\n TransformOptions,\n WeakMap<TransformOptions, TransformOptions>\n>();\n\nconst merge = (a: TransformOptions, b: TransformOptions) => {\n if (!cache.has(a)) {\n cache.set(a, new WeakMap());\n }\n\n const cacheForA = cache.get(a)!;\n if (cacheForA.has(b)) {\n return cacheForA.get(b)!;\n }\n\n const result = babelMerge(a, b);\n cacheForA.set(b, result);\n return result;\n};\n\n/**\n * Merges babel configs together. If a pair of configs were merged before,\n * it will return the cached result.\n */\nexport function buildOptions(\n ...configs: (TransformOptions | null | undefined)[]\n): TransformOptions {\n // Merge all configs together\n return configs\n .map((i) => i ?? null)\n .filter(isNotNull)\n .reduce(merge);\n}\n"],"mappings":";;;;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAA+C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAN/C;AACA;;AAOA,MAAMG,KAAK,GAAG,IAAIC,OAAO,CAGvB,CAAC;AAEH,MAAMC,KAAK,GAAGA,CAACC,CAAmB,EAAEC,CAAmB,KAAK;EAC1D,IAAI,CAACJ,KAAK,CAACK,GAAG,CAACF,CAAC,CAAC,EAAE;IACjBH,KAAK,CAACM,GAAG,CAACH,CAAC,EAAE,IAAIF,OAAO,CAAC,CAAC,CAAC;EAC7B;EAEA,MAAMM,SAAS,GAAGP,KAAK,CAACQ,GAAG,CAACL,CAAC,CAAE;EAC/B,IAAII,SAAS,CAACF,GAAG,CAACD,CAAC,CAAC,EAAE;IACpB,OAAOG,SAAS,CAACC,GAAG,CAACJ,CAAC,CAAC;EACzB;EAEA,MAAMK,MAAM,GAAG,IAAAC,mBAAU,EAACP,CAAC,EAAEC,CAAC,CAAC;EAC/BG,SAAS,CAACD,GAAG,CAACF,CAAC,EAAEK,MAAM,CAAC;EACxB,OAAOA,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAC1B,GAAGC,OAAgD,EACjC;EAClB;EACA,OAAOA,OAAO,CACXC,GAAG,CAAEC,CAAC,IAAKA,CAAC,aAADA,CAAC,cAADA,CAAC,GAAI,IAAI,CAAC,CACrBC,MAAM,CAACC,oBAAS,CAAC,CACjBC,MAAM,CAACf,KAAK,CAAC;AAClB"}