extension-develop 2.1.3 → 3.0.0-next.7

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 (276) hide show
  1. package/README.md +53 -25
  2. package/dist/930.js +44 -0
  3. package/dist/add-centralized-logger-script-background.js +220 -0
  4. package/dist/add-centralized-logger-script-content.js +172 -0
  5. package/dist/add-centralized-logger-script.js +332 -0
  6. package/dist/add-hmr-accept-code.js +5 -11
  7. package/dist/content-script-wrapper.js +166 -0
  8. package/dist/ensure-hmr-for-scripts.js +30 -11
  9. package/dist/minimum-chromium-file.js +6 -20
  10. package/dist/minimum-firefox-file.js +6 -12
  11. package/dist/module.js +12030 -9529
  12. package/dist/resolve-paths-loader.js +1391 -0
  13. package/dist/warn-no-default-export.js +121 -0
  14. package/package.json +21 -35
  15. package/dist/add-content-script-wrapper.js +0 -1789
  16. package/dist/build.d.ts +0 -2
  17. package/dist/cleanup.d.ts +0 -1
  18. package/dist/deprecated-shadow-root.js +0 -135
  19. package/dist/dev.d.ts +0 -2
  20. package/dist/develop-lib/config-types.d.ts +0 -86
  21. package/dist/develop-lib/extract-from-zip.d.ts +0 -1
  22. package/dist/develop-lib/find-nearest-package.d.ts +0 -2
  23. package/dist/develop-lib/generate-extension-types.d.ts +0 -1
  24. package/dist/develop-lib/generate-zip.d.ts +0 -2
  25. package/dist/develop-lib/get-extension-config.d.ts +0 -6
  26. package/dist/develop-lib/get-project-path.d.ts +0 -6
  27. package/dist/develop-lib/install-dependencies.d.ts +0 -2
  28. package/dist/develop-lib/messages.d.ts +0 -36
  29. package/dist/develop-lib/validate-user-dependencies.d.ts +0 -1
  30. package/dist/extensions/chrome-manager-extension/background.js +0 -84
  31. package/dist/extensions/chrome-manager-extension/define-initial-tab.js +0 -77
  32. package/dist/extensions/chrome-manager-extension/images/logo.png +0 -0
  33. package/dist/extensions/chrome-manager-extension/manifest.json +0 -17
  34. package/dist/extensions/chrome-manager-extension/pages/sakura-dark.css +0 -268
  35. package/dist/extensions/chrome-manager-extension/pages/sakura.css +0 -267
  36. package/dist/extensions/chrome-manager-extension/pages/welcome.html +0 -46
  37. package/dist/extensions/chrome-manager-extension/pages/welcome.js +0 -34
  38. package/dist/extensions/chrome-manager-extension/reload-service.js +0 -319
  39. package/dist/extensions/chromium-based-manager-extension/background.js +0 -84
  40. package/dist/extensions/chromium-based-manager-extension/define-initial-tab.js +0 -77
  41. package/dist/extensions/chromium-based-manager-extension/images/logo.png +0 -0
  42. package/dist/extensions/chromium-based-manager-extension/manifest.json +0 -17
  43. package/dist/extensions/chromium-based-manager-extension/pages/sakura-dark.css +0 -268
  44. package/dist/extensions/chromium-based-manager-extension/pages/sakura.css +0 -267
  45. package/dist/extensions/chromium-based-manager-extension/pages/welcome.html +0 -46
  46. package/dist/extensions/chromium-based-manager-extension/pages/welcome.js +0 -34
  47. package/dist/extensions/chromium-based-manager-extension/reload-service.js +0 -324
  48. package/dist/extensions/edge-manager-extension/background.js +0 -82
  49. package/dist/extensions/edge-manager-extension/define-initial-tab.js +0 -77
  50. package/dist/extensions/edge-manager-extension/images/logo.png +0 -0
  51. package/dist/extensions/edge-manager-extension/manifest.json +0 -17
  52. package/dist/extensions/edge-manager-extension/pages/sakura-dark.css +0 -268
  53. package/dist/extensions/edge-manager-extension/pages/sakura.css +0 -267
  54. package/dist/extensions/edge-manager-extension/pages/welcome.html +0 -46
  55. package/dist/extensions/edge-manager-extension/pages/welcome.js +0 -34
  56. package/dist/extensions/edge-manager-extension/reload-service.js +0 -321
  57. package/dist/extensions/firefox-manager-extension/background.js +0 -85
  58. package/dist/extensions/firefox-manager-extension/define-initial-tab.js +0 -64
  59. package/dist/extensions/firefox-manager-extension/images/logo.png +0 -0
  60. package/dist/extensions/firefox-manager-extension/manifest.json +0 -15
  61. package/dist/extensions/firefox-manager-extension/pages/sakura-dark.css +0 -268
  62. package/dist/extensions/firefox-manager-extension/pages/sakura.css +0 -267
  63. package/dist/extensions/firefox-manager-extension/pages/welcome.html +0 -46
  64. package/dist/extensions/firefox-manager-extension/pages/welcome.js +0 -34
  65. package/dist/extensions/firefox-manager-extension/reload-service.js +0 -178
  66. package/dist/extensions/gecko-based-manager-extension/background.js +0 -67
  67. package/dist/extensions/gecko-based-manager-extension/define-initial-tab.js +0 -69
  68. package/dist/extensions/gecko-based-manager-extension/images/logo.png +0 -0
  69. package/dist/extensions/gecko-based-manager-extension/manifest.json +0 -16
  70. package/dist/extensions/gecko-based-manager-extension/pages/sakura-dark.css +0 -268
  71. package/dist/extensions/gecko-based-manager-extension/pages/sakura.css +0 -267
  72. package/dist/extensions/gecko-based-manager-extension/pages/welcome.html +0 -46
  73. package/dist/extensions/gecko-based-manager-extension/pages/welcome.js +0 -34
  74. package/dist/extensions/gecko-based-manager-extension/reload-service.js +0 -171
  75. package/dist/inject-chromium-client-loader.js +0 -176
  76. package/dist/inject-firefox-client-loader.js +0 -169
  77. package/dist/minimum-content-file.js +0 -5
  78. package/dist/module.d.ts +0 -8
  79. package/dist/preview.d.ts +0 -2
  80. package/dist/rslib.config.d.ts +0 -3
  81. package/dist/start.d.ts +0 -2
  82. package/dist/types.d.ts +0 -11
  83. package/dist/vitest.config.d.mts +0 -2
  84. package/dist/webpack/dev-server.d.ts +0 -3
  85. package/dist/webpack/plugin-browsers/browsers-lib/add-progress-bar.d.ts +0 -1
  86. package/dist/webpack/plugin-browsers/browsers-lib/constants.d.ts +0 -5
  87. package/dist/webpack/plugin-browsers/browsers-lib/dynamic-extension-manager.d.ts +0 -35
  88. package/dist/webpack/plugin-browsers/browsers-lib/html-merge.d.ts +0 -1
  89. package/dist/webpack/plugin-browsers/browsers-lib/instance-manager.d.ts +0 -74
  90. package/dist/webpack/plugin-browsers/browsers-lib/messages.d.ts +0 -164
  91. package/dist/webpack/plugin-browsers/browsers-lib/rdp-wire.d.ts +0 -7
  92. package/dist/webpack/plugin-browsers/browsers-lib/shared-utils.d.ts +0 -16
  93. package/dist/webpack/plugin-browsers/browsers-types.d.ts +0 -131
  94. package/dist/webpack/plugin-browsers/index.d.ts +0 -41
  95. package/dist/webpack/plugin-browsers/run-chromium/browser-config.d.ts +0 -3
  96. package/dist/webpack/plugin-browsers/run-chromium/create-profile.d.ts +0 -10
  97. package/dist/webpack/plugin-browsers/run-chromium/index.d.ts +0 -28
  98. package/dist/webpack/plugin-browsers/run-chromium/master-preferences.d.ts +0 -161
  99. package/dist/webpack/plugin-browsers/run-chromium/setup-chrome-inspection/cdp-client.d.ts +0 -29
  100. package/dist/webpack/plugin-browsers/run-chromium/setup-chrome-inspection/index.d.ts +0 -25
  101. package/dist/webpack/plugin-browsers/run-firefox/firefox/binary-detector.d.ts +0 -15
  102. package/dist/webpack/plugin-browsers/run-firefox/firefox/browser-config.d.ts +0 -7
  103. package/dist/webpack/plugin-browsers/run-firefox/firefox/create-profile.d.ts +0 -13
  104. package/dist/webpack/plugin-browsers/run-firefox/firefox/master-preferences.d.ts +0 -95
  105. package/dist/webpack/plugin-browsers/run-firefox/index.d.ts +0 -26
  106. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/index.d.ts +0 -13
  107. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/message-utils.d.ts +0 -2
  108. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/messaging-client.d.ts +0 -42
  109. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/setup-firefox-inspection.d.ts +0 -31
  110. package/dist/webpack/plugin-compatibility/feature-browser-specific-fields.d.ts +0 -9
  111. package/dist/webpack/plugin-compatibility/feature-polyfill.d.ts +0 -12
  112. package/dist/webpack/plugin-compatibility/index.d.ts +0 -13
  113. package/dist/webpack/plugin-compilation/clean-dist.d.ts +0 -8
  114. package/dist/webpack/plugin-compilation/env.d.ts +0 -9
  115. package/dist/webpack/plugin-compilation/index.d.ts +0 -12
  116. package/dist/webpack/plugin-css/common-style-loaders.d.ts +0 -8
  117. package/dist/webpack/plugin-css/css-in-content-script-loader.d.ts +0 -11
  118. package/dist/webpack/plugin-css/css-in-html-loader.d.ts +0 -8
  119. package/dist/webpack/plugin-css/css-tools/less.d.ts +0 -4
  120. package/dist/webpack/plugin-css/css-tools/postcss.d.ts +0 -3
  121. package/dist/webpack/plugin-css/css-tools/sass.d.ts +0 -4
  122. package/dist/webpack/plugin-css/css-tools/stylelint.d.ts +0 -4
  123. package/dist/webpack/plugin-css/css-tools/tailwind.d.ts +0 -2
  124. package/dist/webpack/plugin-css/index.d.ts +0 -9
  125. package/dist/webpack/plugin-css/is-content-script.d.ts +0 -1
  126. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/action.d.ts +0 -2
  127. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/background.d.ts +0 -2
  128. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/browser_action.d.ts +0 -2
  129. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/chrome_url_overrides.d.ts +0 -2
  130. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/devtools_page.d.ts +0 -2
  131. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/index.d.ts +0 -2
  132. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/options_ui.d.ts +0 -2
  133. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/page_action.d.ts +0 -2
  134. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/sandbox.d.ts +0 -2
  135. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/side_panel.d.ts +0 -2
  136. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/sidebar_action.d.ts +0 -2
  137. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/action.d.ts +0 -2
  138. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/browser_action.d.ts +0 -2
  139. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/browser_action.theme_icons.d.ts +0 -2
  140. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/icons.d.ts +0 -2
  141. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/index.d.ts +0 -2
  142. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/normalize.d.ts +0 -6
  143. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/page_action.d.ts +0 -2
  144. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/sidebar_action.d.ts +0 -2
  145. package/dist/webpack/plugin-extension/data/manifest-fields/index.d.ts +0 -19
  146. package/dist/webpack/plugin-extension/data/manifest-fields/json-fields/declarative_net_request.d.ts +0 -2
  147. package/dist/webpack/plugin-extension/data/manifest-fields/json-fields/index.d.ts +0 -2
  148. package/dist/webpack/plugin-extension/data/manifest-fields/json-fields/storage.d.ts +0 -2
  149. package/dist/webpack/plugin-extension/data/manifest-fields/locales-fields/index.d.ts +0 -1
  150. package/dist/webpack/plugin-extension/data/manifest-fields/normalize.d.ts +0 -10
  151. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/background.d.ts +0 -2
  152. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/content_scripts.d.ts +0 -2
  153. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/index.d.ts +0 -2
  154. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/service_worker.d.ts +0 -2
  155. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/user_scripts.d.ts +0 -2
  156. package/dist/webpack/plugin-extension/data/manifest-fields/web-resources-fields/index.d.ts +0 -2
  157. package/dist/webpack/plugin-extension/data/special-folders/generate-entries.d.ts +0 -4
  158. package/dist/webpack/plugin-extension/data/special-folders/index.d.ts +0 -12
  159. package/dist/webpack/plugin-extension/feature-html/__spec__/html-lib/test-utils.d.ts +0 -18
  160. package/dist/webpack/plugin-extension/feature-html/html-lib/parse-html.d.ts +0 -8
  161. package/dist/webpack/plugin-extension/feature-html/html-lib/patch-html.d.ts +0 -8
  162. package/dist/webpack/plugin-extension/feature-html/html-lib/utils.d.ts +0 -18
  163. package/dist/webpack/plugin-extension/feature-html/index.d.ts +0 -37
  164. package/dist/webpack/plugin-extension/feature-html/steps/add-assets-to-compilation.d.ts +0 -11
  165. package/dist/webpack/plugin-extension/feature-html/steps/add-scripts-and-styles-to-compilation.d.ts +0 -10
  166. package/dist/webpack/plugin-extension/feature-html/steps/add-to-file-dependencies.d.ts +0 -10
  167. package/dist/webpack/plugin-extension/feature-html/steps/emit-html-file.d.ts +0 -9
  168. package/dist/webpack/plugin-extension/feature-html/steps/ensure-hmr-for-scripts.d.ts +0 -2
  169. package/dist/webpack/plugin-extension/feature-html/steps/handle-common-errors.d.ts +0 -10
  170. package/dist/webpack/plugin-extension/feature-html/steps/minimum-script-file.d.ts +0 -1
  171. package/dist/webpack/plugin-extension/feature-html/steps/throw-if-recompile-is-needed.d.ts +0 -13
  172. package/dist/webpack/plugin-extension/feature-html/steps/update-html-file.d.ts +0 -10
  173. package/dist/webpack/plugin-extension/feature-icons/index.d.ts +0 -25
  174. package/dist/webpack/plugin-extension/feature-icons/steps/add-to-file-dependencies.d.ts +0 -9
  175. package/dist/webpack/plugin-extension/feature-icons/steps/emit-file.d.ts +0 -9
  176. package/dist/webpack/plugin-extension/feature-json/index.d.ts +0 -18
  177. package/dist/webpack/plugin-extension/feature-locales/get-locales.d.ts +0 -1
  178. package/dist/webpack/plugin-extension/feature-locales/index.d.ts +0 -13
  179. package/dist/webpack/plugin-extension/feature-manifest/index.d.ts +0 -23
  180. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/background.d.ts +0 -10
  181. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/chrome_url_overrides.d.ts +0 -8
  182. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/commands.d.ts +0 -16
  183. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +0 -7
  184. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/content_security_policy.d.ts +0 -4
  185. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/devtools_page.d.ts +0 -4
  186. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/icons.d.ts +0 -6
  187. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/index.d.ts +0 -2
  188. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/omnibox.d.ts +0 -2
  189. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/options_page.d.ts +0 -4
  190. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/options_ui.d.ts +0 -8
  191. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/page_action.d.ts +0 -8
  192. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/permissions.d.ts +0 -4
  193. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/sandbox.d.ts +0 -7
  194. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/sidebar_action.d.ts +0 -2
  195. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/storage.d.ts +0 -6
  196. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/theme.d.ts +0 -2
  197. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/user_scripts.d.ts +0 -2
  198. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/web_accessible_resources.d.ts +0 -9
  199. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/index.d.ts +0 -2
  200. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/background.d.ts +0 -10
  201. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/browser_action.d.ts +0 -12
  202. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/chrome_settings_overrides.d.ts +0 -24
  203. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/index.d.ts +0 -2
  204. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/page_action.d.ts +0 -1
  205. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/sidebar_action.d.ts +0 -1
  206. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/theme_experiment.d.ts +0 -2
  207. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/action.d.ts +0 -8
  208. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/background.d.ts +0 -10
  209. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/declarative_net_request.d.ts +0 -2
  210. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/host_permissions.d.ts +0 -2
  211. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/index.d.ts +0 -2
  212. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/side_panel.d.ts +0 -2
  213. package/dist/webpack/plugin-extension/feature-manifest/steps/add-dependencies.d.ts +0 -6
  214. package/dist/webpack/plugin-extension/feature-manifest/steps/check-manifest-files.d.ts +0 -17
  215. package/dist/webpack/plugin-extension/feature-manifest/steps/emit-manifest.d.ts +0 -7
  216. package/dist/webpack/plugin-extension/feature-manifest/steps/throw-if-recompile.d.ts +0 -11
  217. package/dist/webpack/plugin-extension/feature-manifest/steps/update-manifest.d.ts +0 -9
  218. package/dist/webpack/plugin-extension/feature-scripts/index.d.ts +0 -27
  219. package/dist/webpack/plugin-extension/feature-scripts/scripts-lib/utils.d.ts +0 -3
  220. package/dist/webpack/plugin-extension/feature-scripts/steps/add-content-script-wrapper.d.ts +0 -2
  221. package/dist/webpack/plugin-extension/feature-scripts/steps/add-hmr-accept-code.d.ts +0 -2
  222. package/dist/webpack/plugin-extension/feature-scripts/steps/add-public-path-for-main-world.d.ts +0 -11
  223. package/dist/webpack/plugin-extension/feature-scripts/steps/add-public-path-runtime-module.d.ts +0 -4
  224. package/dist/webpack/plugin-extension/feature-scripts/steps/add-scripts.d.ts +0 -9
  225. package/dist/webpack/plugin-extension/feature-scripts/steps/deprecated-shadow-root.d.ts +0 -2
  226. package/dist/webpack/plugin-extension/feature-scripts/steps/javascript-content-script-wrapper.d.ts +0 -1
  227. package/dist/webpack/plugin-extension/feature-scripts/steps/minimum-content-file.d.ts +0 -0
  228. package/dist/webpack/plugin-extension/feature-scripts/steps/preact-content-script-wrapper.d.ts +0 -1
  229. package/dist/webpack/plugin-extension/feature-scripts/steps/react-content-script-wrapper.d.ts +0 -1
  230. package/dist/webpack/plugin-extension/feature-scripts/steps/svelte-content-script-wrapper.d.ts +0 -1
  231. package/dist/webpack/plugin-extension/feature-scripts/steps/typescript-content-script-wrapper.d.ts +0 -1
  232. package/dist/webpack/plugin-extension/feature-scripts/steps/vue-content-script-wrapper.d.ts +0 -1
  233. package/dist/webpack/plugin-extension/feature-special-folders/copy-public-folder.d.ts +0 -14
  234. package/dist/webpack/plugin-extension/feature-special-folders/index.d.ts +0 -19
  235. package/dist/webpack/plugin-extension/feature-special-folders/warn-upon-folder-changes.d.ts +0 -7
  236. package/dist/webpack/plugin-extension/feature-web-resources/clean-matches.d.ts +0 -7
  237. package/dist/webpack/plugin-extension/feature-web-resources/index.d.ts +0 -18
  238. package/dist/webpack/plugin-extension/index.d.ts +0 -10
  239. package/dist/webpack/plugin-js-frameworks/index.d.ts +0 -13
  240. package/dist/webpack/plugin-js-frameworks/js-tools/babel.d.ts +0 -16
  241. package/dist/webpack/plugin-js-frameworks/js-tools/preact.d.ts +0 -3
  242. package/dist/webpack/plugin-js-frameworks/js-tools/react.d.ts +0 -3
  243. package/dist/webpack/plugin-js-frameworks/js-tools/svelte.d.ts +0 -3
  244. package/dist/webpack/plugin-js-frameworks/js-tools/typescript.d.ts +0 -36
  245. package/dist/webpack/plugin-js-frameworks/js-tools/vue.d.ts +0 -3
  246. package/dist/webpack/plugin-js-frameworks/load-loader-options.d.ts +0 -1
  247. package/dist/webpack/plugin-reload/index.d.ts +0 -13
  248. package/dist/webpack/plugin-reload/reload-lib/messages.d.ts +0 -106
  249. package/dist/webpack/plugin-reload/reload-types.d.ts +0 -14
  250. package/dist/webpack/plugin-reload/start-server.d.ts +0 -4
  251. package/dist/webpack/plugin-reload/steps/create-web-socket-server/index.d.ts +0 -14
  252. package/dist/webpack/plugin-reload/steps/create-web-socket-server/web-socket-server/broadcast-message.d.ts +0 -2
  253. package/dist/webpack/plugin-reload/steps/create-web-socket-server/web-socket-server/message-dispatcher.d.ts +0 -2
  254. package/dist/webpack/plugin-reload/steps/create-web-socket-server/web-socket-server/servers.d.ts +0 -2
  255. package/dist/webpack/plugin-reload/steps/setup-chromium-reload-client/index.d.ts +0 -3
  256. package/dist/webpack/plugin-reload/steps/setup-chromium-reload-client/inject-chromium-client-loader.d.ts +0 -9
  257. package/dist/webpack/plugin-reload/steps/setup-chromium-reload-client/minimum-chromium-file.d.ts +0 -0
  258. package/dist/webpack/plugin-reload/steps/setup-firefox-reload-client/index.d.ts +0 -3
  259. package/dist/webpack/plugin-reload/steps/setup-firefox-reload-client/inject-firefox-client-loader.d.ts +0 -9
  260. package/dist/webpack/plugin-reload/steps/setup-firefox-reload-client/minimum-firefox-file.d.ts +0 -0
  261. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/index.d.ts +0 -9
  262. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-background.d.ts +0 -15
  263. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-csp.d.ts +0 -5
  264. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-externally-connectable.d.ts +0 -10
  265. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-web-resources.d.ts +0 -10
  266. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/generate-manager-extension.d.ts +0 -15
  267. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/index.d.ts +0 -10
  268. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/target-web-extension-plugin/index.d.ts +0 -13
  269. package/dist/webpack/plugin-static-assets/index.d.ts +0 -12
  270. package/dist/webpack/webpack-config.d.ts +0 -14
  271. package/dist/webpack/webpack-lib/auto-exit.d.ts +0 -1
  272. package/dist/webpack/webpack-lib/constants.d.ts +0 -4
  273. package/dist/webpack/webpack-lib/messages.d.ts +0 -121
  274. package/dist/webpack/webpack-lib/port-manager.d.ts +0 -27
  275. package/dist/webpack/webpack-lib/utils.d.ts +0 -23
  276. package/dist/webpack/webpack-types.d.ts +0 -49
