@oroinc/oro-webpack-config-builder 5.1.0-alpha35 → 5.1.0-alpha37
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/modules-config/layout-modules-config-loader.js +1 -1
- package/modules-config/modules-config-loader.js +8 -16
- package/oro-webpack-config.js +5 -20
- package/package.json +16 -16
- package/style/admin-style-loader.js +1 -2
- package/style/style-loader.js +1 -22
- package/validation/assets-validator.js +1 -2
|
@@ -8,7 +8,7 @@ class LayoutModulesConfigLoader extends ModulesConfigLoader {
|
|
|
8
8
|
*/
|
|
9
9
|
loadConfig(theme, filePath) {
|
|
10
10
|
let themeConfig = super.loadConfig(theme, path.join('Resources/views/layouts/', theme, filePath));
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
// recursive process parent theme
|
|
13
13
|
const {parent: parentTheme} = this.themes[theme];
|
|
14
14
|
if (typeof parentTheme === 'string') {
|
|
@@ -38,34 +38,24 @@ class ModulesConfigLoader {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @param {Array} bundles Array of ordered symfony bundle paths
|
|
41
|
-
* @param {string
|
|
41
|
+
* @param {string} themesLocation Path inside the bundle, where to find the theme
|
|
42
42
|
* @param {string} themeInfoFileName Yaml File name with theme info
|
|
43
43
|
*/
|
|
44
44
|
constructor(bundles, themesLocation, themeInfoFileName) {
|
|
45
45
|
this._bundles = bundles;
|
|
46
|
-
|
|
47
|
-
themesLocation = [themesLocation];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const themes = {};
|
|
51
|
-
const self = this;
|
|
52
|
-
themesLocation.forEach(themesLocation => {
|
|
53
|
-
self._collectThemes(themes, themesLocation, themeInfoFileName);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
this._themes = themes;
|
|
46
|
+
this._themes = this._getThemes(themesLocation, themeInfoFileName);
|
|
57
47
|
this._processedFiles = [];
|
|
58
48
|
}
|
|
59
49
|
|
|
60
50
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @param {Object} themes
|
|
51
|
+
* Return list of themes with their parents
|
|
64
52
|
* @param {string} themesLocation
|
|
65
53
|
* @param {string} themeInfoFileName
|
|
54
|
+
* @returns {Object.<string|null>}
|
|
66
55
|
* @private
|
|
67
56
|
*/
|
|
68
|
-
|
|
57
|
+
_getThemes(themesLocation, themeInfoFileName) {
|
|
58
|
+
const themes = {};
|
|
69
59
|
this._bundles.forEach(bundle => {
|
|
70
60
|
const source = bundle + themesLocation;
|
|
71
61
|
|
|
@@ -83,6 +73,8 @@ class ModulesConfigLoader {
|
|
|
83
73
|
themes[name] = merge(themes[name] || {}, theme, {arrayMerge});
|
|
84
74
|
});
|
|
85
75
|
});
|
|
76
|
+
|
|
77
|
+
return themes;
|
|
86
78
|
}
|
|
87
79
|
|
|
88
80
|
/**
|
package/oro-webpack-config.js
CHANGED
|
@@ -32,7 +32,6 @@ require('resolve-url-loader');
|
|
|
32
32
|
|
|
33
33
|
class ConfigBuilder {
|
|
34
34
|
constructor() {
|
|
35
|
-
this._projectPath = '';
|
|
36
35
|
this._enableLayoutThemes = false;
|
|
37
36
|
this._defaultLayoutThemes = null;
|
|
38
37
|
this.emitter = new EventEmitter();
|
|
@@ -187,13 +186,6 @@ class ConfigBuilder {
|
|
|
187
186
|
};
|
|
188
187
|
}
|
|
189
188
|
|
|
190
|
-
get resolvedProjectPath() {
|
|
191
|
-
if (this._resolvedProjectPath == undefined) {
|
|
192
|
-
this._resolvedProjectPath = path.resolve(this._projectPath);
|
|
193
|
-
}
|
|
194
|
-
return this._resolvedProjectPath;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
189
|
get resolvedPublicPath() {
|
|
198
190
|
if (this._resolvedPublicPath === undefined) {
|
|
199
191
|
this._resolvedPublicPath = path.resolve(this._publicPath);
|
|
@@ -441,14 +433,9 @@ class ConfigBuilder {
|
|
|
441
433
|
if (this._isAdminTheme(buildName)) {
|
|
442
434
|
themeDefinition = this._modulesConfigLoader.themes[buildName.split('.')[1]];
|
|
443
435
|
buildPublicPath = '/build/admin/';
|
|
444
|
-
const jsModulesConfig = this._themeConfigFactory.loadConfig(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
'Resources/config/oro/jsmodules.yml',
|
|
448
|
-
'Resources/config/jsmodules.yml',
|
|
449
|
-
'config/oro/jsmodules.yml'
|
|
450
|
-
]
|
|
451
|
-
); validation.jsmodulesValidator.checkFullSchema(
|
|
436
|
+
const jsModulesConfig = this._themeConfigFactory.loadConfig(buildName,
|
|
437
|
+
['Resources/config/oro/jsmodules.yml', 'Resources/config/jsmodules.yml']);
|
|
438
|
+
validation.jsmodulesValidator.checkFullSchema(
|
|
452
439
|
jsModulesConfig,
|
|
453
440
|
this._themeConfigFactory?._configLoader.processedFiles,
|
|
454
441
|
buildName
|
|
@@ -486,7 +473,6 @@ class ConfigBuilder {
|
|
|
486
473
|
modules: [
|
|
487
474
|
resolvedBuildPath,
|
|
488
475
|
this.resolvedPublicPath,
|
|
489
|
-
path.join(this.resolvedProjectPath, '/assets'),
|
|
490
476
|
path.join(this.resolvedPublicPath, '/bundles'),
|
|
491
477
|
path.join(this.resolvedPublicPath, '/js'),
|
|
492
478
|
this.resolvedNodeModulesPath
|
|
@@ -551,11 +537,10 @@ class ConfigBuilder {
|
|
|
551
537
|
this._isProduction = args.mode === 'production';
|
|
552
538
|
this._symfonyEnv = env.symfony;
|
|
553
539
|
this._appConfig = AppConfigLoader.getConfig(this._cachePath, this._symfonyEnv);
|
|
554
|
-
this._appConfig.paths.push(this.resolvedProjectPath);
|
|
555
540
|
|
|
556
541
|
this._modulesConfigLoader = new ModulesConfigLoader(
|
|
557
542
|
this._appConfig.paths,
|
|
558
|
-
|
|
543
|
+
'/Resources/public/themes/',
|
|
559
544
|
'settings.yml'
|
|
560
545
|
);
|
|
561
546
|
this._adminThemes = this._modulesConfigLoader.themeNames.map(themeName => 'admin.' + themeName);
|
|
@@ -569,7 +554,7 @@ class ConfigBuilder {
|
|
|
569
554
|
|
|
570
555
|
this._layoutModulesConfigLoader = new LayoutModulesConfigLoader(
|
|
571
556
|
this._appConfig.paths,
|
|
572
|
-
|
|
557
|
+
'/Resources/views/layouts/',
|
|
573
558
|
'theme.yml'
|
|
574
559
|
);
|
|
575
560
|
this._layoutStyleLoader = new LayoutStyleLoader(this._layoutModulesConfigLoader, entryPointFileWriter);
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oroinc/oro-webpack-config-builder",
|
|
3
|
-
"version": "5.1.0-
|
|
3
|
+
"version": "5.1.0-alpha37",
|
|
4
4
|
"author": "Oro, Inc (https://www.oroinc.com)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "An integration of OroPlatform based applications with the Webpack.",
|
|
7
7
|
"main": "oro-webpack-config.js",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@babel/core": "~7.
|
|
10
|
-
"@babel/plugin-transform-runtime": "~7.
|
|
11
|
-
"@babel/preset-env": "~7.
|
|
9
|
+
"@babel/core": "~7.20.5",
|
|
10
|
+
"@babel/plugin-transform-runtime": "~7.19.6",
|
|
11
|
+
"@babel/preset-env": "~7.20.2",
|
|
12
12
|
"autoprefixer": "~10.4.0",
|
|
13
|
-
"babel-loader": "~
|
|
13
|
+
"babel-loader": "~9.1.0",
|
|
14
14
|
"bindings": "~1.5.0",
|
|
15
15
|
"css-loader": "~6.7.1",
|
|
16
|
-
"css-minimizer-webpack-plugin": "~
|
|
16
|
+
"css-minimizer-webpack-plugin": "~4.2.2",
|
|
17
17
|
"deepmerge": "~4.2.2",
|
|
18
18
|
"exports-loader": "~3.1.0",
|
|
19
19
|
"expose-loader": "~3.1.0",
|
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
"html-webpack-plugin": "~5.5.0",
|
|
24
24
|
"imports-loader": "~3.1.1",
|
|
25
25
|
"js-yaml": "~4.1.0",
|
|
26
|
-
"mini-css-extract-plugin": "~2.
|
|
27
|
-
"minimist": "~1.2.
|
|
28
|
-
"nan": "~2.
|
|
26
|
+
"mini-css-extract-plugin": "~2.7.1",
|
|
27
|
+
"minimist": "~1.2.7",
|
|
28
|
+
"nan": "~2.17.0",
|
|
29
29
|
"path": "0.12.7",
|
|
30
30
|
"postcss": "~8.4.5",
|
|
31
|
-
"postcss-loader": "~
|
|
31
|
+
"postcss-loader": "~7.0.2",
|
|
32
32
|
"printf": "~0.6.0",
|
|
33
33
|
"resolve-url-loader": "^5.0.0",
|
|
34
34
|
"rtlcss-webpack-plugin": "~4.0.6",
|
|
35
|
-
"sass": "~1.
|
|
36
|
-
"sass-loader": "~
|
|
35
|
+
"sass": "~1.56.1",
|
|
36
|
+
"sass-loader": "~13.2.0",
|
|
37
37
|
"schema-utils": "^4.0.0",
|
|
38
38
|
"style-loader": "~3.3.1",
|
|
39
|
-
"terser": "
|
|
39
|
+
"terser": "^5.16.0",
|
|
40
40
|
"text-loader": "0.0.1",
|
|
41
41
|
"underscore": "~1.13.1",
|
|
42
42
|
"url-loader": "~4.1.1",
|
|
43
|
-
"webpack": "~5.
|
|
44
|
-
"webpack-bundle-analyzer": "~4.
|
|
45
|
-
"webpack-cli": "~
|
|
43
|
+
"webpack": "~5.75.0",
|
|
44
|
+
"webpack-bundle-analyzer": "~4.7.0",
|
|
45
|
+
"webpack-cli": "~5.0.0",
|
|
46
46
|
"webpack-dev-server": "^4.7.3",
|
|
47
47
|
"webpack-merge": "~5.8.0",
|
|
48
48
|
"wildcard": "~2.0.0"
|
|
@@ -9,9 +9,8 @@ class AdminStyleLoader extends StyleLoader {
|
|
|
9
9
|
const {rtl_support: rtlSupport = false, styles: extraThemeConfig} =
|
|
10
10
|
this._configLoader.loadConfig(themeName, 'Resources/public/themes/' + themeName + '/settings.yml');
|
|
11
11
|
const baseThemeConfig = this._configLoader.loadConfig(themeName, 'Resources/config/oro/assets.yml');
|
|
12
|
-
const appRootExtraConfig = this._configLoader.loadConfig(themeName, 'config/oro/assets.yml');
|
|
13
12
|
/** @type {Object.<string, ThemeGroupConfig>} */
|
|
14
|
-
const themeConfig = merge(baseThemeConfig,
|
|
13
|
+
const themeConfig = merge(baseThemeConfig, extraThemeConfig);
|
|
15
14
|
|
|
16
15
|
return {
|
|
17
16
|
themeConfig,
|
package/style/style-loader.js
CHANGED
|
@@ -49,7 +49,6 @@ class StyleLoader {
|
|
|
49
49
|
|
|
50
50
|
inputs = this._overrideInputs(inputs);
|
|
51
51
|
inputs = this._sortInputs(inputs);
|
|
52
|
-
inputs = this._applyInputsBasePathPrefix(inputs);
|
|
53
52
|
|
|
54
53
|
if (settings.rtlSupport) {
|
|
55
54
|
writingOptions.ignoreRTLInputs = _.difference(inputs, this._matchInputs(rtlMasks, inputs));
|
|
@@ -59,7 +58,7 @@ class StyleLoader {
|
|
|
59
58
|
const filePath = path.join(buildPath, output);
|
|
60
59
|
entryPoints[entryPointName] = [
|
|
61
60
|
...entries,
|
|
62
|
-
this._entryPointFileWriter.write('
|
|
61
|
+
this._entryPointFileWriter.write('./../../../', inputs, filePath, writingOptions)
|
|
63
62
|
];
|
|
64
63
|
}
|
|
65
64
|
return entryPoints;
|
|
@@ -163,26 +162,6 @@ class StyleLoader {
|
|
|
163
162
|
|
|
164
163
|
return _.unique(whiteListedInputs);
|
|
165
164
|
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Considering base path as application's root.
|
|
169
|
-
* Bundles based *.scss sources go with '../' prefix.
|
|
170
|
-
*
|
|
171
|
-
* @param {string[]} inputs
|
|
172
|
-
* @private
|
|
173
|
-
*/
|
|
174
|
-
_applyInputsBasePathPrefix(inputs) {
|
|
175
|
-
const processedInputs = [];
|
|
176
|
-
|
|
177
|
-
inputs.forEach(input => {
|
|
178
|
-
if (input.indexOf('bundles') === 0) {
|
|
179
|
-
input = '../' + input;
|
|
180
|
-
}
|
|
181
|
-
processedInputs.push(input);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
return processedInputs;
|
|
185
|
-
}
|
|
186
165
|
}
|
|
187
166
|
|
|
188
167
|
module.exports = StyleLoader;
|
|
@@ -82,11 +82,10 @@ module.exports = Object.assign({}, schemaValidator, {
|
|
|
82
82
|
input = newPath;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const fullBasePath = path.resolve(input);
|
|
86
85
|
const fullPath = path.resolve(this._publicPath + input);
|
|
87
86
|
// skip the path to global node modules,
|
|
88
87
|
// e.g. '~bootstrap/scss/bootstrap'
|
|
89
|
-
if (!input.startsWith('~') && !fs.existsSync(fullPath)
|
|
88
|
+
if (!input.startsWith('~') && !fs.existsSync(fullPath)) {
|
|
90
89
|
files.push(input);
|
|
91
90
|
}
|
|
92
91
|
});
|