weboptimizer 4.0.96 → 4.0.97-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.
@@ -89,11 +89,15 @@ environment = eval('process.env')) => {
89
89
  // region load application specific configuration
90
90
  let specificConfiguration = {};
91
91
  try {
92
- specificConfiguration = (await optionalImport(join(metaConfiguration.default.path.context, 'package.json'), {
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 *` + `(?: = *(?: " *"|' *') *)?>([\\s\\S]*?)</ *script *>`, 'ig'), '$1').replace(new RegExp(`<script +processing(-+)-workaround *` + `(?: = *(?: " *"|' *') *)?>([\\s\\S]*?)</ *script *>`, 'ig'), '<script processing$1workaround>$2</script>');
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
- for (const pathToCheck of locationsToCheck) if (resolve(filePath).startsWith(resolve(pathToCheck))) return true;
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
@@ -16,8 +16,8 @@
16
16
  endregion
17
17
  */
18
18
  // region imports
19
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
20
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
21
21
  function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
22
22
  import { copy, extend } from 'clientnode';
23
23
  import HtmlWebpackPlugin from 'html-webpack-plugin';
@@ -16,8 +16,8 @@
16
16
  endregion
17
17
  */
18
18
  // region imports
19
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ function _defineProperty(r, t, o) { return (t = _toPropertyKey(t)) in r ? Object.defineProperty(r, t, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : r[t] = o, r; }
20
+ function _toPropertyKey(r) { var o = _toPrimitive(r, "string"); return "symbol" == typeof o ? o : o + ""; }
21
21
  function _toPrimitive(t, e) { if ("object" != typeof t || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
22
22
  import HtmlWebpackPlugin from 'html-webpack-plugin';
23
23
  // 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 === 'style') {
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: 'script'
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.96",
3
+ "version": "4.0.97-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",
@@ -77,7 +77,7 @@
77
77
  "update:documentation": "web-documentation"
78
78
  },
79
79
  "dependencies": {
80
- "@babel/core": "^8.0.9",
80
+ "@babel/core": "^8.0.10",
81
81
  "@babel/plugin-proposal-decorators": "^8.0.2",
82
82
  "@babel/plugin-transform-class-properties": "^8.0.1",
83
83
  "@babel/plugin-transform-proto-to-assign": "^8.0.1",
@@ -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.1526",
90
+ "clientnode": "4.0.1528",
91
91
  "core-js": "^3.51.0",
92
92
  "ejs": "^7.0.2",
93
93
  "exports-loader": "^5.0.0",
@@ -101,8 +101,8 @@
101
101
  "script-loader": "^0.7.2",
102
102
  "typescript": "npm:@typescript/typescript6@^6.0.2",
103
103
  "webpack": "5.112.2",
104
- "webpack-cli": "^7.2.3",
105
- "webpack-sources": "^3.6.0"
104
+ "webpack-cli": "^7.3.1",
105
+ "webpack-sources": "^3.7.0"
106
106
  },
107
107
  "devDependencies": {
108
108
  "@babel/cli": "^8.0.6",
@@ -122,7 +122,7 @@
122
122
  "@typescript-eslint/parser": "^8.72.1",
123
123
  "css-loader": "^7.1.5",
124
124
  "cssnano": "^9.9.0",
125
- "eslint": "^10.13.0",
125
+ "eslint": "^10.14.0",
126
126
  "eslint-config-google": "^0.14.0",
127
127
  "eslint-plugin-jsdoc": "^65.4.2",
128
128
  "favicons": "^7.3.1",
@@ -138,7 +138,7 @@
138
138
  "postcss-fontpath": "^1.0.0",
139
139
  "postcss-import": "^17.0.1",
140
140
  "postcss-loader": "^8.2.1",
141
- "postcss-preset-env": "^11.6.1",
141
+ "postcss-preset-env": "^11.6.2",
142
142
  "postcss-sprites": "^4.2.1",
143
143
  "postcss-url": "^10.1.4",
144
144
  "shx": "^0.4.0",