@rws-framework/client 2.20.1 → 2.20.2
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/.bin/emerge.sh +15 -15
- package/builder/vite/index.ts +4 -4
- package/builder/vite/rws.vite.config.ts +132 -132
- package/builder/vite/rws_scss_plugin.ts +61 -61
- package/builder/webpack/index.js +10 -10
- package/builder/webpack/rws.webpack.config.js +161 -161
- package/builder/webpack/rws_scss_plugin.js +90 -90
- package/builder/webpack/rws_webpack_plugin.js +137 -137
- package/cfg/_default.cfg.js +26 -26
- package/cfg/_storage.d.ts +22 -22
- package/cfg/_storage.js +42 -42
- package/cfg/tsconfigSetup.js +146 -146
- package/docs/assets/26e93147f10415a0ed4a.svg +6 -6
- package/docs/assets/75c9471662e97ee24f29.svg +7 -7
- package/docs/assets/db90e4df2373980c497d.svg +9 -9
- package/docs/assets/highlight.css +127 -127
- package/docs/assets/main.js +59 -59
- package/docs/assets/style.css +1414 -1414
- package/docs/classes/ApiServiceInstance.html +25 -25
- package/docs/classes/ConfigServiceInstance.html +21 -21
- package/docs/classes/DOMServiceInstance.html +17 -17
- package/docs/classes/NotifyServiceInstance.html +15 -15
- package/docs/classes/RWSClientInstance.html +45 -45
- package/docs/classes/RWSPlugin.html +13 -13
- package/docs/classes/RWSService.html +10 -10
- package/docs/classes/RWSViewComponent.html +1022 -1022
- package/docs/classes/ServiceWorkerServiceInstance.html +13 -13
- package/docs/classes/UtilsServiceInstance.html +13 -13
- package/docs/functions/attr.html +5 -5
- package/docs/functions/observable.html +3 -3
- package/docs/index.html +179 -179
- package/docs/interfaces/HTMLTag.html +3 -3
- package/docs/interfaces/IRWSConfig.html +20 -20
- package/docs/interfaces/IRWSDecoratorOptions.html +5 -5
- package/docs/interfaces/IRWSHttpRoute.html +2 -2
- package/docs/interfaces/IRWSPrefixedHTTProutes.html +2 -2
- package/docs/interfaces/IRWSUser.html +5 -5
- package/docs/modules.html +45 -45
- package/foundation/index.js +1 -1
- package/foundation/rws-foundation.d.ts +7 -7
- package/foundation/rws-foundation.js +7 -7
- package/package.json +1 -1
- package/service_worker/src/_service_worker.ts +83 -83
- package/service_worker/tsconfig.json +20 -20
- package/service_worker/webpack.config.js +66 -66
- package/src/client/components.ts +67 -67
- package/src/client/config.ts +175 -175
- package/src/client/hotReload.ts +22 -22
- package/src/client/services.ts +27 -27
- package/src/client.ts +208 -208
- package/src/components/_component.ts +247 -247
- package/src/components/_container.ts +15 -15
- package/src/components/_decorator.ts +122 -122
- package/src/components/_definitions.ts +64 -64
- package/src/components/_event_handling.ts +40 -40
- package/src/components/index.ts +25 -25
- package/src/index.ts +86 -86
- package/src/plugins/_builder.js +31 -31
- package/src/plugins/_plugin.ts +60 -60
- package/src/services/ApiService.ts +105 -105
- package/src/services/ConfigService.ts +125 -125
- package/src/services/DOMService.ts +93 -93
- package/src/services/NotifyService.ts +47 -47
- package/src/services/ServiceWorkerService.ts +60 -60
- package/src/services/UtilsService.ts +60 -60
- package/src/services/_service.ts +64 -64
- package/src/styles/README.md +157 -157
- package/src/styles/_darkreader.scss +30 -30
- package/src/styles/_grid.scss +75 -75
- package/src/styles/_grid_legacy.scss +49 -49
- package/src/styles/_misc.scss +8 -8
- package/src/styles/_scrollbars.scss +40 -40
- package/src/styles/includes.scss +6 -6
- package/src/types/IBackendCore.ts +11 -11
- package/src/types/IRWSConfig.ts +29 -29
- package/src/types/IRWSPlugin.ts +23 -23
- package/src/types/IRWSResource.ts +4 -4
- package/src/types/IRWSUser.ts +6 -6
- package/src/types/IRWSViewComponent.ts +36 -36
- package/src/types/IReFormerField.ts +4 -4
- package/src/types/RWSNotify.ts +6 -6
- package/src/types/RWSWindow.ts +41 -41
- package/types/declarations.d.ts +8 -8
- package/types/docs-typings.d.ts +15 -15
package/.bin/emerge.sh
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
if ! command -v emerge >/dev/null 2>&1; then
|
|
4
|
-
echo "emerge command does not exist. Installing."
|
|
5
|
-
apt-get install graphviz graphviz-dev
|
|
6
|
-
pip install emerge-viz
|
|
7
|
-
fi
|
|
8
|
-
|
|
9
|
-
mkdir -p ./.emerge-vis-output/rws-client
|
|
10
|
-
mkdir -p ./.emerge-vis-output/fast-element
|
|
11
|
-
mkdir -p ./.emerge-vis-output/fast-foundation
|
|
12
|
-
|
|
13
|
-
npm install
|
|
14
|
-
|
|
15
|
-
emerge -c ./.emerge-typescript-template.yaml
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
if ! command -v emerge >/dev/null 2>&1; then
|
|
4
|
+
echo "emerge command does not exist. Installing."
|
|
5
|
+
apt-get install graphviz graphviz-dev
|
|
6
|
+
pip install emerge-viz
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
mkdir -p ./.emerge-vis-output/rws-client
|
|
10
|
+
mkdir -p ./.emerge-vis-output/fast-element
|
|
11
|
+
mkdir -p ./.emerge-vis-output/fast-foundation
|
|
12
|
+
|
|
13
|
+
npm install
|
|
14
|
+
|
|
15
|
+
emerge -c ./.emerge-typescript-template.yaml
|
|
16
16
|
emerge -c ./.emerge-fast.yaml
|
package/builder/vite/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { rwsViteBuilder } from './rws.vite.config';
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
rwsViteBuilder
|
|
1
|
+
import { rwsViteBuilder } from './rws.vite.config';
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
rwsViteBuilder
|
|
5
5
|
};
|
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import { processEnvDefines } from '../../cfg/build_steps/vite/_env_defines';
|
|
4
|
-
import { getRWSVitePlugins } from '../../cfg/build_steps/vite/_loaders';
|
|
5
|
-
import { rwsPath } from '@rws-framework/console';
|
|
6
|
-
import type { RWSViteConfig } from '../../cfg/build_steps/vite/types';
|
|
7
|
-
import type { UserConfig } from 'vite'; // Add this import
|
|
8
|
-
import { RWSScssPlugin } from './rws_scss_plugin';
|
|
9
|
-
|
|
10
|
-
import { ScriptTarget } from 'typescript';
|
|
11
|
-
|
|
12
|
-
interface CompilerOptionsConfig {
|
|
13
|
-
baseUrl: string;
|
|
14
|
-
experimentalDecorators: boolean;
|
|
15
|
-
emitDecoratorMetadata: boolean;
|
|
16
|
-
target: 'ES2018' | 'ES2020' | 'ESNext';
|
|
17
|
-
module: 'es2022' | 'ESNext' | 'commonjs';
|
|
18
|
-
moduleResolution: 'node' | 'bundler';
|
|
19
|
-
strict: boolean;
|
|
20
|
-
esModuleInterop: boolean;
|
|
21
|
-
resolveJsonModule: boolean;
|
|
22
|
-
outDir: string;
|
|
23
|
-
strictNullChecks: boolean;
|
|
24
|
-
skipLibCheck: boolean;
|
|
25
|
-
allowSyntheticDefaultImports: boolean;
|
|
26
|
-
sourceMap: boolean;
|
|
27
|
-
declaration: boolean;
|
|
28
|
-
lib: Array<'DOM' | 'ESNext' | 'ES2018' | 'ES2020'>; // add other lib options as needed
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface TSConfig {
|
|
32
|
-
compilerOptions: CompilerOptionsConfig;
|
|
33
|
-
paths?: {[key: string]: string[] };
|
|
34
|
-
include?: string[];
|
|
35
|
-
exclude?: string[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function logError(error: any) {
|
|
39
|
-
console.error('Vite config error:', {
|
|
40
|
-
message: error.message,
|
|
41
|
-
stack: error.stack,
|
|
42
|
-
cause: error.cause
|
|
43
|
-
});
|
|
44
|
-
throw error;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function loadTsConfig(tsPath: string): TSConfig | null
|
|
48
|
-
{
|
|
49
|
-
if(!fs.existsSync(tsPath)){
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
const tsConfig = JSON.parse(fs.readFileSync(tsPath, 'utf-8'));
|
|
55
|
-
return tsConfig;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
logError(error);
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const _DEFAULT_CFG: RWSViteConfig = {
|
|
63
|
-
dev: true,
|
|
64
|
-
entry: path.resolve(rwsPath.findPackageDir(process.cwd()), 'src', 'index.ts'),
|
|
65
|
-
outDir: path.resolve(rwsPath.findPackageDir(process.cwd()), 'dist'),
|
|
66
|
-
tsConfigPath: path.resolve(rwsPath.findPackageDir(process.cwd()), 'tsconfig.json'),
|
|
67
|
-
cssOutputPath: path.resolve(rwsPath.findPackageDir(process.cwd()), 'public', 'css'),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export function rwsViteBuilder(config: Partial<RWSViteConfig> = _DEFAULT_CFG, devDebug = false): UserConfig {
|
|
71
|
-
if(!config.tsConfigPath){
|
|
72
|
-
config.tsConfigPath = _DEFAULT_CFG.tsConfigPath;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if(!config.cssOutputPath){
|
|
76
|
-
config.cssOutputPath = _DEFAULT_CFG.cssOutputPath;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if(!config.outDir){
|
|
80
|
-
config.outDir = _DEFAULT_CFG.outDir;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const scssPlugin = new RWSScssPlugin({ autoCompile: [], dev: config.dev as boolean });
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const theConfig: RWSViteConfig = {..._DEFAULT_CFG, ...config};
|
|
87
|
-
|
|
88
|
-
const tsConfig: TSConfig | null = loadTsConfig(theConfig.tsConfigPath);
|
|
89
|
-
|
|
90
|
-
if(!tsConfig){
|
|
91
|
-
throw new Error(`File "${theConfig.tsConfigPath}" was not found!`)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const pkgDir: string = rwsPath.findPackageDir(process.cwd());
|
|
95
|
-
|
|
96
|
-
const outFileName = theConfig.outFileName || 'client.rws.js';
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
define: processEnvDefines(theConfig, _DEFAULT_CFG, devDebug),
|
|
100
|
-
plugins: getRWSVitePlugins({
|
|
101
|
-
scssPlugin,
|
|
102
|
-
packageDir: pkgDir,
|
|
103
|
-
nodeModulesPath: `${rwsPath.findRootWorkspacePath(process.cwd())}/node_modules`,
|
|
104
|
-
tsConfigPath: theConfig.tsConfigPath,
|
|
105
|
-
cssOutputPath: theConfig.cssOutputPath as string,
|
|
106
|
-
dev: config.dev as boolean
|
|
107
|
-
}),
|
|
108
|
-
build: {
|
|
109
|
-
minify: !config.dev,
|
|
110
|
-
sourcemap: config.dev,
|
|
111
|
-
outDir: theConfig.outDir,
|
|
112
|
-
emptyOutDir: true,
|
|
113
|
-
copyPublicDir: false,
|
|
114
|
-
rollupOptions: {
|
|
115
|
-
output: {
|
|
116
|
-
entryFileNames: outFileName,
|
|
117
|
-
chunkFileNames: [...outFileName.split('.').slice(0, -1), 'chunk', outFileName.split('.').at(-1)].join('.'),
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
lib: {
|
|
121
|
-
entry: theConfig.entry,
|
|
122
|
-
formats: ['es'],
|
|
123
|
-
fileName: () => outFileName
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
esbuild: {
|
|
127
|
-
target: tsConfig?.compilerOptions?.target?.toString().toLowerCase() || ScriptTarget.ES2022.toString().toLowerCase(),
|
|
128
|
-
tsconfigRaw: {
|
|
129
|
-
compilerOptions: tsConfig.compilerOptions
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { processEnvDefines } from '../../cfg/build_steps/vite/_env_defines';
|
|
4
|
+
import { getRWSVitePlugins } from '../../cfg/build_steps/vite/_loaders';
|
|
5
|
+
import { rwsPath } from '@rws-framework/console';
|
|
6
|
+
import type { RWSViteConfig } from '../../cfg/build_steps/vite/types';
|
|
7
|
+
import type { UserConfig } from 'vite'; // Add this import
|
|
8
|
+
import { RWSScssPlugin } from './rws_scss_plugin';
|
|
9
|
+
|
|
10
|
+
import { ScriptTarget } from 'typescript';
|
|
11
|
+
|
|
12
|
+
interface CompilerOptionsConfig {
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
experimentalDecorators: boolean;
|
|
15
|
+
emitDecoratorMetadata: boolean;
|
|
16
|
+
target: 'ES2018' | 'ES2020' | 'ESNext';
|
|
17
|
+
module: 'es2022' | 'ESNext' | 'commonjs';
|
|
18
|
+
moduleResolution: 'node' | 'bundler';
|
|
19
|
+
strict: boolean;
|
|
20
|
+
esModuleInterop: boolean;
|
|
21
|
+
resolveJsonModule: boolean;
|
|
22
|
+
outDir: string;
|
|
23
|
+
strictNullChecks: boolean;
|
|
24
|
+
skipLibCheck: boolean;
|
|
25
|
+
allowSyntheticDefaultImports: boolean;
|
|
26
|
+
sourceMap: boolean;
|
|
27
|
+
declaration: boolean;
|
|
28
|
+
lib: Array<'DOM' | 'ESNext' | 'ES2018' | 'ES2020'>; // add other lib options as needed
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface TSConfig {
|
|
32
|
+
compilerOptions: CompilerOptionsConfig;
|
|
33
|
+
paths?: {[key: string]: string[] };
|
|
34
|
+
include?: string[];
|
|
35
|
+
exclude?: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function logError(error: any) {
|
|
39
|
+
console.error('Vite config error:', {
|
|
40
|
+
message: error.message,
|
|
41
|
+
stack: error.stack,
|
|
42
|
+
cause: error.cause
|
|
43
|
+
});
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function loadTsConfig(tsPath: string): TSConfig | null
|
|
48
|
+
{
|
|
49
|
+
if(!fs.existsSync(tsPath)){
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const tsConfig = JSON.parse(fs.readFileSync(tsPath, 'utf-8'));
|
|
55
|
+
return tsConfig;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
logError(error);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const _DEFAULT_CFG: RWSViteConfig = {
|
|
63
|
+
dev: true,
|
|
64
|
+
entry: path.resolve(rwsPath.findPackageDir(process.cwd()), 'src', 'index.ts'),
|
|
65
|
+
outDir: path.resolve(rwsPath.findPackageDir(process.cwd()), 'dist'),
|
|
66
|
+
tsConfigPath: path.resolve(rwsPath.findPackageDir(process.cwd()), 'tsconfig.json'),
|
|
67
|
+
cssOutputPath: path.resolve(rwsPath.findPackageDir(process.cwd()), 'public', 'css'),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function rwsViteBuilder(config: Partial<RWSViteConfig> = _DEFAULT_CFG, devDebug = false): UserConfig {
|
|
71
|
+
if(!config.tsConfigPath){
|
|
72
|
+
config.tsConfigPath = _DEFAULT_CFG.tsConfigPath;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if(!config.cssOutputPath){
|
|
76
|
+
config.cssOutputPath = _DEFAULT_CFG.cssOutputPath;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if(!config.outDir){
|
|
80
|
+
config.outDir = _DEFAULT_CFG.outDir;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const scssPlugin = new RWSScssPlugin({ autoCompile: [], dev: config.dev as boolean });
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
const theConfig: RWSViteConfig = {..._DEFAULT_CFG, ...config};
|
|
87
|
+
|
|
88
|
+
const tsConfig: TSConfig | null = loadTsConfig(theConfig.tsConfigPath);
|
|
89
|
+
|
|
90
|
+
if(!tsConfig){
|
|
91
|
+
throw new Error(`File "${theConfig.tsConfigPath}" was not found!`)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const pkgDir: string = rwsPath.findPackageDir(process.cwd());
|
|
95
|
+
|
|
96
|
+
const outFileName = theConfig.outFileName || 'client.rws.js';
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
define: processEnvDefines(theConfig, _DEFAULT_CFG, devDebug),
|
|
100
|
+
plugins: getRWSVitePlugins({
|
|
101
|
+
scssPlugin,
|
|
102
|
+
packageDir: pkgDir,
|
|
103
|
+
nodeModulesPath: `${rwsPath.findRootWorkspacePath(process.cwd())}/node_modules`,
|
|
104
|
+
tsConfigPath: theConfig.tsConfigPath,
|
|
105
|
+
cssOutputPath: theConfig.cssOutputPath as string,
|
|
106
|
+
dev: config.dev as boolean
|
|
107
|
+
}),
|
|
108
|
+
build: {
|
|
109
|
+
minify: !config.dev,
|
|
110
|
+
sourcemap: config.dev,
|
|
111
|
+
outDir: theConfig.outDir,
|
|
112
|
+
emptyOutDir: true,
|
|
113
|
+
copyPublicDir: false,
|
|
114
|
+
rollupOptions: {
|
|
115
|
+
output: {
|
|
116
|
+
entryFileNames: outFileName,
|
|
117
|
+
chunkFileNames: [...outFileName.split('.').slice(0, -1), 'chunk', outFileName.split('.').at(-1)].join('.'),
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
lib: {
|
|
121
|
+
entry: theConfig.entry,
|
|
122
|
+
formats: ['es'],
|
|
123
|
+
fileName: () => outFileName
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
esbuild: {
|
|
127
|
+
target: tsConfig?.compilerOptions?.target?.toString().toLowerCase() || ScriptTarget.ES2022.toString().toLowerCase(),
|
|
128
|
+
tsconfigRaw: {
|
|
129
|
+
compilerOptions: tsConfig.compilerOptions
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
133
|
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { rwsPath } from '@rws-framework/console';
|
|
3
|
-
|
|
4
|
-
import _scss_compiler_builder from './scss/_compiler';
|
|
5
|
-
import _scss_import_builder from './scss/_import';
|
|
6
|
-
|
|
7
|
-
import _scss_fs_builder from './scss/_fs';
|
|
8
|
-
|
|
9
|
-
type PluginParams = { autoCompile: string[], dev: boolean };
|
|
10
|
-
|
|
11
|
-
class RWSScssPlugin {
|
|
12
|
-
protected autoCompile: string[] = [];
|
|
13
|
-
protected node_modules_dir: (fileDir: string) => void;
|
|
14
|
-
|
|
15
|
-
private _scss_import: any;
|
|
16
|
-
private _scss_fs: any;
|
|
17
|
-
private _scss_compiler: any;
|
|
18
|
-
private dev
|
|
19
|
-
|
|
20
|
-
constructor(params: PluginParams = { autoCompile: [], dev: true }) {
|
|
21
|
-
this.node_modules_dir = (fileDir) => path.relative(fileDir, rwsPath.findRootWorkspacePath(process.cwd())) + '/node_modules/'
|
|
22
|
-
this._scss_import = _scss_import_builder(this);
|
|
23
|
-
this._scss_fs = _scss_fs_builder(this);
|
|
24
|
-
this._scss_compiler = _scss_compiler_builder(this);
|
|
25
|
-
|
|
26
|
-
if (!!params.autoCompile && params.autoCompile.length > 0) {
|
|
27
|
-
this.autoCompile = params.autoCompile;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (let index in this.autoCompile) {
|
|
31
|
-
const sassFile = this.autoCompile[index];
|
|
32
|
-
this.compileFile(sassFile);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
apply(compiler) {
|
|
38
|
-
const _self = this;
|
|
39
|
-
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async compileFile(scssPath): Promise<{ code: string, dependencies: string[]}>
|
|
44
|
-
{
|
|
45
|
-
scssPath = this._scss_import.processImportPath(scssPath, path.dirname(scssPath))
|
|
46
|
-
let scssCode = this._scss_fs.getCodeFromFile(scssPath);
|
|
47
|
-
return await this._scss_compiler.compileScssCode(scssCode, path.dirname(scssPath), null, scssPath);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async compileScssCode(scssCode: string, scssPath: string): Promise<{ code: string, dependencies: string[]}>
|
|
51
|
-
{
|
|
52
|
-
return await this._scss_compiler.compileScssCode(scssCode, scssPath, this.dev);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
writeCssFile(scssFilePath: string, cssContent: string): string
|
|
56
|
-
{
|
|
57
|
-
return this._scss_fs.writeCssFile(scssFilePath, cssContent);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export {RWSScssPlugin};
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { rwsPath } from '@rws-framework/console';
|
|
3
|
+
|
|
4
|
+
import _scss_compiler_builder from './scss/_compiler';
|
|
5
|
+
import _scss_import_builder from './scss/_import';
|
|
6
|
+
|
|
7
|
+
import _scss_fs_builder from './scss/_fs';
|
|
8
|
+
|
|
9
|
+
type PluginParams = { autoCompile: string[], dev: boolean };
|
|
10
|
+
|
|
11
|
+
class RWSScssPlugin {
|
|
12
|
+
protected autoCompile: string[] = [];
|
|
13
|
+
protected node_modules_dir: (fileDir: string) => void;
|
|
14
|
+
|
|
15
|
+
private _scss_import: any;
|
|
16
|
+
private _scss_fs: any;
|
|
17
|
+
private _scss_compiler: any;
|
|
18
|
+
private dev
|
|
19
|
+
|
|
20
|
+
constructor(params: PluginParams = { autoCompile: [], dev: true }) {
|
|
21
|
+
this.node_modules_dir = (fileDir) => path.relative(fileDir, rwsPath.findRootWorkspacePath(process.cwd())) + '/node_modules/'
|
|
22
|
+
this._scss_import = _scss_import_builder(this);
|
|
23
|
+
this._scss_fs = _scss_fs_builder(this);
|
|
24
|
+
this._scss_compiler = _scss_compiler_builder(this);
|
|
25
|
+
|
|
26
|
+
if (!!params.autoCompile && params.autoCompile.length > 0) {
|
|
27
|
+
this.autoCompile = params.autoCompile;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
for (let index in this.autoCompile) {
|
|
31
|
+
const sassFile = this.autoCompile[index];
|
|
32
|
+
this.compileFile(sassFile);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
apply(compiler) {
|
|
38
|
+
const _self = this;
|
|
39
|
+
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async compileFile(scssPath): Promise<{ code: string, dependencies: string[]}>
|
|
44
|
+
{
|
|
45
|
+
scssPath = this._scss_import.processImportPath(scssPath, path.dirname(scssPath))
|
|
46
|
+
let scssCode = this._scss_fs.getCodeFromFile(scssPath);
|
|
47
|
+
return await this._scss_compiler.compileScssCode(scssCode, path.dirname(scssPath), null, scssPath);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async compileScssCode(scssCode: string, scssPath: string): Promise<{ code: string, dependencies: string[]}>
|
|
51
|
+
{
|
|
52
|
+
return await this._scss_compiler.compileScssCode(scssCode, scssPath, this.dev);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
writeCssFile(scssFilePath: string, cssContent: string): string
|
|
56
|
+
{
|
|
57
|
+
return this._scss_fs.writeCssFile(scssFilePath, cssContent);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {RWSScssPlugin};
|
package/builder/webpack/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const scssLoader = require('./loaders/rws_fast_scss_loader');
|
|
2
|
-
const htmlLoader = require('./loaders/rws_fast_html_loader');
|
|
3
|
-
const tsLoader = require('./loaders/rws_fast_ts_loader');
|
|
4
|
-
const { RWSWebpackWrapper } = require('./rws.webpack.config');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
RWSWebpackWrapper,
|
|
8
|
-
scssLoader,
|
|
9
|
-
htmlLoader,
|
|
10
|
-
tsLoader
|
|
1
|
+
const scssLoader = require('./loaders/rws_fast_scss_loader');
|
|
2
|
+
const htmlLoader = require('./loaders/rws_fast_html_loader');
|
|
3
|
+
const tsLoader = require('./loaders/rws_fast_ts_loader');
|
|
4
|
+
const { RWSWebpackWrapper } = require('./rws.webpack.config');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
RWSWebpackWrapper,
|
|
8
|
+
scssLoader,
|
|
9
|
+
htmlLoader,
|
|
10
|
+
tsLoader
|
|
11
11
|
}
|