adnbn 0.5.7 → 0.6.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 (497) hide show
  1. package/dist/cli/builders/app/command.d.ts +3 -6
  2. package/dist/cli/builders/app/index.d.ts +2 -14
  3. package/dist/cli/builders/locale/FirefoxLocaleValidator.d.ts +4 -7
  4. package/dist/cli/builders/locale/LocaleBuilder.d.ts +3 -6
  5. package/dist/cli/builders/locale/LocaleBuilder.js +3 -1
  6. package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
  7. package/dist/cli/builders/locale/LocaleStructureValidator.d.ts +8 -0
  8. package/dist/cli/builders/locale/LocaleStructureValidator.js +64 -0
  9. package/dist/cli/builders/locale/LocaleStructureValidator.js.map +1 -0
  10. package/dist/cli/builders/locale/LocaleValidator.d.ts +4 -7
  11. package/dist/cli/builders/locale/LocaleValidator.js +2 -0
  12. package/dist/cli/builders/locale/LocaleValidator.js.map +1 -1
  13. package/dist/cli/builders/locale/OperaLocaleValidator.d.ts +4 -7
  14. package/dist/cli/builders/locale/index.d.ts +10 -19
  15. package/dist/cli/builders/locale/index.js +2 -0
  16. package/dist/cli/builders/locale/index.js.map +1 -1
  17. package/dist/cli/builders/manifest/ManifestBase.d.ts +30 -18
  18. package/dist/cli/builders/manifest/ManifestBase.js +212 -70
  19. package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
  20. package/dist/cli/builders/manifest/ManifestV2.d.ts +5 -12
  21. package/dist/cli/builders/manifest/ManifestV2.js +8 -7
  22. package/dist/cli/builders/manifest/ManifestV2.js.map +1 -1
  23. package/dist/cli/builders/manifest/ManifestV3.d.ts +5 -12
  24. package/dist/cli/builders/manifest/ManifestV3.js +9 -6
  25. package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
  26. package/dist/cli/builders/manifest/index.d.ts +3 -14
  27. package/dist/cli/builders/manifest/utils.d.ts +10 -15
  28. package/dist/cli/builders/manifest/utils.js +14 -2
  29. package/dist/cli/builders/manifest/utils.js.map +1 -1
  30. package/dist/cli/bundler/index.d.ts +2 -16
  31. package/dist/cli/bundler/plugins/EntrypointPlugin.d.ts +10 -19
  32. package/dist/cli/bundler/plugins/EntrypointPlugin.js +1 -0
  33. package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +1 -1
  34. package/dist/cli/bundler/plugins/GenerateJsonPlugin.d.ts +5 -7
  35. package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +1 -0
  36. package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +1 -1
  37. package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +3 -11
  38. package/dist/cli/bundler/plugins/ManifestPlugin.js +1 -0
  39. package/dist/cli/bundler/plugins/ManifestPlugin.js.map +1 -1
  40. package/dist/cli/bundler/plugins/ReplacePlugin.d.ts +3 -5
  41. package/dist/cli/bundler/plugins/ReplacePlugin.js +1 -0
  42. package/dist/cli/bundler/plugins/ReplacePlugin.js.map +1 -1
  43. package/dist/cli/bundler/plugins/WatchPlugin.d.ts +3 -6
  44. package/dist/cli/bundler/plugins/WatchPlugin.js +1 -0
  45. package/dist/cli/bundler/plugins/WatchPlugin.js.map +1 -1
  46. package/dist/cli/bundler/plugins/index.d.ts +5 -14
  47. package/dist/cli/bundler/utils/index.d.ts +2 -3
  48. package/dist/cli/bundler/utils/optimization.d.ts +2 -5
  49. package/dist/cli/bundler/utils/output.d.ts +2 -5
  50. package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -10
  51. package/dist/cli/entrypoint/file/OptionFile.d.ts +3 -9
  52. package/dist/cli/entrypoint/file/SourceFile.d.ts +7 -11
  53. package/dist/cli/entrypoint/file/SourceFile.js +1 -0
  54. package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
  55. package/dist/cli/entrypoint/file/index.d.ts +4 -8
  56. package/dist/cli/entrypoint/file/injectors/core.d.ts +2 -4
  57. package/dist/cli/entrypoint/file/injectors/index.d.ts +2 -4
  58. package/dist/cli/entrypoint/file/parsers/AbstractParser.d.ts +6 -12
  59. package/dist/cli/entrypoint/file/parsers/AbstractParser.js +1 -0
  60. package/dist/cli/entrypoint/file/parsers/AbstractParser.js.map +1 -1
  61. package/dist/cli/entrypoint/file/parsers/ClassParser.d.ts +9 -15
  62. package/dist/cli/entrypoint/file/parsers/ClassParser.js +3 -0
  63. package/dist/cli/entrypoint/file/parsers/ClassParser.js.map +1 -1
  64. package/dist/cli/entrypoint/file/parsers/FunctionParser.d.ts +9 -17
  65. package/dist/cli/entrypoint/file/parsers/FunctionParser.js +3 -0
  66. package/dist/cli/entrypoint/file/parsers/FunctionParser.js.map +1 -1
  67. package/dist/cli/entrypoint/file/parsers/JSDocParser.d.ts +2 -5
  68. package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +4 -10
  69. package/dist/cli/entrypoint/file/parsers/NodeFinder.js +1 -0
  70. package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
  71. package/dist/cli/entrypoint/file/parsers/ObjectParser.d.ts +7 -15
  72. package/dist/cli/entrypoint/file/parsers/ObjectParser.js +1 -0
  73. package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
  74. package/dist/cli/entrypoint/file/parsers/SignatureBuilder.d.ts +4 -12
  75. package/dist/cli/entrypoint/file/parsers/SignatureBuilder.js +5 -4
  76. package/dist/cli/entrypoint/file/parsers/SignatureBuilder.js.map +1 -1
  77. package/dist/cli/entrypoint/file/parsers/TypeResolver.d.ts +5 -11
  78. package/dist/cli/entrypoint/file/parsers/TypeResolver.js +2 -0
  79. package/dist/cli/entrypoint/file/parsers/TypeResolver.js.map +1 -1
  80. package/dist/cli/entrypoint/file/parsers/helpers/memberFilters.d.ts +1 -3
  81. package/dist/cli/entrypoint/file/parsers/index.d.ts +7 -14
  82. package/dist/cli/entrypoint/file/parsers/types.d.ts +4 -6
  83. package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +2 -6
  84. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +1 -0
  85. package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
  86. package/dist/cli/entrypoint/file/resolvers/TsResolver.d.ts +2 -5
  87. package/dist/cli/entrypoint/file/resolvers/index.d.ts +2 -3
  88. package/dist/cli/entrypoint/file/types.d.ts +5 -7
  89. package/dist/cli/entrypoint/finder/AbstractAssetFinder.d.ts +3 -16
  90. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.d.ts +4 -17
  91. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js +22 -17
  92. package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
  93. package/dist/cli/entrypoint/finder/AbstractFinder.d.ts +4 -15
  94. package/dist/cli/entrypoint/finder/AbstractFinder.js +7 -2
  95. package/dist/cli/entrypoint/finder/AbstractFinder.js.map +1 -1
  96. package/dist/cli/entrypoint/finder/AbstractOptionsFinder.d.ts +3 -16
  97. package/dist/cli/entrypoint/finder/AbstractPluginFinder.d.ts +3 -18
  98. package/dist/cli/entrypoint/finder/AbstractTransportFinder.d.ts +9 -26
  99. package/dist/cli/entrypoint/finder/AbstractViewFinder.d.ts +9 -24
  100. package/dist/cli/entrypoint/finder/AssetPluginFinder.d.ts +8 -19
  101. package/dist/cli/entrypoint/finder/AssetPluginFinder.js +2 -0
  102. package/dist/cli/entrypoint/finder/AssetPluginFinder.js.map +1 -1
  103. package/dist/cli/entrypoint/finder/BackgroundFinder.d.ts +5 -19
  104. package/dist/cli/entrypoint/finder/CommandFinder.d.ts +7 -22
  105. package/dist/cli/entrypoint/finder/ContentFinder.d.ts +5 -19
  106. package/dist/cli/entrypoint/finder/IconFinder.d.ts +12 -25
  107. package/dist/cli/entrypoint/finder/LocaleFinder.d.ts +14 -22
  108. package/dist/cli/entrypoint/finder/LocaleFinder.js +23 -9
  109. package/dist/cli/entrypoint/finder/LocaleFinder.js.map +1 -1
  110. package/dist/cli/entrypoint/finder/OffscreenFinder.d.ts +5 -26
  111. package/dist/cli/entrypoint/finder/OffscreenViewFinder.d.ts +8 -29
  112. package/dist/cli/entrypoint/finder/OffscreenViewFinder.js +1 -0
  113. package/dist/cli/entrypoint/finder/OffscreenViewFinder.js.map +1 -1
  114. package/dist/cli/entrypoint/finder/PageFinder.d.ts +5 -22
  115. package/dist/cli/entrypoint/finder/PluginFinder.d.ts +7 -19
  116. package/dist/cli/entrypoint/finder/PluginFinder.js +2 -0
  117. package/dist/cli/entrypoint/finder/PluginFinder.js.map +1 -1
  118. package/dist/cli/entrypoint/finder/PopupFinder.d.ts +5 -22
  119. package/dist/cli/entrypoint/finder/RelayFinder.d.ts +5 -25
  120. package/dist/cli/entrypoint/finder/ServiceFinder.d.ts +5 -25
  121. package/dist/cli/entrypoint/finder/SidebarFinder.d.ts +5 -22
  122. package/dist/cli/entrypoint/finder/index.d.ts +18 -43
  123. package/dist/cli/entrypoint/index.d.ts +4 -64
  124. package/dist/cli/entrypoint/name/InlineNameGenerator.d.ts +2 -12
  125. package/dist/cli/entrypoint/name/NameGenerator.d.ts +2 -11
  126. package/dist/cli/entrypoint/name/NameGenerator.js +1 -0
  127. package/dist/cli/entrypoint/name/NameGenerator.js.map +1 -1
  128. package/dist/cli/entrypoint/name/index.d.ts +2 -9
  129. package/dist/cli/entrypoint/parser/AbstractParser.d.ts +14 -29
  130. package/dist/cli/entrypoint/parser/AbstractParser.js +1 -0
  131. package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
  132. package/dist/cli/entrypoint/parser/BackgroundParser.d.ts +3 -23
  133. package/dist/cli/entrypoint/parser/CommandParser.d.ts +4 -24
  134. package/dist/cli/entrypoint/parser/CommandParser.js +20 -5
  135. package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
  136. package/dist/cli/entrypoint/parser/ContentParser.d.ts +4 -23
  137. package/dist/cli/entrypoint/parser/OffscreenParser.d.ts +3 -28
  138. package/dist/cli/entrypoint/parser/PageParser.d.ts +3 -26
  139. package/dist/cli/entrypoint/parser/PopupParser.d.ts +3 -26
  140. package/dist/cli/entrypoint/parser/RelayParser.d.ts +4 -27
  141. package/dist/cli/entrypoint/parser/ServiceParser.d.ts +3 -27
  142. package/dist/cli/entrypoint/parser/SidebarParser.d.ts +3 -26
  143. package/dist/cli/entrypoint/parser/ViewParser.d.ts +60 -80
  144. package/dist/cli/entrypoint/parser/index.d.ts +9 -38
  145. package/dist/cli/entrypoint/utils/framework.d.ts +3 -12
  146. package/dist/cli/entrypoint/utils/index.d.ts +2 -10
  147. package/dist/cli/entrypoint/utils/resolve.d.ts +3 -5
  148. package/dist/cli/index.d.ts +1 -2
  149. package/dist/cli/plugins/asset.d.ts +2 -15
  150. package/dist/cli/plugins/background/Background.d.ts +4 -21
  151. package/dist/cli/plugins/background/BackgroundEntry.d.ts +7 -21
  152. package/dist/cli/plugins/background/BackgroundEntry.js +1 -0
  153. package/dist/cli/plugins/background/BackgroundEntry.js.map +1 -1
  154. package/dist/cli/plugins/background/BackgroundManifest.d.ts +5 -21
  155. package/dist/cli/plugins/background/Command.d.ts +6 -23
  156. package/dist/cli/plugins/background/Service.d.ts +5 -27
  157. package/dist/cli/plugins/background/ServiceDeclaration.d.ts +3 -17
  158. package/dist/cli/plugins/background/index.d.ts +2 -15
  159. package/dist/cli/plugins/bundler.d.ts +2 -15
  160. package/dist/cli/plugins/content/Content.d.ts +9 -24
  161. package/dist/cli/plugins/content/ContentDriver.d.ts +7 -22
  162. package/dist/cli/plugins/content/ContentDriver.js +1 -0
  163. package/dist/cli/plugins/content/ContentDriver.js.map +1 -1
  164. package/dist/cli/plugins/content/ContentManager.d.ts +8 -19
  165. package/dist/cli/plugins/content/ContentName.d.ts +5 -17
  166. package/dist/cli/plugins/content/ContentName.js +1 -0
  167. package/dist/cli/plugins/content/ContentName.js.map +1 -1
  168. package/dist/cli/plugins/content/Relay.d.ts +9 -30
  169. package/dist/cli/plugins/content/RelayDeclaration.d.ts +3 -17
  170. package/dist/cli/plugins/content/index.d.ts +2 -15
  171. package/dist/cli/plugins/content/types.d.ts +8 -16
  172. package/dist/cli/plugins/content/utils.d.ts +2 -11
  173. package/dist/cli/plugins/dotenv/index.d.ts +3 -16
  174. package/dist/cli/plugins/dotenv/utils.d.ts +4 -7
  175. package/dist/cli/plugins/html.d.ts +2 -15
  176. package/dist/cli/plugins/icon/Icon.d.ts +6 -22
  177. package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +3 -16
  178. package/dist/cli/plugins/icon/declaration/index.d.ts +1 -13
  179. package/dist/cli/plugins/icon/index.d.ts +4 -21
  180. package/dist/cli/plugins/index.d.ts +22 -58
  181. package/dist/cli/plugins/index.js +32 -30
  182. package/dist/cli/plugins/index.js.map +1 -1
  183. package/dist/cli/plugins/locale/Locale.d.ts +3 -20
  184. package/dist/cli/plugins/locale/declaration/LocaleDeclaration.d.ts +4 -16
  185. package/dist/cli/plugins/locale/declaration/index.d.ts +1 -13
  186. package/dist/cli/plugins/locale/declaration/locale.d.ts +61 -11
  187. package/dist/cli/plugins/locale/index.d.ts +2 -15
  188. package/dist/cli/plugins/locale/index.js +44 -49
  189. package/dist/cli/plugins/locale/index.js.map +1 -1
  190. package/dist/cli/plugins/manifest.d.ts +2 -0
  191. package/dist/cli/plugins/manifest.js +27 -0
  192. package/dist/cli/plugins/manifest.js.map +1 -0
  193. package/dist/cli/plugins/meta/AbstractMeta.d.ts +2 -15
  194. package/dist/cli/plugins/meta/AbstractMeta.js +1 -0
  195. package/dist/cli/plugins/meta/AbstractMeta.js.map +1 -1
  196. package/dist/cli/plugins/meta/Author.d.ts +3 -16
  197. package/dist/cli/plugins/meta/Homepage.d.ts +3 -16
  198. package/dist/cli/plugins/meta/Incognito.d.ts +4 -16
  199. package/dist/cli/plugins/meta/SpecificSettings.d.ts +4 -16
  200. package/dist/cli/plugins/meta/index.d.ts +7 -20
  201. package/dist/cli/plugins/offscreen/Offscreen.d.ts +11 -35
  202. package/dist/cli/plugins/offscreen/OffscreenDeclaration.d.ts +3 -17
  203. package/dist/cli/plugins/offscreen/index.d.ts +2 -15
  204. package/dist/cli/plugins/optimization.d.ts +2 -15
  205. package/dist/cli/plugins/output.d.ts +2 -15
  206. package/dist/cli/plugins/page/Page.d.ts +8 -26
  207. package/dist/cli/plugins/page/declaration/PageDeclaration.d.ts +3 -16
  208. package/dist/cli/plugins/page/declaration/index.d.ts +1 -13
  209. package/dist/cli/plugins/page/index.d.ts +2 -15
  210. package/dist/cli/plugins/popup/Popup.d.ts +9 -27
  211. package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +3 -16
  212. package/dist/cli/plugins/popup/declaration/index.d.ts +1 -13
  213. package/dist/cli/plugins/popup/index.d.ts +2 -15
  214. package/dist/cli/plugins/public.d.ts +2 -15
  215. package/dist/cli/plugins/react.d.ts +2 -15
  216. package/dist/cli/plugins/sidebar/Sidebar.d.ts +9 -27
  217. package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +3 -16
  218. package/dist/cli/plugins/sidebar/declaration/index.d.ts +1 -13
  219. package/dist/cli/plugins/sidebar/index.d.ts +2 -15
  220. package/dist/cli/plugins/style.d.ts +2 -15
  221. package/dist/cli/plugins/typescript/FileBuilder.d.ts +2 -15
  222. package/dist/cli/plugins/typescript/FileBuilder.js +1 -0
  223. package/dist/cli/plugins/typescript/FileBuilder.js.map +1 -1
  224. package/dist/cli/plugins/typescript/TypescriptConfig.d.ts +4 -17
  225. package/dist/cli/plugins/typescript/declaration/index.d.ts +2 -14
  226. package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.d.ts +4 -17
  227. package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.js +1 -0
  228. package/dist/cli/plugins/typescript/declaration/transport/TransportDeclaration.js.map +1 -1
  229. package/dist/cli/plugins/typescript/declaration/transport/index.d.ts +1 -13
  230. package/dist/cli/plugins/typescript/declaration/vendor/VendorDeclaration.d.ts +3 -16
  231. package/dist/cli/plugins/typescript/declaration/vendor/index.d.ts +1 -13
  232. package/dist/cli/plugins/typescript/index.d.ts +6 -20
  233. package/dist/cli/plugins/version/AbstractVersion.d.ts +2 -15
  234. package/dist/cli/plugins/version/AbstractVersion.js +2 -1
  235. package/dist/cli/plugins/version/AbstractVersion.js.map +1 -1
  236. package/dist/cli/plugins/version/AddonVersion.d.ts +3 -16
  237. package/dist/cli/plugins/version/BrowserMinimumVersion.d.ts +3 -16
  238. package/dist/cli/plugins/version/index.d.ts +5 -18
  239. package/dist/cli/plugins/view/View.d.ts +10 -24
  240. package/dist/cli/plugins/view/View.js +2 -0
  241. package/dist/cli/plugins/view/View.js.map +1 -1
  242. package/dist/cli/plugins/view/index.d.ts +3 -22
  243. package/dist/cli/resolvers/bundler.d.ts +4 -15
  244. package/dist/cli/resolvers/config.d.ts +2 -14
  245. package/dist/cli/resolvers/config.js +45 -6
  246. package/dist/cli/resolvers/config.js.map +1 -1
  247. package/dist/cli/resolvers/path.d.ts +11 -24
  248. package/dist/cli/resolvers/plugin.d.ts +3 -16
  249. package/dist/cli/utils/fs.d.ts +3 -5
  250. package/dist/cli/utils/path.d.ts +3 -5
  251. package/dist/cli/utils/string.d.ts +2 -4
  252. package/dist/cli/virtual/background.d.ts +1 -0
  253. package/dist/cli/virtual/command.d.ts +1 -0
  254. package/dist/cli/virtual/content.d.ts +1 -0
  255. package/dist/cli/virtual/index.d.ts +9 -0
  256. package/dist/cli/virtual/index.js +2 -2
  257. package/dist/cli/virtual/offscreen.background.d.ts +1 -0
  258. package/dist/cli/virtual/offscreen.d.ts +1 -0
  259. package/dist/cli/virtual/relay.d.ts +1 -0
  260. package/dist/cli/virtual/transport.d.ts +1 -0
  261. package/dist/cli/virtual/view.d.ts +1 -0
  262. package/dist/cli/virtual/virtual.d.ts +38 -38
  263. package/dist/entry/background/Builder.d.ts +3 -12
  264. package/dist/entry/background/Builder.js +1 -0
  265. package/dist/entry/background/Builder.js.map +1 -1
  266. package/dist/entry/background/index.d.ts +3 -12
  267. package/dist/entry/background/resolvers/definition.d.ts +3 -12
  268. package/dist/entry/background/resolvers/index.d.ts +1 -8
  269. package/dist/entry/command/Builder.d.ts +4 -12
  270. package/dist/entry/command/index.d.ts +3 -12
  271. package/dist/entry/command/resolvers/definition.d.ts +4 -13
  272. package/dist/entry/command/resolvers/index.d.ts +1 -8
  273. package/dist/entry/content/adapters/react/Builder.d.ts +3 -17
  274. package/dist/entry/content/adapters/react/Node.d.ts +6 -14
  275. package/dist/entry/content/adapters/react/Node.js +2 -0
  276. package/dist/entry/content/adapters/react/Node.js.map +1 -1
  277. package/dist/entry/content/adapters/react/index.d.ts +4 -18
  278. package/dist/entry/content/adapters/react/resolvers/index.d.ts +1 -8
  279. package/dist/entry/content/adapters/react/resolvers/render.d.ts +2 -11
  280. package/dist/entry/content/adapters/vanilla/Builder.d.ts +3 -17
  281. package/dist/entry/content/adapters/vanilla/Node.d.ts +2 -11
  282. package/dist/entry/content/adapters/vanilla/Node.js +2 -0
  283. package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
  284. package/dist/entry/content/adapters/vanilla/index.d.ts +4 -18
  285. package/dist/entry/content/core/AbstractMarker.d.ts +2 -11
  286. package/dist/entry/content/core/AbstractMarker.js +1 -0
  287. package/dist/entry/content/core/AbstractMarker.js.map +1 -1
  288. package/dist/entry/content/core/AttributeMarker.d.ts +3 -12
  289. package/dist/entry/content/core/Builder.d.ts +8 -17
  290. package/dist/entry/content/core/Context.d.ts +2 -11
  291. package/dist/entry/content/core/Context.js +1 -0
  292. package/dist/entry/content/core/Context.js.map +1 -1
  293. package/dist/entry/content/core/EventEmitter.d.ts +2 -11
  294. package/dist/entry/content/core/EventNode.d.ts +2 -11
  295. package/dist/entry/content/core/EventNode.js +2 -0
  296. package/dist/entry/content/core/EventNode.js.map +1 -1
  297. package/dist/entry/content/core/ManagedContext.d.ts +3 -12
  298. package/dist/entry/content/core/MarkerNode.d.ts +2 -11
  299. package/dist/entry/content/core/MarkerNode.js +2 -0
  300. package/dist/entry/content/core/MarkerNode.js.map +1 -1
  301. package/dist/entry/content/core/MountBuilder.d.ts +3 -16
  302. package/dist/entry/content/core/MountNode.d.ts +2 -11
  303. package/dist/entry/content/core/MountNode.js +2 -0
  304. package/dist/entry/content/core/MountNode.js.map +1 -1
  305. package/dist/entry/content/core/Node.d.ts +2 -11
  306. package/dist/entry/content/core/Node.js +2 -0
  307. package/dist/entry/content/core/Node.js.map +1 -1
  308. package/dist/entry/content/core/WeakMarker.d.ts +3 -12
  309. package/dist/entry/content/core/resolvers/anchor.d.ts +2 -11
  310. package/dist/entry/content/core/resolvers/container.d.ts +2 -11
  311. package/dist/entry/content/core/resolvers/definition.d.ts +3 -12
  312. package/dist/entry/content/core/resolvers/index.d.ts +6 -13
  313. package/dist/entry/content/core/resolvers/mount.d.ts +2 -11
  314. package/dist/entry/content/core/resolvers/render.d.ts +3 -12
  315. package/dist/entry/content/core/resolvers/watch.d.ts +4 -13
  316. package/dist/entry/content/index.d.ts +1 -8
  317. package/dist/entry/core/Builder.d.ts +2 -11
  318. package/dist/entry/offscreen/Builder.d.ts +8 -25
  319. package/dist/entry/offscreen/Builder.js +8 -1
  320. package/dist/entry/offscreen/Builder.js.map +1 -1
  321. package/dist/entry/offscreen/TransportBuilder.d.ts +6 -24
  322. package/dist/entry/offscreen/index.d.ts +4 -25
  323. package/dist/entry/relay/Builder.d.ts +7 -21
  324. package/dist/entry/relay/Builder.js +1 -0
  325. package/dist/entry/relay/Builder.js.map +1 -1
  326. package/dist/entry/relay/TransportBuilder.d.ts +6 -20
  327. package/dist/entry/relay/index.d.ts +4 -21
  328. package/dist/entry/service/Builder.d.ts +6 -20
  329. package/dist/entry/service/index.d.ts +2 -14
  330. package/dist/entry/transport/AbstractBuilder.d.ts +4 -14
  331. package/dist/entry/transport/index.d.ts +1 -14
  332. package/dist/entry/transport/resolvers/definition.d.ts +7 -20
  333. package/dist/entry/transport/resolvers/index.d.ts +1 -14
  334. package/dist/entry/view/adapters/react/Builder.d.ts +4 -16
  335. package/dist/entry/view/adapters/react/index.d.ts +4 -17
  336. package/dist/entry/view/adapters/react/resolvers/render.d.ts +2 -13
  337. package/dist/entry/view/adapters/vanilla/Builder.d.ts +3 -15
  338. package/dist/entry/view/adapters/vanilla/index.d.ts +4 -16
  339. package/dist/entry/view/core/Builder.d.ts +3 -14
  340. package/dist/entry/view/core/resolvers/container.d.ts +2 -13
  341. package/dist/entry/view/core/resolvers/definition.d.ts +3 -14
  342. package/dist/entry/view/core/resolvers/render.d.ts +3 -14
  343. package/dist/entry/view/index.d.ts +1 -10
  344. package/dist/index.d.ts +1 -43
  345. package/dist/locale/adapters/react/LocaleProvider.d.ts +4 -6
  346. package/dist/locale/adapters/react/LocaleProvider.js +5 -5
  347. package/dist/locale/adapters/react/LocaleProvider.js.map +1 -1
  348. package/dist/locale/adapters/react/context.d.ts +8 -13
  349. package/dist/locale/adapters/react/context.js +2 -5
  350. package/dist/locale/adapters/react/context.js.map +1 -1
  351. package/dist/locale/adapters/react/index.d.ts +2 -6
  352. package/dist/locale/helpers.d.ts +60 -36
  353. package/dist/locale/helpers.js +14 -14
  354. package/dist/locale/helpers.js.map +1 -1
  355. package/dist/locale/index.d.ts +3 -7
  356. package/dist/locale/index.js.map +1 -1
  357. package/dist/locale/providers/AbstractLocale.d.ts +5 -8
  358. package/dist/locale/providers/AbstractLocale.js +9 -6
  359. package/dist/locale/providers/AbstractLocale.js.map +1 -1
  360. package/dist/locale/providers/CustomLocale.d.ts +5 -8
  361. package/dist/locale/providers/CustomLocale.js +3 -1
  362. package/dist/locale/providers/CustomLocale.js.map +1 -1
  363. package/dist/locale/providers/DynamicLocale.d.ts +7 -11
  364. package/dist/locale/providers/DynamicLocale.js +1 -1
  365. package/dist/locale/providers/DynamicLocale.js.map +1 -1
  366. package/dist/locale/providers/NativeLocale.d.ts +7 -10
  367. package/dist/locale/providers/NativeLocale.js.map +1 -1
  368. package/dist/locale/providers/index.d.ts +3 -6
  369. package/dist/locale/utils.d.ts +11 -14
  370. package/dist/main/app.d.ts +1 -1
  371. package/dist/main/app.js +3 -2
  372. package/dist/main/app.js.map +1 -1
  373. package/dist/main/background.d.ts +3 -12
  374. package/dist/main/browser.d.ts +1 -1
  375. package/dist/main/command.d.ts +4 -13
  376. package/dist/main/config.d.ts +3 -16
  377. package/dist/main/config.js.map +1 -1
  378. package/dist/main/content.d.ts +6 -18
  379. package/dist/main/env.d.ts +7 -15
  380. package/dist/main/icon.d.ts +6 -7
  381. package/dist/main/index.d.ts +17 -43
  382. package/dist/main/manifest.d.ts +1 -7
  383. package/dist/main/offscreen.d.ts +9 -22
  384. package/dist/main/offscreen.js +1 -1
  385. package/dist/main/offscreen.js.map +1 -1
  386. package/dist/main/page.d.ts +7 -19
  387. package/dist/main/plugin.d.ts +3 -16
  388. package/dist/main/popup.d.ts +8 -18
  389. package/dist/main/popup.js +2 -2
  390. package/dist/main/popup.js.map +1 -1
  391. package/dist/main/relay.d.ts +8 -21
  392. package/dist/main/service.d.ts +6 -15
  393. package/dist/main/sidebar.d.ts +8 -18
  394. package/dist/main/sidebar.js +2 -2
  395. package/dist/main/sidebar.js.map +1 -1
  396. package/dist/main/view.d.ts +1 -9
  397. package/dist/message/MessageManager.d.ts +2 -5
  398. package/dist/message/adapters/react/index.d.ts +1 -2
  399. package/dist/message/adapters/react/useMessageHandler.d.ts +2 -5
  400. package/dist/message/handlers/AbstractHandler.d.ts +2 -5
  401. package/dist/message/handlers/GeneralHandler.d.ts +3 -6
  402. package/dist/message/handlers/GeneralHandler.js +1 -0
  403. package/dist/message/handlers/GeneralHandler.js.map +1 -1
  404. package/dist/message/handlers/MapHandler.d.ts +3 -6
  405. package/dist/message/handlers/MapHandler.js +1 -0
  406. package/dist/message/handlers/MapHandler.js.map +1 -1
  407. package/dist/message/handlers/SingleHandler.d.ts +3 -6
  408. package/dist/message/handlers/SingleHandler.js +2 -0
  409. package/dist/message/handlers/SingleHandler.js.map +1 -1
  410. package/dist/message/handlers/index.d.ts +3 -5
  411. package/dist/message/index.d.ts +9 -13
  412. package/dist/message/providers/AbstractMessage.d.ts +2 -5
  413. package/dist/message/providers/Message.d.ts +4 -7
  414. package/dist/message/providers/index.d.ts +1 -4
  415. package/dist/offscreen/OffscreenBackground.d.ts +2 -9
  416. package/dist/offscreen/OffscreenBridge.d.ts +8 -9
  417. package/dist/offscreen/OffscreenBridge.js +55 -7
  418. package/dist/offscreen/OffscreenBridge.js.map +1 -1
  419. package/dist/offscreen/OffscreenManager.d.ts +4 -15
  420. package/dist/offscreen/OffscreenMessage.d.ts +2 -14
  421. package/dist/offscreen/index.d.ts +5 -26
  422. package/dist/offscreen/providers/Offscreen.d.ts +3 -14
  423. package/dist/offscreen/providers/ProxyOffscreen.d.ts +7 -18
  424. package/dist/offscreen/providers/ProxyOffscreen.js +44 -23
  425. package/dist/offscreen/providers/ProxyOffscreen.js.map +1 -1
  426. package/dist/offscreen/providers/RegisterOffscreen.d.ts +5 -18
  427. package/dist/offscreen/providers/RegisterOffscreen.js +1 -0
  428. package/dist/offscreen/providers/RegisterOffscreen.js.map +1 -1
  429. package/dist/offscreen/providers/index.d.ts +3 -17
  430. package/dist/offscreen/utils.d.ts +1 -3
  431. package/dist/relay/RelayManager.d.ts +6 -16
  432. package/dist/relay/RelayMessage.d.ts +2 -14
  433. package/dist/relay/RelayPermission.d.ts +4 -15
  434. package/dist/relay/index.d.ts +4 -22
  435. package/dist/relay/providers/ProxyRelay.d.ts +8 -19
  436. package/dist/relay/providers/ProxyRelay.js +2 -0
  437. package/dist/relay/providers/ProxyRelay.js.map +1 -1
  438. package/dist/relay/providers/RegisterRelay.d.ts +4 -16
  439. package/dist/relay/providers/RegisterRelay.js +2 -0
  440. package/dist/relay/providers/RegisterRelay.js.map +1 -1
  441. package/dist/relay/providers/Relay.d.ts +3 -14
  442. package/dist/relay/providers/index.d.ts +3 -18
  443. package/dist/relay/utils.d.ts +3 -5
  444. package/dist/service/ServiceManager.d.ts +4 -15
  445. package/dist/service/ServiceMessage.d.ts +2 -14
  446. package/dist/service/index.d.ts +4 -19
  447. package/dist/service/providers/ProxyService.d.ts +4 -15
  448. package/dist/service/providers/RegisterService.d.ts +3 -15
  449. package/dist/service/providers/RegisterService.js +1 -0
  450. package/dist/service/providers/RegisterService.js.map +1 -1
  451. package/dist/service/providers/Service.d.ts +3 -14
  452. package/dist/service/providers/index.d.ts +3 -15
  453. package/dist/transport/BaseTransport.d.ts +2 -13
  454. package/dist/transport/BaseTransport.js +1 -0
  455. package/dist/transport/BaseTransport.js.map +1 -1
  456. package/dist/transport/ProxyTransport.d.ts +4 -14
  457. package/dist/transport/RegisterTransport.d.ts +4 -16
  458. package/dist/transport/RegisterTransport.js +13 -20
  459. package/dist/transport/RegisterTransport.js.map +1 -1
  460. package/dist/transport/TransportManager.d.ts +2 -13
  461. package/dist/transport/TransportMessage.d.ts +3 -13
  462. package/dist/transport/index.d.ts +1 -9
  463. package/dist/types/app.d.ts +8 -6
  464. package/dist/types/app.js +7 -1
  465. package/dist/types/app.js.map +1 -1
  466. package/dist/types/background.d.ts +20 -7
  467. package/dist/types/browser.d.ts +6 -8
  468. package/dist/types/command.d.ts +27 -7
  469. package/dist/types/config.d.ts +673 -11
  470. package/dist/types/content.d.ts +195 -7
  471. package/dist/types/entrypoint.d.ts +106 -7
  472. package/dist/types/entrypoint.js.map +1 -1
  473. package/dist/types/env.d.ts +4 -6
  474. package/dist/types/framework.d.ts +1 -3
  475. package/dist/types/helpers.d.ts +6 -7
  476. package/dist/types/icon.d.ts +3 -5
  477. package/dist/types/locale.d.ts +35 -29
  478. package/dist/types/locale.js.map +1 -1
  479. package/dist/types/manifest.d.ts +163 -7
  480. package/dist/types/manifest.js.map +1 -1
  481. package/dist/types/message.d.ts +17 -19
  482. package/dist/types/message.js +1 -1
  483. package/dist/types/message.js.map +1 -1
  484. package/dist/types/offscreen.d.ts +13 -23
  485. package/dist/types/offscreen.js +2 -0
  486. package/dist/types/offscreen.js.map +1 -1
  487. package/dist/types/page.d.ts +5 -16
  488. package/dist/types/plugin.d.ts +101 -11
  489. package/dist/types/popup.d.ts +5 -16
  490. package/dist/types/relay.d.ts +13 -21
  491. package/dist/types/service.d.ts +9 -18
  492. package/dist/types/sidebar.d.ts +7 -17
  493. package/dist/types/transport.d.ts +22 -29
  494. package/dist/types/view.d.ts +18 -24
  495. package/package.json +9 -11
  496. package/dist/config-B38J9WIM.d.ts +0 -743
  497. package/dist/manifest-DKvERQ4d.d.ts +0 -503
