adnbn 0.9.0 → 0.11.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 (608) hide show
  1. package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
  2. package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
  3. package/dist/cli/builders/locale/index.js +1 -1
  4. package/dist/cli/builders/locale/index.js.map +1 -1
  5. package/dist/cli/builders/manifest/ManifestBase.d.ts +4 -1
  6. package/dist/cli/builders/manifest/ManifestBase.js +35 -6
  7. package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
  8. package/dist/cli/builders/manifest/ManifestV2.js +1 -1
  9. package/dist/cli/builders/manifest/ManifestV3.js +12 -5
  10. package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
  11. package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
  12. package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
  13. package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
  14. package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
  15. package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
  16. package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
  17. package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
  18. package/dist/cli/builders/manifest/utils/index.js +19 -0
  19. package/dist/cli/builders/manifest/utils/index.js.map +1 -0
  20. package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
  21. package/dist/cli/builders/manifest/utils/permissions.js +34 -0
  22. package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
  23. package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
  24. package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
  25. package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
  26. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
  27. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +523 -0
  28. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
  29. package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.d.ts +13 -0
  30. package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js +16 -0
  31. package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js.map +1 -0
  32. package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +3 -0
  33. package/dist/cli/bundler/plugins/build-assets-map/index.js +8 -0
  34. package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
  35. package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +12 -0
  36. package/dist/cli/bundler/plugins/build-assets-map/usage.js +28 -0
  37. package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
  38. package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
  39. package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
  40. package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
  41. package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
  42. package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
  43. package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
  44. package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
  45. package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
  46. package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
  47. package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
  48. package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
  49. package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
  50. package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
  51. package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
  52. package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
  53. package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
  54. package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
  55. package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
  56. package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
  57. package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
  58. package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
  59. package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
  60. package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
  61. package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
  62. package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
  63. package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
  64. package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
  65. package/dist/cli/bundler/plugins/index.d.ts +11 -5
  66. package/dist/cli/bundler/plugins/index.js +32 -10
  67. package/dist/cli/bundler/plugins/index.js.map +1 -1
  68. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
  69. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
  70. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
  71. package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
  72. package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
  73. package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
  74. package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
  75. package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
  76. package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
  77. package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
  78. package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
  79. package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +55 -0
  80. package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
  81. package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
  82. package/dist/cli/bundler/plugins/manifest/index.js +6 -0
  83. package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
  84. package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
  85. package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
  86. package/dist/cli/bundler/plugins/replace/index.js +5 -0
  87. package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
  88. package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
  89. package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
  90. package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
  91. package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
  92. package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
  93. package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
  94. package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
  95. package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
  96. package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
  97. package/dist/cli/bundler/plugins/types.d.ts +4 -0
  98. package/dist/cli/bundler/plugins/types.js +1 -0
  99. package/dist/cli/bundler/plugins/types.js.map +1 -0
  100. package/dist/cli/bundler/plugins/utils/index.d.ts +3 -0
  101. package/dist/cli/bundler/plugins/utils/index.js +9 -0
  102. package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
  103. package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
  104. package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
  105. package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
  106. package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
  107. package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
  108. package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
  109. package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
  110. package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
  111. package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
  112. package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
  113. package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
  114. package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
  115. package/dist/cli/bundler/plugins/watch/index.js +5 -0
  116. package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
  117. package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
  118. package/dist/cli/bundler/utils/chunk-filename.js +93 -0
  119. package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
  120. package/dist/cli/bundler/utils/index.d.ts +2 -0
  121. package/dist/cli/bundler/utils/index.js +2 -0
  122. package/dist/cli/bundler/utils/index.js.map +1 -1
  123. package/dist/cli/bundler/utils/layers.d.ts +4 -0
  124. package/dist/cli/bundler/utils/layers.js +10 -0
  125. package/dist/cli/bundler/utils/layers.js.map +1 -0
  126. package/dist/cli/bundler/utils/output.d.ts +6 -2
  127. package/dist/cli/bundler/utils/output.js +165 -7
  128. package/dist/cli/bundler/utils/output.js.map +1 -1
  129. package/dist/cli/bundler/utils/styles.d.ts +5 -0
  130. package/dist/cli/bundler/utils/styles.js +30 -0
  131. package/dist/cli/bundler/utils/styles.js.map +1 -0
  132. package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
  133. package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
  134. package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
  135. package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
  136. package/dist/cli/entrypoint/file/OptionFile.js +35 -31
  137. package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
  138. package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
  139. package/dist/cli/entrypoint/file/SourceFile.js +260 -156
  140. package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
  141. package/dist/cli/entrypoint/file/index.d.ts +2 -0
  142. package/dist/cli/entrypoint/file/index.js +2 -0
  143. package/dist/cli/entrypoint/file/index.js.map +1 -1
  144. package/dist/cli/entrypoint/file/injectors/core.js +22 -1
  145. package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
  146. package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
  147. package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
  148. package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
  149. package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
  150. package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
  151. package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
  152. package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
  153. package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
  154. package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
  155. package/dist/cli/entrypoint/file/parsers/index.js +2 -0
  156. package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
  157. package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
  158. package/dist/cli/entrypoint/file/parsers/types.js +13 -0
  159. package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
  160. package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
  161. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
  162. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
  163. package/dist/cli/entrypoint/file/types.d.ts +26 -1
  164. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.d.ts +2 -2
  165. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js +2 -2
  166. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
  167. package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.js → AbstractParsedFinder.js} +3 -3
  168. package/dist/cli/entrypoint/finder/AbstractParsedFinder.js.map +1 -0
  169. package/dist/cli/entrypoint/finder/OptionsFinder.d.ts +13 -0
  170. package/dist/cli/entrypoint/finder/OptionsFinder.js +33 -0
  171. package/dist/cli/entrypoint/finder/OptionsFinder.js.map +1 -0
  172. package/dist/cli/entrypoint/finder/PluginFinder.d.ts +4 -4
  173. package/dist/cli/entrypoint/finder/PluginFinder.js +2 -2
  174. package/dist/cli/entrypoint/finder/PluginFinder.js.map +1 -1
  175. package/dist/cli/entrypoint/finder/index.d.ts +2 -1
  176. package/dist/cli/entrypoint/finder/index.js +20 -18
  177. package/dist/cli/entrypoint/finder/index.js.map +1 -1
  178. package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
  179. package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
  180. package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
  181. package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
  182. package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
  183. package/dist/cli/entrypoint/parser/ContentParser.d.ts +5 -1
  184. package/dist/cli/entrypoint/parser/ContentParser.js +55 -3
  185. package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
  186. package/dist/cli/entrypoint/parser/OptionsParser.d.ts +6 -0
  187. package/dist/cli/entrypoint/parser/OptionsParser.js +16 -0
  188. package/dist/cli/entrypoint/parser/OptionsParser.js.map +1 -0
  189. package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
  190. package/dist/cli/entrypoint/parser/RelayParser.js +4 -0
  191. package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
  192. package/dist/cli/entrypoint/parser/index.d.ts +1 -0
  193. package/dist/cli/entrypoint/parser/index.js +16 -14
  194. package/dist/cli/entrypoint/parser/index.js.map +1 -1
  195. package/dist/cli/plugins/asset.js +9 -4
  196. package/dist/cli/plugins/asset.js.map +1 -1
  197. package/dist/cli/plugins/background/index.js +1 -1
  198. package/dist/cli/plugins/background/index.js.map +1 -1
  199. package/dist/cli/plugins/content/Content.d.ts +1 -1
  200. package/dist/cli/plugins/content/Content.js +3 -2
  201. package/dist/cli/plugins/content/Content.js.map +1 -1
  202. package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
  203. package/dist/cli/plugins/content/ContentManager.js +79 -28
  204. package/dist/cli/plugins/content/ContentManager.js.map +1 -1
  205. package/dist/cli/plugins/content/ContentName.d.ts +1 -1
  206. package/dist/cli/plugins/content/ContentName.js +8 -7
  207. package/dist/cli/plugins/content/ContentName.js.map +1 -1
  208. package/dist/cli/plugins/content/Relay.d.ts +1 -1
  209. package/dist/cli/plugins/content/Relay.js +3 -2
  210. package/dist/cli/plugins/content/Relay.js.map +1 -1
  211. package/dist/cli/plugins/content/bundler.d.ts +7 -0
  212. package/dist/cli/plugins/content/bundler.js +47 -0
  213. package/dist/cli/plugins/content/bundler.js.map +1 -0
  214. package/dist/cli/plugins/content/index.js +121 -62
  215. package/dist/cli/plugins/content/index.js.map +1 -1
  216. package/dist/cli/plugins/content/relay-module.d.ts +3 -0
  217. package/dist/cli/plugins/content/relay-module.js +11 -0
  218. package/dist/cli/plugins/content/relay-module.js.map +1 -0
  219. package/dist/cli/plugins/content/types.d.ts +1 -1
  220. package/dist/cli/plugins/content/utils.d.ts +2 -0
  221. package/dist/cli/plugins/content/utils.js +8 -1
  222. package/dist/cli/plugins/content/utils.js.map +1 -1
  223. package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
  224. package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
  225. package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
  226. package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
  227. package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
  228. package/dist/cli/plugins/icon/icon-module.js +11 -0
  229. package/dist/cli/plugins/icon/icon-module.js.map +1 -0
  230. package/dist/cli/plugins/icon/index.js +5 -3
  231. package/dist/cli/plugins/icon/index.js.map +1 -1
  232. package/dist/cli/plugins/index.d.ts +1 -0
  233. package/dist/cli/plugins/index.js +22 -20
  234. package/dist/cli/plugins/index.js.map +1 -1
  235. package/dist/cli/plugins/locale/Locale.d.ts +9 -2
  236. package/dist/cli/plugins/locale/Locale.js +37 -5
  237. package/dist/cli/plugins/locale/Locale.js.map +1 -1
  238. package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
  239. package/dist/cli/plugins/locale/index.js +57 -22
  240. package/dist/cli/plugins/locale/index.js.map +1 -1
  241. package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
  242. package/dist/cli/plugins/locale/locale-module.js +16 -0
  243. package/dist/cli/plugins/locale/locale-module.js.map +1 -0
  244. package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
  245. package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
  246. package/dist/cli/plugins/offscreen/index.js +5 -4
  247. package/dist/cli/plugins/offscreen/index.js.map +1 -1
  248. package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
  249. package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
  250. package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
  251. package/dist/cli/plugins/options/Options.d.ts +10 -0
  252. package/dist/cli/plugins/options/Options.js +24 -0
  253. package/dist/cli/plugins/options/Options.js.map +1 -0
  254. package/dist/cli/plugins/options/index.d.ts +2 -0
  255. package/dist/cli/plugins/options/index.js +41 -0
  256. package/dist/cli/plugins/options/index.js.map +1 -0
  257. package/dist/cli/plugins/output.js +33 -3
  258. package/dist/cli/plugins/output.js.map +1 -1
  259. package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
  260. package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
  261. package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
  262. package/dist/cli/plugins/page/index.js +14 -10
  263. package/dist/cli/plugins/page/index.js.map +1 -1
  264. package/dist/cli/plugins/page/page-module.d.ts +2 -0
  265. package/dist/cli/plugins/page/page-module.js +11 -0
  266. package/dist/cli/plugins/page/page-module.js.map +1 -0
  267. package/dist/cli/plugins/popup/Popup.d.ts +1 -1
  268. package/dist/cli/plugins/popup/Popup.js +2 -2
  269. package/dist/cli/plugins/popup/Popup.js.map +1 -1
  270. package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
  271. package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
  272. package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
  273. package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
  274. package/dist/cli/plugins/popup/index.js +6 -5
  275. package/dist/cli/plugins/popup/index.js.map +1 -1
  276. package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
  277. package/dist/cli/plugins/popup/popup-module.js +11 -0
  278. package/dist/cli/plugins/popup/popup-module.js.map +1 -0
  279. package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
  280. package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
  281. package/dist/cli/plugins/sandbox/index.js +5 -4
  282. package/dist/cli/plugins/sandbox/index.js.map +1 -1
  283. package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
  284. package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
  285. package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
  286. package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
  287. package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
  288. package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
  289. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
  290. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
  291. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
  292. package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
  293. package/dist/cli/plugins/sidebar/index.js +6 -5
  294. package/dist/cli/plugins/sidebar/index.js.map +1 -1
  295. package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
  296. package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
  297. package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
  298. package/dist/cli/plugins/style/index.d.ts +2 -1
  299. package/dist/cli/plugins/style/index.js +52 -25
  300. package/dist/cli/plugins/style/index.js.map +1 -1
  301. package/dist/cli/plugins/style/types.d.ts +5 -0
  302. package/dist/cli/plugins/style/types.js +1 -0
  303. package/dist/cli/plugins/style/types.js.map +1 -0
  304. package/dist/cli/plugins/view/index.js +1 -1
  305. package/dist/cli/plugins/view/index.js.map +1 -1
  306. package/dist/cli/raw.d.ts +4 -0
  307. package/dist/cli/resolvers/bundler.js +9 -7
  308. package/dist/cli/resolvers/bundler.js.map +1 -1
  309. package/dist/cli/resolvers/config.js +4 -1
  310. package/dist/cli/resolvers/config.js.map +1 -1
  311. package/dist/cli/virtual/index.d.ts +2 -2
  312. package/dist/cli/virtual/index.js +11 -8
  313. package/dist/cli/virtual/virtual.d.ts +8 -10
  314. package/dist/entry/content/adapters/react/Builder.js +1 -1
  315. package/dist/entry/content/adapters/react/Builder.js.map +1 -1
  316. package/dist/entry/content/adapters/react/Node.d.ts +2 -0
  317. package/dist/entry/content/adapters/react/Node.js +10 -2
  318. package/dist/entry/content/adapters/react/Node.js.map +1 -1
  319. package/dist/entry/content/adapters/vanilla/Builder.js +1 -1
  320. package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
  321. package/dist/entry/content/adapters/vanilla/Node.d.ts +2 -1
  322. package/dist/entry/content/adapters/vanilla/Node.js +10 -7
  323. package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
  324. package/dist/entry/content/core/Builder.d.ts +1 -2
  325. package/dist/entry/content/core/Builder.js +9 -5
  326. package/dist/entry/content/core/Builder.js.map +1 -1
  327. package/dist/entry/content/core/MountBuilder.js +14 -6
  328. package/dist/entry/content/core/MountBuilder.js.map +1 -1
  329. package/dist/entry/content/core/{Context.d.ts → context/Context.d.ts} +2 -1
  330. package/dist/entry/content/core/{Context.js → context/Context.js} +7 -0
  331. package/dist/entry/content/core/context/Context.js.map +1 -0
  332. package/dist/entry/content/core/{EventEmitter.d.ts → context/EventEmitter.d.ts} +1 -1
  333. package/dist/entry/content/core/{EventEmitter.js → context/EventEmitter.js} +1 -1
  334. package/dist/entry/content/core/context/EventEmitter.js.map +1 -0
  335. package/dist/entry/content/core/{ManagedContext.d.ts → context/ManagedContext.d.ts} +1 -1
  336. package/dist/entry/content/core/context/ManagedContext.js.map +1 -0
  337. package/dist/entry/content/core/context/index.d.ts +3 -0
  338. package/dist/entry/content/core/context/index.js +9 -0
  339. package/dist/entry/content/core/context/index.js.map +1 -0
  340. package/dist/entry/content/core/{AbstractMarker.d.ts → markers/AbstractMarker.d.ts} +1 -1
  341. package/dist/entry/content/core/{AbstractMarker.js → markers/AbstractMarker.js} +1 -1
  342. package/dist/entry/content/core/markers/AbstractMarker.js.map +1 -0
  343. package/dist/entry/content/core/{AttributeMarker.d.ts → markers/AttributeMarker.d.ts} +1 -1
  344. package/dist/entry/content/core/markers/AttributeMarker.js.map +1 -0
  345. package/dist/entry/content/core/{WeakMarker.d.ts → markers/WeakMarker.d.ts} +1 -1
  346. package/dist/entry/content/core/markers/WeakMarker.js.map +1 -0
  347. package/dist/entry/content/core/markers/index.d.ts +3 -0
  348. package/dist/entry/content/core/markers/index.js +9 -0
  349. package/dist/entry/content/core/markers/index.js.map +1 -0
  350. package/dist/entry/content/core/{EventNode.d.ts → nodes/EventNode.d.ts} +2 -1
  351. package/dist/entry/content/core/{EventNode.js → nodes/EventNode.js} +3 -0
  352. package/dist/entry/content/core/nodes/EventNode.js.map +1 -0
  353. package/dist/entry/content/core/nodes/FrameNode.d.ts +23 -0
  354. package/dist/entry/content/core/nodes/FrameNode.js +125 -0
  355. package/dist/entry/content/core/nodes/FrameNode.js.map +1 -0
  356. package/dist/entry/content/core/{MarkerNode.d.ts → nodes/MarkerNode.d.ts} +2 -1
  357. package/dist/entry/content/core/{MarkerNode.js → nodes/MarkerNode.js} +3 -0
  358. package/dist/entry/content/core/nodes/MarkerNode.js.map +1 -0
  359. package/dist/entry/content/core/{MountNode.d.ts → nodes/MountNode.d.ts} +2 -1
  360. package/dist/entry/content/core/{MountNode.js → nodes/MountNode.js} +3 -0
  361. package/dist/entry/content/core/nodes/MountNode.js.map +1 -0
  362. package/dist/entry/content/core/{Node.d.ts → nodes/Node.d.ts} +2 -1
  363. package/dist/entry/content/core/{Node.js → nodes/Node.js} +3 -0
  364. package/dist/entry/content/core/nodes/Node.js.map +1 -0
  365. package/dist/entry/content/core/nodes/ShadowNode.d.ts +14 -0
  366. package/dist/entry/content/core/nodes/ShadowNode.js +67 -0
  367. package/dist/entry/content/core/nodes/ShadowNode.js.map +1 -0
  368. package/dist/entry/content/core/nodes/index.d.ts +6 -0
  369. package/dist/entry/content/core/nodes/index.js +15 -0
  370. package/dist/entry/content/core/nodes/index.js.map +1 -0
  371. package/dist/entry/content/core/nodes/isolated-styles.d.ts +2 -0
  372. package/dist/entry/content/core/nodes/isolated-styles.js +14 -0
  373. package/dist/entry/content/core/nodes/isolated-styles.js.map +1 -0
  374. package/dist/entry/content/core/resolvers/watch.js +1 -1
  375. package/dist/entry/content/core/resolvers/watch.js.map +1 -1
  376. package/dist/entry/content/frame/Builder.d.ts +7 -0
  377. package/dist/entry/content/frame/Builder.js +14 -0
  378. package/dist/entry/content/frame/Builder.js.map +1 -0
  379. package/dist/entry/content/frame/index.d.ts +4 -0
  380. package/dist/entry/content/frame/index.js +7 -0
  381. package/dist/entry/content/frame/index.js.map +1 -0
  382. package/dist/entry/relay/Builder.js +5 -1
  383. package/dist/entry/relay/Builder.js.map +1 -1
  384. package/dist/entry/relay/index.d.ts +1 -1
  385. package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
  386. package/dist/locale/adapters/react/ReactLocale.js +41 -0
  387. package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
  388. package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
  389. package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
  390. package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
  391. package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
  392. package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
  393. package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
  394. package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
  395. package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
  396. package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
  397. package/dist/locale/adapters/react/index.d.ts +4 -2
  398. package/dist/locale/adapters/react/index.js +6 -4
  399. package/dist/locale/adapters/react/index.js.map +1 -1
  400. package/dist/locale/adapters/react/types.d.ts +22 -0
  401. package/dist/locale/adapters/react/types.js +1 -0
  402. package/dist/locale/adapters/react/types.js.map +1 -0
  403. package/dist/locale/helpers.d.ts +4 -5
  404. package/dist/locale/helpers.js +1 -1
  405. package/dist/locale/helpers.js.map +1 -1
  406. package/dist/locale/index.d.ts +2 -1
  407. package/dist/locale/index.js +1 -0
  408. package/dist/locale/index.js.map +1 -1
  409. package/dist/locale/providers/AbstractLocale.d.ts +4 -4
  410. package/dist/locale/providers/AbstractLocale.js +13 -94
  411. package/dist/locale/providers/AbstractLocale.js.map +1 -1
  412. package/dist/locale/providers/CustomLocale.d.ts +3 -3
  413. package/dist/locale/providers/CustomLocale.js +6 -5
  414. package/dist/locale/providers/CustomLocale.js.map +1 -1
  415. package/dist/locale/providers/DynamicLocale.d.ts +18 -11
  416. package/dist/locale/providers/DynamicLocale.js +60 -47
  417. package/dist/locale/providers/DynamicLocale.js.map +1 -1
  418. package/dist/locale/providers/NativeLocale.d.ts +4 -7
  419. package/dist/locale/providers/NativeLocale.js +5 -14
  420. package/dist/locale/providers/NativeLocale.js.map +1 -1
  421. package/dist/locale/providers/ObservableLocale.d.ts +35 -0
  422. package/dist/locale/providers/ObservableLocale.js +179 -0
  423. package/dist/locale/providers/ObservableLocale.js.map +1 -0
  424. package/dist/locale/providers/index.d.ts +2 -1
  425. package/dist/locale/providers/index.js +3 -1
  426. package/dist/locale/providers/index.js.map +1 -1
  427. package/dist/locale/storage/LocaleStorage.d.ts +11 -0
  428. package/dist/locale/storage/LocaleStorage.js +40 -0
  429. package/dist/locale/storage/LocaleStorage.js.map +1 -0
  430. package/dist/locale/storage/index.d.ts +1 -0
  431. package/dist/locale/storage/index.js +5 -0
  432. package/dist/locale/storage/index.js.map +1 -0
  433. package/dist/main/entrypoint.d.ts +4 -0
  434. package/dist/main/entrypoint.js +20 -0
  435. package/dist/main/entrypoint.js.map +1 -0
  436. package/dist/main/icon.d.ts +2 -3
  437. package/dist/main/icon.js +2 -1
  438. package/dist/main/icon.js.map +1 -1
  439. package/dist/main/index.d.ts +2 -0
  440. package/dist/main/index.js +2 -0
  441. package/dist/main/index.js.map +1 -1
  442. package/dist/main/offscreen.d.ts +2 -5
  443. package/dist/main/offscreen.js +5 -2
  444. package/dist/main/offscreen.js.map +1 -1
  445. package/dist/main/options.d.ts +3 -0
  446. package/dist/main/options.js +7 -0
  447. package/dist/main/options.js.map +1 -0
  448. package/dist/main/page.d.ts +2 -4
  449. package/dist/main/page.js +2 -1
  450. package/dist/main/page.js.map +1 -1
  451. package/dist/main/popup.d.ts +2 -5
  452. package/dist/main/popup.js +3 -3
  453. package/dist/main/popup.js.map +1 -1
  454. package/dist/main/relay.d.ts +1 -2
  455. package/dist/main/relay.js +2 -1
  456. package/dist/main/relay.js.map +1 -1
  457. package/dist/main/sandbox.d.ts +1 -4
  458. package/dist/main/sandbox.js +2 -1
  459. package/dist/main/sandbox.js.map +1 -1
  460. package/dist/main/service.d.ts +1 -2
  461. package/dist/main/service.js.map +1 -1
  462. package/dist/main/sidebar.d.ts +2 -5
  463. package/dist/main/sidebar.js +3 -3
  464. package/dist/main/sidebar.js.map +1 -1
  465. package/dist/message/index.d.ts +2 -4
  466. package/dist/message/index.js.map +1 -1
  467. package/dist/offscreen/index.d.ts +2 -6
  468. package/dist/offscreen/index.js.map +1 -1
  469. package/dist/relay/index.d.ts +2 -5
  470. package/dist/relay/index.js.map +1 -1
  471. package/dist/sandbox/index.d.ts +1 -5
  472. package/dist/sandbox/index.js.map +1 -1
  473. package/dist/service/index.d.ts +2 -6
  474. package/dist/service/index.js.map +1 -1
  475. package/dist/shared/content/index.d.ts +1 -0
  476. package/dist/shared/content/index.js +6 -0
  477. package/dist/shared/content/index.js.map +1 -0
  478. package/dist/shared/content/isolation.d.ts +4 -0
  479. package/dist/shared/content/isolation.js +70 -0
  480. package/dist/shared/content/isolation.js.map +1 -0
  481. package/dist/shared/locale/index.d.ts +5 -0
  482. package/dist/shared/locale/index.js +21 -0
  483. package/dist/shared/locale/index.js.map +1 -0
  484. package/dist/shared/locale/keys.d.ts +5 -0
  485. package/dist/shared/locale/keys.js +33 -0
  486. package/dist/shared/locale/keys.js.map +1 -0
  487. package/dist/shared/locale/language.d.ts +4 -0
  488. package/dist/shared/locale/language.js +23 -0
  489. package/dist/shared/locale/language.js.map +1 -0
  490. package/dist/shared/locale/messages.d.ts +3 -0
  491. package/dist/shared/locale/messages.js +9 -0
  492. package/dist/shared/locale/messages.js.map +1 -0
  493. package/dist/shared/locale/plural.d.ts +2 -0
  494. package/dist/shared/locale/plural.js +81 -0
  495. package/dist/shared/locale/plural.js.map +1 -0
  496. package/dist/shared/locale/substitutions.d.ts +10 -0
  497. package/dist/shared/locale/substitutions.js +32 -0
  498. package/dist/shared/locale/substitutions.js.map +1 -0
  499. package/dist/types/background.d.ts +1 -1
  500. package/dist/types/background.js.map +1 -1
  501. package/dist/types/command.d.ts +1 -1
  502. package/dist/types/command.js.map +1 -1
  503. package/dist/types/content.d.ts +120 -31
  504. package/dist/types/content.js +22 -1
  505. package/dist/types/content.js.map +1 -1
  506. package/dist/types/entrypoint.d.ts +20 -0
  507. package/dist/types/entrypoint.js +4 -0
  508. package/dist/types/entrypoint.js.map +1 -1
  509. package/dist/types/icon.d.ts +8 -0
  510. package/dist/types/icon.js.map +1 -1
  511. package/dist/types/language.d.ts +57 -0
  512. package/dist/types/language.js +62 -0
  513. package/dist/types/language.js.map +1 -0
  514. package/dist/types/locale.d.ts +34 -63
  515. package/dist/types/locale.js +62 -119
  516. package/dist/types/locale.js.map +1 -1
  517. package/dist/types/manifest.d.ts +24 -7
  518. package/dist/types/manifest.js.map +1 -1
  519. package/dist/types/message.d.ts +7 -0
  520. package/dist/types/message.js.map +1 -1
  521. package/dist/types/offscreen.d.ts +14 -1
  522. package/dist/types/offscreen.js.map +1 -1
  523. package/dist/types/options.d.ts +9 -0
  524. package/dist/types/options.js +1 -0
  525. package/dist/types/options.js.map +1 -0
  526. package/dist/types/page.d.ts +8 -0
  527. package/dist/types/plugin.d.ts +2 -1
  528. package/dist/types/popup.d.ts +9 -0
  529. package/dist/types/relay.d.ts +16 -7
  530. package/dist/types/relay.js.map +1 -1
  531. package/dist/types/sandbox.d.ts +12 -0
  532. package/dist/types/sandbox.js.map +1 -1
  533. package/dist/types/service.d.ts +10 -1
  534. package/dist/types/service.js.map +1 -1
  535. package/dist/types/sidebar.d.ts +9 -0
  536. package/dist/types/sidebar.js.map +1 -1
  537. package/dist/types/transport.d.ts +4 -0
  538. package/dist/virtual/entrypoint.d.ts +5 -0
  539. package/dist/virtual/entrypoint.js +7 -0
  540. package/dist/virtual/entrypoint.js.map +1 -0
  541. package/dist/virtual/icon.d.ts +2 -0
  542. package/dist/virtual/icon.js +5 -0
  543. package/dist/virtual/icon.js.map +1 -0
  544. package/dist/virtual/locale.d.ts +7 -0
  545. package/dist/virtual/locale.js +13 -0
  546. package/dist/virtual/locale.js.map +1 -0
  547. package/dist/virtual/modules.d.ts +40 -0
  548. package/dist/virtual/offscreen.d.ts +3 -0
  549. package/dist/virtual/offscreen.js +5 -0
  550. package/dist/virtual/offscreen.js.map +1 -0
  551. package/dist/virtual/page.d.ts +2 -0
  552. package/dist/virtual/page.js +5 -0
  553. package/dist/virtual/page.js.map +1 -0
  554. package/dist/virtual/popup.d.ts +3 -0
  555. package/dist/virtual/popup.js +5 -0
  556. package/dist/virtual/popup.js.map +1 -0
  557. package/dist/virtual/relay.d.ts +3 -0
  558. package/dist/virtual/relay.js +5 -0
  559. package/dist/virtual/relay.js.map +1 -0
  560. package/dist/virtual/sandbox.d.ts +3 -0
  561. package/dist/virtual/sandbox.js +5 -0
  562. package/dist/virtual/sandbox.js.map +1 -0
  563. package/dist/virtual/sidebar.d.ts +3 -0
  564. package/dist/virtual/sidebar.js +5 -0
  565. package/dist/virtual/sidebar.js.map +1 -0
  566. package/package.json +31 -10
  567. package/scripts/clean-dist.js +7 -0
  568. package/scripts/copy-dts.js +11 -1
  569. package/types/client.d.ts +15 -0
  570. package/dist/cli/builders/manifest/utils.d.ts +0 -32
  571. package/dist/cli/builders/manifest/utils.js +0 -209
  572. package/dist/cli/builders/manifest/utils.js.map +0 -1
  573. package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
  574. package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
  575. package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
  576. package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
  577. package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
  578. package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
  579. package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
  580. package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
  581. package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
  582. package/dist/cli/entrypoint/finder/AbstractOptionsFinder.js.map +0 -1
  583. package/dist/entry/content/core/AbstractMarker.js.map +0 -1
  584. package/dist/entry/content/core/AttributeMarker.js.map +0 -1
  585. package/dist/entry/content/core/Context.js.map +0 -1
  586. package/dist/entry/content/core/EventEmitter.js.map +0 -1
  587. package/dist/entry/content/core/EventNode.js.map +0 -1
  588. package/dist/entry/content/core/ManagedContext.js.map +0 -1
  589. package/dist/entry/content/core/MarkerNode.js.map +0 -1
  590. package/dist/entry/content/core/MountNode.js.map +0 -1
  591. package/dist/entry/content/core/Node.js.map +0 -1
  592. package/dist/entry/content/core/WeakMarker.js.map +0 -1
  593. package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
  594. package/dist/locale/adapters/react/LocaleProvider.js +0 -58
  595. package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
  596. package/dist/locale/adapters/react/context.d.ts +0 -14
  597. package/dist/locale/adapters/react/context.js +0 -25
  598. package/dist/locale/adapters/react/context.js.map +0 -1
  599. package/dist/locale/utils.d.ts +0 -11
  600. package/dist/locale/utils.js +0 -67
  601. package/dist/locale/utils.js.map +0 -1
  602. /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
  603. /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
  604. /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
  605. /package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.d.ts → AbstractParsedFinder.d.ts} +0 -0
  606. /package/dist/entry/content/core/{ManagedContext.js → context/ManagedContext.js} +0 -0
  607. /package/dist/entry/content/core/{AttributeMarker.js → markers/AttributeMarker.js} +0 -0
  608. /package/dist/entry/content/core/{WeakMarker.js → markers/WeakMarker.js} +0 -0
