extension-develop 4.1.35 → 4.1.36

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 (32) hide show
  1. package/dist/363~0.mjs +17 -0
  2. package/dist/469~0.mjs +20 -5
  3. package/dist/832~0.mjs +2770 -2761
  4. package/dist/840~0.mjs +2488 -2144
  5. package/dist/852~0.mjs +1 -0
  6. package/dist/contract/codes.json +6 -2
  7. package/dist/extension-js-devtools/build-stamp.json +2 -2
  8. package/dist/extension-js-devtools/chrome/background/service_worker.js +2 -2
  9. package/dist/extension-js-devtools/chrome/pages/welcome.js +2 -2
  10. package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
  11. package/dist/extension-js-devtools/chromium/pages/welcome.js +2 -2
  12. package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
  13. package/dist/extension-js-devtools/edge/pages/welcome.js +2 -2
  14. package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
  15. package/dist/extension-js-devtools/firefox/pages/welcome.js +2 -2
  16. package/dist/extension-js-theme/build-stamp.json +2 -2
  17. package/dist/lib/addon-lint.d.ts +7 -3
  18. package/dist/lib/addon-reviewer-note.d.ts +32 -0
  19. package/dist/lib/build-summary.d.ts +6 -1
  20. package/dist/lib/build-toolchain.d.ts +8 -0
  21. package/dist/lib/chunk-dependency-provenance.d.ts +8 -0
  22. package/dist/lib/development-artifacts.d.ts +2 -0
  23. package/dist/lib/loopback-origins.d.ts +6 -0
  24. package/dist/lib/messages.d.ts +12 -1
  25. package/dist/lib/messaging.d.ts +1 -0
  26. package/dist/lib/stable-loader-paths.d.ts +14 -0
  27. package/dist/plugin-web-extension/feature-manifest/manifest-lib/edge-options-notice.d.ts +4 -0
  28. package/dist/plugin-web-extension/feature-manifest/messages.d.ts +1 -0
  29. package/dist/plugin-web-extension/feature-scripts/steps/add-base-uri-runtime-module.d.ts +5 -0
  30. package/dist/plugin-web-extension/feature-scripts/steps/stamp-webkit-utf8-bom.d.ts +9 -0
  31. package/dist/rspack-config~0.mjs +211 -20
  32. package/package.json +1 -1
@@ -13,6 +13,7 @@ import node_fs from "node:fs";
13
13
  import node_path from "node:path";
14
14
  import { filterKeysForThisBrowser, findPrefixedManifestVersionKeys, findDroppedVendorKeys, isStaticThemeSource, isValidManifestVersion, isStaticTheme } from "./143~0.mjs";
15
15
  import { isChromiumBasedBrowser, isEmulatorBrowser, isWebkitBasedBrowser, stripBom, parseJsonSafe, isGeckoBasedBrowser } from "./937~0.mjs";
16
+ import { maybeUsePreact, maybeUseReact, jsFrameworksIntegrationsEnabled, RAW_RESOURCE_QUERY, ensureTypeScriptConfig, resolveDevelopInstallRoot, loadLoaderOptions, getUserTypeScriptConfigFile, resolveTranspilePackageDirs, contentScriptEntryForAsset, jsFrameworksHmrSummary, isDevContentScriptStandInAsset, hasDependency, isUsingJsxFramework, defaultSplitChunks, buildDevContentScriptMarkerPrelude, resolveReactRefreshEntry, isUsingTypeScript, classifyEntrySurface, planDevContentScripts, isUsingVue, backgroundIsRequiredMessageOnly, getUserJsConfigFile, mergeLoaderOptions, recordZipFailure, svelteCompilerRuntimeMismatch, isUsingIntegration as messages_isUsingIntegration, maybeUseVue, maybeUseSolid, DEV_CONTENT_SCRIPTS_RUNTIME_SOURCE, ensureOptionalContractPackageResolved, jsFrameworksConfigsDetected, NOT_RAW_RESOURCE_QUERY, createNodeModulesExclude, recordZipArtifact, resolveDevelopDistFile, swcParserForFile, getJsxImportSource, isUsingReact, DEV_CONTENT_SCRIPT_REGISTRY_ASSET } from "./840~0.mjs";
16
17
  import { debugLine, isDebug, CODES, humanLine, prefix as messaging_prefix } from "./852~0.mjs";