package/README.md CHANGED
@@ -27,7 +27,6 @@ import {
27
27
  extensionBuild,
28
28
  extensionStart,
29
29
  extensionPreview,
30
- cleanupCommand,
31
30
  type DevOptions,
32
31
  type BuildOptions,
33
32
  type StartOptions,
@@ -55,9 +54,6 @@ async function run() {
55
54
  browser: 'chrome',
56
55
  mode: 'production'
57
56
  } satisfies PreviewOptions)
58
-
59
- // Cleanup orphaned browser instances
60
- await cleanupCommand()
61
57
  }
62
58
 
63
59
  run()
@@ -72,7 +68,7 @@ run()
72
68
  - Zipping: distribution and/or source packages (respects `.gitignore`)
73
69
  - Auto-install of missing dependencies and package manager detection
74
70
  - Type generation for TS projects via `extension-env.d.ts`
75
- - User config via `extension.config.(js|mjs)` for commands, browser launch, and webpack config hooks
71
+ - User config via `extension.config.(js|mjs)` for commands, browser launch, unified logger defaults, and webpack config hooks
76
72
  - Managed dependency guard to avoid conflicts
77
73
 
78
74
  ## Commands
@@ -91,24 +87,31 @@ Options accepted by each command. Values shown are typical types or enumerations
91
87
 