@@ -1,7 +1,14 @@
1
1
  import { Command, Mode, PackageName } from "./../../../../types/app.js";
2
2
  import { Browser } from "./../../../../types/browser.js";
3
3
  import { RelayAllFrames, RelayMethod } from "./../../../../types/relay.js";
4
- import { ContentScriptAppend, ContentScriptDeclarative, ContentScriptMarker } from "./../../../../types/content.js";
4
+ import {
5
+ ContentScriptIsolation,
6
+ ContentScriptShadowMode,
7
+ ContentScriptAppend,
8
+ ContentScriptDeclarative,
9
+ ContentScriptMarker,
10
+ ContentScriptWorld
11
+ } from "./../../../../types/content.js";
5
12
  import { OffscreenReason } from "./../../../../types/offscreen.js";
6
13
  import { SandboxAllow, SandboxSource } from "./../../../../types/sandbox.js";
7
14
  import { CspSource } from "./../../../../types/csp.js";
@@ -55,6 +62,20 @@ var core_default = () => {
55
62
  value
56
63
  });
57
64
  });
65
+ Object.entries(ContentScriptIsolation).forEach(([key, value]) => {
66
+ resolvers.push({ from: PackageName, target: "ContentScriptIsolation", name: key, value });
67
+ });
68
+ Object.entries(ContentScriptShadowMode).forEach(([key, value]) => {
69
+ resolvers.push({ from: PackageName, target: "ContentScriptShadowMode", name: key, value });
70
+ });
71
+ Object.entries(ContentScriptWorld).forEach(([key, value]) => {
72
+ resolvers.push({
73
+ from: PackageName,
74
+ target: "ContentScriptWorld",
75
+ name: key,
76
+ value
77
+ });
78
+ });
58
79
  Object.entries(CspSource).forEach(([key, value]) => {
59
80
  resolvers.push({
60
81
  from: PackageName,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/entrypoint/file/injectors/core.ts"],"sourcesContent":["import {Command, Mode, PackageName} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {RelayAllFrames, RelayMethod} from \"@typing/relay\";\nimport {ContentScriptAppend, ContentScriptDeclarative, ContentScriptMarker} from \"@typing/content\";\nimport {OffscreenReason} from \"@typing/offscreen\";\nimport {SandboxAllow, SandboxSource} from \"@typing/sandbox\";\nimport {CspSource} from \"@typing/csp\";\n\nimport {Injector} from \"../types\";\n\nexport default (): Injector[] => {\n const resolvers: Injector[] = [];\n\n Object.entries(Browser).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Browser\",\n name: key,\n value,\n });\n });\n\n Object.entries(Mode).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Mode\",\n name: key,\n value,\n });\n });\n\n Object.entries(Command).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Command\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptDeclarative).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptDeclarative\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptAppend).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptAppend\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptMarker).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptMarker\",\n name: key,\n value,\n });\n });\n\n Object.entries(CspSource).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"CspSource\",\n name: key,\n value,\n });\n });\n\n Object.entries(RelayMethod).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"RelayMethod\",\n name: key,\n value,\n });\n });\n\n Object.entries(RelayAllFrames).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"RelayAllFrames\",\n name: key,\n value,\n });\n });\n\n Object.entries(OffscreenReason).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"OffscreenReason\",\n name: key,\n value,\n });\n });\n\n Object.entries(SandboxAllow).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"SandboxAllow\",\n name: key,\n value,\n });\n });\n\n Object.entries(SandboxSource).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"SandboxSource\",\n name: key,\n value,\n });\n });\n\n return resolvers;\n};\n"],"mappings":"AAAA,SAAQ,SAAS,MAAM,mBAAkB;AACzC,SAAQ,eAAc;AACtB,SAAQ,gBAAgB,mBAAkB;AAC1C,SAAQ,qBAAqB,0BAA0B,2BAA0B;AACjF,SAAQ,uBAAsB;AAC9B,SAAQ,cAAc,qBAAoB;AAC1C,SAAQ,iBAAgB;AAIxB,IAAO,eAAQ,MAAkB;AAC7B,QAAM,YAAwB,CAAC;AA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AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,WAAW,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAClD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,cAAc,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACrD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,eAAe,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACtD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACnD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO;AACX;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/injectors/core.ts"],"sourcesContent":["import {Command, Mode, PackageName} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {RelayAllFrames, RelayMethod} from \"@typing/relay\";\nimport {\n ContentScriptIsolation,\n ContentScriptShadowMode,\n ContentScriptAppend,\n ContentScriptDeclarative,\n ContentScriptMarker,\n ContentScriptWorld,\n} from \"@typing/content\";\nimport {OffscreenReason} from \"@typing/offscreen\";\nimport {SandboxAllow, SandboxSource} from \"@typing/sandbox\";\nimport {CspSource} from \"@typing/csp\";\n\nimport {Injector} from \"../types\";\n\nexport default (): Injector[] => {\n const resolvers: Injector[] = [];\n\n Object.entries(Browser).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Browser\",\n name: key,\n value,\n });\n });\n\n Object.entries(Mode).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Mode\",\n name: key,\n value,\n });\n });\n\n Object.entries(Command).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Command\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptDeclarative).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptDeclarative\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptAppend).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptAppend\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptMarker).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptMarker\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptIsolation).forEach(([key, value]) => {\n resolvers.push({from: PackageName, target: \"ContentScriptIsolation\", name: key, value});\n });\n\n Object.entries(ContentScriptShadowMode).forEach(([key, value]) => {\n resolvers.push({from: PackageName, target: \"ContentScriptShadowMode\", name: key, value});\n });\n\n Object.entries(ContentScriptWorld).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptWorld\",\n name: key,\n value,\n });\n });\n\n Object.entries(CspSource).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"CspSource\",\n name: key,\n value,\n });\n });\n\n Object.entries(RelayMethod).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"RelayMethod\",\n name: key,\n value,\n });\n });\n\n Object.entries(RelayAllFrames).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"RelayAllFrames\",\n name: key,\n value,\n });\n });\n\n Object.entries(OffscreenReason).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"OffscreenReason\",\n name: key,\n value,\n });\n });\n\n Object.entries(SandboxAllow).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"SandboxAllow\",\n name: key,\n value,\n });\n });\n\n Object.entries(SandboxSource).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"SandboxSource\",\n name: key,\n value,\n });\n });\n\n return resolvers;\n};\n"],"mappings":"AAAA,SAAQ,SAAS,MAAM,mBAAkB;AACzC,SAAQ,eAAc;AACtB,SAAQ,gBAAgB,mBAAkB;AAC1C;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAQ,uBAAsB;AAC9B,SAAQ,cAAc,qBAAoB;AAC1C,SAAQ,iBAAgB;AAIxB,IAAO,eAAQ,MAAkB;AAC7B,QAAM,YAAwB,CAAC;AAE/B,SAAO,QAAQ,OAAO,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC3C,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,OAAO,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CA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A,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,WAAW,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAClD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,cAAc,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACrD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,eAAe,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACtD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACnD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO;AACX;","names":[]}
@@ -0,0 +1,14 @@
1
+ import ts from "typescript";
2
+ import SourceFile from "../SourceFile.js";
3
+ import NodeFinder from "./NodeFinder.js";
4
+ import { type ExportValue } from "./types.js";
5
+ /** Describes default exports without assigning them a renderer, initializer or configuration role. */
6
+ export default class ExportParser {
7
+ private readonly sourceFile;
8
+ private readonly nodeFinder;
9
+ private readonly getCompilerOptions;
10
+ constructor(sourceFile: SourceFile, nodeFinder: NodeFinder, getCompilerOptions: () => ts.CompilerOptions);
11
+ parseDefault(): ExportValue | undefined;
12
+ private describeExpression;
13
+ private describeType;
14
+ }
@@ -0,0 +1,71 @@
1
+ import ts from "typescript";
2
+ import { ExportValueKind } from "./types.js";
3
+ class ExportParser {
4
+ constructor(sourceFile, nodeFinder, getCompilerOptions) {
5
+ this.sourceFile = sourceFile;
6
+ this.nodeFinder = nodeFinder;
7
+ this.getCompilerOptions = getCompilerOptions;
8
+ }
9
+ sourceFile;
10
+ nodeFinder;
11
+ getCompilerOptions;
12
+ parseDefault() {
13
+ const declaration = this.nodeFinder.findDefaultExport();
14
+ if (!declaration) return void 0;
15
+ if (ts.isFunctionDeclaration(declaration)) return { kind: ExportValueKind.Function, properties: [] };
16
+ if (ts.isClassDeclaration(declaration)) return { kind: ExportValueKind.Class, properties: [] };
17
+ if (ts.isExportAssignment(declaration)) {
18
+ const value = this.describeExpression(declaration.expression);
19
+ if (value) return value;
20
+ }
21
+ return this.describeType();
22
+ }
23
+ describeExpression(expression) {
24
+ while (ts.isParenthesizedExpression(expression) || ts.isAsExpression(expression) || ts.isSatisfiesExpression(expression) || ts.isTypeAssertionExpression(expression) || ts.isNonNullExpression(expression)) {
25
+ expression = expression.expression;
26
+ }
27
+ if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression))
28
+ return { kind: ExportValueKind.Function, properties: [] };
29
+ if (ts.isClassExpression(expression)) return { kind: ExportValueKind.Class, properties: [] };
30
+ if (ts.isJsxElement(expression) || ts.isJsxSelfClosingElement(expression) || ts.isJsxFragment(expression))
31
+ return { kind: ExportValueKind.Jsx, properties: [] };
32
+ if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression))
33
+ return { kind: ExportValueKind.String, properties: [], value: expression.text };
34
+ if (ts.isNumericLiteral(expression))
35
+ return { kind: ExportValueKind.Number, properties: [], value: Number(expression.text) };
36
+ if (ts.isObjectLiteralExpression(expression)) {
37
+ const properties = /* @__PURE__ */ new Set();
38
+ for (const property of expression.properties) {
39
+ if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) return void 0;
40
+ properties.add(property.name.text);
41
+ }
42
+ return { kind: ExportValueKind.Object, properties: [...properties] };
43
+ }
44
+ return void 0;
45
+ }
46
+ describeType() {
47
+ const filename = this.sourceFile.getSourceFile().fileName;
48
+ const program = ts.createProgram([filename], { ...this.getCompilerOptions(), noEmit: true });
49
+ const entry = program.getSourceFile(filename);
50
+ if (!entry) return void 0;
51
+ const checker = program.getTypeChecker();
52
+ const module = checker.getSymbolAtLocation(entry);
53
+ const exported = module && checker.getExportsOfModule(module).find((symbol2) => symbol2.name === "default");
54
+ if (!exported) return void 0;
55
+ const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;
56
+ if (!(symbol.flags & ts.SymbolFlags.Value)) return void 0;
57
+ const type = checker.getTypeOfSymbolAtLocation(symbol, entry);
58
+ const properties = type.getProperties().map((property) => property.name);
59
+ if (type.getCallSignatures().length > 0) return { kind: ExportValueKind.Function, properties };
60
+ if (type.getConstructSignatures().length > 0) return { kind: ExportValueKind.Class, properties };
61
+ if (type.flags & ts.TypeFlags.StringLike)
62
+ return { kind: ExportValueKind.String, properties, ...type.isStringLiteral() ? { value: type.value } : {} };
63
+ if (type.flags & ts.TypeFlags.NumberLike)
64
+ return { kind: ExportValueKind.Number, properties, ...type.isNumberLiteral() ? { value: type.value } : {} };
65
+ return { kind: type.flags & ts.TypeFlags.Object ? ExportValueKind.Object : ExportValueKind.Other, properties };
66
+ }
67
+ }
68
+ export {
69
+ ExportParser as default
70
+ };
71
+ //# sourceMappingURL=ExportParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/ExportParser.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport SourceFile from \"../SourceFile\";\nimport NodeFinder from \"./NodeFinder\";\nimport {ExportValueKind, type ExportValue} from \"./types\";\n\n/** Describes default exports without assigning them a renderer, initializer or configuration role. */\nexport default class ExportParser {\n constructor(\n private readonly sourceFile: SourceFile,\n private readonly nodeFinder: NodeFinder,\n private readonly getCompilerOptions: () => ts.CompilerOptions\n ) {}\n\n public parseDefault(): ExportValue | undefined {\n const declaration = this.nodeFinder.findDefaultExport();\n if (!declaration) return undefined;\n if (ts.isFunctionDeclaration(declaration)) return {kind: ExportValueKind.Function, properties: []};\n if (ts.isClassDeclaration(declaration)) return {kind: ExportValueKind.Class, properties: []};\n if (ts.isExportAssignment(declaration)) {\n const value = this.describeExpression(declaration.expression);\n if (value) return value;\n }\n return this.describeType();\n }\n\n private describeExpression(expression: ts.Expression): ExportValue | undefined {\n while (\n ts.isParenthesizedExpression(expression) ||\n ts.isAsExpression(expression) ||\n ts.isSatisfiesExpression(expression) ||\n ts.isTypeAssertionExpression(expression) ||\n ts.isNonNullExpression(expression)\n ) {\n expression = expression.expression;\n }\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression))\n return {kind: ExportValueKind.Function, properties: []};\n if (ts.isClassExpression(expression)) return {kind: ExportValueKind.Class, properties: []};\n if (ts.isJsxElement(expression) || ts.isJsxSelfClosingElement(expression) || ts.isJsxFragment(expression))\n return {kind: ExportValueKind.Jsx, properties: []};\n if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression))\n return {kind: ExportValueKind.String, properties: [], value: expression.text};\n if (ts.isNumericLiteral(expression))\n return {kind: ExportValueKind.Number, properties: [], value: Number(expression.text)};\n if (ts.isObjectLiteralExpression(expression)) {\n const properties = new Set<string>();\n for (const property of expression.properties) {\n // Resolve spread/computed properties through the checker, without evaluating their values.\n if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) return undefined;\n properties.add(property.name.text);\n }\n return {kind: ExportValueKind.Object, properties: [...properties]};\n }\n return undefined;\n }\n\n private describeType(): ExportValue | undefined {\n const filename = this.sourceFile.getSourceFile().fileName;\n // Keep the program local to this analysis: a watch rebuild must see changed imported exports.\n const program = ts.createProgram([filename], {...this.getCompilerOptions(), noEmit: true});\n const entry = program.getSourceFile(filename);\n if (!entry) return undefined;\n const checker = program.getTypeChecker();\n const module = checker.getSymbolAtLocation(entry);\n const exported = module && checker.getExportsOfModule(module).find(symbol => symbol.name === \"default\");\n if (!exported) return undefined;\n const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;\n if (!(symbol.flags & ts.SymbolFlags.Value)) return undefined;\n const type = checker.getTypeOfSymbolAtLocation(symbol, entry);\n const properties = type.getProperties().map(property => property.name);\n if (type.getCallSignatures().length > 0) return {kind: ExportValueKind.Function, properties};\n if (type.getConstructSignatures().length > 0) return {kind: ExportValueKind.Class, properties};\n if (type.flags & ts.TypeFlags.StringLike)\n return {kind: ExportValueKind.String, properties, ...(type.isStringLiteral() ? {value: type.value} : {})};\n if (type.flags & ts.TypeFlags.NumberLike)\n return {kind: ExportValueKind.Number, properties, ...(type.isNumberLiteral() ? {value: type.value} : {})};\n return {kind: type.flags & ts.TypeFlags.Object ? ExportValueKind.Object : ExportValueKind.Other, properties};\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAIf,SAAQ,uBAAwC;AAGhD,MAAO,aAA2B;AAAA,EAC9B,YACqB,YACA,YACA,oBACnB;AAHmB;AACA;AACA;AAAA,EAClB;AAAA,EAHkB;AAAA,EACA;AAAA,EACA;AAAA,EAGd,eAAwC;AAC3C,UAAM,cAAc,KAAK,WAAW,kBAAkB;AACtD,QAAI,CAAC,YAAa,QAAO;AACzB,QAAI,GAAG,sBAAsB,WAAW,EAAG,QAAO,EAAC,MAAM,gBAAgB,UAAU,YAAY,CAAC,EAAC;AACjG,QAAI,GAAG,mBAAmB,WAAW,EAAG,QAAO,EAAC,MAAM,gBAAgB,OAAO,YAAY,CAAC,EAAC;AAC3F,QAAI,GAAG,mBAAmB,WAAW,GAAG;AACpC,YAAM,QAAQ,KAAK,mBAAmB,YAAY,UAAU;AAC5D,UAAI,MAAO,QAAO;A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 +11,8 @@ export default class NodeFinder {
11
11
  * @param sourceFile The source file to find nodes in