17
18
  import { getCanonicalContentScriptEntryName, parseCanonicalContentScriptAsset, CONTENT_SCRIPT_CSS_PROBE_MARKER_PREFIX, createContentScriptCssProbeMarkerPattern, getCanonicalContentScriptJsAssetName, isCanonicalContentScriptAsset, EXTENSIONJS_CONTENT_SCRIPT_LAYER } from "./640~0.mjs";
18
19
  import { manifestGoneDuringSession, publicFolderOffRef, bundlerFatalError, bundlerRecompiling, browserRunnerDisabled, buildBridgeProducerSource, CONTROL_PORT_ASSET_NAME, publicFolderShadowed, specialFoldersSetupSummary, resolveCompanionExtensionDirs, spacerLine, noEntrypointsDetected, specialFolderChangeDetected, recordCodedWarning, messages_ready, serverRestartRequiredFromSpecialFolderMessageOnly, PlaywrightPlugin, publicFolderAppeared, publicMustBeAtProjectRoot, InjectBridgeRelay, prependToEmittedAsset, getSpecialFoldersDataForCompiler, publicFileCollidesWithEntry, computeExtensionsToLoad } from "./832~0.mjs";
@@ -21,7 +22,6 @@ import { sidebarKeyTranslatedForBrowser, missingGeckoDataCollectionPermissions a
21
22
  import { projectConfigCandidatePaths } from "./846~0.mjs";
22
23
  import { REMOTE_SOURCE_PROVENANCE_FILE } from "./zip~0.mjs";
23
24
  import { debugExtensionsToLoad, treeWithSourceFiles, getDirs, codedError, zipSkippedSymlinks, asAbsolute, treeWithDistFilesBrowser, packagingDistributionFiles, displayPath as paths_displayPath, toPosixPath as paths_toPosixPath, debugContextPath, packagingSourceFiles, debugBrowser, debugOutputPath, manifestInvalidJson, treeWithSourceAndDistFiles, noCompanionExtensionsResolved } from "./469~0.mjs";
24
- import { maybeUsePreact, maybeUseReact, jsFrameworksIntegrationsEnabled, RAW_RESOURCE_QUERY, ensureTypeScriptConfig, resolveDevelopInstallRoot, loadLoaderOptions, getUserTypeScriptConfigFile, resolveTranspilePackageDirs, contentScriptEntryForAsset, jsFrameworksHmrSummary, isDevContentScriptStandInAsset, hasDependency, isUsingJsxFramework, defaultSplitChunks, buildDevContentScriptMarkerPrelude, resolveReactRefreshEntry, isUsingTypeScript, classifyEntrySurface, planDevContentScripts, isUsingVue, backgroundIsRequiredMessageOnly, getUserJsConfigFile, mergeLoaderOptions, recordZipFailure, svelteCompilerRuntimeMismatch, isUsingIntegration as messages_isUsingIntegration, maybeUseVue, maybeUseSolid, DEV_CONTENT_SCRIPTS_RUNTIME_SOURCE, ensureOptionalContractPackageResolved, jsFrameworksConfigsDetected, NOT_RAW_RESOURCE_QUERY, createNodeModulesExclude, recordZipArtifact, resolveDevelopDistFile, swcParserForFile, getJsxImportSource, isUsingReact, DEV_CONTENT_SCRIPT_REGISTRY_ASSET } from "./840~0.mjs";
25
25
  import { cssMinifierDroppedRules, postCssConfigUnreadable, missingSassDependency, deadCssUrlRef, postCssPluginNotResolved, postCssConfigPluginsShape, cssIntegrationsEnabled, cssConfigsDetected, isUsingIntegration } from "./524~0.mjs";
26
26
  import { PROJECT_MANIFEST_FILENAMES, findNearestProjectManifestSync, readProjectDependencies } from "./731~0.mjs";
27
27
  import { publicRootsFor, rememberPublicRoots, publicRelativePath as resolve_public_folder_publicRelativePath, turnedOffPublicFolders, inspectPublicFolders, findPublicFile, publicContainmentRoot, publicResolveRoots } from "./105~0.mjs";
@@ -73,6 +73,93 @@ function cssMinimizerOptions(rawManifest, browser) {
73
73
  }
74
74
  };
