weboptimizer 2.0.1167 → 2.0.1170

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/declarations.d.ts CHANGED
@@ -25,7 +25,12 @@ declare module 'postcss-fontpath' {
25
25
  declare module 'postcss-sprites' {
26
26
  export default function(options:Partial<{
27
27
  filterBy:() => Promise<void>
28
- hooks:{onSaveSpritesheet:(_image:Mapping) => string}
28
+ hooks:{
29
+ onSaveSpritesheet:(_image:Mapping<unknown>) => string
30
+ onUpdateRule:(
31
+ _rule:PostcssNode, _token:PostcssNode, _image:Mapping<unknown>
32
+ ) => void
33
+ }
29
34
  spritePath:string
30
35
  stylesheetPath:null|string
31
36
  verbose:boolean
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "2.0.1167",
3
+ "version": "2.0.1170",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -111,7 +111,6 @@
111
111
  "devDependencies": {
112
112
  "@babel/cli": "*",
113
113
  "@babel/eslint-parser": "*",
114
- "@types/cssnano": "*",
115
114
  "@types/ejs": "*",
116
115
  "@types/favicons": "*",
117
116
  "@types/html-minifier": "*",
@@ -923,10 +922,17 @@
923
922
  },
924
923
  "cssnano": {
925
924
  "#": "The autoprefixer has to be disabled in this context since it would remove all needed vendor prefixes from the preceding processing (every prefix should be needed here).",
926
- "autoprefixer": false,
927
- "discardUnused": {
928
- "__evaluate__": "!self.library"
929
- }
925
+ "preset": [
926
+ {
927
+ "__evaluate__": "optionalRequire('cssnano-preset-default')"
928
+ },
929
+ {
930
+ "autoprefixer": false,
931
+ "discardUnused": {
932
+ "__evaluate__": "!self.library"
933
+ }
934
+ }
935
+ ]
930
936
  },
931
937
  "data": {
932
938
  "exclude": null,
@@ -54,7 +54,8 @@ var _helper = _interopRequireDefault(require("./helper"));
54
54
 
55
55
  var _ejsLoader = _interopRequireDefault(require("./ejsLoader"));
56
56
 
57
- var _this = void 0,
57
+ var _optionalRequire,
58
+ _this = void 0,
58
59
  _configuration$path$c,
59
60
  _configuration$cache,
60
61
  _configuration$cache2,
@@ -78,6 +79,7 @@ var postcssCSSnano = (0, _clientnode.optionalRequire)('cssnano');
78
79
  var postcssFontpath = (0, _clientnode.optionalRequire)('postcss-fontpath');
79
80
  var postcssImport = (0, _clientnode.optionalRequire)('postcss-import');
80
81
  var postcssSprites = (0, _clientnode.optionalRequire)('postcss-sprites');
82
+ var updateRule = (_optionalRequire = (0, _clientnode.optionalRequire)('postcss-sprites/lib/core')) === null || _optionalRequire === void 0 ? void 0 : _optionalRequire.updateRule;
81
83
  var postcssURL = (0, _clientnode.optionalRequire)('postcss-url');
82
84
  var pluginNameResourceMapping = {
83
85
  HTML: 'html-webpack-plugin',
@@ -896,6 +898,21 @@ var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(evaluat
896
898
  hooks: {
897
899
  onSaveSpritesheet: function onSaveSpritesheet(image) {
898
900
  return (0, _path.join)(image.spritePath, (0, _path.relative)(configuration.path.target.asset.image, configuration.files.compose.image));
901
+ },
902
+
903
+ /*
904
+ Reset this token due to a
905
+ sprite bug with
906
+ "background-image" declaration
907
+ which do not refer to an image
908
+ (e.g. linear gradient instead).
909
+ */
910
+ onUpdateRule: function onUpdateRule(rule, token, image) {
911
+ if (token.value.includes(token.text)) updateRule(rule, token, image);else token.cloneAfter({
912
+ type: 'decl',
913
+ prop: 'background-image',
914
+ value: token.value
915
+ });
899
916
  }
900
917
  },
901
918
  stylesheetPath: configuration.path.source.asset.cascadingStyleSheet,
@@ -919,7 +936,7 @@ var genericLoader = {
919
936
  use: _module.preprocessor.ejs.additional.pre.map(evaluateMapper).concat({
920
937
  loader: 'file?name=[path][name]' + ((_clientnode["default"].isPlainObject(_module.preprocessor.ejs.options) ? _module.preprocessor.ejs.options : {
921
938
  compileSteps: 2
922
- }).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
939
+ }).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
923
940
  }, {
924
941
  loader: 'extract'
925
942
  }, {
@@ -981,7 +998,7 @@ var genericLoader = {
981
998
  use: _module.preprocessor.html.additional.pre.map(evaluateMapper).concat({
982
999
  loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.asset.base, configuration.path.target.asset.template), '[name]' + ((_clientnode["default"].isPlainObject(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
983
1000
  compileSteps: 2
984
- }).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]"))
1001
+ }).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[contenthash]"))
985
1002
  }, (_clientnode["default"].isPlainObject(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
986
1003
  compileSteps: 2
987
1004
  }).compileSteps % 2 ? [] : [{
@@ -1003,7 +1020,7 @@ var genericLoader = {
1003
1020
  include: configuration.path.source.asset.template,
1004
1021
  test: /\.html(?:\?.*)?$/i,
1005
1022
  use: _module.html.additional.pre.map(evaluateMapper).concat({
1006
- loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.template), "[name][ext]?".concat(configuration.hashAlgorithm, "=") + '[chunkhash]')
1023
+ loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.template), "[name][ext]?".concat(configuration.hashAlgorithm, "=") + '[contenthash]')
1007
1024
  }, {
1008
1025
  loader: 'extract'
1009
1026
  }, {
@@ -1054,7 +1071,7 @@ var genericLoader = {
1054
1071
  return _module.optimizer.font.eot.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.eot.exclude, filePath));
1055
1072
  },
1056
1073
  generator: {
1057
- filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
1074
+ filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
1058
1075
  },
1059
1076
  test: /\.eot(?:\?.*)?$/i,
1060
1077
  type: 'asset/resource',
@@ -1071,7 +1088,7 @@ var genericLoader = {
1071
1088
  },
1072
1089
  include: configuration.path.source.asset.font,
1073
1090
  generator: {
1074
- filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
1091
+ filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
1075
1092
  },
1076
1093
  mimetype: 'image/svg+xml',
1077
1094
  parser: {
@@ -1088,7 +1105,7 @@ var genericLoader = {
1088
1105
  return _module.optimizer.font.ttf.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.ttf.exclude, filePath));
1089
1106
  },
1090
1107
  generator: {
1091
- filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
1108
+ filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
1092
1109
  },
1093
1110
  test: /\.ttf(?:\?.*)?$/i,
1094
1111
  type: 'asset/resource',
@@ -1105,7 +1122,7 @@ var genericLoader = {
1105
1122
  return _module.optimizer.font.woff.exclude === null ? false : Boolean(evaluate(_module.optimizer.font.woff.exclude, filePath));
1106
1123
  },
1107
1124
  generator: {
1108
- filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
1125
+ filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
1109
1126
  },
1110
1127
  test: /\.woff2?(?:\?.*)?$/i,
1111
1128
  type: 'asset/resource',
@@ -1124,7 +1141,7 @@ var genericLoader = {
1124
1141
  return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.optimizer.image.exclude, filePath));
1125
1142
  },
1126
1143
  generator: {
1127
- filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.image), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
1144
+ filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.image), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
1128
1145
  },
1129
1146
  include: configuration.path.source.asset.image,
1130
1147
  test: /\.(?:gif|ico|jpg|png|svg)(?:\?.*)?$/i,
@@ -1144,7 +1161,7 @@ var genericLoader = {
1144
1161
  return configuration.extensions.file.internal.includes((0, _path.extname)(_helper["default"].stripLoader(filePath))) || (_module.optimizer.data.exclude === null ? isFilePathInDependencies(filePath) : Boolean(evaluate(_module.optimizer.data.exclude, filePath)));
1145
1162
  },
1146
1163
  generator: {
1147
- filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.data), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[chunkhash]")
1164
+ filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.data), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
1148
1165
  },
1149
1166
  test: /.+/,
1150
1167
  type: 'asset/resource',