extension-develop 2.0.0 → 2.0.1

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 (260) hide show
  1. package/README.md +204 -0
  2. package/dist/add-content-script-wrapper.js +1777 -0
  3. package/dist/add-hmr-accept-code.js +95 -3
  4. package/dist/build.d.ts +2 -0
  5. package/dist/cleanup.d.ts +1 -0
  6. package/dist/deprecated-shadow-root.js +115 -14
  7. package/dist/dev.d.ts +2 -0
  8. package/dist/develop-lib/config-types.d.ts +85 -0
  9. package/dist/develop-lib/extract-from-zip.d.ts +1 -0
  10. package/dist/develop-lib/find-nearest-package.d.ts +2 -0
  11. package/dist/develop-lib/generate-extension-types.d.ts +1 -0
  12. package/dist/develop-lib/generate-zip.d.ts +2 -0
  13. package/dist/develop-lib/get-extension-config.d.ts +6 -0
  14. package/dist/develop-lib/get-project-path.d.ts +6 -0
  15. package/dist/develop-lib/install-dependencies.d.ts +2 -0
  16. package/dist/develop-lib/messages.d.ts +35 -0
  17. package/dist/develop-lib/validate-user-dependencies.d.ts +1 -0
  18. package/dist/ensure-hmr-for-scripts.js +74 -3
  19. package/dist/extensions/chrome-manager-extension/background.js +1 -1
  20. package/dist/extensions/chrome-manager-extension/images/logo.png +0 -0
  21. package/dist/extensions/chrome-manager-extension/manifest.json +3 -3
  22. package/dist/extensions/chrome-manager-extension/pages/welcome.html +3 -6
  23. package/dist/extensions/chrome-manager-extension/reload-service.js +214 -62
  24. package/dist/extensions/chromium-based-manager-extension/background.js +1 -1
  25. package/dist/extensions/chromium-based-manager-extension/images/logo.png +0 -0
  26. package/dist/extensions/chromium-based-manager-extension/manifest.json +3 -3
  27. package/dist/extensions/chromium-based-manager-extension/pages/welcome.html +3 -6
  28. package/dist/extensions/chromium-based-manager-extension/reload-service.js +185 -28
  29. package/dist/extensions/edge-manager-extension/background.js +1 -1
  30. package/dist/extensions/edge-manager-extension/images/logo.png +0 -0
  31. package/dist/extensions/edge-manager-extension/manifest.json +3 -3
  32. package/dist/extensions/edge-manager-extension/pages/welcome.html +3 -6
  33. package/dist/extensions/edge-manager-extension/reload-service.js +223 -69
  34. package/dist/extensions/firefox-manager-extension/background.js +40 -12
  35. package/dist/extensions/firefox-manager-extension/define-initial-tab.js +10 -12
  36. package/dist/extensions/firefox-manager-extension/images/logo.png +0 -0
  37. package/dist/extensions/firefox-manager-extension/manifest.json +4 -5
  38. package/dist/extensions/firefox-manager-extension/pages/welcome.html +3 -6
  39. package/dist/extensions/firefox-manager-extension/reload-service.js +113 -75
  40. package/dist/extensions/gecko-based-manager-extension/background.js +1 -1
  41. package/dist/extensions/gecko-based-manager-extension/define-initial-tab.js +7 -4
  42. package/dist/extensions/gecko-based-manager-extension/images/logo.png +0 -0
  43. package/dist/extensions/gecko-based-manager-extension/manifest.json +3 -3
  44. package/dist/extensions/gecko-based-manager-extension/pages/welcome.html +3 -6
  45. package/dist/extensions/gecko-based-manager-extension/reload-service.js +54 -26
  46. package/dist/inject-chromium-client-loader.js +144 -22
  47. package/dist/inject-firefox-client-loader.js +164 -47
  48. package/dist/minimum-chromium-file.js +25 -0
  49. package/dist/minimum-content-file.js +5 -0
  50. package/dist/minimum-firefox-file.js +17 -0
  51. package/dist/minimum-script-file.js +5 -0
  52. package/dist/module.d.ts +8 -95
  53. package/dist/module.js +10543 -128
  54. package/dist/preview.d.ts +2 -0
  55. package/dist/rslib.config.d.ts +3 -0
  56. package/dist/start.d.ts +2 -0
  57. package/dist/types.d.ts +11 -0
  58. package/dist/vitest.config.d.mts +2 -0
  59. package/dist/webpack/dev-server.d.ts +3 -0
  60. package/dist/webpack/plugin-browsers/browsers-lib/add-progress-bar.d.ts +1 -0
  61. package/dist/webpack/plugin-browsers/browsers-lib/constants.d.ts +5 -0
  62. package/dist/webpack/plugin-browsers/browsers-lib/dynamic-extension-manager.d.ts +35 -0
  63. package/dist/webpack/plugin-browsers/browsers-lib/html-merge.d.ts +1 -0
  64. package/dist/webpack/plugin-browsers/browsers-lib/instance-manager.d.ts +71 -0
  65. package/dist/webpack/plugin-browsers/browsers-lib/messages.d.ts +161 -0
  66. package/dist/webpack/plugin-browsers/browsers-lib/rdp-wire.d.ts +7 -0
  67. package/dist/webpack/plugin-browsers/browsers-lib/shared-utils.d.ts +16 -0
  68. package/dist/webpack/plugin-browsers/browsers-types.d.ts +131 -0
  69. package/dist/webpack/plugin-browsers/index.d.ts +41 -0
  70. package/dist/webpack/plugin-browsers/run-chromium/browser-config.d.ts +3 -0
  71. package/dist/webpack/plugin-browsers/run-chromium/create-profile.d.ts +10 -0
  72. package/dist/webpack/plugin-browsers/run-chromium/index.d.ts +28 -0
  73. package/dist/webpack/plugin-browsers/run-chromium/master-preferences.d.ts +161 -0
  74. package/dist/webpack/plugin-browsers/run-chromium/setup-chrome-inspection/cdp-client.d.ts +29 -0
  75. package/dist/webpack/plugin-browsers/run-chromium/setup-chrome-inspection/index.d.ts +25 -0
  76. package/dist/webpack/plugin-browsers/run-firefox/firefox/binary-detector.d.ts +15 -0
  77. package/dist/webpack/plugin-browsers/run-firefox/firefox/browser-config.d.ts +7 -0
  78. package/dist/webpack/plugin-browsers/run-firefox/firefox/create-profile.d.ts +13 -0
  79. package/dist/webpack/plugin-browsers/run-firefox/firefox/master-preferences.d.ts +95 -0
  80. package/dist/webpack/plugin-browsers/run-firefox/index.d.ts +26 -0
  81. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/index.d.ts +13 -0
  82. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/message-utils.d.ts +2 -0
  83. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/messaging-client.d.ts +42 -0
  84. package/dist/webpack/plugin-browsers/run-firefox/remote-firefox/setup-firefox-inspection.d.ts +31 -0
  85. package/dist/webpack/plugin-compatibility/feature-browser-specific-fields.d.ts +9 -0
  86. package/dist/webpack/plugin-compatibility/feature-polyfill.d.ts +12 -0
  87. package/dist/webpack/plugin-compatibility/index.d.ts +13 -0
  88. package/dist/webpack/plugin-compilation/clean-dist.d.ts +8 -0
  89. package/dist/webpack/plugin-compilation/env.d.ts +9 -0
  90. package/dist/webpack/plugin-compilation/index.d.ts +12 -0
  91. package/dist/webpack/plugin-css/common-style-loaders.d.ts +8 -0
  92. package/dist/webpack/plugin-css/css-in-content-script-loader.d.ts +11 -0
  93. package/dist/webpack/plugin-css/css-in-html-loader.d.ts +8 -0
  94. package/dist/webpack/plugin-css/css-tools/less.d.ts +4 -0
  95. package/dist/webpack/plugin-css/css-tools/postcss.d.ts +3 -0
  96. package/dist/webpack/plugin-css/css-tools/sass.d.ts +4 -0
  97. package/dist/webpack/plugin-css/css-tools/stylelint.d.ts +4 -0
  98. package/dist/webpack/plugin-css/css-tools/tailwind.d.ts +2 -0
  99. package/dist/webpack/plugin-css/index.d.ts +9 -0
  100. package/dist/webpack/plugin-css/is-content-script.d.ts +1 -0
  101. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/action.d.ts +2 -0
  102. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/background.d.ts +2 -0
  103. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/browser_action.d.ts +2 -0
  104. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/chrome_url_overrides.d.ts +2 -0
  105. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/devtools_page.d.ts +2 -0
  106. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/index.d.ts +2 -0
  107. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/options_ui.d.ts +2 -0
  108. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/page_action.d.ts +2 -0
  109. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/sandbox.d.ts +2 -0
  110. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/side_panel.d.ts +2 -0
  111. package/dist/webpack/plugin-extension/data/manifest-fields/html-fields/sidebar_action.d.ts +2 -0
  112. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/action.d.ts +2 -0
  113. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/browser_action.d.ts +2 -0
  114. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/browser_action.theme_icons.d.ts +2 -0
  115. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/icons.d.ts +2 -0
  116. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/index.d.ts +2 -0
  117. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/normalize.d.ts +6 -0
  118. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/page_action.d.ts +2 -0
  119. package/dist/webpack/plugin-extension/data/manifest-fields/icons-fields/sidebar_action.d.ts +2 -0
  120. package/dist/webpack/plugin-extension/data/manifest-fields/index.d.ts +19 -0
  121. package/dist/webpack/plugin-extension/data/manifest-fields/json-fields/declarative_net_request.d.ts +2 -0
  122. package/dist/webpack/plugin-extension/data/manifest-fields/json-fields/index.d.ts +2 -0
  123. package/dist/webpack/plugin-extension/data/manifest-fields/json-fields/storage.d.ts +2 -0
  124. package/dist/webpack/plugin-extension/data/manifest-fields/locales-fields/index.d.ts +1 -0
  125. package/dist/webpack/plugin-extension/data/manifest-fields/normalize.d.ts +10 -0
  126. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/background.d.ts +2 -0
  127. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/content_scripts.d.ts +2 -0
  128. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/index.d.ts +2 -0
  129. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/service_worker.d.ts +2 -0
  130. package/dist/webpack/plugin-extension/data/manifest-fields/scripts-fields/user_scripts.d.ts +2 -0
  131. package/dist/webpack/plugin-extension/data/manifest-fields/web-resources-fields/index.d.ts +2 -0
  132. package/dist/webpack/plugin-extension/data/special-folders/generate-entries.d.ts +4 -0
  133. package/dist/webpack/plugin-extension/data/special-folders/index.d.ts +12 -0
  134. package/dist/webpack/plugin-extension/feature-html/__spec__/html-lib/test-utils.d.ts +18 -0
  135. package/dist/webpack/plugin-extension/feature-html/html-lib/parse-html.d.ts +8 -0
  136. package/dist/webpack/plugin-extension/feature-html/html-lib/patch-html.d.ts +8 -0
  137. package/dist/webpack/plugin-extension/feature-html/html-lib/utils.d.ts +18 -0
  138. package/dist/webpack/plugin-extension/feature-html/index.d.ts +37 -0
  139. package/dist/webpack/plugin-extension/feature-html/steps/add-assets-to-compilation.d.ts +11 -0
  140. package/dist/webpack/plugin-extension/feature-html/steps/add-scripts-and-styles-to-compilation.d.ts +10 -0
  141. package/dist/webpack/plugin-extension/feature-html/steps/add-to-file-dependencies.d.ts +10 -0
  142. package/dist/webpack/plugin-extension/feature-html/steps/emit-html-file.d.ts +9 -0
  143. package/dist/webpack/plugin-extension/feature-html/steps/ensure-hmr-for-scripts.d.ts +2 -0
  144. package/dist/webpack/plugin-extension/feature-html/steps/handle-common-errors.d.ts +10 -0
  145. package/dist/webpack/plugin-extension/feature-html/steps/minimum-script-file.d.ts +1 -0
  146. package/dist/webpack/plugin-extension/feature-html/steps/throw-if-recompile-is-needed.d.ts +13 -0
  147. package/dist/webpack/plugin-extension/feature-html/steps/update-html-file.d.ts +10 -0
  148. package/dist/webpack/plugin-extension/feature-icons/index.d.ts +25 -0
  149. package/dist/webpack/plugin-extension/feature-icons/steps/add-to-file-dependencies.d.ts +9 -0
  150. package/dist/webpack/plugin-extension/feature-icons/steps/emit-file.d.ts +9 -0
  151. package/dist/webpack/plugin-extension/feature-json/index.d.ts +18 -0
  152. package/dist/webpack/plugin-extension/feature-locales/get-locales.d.ts +1 -0
  153. package/dist/webpack/plugin-extension/feature-locales/index.d.ts +13 -0
  154. package/dist/webpack/plugin-extension/feature-manifest/index.d.ts +23 -0
  155. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/background.d.ts +10 -0
  156. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/chrome_url_overrides.d.ts +8 -0
  157. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/commands.d.ts +16 -0
  158. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/content_scripts.d.ts +7 -0
  159. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/content_security_policy.d.ts +4 -0
  160. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/devtools_page.d.ts +4 -0
  161. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/icons.d.ts +6 -0
  162. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/index.d.ts +2 -0
  163. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/omnibox.d.ts +2 -0
  164. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/options_page.d.ts +4 -0
  165. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/options_ui.d.ts +8 -0
  166. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/page_action.d.ts +8 -0
  167. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/permissions.d.ts +4 -0
  168. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/sandbox.d.ts +7 -0
  169. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/sidebar_action.d.ts +2 -0
  170. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/storage.d.ts +6 -0
  171. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/theme.d.ts +2 -0
  172. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/user_scripts.d.ts +2 -0
  173. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/common/web_accessible_resources.d.ts +9 -0
  174. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/index.d.ts +2 -0
  175. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/background.d.ts +10 -0
  176. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/browser_action.d.ts +12 -0
  177. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/chrome_settings_overrides.d.ts +24 -0
  178. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/index.d.ts +2 -0
  179. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/page_action.d.ts +1 -0
  180. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/sidebar_action.d.ts +1 -0
  181. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv2/theme_experiment.d.ts +2 -0
  182. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/action.d.ts +8 -0
  183. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/background.d.ts +10 -0
  184. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/declarative_net_request.d.ts +2 -0
  185. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/host_permissions.d.ts +2 -0
  186. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/index.d.ts +2 -0
  187. package/dist/webpack/plugin-extension/feature-manifest/manifest-overrides/mv3/side_panel.d.ts +2 -0
  188. package/dist/webpack/plugin-extension/feature-manifest/steps/add-dependencies.d.ts +6 -0
  189. package/dist/webpack/plugin-extension/feature-manifest/steps/check-manifest-files.d.ts +17 -0
  190. package/dist/webpack/plugin-extension/feature-manifest/steps/emit-manifest.d.ts +7 -0
  191. package/dist/webpack/plugin-extension/feature-manifest/steps/throw-if-recompile.d.ts +11 -0
  192. package/dist/webpack/plugin-extension/feature-manifest/steps/update-manifest.d.ts +9 -0
  193. package/dist/webpack/plugin-extension/feature-scripts/index.d.ts +27 -0
  194. package/dist/webpack/plugin-extension/feature-scripts/scripts-lib/utils.d.ts +3 -0
  195. package/dist/webpack/plugin-extension/feature-scripts/steps/add-content-script-wrapper.d.ts +2 -0
  196. package/dist/webpack/plugin-extension/feature-scripts/steps/add-hmr-accept-code.d.ts +2 -0
  197. package/dist/webpack/plugin-extension/feature-scripts/steps/add-public-path-for-main-world.d.ts +11 -0
  198. package/dist/webpack/plugin-extension/feature-scripts/steps/add-public-path-runtime-module.d.ts +4 -0
  199. package/dist/webpack/plugin-extension/feature-scripts/steps/add-scripts.d.ts +9 -0
  200. package/dist/webpack/plugin-extension/feature-scripts/steps/deprecated-shadow-root.d.ts +2 -0
  201. package/dist/webpack/plugin-extension/feature-scripts/steps/javascript-content-script-wrapper.d.ts +1 -0
  202. package/dist/webpack/plugin-extension/feature-scripts/steps/preact-content-script-wrapper.d.ts +1 -0
  203. package/dist/webpack/plugin-extension/feature-scripts/steps/react-content-script-wrapper.d.ts +1 -0
  204. package/dist/webpack/plugin-extension/feature-scripts/steps/svelte-content-script-wrapper.d.ts +1 -0
  205. package/dist/webpack/plugin-extension/feature-scripts/steps/typescript-content-script-wrapper.d.ts +1 -0
  206. package/dist/webpack/plugin-extension/feature-scripts/steps/vue-content-script-wrapper.d.ts +1 -0
  207. package/dist/webpack/plugin-extension/feature-special-folders/copy-public-folder.d.ts +14 -0
  208. package/dist/webpack/plugin-extension/feature-special-folders/index.d.ts +19 -0
  209. package/dist/webpack/plugin-extension/feature-special-folders/warn-upon-folder-changes.d.ts +7 -0
  210. package/dist/webpack/plugin-extension/feature-web-resources/clean-matches.d.ts +7 -0
  211. package/dist/webpack/plugin-extension/feature-web-resources/index.d.ts +18 -0
  212. package/dist/webpack/plugin-extension/index.d.ts +10 -0
  213. package/dist/webpack/plugin-js-frameworks/index.d.ts +13 -0
  214. package/dist/webpack/plugin-js-frameworks/js-tools/babel.d.ts +16 -0
  215. package/dist/webpack/plugin-js-frameworks/js-tools/preact.d.ts +3 -0
  216. package/dist/webpack/plugin-js-frameworks/js-tools/react.d.ts +3 -0
  217. package/dist/webpack/plugin-js-frameworks/js-tools/svelte.d.ts +3 -0
  218. package/dist/webpack/plugin-js-frameworks/js-tools/typescript.d.ts +36 -0
  219. package/dist/webpack/plugin-js-frameworks/js-tools/vue.d.ts +3 -0
  220. package/dist/webpack/plugin-js-frameworks/load-loader-options.d.ts +1 -0
  221. package/dist/webpack/plugin-reload/index.d.ts +13 -0
  222. package/dist/webpack/plugin-reload/reload-lib/messages.d.ts +106 -0
  223. package/dist/webpack/plugin-reload/reload-types.d.ts +14 -0
  224. package/dist/webpack/plugin-reload/start-server.d.ts +4 -0
  225. package/dist/webpack/plugin-reload/steps/create-web-socket-server/index.d.ts +14 -0
  226. package/dist/webpack/plugin-reload/steps/create-web-socket-server/web-socket-server/broadcast-message.d.ts +2 -0
  227. package/dist/webpack/plugin-reload/steps/create-web-socket-server/web-socket-server/message-dispatcher.d.ts +2 -0
  228. package/dist/webpack/plugin-reload/steps/create-web-socket-server/web-socket-server/servers.d.ts +2 -0
  229. package/dist/webpack/plugin-reload/steps/setup-chromium-reload-client/index.d.ts +3 -0
  230. package/dist/webpack/plugin-reload/steps/setup-chromium-reload-client/inject-chromium-client-loader.d.ts +9 -0
  231. package/dist/webpack/plugin-reload/steps/setup-chromium-reload-client/minimum-chromium-file.d.ts +0 -0
  232. package/dist/webpack/plugin-reload/steps/setup-firefox-reload-client/index.d.ts +3 -0
  233. package/dist/webpack/plugin-reload/steps/setup-firefox-reload-client/inject-firefox-client-loader.d.ts +9 -0
  234. package/dist/webpack/plugin-reload/steps/setup-firefox-reload-client/minimum-firefox-file.d.ts +0 -0
  235. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/index.d.ts +9 -0
  236. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-background.d.ts +15 -0
  237. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-csp.d.ts +5 -0
  238. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-externally-connectable.d.ts +10 -0
  239. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/apply-manifest-dev-defaults/patch-web-resources.d.ts +10 -0
  240. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/generate-manager-extension.d.ts +15 -0
  241. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/index.d.ts +10 -0
  242. package/dist/webpack/plugin-reload/steps/setup-reload-strategy/target-web-extension-plugin/index.d.ts +13 -0
  243. package/dist/webpack/plugin-static-assets/index.d.ts +12 -0
  244. package/dist/webpack/webpack-config.d.ts +14 -0
  245. package/dist/webpack/webpack-lib/auto-exit.d.ts +1 -0
  246. package/dist/webpack/webpack-lib/constants.d.ts +4 -0
  247. package/dist/webpack/webpack-lib/messages.d.ts +121 -0
  248. package/dist/webpack/webpack-lib/port-manager.d.ts +27 -0
  249. package/dist/webpack/webpack-lib/utils.d.ts +20 -0
  250. package/dist/webpack/webpack-types.d.ts +49 -0
  251. package/package.json +64 -29
  252. package/dist/depreacated-shadow-root.js +0 -34
  253. package/dist/inject-content-css-during-dev.js +0 -10
  254. package/dist/minimum-chromium-file.mjs +0 -1
  255. package/dist/minimum-content-file.mjs +0 -1
  256. package/dist/minimum-firefox-file.mjs +0 -1
  257. package/dist/resolver-loader.js +0 -1
  258. package/dist/resolver-module.mjs +0 -1
  259. package/dist/tailwind.config.js +0 -25
  260. /package/dist/{minimum-script-file.mjs → webpack/plugin-extension/feature-scripts/steps/minimum-content-file.d.ts} +0 -0