75
75
  }
76
+ const NODE_MODULES_SEGMENT = '/node_modules/';
77
+ function toPosix(value) {
78
+ return value.split(__rspack_external_node_path_806ed179.sep).join('/');
79
+ }
80
+ function isInside(dir, file) {
81
+ const relative = __rspack_external_node_path_806ed179.relative(dir, file);
82
+ return '' !== relative && !relative.startsWith('..') && !__rspack_external_node_path_806ed179.isAbsolute(relative);
83
+ }
84
+ function sameFile(a, b) {
85
+ try {
86
+ return __rspack_external_node_fs_1b05aee1.realpathSync.native(a) === __rspack_external_node_fs_1b05aee1.realpathSync.native(b);
87
+ } catch {
88
+ return false;
89
+ }
90
+ }
91
+ function locateLoaderPackage(loaderPath, developRoot) {
92
+ const posix = toPosix(loaderPath);
93
+ const marker = posix.lastIndexOf(NODE_MODULES_SEGMENT);
94
+ if (-1 !== marker) {
95
+ const segments = posix.slice(marker + NODE_MODULES_SEGMENT.length).split('/');
96
+ const scoped = segments[0]?.startsWith('@');
97
+ const name = scoped ? segments.slice(0, 2).join('/') : segments[0];
98
+ const inside = segments.slice(scoped ? 2 : 1).join('/');
99
+ if (name && inside) return {
100
+ name,
101
+ inside
102
+ };
103
+ }
104
+ if (developRoot && isInside(developRoot, loaderPath)) return {
105
+ name: 'extension-develop',
106
+ inside: toPosix(__rspack_external_node_path_806ed179.relative(developRoot, loaderPath))
107
+ };
108
+ }
109
+ function projectLocalLoaderPath(loaderPath, projectRoot, developRoot = resolveDevelopInstallRoot()) {
110
+ if (!__rspack_external_node_path_806ed179.isAbsolute(loaderPath)) return loaderPath;
111
+ const located = locateLoaderPackage(loaderPath, developRoot);
112
+ if (!located) return loaderPath;
113
+ const candidates = [
114
+ __rspack_external_node_path_806ed179.join(projectRoot, 'node_modules', located.name, located.inside),
115
+ __rspack_external_node_path_806ed179.join(projectRoot, 'node_modules', '.pnpm', 'node_modules', located.name, located.inside)
116
+ ];
117
+ for (const candidate of candidates){
118
+ if (candidate === loaderPath) break;
119
+ if (sameFile(candidate, loaderPath)) return candidate;
120
+ }
121
+ return loaderPath;
122
+ }
123
+ function rewriteUse(use, rewrite) {
124
+ if ('string' == typeof use) return rewrite(use);
125
+ if (Array.isArray(use)) return use.map((entry)=>rewriteUse(entry, rewrite));
126
+ if (use && 'object' == typeof use) {
127
+ const entry = use;
128
+ if ('string' == typeof entry.loader) entry.loader = rewrite(entry.loader);
129
+ }
130
+ return use;
131
+ }
132
+ function rewriteRuleLoaderPaths(rules, rewrite) {
133
+ if (!Array.isArray(rules)) return;
134
+ for (const rule of rules)if (rule && 'object' == typeof rule) {
135
+ if ('string' == typeof rule.loader) rule.loader = rewrite(rule.loader);
136
+ if (void 0 !== rule.use && 'function' != typeof rule.use) rule.use = rewriteUse(rule.use, rewrite);
137
+ rewriteRuleLoaderPaths(rule.oneOf, rewrite);
138
+ rewriteRuleLoaderPaths(rule.rules, rewrite);
139
+ }
140
+ }
141
+ class StableLoaderPathsPlugin {
142
+ static name = 'plugin-stable-loader-paths';
143
+ apply(compiler) {
144
+ const run = ()=>{
145
+ const projectRoot = compiler.options.context;
146
+ if ('string' != typeof projectRoot || !projectRoot) return;
147
+ const developRoot = resolveDevelopInstallRoot();
148
+ const seen = new Map();
149
+ const rewrite = (loaderPath)=>{
150
+ let local = seen.get(loaderPath);
151
+ if (void 0 === local) {
152
+ local = projectLocalLoaderPath(loaderPath, projectRoot, developRoot);
153
+ seen.set(loaderPath, local);
154
+ }
155
+ return local;
156
+ };
157
+ rewriteRuleLoaderPaths(compiler.options.module?.rules, rewrite);
158
+ };
159
+ compiler.hooks.beforeRun.tap(StableLoaderPathsPlugin.name, run);
160
+ compiler.hooks.watchRun.tap(StableLoaderPathsPlugin.name, run);
161
+ }
162
+ }
76
163
  function getLoggingPrefix(type) {
77
164
  return messaging_prefix(type);
78
165
  }
