@rws-framework/client 2.8.4 → 2.9.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/cfg/_default.cfg.js +1 -0
- package/cfg/build_steps/webpack/_aliases.js +10 -0
- package/cfg/build_steps/webpack/_info.js +19 -0
- package/cfg/build_steps/webpack/_loaders.js +40 -0
- package/cfg/build_steps/webpack/_rws_externals.js +66 -0
- package/cfg/tsconfigSetup.js +30 -10
- package/foundation/index.js +1 -0
- package/foundation/rws-foundation.d.ts +8 -0
- package/foundation/rws-foundation.js +8 -0
- package/package.json +6 -4
- package/rws.webpack.config.js +137 -131
- package/service_worker/src/_service_worker.ts +1 -1
- package/src/client/config.ts +10 -3
- package/src/client.ts +3 -2
- package/src/components/_attrs/external-observable.ts +72 -0
- package/src/components/_component.ts +4 -5
- package/src/components/_container.ts +4 -4
- package/src/components/_decorator.ts +39 -9
- package/src/components/_decorators/RWSFillBuild.ts +0 -1
- package/src/components/_decorators/RWSInject.ts +3 -3
- package/src/components/_decorators/_di.ts +2 -2
- package/src/components/loader/styles/layout.scss +5 -5
- package/src/index.d.ts +1 -0
- package/src/index.ts +5 -5
- package/src/plugins/_plugin.ts +1 -1
- package/src/services/ConfigService.ts +4 -4
- package/src/services/_service.ts +10 -7
- package/src/types/RWSWindow.ts +2 -1
- package/tsconfig.json +5 -1
- package/types/declarations.d.ts +1 -1
- package/webpack/loaders/rws_fast_scss_loader.js +39 -30
- package/webpack/loaders/rws_fast_ts_loader.js +5 -3
- package/webpack/rws_after_plugin.js +26 -23
- package/webpack/rws_scss_plugin.js +22 -11
- package/_rws_externals.js +0 -39
- package/src/components/_design_system.ts +0 -6
- package/webpack/loaders/rws_fast_html_loader.js +0 -8
- package/webpack/loaders/rws_uncomments_loader.js +0 -35
|
@@ -48,7 +48,9 @@ class RWSScssPlugin {
|
|
|
48
48
|
importRootPath = path.dirname(importRootPath);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
const processedImportPath = this.processImportPath(importPath, importRootPath);
|
|
52
|
+
|
|
53
|
+
imports.push([processedImportPath, importLine, path.resolve(processedImportPath)]);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
return [imports, fileContent];
|
|
@@ -62,9 +64,16 @@ class RWSScssPlugin {
|
|
|
62
64
|
const usesPath = match[1];
|
|
63
65
|
const usesLine = match[0];
|
|
64
66
|
|
|
65
|
-
uses.
|
|
67
|
+
if(!uses.find((item) => {
|
|
68
|
+
console.log(item);
|
|
69
|
+
return item[0] == usesPath
|
|
70
|
+
}) && !usesPath !== 'sass:math'){
|
|
71
|
+
uses.push([usesPath, usesLine]);
|
|
72
|
+
}
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
// console.log(uses);
|
|
76
|
+
|
|
68
77
|
return [uses];
|
|
69
78
|
}
|
|
70
79
|
|
|
@@ -244,9 +253,6 @@ class RWSScssPlugin {
|
|
|
244
253
|
}
|
|
245
254
|
|
|
246
255
|
replaceFontUrlWithBase64(cssContent) {
|
|
247
|
-
const urlRegex = /url\(([^)]+)\)/g;
|
|
248
|
-
let match;
|
|
249
|
-
|
|
250
256
|
const fontFaceRegex = /@font-face\s*\{[^}]*\}/g;
|
|
251
257
|
let fontFaces = [...cssContent.matchAll(fontFaceRegex)];
|
|
252
258
|
|
|
@@ -343,6 +349,8 @@ class RWSScssPlugin {
|
|
|
343
349
|
const _self = this;
|
|
344
350
|
const [scssImports] = this.extractScssImports(scssCode, fileRootDir);
|
|
345
351
|
|
|
352
|
+
const dependencies = scssImports.map((item) => item[2]);
|
|
353
|
+
|
|
346
354
|
if (scssImports && scssImports.length) {
|
|
347
355
|
scssCode = this.replaceImports(this.processImports(scssImports, fileRootDir), scssCode);
|
|
348
356
|
}
|
|
@@ -353,18 +361,21 @@ class RWSScssPlugin {
|
|
|
353
361
|
|
|
354
362
|
uses.forEach(scssUse => {
|
|
355
363
|
const useLine = scssUse[1];
|
|
356
|
-
|
|
357
|
-
|
|
364
|
+
if(scssCode.indexOf(useLine) === -1){
|
|
365
|
+
console.log(scssCode);
|
|
366
|
+
scssUses += useLine + '\n';
|
|
367
|
+
scssCode = scssCode.replace(useLine + '\n', '');
|
|
368
|
+
}else{
|
|
369
|
+
console.log('ommiting @use. detected in:', fileRootDir, scssUse)
|
|
370
|
+
}
|
|
358
371
|
});
|
|
359
372
|
|
|
360
373
|
scssCode = scssUses + scssCode;
|
|
361
374
|
|
|
362
375
|
try {
|
|
376
|
+
const result = sass.compileString(scssCode, { loadPaths: [fileRootDir]});
|
|
363
377
|
|
|
364
|
-
|
|
365
|
-
let finalCss = result.css;
|
|
366
|
-
|
|
367
|
-
return this.replaceFontUrlWithBase64(finalCss);
|
|
378
|
+
return { code: this.replaceFontUrlWithBase64(result.css.toString()), dependencies};
|
|
368
379
|
} catch (err) {
|
|
369
380
|
console.error('SASS Error in', fileRootDir);
|
|
370
381
|
|
package/_rws_externals.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const tools = require('./_tools');
|
|
5
|
-
|
|
6
|
-
const _defaultOpts = {
|
|
7
|
-
inc_list_context: [],
|
|
8
|
-
inc_list: [],
|
|
9
|
-
not_inc_list: [],
|
|
10
|
-
not_inc_list_context: ['@rws-framework/client', 'node_modules'],
|
|
11
|
-
exceptions: [],
|
|
12
|
-
exceptions_context: [],
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const moduleDir = path.resolve(path.dirname(module.id));
|
|
16
|
-
const nodeModules = path.resolve(tools.findRootWorkspacePath(process.cwd()), '/node_modules');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const externals = (declaredCodeBase, nodeModules, externalOptions = _defaultOpts) => ({context, request}, callback) => {
|
|
20
|
-
let theOptions = _defaultOpts;
|
|
21
|
-
|
|
22
|
-
if(externalOptions !== null){
|
|
23
|
-
theOptions = Object.assign(theOptions, externalOptions);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const codeBase = path.resolve(declaredCodeBase);
|
|
27
|
-
|
|
28
|
-
let mergeTarget = true;
|
|
29
|
-
|
|
30
|
-
if (mergeTarget) {
|
|
31
|
-
//merging to output
|
|
32
|
-
return callback();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//using require from node_modules
|
|
36
|
-
callback(null, 'commonjs ' + request);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
module.exports = {rwsExternals: externals, _externalsDefaults: _defaultOpts};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const Terser = require('terser');
|
|
5
|
-
|
|
6
|
-
async function removeCommentsFromFile(code, inputSourceMap) {
|
|
7
|
-
const callback = this.async();
|
|
8
|
-
const sourceMap = this.sourceMap;
|
|
9
|
-
// Configure Terser to remove comments
|
|
10
|
-
try {
|
|
11
|
-
const minifyOptions = {
|
|
12
|
-
format: {
|
|
13
|
-
comments: false // Remove all comments
|
|
14
|
-
},
|
|
15
|
-
sourceMap: sourceMap
|
|
16
|
-
? {
|
|
17
|
-
content: inputSourceMap || false,
|
|
18
|
-
url: 'out.js.map'
|
|
19
|
-
}
|
|
20
|
-
: false
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Minify source code
|
|
24
|
-
const result = await Terser.minify(code, minifyOptions);
|
|
25
|
-
|
|
26
|
-
// Pass along the source map if enabled
|
|
27
|
-
callback(null, result.code, result.map || inputSourceMap);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
callback(err);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = async function (source, inputSourceMap) {
|
|
34
|
-
return await removeCommentsFromFile.bind(this)(source, inputSourceMap);
|
|
35
|
-
};
|