extension-develop 3.1.0-next.2 → 3.1.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.
package/dist/329.js CHANGED
@@ -850,31 +850,36 @@ exports.modules = {
850
850
  });
851
851
  return styleLoaders.filter(Boolean);
852
852
  }
853
- async function cssInContentScriptLoader(projectPath, manifestPath, mode) {
853
+ async function cssInContentScriptLoader(projectPath, manifestPath, mode, usage = {}) {
854
+ const { useSass = true, useLess = true } = usage;
854
855
  const isContentScript = (issuer)=>isContentScriptEntry(issuer, manifestPath);
855
856
  const fileTypes = [
856
857
  {
857
858
  test: /\.css$/,
858
859
  loader: null
859
860
  },
860
- {
861
- test: /\.(sass|scss)$/,
862
- exclude: /\.module\.(sass|scss)$/,
863
- loader: 'sass-loader'
864
- },
865
- {
866
- test: /\.module\.(sass|scss)$/,
867
- loader: 'sass-loader'
868
- },
869
- {
870
- test: /\.less$/,
871
- exclude: /\.module\.less$/,
872
- loader: 'less-loader'
873
- },
874
- {
875
- test: /\.module\.less$/,
876
- loader: 'less-loader'
877
- }
861
+ ...useSass ? [
862
+ {
863
+ test: /\.(sass|scss)$/,
864
+ exclude: /\.module\.(sass|scss)$/,
865
+ loader: 'sass-loader'
866
+ },
867
+ {
868
+ test: /\.module\.(sass|scss)$/,
869
+ loader: 'sass-loader'
870
+ }
871
+ ] : [],
872
+ ...useLess ? [
873
+ {
874
+ test: /\.less$/,
875
+ exclude: /\.module\.less$/,
876
+ loader: 'less-loader'
877
+ },
878
+ {
879
+ test: /\.module\.less$/,
880
+ loader: 'less-loader'
881
+ }
882
+ ] : []
878
883
  ];
879
884
  const rules = await Promise.all(fileTypes.map(async ({ test, exclude, loader })=>{
880
885
  const baseConfig = {
@@ -906,7 +911,8 @@ exports.modules = {
906
911
  }));
907
912
  return rules;
908
913
  }
909
- async function cssInHtmlLoader(projectPath, mode, manifestPath) {
914
+ async function cssInHtmlLoader(projectPath, mode, manifestPath, usage = {}) {
915
+ const { useSass = true, useLess = true } = usage;
910
916
  const isNotContentScript = (issuer)=>!isContentScriptEntry(issuer, manifestPath);
911
917
  const fileTypes = [
912
918
  {
@@ -914,28 +920,32 @@ exports.modules = {
914
920
  type: 'css',
915
921
  loader: null
916
922
  },
917
- {
918
- test: /\.(sass|scss)$/,
919
- exclude: /\.module\.(sass|scss)$/,
920
- type: 'css',
921
- loader: 'sass-loader'
922
- },
923
- {
924
- test: /\.module\.(sass|scss)$/,
925
- type: 'css/module',
926
- loader: 'sass-loader'
927
- },
928
- {
929
- test: /\.less$/,
930
- exclude: /\.module\.less$/,
931
- type: 'css',
932
- loader: 'less-loader'
933
- },
934
- {
935
- test: /\.module\.less$/,
936
- type: 'css/module',
937
- loader: 'less-loader'
938
- }
923
+ ...useSass ? [
924
+ {
925
+ test: /\.(sass|scss)$/,
926
+ exclude: /\.module\.(sass|scss)$/,
927
+ type: 'css',
928
+ loader: 'sass-loader'
929
+ },
930
+ {
931
+ test: /\.module\.(sass|scss)$/,
932
+ type: 'css/module',
933
+ loader: 'sass-loader'
934
+ }
935
+ ] : [],
936
+ ...useLess ? [
937
+ {
938
+ test: /\.less$/,
939
+ exclude: /\.module\.less$/,
940
+ type: 'css',
941
+ loader: 'less-loader'
942
+ },
943
+ {
944
+ test: /\.module\.less$/,
945
+ type: 'css/module',
946
+ loader: 'less-loader'
947
+ }
948
+ ] : []
939
949
  ];
940
950
  const rules = await Promise.all(fileTypes.map(async ({ test, exclude, type, loader })=>{
941
951
  const baseConfig = {
@@ -977,17 +987,25 @@ exports.modules = {
977
987
  class CssPlugin {
978
988
  async configureOptions(compiler) {
979
989
  const mode = compiler.options.mode || 'development';
980
- const projectPath = compiler.options.context;
990
+ const projectPath = compiler.options.context || process.cwd();
981
991
  const plugins = [];
982
992
  const manifestPath = this.manifestPath;
993
+ const usingSass = (0, css_lib_integrations.w)(projectPath, 'sass');
994
+ const usingLess = (0, css_lib_integrations.w)(projectPath, 'less');
983
995
  const maybeInstallStylelint = await maybeUseStylelint(projectPath);
984
996
  plugins.push(...maybeInstallStylelint);
985
- const loaders = [
986
- ...await cssInContentScriptLoader(projectPath, manifestPath, mode),
987
- ...await cssInHtmlLoader(projectPath, mode, manifestPath)
988
- ];
989
997
  const maybeInstallSass = await maybeUseSass(projectPath);
990
998
  const maybeInstallLess = await maybeUseLess(projectPath, manifestPath);
999
+ const loaders = [
1000
+ ...await cssInContentScriptLoader(projectPath, manifestPath, mode, {
1001
+ useSass: usingSass,
1002
+ useLess: usingLess
1003
+ }),
1004
+ ...await cssInHtmlLoader(projectPath, mode, manifestPath, {
1005
+ useSass: usingSass,
1006
+ useLess: usingLess
1007
+ })
1008
+ ];
991
1009
  if (maybeInstallSass.length) loaders.push({
992
1010
  test: /\.(sass|scss)$/,
993
1011
  exclude: /\.module\.(sass|scss)$/,
@@ -1016,8 +1034,6 @@ exports.modules = {
1016
1034
  ].filter(Boolean);
1017
1035
  if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
1018
1036
  const integrations = [];
1019
- const usingSass = (0, css_lib_integrations.w)(projectPath, 'sass');
1020
- const usingLess = (0, css_lib_integrations.w)(projectPath, 'less');
1021
1037
  const usingTailwind = (0, css_lib_integrations.w)(projectPath, 'tailwindcss');
1022
1038
  const usingPostcss = (0, css_lib_integrations.w)(projectPath, 'postcss') || void 0 !== plugin_css_findPostCssConfig(projectPath) || usingSass || usingLess || usingTailwind;
1023
1039
  if (usingPostcss) integrations.push('PostCSS');
package/dist/module.js CHANGED
@@ -4505,7 +4505,7 @@ var __webpack_modules__ = {
4505
4505
  module.exports = require("ws");
4506
4506
  },
4507
4507
  "./package.json" (module) {
4508
- module.exports = JSON.parse('{"rE":"3.1.0-next.2","El":{"@rspack/core":"^1.7.2","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^5.0.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.0.3","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","package-manager-detector":"^1.6.0","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.19.0"}}');
4508
+ module.exports = JSON.parse('{"rE":"3.1.0-next.6","El":{"@rspack/core":"^1.7.2","@rspack/dev-server":"^1.1.5","@swc/core":"^1.15.8","@swc/helpers":"^0.5.18","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^5.0.0","chrome-location2":"4.0.0","chromium-location":"2.0.0","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^17.2.3","edge-location":"2.2.0","firefox-location2":"3.0.0","go-git-it":"^5.0.3","ignore":"^7.0.5","loader-utils":"^3.3.1","magic-string":"^0.30.21","package-manager-detector":"^1.6.0","parse5":"^8.0.0","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.3.3","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.19.0"}}');
4509
4509
  }
4510
4510
  };
4511
4511
  var __webpack_module_cache__ = {};
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "name": "extension-develop",
25
- "version": "3.1.0-next.2",
25
+ "version": "3.1.0-next.6",
26
26
  "description": "Develop, build, preview, and package Extension.js projects.",
27
27
  "author": {
28
28
  "name": "Cezar Augusto",