package/README.md ADDED
@@ -0,0 +1,204 @@
1
+ [npm-version-image]: https://img.shields.io/npm/v/extension-develop.svg?color=0971fe
2
+ [npm-version-url]: https://www.npmjs.com/package/extension-develop
3
+ [downloads-image]: https://img.shields.io/npm/dm/extension-develop.svg?color=2ecc40
4
+ [downloads-url]: https://npmjs.org/package/extension-develop
5
+ [empowering-image]: https://img.shields.io/badge/Empowering-Extension.js-0971fe
6
+ [empowering-url]: https://extension.js.org
7
+
8
+ [![Empowering][empowering-image]][empowering-url] [![Version][npm-version-image]][npm-version-url] [![Downloads][downloads-image]][downloads-url]
9
+
10
+ # extension-develop
11
+
12
+ > Develop, build, preview, and package [Extension.js](https://extension.js.org) projects.
13
+
14
+ This package powers Extension.js during local development and production builds. It provides the commands and build plugins that compile your extension, run it in browsers, and produce distributable artifacts.
15
+
16
+ ## Installation
17
+
18
+ ```
19
+ pnpm add extension-develop
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```ts
25
+ import {
26
+ extensionDev,
27
+ extensionBuild,
28
+ extensionStart,
29
+ extensionPreview,
30
+ cleanupCommand,
31
+ type DevOptions,
32
+ type BuildOptions,
33
+ type StartOptions,
34
+ type PreviewOptions
35
+ } from 'extension-develop'
36
+
37
+ async function run() {
38
+ // Development server
39
+ await extensionDev(undefined, {
40
+ browser: 'chrome',
41
+ open: true
42
+ } satisfies DevOptions)
43
+
44
+ // Production build + zip
45
+ await extensionBuild(undefined, {
46
+ browser: 'firefox',
47
+ zip: true
48
+ } satisfies BuildOptions)
49
+
50
+ // Build then preview from dist/<browser>
51
+ await extensionStart(undefined, {browser: 'edge'} satisfies StartOptions)
52
+
53
+ // Preview using an existing output folder or project path
54
+ await extensionPreview(undefined, {
55
+ browser: 'chrome',
56
+ mode: 'production'
57
+ } satisfies PreviewOptions)
58
+
59
+ // Cleanup orphaned browser instances
60
+ await cleanupCommand()
61
+ }
62
+
63
+ run()
64
+ ```
65
+
66
+ ## Features
67
+
68
+ - Live reload/HMR development server with per-instance browser runners
69
+ - Cross-browser support: Chrome, Edge, Firefox, Chromium-based, Gecko-based
70
+ - Rspack-based build with opinionated plugin stack
71
+ - Clean production output in `dist/<browser>`
72
+ - Zipping: distribution and/or source packages (respects `.gitignore`)
73
+ - Auto-install of missing dependencies and package manager detection
74
+ - 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
76
+ - Managed dependency guard to avoid conflicts
77
+
78
+ ## Commands
79
+
80
+ | Name | Summary |
81
+ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82
+ | dev | - Starts a local development server with live reload/HMR<br/>- Auto-installs dependencies if missing<br/>- Generates TypeScript shim types (`extension-env.d.ts`) when applicable<br/>- Launches a target browser with an isolated/stable profile |
83
+ | build | - Production build using the webpack/Rspack plugin stack<br/>- Cleans `dist/<browser>` before emitting<br/>- Optional packaging: distribution zip and/or source zip<br/>- Merges user config; excludes browser runners during compilation |
84
+ | start | - Runs a silent production build, then launches preview from `dist/<browser>`<br/>- Mirrors the runtime environment of shipped output |
85
+ | preview | - Launches the extension for manual testing without dev server<br/>- Uses `dist/<browser>` when present, otherwise uses the project directory<br/>- Preserves production settings; only browser runners are applied |
86
+ | cleanup | - Removes orphaned browser instances and temporary profiles created during development |
87
+
88
+ ## Command options
89
+
90
+ Options accepted by each command. Values shown are typical types or enumerations; see the tables for specifics.
91
+
92
+ ### Common (browser/runtime)
93
+
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 |
102
+
103
+ ### dev
104
+
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 |
112
+
113
+ ### build
114
+
115
+ | Option | Type / Values | Description |
116
+ | ----------- | ------------- | -------------------------------------------------------------- |
117
+ | zip | boolean | Package `dist/<browser>` as an artifact (e.g., `.zip`, `.xpi`) |
118
+ | zipSource | boolean | Package source files (respects `.gitignore`) |
119
+ | zipFilename | string | Custom base name for artifacts |
120
+ | polyfill | boolean | Include `webextension-polyfill` when possible |
121
+ | silent | boolean | Suppress non-error logs |
122
+
123
+ ### start
124
+
125
+ | Option | Type / Values | Description |
126
+ | -------- | ------------- | --------------------------------------------- |
127
+ | mode | `production` | Build mode |
128
+ | polyfill | boolean | Include `webextension-polyfill` when possible |
129
+
130
+ ### preview
131
+
132
+ | Option | Type / Values | Description |
133
+ | ---------- | ------------- | ------------------------------------------------------------------- |
134
+ | mode | `production` | Build mode |
135
+ | outputPath | string | Directory to run from (defaults to `dist/<browser>` when available) |
136
+
137
+ ## Project detection and inputs
138
+
139
+ - Path or remote: Commands accept a local path or a remote URL.
140
+ - GitHub repo URL: downloaded via `go-git-it` into a subfolder named after the repository.
141
+ - Other HTTP(S) URLs: treated as zip archives and extracted locally.
142
+ - Monorepos: The nearest `manifest.json` is resolved recursively; the nearest valid `package.json` is then located and validated.
143
+
144
+ ## User config
145
+
146
+ - Provide `extension.config.js` or `extension.config.mjs` in your project root.
147
+ - 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.
151
+ - When detected, a one‑time notice is printed to indicate config is active.
152
+
153
+ ## Safety and ergonomics
154
+
155
+ - Managed dependency guard: If your `extension.config.*` references dependencies that are managed by Extension.js itself, the command aborts with a detailed message to prevent version conflicts.
156
+ - Auto‑install: If `node_modules` is missing, the appropriate package manager is detected and dependencies are installed before running.
157
+ - Type generation: For TypeScript projects, `extension-env.d.ts` is generated/updated to include required types and polyfills.
158
+
159
+ ## Packaging outputs
160
+
161
+ - Distribution artifacts live under `dist/<browser>/` and source artifacts under `dist/`.
162
+ - File names default to a sanitized form of `manifest.name` plus `manifest.version` (override with `zipFilename`).
163
+ - Source packaging respects `.gitignore`.
164
+
165
+ Example layout when both `zip` and `zipSource` are enabled:
166
+
167
+ ```
168
+ dist/
169
+ chrome/
170
+ <name>-<version>.zip
171
+ <name>-<version>-source.zip
172
+ ```
173
+
174
+ ## Notes and compatibility
175
+
176
+ - Built on the same Rspack stack as `@/webpack`; user config is loaded when an `extension.config.*` is present.
177
+ - Only `EXTENSION_PUBLIC_*` variables are injected into client code; avoid secrets in templated `.json`/`.html`.
178
+
179
+ ## Plugins
180
+
181
+ | Name | Group | Summary |
182
+ | -------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
183
+ | plugin-extension | core | - Core builder: emits pages and scripts<br/>- Validates and rewrites `manifest.json`<br/>- Ships icons, JSON, locales, and web resources<br/>- Ensures dev parity between local and shipped output |
184
+ | plugin-css | core | - Auto‑wires CSS for HTML and content scripts<br/>- Optional SASS/LESS/PostCSS when configs exist<br/>- Integrates Stylelint when configured |
185
+ | plugin-js-frameworks | core | - Detects React/Preact/Vue/Svelte and TypeScript<br/>- Configures SWC parsing, loaders/plugins, and safe aliases<br/>- Sets `tsconfig` resolution<br/>- Defers heavy work to `beforeRun` in production |
186
+ | 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 |
187
+ | plugin-compatibility | core | - Cross‑browser helpers<br/>- Normalizes browser‑specific manifest fields<br/>- Optional `webextension-polyfill` for Chromium |
188
+ | plugin-compilation | core | - Loads env and templating (`EXTENSION_PUBLIC_*`)<br/>- Optional `dist/<browser>` cleaning<br/>- Compact, de‑duplicated compilation summary |
189
+ | 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 |
190
+
191
+ ## Notes and compatibility
192
+
193
+ - Built against `@rspack/core`; Webpack 5 may work for some plugins but is not officially supported here.
194
+ - Only `EXTENSION_PUBLIC_*` variables are injected into client code; avoid embedding secrets in templated `.json`/`.html`.
195
+
196
+ ## Related files in this folder
197
+
198
+ - `webpack/webpack-config.ts`: Assembles the plugin stack and shared configuration.
199
+ - `webpack/dev-server.ts`: Local development server wiring and reload orchestration.
200
+ - `webpack/webpack-types.ts`: Common types for the plugin stack.
201
+
202
+ ## License
203
+
204
+ MIT (c) Cezar Augusto and the Extension.js Authors.