@rws-framework/client 2.14.1 → 2.15.0
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/builder/vite/index.ts +0 -0
- package/builder/vite/loaders/html.ts +0 -0
- package/builder/vite/loaders/index.ts +0 -0
- package/builder/vite/loaders/loader.type.ts +0 -0
- package/builder/vite/loaders/scss.ts +0 -0
- package/builder/vite/loaders/ts.ts +0 -0
- package/builder/vite/rws.vite.config.ts +0 -0
- package/builder/vite/rws_scss_plugin.ts +0 -0
- package/builder/vite/scss/_compiler.ts +0 -0
- package/builder/vite/scss/_fonts.ts +0 -0
- package/builder/vite/scss/_fs.ts +0 -0
- package/builder/vite/scss/_import.ts +0 -0
- package/builder/webpack/after/copy.js +1 -0
- package/builder/webpack/loaders/rws_fast_scss_loader.js +3 -1
- package/builder/webpack/loaders/rws_fast_ts_loader.js +2 -3
- package/builder/webpack/rws.webpack.config.js +12 -25
- package/builder/webpack/rws_scss_plugin.js +18 -9
- package/builder/webpack/scss/_compiler.js +5 -6
- package/builder/webpack/scss/_fonts.js +2 -2
- package/builder/webpack/scss/_fs.js +3 -2
- package/builder/webpack/scss/_import.js +53 -19
- package/cfg/build_steps/vite/_build_config.ts +0 -0
- package/cfg/build_steps/vite/_env_defines.ts +0 -0
- package/cfg/build_steps/vite/_loaders.ts +0 -0
- package/cfg/build_steps/vite/index.ts +0 -0
- package/cfg/build_steps/vite/types.ts +0 -0
- package/cfg/build_steps/webpack/_actions.js +0 -0
- package/cfg/build_steps/webpack/_aliases.js +1 -2
- package/cfg/build_steps/webpack/_build_config.js +10 -11
- package/cfg/build_steps/webpack/_component_handling.js +1 -1
- package/cfg/build_steps/webpack/_dev_servers.js +0 -0
- package/cfg/build_steps/webpack/_env_defines.js +1 -1
- package/cfg/build_steps/webpack/_info.js +12 -5
- package/cfg/build_steps/webpack/_loaders.js +39 -19
- package/cfg/build_steps/webpack/_parser.js +118 -0
- package/cfg/build_steps/webpack/_plugins.js +6 -6
- package/cfg/build_steps/webpack/_production.js +8 -10
- package/cfg/build_steps/webpack/_rws_externals.js +2 -2
- package/cfg/build_steps/webpack/_webpack_config.js +6 -12
- package/cfg/tsconfigSetup.js +4 -7
- package/package.json +13 -13
- package/src/styles/README.md +158 -0
- package/src/styles/_grid_legacy.scss +50 -0
- package/tsconfig.json +20 -31
package/builder/vite/index.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/builder/vite/scss/_fs.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -32,6 +32,7 @@ module.exports = async (copyList = {}, pluginCfg) => {
|
|
|
32
32
|
// If sourcePath is a directory, collect all files recursively
|
|
33
33
|
const allFiles = collectFiles(sourcePath);
|
|
34
34
|
allFiles.forEach((file) => {
|
|
35
|
+
|
|
35
36
|
const relativePath = path.relative(sourcePath, file);
|
|
36
37
|
const targetFilePath = path.join(targetPath, relativePath);
|
|
37
38
|
const targetFileDir = path.dirname(targetFilePath);
|
|
@@ -8,7 +8,9 @@ module.exports = async function(content) {
|
|
|
8
8
|
const componentPath = path.resolve(componentDir, 'component.ts');
|
|
9
9
|
const isDev = this._compiler.options.mode === 'development';
|
|
10
10
|
const saveFile = content.indexOf('@save') > -1;
|
|
11
|
-
const plugin = new RWSScssPlugin(
|
|
11
|
+
const plugin = new RWSScssPlugin({
|
|
12
|
+
rwsWorkspaceDir: this.query?.rwsWorkspaceDir
|
|
13
|
+
});
|
|
12
14
|
let fromTs = false;
|
|
13
15
|
|
|
14
16
|
if(saveFile){
|
|
@@ -12,8 +12,7 @@ module.exports = async function(content) {
|
|
|
12
12
|
const filePath = this.resourcePath;
|
|
13
13
|
const isDev = this._compiler.options.mode === 'development';
|
|
14
14
|
let isIgnored = false;
|
|
15
|
-
let isDebugged = false;
|
|
16
|
-
|
|
15
|
+
let isDebugged = false;
|
|
17
16
|
// timingStart('decorator_extraction');
|
|
18
17
|
const decoratorExtract = LoadersHelper.extractRWSViewArgs(processedContent);
|
|
19
18
|
const decoratorData = decoratorExtract ? decoratorExtract.viewDecoratorData : null;
|
|
@@ -62,7 +61,7 @@ module.exports = async function(content) {
|
|
|
62
61
|
try {
|
|
63
62
|
if(tagName){
|
|
64
63
|
const [template, htmlFastImports, templateExists] = await LoadersHelper.getTemplate(filePath, this.addDependency, templateName, isDev);
|
|
65
|
-
const styles = await LoadersHelper.getStyles(filePath, this.addDependency, templateExists, stylesPath, isDev);
|
|
64
|
+
const styles = await LoadersHelper.getStyles(filePath, this.query?.rwsWorkspaceDir, this.addDependency, templateExists, stylesPath, isDev);
|
|
66
65
|
|
|
67
66
|
if(className){
|
|
68
67
|
const replacedViewDecoratorContent = decoratorExtract.replacedDecorator;
|
|
@@ -22,7 +22,7 @@ const _MAIN_PACKAGE = rwsPath.findRootWorkspacePath(process.cwd());
|
|
|
22
22
|
|
|
23
23
|
// #SECTION INIT OPTIONS
|
|
24
24
|
|
|
25
|
-
const RWSWebpackWrapper = async (rwsFrontendConfig) => {
|
|
25
|
+
const RWSWebpackWrapper = async (rwsFrontendConfig, _packageDir) => {
|
|
26
26
|
const {
|
|
27
27
|
executionDir,
|
|
28
28
|
isWatcher,
|
|
@@ -42,11 +42,10 @@ const RWSWebpackWrapper = async (rwsFrontendConfig) => {
|
|
|
42
42
|
devTools,
|
|
43
43
|
devDebug,
|
|
44
44
|
devRouteProxy,
|
|
45
|
-
|
|
45
|
+
tsConfig,
|
|
46
46
|
rwsPlugins,
|
|
47
|
-
_packageDir,
|
|
48
47
|
BuildConfigurator
|
|
49
|
-
} = await getBuildConfig(rwsFrontendConfig);
|
|
48
|
+
} = await getBuildConfig(rwsFrontendConfig, _packageDir);
|
|
50
49
|
|
|
51
50
|
timeLog({ devDebug });
|
|
52
51
|
|
|
@@ -55,25 +54,20 @@ const RWSWebpackWrapper = async (rwsFrontendConfig) => {
|
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
rwsPath.removeDirectory(outputDir, true);
|
|
58
|
-
buildInfo.start(executionDir,
|
|
57
|
+
buildInfo.start(executionDir, tsConfig, outputDir, isDev, publicDir, isParted, partedPrefix, partedDirUrlPrefix, devTools, rwsFrontendConfig.rwsPlugins);
|
|
59
58
|
|
|
60
59
|
// #SECTION INIT PLUGINS && ENV VARS DEFINES
|
|
61
|
-
addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotReload, isReport
|
|
60
|
+
addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotReload, isReport);
|
|
62
61
|
|
|
63
62
|
const WEBPACK_AFTER_ACTIONS = rwsFrontendConfig.actions || [];
|
|
64
63
|
const WEBPACK_AFTER_ERROR_ACTIONS = rwsFrontendConfig.error_actions || [];
|
|
65
64
|
|
|
66
|
-
const modules_setup = ['node_modules'];
|
|
65
|
+
const modules_setup = [path.resolve(tools.findRootWorkspacePath(executionDir), 'node_modules')];
|
|
67
66
|
|
|
68
67
|
let optimConfig = null;
|
|
69
68
|
let aliases = rwsFrontendConfig.aliases || {};
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
__filename,
|
|
73
|
-
_packageDir
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
aliases = { ...aliases, ...loadAliases(__dirname, path.resolve(_MAIN_PACKAGE, 'node_modules'), executionDir) }
|
|
70
|
+
aliases = { ...aliases, ...loadAliases(_packageDir, path.resolve(_MAIN_PACKAGE, 'node_modules'), executionDir) }
|
|
77
71
|
|
|
78
72
|
// #SECTION PLUGIN STARTING HOOKS
|
|
79
73
|
|
|
@@ -85,22 +79,15 @@ const RWSWebpackWrapper = async (rwsFrontendConfig) => {
|
|
|
85
79
|
|
|
86
80
|
|
|
87
81
|
// #SECTION RWS COMPONENT SCAN && PARTED PROCESSING
|
|
88
|
-
const RWSComponents = scanComponents(await partedComponentsEvents(partedComponentsLocations, rwsPlugins, isParted), executionDir,
|
|
82
|
+
const RWSComponents = scanComponents(await partedComponentsEvents(partedComponentsLocations, rwsPlugins, isParted), executionDir, _packageDir);
|
|
89
83
|
console.log(`${chalk.cyanBright('RWS Scanned')} ${chalk.yellowBright(RWSComponents.length)} components`);
|
|
90
|
-
const { automatedChunks, automatedEntries } = setComponentsChunks(rwsFrontendConfig.
|
|
84
|
+
const { automatedChunks, automatedEntries } = setComponentsChunks(rwsFrontendConfig.entrypoint, RWSComponents, isParted);
|
|
91
85
|
|
|
92
86
|
// #SECTION RWS INFO FILE
|
|
93
87
|
generateRWSInfoFile(outputDir, automatedEntries);
|
|
94
88
|
console.log(chalk.greenBright(`RWSInfo file generated.`));
|
|
95
89
|
|
|
96
90
|
|
|
97
|
-
// #SECTION TSCONFIG VALIDATION/SETUP
|
|
98
|
-
const tsValidated = tools.setupTsConfig(tsConfigPath, executionDir, rwsFrontendConfig.aliases);
|
|
99
|
-
|
|
100
|
-
if (!tsValidated) {
|
|
101
|
-
throw new Error('RWS Webpack build failed.');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
91
|
if (!isDev) {
|
|
105
92
|
// #SECTION RWS PROD SETUP
|
|
106
93
|
|
|
@@ -128,7 +115,6 @@ const RWSWebpackWrapper = async (rwsFrontendConfig) => {
|
|
|
128
115
|
// #SECTION RWS WEBPACK BUILD
|
|
129
116
|
const cfgExport = createWebpackConfig(
|
|
130
117
|
executionDir,
|
|
131
|
-
path.resolve(__dirname, '..', '..'),
|
|
132
118
|
_packageDir,
|
|
133
119
|
isDev,
|
|
134
120
|
devTools,
|
|
@@ -140,10 +126,11 @@ const RWSWebpackWrapper = async (rwsFrontendConfig) => {
|
|
|
140
126
|
automatedChunks,
|
|
141
127
|
modules_setup,
|
|
142
128
|
aliases,
|
|
143
|
-
|
|
129
|
+
tsConfig,
|
|
144
130
|
RWS_WEBPACK_PLUGINS_BAG.getPlugins(),
|
|
145
131
|
rwsExternals,
|
|
146
|
-
devExternalsVars
|
|
132
|
+
devExternalsVars,
|
|
133
|
+
rwsFrontendConfig.entrypoint
|
|
147
134
|
);
|
|
148
135
|
|
|
149
136
|
if (optimConfig) {
|
|
@@ -13,17 +13,23 @@ let _scss_fs = null;
|
|
|
13
13
|
|
|
14
14
|
class RWSScssPlugin {
|
|
15
15
|
autoCompile = [];
|
|
16
|
+
rwsWorkspaceDir = null;
|
|
16
17
|
|
|
17
|
-
constructor(params
|
|
18
|
-
|
|
18
|
+
constructor(params = {
|
|
19
|
+
rwsWorkspaceDir: null,
|
|
20
|
+
autoCompile: []
|
|
21
|
+
}) {
|
|
22
|
+
this.node_modules_dir = (fileDir) => path.relative(fileDir, _tools.findRootWorkspacePath(process.cwd() + '/node_modules'))
|
|
19
23
|
_scss_import = _scss_import_builder(this);
|
|
20
24
|
_scss_fs = _scss_fs_builder(this);
|
|
21
25
|
_scss_compiler = _scss_compiler_builder(this);
|
|
22
26
|
|
|
23
|
-
if
|
|
24
|
-
|
|
27
|
+
if(!params.rwsWorkspaceDir){
|
|
28
|
+
throw new Error('Pass "rwsWorkspaceDir" to the "@rws-framework/client/builder/webpack/loaders/rws_fast_ts_loader.js" loader.');
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
this.rwsWorkspaceDir = params.rwsWorkspaceDir;
|
|
32
|
+
|
|
27
33
|
if (!!params.autoCompile && params.autoCompile.length > 0) {
|
|
28
34
|
this.autoCompile = params.autoCompile;
|
|
29
35
|
}
|
|
@@ -33,7 +39,6 @@ class RWSScssPlugin {
|
|
|
33
39
|
this.compileFile(sassFile, true);
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
|
-
|
|
37
42
|
|
|
38
43
|
apply(compiler) {
|
|
39
44
|
const _self = this;
|
|
@@ -42,21 +47,25 @@ class RWSScssPlugin {
|
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
async compileFile(scssPath) {
|
|
45
|
-
scssPath = _scss_import.processImportPath(scssPath, path.dirname(scssPath))
|
|
50
|
+
scssPath = _scss_import.processImportPath(scssPath, this.rwsWorkspaceDir, path.dirname(scssPath))
|
|
46
51
|
|
|
47
52
|
|
|
48
|
-
let scssCode = _scss_fs.getCodeFromFile(scssPath);
|
|
53
|
+
let scssCode = _scss_fs.getCodeFromFile(scssPath, this.rwsWorkspaceDir);
|
|
49
54
|
|
|
50
|
-
return await _scss_compiler.compileScssCode(scssCode, path.dirname(scssPath),
|
|
55
|
+
return await _scss_compiler.compileScssCode(scssCode, path.dirname(scssPath), this.rwsWorkspaceDir);
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
async compileScssCode(scssCode, scssPath){
|
|
54
|
-
return await _scss_compiler.compileScssCode(scssCode, scssPath,
|
|
59
|
+
return await _scss_compiler.compileScssCode(scssCode, scssPath, this.rwsWorkspaceDir);
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
writeCssFile(scssFilePath, cssContent){
|
|
58
63
|
return _scss_fs.writeCssFile(scssFilePath, cssContent);
|
|
59
64
|
}
|
|
65
|
+
|
|
66
|
+
getRWSWorkspaceDir() {
|
|
67
|
+
return this.rwsWorkspaceDir;
|
|
68
|
+
}
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
module.exports = RWSScssPlugin;
|
|
@@ -9,16 +9,15 @@ let _scss_fonts = null;
|
|
|
9
9
|
const _scss_import_builder = require('./_import');
|
|
10
10
|
let _scss_import = null;
|
|
11
11
|
|
|
12
|
-
function compileScssCode(scssCode, fileRootDir,
|
|
12
|
+
function compileScssCode(scssCode, fileRootDir, rwsWorkspaceDir) {
|
|
13
13
|
_scss_fonts = _scss_fonts_builder(this);
|
|
14
|
-
_scss_import = _scss_import_builder(this);
|
|
15
|
-
|
|
16
|
-
const [scssImports] = _scss_import.extractScssImports(scssCode, fileRootDir);
|
|
14
|
+
_scss_import = _scss_import_builder(this);
|
|
15
|
+
const [scssImports] = _scss_import.extractScssImports(scssCode, rwsWorkspaceDir, fileRootDir);
|
|
17
16
|
|
|
18
17
|
const dependencies = scssImports.map((item) => item[2]);
|
|
19
18
|
|
|
20
19
|
if (scssImports && scssImports.length) {
|
|
21
|
-
scssCode = _scss_import.replaceImports(_scss_import.processImports(scssImports, fileRootDir), scssCode);
|
|
20
|
+
scssCode = _scss_import.replaceImports(_scss_import.processImports(scssImports, rwsWorkspaceDir, fileRootDir), scssCode);
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
const uses = _scss_import.extractScssUses(scssCode)[0];
|
|
@@ -39,7 +38,7 @@ function compileScssCode(scssCode, fileRootDir, createFile = false, filePath = n
|
|
|
39
38
|
const result = sass.compileString(scssCode, { loadPaths: [fileRootDir]});
|
|
40
39
|
|
|
41
40
|
let compiledCode = result.css.toString();
|
|
42
|
-
compiledCode = _scss_fonts.replaceFontUrlWithBase64(compiledCode);
|
|
41
|
+
compiledCode = _scss_fonts.replaceFontUrlWithBase64(compiledCode, rwsWorkspaceDir);
|
|
43
42
|
compiledCode = replaceEmojisWithQuestionMark(compiledCode, fileRootDir);
|
|
44
43
|
return { code: compiledCode, dependencies};
|
|
45
44
|
} catch (err) {
|
|
@@ -44,7 +44,7 @@ function convertFontToBase64(fontPath) {
|
|
|
44
44
|
return fs.readFileSync(fontPath, { encoding: 'base64' });
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
function replaceFontUrlWithBase64(cssContent) {
|
|
47
|
+
function replaceFontUrlWithBase64(cssContent, rwsWorkspaceDir) {
|
|
48
48
|
const fontFaceRegex = /@font-face\s*\{[^}]*\}/g;
|
|
49
49
|
let fontFaces = [...cssContent.matchAll(fontFaceRegex)];
|
|
50
50
|
_scss_import = _scss_import_builder(this);
|
|
@@ -58,7 +58,7 @@ function replaceFontUrlWithBase64(cssContent) {
|
|
|
58
58
|
|
|
59
59
|
while ((match = urlRegex.exec(fontFaceContent)) !== null) {
|
|
60
60
|
// Create a promise to convert each font to Base64 and replace in CSS
|
|
61
|
-
const base64 = convertFontToBase64(_scss_import.processImportPath(match[2], null, true));
|
|
61
|
+
const base64 = convertFontToBase64(_scss_import.processImportPath(match[2], rwsWorkspaceDir, null, true));
|
|
62
62
|
const base64Font = `data:font/woff2;base64,${base64}`;
|
|
63
63
|
|
|
64
64
|
modifiedFontFaceContent = modifiedFontFaceContent.replace(match[2], base64Font);
|
|
@@ -47,13 +47,14 @@ function readSCSSFilesFromDirectory(dirPath) {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
function getCodeFromFile(filePath) {
|
|
50
|
+
function getCodeFromFile(filePath, rwsWorkspaceDir) {
|
|
51
51
|
filePath = filePath.replace('//', '/');
|
|
52
52
|
const _scss_import_builder = require('./_import');
|
|
53
53
|
_scss_import = _scss_import_builder(this);
|
|
54
54
|
|
|
55
55
|
if (!fs.existsSync(filePath)) {
|
|
56
|
-
const processedImportPath = _scss_import.processImportPath(filePath, path.dirname(filePath));
|
|
56
|
+
const processedImportPath = _scss_import.processImportPath(filePath, rwsWorkspaceDir, path.dirname(filePath));
|
|
57
|
+
|
|
57
58
|
if (!fs.existsSync(processedImportPath)) {
|
|
58
59
|
throw new Error(`SCSS loader: File path "${filePath}" was not found.`);
|
|
59
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { rwsPath } = require('@rws-framework/console');
|
|
2
|
-
|
|
2
|
+
const chalk = require('chalk');
|
|
3
3
|
const _scss_fs_builder = require('./_fs');
|
|
4
4
|
let _scss_fs = null;
|
|
5
5
|
const fs = require('fs');
|
|
@@ -7,26 +7,34 @@ const path = require('path');
|
|
|
7
7
|
const CSS_IMPORT_REGEX = /^(?!.*\/\/)(?!.*\/\*).*@import\s+['"]((?![^'"]*:[^'"]*).+?)['"];?/gm;
|
|
8
8
|
const SCSS_USE_REGEX = /^(?!.*\/\/)(?!.*\/\*).*@use\s+['"]?([^'"\s]+)['"]?;?/gm;
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const WORKSPACE_ROOT = rwsPath.findPackageDir(process.cwd());
|
|
11
11
|
|
|
12
|
-
function processImportPath(importPath, fileRootDir = null, noext = false) {
|
|
12
|
+
function processImportPath(importPath, rwsWorkspaceDir, fileRootDir = null, noext = false) {
|
|
13
13
|
_scss_fs = _scss_fs_builder(this);
|
|
14
|
-
|
|
14
|
+
const workspaceDir = this.getRWSWorkspaceDir ? this.getRWSWorkspaceDir() : rwsWorkspaceDir;
|
|
15
|
+
|
|
15
16
|
if (importPath.split('')[0] === '~') {
|
|
16
17
|
return fillSCSSExt(replaceWithNodeModules(importPath, null, true), noext);
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
if (importPath.indexOf('@rws-mixins') === 0) {
|
|
20
|
-
return path.resolve(rwsPath.findPackageDir(
|
|
21
|
+
return path.resolve(rwsPath.findPackageDir(workspaceDir), 'src', 'styles', 'includes.scss');
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
if (importPath.indexOf('@cwd') === 0) {
|
|
24
|
-
return fillSCSSExt(process.cwd()
|
|
25
|
+
return fillSCSSExt(path.join(process.cwd(), importPath.slice(4)), noext);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
if (importPath.split('')[0] === '/') {
|
|
29
|
+
const originalImport = fillSCSSExt(importPath, noext);
|
|
30
|
+
|
|
31
|
+
if(!fs.existsSync(originalImport)){
|
|
32
|
+
const absoluteImport = fillSCSSExt(path.join(workspaceDir, 'src', importPath), noext);
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
return absoluteImport;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return originalImport;
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
if (fileRootDir) {
|
|
@@ -79,7 +87,30 @@ function fillSCSSExt(scssPath, noext = false) {
|
|
|
79
87
|
return scssPath;
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
function
|
|
90
|
+
function fillSCSSExt(scssPath, noext = false) {
|
|
91
|
+
const underscoredPath = underscorePath(scssPath, noext);
|
|
92
|
+
let ext = scssPath;
|
|
93
|
+
|
|
94
|
+
if (!fs.existsSync(scssPath) && fs.existsSync(underscoredPath)) {
|
|
95
|
+
ext = underscoredPath;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (noext) {
|
|
99
|
+
ext = scssPath;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if ((!fs.existsSync(scssPath) || (fs.existsSync(scssPath) && fs.statSync(scssPath).isDirectory())) && fs.existsSync(`${scssPath}.scss`)) {
|
|
103
|
+
ext = `${scssPath}.scss`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (fs.existsSync(`_${scssPath}.scss`)) {
|
|
107
|
+
ext = `${scssPath}.scss`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return ext;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function extractScssImports(fileContent, rwsWorkspaceDir, importRootPath) {
|
|
83
114
|
_scss_fs = _scss_fs_builder(this);
|
|
84
115
|
let match;
|
|
85
116
|
const imports = [];
|
|
@@ -92,9 +123,9 @@ function extractScssImports(fileContent, importRootPath) {
|
|
|
92
123
|
importRootPath = path.dirname(importRootPath);
|
|
93
124
|
}
|
|
94
125
|
|
|
95
|
-
const processedImportPath = processImportPath(importPath, importRootPath);
|
|
126
|
+
const processedImportPath = processImportPath(importPath, rwsWorkspaceDir, importRootPath);
|
|
96
127
|
|
|
97
|
-
imports.push([processedImportPath, importLine, path.resolve(processedImportPath)]);
|
|
128
|
+
imports.push([processedImportPath, importLine, path.resolve(processedImportPath), rwsWorkspaceDir]);
|
|
98
129
|
}
|
|
99
130
|
|
|
100
131
|
return [imports, fileContent];
|
|
@@ -125,11 +156,12 @@ function detectImports(code) {
|
|
|
125
156
|
|
|
126
157
|
function replaceWithNodeModules(input, fileDir = null, absolute = false, token = '~') {
|
|
127
158
|
_scss_fs = _scss_fs_builder(this);
|
|
128
|
-
return input.replace(token, absolute ? `${path.resolve(
|
|
159
|
+
return input.replace(token, absolute ? `${path.resolve(WORKSPACE_ROOT, 'node_modules')}/` : this.node_modules_dir(fileDir ? fileDir : process.cwd()));
|
|
129
160
|
}
|
|
130
161
|
|
|
131
|
-
function processImports(imports, fileRootDir, importStorage = {}, sub = false) {
|
|
162
|
+
function processImports(imports, fileRootDir, rwsWorkspaceDir, importStorage = {}, sub = false) {
|
|
132
163
|
_scss_fs = _scss_fs_builder(this);
|
|
164
|
+
|
|
133
165
|
const importResults = [];
|
|
134
166
|
|
|
135
167
|
const getStorage = (sourceComponentPath, importedFileContent) => {
|
|
@@ -143,18 +175,20 @@ function processImports(imports, fileRootDir, importStorage = {}, sub = false) {
|
|
|
143
175
|
|
|
144
176
|
return '';
|
|
145
177
|
}
|
|
146
|
-
|
|
178
|
+
|
|
179
|
+
|
|
147
180
|
imports.forEach(importData => {
|
|
148
181
|
const originalImportPath = importData[0];
|
|
149
|
-
|
|
150
|
-
_scss_fs = _scss_fs_builder(this);
|
|
151
|
-
let replacedScssContent = getStorage(importPath, _scss_fs.getCodeFromFile(importPath).replace(/\/\*[\s\S]*?\*\//g, ''));
|
|
182
|
+
const workspaceDir = this.getRWSWorkspaceDir ? this.getRWSWorkspaceDir() : importData[3];
|
|
152
183
|
|
|
153
|
-
|
|
184
|
+
let importPath = processImportPath(originalImportPath, workspaceDir, fileRootDir);
|
|
154
185
|
|
|
155
|
-
|
|
186
|
+
let replacedScssContent = getStorage(importPath, _scss_fs.getCodeFromFile(importPath, workspaceDir).replace(/\/\*[\s\S]*?\*\//g, ''));
|
|
187
|
+
|
|
188
|
+
const recursiveImports = extractScssImports(replacedScssContent, workspaceDir, importPath)[0];
|
|
156
189
|
|
|
157
|
-
|
|
190
|
+
if (recursiveImports.length) {
|
|
191
|
+
replacedScssContent = replaceImports(processImports(recursiveImports, path.dirname(importPath), workspaceDir, importStorage, true), replacedScssContent);
|
|
158
192
|
}
|
|
159
193
|
|
|
160
194
|
importResults.push({
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
2
4
|
const { RWSConfigBuilder } = require('@rws-framework/console')
|
|
3
5
|
const { rwsPath } = require('@rws-framework/console');
|
|
4
6
|
const { _DEFAULT_CONFIG } = require('../../_default.cfg');
|
|
5
7
|
|
|
6
|
-
async function getBuildConfig(rwsFrontBuildConfig){
|
|
7
|
-
const BuildConfigurator = new RWSConfigBuilder(rwsPath.findPackageDir(process.cwd())
|
|
8
|
-
const _packageDir = rwsPath.findPackageDir(process.cwd());
|
|
9
|
-
|
|
8
|
+
async function getBuildConfig(rwsFrontBuildConfig, _packageDir){
|
|
9
|
+
const BuildConfigurator = new RWSConfigBuilder(path.join(rwsPath.findPackageDir(process.cwd()), '.rws.json'), {..._DEFAULT_CONFIG, ...rwsFrontBuildConfig});
|
|
10
10
|
const executionDir = rwsPath.relativize(BuildConfigurator.get('executionDir') || rwsFrontBuildConfig.executionDir || process.cwd(), _packageDir);
|
|
11
11
|
const isWatcher = process.argv.includes('--watch') || false;
|
|
12
12
|
|
|
13
13
|
const isDev = isWatcher ? true : (BuildConfigurator.get('dev', rwsFrontBuildConfig.dev) || false);
|
|
14
|
-
const isHotReload = BuildConfigurator.get('
|
|
15
|
-
const isReport = BuildConfigurator.get('
|
|
14
|
+
const isHotReload = BuildConfigurator.get('hotReload', rwsFrontBuildConfig.hotReload);
|
|
15
|
+
const isReport = BuildConfigurator.get('pkgReport', rwsFrontBuildConfig.pkgReport);
|
|
16
16
|
const isParted = BuildConfigurator.get('parted', rwsFrontBuildConfig.parted || false);
|
|
17
17
|
|
|
18
18
|
const partedPrefix = BuildConfigurator.get('partedPrefix', rwsFrontBuildConfig.partedPrefix);
|
|
@@ -20,7 +20,7 @@ async function getBuildConfig(rwsFrontBuildConfig){
|
|
|
20
20
|
|
|
21
21
|
let partedComponentsLocations = BuildConfigurator.get('partedComponentsLocations', rwsFrontBuildConfig.partedComponentsLocations);
|
|
22
22
|
const customServiceLocations = BuildConfigurator.get('customServiceLocations', rwsFrontBuildConfig.customServiceLocations); //@todo: check if needed
|
|
23
|
-
const outputDir = rwsPath.relativize(BuildConfigurator.get('outputDir', rwsFrontBuildConfig.outputDir),
|
|
23
|
+
const outputDir = rwsPath.relativize(BuildConfigurator.get('outputDir', rwsFrontBuildConfig.outputDir), executionDir);
|
|
24
24
|
|
|
25
25
|
const outputFileName = BuildConfigurator.get('outputFileName') || rwsFrontBuildConfig.outputFileName;
|
|
26
26
|
const publicDir = BuildConfigurator.get('publicDir') || rwsFrontBuildConfig.publicDir;
|
|
@@ -37,7 +37,7 @@ async function getBuildConfig(rwsFrontBuildConfig){
|
|
|
37
37
|
|
|
38
38
|
const devRouteProxy = BuildConfigurator.get('devRouteProxy') || rwsFrontBuildConfig.devRouteProxy;
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const tsConfig = BuildConfigurator.get('tsConfig') || rwsFrontBuildConfig.tsConfig;
|
|
41
41
|
|
|
42
42
|
const rwsPlugins = {};
|
|
43
43
|
|
|
@@ -67,9 +67,8 @@ async function getBuildConfig(rwsFrontBuildConfig){
|
|
|
67
67
|
devTools,
|
|
68
68
|
devDebug,
|
|
69
69
|
devRouteProxy,
|
|
70
|
-
|
|
71
|
-
rwsPlugins,
|
|
72
|
-
_packageDir,
|
|
70
|
+
tsConfig,
|
|
71
|
+
rwsPlugins,
|
|
73
72
|
BuildConfigurator
|
|
74
73
|
}
|
|
75
74
|
}
|
|
@@ -41,7 +41,7 @@ function setComponentsChunks(clientEntry, RWSComponents = [], isParted = false)
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function generateRWSInfoFile(outputDir, automatedEntries) {
|
|
44
|
-
const rwsInfoJson = outputDir
|
|
44
|
+
const rwsInfoJson = path.join(outputDir, '/rws_info.json');
|
|
45
45
|
fs.writeFile(rwsInfoJson, JSON.stringify({ components: Object.keys(automatedEntries) }, null, 2), () => {});
|
|
46
46
|
}
|
|
47
47
|
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ function processEnvDefines(BuildConfigurator, config, devDebug) {
|
|
|
7
7
|
'process.env._RWS_BUILD_OVERRIDE': JSON.stringify(BuildConfigurator.exportBuildConfig())
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const rwsDefines = BuildConfigurator.get('
|
|
10
|
+
const rwsDefines = BuildConfigurator.get('env') || config.env || null;
|
|
11
11
|
|
|
12
12
|
if (rwsDefines) {
|
|
13
13
|
_rws_defines = { ..._rws_defines, ...rwsDefines }
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
+
const util = require('util');
|
|
3
|
+
|
|
4
|
+
|
|
2
5
|
|
|
3
6
|
module.exports = {
|
|
4
|
-
start: (executionDir,
|
|
5
|
-
console.log(chalk.green('
|
|
6
|
-
|
|
7
|
-
executionDir,
|
|
8
|
-
tsConfigPath,
|
|
7
|
+
start: (executionDir, tsConfig, outputDir, isDev, publicDir, isParted, partedPrefix, partedDirUrlPrefix, devTools, rwsPlugins) => {
|
|
8
|
+
console.log(chalk.green('RWS Frontend build started with:'), {
|
|
9
|
+
executionDir,
|
|
9
10
|
outputDir,
|
|
10
11
|
dev: isDev,
|
|
11
12
|
publicDir,
|
|
@@ -15,5 +16,11 @@ module.exports = {
|
|
|
15
16
|
devtool: devTools,
|
|
16
17
|
plugins: rwsPlugins
|
|
17
18
|
});
|
|
19
|
+
|
|
20
|
+
console.log(chalk.blue('\nTSCONFIG:'), util.inspect(tsConfig, {
|
|
21
|
+
depth: null,
|
|
22
|
+
colors: true,
|
|
23
|
+
maxArrayLength: null
|
|
24
|
+
}));
|
|
18
25
|
}
|
|
19
26
|
}
|