extension-develop 2.1.3 → 3.0.0-next.6

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 +11751 -9472
  12. package/dist/resolve-paths-loader.js +1387 -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
@@ -0,0 +1,1387 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
+ return 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
+ }();
5
+ var __webpack_modules__ = {
6
+ "@swc/core?782a": function(module) {
7
+ module.exports = require("@swc/core");
8
+ },
9
+ "@swc/core?7929": function(module) {
10
+ module.exports = import("@swc/core").then(function(module) {
11
+ return module;
12
+ });
13
+ }
14
+ };
15
+ var __webpack_module_cache__ = {};
16
+ function __webpack_require__(moduleId) {
17
+ var cachedModule = __webpack_module_cache__[moduleId];
18
+ if (void 0 !== cachedModule) return cachedModule.exports;
19
+ var module = __webpack_module_cache__[moduleId] = {
20
+ exports: {}
21
+ };
22
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
23
+ return module.exports;
24
+ }
25
+ (()=>{
26
+ __webpack_require__.n = (module)=>{
27
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
28
+ __webpack_require__.d(getter, {
29
+ a: getter
30
+ });
31
+ return getter;
32
+ };
33
+ })();
34
+ (()=>{
35
+ __webpack_require__.d = (exports1, definition)=>{
36
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
37
+ enumerable: true,
38
+ get: definition[key]
39
+ });
40
+ };
41
+ })();
42
+ (()=>{
43
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
44
+ })();
45
+ (()=>{
46
+ __webpack_require__.r = (exports1)=>{
47
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
48
+ value: 'Module'
49
+ });
50
+ Object.defineProperty(exports1, '__esModule', {
51
+ value: true
52
+ });
53
+ };
54
+ })();
55
+ var __webpack_exports__ = {};
56
+ (()=>{
57
+ __webpack_require__.r(__webpack_exports__);
58
+ __webpack_require__.d(__webpack_exports__, {
59
+ default: ()=>resolvePathsLoader
60
+ });
61
+ const external_path_namespaceObject = require("path");
62
+ const external_fs_namespaceObject = require("fs");
63
+ const external_magic_string_namespaceObject = require("magic-string");
64
+ var external_magic_string_default = /*#__PURE__*/ __webpack_require__.n(external_magic_string_namespaceObject);
65
+ function getFilename(feature, filePath) {
66
+ const entryExt = external_path_namespaceObject.extname(filePath);
67
+ let fileOutputpath = feature;
68
+ if ([
69
+ '.js',
70
+ '.jsx',
71
+ '.tsx',
72
+ '.ts'
73
+ ].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.js');
74
+ if ([
75
+ '.html',
76
+ '.njk',
77
+ '.nunjucks'
78
+ ].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.html');
79
+ if ([
80
+ '.css',
81
+ '.scss',
82
+ '.sass',
83
+ '.less'
84
+ ].includes(entryExt)) fileOutputpath = fileOutputpath.replace(entryExt, '.css');
85
+ return unixify(fileOutputpath || '');
86
+ }
87
+ function unixify(filePath) {
88
+ return filePath.replace(/\\/g, '/');
89
+ }
90
+ function memberChainFromCallee(callee) {
91
+ const memberParts = [];
92
+ let currentExpression = callee;
93
+ while(currentExpression && 'ParenExpression' === currentExpression.type)currentExpression = currentExpression.expression;
94
+ while(currentExpression){
95
+ if ('Identifier' === currentExpression.type) {
96
+ memberParts.unshift(currentExpression.value);
97
+ break;
98
+ }
99
+ if ('MemberExpression' === currentExpression.type) {
100
+ const propertyNode = currentExpression.property;
101
+ if ((null == propertyNode ? void 0 : propertyNode.type) === 'Identifier') memberParts.unshift(propertyNode.value);
102
+ currentExpression = currentExpression.object;
103
+ continue;
104
+ }
105
+ break;
106
+ }
107
+ return memberParts;
108
+ }
109
+ function getPropName(propertyNode) {
110
+ if (!propertyNode || 'KeyValueProperty' !== propertyNode.type) return;
111
+ const keyNode = propertyNode.key;
112
+ if ((null == keyNode ? void 0 : keyNode.type) === 'Identifier') return keyNode.value;
113
+ if ((null == keyNode ? void 0 : keyNode.type) === 'StringLiteral') return keyNode.value;
114
+ }
115
+ function isHttpLike(input) {
116
+ return /^https?:\/\//i.test(input) || /^data:/i.test(input) || /^chrome:\/\//i.test(input) || /^moz-extension:\/\//i.test(input);
117
+ }
118
+ function hasGlob(input) {
119
+ return /[*?\[\]{}]/.test(input);
120
+ }
121
+ function resolveLiteralToOutput(literal, opts) {
122
+ const { manifestPath, packageJsonDir, authorFilePath } = opts;
123
+ const root = packageJsonDir || external_path_namespaceObject.dirname(manifestPath);
124
+ const canonicalUnixPath = unixify(literal || '');
125
+ if (!literal || isHttpLike(literal) || hasGlob(literal)) return;
126
+ if (/^\/public\//i.test(canonicalUnixPath)) {
127
+ const out = canonicalUnixPath.replace(/^\/public\//i, '');
128
+ return out;
129
+ }
130
+ if (/^(?:\.\/)?public\//i.test(canonicalUnixPath)) {
131
+ const out = canonicalUnixPath.replace(/^(?:\.\/)?public\//i, '');
132
+ return out;
133
+ }
134
+ if (/^\//.test(canonicalUnixPath)) {
135
+ const trimmed = canonicalUnixPath.replace(/^\//, '');
136
+ if (/^(?:pages|scripts)\//i.test(trimmed)) {
137
+ const abs = external_path_namespaceObject.join(root, trimmed);
138
+ return unixify(getFilename(trimmed, abs));
139
+ }
140
+ return trimmed;
141
+ }
142
+ const baseDir = /^(\.\/|\.\.\/)/.test(canonicalUnixPath) && authorFilePath ? external_path_namespaceObject.dirname(authorFilePath) : root;
143
+ const candidateAbsolutePath = external_path_namespaceObject.isAbsolute(literal) ? literal : external_path_namespaceObject.resolve(baseDir, literal);
144
+ const pathWithoutDotPrefix = canonicalUnixPath.replace(/^\.\//, '');
145
+ if (/^pages\//i.test(pathWithoutDotPrefix)) return unixify(getFilename(pathWithoutDotPrefix, candidateAbsolutePath));
146
+ if (/^scripts\//i.test(pathWithoutDotPrefix)) return unixify(getFilename(pathWithoutDotPrefix, candidateAbsolutePath));
147
+ try {
148
+ const normalizedRel = unixify(external_path_namespaceObject.relative(root, candidateAbsolutePath));
149
+ const relNoDotPrefix = normalizedRel.replace(/^\.\//, '');
150
+ if (/^public\//i.test(relNoDotPrefix)) return relNoDotPrefix.replace(/^public\//i, '');
151
+ if (/^pages\//i.test(relNoDotPrefix)) return unixify(getFilename(relNoDotPrefix, candidateAbsolutePath));
152
+ if (/^scripts\//i.test(relNoDotPrefix)) return unixify(getFilename(relNoDotPrefix, candidateAbsolutePath));
153
+ } catch {}
154
+ }
155
+ function isStringLiteral(node) {
156
+ return node && 'StringLiteral' === node.type && 'string' == typeof node.value;
157
+ }
158
+ function isStaticTemplate(node) {
159
+ return node && 'TemplateLiteral' === node.type && Array.isArray(node.expressions) && 0 === node.expressions.length;
160
+ }
161
+ function evalStaticString(node) {
162
+ if (!node) return;
163
+ if (node && 'ParenExpression' === node.type) return evalStaticString(node.expression);
164
+ if (isStringLiteral(node)) return node.value;
165
+ if (isStaticTemplate(node)) {
166
+ var _node_quasis;
167
+ return null == (_node_quasis = node.quasis) ? void 0 : _node_quasis.map((quasi)=>quasi.raw ?? '').join('');
168
+ }
169
+ if (node && 'BinaryExpression' === node.type && '+' === node.operator) {
170
+ const left = evalStaticString(node.left);
171
+ const right = evalStaticString(node.right);
172
+ if ('string' == typeof left && 'string' == typeof right) return left + right;
173
+ }
174
+ }
175
+ function handleRuntimeCalls(node, source, rewriteValue, manifestPath) {
176
+ var _node_arguments;
177
+ if ('CallExpression' !== node.type) return false;
178
+ const memberChain = memberChainFromCallee(node.callee);
179
+ const apiRoot = memberChain[0];
180
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
181
+ const method = memberChain.join('.');
182
+ if ((method.endsWith('runtime.getURL') || method.endsWith('extension.getURL')) && (null == (_node_arguments = node.arguments) ? void 0 : _node_arguments[0])) {
183
+ const firstArgument = node.arguments[0].expression;
184
+ if (isStringLiteral(firstArgument)) {
185
+ const resolved = resolveLiteralToOutput(firstArgument.value, {
186
+ manifestPath
187
+ });
188
+ rewriteValue(firstArgument, resolved, firstArgument.value);
189
+ } else if (isStaticTemplate(firstArgument)) {
190
+ const rawTemplate = source.slice(firstArgument.span.start + 1, firstArgument.span.end - 1);
191
+ const resolved = resolveLiteralToOutput(rawTemplate, {
192
+ manifestPath
193
+ });
194
+ rewriteValue(firstArgument, resolved, rawTemplate);
195
+ }
196
+ return true;
197
+ }
198
+ return false;
199
+ }
200
+ function handleActionAndPopup(node, source, rewriteValue, manifestPath) {
201
+ if ('CallExpression' !== node.type) return false;
202
+ const memberChain = memberChainFromCallee(node.callee);
203
+ const apiRoot = memberChain[0];
204
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
205
+ const method = memberChain.join('.');
206
+ if (method.endsWith('action.setIcon') || method.endsWith('pageAction.setIcon') || method.endsWith('browserAction.setIcon')) {
207
+ var _node_arguments_, _node_arguments;
208
+ const firstArgument = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[0]) ? void 0 : _node_arguments_.expression;
209
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
210
+ if ('KeyValueProperty' !== propertyNode.type) continue;
211
+ const keyName = getPropName(propertyNode);
212
+ if ('path' !== keyName) continue;
213
+ const valueNode = propertyNode.value;
214
+ if (isStringLiteral(valueNode)) {
215
+ const resolved = resolveLiteralToOutput(valueNode.value, {
216
+ manifestPath
217
+ });
218
+ rewriteValue(valueNode, resolved, valueNode.value);
219
+ } else if ((null == valueNode ? void 0 : valueNode.type) === 'ObjectExpression') {
220
+ for (const innerProperty of valueNode.properties || [])if ('KeyValueProperty' === innerProperty.type && isStringLiteral(innerProperty.value)) {
221
+ const resolved = resolveLiteralToOutput(innerProperty.value.value, {
222
+ manifestPath
223
+ });
224
+ rewriteValue(innerProperty.value, resolved, innerProperty.value.value);
225
+ } else if ('KeyValueProperty' === innerProperty.type && isStaticTemplate(innerProperty.value)) {
226
+ const raw = source.slice(innerProperty.value.span.start + 1, innerProperty.value.span.end - 1);
227
+ const resolved = resolveLiteralToOutput(raw, {
228
+ manifestPath
229
+ });
230
+ rewriteValue(innerProperty.value, resolved, raw);
231
+ } else if ('KeyValueProperty' === innerProperty.type) {
232
+ const raw = evalStaticString(innerProperty.value);
233
+ if ('string' == typeof raw) {
234
+ const resolved = resolveLiteralToOutput(raw, {
235
+ manifestPath
236
+ });
237
+ const originalExpr = source.slice(innerProperty.value.span.start, innerProperty.value.span.end);
238
+ rewriteValue(innerProperty.value, resolved, originalExpr);
239
+ }
240
+ }
241
+ } else if (isStaticTemplate(valueNode)) {
242
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
243
+ const resolved = resolveLiteralToOutput(raw, {
244
+ manifestPath
245
+ });
246
+ rewriteValue(valueNode, resolved, raw);
247
+ } else {
248
+ const raw = evalStaticString(valueNode);
249
+ if ('string' == typeof raw) {
250
+ const resolved = resolveLiteralToOutput(raw, {
251
+ manifestPath
252
+ });
253
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
254
+ rewriteValue(valueNode, resolved, originalExpr);
255
+ }
256
+ }
257
+ }
258
+ return true;
259
+ }
260
+ if (method.endsWith('action.setPopup') || method.endsWith('pageAction.setPopup') || method.endsWith('browserAction.setPopup')) {
261
+ var _node_arguments_1, _node_arguments1;
262
+ const firstArgument = null == (_node_arguments1 = node.arguments) ? void 0 : null == (_node_arguments_1 = _node_arguments1[0]) ? void 0 : _node_arguments_1.expression;
263
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
264
+ if ('KeyValueProperty' !== propertyNode.type) continue;
265
+ const keyName = getPropName(propertyNode);
266
+ if ('popup' !== keyName) continue;
267
+ const valueNode = propertyNode.value;
268
+ if (isStringLiteral(valueNode)) {
269
+ const resolved = resolveLiteralToOutput(valueNode.value, {
270
+ manifestPath
271
+ });
272
+ rewriteValue(valueNode, resolved);
273
+ } else if (isStaticTemplate(valueNode)) {
274
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
275
+ const resolved = resolveLiteralToOutput(raw, {
276
+ manifestPath
277
+ });
278
+ rewriteValue(valueNode, resolved);
279
+ } else {
280
+ const raw = evalStaticString(valueNode);
281
+ if ('string' == typeof raw) {
282
+ const resolved = resolveLiteralToOutput(raw, {
283
+ manifestPath
284
+ });
285
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
286
+ rewriteValue(valueNode, resolved, originalExpr);
287
+ }
288
+ }
289
+ }
290
+ return true;
291
+ }
292
+ return false;
293
+ }
294
+ function handleDevtools(node, source, rewriteValue, manifestPath) {
295
+ if ('CallExpression' !== node.type) return false;
296
+ const memberChain = memberChainFromCallee(node.callee);
297
+ const apiRoot = memberChain[0];
298
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
299
+ const method = memberChain.join('.');
300
+ if (method.endsWith('devtools.panels.create')) {
301
+ var _node_arguments_, _node_arguments, _node_arguments_1, _node_arguments1;
302
+ const iconArg = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[1]) ? void 0 : _node_arguments_.expression;
303
+ const pageArg = null == (_node_arguments1 = node.arguments) ? void 0 : null == (_node_arguments_1 = _node_arguments1[2]) ? void 0 : _node_arguments_1.expression;
304
+ let touched = false;
305
+ if (isStringLiteral(iconArg)) {
306
+ const resolved = resolveLiteralToOutput(iconArg.value, {
307
+ manifestPath
308
+ });
309
+ rewriteValue(iconArg, resolved, iconArg.value);
310
+ touched = true;
311
+ } else if (isStaticTemplate(iconArg)) {
312
+ const rawTemplate = source.slice(iconArg.span.start + 1, iconArg.span.end - 1);
313
+ const resolved = resolveLiteralToOutput(rawTemplate, {
314
+ manifestPath
315
+ });
316
+ rewriteValue(iconArg, resolved, rawTemplate);
317
+ } else {
318
+ const staticallyEvaluated = evalStaticString(iconArg);
319
+ if ('string' == typeof staticallyEvaluated) {
320
+ const resolved = resolveLiteralToOutput(staticallyEvaluated, {
321
+ manifestPath
322
+ });
323
+ const originalExpr = source.slice(iconArg.span.start, iconArg.span.end);
324
+ rewriteValue(iconArg, resolved, originalExpr);
325
+ touched = true;
326
+ }
327
+ }
328
+ if (isStringLiteral(pageArg)) {
329
+ const resolved = resolveLiteralToOutput(pageArg.value, {
330
+ manifestPath
331
+ });
332
+ rewriteValue(pageArg, resolved, pageArg.value);
333
+ touched = true;
334
+ } else if (isStaticTemplate(pageArg)) {
335
+ const rawTemplate = source.slice(pageArg.span.start + 1, pageArg.span.end - 1);
336
+ const resolved = resolveLiteralToOutput(rawTemplate, {
337
+ manifestPath
338
+ });
339
+ rewriteValue(pageArg, resolved, rawTemplate);
340
+ } else {
341
+ const staticallyEvaluated = evalStaticString(pageArg);
342
+ if ('string' == typeof staticallyEvaluated) {
343
+ const resolved = resolveLiteralToOutput(staticallyEvaluated, {
344
+ manifestPath
345
+ });
346
+ const originalExpr = source.slice(pageArg.span.start, pageArg.span.end);
347
+ rewriteValue(pageArg, resolved, originalExpr);
348
+ touched = true;
349
+ }
350
+ }
351
+ return touched;
352
+ }
353
+ return false;
354
+ }
355
+ function handleTabsAndWindows(node, source, rewriteValue, manifestPath) {
356
+ if ('CallExpression' !== node.type) return false;
357
+ const memberChain = memberChainFromCallee(node.callee);
358
+ const apiRoot = memberChain[0];
359
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
360
+ const method = memberChain.join('.');
361
+ if (method.endsWith('tabs.create') || method.endsWith('windows.create')) {
362
+ var _node_arguments_, _node_arguments;
363
+ const firstArgument = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[0]) ? void 0 : _node_arguments_.expression;
364
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
365
+ if ('KeyValueProperty' !== propertyNode.type) continue;
366
+ const keyName = getPropName(propertyNode);
367
+ if ('url' !== keyName) continue;
368
+ const valueNode = propertyNode.value;
369
+ if (isStringLiteral(valueNode)) {
370
+ const resolved = resolveLiteralToOutput(valueNode.value, {
371
+ manifestPath
372
+ });
373
+ rewriteValue(valueNode, resolved, valueNode.value);
374
+ } else if ((null == valueNode ? void 0 : valueNode.type) === 'ArrayExpression') for (const arrayElement of valueNode.elements || []){
375
+ const literalNode = null == arrayElement ? void 0 : arrayElement.expression;
376
+ if (isStringLiteral(literalNode)) {
377
+ const resolved = resolveLiteralToOutput(literalNode.value, {
378
+ manifestPath
379
+ });
380
+ rewriteValue(literalNode, resolved, literalNode.value);
381
+ } else if (isStaticTemplate(literalNode)) {
382
+ const raw = source.slice(literalNode.span.start + 1, literalNode.span.end - 1);
383
+ const resolved = resolveLiteralToOutput(raw, {
384
+ manifestPath
385
+ });
386
+ rewriteValue(literalNode, resolved, raw);
387
+ } else {
388
+ const raw = evalStaticString(literalNode);
389
+ if ('string' == typeof raw) {
390
+ const resolved = resolveLiteralToOutput(raw, {
391
+ manifestPath
392
+ });
393
+ const originalExpr = source.slice(literalNode.span.start, literalNode.span.end);
394
+ rewriteValue(literalNode, resolved, originalExpr);
395
+ }
396
+ }
397
+ }
398
+ else if (isStaticTemplate(valueNode)) {
399
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
400
+ const resolved = resolveLiteralToOutput(raw, {
401
+ manifestPath
402
+ });
403
+ rewriteValue(valueNode, resolved, raw);
404
+ } else {
405
+ const raw = evalStaticString(valueNode);
406
+ if ('string' == typeof raw) {
407
+ const resolved = resolveLiteralToOutput(raw, {
408
+ manifestPath
409
+ });
410
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
411
+ rewriteValue(valueNode, resolved, originalExpr);
412
+ }
413
+ }
414
+ }
415
+ return true;
416
+ }
417
+ if (method.endsWith('tabs.update')) {
418
+ var _node_arguments_1, _node_arguments1, _node_arguments_2, _node_arguments2;
419
+ const optionsArgument = (null == (_node_arguments1 = node.arguments) ? void 0 : null == (_node_arguments_1 = _node_arguments1[1]) ? void 0 : _node_arguments_1.expression) || (null == (_node_arguments2 = node.arguments) ? void 0 : null == (_node_arguments_2 = _node_arguments2[0]) ? void 0 : _node_arguments_2.expression);
420
+ if ((null == optionsArgument ? void 0 : optionsArgument.type) === 'ObjectExpression') for (const propertyNode of optionsArgument.properties || []){
421
+ if ('KeyValueProperty' !== propertyNode.type) continue;
422
+ const keyName = getPropName(propertyNode);
423
+ if ('url' !== keyName) continue;
424
+ const valueNode = propertyNode.value;
425
+ if (isStringLiteral(valueNode)) {
426
+ const resolved = resolveLiteralToOutput(valueNode.value, {
427
+ manifestPath
428
+ });
429
+ rewriteValue(valueNode, resolved, valueNode.value);
430
+ } else if (isStaticTemplate(valueNode)) {
431
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
432
+ const resolved = resolveLiteralToOutput(raw, {
433
+ manifestPath
434
+ });
435
+ rewriteValue(valueNode, resolved, raw);
436
+ } else {
437
+ const raw = evalStaticString(valueNode);
438
+ if ('string' == typeof raw) {
439
+ const resolved = resolveLiteralToOutput(raw, {
440
+ manifestPath
441
+ });
442
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
443
+ rewriteValue(valueNode, resolved, originalExpr);
444
+ }
445
+ }
446
+ }
447
+ return true;
448
+ }
449
+ return false;
450
+ }
451
+ function handleScripting(node, source, rewriteValue, manifestPath) {
452
+ if ('CallExpression' !== node.type) return false;
453
+ const memberChain = memberChainFromCallee(node.callee);
454
+ const apiRoot = memberChain[0];
455
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
456
+ const method = memberChain.join('.');
457
+ if (method.endsWith("scripting.registerContentScripts")) {
458
+ for (const argumentNode of node.arguments || []){
459
+ const arrayExpressionNode = null == argumentNode ? void 0 : argumentNode.expression;
460
+ if (arrayExpressionNode && 'ArrayExpression' === arrayExpressionNode.type) for (const arrayElement of arrayExpressionNode.elements || []){
461
+ const objectExpressionNode = null == arrayElement ? void 0 : arrayElement.expression;
462
+ if (objectExpressionNode && 'ObjectExpression' === objectExpressionNode.type) for (const propertyNode of objectExpressionNode.properties || []){
463
+ if ('KeyValueProperty' !== propertyNode.type) continue;
464
+ const keyName = getPropName(propertyNode);
465
+ if ('js' !== keyName && 'css' !== keyName) continue;
466
+ const valueNode = propertyNode.value;
467
+ if ('ArrayExpression' === valueNode.type) for (const innerItem of valueNode.elements || []){
468
+ const literalNode = null == innerItem ? void 0 : innerItem.expression;
469
+ if (isStringLiteral(literalNode)) {
470
+ const resolved = resolveLiteralToOutput(literalNode.value, {
471
+ manifestPath
472
+ });
473
+ rewriteValue(literalNode, resolved, literalNode.value);
474
+ } else if (isStaticTemplate(literalNode)) {
475
+ const raw = source.slice(literalNode.span.start + 1, literalNode.span.end - 1);
476
+ const resolved = resolveLiteralToOutput(raw, {
477
+ manifestPath
478
+ });
479
+ rewriteValue(literalNode, resolved, raw);
480
+ } else {
481
+ const raw = evalStaticString(literalNode);
482
+ if ('string' == typeof raw) {
483
+ const resolved = resolveLiteralToOutput(raw, {
484
+ manifestPath
485
+ });
486
+ const originalExpr = source.slice(literalNode.span.start, literalNode.span.end);
487
+ rewriteValue(literalNode, resolved, originalExpr);
488
+ }
489
+ }
490
+ }
491
+ else if (isStringLiteral(valueNode)) {
492
+ const resolved = resolveLiteralToOutput(valueNode.value, {
493
+ manifestPath
494
+ });
495
+ rewriteValue(valueNode, resolved, valueNode.value);
496
+ } else if (isStaticTemplate(valueNode)) {
497
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
498
+ const resolved = resolveLiteralToOutput(raw, {
499
+ manifestPath
500
+ });
501
+ rewriteValue(valueNode, resolved, raw);
502
+ } else {
503
+ const raw = evalStaticString(valueNode);
504
+ if ('string' == typeof raw) {
505
+ const resolved = resolveLiteralToOutput(raw, {
506
+ manifestPath
507
+ });
508
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
509
+ rewriteValue(valueNode, resolved, originalExpr);
510
+ }
511
+ }
512
+ }
513
+ }
514
+ }
515
+ return true;
516
+ }
517
+ if (method.endsWith("scripting.executeScript") || method.endsWith("scripting.insertCSS")) {
518
+ var _node_arguments_, _node_arguments;
519
+ const firstArgument = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[0]) ? void 0 : _node_arguments_.expression;
520
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
521
+ if ('KeyValueProperty' !== propertyNode.type) continue;
522
+ const keyName = getPropName(propertyNode);
523
+ if ('files' !== keyName) continue;
524
+ const valueNode = propertyNode.value;
525
+ if ((null == valueNode ? void 0 : valueNode.type) === 'ArrayExpression') for (const arrayElement of valueNode.elements || []){
526
+ const literalNode = null == arrayElement ? void 0 : arrayElement.expression;
527
+ if (isStringLiteral(literalNode)) {
528
+ const resolved = resolveLiteralToOutput(literalNode.value, {
529
+ manifestPath
530
+ });
531
+ rewriteValue(literalNode, resolved, literalNode.value);
532
+ } else if (isStaticTemplate(literalNode)) {
533
+ const raw = source.slice(literalNode.span.start + 1, literalNode.span.end - 1);
534
+ const resolved = resolveLiteralToOutput(raw, {
535
+ manifestPath
536
+ });
537
+ rewriteValue(literalNode, resolved, raw);
538
+ } else {
539
+ const raw = evalStaticString(literalNode);
540
+ if ('string' == typeof raw) {
541
+ const resolved = resolveLiteralToOutput(raw, {
542
+ manifestPath
543
+ });
544
+ const originalExpr = source.slice(literalNode.span.start, literalNode.span.end);
545
+ rewriteValue(literalNode, resolved, originalExpr);
546
+ }
547
+ }
548
+ }
549
+ }
550
+ return true;
551
+ }
552
+ return false;
553
+ }
554
+ function handleMv2Tabs(node, source, rewriteValue, manifestPath) {
555
+ if ('CallExpression' !== node.type) return false;
556
+ const memberChain = memberChainFromCallee(node.callee);
557
+ const apiRoot = memberChain[0];
558
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
559
+ const method = memberChain.join('.');
560
+ if (method.endsWith('tabs.executeScript') || method.endsWith('tabs.insertCSS')) {
561
+ var _node_arguments_, _node_arguments;
562
+ const firstArgument = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[0]) ? void 0 : _node_arguments_.expression;
563
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
564
+ if ('KeyValueProperty' !== propertyNode.type) continue;
565
+ const keyName = getPropName(propertyNode);
566
+ if ('file' !== keyName) continue;
567
+ const valueNode = propertyNode.value;
568
+ if (isStringLiteral(valueNode)) {
569
+ const resolved = resolveLiteralToOutput(valueNode.value, {
570
+ manifestPath
571
+ });
572
+ rewriteValue(valueNode, resolved, valueNode.value);
573
+ } else if (isStaticTemplate(valueNode)) {
574
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
575
+ const resolved = resolveLiteralToOutput(raw, {
576
+ manifestPath
577
+ });
578
+ rewriteValue(valueNode, resolved, raw);
579
+ } else {
580
+ const raw = evalStaticString(valueNode);
581
+ if ('string' == typeof raw) {
582
+ const resolved = resolveLiteralToOutput(raw, {
583
+ manifestPath
584
+ });
585
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
586
+ rewriteValue(valueNode, resolved, originalExpr);
587
+ }
588
+ }
589
+ }
590
+ return true;
591
+ }
592
+ return false;
593
+ }
594
+ function handlePanels(node, source, rewriteValue, manifestPath) {
595
+ if ('CallExpression' !== node.type) return false;
596
+ const memberChain = memberChainFromCallee(node.callee);
597
+ const apiRoot = memberChain[0];
598
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
599
+ const method = memberChain.join('.');
600
+ if (method.endsWith('sidePanel.setOptions') || method.endsWith('sidebarAction.setPanel')) {
601
+ var _node_arguments_, _node_arguments;
602
+ const firstArgument = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[0]) ? void 0 : _node_arguments_.expression;
603
+ if (method.endsWith('sidebarAction.setPanel')) {
604
+ const arg = firstArgument;
605
+ if (isStringLiteral(arg)) {
606
+ const resolved = resolveLiteralToOutput(arg.value, {
607
+ manifestPath
608
+ });
609
+ rewriteValue(arg, resolved, arg.value);
610
+ return true;
611
+ }
612
+ if (isStaticTemplate(arg)) {
613
+ const raw = source.slice(arg.span.start + 1, arg.span.end - 1);
614
+ const resolved = resolveLiteralToOutput(raw, {
615
+ manifestPath
616
+ });
617
+ rewriteValue(arg, resolved, raw);
618
+ return true;
619
+ }
620
+ {
621
+ const raw = evalStaticString(arg);
622
+ if ('string' == typeof raw) {
623
+ const resolved = resolveLiteralToOutput(raw, {
624
+ manifestPath
625
+ });
626
+ const originalExpr = source.slice(arg.span.start, arg.span.end);
627
+ rewriteValue(arg, resolved, originalExpr);
628
+ return true;
629
+ }
630
+ }
631
+ }
632
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
633
+ if ('KeyValueProperty' !== propertyNode.type) continue;
634
+ const keyName = getPropName(propertyNode);
635
+ if ('path' === keyName || 'panel' === keyName || 'page' === keyName) {
636
+ const valueNode = propertyNode.value;
637
+ if (isStringLiteral(valueNode)) {
638
+ const resolved = resolveLiteralToOutput(valueNode.value, {
639
+ manifestPath
640
+ });
641
+ rewriteValue(valueNode, resolved, valueNode.value);
642
+ } else if (isStaticTemplate(valueNode)) {
643
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
644
+ const resolved = resolveLiteralToOutput(raw, {
645
+ manifestPath
646
+ });
647
+ rewriteValue(valueNode, resolved, raw);
648
+ } else {
649
+ const raw = evalStaticString(valueNode);
650
+ if ('string' == typeof raw) {
651
+ const resolved = resolveLiteralToOutput(raw, {
652
+ manifestPath
653
+ });
654
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
655
+ rewriteValue(valueNode, resolved, originalExpr);
656
+ }
657
+ }
658
+ }
659
+ }
660
+ return true;
661
+ }
662
+ return false;
663
+ }
664
+ function handleNotifications(node, source, rewriteValue, manifestPath) {
665
+ if ('CallExpression' !== node.type) return false;
666
+ const memberChain = memberChainFromCallee(node.callee);
667
+ const apiRoot = memberChain[0];
668
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
669
+ const method = memberChain.join('.');
670
+ if (method.endsWith('notifications.create') || method.endsWith('notifications.update')) {
671
+ var _node_arguments_, _node_arguments, _node_arguments_1, _node_arguments1;
672
+ const optionsArgument = (null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[1]) ? void 0 : _node_arguments_.expression) || (null == (_node_arguments1 = node.arguments) ? void 0 : null == (_node_arguments_1 = _node_arguments1[0]) ? void 0 : _node_arguments_1.expression);
673
+ if ((null == optionsArgument ? void 0 : optionsArgument.type) === 'ObjectExpression') {
674
+ let touched = false;
675
+ for (const propertyNode of optionsArgument.properties || []){
676
+ if ('KeyValueProperty' !== propertyNode.type) continue;
677
+ const keyName = getPropName(propertyNode);
678
+ if ('iconUrl' === keyName || 'imageUrl' === keyName) {
679
+ const valueNode = propertyNode.value;
680
+ if (isStringLiteral(valueNode)) {
681
+ const resolved = resolveLiteralToOutput(valueNode.value, {
682
+ manifestPath
683
+ });
684
+ rewriteValue(valueNode, resolved, valueNode.value);
685
+ touched = true;
686
+ } else if (isStaticTemplate(valueNode)) {
687
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
688
+ const resolved = resolveLiteralToOutput(raw, {
689
+ manifestPath
690
+ });
691
+ rewriteValue(valueNode, resolved, raw);
692
+ touched = true;
693
+ } else {
694
+ const raw = evalStaticString(valueNode);
695
+ if ('string' == typeof raw) {
696
+ const resolved = resolveLiteralToOutput(raw, {
697
+ manifestPath
698
+ });
699
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
700
+ rewriteValue(valueNode, resolved, originalExpr);
701
+ touched = true;
702
+ }
703
+ }
704
+ }
705
+ }
706
+ if (touched) return true;
707
+ }
708
+ }
709
+ return false;
710
+ }
711
+ function handleMenus(node, source, rewriteValue, manifestPath) {
712
+ if ('CallExpression' !== node.type) return false;
713
+ const memberChain = memberChainFromCallee(node.callee);
714
+ const apiRoot = memberChain[0];
715
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
716
+ const method = memberChain.join('.');
717
+ if (method.endsWith('contextMenus.create') || method.endsWith('contextMenus.update') || method.endsWith('menus.create') || method.endsWith('menus.update')) {
718
+ var _node_arguments_, _node_arguments;
719
+ const firstArgument = null == (_node_arguments = node.arguments) ? void 0 : null == (_node_arguments_ = _node_arguments[0]) ? void 0 : _node_arguments_.expression;
720
+ if ((null == firstArgument ? void 0 : firstArgument.type) === 'ObjectExpression') for (const propertyNode of firstArgument.properties || []){
721
+ if ('KeyValueProperty' !== propertyNode.type) continue;
722
+ const keyNode = propertyNode.key;
723
+ const keyName = (null == keyNode ? void 0 : keyNode.type) === 'Identifier' ? keyNode.value : null == keyNode ? void 0 : keyNode.value;
724
+ if ('icons' !== keyName) continue;
725
+ const valueNode = propertyNode.value;
726
+ if ((null == valueNode ? void 0 : valueNode.type) === 'ObjectExpression') for (const innerProperty of valueNode.properties || []){
727
+ if ('KeyValueProperty' !== innerProperty.type) continue;
728
+ const innerValue = innerProperty.value;
729
+ if (isStringLiteral(innerValue)) {
730
+ const resolved = resolveLiteralToOutput(innerValue.value, {
731
+ manifestPath
732
+ });
733
+ rewriteValue(innerValue, resolved, innerValue.value);
734
+ } else if (isStaticTemplate(innerValue)) {
735
+ const raw = source.slice(innerValue.span.start + 1, innerValue.span.end - 1);
736
+ const resolved = resolveLiteralToOutput(raw, {
737
+ manifestPath
738
+ });
739
+ rewriteValue(innerValue, resolved, raw);
740
+ } else {
741
+ const raw = evalStaticString(innerValue);
742
+ if ('string' == typeof raw) {
743
+ const resolved = resolveLiteralToOutput(raw, {
744
+ manifestPath
745
+ });
746
+ const originalExpr = source.slice(innerValue.span.start, innerValue.span.end);
747
+ rewriteValue(innerValue, resolved, originalExpr);
748
+ }
749
+ }
750
+ }
751
+ }
752
+ return true;
753
+ }
754
+ return false;
755
+ }
756
+ function handleDeclarativeContent(node, source, rewriteValue, manifestPath) {
757
+ if ('NewExpression' !== node.type) return false;
758
+ const memberChain = memberChainFromCallee(node.callee);
759
+ const apiRoot = memberChain[0];
760
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
761
+ const method = memberChain.join('.');
762
+ if (method.endsWith('declarativeContent.SetIcon')) {
763
+ var _node_arguments;
764
+ const arg0 = null == (_node_arguments = node.arguments) ? void 0 : _node_arguments[0];
765
+ const optionsArgument = arg0 && arg0.expression || arg0;
766
+ if ((null == optionsArgument ? void 0 : optionsArgument.type) === 'ObjectExpression') for (const propertyNode of optionsArgument.properties || []){
767
+ if ('KeyValueProperty' !== propertyNode.type) continue;
768
+ const keyNode = propertyNode.key;
769
+ const keyName = (null == keyNode ? void 0 : keyNode.type) === 'Identifier' ? keyNode.value : null == keyNode ? void 0 : keyNode.value;
770
+ if ('path' !== keyName) continue;
771
+ const valueNode = propertyNode.value;
772
+ if (isStringLiteral(valueNode)) {
773
+ const resolved = resolveLiteralToOutput(valueNode.value, {
774
+ manifestPath
775
+ });
776
+ rewriteValue(valueNode, resolved, valueNode.value);
777
+ } else if ((null == valueNode ? void 0 : valueNode.type) === 'ObjectExpression') for (const innerProperty of valueNode.properties || []){
778
+ if ('KeyValueProperty' !== innerProperty.type) continue;
779
+ const innerValue = innerProperty.value;
780
+ if (isStringLiteral(innerValue)) {
781
+ const resolved = resolveLiteralToOutput(innerValue.value, {
782
+ manifestPath
783
+ });
784
+ rewriteValue(innerValue, resolved, innerValue.value);
785
+ } else if (isStaticTemplate(innerValue)) {
786
+ const raw = source.slice(innerValue.span.start + 1, innerValue.span.end - 1);
787
+ const resolved = resolveLiteralToOutput(raw, {
788
+ manifestPath
789
+ });
790
+ rewriteValue(innerValue, resolved, raw);
791
+ } else {
792
+ const raw = evalStaticString(innerValue);
793
+ if ('string' == typeof raw) {
794
+ const resolved = resolveLiteralToOutput(raw, {
795
+ manifestPath
796
+ });
797
+ const originalExpr = source.slice(innerValue.span.start, innerValue.span.end);
798
+ rewriteValue(innerValue, resolved, originalExpr);
799
+ }
800
+ }
801
+ }
802
+ else if (isStaticTemplate(valueNode)) {
803
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
804
+ const resolved = resolveLiteralToOutput(raw, {
805
+ manifestPath
806
+ });
807
+ rewriteValue(valueNode, resolved, raw);
808
+ } else {
809
+ const raw = evalStaticString(valueNode);
810
+ if ('string' == typeof raw) {
811
+ const resolved = resolveLiteralToOutput(raw, {
812
+ manifestPath
813
+ });
814
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
815
+ rewriteValue(valueNode, resolved, originalExpr);
816
+ }
817
+ }
818
+ }
819
+ return true;
820
+ }
821
+ return false;
822
+ }
823
+ const ALLOWED_KEYS = new Set([
824
+ 'url',
825
+ 'file',
826
+ 'files',
827
+ 'path',
828
+ 'popup',
829
+ 'panel',
830
+ 'page',
831
+ 'iconUrl',
832
+ 'imageUrl',
833
+ 'default_icon',
834
+ 'default_popup',
835
+ 'default_panel'
836
+ ]);
837
+ function processValue(valueNode, source, rewriteValue, manifestPath) {
838
+ if (!valueNode) return;
839
+ if (isStringLiteral(valueNode)) {
840
+ const out = resolveLiteralToOutput(valueNode.value, {
841
+ manifestPath
842
+ });
843
+ rewriteValue(valueNode, out, valueNode.value);
844
+ return;
845
+ }
846
+ if (isStaticTemplate(valueNode)) {
847
+ const raw = source.slice(valueNode.span.start + 1, valueNode.span.end - 1);
848
+ const out = resolveLiteralToOutput(raw, {
849
+ manifestPath
850
+ });
851
+ rewriteValue(valueNode, out, raw);
852
+ return;
853
+ }
854
+ const raw = evalStaticString(valueNode);
855
+ if ('string' == typeof raw) {
856
+ const out = resolveLiteralToOutput(raw, {
857
+ manifestPath
858
+ });
859
+ const originalExpr = source.slice(valueNode.span.start, valueNode.span.end);
860
+ rewriteValue(valueNode, out, originalExpr);
861
+ return;
862
+ }
863
+ }
864
+ function walkCandidate(containerNode, onCandidateValue) {
865
+ if (!containerNode) return;
866
+ if ('ArrayExpression' === containerNode.type) {
867
+ for (const elementNode of containerNode.elements || [])onCandidateValue(null == elementNode ? void 0 : elementNode.expression);
868
+ return;
869
+ }
870
+ if ('ObjectExpression' === containerNode.type) for (const propertyNode of containerNode.properties || []){
871
+ var _propertyNode_value, _propertyNode_value1;
872
+ if ('KeyValueProperty' !== propertyNode.type) continue;
873
+ const key = getPropName(propertyNode);
874
+ if (key) {
875
+ if (ALLOWED_KEYS.has(key)) onCandidateValue(propertyNode.value);
876
+ if ((null == (_propertyNode_value = propertyNode.value) ? void 0 : _propertyNode_value.type) === 'ArrayExpression' || (null == (_propertyNode_value1 = propertyNode.value) ? void 0 : _propertyNode_value1.type) === 'ObjectExpression') {
877
+ var _propertyNode_value2;
878
+ if (('default_icon' === key || 'path' === key) && (null == (_propertyNode_value2 = propertyNode.value) ? void 0 : _propertyNode_value2.type) === 'ObjectExpression') {
879
+ for (const sizeProp of propertyNode.value.properties || [])if ('KeyValueProperty' === sizeProp.type) onCandidateValue(sizeProp.value);
880
+ } else walkCandidate(propertyNode.value, onCandidateValue);
881
+ }
882
+ }
883
+ }
884
+ }
885
+ function handleGenericApiPaths(node, source, rewriteValue, manifestPath) {
886
+ if ('CallExpression' !== node.type) return false;
887
+ const memberChain = memberChainFromCallee(node.callee);
888
+ const apiRoot = memberChain[0];
889
+ if ('chrome' !== apiRoot && 'browser' !== apiRoot) return false;
890
+ let touched = false;
891
+ for (const argumentNode of node.arguments || []){
892
+ const expressionNode = null == argumentNode ? void 0 : argumentNode.expression;
893
+ if (expressionNode) {
894
+ if ('ObjectExpression' === expressionNode.type || 'ArrayExpression' === expressionNode.type) walkCandidate(expressionNode, (candidateValue)=>{
895
+ const touchedBefore = touched;
896
+ processValue(candidateValue, source, rewriteValue, manifestPath);
897
+ if (!touchedBefore) touched = true;
898
+ });
899
+ }
900
+ }
901
+ return touched;
902
+ }
903
+ function handleCallExpression(node, source, rewriteValue, manifestPath) {
904
+ if (handleRuntimeCalls(node, source, rewriteValue, manifestPath)) return;
905
+ if (handleActionAndPopup(node, source, rewriteValue, manifestPath)) return;
906
+ if (handleDevtools(node, source, rewriteValue, manifestPath)) return;
907
+ if (handleTabsAndWindows(node, source, rewriteValue, manifestPath)) return;
908
+ if (handleScripting(node, source, rewriteValue, manifestPath)) return;
909
+ if (handleMv2Tabs(node, source, rewriteValue, manifestPath)) return;
910
+ if (handlePanels(node, source, rewriteValue, manifestPath)) return;
911
+ if (handleNotifications(node, source, rewriteValue, manifestPath)) return;
912
+ if (handleMenus(node, source, rewriteValue, manifestPath)) return;
913
+ if (handleDeclarativeContent(node, source, rewriteValue, manifestPath)) return;
914
+ try {
915
+ handleGenericApiPaths(node, source, rewriteValue, manifestPath);
916
+ } catch {}
917
+ }
918
+ function isJsxLikePath(filePath) {
919
+ return 'string' == typeof filePath && /\.[cm]?[jt]sx$/.test(String(filePath));
920
+ }
921
+ function stripNestedQuotes(value) {
922
+ const match = /^(['"])(.*)\1$/.exec(value);
923
+ return match ? match[2] : value;
924
+ }
925
+ function normalizeLiteralPayload(value) {
926
+ const withForwardSlashes = value.replace(/\\/g, '/');
927
+ const withCollapsed = withForwardSlashes.replace(/\/{2,}/g, '/');
928
+ return stripNestedQuotes(withCollapsed);
929
+ }
930
+ function isLikelyApiContextAt(source, atIndex) {
931
+ if ('number' != typeof atIndex) return false;
932
+ const start = Math.max(0, atIndex - 200);
933
+ const neighborhood = source.slice(start, atIndex);
934
+ return /(chrome|browser)\s*\.(?:tabs|windows|scripting|action|sidePanel|sidebarAction|devtools|runtime|extension)\b/.test(neighborhood);
935
+ }
936
+ function resolveAndNormalizeLiteral(literal, ctx) {
937
+ const normalizedInput = normalizeLiteralPayload(literal);
938
+ const resolved = resolveLiteralToOutput(normalizedInput, {
939
+ manifestPath: ctx.manifestPath,
940
+ packageJsonDir: ctx.packageJsonDir,
941
+ authorFilePath: ctx.authorFilePath
942
+ });
943
+ return normalizeLiteralPayload(resolved ?? normalizedInput);
944
+ }
945
+ function replaceRuntimeGetURL(source, input, ctx) {
946
+ const rx = /(\.(?:runtime|extension)\.getURL\()\s*(['"])(.*?)\2(\))/g;
947
+ function onMatch(full, pre, q, p, post, offset) {
948
+ try {
949
+ const resolved = resolveLiteralToOutput(normalizeLiteralPayload(p), {
950
+ manifestPath: ctx.manifestPath,
951
+ packageJsonDir: ctx.packageJsonDir,
952
+ authorFilePath: ctx.authorFilePath
953
+ });
954
+ const computed = normalizeLiteralPayload(resolved ?? p);
955
+ try {
956
+ var _ctx_onResolvedLiteral;
957
+ null == (_ctx_onResolvedLiteral = ctx.onResolvedLiteral) || _ctx_onResolvedLiteral.call(ctx, p, resolved ?? void 0, offset);
958
+ } catch {}
959
+ return `${pre}${q}${computed}${q}${post}`;
960
+ } catch {
961
+ return full;
962
+ }
963
+ }
964
+ return input.replace(rx, onMatch);
965
+ }
966
+ function replaceObjectKeyLiterals(source, input, keys, ctx) {
967
+ for (const key of keys){
968
+ const rx = new RegExp(`(${key}\\s*:\\s*)(['"])(.*?)\\2`, 'g');
969
+ function onMatch(full, pre, q, p, offset) {
970
+ try {
971
+ const resolved = resolveLiteralToOutput(normalizeLiteralPayload(p), {
972
+ manifestPath: ctx.manifestPath,
973
+ packageJsonDir: ctx.packageJsonDir,
974
+ authorFilePath: ctx.authorFilePath
975
+ });
976
+ const computed = normalizeLiteralPayload(resolved ?? p);
977
+ try {
978
+ if (isLikelyApiContextAt(source, offset)) {
979
+ var _ctx_onResolvedLiteral;
980
+ null == (_ctx_onResolvedLiteral = ctx.onResolvedLiteral) || _ctx_onResolvedLiteral.call(ctx, p, resolved ?? void 0, offset);
981
+ }
982
+ } catch {}
983
+ return `${pre}${q}${computed}${q}`;
984
+ } catch {
985
+ return full;
986
+ }
987
+ }
988
+ input = input.replace(rx, onMatch);
989
+ }
990
+ return input;
991
+ }
992
+ function replaceStaticTemplateForKeys(source, input, keys, ctx) {
993
+ const rx = new RegExp(`((?:${keys.join('|')})\\s*:\\s*)\`([^\\\`$]*)\``, 'g');
994
+ function onMatch(full, pre, inner, offset) {
995
+ try {
996
+ const resolved = resolveLiteralToOutput(normalizeLiteralPayload(inner), {
997
+ manifestPath: ctx.manifestPath,
998
+ packageJsonDir: ctx.packageJsonDir,
999
+ authorFilePath: ctx.authorFilePath
1000
+ });
1001
+ const computed = normalizeLiteralPayload(resolved ?? inner);
1002
+ try {
1003
+ if (isLikelyApiContextAt(source, offset)) {
1004
+ var _ctx_onResolvedLiteral;
1005
+ null == (_ctx_onResolvedLiteral = ctx.onResolvedLiteral) || _ctx_onResolvedLiteral.call(ctx, inner, resolved ?? void 0, offset);
1006
+ }
1007
+ } catch {}
1008
+ return `${pre}'${computed}'`;
1009
+ } catch {
1010
+ return full;
1011
+ }
1012
+ }
1013
+ return input.replace(rx, onMatch);
1014
+ }
1015
+ function replaceConcatForKeys(source, input, keys, ctx) {
1016
+ const rx = new RegExp(`((?:${keys.join('|')})\\s*:\\s*)((?:['"][^'"]*['"]\\s*\\+\\s*)+['"][^'"]*['"])`, 'g');
1017
+ function onMatch(full, pre, expr, offset) {
1018
+ try {
1019
+ const partRe = /(['"])([^'"]*?)\1/g;
1020
+ let m;
1021
+ let concatenated = '';
1022
+ while(m = partRe.exec(expr))concatenated += m[2];
1023
+ const resolved = resolveLiteralToOutput(normalizeLiteralPayload(concatenated), {
1024
+ manifestPath: ctx.manifestPath,
1025
+ packageJsonDir: ctx.packageJsonDir,
1026
+ authorFilePath: ctx.authorFilePath
1027
+ });
1028
+ const computed = normalizeLiteralPayload(resolved ?? concatenated);
1029
+ try {
1030
+ if (isLikelyApiContextAt(source, offset)) {
1031
+ var _ctx_onResolvedLiteral;
1032
+ null == (_ctx_onResolvedLiteral = ctx.onResolvedLiteral) || _ctx_onResolvedLiteral.call(ctx, concatenated, resolved ?? void 0, offset);
1033
+ }
1034
+ } catch {}
1035
+ return `${pre}'${computed}'`;
1036
+ } catch {
1037
+ return full;
1038
+ }
1039
+ }
1040
+ return input.replace(rx, onMatch);
1041
+ }
1042
+ function replaceFilesArray(source, input, ctx) {
1043
+ const rx = /(files\s*:\s*\[)([^\]]*)(\])/g;
1044
+ function onMatch(full, pre, inner, post, offset) {
1045
+ try {
1046
+ const replacedInner = inner.replace(/(['"])(.*?)(\1)/g, function(_m, q, p) {
1047
+ try {
1048
+ const computed = resolveAndNormalizeLiteral(p, ctx);
1049
+ return `${q}${computed ?? p}${q}`;
1050
+ } catch {
1051
+ return `${q}${p}${q}`;
1052
+ }
1053
+ });
1054
+ try {
1055
+ if (isLikelyApiContextAt(source, offset)) {
1056
+ const re = /(['"])(.*?)(\1)/g;
1057
+ let match;
1058
+ while(match = re.exec(inner)){
1059
+ var _ctx_onResolvedLiteral;
1060
+ const raw = match[2];
1061
+ const resolved = resolveLiteralToOutput(normalizeLiteralPayload(raw), {
1062
+ manifestPath: ctx.manifestPath,
1063
+ packageJsonDir: ctx.packageJsonDir,
1064
+ authorFilePath: ctx.authorFilePath
1065
+ });
1066
+ null == (_ctx_onResolvedLiteral = ctx.onResolvedLiteral) || _ctx_onResolvedLiteral.call(ctx, raw, resolved ?? void 0, offset + match.index);
1067
+ }
1068
+ }
1069
+ } catch {}
1070
+ return `${pre}${replacedInner}${post}`;
1071
+ } catch {
1072
+ return full;
1073
+ }
1074
+ }
1075
+ return input.replace(rx, onMatch);
1076
+ }
1077
+ function replaceJsCssArrays(source, input, ctx) {
1078
+ for (const key of [
1079
+ 'js',
1080
+ 'css'
1081
+ ]){
1082
+ const rxArr = new RegExp(`(${key}\\s*:\\s*\\[)([^\\]]*)(\\])`, 'g');
1083
+ function onMatch(full, pre, inner, post, offset) {
1084
+ try {
1085
+ const replacedInner = String(inner).replace(/(['"])(.*?)(\1)/g, function(_m, q, p) {
1086
+ try {
1087
+ const computed = resolveAndNormalizeLiteral(p, ctx);
1088
+ return `${q}${computed ?? p}${q}`;
1089
+ } catch {
1090
+ return `${q}${p}${q}`;
1091
+ }
1092
+ });
1093
+ try {
1094
+ if (isLikelyApiContextAt(source, offset)) {
1095
+ const re = /(['"])(.*?)(\1)/g;
1096
+ let match;
1097
+ while(match = re.exec(inner)){
1098
+ var _ctx_onResolvedLiteral;
1099
+ const raw = match[2];
1100
+ const resolved = resolveLiteralToOutput(normalizeLiteralPayload(raw), {
1101
+ manifestPath: ctx.manifestPath,
1102
+ packageJsonDir: ctx.packageJsonDir,
1103
+ authorFilePath: ctx.authorFilePath
1104
+ });
1105
+ null == (_ctx_onResolvedLiteral = ctx.onResolvedLiteral) || _ctx_onResolvedLiteral.call(ctx, raw, resolved ?? void 0, offset + match.index);
1106
+ }
1107
+ }
1108
+ } catch {}
1109
+ return `${pre}${replacedInner}${post}`;
1110
+ } catch {
1111
+ return full;
1112
+ }
1113
+ }
1114
+ input = input.replace(rxArr, onMatch);
1115
+ }
1116
+ return input;
1117
+ }
1118
+ function cleanupPublicRootLiterals(input) {
1119
+ input = input.replace(/(['"])\/public\/([^'"]+?)\1/g, function(_m, q, p) {
1120
+ return `${q}${normalizeLiteralPayload(p)}${q}`;
1121
+ });
1122
+ input = input.replace(/(['"])public\/(.*?)\1/g, function(_m, q, p) {
1123
+ return `${q}${normalizeLiteralPayload(p)}${q}`;
1124
+ });
1125
+ return input;
1126
+ }
1127
+ function normalizeSpecialFolderExtensions(input) {
1128
+ input = input.replace(/(['"])((?:pages|scripts)\/[^'"]+?)\.(ts|tsx)\1/g, function(_m, q, p) {
1129
+ return `${q}${p}.js${q}`;
1130
+ });
1131
+ input = input.replace(/(['"])((?:pages|scripts)\/[^'"]+?)\.(njk|nunjucks)\1/g, function(_m, q, p) {
1132
+ return `${q}${p}.html${q}`;
1133
+ });
1134
+ input = input.replace(/(['"])((?:pages|scripts)\/[^'"]+?)\.(scss|sass|less)\1/g, function(_m, q, p) {
1135
+ return `${q}${p}.css${q}`;
1136
+ });
1137
+ return input;
1138
+ }
1139
+ function collapseAccidentalDoubleQuotes(input, keys) {
1140
+ const keyUnion = `(?:${keys.join('|')})`;
1141
+ input = input.replace(new RegExp(`(${keyUnion}\\s*:\\s*)''`, 'g'), "$1'");
1142
+ input = input.replace(new RegExp(`(${keyUnion}\\s*:\\s*)""`, 'g'), '$1"');
1143
+ input = input.replace(/:\s*''/g, ": '");
1144
+ input = input.replace(/:\s*""/g, ': "');
1145
+ input = input.replace(/:\s*''([^']+)'/g, ": '$1'");
1146
+ input = input.replace(/:\s*\"\"([^\"]+)\"/g, ': "$1"');
1147
+ input = input.replace(/''([^']*?)''/g, "'$1'");
1148
+ input = input.replace(/""([^"]*?)""/g, '"$1"');
1149
+ return input;
1150
+ }
1151
+ function textFallbackTransform(source, opts) {
1152
+ let output = String(source);
1153
+ const ctx = {
1154
+ manifestPath: opts.manifestPath,
1155
+ packageJsonDir: opts.packageJsonDir,
1156
+ authorFilePath: opts.authorFilePath,
1157
+ onResolvedLiteral: opts.onResolvedLiteral
1158
+ };
1159
+ output = replaceRuntimeGetURL(source, output, ctx);
1160
+ const supportedKeys = [
1161
+ 'url',
1162
+ 'file',
1163
+ 'path',
1164
+ 'iconUrl',
1165
+ 'imageUrl',
1166
+ 'default_icon'
1167
+ ];
1168
+ output = replaceObjectKeyLiterals(source, output, supportedKeys, ctx);
1169
+ output = replaceStaticTemplateForKeys(source, output, supportedKeys, ctx);
1170
+ output = replaceConcatForKeys(source, output, supportedKeys, ctx);
1171
+ output = replaceFilesArray(source, output, ctx);
1172
+ output = replaceJsCssArrays(source, output, ctx);
1173
+ if (!isJsxLikePath(opts.authorFilePath)) output = cleanupPublicRootLiterals(output);
1174
+ output = normalizeSpecialFolderExtensions(output);
1175
+ output = collapseAccidentalDoubleQuotes(output, supportedKeys);
1176
+ return output;
1177
+ }
1178
+ const external_module_namespaceObject = require("module");
1179
+ let swcRuntimeModule;
1180
+ async function loadSwc() {
1181
+ if (swcRuntimeModule) return swcRuntimeModule;
1182
+ try {
1183
+ const mod = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@swc/core?7929"));
1184
+ swcRuntimeModule = (null == mod ? void 0 : mod.default) && mod.default.parse ? mod.default : mod;
1185
+ } catch {
1186
+ try {
1187
+ const mod = __webpack_require__("@swc/core?782a") || (0, external_module_namespaceObject.createRequire)('undefined' != typeof __filename ? __filename : __rslib_import_meta_url__)('@swc/core');
1188
+ swcRuntimeModule = (null == mod ? void 0 : mod.default) && mod.default.parse ? mod.default : mod;
1189
+ } catch {}
1190
+ }
1191
+ return swcRuntimeModule || null;
1192
+ }
1193
+ async function parseWithSwc(swc, source, flags) {
1194
+ return swc.parse(source, {
1195
+ syntax: flags.isTS ? "typescript" : "ecmascript",
1196
+ tsx: flags.isTS && flags.isJSX,
1197
+ jsx: !flags.isTS && flags.isJSX,
1198
+ target: 'es2022',
1199
+ isModule: true
1200
+ });
1201
+ }
1202
+ async function resolvePathsLoader(source) {
1203
+ var _this_getOptions, _this;
1204
+ const callback = this.async();
1205
+ const options = (null == (_this_getOptions = (_this = this).getOptions) ? void 0 : _this_getOptions.call(_this)) || {};
1206
+ const manifestPath = options.manifestPath;
1207
+ const packageJsonDir = options.packageJsonDir;
1208
+ const outputPath = String(options.outputPath || '');
1209
+ const sourceMapsOpt = 'boolean' == typeof options.sourceMaps || 'auto' === options.sourceMaps ? options.sourceMaps : 'auto';
1210
+ this.cacheable && this.cacheable();
1211
+ const emittedBodies = new Set();
1212
+ const emitStandardWarning = (headerFilePath, bodyLines)=>{
1213
+ var _this_emitWarning, _this;
1214
+ const bodyMessage = bodyLines.join('\n');
1215
+ if (emittedBodies.has(bodyMessage)) return;
1216
+ emittedBodies.add(bodyMessage);
1217
+ const warning = new Error(bodyMessage);
1218
+ warning.file = headerFilePath;
1219
+ null == (_this_emitWarning = (_this = this).emitWarning) || _this_emitWarning.call(_this, warning);
1220
+ };
1221
+ const warnIfMissingPublic = (original, computed)=>{
1222
+ try {
1223
+ const canonical = unixify(original || '');
1224
+ const authorUsedRoot = /^\//.test(canonical);
1225
+ if (computed) {
1226
+ if (/^(?:pages|scripts)\//i.test(computed)) return;
1227
+ const root = packageJsonDir || external_path_namespaceObject.dirname(manifestPath);
1228
+ const sourcePublicAbs = external_path_namespaceObject.join(root, 'public', computed);
1229
+ if (!external_fs_namespaceObject.existsSync(sourcePublicAbs)) {
1230
+ const displayPath = authorUsedRoot && outputPath ? external_path_namespaceObject.join(outputPath, computed) : sourcePublicAbs;
1231
+ const lines = [
1232
+ 'Check the path used in your extension API call.',
1233
+ 'The path must point to an existing file that will be packaged with the extension.',
1234
+ `Found value: ${original ?? ''}`,
1235
+ `Resolved path: ${authorUsedRoot && outputPath ? external_path_namespaceObject.join(outputPath, computed) : sourcePublicAbs}`
1236
+ ];
1237
+ if (authorUsedRoot) lines.push("Paths starting with '/' are resolved from the extension output root (served from public/), not your source directory.");
1238
+ lines.push('', `NOT FOUND ${displayPath}`);
1239
+ emitStandardWarning(String(this.resourcePath), lines);
1240
+ }
1241
+ } else if (original) {
1242
+ const looksNested = /(^|\/)src\/pages\//i.test(canonical) || /(^|\/)src\/scripts\//i.test(canonical);
1243
+ if (looksNested) {
1244
+ const root = packageJsonDir || external_path_namespaceObject.dirname(manifestPath);
1245
+ const abs = external_path_namespaceObject.join(root, canonical);
1246
+ const lines = [
1247
+ 'Check the path used in your extension API call.',
1248
+ 'The path must point to an existing file that will be packaged with the extension.',
1249
+ `Found value: ${original}`
1250
+ ];
1251
+ lines.push('', `NOT FOUND ${abs}`);
1252
+ emitStandardWarning(String(this.resourcePath), lines);
1253
+ }
1254
+ }
1255
+ } catch {}
1256
+ };
1257
+ try {
1258
+ const resourcePathUnix = unixify(String(this.resourcePath || ''));
1259
+ if (resourcePathUnix.split('/').includes('public')) return callback(null, source);
1260
+ } catch {}
1261
+ try {
1262
+ const sourceString = String(source);
1263
+ const containsEligiblePatterns = /(?:^|[^A-Za-z0-9_$])(chrome|browser)\s*\./.test(sourceString) || /(?:^|[^A-Za-z0-9_$])(?:runtime|extension)\s*\.?\s*getURL\s*\(/.test(sourceString) || /(?:^|[^A-Za-z0-9_$])\/public\//.test(sourceString) || /(?:^|[^A-Za-z0-9_$])public\//.test(sourceString) || /(?:^|[^A-Za-z0-9_$])\/pages\//.test(sourceString) || /(?:^|[^A-Za-z0-9_$])pages\//.test(sourceString) || /(?:^|[^A-Za-z0-9_$])\/scripts\//.test(sourceString) || /(?:^|[^A-Za-z0-9_$])scripts\//.test(sourceString);
1264
+ if (!containsEligiblePatterns) return callback(null, source);
1265
+ } catch {}
1266
+ let postTextSource;
1267
+ try {
1268
+ const out = textFallbackTransform(String(source), {
1269
+ manifestPath,
1270
+ packageJsonDir,
1271
+ authorFilePath: String(this.resourcePath || ''),
1272
+ onResolvedLiteral: (original, computed)=>warnIfMissingPublic(original, computed)
1273
+ });
1274
+ postTextSource = out;
1275
+ const hasStaticTemplates = /`[^$`]*`/.test(out);
1276
+ const hasBinaryConcats = /(['"`][^'"`]*['"`]\s*\+\s*['"`][^'"`]*['"`])/.test(out);
1277
+ const hasApiRoots = /(?:^|[^A-Za-z0-9_$])(chrome|browser)\s*\./.test(out);
1278
+ const needsStaticEval = (hasStaticTemplates || hasBinaryConcats) && hasApiRoots;
1279
+ const enableMaps = 'auto' === sourceMapsOpt ? Boolean(this.sourceMap) : Boolean(sourceMapsOpt);
1280
+ if (!needsStaticEval) {
1281
+ if (out !== String(source) || enableMaps && /\.[cm]?tsx?$/.test(String(this.resourcePath || ''))) {
1282
+ const msAll = new (external_magic_string_default())(String(source));
1283
+ msAll.overwrite(0, String(source).length, out);
1284
+ const map = enableMaps ? msAll.generateMap({
1285
+ hires: true,
1286
+ source: String(this.resourcePath),
1287
+ includeContent: true
1288
+ }) : void 0;
1289
+ return callback(null, out, map);
1290
+ }
1291
+ }
1292
+ } catch {}
1293
+ const swc = await loadSwc();
1294
+ if (!swc) return callback(null, source);
1295
+ let programAst;
1296
+ try {
1297
+ const isTS = /\.[cm]?tsx?$/.test(this.resourcePath);
1298
+ const isJSX = /\.[cm]?[jt]sx$/.test(this.resourcePath);
1299
+ const parseSource = 'string' == typeof postTextSource ? postTextSource : source;
1300
+ programAst = await parseWithSwc(swc, parseSource, {
1301
+ isTS,
1302
+ isJSX
1303
+ });
1304
+ } catch {
1305
+ return callback(null, source);
1306
+ }
1307
+ const inputSource = 'string' == typeof postTextSource ? postTextSource : String(source);
1308
+ const ms = new (external_magic_string_default())(inputSource);
1309
+ let edited = false;
1310
+ const rewriteValue = (node, computed, rawInput)=>{
1311
+ if (!computed && 'string' == typeof rawInput) try {
1312
+ const recomputed = resolveLiteralToOutput(rawInput, {
1313
+ manifestPath,
1314
+ packageJsonDir,
1315
+ authorFilePath: String(this.resourcePath || '')
1316
+ });
1317
+ if (recomputed) computed = recomputed;
1318
+ } catch {}
1319
+ if (!computed) return;
1320
+ try {
1321
+ const span = null == node ? void 0 : node.span;
1322
+ if (span && 'number' == typeof span.start && 'number' == typeof span.end) {
1323
+ const src = String(inputSource);
1324
+ const before = src[span.start - 1];
1325
+ const after = src[span.end];
1326
+ const isQuote = (c)=>"'" === c || '"' === c;
1327
+ if (isQuote(before) && before === after) {
1328
+ let start = span.start - 1;
1329
+ let end = span.end + 1;
1330
+ const q = before;
1331
+ const escaped = "'" === q ? String(computed).replace(/'/g, "\\'") : String(computed).replace(/"/g, '\\"');
1332
+ ms.overwrite(start, end, `${q}${escaped}${q}`);
1333
+ } else ms.overwrite(span.start, span.end, JSON.stringify(computed));
1334
+ edited = true;
1335
+ }
1336
+ } catch {}
1337
+ };
1338
+ const walk = (currentNode)=>{
1339
+ if (!currentNode || 'object' != typeof currentNode) return;
1340
+ if ('CallExpression' === currentNode.type) try {
1341
+ handleCallExpression(currentNode, String(inputSource), rewriteValue, manifestPath);
1342
+ } catch {}
1343
+ for(const key in currentNode){
1344
+ if (!Object.prototype.hasOwnProperty.call(currentNode, key)) continue;
1345
+ const childNode = currentNode[key];
1346
+ if (childNode) {
1347
+ if (Array.isArray(childNode)) childNode.forEach(walk);
1348
+ else if (childNode && 'string' == typeof childNode.type) walk(childNode);
1349
+ }
1350
+ }
1351
+ };
1352
+ walk(programAst);
1353
+ try {
1354
+ if (!edited) {
1355
+ if ('string' == typeof postTextSource && postTextSource !== String(source)) {
1356
+ const enableMaps = 'auto' === sourceMapsOpt ? Boolean(this.sourceMap) : Boolean(sourceMapsOpt);
1357
+ const msAll = new (external_magic_string_default())(String(source));
1358
+ msAll.overwrite(0, String(source).length, postTextSource);
1359
+ const map = enableMaps ? msAll.generateMap({
1360
+ hires: true,
1361
+ source: String(this.resourcePath),
1362
+ includeContent: true
1363
+ }) : void 0;
1364
+ return callback(null, postTextSource, map);
1365
+ }
1366
+ return callback(null, source);
1367
+ }
1368
+ const enableMaps = 'auto' === sourceMapsOpt ? Boolean(this.sourceMap) : Boolean(sourceMapsOpt);
1369
+ const code = ms.toString();
1370
+ const map = enableMaps ? ms.generateMap({
1371
+ hires: true,
1372
+ source: String(this.resourcePath),
1373
+ includeContent: true
1374
+ }) : void 0;
1375
+ return callback(null, code, map);
1376
+ } catch {
1377
+ return callback(null, source);
1378
+ }
1379
+ }
1380
+ })();
1381
+ exports["default"] = __webpack_exports__["default"];
1382
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
1383
+ "default"
1384
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
1385
+ Object.defineProperty(exports, '__esModule', {
1386
+ value: true
1387
+ });