92
88
  ### Common (browser/runtime)
93
89
 
94
- | Option | Type / Values | Description |
95
- | -------------- | -------------------------------------------------- | ------------------------------------------- |
96
- | browser | chrome, edge, firefox, chromium-based, gecko-based | Target browser/runtime |
97
- | profile | string or false | Profile path or disable profile persistence |
98
- | startingUrl | string | Initial URL to open |
99
- | open | boolean | Focus/open the browser window |
100
- | chromiumBinary | string | Custom Chromium-based executable path |
101
- | geckoBinary | string | Custom Gecko-based executable path |
90
+ | Option | Type / Values | Description |
91
+ | -------------- | -------------------------------------------------- | --------------------------------------------------------------- |
92
+ | browser | chrome, edge, firefox, chromium-based, gecko-based | Target browser/runtime |
93
+ | profile | string or false | Profile path or disable profile persistence |
94
+ | startingUrl | string | Initial URL to open |
95
+ | open | boolean | Focus/open the browser window (CLI: use `--no-open` to disable) |
96
+ | chromiumBinary | string | Custom Chromium-based executable path |
97
+ | geckoBinary | string | Custom Gecko-based executable path |
102
98
 
103
99
  ### dev
104
100
 
105
- | Option | Type / Values | Description |
106
- | ----------- | ----------------------------- | --------------------------------------------- |
107
- | mode | development, production, none | Build mode |
108
- | polyfill | boolean | Include `webextension-polyfill` when possible |
109
- | port | number or string | Dev server port |
110
- | source | string | Inspect a source directory |
111
- | watchSource | boolean | Watch the source directory |
101
+ | Option | Type / Values | Description |
102
+ | ------------- | ----------------------------------- | --------------------------------------------------------------------------------- |
103
+ | mode | development, production, none | Build mode |
104
+ | polyfill | boolean | Include `webextension-polyfill` when possible |
105
+ | port | number or string | Dev server port |
106
+ | source | string | Inspect a source directory |
107
+ | watchSource | boolean | Watch the source directory |
108
+ | logs | off,error,warn,info,debug,trace,all | Unified logger verbosity (all shows everything) |
109
+ | logContext | list or `all` | Comma-separated contexts (background,content,page,sidebar,popup,options,devtools) |
110
+ | logFormat | pretty,json | Pretty text or JSON output |
111
+ | logTimestamps | boolean | Include timestamps in pretty output |
112
+ | logColor | boolean | Colorize pretty output |
113
+ | logUrl | string or /regex/flags | Filter by URL substring or JS-style regex literal |
114
+ | logTab | number | Filter by tabId |
112
115
 
