weboptimizer 4.0.14 → 4.0.16

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weboptimizer",
3
- "version": "4.0.14",
3
+ "version": "4.0.16",
4
4
  "description": "A generic web optimizer, (module) bundler and development environment.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -123,7 +123,7 @@
123
123
  "@types/html-minifier": "^4.0.6",
124
124
  "@types/html-minifier-terser": "^7.0.2",
125
125
  "@types/imagemin": "^9.0.1",
126
- "@types/node": "^26.1.0",
126
+ "@types/node": "^26.1.1",
127
127
  "@types/postcss-import": "^14.0.3",
128
128
  "@types/postcss-url": "^10.0.4",
129
129
  "@types/webpack-env": "^1.18.8",
@@ -330,6 +330,11 @@
330
330
  },
331
331
  "sideEffects": true,
332
332
  "type": "module",
333
+ "exports": {
334
+ ".": "/.index.js",
335
+ "./browser": "./browser.js",
336
+ "./ejsLoader": "./ejsLoader.js"
337
+ },
333
338
  "webDocumentation": {
334
339
  "trackingCode": "UA-40192634-11"
335
340
  },
@@ -583,11 +588,14 @@
583
588
  },
584
589
  "encoding": "utf-8",
585
590
  "exportFormat": {
591
+ "external": {
592
+ "__evaluate__": "2 < self.givenCommandLineArguments.length && ['document', 'serve'].includes(self.givenCommandLineArguments[2]) ? 'window' : 'module-import'"
593
+ },
586
594
  "globalObject": {
587
595
  "__evaluate__": "2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2] === 'serve' ? 'window' : 'this'"
588
596
  },
589
597
  "self": {
590
- "__evaluate__": "2 < self.givenCommandLineArguments.length && ['document', 'serve'].includes(self.givenCommandLineArguments[2]) ? 'var' : 'modern-module'"
598
+ "__evaluate__": "2 < self.givenCommandLineArguments.length && ['document', 'serve'].includes(self.givenCommandLineArguments[2]) ? 'window' : 'modern-module'"
591
599
  }
592
600
  },
593
601
  "extensions": {
@@ -736,7 +744,7 @@
736
744
  "last 2 major versions",
737
745
  "> 5%"
738
746
  ],
739
- "testCommandLine": "jest --config node_modules/weboptimizer/jest.json --noStackTrace --test-regex",
747
+ "testCommandLine": "node --experimental-vm-modules node_modules/.bin/jest --config node_modules/weboptimizer/jest.json --noStackTrace --test-regex",
740
748
  "testCommandLineCoverageArguments": "--ci --coverage --coverage-reporters=text --coverage-reporters=text-summary --silent --test-location-in-results"
741
749
  },
742
750
  "givenCommandLineArguments": [],
package/type.d.ts CHANGED
@@ -207,7 +207,9 @@ export interface DefaultConfiguration {
207
207
  test: PlainObject;
208
208
  'test:browser': PlainObject;
209
209
  }
210
- export type ExportFormat = 'amd' | 'amd-require' | 'assign' | 'global' | 'jsonp' | 'var' | 'this' | 'commonjs' | 'commonjs2' | 'umd';
210
+ export type BaseExportFormat = 'amd' | 'amd-require' | 'assign' | 'commonjs' | 'commonjs-module' | 'global' | 'jsonp' | 'module' | 'self' | 'system' | 'this' | 'umd' | 'umd2' | 'var' | 'window';
211
+ export type ExternalExportFormat = BaseExportFormat | 'import' | 'module-import' | 'node-commonjs' | 'promise' | 'script';
212
+ export type ExportFormat = BaseExportFormat | 'assign-properties' | 'modern-module' | 'commonjs2' | 'commonjs-static';
211
213
  export interface HTMLConfiguration {
212
214
  filename: string;
213
215
  template: {
@@ -280,7 +282,7 @@ export interface ResolvedConfiguration {
280
282
  document: PlainObject;
281
283
  encoding: Encoding;
282
284
  exportFormat: {
283
- external: ExportFormat;
285
+ external: ExternalExportFormat;
284
286
  globalObject: string;
285
287
  self: ExportFormat;
286
288
  };
@@ -243,8 +243,15 @@ if (configuration.injection.external.modules === '__implicit__')
243
243
  // endregion
244
244
  }
245
245
  if (typeof result !== 'string' && Object.prototype.hasOwnProperty.call(result, 'root') && Array.isArray(result.root)) result.root = [].concat(result.root).map(name => convertToValidVariableName(name));
246
- const exportFormat = Object.prototype.hasOwnProperty.call(configuration.exportFormat, 'external') ? configuration.exportFormat.external : configuration.exportFormat.self;
247
- callback(undefined, exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat], exportFormat);
246
+ const {
247
+ external: exportFormat
248
+ } = configuration.exportFormat;
249
+ let reference = exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat];
250
+ console.log();
251
+ console.log('EX', reference, exportFormat);
252
+ console.log();
253
+ if (typeof reference === 'string' && ['window', 'var'].includes(exportFormat)) reference = convertToValidVariableName(reference);
254
+ callback(undefined, reference, exportFormat);
248
255
  return;
249
256
  }
250
257
  callback();