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
@@ -3,7 +3,7 @@ import fs from "fs";
3
3
  import path from "path";
4
4
  import { ImportResolver } from "./resolvers/index.js";
5
5
  import injectors from "./injectors/index.js";
6
- class EntryFile {
6
+ class SourceFile {
7
7
  constructor(file) {
8
8
  this.file = file;
9
9
  }
@@ -11,17 +11,17 @@ class EntryFile {
11
11
  sourceFile;
12
12
  variables;
13
13
  imports;
14
- enums;
14
+ sources = /* @__PURE__ */ new Map();
15
15
  importResolver;
16
16
  static make(file) {
17
17
  return new this(file);
18
18
  }
19
19
  getSourceFile() {
20
- if (this.sourceFile) {
21
- return this.sourceFile;
20
+ if (!this.sourceFile) {
21
+ const sourceCode = fs.readFileSync(this.file, "utf8");
22
+ this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true);
22
23
  }
23
- const sourceCode = fs.readFileSync(this.file, "utf8");
24
- return this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true);
24
+ return this.sourceFile;
25
25
  }
26
26
  getImports() {
27
27
  if (this.imports) {
@@ -29,7 +29,7 @@ class EntryFile {
29
29
  }
30
30
  this.imports = /* @__PURE__ */ new Map();
31
31
  const parse = (node) => {
32
- var _a, _b, _c;
32
+ var _a, _b, _c, _d;
33
33
  if (ts.isImportDeclaration(node) && node.moduleSpecifier) {
34
34
  const importPath = node.moduleSpecifier.text;
35
35
  if (node.importClause) {
@@ -42,196 +42,300 @@ class EntryFile {
42
42
  (_a2 = this.imports) == null ? void 0 : _a2.set(el.name.text, this.getInputResolver().get(importPath));
43
43
  });
44
44
  }
45
+ if (node.importClause.namedBindings && ts.isNamespaceImport(node.importClause.namedBindings)) {
46
+ (_b = this.imports) == null ? void 0 : _b.set(
47
+ node.importClause.namedBindings.name.text,
48
+ this.getInputResolver().get(importPath)
49
+ );
50
+ }
45
51
  }
46
52
  } else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {
47
53
  if (node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) {
48
54
  const importPath = node.moduleReference.expression.text;
49
- (_b = this.imports) == null ? void 0 : _b.set(node.name.text, this.getInputResolver().get(importPath));
55
+ (_c = this.imports) == null ? void 0 : _c.set(node.name.text, this.getInputResolver().get(importPath));
50
56
  }
51
57
  } else if (ts.isImportEqualsDeclaration(node)) {
52
58
  const qualifiedName = node.moduleReference.getText();
53
- (_c = this.imports) == null ? void 0 : _c.set(node.name.text, qualifiedName);
59
+ (_d = this.imports) == null ? void 0 : _d.set(node.name.text, qualifiedName);
54
60
  }
55
61
  ts.forEachChild(node, parse);
56
62
  };
57
63
  parse(this.getSourceFile());
58
64
  return this.imports;
59
65
  }
60
- getEnums() {
61
- if (this.enums) {
62
- return this.enums;
63
- }
64
- this.enums = /* @__PURE__ */ new Map();
65
- const parse = (node) => {
66
- var _a;
67
- if (ts.isEnumDeclaration(node)) {
68
- const enumName = node.name.text;
69
- const enumProperties = /* @__PURE__ */ new Map();
70
- node.members.forEach((member) => {
71
- const key = member.name.getText();
72
- const value = member.initializer ? member.initializer.getText().replace(/['"]/g, "") : key;
73
- enumProperties.set(key, value);
74
- });
75
- (_a = this.enums) == null ? void 0 : _a.set(enumName, enumProperties);
76
- }
77
- ts.forEachChild(node, parse);
78
- };
79
- parse(this.getSourceFile());
80
- return this.enums;
81
- }
82
- getVariables() {
83
- if (this.variables) {
84
- return this.variables;
85
- }
86
- this.variables = /* @__PURE__ */ new Map();
87
- const parse = (node) => {
88
- var _a, _b, _c, _d;
89
- if (ts.isVariableStatement(node)) {
90
- const isExported = (_a = node.modifiers) == null ? void 0 : _a.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
91
- node.declarationList.declarations.forEach((declaration) => {
92
- var _a2;
93
- if (ts.isIdentifier(declaration.name) && declaration.initializer) {
94
- const name = declaration.name.text;
95
- const value = this.parseNode(declaration.initializer);
96
- (_a2 = this.variables) == null ? void 0 : _a2.set(name, {
97
- name,
98
- value,
99
- exported: isExported || false
100
- });
66
+ /** Collect declarations without evaluating runtime functions or unrelated initializers. */
67
+ getBindings(exportedOnly = false) {
68
+ var _a, _b;
69
+ const bindings = /* @__PURE__ */ new Map();
70
+ const bind = (name, node) => bindings.set(name, { source: this, node });
71
+ for (const statement of this.getSourceFile().statements) {
72
+ const exported = ts.canHaveModifiers(statement) && ((_a = ts.getModifiers(statement)) == null ? void 0 : _a.some((item) => item.kind === ts.SyntaxKind.ExportKeyword));
73
+ if (ts.isVariableStatement(statement) && (!exportedOnly || exported)) {
74
+ for (const declaration of statement.declarationList.declarations) {
75
+ if (ts.isIdentifier(declaration.name)) bind(declaration.name.text, declaration);
76
+ else {
77
+ const collect = (node) => {
78
+ if (ts.isBindingElement(node) && ts.isIdentifier(node.name)) bind(node.name.text, node);
79
+ else ts.forEachChild(node, collect);
80
+ };
81
+ collect(declaration.name);
101
82
  }
102
- });
83
+ }
84
+ } else if ((ts.isEnumDeclaration(statement) || ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && (!exportedOnly || exported) && statement.name) {
85
+ const isDefault = (_b = ts.getModifiers(statement)) == null ? void 0 : _b.some((item) => item.kind === ts.SyntaxKind.DefaultKeyword);
86
+ bind(exportedOnly && isDefault ? "default" : statement.name.text, statement);
103
87
  }
104
- if (ts.isExportDeclaration(node) && node.exportClause && ts.isNamedExports(node.exportClause)) {
105
- node.exportClause.elements.forEach((el) => {
106
- var _a2, _b2, _c2;
107
- const name = el.name.text;
108
- if ((_a2 = this.variables) == null ? void 0 : _a2.has(name)) {
109
- const variable = (_b2 = this.variables) == null ? void 0 : _b2.get(name);
110
- (_c2 = this.variables) == null ? void 0 : _c2.set(name, {
111
- name,
112
- value: variable.value,
113
- exported: true
114
- });
115
- }
116
- });
88
+ if (exportedOnly && ts.isExportAssignment(statement) && !statement.isExportEquals) {
89
+ bind("default", statement.expression);
117
90
  }
118
- if (ts.isExportAssignment(node)) {
119
- const expr = node.expression;
120
- if (ts.isIdentifier(expr) && ((_b = this.variables) == null ? void 0 : _b.has(expr.text))) {
121
- const variable = (_c = this.variables) == null ? void 0 : _c.get(expr.text);
122
- const name = "default";
123
- (_d = this.variables) == null ? void 0 : _d.set(name, {
124
- name,
125
- value: variable.value,
126
- exported: true
127
- });
91
+ if (exportedOnly && ts.isExportDeclaration(statement) && !statement.isTypeOnly && statement.exportClause && ts.isNamedExports(statement.exportClause)) {
92
+ for (const item of statement.exportClause.elements) {
93
+ if (!item.isTypeOnly)
94
+ bind(item.name.text, statement.moduleSpecifier ? item : item.propertyName ?? item.name);
128
95
  }
129
96
  }
130
- ts.forEachChild(node, parse);
131
- };
132
- parse(this.getSourceFile());
97
+ }
98
+ return bindings;
99
+ }
100
+ getVariables() {
101
+ if (this.variables) return this.variables;
102
+ const locals = this.getBindings();
103
+ const exported = this.getBindings(true);
104
+ this.variables = /* @__PURE__ */ new Map();
105
+ for (const [name, binding] of new Map([...locals, ...exported])) {
106
+ const result = this.parseNode(binding.node, name);
107
+ this.variables.set(name, {
108
+ name,
109
+ value: result.resolved ? result.value : void 0,
110
+ exported: exported.has(name)
111
+ });
112
+ }
133
113
  return this.variables;
134
114
  }
135
115
  resolveValue(from, target, name) {
136
116
  return injectors([])(from, target, name);
137
117
  }
138
- findPropertyAccessValue(property) {
139
- if (ts.isPropertyAccessExpression(property)) {
140
- const objectName = property.expression.getText();
141
- const propertyName = property.name.getText();
142
- const varItem = this.getVariables().get(objectName);
143
- if (varItem) {
144
- return varItem.value;
118
+ getImportBinding(name) {
119
+ var _a;
120
+ for (const statement of this.getSourceFile().statements) {
121
+ if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;
122
+ const clause = statement.importClause;
123
+ const from = statement.moduleSpecifier.text;
124
+ if (((_a = clause == null ? void 0 : clause.name) == null ? void 0 : _a.text) === name) return { from, name: "default" };
125
+ if ((clause == null ? void 0 : clause.namedBindings) && ts.isNamedImports(clause.namedBindings)) {
126
+ const item = clause.namedBindings.elements.find((item2) => item2.name.text === name);
127
+ if (item) return { from, name: (item.propertyName ?? item.name).text };
145
128
  }
146
- const enumItem = this.getEnums().get(objectName);
147
- if (enumItem) {
148
- return enumItem.get(propertyName);
129
+ if ((clause == null ? void 0 : clause.namedBindings) && ts.isNamespaceImport(clause.namedBindings) && clause.namedBindings.name.text === name)
130
+ return { from, name: "*" };
131
+ }
132
+ }
133
+ getImportedSource(from) {
134
+ const filename = this.getInputResolver().get(from);
135
+ if (!filename || !path.isAbsolute(filename) || !/\.[cm]?[jt]sx?$/.test(filename) || !fs.existsSync(filename))
136
+ return;
137
+ let source = this.sources.get(filename);
138
+ if (!source) {
139
+ source = new SourceFile(filename);
140
+ source.setImportResolver(this.getInputResolver());
141
+ source.sources = this.sources;
142
+ this.sources.set(filename, source);
143
+ }
144
+ return source;
145
+ }
146
+ failure(context, reason) {
147
+ return { resolved: false, file: this.file, path: context.path, reason };
148
+ }
149
+ /** Follow static bindings, retaining their source module and detecting reference cycles. */
150
+ resolveNode(node, context) {
151
+ var _a;
152
+ if (!node) return this.failure(context, "missing initializer");
153
+ const key = `${this.file}:${node.pos}:${node.end}`;
154
+ if (context.seen.has(key)) return this.failure(context, "circular reference");
155
+ context = { ...context, seen: /* @__PURE__ */ new Set([...context.seen, key]) };
156
+ if (ts.isAsExpression(node) || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node) || ts.isParenthesizedExpression(node) || ts.isNonNullExpression(node)) {
157
+ return this.resolveNode(node.expression, context);
158
+ }
159
+ if (ts.isVariableDeclaration(node)) {
160
+ if (!ts.isVariableDeclarationList(node.parent) || !(node.parent.flags & ts.NodeFlags.Const))
161
+ return this.failure(context, "use a const declaration for build options");
162
+ return this.resolveNode(node.initializer, context);
163
+ }
164
+ if (ts.isExportSpecifier(node) && ts.isExportDeclaration(node.parent.parent)) {
165
+ const from = node.parent.parent.moduleSpecifier;
166
+ const name = (node.propertyName ?? node.name).text;
167
+ const binding = from && ts.isStringLiteral(from) ? (_a = this.getImportedSource(from.text)) == null ? void 0 : _a.getBindings(true).get(name) : void 0;
168
+ if (binding) return binding.source.resolveNode(binding.node, context);
169
+ return this.failure(context, `cannot resolve re-exported value ${name}`);
170
+ }
171
+ if (ts.isIdentifier(node)) {
172
+ const local = this.getBindings().get(node.text);
173
+ if (local) return local.source.resolveNode(local.node, context);
174
+ const imported = this.getImportBinding(node.text);
175
+ if (imported) {
176
+ const source = this.getImportedSource(imported.from);
177
+ const binding = source == null ? void 0 : source.getBindings(true).get(imported.name);
178
+ if (binding) return binding.source.resolveNode(binding.node, context);
179
+ return this.failure(context, `cannot resolve imported value ${node.text}`);
149
180
  }
150
- const importItem = this.getImports().get(objectName);
151
- if (importItem) {
152
- const resolverItem = this.resolveValue(importItem, objectName, propertyName);
153
- if (resolverItem) {
154
- return resolverItem;
155
- }
156
- return EntryFile.make(importItem).findPropertyAccessValue(property);
181
+ if (node.text !== "undefined") return this.failure(context, `unresolved identifier ${node.text}`);
182
+ }
183
+ return { resolved: true, value: { source: this, node, context } };
184
+ }
185
+ parseNode(node, property = "") {
186
+ return this.readValue(node, { path: property, seen: /* @__PURE__ */ new Set() });
187
+ }
188
+ /** Read an object's shape first so callers can select build fields before evaluating values. */
189
+ getProperties(node, property = "") {
190
+ return this.readProperties(node, { path: property, seen: /* @__PURE__ */ new Set() });
191
+ }
192
+ readProperties(node, context) {
193
+ const result = this.resolveNode(node, context);
194
+ if (!result.resolved) return result;
195
+ const binding = result.value;
196
+ if (!ts.isObjectLiteralExpression(binding.node))
197
+ return binding.source.failure(binding.context, "expected a static object");
198
+ return binding.source.objectProperties(binding.node, binding.context);
199
+ }
200
+ objectProperties(node, context) {
201
+ const properties = /* @__PURE__ */ new Map();
202
+ for (const property of node.properties) {
203
+ if (ts.isSpreadAssignment(property)) {
204
+ const spread = this.readProperties(property.expression, context);
205
+ if (!spread.resolved) return spread;
206
+ for (const [key2, binding] of spread.value) properties.set(key2, binding);
207
+ continue;
208
+ }
209
+ let key;
210
+ if (ts.isComputedPropertyName(property.name)) {
211
+ const result = this.readValue(property.name.expression, context);
212
+ if (!result.resolved) return result;
213
+ if (typeof result.value !== "string" && typeof result.value !== "number")
214
+ return this.failure(context, "object keys must be strings or numbers");
215
+ key = String(result.value);
216
+ } else {
217
+ key = property.name.text;
157
218
  }
158
- return `${objectName}.${propertyName}`;
219
+ properties.set(key, {
220
+ source: this,
221
+ node: ts.isPropertyAssignment(property) ? property.initializer : ts.isShorthandPropertyAssignment(property) ? property.name : property
222
+ });
159
223
  }
160
- return void 0;
224
+ return { resolved: true, value: properties };
161
225
  }
162
- parseNode(node) {
226
+ readValue(node, context) {
227
+ const resolved = this.resolveNode(node, context);
228
+ if (!resolved.resolved) return resolved;
229
+ const binding = resolved.value;
230
+ return binding.source.readResolvedValue(binding.node, binding.context);
231
+ }
232
+ readResolvedValue(node, context) {
163
233
  var _a;
164
- if (!node) {
165
- return void 0;
166
- }
167
- switch (node.kind) {
168
- case ts.SyntaxKind.StringLiteral:
169
- return node.text;
170
- case ts.SyntaxKind.TrueKeyword:
171
- return true;
172
- case ts.SyntaxKind.FalseKeyword:
173
- return false;
174
- case ts.SyntaxKind.NullKeyword:
175
- return null;
176
- case ts.SyntaxKind.NumericLiteral:
177
- return parseFloat(node.text);
178
- case ts.SyntaxKind.Identifier: {
179
- const id = node;
180
- const name = id.text;
181
- const local = (_a = this.variables) == null ? void 0 : _a.get(name);
182
- if (local && local.value !== void 0) {
183
- return local.value;
184
- }
185
- const importPath = this.getImports().get(name);
186
- if (importPath) {
187
- const parser = EntryFile.make(importPath);
188
- const imported = parser.getVariables().get(name);
189
- if (imported && imported.value !== void 0) {
190
- return imported.value;
234
+ const success = (value) => ({ resolved: true, value });
235
+ if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return success(node.text);
236
+ if (ts.isNumericLiteral(node)) return success(Number(node.text));
237
+ if (node.kind === ts.SyntaxKind.TrueKeyword) return success(true);
238
+ if (node.kind === ts.SyntaxKind.FalseKeyword) return success(false);
239
+ if (node.kind === ts.SyntaxKind.NullKeyword) return success(null);
240
+ if (ts.isIdentifier(node) && node.text === "undefined") return success(void 0);
241
+ if (ts.isPrefixUnaryExpression(node)) {
242
+ const operand = this.readValue(node.operand, context);
243
+ if (!operand.resolved) return operand;
244
+ if (typeof operand.value === "number" && (node.operator === ts.SyntaxKind.MinusToken || node.operator === ts.SyntaxKind.PlusToken))
245
+ return success(node.operator === ts.SyntaxKind.MinusToken ? -operand.value : operand.value);
246
+ return this.failure(context, "unsupported unary expression");
247
+ }
248
+ if (ts.isArrayLiteralExpression(node)) {
249
+ const values = [];
250
+ for (const [index, element] of node.elements.entries()) {
251
+ const result = this.readValue(ts.isSpreadElement(element) ? element.expression : element, {
252
+ ...context,
253
+ path: `${context.path}[${index}]`
254
+ });
255
+ if (!result.resolved) return result;
256
+ if (ts.isSpreadElement(element)) {
257
+ if (!Array.isArray(result.value))
258
+ return this.failure(context, "array spread must reference a static array");
259
+ values.push(...result.value);
260
+ } else values.push(result.value);
261
+ }
262
+ return success(values);
263
+ }
264
+ if (ts.isObjectLiteralExpression(node)) {
265
+ const properties = this.objectProperties(node, context);
266
+ if (!properties.resolved) return properties;
267
+ const values = [];
268
+ for (const [key, binding] of properties.value) {
269
+ const result = binding.source.readValue(binding.node, {
270
+ ...context,
271
+ path: context.path ? `${context.path}.${key}` : key
272
+ });
273
+ if (!result.resolved) return result;
274
+ values.push([key, result.value]);
275
+ }
276
+ return success(Object.fromEntries(values));
277
+ }
278
+ if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
279
+ const property = ts.isPropertyAccessExpression(node) ? success(node.name.text) : this.readValue(node.argumentExpression, context);
280
+ if (!property.resolved) return property;
281
+ if (typeof property.value !== "string" && typeof property.value !== "number")
282
+ return this.failure(context, "member name must be a string or number");
283
+ const name = String(property.value);
284
+ if (ts.isIdentifier(node.expression) && !this.getBindings().has(node.expression.text)) {
285
+ const imported = this.getImportBinding(node.expression.text);
286
+ if (imported) {
287
+ const value = this.resolveValue(imported.from, imported.name, name);
288
+ if (value !== void 0) return success(value);
289
+ if (imported.name === "*") {
290
+ const binding2 = (_a = this.getImportedSource(imported.from)) == null ? void 0 : _a.getBindings(true).get(name);
291
+ if (binding2) return binding2.source.readValue(binding2.node, context);
191
292
  }
192
293
  }
193
- return name;
194
294
  }
195
- case ts.SyntaxKind.ArrayLiteralExpression:
196
- return node.elements.map((element) => this.parseNode(element));
197
- case ts.SyntaxKind.ObjectLiteralExpression:
198
- return node.properties.filter(
199
- (property) => ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)
200
- ).reduce(
201
- (acc, property) => {
202
- var _a2, _b, _c;
203
- if (ts.isComputedPropertyName(property.name)) {
204
- return acc;
205
- }
206
- const key = property.name.text;
207
- const initNode = ts.isShorthandPropertyAssignment(property) ? property.name : property.initializer;
208
- let value = this.parseNode(initNode);
209
- if (typeof value === "string" && ((_a2 = this.variables) == null ? void 0 : _a2.has(value))) {
210
- value = (_c = (_b = this.variables) == null ? void 0 : _b.get(value)) == null ? void 0 : _c.value;
211
- }
212
- acc[key] = value;
213
- return acc;
214
- },
215
- {}
216
- );
217
- case ts.SyntaxKind.PropertyAccessExpression: {
218
- return this.findPropertyAccessValue(node);
295
+ const resolved = this.resolveNode(node.expression, context);
296
+ if (!resolved.resolved) return resolved;
297
+ const binding = resolved.value;
298
+ if (ts.isObjectLiteralExpression(binding.node)) {
299
+ const properties = binding.source.objectProperties(binding.node, binding.context);
300
+ if (!properties.resolved) return properties;
301
+ const member = properties.value.get(name);
302
+ if (member) return member.source.readValue(member.node, binding.context);
303
+ return this.failure(context, `unknown member ${name}`);
219
304
  }
220
- default:
221
- return void 0;
305
+ const object = binding.source.readResolvedValue(binding.node, binding.context);
306
+ if (!object.resolved) return object;
307
+ if (object.value !== null && typeof object.value === "object" && Object.hasOwn(object.value, name))
308
+ return success(object.value[name]);
309
+ return this.failure(context, `unknown member ${name}`);
222
310
  }
311
+ if (ts.isEnumDeclaration(node)) {
312
+ const values = {};
313
+ let previous = -1;
314
+ for (const member of node.members) {
315
+ const result = member.initializer ? this.readValue(member.initializer, context) : typeof previous === "number" ? success(previous + 1) : this.failure(context, "enum member needs a static initializer");
316
+ if (!result.resolved) return result;
317
+ if (typeof result.value !== "string" && typeof result.value !== "number")
318
+ return this.failure(context, "enum values must be strings or numbers");
319
+ if (ts.isComputedPropertyName(member.name))
320
+ return this.failure(context, "computed enum names are not supported");
321
+ values[member.name.text] = previous = result.value;
322
+ }
323
+ return success(values);
324
+ }
325
+ return this.failure(
326
+ context,
327
+ `unsupported ${ts.SyntaxKind[node.kind]}; use literals, constants or supported enum members`
328
+ );
223
329
  }
224
330
  getInputResolver() {
225
- if (this.importResolver) {
226
- return this.importResolver;
227
- }
228
- return this.setImportResolver(new ImportResolver());
331
+ if (!this.importResolver) this.importResolver = new ImportResolver();
332
+ return this.importResolver.setBaseDir(path.dirname(this.file));
229
333
  }
230
334
  setImportResolver(resolver) {
231
335
  return this.importResolver = resolver.setBaseDir(path.dirname(this.file));
232
336
  }
233
337
  }
234
338
  export {
235
- EntryFile as default
339
+ SourceFile as default
236
340
  };
237
341
  //# sourceMappingURL=SourceFile.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/entrypoint/file/SourceFile.ts"],"sourcesContent":["import ts from \"typescript\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport {ImportResolver} from \"./resolvers\";\n\nimport injectors from \"./injectors\";\n\nimport {EnumMap, ImportMap, Variable, VariableMap} from \"./types\";\n\nexport default class EntryFile {\n private sourceFile?: ts.SourceFile;\n\n private variables?: VariableMap;\n\n private imports?: ImportMap;\n\n private enums?: EnumMap;\n\n protected importResolver?: ImportResolver;\n\n static make<T extends EntryFile>(this: new (file: string) => T, file: string): T {\n return new this(file);\n }\n\n constructor(protected readonly file: string) {}\n\n public getSourceFile(): ts.SourceFile {\n if (this.sourceFile) {\n return this.sourceFile;\n }\n\n const sourceCode = fs.readFileSync(this.file, \"utf8\");\n\n return (this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true));\n }\n\n public getImports(): ImportMap {\n if (this.imports) {\n return this.imports;\n }\n\n this.imports = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isImportDeclaration(node) && node.moduleSpecifier) {\n const importPath = (node.moduleSpecifier as ts.StringLiteral).text;\n if (node.importClause) {\n // default import: import X from '...'\n if (node.importClause.name) {\n this.imports?.set(node.importClause.name.text, this.getInputResolver().get(importPath));\n }\n // named imports: import { A, B } from '...'\n if (node.importClause.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {\n node.importClause.namedBindings.elements.forEach(el => {\n this.imports?.set(el.name.text, this.getInputResolver().get(importPath));\n });\n }\n }\n }\n // import equals: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {\n if (node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) {\n const importPath = node.moduleReference.expression.text;\n this.imports?.set(node.name.text, this.getInputResolver().get(importPath));\n }\n }\n // import equals with qualified name: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node)) {\n // For qualified names like chrome.tabs.Tab, we don't need to resolve a path\n // Just store the full qualified name as the \"import path\"\n const qualifiedName = node.moduleReference.getText();\n this.imports?.set(node.name.text, qualifiedName);\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.imports;\n }\n\n public getEnums(): EnumMap {\n if (this.enums) {\n return this.enums;\n }\n\n this.enums = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isEnumDeclaration(node)) {\n const enumName = node.name.text;\n const enumProperties: Map<string, string | number> = new Map();\n\n node.members.forEach(member => {\n const key = member.name.getText();\n const value = member.initializer ? member.initializer.getText().replace(/['\"]/g, \"\") : key;\n\n enumProperties.set(key, value);\n });\n\n this.enums?.set(enumName, enumProperties);\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.enums;\n }\n\n public getVariables(): VariableMap {\n if (this.variables) {\n return this.variables;\n }\n\n this.variables = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.ExportKeyword);\n\n node.declarationList.declarations.forEach(declaration => {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n const name = declaration.name.text;\n const value = this.parseNode(declaration.initializer);\n\n this.variables?.set(name, {\n name,\n value,\n exported: isExported || false,\n });\n }\n });\n }\n\n if (ts.isExportDeclaration(node) && node.exportClause && ts.isNamedExports(node.exportClause)) {\n node.exportClause.elements.forEach(el => {\n const name = el.name.text;\n\n if (this.variables?.has(name)) {\n const variable = this.variables?.get(name) as Variable;\n\n this.variables?.set(name, {\n name,\n value: variable.value,\n exported: true,\n });\n }\n });\n }\n\n if (ts.isExportAssignment(node)) {\n const expr = node.expression;\n if (ts.isIdentifier(expr) && this.variables?.has(expr.text)) {\n const variable = this.variables?.get(expr.text) as Variable;\n const name = \"default\";\n\n this.variables?.set(name, {\n name,\n value: variable.value,\n exported: true,\n });\n }\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.variables;\n }\n\n protected resolveValue(from: string, target: string, name: string): any {\n return injectors([])(from, target, name);\n }\n\n protected findPropertyAccessValue(property: ts.Node): any {\n if (ts.isPropertyAccessExpression(property)) {\n const objectName = property.expression.getText();\n const propertyName = property.name.getText();\n\n const varItem = this.getVariables().get(objectName);\n\n if (varItem) {\n return varItem.value;\n }\n\n const enumItem = this.getEnums().get(objectName);\n\n if (enumItem) {\n return enumItem.get(propertyName);\n }\n\n const importItem = this.getImports().get(objectName);\n\n if (importItem) {\n const resolverItem = this.resolveValue(importItem, objectName, propertyName);\n\n if (resolverItem) {\n return resolverItem;\n }\n\n return EntryFile.make(importItem).findPropertyAccessValue(property);\n }\n\n return `${objectName}.${propertyName}`;\n }\n\n return undefined;\n }\n\n public parseNode(node?: ts.Node): any {\n if (!node) {\n return undefined;\n }\n\n switch (node.kind) {\n case ts.SyntaxKind.StringLiteral:\n return (node as ts.StringLiteral).text;\n case ts.SyntaxKind.TrueKeyword:\n return true;\n case ts.SyntaxKind.FalseKeyword:\n return false;\n case ts.SyntaxKind.NullKeyword:\n return null;\n case ts.SyntaxKind.NumericLiteral:\n return parseFloat((node as ts.NumericLiteral).text);\n case ts.SyntaxKind.Identifier: {\n const id = node as ts.Identifier;\n const name = id.text;\n // local variable\n const local = this.variables?.get(name);\n if (local && local.value !== undefined) {\n return local.value;\n }\n // imported constant: try to resolve its value from source file\n const importPath = this.getImports().get(name);\n if (importPath) {\n // load imported file and check its variables\n const parser = EntryFile.make(importPath);\n const imported = parser.getVariables().get(name);\n if (imported && imported.value !== undefined) {\n return imported.value;\n }\n }\n return name;\n }\n case ts.SyntaxKind.ArrayLiteralExpression:\n return (node as ts.ArrayLiteralExpression).elements.map(element => this.parseNode(element));\n case ts.SyntaxKind.ObjectLiteralExpression:\n return (node as ts.ObjectLiteralExpression).properties\n .filter(\n (property): property is ts.PropertyAssignment | ts.ShorthandPropertyAssignment =>\n ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)\n )\n .reduce(\n (acc, property) => {\n if (ts.isComputedPropertyName(property.name)) {\n return acc;\n }\n\n const key = (property.name as ts.Identifier | ts.StringLiteral).text;\n\n // Determine the initializer node: for shorthand, use the identifier itself\n const initNode = ts.isShorthandPropertyAssignment(property)\n ? (property.name as ts.Identifier)\n : (property.initializer as ts.Expression | undefined);\n\n let value = this.parseNode(initNode);\n\n // If value is still just an identifier name, resolve from collected variables\n if (typeof value === \"string\" && this.variables?.has(value)) {\n value = this.variables?.get(value)?.value;\n }\n\n acc[key] = value;\n\n return acc;\n },\n {} as Record<string, any>\n );\n case ts.SyntaxKind.PropertyAccessExpression: {\n return this.findPropertyAccessValue(node);\n }\n default:\n return undefined;\n }\n }\n\n protected getInputResolver(): ImportResolver {\n if (this.importResolver) {\n return this.importResolver;\n }\n\n return this.setImportResolver(new ImportResolver());\n }\n\n public setImportResolver(resolver: ImportResolver): ImportResolver {\n return (this.importResolver = resolver.setBaseDir(path.dirname(this.file)));\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAQ,sBAAqB;AAE7B,OAAO,eAAe;AAItB,MAAO,UAAwB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EU,mBAAmC;AACzC,QAAI,KAAK,gBAAgB;AACrB,aAAO,KAAK;AAAA,IAChB;AAEA,WAAO,KAAK,kBAAkB,IAAI,eAAe,CAAC;AAAA,EACtD;AAAA,EAEO,kBAAkB,UAA0C;AAC/D,WAAQ,KAAK,iBAAiB,SAAS,WAAW,KAAK,QAAQ,KAAK,IAAI,CAAC;AAAA,EAC7E;AACJ;","names":["_a","_b","_c"]}
1
+ {"version":3,"sources":["../../../../src/cli/entrypoint/file/SourceFile.ts"],"sourcesContent":["import ts from \"typescript\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport {ImportResolver} from \"./resolvers\";\nimport injectors from \"./injectors\";\nimport type {\n ImportMap,\n VariableMap,\n SourceValue,\n SourceReadResult,\n SourceBinding,\n SourceReadContext,\n SourceResolvedBinding,\n} from \"./types\";\n\nexport default class SourceFile {\n private sourceFile?: ts.SourceFile;\n private variables?: VariableMap;\n private imports?: ImportMap;\n private sources = new Map<string, SourceFile>();\n protected importResolver?: ImportResolver;\n\n static make<T extends SourceFile>(this: new (file: string) => T, file: string): T {\n return new this(file);\n }\n\n constructor(protected readonly file: string) {}\n\n public getSourceFile(): ts.SourceFile {\n if (!this.sourceFile) {\n const sourceCode = fs.readFileSync(this.file, \"utf8\");\n this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true);\n }\n return this.sourceFile;\n }\n\n public getImports(): ImportMap {\n if (this.imports) {\n return this.imports;\n }\n\n this.imports = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isImportDeclaration(node) && node.moduleSpecifier) {\n const importPath = (node.moduleSpecifier as ts.StringLiteral).text;\n if (node.importClause) {\n // default import: import X from '...'\n if (node.importClause.name) {\n this.imports?.set(node.importClause.name.text, this.getInputResolver().get(importPath));\n }\n // named imports: import { A, B } from '...'\n if (node.importClause.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {\n node.importClause.namedBindings.elements.forEach(el => {\n this.imports?.set(el.name.text, this.getInputResolver().get(importPath));\n });\n }\n if (node.importClause.namedBindings && ts.isNamespaceImport(node.importClause.namedBindings)) {\n this.imports?.set(\n node.importClause.namedBindings.name.text,\n this.getInputResolver().get(importPath)\n );\n }\n }\n }\n // import equals: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {\n if (node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) {\n const importPath = node.moduleReference.expression.text;\n this.imports?.set(node.name.text, this.getInputResolver().get(importPath));\n }\n }\n // import equals with qualified name: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node)) {\n // For qualified names like chrome.tabs.Tab, we don't need to resolve a path\n // Just store the full qualified name as the \"import path\"\n const qualifiedName = node.moduleReference.getText();\n this.imports?.set(node.name.text, qualifiedName);\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.imports;\n }\n\n /** Collect declarations without evaluating runtime functions or unrelated initializers. */\n protected getBindings(exportedOnly = false): Map<string, SourceBinding> {\n const bindings = new Map<string, SourceBinding>();\n const bind = (name: string, node: ts.Node) => bindings.set(name, {source: this, node});\n for (const statement of this.getSourceFile().statements) {\n const exported =\n ts.canHaveModifiers(statement) &&\n ts.getModifiers(statement)?.some(item => item.kind === ts.SyntaxKind.ExportKeyword);\n if (ts.isVariableStatement(statement) && (!exportedOnly || exported)) {\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name)) bind(declaration.name.text, declaration);\n else {\n const collect = (node: ts.Node) => {\n if (ts.isBindingElement(node) && ts.isIdentifier(node.name)) bind(node.name.text, node);\n else ts.forEachChild(node, collect);\n };\n collect(declaration.name);\n }\n }\n } else if (\n (ts.isEnumDeclaration(statement) ||\n ts.isFunctionDeclaration(statement) ||\n ts.isClassDeclaration(statement)) &&\n (!exportedOnly || exported) &&\n statement.name\n ) {\n const isDefault = ts.getModifiers(statement)?.some(item => item.kind === ts.SyntaxKind.DefaultKeyword);\n bind(exportedOnly && isDefault ? \"default\" : statement.name.text, statement);\n }\n if (exportedOnly && ts.isExportAssignment(statement) && !statement.isExportEquals) {\n bind(\"default\", statement.expression);\n }\n if (\n exportedOnly &&\n ts.isExportDeclaration(statement) &&\n !statement.isTypeOnly &&\n statement.exportClause &&\n ts.isNamedExports(statement.exportClause)\n ) {\n for (const item of statement.exportClause.elements) {\n if (!item.isTypeOnly)\n bind(item.name.text, statement.moduleSpecifier ? item : (item.propertyName ?? item.name));\n }\n }\n }\n return bindings;\n }\n\n public getVariables(): VariableMap {\n if (this.variables) return this.variables;\n const locals = this.getBindings();\n const exported = this.getBindings(true);\n this.variables = new Map();\n for (const [name, binding] of new Map([...locals, ...exported])) {\n const result = this.parseNode(binding.node, name);\n // Signature inference can use known values without requiring executable code to be static.\n this.variables.set(name, {\n name,\n value: result.resolved ? result.value : undefined,\n exported: exported.has(name),\n });\n }\n return this.variables;\n }\n\n protected resolveValue(from: string, target: string, name: string): any {\n return injectors([])(from, target, name);\n }\n\n private getImportBinding(name: string): {from: string; name: string} | undefined {\n for (const statement of this.getSourceFile().statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;\n const clause = statement.importClause;\n const from = statement.moduleSpecifier.text;\n if (clause?.name?.text === name) return {from, name: \"default\"};\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n const item = clause.namedBindings.elements.find(item => item.name.text === name);\n if (item) return {from, name: (item.propertyName ?? item.name).text};\n }\n if (\n clause?.namedBindings &&\n ts.isNamespaceImport(clause.namedBindings) &&\n clause.namedBindings.name.text === name\n )\n return {from, name: \"*\"};\n }\n }\n\n private getImportedSource(from: string): SourceFile | undefined {\n const filename = this.getInputResolver().get(from);\n if (!filename || !path.isAbsolute(filename) || !/\\.[cm]?[jt]sx?$/.test(filename) || !fs.existsSync(filename))\n return;\n let source = this.sources.get(filename);\n if (!source) {\n source = new SourceFile(filename);\n source.setImportResolver(this.getInputResolver());\n source.sources = this.sources;\n this.sources.set(filename, source);\n }\n return source;\n }\n\n private failure(context: SourceReadContext, reason: string): SourceReadResult<never> {\n return {resolved: false, file: this.file, path: context.path, reason};\n }\n\n /** Follow static bindings, retaining their source module and detecting reference cycles. */\n private resolveNode(\n node: ts.Node | undefined,\n context: SourceReadContext\n ): SourceReadResult<SourceResolvedBinding> {\n if (!node) return this.failure(context, \"missing initializer\");\n const key = `${this.file}:${node.pos}:${node.end}`;\n if (context.seen.has(key)) return this.failure(context, \"circular reference\");\n context = {...context, seen: new Set([...context.seen, key])};\n if (\n ts.isAsExpression(node) ||\n ts.isTypeAssertionExpression(node) ||\n ts.isSatisfiesExpression(node) ||\n ts.isParenthesizedExpression(node) ||\n ts.isNonNullExpression(node)\n ) {\n return this.resolveNode(node.expression, context);\n }\n if (ts.isVariableDeclaration(node)) {\n if (!ts.isVariableDeclarationList(node.parent) || !(node.parent.flags & ts.NodeFlags.Const))\n return this.failure(context, \"use a const declaration for build options\");\n return this.resolveNode(node.initializer, context);\n }\n if (ts.isExportSpecifier(node) && ts.isExportDeclaration(node.parent.parent)) {\n const from = node.parent.parent.moduleSpecifier;\n const name = (node.propertyName ?? node.name).text;\n const binding =\n from && ts.isStringLiteral(from)\n ? this.getImportedSource(from.text)?.getBindings(true).get(name)\n : undefined;\n if (binding) return binding.source.resolveNode(binding.node, context);\n return this.failure(context, `cannot resolve re-exported value ${name}`);\n }\n if (ts.isIdentifier(node)) {\n const local = this.getBindings().get(node.text);\n if (local) return local.source.resolveNode(local.node, context);\n const imported = this.getImportBinding(node.text);\n if (imported) {\n const source = this.getImportedSource(imported.from);\n const binding = source?.getBindings(true).get(imported.name);\n if (binding) return binding.source.resolveNode(binding.node, context);\n return this.failure(context, `cannot resolve imported value ${node.text}`);\n }\n if (node.text !== \"undefined\") return this.failure(context, `unresolved identifier ${node.text}`);\n }\n return {resolved: true, value: {source: this, node, context}};\n }\n\n public parseNode(node?: ts.Node, property = \"\"): SourceReadResult {\n return this.readValue(node, {path: property, seen: new Set()});\n }\n\n /** Read an object's shape first so callers can select build fields before evaluating values. */\n protected getProperties(node: ts.Node, property = \"\"): SourceReadResult<Map<string, SourceBinding>> {\n return this.readProperties(node, {path: property, seen: new Set()});\n }\n\n private readProperties(node: ts.Node, context: SourceReadContext): SourceReadResult<Map<string, SourceBinding>> {\n const result = this.resolveNode(node, context);\n if (!result.resolved) return result;\n const binding = result.value;\n if (!ts.isObjectLiteralExpression(binding.node))\n return binding.source.failure(binding.context, \"expected a static object\");\n return binding.source.objectProperties(binding.node, binding.context);\n }\n\n private objectProperties(\n node: ts.ObjectLiteralExpression,\n context: SourceReadContext\n ): SourceReadResult<Map<string, SourceBinding>> {\n const properties = new Map<string, SourceBinding>();\n for (const property of node.properties) {\n if (ts.isSpreadAssignment(property)) {\n const spread = this.readProperties(property.expression, context);\n if (!spread.resolved) return spread;\n for (const [key, binding] of spread.value) properties.set(key, binding);\n continue;\n }\n let key: string;\n if (ts.isComputedPropertyName(property.name)) {\n const result = this.readValue(property.name.expression, context);\n if (!result.resolved) return result;\n if (typeof result.value !== \"string\" && typeof result.value !== \"number\")\n return this.failure(context, \"object keys must be strings or numbers\");\n key = String(result.value);\n } else {\n key = property.name.text;\n }\n properties.set(key, {\n source: this,\n node: ts.isPropertyAssignment(property)\n ? property.initializer\n : ts.isShorthandPropertyAssignment(property)\n ? property.name\n : property,\n });\n }\n return {resolved: true, value: properties};\n }\n\n private readValue(node: ts.Node | undefined, context: SourceReadContext): SourceReadResult {\n const resolved = this.resolveNode(node, context);\n if (!resolved.resolved) return resolved;\n const binding = resolved.value;\n return binding.source.readResolvedValue(binding.node, binding.context);\n }\n\n private readResolvedValue(node: ts.Node, context: SourceReadContext): SourceReadResult {\n const success = (value: SourceValue): SourceReadResult => ({resolved: true, value});\n if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return success(node.text);\n if (ts.isNumericLiteral(node)) return success(Number(node.text));\n if (node.kind === ts.SyntaxKind.TrueKeyword) return success(true);\n if (node.kind === ts.SyntaxKind.FalseKeyword) return success(false);\n if (node.kind === ts.SyntaxKind.NullKeyword) return success(null);\n if (ts.isIdentifier(node) && node.text === \"undefined\") return success(undefined);\n if (ts.isPrefixUnaryExpression(node)) {\n const operand = this.readValue(node.operand, context);\n if (!operand.resolved) return operand;\n if (\n typeof operand.value === \"number\" &&\n (node.operator === ts.SyntaxKind.MinusToken || node.operator === ts.SyntaxKind.PlusToken)\n )\n return success(node.operator === ts.SyntaxKind.MinusToken ? -operand.value : operand.value);\n return this.failure(context, \"unsupported unary expression\");\n }\n if (ts.isArrayLiteralExpression(node)) {\n const values: SourceValue[] = [];\n for (const [index, element] of node.elements.entries()) {\n const result = this.readValue(ts.isSpreadElement(element) ? element.expression : element, {\n ...context,\n path: `${context.path}[${index}]`,\n });\n if (!result.resolved) return result;\n if (ts.isSpreadElement(element)) {\n if (!Array.isArray(result.value))\n return this.failure(context, \"array spread must reference a static array\");\n values.push(...result.value);\n } else values.push(result.value);\n }\n return success(values);\n }\n if (ts.isObjectLiteralExpression(node)) {\n const properties = this.objectProperties(node, context);\n if (!properties.resolved) return properties;\n const values: [string, SourceValue][] = [];\n for (const [key, binding] of properties.value) {\n const result = binding.source.readValue(binding.node, {\n ...context,\n path: context.path ? `${context.path}.${key}` : key,\n });\n if (!result.resolved) return result;\n values.push([key, result.value]);\n }\n return success(Object.fromEntries(values));\n }\n if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {\n const property = ts.isPropertyAccessExpression(node)\n ? success(node.name.text)\n : this.readValue(node.argumentExpression, context);\n if (!property.resolved) return property;\n if (typeof property.value !== \"string\" && typeof property.value !== \"number\")\n return this.failure(context, \"member name must be a string or number\");\n const name = String(property.value);\n if (ts.isIdentifier(node.expression) && !this.getBindings().has(node.expression.text)) {\n const imported = this.getImportBinding(node.expression.text);\n if (imported) {\n const value = this.resolveValue(imported.from, imported.name, name);\n if (value !== undefined) return success(value);\n if (imported.name === \"*\") {\n const binding = this.getImportedSource(imported.from)?.getBindings(true).get(name);\n if (binding) return binding.source.readValue(binding.node, context);\n }\n }\n }\n const resolved = this.resolveNode(node.expression, context);\n if (!resolved.resolved) return resolved;\n const binding = resolved.value;\n if (ts.isObjectLiteralExpression(binding.node)) {\n const properties = binding.source.objectProperties(binding.node, binding.context);\n if (!properties.resolved) return properties;\n const member = properties.value.get(name);\n if (member) return member.source.readValue(member.node, binding.context);\n return this.failure(context, `unknown member ${name}`);\n }\n const object = binding.source.readResolvedValue(binding.node, binding.context);\n if (!object.resolved) return object;\n if (object.value !== null && typeof object.value === \"object\" && Object.hasOwn(object.value, name))\n return success((object.value as Record<string, SourceValue>)[name]);\n return this.failure(context, `unknown member ${name}`);\n }\n if (ts.isEnumDeclaration(node)) {\n const values: Record<string, SourceValue> = {};\n let previous: SourceValue = -1;\n for (const member of node.members) {\n const result = member.initializer\n ? this.readValue(member.initializer, context)\n : typeof previous === \"number\"\n ? success(previous + 1)\n : this.failure(context, \"enum member needs a static initializer\");\n if (!result.resolved) return result;\n if (typeof result.value !== \"string\" && typeof result.value !== \"number\")\n return this.failure(context, \"enum values must be strings or numbers\");\n if (ts.isComputedPropertyName(member.name))\n return this.failure(context, \"computed enum names are not supported\");\n values[member.name.text] = previous = result.value;\n }\n return success(values);\n }\n return this.failure(\n context,\n `unsupported ${ts.SyntaxKind[node.kind]}; use literals, constants or supported enum members`\n );\n }\n\n protected getInputResolver(): ImportResolver {\n if (!this.importResolver) this.importResolver = new ImportResolver();\n return this.importResolver.setBaseDir(path.dirname(this.file));\n }\n\n public setImportResolver(resolver: ImportResolver): ImportResolver {\n return (this.importResolver = resolver.setBaseDir(path.dirname(this.file)));\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAQ,sBAAqB;AAC7B,OAAO,eAAe;AAWtB,MAAO,WAAyB;AAAA,EAW5B,YAA+B,MAAc;AAAd;AAAA,EAAe;AAAA,EAAf;AAAA,EAVvB;AAAA,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AAO,KAAK,QAAQ,SAAS,wCAAwC;AACzE,YAAI,GAAG,uBAAuB,OAAO,IAAI;AACrC,iBAAO,KAAK,QAAQ,SAAS,uCAAuC;AACxE,eAAO,OAAO,KAAK,IAAI,IAAI,WAAW,OAAO;AAAA,MACjD;AACA,aAAO,QAAQ,MAAM;AAAA,IACzB;AACA,WAAO,KAAK;AAAA,MACR;AAAA,MACA,eAAe,GAAG,WAAW,KAAK,IAAI,CAAC;AAAA,IAC3C;AAAA,EACJ;AAAA,EAEU,mBAAmC;AACzC,QAAI,CAAC,KAAK,eAAgB,MAAK,iBAAiB,IAAI,eAAe;AACnE,WAAO,KAAK,eAAe,WAAW,KAAK,QAAQ,KAAK,IAAI,CAAC;AAAA,EACjE;AAAA,EAEO,kBAAkB,UAA0C;AAC/D,WAAQ,KAAK,iBAAiB,SAAS,WAAW,KAAK,QAAQ,KAAK,IAAI,CAAC;AAAA,EAC7E;AACJ;","names":["_a","item","key","binding"]}
@@ -2,3 +2,5 @@ export { default as OptionFile } from "./OptionFile.js";
2
2
  export { default as SourceFile } from "./SourceFile.js";
3
3
  export { default as ExpressionFile } from "./ExpressionFile.js";
4
4
  export * from "./resolvers/index.js";
5
+ export { ExportValueKind } from "./parsers/types.js";
6
+ export type { ExportValue } from "./parsers/types.js";
@@ -2,7 +2,9 @@ import { default as default2 } from "./OptionFile.js";
2
2
  import { default as default3 } from "./SourceFile.js";
3
3
  import { default as default4 } from "./ExpressionFile.js";
4
4
  export * from "./resolvers/index.js";
5
+ import { ExportValueKind } from "./parsers/types.js";
5
6
  export {
7
+ ExportValueKind,
6
8
  default4 as ExpressionFile,
7
9
  default2 as OptionFile,
8
10
  default3 as SourceFile
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/entrypoint/file/index.ts"],"sourcesContent":["export {default as OptionFile} from \"./OptionFile\";\nexport {default as SourceFile} from \"./SourceFile\";\nexport {default as ExpressionFile} from \"./ExpressionFile\";\nexport * from \"./resolvers\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAAgC;AACxC,cAAc;","names":["default"]}
1
+ {"version":3,"sources":["../../../../src/cli/entrypoint/file/index.ts"],"sourcesContent":["export {default as OptionFile} from \"./OptionFile\";\nexport {default as SourceFile} from \"./SourceFile\";\nexport {default as ExpressionFile} from \"./ExpressionFile\";\nexport * from \"./resolvers\";\nexport {ExportValueKind} from \"./parsers/types\";\nexport type {ExportValue} from \"./parsers/types\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAAgC;AACxC,cAAc;AACd,SAAQ,uBAAsB;","names":["default"]}