@rws-framework/client 2.9.6 → 2.9.8
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/package.json
CHANGED
package/rws.webpack.config.js
CHANGED
|
@@ -5,7 +5,6 @@ const webpack = require('webpack');
|
|
|
5
5
|
const { rwsPath, RWSConfigBuilder } = require('@rws-framework/console');
|
|
6
6
|
|
|
7
7
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
8
|
-
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
|
|
9
8
|
|
|
10
9
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
11
10
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
@@ -26,7 +25,6 @@ const { _DEFAULT_CONFIG } = require('./cfg/_default.cfg');
|
|
|
26
25
|
const { info } = require('console');
|
|
27
26
|
|
|
28
27
|
const _MAIN_PACKAGE = rwsPath.findRootWorkspacePath(process.cwd());
|
|
29
|
-
console.log(process.argv);
|
|
30
28
|
const RWSWebpackWrapper = async (config) => {
|
|
31
29
|
const BuildConfigurator = new RWSConfigBuilder(rwsPath.findPackageDir(process.cwd()) + '/.rws.json', {..._DEFAULT_CONFIG, ...config});
|
|
32
30
|
|
package/src/client/config.ts
CHANGED
|
@@ -94,9 +94,7 @@ async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
|
|
|
94
94
|
|
|
95
95
|
if(this.config){
|
|
96
96
|
this.config = deepmerge(this.config, config);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
console.log(config, this.config.plugins)
|
|
97
|
+
}
|
|
100
98
|
|
|
101
99
|
this.appConfig.mergeConfig(this.config);
|
|
102
100
|
|
|
@@ -135,8 +133,7 @@ async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
|
|
|
135
133
|
|
|
136
134
|
await this.initCallback();
|
|
137
135
|
|
|
138
|
-
for (const plugin of RWSPlugin.getAllPlugins()){
|
|
139
|
-
console.log('plugin', plugin)
|
|
136
|
+
for (const plugin of RWSPlugin.getAllPlugins()){
|
|
140
137
|
await plugin.onClientStart();
|
|
141
138
|
}
|
|
142
139
|
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
+
const RWSScssPlugin = require('../rws_scss_plugin');
|
|
3
4
|
|
|
4
5
|
module.exports = function(content) {
|
|
5
6
|
const filePath = this.resourcePath;
|
|
6
7
|
const componentDir = path.resolve(path.dirname(filePath), '..');
|
|
7
8
|
const componentPath = path.resolve(componentDir, 'component.ts');
|
|
9
|
+
const isDev = this._compiler.options.mode === 'development';
|
|
10
|
+
const saveFile = content.indexOf('@save') > -1;
|
|
11
|
+
const plugin = new RWSScssPlugin();
|
|
12
|
+
let fromTs = false;
|
|
13
|
+
|
|
14
|
+
if(saveFile){
|
|
15
|
+
try {
|
|
16
|
+
const codeData = plugin.compileScssCode(content, path.dirname(filePath), null, filePath, !isDev);
|
|
17
|
+
|
|
18
|
+
const code = codeData.code;
|
|
19
|
+
const deps = codeData.dependencies;
|
|
20
|
+
|
|
21
|
+
for (const dependency of deps){
|
|
22
|
+
this.addDependency(dependency);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (saveFile && code) {
|
|
26
|
+
plugin.writeCssFile(filePath, code);
|
|
27
|
+
}
|
|
28
|
+
} catch(e){
|
|
29
|
+
console.error(e);
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
8
33
|
|
|
9
34
|
if(fs.existsSync(componentPath)){
|
|
10
35
|
fs.writeFileSync(componentPath, fs.readFileSync(componentPath, 'utf-8'))
|
|
@@ -64,8 +64,7 @@ class RWSScssPlugin {
|
|
|
64
64
|
const usesPath = match[1];
|
|
65
65
|
const usesLine = match[0];
|
|
66
66
|
|
|
67
|
-
if(!uses.find((item) => {
|
|
68
|
-
console.log(item);
|
|
67
|
+
if(!uses.find((item) => {
|
|
69
68
|
return item[0] == usesPath
|
|
70
69
|
}) && !usesPath !== 'sass:math'){
|
|
71
70
|
uses.push([usesPath, usesLine]);
|
|
@@ -361,8 +360,7 @@ class RWSScssPlugin {
|
|
|
361
360
|
|
|
362
361
|
uses.forEach(scssUse => {
|
|
363
362
|
const useLine = scssUse[1];
|
|
364
|
-
if(scssCode.indexOf(useLine) === -1){
|
|
365
|
-
console.log(scssCode);
|
|
363
|
+
if(scssCode.indexOf(useLine) === -1){
|
|
366
364
|
scssUses += useLine + '\n';
|
|
367
365
|
scssCode = scssCode.replace(useLine + '\n', '');
|
|
368
366
|
}else{
|