12
12
  */
13
13
  constructor(sourceFile: SourceFile);
14
+ /** Finds default-export syntax without traversing nested scopes; skips explicitly type-only re-exports. */
15
+ findDefaultExport(): ts.Statement | undefined;
14
16
  /**
15
17
  * Generic method to find a node of a specific type by name in the AST.
16
18
  *
@@ -9,6 +9,15 @@ class NodeFinder {
9
9
  this.sourceFile = sourceFile;
10
10
  }
11
11
  sourceFile;
12
+ /** Finds default-export syntax without traversing nested scopes; skips explicitly type-only re-exports. */
13
+ findDefaultExport() {
14
+ return this.sourceFile.getSourceFile().statements.find(
15
+ (statement) => {
16
+ var _a;
17
+ return ts.isExportAssignment(statement) && !statement.isExportEquals || ts.canHaveModifiers(statement) && ((_a = ts.getModifiers(statement)) == null ? void 0 : _a.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword)) || ts.isExportDeclaration(statement) && !statement.isTypeOnly && statement.exportClause && ts.isNamedExports(statement.exportClause) && statement.exportClause.elements.some((item) => !item.isTypeOnly && item.name.text === "default");
18
+ }
19
+ );
20
+ }
12
21
  /**
13
22
  * Generic method to find a node of a specific type by name in the AST.
14
23
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/NodeFinder.ts"],"sourcesContent":["import ts from \"typescript\";\nimport SourceFile from \"../SourceFile\";\n\n/**\n * Finds nodes in the TypeScript AST.\n */\nexport default class NodeFinder {\n /**\n * Constructor for the NodeFinder.\n *\n * @param sourceFile The source file to find nodes in\n */\n constructor(private sourceFile: SourceFile) {}\n\n /**\n * Generic method to find a node of a specific type by name in the AST.\n *\n * @param predicate The predicate to match the node\n * @param name The name to search for\n * @returns The found node or undefined if not found\n */\n public findNodeByName<T extends ts.Node>(\n predicate: (node: ts.Node, name: string) => node is T,\n name: string\n ): T | undefined {\n const sf = this.sourceFile.getSourceFile();\n let found: T | undefined;\n\n const visit = (node: ts.Node) => {\n if (predicate(node, name)) {\n found = node;\n } else {\n ts.forEachChild(node, visit);\n }\n };\n\n ts.forEachChild(sf, visit);\n return found;\n }\n\n /**\n * Searches the AST of this file for a class declaration by name.\n *\n * @param name The name of the class to find\n * @returns The class declaration or undefined if not found\n */\n public findClassDeclaration(name: string): ts.ClassDeclaration | undefined {\n return this.findNodeByName<ts.ClassDeclaration>(\n (node, searchName): node is ts.ClassDeclaration =>\n ts.isClassDeclaration(node) && node.name?.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a type alias declaration by name.\n *\n * @param name The name of the type alias to find\n * @returns The type alias declaration or undefined if not found\n */\n public findTypeAliasDeclaration(name: string): ts.TypeAliasDeclaration | undefined {\n return this.findNodeByName<ts.TypeAliasDeclaration>(\n (node, searchName): node is ts.TypeAliasDeclaration =>\n ts.isTypeAliasDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an interface declaration by name.\n *\n * @param name The name of the interface to find\n * @returns The interface declaration or undefined if not found\n */\n public findInterfaceDeclaration(name: string): ts.InterfaceDeclaration | undefined {\n return this.findNodeByName<ts.InterfaceDeclaration>(\n (node, searchName): node is ts.InterfaceDeclaration =>\n ts.isInterfaceDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a variable declaration by name.\n *\n * @param name The name of the variable to find\n * @returns The variable declaration or undefined if not found\n */\n public findVariableDeclaration(name: string): ts.VariableDeclaration | undefined {\n return this.findNodeByName<ts.VariableDeclaration>(\n (node, searchName): node is ts.VariableDeclaration =>\n ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an import equals declaration by name.\n *\n * @param name The name of the import equals declaration to find\n * @returns The import equals declaration or undefined if not found\n */\n public findImportEqualsDeclaration(name: string): ts.ImportEqualsDeclaration | undefined {\n return this.findNodeByName<ts.ImportEqualsDeclaration>(\n (node, searchName): node is ts.ImportEqualsDeclaration =>\n ts.isImportEqualsDeclaration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ACH,GAAG,sBAAsB,IAAI,KAAK,GAAG,aAAa,KAAK,IAAI,KAAK,KAAK,KAAK,SAAS;AAAA,MACvF;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,4BAA4B,MAAsD;AACrF,WAAO,KAAK;AAAA,MACR,CAAC,MAAM,eACH,GAAG,0BAA0B,IAAI,KAAK,GAAG,aAAa,KAAK,IAAI,KAAK,KAAK,KAAK,SAAS;AAAA,MAC3F;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/NodeFinder.ts"],"sourcesContent":["import ts from \"typescript\";\nimport SourceFile from \"../SourceFile\";\n\n/**\n * Finds nodes in the TypeScript AST.\n */\nexport default class NodeFinder {\n /**\n * Constructor for the NodeFinder.\n *\n * @param sourceFile The source file to find nodes in\n */\n constructor(private sourceFile: SourceFile) {}\n\n /** Finds default-export syntax without traversing nested scopes; skips explicitly type-only re-exports. */\n public findDefaultExport(): ts.Statement | undefined {\n return this.sourceFile\n .getSourceFile()\n .statements.find(\n statement =>\n (ts.isExportAssignment(statement) && !statement.isExportEquals) ||\n (ts.canHaveModifiers(statement) &&\n ts.getModifiers(statement)?.some(modifier => modifier.kind === ts.SyntaxKind.DefaultKeyword)) ||\n (ts.isExportDeclaration(statement) &&\n !statement.isTypeOnly &&\n statement.exportClause &&\n ts.isNamedExports(statement.exportClause) &&\n statement.exportClause.elements.some(item => !item.isTypeOnly && item.name.text === \"default\"))\n );\n }\n\n /**\n * Generic method to find a node of a specific type by name in the AST.\n *\n * @param predicate The predicate to match the node\n * @param name The name to search for\n * @returns The found node or undefined if not found\n */\n public findNodeByName<T extends ts.Node>(\n predicate: (node: ts.Node, name: string) => node is T,\n name: string\n ): T | undefined {\n const sf = this.sourceFile.getSourceFile();\n let found: T | undefined;\n\n const visit = (node: ts.Node) => {\n if (predicate(node, name)) {\n found = node;\n } else {\n ts.forEachChild(node, visit);\n }\n };\n\n ts.forEachChild(sf, visit);\n return found;\n }\n\n /**\n * Searches the AST of this file for a class declaration by name.\n *\n * @param name The name of the class to find\n * @returns The class declaration or undefined if not found\n */\n public findClassDeclaration(name: string): ts.ClassDeclaration | undefined {\n return this.findNodeByName<ts.ClassDeclaration>(\n (node, searchName): node is ts.ClassDeclaration =>\n ts.isClassDeclaration(node) && node.name?.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a type alias declaration by name.\n *\n * @param name The name of the type alias to find\n * @returns The type alias declaration or undefined if not found\n */\n public findTypeAliasDeclaration(name: string): ts.TypeAliasDeclaration | undefined {\n return this.findNodeByName<ts.TypeAliasDeclaration>(\n (node, searchName): node is ts.TypeAliasDeclaration =>\n ts.isTypeAliasDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an interface declaration by name.\n *\n * @param name The name of the interface to find\n * @returns The interface declaration or undefined if not found\n */\n public findInterfaceDeclaration(name: string): ts.InterfaceDeclaration | undefined {\n return this.findNodeByName<ts.InterfaceDeclaration>(\n (node, searchName): node is ts.InterfaceDeclaration =>\n ts.isInterfaceDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a variable declaration by name.\n *\n * @param name The name of the variable to find\n * @returns The variable declaration or undefined if not found\n */\n public findVariableDeclaration(name: string): ts.VariableDeclaration | undefined {\n return this.findNodeByName<ts.VariableDeclaration>(\n (node, searchName): node is ts.VariableDeclaration =>\n ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an import equals declaration by name.\n *\n * @param name The name of the import equals declaration to find\n * @returns The import equals declaration or undefined if not found\n */\n public findImportEqualsDeclaration(name: string): ts.ImportEqualsDeclaration | undefined {\n return this.findNodeByName<ts.ImportEqualsDeclaration>(\n (node, searchName): node is ts.ImportEqualsDeclaration =>\n ts.isImportEqualsDeclaration(node) && ts.isIdentifier(node.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,WAAO,KAAK;AAAA,MACR,CAAC,MAAM,eACH,GAAG,uBAAuB,IAAI,KAAK,KAAK,KAAK,SAAS;AAAA,MAC1D;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,yBAAyB,MAAmD;AAC/E,WAAO,KAAK;AAAA,MACR,CAAC,MAAM,eACH,GAAG,uBAAuB,IAAI,KAAK,KAAK,KAAK,SAAS;AAAA,MAC1D;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,wBAAwB,MAAkD;AAC7E,WAAO,KAAK;AAAA,MACR,CAAC,MAAM,eACH,GAAG,sBAAsB,IAAI,KAAK,GAAG,aAAa,KAAK,IAAI,KAAK,KAAK,KAAK,SAAS;AAAA,MACvF;AAAA,IACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,4BAA4B,MAAsD;AACrF,WAAO,KAAK;AAAA,MACR,CAAC,MAAM,eACH,GAAG,0BAA0B,IAAI,KAAK,GAAG,aAAa,KAAK,IAAI,KAAK,KAAK,KAAK,SAAS;AAAA,MAC3F;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
@@ -74,7 +74,11 @@ class ObjectParser extends AbstractParser {
74
74
  * @returns The inferred type as a string
75
75
  */
76
76
  inferTypeFromExpression(expr) {
77
- const val = this.sourceFile.parseNode(expr);
77
+ if (ts.isObjectLiteralExpression(expr)) return "object";
78
+ if (ts.isArrayLiteralExpression(expr)) return "array";
79
+ const result = this.sourceFile.parseNode(expr);
80
+ if (!result.resolved) return "any";
81
+ const val = result.value;
78
82
  switch (typeof val) {
79
83
  case "string":
80
84
  return "string";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/ObjectParser.ts"],"sourcesContent":["import ts from \"typescript\";\nimport _ from \"lodash\";\n\nimport SourceFile from \"../SourceFile\";\nimport AbstractParser from \"./AbstractParser\";\nimport SignatureBuilder from \"./SignatureBuilder\";\nimport JSDocParser from \"./JSDocParser\";\n\nimport {shouldIncludeMember} from \"./helpers/memberFilters\";\n\nimport {MemberSignature} from \"./types\";\n\n/**\n * Parses object literal expressions.\n */\nexport default class ObjectParser extends AbstractParser {\n /**\n * Constructor for the ObjectParser.\n *\n * @param sourceFile The source file to parse\n * @param signatureBuilder The signature builder to use for building signatures\n */\n private readonly jsDocParser: JSDocParser;\n\n constructor(\n sourceFile: SourceFile,\n private readonly signatureBuilder: SignatureBuilder\n ) {\n super(sourceFile);\n\n this.jsDocParser = new JSDocParser();\n }\n\n /**\n * Parses an object literal: each property becomes a member signature.\n *\n * @param obj The object literal expression to parse\n * @returns A record of member signatures\n */\n public parse(obj: ts.ObjectLiteralExpression): Record<string, MemberSignature> {\n const result: Record<string, MemberSignature> = {};\n\n for (const prop of obj.properties) {\n // key name helper\n const key = this.getName(prop.name ?? prop);\n\n // Skip members that start with underscore\n if (!shouldIncludeMember(key)) {\n continue;\n }\n\n if (ts.isPropertyAssignment(prop)) {\n const init = prop.initializer;\n\n if (ts.isFunctionExpression(init) || ts.isArrowFunction(init)) {\n result[key] = this.signatureBuilder.getMethodSignature(init);\n } else {\n // Check for JSDoc @type annotation\n const jsDocType = this.jsDocParser.getJSDocType(prop);\n const tsType = this.inferTypeFromExpression(init);\n\n result[key] = {\n kind: \"property\",\n type: jsDocType || tsType,\n };\n }\n } else if (ts.isMethodDeclaration(prop)) {\n result[key] = this.signatureBuilder.getMethodSignature(prop);\n } else if (ts.isShorthandPropertyAssignment(prop)) {\n const name = prop.name.text;\n const variable = this.sourceFile.getVariables().get(name);\n const val = variable ? variable.value : undefined;\n\n let type = \"any\";\n\n if (!_.isUndefined(val)) {\n if (_.isString(val)) {\n type = \"string\";\n } else if (_.isNumber(val)) {\n type = \"number\";\n } else if (_.isBoolean(val)) {\n type = \"boolean\";\n } else if (_.isArray(val)) {\n type = \"array\";\n } else if (_.isPlainObject(val)) {\n type = \"object\";\n }\n }\n\n result[key] = {kind: \"property\", type};\n }\n }\n\n return result;\n }\n\n /**\n * Infers a type string from an expression.\n *\n * @param expr The expression to infer a type from\n * @returns The inferred type as a string\n */\n public inferTypeFromExpression(expr: ts.Expression): string {\n const val = this.sourceFile.parseNode(expr);\n\n switch (typeof val) {\n case \"string\":\n return \"string\";\n case \"number\":\n return \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"object\":\n if (val === null) return \"null\";\n if (_.isArray(val)) return \"array\";\n return \"object\";\n default:\n return \"any\";\n }\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,OAAO;AAGd,OAAO,oBAAoB;AAE3B,OAAO,iBAAiB;AAExB,SAAQ,2BAA0B;AAOlC,MAAO,qBAAmC,eAAe;AAAA,EASrD,YACI,YACiB,kBACnB;AACE,UAAM,UAAU;AAFC;AAIjB,SAAK,cAAc,IAAI,YAAY;AAAA,EACvC;AAAA,EALqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAJJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBV,MAAM,KAAkE;AAC3E,UAAM,SAA0C,CAAC;AAEjD,eAAW,QAAQ,IAAI,YAAY;AAE/B,YAAM,MAAM,KAAK,QAAQ,KAAK,QAAQ,IAAI;AAG1C,UAAI,CAAC,oBAAoB,GAAG,GAAG;AAC3B;AAAA,MACJ;AAEA,UAAI,GAAG,qBAAqB,IAAI,GAAG;AAC/B,cAAM,OAAO,KAAK;AAElB,YAAI,GAAG,qBAAqB,IAAI,KAAK,GAAG,gBAAgB,IAAI,GAAG;AAC3D,iBAAO,GAAG,IAAI,KAAK,iBAAiB,mBAAmB,IAAI;AAAA,QAC/D,OAAO;AAEH,gBAAM,YAAY,KAAK,YAAY,aAAa,IAAI;AACpD,gBAAM,SAAS,KAAK,wBAAwB,IAAI;AAEhD,iBAAO,GAAG,IAAI;AAAA,YACV,MAAM;AAAA,YACN,MAAM,aAAa;AAAA,UACvB;AAAA,QACJ;AAAA,MACJ,WAAW,GAAG,oBAAoB,IAAI,GAAG;AACrC,eAAO,GAAG,IAAI,KAAK,iBAAiB,mBAAmB,IAAI;AAAA,MAC/D,WAAW,GAAG,8BAA8B,IAAI,GAAG;AAC/C,cAAM,OAAO,KAAK,KAAK;AACvB,cAAM,WAAW,KAAK,WAAW,aAAa,EAAE,IAAI,IAAI;AACxD,cAAM,MAAM,WAAW,SAAS,QAAQ;AAExC,YAAI,OAAO;AAEX,YAAI,CAAC,EAAE,YAAY,GAAG,GAAG;AACrB,cAAI,EAAE,SAAS,GAAG,GAAG;AACjB,mBAAO;AAAA,UACX,WAAW,EAAE,SAAS,GAAG,GAAG;AACxB,mBAAO;AAAA,UACX,WAAW,EAAE,UAAU,GAAG,GAAG;AACzB,mBAAO;AAAA,UACX,WAAW,EAAE,QAAQ,GAAG,GAAG;AACvB,mBAAO;AAAA,UACX,WAAW,EAAE,cAAc,GAAG,GAAG;AAC7B,mBAAO;AAAA,UACX;AAAA,QACJ;AAEA,eAAO,GAAG,IAAI,EAAC,MAAM,YAAY,KAAI;AAAA,MACzC;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,wBAAwB,MAA6B;AACxD,UAAM,MAAM,KAAK,WAAW,UAAU,IAAI;AAE1C,YAAQ,OAAO,KAAK;AAAA,MAChB,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,YAAI,QAAQ,KAAM,QAAO;AACzB,YAAI,EAAE,QAAQ,GAAG,EAAG,QAAO;AAC3B,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IACf;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/ObjectParser.ts"],"sourcesContent":["import ts from \"typescript\";\nimport _ from \"lodash\";\n\nimport SourceFile from \"../SourceFile\";\nimport AbstractParser from \"./AbstractParser\";\nimport SignatureBuilder from \"./SignatureBuilder\";\nimport JSDocParser from \"./JSDocParser\";\n\nimport {shouldIncludeMember} from \"./helpers/memberFilters\";\n\nimport {MemberSignature} from \"./types\";\n\n/**\n * Parses object literal expressions.\n */\nexport default class ObjectParser extends AbstractParser {\n /**\n * Constructor for the ObjectParser.\n *\n * @param sourceFile The source file to parse\n * @param signatureBuilder The signature builder to use for building signatures\n */\n private readonly jsDocParser: JSDocParser;\n\n constructor(\n sourceFile: SourceFile,\n private readonly signatureBuilder: SignatureBuilder\n ) {\n super(sourceFile);\n\n this.jsDocParser = new JSDocParser();\n }\n\n /**\n * Parses an object literal: each property becomes a member signature.\n *\n * @param obj The object literal expression to parse\n * @returns A record of member signatures\n */\n public parse(obj: ts.ObjectLiteralExpression): Record<string, MemberSignature> {\n const result: Record<string, MemberSignature> = {};\n\n for (const prop of obj.properties) {\n // key name helper\n const key = this.getName(prop.name ?? prop);\n\n // Skip members that start with underscore\n if (!shouldIncludeMember(key)) {\n continue;\n }\n\n if (ts.isPropertyAssignment(prop)) {\n const init = prop.initializer;\n\n if (ts.isFunctionExpression(init) || ts.isArrowFunction(init)) {\n result[key] = this.signatureBuilder.getMethodSignature(init);\n } else {\n // Check for JSDoc @type annotation\n const jsDocType = this.jsDocParser.getJSDocType(prop);\n const tsType = this.inferTypeFromExpression(init);\n\n result[key] = {\n kind: \"property\",\n type: jsDocType || tsType,\n };\n }\n } else if (ts.isMethodDeclaration(prop)) {\n result[key] = this.signatureBuilder.getMethodSignature(prop);\n } else if (ts.isShorthandPropertyAssignment(prop)) {\n const name = prop.name.text;\n const variable = this.sourceFile.getVariables().get(name);\n const val = variable ? variable.value : undefined;\n\n let type = \"any\";\n\n if (!_.isUndefined(val)) {\n if (_.isString(val)) {\n type = \"string\";\n } else if (_.isNumber(val)) {\n type = \"number\";\n } else if (_.isBoolean(val)) {\n type = \"boolean\";\n } else if (_.isArray(val)) {\n type = \"array\";\n } else if (_.isPlainObject(val)) {\n type = \"object\";\n }\n }\n\n result[key] = {kind: \"property\", type};\n }\n }\n\n return result;\n }\n\n /**\n * Infers a type string from an expression.\n *\n * @param expr The expression to infer a type from\n * @returns The inferred type as a string\n */\n public inferTypeFromExpression(expr: ts.Expression): string {\n // Shape inference does not require every member to be a statically known value.\n if (ts.isObjectLiteralExpression(expr)) return \"object\";\n if (ts.isArrayLiteralExpression(expr)) return \"array\";\n const result = this.sourceFile.parseNode(expr);\n if (!result.resolved) return \"any\";\n const val = result.value;\n\n switch (typeof val) {\n case \"string\":\n return \"string\";\n case \"number\":\n return \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"object\":\n if (val === null) return \"null\";\n if (_.isArray(val)) return \"array\";\n return \"object\";\n default:\n return \"any\";\n }\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,OAAO;AAGd,OAAO,oBAAoB;AAE3B,OAAO,iBAAiB;AAExB,SAAQ,2BAA0B;AAOlC,MAAO,qBAAmC,eAAe;AAAA,EASrD,YACI,YACiB,kBACnB;AACE,UAAM,UAAU;AAFC;AAIjB,SAAK,cAAc,IAAI,YAAY;AAAA,EACvC;AAAA,EALqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAJJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBV,MAAM,KAAkE;AAC3E,UAAM,SAA0C,CAAC;AAEjD,eAAW,QAAQ,IAAI,YAAY;AAE/B,YAAM,MAAM,KAAK,QAAQ,KAAK,QAAQ,IAAI;AAG1C,UAAI,CAAC,oBAAoB,GAAG,GAAG;AAC3B;AAAA,MACJ;AAEA,UAAI,GAAG,qBAAqB,IAAI,GAAG;AAC/B,cAAM,OAAO,KAAK;AAElB,YAAI,GAAG,qBAAqB,IAAI,KAAK,GAAG,gBAAgB,IAAI,GAAG;AAC3D,iBAAO,GAAG,IAAI,KAAK,iBAAiB,mBAAmB,IAAI;AAAA,QAC/D,OAAO;AAEH,gBAAM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;AACD,eAAO;AAAA,MACX,KAAK;AACD,YAAI,QAAQ,KAAM,QAAO;AACzB,YAAI,EAAE,QAAQ,GAAG,EAAG,QAAO;AAC3B,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IACf;AAAA,EACJ;AACJ;","names":[]}
@@ -5,3 +5,4 @@ export { default as TypeResolver } from "./TypeResolver.js";
5
5
  export { default as SignatureBuilder } from "./SignatureBuilder.js";
6
6
  export { default as NodeFinder } from "./NodeFinder.js";
7
7
  export { default as JSDocParser } from "./JSDocParser.js";
8
+ export { default as ExportParser } from "./ExportParser.js";
@@ -5,8 +5,10 @@ import { default as default5 } from "./TypeResolver.js";
5
5
  import { default as default6 } from "./SignatureBuilder.js";
6
6
  import { default as default7 } from "./NodeFinder.js";
7
7
  import { default as default8 } from "./JSDocParser.js";
8
+ import { default as default9 } from "./ExportParser.js";
8
9
  export {
9
10
  default4 as ClassParser,
11
+ default9 as ExportParser,
10
12
  default2 as FunctionParser,
11
13
  default8 as JSDocParser,
12
14
  default7 as NodeFinder,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/index.ts"],"sourcesContent":["export {default as FunctionParser} from \"./FunctionParser\";\nexport {default as ObjectParser} from \"./ObjectParser\";\nexport {default as ClassParser} from \"./ClassParser\";\nexport {default as TypeResolver} from \"./TypeResolver\";\nexport {default as SignatureBuilder} from \"./SignatureBuilder\";\nexport {default as NodeFinder} from \"./NodeFinder\";\nexport {default as JSDocParser} from \"./JSDocParser\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAAgC;AACxC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAAkC;AAC1C,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA6B;","names":["default"]}
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/index.ts"],"sourcesContent":["export {default as FunctionParser} from \"./FunctionParser\";\nexport {default as ObjectParser} from \"./ObjectParser\";\nexport {default as ClassParser} from \"./ClassParser\";\nexport {default as TypeResolver} from \"./TypeResolver\";\nexport {default as SignatureBuilder} from \"./SignatureBuilder\";\nexport {default as NodeFinder} from \"./NodeFinder\";\nexport {default as JSDocParser} from \"./JSDocParser\";\nexport {default as ExportParser} from \"./ExportParser\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAAgC;AACxC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAAkC;AAC1C,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;","names":["default"]}
@@ -27,3 +27,19 @@ export interface PropertySignature {
27
27
  * Member of an interface: either a method or a property.
28
28
  */
29
29
  export type MemberSignature = MethodSignature | PropertySignature;
30
+ export declare enum ExportValueKind {
31
+ Function = "function",
32
+ Class = "class",
33
+ Jsx = "jsx",
34
+ Object = "object",
35
+ String = "string",
36
+ Number = "number",
37
+ Other = "other"
38
+ }
39
+ /** Source-level facts about an export, without TypeScript nodes or entrypoint-specific meaning. */
40
+ export interface ExportValue {
41
+ readonly kind: ExportValueKind;
42
+ /** Property names identified statically, without evaluating the exported value. */
43
+ readonly properties: readonly string[];
44
+ readonly value?: string | number;
45
+ }
@@ -1 +1,14 @@
1
+ var ExportValueKind = /* @__PURE__ */ ((ExportValueKind2) => {
2
+ ExportValueKind2["Function"] = "function";
3
+ ExportValueKind2["Class"] = "class";
4
+ ExportValueKind2["Jsx"] = "jsx";
5
+ ExportValueKind2["Object"] = "object";
6
+ ExportValueKind2["String"] = "string";
7
+ ExportValueKind2["Number"] = "number";
8
+ ExportValueKind2["Other"] = "other";
9
+ return ExportValueKind2;
10
+ })(ExportValueKind || {});
11
+ export {
12
+ ExportValueKind
13
+ };
1
14
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/types.ts"],"sourcesContent":["/**\n * Signature of a method parameter.\n */\nexport interface ParameterSignature {\n name: string;\n type: string;\n optional: boolean;\n}\n\n/**\n * Signature of a method.\n */\nexport interface MethodSignature {\n kind: \"method\";\n typeParameters: string[];\n parameters: ParameterSignature[];\n returnType: string;\n}\n\n/**\n * Signature of a property.\n */\nexport interface PropertySignature {\n kind: \"property\";\n type: string;\n optional?: boolean;\n}\n\n/**\n * Member of an interface: either a method or a property.\n */\nexport type MemberSignature = MethodSignature | PropertySignature;\n\nexport enum ExportValueKind {\n Function = \"function\",\n Class = \"class\",\n Jsx = \"jsx\",\n Object = \"object\",\n String = \"string\",\n Number = \"number\",\n Other = \"other\",\n}\n\n/** Source-level facts about an export, without TypeScript nodes or entrypoint-specific meaning. */\nexport interface ExportValue {\n readonly kind: ExportValueKind;\n /** Property names identified statically, without evaluating the exported value. */\n readonly properties: readonly string[];\n readonly value?: string | number;\n}\n"],"mappings":"AAiCO,IAAK,kBAAL,kBAAKA,qBAAL;AACH,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,WAAQ;AAPA,SAAAA;AAAA,GAAA;","names":["ExportValueKind"]}
@@ -4,6 +4,7 @@ export default class {
4
4
  protected baseDir: string;
5
5
  constructor(ts?: TsResolver);
6
6
  setTs(ts: TsResolver): this;
7
+ getTs(): TsResolver;
7
8
  setBaseDir(baseDir: string): this;
8
9
  get(importPath: string): string;
9
10
  }
@@ -14,6 +14,9 @@ class ImportResolver_default {
14
14
  this.ts = ts;
15
15
  return this;
16
16
  }
17
+ getTs() {
18
+ return this.ts;
19
+ }
17
20
  setBaseDir(baseDir) {
18
21
  this.baseDir = baseDir;
19
22
  return this;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/entrypoint/file/resolvers/ImportResolver.ts"],"sourcesContent":["import path from \"path\";\nimport {createRequire} from \"module\";\n\nimport TsResolver from \"./TsResolver\";\n\nimport {hasEntrypointPath, resolveEntrypointPath} from \"@cli/entrypoint/utils\";\n\nimport {PackageName} from \"@typing/app\";\n\nexport default class {\n protected baseDir: string;\n\n constructor(protected ts: TsResolver = TsResolver.make()) {\n this.baseDir = process.cwd();\n }\n\n public setTs(ts: TsResolver): this {\n this.ts = ts;\n\n return this;\n }\n\n public setBaseDir(baseDir: string): this {\n this.baseDir = baseDir;\n\n return this;\n }\n\n public get(importPath: string): string {\n if (importPath.startsWith(\".\") || importPath.startsWith(\"/\")) {\n let resolvedLocal: string | undefined = path.resolve(this.baseDir, importPath);\n\n if (hasEntrypointPath(resolvedLocal)) {\n return resolvedLocal;\n }\n\n resolvedLocal = resolveEntrypointPath(resolvedLocal);\n\n if (resolvedLocal) {\n return resolvedLocal;\n }\n\n return importPath;\n }\n\n let aliased = this.ts.matchPath(importPath);\n\n if (aliased) {\n if (hasEntrypointPath(aliased)) {\n return path.resolve(aliased);\n }\n\n aliased = resolveEntrypointPath(aliased);\n\n if (aliased) {\n return path.resolve(aliased);\n }\n }\n\n try {\n if (importPath === PackageName || importPath.startsWith(`${PackageName}/`)) {\n return importPath;\n }\n\n return createRequire(import.meta.url).resolve(importPath, {paths: [this.baseDir]});\n } catch {\n return importPath;\n }\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAQ,qBAAoB;AAE5B,OAAO,gBAAgB;AAEvB,SAAQ,mBAAmB,6BAA4B;AAEvD,SAAQ,mBAAkB;AAE1B,MAAO,uBAAc;AAAA,EAGjB,YAAsB,KAAiB,WAAW,KAAK,GAAG;AAApC;AAClB,SAAK,UAAU,QAAQ,IAAI;AAAA,EAC/B;AAAA,EAFsB;AAAA,EAFZ;AAAA,EAMH,MAAM,IAAsB;AAC/B,SAAK,KAAK;AAEV,WAAO;AAAA,EACX;AAAA,EAEO,WAAW,SAAuB;AACrC,SAAK,UAAU;AAEf,WAAO;AAAA,EACX;AAAA,EAEO,IAAI,YAA4B;AACnC,QAAI,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG,GAAG;AAC1D,UAAI,gBAAoC,KAAK,QAAQ,KAAK,SAAS,UAAU;AAE7E,UAAI,kBAAkB,aAAa,GAAG;AAClC,eAAO;AAAA,MACX;AAEA,sBAAgB,sBAAsB,aAAa;AAEnD,UAAI,eAAe;AACf,eAAO;AAAA,MACX;AAEA,aAAO;AAAA,IACX;AAEA,QAAI,UAAU,KAAK,GAAG,UAAU,UAAU;AAE1C,QAAI,SAAS;AACT,UAAI,kBAAkB,OAAO,GAAG;AAC5B,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAEA,gBAAU,sBAAsB,OAAO;AAEvC,UAAI,SAAS;AACT,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAAA,IACJ;AAEA,QAAI;AACA,UAAI,eAAe,eAAe,WAAW,WAAW,GAAG,WAAW,GAAG,GAAG;AACxE,eAAO;AAAA,MACX;AAEA,aAAO,cAAc,YAAY,GAAG,EAAE,QAAQ,YAAY,EAAC,OAAO,CAAC,KAAK,OAAO,EAAC,CAAC;AAAA,IACrF,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/cli/entrypoint/file/resolvers/ImportResolver.ts"],"sourcesContent":["import path from \"path\";\nimport {createRequire} from \"module\";\n\nimport TsResolver from \"./TsResolver\";\n\nimport {hasEntrypointPath, resolveEntrypointPath} from \"@cli/entrypoint/utils\";\n\nimport {PackageName} from \"@typing/app\";\n\nexport default class {\n protected baseDir: string;\n\n constructor(protected ts: TsResolver = TsResolver.make()) {\n this.baseDir = process.cwd();\n }\n\n public setTs(ts: TsResolver): this {\n this.ts = ts;\n\n return this;\n }\n\n public getTs(): TsResolver {\n return this.ts;\n }\n\n public setBaseDir(baseDir: string): this {\n this.baseDir = baseDir;\n\n return this;\n }\n\n public get(importPath: string): string {\n if (importPath.startsWith(\".\") || importPath.startsWith(\"/\")) {\n let resolvedLocal: string | undefined = path.resolve(this.baseDir, importPath);\n\n if (hasEntrypointPath(resolvedLocal)) {\n return resolvedLocal;\n }\n\n resolvedLocal = resolveEntrypointPath(resolvedLocal);\n\n if (resolvedLocal) {\n return resolvedLocal;\n }\n\n return importPath;\n }\n\n let aliased = this.ts.matchPath(importPath);\n\n if (aliased) {\n if (hasEntrypointPath(aliased)) {\n return path.resolve(aliased);\n }\n\n aliased = resolveEntrypointPath(aliased);\n\n if (aliased) {\n return path.resolve(aliased);\n }\n }\n\n try {\n if (importPath === PackageName || importPath.startsWith(`${PackageName}/`)) {\n return importPath;\n }\n\n return createRequire(import.meta.url).resolve(importPath, {paths: [this.baseDir]});\n } catch {\n return importPath;\n }\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAQ,qBAAoB;AAE5B,OAAO,gBAAgB;AAEvB,SAAQ,mBAAmB,6BAA4B;AAEvD,SAAQ,mBAAkB;AAE1B,MAAO,uBAAc;AAAA,EAGjB,YAAsB,KAAiB,WAAW,KAAK,GAAG;AAApC;AAClB,SAAK,UAAU,QAAQ,IAAI;AAAA,EAC/B;AAAA,EAFsB;AAAA,EAFZ;AAAA,EAMH,MAAM,IAAsB;AAC/B,SAAK,KAAK;AAEV,WAAO;AAAA,EACX;AAAA,EAEO,QAAoB;AACvB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,WAAW,SAAuB;AACrC,SAAK,UAAU;AAEf,WAAO;AAAA,EACX;AAAA,EAEO,IAAI,YAA4B;AACnC,QAAI,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG,GAAG;AAC1D,UAAI,gBAAoC,KAAK,QAAQ,KAAK,SAAS,UAAU;AAE7E,UAAI,kBAAkB,aAAa,GAAG;AAClC,eAAO;AAAA,MACX;AAEA,sBAAgB,sBAAsB,aAAa;AAEnD,UAAI,eAAe;AACf,eAAO;AAAA,MACX;AAEA,aAAO;AAAA,IACX;AAEA,QAAI,UAAU,KAAK,GAAG,UAAU,UAAU;AAE1C,QAAI,SAAS;AACT,UAAI,kBAAkB,OAAO,GAAG;AAC5B,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAEA,gBAAU,sBAAsB,OAAO;AAEvC,UAAI,SAAS;AACT,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAAA,IACJ;AAEA,QAAI;AACA,UAAI,eAAe,eAAe,WAAW,WAAW,GAAG,WAAW,GAAG,GAAG;AACxE,eAAO;AAAA,MACX;AAEA,aAAO,cAAc,YAAY,GAAG,EAAE,QAAQ,YAAY,EAAC,OAAO,CAAC,KAAK,OAAO,EAAC,CAAC;AAAA,IACrF,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;","names":[]}
@@ -1,3 +1,5 @@
1
+ import type ts from "typescript";
2
+ import type SourceFile from "./SourceFile.js";
1
3
  export interface Variable {
2
4
  name: string;
3
5
  value: any;
@@ -11,4 +13,27 @@ export interface Injector<T = any> {
11
13
  }
12
14
  export type VariableMap = Map<string, Variable>;
13
15
  export type ImportMap = Map<string, string>;
14
- export type EnumMap = Map<string, Map<string, string | number>>;
16
+ export type SourceValue = string | number | boolean | null | undefined | SourceValue[] | {
17
+ [key: string]: SourceValue;
18
+ };
19
+ export type SourceReadResult<T = SourceValue> = {
20
+ resolved: true;
21
+ value: T;
22
+ } | {
23
+ resolved: false;
24
+ file: string;
25
+ path: string;
26
+ reason: string;
27
+ };
28
+ /** An unevaluated expression and the module in which its identifiers are defined. */
29
+ export interface SourceBinding {
30
+ source: SourceFile;
31
+ node: ts.Node;
32
+ }
33
+ export interface SourceReadContext {
34
+ path: string;
35
+ seen: ReadonlySet<string>;
36
+ }
37
+ export interface SourceResolvedBinding extends SourceBinding {
38
+ context: SourceReadContext;
39
+ }
@@ -1,7 +1,7 @@
1
- import AbstractOptionsFinder from "./AbstractOptionsFinder.js";
1
+ import AbstractParsedFinder from "./AbstractParsedFinder.js";
2
2
  import { EntrypointFile, EntrypointOptions } from "../../../types/entrypoint.js";
3
3
  import { ReadonlyConfig } from "../../../types/config.js";
4
- export default abstract class<O extends EntrypointOptions> extends AbstractOptionsFinder<O> {
4
+ export default abstract class<O extends EntrypointOptions> extends AbstractParsedFinder<O> {
5
5
  protected fileExtensionsPattern: string;
6
6
  protected possibleIndexFiles: Set<string>;
7
7
  protected constructor(config: ReadonlyConfig);
@@ -1,11 +1,11 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import pluralize from "pluralize";
4
- import AbstractOptionsFinder from "./AbstractOptionsFinder.js";
4
+ import AbstractParsedFinder from "./AbstractParsedFinder.js";
5
5
  import { FileLayer, setFilePrecedence } from "./utils/filePrecedence.js";
6
6
  import { getAppSourcePath, getSharedPath } from "./../../../cli/resolvers/path.js";
7
7
  import { EntrypointFileExtensions } from "./../../../types/entrypoint.js";
8
- class AbstractEntrypointFinder_default extends AbstractOptionsFinder {
8
+ class AbstractEntrypointFinder_default extends AbstractParsedFinder {
9
9
  fileExtensionsPattern;
10
10
  possibleIndexFiles;
11
11
  constructor(config) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/entrypoint/finder/AbstractEntrypointFinder.ts"],"sourcesContent":["import fs, {Dirent} from \"fs\";\nimport path from \"path\";\nimport pluralize from \"pluralize\";\n\nimport AbstractOptionsFinder from \"./AbstractOptionsFinder\";\nimport {FileLayer, setFilePrecedence} from \"./utils/filePrecedence\";\n\nimport {getAppSourcePath, getSharedPath} from \"@cli/resolvers/path\";\n\nimport {EntrypointFile, EntrypointFileExtensions, EntrypointOptions} from \"@typing/entrypoint\";\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default abstract class<O extends EntrypointOptions> extends AbstractOptionsFinder<O> {\n protected fileExtensionsPattern: string;\n\n protected possibleIndexFiles: Set<string>;\n\n protected constructor(config: ReadonlyConfig) {\n super(config);\n\n this.fileExtensionsPattern = [...EntrypointFileExtensions].map(ext => ext.replace(\".\", \"\\\\.\")).join(\"|\");\n\n this.possibleIndexFiles = new Set([...EntrypointFileExtensions].map(ext => `index.${ext}`));\n }\n\n public canMerge(): boolean {\n return false;\n }\n\n protected async getFiles(): Promise<Set<EntrypointFile>> {\n const entrypoint = this.type();\n\n let files = new Set<EntrypointFile>();\n\n const appFiles = this.findFiles(getAppSourcePath(this.config));\n\n for (const file of appFiles) {\n setFilePrecedence(file, {layer: FileLayer.AppSource});\n }\n\n if (appFiles.size > 0) {\n files = appFiles;\n\n if (this.config.debug) {\n console.info(`App \"${entrypoint}\" files added:`, appFiles);\n }\n }\n\n if ((appFiles.size > 0 && this.canMerge()) || appFiles.size === 0) {\n const sharedFiles = this.findFiles(getSharedPath(this.config));\n\n for (const file of sharedFiles) {\n setFilePrecedence(file, {layer: FileLayer.Shared});\n }\n\n if (sharedFiles.size > 0) {\n files = new Set([...files, ...sharedFiles]);\n\n if (this.config.debug) {\n console.info(`Shared \"${entrypoint}\" files added:`, sharedFiles);\n }\n }\n }\n\n return files;\n }\n\n protected findFiles(directory: string): Set<EntrypointFile> {\n const entrypoint = this.type();\n const entrypointPluralize = pluralize(entrypoint);\n\n const rootFiles: EntrypointFile[] = [];\n const groupedFiles: EntrypointFile[] = [];\n\n const collect = (dir: string, files: EntrypointFile[], collectGrouped: boolean): void => {\n let entries: Dirent[];\n\n try {\n entries = fs.readdirSync(dir, {withFileTypes: true});\n } catch (e) {\n if (this.config.debug) {\n console.log(`Failed to read ${entrypoint} entrypoint directory: \"${dir}\". Skipping.`);\n }\n\n return;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n if (this.isValidDirname(entry.name)) {\n for (const indexFile of this.possibleIndexFiles) {\n const indexPath = path.join(fullPath, indexFile);\n\n try {\n const stat = fs.statSync(indexPath);\n\n if (stat.isFile()) {\n files.push(this.file(indexPath));\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\n `Error reading ${entrypoint} entrypoint index file: \"${indexPath}\". Skipping.`\n );\n }\n }\n }\n } else if (collectGrouped && entry.name === entrypointPluralize) {\n collect(fullPath, groupedFiles, false);\n }\n } else if (entry.isFile() && this.isValidFilename(entry.name)) {\n files.push(this.file(fullPath));\n }\n }\n };\n\n collect(directory, rootFiles, true);\n\n if (groupedFiles.length > 0) {\n return new Set(groupedFiles);\n }\n\n if (rootFiles.length > 0) {\n return new Set(rootFiles);\n }\n\n try {\n directory = path.join(directory, entrypoint);\n\n const stat = fs.statSync(directory);\n\n if (stat.isDirectory()) {\n collect(directory, rootFiles, false);\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\"Error reading entrypoint directory:\", directory);\n }\n }\n\n return new Set(rootFiles);\n }\n\n protected isValidFilename(filename: string): boolean {\n const name = this.type().replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n const pattern = new RegExp(`^(?:.*\\\\.)?${name}\\\\.(${this.fileExtensionsPattern})$`);\n\n return pattern.test(filename);\n }\n\n protected isValidDirname(dirname: string): boolean {\n const entrypoint = this.type();\n\n return dirname === entrypoint || dirname.endsWith(`.${entrypoint}`);\n }\n}\n"],"mappings":"AAAA,OAAO,QAAkB;AACzB,OAAO,UAAU;AACjB,OAAO,eAAe;AAEtB,OAAO,2BAA2B;AAClC,SAAQ,WAAW,yBAAwB;AAE3C,SAAQ,kBAAkB,qBAAoB;AAE9C,SAAwB,gCAAkD;AAG1E,MAAO,yCAA4D,sBAAyB;AAAA,EAC9E;AAAA,EAEA;AAAA,EAEA,YAAY,QAAwB;AAC1C,UAAM,MAAM;AAEZ,SAAK,wBAAwB,CAAC,GAAG,wBAAwB,EAAE,IAAI,SAAO,IAAI,QAAQ,KAAK,KAAK,CAAC,EAAE,KAAK,GAAG;AAEvG,SAAK,qBAAqB,IAAI,IAAI,CAAC,GAAG,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AG;AACR,UAAI,KAAK,OAAO,OAAO;AACnB,gBAAQ,IAAI,uCAAuC,SAAS;AAAA,MAChE;AAAA,IACJ;AAEA,WAAO,IAAI,IAAI,SAAS;AAAA,EAC5B;AAAA,EAEU,gBAAgB,UAA2B;AACjD,UAAM,OAAO,KAAK,KAAK,EAAE,QAAQ,uBAAuB,MAAM;AAE9D,UAAM,UAAU,IAAI,OAAO,cAAc,IAAI,OAAO,KAAK,qBAAqB,IAAI;AAElF,WAAO,QAAQ,KAAK,QAAQ;AAAA,EAChC;AAAA,EAEU,eAAe,SAA0B;AAC/C,UAAM,aAAa,KAAK,KAAK;AAE7B,WAAO,YAAY,cAAc,QAAQ,SAAS,IAAI,UAAU,EAAE;AAAA,EACtE;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/entrypoint/finder/AbstractEntrypointFinder.ts"],"sourcesContent":["import fs, {Dirent} from \"fs\";\nimport path from \"path\";\nimport pluralize from \"pluralize\";\n\nimport AbstractParsedFinder from \"./AbstractParsedFinder\";\nimport {FileLayer, setFilePrecedence} from \"./utils/filePrecedence\";\n\nimport {getAppSourcePath, getSharedPath} from \"@cli/resolvers/path\";\n\nimport {EntrypointFile, EntrypointFileExtensions, EntrypointOptions} from \"@typing/entrypoint\";\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default abstract class<O extends EntrypointOptions> extends AbstractParsedFinder<O> {\n protected fileExtensionsPattern: string;\n\n protected possibleIndexFiles: Set<string>;\n\n protected constructor(config: ReadonlyConfig) {\n super(config);\n\n // prettier-ignore\n this.fileExtensionsPattern = [...EntrypointFileExtensions]\n .map(ext => ext.replace(\".\", \"\\\\.\"))\n .join(\"|\");\n\n // prettier-ignore\n this.possibleIndexFiles = new Set([...EntrypointFileExtensions]\n .map(ext => `index.${ext}`));\n }\n\n public canMerge(): boolean {\n return false;\n }\n\n protected async getFiles(): Promise<Set<EntrypointFile>> {\n const entrypoint = this.type();\n\n let files = new Set<EntrypointFile>();\n\n const appFiles = this.findFiles(getAppSourcePath(this.config));\n\n for (const file of appFiles) {\n setFilePrecedence(file, {layer: FileLayer.AppSource});\n }\n\n if (appFiles.size > 0) {\n files = appFiles;\n\n if (this.config.debug) {\n console.info(`App \"${entrypoint}\" files added:`, appFiles);\n }\n }\n\n if ((appFiles.size > 0 && this.canMerge()) || appFiles.size === 0) {\n const sharedFiles = this.findFiles(getSharedPath(this.config));\n\n for (const file of sharedFiles) {\n setFilePrecedence(file, {layer: FileLayer.Shared});\n }\n\n if (sharedFiles.size > 0) {\n files = new Set([...files, ...sharedFiles]);\n\n if (this.config.debug) {\n console.info(`Shared \"${entrypoint}\" files added:`, sharedFiles);\n }\n }\n }\n\n return files;\n }\n\n protected findFiles(directory: string): Set<EntrypointFile> {\n const entrypoint = this.type();\n const entrypointPluralize = pluralize(entrypoint);\n\n const rootFiles: EntrypointFile[] = [];\n const groupedFiles: EntrypointFile[] = [];\n\n const collect = (dir: string, files: EntrypointFile[], collectGrouped: boolean): void => {\n let entries: Dirent[];\n\n try {\n entries = fs.readdirSync(dir, {withFileTypes: true});\n } catch (e) {\n if (this.config.debug) {\n console.log(`Failed to read ${entrypoint} entrypoint directory: \"${dir}\". Skipping.`);\n }\n\n return;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n if (this.isValidDirname(entry.name)) {\n for (const indexFile of this.possibleIndexFiles) {\n const indexPath = path.join(fullPath, indexFile);\n\n try {\n const stat = fs.statSync(indexPath);\n\n if (stat.isFile()) {\n files.push(this.file(indexPath));\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\n `Error reading ${entrypoint} entrypoint index file: \"${indexPath}\". Skipping.`\n );\n }\n }\n }\n } else if (collectGrouped && entry.name === entrypointPluralize) {\n collect(fullPath, groupedFiles, false);\n }\n } else if (entry.isFile() && this.isValidFilename(entry.name)) {\n files.push(this.file(fullPath));\n }\n }\n };\n\n collect(directory, rootFiles, true);\n\n if (groupedFiles.length > 0) {\n return new Set(groupedFiles);\n }\n\n if (rootFiles.length > 0) {\n return new Set(rootFiles);\n }\n\n try {\n directory = path.join(directory, entrypoint);\n\n const stat = fs.statSync(directory);\n\n if (stat.isDirectory()) {\n collect(directory, rootFiles, false);\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\"Error reading entrypoint directory:\", directory);\n }\n }\n\n return new Set(rootFiles);\n }\n\n protected isValidFilename(filename: string): boolean {\n const name = this.type().replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n const pattern = new RegExp(`^(?:.*\\\\.)?${name}\\\\.(${this.fileExtensionsPattern})$`);\n\n return pattern.test(filename);\n }\n\n protected isValidDirname(dirname: string): boolean {\n const entrypoint = this.type();\n\n return dirname === entrypoint || dirname.endsWith(`.${entrypoint}`);\n }\n}\n"],"mappings":"AAAA,OAAO,QAAkB;AACzB,OAAO,UAAU;AACjB,OAAO,eAAe;AAEtB,OAAO,0BAA0B;AACjC,SAAQ,WAAW,yBAAwB;AAE3C,SAAQ,kBAAkB,qBAAoB;AAE9C,SAAwB,gCAAkD;AAG1E,MAAO,yCAA4D,qBAAwB;AAAA,EAC7E;AAAA,EAEA;AAAA,EAEA,YAAY,QAAwB;AAC1C,UAAM,MAAM;AAGZ,SAAK,wBAAwB,CAAC,GAAG,wBAAwB,EACpD,IAAI,SAAO,IAAI,QAAQ,KAAK,KAAK,CAAC,EAClC,KAAK,GAAG;AAGb,SAAK,qBAAqB,IAAI,IAAI,CAAC,GAAG,wBAAwB,EACzD,IAAI,SAAO,SAAS,GAAG,EAAE,CAAC;AAAA,EACnC;AAAA,EAEO,WAAoB;AACvB,WAAO;AAAA,EACX;AAAA,EAEA,MAAgB,WAAyC;AACrD,UAAM,aAAa,KAAK,KAAK;AAE7B,QAAI,QAAQ,oBAAI,IAAoB;AAEpC,UAAM,WAAW,KAAK,UAAU,iBAAiB,KAAK,MAAM,CAAC;AAE7D,eAAW,QAAQ,UAAU;AACzB,wBAAkB,MAAM,EAAC,OAAO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K,QAAQ;AAAA,EAChC;AAAA,EAEU,eAAe,SAA0B;AAC/C,UAAM,aAAa,KAAK,KAAK;AAE7B,WAAO,YAAY,cAAc,QAAQ,SAAS,IAAI,UAAU,EAAE;AAAA,EACtE;AACJ;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import AbstractFinder from "./AbstractFinder.js";
2
- class AbstractOptionsFinder_default extends AbstractFinder {
2
+ class AbstractParsedFinder_default extends AbstractFinder {
3
3
  _parser;
4
4
  _options;
5
5
  _contract;
@@ -78,6 +78,6 @@ class AbstractOptionsFinder_default extends AbstractFinder {
78
78
  }
79
79
  }
80
80
  export {
81
- AbstractOptionsFinder_default as default
81
+ AbstractParsedFinder_default as default
82
82
  };
83
- //# sourceMappingURL=AbstractOptionsFinder.js.map
83
+ //# sourceMappingURL=AbstractParsedFinder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/cli/entrypoint/finder/AbstractParsedFinder.ts"],"sourcesContent":["import AbstractFinder from \"./AbstractFinder\";\nimport {\n EntrypointFile,\n EntrypointOptions,\n EntrypointOptionsFinder,\n EntrypointParser,\n EntrypointType,\n} from \"@typing/entrypoint\";\n\nexport default abstract class<O extends EntrypointOptions>\n extends AbstractFinder\n implements EntrypointOptionsFinder<O>\n{\n protected _parser?: EntrypointParser<O>;\n protected _options?: Map<EntrypointFile, O>;\n protected _contract?: Map<EntrypointFile, string | undefined>;\n\n public abstract type(): EntrypointType;\n\n protected abstract getParser(): EntrypointParser<O>;\n\n public parser(): EntrypointParser<O> {\n return (this._parser ??= this.getParser());\n }\n\n public async options(): Promise<Map<EntrypointFile, O>> {\n return (this._options ??= await this.getOptions());\n }\n\n public async empty(): Promise<boolean> {\n return (await this.options()).size === 0;\n }\n\n public async contracts(): Promise<Map<EntrypointFile, string | undefined>> {\n return (this._contract ??= await this.getContracts());\n }\n\n protected async getContracts(): Promise<Map<EntrypointFile, string | undefined>> {\n const collect = new Map<EntrypointFile, string | undefined>();\n\n const options = await this.options();\n\n for (const file of options.keys()) {\n collect.set(file, this.parser().contract(file));\n }\n\n return collect;\n }\n\n protected async getOptions(): Promise<Map<EntrypointFile, O>> {\n const collect = new Map<EntrypointFile, O>();\n\n for (const file of await this.files()) {\n const options = this.parser().options(file);\n\n if (!this.isValidOptions(options)) {\n continue;\n }\n\n collect.set(file, options);\n }\n\n return collect;\n }\n\n protected isValidOptions(options: O): boolean {\n const {\n browser,\n app,\n mode: configMode,\n debug: configDebug,\n manifestVersion: configManifestVersion,\n } = this.config;\n\n const {\n mode,\n debug,\n manifestVersion,\n includeBrowser = [],\n includeApp = [],\n excludeBrowser = [],\n excludeApp = [],\n } = options;\n\n if (mode && mode !== configMode) {\n return false;\n }\n\n if (debug !== undefined && debug !== configDebug) {\n return false;\n }\n\n if (manifestVersion && manifestVersion !== configManifestVersion) {\n return false;\n }\n\n if (includeBrowser.length > 0 && !includeBrowser.includes(browser)) {\n return false;\n }\n\n if (includeApp.length > 0 && !includeApp.includes(app)) {\n return false;\n }\n\n if (excludeBrowser.length > 0 && excludeBrowser.includes(browser)) {\n return false;\n }\n\n return !(excludeApp.length > 0 && excludeApp.includes(app));\n }\n\n public clear(): this {\n this._options = undefined;\n this._contract = undefined;\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,oBAAoB;AAS3B,MAAO,qCACK,eAEZ;AAAA,EACc;AAAA,EACA;AAAA,EACA;AAAA,EAMH,SAA8B;AACjC,WAAQ,KAAK,YAAL,KAAK,UAAY,KAAK,UAAU;AAAA,EAC5C;AAAA,EAEA,MAAa,UAA2C;AACpD,WAAQ,KAAK,aAAL,KAAK,WAAa,MAAM,KAAK,WAAW;AAAA,EACpD;AAAA,EAEA,MAAa,QAA0B;AACnC,YAAQ,MAAM,KAAK,QAAQ,GAAG,SAAS;AAAA,EAC3C;AAAA,EAEA,MAAa,YAA8D;AACvE,WAAQ,KAAK,cAAL,KAAK,YAAc,MAAM,KAAK,aAAa;AAAA,EACvD;AAAA,EAEA,MAAgB,eA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AE,WAAW,SAAS,KAAK,WAAW,SAAS,GAAG;AAAA,EAC7D;AAAA,EAEO,QAAc;AACjB,SAAK,WAAW;AAChB,SAAK,YAAY;AAEjB,WAAO,MAAM,MAAM;AAAA,EACvB;AACJ;","names":[]}
@@ -0,0 +1,13 @@
1
+ import ViewCspFinder from "./ViewCspFinder.js";
2
+ import type { ViewItems } from "./AbstractViewFinder.js";
3
+ import type { ReadonlyConfig } from "../../../types/config.js";
4
+ import type { OptionsEntrypointOptions } from "../../../types/options.js";
5
+ import { EntrypointOptionsFinder, EntrypointParser, EntrypointType } from "../../../types/entrypoint.js";
6
+ export default class extends ViewCspFinder<OptionsEntrypointOptions> {
7
+ constructor(config: ReadonlyConfig);
8
+ type(): EntrypointType;
9
+ protected getParser(): EntrypointParser<OptionsEntrypointOptions>;
10
+ protected getPlugin(): EntrypointOptionsFinder<OptionsEntrypointOptions>;
11
+ protected getViews(): Promise<ViewItems<OptionsEntrypointOptions>>;
12
+ allowMultiple(): boolean;
13
+ }
@@ -0,0 +1,33 @@
1
+ import ViewCspFinder from "./ViewCspFinder.js";
2
+ import PluginFinder from "./PluginFinder.js";
3
+ import { OptionsParser } from "../parser/index.js";
4
+ import { EntrypointType } from "./../../../types/entrypoint.js";
5
+ class OptionsFinder_default extends ViewCspFinder {
6
+ constructor(config) {
7
+ super(config);
8
+ }
9
+ type() {
10
+ return EntrypointType.Options;
11
+ }
12
+ getParser() {
13
+ return new OptionsParser(this.config);
14
+ }
15
+ getPlugin() {
16
+ return new PluginFinder(this.config, "options", this);
17
+ }
18
+ async getViews() {
19
+ const views = await super.getViews();
20
+ for (const view of views.values()) {
21
+ const { openInTab, ...options } = view.options;
22
+ view.options = options;
23
+ }
24
+ return views;
25
+ }
26
+ allowMultiple() {
27
+ return false;
28
+ }
29
+ }
30
+ export {
31
+ OptionsFinder_default as default
32
+ };
33
+ //# sourceMappingURL=OptionsFinder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/cli/entrypoint/finder/OptionsFinder.ts"],"sourcesContent":["import ViewCspFinder from \"./ViewCspFinder\";\nimport PluginFinder from \"./PluginFinder\";\n\nimport {OptionsParser} from \"../parser\";\n\nimport type {ViewItems} from \"./AbstractViewFinder\";\nimport type {ReadonlyConfig} from \"@typing/config\";\nimport type {OptionsEntrypointOptions} from \"@typing/options\";\nimport {EntrypointOptionsFinder, EntrypointParser, EntrypointType} from \"@typing/entrypoint\";\n\nexport default class extends ViewCspFinder<OptionsEntrypointOptions> {\n public constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n public type(): EntrypointType {\n return EntrypointType.Options;\n }\n\n protected getParser(): EntrypointParser<OptionsEntrypointOptions> {\n return new OptionsParser(this.config);\n }\n\n protected getPlugin(): EntrypointOptionsFinder<OptionsEntrypointOptions> {\n return new PluginFinder(this.config, \"options\", this);\n }\n\n protected async getViews(): Promise<ViewItems<OptionsEntrypointOptions>> {\n const views = await super.getViews();\n\n for (const view of views.values()) {\n const {openInTab, ...options} = view.options;\n\n view.options = options;\n }\n\n return views;\n }\n\n public allowMultiple(): boolean {\n return false;\n }\n}\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B,OAAO,kBAAkB;AAEzB,SAAQ,qBAAoB;AAK5B,SAAmD,sBAAqB;AAExE,MAAO,8BAAsB,cAAwC;AAAA,EAC1D,YAAY,QAAwB;AACvC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEO,OAAuB;AAC1B,WAAO,eAAe;AAAA,EAC1B;AAAA,EAEU,YAAwD;AAC9D,WAAO,IAAI,cAAc,KAAK,MAAM;AAAA,EACxC;AAAA,EAEU,YAA+D;AACrE,WAAO,IAAI,aAAa,KAAK,QAAQ,WAAW,IAAI;AAAA,EACxD;AAAA,EAEA,MAAgB,WAAyD;AACrE,UAAM,QAAQ,MAAM,MAAM,SAAS;AAEnC,eAAW,QAAQ,MAAM,OAAO,GAAG;AAC/B,YAAM,EAAC,WAAW,GAAG,QAAO,IAAI,KAAK;AAErC,WAAK,UAAU;AAAA,IACnB;AAEA,WAAO;AAAA,EACX;AAAA,EAEO,gBAAyB;AAC5B,WAAO;AAAA,EACX;AACJ;","names":[]}
@@ -1,11 +1,11 @@
1
- import AbstractOptionsFinder from "./AbstractOptionsFinder.js";
1
+ import AbstractParsedFinder from "./AbstractParsedFinder.js";
2
2
  import { ReadonlyConfig } from "../../../types/config.js";
3
3
  import { PluginHandlerKeys } from "../../../types/plugin.js";
4
4
  import { EntrypointFile, EntrypointOptions, EntrypointParser, EntrypointType } from "../../../types/entrypoint.js";
5
- export default class<O extends EntrypointOptions> extends AbstractOptionsFinder<O> {
5
+ export default class<O extends EntrypointOptions> extends AbstractParsedFinder<O> {
6
6
  protected readonly key: PluginHandlerKeys;
7
- protected readonly finder: AbstractOptionsFinder<O>;
8
- constructor(config: ReadonlyConfig, key: PluginHandlerKeys, finder: AbstractOptionsFinder<O>);
7
+ protected readonly finder: AbstractParsedFinder<O>;
8
+ constructor(config: ReadonlyConfig, key: PluginHandlerKeys, finder: AbstractParsedFinder<O>);
9
9
  type(): EntrypointType;
10
10
  protected getParser(): EntrypointParser<O>;
11
11
  protected getFiles(): Promise<Set<EntrypointFile>>;