weboptimizer 4.0.95-1 → 4.0.96-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/configurator.js +6 -2
- package/dist/ejsLoader.js +1 -1
- package/dist/helper.js +9 -1
- package/dist/plugins/InPlaceAssetsIntoHTML.js +11 -2
- package/package.json +3 -3
package/dist/configurator.js
CHANGED
|
@@ -89,11 +89,15 @@ environment = eval('process.env')) => {
|
|
|
89
89
|
// region load application specific configuration
|
|
90
90
|
let specificConfiguration = {};
|
|
91
91
|
try {
|
|
92
|
-
|
|
92
|
+
/*
|
|
93
|
+
NOTE: Imported modules are cached so we have to copy to avoid
|
|
94
|
+
leaking task specific merges into subsequent loads.
|
|
95
|
+
*/
|
|
96
|
+
specificConfiguration = copy((await optionalImport(join(metaConfiguration.default.path.context, 'package.json'), {
|
|
93
97
|
with: {
|
|
94
98
|
type: 'json'
|
|
95
99
|
}
|
|
96
|
-
})).default;
|
|
100
|
+
})).default);
|
|
97
101
|
} catch {
|
|
98
102
|
metaConfiguration.default.path.context = currentWorkingDirectory;
|
|
99
103
|
}
|
package/dist/ejsLoader.js
CHANGED
|
@@ -257,7 +257,7 @@ export const loader = async function (source) {
|
|
|
257
257
|
return `${options.strict ? `'use strict';\n` : ''}${result}`;
|
|
258
258
|
}
|
|
259
259
|
if (typeof result === 'string') {
|
|
260
|
-
result = result.replace(new RegExp(`<script +processing-workaround *` + `(
|
|
260
|
+
result = result.replace(new RegExp(`<script +processing-workaround *` + `(?:= *(?:" *"|' *') *)?>([\\s\\S]*?)</ *script *>`, 'ig'), '$1').replace(new RegExp(`<script +processing(-+)-workaround *` + `(?:= *(?:" *"|' *') *)?>([\\s\\S]*?)</ *script *>`, 'ig'), '<script processing$1workaround>$2</script>');
|
|
261
261
|
return result;
|
|
262
262
|
}
|
|
263
263
|
return '';
|
package/dist/helper.js
CHANGED
|
@@ -38,7 +38,15 @@ export const log = new Logger({
|
|
|
38
38
|
* "false" otherwise.
|
|
39
39
|
*/
|
|
40
40
|
export const isFilePathInLocation = (filePath, locationsToCheck) => {
|
|
41
|
-
|
|
41
|
+
filePath = resolve(filePath);
|
|
42
|
+
for (const pathToCheck of locationsToCheck) {
|
|
43
|
+
const location = resolve(pathToCheck);
|
|
44
|
+
/*
|
|
45
|
+
NOTE: Only match whole path segments to avoid treating sibling
|
|
46
|
+
locations sharing a prefix (e.g. ".github" vs. ".git") as nested.
|
|
47
|
+
*/
|
|
48
|
+
if (filePath === location || filePath.startsWith(location.endsWith(sep) ? location : `${location}${sep}`)) return true;
|
|
49
|
+
}
|
|
42
50
|
return false;
|
|
43
51
|
};
|
|
44
52
|
// endregion
|
|
@@ -41,12 +41,19 @@ export class InPlaceAssetsIntoHTML {
|
|
|
41
41
|
const inPlace = (type, tag) => {
|
|
42
42
|
let settings = null;
|
|
43
43
|
let url = false;
|
|
44
|
+
let tagName = 'script';
|
|
44
45
|
if (tag.tagName === 'script') {
|
|
45
46
|
settings = this.options.javaScript;
|
|
46
47
|
url = tag.attributes.src;
|
|
47
|
-
} else if (tag.tagName === '
|
|
48
|
+
} else if (tag.tagName === 'link' && tag.attributes.rel === 'stylesheet') {
|
|
49
|
+
/*
|
|
50
|
+
NOTE: Style sheets are referenced via
|
|
51
|
+
"link" tags and have to be in placed as
|
|
52
|
+
"style" tags.
|
|
53
|
+
*/
|
|
48
54
|
settings = this.options.cascadingStyleSheet;
|
|
49
55
|
url = tag.attributes.href;
|
|
56
|
+
tagName = 'style';
|
|
50
57
|
}
|
|
51
58
|
if (!(url && typeof url === 'string')) return tag;
|
|
52
59
|
const name = publicPath ? url.replace(publicPath, '') : url;
|
|
@@ -55,13 +62,15 @@ export class InPlaceAssetsIntoHTML {
|
|
|
55
62
|
...tag.attributes
|
|
56
63
|
};
|
|
57
64
|
delete newAttributes.href;
|
|
65
|
+
delete newAttributes.rel;
|
|
58
66
|
delete newAttributes.src;
|
|
59
67
|
inPlacedAssetNames.push(name);
|
|
60
68
|
return {
|
|
61
69
|
...tag,
|
|
62
70
|
attributes: newAttributes,
|
|
63
71
|
innerHTML: compilation.assets[name].source(),
|
|
64
|
-
tagName
|
|
72
|
+
tagName,
|
|
73
|
+
voidTag: false
|
|
65
74
|
};
|
|
66
75
|
}
|
|
67
76
|
return tag;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.96-1",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"lint:base": "eslint --config dist/eslint.config.js --no-warn-ignored src/*.ts src/*/*.ts src/test/*/*.ts",
|
|
70
70
|
"prepare": "yarn build",
|
|
71
71
|
"prettify": "yarn lint:base --fix || true",
|
|
72
|
-
"test": "yarn build:test && node --experimental-vm-modules node_modules/.bin/jest --config ./weboptimizerJest.json --noStackTrace --root-dir './' --test-regex '/dist/test/.+\\\\.js$' dist/test/browser.js dist/test/configurator.js dist/test/ejsLoader.js dist/test/helper.js dist/test/stylelintConfigurator.js dist/test/index.js dist/test/webpackConfigurator.js",
|
|
72
|
+
"test": "yarn build:test && node --experimental-vm-modules node_modules/.bin/jest --config ./weboptimizerJest.json --noStackTrace --root-dir './' --test-regex '/dist/test/.+\\\\.js$' dist/test/browser.js dist/test/configurator.js dist/test/ejsLoader.js dist/test/helper.js dist/test/HTMLTransformation.js dist/test/InPlaceAssetsIntoHTML.js dist/test/stylelintConfigurator.js dist/test/index.js dist/test/webpackConfigurator.js",
|
|
73
73
|
"test:coverage": "yarn test --ci --coverage --coverageReporters=text --coverageReporters=text-summary --silent --testLocationInResults",
|
|
74
74
|
"test:coverage:report": "yarn test:coverage --coverageDirectory=.coverage --coverageReporters=lcov --outputFile=lcov.info",
|
|
75
75
|
"test:watch": "yarn test --watch",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"babel-loader": "^10.1.1",
|
|
88
88
|
"babel-plugin-polyfill-corejs3": "^1.0.0",
|
|
89
89
|
"babel-plugin-transform-rewrite-imports": "^1.5.4",
|
|
90
|
-
"clientnode": "4.0.
|
|
90
|
+
"clientnode": "4.0.1527",
|
|
91
91
|
"core-js": "^3.51.0",
|
|
92
92
|
"ejs": "^7.0.2",
|
|
93
93
|
"exports-loader": "^5.0.0",
|