@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
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
const { rwsPath } = require('@rws-framework/console');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
|
|
5
|
-
const RWSWebpackPlugin = require('./rws_webpack_plugin');
|
|
6
|
-
|
|
7
|
-
const buildInfo = require('../../cfg/build_steps/webpack/_info');
|
|
8
|
-
const { loadAliases } = require('../../cfg/build_steps/webpack/_aliases');
|
|
9
|
-
const { timingStart, timingStop, timeLog, toggleLogging } = require('../../cfg/build_steps/webpack/_timing');
|
|
10
|
-
const { getRWSProductionSetup } = require('../../cfg/build_steps/webpack/_production');
|
|
11
|
-
const { rwsExternals } = require('../../cfg/build_steps/webpack/_rws_externals');
|
|
12
|
-
|
|
13
|
-
const tools = require('../../_tools');
|
|
14
|
-
const { setComponentsChunks, scanComponents, generateRWSInfoFile, partedComponentsEvents } = require('../../cfg/build_steps/webpack/_component_handling');
|
|
15
|
-
const { getBuildConfig } = require('../../cfg/build_steps/webpack/_build_config');
|
|
16
|
-
const { createWebpackConfig } = require('../../cfg/build_steps/webpack/_webpack_config');
|
|
17
|
-
const { executeRWSStartActions, timingActions, devActions } = require('../../cfg/build_steps/webpack/_actions');
|
|
18
|
-
const { RWS_WEBPACK_PLUGINS_BAG, addStartPlugins } = require('../../cfg/build_steps/webpack/_plugins');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// #SECTION INIT OPTIONS
|
|
22
|
-
|
|
23
|
-
const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
|
|
24
|
-
const _MAIN_PACKAGE = rwsPath.findRootWorkspacePath(appRoot);
|
|
25
|
-
|
|
26
|
-
const {
|
|
27
|
-
executionDir,
|
|
28
|
-
isWatcher,
|
|
29
|
-
isDev,
|
|
30
|
-
isReport,
|
|
31
|
-
isParted,
|
|
32
|
-
partedPrefix,
|
|
33
|
-
partedDirUrlPrefix,
|
|
34
|
-
partedComponentsLocations,
|
|
35
|
-
customServiceLocations,
|
|
36
|
-
outputDir,
|
|
37
|
-
outputFileName,
|
|
38
|
-
publicDir,
|
|
39
|
-
cssDir,
|
|
40
|
-
serviceWorkerPath,
|
|
41
|
-
publicIndex,
|
|
42
|
-
devTools,
|
|
43
|
-
devDebug,
|
|
44
|
-
devRouteProxy,
|
|
45
|
-
tsConfig,
|
|
46
|
-
rwsPlugins,
|
|
47
|
-
BuildConfigurator,
|
|
48
|
-
hotReload,
|
|
49
|
-
hotReloadPort,
|
|
50
|
-
loaderIgnoreExceptions
|
|
51
|
-
} = await getBuildConfig(rwsFrontendConfig, _packageDir);
|
|
52
|
-
|
|
53
|
-
timeLog({ devDebug });
|
|
54
|
-
|
|
55
|
-
if (devDebug?.timing) {
|
|
56
|
-
timingStart('build config');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
rwsPath.removeDirectory(outputDir, true);
|
|
60
|
-
buildInfo.start(executionDir, tsConfig, outputDir, isDev, publicDir, isParted, partedPrefix, partedDirUrlPrefix, devTools, rwsFrontendConfig.rwsPlugins);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// #SECTION INIT PLUGINS && ENV VARS DEFINES
|
|
64
|
-
addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, hotReload, isReport);
|
|
65
|
-
|
|
66
|
-
const WEBPACK_AFTER_ACTIONS = rwsFrontendConfig.actions || [];
|
|
67
|
-
const WEBPACK_AFTER_ERROR_ACTIONS = rwsFrontendConfig.error_actions || [];
|
|
68
|
-
|
|
69
|
-
const modules_setup = [path.join(_packageDir, 'node_modules'), path.join(executionDir, 'node_modules'), path.join(tools.findRootWorkspacePath(appRoot), 'node_modules')];
|
|
70
|
-
let optimConfig = null;
|
|
71
|
-
let aliases = rwsFrontendConfig.aliases || {};
|
|
72
|
-
aliases = { ...aliases, ...(await loadAliases(_packageDir, tsConfig,path.resolve(_MAIN_PACKAGE, 'node_modules'), executionDir))}
|
|
73
|
-
|
|
74
|
-
// #SECTION PLUGIN STARTING HOOKS
|
|
75
|
-
|
|
76
|
-
executeRWSStartActions(WEBPACK_AFTER_ACTIONS, serviceWorkerPath, BuildConfigurator, rwsFrontendConfig);
|
|
77
|
-
|
|
78
|
-
if (devDebug?.timing) {
|
|
79
|
-
timingStop('build config');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// #SECTION RWS COMPONENT SCAN && PARTED PROCESSING
|
|
84
|
-
const RWSComponents = scanComponents(await partedComponentsEvents(partedComponentsLocations, rwsPlugins, isParted), executionDir, _packageDir);
|
|
85
|
-
console.log(`${chalk.cyanBright('RWS Scanned')} ${chalk.yellowBright(RWSComponents.length)} components`);
|
|
86
|
-
const { automatedChunks, automatedEntries } = setComponentsChunks(rwsFrontendConfig.entrypoint, RWSComponents, isParted);
|
|
87
|
-
|
|
88
|
-
// #SECTION RWS INFO FILE
|
|
89
|
-
generateRWSInfoFile(outputDir, automatedEntries);
|
|
90
|
-
console.log(chalk.greenBright(`RWSInfo file generated.`));
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (!isDev) {
|
|
94
|
-
// #SECTION RWS PROD SETUP
|
|
95
|
-
|
|
96
|
-
if (!optimConfig) {
|
|
97
|
-
optimConfig = {};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
optimConfig = getRWSProductionSetup(optimConfig, tsConfig.path);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// #SECTION RWS DEV ACTIONS
|
|
104
|
-
const devExternalsVars = devActions(WEBPACK_AFTER_ACTIONS, executionDir, devDebug);
|
|
105
|
-
timingActions(WEBPACK_AFTER_ACTIONS, WEBPACK_AFTER_ERROR_ACTIONS, devDebug);
|
|
106
|
-
|
|
107
|
-
// #SECTION RWS WEBPACK PLUGIN INIT
|
|
108
|
-
if (WEBPACK_AFTER_ACTIONS.length || WEBPACK_AFTER_ERROR_ACTIONS.length) {
|
|
109
|
-
RWS_WEBPACK_PLUGINS_BAG.add(new RWSWebpackPlugin({
|
|
110
|
-
actions: WEBPACK_AFTER_ACTIONS,
|
|
111
|
-
error_actions: WEBPACK_AFTER_ERROR_ACTIONS,
|
|
112
|
-
dev: isDev,
|
|
113
|
-
devDebug,
|
|
114
|
-
appRoot
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// #SECTION RWS WEBPACK BUILD
|
|
119
|
-
const cfgExport = await createWebpackConfig({
|
|
120
|
-
executionDir,
|
|
121
|
-
_packageDir,
|
|
122
|
-
isDev,
|
|
123
|
-
devTools,
|
|
124
|
-
devDebug,
|
|
125
|
-
isParted,
|
|
126
|
-
partedPrefix,
|
|
127
|
-
outputDir,
|
|
128
|
-
outputFileName,
|
|
129
|
-
automatedChunks,
|
|
130
|
-
modules_setup,
|
|
131
|
-
aliases,
|
|
132
|
-
tsConfig,
|
|
133
|
-
WEBPACK_PLUGINS: RWS_WEBPACK_PLUGINS_BAG.getPlugins(),
|
|
134
|
-
rwsExternals,
|
|
135
|
-
devExternalsVars,
|
|
136
|
-
appRootDir: appRoot,
|
|
137
|
-
entrypoint: rwsFrontendConfig.entrypoint,
|
|
138
|
-
hotReload,
|
|
139
|
-
hotReloadPort,
|
|
140
|
-
publicDir,
|
|
141
|
-
cssDir,
|
|
142
|
-
loaderIgnoreExceptions
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (optimConfig) {
|
|
147
|
-
// setup production config if it got created above
|
|
148
|
-
cfgExport.optimization = optimConfig;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// #SECTION RWS PLUGINS onBuild EVENTS FIRE
|
|
152
|
-
for (const pluginKey of Object.keys(rwsPlugins)) {
|
|
153
|
-
const plugin = rwsPlugins[pluginKey];
|
|
154
|
-
await plugin.onBuild(cfgExport);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return cfgExport;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
1
|
+
const { rwsPath } = require('@rws-framework/console');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
const RWSWebpackPlugin = require('./rws_webpack_plugin');
|
|
6
|
+
|
|
7
|
+
const buildInfo = require('../../cfg/build_steps/webpack/_info');
|
|
8
|
+
const { loadAliases } = require('../../cfg/build_steps/webpack/_aliases');
|
|
9
|
+
const { timingStart, timingStop, timeLog, toggleLogging } = require('../../cfg/build_steps/webpack/_timing');
|
|
10
|
+
const { getRWSProductionSetup } = require('../../cfg/build_steps/webpack/_production');
|
|
11
|
+
const { rwsExternals } = require('../../cfg/build_steps/webpack/_rws_externals');
|
|
12
|
+
|
|
13
|
+
const tools = require('../../_tools');
|
|
14
|
+
const { setComponentsChunks, scanComponents, generateRWSInfoFile, partedComponentsEvents } = require('../../cfg/build_steps/webpack/_component_handling');
|
|
15
|
+
const { getBuildConfig } = require('../../cfg/build_steps/webpack/_build_config');
|
|
16
|
+
const { createWebpackConfig } = require('../../cfg/build_steps/webpack/_webpack_config');
|
|
17
|
+
const { executeRWSStartActions, timingActions, devActions } = require('../../cfg/build_steps/webpack/_actions');
|
|
18
|
+
const { RWS_WEBPACK_PLUGINS_BAG, addStartPlugins } = require('../../cfg/build_steps/webpack/_plugins');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// #SECTION INIT OPTIONS
|
|
22
|
+
|
|
23
|
+
const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
|
|
24
|
+
const _MAIN_PACKAGE = rwsPath.findRootWorkspacePath(appRoot);
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
executionDir,
|
|
28
|
+
isWatcher,
|
|
29
|
+
isDev,
|
|
30
|
+
isReport,
|
|
31
|
+
isParted,
|
|
32
|
+
partedPrefix,
|
|
33
|
+
partedDirUrlPrefix,
|
|
34
|
+
partedComponentsLocations,
|
|
35
|
+
customServiceLocations,
|
|
36
|
+
outputDir,
|
|
37
|
+
outputFileName,
|
|
38
|
+
publicDir,
|
|
39
|
+
cssDir,
|
|
40
|
+
serviceWorkerPath,
|
|
41
|
+
publicIndex,
|
|
42
|
+
devTools,
|
|
43
|
+
devDebug,
|
|
44
|
+
devRouteProxy,
|
|
45
|
+
tsConfig,
|
|
46
|
+
rwsPlugins,
|
|
47
|
+
BuildConfigurator,
|
|
48
|
+
hotReload,
|
|
49
|
+
hotReloadPort,
|
|
50
|
+
loaderIgnoreExceptions
|
|
51
|
+
} = await getBuildConfig(rwsFrontendConfig, _packageDir);
|
|
52
|
+
|
|
53
|
+
timeLog({ devDebug });
|
|
54
|
+
|
|
55
|
+
if (devDebug?.timing) {
|
|
56
|
+
timingStart('build config');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
rwsPath.removeDirectory(outputDir, true);
|
|
60
|
+
buildInfo.start(executionDir, tsConfig, outputDir, isDev, publicDir, isParted, partedPrefix, partedDirUrlPrefix, devTools, rwsFrontendConfig.rwsPlugins);
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
// #SECTION INIT PLUGINS && ENV VARS DEFINES
|
|
64
|
+
addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, hotReload, isReport);
|
|
65
|
+
|
|
66
|
+
const WEBPACK_AFTER_ACTIONS = rwsFrontendConfig.actions || [];
|
|
67
|
+
const WEBPACK_AFTER_ERROR_ACTIONS = rwsFrontendConfig.error_actions || [];
|
|
68
|
+
|
|
69
|
+
const modules_setup = [path.join(_packageDir, 'node_modules'), path.join(executionDir, 'node_modules'), path.join(tools.findRootWorkspacePath(appRoot), 'node_modules')];
|
|
70
|
+
let optimConfig = null;
|
|
71
|
+
let aliases = rwsFrontendConfig.aliases || {};
|
|
72
|
+
aliases = { ...aliases, ...(await loadAliases(_packageDir, tsConfig,path.resolve(_MAIN_PACKAGE, 'node_modules'), executionDir))}
|
|
73
|
+
|
|
74
|
+
// #SECTION PLUGIN STARTING HOOKS
|
|
75
|
+
|
|
76
|
+
executeRWSStartActions(WEBPACK_AFTER_ACTIONS, serviceWorkerPath, BuildConfigurator, rwsFrontendConfig);
|
|
77
|
+
|
|
78
|
+
if (devDebug?.timing) {
|
|
79
|
+
timingStop('build config');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// #SECTION RWS COMPONENT SCAN && PARTED PROCESSING
|
|
84
|
+
const RWSComponents = scanComponents(await partedComponentsEvents(partedComponentsLocations, rwsPlugins, isParted), executionDir, _packageDir);
|
|
85
|
+
console.log(`${chalk.cyanBright('RWS Scanned')} ${chalk.yellowBright(RWSComponents.length)} components`);
|
|
86
|
+
const { automatedChunks, automatedEntries } = setComponentsChunks(rwsFrontendConfig.entrypoint, RWSComponents, isParted);
|
|
87
|
+
|
|
88
|
+
// #SECTION RWS INFO FILE
|
|
89
|
+
generateRWSInfoFile(outputDir, automatedEntries);
|
|
90
|
+
console.log(chalk.greenBright(`RWSInfo file generated.`));
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if (!isDev) {
|
|
94
|
+
// #SECTION RWS PROD SETUP
|
|
95
|
+
|
|
96
|
+
if (!optimConfig) {
|
|
97
|
+
optimConfig = {};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
optimConfig = getRWSProductionSetup(optimConfig, tsConfig.path);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// #SECTION RWS DEV ACTIONS
|
|
104
|
+
const devExternalsVars = devActions(WEBPACK_AFTER_ACTIONS, executionDir, devDebug);
|
|
105
|
+
timingActions(WEBPACK_AFTER_ACTIONS, WEBPACK_AFTER_ERROR_ACTIONS, devDebug);
|
|
106
|
+
|
|
107
|
+
// #SECTION RWS WEBPACK PLUGIN INIT
|
|
108
|
+
if (WEBPACK_AFTER_ACTIONS.length || WEBPACK_AFTER_ERROR_ACTIONS.length) {
|
|
109
|
+
RWS_WEBPACK_PLUGINS_BAG.add(new RWSWebpackPlugin({
|
|
110
|
+
actions: WEBPACK_AFTER_ACTIONS,
|
|
111
|
+
error_actions: WEBPACK_AFTER_ERROR_ACTIONS,
|
|
112
|
+
dev: isDev,
|
|
113
|
+
devDebug,
|
|
114
|
+
appRoot
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// #SECTION RWS WEBPACK BUILD
|
|
119
|
+
const cfgExport = await createWebpackConfig({
|
|
120
|
+
executionDir,
|
|
121
|
+
_packageDir,
|
|
122
|
+
isDev,
|
|
123
|
+
devTools,
|
|
124
|
+
devDebug,
|
|
125
|
+
isParted,
|
|
126
|
+
partedPrefix,
|
|
127
|
+
outputDir,
|
|
128
|
+
outputFileName,
|
|
129
|
+
automatedChunks,
|
|
130
|
+
modules_setup,
|
|
131
|
+
aliases,
|
|
132
|
+
tsConfig,
|
|
133
|
+
WEBPACK_PLUGINS: RWS_WEBPACK_PLUGINS_BAG.getPlugins(),
|
|
134
|
+
rwsExternals,
|
|
135
|
+
devExternalsVars,
|
|
136
|
+
appRootDir: appRoot,
|
|
137
|
+
entrypoint: rwsFrontendConfig.entrypoint,
|
|
138
|
+
hotReload,
|
|
139
|
+
hotReloadPort,
|
|
140
|
+
publicDir,
|
|
141
|
+
cssDir,
|
|
142
|
+
loaderIgnoreExceptions
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if (optimConfig) {
|
|
147
|
+
// setup production config if it got created above
|
|
148
|
+
cfgExport.optimization = optimConfig;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// #SECTION RWS PLUGINS onBuild EVENTS FIRE
|
|
152
|
+
for (const pluginKey of Object.keys(rwsPlugins)) {
|
|
153
|
+
const plugin = rwsPlugins[pluginKey];
|
|
154
|
+
await plugin.onBuild(cfgExport);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return cfgExport;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
162
|
module.exports = RWSWebpackWrapper;
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const _tools = require('../../_tools');
|
|
3
|
-
|
|
4
|
-
const _scss_compiler_builder = require('./scss/_compiler');
|
|
5
|
-
let _scss_compiler = null;
|
|
6
|
-
const _scss_import_builder = require('./scss/_import');
|
|
7
|
-
|
|
8
|
-
let _scss_import = null;
|
|
9
|
-
const _scss_fs_builder = require('./scss/_fs');
|
|
10
|
-
const { timingStart, timingStop } = require('../../cfg/build_steps/webpack/_timing');
|
|
11
|
-
let _scss_fs = null;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class RWSScssPlugin {
|
|
15
|
-
autoCompile = [];
|
|
16
|
-
rwsWorkspaceDir = null;
|
|
17
|
-
|
|
18
|
-
constructor(params = {
|
|
19
|
-
appRootDir: null,
|
|
20
|
-
rwsWorkspaceDir: null,
|
|
21
|
-
publicDir: null,
|
|
22
|
-
cssDir: null,
|
|
23
|
-
autoCompile: []
|
|
24
|
-
}) {
|
|
25
|
-
this.node_modules_dir = (fileDir) => path.relative(fileDir, path.join(this.getRWSRootDir(), '/node_modules'))
|
|
26
|
-
_scss_import = _scss_import_builder(this);
|
|
27
|
-
_scss_fs = _scss_fs_builder(this);
|
|
28
|
-
_scss_compiler = _scss_compiler_builder(this);
|
|
29
|
-
|
|
30
|
-
this.pubDir = params.publicDir;
|
|
31
|
-
this.cssDir = params.cssDir;
|
|
32
|
-
|
|
33
|
-
if(!params.rwsWorkspaceDir){
|
|
34
|
-
throw new Error('Pass "rwsWorkspaceDir" to the "@rws-framework/client/builder/webpack/loaders/rws_fast_ts_loader.js" loader.');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.rwsWorkspaceDir = params.rwsWorkspaceDir;
|
|
38
|
-
this.appRootDir = params.appRootDir;
|
|
39
|
-
|
|
40
|
-
if (!!params.autoCompile && params.autoCompile.length > 0) {
|
|
41
|
-
this.autoCompile = params.autoCompile;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
for (let index in this.autoCompile) {
|
|
45
|
-
const sassFile = this.autoCompile[index];
|
|
46
|
-
this.compileFile(sassFile, pubDir);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
apply(compiler) {
|
|
51
|
-
const _self = this;
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async compileFile(scssPath) {
|
|
57
|
-
scssPath = _scss_import.processImportPath(scssPath, this.getRWSWorkspaceDir(), this.getRWSRootDir(),path.dirname(scssPath), false, this.getPubDir())
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let scssCode = _scss_fs.getCodeFromFile(scssPath, this.getRWSWorkspaceDir(), this.getRWSRootDir(), this.getPubDir());
|
|
61
|
-
|
|
62
|
-
return await _scss_compiler.compileScssCode(scssCode, path.dirname(scssPath), this.getRWSWorkspaceDir(), this.getRWSRootDir(), this.getPubDir());
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async compileScssCode(scssCode, scssPath){
|
|
66
|
-
return await _scss_compiler.compileScssCode(scssCode, scssPath, this.getRWSWorkspaceDir(), this.getRWSRootDir(), this.getPubDir());
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
writeCssFile(scssFilePath, cssContent){
|
|
70
|
-
return _scss_fs.writeCssFile(scssFilePath, cssContent, this.getRWSWorkspaceDir(), this.getCssDir());
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
getRWSWorkspaceDir() {
|
|
74
|
-
return this.rwsWorkspaceDir;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
getRWSRootDir() {
|
|
78
|
-
return this.appRootDir;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getCssDir() {
|
|
82
|
-
return this.cssDir;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
getPubDir() {
|
|
86
|
-
return this.pubDir;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
module.exports = RWSScssPlugin;
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const _tools = require('../../_tools');
|
|
3
|
+
|
|
4
|
+
const _scss_compiler_builder = require('./scss/_compiler');
|
|
5
|
+
let _scss_compiler = null;
|
|
6
|
+
const _scss_import_builder = require('./scss/_import');
|
|
7
|
+
|
|
8
|
+
let _scss_import = null;
|
|
9
|
+
const _scss_fs_builder = require('./scss/_fs');
|
|
10
|
+
const { timingStart, timingStop } = require('../../cfg/build_steps/webpack/_timing');
|
|
11
|
+
let _scss_fs = null;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class RWSScssPlugin {
|
|
15
|
+
autoCompile = [];
|
|
16
|
+
rwsWorkspaceDir = null;
|
|
17
|
+
|
|
18
|
+
constructor(params = {
|
|
19
|
+
appRootDir: null,
|
|
20
|
+
rwsWorkspaceDir: null,
|
|
21
|
+
publicDir: null,
|
|
22
|
+
cssDir: null,
|
|
23
|
+
autoCompile: []
|
|
24
|
+
}) {
|
|
25
|
+
this.node_modules_dir = (fileDir) => path.relative(fileDir, path.join(this.getRWSRootDir(), '/node_modules'))
|
|
26
|
+
_scss_import = _scss_import_builder(this);
|
|
27
|
+
_scss_fs = _scss_fs_builder(this);
|
|
28
|
+
_scss_compiler = _scss_compiler_builder(this);
|
|
29
|
+
|
|
30
|
+
this.pubDir = params.publicDir;
|
|
31
|
+
this.cssDir = params.cssDir;
|
|
32
|
+
|
|
33
|
+
if(!params.rwsWorkspaceDir){
|
|
34
|
+
throw new Error('Pass "rwsWorkspaceDir" to the "@rws-framework/client/builder/webpack/loaders/rws_fast_ts_loader.js" loader.');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
this.rwsWorkspaceDir = params.rwsWorkspaceDir;
|
|
38
|
+
this.appRootDir = params.appRootDir;
|
|
39
|
+
|
|
40
|
+
if (!!params.autoCompile && params.autoCompile.length > 0) {
|
|
41
|
+
this.autoCompile = params.autoCompile;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
for (let index in this.autoCompile) {
|
|
45
|
+
const sassFile = this.autoCompile[index];
|
|
46
|
+
this.compileFile(sassFile, pubDir);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
apply(compiler) {
|
|
51
|
+
const _self = this;
|
|
52
|
+
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async compileFile(scssPath) {
|
|
57
|
+
scssPath = _scss_import.processImportPath(scssPath, this.getRWSWorkspaceDir(), this.getRWSRootDir(),path.dirname(scssPath), false, this.getPubDir())
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
let scssCode = _scss_fs.getCodeFromFile(scssPath, this.getRWSWorkspaceDir(), this.getRWSRootDir(), this.getPubDir());
|
|
61
|
+
|
|
62
|
+
return await _scss_compiler.compileScssCode(scssCode, path.dirname(scssPath), this.getRWSWorkspaceDir(), this.getRWSRootDir(), this.getPubDir());
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async compileScssCode(scssCode, scssPath){
|
|
66
|
+
return await _scss_compiler.compileScssCode(scssCode, scssPath, this.getRWSWorkspaceDir(), this.getRWSRootDir(), this.getPubDir());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
writeCssFile(scssFilePath, cssContent){
|
|
70
|
+
return _scss_fs.writeCssFile(scssFilePath, cssContent, this.getRWSWorkspaceDir(), this.getCssDir());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getRWSWorkspaceDir() {
|
|
74
|
+
return this.rwsWorkspaceDir;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getRWSRootDir() {
|
|
78
|
+
return this.appRootDir;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getCssDir() {
|
|
82
|
+
return this.cssDir;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getPubDir() {
|
|
86
|
+
return this.pubDir;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = RWSScssPlugin;
|