113
116
  ### build
114
117
 
@@ -141,13 +144,22 @@ Options accepted by each command. Values shown are typical types or enumerations
141
144
  - Other HTTP(S) URLs: treated as zip archives and extracted locally.
142
145
  - Monorepos: The nearest `manifest.json` is resolved recursively; the nearest valid `package.json` is then located and validated.
143
146
 
147
+ ### Root semantics (manifest vs package.json)
148
+
149
+ - `manifest.json` may live in any subdirectory of your project.
150
+ - The project root for build/dev is the directory containing the nearest valid `package.json` (i.e., webpack `context`).
151
+ - Special folders and root-relative paths are anchored at the package root:
152
+ - `public/`, `pages/`, `scripts/`, and URLs starting with `/` resolve relative to the package root (e.g., `/logo.png` → `<packageRoot>/public/logo.png`).
153
+ - Web-only mode: if no `package.json` is found, the manifest directory is used as a fallback project root.
154
+
144
155
  ## User config
145
156
 
146
157
  - Provide `extension.config.js` or `extension.config.mjs` in your project root.
147
158
  - Supported sections:
148
- - config(config: Configuration): mutate the assembled Rspack config.
149
- - commands.dev | .build | .start | .preview: per-command options (browser, profile, binaries, flags, preferences, packaging).
150
- - browser.chrome | .firefox | .edge | .chromium-based | .gecko-based: launch flags, excluded flags, preferences, binaries, and profile reuse.
159
+ - config(config: Configuration): mutate the assembled Rspack config. Supports a function or a plain object. When an object is provided, it is deep‑merged on top of the assembled config.
160
+ - commands.dev | .build | .start | .preview: percommand options (browser, profile, binaries, flags, preferences, unified logger defaults, packaging). These defaults are applied for all respective commands.
161
+ - browser.chrome | .firefox | .edge | .chromium-based | .gecko-based: launch flags, excluded flags, preferences, binaries, and profile reuse (persistProfile).
162
+ - Precedence when composing options: browser._ → commands._ → CLI flags. CLI flags always win over config defaults.
151
163
  - When detected, a one‑time notice is printed to indicate config is active.
