weboptimizer 4.0.15 → 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 +11 -3
- package/type.d.ts +4 -2
- package/webpackConfigurator.js +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.16",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -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
|
},
|
|
@@ -356,7 +361,7 @@
|
|
|
356
361
|
"__evaluate__": "self.debug"
|
|
357
362
|
},
|
|
358
363
|
"EXTERNAL_EXPORT_FORMAT": {
|
|
359
|
-
"__evaluate__": "`'${self.exportFormat.external
|
|
364
|
+
"__evaluate__": "`'${self.exportFormat.external}'`"
|
|
360
365
|
},
|
|
361
366
|
"NAME": {
|
|
362
367
|
"__evaluate__": "`'${self.name}'`"
|
|
@@ -583,6 +588,9 @@
|
|
|
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
|
},
|
|
@@ -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
|
|
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:
|
|
285
|
+
external: ExternalExportFormat;
|
|
284
286
|
globalObject: string;
|
|
285
287
|
self: ExportFormat;
|
|
286
288
|
};
|
package/webpackConfigurator.js
CHANGED
|
@@ -243,8 +243,13 @@ 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
|
|
246
|
+
const {
|
|
247
|
+
external: exportFormat
|
|
248
|
+
} = configuration.exportFormat;
|
|
247
249
|
let reference = exportFormat === 'umd' || typeof result === 'string' ? result : result[exportFormat];
|
|
250
|
+
console.log();
|
|
251
|
+
console.log('EX', reference, exportFormat);
|
|
252
|
+
console.log();
|
|
248
253
|
if (typeof reference === 'string' && ['window', 'var'].includes(exportFormat)) reference = convertToValidVariableName(reference);
|
|
249
254
|
callback(undefined, reference, exportFormat);
|
|
250
255
|
return;
|