@oroinc/oro-webpack-config-builder 5.1.0-alpha32 → 5.1.0-alpha35
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/error-handler.js +95 -0
- package/loader/inject-loader/index.js +1 -70
- package/modules-config/layout-modules-config-loader.js +7 -3
- package/modules-config/modules-config-loader.js +34 -9
- package/oro-webpack-config.js +83 -21
- package/package.json +10 -9
- package/plugin/logs/after-webpack-logs-plugin.js +25 -0
- package/style/admin-style-loader.js +2 -1
- package/style/style-loader.js +35 -10
- package/theme-config-factory.js +5 -9
- package/utils.js +30 -0
- package/validation/assets-validator.js +104 -0
- package/validation/errors/assets-input-file-error.js +24 -0
- package/validation/errors/assets-schema-error.js +40 -0
- package/validation/errors/base-error.js +37 -0
- package/validation/errors/jsmodules-extra-modules-error.js +22 -0
- package/validation/errors/jsmodules-schema-error.js +40 -0
- package/validation/errors/styles-error.js +24 -0
- package/validation/index.js +36 -0
- package/validation/jsmodules-validator.js +53 -0
- package/validation/schema-validator.js +62 -0
- package/validation/schemas/assets-schema-full.js +22 -0
- package/validation/schemas/assets-schema.js +32 -0
- package/validation/schemas/jsmodules-schema-full.js +11 -0
- package/validation/schemas/jsmodules-schema.js +76 -0
- package/writer/dynamic-imports-file-writer.js +2 -2
- package/writer/scss-entry-point-file-writer.js +1 -1
- package/messages.js +0 -29
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema to validate jsmodules.yml files
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* Full scheme complements "jsmodules-schema" one.
|
|
6
|
+
* It should have only rules which are not defined in "jsmodules-schema" schema due to avoid duplicates in error messages
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
type: 'object',
|
|
10
|
+
required: ['entry']
|
|
11
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema to validate jsmodules.yml files
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
'entry': {
|
|
8
|
+
description: 'Webpack entry points configuration.',
|
|
9
|
+
type: 'object',
|
|
10
|
+
patternProperties: {
|
|
11
|
+
'.*': {
|
|
12
|
+
type: 'array',
|
|
13
|
+
items: {
|
|
14
|
+
type: 'string'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
'shim': {
|
|
20
|
+
description: 'Configure a webpack shimming feature',
|
|
21
|
+
type: 'object',
|
|
22
|
+
patternProperties: {
|
|
23
|
+
'.*': {
|
|
24
|
+
type: 'object'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
'map': {
|
|
29
|
+
description: 'The map option allows to substitute a module with the given ID with a different module.',
|
|
30
|
+
type: 'object',
|
|
31
|
+
patternProperties: {
|
|
32
|
+
'.*': {
|
|
33
|
+
type: 'object'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
'app-modules': {
|
|
38
|
+
description: 'Introduces a list of modules that should be initialized before application is launched.',
|
|
39
|
+
type: 'array',
|
|
40
|
+
items: {
|
|
41
|
+
type: 'string'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
'dynamic-imports': {
|
|
45
|
+
description: 'Gives possibility to import a module with the name that is determined at runtime.',
|
|
46
|
+
type: 'object',
|
|
47
|
+
patternProperties: {
|
|
48
|
+
'.*': {
|
|
49
|
+
type: 'array',
|
|
50
|
+
items: {
|
|
51
|
+
type: 'string'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
'configs': {
|
|
57
|
+
description: 'Runtime configuration for a the module.',
|
|
58
|
+
type: 'object',
|
|
59
|
+
patternProperties: {
|
|
60
|
+
'.*': {
|
|
61
|
+
type: 'object'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
'aliases': {
|
|
66
|
+
description: 'An alias is an alternative name.',
|
|
67
|
+
type: 'object',
|
|
68
|
+
patternProperties: {
|
|
69
|
+
'.*': {
|
|
70
|
+
type: 'string'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
additionalProperties: false
|
|
76
|
+
};
|
|
@@ -19,8 +19,8 @@ class DynamicImportsFileWriter {
|
|
|
19
19
|
write(dynamicImports, output) {
|
|
20
20
|
const buildPath = path.join(output, 'dynamic-imports.js');
|
|
21
21
|
let content = Object.entries(dynamicImports).map(([chunkName, moduleNames]) => {
|
|
22
|
-
const notation = chunkName === 'commons'
|
|
23
|
-
'/* webpackMode: "eager" */' : `/* webpackChunkName: "${chunkName}" */`;
|
|
22
|
+
const notation = chunkName === 'commons'
|
|
23
|
+
? '/* webpackMode: "eager" */' : `/* webpackChunkName: "${chunkName}" */`;
|
|
24
24
|
return moduleNames.map(moduleName =>`'${moduleName}': () => import(${notation}'${moduleName}')`);
|
|
25
25
|
});
|
|
26
26
|
content = `module.exports = {\n ${content.flat().join(',\n ')}\n};\n`;
|
|
@@ -25,7 +25,7 @@ class SCSSEntryPointFileWriter {
|
|
|
25
25
|
input = input.replace(/\.[^/.]+$/, '');
|
|
26
26
|
// don't add the base path to global node modules,
|
|
27
27
|
// e.g. '~bootstrap/scss/bootstrap'
|
|
28
|
-
const basePath = input.startsWith('~') ? '': baseInputPath;
|
|
28
|
+
const basePath = input.startsWith('~') ? '' : baseInputPath;
|
|
29
29
|
let importModule = `@import "${basePath}${input}";\n`;
|
|
30
30
|
if (ignoreRTL) {
|
|
31
31
|
importModule = `/*rtl:begin:ignore*/\n${importModule}/*rtl:end:ignore*/\n`;
|
package/messages.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const doc = "Please, find more information in the documentation ";
|
|
2
|
-
const CSSError = "Failed assembly styles.\n";
|
|
3
|
-
const CSSDoc = "https://doc.oroinc.com/backend/bundles/platform/AssetBundle/#load-scss-or-css-files-from-the-bundle";
|
|
4
|
-
const JSError = `Failed assembly JS.\n`;
|
|
5
|
-
const JSDoc = "https://doc.oroinc.com/backend/bundles/platform/AssetBundle/#create-jsmodules-yml-configuration";
|
|
6
|
-
const JSExtraBuildDoc = "https://doc.oroinc.com/master/frontend/storefront/how-to/how-to-create-extra-js-build-for-landing-page";
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
assetsMissedOutput(group, theme) {
|
|
10
|
-
const error = `The "output" for "${group}" entry point in "${theme}" theme is not defined.\n`;
|
|
11
|
-
|
|
12
|
-
return `${CSSError}${error}${doc}${CSSDoc}`;
|
|
13
|
-
},
|
|
14
|
-
assetsMissedInput(group, theme) {
|
|
15
|
-
const error = `The "output" for "${group}" entry point in "${theme}" theme is not defined.\n`;
|
|
16
|
-
|
|
17
|
-
return `${CSSError}${error}${doc}${CSSDoc}`
|
|
18
|
-
},
|
|
19
|
-
jsModulesError(theme) {
|
|
20
|
-
const error = `Failed assembly JS for the "${theme}" theme.\n`;
|
|
21
|
-
|
|
22
|
-
return `${error}${doc}${JSDoc}`
|
|
23
|
-
},
|
|
24
|
-
jsExtraModulesError(parts) {
|
|
25
|
-
const error = `Sections ["${parts.join('", "')}"] are not allowed in extra js build definition\n`;
|
|
26
|
-
|
|
27
|
-
return `${JSError}${error}${doc}${JSExtraBuildDoc}`;
|
|
28
|
-
}
|
|
29
|
-
};
|