@studyportals/webpack-helper 2.4.4-beta.0 → 2.5.0-beta.0
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/README.md +201 -201
- package/assets/.babelrc +10 -10
- package/assets/.browserslistrc +2 -2
- package/package.json +58 -58
- package/src/defaults/development.config.js +7 -7
- package/src/defaults/production.config.js +58 -58
- package/src/enums/mode.js +7 -7
- package/src/enums/preset.js +8 -8
- package/src/factories/configuration-factory.js +12 -9
- package/src/interfaces/bob.interface.js +2 -2
- package/src/interfaces/entry.interface.js +2 -2
- package/src/interfaces/entrypoint.interface.js +2 -2
- package/src/interfaces/output.interface.js +2 -2
- package/src/interfaces/preset.interface.js +2 -2
- package/src/model/configuration.js +119 -116
- package/src/model/entry.js +12 -11
- package/src/model/module.js +18 -16
- package/src/model/output.js +45 -44
- package/src/model/plugins.js +17 -15
- package/src/presets/javascript.preset.js +49 -46
- package/src/presets/typescript.preset.js +62 -59
- package/src/presets/vue-typescript.preset.js +85 -82
- package/src/main.js +0 -5
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.ProductionConfig = (bobConfig)
|
|
8
|
-
|
|
9
|
-
if (bobConfig !== null && bobConfig.hasOwnProperty('dllPackages')) {
|
|
10
|
-
bobConfig.dllPackages.forEach((dependency)
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
plugins: [
|
|
14
|
-
new webpack.LoaderOptionsPlugin({
|
|
15
|
-
minimize: true
|
|
16
|
-
}),
|
|
17
|
-
new webpack.DefinePlugin({
|
|
18
|
-
'process.env': {
|
|
19
|
-
NODE_ENV: '"production"'
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
22
|
-
new OptimizeCSSAssetsPlugin({
|
|
23
|
-
cssProcessorPluginOptions: {
|
|
24
|
-
preset: [
|
|
25
|
-
'default',
|
|
26
|
-
{
|
|
27
|
-
discardComments: {
|
|
28
|
-
removeAll: true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
new DllAvailabilityTracker({
|
|
35
|
-
dependencies: dllDependencies || []
|
|
36
|
-
})
|
|
37
|
-
],
|
|
38
|
-
optimization: {
|
|
39
|
-
minimize: true,
|
|
40
|
-
minimizer: [
|
|
41
|
-
new TerserPlugin({
|
|
42
|
-
sourceMap: true,
|
|
43
|
-
parallel: true,
|
|
44
|
-
extractComments: false,
|
|
45
|
-
terserOptions: {
|
|
46
|
-
output: {
|
|
47
|
-
comments: false
|
|
48
|
-
},
|
|
49
|
-
compress: {
|
|
50
|
-
drop_console: true,
|
|
51
|
-
passes: 5
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var webpack = require('webpack');
|
|
4
|
+
var TerserPlugin = require('terser-webpack-plugin');
|
|
5
|
+
var OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
|
6
|
+
var DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
|
|
7
|
+
exports.ProductionConfig = function (bobConfig) {
|
|
8
|
+
var dllDependencies = ['library'];
|
|
9
|
+
if (bobConfig !== null && bobConfig.hasOwnProperty('dllPackages')) {
|
|
10
|
+
bobConfig.dllPackages.forEach(function (dependency) { return dllDependencies.push(dependency.manifest.name); });
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
plugins: [
|
|
14
|
+
new webpack.LoaderOptionsPlugin({
|
|
15
|
+
minimize: true
|
|
16
|
+
}),
|
|
17
|
+
new webpack.DefinePlugin({
|
|
18
|
+
'process.env': {
|
|
19
|
+
NODE_ENV: '"production"'
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
new OptimizeCSSAssetsPlugin({
|
|
23
|
+
cssProcessorPluginOptions: {
|
|
24
|
+
preset: [
|
|
25
|
+
'default',
|
|
26
|
+
{
|
|
27
|
+
discardComments: {
|
|
28
|
+
removeAll: true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
new DllAvailabilityTracker({
|
|
35
|
+
dependencies: dllDependencies || []
|
|
36
|
+
})
|
|
37
|
+
],
|
|
38
|
+
optimization: {
|
|
39
|
+
minimize: true,
|
|
40
|
+
minimizer: [
|
|
41
|
+
new TerserPlugin({
|
|
42
|
+
sourceMap: true,
|
|
43
|
+
parallel: true,
|
|
44
|
+
extractComments: false,
|
|
45
|
+
terserOptions: {
|
|
46
|
+
output: {
|
|
47
|
+
comments: false
|
|
48
|
+
},
|
|
49
|
+
compress: {
|
|
50
|
+
drop_console: true,
|
|
51
|
+
passes: 5
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
package/src/enums/mode.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var Mode;
|
|
4
|
-
(function (Mode) {
|
|
5
|
-
Mode["DEVELOPMENT"] = "development";
|
|
6
|
-
Mode["PRODUCTION"] = "production";
|
|
7
|
-
})(Mode = exports.Mode || (exports.Mode = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var Mode;
|
|
4
|
+
(function (Mode) {
|
|
5
|
+
Mode["DEVELOPMENT"] = "development";
|
|
6
|
+
Mode["PRODUCTION"] = "production";
|
|
7
|
+
})(Mode = exports.Mode || (exports.Mode = {}));
|
package/src/enums/preset.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var Preset;
|
|
4
|
-
(function (Preset) {
|
|
5
|
-
Preset["VUE_TYPESCRIPT"] = "vue-typescript";
|
|
6
|
-
Preset["TYPESCRIPT"] = "typescript";
|
|
7
|
-
Preset["JAVASCRIPT"] = "javascript";
|
|
8
|
-
})(Preset = exports.Preset || (exports.Preset = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var Preset;
|
|
4
|
+
(function (Preset) {
|
|
5
|
+
Preset["VUE_TYPESCRIPT"] = "vue-typescript";
|
|
6
|
+
Preset["TYPESCRIPT"] = "typescript";
|
|
7
|
+
Preset["JAVASCRIPT"] = "javascript";
|
|
8
|
+
})(Preset = exports.Preset || (exports.Preset = {}));
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var configuration_1 = require("../model/configuration");
|
|
4
|
+
var ConfigurationFactory = /** @class */ (function () {
|
|
5
|
+
function ConfigurationFactory() {
|
|
6
|
+
}
|
|
7
|
+
ConfigurationFactory.prototype.create = function (options) {
|
|
8
|
+
return new configuration_1.Configuration(options);
|
|
9
|
+
};
|
|
10
|
+
return ConfigurationFactory;
|
|
11
|
+
}());
|
|
12
|
+
exports.ConfigurationFactory = ConfigurationFactory;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
@@ -1,116 +1,119 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
[mode_1.Mode.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
plugins.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.bob.dllPackages
|
|
100
|
-
dependencies
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var entry_1 = require("./entry");
|
|
4
|
+
var output_1 = require("./output");
|
|
5
|
+
var plugins_1 = require("./plugins");
|
|
6
|
+
var module_1 = require("./module");
|
|
7
|
+
var preset_1 = require("../enums/preset");
|
|
8
|
+
var vue_typescript_preset_1 = require("../presets/vue-typescript.preset");
|
|
9
|
+
var typescript_preset_1 = require("../presets/typescript.preset");
|
|
10
|
+
var javascript_preset_1 = require("../presets/javascript.preset");
|
|
11
|
+
var mode_1 = require("../enums/mode");
|
|
12
|
+
var production_config_1 = require("../defaults/production.config");
|
|
13
|
+
var development_config_1 = require("../defaults/development.config");
|
|
14
|
+
var ManifestGenerator = require("@studyportals/bob-manifest-generator").ManifestGenerator;
|
|
15
|
+
var DllReferencePlugin = require("@studyportals/bob-manifest-generator").DllReferencePlugin;
|
|
16
|
+
var merge = require("webpack-merge");
|
|
17
|
+
var Configuration = /** @class */ (function () {
|
|
18
|
+
function Configuration(options) {
|
|
19
|
+
var _a;
|
|
20
|
+
this.bob = options.bob || null;
|
|
21
|
+
this.entry = new entry_1.Entry(options.entry);
|
|
22
|
+
this.output = new output_1.Output(options.output);
|
|
23
|
+
this.extensions = options.extensions || [];
|
|
24
|
+
this.preset = options.preset || null;
|
|
25
|
+
this.hash = options.output.hash || false;
|
|
26
|
+
this.plugins = new plugins_1.Plugins(options.plugins);
|
|
27
|
+
this.module = new module_1.Module(options.module);
|
|
28
|
+
this.commonConfig = options.common || {};
|
|
29
|
+
this.environmentSpecificConfig = (_a = {},
|
|
30
|
+
_a[mode_1.Mode.DEVELOPMENT] = merge([options[mode_1.Mode.DEVELOPMENT], development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
|
|
31
|
+
_a[mode_1.Mode.PRODUCTION] = merge([options[mode_1.Mode.PRODUCTION], production_config_1.ProductionConfig(this.bob)]) || production_config_1.ProductionConfig(this.bob),
|
|
32
|
+
_a);
|
|
33
|
+
this.detectPresets();
|
|
34
|
+
}
|
|
35
|
+
Configuration.prototype.get = function (mode) {
|
|
36
|
+
return merge({
|
|
37
|
+
entry: this.entry.getEntry(),
|
|
38
|
+
output: this.output.getOutput(),
|
|
39
|
+
plugins: this.plugins.getPlugins(),
|
|
40
|
+
module: this.module.getModule(),
|
|
41
|
+
resolve: {
|
|
42
|
+
extensions: this.extensions
|
|
43
|
+
},
|
|
44
|
+
performance: {
|
|
45
|
+
hints: false
|
|
46
|
+
},
|
|
47
|
+
optimization: {
|
|
48
|
+
minimize: false
|
|
49
|
+
},
|
|
50
|
+
devtool: 'source-map'
|
|
51
|
+
}, this.getBobConfig(), this.commonConfig, this.getEnvironmentSpecificConfig(mode), { mode: mode });
|
|
52
|
+
};
|
|
53
|
+
Configuration.prototype.detectPresets = function () {
|
|
54
|
+
switch (this.preset) {
|
|
55
|
+
case preset_1.Preset.VUE_TYPESCRIPT:
|
|
56
|
+
this.injectPreset(new vue_typescript_preset_1.VueTypeScriptPreset());
|
|
57
|
+
break;
|
|
58
|
+
case preset_1.Preset.TYPESCRIPT:
|
|
59
|
+
this.injectPreset(new typescript_preset_1.TypeScriptPreset());
|
|
60
|
+
break;
|
|
61
|
+
case preset_1.Preset.JAVASCRIPT:
|
|
62
|
+
this.injectPreset(new javascript_preset_1.JavascriptPreset());
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
Configuration.prototype.injectPreset = function (preset) {
|
|
69
|
+
var _this = this;
|
|
70
|
+
var plugins = preset.getPlugins(this.getCSSFileName());
|
|
71
|
+
var module = preset.getModule();
|
|
72
|
+
plugins.forEach(function (plugin) {
|
|
73
|
+
_this.plugins.addPlugin(plugin);
|
|
74
|
+
});
|
|
75
|
+
this.extensions = this.extensions.concat(preset.getExtensions());
|
|
76
|
+
this.module.setModule(module);
|
|
77
|
+
};
|
|
78
|
+
Configuration.prototype.getEnvironmentSpecificConfig = function (mode) {
|
|
79
|
+
return this.environmentSpecificConfig[mode];
|
|
80
|
+
};
|
|
81
|
+
Configuration.prototype.getBobConfig = function () {
|
|
82
|
+
if (this.bob === null) {
|
|
83
|
+
return {};
|
|
84
|
+
}
|
|
85
|
+
var dllPackages = [];
|
|
86
|
+
if (typeof this.bob.dllPackages !== 'undefined'
|
|
87
|
+
&& this.bob.dllPackages.length > 0) {
|
|
88
|
+
dllPackages = this.getBobDllDependencies();
|
|
89
|
+
delete this.bob.dllPackages;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
plugins: [
|
|
93
|
+
new ManifestGenerator(this.bob)
|
|
94
|
+
].concat(dllPackages)
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
Configuration.prototype.getBobDllDependencies = function () {
|
|
98
|
+
var dependencies = [];
|
|
99
|
+
if (typeof this.bob.dllPackages === 'undefined')
|
|
100
|
+
return dependencies;
|
|
101
|
+
this.bob.dllPackages.forEach(function (dependency) {
|
|
102
|
+
dependencies.push(new DllReferencePlugin({
|
|
103
|
+
name: dependency.name,
|
|
104
|
+
manifest: dependency.manifest
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
return dependencies;
|
|
108
|
+
};
|
|
109
|
+
Configuration.prototype.getCSSFileName = function () {
|
|
110
|
+
if (this.hash === false
|
|
111
|
+
|| typeof this.hash.css !== 'undefined'
|
|
112
|
+
&& this.hash.css === false) {
|
|
113
|
+
return 'style.css';
|
|
114
|
+
}
|
|
115
|
+
return 'style.[hash].css';
|
|
116
|
+
};
|
|
117
|
+
return Configuration;
|
|
118
|
+
}());
|
|
119
|
+
exports.Configuration = Configuration;
|
package/src/model/entry.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
this.entry = entry;
|
|
6
|
-
}
|
|
7
|
-
getEntry() {
|
|
8
|
-
return this.entry;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var Entry = /** @class */ (function () {
|
|
4
|
+
function Entry(entry) {
|
|
5
|
+
this.entry = entry;
|
|
6
|
+
}
|
|
7
|
+
Entry.prototype.getEntry = function () {
|
|
8
|
+
return this.entry;
|
|
9
|
+
};
|
|
10
|
+
return Entry;
|
|
11
|
+
}());
|
|
12
|
+
exports.Entry = Entry;
|
package/src/model/module.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.module =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var merge = require("webpack-merge");
|
|
4
|
+
var Module = /** @class */ (function () {
|
|
5
|
+
function Module(module) {
|
|
6
|
+
if (module === void 0) { module = {}; }
|
|
7
|
+
this.module = {};
|
|
8
|
+
this.module = merge(this.module, module);
|
|
9
|
+
}
|
|
10
|
+
Module.prototype.setModule = function (module) {
|
|
11
|
+
this.module = merge(this.module, module);
|
|
12
|
+
};
|
|
13
|
+
Module.prototype.getModule = function () {
|
|
14
|
+
return this.module;
|
|
15
|
+
};
|
|
16
|
+
return Module;
|
|
17
|
+
}());
|
|
18
|
+
exports.Module = Module;
|
package/src/model/output.js
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
this.path = outputConfig.path;
|
|
6
|
-
this.publicPath = outputConfig.publicPath || null;
|
|
7
|
-
this.library = outputConfig.library || null;
|
|
8
|
-
this.addHash = this.shouldAddHash(outputConfig.hash),
|
|
9
|
-
this.fileName = outputConfig.fileName || "[name]";
|
|
10
|
-
this.crossOriginLoading = outputConfig.crossOriginLoading || null;
|
|
11
|
-
}
|
|
12
|
-
getOutput() {
|
|
13
|
-
|
|
14
|
-
path: this.path,
|
|
15
|
-
filename: this.getFileName()
|
|
16
|
-
};
|
|
17
|
-
if (this.publicPath !== null) {
|
|
18
|
-
output.publicPath = this.publicPath;
|
|
19
|
-
}
|
|
20
|
-
if (this.library !== null) {
|
|
21
|
-
output.library = this.library;
|
|
22
|
-
}
|
|
23
|
-
if (this.crossOriginLoading !== null) {
|
|
24
|
-
output.crossOriginLoading = this.crossOriginLoading;
|
|
25
|
-
}
|
|
26
|
-
return output;
|
|
27
|
-
}
|
|
28
|
-
getFileName() {
|
|
29
|
-
|
|
30
|
-
return fileName;
|
|
31
|
-
}
|
|
32
|
-
shouldAddHash(hashConfig) {
|
|
33
|
-
if (typeof hashConfig === 'undefined') {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
if (typeof hashConfig.js !== 'undefined'
|
|
37
|
-
&& hashConfig.js === false
|
|
38
|
-
|| hashConfig === false) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var Output = /** @class */ (function () {
|
|
4
|
+
function Output(outputConfig) {
|
|
5
|
+
this.path = outputConfig.path;
|
|
6
|
+
this.publicPath = outputConfig.publicPath || null;
|
|
7
|
+
this.library = outputConfig.library || null;
|
|
8
|
+
this.addHash = this.shouldAddHash(outputConfig.hash),
|
|
9
|
+
this.fileName = outputConfig.fileName || "[name]";
|
|
10
|
+
this.crossOriginLoading = outputConfig.crossOriginLoading || null;
|
|
11
|
+
}
|
|
12
|
+
Output.prototype.getOutput = function () {
|
|
13
|
+
var output = {
|
|
14
|
+
path: this.path,
|
|
15
|
+
filename: this.getFileName()
|
|
16
|
+
};
|
|
17
|
+
if (this.publicPath !== null) {
|
|
18
|
+
output.publicPath = this.publicPath;
|
|
19
|
+
}
|
|
20
|
+
if (this.library !== null) {
|
|
21
|
+
output.library = this.library;
|
|
22
|
+
}
|
|
23
|
+
if (this.crossOriginLoading !== null) {
|
|
24
|
+
output.crossOriginLoading = this.crossOriginLoading;
|
|
25
|
+
}
|
|
26
|
+
return output;
|
|
27
|
+
};
|
|
28
|
+
Output.prototype.getFileName = function () {
|
|
29
|
+
var fileName = this.addHash === true ? this.fileName + ".[hash].js" : this.fileName + ".js";
|
|
30
|
+
return fileName;
|
|
31
|
+
};
|
|
32
|
+
Output.prototype.shouldAddHash = function (hashConfig) {
|
|
33
|
+
if (typeof hashConfig === 'undefined') {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
if (typeof hashConfig.js !== 'undefined'
|
|
37
|
+
&& hashConfig.js === false
|
|
38
|
+
|| hashConfig === false) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
return Output;
|
|
44
|
+
}());
|
|
45
|
+
exports.Output = Output;
|
package/src/model/plugins.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this.plugins =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var Plugins = /** @class */ (function () {
|
|
4
|
+
function Plugins(plugins) {
|
|
5
|
+
if (plugins === void 0) { plugins = []; }
|
|
6
|
+
this.plugins = [];
|
|
7
|
+
this.plugins = this.plugins.concat(plugins);
|
|
8
|
+
}
|
|
9
|
+
Plugins.prototype.addPlugin = function (plugin) {
|
|
10
|
+
this.plugins.push(plugin);
|
|
11
|
+
};
|
|
12
|
+
Plugins.prototype.getPlugins = function () {
|
|
13
|
+
return this.plugins;
|
|
14
|
+
};
|
|
15
|
+
return Plugins;
|
|
16
|
+
}());
|
|
17
|
+
exports.Plugins = Plugins;
|