weboptimizer 4.0.15 → 4.0.17
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/browser.js +4 -3
- package/package.json +21 -7
- package/type.d.ts +4 -2
- package/type.js +0 -4
- package/webpackConfigurator.js +6 -1
package/browser.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
// region imports
|
|
19
19
|
import { CONSOLE_METHODS, Logger, timeout } from 'clientnode';
|
|
20
|
+
import webOptimizerDefaultTemplate from 'webOptimizerDefaultTemplateFilePath';
|
|
20
21
|
// endregion
|
|
21
22
|
// region declaration
|
|
22
23
|
|
|
@@ -92,6 +93,7 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
92
93
|
virtualConsole
|
|
93
94
|
});
|
|
94
95
|
};
|
|
96
|
+
let evaluatedContent = '';
|
|
95
97
|
if (typeof NAME === 'undefined' || NAME === 'webOptimizer') {
|
|
96
98
|
const filePath = path.join(import.meta.dirname, 'index.html.ejs');
|
|
97
99
|
/*
|
|
@@ -102,15 +104,14 @@ if (typeof TARGET_TECHNOLOGY === 'undefined' || TARGET_TECHNOLOGY === 'node')
|
|
|
102
104
|
const content = await (await import('fs')).promises.readFile(filePath, {
|
|
103
105
|
encoding: 'utf-8'
|
|
104
106
|
});
|
|
105
|
-
let evaluatedContent = '';
|
|
106
107
|
await ejsLoader.bind({
|
|
107
108
|
resourcePath: filePath,
|
|
108
109
|
async: (error, result) => {
|
|
109
110
|
if (error) throw error;else evaluatedContent = result;
|
|
110
111
|
}
|
|
111
112
|
})(content);
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
} else evaluatedContent = webOptimizerDefaultTemplate;
|
|
114
|
+
render(evaluatedContent);
|
|
114
115
|
// endregion
|
|
115
116
|
})().catch(error => {
|
|
116
117
|
log.error(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weboptimizer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.17",
|
|
4
4
|
"description": "A generic web optimizer, (module) bundler and development environment.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webpack",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"babel-plugin-polyfill-corejs3": "^1.0.0",
|
|
96
96
|
"babel-plugin-transform-rewrite-imports": "^1.5.4",
|
|
97
97
|
"babel-preset-minify": "^0.5.2",
|
|
98
|
-
"clientnode": "4.0.
|
|
98
|
+
"clientnode": "4.0.1439",
|
|
99
99
|
"core-js": "^3.49.0",
|
|
100
100
|
"ejs": "^6.0.1",
|
|
101
101
|
"exports-loader": "^5.0.0",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"webpack-sources": "^3.5.1"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@babel/cli": "^8.0.
|
|
117
|
+
"@babel/cli": "^8.0.4",
|
|
118
118
|
"@babel/eslint-parser": "^8.0.1",
|
|
119
119
|
"@eslint/js": "^10.0.1",
|
|
120
120
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
@@ -330,6 +330,12 @@
|
|
|
330
330
|
},
|
|
331
331
|
"sideEffects": true,
|
|
332
332
|
"type": "module",
|
|
333
|
+
"exports": {
|
|
334
|
+
".": "/.index.js",
|
|
335
|
+
"./browser": "./browser.js",
|
|
336
|
+
"./ejsLoader": "./ejsLoader.js",
|
|
337
|
+
"./type": "./type.js"
|
|
338
|
+
},
|
|
333
339
|
"webDocumentation": {
|
|
334
340
|
"trackingCode": "UA-40192634-11"
|
|
335
341
|
},
|
|
@@ -356,7 +362,7 @@
|
|
|
356
362
|
"__evaluate__": "self.debug"
|
|
357
363
|
},
|
|
358
364
|
"EXTERNAL_EXPORT_FORMAT": {
|
|
359
|
-
"__evaluate__": "`'${self.exportFormat.external
|
|
365
|
+
"__evaluate__": "`'${self.exportFormat.external}'`"
|
|
360
366
|
},
|
|
361
367
|
"NAME": {
|
|
362
368
|
"__evaluate__": "`'${self.name}'`"
|
|
@@ -583,6 +589,9 @@
|
|
|
583
589
|
},
|
|
584
590
|
"encoding": "utf-8",
|
|
585
591
|
"exportFormat": {
|
|
592
|
+
"external": {
|
|
593
|
+
"__evaluate__": "2 < self.givenCommandLineArguments.length && ['document', 'serve'].includes(self.givenCommandLineArguments[2]) ? 'window' : 'module-import'"
|
|
594
|
+
},
|
|
586
595
|
"globalObject": {
|
|
587
596
|
"__evaluate__": "2 < self.givenCommandLineArguments.length && self.givenCommandLineArguments[2] === 'serve' ? 'window' : 'this'"
|
|
588
597
|
},
|
|
@@ -733,10 +742,9 @@
|
|
|
733
742
|
"cascadingStyleSheetFileExtension": "css",
|
|
734
743
|
"isWeb": true,
|
|
735
744
|
"supportedBrowsers": [
|
|
736
|
-
"last 2 major versions"
|
|
737
|
-
"> 5%"
|
|
745
|
+
"last 2 major versions"
|
|
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": [],
|
|
@@ -1521,6 +1529,12 @@
|
|
|
1521
1529
|
"offline": null
|
|
1522
1530
|
},
|
|
1523
1531
|
"webpack": {
|
|
1532
|
+
"output": {
|
|
1533
|
+
"environment": {
|
|
1534
|
+
"dynamicImport": true,
|
|
1535
|
+
"module": true
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1524
1538
|
"watchOptions": {
|
|
1525
1539
|
"ignored": [
|
|
1526
1540
|
"./*.js",
|
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/type.js
CHANGED
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;
|