152
164
 
153
165
  ### Environment variables in `extension.config.*`
@@ -172,7 +184,24 @@ export default {
172
184
  process.env.EXTENSION_PUBLIC_START_URL || 'https://example.com'
173
185
  }
174
186
  },
187
+ commands: {
188
+ dev: {
189
+ // Unified logger defaults for `extension dev`
190
+ logLevel: 'off',
191
+ // omit or set to undefined to include all
192
+ logContexts: ['background', 'content'],
193
+ logFormat: 'pretty',
194
+ logTimestamps: true,
195
+ logColor: true,
196
+ // Optional filters
197
+ logUrl: '/example\\.com/i',
198
+ logTab: 123
199
+ }
200
+ },
201
+ // Either a function
175
202
  config: (config) => config
203
+ // Or a plain object to merge
204
+ // config: { resolve: { alias: { react: 'preact/compat' } } }
176
205
  }
177
206
  ```
178
207
 
@@ -212,7 +241,6 @@ dist/
212
241
  | plugin-static-assets | core | - Emits images, fonts, and misc files to `assets/`<br/>- Inlines small SVGs (≤2KB), emits larger ones<br/>- Content hashing in production; stable names in development<br/>- Respects existing custom SVG rules |
213
242
  | plugin-compatibility | core | - Cross‑browser helpers<br/>- Normalizes browser‑specific manifest fields<br/>- Optional `webextension-polyfill` for Chromium |
214
243
  | plugin-compilation | core | - Loads env and templating (`EXTENSION_PUBLIC_*`)<br/>- Optional `dist/<browser>` cleaning<br/>- Compact, de‑duplicated compilation summary |
215
- | plugin-reload | core | - Dev‑time live reload/HMR orchestration<br/>- Per‑instance WebSocket server<br/>- Manifest dev overrides<br/>- Full recompiles on HTML entry changes |
216
244
 
217
245
  ## Notes and compatibility
218
246
 
@@ -222,7 +250,7 @@ dist/
222
250
  ## Related files in this folder
223
251
 
224
252
  - `webpack/webpack-config.ts`: Assembles the plugin stack and shared configuration.
225
- - `webpack/dev-server.ts`: Local development server wiring and reload orchestration.
253
+ - `dev-server/`: Local development server wiring and reload orchestration.
226
254
  - `webpack/webpack-types.ts`: Common types for the plugin stack.
227
255
 
228
256
  ## License
package/dist/930.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ exports.ids = [
3
+ "930"
4
+ ];
5
+ exports.modules = {
6
+ "./webpack/webpack-lib/zip.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.d(__webpack_exports__, {
8
+ downloadAndExtractZip: ()=>downloadAndExtractZip
9
+ });
10
+ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("path");
11
+ var adm_zip__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("adm-zip");
12
+ var adm_zip__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(adm_zip__WEBPACK_IMPORTED_MODULE_1__);
13
+ var _messages__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./webpack/webpack-lib/messages.ts");
14
+ async function downloadAndExtractZip(url, targetPath) {
15
+ const urlNoSearchParams = url.split('?')[0];
16
+ try {
17
+ console.log(_messages__WEBPACK_IMPORTED_MODULE_2__.cq(urlNoSearchParams));
18
+ const res = await fetch(url, {
19
+ redirect: 'follow'
20
+ });
21
+ if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} ${res.statusText}`);
22
+ const contentType = String(res.headers.get('content-type') || '');
23
+ const isZipExt = '.zip' === path__WEBPACK_IMPORTED_MODULE_0__.extname(urlNoSearchParams).toLowerCase();
24
+ const isZipType = /zip|octet-stream/i.test(contentType);
25
+ if (!isZipExt && !isZipType) throw new Error(`${_messages__WEBPACK_IMPORTED_MODULE_2__.wX(urlNoSearchParams, contentType)}`);
26
+ const extname = path__WEBPACK_IMPORTED_MODULE_0__.extname(urlNoSearchParams);
27
+ const basename = path__WEBPACK_IMPORTED_MODULE_0__.basename(urlNoSearchParams, extname);
28
+ const destinationPath = path__WEBPACK_IMPORTED_MODULE_0__.join(targetPath, basename);
29
+ console.log(_messages__WEBPACK_IMPORTED_MODULE_2__.WF(destinationPath));
30
+ const arrayBuffer = await res.arrayBuffer();
31
+ const zipBuffer = Buffer.from(arrayBuffer);
32
+ const zip = new (adm_zip__WEBPACK_IMPORTED_MODULE_1___default())(zipBuffer);
33
+ zip.extractAllTo(destinationPath, true);
34
+ console.log(_messages__WEBPACK_IMPORTED_MODULE_2__.aP());
35
+ return destinationPath;
36
+ } catch (error) {
37
+ console.error(_messages__WEBPACK_IMPORTED_MODULE_2__.QC(error));
38
+ const err = new Error(`${_messages__WEBPACK_IMPORTED_MODULE_2__.QC(error)}`);
39
+ err.code = 'EZIP';
40
+ throw err;
41
+ }
42
+ }
43
+ }
44
+ };
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ default: ()=>logger_background
37
+ });
38
+ const external_fs_namespaceObject = require("fs");
39
+ var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
40
+ const external_path_namespaceObject = require("path");
41
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
42
+ const external_schema_utils_namespaceObject = require("schema-utils");
43
+ function filterKeysForThisBrowser(manifest, browser) {
44
+ const CHROMIUM_BASED_BROWSERS = [
45
+ 'chrome',
46
+ 'edge'
47
+ ];
48
+ const GECKO_BASED_BROWSERS = [
49
+ 'firefox'
50
+ ];
51
+ const isChromiumTarget = CHROMIUM_BASED_BROWSERS.includes(browser) || String(browser).includes('chromium');
52
+ const isGeckoTarget = GECKO_BASED_BROWSERS.includes(browser) || String(browser).includes('gecko');
53
+ const chromiumPrefixes = new Set([
54
+ 'chromium',
55
+ 'chrome',
56
+ 'edge'
57
+ ]);
58
+ const geckoPrefixes = new Set([
59
+ 'gecko',
60
+ 'firefox'
61
+ ]);
62
+ const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
63
+ const indexOfColon = key.indexOf(':');
64
+ if (-1 === indexOfColon) return value;
65
+ const prefix = key.substring(0, indexOfColon);
66
+ if (prefix === browser || isChromiumTarget && chromiumPrefixes.has(prefix) || isGeckoTarget && geckoPrefixes.has(prefix)) this[key.substring(indexOfColon + 1)] = value;
67
+ });
68
+ return patchedManifest;
69
+ }
70
+ const schema = {
71
+ type: 'object',
72
+ properties: {
73
+ test: {
74
+ type: 'string'
75
+ },
76
+ manifestPath: {
77
+ type: 'string'
78
+ },
79
+ mode: {
80
+ type: 'string'
81
+ },
82
+ browser: {
83
+ type: 'string'
84
+ }
85
+ }
86
+ };
87
+ function logger_background(source) {
88
+ const options = this.getOptions();
89
+ const manifestPath = options.manifestPath;
90
+ const projectPath = external_path_default().dirname(manifestPath);
91
+ const rawManifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
92
+ const browser = options.browser || 'chrome';
93
+ const manifest = filterKeysForThisBrowser(rawManifest, browser);
94
+ (0, external_schema_utils_namespaceObject.validate)(schema, options, {
95
+ name: "scripts:add-centralized-logger-script-background",
96
+ baseDataPath: 'options'
97
+ });
98
+ const resourceAbsPath = external_path_default().normalize(this.resourcePath);
99
+ const loggerBootstrap = `
100
+ /* centralized background logger bootstrap */
101
+ (function() {
102
+ var loggerPort;
103
+ var buffer = [];
104
+ function tryConnect() {
105
+ if (!(typeof chrome !== "undefined" && chrome.runtime && chrome.runtime.connect)) return;
106
+ var targetId = (function(){
107
+ if (typeof self !== 'undefined' && (self).__EXT_LOGGER_ID__) return String((self).__EXT_LOGGER_ID__);
108
+ try {
109
+ var u = new URL(typeof location !== 'undefined' ? String(location.href) : '');
110
+ var v = u.searchParams.get('loggerId');
111
+ if (v) return v;
112
+ } catch {}
113
+ return '';
114
+ })();
115
+ if (!loggerPort && targetId) {
116
+ try {
117
+ loggerPort = chrome.runtime.connect(targetId, { name: 'logger' });
118
+ flush();
119
+ attachDisconnect();
120
+ } catch (e) {}
121
+ }
122
+ // intentionally avoid local self-connection to prevent loops; only external connection should be used
123
+ if (!loggerPort && chrome.management && typeof chrome.management.getAll === 'function') {
124
+ chrome.management.getAll(function(list){
125
+ var found = (list||[]).find(function(it){ return it && typeof it.name === 'string' && it.name.toLowerCase().includes('centralized-logger'); });
126
+ if (found && found.id && !loggerPort) {
127
+ try {
128
+ loggerPort = chrome.runtime.connect(found.id, { name: 'logger' });
129
+ flush();
130
+ attachDisconnect();
131
+ } catch (e) {}
132
+ }
133
+ });
134
+ } else {
135
+ attachDisconnect();
136
+ }
137
+ }
138
+ function flush(){
139
+ if (!loggerPort || !loggerPort.postMessage) return;
140
+ var q = buffer; buffer = [];
141
+ for (var i=0;i<q.length;i++) {
142
+ try { loggerPort.postMessage(q[i]); } catch (e) {}
143
+ }
144
+ }
145
+ function attachDisconnect(){
146
+ if (loggerPort && loggerPort.onDisconnect && loggerPort.onDisconnect.addListener) {
147
+ loggerPort.onDisconnect.addListener(function(){ loggerPort = null; });
148
+ }
149
+ }
150
+
151
+ if (typeof chrome !== "undefined" && chrome.runtime && chrome.runtime.connect) {
152
+ tryConnect();
153
+
154
+ // Bridge: forward any internal ports named 'logger' (e.g., from content/UI) to centralized logger
155
+ if (chrome.runtime && chrome.runtime.onConnect && chrome.runtime.onConnect.addListener) {
156
+ chrome.runtime.onConnect.addListener(function(port) {
157
+ if (!port || port.name !== 'logger') return;
158
+ port.onMessage.addListener(function(msg){
159
+ if (!loggerPort) { tryConnect(); }
160
+ if (loggerPort && loggerPort.postMessage) { loggerPort.postMessage(msg); }
161
+ else { buffer.push(msg); }
162
+ });
163
+ });
164
+ }
165
+ }
166
+
167
+ function safePost(msg) {
168
+ try {
169
+ if (!loggerPort) { tryConnect(); }
170
+ if (loggerPort && loggerPort.postMessage) { loggerPort.postMessage(msg); }
171
+ else { buffer.push(msg); }
172
+ } catch (e) {}
173
+ }
174
+
175
+ if (typeof self !== "undefined" && self.addEventListener) {
176
+ self.addEventListener('error', function(e) {
177
+ safePost({ type: 'log', level: 'error', context: 'background', messageParts: [ String(e && e.message || ''), String(e && e.filename || ''), e && e.lineno, e && e.colno ] });
178
+ });
179
+
180
+ self.addEventListener('unhandledrejection', function(e) {
181
+ var reason = '';
182
+ if (e && typeof e.reason !== "undefined") {
183
+ try { reason = typeof e.reason === "string" ? e.reason : JSON.stringify(e.reason); } catch (_) { reason = String(e.reason); }
184
+ }
185
+ safePost({ type: 'log', level: 'error', context: 'background', messageParts: ['Unhandled Rejection', reason] });
186
+ });
187
+ }
188
+
189
+ ['log','info','warn','error','debug'].forEach(function(lvl) {
190
+ if (typeof console !== "undefined" && typeof console[lvl] === "function") {
191
+ var orig = console[lvl].bind(console);
192
+ console[lvl] = function() {
193
+ var args = Array.prototype.slice.call(arguments);
194
+ safePost({ type: 'log', level: String(lvl), context: 'background', messageParts: args });
195
+ orig.apply(console, args);
196
+ };
197
+ }
198
+ });
199
+ })();
200
+ `;
201
+ if (manifest.background) {
202
+ if (manifest.background.scripts) for (const bgScript of manifest.background.scripts){
203
+ const absoluteUrl = external_path_default().resolve(projectPath, bgScript);
204
+ if (resourceAbsPath === external_path_default().normalize(absoluteUrl)) return `${loggerBootstrap}${source}`;
205
+ }
206
+ if (manifest.background.service_worker) {
207
+ const swPath = manifest.background.service_worker;
208
+ const absoluteSwPath = external_path_default().resolve(projectPath, swPath);
209
+ if (resourceAbsPath === external_path_default().normalize(absoluteSwPath)) return `${loggerBootstrap}${source}`;
210
+ }
211
+ }
212
+ return source;
213
+ }
214
+ exports["default"] = __webpack_exports__["default"];
215
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
216
+ "default"
217
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
218
+ Object.defineProperty(exports, '__esModule', {
219
+ value: true
220
+ });
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ default: ()=>logger_script
37
+ });
38
+ const external_fs_namespaceObject = require("fs");
39
+ var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
40
+ const external_path_namespaceObject = require("path");
41
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
42
+ const external_schema_utils_namespaceObject = require("schema-utils");
43
+ function filterKeysForThisBrowser(manifest, browser) {
44
+ const CHROMIUM_BASED_BROWSERS = [
45
+ 'chrome',
46
+ 'edge'
47
+ ];
48
+ const GECKO_BASED_BROWSERS = [
49
+ 'firefox'
50
+ ];
51
+ const isChromiumTarget = CHROMIUM_BASED_BROWSERS.includes(browser) || String(browser).includes('chromium');
52
+ const isGeckoTarget = GECKO_BASED_BROWSERS.includes(browser) || String(browser).includes('gecko');
53
+ const chromiumPrefixes = new Set([
54
+ 'chromium',
55
+ 'chrome',
56
+ 'edge'
57
+ ]);
58
+ const geckoPrefixes = new Set([
59
+ 'gecko',
60
+ 'firefox'
61
+ ]);
62
+ const patchedManifest = JSON.parse(JSON.stringify(manifest), function(key, value) {
63
+ const indexOfColon = key.indexOf(':');
64
+ if (-1 === indexOfColon) return value;
65
+ const prefix = key.substring(0, indexOfColon);
66
+ if (prefix === browser || isChromiumTarget && chromiumPrefixes.has(prefix) || isGeckoTarget && geckoPrefixes.has(prefix)) this[key.substring(indexOfColon + 1)] = value;
67
+ });
68
+ return patchedManifest;
69
+ }
70
+ const schema = {
71
+ type: 'object',
72
+ properties: {
73
+ test: {
74
+ type: 'string'
75
+ },
76
+ manifestPath: {
77
+ type: 'string'
78
+ },
79
+ mode: {
80
+ type: 'string'
81
+ },
82
+ browser: {
83
+ type: 'string'
84
+ }
85
+ }
86
+ };
87
+ function logger_script(source) {
88
+ const options = this.getOptions();
89
+ const manifestPath = options.manifestPath;
90
+ const projectPath = external_path_default().dirname(manifestPath);
91
+ const rawManifest = JSON.parse(external_fs_default().readFileSync(manifestPath, 'utf-8'));
92
+ const browser = options.browser || 'chrome';
93
+ const manifest = filterKeysForThisBrowser(rawManifest, browser);
94
+ (0, external_schema_utils_namespaceObject.validate)(schema, options, {
95
+ name: "scripts:add-centralized-logger-script-content",
96
+ baseDataPath: 'options'
97
+ });
98
+ const resourceAbsPath = external_path_default().normalize(this.resourcePath);
99
+ const pageScriptName = 'content-logger.page.js';
100
+ const pageScriptContent = '(function(){\n function post(msg){ try { window.postMessage(msg, "*") } catch (_) {} }\n window.addEventListener("error", function(e){\n post({ __reactLogger: true, type: "log", level: "error",\n messageParts: [ String(e && e.message || ""), String(e && e.filename || ""), e && e.lineno, e && e.colno ],\n url: String(location && location.href || "") })\n })\n window.addEventListener("unhandledrejection", function(e){\n var reason; try { reason = typeof e.reason === "string" ? e.reason : JSON.stringify(e.reason) } catch (_) { reason = String(e.reason) }\n post({ __reactLogger: true, type: "log", level: "error", messageParts: ["Unhandled Rejection", reason], url: String(location && location.href || "") })\n })\n ["log","info","warn","error","debug","trace"].forEach(function(level){\n try {\n var original = console[level] && console[level].bind ? console[level].bind(console) : console[level]\n console[level] = function(){ var args = [].slice.call(arguments); post({ __reactLogger: true, type: "log", level: level, messageParts: args, url: String(location && location.href || "") }); try { return original && original.apply ? original.apply(console, args) : void 0 } catch (_) {} }\n } catch (_) {}\n })\n try {\n var oc = console.clear && console.clear.bind ? console.clear.bind(console) : console.clear; if (oc) console.clear = function(){ try { post({ __reactLogger: true, type: "log", level: "info", messageParts: ["console.clear"], url: String(location && location.href || ""), meta: { kind: "clear" } }) } catch (_) {} try { return oc.apply(console, arguments) } catch (_) {} }\n } catch (_) {}\n ;["group","groupCollapsed","groupEnd"].forEach(function(k){ try { var og = console[k] && console[k].bind ? console[k].bind(console) : console[k]; if (!og) return; console[k] = function(){ var args = [].slice.call(arguments); try { post({ __reactLogger: true, type: "log", level: "log", messageParts: args, url: String(location && location.href || ""), meta: { kind: k } }) } catch (_) {} try { return og.apply(console, args) } catch (_) {} } } catch (_) {} })\n ;["time","timeLog","timeEnd","count","countReset","table"].forEach(function(k){ try { var oo = console[k] && console[k].bind ? console[k].bind(console) : console[k]; if (!oo) return; console[k] = function(){ var args = [].slice.call(arguments); try { post({ __reactLogger: true, type: "log", level: "log", messageParts: args, url: String(location && location.href || ""), meta: { kind: k } }) } catch (_) {} try { return oo.apply(console, args) } catch (_) {} } } catch (_) {} })\n})()';
101
+ this.emitFile(pageScriptName, pageScriptContent);
102
+ const loggerBootstrap = `
103
+ /* centralized content logger bootstrap */
104
+ (function() {
105
+ var contextLabel = 'content'
106
+ var port
107
+ if (typeof chrome !== 'undefined' && chrome.runtime && chrome.runtime.connect) {
108
+ var targetId = (function(){
109
+ if (typeof window !== 'undefined' && (window).__EXT_LOGGER_ID__) return String((window).__EXT_LOGGER_ID__)
110
+ try { var u = new URL(typeof location !== 'undefined' ? String(location.href) : ''); var v = u.searchParams.get('loggerId'); if (v) return v } catch {}
111
+ return ''
112
+ })()
113
+
114
+ if (targetId) { try { port = chrome.runtime.connect(targetId, { name: 'logger' }) } catch (_) {} }
115
+ if (!port) { try { port = chrome.runtime.connect({ name: 'logger' }) } catch (_) {} }
116
+
117
+ if (!port && chrome.management && typeof chrome.management.getAll === 'function') {
118
+ chrome.management.getAll(function(list){
119
+ var found = (list||[]).find(function(it){ return it && typeof it.name === 'string' && it.name.toLowerCase().includes('centralized-logger') })
120
+ if (found && found.id) { try { port = chrome.runtime.connect(found.id, { name: 'logger' }) } catch (_) {} }
121
+ })
122
+ }
123
+ }
124
+
125
+ function safePost(msg) { if (port && port.postMessage) { port.postMessage(msg) } }
126
+
127
+ window.addEventListener('message', function(event){
128
+ try {
129
+ var data = (event && event.data) || {}
130
+ if (!data || data.__reactLogger !== true || data.type !== 'log') return
131
+ var parts = Array.isArray(data.messageParts) ? data.messageParts : [data.messageParts]
132
+ var meta = (typeof data.meta === 'object' && data.meta) ? data.meta : undefined
133
+ safePost({ type: 'log', level: String(data.level || 'log'), context: 'page', messageParts: parts, url: data.url, meta: meta })
134
+ } catch (_) {}
135
+ })
136
+
137
+ var el = document.createElement('script')
138
+ try { el.src = chrome.runtime.getURL('${pageScriptName}') } catch (_) {}
139
+ (document.documentElement || document.head || document.body).appendChild(el)
140
+
141
+ ;['log','info','warn','error','debug','trace'].forEach(function(level) {
142
+ if (typeof console !== 'undefined' && typeof console[level] === 'function') {
143
+ var original = console[level].bind(console)
144
+ console[level] = function() {
145
+ var args = Array.prototype.slice.call(arguments)
146
+ try { safePost({ type:'log', level:String(level), context: contextLabel, messageParts: args }) } catch (_) {}
147
+ original.apply(console, args)
148
+ }
149
+ }
150
+ })
151
+ })()
152
+ `;
153
+ const declaredContentJsAbsPaths = [];
154
+ const contentScripts = Array.isArray(manifest.content_scripts) ? manifest.content_scripts : [];
155
+ for (const cs of contentScripts){
156
+ const jsList = Array.isArray(null == cs ? void 0 : cs.js) ? cs.js : [];
157
+ for (const js of jsList){
158
+ const abs = external_path_default().resolve(projectPath, js);
159
+ declaredContentJsAbsPaths.push(abs);
160
+ }
161
+ }
162
+ const isDeclaredContentScript = declaredContentJsAbsPaths.some((abs)=>resourceAbsPath === external_path_default().normalize(abs));
163
+ if (isDeclaredContentScript) return `${loggerBootstrap}${source}`;
164
+ return source;
165
+ }
166
+ exports["default"] = __webpack_exports__["default"];
167
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
168
+ "default"
169
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
170
+ Object.defineProperty(exports, '__esModule', {
171
+ value: true
172
+ });