weboptimizer 2.0.1561 → 2.0.1563
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/package.json +17 -17
- package/webpackConfigurator.js +94 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1563",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -88,19 +88,19 @@
|
|
|
88
88
|
},
|
|
89
89
|
"runkitExample": "require('@babel/runtime/package.json')\n\nconst {default: main} = require('weboptimizer')\n\nawait main('./', './', ['clear'])",
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@babel/core": "^7.26.
|
|
91
|
+
"@babel/core": "^7.26.9",
|
|
92
92
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
93
93
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
94
94
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
|
|
95
95
|
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
|
96
|
-
"@babel/plugin-transform-runtime": "^7.26.
|
|
97
|
-
"@babel/preset-env": "^7.26.
|
|
96
|
+
"@babel/plugin-transform-runtime": "^7.26.9",
|
|
97
|
+
"@babel/preset-env": "^7.26.9",
|
|
98
98
|
"@babel/preset-typescript": "^7.26.0",
|
|
99
|
-
"@babel/runtime": "^7.26.
|
|
99
|
+
"@babel/runtime": "^7.26.9",
|
|
100
100
|
"babel-loader": "^9.2.1",
|
|
101
101
|
"babel-plugin-transform-modern-regexp": "^0.0.6",
|
|
102
102
|
"babel-preset-minify": "^0.5.2",
|
|
103
|
-
"clientnode": "3.0.
|
|
103
|
+
"clientnode": "3.0.1271",
|
|
104
104
|
"ejs": "^3.1.10",
|
|
105
105
|
"exports-loader": "^5.0.0",
|
|
106
106
|
"extract-loader": "^5.1.0",
|
|
@@ -113,46 +113,46 @@
|
|
|
113
113
|
"rimraf": "^6.0.1",
|
|
114
114
|
"script-loader": "^0.7.2",
|
|
115
115
|
"typescript": "^5.7.3",
|
|
116
|
-
"webpack": "^5.
|
|
116
|
+
"webpack": "^5.98.0",
|
|
117
117
|
"webpack-cli": "^6.0.1",
|
|
118
118
|
"webpack-sources": "^3.2.3"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@babel/cli": "^7.26.4",
|
|
122
122
|
"@babel/eslint-parser": "^7.26.8",
|
|
123
|
-
"@stylistic/eslint-plugin": "^
|
|
124
|
-
"@stylistic/eslint-plugin-ts": "^
|
|
123
|
+
"@stylistic/eslint-plugin": "^4.0.1",
|
|
124
|
+
"@stylistic/eslint-plugin-ts": "^4.0.1",
|
|
125
125
|
"@types/ejs": "^3.1.5",
|
|
126
126
|
"@types/eslint": "^9.6.1",
|
|
127
127
|
"@types/html-minifier": "^4.0.5",
|
|
128
128
|
"@types/html-minifier-terser": "^7.0.2",
|
|
129
129
|
"@types/imagemin": "^9.0.1",
|
|
130
|
-
"@types/node": "^22.13.
|
|
130
|
+
"@types/node": "^22.13.4",
|
|
131
131
|
"@types/postcss-import": "^14.0.3",
|
|
132
132
|
"@types/postcss-url": "^10.0.4",
|
|
133
133
|
"@types/webpack-env": "^1.18.8",
|
|
134
134
|
"@types/webpack-sources": "^3.2.3",
|
|
135
|
-
"@typescript-eslint/parser": "^8.24.
|
|
135
|
+
"@typescript-eslint/parser": "^8.24.1",
|
|
136
136
|
"css-loader": "^7.1.2",
|
|
137
137
|
"cssnano": "^7.0.6",
|
|
138
|
-
"documentation-website": "^1.0.
|
|
138
|
+
"documentation-website": "^1.0.344",
|
|
139
139
|
"eslint": "^9.20.1",
|
|
140
140
|
"eslint-config-google": "^0.14.0",
|
|
141
141
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
142
142
|
"favicons": "^7.2.0",
|
|
143
143
|
"favicons-webpack-plugin": "^6.0.1",
|
|
144
|
-
"globals": "^15.
|
|
144
|
+
"globals": "^15.15.0",
|
|
145
145
|
"image-minimizer-webpack-plugin": "^4.1.3",
|
|
146
146
|
"jest": "^29.7.0",
|
|
147
147
|
"jsdoc": "^4.0.4",
|
|
148
148
|
"mini-css-extract-plugin": "^2.9.2",
|
|
149
149
|
"mkdirp": "^3.0.1",
|
|
150
150
|
"node-fetch": "^3.3.2",
|
|
151
|
-
"postcss": "^8.5.
|
|
151
|
+
"postcss": "^8.5.3",
|
|
152
152
|
"postcss-fontpath": "^1.0.0",
|
|
153
153
|
"postcss-import": "^16.1.0",
|
|
154
154
|
"postcss-loader": "^8.1.1",
|
|
155
|
-
"postcss-preset-env": "^10.1.
|
|
155
|
+
"postcss-preset-env": "^10.1.4",
|
|
156
156
|
"postcss-sprites": "^4.2.1",
|
|
157
157
|
"postcss-url": "^10.1.3",
|
|
158
158
|
"shx": "^0.3.4",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"stylelint": "^16.14.1",
|
|
161
161
|
"stylelint-config-standard": "^37.0.0",
|
|
162
162
|
"stylelint-config-standard-scss": "^14.0.0",
|
|
163
|
-
"typescript-eslint": "^8.24.
|
|
163
|
+
"typescript-eslint": "^8.24.1",
|
|
164
164
|
"typescript-plugin-css-modules": "^5.1.0",
|
|
165
165
|
"workbox-webpack-plugin": "^7.3.0"
|
|
166
166
|
},
|
|
@@ -1099,7 +1099,7 @@
|
|
|
1099
1099
|
},
|
|
1100
1100
|
"compress": {
|
|
1101
1101
|
"html": {
|
|
1102
|
-
"__evaluate__": "self.module.optimizer.htmlMinifier"
|
|
1102
|
+
"__evaluate__": "type && type.includes('html') && self.module.optimizer.htmlMinifier"
|
|
1103
1103
|
},
|
|
1104
1104
|
"javaScript": {
|
|
1105
1105
|
"__evaluate__": "self.module.optimizer.babelMinify.module"
|
package/webpackConfigurator.js
CHANGED
|
@@ -593,23 +593,34 @@ var scope = {
|
|
|
593
593
|
require: currentRequire !== null && currentRequire !== void 0 ? currentRequire : require
|
|
594
594
|
};
|
|
595
595
|
var evaluateAnThrow = function evaluateAnThrow(object) {
|
|
596
|
-
var
|
|
596
|
+
var givenOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
597
|
+
var options = _objectSpread({
|
|
598
|
+
filePath: configuration.path.context
|
|
599
|
+
}, givenOptions);
|
|
597
600
|
if (typeof object === 'string') {
|
|
598
|
-
var evaluated = (0, _clientnode.evaluate)(object, _objectSpread({
|
|
599
|
-
filePath: filePath
|
|
600
|
-
}, scope)
|
|
601
|
+
var evaluated = (0, _clientnode.evaluate)(object, _objectSpread(_objectSpread({
|
|
602
|
+
filePath: options.filePath
|
|
603
|
+
}, scope), {}, {
|
|
604
|
+
type: options.type
|
|
605
|
+
}));
|
|
601
606
|
if (evaluated.error) throw new Error('Error occurred during processing given expression: ' + evaluated.error);
|
|
602
607
|
return evaluated.result;
|
|
603
608
|
}
|
|
604
609
|
return object;
|
|
605
610
|
};
|
|
606
|
-
var
|
|
607
|
-
return
|
|
611
|
+
var createEvaluateMapper = function createEvaluateMapper(type) {
|
|
612
|
+
return function (value) {
|
|
613
|
+
return evaluateAnThrow(value, {
|
|
614
|
+
type: type
|
|
615
|
+
});
|
|
616
|
+
};
|
|
608
617
|
};
|
|
609
618
|
var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderConfiguration(loaderConfiguration) {
|
|
610
619
|
return {
|
|
611
620
|
exclude: function exclude(filePath) {
|
|
612
|
-
return evaluateAnThrow(loaderConfiguration.exclude,
|
|
621
|
+
return evaluateAnThrow(loaderConfiguration.exclude, {
|
|
622
|
+
filePath: filePath
|
|
623
|
+
});
|
|
613
624
|
},
|
|
614
625
|
include: loaderConfiguration.include && evaluateAnThrow(loaderConfiguration.include) || configuration.path.source.base,
|
|
615
626
|
test: new RegExp(evaluateAnThrow(loaderConfiguration.test)),
|
|
@@ -619,7 +630,7 @@ var evaluateAdditionalLoaderConfiguration = function evaluateAdditionalLoaderCon
|
|
|
619
630
|
var getIncludingPaths = function getIncludingPaths(path) {
|
|
620
631
|
return (0, _helper.normalizePaths)([path].concat(_module.locations.directoryPaths));
|
|
621
632
|
};
|
|
622
|
-
var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(
|
|
633
|
+
var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(createEvaluateMapper('css')).concat({
|
|
623
634
|
loader: _module.style.loader,
|
|
624
635
|
options: _module.style.options || {}
|
|
625
636
|
}, {
|
|
@@ -636,7 +647,7 @@ var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(evaluat
|
|
|
636
647
|
*/
|
|
637
648
|
plugins: [].concat(postcssImport ? postcssImport({
|
|
638
649
|
root: configuration.path.context
|
|
639
|
-
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.pre.map(
|
|
650
|
+
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.pre.map(createEvaluateMapper('css.postcss')),
|
|
640
651
|
/*
|
|
641
652
|
NOTE: Checking path doesn't work if fonts
|
|
642
653
|
are referenced in libraries provided in
|
|
@@ -681,10 +692,10 @@ var cssUse = _module.preprocessor.cascadingStyleSheet.additional.pre.map(evaluat
|
|
|
681
692
|
},
|
|
682
693
|
stylesheetPath: configuration.path.source.asset.cascadingStyleSheet,
|
|
683
694
|
spritePath: configuration.path.source.asset.image
|
|
684
|
-
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.post.map(
|
|
695
|
+
}) : [], _module.preprocessor.cascadingStyleSheet.additional.plugins.post.map(createEvaluateMapper('css.postcss')), _module.optimizer.cssnano && postcssCSSnano ? postcssCSSnano(_module.optimizer.cssnano) : [])
|
|
685
696
|
}
|
|
686
697
|
} : {}, _module.preprocessor.cascadingStyleSheet.options || {})
|
|
687
|
-
} : [], _module.preprocessor.cascadingStyleSheet.additional.post.map(
|
|
698
|
+
} : [], _module.preprocessor.cascadingStyleSheet.additional.post.map(createEvaluateMapper('css')));
|
|
688
699
|
var genericLoader = {
|
|
689
700
|
// Convert to compatible native web types.
|
|
690
701
|
// region generic template
|
|
@@ -692,29 +703,31 @@ var genericLoader = {
|
|
|
692
703
|
exclude: function exclude(filePath) {
|
|
693
704
|
return (0, _helper.normalizePaths)(configuration.files.html.concat(configuration.files.defaultHTML).map(function (htmlConfiguration) {
|
|
694
705
|
return htmlConfiguration.template.filePath;
|
|
695
|
-
})).includes(filePath) || _module.preprocessor.ejs.exclude === null ? false : evaluateAnThrow(_module.preprocessor.ejs.exclude,
|
|
706
|
+
})).includes(filePath) || _module.preprocessor.ejs.exclude === null ? false : evaluateAnThrow(_module.preprocessor.ejs.exclude, {
|
|
707
|
+
filePath: filePath
|
|
708
|
+
});
|
|
696
709
|
},
|
|
697
710
|
include: getIncludingPaths(configuration.path.source.asset.template),
|
|
698
711
|
test: /^(?!.+\.html\.ejs$).+\.ejs$/i,
|
|
699
|
-
use: _module.preprocessor.ejs.additional.pre.map(
|
|
700
|
-
loader: 'file?name=[path][name]' + (((0, _clientnode.isPlainObject)(_module.preprocessor.ejs.options) ? _module.preprocessor.ejs.options : {
|
|
701
|
-
compileSteps: 2
|
|
702
|
-
}).compileSteps % 2 ? '.js' : '') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
703
|
-
}, {
|
|
704
|
-
loader: 'extract'
|
|
705
|
-
}, {
|
|
712
|
+
use: _module.preprocessor.ejs.additional.pre.map(createEvaluateMapper('ejs')).concat({
|
|
706
713
|
loader: _module.preprocessor.ejs.loader,
|
|
707
714
|
options: _module.preprocessor.ejs.options || {}
|
|
708
|
-
}, _module.preprocessor.ejs.additional.post.map(
|
|
715
|
+
}, _module.preprocessor.ejs.additional.post.map(createEvaluateMapper('ejs')))
|
|
709
716
|
},
|
|
710
717
|
// endregion
|
|
711
718
|
// region script
|
|
712
719
|
script: {
|
|
713
720
|
exclude: function exclude(filePath) {
|
|
714
|
-
return evaluateAnThrow(_module.preprocessor.javaScript.exclude,
|
|
721
|
+
return evaluateAnThrow(_module.preprocessor.javaScript.exclude, {
|
|
722
|
+
filePath: filePath,
|
|
723
|
+
type: 'script'
|
|
724
|
+
});
|
|
715
725
|
},
|
|
716
726
|
include: function include(filePath) {
|
|
717
|
-
var result = evaluateAnThrow(_module.preprocessor.javaScript.include,
|
|
727
|
+
var result = evaluateAnThrow(_module.preprocessor.javaScript.include, {
|
|
728
|
+
filePath: filePath,
|
|
729
|
+
type: 'script'
|
|
730
|
+
});
|
|
718
731
|
if ([null, undefined].includes(result)) {
|
|
719
732
|
var _iterator10 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.javaScript)),
|
|
720
733
|
_step10;
|
|
@@ -733,10 +746,10 @@ var genericLoader = {
|
|
|
733
746
|
return Boolean(result);
|
|
734
747
|
},
|
|
735
748
|
test: new RegExp(_module.preprocessor.javaScript.regularExpression, 'i'),
|
|
736
|
-
use: _module.preprocessor.javaScript.additional.pre.map(
|
|
749
|
+
use: _module.preprocessor.javaScript.additional.pre.map(createEvaluateMapper('script')).concat({
|
|
737
750
|
loader: _module.preprocessor.javaScript.loader,
|
|
738
751
|
options: _module.preprocessor.javaScript.options || {}
|
|
739
|
-
}, _module.preprocessor.javaScript.additional.post.map(
|
|
752
|
+
}, _module.preprocessor.javaScript.additional.post.map(createEvaluateMapper('script')))
|
|
740
753
|
},
|
|
741
754
|
// endregion
|
|
742
755
|
// region html template
|
|
@@ -750,15 +763,21 @@ var genericLoader = {
|
|
|
750
763
|
exclude: function exclude(filePath) {
|
|
751
764
|
return (0, _helper.normalizePaths)(configuration.files.html.concat(configuration.files.defaultHTML).map(function (htmlConfiguration) {
|
|
752
765
|
return htmlConfiguration.template.filePath;
|
|
753
|
-
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : evaluateAnThrow(_module.preprocessor.html.exclude,
|
|
766
|
+
})).includes(filePath) || (_module.preprocessor.html.exclude === null ? false : evaluateAnThrow(_module.preprocessor.html.exclude, {
|
|
767
|
+
filePath: filePath,
|
|
768
|
+
type: 'html.ejs'
|
|
769
|
+
}));
|
|
754
770
|
},
|
|
755
771
|
include: configuration.path.source.asset.template,
|
|
756
772
|
test: /\.html\.ejs(?: \?.*)?$/i,
|
|
757
|
-
use: _module.preprocessor.html.additional.pre.map(
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
773
|
+
use: _module.preprocessor.html.additional.pre.map(createEvaluateMapper('html.ejs')).concat(
|
|
774
|
+
/*
|
|
775
|
+
We might need to evaluate ejs before we are able to
|
|
776
|
+
parse html beforhand. If not we parse it as html
|
|
777
|
+
directly.
|
|
778
|
+
*/
|
|
779
|
+
|
|
780
|
+
((0, _clientnode.isPlainObject)(_module.preprocessor.html.options) ? _module.preprocessor.html.options : {
|
|
762
781
|
compileSteps: 2
|
|
763
782
|
}).compileSteps % 2 ? [] : [{
|
|
764
783
|
loader: 'extract'
|
|
@@ -768,24 +787,27 @@ var genericLoader = {
|
|
|
768
787
|
}], {
|
|
769
788
|
loader: _module.preprocessor.html.loader,
|
|
770
789
|
options: _module.preprocessor.html.options || {}
|
|
771
|
-
}, _module.preprocessor.html.additional.post.map(
|
|
790
|
+
}, _module.preprocessor.html.additional.post.map(createEvaluateMapper('html.ejs')))
|
|
772
791
|
},
|
|
773
792
|
html: {
|
|
774
793
|
exclude: function exclude(filePath) {
|
|
775
794
|
return (0, _helper.normalizePaths)(configuration.files.html.concat(configuration.files.defaultHTML).map(function (htmlConfiguration) {
|
|
776
795
|
return htmlConfiguration.template.filePath;
|
|
777
|
-
})).includes(filePath) || (_module.html.exclude === null ? true : evaluateAnThrow(_module.html.exclude,
|
|
796
|
+
})).includes(filePath) || (_module.html.exclude === null ? true : evaluateAnThrow(_module.html.exclude, {
|
|
797
|
+
filePath: filePath,
|
|
798
|
+
type: 'html'
|
|
799
|
+
}));
|
|
778
800
|
},
|
|
779
801
|
include: configuration.path.source.asset.template,
|
|
780
802
|
test: /\.html(?: \?.*)?$/i,
|
|
781
|
-
use: _module.html.additional.pre.map(
|
|
803
|
+
use: _module.html.additional.pre.map(createEvaluateMapper('html')).concat({
|
|
782
804
|
loader: 'file?name=' + (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.template), "[name][ext]?".concat(configuration.hashAlgorithm, "=") + '[contenthash]')
|
|
783
805
|
}, {
|
|
784
806
|
loader: 'extract'
|
|
785
807
|
}, {
|
|
786
808
|
loader: _module.html.loader,
|
|
787
809
|
options: _module.html.options || {}
|
|
788
|
-
}, _module.html.additional.post.map(
|
|
810
|
+
}, _module.html.additional.post.map(createEvaluateMapper('html')))
|
|
789
811
|
}
|
|
790
812
|
},
|
|
791
813
|
// endregion
|
|
@@ -793,10 +815,16 @@ var genericLoader = {
|
|
|
793
815
|
// region style
|
|
794
816
|
style: {
|
|
795
817
|
exclude: function exclude(filePath) {
|
|
796
|
-
return _module.cascadingStyleSheet.exclude === null ? isFilePathInDependencies(filePath) : evaluateAnThrow(_module.cascadingStyleSheet.exclude,
|
|
818
|
+
return _module.cascadingStyleSheet.exclude === null ? isFilePathInDependencies(filePath) : evaluateAnThrow(_module.cascadingStyleSheet.exclude, {
|
|
819
|
+
filePath: filePath,
|
|
820
|
+
type: 'style'
|
|
821
|
+
});
|
|
797
822
|
},
|
|
798
823
|
include: function include(filePath) {
|
|
799
|
-
var result = evaluateAnThrow(_module.cascadingStyleSheet.include,
|
|
824
|
+
var result = evaluateAnThrow(_module.cascadingStyleSheet.include, {
|
|
825
|
+
filePath: filePath,
|
|
826
|
+
type: 'style'
|
|
827
|
+
});
|
|
800
828
|
if ([null, undefined].includes(result)) {
|
|
801
829
|
var _iterator11 = _createForOfIteratorHelper(getIncludingPaths(configuration.path.source.asset.cascadingStyleSheet)),
|
|
802
830
|
_step11;
|
|
@@ -823,7 +851,10 @@ var genericLoader = {
|
|
|
823
851
|
font: {
|
|
824
852
|
eot: {
|
|
825
853
|
exclude: function exclude(filePath) {
|
|
826
|
-
return _module.optimizer.font.eot.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.eot.exclude,
|
|
854
|
+
return _module.optimizer.font.eot.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.eot.exclude, {
|
|
855
|
+
filePath: filePath,
|
|
856
|
+
type: 'font.eot'
|
|
857
|
+
});
|
|
827
858
|
},
|
|
828
859
|
generator: {
|
|
829
860
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -835,11 +866,14 @@ var genericLoader = {
|
|
|
835
866
|
maxSize: configuration.inPlace.otherMaximumFileSizeLimitInByte
|
|
836
867
|
}
|
|
837
868
|
},
|
|
838
|
-
use: _module.optimizer.font.eot.loader.map(
|
|
869
|
+
use: _module.optimizer.font.eot.loader.map(createEvaluateMapper('font.eot'))
|
|
839
870
|
},
|
|
840
871
|
svg: {
|
|
841
872
|
exclude: function exclude(filePath) {
|
|
842
|
-
return _module.optimizer.font.svg.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.svg.exclude,
|
|
873
|
+
return _module.optimizer.font.svg.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.svg.exclude, {
|
|
874
|
+
filePath: filePath,
|
|
875
|
+
type: 'svg'
|
|
876
|
+
});
|
|
843
877
|
},
|
|
844
878
|
include: configuration.path.source.asset.font,
|
|
845
879
|
generator: {
|
|
@@ -853,11 +887,14 @@ var genericLoader = {
|
|
|
853
887
|
},
|
|
854
888
|
test: /\.svg(?: \?.*)?$/i,
|
|
855
889
|
type: 'asset/resource',
|
|
856
|
-
use: _module.optimizer.font.svg.loader.map(
|
|
890
|
+
use: _module.optimizer.font.svg.loader.map(createEvaluateMapper('font.svg'))
|
|
857
891
|
},
|
|
858
892
|
ttf: {
|
|
859
893
|
exclude: function exclude(filePath) {
|
|
860
|
-
return _module.optimizer.font.ttf.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.ttf.exclude,
|
|
894
|
+
return _module.optimizer.font.ttf.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.ttf.exclude, {
|
|
895
|
+
filePath: filePath,
|
|
896
|
+
type: 'ttf'
|
|
897
|
+
});
|
|
861
898
|
},
|
|
862
899
|
generator: {
|
|
863
900
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -870,11 +907,14 @@ var genericLoader = {
|
|
|
870
907
|
maxSize: configuration.inPlace.otherMaximumFileSizeLimitInByte
|
|
871
908
|
}
|
|
872
909
|
},
|
|
873
|
-
use: _module.optimizer.font.ttf.loader.map(
|
|
910
|
+
use: _module.optimizer.font.ttf.loader.map(createEvaluateMapper('font.ttf'))
|
|
874
911
|
},
|
|
875
912
|
woff: {
|
|
876
913
|
exclude: function exclude(filePath) {
|
|
877
|
-
return _module.optimizer.font.woff.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.woff.exclude,
|
|
914
|
+
return _module.optimizer.font.woff.exclude === null ? false : evaluateAnThrow(_module.optimizer.font.woff.exclude, {
|
|
915
|
+
filePath: filePath,
|
|
916
|
+
type: 'woff'
|
|
917
|
+
});
|
|
878
918
|
},
|
|
879
919
|
generator: {
|
|
880
920
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.font), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -886,14 +926,17 @@ var genericLoader = {
|
|
|
886
926
|
maxSize: configuration.inPlace.otherMaximumFileSizeLimitInByte
|
|
887
927
|
}
|
|
888
928
|
},
|
|
889
|
-
use: _module.optimizer.font.woff.loader.map(
|
|
929
|
+
use: _module.optimizer.font.woff.loader.map(createEvaluateMapper('font.woff'))
|
|
890
930
|
}
|
|
891
931
|
},
|
|
892
932
|
// endregion
|
|
893
933
|
// region image
|
|
894
934
|
image: {
|
|
895
935
|
exclude: function exclude(filePath) {
|
|
896
|
-
return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : evaluateAnThrow(_module.optimizer.image.exclude,
|
|
936
|
+
return _module.optimizer.image.exclude === null ? isFilePathInDependencies(filePath) : evaluateAnThrow(_module.optimizer.image.exclude, {
|
|
937
|
+
filePath: filePath,
|
|
938
|
+
type: 'image'
|
|
939
|
+
});
|
|
897
940
|
},
|
|
898
941
|
generator: {
|
|
899
942
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.image), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -906,14 +949,17 @@ var genericLoader = {
|
|
|
906
949
|
maxSize: configuration.inPlace.otherMaximumFileSizeLimitInByte
|
|
907
950
|
}
|
|
908
951
|
},
|
|
909
|
-
use: _module.optimizer.image.loader.map(
|
|
952
|
+
use: _module.optimizer.image.loader.map(createEvaluateMapper('image'))
|
|
910
953
|
},
|
|
911
954
|
// endregion
|
|
912
955
|
// region data
|
|
913
956
|
data: {
|
|
914
957
|
exclude: function exclude(filePath) {
|
|
915
958
|
if (typeof filePath !== 'string') return false;
|
|
916
|
-
return configuration.extensions.file.internal.includes((0, _path.extname)((0, _helper.stripLoader)(filePath))) || (_module.optimizer.data.exclude === null ? isFilePathInDependencies(filePath) : evaluateAnThrow(_module.optimizer.data.exclude,
|
|
959
|
+
return configuration.extensions.file.internal.includes((0, _path.extname)((0, _helper.stripLoader)(filePath))) || (_module.optimizer.data.exclude === null ? isFilePathInDependencies(filePath) : evaluateAnThrow(_module.optimizer.data.exclude, {
|
|
960
|
+
filePath: filePath,
|
|
961
|
+
type: 'data'
|
|
962
|
+
}));
|
|
917
963
|
},
|
|
918
964
|
generator: {
|
|
919
965
|
filename: (0, _path.join)((0, _path.relative)(configuration.path.target.base, configuration.path.target.asset.data), '[name][ext]') + "?".concat(configuration.hashAlgorithm, "=[contenthash]")
|
|
@@ -925,7 +971,7 @@ var genericLoader = {
|
|
|
925
971
|
maxSize: configuration.inPlace.otherMaximumFileSizeLimitInByte
|
|
926
972
|
}
|
|
927
973
|
},
|
|
928
|
-
use: _module.optimizer.data.loader.map(
|
|
974
|
+
use: _module.optimizer.data.loader.map(createEvaluateMapper('data'))
|
|
929
975
|
}
|
|
930
976
|
// endregion
|
|
931
977
|
};
|