@oroinc/oro-webpack-config-builder 5.1.0-alpha36 → 5.1.0-alpha38

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.
@@ -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
- themeConfig = merge(themeConfig, super.loadConfig(theme, path.join('templates/layouts/', theme, filePath)));
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|Array} themesLocation Path inside the bundle, where to find the theme
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
- if (!Array.isArray(themesLocation)) {
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
- * Collects list of themes with their parents into given storage(themes param)
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
- _collectThemes(themes, themesLocation, themeInfoFileName) {
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
  /**
@@ -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
- buildName,
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
- ['/Resources/public/themes/', '/public/themes/admin/'],
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
- ['/Resources/views/layouts/', '/templates/layouts/'],
557
+ '/Resources/views/layouts/',
573
558
  'theme.yml'
574
559
  );
575
560
  this._layoutStyleLoader = new LayoutStyleLoader(this._layoutModulesConfigLoader, entryPointFileWriter);
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
1
  {
2
2
  "name": "@oroinc/oro-webpack-config-builder",
3
- "version": "5.1.0-alpha36",
3
+ "version": "5.1.0-alpha38",
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.19.3",
10
- "@babel/plugin-transform-runtime": "~7.19.1",
11
- "@babel/preset-env": "~7.19.3",
12
- "autoprefixer": "~10.4.12",
13
- "babel-loader": "~8.2.5",
9
+ "@babel/core": "~7.17.9",
10
+ "@babel/plugin-transform-runtime": "~7.17.0",
11
+ "@babel/preset-env": "~7.16.11",
12
+ "autoprefixer": "~10.4.0",
13
+ "babel-loader": "~8.2.3",
14
14
  "bindings": "~1.5.0",
15
15
  "css-loader": "~6.7.1",
16
- "css-minimizer-webpack-plugin": "~4.2.0",
16
+ "css-minimizer-webpack-plugin": "~3.4.1",
17
17
  "deepmerge": "~4.2.2",
18
- "exports-loader": "~4.0.0",
19
- "expose-loader": "~4.0.0",
18
+ "exports-loader": "~3.1.0",
19
+ "expose-loader": "~3.1.0",
20
20
  "extract-loader": "~5.1.0",
21
21
  "file-loader": "~6.2.0",
22
22
  "happypack": "~5.0.1",
23
23
  "html-webpack-plugin": "~5.5.0",
24
- "imports-loader": "~4.0.1",
24
+ "imports-loader": "~3.1.1",
25
25
  "js-yaml": "~4.1.0",
26
- "mini-css-extract-plugin": "~2.6.1",
26
+ "mini-css-extract-plugin": "~2.6.0",
27
27
  "minimist": "~1.2.3",
28
- "nan": "~2.16.0",
28
+ "nan": "~2.15.0",
29
29
  "path": "0.12.7",
30
- "postcss": "~8.4.17",
31
- "postcss-loader": "~7.0.1",
30
+ "postcss": "~8.4.5",
31
+ "postcss-loader": "~6.2.0",
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.55.0",
36
- "sass-loader": "~13.0.2",
35
+ "sass": "~1.50.0",
36
+ "sass-loader": "~12.6.0",
37
37
  "schema-utils": "^4.0.0",
38
38
  "style-loader": "~3.3.1",
39
- "terser": "~5.15.0",
39
+ "terser": "~5.14.2",
40
40
  "text-loader": "0.0.1",
41
- "underscore": "1.13.*",
41
+ "underscore": "~1.13.1",
42
42
  "url-loader": "~4.1.1",
43
- "webpack": "~5.74.0",
44
- "webpack-bundle-analyzer": "~4.6.1",
45
- "webpack-cli": "~4.10.0",
46
- "webpack-dev-server": "^4.11.1",
43
+ "webpack": "~5.72.0",
44
+ "webpack-bundle-analyzer": "~4.5.0",
45
+ "webpack-cli": "~4.9.1",
46
+ "webpack-dev-server": "^4.7.3",
47
47
  "webpack-merge": "~5.8.0",
48
48
  "wildcard": "~2.0.0"
49
49
  }
@@ -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, appRootExtraConfig, extraThemeConfig);
13
+ const themeConfig = merge(baseThemeConfig, extraThemeConfig);
15
14
 
16
15
  return {
17
16
  themeConfig,
@@ -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('./../../', inputs, filePath, writingOptions)
61
+ this._entryPointFileWriter.write('./../../../', inputs, filePath, writingOptions)
63
62
  ];
64
63
  }
65
64
  return entryPoints;
@@ -154,7 +153,6 @@ class StyleLoader {
154
153
  * @protected
155
154
  */
156
155
  _matchInputs(masks, inputs) {
157
- masks = this._applyInputsBasePathPrefix(masks);
158
156
  masks = masks.map(mask => wildcard(mask));
159
157
 
160
158
  const whiteListedInputs = masks.reduce((include, mask) => {
@@ -164,26 +162,6 @@ class StyleLoader {
164
162
 
165
163
  return _.unique(whiteListedInputs);
166
164
  }
167
-
168
- /**
169
- * Considering base path as application's root.
170
- * Bundles based *.scss sources go with '../' prefix.
171
- *
172
- * @param {string[]} inputs
173
- * @private
174
- */
175
- _applyInputsBasePathPrefix(inputs) {
176
- const processedInputs = [];
177
-
178
- inputs.forEach(input => {
179
- if (input.indexOf('bundles') === 0) {
180
- input = '../' + input;
181
- }
182
- processedInputs.push(input);
183
- });
184
-
185
- return processedInputs;
186
- }
187
165
  }
188
166
 
189
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) && !fs.existsSync(fullBasePath)) {
88
+ if (!input.startsWith('~') && !fs.existsSync(fullPath)) {
90
89
  files.push(input);
91
90
  }
92
91
  });