extension-develop 3.15.0 → 3.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/442.cjs CHANGED
@@ -2209,14 +2209,14 @@ exports.modules = {
2209
2209
  {
2210
2210
  test: /\.css$/,
2211
2211
  exclude: /\.module\.css$/,
2212
- type: 'asset',
2212
+ type: 'asset/inline',
2213
2213
  loader: null
2214
2214
  },
2215
2215
  ...useSass ? [
2216
2216
  {
2217
2217
  test: /\.(sass|scss)$/,
2218
2218
  exclude: /\.module\.(sass|scss)$/,
2219
- type: 'asset',
2219
+ type: 'asset/inline',
2220
2220
  loader: 'sass-loader'
2221
2221
  },
2222
2222
  {
@@ -2229,7 +2229,7 @@ exports.modules = {
2229
2229
  {
2230
2230
  test: /\.less$/,
2231
2231
  exclude: /\.module\.less$/,
2232
- type: 'asset',
2232
+ type: 'asset/inline',
2233
2233
  loader: 'less-loader'
2234
2234
  },
2235
2235
  {
@@ -2239,32 +2239,22 @@ exports.modules = {
2239
2239
  }
2240
2240
  ] : []
2241
2241
  ];
2242
- const rules = await Promise.all(fileTypes.map(async ({ test, exclude, type = 'asset', loader })=>{
2243
- const baseConfig = {
2242
+ const rules = await Promise.all(fileTypes.map(async ({ test, exclude, type, loader })=>{
2243
+ const use = loader ? await commonStyleLoaders(projectPath, {
2244
+ mode: mode,
2245
+ loader: resolvePreprocessorLoader(loader, projectPath),
2246
+ loaderOptions: 'sass-loader' === loader ? createSassLoaderOptions(projectPath, mode) : {
2247
+ sourceMap: true
2248
+ }
2249
+ }) : await commonStyleLoaders(projectPath, {
2250
+ mode: mode
2251
+ });
2252
+ return {
2244
2253
  test,
2245
2254
  exclude,
2246
2255
  type,
2247
- issuer: isContentScript
2248
- };
2249
- if ('asset' === type) baseConfig.generator = {
2250
- filename: "content_scripts/[name].[contenthash:8].css"
2251
- };
2252
- if (!loader) return {
2253
- ...baseConfig,
2254
- use: await commonStyleLoaders(projectPath, {
2255
- mode: mode
2256
- })
2257
- };
2258
- const loaderOptions = 'sass-loader' === loader ? createSassLoaderOptions(projectPath, mode) : {
2259
- sourceMap: true
2260
- };
2261
- return {
2262
- ...baseConfig,
2263
- use: await commonStyleLoaders(projectPath, {
2264
- mode: mode,
2265
- loader: resolvePreprocessorLoader(loader, projectPath),
2266
- loaderOptions
2267
- })
2256
+ issuer: isContentScript,
2257
+ use
2268
2258
  };
2269
2259
  }));
2270
2260
  return rules;
@@ -2315,28 +2305,21 @@ exports.modules = {
2315
2305
  ] : []
2316
2306
  ];
2317
2307
  const rules = await Promise.all(fileTypes.map(async ({ test, exclude, type, loader })=>{
2318
- const baseConfig = {
2308
+ const use = loader ? await commonStyleLoaders(projectPath, {
2309
+ mode: mode,
2310
+ loader: css_in_html_loader_resolvePreprocessorLoader(loader, projectPath),
2311
+ loaderOptions: 'sass-loader' === loader ? createSassLoaderOptions(projectPath, mode) : {
2312
+ sourceMap: true
2313
+ }
2314
+ }) : await commonStyleLoaders(projectPath, {
2315
+ mode: mode
2316
+ });
2317
+ return {
2319
2318
  test,
2320
2319
  exclude,
2321
2320
  type,
2322
- issuer: isNotContentScript
2323
- };
2324
- if (!loader) return {
2325
- ...baseConfig,
2326
- use: await commonStyleLoaders(projectPath, {
2327
- mode: mode
2328
- })
2329
- };
2330
- const loaderOptions = 'sass-loader' === loader ? createSassLoaderOptions(projectPath, mode) : {
2331
- sourceMap: true
2332
- };
2333
- return {
2334
- ...baseConfig,
2335
- use: await commonStyleLoaders(projectPath, {
2336
- mode: mode,
2337
- loader: css_in_html_loader_resolvePreprocessorLoader(loader, projectPath),
2338
- loaderOptions
2339
- })
2321
+ issuer: isNotContentScript,
2322
+ use
2340
2323
  };
2341
2324
  }));
2342
2325
  return rules;
@@ -2390,8 +2373,8 @@ exports.modules = {
2390
2373
  const usingLess = (0, has_dependency.w)(projectPath, 'less');
2391
2374
  const maybeInstallStylelint = await maybeUseStylelint(projectPath);
2392
2375
  plugins.push(...maybeInstallStylelint);
2393
- const maybeInstallSass = await maybeUseSass(projectPath);
2394
- const maybeInstallLess = await maybeUseLess(projectPath, manifestPath);
2376
+ await maybeUseSass(projectPath);
2377
+ await maybeUseLess(projectPath, manifestPath);
2395
2378
  const loaders = [
2396
2379
  ...await cssInContentScriptLoader(projectPath, manifestPath, mode, {
2397
2380
  useSass: usingSass,
@@ -2402,24 +2385,6 @@ exports.modules = {
2402
2385
  useLess: usingLess
2403
2386
  })
2404
2387
  ];
2405
- if (maybeInstallSass.length) loaders.push({
2406
- test: /\.(sass|scss)$/,
2407
- exclude: /\.module\.(sass|scss)$/,
2408
- type: 'asset/resource',
2409
- generator: {
2410
- filename: "content_scripts/[name].[contenthash:8].css"
2411
- },
2412
- issuer: (issuer)=>isContentScriptEntry(issuer, manifestPath, projectPath)
2413
- });
2414
- if (maybeInstallLess.length) loaders.push({
2415
- test: /\.less$/,
2416
- exclude: /\.module\.less$/,
2417
- type: 'asset/resource',
2418
- generator: {
2419
- filename: "content_scripts/[name].[contenthash:8].css"
2420
- },
2421
- issuer: (issuer)=>isContentScriptEntry(issuer, manifestPath, projectPath)
2422
- });
2423
2388
  compiler.options.output.cssFilename = '[name].css';
2424
2389
  compiler.options.output.cssChunkFilename = '[name].css';
2425
2390
  compiler.options.plugins = [
@@ -2658,9 +2623,6 @@ exports.modules = {
2658
2623
  dependencyId: '@rspack/plugin-preact-refresh',
2659
2624
  moduleAdapter: (mod)=>mod && mod.default || mod
2660
2625
  });
2661
- const preactPlugins = [
2662
- new PreactRefreshPlugin({})
2663
- ];
2664
2626
  const requireFromProject = (0, external_module_.createRequire)(external_path_.join(projectPath, 'package.json'));
2665
2627
  const resolveFromProject = (id)=>{
2666
2628
  try {
@@ -2669,11 +2631,19 @@ exports.modules = {
2669
2631
  return;
2670
2632
  }
2671
2633
  };
2634
+ const preactPkgJson = resolveFromProject('preact/package.json');
2635
+ const preactDir = preactPkgJson ? external_path_.dirname(preactPkgJson) : void 0;
2672
2636
  const preactCompat = resolveFromProject('preact/compat');
2673
2637
  const preactTestUtils = resolveFromProject('preact/test-utils');
2674
2638
  const preactJsxRuntime = resolveFromProject('preact/jsx-runtime');
2675
2639
  const preactJsxDevRuntime = resolveFromProject('preact/jsx-dev-runtime');
2640
+ const preactPlugins = [
2641
+ new PreactRefreshPlugin(preactDir ? {
2642
+ preactPath: preactDir
2643
+ } : {})
2644
+ ];
2676
2645
  const alias = {};
2646
+ if (preactDir) alias.preact = preactDir;
2677
2647
  if (preactCompat) {
2678
2648
  alias.react = preactCompat;
2679
2649
  alias['react-dom'] = preactCompat;
@@ -2830,7 +2800,7 @@ exports.modules = {
2830
2800
  const defaultPlugins = [
2831
2801
  new VueLoaderPlugin(),
2832
2802
  new core_.DefinePlugin({
2833
- __VUE_OPTIONS_API__: JSON.stringify(true),
2803
+ __VUE_OPTIONS_API__: JSON.stringify(!isProd),
2834
2804
  __VUE_PROD_DEVTOOLS__: JSON.stringify(!isProd),
2835
2805
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(!isProd)
2836
2806
  })
@@ -3425,13 +3395,20 @@ exports.modules = {
3425
3395
  if (!outputPath) return;
3426
3396
  const csDir = external_path_.join(outputPath, "content_scripts");
3427
3397
  if (!external_fs_.existsSync(csDir)) return;
3428
- const hashedRe = /^content-\d+\.[a-f0-9]+\.(js|css)(\.map)?$/i;
3398
+ const emittedNames = new Set();
3399
+ const assets = 'function' == typeof compilation.getAssets ? compilation.getAssets() : [];
3400
+ for (const asset of assets){
3401
+ const name = asset?.name || '';
3402
+ if (name.startsWith("content_scripts/")) emittedNames.add(name);
3403
+ }
3404
+ const hashedRe = /^[A-Za-z0-9._-]+\.[a-f0-9]{6,}\.(js|css)(\.map)?$/i;
3429
3405
  try {
3430
3406
  for (const name of external_fs_.readdirSync(csDir)){
3431
3407
  if (!hashedRe.test(name)) continue;
3432
3408
  const rel = `content_scripts/${name}`;
3433
- if (!currentNames.has(rel)) {
3434
- if (!currentNames.has(rel.replace(/\.map$/, ''))) try {
3409
+ const relNoMap = rel.replace(/\.map$/, '');
3410
+ if (!(currentNames.has(rel) || currentNames.has(relNoMap))) {
3411
+ if (!(emittedNames.has(rel) || emittedNames.has(relNoMap))) try {
3435
3412
  external_fs_.unlinkSync(external_path_.join(csDir, name));
3436
3413
  } catch {}
3437
3414
  }
@@ -3909,7 +3886,19 @@ exports.modules = {
3909
3886
  }
3910
3887
  }
3911
3888
  const assetKeys = Object.keys(compilation.assets || {});
3912
- const cssUnderContentScripts = assetKeys.filter((k)=>k.startsWith("content_scripts/")).filter((k)=>k.endsWith('.css')).sort();
3889
+ const emittedCssUnderContentScripts = assetKeys.filter((k)=>k.startsWith("content_scripts/")).filter((k)=>k.endsWith('.css'));
3890
+ const onDiskCssUnderContentScripts = [];
3891
+ const outputPath = compilation.options.output?.path;
3892
+ if (outputPath) try {
3893
+ const csDir = external_path_.join(outputPath, "content_scripts");
3894
+ if (external_fs_.existsSync(csDir)) {
3895
+ for (const name of external_fs_.readdirSync(csDir))if (name.endsWith('.css')) onDiskCssUnderContentScripts.push(`content_scripts/${name}`);
3896
+ }
3897
+ } catch {}
3898
+ const cssUnderContentScripts = Array.from(new Set([
3899
+ ...emittedCssUnderContentScripts,
3900
+ ...onDiskCssUnderContentScripts
3901
+ ])).sort();
3913
3902
  if (Array.isArray(canonicalManifest.content_scripts)) for (const contentScript of canonicalManifest.content_scripts){
3914
3903
  const jsFiles = Array.isArray(contentScript.js) ? contentScript.js : [];
3915
3904
  const canonicalCss = jsFiles.map(toCanonicalContentScriptCss).filter((resource)=>Boolean(resource && cssUnderContentScripts.includes(resource)));
@@ -8937,7 +8926,7 @@ Set background.noDynamicEntryWarning to true to disable this warning.
8937
8926
  return 'ignored';
8938
8927
  }
8939
8928
  const BUDGET_BYTES = {
8940
- "content-script": 153600,
8929
+ "content-script": 262144,
8941
8930
  'service-worker': 204800,
8942
8931
  page: 512000,
8943
8932
  ignored: 1 / 0