weboptimizer 3.0.5 → 3.0.7

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/ejsLoader.d.ts CHANGED
@@ -2,8 +2,7 @@ import { Encoding, Mapping } from 'clientnode';
2
2
  import { Options, TemplateFunction as EJSTemplateFunction } from 'ejs';
3
3
  import { LoaderContext } from 'webpack';
4
4
  import { Extensions, Replacements } from './type';
5
- export type PreCompiledTemplateFunction = ((..._parameters: Array<unknown>) => string);
6
- export type TemplateFunction = EJSTemplateFunction | PreCompiledTemplateFunction;
5
+ export type TemplateFunction = EJSTemplateFunction;
7
6
  export type CompilerOptions = Options & {
8
7
  encoding: Encoding;
9
8
  isString?: boolean;
package/ejsLoader.js CHANGED
@@ -21,8 +21,6 @@ Object.defineProperty(exports, "__esModule", {
21
21
  value: true
22
22
  });
23
23
  exports.loader = exports["default"] = void 0;
24
- var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
25
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
26
24
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
25
  var _core = require("@babel/core");
28
26
  var _babelPresetMinify = _interopRequireDefault(require("babel-preset-minify"));
@@ -146,8 +144,6 @@ var loader = exports.loader = function loader(source) {
146
144
  delete options.isString;
147
145
  var stepLocals;
148
146
  var scope = {};
149
- var originalScopeNames = [];
150
- var scopeNames = [];
151
147
  for (var step = 1; step <= compileSteps; step += 1) {
152
148
  // On every odd compile step we have to determine the environment.
153
149
  if (step % 2) {
@@ -160,10 +156,6 @@ var loader = exports.loader = function loader(source) {
160
156
  include: require,
161
157
  require: require
162
158
  }, Array.isArray(stepLocals) ? {} : stepLocals);else if (!Array.isArray(stepLocals)) scope = stepLocals;
163
- originalScopeNames = Array.isArray(stepLocals) ? stepLocals : Object.keys(scope);
164
- scopeNames = originalScopeNames.map(function (name) {
165
- return (0, _clientnode.convertToValidVariableName)(name);
166
- });
167
159
  // endregion
168
160
  }
169
161
  if (typeof result === 'string') {
@@ -181,23 +173,11 @@ var loader = exports.loader = function loader(source) {
181
173
  // NOTE: Needed to manipulate code after compiling.
182
174
  options.client = true;
183
175
  result = _ejs["default"].compile(result, options);
184
-
185
- /*
186
- Provide all scope names when "_with" options isn't
187
- enabled
188
- */
189
- if (options.strict || !options._with) {
190
- var localsName = options.localsName || 'locals';
191
- while (scopeNames.includes(localsName)) localsName = "_".concat(localsName);
192
-
193
- /* eslint-disable @typescript-eslint/no-implied-eval */
194
- result = (0, _construct2["default"])(Function, (0, _toConsumableArray2["default"])(scopeNames).concat([localsName, "return ".concat(result.toString(), "(") + "".concat(localsName, ",") + "".concat(localsName, ".escapeFn,") + "".concat(localsName, ".include,") + "".concat(localsName, ".rethrow)")]));
195
- /* eslint-enable @typescript-eslint/no-implied-eval */
196
- }
197
176
  }
198
- } else result = compressHTML(!options.strict && options._with ? result(scope, scope.escapeFn, scope.include) : result.apply(void 0, (0, _toConsumableArray2["default"])(originalScopeNames.map(function (name) {
199
- return scope[name];
200
- }).concat(!options.strict && options._with ? [] : scope))));
177
+ } else {
178
+ result = result(scope);
179
+ result = compressHTML(result);
180
+ }
201
181
  }
202
182
  if (compileSteps % 2) {
203
183
  var _givenOptions$compres2, _givenOptions$compres3, _givenOptions$compres4, _givenOptions$compres5;
package/index.html.ejs CHANGED
@@ -15,18 +15,18 @@
15
15
  <head>
16
16
  <meta charset="utf-8">
17
17
  <%_ if (
18
- 2 < configuration.givenCommandLineArguments.length &&
18
+ 2 < _.configuration.givenCommandLineArguments.length &&
19
19
  ['serve', 'test', 'test:browser'].includes(
20
- configuration.givenCommandLineArguments[2]
20
+ _.configuration.givenCommandLineArguments[2]
21
21
  )
22
22
  ) { _%>
23
23
  <!--Prevent browser caching-->
24
24
  <meta http-equiv="cache-control" content="no-cache">
25
25
  <meta http-equiv="expires" content="0">
26
26
  <meta http-equiv="pragma" content="no-cache">
27
- <title><%- configuration.name %> - test</title>
27
+ <title><%- _.configuration.name %> - test</title>
28
28
  <%_ } else { _%>
29
- <title><%- configuration.name %></title>
29
+ <title><%- _.configuration.name %></title>
30
30
  <%_ } _%>
31
31
  <script>
32
32
  window.document.documentElement.className =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -77,7 +77,7 @@
77
77
  "lint:base": "eslint --no-warn-ignored *.ts */*.ts test/*/*.ts",
78
78
  "prepare": "yarn build",
79
79
  "prettify": "yarn lint:base --fix || true",
80
- "test": "yarn build:test && jest --config ./jest.json --noStackTrace --root-dir './' --test-regex '/test/.+\\\\.js$' test/browser.js test/configurator.js test/helper.js test/ejsLoader.js test/stylelintConfigurator.js test/index.js test/webpackConfigurator.js",
80
+ "test": "yarn build:test && jest --config ./weboptimizerJest.json --noStackTrace --root-dir './' --test-regex '/test/.+\\\\.js$' test/browser.js test/configurator.js test/helper.js test/ejsLoader.js test/stylelintConfigurator.js test/index.js test/webpackConfigurator.js",
81
81
  "test:coverage": "yarn test --ci --coverage --coverageReporters=text --coverageReporters=text-summary --silent --testLocationInResults",
82
82
  "test:coverage:report": "yarn test:coverage --coverageDirectory=.coverage --coverageReporters=lcov --outputFile=lcov.info",
83
83
  "test:watch": "yarn test --watch",
@@ -136,7 +136,7 @@
136
136
  "documentation-website": "^1.0.401",
137
137
  "eslint": "^10.0.3",
138
138
  "eslint-config-google": "^0.14.0",
139
- "eslint-plugin-jsdoc": "^62.7.1",
139
+ "eslint-plugin-jsdoc": "^62.8.0",
140
140
  "favicons": "^7.2.0",
141
141
  "favicons-webpack-plugin": "^6.0.1",
142
142
  "globals": "^17.4.0",