@@ -1,14 +1,8 @@
1
- import export_default$1 from './ManifestBase.js';
2
- import { V as ManifestVersion, ae as CoreManifest } from '../../../manifest-DKvERQ4d.js';
3
- import { Browser } from '../../../types/browser.js';
4
- import '../../../types/locale.js';
5
- import 'react';
6
- import 'utility-types';
7
- import '../../../types/app.js';
8
- import '../../../types/helpers.js';
9
-
1
+ import ManifestBase from "./ManifestBase.js";
2
+ import { CoreManifest, ManifestVersion } from "../../../types/manifest.js";
3
+ import { Browser } from "../../../types/browser.js";
10
4
  type ManifestV3 = chrome.runtime.ManifestV3;
11
- declare class export_default extends export_default$1<ManifestV3> {
5
+ export default class extends ManifestBase<ManifestV3> {
12
6
  constructor(browser: Browser);
13
7
  getManifestVersion(): ManifestVersion;
14
8
  protected buildBackground(): Partial<CoreManifest> | undefined;
@@ -19,5 +13,4 @@ declare class export_default extends export_default$1<ManifestV3> {
19
13
  protected buildOptionalHostPermissions(): Partial<ManifestV3> | undefined;
20
14
  protected buildWebAccessibleResources(): Partial<ManifestV3> | undefined;
21
15
  }
22
-
23
- export { export_default as default };
16
+ export {};
@@ -1,5 +1,5 @@
1
1
  import ManifestBase, { ManifestError } from "./ManifestBase.js";
2
- import { filterHostPatterns, filterPermissionsForMV3 } from "./utils.js";
2
+ import { filterHostPatterns, filterOptionalPermissions, filterPermissionsForMV3 } from "./utils.js";
3
3
  import { Browser } from "./../../../types/browser.js";
4
4
  class ManifestV3_default extends ManifestBase {
5
5
  constructor(browser) {
@@ -52,24 +52,27 @@ class ManifestV3_default extends ManifestBase {
52
52
  }
53
53
  }
54
54
  buildPermissions() {
55
- const permissions = Array.from(filterPermissionsForMV3(this.permissions));
55
+ const permissions = Array.from(filterPermissionsForMV3(this.combinedPermissions));
56
56
  if (permissions.length > 0) {
57
57
  return { permissions };
58
58
  }
59
59
  }
60
60
  buildOptionalPermissions() {
61
- const optionalPermissions = Array.from(filterPermissionsForMV3(this.optionalPermissions)).filter((permission) => !this.permissions.has(permission));
61
+ const optionalPermissions = filterOptionalPermissions(
62
+ filterPermissionsForMV3(this.combinedOptionalPermissions),
63
+ filterPermissionsForMV3(this.combinedPermissions)
64
+ );
62
65
  if (optionalPermissions.length > 0) {
63
66
  return { optional_permissions: optionalPermissions };
64
67
  }
65
68
  }
66
69
  buildHostPermissions() {
67
- if (this.hostPermissions.size > 0) {
68
- return { host_permissions: [...filterHostPatterns(this.hostPermissions)] };
70
+ if (this.combinedHostPermissions.size > 0) {
71
+ return { host_permissions: [...filterHostPatterns(this.combinedHostPermissions)] };
69
72
  }
70
73
  }
71
74
  buildOptionalHostPermissions() {
72
- const optionalHostPermissions = Array.from(filterHostPatterns(/* @__PURE__ */ new Set([...this.hostPermissions, ...this.optionalHostPermissions]))).filter((permission) => !this.hostPermissions.has(permission));
75
+ const optionalHostPermissions = Array.from(filterHostPatterns(/* @__PURE__ */ new Set([...this.combinedHostPermissions, ...this.combinedOptionalHostPermissions]))).filter((permission) => !this.combinedHostPermissions.has(permission));
73
76
  if (optionalHostPermissions.length > 0) {
74
77
  return { optional_host_permissions: optionalHostPermissions };
75
78
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/builders/manifest/ManifestV3.ts"],"sourcesContent":["import ManifestBase, {ManifestError} from \"./ManifestBase\";\n\nimport {filterHostPatterns, filterPermissionsForMV3} from \"./utils\";\n\nimport {CoreManifest, ManifestAccessibleResource, ManifestVersion} from \"@typing/manifest\";\nimport {Browser} from \"@typing/browser\";\n\ntype ManifestV3 = chrome.runtime.ManifestV3;\n\nexport default class extends ManifestBase<ManifestV3> {\n public constructor(browser: Browser) {\n super(browser);\n }\n\n public getManifestVersion(): ManifestVersion {\n return 3;\n }\n\n protected buildBackground(): Partial<CoreManifest> | undefined {\n if (this.browser === Browser.Firefox) {\n const manifest = super.buildBackground();\n\n if (manifest) {\n const {background, ...other} = manifest;\n\n return {...other, background: {...background, persistent: undefined}};\n }\n\n return;\n }\n\n if (this.background) {\n const {entry} = this.background;\n\n const dependencies = this.dependencies.get(entry);\n\n if (!dependencies) {\n throw new ManifestError(`Background entry \"${entry}\" not found in dependencies`);\n }\n\n if (dependencies.js.size === 0) {\n throw new ManifestError(`Background entry \"${entry}\" has no dependencies`);\n }\n\n if (dependencies.js.size > 1) {\n throw new ManifestError(`Background entry \"${entry}\" has more than one dependency`);\n }\n\n const [js] = Array.from(dependencies.js);\n\n return {background: {service_worker: js}};\n }\n }\n\n protected buildAction(): Partial<ManifestV3> | undefined {\n if (this.popup) {\n const {path, icon, title} = this.popup;\n\n return {\n action: {\n default_title: title || this.name,\n default_popup: path,\n default_icon: this.getIconsByName(icon),\n },\n };\n } else if (this.hasExecuteActionCommand()) {\n return {\n action: {\n default_title: this.name,\n },\n };\n }\n }\n\n protected buildPermissions(): Partial<ManifestV3> | undefined {\n const permissions = Array.from(filterPermissionsForMV3(this.permissions));\n\n if (permissions.length > 0) {\n return {permissions};\n }\n }\n\n protected buildOptionalPermissions(): Partial<ManifestV3> | undefined {\n // prettier-ignore\n const optionalPermissions = Array\n .from(filterPermissionsForMV3(this.optionalPermissions))\n .filter((permission) => !this.permissions.has(permission));\n\n if (optionalPermissions.length > 0) {\n return {optional_permissions: optionalPermissions};\n }\n }\n\n protected buildHostPermissions(): Partial<ManifestV3> | undefined {\n if (this.hostPermissions.size > 0) {\n return {host_permissions: [...filterHostPatterns(this.hostPermissions)]};\n }\n }\n\n protected buildOptionalHostPermissions(): Partial<ManifestV3> | undefined {\n // prettier-ignore\n const optionalHostPermissions = Array\n .from(filterHostPatterns(new Set([...this.hostPermissions, ...this.optionalHostPermissions])))\n .filter((permission) => !this.hostPermissions.has(permission));\n\n if (optionalHostPermissions.length > 0) {\n return {optional_host_permissions: optionalHostPermissions};\n }\n }\n\n protected buildWebAccessibleResources(): Partial<ManifestV3> | undefined {\n const resources: ManifestAccessibleResource[] = this.getWebAccessibleResources();\n\n const transformedResources = resources.map(resource => ({\n resources: resource.resources,\n matches: resource.matches || [],\n }));\n\n if (resources.length > 0) {\n return {web_accessible_resources: transformedResources};\n }\n }\n}\n"],"mappings":"AAAA,OAAO,gBAAe,qBAAoB;AAE1C,SAAQ,oBAAoB,+BAA8B;AAG1D,SAAQ,eAAc;AAItB,MAAO,2BAAsB,aAAyB;AAAA,EAC3C,YAAY,SAAkB;AACjC,UAAM,OAAO;AAAA,EACjB;AAAA,EAEO,qBAAsC;AACzC,WAAO;AAAA,EACX;AAAA,EAEU,kBAAqD;AAC3D,QAAI,KAAK,YAAY,QAAQ,SAAS;AAClC,YAAM,WAAW,MAAM,gBAAgB;AAEvC,UAAI,UAAU;AACV,cAAM,EAAC,YAAY,GAAG,MAAK,IAAI;AAE/B,eAAO,EAAC,GAAG,OAAO,YAAY,EAAC,GAAG,YAAY,YAAY,OAAS,EAAC;AAAA,MACxE;AAEA;AAAA,IACJ;AAEA,QAAI,KAAK,YAAY;AACjB,YAAM,EAAC,MAAK,IAAI,KAAK;AAErB,YAAM,eAAe,KAAK,aAAa,IAAI,KAAK;AAEhD,UAAI,CAAC,cAAc;AACf,cAAM,IAAI,cAAc,qBAAqB,KAAK,6BAA6B;AAAA,MACnF;AAEA,UAAI,aAAa,GAAG,SAAS,GAAG;AAC5B,cAAM,IAAI,cAAc,qBAAqB,KAAK,uBAAuB;AAAA,MAC7E;AAEA,UAAI,aAAa,GAAG,OAAO,GAAG;AAC1B,cAAM,IAAI,cAAc,qBAAqB,KAAK,gCAAgC;AAAA,MACtF;AAEA,YAAM,CAAC,EAAE,IAAI,MAAM,KAAK,aAAa,EAAE;AAEvC,aAAO,EAAC,YAAY,EAAC,gBAAgB,GAAE,EAAC;AAAA,IAC5C;AAAA,EACJ;AAAA,EAE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AACrE,UAAM,YAA0C,KAAK,0BAA0B;AAE/E,UAAM,uBAAuB,UAAU,IAAI,eAAa;AAAA,MACpD,WAAW,SAAS;AAAA,MACpB,SAAS,SAAS,WAAW,CAAC;AAAA,IAClC,EAAE;AAEF,QAAI,UAAU,SAAS,GAAG;AACtB,aAAO,EAAC,0BAA0B,qBAAoB;AAAA,IAC1D;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/builders/manifest/ManifestV3.ts"],"sourcesContent":["import ManifestBase, {ManifestError} from \"./ManifestBase\";\n\nimport {filterHostPatterns, filterOptionalPermissions, filterPermissionsForMV3} from \"./utils\";\n\nimport {CoreManifest, ManifestAccessibleResource, ManifestVersion} from \"@typing/manifest\";\nimport {Browser} from \"@typing/browser\";\n\ntype ManifestV3 = chrome.runtime.ManifestV3;\n\nexport default class extends ManifestBase<ManifestV3> {\n public constructor(browser: Browser) {\n super(browser);\n }\n\n public getManifestVersion(): ManifestVersion {\n return 3;\n }\n\n protected buildBackground(): Partial<CoreManifest> | undefined {\n if (this.browser === Browser.Firefox) {\n const manifest = super.buildBackground();\n\n if (manifest) {\n const {background, ...other} = manifest;\n\n return {...other, background: {...background, persistent: undefined}};\n }\n\n return;\n }\n\n if (this.background) {\n const {entry} = this.background;\n\n const dependencies = this.dependencies.get(entry);\n\n if (!dependencies) {\n throw new ManifestError(`Background entry \"${entry}\" not found in dependencies`);\n }\n\n if (dependencies.js.size === 0) {\n throw new ManifestError(`Background entry \"${entry}\" has no dependencies`);\n }\n\n if (dependencies.js.size > 1) {\n throw new ManifestError(`Background entry \"${entry}\" has more than one dependency`);\n }\n\n const [js] = Array.from(dependencies.js);\n\n return {background: {service_worker: js}};\n }\n }\n\n protected buildAction(): Partial<ManifestV3> | undefined {\n if (this.popup) {\n const {path, icon, title} = this.popup;\n\n return {\n action: {\n default_title: title || this.name,\n default_popup: path,\n default_icon: this.getIconsByName(icon),\n },\n };\n } else if (this.hasExecuteActionCommand()) {\n return {\n action: {\n default_title: this.name,\n },\n };\n }\n }\n\n protected buildPermissions(): Partial<ManifestV3> | undefined {\n const permissions = Array.from(filterPermissionsForMV3(this.combinedPermissions));\n\n if (permissions.length > 0) {\n return {permissions};\n }\n }\n\n protected buildOptionalPermissions(): Partial<ManifestV3> | undefined {\n const optionalPermissions = filterOptionalPermissions(\n filterPermissionsForMV3(this.combinedOptionalPermissions),\n filterPermissionsForMV3(this.combinedPermissions)\n );\n\n if (optionalPermissions.length > 0) {\n return {optional_permissions: optionalPermissions};\n }\n }\n\n protected buildHostPermissions(): Partial<ManifestV3> | undefined {\n if (this.combinedHostPermissions.size > 0) {\n return {host_permissions: [...filterHostPatterns(this.combinedHostPermissions)]};\n }\n }\n\n protected buildOptionalHostPermissions(): Partial<ManifestV3> | undefined {\n // prettier-ignore\n const optionalHostPermissions = Array\n .from(filterHostPatterns(new Set([...this.combinedHostPermissions, ...this.combinedOptionalHostPermissions])))\n .filter((permission) => !this.combinedHostPermissions.has(permission));\n\n if (optionalHostPermissions.length > 0) {\n return {optional_host_permissions: optionalHostPermissions};\n }\n }\n\n protected buildWebAccessibleResources(): Partial<ManifestV3> | undefined {\n const resources: ManifestAccessibleResource[] = this.getWebAccessibleResources();\n\n const transformedResources = resources.map(resource => ({\n resources: resource.resources,\n matches: resource.matches || [],\n }));\n\n if (resources.length > 0) {\n return {web_accessible_resources: transformedResources};\n }\n }\n}\n"],"mappings":"AAAA,OAAO,gBAAe,qBAAoB;AAE1C,SAAQ,oBAAoB,2BAA2B,+BAA8B;AAGrF,SAAQ,eAAc;AAItB,MAAO,2BAAsB,aAAyB;AAAA,EAC3C,YAAY,SAAkB;AACjC,UAAM,OAAO;AAAA,EACjB;AAAA,EAEO,qBAAsC;AACzC,WAAO;AAAA,EACX;AAAA,EAEU,kBAAqD;AAC3D,QAAI,KAAK,YAAY,QAAQ,SAAS;AAClC,YAAM,WAAW,MAAM,gBAAgB;AAEvC,UAAI,UAAU;AACV,cAAM,EAAC,YAAY,GA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AA2B;AAAA,MACxD,wBAAwB,KAAK,mBAAmB;AAAA,IACpD;AAEA,QAAI,oBAAoB,SAAS,GAAG;AAChC,aAAO,EAAC,sBAAsB,oBAAmB;AAAA,IACrD;AAAA,EACJ;AAAA,EAEU,uBAAwD;AAC9D,QAAI,KAAK,wBAAwB,OAAO,GAAG;AACvC,aAAO,EAAC,kBAAkB,CAAC,GAAG,mBAAmB,KAAK,uBAAuB,CAAC,EAAC;AAAA,IACnF;AAAA,EACJ;AAAA,EAEU,+BAAgE;AAEtE,UAAM,0BAA0B,MAC3B,KAAK,mBAAmB,oBAAI,IAAI,CAAC,GAAG,KAAK,yBAAyB,GAAG,KAAK,+BAA+B,CAAC,CAAC,CAAC,EAC5G,OAAO,CAAC,eAAe,CAAC,KAAK,wBAAwB,IAAI,UAAU,CAAC;AAEzE,QAAI,wBAAwB,SAAS,GAAG;AACpC,aAAO,EAAC,2BAA2B,wBAAuB;AAAA,IAC9D;AAAA,EACJ;AAAA,EAEU,8BAA+D;AACrE,UAAM,YAA0C,KAAK,0BAA0B;AAE/E,UAAM,uBAAuB,UAAU,IAAI,eAAa;AAAA,MACpD,WAAW,SAAS;AAAA,MACpB,SAAS,SAAS,WAAW,CAAC;AAAA,IAClC,EAAE;AAEF,QAAI,UAAU,SAAS,GAAG;AACtB,aAAO,EAAC,0BAA0B,qBAAoB;AAAA,IAC1D;AAAA,EACJ;AACJ;","names":[]}
@@ -1,15 +1,4 @@
1
- import { T as ManifestBuilder } from '../../../manifest-DKvERQ4d.js';
2
- import { R as ReadonlyConfig } from '../../../config-B38J9WIM.js';
3
- import 'react';
4
- import 'utility-types';
5
- import '../../../types/app.js';
6
- import '../../../types/browser.js';
7
- import '../../../types/helpers.js';
8
- import '../../../types/locale.js';
9
- import '@rspack/core';
10
- import 'html-rspack-tags-plugin';
11
- import '../../../types/env.js';
12
-
1
+ import { ManifestBuilder } from "../../../types/manifest.js";
2
+ import { ReadonlyConfig } from "../../../types/config.js";
13
3
  declare const _default: (config: ReadonlyConfig) => ManifestBuilder;
14
-
15
- export { _default as default };
4
+ export default _default;
@@ -1,11 +1,5 @@
1
- import { DataCollectionPermissions } from '../../../types/browser.js';
2
- import { an as ManifestAccessibleResource } from '../../../manifest-DKvERQ4d.js';
3
- import 'react';
4
- import 'utility-types';
5
- import '../../../types/app.js';
6
- import '../../../types/helpers.js';
7
- import '../../../types/locale.js';
8
-
1
+ import { DataCollectionPermissions } from "../../../types/browser.js";
2
+ import { ManifestAccessibleResource } from "../../../types/manifest.js";
9
3
  type ManifestPermissions = chrome.runtime.ManifestPermission;
10
4
  type ManifestOptionalPermissions = chrome.runtime.ManifestOptionalPermission;
11
5
  type Permission = ManifestPermissions | ManifestOptionalPermissions;
@@ -15,10 +9,12 @@ type Permission = ManifestPermissions | ManifestOptionalPermissions;
15
9
  * @param permissions - Set of permissions to filter
16
10
  * @returns New set of permissions adapted for Manifest V2
17
11
  */
18
- declare const filterPermissionsForMV2: <T extends Permission>(permissions: Set<T>) => Set<T>;
19
- declare const filterPermissionsForMV3: <T extends Permission>(permissions: Set<T>) => Set<T>;
20
- declare const filterHostPatterns: (patterns: Set<string>) => Set<string>;
21
- declare const mergeWebAccessibleResources: (resources: ManifestAccessibleResource[]) => ManifestAccessibleResource[];
12
+ export declare const filterPermissions: <T extends Permission>(permissions: Set<T>) => Set<T>;
13
+ export declare const filterPermissionsForMV2: <T extends Permission>(permissions: Set<T>) => Set<T>;
14
+ export declare const filterPermissionsForMV3: <T extends Permission>(permissions: Set<T>) => Set<T>;
15
+ export declare const filterOptionalPermissions: <O extends ManifestOptionalPermissions, R extends ManifestPermissions>(optional: Set<O>, required: Set<R>) => O[];
16
+ export declare const filterHostPatterns: (patterns: Set<string>) => Set<string>;
17
+ export declare const mergeWebAccessibleResources: (resources: ManifestAccessibleResource[]) => ManifestAccessibleResource[];
22
18
  /**
23
19
  * Normalizes data collection permissions for the manifest.
24
20
  *
@@ -32,6 +28,5 @@ declare const mergeWebAccessibleResources: (resources: ManifestAccessibleResourc
32
28
  *
33
29
  * @param permissions - The permissions object to normalize.
34
30
  */
35
- declare const normalizeDataCollectionPermissions: (permissions?: DataCollectionPermissions) => DataCollectionPermissions;
36
-
37
- export { filterHostPatterns, filterPermissionsForMV2, filterPermissionsForMV3, mergeWebAccessibleResources, normalizeDataCollectionPermissions };
31
+ export declare const normalizeDataCollectionPermissions: (permissions?: DataCollectionPermissions) => DataCollectionPermissions;
32
+ export {};
@@ -1,6 +1,12 @@
1
1
  import _ from "lodash";
2
2
  import { DataCollectionPermission } from "./../../../types/browser.js";
3
3
  import { ManifestMatchSchemes, ManifestSpecialSchemes } from "./../../../types/manifest.js";
4
+ const filterPermissions = (permissions) => {
5
+ if (permissions.has("tabs")) {
6
+ permissions.delete("activeTab");
7
+ }
8
+ return permissions;
9
+ };
4
10
  const filterPermissionsForMV2 = (permissions) => {
5
11
  const filteredPermissions = new Set(permissions);
6
12
  if (filteredPermissions.has("scripting")) {
@@ -8,14 +14,18 @@ const filterPermissionsForMV2 = (permissions) => {
8
14
  filteredPermissions.add("tabs");
9
15
  }
10
16
  filteredPermissions.delete("offscreen");
11
- return filteredPermissions;
17
+ return filterPermissions(filteredPermissions);
12
18
  };
13
19
  const filterPermissionsForMV3 = (permissions) => {
14
20
  const filteredPermissions = new Set(permissions);
15
21
  filteredPermissions.delete("webAuthenticationProxy");
16
22
  filteredPermissions.delete("webRequestAuthProvider");
17
23
  filteredPermissions.delete("webRequestBlocking");
18
- return filteredPermissions;
24
+ return filterPermissions(filteredPermissions);
25
+ };
26
+ const filterOptionalPermissions = (optional, required) => {
27
+ const allPermissions = filterPermissions(/* @__PURE__ */ new Set([...optional, ...required]));
28
+ return _.difference(Array.from(allPermissions), Array.from(required));
19
29
  };
20
30
  const filterHostPatterns = (patterns) => {
21
31
  if (patterns.has("<all_urls>")) {
@@ -189,6 +199,8 @@ const normalizeDataCollectionPermissions = (permissions) => {
189
199
  };
190
200
  export {
191
201
  filterHostPatterns,
202
+ filterOptionalPermissions,
203
+ filterPermissions,
192
204
  filterPermissionsForMV2,
193
205
  filterPermissionsForMV3,
194
206
  mergeWebAccessibleResources,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/builders/manifest/utils.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {DataCollectionPermission, DataCollectionPermissions} from \"@typing/browser\";\n\nimport {ManifestAccessibleResource, ManifestMatchSchemes, ManifestSpecialSchemes} from \"@typing/manifest\";\n\ntype ManifestPermissions = chrome.runtime.ManifestPermission;\ntype ManifestOptionalPermissions = chrome.runtime.ManifestOptionalPermission;\n\ntype Permission = ManifestPermissions | ManifestOptionalPermissions;\n/**\n * Filters and adapts permissions for Manifest V2 compatibility.\n *\n * @param permissions - Set of permissions to filter\n * @returns New set of permissions adapted for Manifest V2\n */\nexport const filterPermissionsForMV2 = <T extends Permission>(permissions: Set<T>): Set<T> => {\n const filteredPermissions = new Set(permissions);\n\n /**\n * Manifest V3 introduced a new 'scripting' permission for working with the Chrome Scripting API,\n * but Manifest V2 uses the 'tabs' permission for executing scripts on web pages.\n * This function automatically replaces 'scripting' with 'tabs' to ensure backward compatibility.\n *\n * @example\n * ```typescript\n * const mv3Permissions = new Set(['scripting', 'storage', 'activeTab']);\n * const mv2Permissions = filterPermissionsForMV2(mv3Permissions);\n * // Result: Set(['tabs', 'storage', 'activeTab'])\n * ```\n */\n if (filteredPermissions.has(\"scripting\" as T)) {\n filteredPermissions.delete(\"scripting\" as T);\n filteredPermissions.add(\"tabs\" as T);\n }\n\n filteredPermissions.delete(\"offscreen\" as T);\n\n return filteredPermissions;\n};\n\nexport const filterPermissionsForMV3 = <T extends Permission>(permissions: Set<T>): Set<T> => {\n const filteredPermissions = new Set(permissions);\n\n /**\n * @permissions webRequestBlocking, webAuthenticationProxy, webRequestAuthProvider\n * @description These permissions were removed in Manifest V3 due to concerns related to security, performance, and transparency.\n * - `webRequestBlocking`: Allowed real-time interception and modification of network requests, which introduced latency and potential security risks. Replaced by the safer, declarative `declarativeNetRequest` API.\n * - `webAuthenticationProxy`: Provided proxy authentication control, but was rarely used and posed privacy risks.\n * - `webRequestAuthProvider`: Enabled handling of HTTP authentication (onAuthRequired), but was considered unsafe in the new MV3 architecture due to its ability to interfere with authentication flows.\n * @manifestV3 Removed. These APIs are no longer available in extensions using Manifest V3.\n */\n filteredPermissions.delete(\"webAuthenticationProxy\" as T);\n filteredPermissions.delete(\"webRequestAuthProvider\" as T);\n filteredPermissions.delete(\"webRequestBlocking\" as T);\n\n return filteredPermissions;\n};\n\nexport const filterHostPatterns = (patterns: Set<string>): Set<string> => {\n if (patterns.has(\"<all_urls>\")) {\n return new Set([\"<all_urls>\"]);\n }\n\n const result = new Set<string>();\n\n const activeWildcards = new Set<string>();\n\n if (patterns.has(\"*://*/*\")) {\n activeWildcards.add(\"*://*/*\");\n result.add(\"*://*/*\");\n }\n\n for (const scheme of ManifestMatchSchemes) {\n const wildcard = `${scheme}://*/*`;\n\n if (patterns.has(wildcard)) {\n if (scheme === \"http\" || scheme === \"https\") {\n if (!activeWildcards.has(\"*://*/*\")) {\n activeWildcards.add(wildcard);\n result.add(wildcard);\n }\n } else {\n activeWildcards.add(wildcard);\n result.add(wildcard);\n }\n }\n }\n\n const isCoveredByWildcard = (pattern: string): boolean => {\n const schemeIndex = pattern.indexOf(\"://\");\n if (schemeIndex === -1) return false;\n\n const scheme = pattern.substring(0, schemeIndex);\n\n if (ManifestSpecialSchemes.has(scheme)) {\n return false;\n }\n\n if (activeWildcards.has(\"*://*/*\") && (scheme === \"http\" || scheme === \"https\")) {\n return true;\n }\n\n return activeWildcards.has(`${scheme}://*/*`);\n };\n\n for (const pattern of patterns) {\n if (activeWildcards.has(pattern)) {\n continue;\n }\n\n if (!isCoveredByWildcard(pattern)) {\n result.add(pattern);\n }\n }\n\n return result;\n};\n\nexport const mergeWebAccessibleResources = (resources: ManifestAccessibleResource[]): ManifestAccessibleResource[] => {\n if (resources.length === 0) return [];\n\n const simplifiedMatches: ManifestAccessibleResource[] = resources.map(r => {\n const {resources, matches, extensionIds, useDynamicUrl} = r;\n return {\n resources,\n extensionIds,\n useDynamicUrl,\n matches: matches ? Array.from(filterHostPatterns(new Set(matches))) : matches,\n };\n });\n\n const normalize = (arr?: string[]) => Array.from(new Set(arr || [])).sort();\n\n const makeKey = (r: ManifestAccessibleResource, exclude: (keyof ManifestAccessibleResource)[]): string => {\n const obj: ManifestAccessibleResource = {\n resources: normalize(r.resources),\n matches: normalize(r.matches),\n extensionIds: normalize(r.extensionIds),\n useDynamicUrl: r.useDynamicUrl,\n };\n\n for (const field of exclude) {\n delete obj[field];\n }\n\n return JSON.stringify(obj);\n };\n\n const mergeTwo = (a: ManifestAccessibleResource, b: ManifestAccessibleResource): ManifestAccessibleResource => ({\n resources: normalize([...a.resources, ...b.resources]),\n matches: normalize([...(a.matches || []), ...(b.matches || [])]),\n extensionIds: normalize([...(a.extensionIds || []), ...(b.extensionIds || [])]),\n useDynamicUrl: a.useDynamicUrl,\n });\n\n const merge = (resources: ManifestAccessibleResource[], mergeBy: keyof ManifestAccessibleResource) => {\n const map = new Map<string, ManifestAccessibleResource>();\n let changed = false;\n for (const r of resources) {\n const key = makeKey(r, [mergeBy]);\n if (map.has(key)) {\n const merged = mergeTwo(map.get(key)!, r);\n map.set(key, merged);\n changed = true;\n } else {\n map.set(key, r);\n }\n }\n\n return {\n changed,\n result: Array.from(map.values()),\n };\n };\n\n let changed = true;\n\n let result: ManifestAccessibleResource[] = simplifiedMatches.map(r => ({\n resources: normalize(r.resources),\n matches: normalize(r.matches),\n extensionIds: normalize(r.extensionIds),\n useDynamicUrl: r.useDynamicUrl,\n }));\n\n while (changed) {\n changed = false;\n\n const mergeByResources = merge(result, \"resources\");\n const afterResources = mergeByResources.result;\n\n const mergeByMatches = merge(afterResources, \"matches\");\n const afterMatches = mergeByMatches.result;\n\n const mergeByExtensionIds = merge(afterMatches, \"extensionIds\");\n const afterExtensionIds = mergeByExtensionIds.result;\n\n changed = mergeByResources.changed || mergeByMatches.changed || mergeByExtensionIds.changed;\n result = afterExtensionIds;\n }\n\n for (const entry of result) {\n if (!entry.matches) continue;\n if (entry.matches.includes(\"<all_urls>\") || entry.matches.includes(\"*://*/*\")) {\n for (const other of result) {\n if (other === entry) continue;\n // збігаються усі крім resources → можна чистити resources\n if (\n _.isEqual(other.matches, entry.matches) ||\n other.useDynamicUrl !== entry.useDynamicUrl ||\n !_.isEqual(other.extensionIds, entry.extensionIds)\n ) {\n continue;\n }\n other.resources = other.resources.filter(r => !entry.resources.includes(r));\n }\n }\n }\n\n for (const entry of result) {\n if (!entry.matches) continue;\n for (const scheme of ManifestMatchSchemes) {\n if (entry.matches.includes(`${scheme}://*/*`)) {\n for (const other of result) {\n if (other === entry) continue;\n if (\n other.useDynamicUrl !== entry.useDynamicUrl ||\n !_.isEqual(other.extensionIds, entry.extensionIds)\n ) {\n continue;\n }\n if (other.matches?.some(m => m.startsWith(`${scheme}://`))) {\n other.resources = other.resources.filter(r => !entry.resources.includes(r));\n }\n }\n }\n }\n }\n\n result = result\n .filter(r => r.resources.length > 0)\n .map(r => {\n if (r.matches?.length === 0) delete r.matches;\n if (r.extensionIds?.length === 0) delete r.extensionIds;\n if (r.useDynamicUrl === undefined) delete r.useDynamicUrl;\n return r;\n });\n\n return result;\n};\n\n/**\n * Normalizes data collection permissions for the manifest.\n *\n * - Removes duplicate permissions.\n * - Filters out invalid permissions not present in DataCollectionPermission enum.\n * - Sets \"none\" as default if required permissions are empty.\n * - Removes \"none\" if real permissions are added to required.\n * - Removes \"none\" from optional permissions.\n * - Removes any permission from optional if it's already in required.\n * - Sorts both required and optional permissions alphabetically.\n *\n * @param permissions - The permissions object to normalize.\n */\nexport const normalizeDataCollectionPermissions = (\n permissions?: DataCollectionPermissions\n): DataCollectionPermissions => {\n const validPermissions = Object.values(DataCollectionPermission) as string[];\n\n let required = _.uniq(permissions?.required || []).filter(\n p => (p as string) === \"none\" || validPermissions.includes(p as string)\n );\n\n let optional = _.uniq(permissions?.optional || []).filter(\n p => (p as string) !== \"none\" && validPermissions.includes(p as string)\n );\n\n if (required.length === 0) {\n required = [\"none\" as any];\n }\n\n if (required.length > 1 && required.includes(\"none\" as any)) {\n required = _.without(required, \"none\" as any);\n }\n\n optional = _.difference(optional, required);\n\n return {\n required: required.toSorted() as DataCollectionPermissions[\"required\"],\n optional: optional.length > 0 ? (optional.toSorted() as DataCollectionPermissions[\"optional\"]) : undefined,\n };\n};\n"],"mappings":"AAAA,OAAO,OAAO;AACd,SAAQ,gCAA0D;AAElE,SAAoC,sBAAsB,8BAA6B;AAYhF,MAAM,0BAA0B,CAAuB,gBAAgC;AAC1F,QAAM,sBAAsB,IAAI,IAAI,WAAW;AAc/C,MAAI,oBAAoB,IAAI,WAAgB,GAAG;AAC3C,wBAAoB,OAAO,WAAgB;AAC3C,wBAAoB,IAAI,MAAW;AAAA,EACvC;AAEA,sBAAoB,OAAO,WAAgB;AAE3C,SAAO;AACX;AAEO,MAAM,0BAA0B,CAAuB,gBAAgC;AAC1F,QAAM,sBAAsB,IAAI,IAAI,WAAW;AAU/C,sBAAoB,OAAO,wBAA6B;AACxD,sBAAoB,OAAO,wBAA6B;AACxD,sBAAoB,OAAO,oBAAyB;AAEpD,SAAO;AACX;AAEO,MAAM,qBAAqB,CAAC,aAAuC;AACtE,MAAI,SAAS,IAAI,YAAY,GAAG;AAC5B,WAAO,oBAAI,IAAI,CAAC,YAAY,CAAC;AAAA,EACjC;AAEA,QAAM,SAAS,oBAAI,IAAY;AAE/B,QAAM,kBAAkB,oBAAI,IAAY;AAExC,MAAI,SAAS,IAAI,SAAS,GAAG;AACzB,oBAAgB,IAAI,SAAS;AAC7B,WAAO,IAAI,SAAS;AAAA,EACxB;AAEA,aAAW,UAAU,sBAAsB;AACvC,UAAM,WAAW,GAAG,MAAM;AAE1B,QAAI,SAAS,IAAI,QAAQ,GAAG;AACxB,UAAI,WAAW,UAAU,WAAW,SAAS;AACzC,YAAI,CAAC,gBAAgB,IAAI,SAAS,GAAG;AACjC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,UAC9E;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAEA,WAAS,OACJ,OAAO,OAAK,EAAE,UAAU,SAAS,CAAC,EAClC,IAAI,OAAK;AAhPlB,QAAAC,KAAA;AAiPY,UAAIA,MAAA,EAAE,YAAF,gBAAAA,IAAW,YAAW,EAAG,QAAO,EAAE;AACtC,UAAI,OAAE,iBAAF,mBAAgB,YAAW,EAAG,QAAO,EAAE;AAC3C,QAAI,EAAE,kBAAkB,OAAW,QAAO,EAAE;AAC5C,WAAO;AAAA,EACX,CAAC;AAEL,SAAO;AACX;AAeO,MAAM,qCAAqC,CAC9C,gBAC4B;AAC5B,QAAM,mBAAmB,OAAO,OAAO,wBAAwB;AAE/D,MAAI,WAAW,EAAE,MAAK,2CAAa,aAAY,CAAC,CAAC,EAAE;AAAA,IAC/C,OAAM,MAAiB,UAAU,iBAAiB,SAAS,CAAW;AAAA,EAC1E;AAEA,MAAI,WAAW,EAAE,MAAK,2CAAa,aAAY,CAAC,CAAC,EAAE;AAAA,IAC/C,OAAM,MAAiB,UAAU,iBAAiB,SAAS,CAAW;AAAA,EAC1E;AAEA,MAAI,SAAS,WAAW,GAAG;AACvB,eAAW,CAAC,MAAa;AAAA,EAC7B;AAEA,MAAI,SAAS,SAAS,KAAK,SAAS,SAAS,MAAa,GAAG;AACzD,eAAW,EAAE,QAAQ,UAAU,MAAa;AAAA,EAChD;AAEA,aAAW,EAAE,WAAW,UAAU,QAAQ;AAE1C,SAAO;AAAA,IACH,UAAU,SAAS,SAAS;AAAA,IAC5B,UAAU,SAAS,SAAS,IAAK,SAAS,SAAS,IAA8C;AAAA,EACrG;AACJ;","names":["resources","changed","_a"]}
1
+ {"version":3,"sources":["../../../../src/cli/builders/manifest/utils.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {DataCollectionPermission, DataCollectionPermissions} from \"@typing/browser\";\n\nimport {ManifestAccessibleResource, ManifestMatchSchemes, ManifestSpecialSchemes} from \"@typing/manifest\";\n\ntype ManifestPermissions = chrome.runtime.ManifestPermission;\ntype ManifestOptionalPermissions = chrome.runtime.ManifestOptionalPermission;\n\ntype Permission = ManifestPermissions | ManifestOptionalPermissions;\n/**\n * Filters and adapts permissions for Manifest V2 compatibility.\n *\n * @param permissions - Set of permissions to filter\n * @returns New set of permissions adapted for Manifest V2\n */\nexport const filterPermissions = <T extends Permission>(permissions: Set<T>): Set<T> => {\n if (permissions.has(\"tabs\" as T)) {\n permissions.delete(\"activeTab\" as T);\n }\n return permissions;\n};\n\nexport const filterPermissionsForMV2 = <T extends Permission>(permissions: Set<T>): Set<T> => {\n const filteredPermissions = new Set(permissions);\n\n /**\n * Manifest V3 introduced a new 'scripting' permission for working with the Chrome Scripting API,\n * but Manifest V2 uses the 'tabs' permission for executing scripts on web pages.\n * This function automatically replaces 'scripting' with 'tabs' to ensure backward compatibility.\n *\n * @example\n * ```typescript\n * const mv3Permissions = new Set(['scripting', 'storage', 'activeTab']);\n * const mv2Permissions = filterPermissionsForMV2(mv3Permissions);\n * // Result: Set(['tabs', 'storage', 'activeTab'])\n * ```\n */\n if (filteredPermissions.has(\"scripting\" as T)) {\n filteredPermissions.delete(\"scripting\" as T);\n filteredPermissions.add(\"tabs\" as T);\n }\n\n filteredPermissions.delete(\"offscreen\" as T);\n\n return filterPermissions(filteredPermissions);\n};\n\nexport const filterPermissionsForMV3 = <T extends Permission>(permissions: Set<T>): Set<T> => {\n const filteredPermissions = new Set(permissions);\n\n /**\n * @permissions webRequestBlocking, webAuthenticationProxy, webRequestAuthProvider\n * @description These permissions were removed in Manifest V3 due to concerns related to security, performance, and transparency.\n * - `webRequestBlocking`: Allowed real-time interception and modification of network requests, which introduced latency and potential security risks. Replaced by the safer, declarative `declarativeNetRequest` API.\n * - `webAuthenticationProxy`: Provided proxy authentication control, but was rarely used and posed privacy risks.\n * - `webRequestAuthProvider`: Enabled handling of HTTP authentication (onAuthRequired), but was considered unsafe in the new MV3 architecture due to its ability to interfere with authentication flows.\n * @manifestV3 Removed. These APIs are no longer available in extensions using Manifest V3.\n */\n filteredPermissions.delete(\"webAuthenticationProxy\" as T);\n filteredPermissions.delete(\"webRequestAuthProvider\" as T);\n filteredPermissions.delete(\"webRequestBlocking\" as T);\n\n return filterPermissions(filteredPermissions);\n};\n\nexport const filterOptionalPermissions = <O extends ManifestOptionalPermissions, R extends ManifestPermissions>(\n optional: Set<O>,\n required: Set<R>\n): O[] => {\n const allPermissions = filterPermissions(new Set([...optional, ...required]));\n return _.difference(Array.from(allPermissions), Array.from(required)) as O[];\n};\n\nexport const filterHostPatterns = (patterns: Set<string>): Set<string> => {\n if (patterns.has(\"<all_urls>\")) {\n return new Set([\"<all_urls>\"]);\n }\n\n const result = new Set<string>();\n\n const activeWildcards = new Set<string>();\n\n if (patterns.has(\"*://*/*\")) {\n activeWildcards.add(\"*://*/*\");\n result.add(\"*://*/*\");\n }\n\n for (const scheme of ManifestMatchSchemes) {\n const wildcard = `${scheme}://*/*`;\n\n if (patterns.has(wildcard)) {\n if (scheme === \"http\" || scheme === \"https\") {\n if (!activeWildcards.has(\"*://*/*\")) {\n activeWildcards.add(wildcard);\n result.add(wildcard);\n }\n } else {\n activeWildcards.add(wildcard);\n result.add(wildcard);\n }\n }\n }\n\n const isCoveredByWildcard = (pattern: string): boolean => {\n const schemeIndex = pattern.indexOf(\"://\");\n if (schemeIndex === -1) return false;\n\n const scheme = pattern.substring(0, schemeIndex);\n\n if (ManifestSpecialSchemes.has(scheme)) {\n return false;\n }\n\n if (activeWildcards.has(\"*://*/*\") && (scheme === \"http\" || scheme === \"https\")) {\n return true;\n }\n\n return activeWildcards.has(`${scheme}://*/*`);\n };\n\n for (const pattern of patterns) {\n if (activeWildcards.has(pattern)) {\n continue;\n }\n\n if (!isCoveredByWildcard(pattern)) {\n result.add(pattern);\n }\n }\n\n return result;\n};\n\nexport const mergeWebAccessibleResources = (resources: ManifestAccessibleResource[]): ManifestAccessibleResource[] => {\n if (resources.length === 0) return [];\n\n const simplifiedMatches: ManifestAccessibleResource[] = resources.map(r => {\n const {resources, matches, extensionIds, useDynamicUrl} = r;\n return {\n resources,\n extensionIds,\n useDynamicUrl,\n matches: matches ? Array.from(filterHostPatterns(new Set(matches))) : matches,\n };\n });\n\n const normalize = (arr?: string[]) => Array.from(new Set(arr || [])).sort();\n\n const makeKey = (r: ManifestAccessibleResource, exclude: (keyof ManifestAccessibleResource)[]): string => {\n const obj: ManifestAccessibleResource = {\n resources: normalize(r.resources),\n matches: normalize(r.matches),\n extensionIds: normalize(r.extensionIds),\n useDynamicUrl: r.useDynamicUrl,\n };\n\n for (const field of exclude) {\n delete obj[field];\n }\n\n return JSON.stringify(obj);\n };\n\n const mergeTwo = (a: ManifestAccessibleResource, b: ManifestAccessibleResource): ManifestAccessibleResource => ({\n resources: normalize([...a.resources, ...b.resources]),\n matches: normalize([...(a.matches || []), ...(b.matches || [])]),\n extensionIds: normalize([...(a.extensionIds || []), ...(b.extensionIds || [])]),\n useDynamicUrl: a.useDynamicUrl,\n });\n\n const merge = (resources: ManifestAccessibleResource[], mergeBy: keyof ManifestAccessibleResource) => {\n const map = new Map<string, ManifestAccessibleResource>();\n let changed = false;\n for (const r of resources) {\n const key = makeKey(r, [mergeBy]);\n if (map.has(key)) {\n const merged = mergeTwo(map.get(key)!, r);\n map.set(key, merged);\n changed = true;\n } else {\n map.set(key, r);\n }\n }\n\n return {\n changed,\n result: Array.from(map.values()),\n };\n };\n\n let changed = true;\n\n let result: ManifestAccessibleResource[] = simplifiedMatches.map(r => ({\n resources: normalize(r.resources),\n matches: normalize(r.matches),\n extensionIds: normalize(r.extensionIds),\n useDynamicUrl: r.useDynamicUrl,\n }));\n\n while (changed) {\n changed = false;\n\n const mergeByResources = merge(result, \"resources\");\n const afterResources = mergeByResources.result;\n\n const mergeByMatches = merge(afterResources, \"matches\");\n const afterMatches = mergeByMatches.result;\n\n const mergeByExtensionIds = merge(afterMatches, \"extensionIds\");\n const afterExtensionIds = mergeByExtensionIds.result;\n\n changed = mergeByResources.changed || mergeByMatches.changed || mergeByExtensionIds.changed;\n result = afterExtensionIds;\n }\n\n for (const entry of result) {\n if (!entry.matches) continue;\n if (entry.matches.includes(\"<all_urls>\") || entry.matches.includes(\"*://*/*\")) {\n for (const other of result) {\n if (other === entry) continue;\n\n if (\n _.isEqual(other.matches, entry.matches) ||\n other.useDynamicUrl !== entry.useDynamicUrl ||\n !_.isEqual(other.extensionIds, entry.extensionIds)\n ) {\n continue;\n }\n other.resources = other.resources.filter(r => !entry.resources.includes(r));\n }\n }\n }\n\n for (const entry of result) {\n if (!entry.matches) continue;\n for (const scheme of ManifestMatchSchemes) {\n if (entry.matches.includes(`${scheme}://*/*`)) {\n for (const other of result) {\n if (other === entry) continue;\n if (\n other.useDynamicUrl !== entry.useDynamicUrl ||\n !_.isEqual(other.extensionIds, entry.extensionIds)\n ) {\n continue;\n }\n if (other.matches?.some(m => m.startsWith(`${scheme}://`))) {\n other.resources = other.resources.filter(r => !entry.resources.includes(r));\n }\n }\n }\n }\n }\n\n result = result\n .filter(r => r.resources.length > 0)\n .map(r => {\n if (r.matches?.length === 0) delete r.matches;\n if (r.extensionIds?.length === 0) delete r.extensionIds;\n if (r.useDynamicUrl === undefined) delete r.useDynamicUrl;\n return r;\n });\n\n return result;\n};\n\n/**\n * Normalizes data collection permissions for the manifest.\n *\n * - Removes duplicate permissions.\n * - Filters out invalid permissions not present in DataCollectionPermission enum.\n * - Sets \"none\" as default if required permissions are empty.\n * - Removes \"none\" if real permissions are added to required.\n * - Removes \"none\" from optional permissions.\n * - Removes any permission from optional if it's already in required.\n * - Sorts both required and optional permissions alphabetically.\n *\n * @param permissions - The permissions object to normalize.\n */\nexport const normalizeDataCollectionPermissions = (\n permissions?: DataCollectionPermissions\n): DataCollectionPermissions => {\n const validPermissions = Object.values(DataCollectionPermission) as string[];\n\n let required = _.uniq(permissions?.required || []).filter(\n p => (p as string) === \"none\" || validPermissions.includes(p as string)\n );\n\n let optional = _.uniq(permissions?.optional || []).filter(\n p => (p as string) !== \"none\" && validPermissions.includes(p as string)\n );\n\n if (required.length === 0) {\n required = [\"none\" as any];\n }\n\n if (required.length > 1 && required.includes(\"none\" as any)) {\n required = _.without(required, \"none\" as any);\n }\n\n optional = _.difference(optional, required);\n\n return {\n required: required.toSorted() as DataCollectionPermissions[\"required\"],\n optional: optional.length > 0 ? (optional.toSorted() as DataCollectionPermissions[\"optional\"]) : undefined,\n };\n};\n"],"mappings":"AAAA,OAAO,OAAO;AACd,SAAQ,gCAA0D;AAElE,SAAoC,sBAAsB,8BAA6B;AAYhF,MAAM,oBAAoB,CAAuB,gBAAgC;AACpF,MAAI,YAAY,IAAI,MAAW,GAAG;AAC9B,gBAAY,OAAO,WAAgB;AAAA,EACvC;AACA,SAAO;AACX;AAEO,MAAM,0BAA0B,CAAuB,gBAAgC;AAC1F,QAAM,sBAAsB,IAAI,IAAI,WAAW;AAc/C,MAAI,oBAAoB,IAAI,WAAgB,GAAG;AAC3C,wBAAoB,OAAO,WAAgB;AAC3C,wBAAoB,IAAI,MAAW;AAAA,EACvC;AAEA,sBAAoB,OAAO,WAAgB;AAE3C,SAAO,kBAAkB,mBAAmB;AAChD;AAEO,MAAM,0BAA0B,CAAuB,gBAAgC;AAC1F,QAAM,sBAAsB,IAAI,IAAI,WAAW;AAU/C,sBAAoB,OAAO,wBAA6B;AACxD,sBAAoB,OAAO,wBAA6B;AACxD,sBAAoB,OAAO,oBAAyB;AAEpD,SAAO,kBAAkB,mBAAmB;AAChD;AAEO,MAAM,4BAA4B,CACrC,UACA,aACM;AACN,QAAM,iBAAiB,kBAAkB,oBAAI,IAAI,CAAC,GAAG,UAAU,GAAG,QAAQ,CAAC,CAAC;AAC5E,SAAO,EAAE,WAAW,MAAM,KAAK,cAAc,GAAG,MAAM,KAAK,QAAQ,CAAC;AACxE;AAEO,MAAM,qBAAqB,CAAC,aAAuC;AACtE,MAAI,SAAS,IAAI,YAAY,GAAG;AAC5B,WAAO,oBAAI,IAAI,CAAC,YAAY,CA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ChD;AAEA,aAAW,EAAE,WAAW,UAAU,QAAQ;AAE1C,SAAO;AAAA,IACH,UAAU,SAAS,SAAS;AAAA,IAC5B,UAAU,SAAS,SAAS,IAAK,SAAS,SAAS,IAA8C;AAAA,EACrG;AACJ;","names":["resources","changed","_a"]}
@@ -1,16 +1,2 @@
1
- export { default as EntrypointPlugin, EntrypointPluginEntryModules, EntrypointPluginModule, EntrypointPluginModules, EntrypointPluginTemplate, EntrypointPluginUpdate } from './plugins/EntrypointPlugin.js';
2
- export { default as GenerateJsonPlugin, GenerateJsonPluginData, GenerateJsonPluginUpdate } from './plugins/GenerateJsonPlugin.js';
3
- export { default as ManifestPlugin } from './plugins/ManifestPlugin.js';
4
- export { default as ReplacePlugin } from './plugins/ReplacePlugin.js';
5
- export { default as WatchPlugin } from './plugins/WatchPlugin.js';
6
- export { onlyViaTopLevelEntry } from './utils/optimization.js';
7
- export { appFilenameResolver } from './utils/output.js';
8
- import '@rspack/core';
9
- import 'rspack-plugin-virtual-module';
10
- import '../../manifest-DKvERQ4d.js';
11
- import 'react';
12
- import 'utility-types';
13
- import '../../types/app.js';
14
- import '../../types/browser.js';
15
- import '../../types/helpers.js';
16
- import '../../types/locale.js';
1
+ export * from "./plugins/index.js";
2
+ export * from "./utils/index.js";
@@ -1,16 +1,9 @@
1
- import { Compiler, EntryNormalized } from '@rspack/core';
2
- import { RspackVirtualModulePlugin } from 'rspack-plugin-virtual-module';
3
- import { Z as EntrypointFile, _ as EntrypointEntries } from '../../../manifest-DKvERQ4d.js';
4
- import 'react';
5
- import 'utility-types';
6
- import '../../../types/app.js';
7
- import '../../../types/browser.js';
8
- import '../../../types/helpers.js';
9
- import '../../../types/locale.js';
10
-
11
- type EntrypointPluginTemplate = (file: EntrypointFile) => string;
12
- type EntrypointPluginUpdate = (files: ReadonlySet<string>) => Promise<EntrypointEntries>;
13
- interface EntrypointPluginModule {
1
+ import { Compiler, EntryNormalized } from "@rspack/core";
2
+ import { RspackVirtualModulePlugin as VirtualModulesPlugin } from "rspack-plugin-virtual-module";
3
+ import { EntrypointEntries, EntrypointFile } from "../../../types/entrypoint.js";
4
+ export type EntrypointPluginTemplate = (file: EntrypointFile) => string;
5
+ export type EntrypointPluginUpdate = (files: ReadonlySet<string>) => Promise<EntrypointEntries>;
6
+ export interface EntrypointPluginModule {
14
7
  /**
15
8
  * Virtual module name, used in the rspack entry and virtual module.
16
9
  */
@@ -20,9 +13,9 @@ interface EntrypointPluginModule {
20
13
  */
21
14
  module: string;
22
15
  }
23
- type EntrypointPluginModules = Map<EntrypointFile, EntrypointPluginModule>;
24
- type EntrypointPluginEntryModules = Map<string, EntrypointPluginModules>;
25
- declare class EntrypointPlugin {
16
+ export type EntrypointPluginModules = Map<EntrypointFile, EntrypointPluginModule>;
17
+ export type EntrypointPluginEntryModules = Map<string, EntrypointPluginModules>;
18
+ export default class EntrypointPlugin {
26
19
  private readonly entries;
27
20
  private readonly pluginName;
28
21
  private _plugin?;
@@ -30,7 +23,7 @@ declare class EntrypointPlugin {
30
23
  protected template?: EntrypointPluginTemplate;
31
24
  protected update?: EntrypointPluginUpdate;
32
25
  static filename(file: EntrypointFile): string;
33
- protected get plugin(): RspackVirtualModulePlugin;
26
+ protected get plugin(): VirtualModulesPlugin;
34
27
  protected get modules(): EntrypointPluginEntryModules;
35
28
  protected get watchFiles(): ReadonlySet<string>;
36
29
  static from(entries: EntrypointEntries): EntrypointPlugin;
@@ -43,5 +36,3 @@ declare class EntrypointPlugin {
43
36
  protected createModules(entries: EntrypointEntries): EntrypointPluginEntryModules;
44
37
  protected getModuleContents(modules: EntrypointPluginEntryModules): Map<string, string>;
45
38
  }
46
-
47
- export { type EntrypointPluginEntryModules, type EntrypointPluginModule, type EntrypointPluginModules, type EntrypointPluginTemplate, type EntrypointPluginUpdate, EntrypointPlugin as default };
@@ -5,6 +5,7 @@ class EntrypointPlugin {
5
5
  constructor(entries = /* @__PURE__ */ new Map()) {
6
6
  this.entries = entries;
7
7
  }
8
+ entries;
8
9
  pluginName = "EntrypointPlugin";
9
10
  _plugin;
10
11
  _modules;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/bundler/plugins/EntrypointPlugin.ts"],"sourcesContent":["import _ from \"lodash\";\nimport path from \"path\";\n\nimport {Compiler, EntryNormalized} from \"@rspack/core\";\nimport {RspackVirtualModulePlugin as VirtualModulesPlugin} from \"rspack-plugin-virtual-module\";\n\nimport {EntrypointEntries, EntrypointFile} from \"@typing/entrypoint\";\n\nexport type EntrypointPluginTemplate = (file: EntrypointFile) => string;\n\nexport type EntrypointPluginUpdate = (files: ReadonlySet<string>) => Promise<EntrypointEntries>;\n\nexport interface EntrypointPluginModule {\n /**\n * Virtual module name, used in the rspack entry and virtual module.\n */\n name: string;\n\n /**\n * Virtual module content.\n */\n module: string;\n}\n\nexport type EntrypointPluginModules = Map<EntrypointFile, EntrypointPluginModule>;\n\nexport type EntrypointPluginEntryModules = Map<string, EntrypointPluginModules>;\n\nexport default class EntrypointPlugin {\n private readonly pluginName: string = \"EntrypointPlugin\";\n\n private _plugin?: VirtualModulesPlugin;\n private _modules?: EntrypointPluginEntryModules;\n\n protected template?: EntrypointPluginTemplate;\n protected update?: EntrypointPluginUpdate;\n\n public static filename(file: EntrypointFile): string {\n let name = file.file;\n\n if (file.external) {\n const {ext} = path.parse(name);\n name = file.import + ext;\n }\n\n return path.join(\"virtual\", name);\n }\n\n protected get plugin(): VirtualModulesPlugin {\n if (this._plugin) {\n return this._plugin;\n }\n\n const modules = Object.fromEntries(this.getModuleContents(this.modules));\n\n return (this._plugin = new VirtualModulesPlugin(modules, \"entrypoint\"));\n }\n\n protected get modules(): EntrypointPluginEntryModules {\n return (this._modules ??= this.createModules(this.entries));\n }\n\n protected get watchFiles(): ReadonlySet<string> {\n const files = Array.from(this.modules.values())\n .flatMap(modules => Array.from(modules.keys()))\n .filter(({external}) => !external)\n .map(({file}) => file);\n\n return new Set(files);\n }\n\n public static from(entries: EntrypointEntries): EntrypointPlugin {\n return new EntrypointPlugin(entries);\n }\n\n constructor(private readonly entries: EntrypointEntries = new Map()) {}\n\n public virtual(template: EntrypointPluginTemplate): this {\n this.template = template;\n\n return this;\n }\n\n public watch(update: EntrypointPluginUpdate): this {\n this.update = update;\n\n return this;\n }\n\n public apply(compiler: Compiler): void {\n this.plugin.apply(compiler);\n\n compiler.hooks.entryOption.tap(this.pluginName, (_, entry) => {\n this.hookEntryOption(entry);\n });\n\n if (this.update) {\n compiler.hooks.watchRun.tapAsync(this.pluginName, (compiler, callback) => {\n this.hookWatchRun(compiler)\n .then(() => callback())\n .catch(callback);\n });\n }\n }\n\n protected hookEntryOption(entry: EntryNormalized): void {\n if (_.isPlainObject(entry)) {\n this.modules.entries().forEach(([name, modules]) => {\n let currentFiles = structuredClone(entry[name] ?? []);\n\n if (\"import\" in currentFiles) {\n currentFiles = currentFiles.import;\n }\n\n currentFiles.push(...Array.from(modules.values(), ({name}) => name));\n\n entry[name] = {\n import: _.uniq(currentFiles),\n };\n });\n } else {\n throw new Error(\"EntrypointPlugin: entry is not an object\");\n }\n }\n\n protected async hookWatchRun(compiler: Compiler): Promise<void> {\n const {modifiedFiles = new Set()} = compiler;\n\n const watchFiles = this.watchFiles;\n\n const needUpdate = Array.from(modifiedFiles).some(file => {\n if (path.isAbsolute(file)) {\n file = path.relative(compiler.context, file);\n }\n\n return watchFiles.has(file);\n });\n\n if (!needUpdate) {\n return;\n }\n\n const updatedEntries = await this.update!(modifiedFiles);\n\n const updatedModules = this.createModules(updatedEntries);\n\n const currentContents = this.getModuleContents(this.modules);\n const updatedContents = this.getModuleContents(updatedModules);\n\n const removedContents = new Map(Array.from(currentContents).filter(entry => !updatedContents.has(entry[0])));\n\n const addedContents = new Map(Array.from(updatedContents).filter(entry => !currentContents.has(entry[0])));\n\n if (removedContents.size > 0 || addedContents.size > 0) {\n removedContents.keys().forEach(name => {\n this.plugin.writeModule(name, \"\");\n });\n\n addedContents.forEach((content, name) => {\n this.plugin.writeModule(name, content);\n });\n\n updatedModules.entries().forEach(([name, modules]) => {\n let entry: string[] = structuredClone(compiler.options.entry[name]);\n\n if (\"import\" in entry) {\n entry = entry.import as string[];\n }\n\n entry = entry.filter(file => !removedContents.has(file));\n\n entry.push(...Array.from(modules.values(), ({name}) => name));\n\n compiler.options.entry[name] = _.uniq(entry);\n });\n }\n\n this._modules = updatedModules;\n }\n\n protected createModules(entries: EntrypointEntries): EntrypointPluginEntryModules {\n const entryModules: EntrypointPluginEntryModules = new Map();\n\n for (const [name, files] of entries) {\n const modules: EntrypointPluginModules = new Map();\n\n for (const file of files) {\n modules.set(file, {\n name: EntrypointPlugin.filename(file),\n module: this.template ? this.template(file) : \"\",\n });\n }\n\n entryModules.set(name, modules);\n }\n\n return entryModules;\n }\n\n protected getModuleContents(modules: EntrypointPluginEntryModules): Map<string, string> {\n const content = new Map<string, string>();\n\n modules.values().forEach(modules => {\n modules.forEach(({name, module}) => {\n content.set(name, module);\n });\n });\n\n return content;\n }\n}\n"],"mappings":"AAAA,OAAO,OAAO;AACd,OAAO,UAAU;AAGjB,SAAQ,6BAA6B,4BAA2B;AAwBhE,MAAO,iBAA+B;AAAA,EA+ClC,YAA6B,UAA6B,oBAAI,IAAI,GAAG;AAAxC;AAAA,EAAyC;AAAA,EA9CrD,aAAqB;AAAA,EAE9B;AAAA,EACA;AAAA,EAEE;AAAA,EACA;AAAA,EAEV,OAAc,SAAS,MAA8B;AACjD,QAAI,OAAO,KAAK;AAEhB,QAAI,KAAK,UAAU;AACf,YAAM,EAAC,IAAG,IAAI,KAAK,MAAM,IAAI;AAC7B,aAAO,KAAK,SAAS;AAAA,IACzB;AAEA,WAAO,KAAK,KAAK,WAAW,IAAI;AAAA,EACpC;AAAA,EAEA,IAAc,SAA+B;AACzC,QAAI,KAAK,SAAS;AACd,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,UAAU,OAAO,YAAY,KAAK,kBAAkB,KAAK,OAAO,CAAC;AAEvE,WAAQ,KAAK,UAAU,IAAI,qBAAqB,SA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M,OAAO;AAAA,MACzC,CAAC;AAED,qBAAe,QAAQ,EAAE,QAAQ,CAAC,CAAC,MAAM,OAAO,MAAM;AAClD,YAAI,QAAkB,gBAAgB,SAAS,QAAQ,MAAM,IAAI,CAAC;AAElE,YAAI,YAAY,OAAO;AACnB,kBAAQ,MAAM;AAAA,QAClB;AAEA,gBAAQ,MAAM,OAAO,UAAQ,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAEvD,cAAM,KAAK,GAAG,MAAM,KAAK,QAAQ,OAAO,GAAG,CAAC,EAAC,MAAAA,MAAI,MAAMA,KAAI,CAAC;AAE5D,iBAAS,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK;AAAA,MAC/C,CAAC;AAAA,IACL;AAEA,SAAK,WAAW;AAAA,EACpB;AAAA,EAEU,cAAc,SAA0D;AAC9E,UAAM,eAA6C,oBAAI,IAAI;AAE3D,eAAW,CAAC,MAAM,KAAK,KAAK,SAAS;AACjC,YAAM,UAAmC,oBAAI,IAAI;AAEjD,iBAAW,QAAQ,OAAO;AACtB,gBAAQ,IAAI,MAAM;AAAA,UACd,MAAM,iBAAiB,SAAS,IAAI;AAAA,UACpC,QAAQ,KAAK,WAAW,KAAK,SAAS,IAAI,IAAI;AAAA,QAClD,CAAC;AAAA,MACL;AAEA,mBAAa,IAAI,MAAM,OAAO;AAAA,IAClC;AAEA,WAAO;AAAA,EACX;AAAA,EAEU,kBAAkB,SAA4D;AACpF,UAAM,UAAU,oBAAI,IAAoB;AAExC,YAAQ,OAAO,EAAE,QAAQ,CAAAC,aAAW;AAChC,MAAAA,SAAQ,QAAQ,CAAC,EAAC,MAAM,OAAM,MAAM;AAChC,gBAAQ,IAAI,MAAM,MAAM;AAAA,MAC5B,CAAC;AAAA,IACL,CAAC;AAED,WAAO;AAAA,EACX;AACJ;","names":["_","compiler","name","modules"]}
1
+ {"version":3,"sources":["../../../../src/cli/bundler/plugins/EntrypointPlugin.ts"],"sourcesContent":["import _ from \"lodash\";\nimport path from \"path\";\n\nimport {Compiler, EntryNormalized} from \"@rspack/core\";\nimport {RspackVirtualModulePlugin as VirtualModulesPlugin} from \"rspack-plugin-virtual-module\";\n\nimport {EntrypointEntries, EntrypointFile} from \"@typing/entrypoint\";\n\nexport type EntrypointPluginTemplate = (file: EntrypointFile) => string;\n\nexport type EntrypointPluginUpdate = (files: ReadonlySet<string>) => Promise<EntrypointEntries>;\n\nexport interface EntrypointPluginModule {\n /**\n * Virtual module name, used in the rspack entry and virtual module.\n */\n name: string;\n\n /**\n * Virtual module content.\n */\n module: string;\n}\n\nexport type EntrypointPluginModules = Map<EntrypointFile, EntrypointPluginModule>;\n\nexport type EntrypointPluginEntryModules = Map<string, EntrypointPluginModules>;\n\nexport default class EntrypointPlugin {\n private readonly pluginName: string = \"EntrypointPlugin\";\n\n private _plugin?: VirtualModulesPlugin;\n private _modules?: EntrypointPluginEntryModules;\n\n protected template?: EntrypointPluginTemplate;\n protected update?: EntrypointPluginUpdate;\n\n public static filename(file: EntrypointFile): string {\n let name = file.file;\n\n if (file.external) {\n const {ext} = path.parse(name);\n name = file.import + ext;\n }\n\n return path.join(\"virtual\", name);\n }\n\n protected get plugin(): VirtualModulesPlugin {\n if (this._plugin) {\n return this._plugin;\n }\n\n const modules = Object.fromEntries(this.getModuleContents(this.modules));\n\n return (this._plugin = new VirtualModulesPlugin(modules, \"entrypoint\"));\n }\n\n protected get modules(): EntrypointPluginEntryModules {\n return (this._modules ??= this.createModules(this.entries));\n }\n\n protected get watchFiles(): ReadonlySet<string> {\n const files = Array.from(this.modules.values())\n .flatMap(modules => Array.from(modules.keys()))\n .filter(({external}) => !external)\n .map(({file}) => file);\n\n return new Set(files);\n }\n\n public static from(entries: EntrypointEntries): EntrypointPlugin {\n return new EntrypointPlugin(entries);\n }\n\n constructor(private readonly entries: EntrypointEntries = new Map()) {}\n\n public virtual(template: EntrypointPluginTemplate): this {\n this.template = template;\n\n return this;\n }\n\n public watch(update: EntrypointPluginUpdate): this {\n this.update = update;\n\n return this;\n }\n\n public apply(compiler: Compiler): void {\n this.plugin.apply(compiler);\n\n compiler.hooks.entryOption.tap(this.pluginName, (_, entry) => {\n this.hookEntryOption(entry);\n });\n\n if (this.update) {\n compiler.hooks.watchRun.tapAsync(this.pluginName, (compiler, callback) => {\n this.hookWatchRun(compiler)\n .then(() => callback())\n .catch(callback);\n });\n }\n }\n\n protected hookEntryOption(entry: EntryNormalized): void {\n if (_.isPlainObject(entry)) {\n this.modules.entries().forEach(([name, modules]) => {\n let currentFiles = structuredClone(entry[name] ?? []);\n\n if (\"import\" in currentFiles) {\n currentFiles = currentFiles.import;\n }\n\n currentFiles.push(...Array.from(modules.values(), ({name}) => name));\n\n entry[name] = {\n import: _.uniq(currentFiles),\n };\n });\n } else {\n throw new Error(\"EntrypointPlugin: entry is not an object\");\n }\n }\n\n protected async hookWatchRun(compiler: Compiler): Promise<void> {\n const {modifiedFiles = new Set()} = compiler;\n\n const watchFiles = this.watchFiles;\n\n const needUpdate = Array.from(modifiedFiles).some(file => {\n if (path.isAbsolute(file)) {\n file = path.relative(compiler.context, file);\n }\n\n return watchFiles.has(file);\n });\n\n if (!needUpdate) {\n return;\n }\n\n const updatedEntries = await this.update!(modifiedFiles);\n\n const updatedModules = this.createModules(updatedEntries);\n\n const currentContents = this.getModuleContents(this.modules);\n const updatedContents = this.getModuleContents(updatedModules);\n\n const removedContents = new Map(Array.from(currentContents).filter(entry => !updatedContents.has(entry[0])));\n\n const addedContents = new Map(Array.from(updatedContents).filter(entry => !currentContents.has(entry[0])));\n\n if (removedContents.size > 0 || addedContents.size > 0) {\n removedContents.keys().forEach(name => {\n this.plugin.writeModule(name, \"\");\n });\n\n addedContents.forEach((content, name) => {\n this.plugin.writeModule(name, content);\n });\n\n updatedModules.entries().forEach(([name, modules]) => {\n let entry: string[] = structuredClone(compiler.options.entry[name]);\n\n if (\"import\" in entry) {\n entry = entry.import as string[];\n }\n\n entry = entry.filter(file => !removedContents.has(file));\n\n entry.push(...Array.from(modules.values(), ({name}) => name));\n\n compiler.options.entry[name] = _.uniq(entry);\n });\n }\n\n this._modules = updatedModules;\n }\n\n protected createModules(entries: EntrypointEntries): EntrypointPluginEntryModules {\n const entryModules: EntrypointPluginEntryModules = new Map();\n\n for (const [name, files] of entries) {\n const modules: EntrypointPluginModules = new Map();\n\n for (const file of files) {\n modules.set(file, {\n name: EntrypointPlugin.filename(file),\n module: this.template ? this.template(file) : \"\",\n });\n }\n\n entryModules.set(name, modules);\n }\n\n return entryModules;\n }\n\n protected getModuleContents(modules: EntrypointPluginEntryModules): Map<string, string> {\n const content = new Map<string, string>();\n\n modules.values().forEach(modules => {\n modules.forEach(({name, module}) => {\n content.set(name, module);\n });\n });\n\n return content;\n }\n}\n"],"mappings":"AAAA,OAAO,OAAO;AACd,OAAO,UAAU;AAGjB,SAAQ,6BAA6B,4BAA2B;AAwBhE,MAAO,iBAA+B;AAAA,EA+ClC,YAA6B,UAA6B,oBAAI,IAAI,GAAG;AAAxC;AAAA,EAAyC;AAAA,EAAzC;AAAA,EA9CZ,aAAqB;AAAA,EAE9B;AAAA,EACA;AAAA,EAEE;AAAA,EACA;AAAA,EAEV,OAAc,SAAS,MAA8B;AACjD,QAAI,OAAO,KAAK;AAEhB,QAAI,KAAK,UAAU;AACf,YAAM,EAAC,IAAG,IAAI,KAAK,MAAM,IAAI;AAC7B,aAAO,KAAK,SAAS;AAAA,IACzB;AAEA,WAAO,KAAK,KAAK,WAAW,IAAI;AAAA,EACpC;AAAA,EAEA,IAAc,SAA+B;AACzC,QAAI,KAAK,SAAS;AACd,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,UAAU,OAAO,YAAY,KAAK,kBAAkB,KAAK,OAAO,CAAC;AAEvE,WAAQ,KAAK,UAAU,IAAI,qBAAqB,SAAS,YAAY;AAAA,EACzE;AAAA,EAEA,IAAc,UAAwC;AAClD,WAAQ,KAAK,aAAL,KAAK,WAAa,KAAK,cAAc,KAAK,OAAO;AAAA,EAC7D;AAAA,EAE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AAM,IAAI,CAAC;AAElE,YAAI,YAAY,OAAO;AACnB,kBAAQ,MAAM;AAAA,QAClB;AAEA,gBAAQ,MAAM,OAAO,UAAQ,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAEvD,cAAM,KAAK,GAAG,MAAM,KAAK,QAAQ,OAAO,GAAG,CAAC,EAAC,MAAAA,MAAI,MAAMA,KAAI,CAAC;AAE5D,iBAAS,QAAQ,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK;AAAA,MAC/C,CAAC;AAAA,IACL;AAEA,SAAK,WAAW;AAAA,EACpB;AAAA,EAEU,cAAc,SAA0D;AAC9E,UAAM,eAA6C,oBAAI,IAAI;AAE3D,eAAW,CAAC,MAAM,KAAK,KAAK,SAAS;AACjC,YAAM,UAAmC,oBAAI,IAAI;AAEjD,iBAAW,QAAQ,OAAO;AACtB,gBAAQ,IAAI,MAAM;AAAA,UACd,MAAM,iBAAiB,SAAS,IAAI;AAAA,UACpC,QAAQ,KAAK,WAAW,KAAK,SAAS,IAAI,IAAI;AAAA,QAClD,CAAC;AAAA,MACL;AAEA,mBAAa,IAAI,MAAM,OAAO;AAAA,IAClC;AAEA,WAAO;AAAA,EACX;AAAA,EAEU,kBAAkB,SAA4D;AACpF,UAAM,UAAU,oBAAI,IAAoB;AAExC,YAAQ,OAAO,EAAE,QAAQ,CAAAC,aAAW;AAChC,MAAAA,SAAQ,QAAQ,CAAC,EAAC,MAAM,OAAM,MAAM;AAChC,gBAAQ,IAAI,MAAM,MAAM;AAAA,MAC5B,CAAC;AAAA,IACL,CAAC;AAED,WAAO;AAAA,EACX;AACJ;","names":["_","compiler","name","modules"]}
@@ -1,13 +1,12 @@
1
- import { Compiler, Compilation } from '@rspack/core';
2
-
1
+ import { Compilation, Compiler } from "@rspack/core";
3
2
  type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
4
3
  interface JsonObject {
5
4
  [key: string]: JsonValue;
6
5
  }
7
6
  type JsonArray = JsonValue[];
8
- type GenerateJsonPluginData = Record<string, JsonValue>;
9
- type GenerateJsonPluginUpdate = () => Promise<GenerateJsonPluginData>;
10
- declare class GenerateJsonPlugin {
7
+ export type GenerateJsonPluginData = Record<string, JsonValue>;
8
+ export type GenerateJsonPluginUpdate = () => Promise<GenerateJsonPluginData>;
9
+ export default class GenerateJsonPlugin {
11
10
  protected data: GenerateJsonPluginData;
12
11
  private readonly pluginName;
13
12
  private update?;
@@ -16,5 +15,4 @@ declare class GenerateJsonPlugin {
16
15
  watch(update: GenerateJsonPluginUpdate): this;
17
16
  protected generateFiles(compilation: Compilation): void;
18
17
  }
19
-
20
- export { type GenerateJsonPluginData, type GenerateJsonPluginUpdate, GenerateJsonPlugin as default };
18
+ export {};
@@ -3,6 +3,7 @@ class GenerateJsonPlugin {
3
3
  constructor(data) {
4
4
  this.data = data;
5
5
  }
6
+ data;
6
7
  pluginName = "GenerateJsonPlugin";
7
8
  update;
8
9
  apply(compiler) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/bundler/plugins/GenerateJsonPlugin.ts"],"sourcesContent":["import {Compilation, Compiler, sources} from \"@rspack/core\";\n\ntype JsonValue = string | number | boolean | null | JsonObject | JsonArray;\n\ninterface JsonObject {\n [key: string]: JsonValue;\n}\n\ntype JsonArray = JsonValue[];\n\nexport type GenerateJsonPluginData = Record<string, JsonValue>;\n\nexport type GenerateJsonPluginUpdate = () => Promise<GenerateJsonPluginData>;\n\nexport default class GenerateJsonPlugin {\n private readonly pluginName: string = \"GenerateJsonPlugin\";\n\n private update?: GenerateJsonPluginUpdate;\n\n constructor(protected data: GenerateJsonPluginData) {}\n\n public apply(compiler: Compiler): void {\n compiler.hooks.watchRun.tapPromise(this.pluginName, async () => {\n try {\n const update = this.update;\n\n if (update) {\n this.data = await update();\n }\n } catch (e) {\n console.error(\"GenerateJsonPlugin: Error updating data\", e);\n }\n });\n\n compiler.hooks.compilation.tap(this.pluginName, (compilation: Compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: this.pluginName,\n stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,\n },\n () => this.generateFiles(compilation)\n );\n });\n }\n\n public watch(update: GenerateJsonPluginUpdate): this {\n this.update = update;\n\n return this;\n }\n\n protected generateFiles(compilation: Compilation): void {\n Object.entries(this.data).forEach(([filename, jsonData]) => {\n const json = JSON.stringify(jsonData, null, 2);\n\n compilation.emitAsset(filename, new sources.RawSource(json));\n });\n }\n}\n"],"mappings":"AAAA,SAAQ,aAAuB,eAAc;AAc7C,MAAO,mBAAiC;AAAA,EAKpC,YAAsB,MAA8B;AAA9B;AAAA,EAA+B;AAAA,EAJpC,aAAqB;AAAA,EAE9B;AAAA,EAID,MAAM,UAA0B;AACnC,aAAS,MAAM,SAAS,WAAW,KAAK,YAAY,YAAY;AAC5D,UAAI;AACA,cAAM,SAAS,KAAK;AAEpB,YAAI,QAAQ;AACR,eAAK,OAAO,MAAM,OAAO;AAAA,QAC7B;AAAA,MACJ,SAAS,GAAG;AACR,gBAAQ,MAAM,2CAA2C,CAAC;AAAA,MAC9D;AAAA,IACJ,CAAC;AAED,aAAS,MAAM,YAAY,IAAI,KAAK,YAAY,CAAC,gBAA6B;AAC1E,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM,KAAK;AAAA,UACX,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,MAAM,KAAK,cAAc,WAAW;AAAA,MACxC;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEO,MAAM,QAAwC;AACjD,SAAK,SAAS;AAEd,WAAO;AAAA,EACX;AAAA,EAEU,cAAc,aAAgC;AACpD,WAAO,QAAQ,KAAK,IAAI,EAAE,QAAQ,CAAC,CAAC,UAAU,QAAQ,MAAM;AACxD,YAAM,OAAO,KAAK,UAAU,UAAU,MAAM,CAAC;AAE7C,kBAAY,UAAU,UAAU,IAAI,QAAQ,UAAU,IAAI,CAAC;AAAA,IAC/D,CAAC;AAAA,EACL;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/bundler/plugins/GenerateJsonPlugin.ts"],"sourcesContent":["import {Compilation, Compiler, sources} from \"@rspack/core\";\n\ntype JsonValue = string | number | boolean | null | JsonObject | JsonArray;\n\ninterface JsonObject {\n [key: string]: JsonValue;\n}\n\ntype JsonArray = JsonValue[];\n\nexport type GenerateJsonPluginData = Record<string, JsonValue>;\n\nexport type GenerateJsonPluginUpdate = () => Promise<GenerateJsonPluginData>;\n\nexport default class GenerateJsonPlugin {\n private readonly pluginName: string = \"GenerateJsonPlugin\";\n\n private update?: GenerateJsonPluginUpdate;\n\n constructor(protected data: GenerateJsonPluginData) {}\n\n public apply(compiler: Compiler): void {\n compiler.hooks.watchRun.tapPromise(this.pluginName, async () => {\n try {\n const update = this.update;\n\n if (update) {\n this.data = await update();\n }\n } catch (e) {\n console.error(\"GenerateJsonPlugin: Error updating data\", e);\n }\n });\n\n compiler.hooks.compilation.tap(this.pluginName, (compilation: Compilation) => {\n compilation.hooks.processAssets.tap(\n {\n name: this.pluginName,\n stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,\n },\n () => this.generateFiles(compilation)\n );\n });\n }\n\n public watch(update: GenerateJsonPluginUpdate): this {\n this.update = update;\n\n return this;\n }\n\n protected generateFiles(compilation: Compilation): void {\n Object.entries(this.data).forEach(([filename, jsonData]) => {\n const json = JSON.stringify(jsonData, null, 2);\n\n compilation.emitAsset(filename, new sources.RawSource(json));\n });\n }\n}\n"],"mappings":"AAAA,SAAQ,aAAuB,eAAc;AAc7C,MAAO,mBAAiC;AAAA,EAKpC,YAAsB,MAA8B;AAA9B;AAAA,EAA+B;AAAA,EAA/B;AAAA,EAJL,aAAqB;AAAA,EAE9B;AAAA,EAID,MAAM,UAA0B;AACnC,aAAS,MAAM,SAAS,WAAW,KAAK,YAAY,YAAY;AAC5D,UAAI;AACA,cAAM,SAAS,KAAK;AAEpB,YAAI,QAAQ;AACR,eAAK,OAAO,MAAM,OAAO;AAAA,QAC7B;AAAA,MACJ,SAAS,GAAG;AACR,gBAAQ,MAAM,2CAA2C,CAAC;AAAA,MAC9D;AAAA,IACJ,CAAC;AAED,aAAS,MAAM,YAAY,IAAI,KAAK,YAAY,CAAC,gBAA6B;AAC1E,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM,KAAK;AAAA,UACX,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,MAAM,KAAK,cAAc,WAAW;AAAA,MACxC;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEO,MAAM,QAAwC;AACjD,SAAK,SAAS;AAEd,WAAO;AAAA,EACX;AAAA,EAEU,cAAc,aAAgC;AACpD,WAAO,QAAQ,KAAK,IAAI,EAAE,QAAQ,CAAC,CAAC,UAAU,QAAQ,MAAM;AACxD,YAAM,OAAO,KAAK,UAAU,UAAU,MAAM,CAAC;AAE7C,kBAAY,UAAU,UAAU,IAAI,QAAQ,UAAU,IAAI,CAAC;AAAA,IAC/D,CAAC;AAAA,EACL;AACJ;","names":[]}
@@ -1,12 +1,5 @@
1
- import { Compiler } from '@rspack/core';
2
- import { T as ManifestBuilder } from '../../../manifest-DKvERQ4d.js';
3
- import 'react';
4
- import 'utility-types';
5
- import '../../../types/app.js';
6
- import '../../../types/browser.js';
7
- import '../../../types/helpers.js';
8
- import '../../../types/locale.js';
9
-
1
+ import { Compiler } from "@rspack/core";
2
+ import { ManifestBuilder } from "../../../types/manifest.js";
10
3
  declare class ManifestPlugin {
11
4
  private readonly manifest;
12
5
  constructor(manifest: ManifestBuilder);
@@ -14,5 +7,4 @@ declare class ManifestPlugin {
14
7
  private collectAllChunks;
15
8
  private isAsset;
16
9
  }
17
-
18
- export { ManifestPlugin as default };
10
+ export default ManifestPlugin;
@@ -4,6 +4,7 @@ class ManifestPlugin {
4
4
  constructor(manifest) {
5
5
  this.manifest = manifest;
6
6
  }
7
+ manifest;
7
8
  apply(compiler) {
8
9
  compiler.hooks.compilation.tap("ManifestPlugin", (compilation) => {
9
10
  compilation.hooks.processAssets.tap(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/bundler/plugins/ManifestPlugin.ts"],"sourcesContent":["import rspack, {Chunk, Compilation, Compiler} from \"@rspack/core\";\n\nimport {toPosix} from \"@cli/utils/path\";\n\nimport {ManifestBuilder, ManifestDependencies, ManifestDependency} from \"@typing/manifest\";\n\nclass ManifestPlugin {\n constructor(private readonly manifest: ManifestBuilder) {}\n\n apply(compiler: Compiler): void {\n compiler.hooks.compilation.tap(\"ManifestPlugin\", compilation => {\n compilation.hooks.processAssets.tap(\n {\n name: \"ManifestPlugin\",\n stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n () => {\n const entryDependencies: ManifestDependencies = new Map();\n\n compilation.entrypoints.forEach((entryPoint, entryName) => {\n const dependencies: ManifestDependency = {\n assets: new Set(),\n css: new Set(),\n js: new Set(),\n };\n\n const allChunks = new Set<Chunk>();\n\n this.collectAllChunks(entryPoint, allChunks);\n\n allChunks.forEach((chunk: Chunk) => {\n chunk.files.forEach((fileName: string) => {\n fileName = toPosix(fileName);\n\n if (fileName.endsWith(\".js\")) {\n dependencies.js.add(fileName);\n } else if (fileName.endsWith(\".css\")) {\n dependencies.css.add(fileName);\n } else if (this.isAsset(fileName)) {\n dependencies.assets.add(fileName);\n }\n });\n\n const auxiliaryFiles = chunk.auxiliaryFiles || [];\n\n auxiliaryFiles.forEach((fileName: string) => {\n fileName = toPosix(fileName);\n\n if (fileName.endsWith(\".css\")) {\n dependencies.css.add(fileName);\n } else if (this.isAsset(fileName)) {\n dependencies.assets.add(fileName);\n }\n });\n });\n\n entryDependencies.set(entryName, dependencies);\n });\n\n const manifest = this.manifest.setDependencies(entryDependencies).get();\n const json = JSON.stringify(manifest, null, 2);\n\n compilation.emitAsset(\"manifest.json\", new rspack.sources.RawSource(json));\n }\n );\n });\n }\n\n private collectAllChunks(entryPointOrChunkGroup: any, collectedChunks: Set<Chunk>): Set<Chunk> {\n if (entryPointOrChunkGroup.chunks) {\n entryPointOrChunkGroup.chunks.forEach((chunk: Chunk) => {\n if (!collectedChunks.has(chunk)) {\n collectedChunks.add(chunk);\n }\n });\n }\n\n if (entryPointOrChunkGroup.childrenIterable) {\n for (const childGroup of entryPointOrChunkGroup.childrenIterable) {\n this.collectAllChunks(childGroup, collectedChunks);\n }\n }\n\n return collectedChunks;\n }\n\n private isAsset(file: string): boolean {\n return /\\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/.test(file);\n }\n}\n\nexport default ManifestPlugin;\n"],"mappings":"AAAA,OAAO,UAAgB,mBAA4B;AAEnD,SAAQ,eAAc;AAItB,MAAM,eAAe;AAAA,EACjB,YAA6B,UAA2B;AAA3B;AAAA,EAA4B;AAAA,EAEzD,MAAM,UAA0B;AAC5B,aAAS,MAAM,YAAY,IAAI,kBAAkB,iBAAe;AAC5D,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM;AAAA,UACN,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,MAAM;AACF,gBAAM,oBAA0C,oBAAI,IAAI;AAExD,sBAAY,YAAY,QAAQ,CAAC,YAAY,cAAc;AACvD,kBAAM,eAAmC;AAAA,cACrC,QAAQ,oBAAI,IAAI;AAAA,cAChB,KAAK,oBAAI,IAAI;AAAA,cACb,IAAI,oBAAI,IAAI;AAAA,YAChB;AAEA,kBAAM,YAAY,oBAAI,IAAW;AAEjC,iBAAK,iBAAiB,YAAY,SAAS;AAE3C,sBAAU,QAAQ,CAAC,UAAiB;AAChC,oBAAM,MAAM,QAAQ,CAAC,aAAqB;AACtC,2BAAW,QAAQ,QAAQ;AAE3B,oBAAI,SAAS,SAAS,KAAK,GAAG;AAC1B,+BAAa,GAAG,IAAI,QAAQ;AAAA,gBAChC,WAAW,SAAS,SAAS,MAAM,GAAG;AAClC,+BAAa,IAAI,IAAI,QAAQ;AAAA,gBACjC,WAAW,KAAK,QAAQ,QAAQ,GAAG;AAC/B,+BAAa,OAAO,IAAI,QAAQ;AAAA,gBACpC;AAAA,cACJ,CAAC;AAED,oBAAM,iBAAiB,MAAM,kBAAkB,CAAC;AAEhD,6BAAe,QAAQ,CAAC,aAAqB;AACzC,2BAAW,QAAQ,QAAQ;AAE3B,oBAAI,SAAS,SAAS,MAAM,GAAG;AAC3B,+BAAa,IAAI,IAAI,QAAQ;AAAA,gBACjC,WAAW,KAAK,QAAQ,QAAQ,GAAG;AAC/B,+BAAa,OAAO,IAAI,QAAQ;AAAA,gBACpC;AAAA,cACJ,CAAC;AAAA,YACL,CAAC;AAED,8BAAkB,IAAI,WAAW,YAAY;AAAA,UACjD,CAAC;AAED,gBAAM,WAAW,KAAK,SAAS,gBAAgB,iBAAiB,EAAE,IAAI;AACtE,gBAAM,OAAO,KAAK,UAAU,UAAU,MAAM,CAAC;AAE7C,sBAAY,UAAU,iBAAiB,IAAI,OAAO,QAAQ,UAAU,IAAI,CAAC;AAAA,QAC7E;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEQ,iBAAiB,wBAA6B,iBAAyC;AAC3F,QAAI,uBAAuB,QAAQ;AAC/B,6BAAuB,OAAO,QAAQ,CAAC,UAAiB;AACpD,YAAI,CAAC,gBAAgB,IAAI,KAAK,GAAG;AAC7B,0BAAgB,IAAI,KAAK;AAAA,QAC7B;AAAA,MACJ,CAAC;AAAA,IACL;AAEA,QAAI,uBAAuB,kBAAkB;AACzC,iBAAW,cAAc,uBAAuB,kBAAkB;AAC9D,aAAK,iBAAiB,YAAY,eAAe;AAAA,MACrD;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA,EAEQ,QAAQ,MAAuB;AACnC,WAAO,+CAA+C,KAAK,IAAI;AAAA,EACnE;AACJ;AAEA,IAAO,yBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/bundler/plugins/ManifestPlugin.ts"],"sourcesContent":["import rspack, {Chunk, Compilation, Compiler} from \"@rspack/core\";\n\nimport {toPosix} from \"@cli/utils/path\";\n\nimport {ManifestBuilder, ManifestDependencies, ManifestDependency} from \"@typing/manifest\";\n\nclass ManifestPlugin {\n constructor(private readonly manifest: ManifestBuilder) {}\n\n apply(compiler: Compiler): void {\n compiler.hooks.compilation.tap(\"ManifestPlugin\", compilation => {\n compilation.hooks.processAssets.tap(\n {\n name: \"ManifestPlugin\",\n stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,\n },\n () => {\n const entryDependencies: ManifestDependencies = new Map();\n\n compilation.entrypoints.forEach((entryPoint, entryName) => {\n const dependencies: ManifestDependency = {\n assets: new Set(),\n css: new Set(),\n js: new Set(),\n };\n\n const allChunks = new Set<Chunk>();\n\n this.collectAllChunks(entryPoint, allChunks);\n\n allChunks.forEach((chunk: Chunk) => {\n chunk.files.forEach((fileName: string) => {\n fileName = toPosix(fileName);\n\n if (fileName.endsWith(\".js\")) {\n dependencies.js.add(fileName);\n } else if (fileName.endsWith(\".css\")) {\n dependencies.css.add(fileName);\n } else if (this.isAsset(fileName)) {\n dependencies.assets.add(fileName);\n }\n });\n\n const auxiliaryFiles = chunk.auxiliaryFiles || [];\n\n auxiliaryFiles.forEach((fileName: string) => {\n fileName = toPosix(fileName);\n\n if (fileName.endsWith(\".css\")) {\n dependencies.css.add(fileName);\n } else if (this.isAsset(fileName)) {\n dependencies.assets.add(fileName);\n }\n });\n });\n\n entryDependencies.set(entryName, dependencies);\n });\n\n const manifest = this.manifest.setDependencies(entryDependencies).get();\n const json = JSON.stringify(manifest, null, 2);\n\n compilation.emitAsset(\"manifest.json\", new rspack.sources.RawSource(json));\n }\n );\n });\n }\n\n private collectAllChunks(entryPointOrChunkGroup: any, collectedChunks: Set<Chunk>): Set<Chunk> {\n if (entryPointOrChunkGroup.chunks) {\n entryPointOrChunkGroup.chunks.forEach((chunk: Chunk) => {\n if (!collectedChunks.has(chunk)) {\n collectedChunks.add(chunk);\n }\n });\n }\n\n if (entryPointOrChunkGroup.childrenIterable) {\n for (const childGroup of entryPointOrChunkGroup.childrenIterable) {\n this.collectAllChunks(childGroup, collectedChunks);\n }\n }\n\n return collectedChunks;\n }\n\n private isAsset(file: string): boolean {\n return /\\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/.test(file);\n }\n}\n\nexport default ManifestPlugin;\n"],"mappings":"AAAA,OAAO,UAAgB,mBAA4B;AAEnD,SAAQ,eAAc;AAItB,MAAM,eAAe;AAAA,EACjB,YAA6B,UAA2B;AAA3B;AAAA,EAA4B;AAAA,EAA5B;AAAA,EAE7B,MAAM,UAA0B;AAC5B,aAAS,MAAM,YAAY,IAAI,kBAAkB,iBAAe;AAC5D,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM;AAAA,UACN,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,MAAM;AACF,gBAAM,oBAA0C,oBAAI,IAAI;AAExD,sBAAY,YAAY,QAAQ,CAAC,YAAY,cAAc;AACvD,kBAAM,eAAmC;AAAA,cACrC,QAAQ,oBAAI,IAAI;AAAA,cAChB,KAAK,oBAAI,IAAI;AAAA,cACb,IAAI,oBAAI,IAAI;AAAA,YAChB;AAEA,kBAAM,YAAY,oBAAI,IAAW;AAEjC,iBAAK,iBAAiB,YAAY,SAAS;AAE3C,sBAAU,QAAQ,CAAC,UAAiB;AAChC,oBAAM,MAAM,QAAQ,CAAC,aAAqB;AACtC,2BAAW,QAAQ,QAAQ;AAE3B,oBAAI,SAAS,SAAS,KAAK,GAAG;AAC1B,+BAAa,GAAG,IAAI,QAAQ;AAAA,gBAChC,WAAW,SAAS,SAAS,MAAM,GAAG;AAClC,+BAAa,IAAI,IAAI,QAAQ;AAAA,gBACjC,WAAW,KAAK,QAAQ,QAAQ,GAAG;AAC/B,+BAAa,OAAO,IAAI,QAAQ;AAAA,gBACpC;AAAA,cACJ,CAAC;AAED,oBAAM,iBAAiB,MAAM,kBAAkB,CAAC;AAEhD,6BAAe,QAAQ,CAAC,aAAqB;AACzC,2BAAW,QAAQ,QAAQ;AAE3B,oBAAI,SAAS,SAAS,MAAM,GAAG;AAC3B,+BAAa,IAAI,IAAI,QAAQ;AAAA,gBACjC,WAAW,KAAK,QAAQ,QAAQ,GAAG;AAC/B,+BAAa,OAAO,IAAI,QAAQ;AAAA,gBACpC;AAAA,cACJ,CAAC;AAAA,YACL,CAAC;AAED,8BAAkB,IAAI,WAAW,YAAY;AAAA,UACjD,CAAC;AAED,gBAAM,WAAW,KAAK,SAAS,gBAAgB,iBAAiB,EAAE,IAAI;AACtE,gBAAM,OAAO,KAAK,UAAU,UAAU,MAAM,CAAC;AAE7C,sBAAY,UAAU,iBAAiB,IAAI,OAAO,QAAQ,UAAU,IAAI,CAAC;AAAA,QAC7E;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEQ,iBAAiB,wBAA6B,iBAAyC;AAC3F,QAAI,uBAAuB,QAAQ;AAC/B,6BAAuB,OAAO,QAAQ,CAAC,UAAiB;AACpD,YAAI,CAAC,gBAAgB,IAAI,KAAK,GAAG;AAC7B,0BAAgB,IAAI,KAAK;AAAA,QAC7B;AAAA,MACJ,CAAC;AAAA,IACL;AAEA,QAAI,uBAAuB,kBAAkB;AACzC,iBAAW,cAAc,uBAAuB,kBAAkB;AAC9D,aAAK,iBAAiB,YAAY,eAAe;AAAA,MACrD;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA,EAEQ,QAAQ,MAAuB;AACnC,WAAO,+CAA+C,KAAK,IAAI;AAAA,EACnE;AACJ;AAEA,IAAO,yBAAQ;","names":[]}
@@ -1,12 +1,10 @@
1
- import { Compiler } from '@rspack/core';
2
-
1
+ import { type Compiler } from "@rspack/core";
3
2
  interface ReplaceOptions {
4
3
  values: Record<string, string>;
5
4
  }
6
- declare class ReplacePlugin {
5
+ export default class ReplacePlugin {
7
6
  private options;
8
7
  constructor(options: ReplaceOptions);
9
8
  apply(compiler: Compiler): void;
10
9
  }
11
-
12
- export { ReplacePlugin as default };
10
+ export {};
@@ -2,6 +2,7 @@ class ReplacePlugin {
2
2
  constructor(options) {
3
3
  this.options = options;
4
4
  }
5
+ options;
5
6
  apply(compiler) {
6
7
  compiler.hooks.emit.tap("ReplacePlugin", (compilation) => {
7
8
  for (const filename in compilation.assets) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/bundler/plugins/ReplacePlugin.ts"],"sourcesContent":["import {type Compiler} from \"@rspack/core\";\n\ninterface ReplaceOptions {\n values: Record<string, string>;\n}\n\nexport default class ReplacePlugin {\n constructor(private options: ReplaceOptions) {}\n\n apply(compiler: Compiler): void {\n compiler.hooks.emit.tap(\"ReplacePlugin\", compilation => {\n for (const filename in compilation.assets) {\n let content = compilation.assets[filename].source().toString();\n let hasChanges = false;\n\n for (const [search, replace] of Object.entries(this.options.values)) {\n if (content.includes(search)) {\n content = content.replace(new RegExp(search, \"g\"), replace);\n hasChanges = true;\n }\n }\n\n if (hasChanges) {\n const sourceMap = {\n version: 3,\n sources: [],\n names: [],\n mappings: \"\",\n file: filename,\n };\n\n compilation.assets[filename] = {\n source: () => content,\n size: () => content.length,\n buffer: () => Buffer.from(content),\n map: () => sourceMap,\n sourceAndMap: () => ({source: content, map: sourceMap}),\n updateHash: () => {},\n };\n }\n }\n });\n }\n}\n"],"mappings":"AAMA,MAAO,cAA4B;AAAA,EAC/B,YAAoB,SAAyB;AAAzB;AAAA,EAA0B;AAAA,EAE9C,MAAM,UAA0B;AAC5B,aAAS,MAAM,KAAK,IAAI,iBAAiB,iBAAe;AACpD,iBAAW,YAAY,YAAY,QAAQ;AACvC,YAAI,UAAU,YAAY,OAAO,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC7D,YAAI,aAAa;AAEjB,mBAAW,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,MAAM,GAAG;AACjE,cAAI,QAAQ,SAAS,MAAM,GAAG;AAC1B,sBAAU,QAAQ,QAAQ,IAAI,OAAO,QAAQ,GAAG,GAAG,OAAO;AAC1D,yBAAa;AAAA,UACjB;AAAA,QACJ;AAEA,YAAI,YAAY;AACZ,gBAAM,YAAY;AAAA,YACd,SAAS;AAAA,YACT,SAAS,CAAC;AAAA,YACV,OAAO,CAAC;AAAA,YACR,UAAU;AAAA,YACV,MAAM;AAAA,UACV;AAEA,sBAAY,OAAO,QAAQ,IAAI;AAAA,YAC3B,QAAQ,MAAM;AAAA,YACd,MAAM,MAAM,QAAQ;AAAA,YACpB,QAAQ,MAAM,OAAO,KAAK,OAAO;AAAA,YACjC,KAAK,MAAM;AAAA,YACX,cAAc,OAAO,EAAC,QAAQ,SAAS,KAAK,UAAS;AAAA,YACrD,YAAY,MAAM;AAAA,YAAC;AAAA,UACvB;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/cli/bundler/plugins/ReplacePlugin.ts"],"sourcesContent":["import {type Compiler} from \"@rspack/core\";\n\ninterface ReplaceOptions {\n values: Record<string, string>;\n}\n\nexport default class ReplacePlugin {\n constructor(private options: ReplaceOptions) {}\n\n apply(compiler: Compiler): void {\n compiler.hooks.emit.tap(\"ReplacePlugin\", compilation => {\n for (const filename in compilation.assets) {\n let content = compilation.assets[filename].source().toString();\n let hasChanges = false;\n\n for (const [search, replace] of Object.entries(this.options.values)) {\n if (content.includes(search)) {\n content = content.replace(new RegExp(search, \"g\"), replace);\n hasChanges = true;\n }\n }\n\n if (hasChanges) {\n const sourceMap = {\n version: 3,\n sources: [],\n names: [],\n mappings: \"\",\n file: filename,\n };\n\n compilation.assets[filename] = {\n source: () => content,\n size: () => content.length,\n buffer: () => Buffer.from(content),\n map: () => sourceMap,\n sourceAndMap: () => ({source: content, map: sourceMap}),\n updateHash: () => {},\n };\n }\n }\n });\n }\n}\n"],"mappings":"AAMA,MAAO,cAA4B;AAAA,EAC/B,YAAoB,SAAyB;AAAzB;AAAA,EAA0B;AAAA,EAA1B;AAAA,EAEpB,MAAM,UAA0B;AAC5B,aAAS,MAAM,KAAK,IAAI,iBAAiB,iBAAe;AACpD,iBAAW,YAAY,YAAY,QAAQ;AACvC,YAAI,UAAU,YAAY,OAAO,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC7D,YAAI,aAAa;AAEjB,mBAAW,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,MAAM,GAAG;AACjE,cAAI,QAAQ,SAAS,MAAM,GAAG;AAC1B,sBAAU,QAAQ,QAAQ,IAAI,OAAO,QAAQ,GAAG,GAAG,OAAO;AAC1D,yBAAa;AAAA,UACjB;AAAA,QACJ;AAEA,YAAI,YAAY;AACZ,gBAAM,YAAY;AAAA,YACd,SAAS;AAAA,YACT,SAAS,CAAC;AAAA,YACV,OAAO,CAAC;AAAA,YACR,UAAU;AAAA,YACV,MAAM;AAAA,UACV;AAEA,sBAAY,OAAO,QAAQ,IAAI;AAAA,YAC3B,QAAQ,MAAM;AAAA,YACd,MAAM,MAAM,QAAQ;AAAA,YACpB,QAAQ,MAAM,OAAO,KAAK,OAAO;AAAA,YACjC,KAAK,MAAM;AAAA,YACX,cAAc,OAAO,EAAC,QAAQ,SAAS,KAAK,UAAS;AAAA,YACrD,YAAY,MAAM;AAAA,YAAC;AAAA,UACvB;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":[]}
@@ -1,10 +1,7 @@
1
- import { Compiler } from '@rspack/core';
2
-
3
- type WatchPluginCallback = (files: ReadonlySet<string>) => Promise<void>;
4
- declare class WatchPlugin {
1
+ import { Compiler } from "@rspack/core";
2
+ export type WatchPluginCallback = (files: ReadonlySet<string>) => Promise<void>;
3
+ export default class WatchPlugin {
5
4
  private readonly callback;
6
5
  constructor(callback: WatchPluginCallback);
7
6
  apply(compiler: Compiler): void;
8
7
  }
9
-
10
- export { type WatchPluginCallback, WatchPlugin as default };
@@ -2,6 +2,7 @@ class WatchPlugin {
2
2
  constructor(callback) {
3
3
  this.callback = callback;
4
4
  }
5
+ callback;
5
6
  apply(compiler) {
6
7
  compiler.hooks.watchRun.tapAsync("WatchPlugin", async (compiler2, callback) => {
7
8
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/bundler/plugins/WatchPlugin.ts"],"sourcesContent":["import {Compiler} from \"@rspack/core\";\n\nexport type WatchPluginCallback = (files: ReadonlySet<string>) => Promise<void>;\n\nexport default class WatchPlugin {\n constructor(private readonly callback: WatchPluginCallback) {}\n\n public apply(compiler: Compiler): void {\n compiler.hooks.watchRun.tapAsync(\"WatchPlugin\", async (compiler, callback) => {\n try {\n const {modifiedFiles = new Set()} = compiler;\n\n await this.callback(modifiedFiles);\n\n callback();\n } catch (e) {\n callback(e as Error);\n }\n });\n }\n}\n"],"mappings":"AAIA,MAAO,YAA0B;AAAA,EAC7B,YAA6B,UAA+B;AAA/B;AAAA,EAAgC;AAAA,EAEtD,MAAM,UAA0B;AACnC,aAAS,MAAM,SAAS,SAAS,eAAe,OAAOA,WAAU,aAAa;AAC1E,UAAI;AACA,cAAM,EAAC,gBAAgB,oBAAI,IAAI,EAAC,IAAIA;AAEpC,cAAM,KAAK,SAAS,aAAa;AAEjC,iBAAS;AAAA,MACb,SAAS,GAAG;AACR,iBAAS,CAAU;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":["compiler"]}
1
+ {"version":3,"sources":["../../../../src/cli/bundler/plugins/WatchPlugin.ts"],"sourcesContent":["import {Compiler} from \"@rspack/core\";\n\nexport type WatchPluginCallback = (files: ReadonlySet<string>) => Promise<void>;\n\nexport default class WatchPlugin {\n constructor(private readonly callback: WatchPluginCallback) {}\n\n public apply(compiler: Compiler): void {\n compiler.hooks.watchRun.tapAsync(\"WatchPlugin\", async (compiler, callback) => {\n try {\n const {modifiedFiles = new Set()} = compiler;\n\n await this.callback(modifiedFiles);\n\n callback();\n } catch (e) {\n callback(e as Error);\n }\n });\n }\n}\n"],"mappings":"AAIA,MAAO,YAA0B;AAAA,EAC7B,YAA6B,UAA+B;AAA/B;AAAA,EAAgC;AAAA,EAAhC;AAAA,EAEtB,MAAM,UAA0B;AACnC,aAAS,MAAM,SAAS,SAAS,eAAe,OAAOA,WAAU,aAAa;AAC1E,UAAI;AACA,cAAM,EAAC,gBAAgB,oBAAI,IAAI,EAAC,IAAIA;AAEpC,cAAM,KAAK,SAAS,aAAa;AAEjC,iBAAS;AAAA,MACb,SAAS,GAAG;AACR,iBAAS,CAAU;AAAA,MACvB;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":["compiler"]}