@rws-framework/client 2.10.8 → 2.10.10
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/_tools.js +23 -18
- package/cfg/build_steps/webpack/_actions.js +86 -0
- package/cfg/build_steps/webpack/_aliases.js +2 -2
- package/cfg/build_steps/webpack/_build_config.js +77 -0
- package/cfg/build_steps/webpack/_cache.js +99 -0
- package/cfg/build_steps/webpack/_component_handling.js +61 -0
- package/cfg/build_steps/webpack/_dev_servers.js +15 -0
- package/cfg/build_steps/webpack/_env_defines.js +19 -0
- package/cfg/build_steps/webpack/_loaders.js +215 -37
- package/cfg/build_steps/webpack/_plugins.js +104 -0
- package/cfg/build_steps/webpack/_timing.js +53 -0
- package/cfg/build_steps/webpack/_webpack_config.js +59 -0
- package/cfg/tsconfigSetup.js +53 -32
- package/console.js +3 -3
- package/package.json +5 -3
- package/rws.webpack.config.js +110 -242
- package/src/services/UtilsService.ts +1 -31
- package/webpack/loaders/rws_fast_html_loader.js +5 -1
- package/webpack/loaders/rws_fast_scss_loader.js +7 -3
- package/webpack/loaders/rws_fast_ts_loader.js +44 -102
- package/webpack/rws_scss_plugin.js +6 -3
- package/webpack/rws_webpack_plugin.js +138 -0
- package/webpack/scss/_compiler.js +1 -2
- package/webpack/scss/_fs.js +1 -1
- package/webpack/scss/_import.js +4 -2
- package/webpack/rws_after_plugin.js +0 -104
package/_tools.js
CHANGED
|
@@ -5,6 +5,9 @@ const { spawn } = require('child_process');
|
|
|
5
5
|
const JSON5 = require('json5');
|
|
6
6
|
|
|
7
7
|
const { setupTsConfig } = require('./cfg/tsconfigSetup');
|
|
8
|
+
const LoadersHelper = require('./cfg/build_steps/webpack/_loaders');
|
|
9
|
+
|
|
10
|
+
const { rwsPath } = require('@rws-framework/console');
|
|
8
11
|
|
|
9
12
|
function findRootWorkspacePath(currentPath) {
|
|
10
13
|
const parentPackageJsonPath = path.join(currentPath + '/..', 'package.json');
|
|
@@ -165,16 +168,17 @@ function findComponentFilesWithText(dir, text, ignored = [], fileList = []) {
|
|
|
165
168
|
|
|
166
169
|
if (fileStat.isDirectory() && !ignored.includes(file)) {
|
|
167
170
|
findComponentFilesWithText(filePath, text, ignored, fileList);
|
|
168
|
-
} else if (fileStat.isFile() && filePath.endsWith('.ts')) {
|
|
171
|
+
} else if (fileStat.isFile() && filePath.endsWith('component.ts')) {
|
|
169
172
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
170
173
|
if (content.includes(text)) {
|
|
171
|
-
|
|
174
|
+
try {
|
|
175
|
+
const compInfo = extractComponentInfo(content);
|
|
172
176
|
|
|
173
177
|
if (compInfo) {
|
|
174
178
|
|
|
175
|
-
const { tagName, className, options
|
|
179
|
+
const { tagName, className, options } = compInfo;
|
|
176
180
|
|
|
177
|
-
if (
|
|
181
|
+
if (options?.ignorePackaging) {
|
|
178
182
|
return;
|
|
179
183
|
}
|
|
180
184
|
|
|
@@ -188,6 +192,11 @@ function findComponentFilesWithText(dir, text, ignored = [], fileList = []) {
|
|
|
188
192
|
isIgnored: options?.ignorePackaging,
|
|
189
193
|
isOreo: options?.oreoMode
|
|
190
194
|
});
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
}catch(e){
|
|
198
|
+
console.log('ERRORER', e);
|
|
199
|
+
throw new Error(`findComponentFilesWithText('${dir}', '${text}') error`)
|
|
191
200
|
}
|
|
192
201
|
}
|
|
193
202
|
}
|
|
@@ -196,6 +205,7 @@ function findComponentFilesWithText(dir, text, ignored = [], fileList = []) {
|
|
|
196
205
|
return fileList;
|
|
197
206
|
}
|
|
198
207
|
|
|
208
|
+
|
|
199
209
|
function extractRWSViewArguments(sourceFile) {
|
|
200
210
|
let argumentsExtracted = {
|
|
201
211
|
className: null,
|
|
@@ -292,23 +302,18 @@ function extractRWSIgnoreArguments(sourceFile) {
|
|
|
292
302
|
}
|
|
293
303
|
|
|
294
304
|
function extractComponentInfo(componentCode) {
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
if (!componentNameRegex.test(componentCode)) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
305
|
+
const decoratorData = LoadersHelper.extractRWSViewArgs(componentCode, true);
|
|
300
306
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
let decoratorArgs = extractRWSViewArguments(tsSourceFile);
|
|
304
|
-
|
|
305
|
-
if (!decoratorArgs) {
|
|
306
|
-
decoratorArgs = {};
|
|
307
|
+
if(!decoratorData){
|
|
308
|
+
return null;
|
|
307
309
|
}
|
|
310
|
+
// console.log(decoratorData, componentCode);
|
|
308
311
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
return {
|
|
313
|
+
tagName: decoratorData.viewDecoratorData.tagName,
|
|
314
|
+
className: decoratorData.viewDecoratorData.className,
|
|
315
|
+
options: decoratorData.viewDecoratorData.decoratorArgs
|
|
316
|
+
};
|
|
312
317
|
}
|
|
313
318
|
|
|
314
319
|
function getAllFilesInFolder(folderPath, ignoreFilenames = [], recursive = false) {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
|
|
3
|
+
const { rwsRuntimeHelper } = require('@rws-framework/console');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function executeRWSStartActions(WEBPACK_AFTER_ACTIONS, serviceWorkerPath, BuildConfigurator, rwsFrontConfig) {
|
|
7
|
+
if (serviceWorkerPath) {
|
|
8
|
+
WEBPACK_AFTER_ACTIONS.push({
|
|
9
|
+
type: 'service_worker',
|
|
10
|
+
actionHandler: serviceWorkerPath
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const assetsToCopy = BuildConfigurator.get('copyAssets') || rwsFrontConfig.copyAssets;
|
|
15
|
+
|
|
16
|
+
if (!!assetsToCopy) {
|
|
17
|
+
WEBPACK_AFTER_ACTIONS.push({
|
|
18
|
+
type: 'copy',
|
|
19
|
+
actionHandler: assetsToCopy
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
function timingActions(WEBPACK_AFTER_ACTIONS, WEBPACK_AFTER_ERROR_ACTIONS, devDebug){
|
|
26
|
+
if(devDebug?.timing){
|
|
27
|
+
rwsRuntimeHelper.setRWSVar('_timer_css', 'none|0');
|
|
28
|
+
|
|
29
|
+
WEBPACK_AFTER_ACTIONS.push({
|
|
30
|
+
type: 'custom',
|
|
31
|
+
actionHandler: () => {
|
|
32
|
+
|
|
33
|
+
const cssTimesList = rwsRuntimeHelper.getRWSVar('_timer_css');
|
|
34
|
+
|
|
35
|
+
if(cssTimesList){
|
|
36
|
+
const cssTime = cssTimesList.split('\n').map((elString) => {
|
|
37
|
+
const item = elString.split('|')[1];
|
|
38
|
+
return item === '' ? 0 : parseInt(item)
|
|
39
|
+
}).reduce((acc, curr) => acc + curr, 0);
|
|
40
|
+
rwsRuntimeHelper.setRWSVar('_timer_css', 'none|0');
|
|
41
|
+
console.log(chalk.yellow('[RWS BUILD] (after)'), `CSS TIME: ${Math.round(cssTime)}`);
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
WEBPACK_AFTER_ERROR_ACTIONS.push({
|
|
49
|
+
type: 'custom',
|
|
50
|
+
actionHandler: () => {
|
|
51
|
+
console.log('CUSTOM ERROR');
|
|
52
|
+
rwsRuntimeHelper.setRWSVar('_timer_css', 'none|0');
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function devActions(WEBPACK_AFTER_ACTIONS, executionDir, devDebug){
|
|
58
|
+
const devExternalsVars = {
|
|
59
|
+
packed: [],
|
|
60
|
+
ignored: [],
|
|
61
|
+
frontendRequestContextCache: []
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if(devDebug?.build){
|
|
65
|
+
const debugDir = path.join(executionDir, '.debug');
|
|
66
|
+
|
|
67
|
+
if(!fs.existsSync(debugDir)){
|
|
68
|
+
fs.mkdirSync(debugDir)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
WEBPACK_AFTER_ACTIONS.push({
|
|
72
|
+
type: 'custom',
|
|
73
|
+
actionHandler: () => {
|
|
74
|
+
fs.writeFile(path.join(debugDir, 'in_vendors.json'), JSON.stringify(devExternalsVars.ignored, null, 2));
|
|
75
|
+
fs.writeFile(path.join(debugDir, 'rws_processed.json'), JSON.stringify(devExternalsVars.packed, null, 2));
|
|
76
|
+
fs.writeFile(path.join(debugDir, 'requestcache.json'), JSON.stringify(devExternalsVars.frontendRequestContextCache, null, 2));
|
|
77
|
+
|
|
78
|
+
console.log(chalk.yellow('[RWS BUILD] (after)'), `packaging debug saved in: ${debugDir}`);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return devExternalsVars;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = { devActions, timingActions, executeRWSStartActions }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
|
-
function loadAliases(packageDir, nodeModulesPath){
|
|
3
|
+
function loadAliases(packageDir, nodeModulesPath, srcDir){
|
|
4
4
|
return {
|
|
5
|
-
|
|
5
|
+
'src': srcDir + '/src',
|
|
6
6
|
'@rws-framework/foundation': path.resolve(packageDir, 'foundation', 'rws-foundation.js')
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { RWSConfigBuilder } = require('@rws-framework/console')
|
|
3
|
+
const { rwsPath } = require('@rws-framework/console');
|
|
4
|
+
const { _DEFAULT_CONFIG } = require('../../_default.cfg');
|
|
5
|
+
|
|
6
|
+
async function getBuildConfig(rwsFrontBuildConfig){
|
|
7
|
+
const BuildConfigurator = new RWSConfigBuilder(rwsPath.findPackageDir(process.cwd()) + '/.rws.json', {..._DEFAULT_CONFIG, ...rwsFrontBuildConfig});
|
|
8
|
+
const _packageDir = rwsPath.findPackageDir(process.cwd());
|
|
9
|
+
|
|
10
|
+
const executionDir = rwsPath.relativize(BuildConfigurator.get('executionDir') || rwsFrontBuildConfig.executionDir || process.cwd(), _packageDir);
|
|
11
|
+
const isWatcher = process.argv.includes('--watch') || false;
|
|
12
|
+
|
|
13
|
+
const isDev = isWatcher ? true : (BuildConfigurator.get('dev', rwsFrontBuildConfig.dev) || false);
|
|
14
|
+
const isHotReload = BuildConfigurator.get('hot', rwsFrontBuildConfig.hot);
|
|
15
|
+
const isReport = BuildConfigurator.get('report', rwsFrontBuildConfig.report);
|
|
16
|
+
const isParted = BuildConfigurator.get('parted', rwsFrontBuildConfig.parted || false);
|
|
17
|
+
|
|
18
|
+
const partedPrefix = BuildConfigurator.get('partedPrefix', rwsFrontBuildConfig.partedPrefix);
|
|
19
|
+
const partedDirUrlPrefix = BuildConfigurator.get('partedDirUrlPrefix', rwsFrontBuildConfig.partedDirUrlPrefix);
|
|
20
|
+
|
|
21
|
+
let partedComponentsLocations = BuildConfigurator.get('partedComponentsLocations', rwsFrontBuildConfig.partedComponentsLocations);
|
|
22
|
+
const customServiceLocations = BuildConfigurator.get('customServiceLocations', rwsFrontBuildConfig.customServiceLocations); //@todo: check if needed
|
|
23
|
+
const outputDir = rwsPath.relativize(BuildConfigurator.get('outputDir', rwsFrontBuildConfig.outputDir), _packageDir);
|
|
24
|
+
|
|
25
|
+
const outputFileName = BuildConfigurator.get('outputFileName') || rwsFrontBuildConfig.outputFileName;
|
|
26
|
+
const publicDir = BuildConfigurator.get('publicDir') || rwsFrontBuildConfig.publicDir;
|
|
27
|
+
const serviceWorkerPath = BuildConfigurator.get('serviceWorker') || rwsFrontBuildConfig.serviceWorker;
|
|
28
|
+
|
|
29
|
+
const publicIndex = BuildConfigurator.get('publicIndex') || rwsFrontBuildConfig.publicIndex;
|
|
30
|
+
|
|
31
|
+
const devTools = isDev ? (BuildConfigurator.get('devtool') || 'source-map') : false;
|
|
32
|
+
|
|
33
|
+
const _DEFAULT_DEV_DEBUG = { build: false, timing: false, rwsCache: false, profiling: false };
|
|
34
|
+
|
|
35
|
+
let devDebug = isDev ? (BuildConfigurator.get('devDebug') || rwsFrontBuildConfig.devDebug || {}) : {};
|
|
36
|
+
devDebug = {..._DEFAULT_DEV_DEBUG, ...devDebug}
|
|
37
|
+
|
|
38
|
+
const devRouteProxy = BuildConfigurator.get('devRouteProxy') || rwsFrontBuildConfig.devRouteProxy;
|
|
39
|
+
|
|
40
|
+
const tsConfigPath = rwsPath.relativize(BuildConfigurator.get('tsConfigPath') || rwsFrontBuildConfig.tsConfigPath, executionDir);
|
|
41
|
+
|
|
42
|
+
const rwsPlugins = {};
|
|
43
|
+
|
|
44
|
+
if(rwsFrontBuildConfig.rwsPlugins){
|
|
45
|
+
for(const pluginEntry of rwsFrontBuildConfig.rwsPlugins){
|
|
46
|
+
const pluginBuilder = (await import(`${pluginEntry}/build.js`)).default;
|
|
47
|
+
rwsPlugins[pluginEntry] = new pluginBuilder(BuildConfigurator, rwsFrontBuildConfig);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
executionDir,
|
|
53
|
+
isWatcher,
|
|
54
|
+
isDev,
|
|
55
|
+
isHotReload,
|
|
56
|
+
isReport,
|
|
57
|
+
isParted,
|
|
58
|
+
partedPrefix,
|
|
59
|
+
partedDirUrlPrefix,
|
|
60
|
+
partedComponentsLocations,
|
|
61
|
+
customServiceLocations,
|
|
62
|
+
outputDir,
|
|
63
|
+
outputFileName,
|
|
64
|
+
publicDir,
|
|
65
|
+
serviceWorkerPath,
|
|
66
|
+
publicIndex,
|
|
67
|
+
devTools,
|
|
68
|
+
devDebug,
|
|
69
|
+
devRouteProxy,
|
|
70
|
+
tsConfigPath,
|
|
71
|
+
rwsPlugins,
|
|
72
|
+
_packageDir,
|
|
73
|
+
BuildConfigurator
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = { getBuildConfig }
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const { rwsPath, rwsRuntimeHelper } = require('@rws-framework/console');
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const md5 = require('md5');
|
|
6
|
+
const chalk = require('chalk');
|
|
7
|
+
const { rmdir } = require('fs/promises');
|
|
8
|
+
|
|
9
|
+
class RWSCacheSystem {
|
|
10
|
+
constructor(customCompilationOptions){
|
|
11
|
+
const WORKSPACE = rwsPath.findRootWorkspacePath(process.cwd());
|
|
12
|
+
this.rwsDir = path.resolve(WORKSPACE, 'node_modules', '.rws');
|
|
13
|
+
|
|
14
|
+
this.customCompilationOptions = customCompilationOptions;
|
|
15
|
+
|
|
16
|
+
if(!fs.existsSync(this.rwsDir)){
|
|
17
|
+
fs.mkdirSync(this.rwsDir);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this.enabled = this.customCompilationOptions ? (this.customCompilationOptions?.devDebug?.rwsCache) === true : false;
|
|
21
|
+
|
|
22
|
+
if(!this.enabled){
|
|
23
|
+
if(fs.existsSync(this.rwsDir+'/front')){
|
|
24
|
+
console.log({pat: this.rwsDir+'/front'});
|
|
25
|
+
rmdir(this.rwsDir+'/front', { recursive: true });
|
|
26
|
+
console.log(chalk.red('[RWS CACHE] front cache removed.'));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
hasCachedItem(filePath){
|
|
32
|
+
return this.enabled ? rwsRuntimeHelper.getRWSVar(this.getCacheKey(filePath)) !== null : false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getCachedItem(filePath, fileHash = null){
|
|
36
|
+
if(!this.enabled){
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const key = this.getCacheKey(filePath);
|
|
41
|
+
const item = rwsRuntimeHelper.getRWSVar(key);
|
|
42
|
+
let itemCfg = rwsRuntimeHelper.getRWSVar(key + '.cfg.json');
|
|
43
|
+
|
|
44
|
+
if(itemCfg){
|
|
45
|
+
itemCfg = JSON.parse(itemCfg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if(item){
|
|
49
|
+
if((!itemCfg || !fileHash) || itemCfg.sourceHash !== fileHash){
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return item;
|
|
54
|
+
}else{
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
cacheItem(filePath, processedContent, sourceContent){
|
|
60
|
+
if(!this.enabled){
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const key = this.getCacheKey(filePath);
|
|
65
|
+
|
|
66
|
+
rwsRuntimeHelper.setRWSVar(key, processedContent);
|
|
67
|
+
rwsRuntimeHelper.setRWSVar(key + '.cfg.json', JSON.stringify({
|
|
68
|
+
sourceHash: md5(sourceContent),
|
|
69
|
+
sourceFileName: filePath
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
removeCacheItem(filePath){
|
|
74
|
+
if(!this.enabled){
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
rwsRuntimeHelper.removeRWSVar(this.getCacheKey(filePath));
|
|
79
|
+
rwsRuntimeHelper.removeRWSVar(this.getCacheKey(filePath) + '.cfg.json');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getCacheKey(filePath){
|
|
83
|
+
return `front/${md5(filePath)}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const RWSCache = {
|
|
88
|
+
_instance: null,
|
|
89
|
+
cache: (customCompilationOptions) => {
|
|
90
|
+
|
|
91
|
+
if(!this._instance){
|
|
92
|
+
this._instance = new RWSCacheSystem(customCompilationOptions);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return this._instance;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = RWSCache;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const tools = require('../../../_tools');
|
|
5
|
+
|
|
6
|
+
function scanComponents(partedComponentsLocations, executionDir, pkgCodeDir) {
|
|
7
|
+
const foundRWSUserClasses = tools.findComponentFilesWithText(executionDir, '@RWSView', ['dist', 'node_modules', '@rws-framework/client']);
|
|
8
|
+
const foundRWSClientClasses = tools.findComponentFilesWithText(pkgCodeDir, '@RWSView', ['dist', 'node_modules']);
|
|
9
|
+
let RWSComponents = [...foundRWSUserClasses, ...foundRWSClientClasses];
|
|
10
|
+
|
|
11
|
+
if (partedComponentsLocations) {
|
|
12
|
+
partedComponentsLocations.forEach((componentDir) => {
|
|
13
|
+
RWSComponents = [...RWSComponents, ...(tools.findComponentFilesWithText(path.resolve(componentDir), '@RWSView', ['dist', 'node_modules', '@rws-framework/client']))];
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return RWSComponents;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function setComponentsChunks(clientEntry, RWSComponents = [], isParted = false) {
|
|
21
|
+
let automatedChunks = {
|
|
22
|
+
client: clientEntry,
|
|
23
|
+
};
|
|
24
|
+
const automatedEntries = {};
|
|
25
|
+
RWSComponents.forEach((fileInfo) => {
|
|
26
|
+
const isIgnored = fileInfo.isIgnored;
|
|
27
|
+
|
|
28
|
+
if (isIgnored === true) {
|
|
29
|
+
// console.warn('Ignored: '+ fileInfo.filePath);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
automatedEntries[fileInfo.tagName] = fileInfo.filePath;
|
|
34
|
+
|
|
35
|
+
if (isParted) {
|
|
36
|
+
automatedChunks[fileInfo.tagName] = fileInfo.filePath;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return { automatedChunks, automatedEntries }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function generateRWSInfoFile(outputDir, automatedEntries) {
|
|
44
|
+
const rwsInfoJson = outputDir + '/rws_info.json'
|
|
45
|
+
fs.writeFile(rwsInfoJson, JSON.stringify({ components: Object.keys(automatedEntries) }, null, 2), () => {});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function partedComponentsEvents(partedComponentsLocations, rwsPlugins, isParted) {
|
|
49
|
+
if(!isParted){
|
|
50
|
+
return partedComponentsLocations;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (const pluginKey of Object.keys(rwsPlugins)) {
|
|
54
|
+
const plugin = rwsPlugins[pluginKey];
|
|
55
|
+
partedComponentsLocations = await plugin.onComponentsLocated(partedComponentsLocations);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return partedComponentsLocations;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = { scanComponents, setComponentsChunks, generateRWSInfoFile, partedComponentsEvents }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
function webpackDevServer(BuildConfigurator, rwsFrontendConfig, cfgExport){
|
|
4
|
+
const backendUrl = BuildConfigurator.get('backendUrl') || rwsFrontendConfig.backendUrl;
|
|
5
|
+
const apiPort = BuildConfigurator.get('apiPort') || rwsFrontendConfig.apiPort;
|
|
6
|
+
|
|
7
|
+
if (backendUrl && apiPort) {
|
|
8
|
+
// cfgExport.devServer = {
|
|
9
|
+
// hot: true, // Enable hot module replacement
|
|
10
|
+
// open: true, // Automatically open the browser
|
|
11
|
+
// }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = { webpackDevServer }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
function processEnvDefines(BuildConfigurator, config, devDebug) {
|
|
4
|
+
let _rws_defines = {
|
|
5
|
+
'process.env._RWS_DEV_DEBUG': JSON.stringify(devDebug),
|
|
6
|
+
'process.env._RWS_DEFAULTS': JSON.stringify(BuildConfigurator.exportDefaultConfig()),
|
|
7
|
+
'process.env._RWS_BUILD_OVERRIDE': JSON.stringify(BuildConfigurator.exportBuildConfig())
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const rwsDefines = BuildConfigurator.get('rwsDefines') || config.rwsDefines || null;
|
|
11
|
+
|
|
12
|
+
if (rwsDefines) {
|
|
13
|
+
_rws_defines = { ..._rws_defines, ...rwsDefines }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return _rws_defines;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = { processEnvDefines }
|