@@ -1020,7 +1107,7 @@ function resolveManifestName(rawName, manifest, searchRoots, fallback) {
1020
1107
  } catch {}
1021
1108
  return fallback;
1022
1109
  }
1023
- const toPosix = (p)=>p.replace(/\\/g, '/');
1110
+ const zip_toPosix = (p)=>p.replace(/\\/g, '/');
1024
1111
  function zipEntryFor(absPath) {
1025
1112
  const stat = __rspack_external_node_fs_1b05aee1.statSync(absPath);
1026
1113
  return [
@@ -1034,7 +1121,7 @@ function zipEntryFor(absPath) {
1034
1121
  }
1035
1122
  function writeZipFile(zipPath, entries) {
1036
1123
  const zippable = {};
1037
- for (const entry of entries)zippable[toPosix(entry.name)] = zipEntryFor(entry.absPath);
1124
+ for (const entry of entries)zippable[zip_toPosix(entry.name)] = zipEntryFor(entry.absPath);
1038
1125
  __rspack_external_node_fs_1b05aee1.writeFileSync(zipPath, zipSync(zippable));
1039
1126
  }
1040
1127
  function listFilesUnder(root, skipNames) {
@@ -1056,14 +1143,14 @@ function listFilesUnder(root, skipNames) {
1056
1143
  for (const entry of entries){
1057
1144
  const rel = relDir ? __rspack_external_node_path_806ed179.join(relDir, entry.name) : entry.name;
1058
1145
  if (entry.isDirectory()) stack.push(rel);
1059
- else if (entry.isFile() && !skipNames.has(toPosix(rel))) out.push(rel);
1146
+ else if (entry.isFile() && !skipNames.has(zip_toPosix(rel))) out.push(rel);
1060
1147
  }
1061
1148
  }
1062
1149
  return out.sort();
1063
1150
  }
1064
1151
  const COMPANION_DIR = 'extensions';
1065
1152
  function isCompanionExtension(file) {
1066
- const [first] = toPosix(file).split('/');
1153
+ const [first] = zip_toPosix(file).split('/');
1067
1154
  return first === COMPANION_DIR;
1068
1155
  }
1069
1156
  const DENIED_SEGMENTS = new Set([
@@ -1080,7 +1167,7 @@ function isDeniedEnvFile(basename) {
1080
1167
  }
1081
1168
  const STAGING_DIR_PREFIX = '.extension-build-';
1082
1169
  function isDeniedFromSourceZip(file) {
1083
- const posix = toPosix(file);
1170
+ const posix = zip_toPosix(file);
1084
1171
  const segments = posix.split('/');
1085
1172
  if (segments.some((segment)=>DENIED_SEGMENTS.has(segment))) return true;
1086
1173
  if (segments.some((segment)=>segment.startsWith(STAGING_DIR_PREFIX))) return true;
@@ -1092,12 +1179,12 @@ function zip_isUnder(file, root) {
1092
1179
  return file === root || file.startsWith(`${root}/`);
1093
1180
  }
1094
1181
  function relativeWithin(projectDir, target) {
1095
- const relative = toPosix(__rspack_external_node_path_806ed179.relative(projectDir, target));
1182
+ const relative = zip_toPosix(__rspack_external_node_path_806ed179.relative(projectDir, target));
1096
1183
  const outside = '..' === relative || relative.startsWith('../') || __rspack_external_node_path_806ed179.isAbsolute(relative);
1097
1184
  return outside ? void 0 : relative;
1098
1185
  }
1099
1186
  function isBuildOutput(file, projectDir, output) {
1100
- const posix = toPosix(file);
1187
+ const posix = zip_toPosix(file);
1101
1188
  if (zip_isUnder(posix, relativeWithin(projectDir, output.outPath))) return true;
1102
1189
  const artifactDir = relativeWithin(projectDir, __rspack_external_node_path_806ed179.dirname(output.outPath));
1103
1190
  const fileDir = posix.includes('/') ? posix.slice(0, posix.lastIndexOf('/')) : '';
@@ -1118,7 +1205,7 @@ async function getFilesToZip(projectDir, output) {
1118
1205
  dot: true,
1119
1206
  filesOnly: true,
1120
1207
  flush: true
1121
- })).map(toPosix);
1208
+ })).map(zip_toPosix);
1122
1209
  const kept = files.filter((file)=>!isDeniedFromSourceZip(file) && !(output && isBuildOutput(file, projectDir, output)) && !ig.ignores(file) && !isCompanionExtension(file));
1123
1210
  const regularFiles = [];
1124
1211
  const skippedLinks = [];
@@ -1207,7 +1294,7 @@ class ZipPlugin {
1207
1294
  if (this.zipData.zip) try {
1208
1295
  if (isDebug()) debugLine(packagingDistributionFiles(distPath));
1209
1296
  writeZipFile(distPath, listFilesUnder(outPath, new Set([
1210
- toPosix(zipName)
1297
+ zip_toPosix(zipName)
1211
1298
  ])).filter((file)=>!file.endsWith('.map')).map((file)=>({
1212
1299
  name: file,
1213
1300
  absPath: __rspack_external_node_path_806ed179.join(outPath, file)
@@ -3615,7 +3702,8 @@ class InjectBridgeProducer {
3615
3702
  }, ()=>{
3616
3703
  const controlAsset = new core_sources.RawSource(JSON.stringify({
3617
3704
  port: controlPort,
3618
- instanceId
3705
+ instanceId,
3706
+ buildType: 'development'
3619
3707
  }));
3620
3708
  if (compilation.getAsset(CONTROL_PORT_ASSET_NAME)) compilation.updateAsset(CONTROL_PORT_ASSET_NAME, controlAsset);
3621
3709
  else compilation.emitAsset(CONTROL_PORT_ASSET_NAME, controlAsset);
@@ -4534,7 +4622,7 @@ function getUndoPath(filename, outputPath, enforceRelative) {
4534
4622
  else if ('.' !== part) depth++;
4535
4623
  return depth > 0 ? `${'../'.repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
4536
4624
  }
4537
- function BaseUriRuntimeModule(webpack) {
4625
+ function BaseUri_BaseUriRuntimeModule(webpack) {
4538
4626
  const { RuntimeGlobals, RuntimeModule, Template } = webpack;
4539
4627
  class BaseUriRuntime extends RuntimeModule {
4540
4628
  constructor(){
@@ -4659,7 +4747,7 @@ class WebExtensionChuckLoaderRuntimePlugin {
4659
4747
  });
4660
4748
  compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.baseURI).tap(WebExtensionChuckLoaderRuntimePlugin.name, (chunk, set)=>{
4661
4749
  set.add(RuntimeGlobal);
4662
- compilation.addRuntimeModule(chunk, BaseUriRuntimeModule(compiler.webpack));
4750
+ compilation.addRuntimeModule(chunk, BaseUri_BaseUriRuntimeModule(compiler.webpack));
4663
4751
  return true;
4664
4752
  });
4665
4753
  compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.publicPath).tap(WebExtensionChuckLoaderRuntimePlugin.name, (chunk, set)=>{
@@ -10228,7 +10316,7 @@ const PARTIALLY_GATED_APIS = {
10228
10316
  const GATED_USES = {
10229
10317
  tabs: [
10230
10318
  /(?<!\b(?:document|meta)\s*)\.\s*(?:url|pendingUrl|title|favIconUrl)\b/,
10231
- /\{[^{}:]*\b(?:url|pendingUrl|title|favIconUrl)\b[^{}:]*\}\s*(?:=|\))/,
10319
+ /\{[^{}:]*\b(?:url|pendingUrl|title|favIconUrl)\b[^{}:]*\}\s*(?:=(?![=>])|\)\s*(?:=>|\{))/,
10232
10320
  /\btabs\s*\.\s*query\s*\(\s*\{[^{}]*\b(?:url|title)\s*:/
10233
10321
  ]
10234
10322
  };
@@ -10260,8 +10348,16 @@ function partiallyGatedWarning(api, relative, declared = new Set()) {
10260
10348
  function patchWebkitBackground(manifest, browser) {
10261
10349
  if (!isWebkitBasedBrowser(String(browser))) return manifest;
10262
10350
  const background = manifest.background;
10263
- if (!background || !background.service_worker || background.scripts) return manifest;
10264
- const { service_worker, type, ...rest } = background;
10351
+ if (!background) return manifest;
10352
+ if (!background.service_worker || background.scripts) {
10353
+ if (!('persistent' in background)) return manifest;
10354
+ const { persistent, ...rest } = background;
10355
+ return {
10356
+ ...manifest,
10357
+ background: rest
10358
+ };
10359
+ }
10360
+ const { service_worker, type, persistent, ...rest } = background;
10265
10361
  return {
10266
10362
  ...manifest,
10267
10363
  background: {
@@ -13437,6 +13533,59 @@ class ManifestPlugin {
13437
13533
  new ManifestLegacyWarnings().apply(compiler);
13438
13534
  }
13439
13535
  }
13536
+ class AddBaseUriRuntimeModule {
13537
+ apply(compiler) {
13538
+ if (!compiler?.hooks?.compilation) return;
13539
+ const { RuntimeGlobals } = compiler.webpack;
13540
+ compiler.hooks.compilation.tap('BaseUriRuntimeModule', (compilation)=>{
13541
+ compilation.hooks.additionalTreeRuntimeRequirements.tap(AddBaseUriRuntimeModule.name, (chunk, set)=>{
13542
+ if (!isWorkerEntry(compiler, chunk.name)) return;
13543
+ if (!set.has(RuntimeGlobals.baseURI) && !set.has('baseUri')) return;
13544
+ compilation.addRuntimeModule(chunk, add_base_uri_runtime_module_BaseUriRuntimeModule(compiler));
13545
+ });
13546
+ });
13547
+ }
13548
+ }
13549
+ function isWorkerEntry(compiler, name) {
13550
+ if (!name) return false;
13551
+ const entries = compiler.options.entry;
13552
+ const chunkLoading = entries[name]?.chunkLoading;
13553
+ return false === chunkLoading || "import-scripts" === chunkLoading;
13554
+ }
13555
+ function baseUriRuntimeSource(baseUriGlobal) {
13556
+ return [
13557
+ 'var __extjsBase = "";',
13558
+ "try {",
13559
+ ' var __extjsApi = (typeof browser === "object" && browser && browser.runtime) ? browser : (typeof chrome === "object" && chrome && chrome.runtime) ? chrome : null;',
13560
+ ' if (__extjsApi && typeof __extjsApi.runtime.getURL === "function") __extjsBase = String(__extjsApi.runtime.getURL("/"));',
13561
+ '} catch (_) { __extjsBase = ""; }',
13562
+ 'if (!__extjsBase && typeof globalThis === "object" && globalThis && globalThis.__EXTJS_EXTENSION_BASE__) {',
13563
+ ' __extjsBase = String(globalThis.__EXTJS_EXTENSION_BASE__ || "");',
13564
+ "}",
13565
+ 'if (!__extjsBase && typeof document === "object" && document && document.documentElement) {',
13566
+ ' try { __extjsBase = String(document.documentElement.getAttribute("data-extjs-extension-base") || ""); } catch (_) { __extjsBase = ""; }',
13567
+ "}",
13568
+ "if (__extjsBase) {",
13569
+ ` ${baseUriGlobal} = __extjsBase;`,
13570
+ '} else if (typeof document === "object" && document && document.baseURI) {',
13571
+ ` ${baseUriGlobal} = document.baseURI;`,
13572
+ '} else if (typeof self === "object" && self && self.location && self.location.href) {',
13573
+ ` ${baseUriGlobal} = self.location.href;`,
13574
+ "}"
13575
+ ];
13576
+ }
13577
+ function add_base_uri_runtime_module_BaseUriRuntimeModule(compiler) {
13578
+ const { Template, RuntimeModule, RuntimeGlobals } = compiler.webpack;
13579
+ class BaseUriRuntimeModule extends RuntimeModule {
13580
+ constructor(){
13581
+ super('extension base uri', RuntimeModule.STAGE_ATTACH);
13582
+ }
13583
+ generate() {
13584
+ return Template.asString(baseUriRuntimeSource(RuntimeGlobals.baseURI));
13585
+ }
13586
+ }
13587
+ return new BaseUriRuntimeModule();
13588
+ }
13440
13589
  const isScriptsFolderFeature = (feature)=>feature.startsWith("scripts/");
13441
13590
  function collectScriptEntries(options) {
13442
13591
  const { includeList, manifestDir, projectPath } = options;
@@ -13798,11 +13947,10 @@ class AddScripts {
13798
13947
  ] : entryImports;
13799
13948
  if (!finalEntryImports.length) continue;
13800
13949
  const runsAsWorker = 'background/service_worker' === feature || isBackgroundScriptsFeature(feature) && 3 === Number(manifestJson.manifest_version) && !isGeckoBasedBrowser(String(this.browser));
13950
+ const workerChunkLoading = manifestJson.background?.type === 'module' ? false : "import-scripts";
13801
13951
  newEntries[feature] = runsAsWorker ? {
13802
13952
  import: finalEntryImports,
13803
- ...manifestJson.background?.type === 'module' ? {} : {
13804
- chunkLoading: "import-scripts"
13805
- }
13953
+ chunkLoading: workerChunkLoading
13806
13954
  } : {
13807
13955
  import: finalEntryImports,
13808
13956
  ...isContentScriptFeature(feature) || add_scripts_isScriptsFolderFeature(feature) ? {
@@ -13968,6 +14116,37 @@ class KeepGetURLImportsNative {
13968
14116
  });
13969
14117
  }
13970
14118
  }
14119
+ const UTF8_BOM = '';
14120
+ const SCRIPT_ASSET = /\.[cm]?js$/i;
14121
+ class StampWebkitUtf8Bom {
14122
+ browser;
14123
+ constructor(options){
14124
+ this.browser = String(options.browser || 'chrome');
14125
+ }
14126
+ apply(compiler) {
14127
+ if (!isWebkitBasedBrowser(this.browser)) return;
14128
+ if (!compiler?.hooks?.thisCompilation?.tap) return;
14129
+ compiler.hooks.thisCompilation.tap("scripts:stamp-webkit-utf8-bom", (compilation)=>{
14130
+ compilation.hooks.processAssets.tap({
14131
+ name: "scripts:stamp-webkit-utf8-bom",
14132
+ stage: core_Compilation.PROCESS_ASSETS_STAGE_REPORT + 900
14133
+ }, ()=>{
14134
+ const assets = 'function' == typeof compilation.getAssets ? compilation.getAssets() : [];
14135
+ for (const asset of assets){
14136
+ const name = asset?.name || '';
14137
+ if (!SCRIPT_ASSET.test(name)) continue;
14138
+ let source = '';
14139
+ try {
14140
+ source = asset.source?.source?.().toString() || '';
14141
+ } catch {
14142
+ continue;
14143
+ }
14144
+ if (source && 0xfeff !== source.charCodeAt(0)) compilation.updateAsset(name, new core_sources.RawSource(`${UTF8_BOM}${source}`));
14145
+ }
14146
+ });
14147
+ });
14148
+ }
14149
+ }
13971
14150
  const validate_emitted_script_syntax_requireModule = createRequire(import.meta.url);
13972
14151
  class ValidateEmittedScriptSyntax {
13973
14152
  apply(compiler) {
@@ -14796,7 +14975,11 @@ class ScriptsPlugin {
14796
14975
  devSession: this.devSession
14797
14976
  }).apply(compiler);
14798
14977
  if ('production' === compiler.options.mode) new AddPublicPathRuntimeModule().apply(compiler);
14978
+ new AddBaseUriRuntimeModule().apply(compiler);
14799
14979
  new ValidateEmittedScriptSyntax().apply(compiler);
14980
+ new StampWebkitUtf8Bom({
14981
+ browser: this.browser
14982
+ }).apply(compiler);
14800
14983
  new WarnSplitInitialChunks().apply(compiler);
14801
14984
  new WarnPageContextWorker().apply(compiler);
14802
14985
  new WarnMissingBuildConstants({
@@ -15516,6 +15699,7 @@ function webpackConfig(projectStructure, devOptions) {
15516
15699
  browsersPlugin.extensionsToLoad = unpackedExtensionDirsToLoad;
15517
15700
  plugins.push(browsersPlugin);
15518
15701
  }
15702
+ plugins.push(new StableLoaderPathsPlugin());
15519
15703
  const modeCondition = 'production' === (devOptions.mode || 'development') ? 'production' : 'development';
15520
15704
  const importResolve = {
15521
15705
  conditionNames: [
@@ -15696,6 +15880,7 @@ function webpackConfig(projectStructure, devOptions) {
15696
15880
  global: false
15697
15881
  },
15698
15882
  resolveLoader: {
15883
+ symlinks: false,
15699
15884
  modules: [
15700
15885
  'node_modules',
15701
15886
  __rspack_external_node_path_806ed179.join(packageJsonDir, 'node_modules'),
@@ -15755,7 +15940,13 @@ function webpackConfig(projectStructure, devOptions) {
15755
15940
  minimize: 'production' === devOptions.mode && false !== devOptions.minify,
15756
15941
  minimizer: [
15757
15942
  new SwcJsMinimizerRspackPlugin({
15758
- extractComments: true
15943
+ extractComments: true,
15944
+ minimizerOptions: {
15945
+ compress: {
15946
+ reduce_vars: false,
15947
+ collapse_vars: false
15948
+ }
15949
+ }
15759
15950
  }),
15760
15951
  new LightningCssMinimizerRspackPlugin({
15761
15952
  removeUnusedLocalIdents: false,
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "runtime"
49
49
  ],
50
50
  "name": "extension-develop",
51
- "version": "4.1.35",
51
+ "version": "4.1.36",
52
52
  "description": "Develop, build, preview, and package Extension.js projects.",
53
53
  "author": {
54
54
  "name": "Cezar Augusto",