@oroinc/oro-webpack-config-builder 5.1.0-alpha8 → 5.1.0-lts001
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 +1 -1
- package/error-handler.js +95 -0
- package/loader/config-loader.js +1 -2
- package/loader/inject-loader/LICENSE.md +21 -0
- package/loader/inject-loader/README.md +54 -0
- package/loader/inject-loader/index.js +10 -0
- package/loader/inject-loader/injectify.js +66 -0
- package/loader/inject-loader/package.json +55 -0
- package/loader/inject-loader/wrapper_template.js +32 -0
- package/modules-config/layout-modules-config-loader.js +66 -2
- package/modules-config/modules-config-loader.js +52 -19
- package/oro-webpack-config.js +416 -301
- package/package.json +37 -37
- package/plugin/logs/after-webpack-logs-plugin.js +25 -0
- package/style/admin-style-loader.js +23 -0
- package/style/layout-style-loader.js +12 -109
- package/style/style-loader.js +156 -46
- package/theme-config-factory.js +45 -6
- 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/configs-file-writer.js +1 -1
- package/writer/dynamic-imports-file-writer.js +3 -3
- package/writer/scss-entry-point-file-writer.js +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const {isProdMode} = require('../utils');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const schema = require('./schemas/assets-schema');
|
|
5
|
+
const fullSchema = require('./schemas/assets-schema-full');
|
|
6
|
+
const schemaValidator = require('./schema-validator');
|
|
7
|
+
const EventEmitter = require('events');
|
|
8
|
+
const emitter = new EventEmitter();
|
|
9
|
+
const AssetsSchemaError = require('./errors/assets-schema-error');
|
|
10
|
+
const AssetsInputFileError = require('./errors/assets-input-file-error');
|
|
11
|
+
|
|
12
|
+
module.exports = Object.assign({}, schemaValidator, {
|
|
13
|
+
emitter,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} filePath
|
|
17
|
+
* @param {Object} doc
|
|
18
|
+
* @param {string} theme
|
|
19
|
+
* @returns {boolean|undefined}
|
|
20
|
+
*/
|
|
21
|
+
checkSchema(filePath, doc, theme) {
|
|
22
|
+
if (isProdMode()) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const result = this.validateSchema(schema, doc);
|
|
26
|
+
|
|
27
|
+
if (!result.valid) {
|
|
28
|
+
const error = new AssetsSchemaError(result.formattedError, [filePath], theme);
|
|
29
|
+
|
|
30
|
+
this.emitter.emit('error', error);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return result.valid;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {Object} doc
|
|
38
|
+
* @param {Array} files
|
|
39
|
+
* @param {string} theme
|
|
40
|
+
* @returns {boolean|undefined}
|
|
41
|
+
*/
|
|
42
|
+
checkFullSchema(doc, files = [], theme) {
|
|
43
|
+
if (isProdMode()) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const result = this.validateSchema(fullSchema, doc);
|
|
47
|
+
|
|
48
|
+
if (!result.valid) {
|
|
49
|
+
const error = new AssetsSchemaError(result.formattedError, files, theme);
|
|
50
|
+
|
|
51
|
+
this.emitter.emit('error', error);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return result.valid;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {string} filePath
|
|
59
|
+
* @param {Object} doc
|
|
60
|
+
* @param {string} theme
|
|
61
|
+
* @returns {boolean|undefined}
|
|
62
|
+
*/
|
|
63
|
+
checkInputsExist(filePath, doc, theme) {
|
|
64
|
+
if (isProdMode()) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let valid = true;
|
|
69
|
+
for (const [, props] of Object.entries(doc)) {
|
|
70
|
+
if (!Array.isArray(props.inputs)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const files = [];
|
|
75
|
+
props.inputs.forEach(input => {
|
|
76
|
+
if (typeof input === 'object') {
|
|
77
|
+
const newPath = Object.values(input)[0];
|
|
78
|
+
|
|
79
|
+
if (newPath === '~') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
input = newPath;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const fullBasePath = path.resolve(input);
|
|
86
|
+
const fullPath = path.resolve(this._publicPath + input);
|
|
87
|
+
// skip the path to global node modules,
|
|
88
|
+
// e.g. '~bootstrap/scss/bootstrap'
|
|
89
|
+
if (!input.startsWith('~') && !fs.existsSync(fullPath) && !fs.existsSync(fullBasePath)) {
|
|
90
|
+
files.push(input);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (files.length) {
|
|
94
|
+
valid = false;
|
|
95
|
+
files.forEach(notExistFile => {
|
|
96
|
+
const error = new AssetsInputFileError(notExistFile, filePath);
|
|
97
|
+
|
|
98
|
+
this.emitter.emit('error', error);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return valid;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const BaseError = require('./base-error');
|
|
2
|
+
|
|
3
|
+
class AssetsInputFileError extends BaseError {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* Invalid styles config: input file does not exist /scss/test.scss
|
|
7
|
+
* at /config/assets.yml
|
|
8
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
9
|
+
*
|
|
10
|
+
* @param {string} notExistFile
|
|
11
|
+
* @param {string} path
|
|
12
|
+
*/
|
|
13
|
+
constructor(notExistFile, path) {
|
|
14
|
+
const msg = `input file does not exist: ${notExistFile}\nat ${path}:1`;
|
|
15
|
+
|
|
16
|
+
super(msg);
|
|
17
|
+
|
|
18
|
+
this.name = 'Invalid styles config';
|
|
19
|
+
this.docLink =
|
|
20
|
+
'https://doc.oroinc.com/backend/bundles/platform/AssetBundle/#load-scss-or-css-files-from-the-bundle';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = AssetsInputFileError;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const BaseError = require('./base-error');
|
|
2
|
+
|
|
3
|
+
class AssetsSchemaError extends BaseError {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* Invalid styles config: the "assets.yml" in the "default" theme file does not match the API schema.
|
|
7
|
+
* styles.inputs[0] should be: string | object
|
|
8
|
+
* at /config/assets.yml
|
|
9
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* Invalid styles config: the "assets.yml" file the "default" theme does not match the API schema.
|
|
13
|
+
* styles misses the property 'output'.
|
|
14
|
+
* List of processed files for the "default" theme:
|
|
15
|
+
* /default/config/assets.yml
|
|
16
|
+
* /default/config/assets.yml
|
|
17
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
18
|
+
*
|
|
19
|
+
* @param {string} reason
|
|
20
|
+
* @param {Array} files
|
|
21
|
+
* @param {string} theme
|
|
22
|
+
*/
|
|
23
|
+
constructor(reason, files, theme) {
|
|
24
|
+
let msg = `the "assets.yml" file in the "${theme}" theme does not match the API schema.\n${reason}`;
|
|
25
|
+
|
|
26
|
+
const filesListMsg = BaseError.generateFilesListMsg(files, theme);
|
|
27
|
+
|
|
28
|
+
if (filesListMsg.length) {
|
|
29
|
+
msg = `${msg}\n${filesListMsg}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
super(msg);
|
|
33
|
+
|
|
34
|
+
this.name = 'Invalid styles config';
|
|
35
|
+
this.docLink =
|
|
36
|
+
'https://doc.oroinc.com/backend/bundles/platform/AssetBundle/#load-scss-or-css-files-from-the-bundle';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = AssetsSchemaError;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const {isVerboseMode} = require('../../utils');
|
|
2
|
+
|
|
3
|
+
class BaseError extends Error {
|
|
4
|
+
/**
|
|
5
|
+
* Prepares documentation phrase
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
get extra() {
|
|
9
|
+
return this.docLink ? `Please, find more information in the documentation ${this.docLink}` : '';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates an instance of BaseError
|
|
14
|
+
* @param {string} message error message
|
|
15
|
+
*/
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates a part of message about processed files
|
|
22
|
+
* @param {Array} files
|
|
23
|
+
* @param {string} theme
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
static generateFilesListMsg(files, theme) {
|
|
27
|
+
if (files.length === 1) {
|
|
28
|
+
return `at ${files[0]}:1`;
|
|
29
|
+
} else if (isVerboseMode()) {
|
|
30
|
+
return `List of processed files for the "${theme}" theme:\n ${files.join('\n ')}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = BaseError;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const BaseError = require('./base-error');
|
|
2
|
+
|
|
3
|
+
class JsmodulesExtraModulesError extends BaseError {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* Failed assembly JS: sections ["shim"] are not allowed in extra js build definition.
|
|
7
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
8
|
+
*
|
|
9
|
+
* @param {Array} parts
|
|
10
|
+
*/
|
|
11
|
+
constructor(parts) {
|
|
12
|
+
const msg = `sections ["${parts.join('", "')}"] are not allowed in extra js build definition.`;
|
|
13
|
+
|
|
14
|
+
super(msg);
|
|
15
|
+
|
|
16
|
+
this.name = 'Failed assembly JS';
|
|
17
|
+
this.docLink =
|
|
18
|
+
'https://doc.oroinc.com/master/frontend/storefront/how-to/how-to-create-extra-js-build-for-landing-page';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = JsmodulesExtraModulesError;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const BaseError = require('./base-error');
|
|
2
|
+
|
|
3
|
+
class JSModulesSchemaError extends BaseError {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* Invalid JS config: the "jsmodules.yml" files in the "default" theme do not match the API schema.
|
|
7
|
+
* has an unknown property 'rest'.
|
|
8
|
+
* at default/config/jsmodules.yml
|
|
9
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* Invalid JS config: the "jsmodules.yml" files in the "default" theme do not match the API schema.
|
|
13
|
+
* misses the property 'entry'.
|
|
14
|
+
* List of processed files for the "default" theme:
|
|
15
|
+
* /default/config/jsmodules.yml
|
|
16
|
+
* /default/config/jsmodules.yml
|
|
17
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
18
|
+
*
|
|
19
|
+
* @param {string} reason
|
|
20
|
+
* @param {Array} files
|
|
21
|
+
* @param {string} theme
|
|
22
|
+
*/
|
|
23
|
+
constructor(reason, files, theme) {
|
|
24
|
+
let msg = `the "jsmodules.yml" files in the "${theme}" theme do not match the API schema.\n${reason}`;
|
|
25
|
+
|
|
26
|
+
const filesListMsg = BaseError.generateFilesListMsg(files, theme);
|
|
27
|
+
|
|
28
|
+
if (filesListMsg.length) {
|
|
29
|
+
msg = `${msg}\n${filesListMsg}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
super(msg);
|
|
33
|
+
|
|
34
|
+
this.name = 'Invalid JS config';
|
|
35
|
+
this.docLink =
|
|
36
|
+
'https://doc.oroinc.com/backend/bundles/platform/AssetBundle/#create-jsmodules-yml-configuration';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = JSModulesSchemaError;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const BaseError = require('./base-error');
|
|
2
|
+
|
|
3
|
+
class StylesError extends BaseError {
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* Failed assembly styles: the "output" for "styles" entry point in "default" theme is not defined.
|
|
7
|
+
* Please, find more information in the documentation https://doc.oroinc.com/...
|
|
8
|
+
*
|
|
9
|
+
* @param {string} key
|
|
10
|
+
* @param {string} group
|
|
11
|
+
* @param {string} theme
|
|
12
|
+
*/
|
|
13
|
+
constructor(key, group, theme) {
|
|
14
|
+
const msg = `the "${key}" for "${group}" entry point in "${theme}" theme is not defined.`;
|
|
15
|
+
|
|
16
|
+
super(msg);
|
|
17
|
+
|
|
18
|
+
this.name = 'Failed assembly styles';
|
|
19
|
+
this.docLink =
|
|
20
|
+
'https://doc.oroinc.com/backend/bundles/platform/AssetBundle/#load-scss-or-css-files-from-the-bundle';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = StylesError;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const assetsValidation = require('./assets-validator');
|
|
2
|
+
const jsmodulesValidator = require('./jsmodules-validator');
|
|
3
|
+
|
|
4
|
+
const isJSModulesPath = path => /jsmodules([-a-zA-Z\d]*)\.yml$/.test(path);
|
|
5
|
+
const isAssetsPath = path => /assets\.yml$/.test(path);
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
assetsValidation,
|
|
9
|
+
jsmodulesValidator,
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* set public path for all validators
|
|
13
|
+
* {string} path
|
|
14
|
+
*/
|
|
15
|
+
setPublicPath(path) {
|
|
16
|
+
[assetsValidation, jsmodulesValidator].forEach(validator => validator.setPublicPath(path));
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Run appropriate validator
|
|
21
|
+
* {string} filePath
|
|
22
|
+
* {Object} doc
|
|
23
|
+
* {string} theme
|
|
24
|
+
*/
|
|
25
|
+
checkSchema(filePath, doc, theme) {
|
|
26
|
+
if (isJSModulesPath(filePath)) {
|
|
27
|
+
jsmodulesValidator.checkSchema(filePath, doc, theme);
|
|
28
|
+
} else if (isAssetsPath(filePath)) {
|
|
29
|
+
const validSchema = assetsValidation.checkSchema(filePath, doc, theme);
|
|
30
|
+
|
|
31
|
+
if (validSchema) {
|
|
32
|
+
assetsValidation.checkInputsExist(filePath, doc, theme);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const schema = require('./schemas/jsmodules-schema');
|
|
2
|
+
const fullSchema = require('./schemas/jsmodules-schema-full');
|
|
3
|
+
const schemaValidator = require('./schema-validator');
|
|
4
|
+
const {isProdMode} = require('../utils');
|
|
5
|
+
const EventEmitter = require('events');
|
|
6
|
+
const emitter = new EventEmitter();
|
|
7
|
+
const JSModulesSchemaError = require('./errors/jsmodules-schema-error');
|
|
8
|
+
|
|
9
|
+
module.exports = Object.assign({}, schemaValidator, {
|
|
10
|
+
emitter,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} filePath
|
|
14
|
+
* @param {Object} doc
|
|
15
|
+
* @param {string} theme
|
|
16
|
+
* @returns {boolean|undefined}
|
|
17
|
+
*/
|
|
18
|
+
checkSchema(filePath, doc, theme) {
|
|
19
|
+
if (isProdMode()) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const result = this.validateSchema(schema, doc);
|
|
23
|
+
|
|
24
|
+
if (!result.valid) {
|
|
25
|
+
const error = new JSModulesSchemaError(result.formattedError, [filePath], theme);
|
|
26
|
+
|
|
27
|
+
this.emitter.emit('error', error);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return result.valid;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Object} doc
|
|
35
|
+
* @param {Array} files
|
|
36
|
+
* @param {string} theme
|
|
37
|
+
* @returns {boolean|undefined}
|
|
38
|
+
*/
|
|
39
|
+
checkFullSchema(doc, files = [], theme) {
|
|
40
|
+
if (isProdMode()) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const result = this.validateSchema(fullSchema, doc);
|
|
44
|
+
|
|
45
|
+
if (!result.valid) {
|
|
46
|
+
const error = new JSModulesSchemaError(result.formattedError, files, theme);
|
|
47
|
+
|
|
48
|
+
this.emitter.emit('error', error);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return result.valid;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const {validate} = require('schema-utils');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
/**
|
|
5
|
+
* Symfony public directory path related to application root folder
|
|
6
|
+
* {string}
|
|
7
|
+
*/
|
|
8
|
+
_publicPath: 'public/',
|
|
9
|
+
|
|
10
|
+
setPublicPath(path) {
|
|
11
|
+
this._publicPath = path;
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Validates data according to the schema
|
|
16
|
+
* @param {Object} scheme
|
|
17
|
+
* @param {Object} data
|
|
18
|
+
* @param {Object} [options]
|
|
19
|
+
* @returns {Object}
|
|
20
|
+
*/
|
|
21
|
+
validateSchema(scheme, data, options) {
|
|
22
|
+
const result = {
|
|
23
|
+
valid: true
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const baseDataPath = 'configuration';
|
|
28
|
+
const basePathReg = /^configuration\./;
|
|
29
|
+
validate(scheme, data, {
|
|
30
|
+
baseDataPath,
|
|
31
|
+
...options || {},
|
|
32
|
+
postFormatter(formattedError, error) {
|
|
33
|
+
if (result.formattedError === void 0) {
|
|
34
|
+
result.formattedError = [];
|
|
35
|
+
}
|
|
36
|
+
result.error = error;
|
|
37
|
+
|
|
38
|
+
if (
|
|
39
|
+
Array.isArray(error.params.type) ||
|
|
40
|
+
error.params.missingProperty
|
|
41
|
+
) {
|
|
42
|
+
// remove an excess line break
|
|
43
|
+
formattedError = formattedError.replace(/\n/g, ' ');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
formattedError = formattedError.replace(basePathReg, '');
|
|
47
|
+
result.formattedError.push(formattedError.trim());
|
|
48
|
+
return formattedError;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
} catch (e) {
|
|
52
|
+
result.valid = false;
|
|
53
|
+
result.errorMessage = e.message;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (result.formattedError) {
|
|
57
|
+
result.formattedError = result.formattedError.join('\n');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema to validate assets.yml files
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* Full scheme complements "assets-schema" one.
|
|
6
|
+
* It should have only rules which are not defined in "assets-schema" schema due to avoid duplicates in error messages
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
type: 'object',
|
|
10
|
+
patternProperties: {
|
|
11
|
+
'.*': {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
inputs: {
|
|
15
|
+
description: 'The "inputs" property is an array of files to load.',
|
|
16
|
+
minItems: 1
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
required: ['inputs', 'output']
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema to validate assets.yml files
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
type: 'object',
|
|
6
|
+
patternProperties: {
|
|
7
|
+
'.*': {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
inputs: {
|
|
11
|
+
description: 'The "inputs" property is an array of files to load.',
|
|
12
|
+
type: 'array',
|
|
13
|
+
items: {
|
|
14
|
+
type: ['string', 'object']
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
output: {
|
|
18
|
+
description: 'Output file path inside "public/" directory for the entry point',
|
|
19
|
+
type: 'string'
|
|
20
|
+
},
|
|
21
|
+
auto_rtl_inputs: {
|
|
22
|
+
description: 'List of wildcard file masks for inputs that has to be processed with RTL plugin.',
|
|
23
|
+
type: 'array',
|
|
24
|
+
items: {
|
|
25
|
+
type: 'string'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
additionalProperties: false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -12,7 +12,7 @@ class ConfigsFileWriter {
|
|
|
12
12
|
/**
|
|
13
13
|
* Write app-modules.js file and return file path
|
|
14
14
|
*
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {Object} configs List of configurable modules
|
|
16
16
|
* @param {string} output Output file path
|
|
17
17
|
* @returns {string} JS file path of an output file
|
|
18
18
|
*/
|
|
@@ -19,9 +19,9 @@ 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
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
22
|
+
const notation = chunkName === 'commons'
|
|
23
|
+
? '/* webpackMode: "eager" */' : `/* webpackChunkName: "${chunkName}" */`;
|
|
24
|
+
return moduleNames.map(moduleName =>`'${moduleName}': () => import(${notation}'${moduleName}')`);
|
|
25
25
|
});
|
|
26
26
|
content = `module.exports = {\n ${content.flat().join(',\n ')}\n};\n`;
|
|
27
27
|
const filepath = path.resolve(this._publicPath + buildPath);
|
|
@@ -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`;
|