@rws-framework/client 2.13.1 → 2.13.3
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/add-v.sh +9 -9
- package/.bin/emerge.sh +15 -15
- package/.emerge-fast.yaml +46 -46
- package/.emerge-typescript-template.yaml +23 -23
- package/.emerge-vis-output/fast-element/emerge-file_result_dependency_graph.graphml +693 -693
- package/.emerge-vis-output/fast-element/emerge-filesystem_graph.graphml +705 -705
- package/.emerge-vis-output/fast-element/emerge-statistics-metrics.txt +440 -440
- package/.emerge-vis-output/fast-element/html/emerge.html +500 -500
- package/.emerge-vis-output/fast-element/html/jsconfig.json +8 -8
- package/.emerge-vis-output/fast-element/html/resources/css/custom.css +211 -211
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_common.js +44 -44
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_data.js +13 -13
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_git.js +1413 -1413
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_graph.js +539 -539
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_heatmap.js +219 -219
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_hull.js +179 -179
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_main.js +1002 -1002
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_search.js +71 -71
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_ui.js +199 -199
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.css +4123 -4123
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +4122 -4122
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.css +487 -487
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +484 -484
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.css +4265 -4265
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +4256 -4256
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.css +10877 -10877
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.css +10841 -10841
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.js +7075 -7075
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.js +5202 -5202
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.js +5249 -5249
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/d3/d3.v7.8.4.min.js +2 -2
- package/.emerge-vis-output/fast-element/html/vendors/d3/d3.v7.min.js +2 -2
- package/.emerge-vis-output/fast-element/html/vendors/dark-mode-switch/css/dark-mode.css +148 -148
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/daterangepicker.min.js +7 -7
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/moment.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/hull/hull.js +373 -373
- package/.emerge-vis-output/fast-element/html/vendors/jquery/jquery-3.6.0.min.js +2 -2
- package/.emerge-vis-output/fast-element/html/vendors/popper/popper.min.js +6 -6
- package/.emerge-vis-output/fast-element/html/vendors/simpleheat/simpleheat.js +141 -141
- package/.emerge-vis-output/fast-foundation/emerge-file_result_dependency_graph.graphml +4043 -4043
- package/.emerge-vis-output/fast-foundation/emerge-filesystem_graph.graphml +4538 -4538
- package/.emerge-vis-output/fast-foundation/emerge-statistics-metrics.txt +2510 -2510
- package/.emerge-vis-output/fast-foundation/html/emerge.html +500 -500
- package/.emerge-vis-output/fast-foundation/html/jsconfig.json +8 -8
- package/.emerge-vis-output/fast-foundation/html/resources/css/custom.css +211 -211
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_common.js +44 -44
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_data.js +13 -13
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_git.js +1413 -1413
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_graph.js +539 -539
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_heatmap.js +219 -219
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_hull.js +179 -179
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_main.js +1002 -1002
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_search.js +71 -71
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_ui.js +199 -199
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.css +4123 -4123
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +4122 -4122
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.css +487 -487
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +484 -484
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.css +4265 -4265
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +4256 -4256
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.css +10877 -10877
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.css +10841 -10841
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.min.css +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.js +7075 -7075
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.js +5202 -5202
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.js +5249 -5249
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/d3/d3.v7.8.4.min.js +2 -2
- package/.emerge-vis-output/fast-foundation/html/vendors/d3/d3.v7.min.js +2 -2
- package/.emerge-vis-output/fast-foundation/html/vendors/dark-mode-switch/css/dark-mode.css +148 -148
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/daterangepicker.min.js +7 -7
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/moment.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/hull/hull.js +373 -373
- package/.emerge-vis-output/fast-foundation/html/vendors/jquery/jquery-3.6.0.min.js +2 -2
- package/.emerge-vis-output/fast-foundation/html/vendors/popper/popper.min.js +6 -6
- package/.emerge-vis-output/fast-foundation/html/vendors/simpleheat/simpleheat.js +141 -141
- package/.emerge-vis-output/rws-client/emerge-file_result_dependency_graph.graphml +1143 -1143
- package/.emerge-vis-output/rws-client/emerge-filesystem_graph.graphml +1003 -1003
- package/.emerge-vis-output/rws-client/emerge-statistics-metrics.txt +655 -655
- package/.emerge-vis-output/rws-client/html/emerge.html +500 -500
- package/.emerge-vis-output/rws-client/html/jsconfig.json +8 -8
- package/.emerge-vis-output/rws-client/html/resources/css/custom.css +211 -211
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_common.js +44 -44
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_data.js +13 -13
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_git.js +1413 -1413
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_graph.js +539 -539
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_heatmap.js +219 -219
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_hull.js +179 -179
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_main.js +1002 -1002
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_search.js +71 -71
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_ui.js +199 -199
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.css +4123 -4123
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +4122 -4122
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.css +487 -487
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +484 -484
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.css +4265 -4265
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +4256 -4256
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.css +10877 -10877
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.css +10841 -10841
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.min.css +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.js +7075 -7075
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.js +5202 -5202
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.js +5249 -5249
- package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/d3/d3.v7.8.4.min.js +2 -2
- package/.emerge-vis-output/rws-client/html/vendors/d3/d3.v7.min.js +2 -2
- package/.emerge-vis-output/rws-client/html/vendors/dark-mode-switch/css/dark-mode.css +148 -148
- package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/daterangepicker.min.js +7 -7
- package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/moment.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/hull/hull.js +373 -373
- package/.emerge-vis-output/rws-client/html/vendors/jquery/jquery-3.6.0.min.js +2 -2
- package/.emerge-vis-output/rws-client/html/vendors/popper/popper.min.js +6 -6
- package/.emerge-vis-output/rws-client/html/vendors/simpleheat/simpleheat.js +141 -141
- package/.eslintrc.json +51 -51
- package/.gitmodules +2 -2
- package/.setup/.eslintrc.json +11 -11
- package/.setup/_base.eslintrc.json +48 -48
- package/.setup/tsconfig.json +28 -28
- package/PLUGINS.MD +188 -188
- package/README.md +1023 -1023
- package/_tools.js +396 -396
- package/builder/vite/index.ts +4 -4
- package/{cfg/build_steps → builder}/vite/loaders/html.ts +11 -11
- package/{cfg/build_steps → builder}/vite/loaders/index.ts +8 -8
- package/{cfg/build_steps → builder}/vite/loaders/loader.type.ts +27 -27
- package/{cfg/build_steps → builder}/vite/loaders/scss.ts +32 -32
- package/{cfg/build_steps → builder}/vite/loaders/ts.ts +309 -312
- package/builder/vite/rws.vite.config.ts +56 -49
- package/{cfg/build_steps → builder}/vite/rws_scss_plugin.ts +61 -60
- package/{cfg/build_steps → builder}/vite/scss/_compiler.ts +95 -94
- package/{cfg/build_steps → builder}/vite/scss/_fonts.ts +80 -80
- package/{cfg/build_steps → builder}/vite/scss/_fs.ts +83 -81
- package/{cfg/build_steps → builder}/vite/scss/_import.ts +191 -184
- package/builder/webpack/after/copy.js +78 -78
- package/builder/webpack/after/sw.js +13 -13
- package/builder/webpack/index.js +10 -10
- package/builder/webpack/loaders/rws_fast_html_loader.js +17 -17
- package/builder/webpack/loaders/rws_fast_scss_loader.js +43 -43
- package/builder/webpack/loaders/rws_fast_ts_loader.js +96 -96
- package/builder/webpack/loaders/ts/html_error.js +19 -19
- package/builder/webpack/rws.webpack.config.js +169 -169
- package/builder/webpack/rws_scss_plugin.js +62 -62
- package/builder/webpack/rws_webpack_plugin.js +137 -137
- package/builder/webpack/scss/_compiler.js +97 -97
- package/builder/webpack/scss/_fonts.js +80 -80
- package/builder/webpack/scss/_fs.js +84 -84
- package/builder/webpack/scss/_import.js +186 -186
- package/cfg/_default.cfg.js +26 -26
- package/cfg/_storage.d.ts +22 -22
- package/cfg/_storage.js +42 -42
- package/cfg/build_steps/vite/_build_config.ts +105 -105
- package/cfg/build_steps/vite/_env_defines.ts +17 -17
- package/cfg/build_steps/vite/_loaders.ts +187 -184
- package/cfg/build_steps/vite/index.ts +2 -2
- package/cfg/build_steps/vite/types.ts +7 -7
- package/cfg/build_steps/webpack/_actions.js +85 -85
- package/cfg/build_steps/webpack/_aliases.js +9 -9
- package/cfg/build_steps/webpack/_build_config.js +76 -76
- package/cfg/build_steps/webpack/_cache.js +98 -98
- package/cfg/build_steps/webpack/_component_handling.js +60 -60
- package/cfg/build_steps/webpack/_dev_servers.js +14 -14
- package/cfg/build_steps/webpack/_env_defines.js +18 -18
- package/cfg/build_steps/webpack/_info.js +18 -18
- package/cfg/build_steps/webpack/_loaders.js +223 -223
- package/cfg/build_steps/webpack/_plugins.js +102 -102
- package/cfg/build_steps/webpack/_production.js +37 -37
- package/cfg/build_steps/webpack/_rws_externals.js +68 -68
- package/cfg/build_steps/webpack/_timing.js +52 -52
- package/cfg/build_steps/webpack/_webpack_config.js +58 -58
- package/cfg/tsconfigSetup.js +150 -150
- package/console.js +86 -86
- 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 +108 -108
- 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 +165 -165
- package/src/client/services.ts +27 -27
- package/src/client.ts +212 -212
- package/src/components/_attrs/_default_observable_accessor.ts +8 -8
- package/src/components/_attrs/_extended_accessor.ts +40 -40
- package/src/components/_attrs/_external_handler.ts +7 -7
- package/src/components/_attrs/_external_observable_accessor.ts +8 -8
- package/src/components/_attrs/angular-attr.ts +34 -34
- package/src/components/_attrs/external-attr.ts +59 -59
- package/src/components/_attrs/external-observable.ts +52 -52
- package/src/components/_attrs/sanitize-html.ts +80 -80
- package/src/components/_component.ts +245 -245
- package/src/components/_container.ts +15 -15
- package/src/components/_decorator.ts +122 -122
- package/src/components/_decorators/RWSFillBuild.ts +54 -54
- package/src/components/_decorators/RWSInject.ts +49 -49
- package/src/components/_decorators/RWSService.ts +11 -11
- package/src/components/_decorators/_di.ts +15 -15
- package/src/components/_definitions.ts +64 -64
- package/src/components/_event_handling.ts +40 -40
- package/src/components/index.ts +14 -14
- package/src/components/loader/component.ts +12 -12
- package/src/components/loader/styles/layout.scss +13 -13
- package/src/components/progress/component.ts +54 -54
- package/src/components/progress/styles/layout.scss +90 -90
- package/src/components/progress/template.html +24 -24
- package/src/components/uploader/component.ts +83 -83
- package/src/components/uploader/styles/layout.scss +130 -130
- package/src/components/uploader/template.html +16 -16
- package/src/index.ts +93 -93
- package/src/plugins/_builder.js +31 -31
- package/src/plugins/_plugin.ts +63 -63
- package/src/services/ApiService.ts +242 -242
- package/src/services/ConfigService.ts +134 -134
- package/src/services/DOMService.ts +100 -100
- 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/_darkreader.scss +30 -30
- package/src/styles/_grid.scss +75 -75
- package/src/styles/_misc.scss +8 -8
- package/src/styles/_scrollbars.scss +40 -40
- package/src/styles/includes.scss +4 -4
- package/src/types/IRWSConfig.ts +30 -30
- package/src/types/IRWSPlugin.ts +18 -18
- package/src/types/IRWSUser.ts +6 -6
- package/src/types/IRWSViewComponent.ts +36 -36
- package/src/types/RWSNotify.ts +6 -6
- package/src/types/RWSWindow.ts +41 -41
- package/tsconfig.json +30 -30
- package/typedoc.json +13 -13
- package/types/declarations.d.ts +8 -8
- package/types/docs-typings.d.ts +15 -15
|
@@ -1,224 +1,224 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
|
|
5
|
-
const RWSCssPlugin = require("../../../webpack/rws_scss_plugin");
|
|
6
|
-
const plugin = new RWSCssPlugin();
|
|
7
|
-
const JSON5 = require('json5');
|
|
8
|
-
const chalk = require('chalk');
|
|
9
|
-
const { timingCounterStart, timingCounterStop } = require('./_timing');
|
|
10
|
-
const { rwsRuntimeHelper } = require('@rws-framework/console');
|
|
11
|
-
|
|
12
|
-
function getRWSLoaders(packageDir, nodeModulesPath, tsConfigPath, devDebug) {
|
|
13
|
-
const scssLoader = packageDir + '/webpack/loaders/rws_fast_scss_loader.js';
|
|
14
|
-
const tsLoader = packageDir + '/webpack/loaders/rws_fast_ts_loader.js';
|
|
15
|
-
const htmlLoader = packageDir + '/webpack/loaders/rws_fast_html_loader.js';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return [
|
|
19
|
-
{
|
|
20
|
-
test: /\.html$/,
|
|
21
|
-
use: [
|
|
22
|
-
{
|
|
23
|
-
loader: htmlLoader,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
test: /\.(ts)$/,
|
|
29
|
-
use: [
|
|
30
|
-
{
|
|
31
|
-
loader: 'ts-loader',
|
|
32
|
-
options: {
|
|
33
|
-
transpileOnly: true,
|
|
34
|
-
allowTsInNodeModules: true,
|
|
35
|
-
configFile: path.resolve(tsConfigPath)
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
loader: tsLoader,
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
exclude: [
|
|
43
|
-
/node_modules\/(?!\@rws-framework\/[A-Z0-9a-z])/,
|
|
44
|
-
/\.debug\.ts$/,
|
|
45
|
-
/\.d\.ts$/,
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
test: /\.scss$/i,
|
|
50
|
-
use: [
|
|
51
|
-
scssLoader,
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function _extractRWSViewDefs(fastOptions = {}, decoratorArgs = {})
|
|
58
|
-
{
|
|
59
|
-
const addedParamDefs = [];
|
|
60
|
-
const addedParams = [];
|
|
61
|
-
|
|
62
|
-
for (const key in fastOptions){
|
|
63
|
-
addedParamDefs.push(`const ${key} = ${JSON.stringify(fastOptions[key])};`);
|
|
64
|
-
addedParams.push(key);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return [addedParamDefs, addedParams];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function extractRWSViewArgs(content, noReplace = false) {
|
|
71
|
-
const viewReg = /@RWSView\(\s*["']([^"']+)["'](?:\s*,\s*([\s\S]*?))?\s*\)\s*(.*?\s+)?class\s+([a-zA-Z0-9_-]+)\s+extends\s+RWSViewComponent/gm;
|
|
72
|
-
|
|
73
|
-
let m;
|
|
74
|
-
let tagName = null;
|
|
75
|
-
let className = null;
|
|
76
|
-
let classNamePrefix = null;
|
|
77
|
-
let decoratorArgs = null;
|
|
78
|
-
|
|
79
|
-
const _defaultRWSLoaderOptions = {
|
|
80
|
-
templatePath: 'template.html',
|
|
81
|
-
stylesPath: 'styles.scss',
|
|
82
|
-
fastOptions: { shadowOptions: { mode: 'open' } }
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
while ((m = viewReg.exec(content)) !== null) {
|
|
87
|
-
// This is necessary to avoid infinite loops with zero-width matches
|
|
88
|
-
if (m.index === viewReg.lastIndex) {
|
|
89
|
-
viewReg.lastIndex++;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// The result can be accessed through the `m`-variable.
|
|
93
|
-
m.forEach((match, groupIndex) => {
|
|
94
|
-
if (groupIndex === 1) {
|
|
95
|
-
tagName = match;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (groupIndex === 2) {
|
|
99
|
-
if (match) {
|
|
100
|
-
try {
|
|
101
|
-
decoratorArgs = JSON5.parse(match);
|
|
102
|
-
} catch(e){
|
|
103
|
-
console.log(chalk.red('Decorator options parse error: ') + e.message + '\n Problematic line:');
|
|
104
|
-
console.log(`
|
|
105
|
-
@RWSView(${tagName}, ${match})
|
|
106
|
-
`);
|
|
107
|
-
console.log(chalk.yellowBright(`Decorator options failed to parse for "${tagName}" component.`) + ' { decoratorArgs } defaulting to null.');
|
|
108
|
-
console.log(match);
|
|
109
|
-
|
|
110
|
-
throw new Error('Failed parsing @RWSView')
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (groupIndex === 3) {
|
|
116
|
-
if(match){
|
|
117
|
-
classNamePrefix = match;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (groupIndex === 4) {
|
|
122
|
-
className = match;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if(!tagName){
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
let processedContent = content;
|
|
132
|
-
|
|
133
|
-
let fastOptions = _defaultRWSLoaderOptions.fastOptions;
|
|
134
|
-
|
|
135
|
-
if (decoratorArgs && decoratorArgs.fastElementOptions) {
|
|
136
|
-
fastOptions = decoratorArgs.fastElementOptions;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
let replacedDecorator = null;
|
|
140
|
-
|
|
141
|
-
if(!noReplace){
|
|
142
|
-
const [addedParamDefs, addedParams] = _extractRWSViewDefs(fastOptions, decoratorArgs);
|
|
143
|
-
const replacedViewDecoratorContent = processedContent.replace(
|
|
144
|
-
viewReg,
|
|
145
|
-
`@RWSView('$1', null, { template: rwsTemplate, styles${addedParams.length ? ', options: {' + (addedParams.join(', ')) + '}' : ''} })\n$3class $4 extends RWSViewComponent `
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
// console.log({replacedViewDecoratorContent});
|
|
149
|
-
|
|
150
|
-
replacedDecorator = `${addedParamDefs.join('\n')}\n${replacedViewDecoratorContent}`;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
viewDecoratorData: {
|
|
155
|
-
tagName,
|
|
156
|
-
className,
|
|
157
|
-
classNamePrefix,
|
|
158
|
-
decoratorArgs
|
|
159
|
-
},
|
|
160
|
-
replacedDecorator
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
async function getStyles(filePath, addDependency, templateExists, stylesPath = null, isDev = false) {
|
|
165
|
-
if(!stylesPath){
|
|
166
|
-
stylesPath = 'styles/layout.scss';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
let styles = 'const styles: null = null;'
|
|
170
|
-
const stylesFilePath = path.dirname(filePath) + '/' + stylesPath;
|
|
171
|
-
|
|
172
|
-
if (fs.existsSync(stylesFilePath)) {
|
|
173
|
-
const scsscontent = fs.readFileSync(stylesFilePath, 'utf-8');
|
|
174
|
-
timingCounterStart();
|
|
175
|
-
const codeData = await plugin.compileScssCode(scsscontent, path.dirname(filePath) + '/styles', null, filePath, !isDev);
|
|
176
|
-
const elapsed = timingCounterStop();
|
|
177
|
-
let currentTimingList = rwsRuntimeHelper.getRWSVar('_timer_css');
|
|
178
|
-
|
|
179
|
-
if(currentTimingList){
|
|
180
|
-
currentTimingList += `\n${filePath}|${elapsed}`;
|
|
181
|
-
}else{
|
|
182
|
-
currentTimingList = `${filePath}|${elapsed}`;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
rwsRuntimeHelper.setRWSVar('_timer_css', currentTimingList);
|
|
186
|
-
|
|
187
|
-
const cssCode = codeData.code;
|
|
188
|
-
|
|
189
|
-
styles = isDev ? `import './${stylesPath}';\n` : '';
|
|
190
|
-
|
|
191
|
-
if (!templateExists) {
|
|
192
|
-
styles += `import { css } from '@microsoft/fast-element';\n`;
|
|
193
|
-
}
|
|
194
|
-
styles += `const styles = ${templateExists ? 'T.' : ''}css\`${cssCode}\`;\n`;
|
|
195
|
-
|
|
196
|
-
addDependency(path.dirname(filePath) + '/' + stylesPath);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return styles;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
async function getTemplate(filePath, addDependency, templateName = null, isDev = false) {
|
|
203
|
-
if(!templateName){
|
|
204
|
-
templateName = 'template';
|
|
205
|
-
}
|
|
206
|
-
const templatePath = path.dirname(filePath) + `/${templateName}.html`;
|
|
207
|
-
let htmlFastImports = null;
|
|
208
|
-
const templateExists = fs.existsSync(templatePath);
|
|
209
|
-
|
|
210
|
-
let template = 'const rwsTemplate: null = null;';
|
|
211
|
-
|
|
212
|
-
if (templateExists) {
|
|
213
|
-
const templateContent = fs.readFileSync(templatePath, 'utf-8').replace(/<!--[\s\S]*?-->/g, '');
|
|
214
|
-
htmlFastImports = `import * as T from '@microsoft/fast-element';\nimport './${templateName}.html';\n`;
|
|
215
|
-
template = `
|
|
216
|
-
//@ts-ignore
|
|
217
|
-
let rwsTemplate: any = T.html\`${templateContent}\`;
|
|
218
|
-
`; addDependency(templatePath);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return [template, htmlFastImports, templateExists];
|
|
222
|
-
}
|
|
223
|
-
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
const RWSCssPlugin = require("../../../webpack/rws_scss_plugin");
|
|
6
|
+
const plugin = new RWSCssPlugin();
|
|
7
|
+
const JSON5 = require('json5');
|
|
8
|
+
const chalk = require('chalk');
|
|
9
|
+
const { timingCounterStart, timingCounterStop } = require('./_timing');
|
|
10
|
+
const { rwsRuntimeHelper } = require('@rws-framework/console');
|
|
11
|
+
|
|
12
|
+
function getRWSLoaders(packageDir, nodeModulesPath, tsConfigPath, devDebug) {
|
|
13
|
+
const scssLoader = packageDir + '/webpack/loaders/rws_fast_scss_loader.js';
|
|
14
|
+
const tsLoader = packageDir + '/webpack/loaders/rws_fast_ts_loader.js';
|
|
15
|
+
const htmlLoader = packageDir + '/webpack/loaders/rws_fast_html_loader.js';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
test: /\.html$/,
|
|
21
|
+
use: [
|
|
22
|
+
{
|
|
23
|
+
loader: htmlLoader,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
test: /\.(ts)$/,
|
|
29
|
+
use: [
|
|
30
|
+
{
|
|
31
|
+
loader: 'ts-loader',
|
|
32
|
+
options: {
|
|
33
|
+
transpileOnly: true,
|
|
34
|
+
allowTsInNodeModules: true,
|
|
35
|
+
configFile: path.resolve(tsConfigPath)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
loader: tsLoader,
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
exclude: [
|
|
43
|
+
/node_modules\/(?!\@rws-framework\/[A-Z0-9a-z])/,
|
|
44
|
+
/\.debug\.ts$/,
|
|
45
|
+
/\.d\.ts$/,
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
test: /\.scss$/i,
|
|
50
|
+
use: [
|
|
51
|
+
scssLoader,
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _extractRWSViewDefs(fastOptions = {}, decoratorArgs = {})
|
|
58
|
+
{
|
|
59
|
+
const addedParamDefs = [];
|
|
60
|
+
const addedParams = [];
|
|
61
|
+
|
|
62
|
+
for (const key in fastOptions){
|
|
63
|
+
addedParamDefs.push(`const ${key} = ${JSON.stringify(fastOptions[key])};`);
|
|
64
|
+
addedParams.push(key);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return [addedParamDefs, addedParams];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function extractRWSViewArgs(content, noReplace = false) {
|
|
71
|
+
const viewReg = /@RWSView\(\s*["']([^"']+)["'](?:\s*,\s*([\s\S]*?))?\s*\)\s*(.*?\s+)?class\s+([a-zA-Z0-9_-]+)\s+extends\s+RWSViewComponent/gm;
|
|
72
|
+
|
|
73
|
+
let m;
|
|
74
|
+
let tagName = null;
|
|
75
|
+
let className = null;
|
|
76
|
+
let classNamePrefix = null;
|
|
77
|
+
let decoratorArgs = null;
|
|
78
|
+
|
|
79
|
+
const _defaultRWSLoaderOptions = {
|
|
80
|
+
templatePath: 'template.html',
|
|
81
|
+
stylesPath: 'styles.scss',
|
|
82
|
+
fastOptions: { shadowOptions: { mode: 'open' } }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
while ((m = viewReg.exec(content)) !== null) {
|
|
87
|
+
// This is necessary to avoid infinite loops with zero-width matches
|
|
88
|
+
if (m.index === viewReg.lastIndex) {
|
|
89
|
+
viewReg.lastIndex++;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// The result can be accessed through the `m`-variable.
|
|
93
|
+
m.forEach((match, groupIndex) => {
|
|
94
|
+
if (groupIndex === 1) {
|
|
95
|
+
tagName = match;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (groupIndex === 2) {
|
|
99
|
+
if (match) {
|
|
100
|
+
try {
|
|
101
|
+
decoratorArgs = JSON5.parse(match);
|
|
102
|
+
} catch(e){
|
|
103
|
+
console.log(chalk.red('Decorator options parse error: ') + e.message + '\n Problematic line:');
|
|
104
|
+
console.log(`
|
|
105
|
+
@RWSView(${tagName}, ${match})
|
|
106
|
+
`);
|
|
107
|
+
console.log(chalk.yellowBright(`Decorator options failed to parse for "${tagName}" component.`) + ' { decoratorArgs } defaulting to null.');
|
|
108
|
+
console.log(match);
|
|
109
|
+
|
|
110
|
+
throw new Error('Failed parsing @RWSView')
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (groupIndex === 3) {
|
|
116
|
+
if(match){
|
|
117
|
+
classNamePrefix = match;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (groupIndex === 4) {
|
|
122
|
+
className = match;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if(!tagName){
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let processedContent = content;
|
|
132
|
+
|
|
133
|
+
let fastOptions = _defaultRWSLoaderOptions.fastOptions;
|
|
134
|
+
|
|
135
|
+
if (decoratorArgs && decoratorArgs.fastElementOptions) {
|
|
136
|
+
fastOptions = decoratorArgs.fastElementOptions;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let replacedDecorator = null;
|
|
140
|
+
|
|
141
|
+
if(!noReplace){
|
|
142
|
+
const [addedParamDefs, addedParams] = _extractRWSViewDefs(fastOptions, decoratorArgs);
|
|
143
|
+
const replacedViewDecoratorContent = processedContent.replace(
|
|
144
|
+
viewReg,
|
|
145
|
+
`@RWSView('$1', null, { template: rwsTemplate, styles${addedParams.length ? ', options: {' + (addedParams.join(', ')) + '}' : ''} })\n$3class $4 extends RWSViewComponent `
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
// console.log({replacedViewDecoratorContent});
|
|
149
|
+
|
|
150
|
+
replacedDecorator = `${addedParamDefs.join('\n')}\n${replacedViewDecoratorContent}`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
viewDecoratorData: {
|
|
155
|
+
tagName,
|
|
156
|
+
className,
|
|
157
|
+
classNamePrefix,
|
|
158
|
+
decoratorArgs
|
|
159
|
+
},
|
|
160
|
+
replacedDecorator
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function getStyles(filePath, addDependency, templateExists, stylesPath = null, isDev = false) {
|
|
165
|
+
if(!stylesPath){
|
|
166
|
+
stylesPath = 'styles/layout.scss';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let styles = 'const styles: null = null;'
|
|
170
|
+
const stylesFilePath = path.dirname(filePath) + '/' + stylesPath;
|
|
171
|
+
|
|
172
|
+
if (fs.existsSync(stylesFilePath)) {
|
|
173
|
+
const scsscontent = fs.readFileSync(stylesFilePath, 'utf-8');
|
|
174
|
+
timingCounterStart();
|
|
175
|
+
const codeData = await plugin.compileScssCode(scsscontent, path.dirname(filePath) + '/styles', null, filePath, !isDev);
|
|
176
|
+
const elapsed = timingCounterStop();
|
|
177
|
+
let currentTimingList = rwsRuntimeHelper.getRWSVar('_timer_css');
|
|
178
|
+
|
|
179
|
+
if(currentTimingList){
|
|
180
|
+
currentTimingList += `\n${filePath}|${elapsed}`;
|
|
181
|
+
}else{
|
|
182
|
+
currentTimingList = `${filePath}|${elapsed}`;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
rwsRuntimeHelper.setRWSVar('_timer_css', currentTimingList);
|
|
186
|
+
|
|
187
|
+
const cssCode = codeData.code;
|
|
188
|
+
|
|
189
|
+
styles = isDev ? `import './${stylesPath}';\n` : '';
|
|
190
|
+
|
|
191
|
+
if (!templateExists) {
|
|
192
|
+
styles += `import { css } from '@microsoft/fast-element';\n`;
|
|
193
|
+
}
|
|
194
|
+
styles += `const styles = ${templateExists ? 'T.' : ''}css\`${cssCode}\`;\n`;
|
|
195
|
+
|
|
196
|
+
addDependency(path.dirname(filePath) + '/' + stylesPath);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return styles;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async function getTemplate(filePath, addDependency, templateName = null, isDev = false) {
|
|
203
|
+
if(!templateName){
|
|
204
|
+
templateName = 'template';
|
|
205
|
+
}
|
|
206
|
+
const templatePath = path.dirname(filePath) + `/${templateName}.html`;
|
|
207
|
+
let htmlFastImports = null;
|
|
208
|
+
const templateExists = fs.existsSync(templatePath);
|
|
209
|
+
|
|
210
|
+
let template = 'const rwsTemplate: null = null;';
|
|
211
|
+
|
|
212
|
+
if (templateExists) {
|
|
213
|
+
const templateContent = fs.readFileSync(templatePath, 'utf-8').replace(/<!--[\s\S]*?-->/g, '');
|
|
214
|
+
htmlFastImports = `import * as T from '@microsoft/fast-element';\nimport './${templateName}.html';\n`;
|
|
215
|
+
template = `
|
|
216
|
+
//@ts-ignore
|
|
217
|
+
let rwsTemplate: any = T.html\`${templateContent}\`;
|
|
218
|
+
`; addDependency(templatePath);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return [template, htmlFastImports, templateExists];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
224
|
module.exports = { getRWSLoaders, extractRWSViewArgs, getTemplate, getStyles }
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
const webpack = require('webpack')
|
|
2
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
4
|
-
const { processEnvDefines } = require('./_env_defines');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
const RWS_WEBPACK_PLUGINS_BAG = {
|
|
8
|
-
_plugins: [],
|
|
9
|
-
add(plugin) {
|
|
10
|
-
if (Array.isArray(plugin)) {
|
|
11
|
-
if (!plugin.length) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
plugin.forEach((item) => {
|
|
16
|
-
RWS_WEBPACK_PLUGINS_BAG.add(item);
|
|
17
|
-
})
|
|
18
|
-
} else {
|
|
19
|
-
if (!plugin) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!this._plugins.includes(plugin)) {
|
|
24
|
-
this._plugins.push(plugin);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
getPlugins() {
|
|
29
|
-
return this._plugins
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function getPackageModPlugins() {
|
|
34
|
-
return [
|
|
35
|
-
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb/),
|
|
36
|
-
new webpack.IgnorePlugin({
|
|
37
|
-
resourceRegExp: /.*\.es6\.js$/,
|
|
38
|
-
contextRegExp: /node_modules/
|
|
39
|
-
}),
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
|
|
44
|
-
const _rws_defines = processEnvDefines(BuildConfigurator, rwsFrontendConfig, devDebug);
|
|
45
|
-
|
|
46
|
-
return [
|
|
47
|
-
new webpack.DefinePlugin(_rws_defines)
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath, devDebug) {
|
|
52
|
-
if(!devDebug?.profiling){
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const profiling = new webpack.debug.ProfilingPlugin({
|
|
57
|
-
outputPath: path.join(BuildConfigurator.get('outputDir') || rwsFrontendConfig.outputDir, '.profiling/profileEvents.json'),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return [
|
|
62
|
-
profiling
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath) {
|
|
67
|
-
return [
|
|
68
|
-
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotReload, isReport, tsConfigPath) {
|
|
73
|
-
|
|
74
|
-
RWS_WEBPACK_PLUGINS_BAG.add([
|
|
75
|
-
...getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug),
|
|
76
|
-
...getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath, devDebug),
|
|
77
|
-
...getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath),
|
|
78
|
-
...getPackageModPlugins()
|
|
79
|
-
]);
|
|
80
|
-
|
|
81
|
-
if (isHotReload) {
|
|
82
|
-
if (!publicDir) {
|
|
83
|
-
throw new Error('No public dir set')
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
RWS_WEBPACK_PLUGINS_BAG.add(new HtmlWebpackPlugin({
|
|
87
|
-
template: publicDir + '/' + publicIndex,
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const overridePlugins = rwsFrontendConfig.plugins || []
|
|
92
|
-
|
|
93
|
-
RWS_WEBPACK_PLUGINS_BAG.add(overridePlugins);
|
|
94
|
-
|
|
95
|
-
if (isReport) {
|
|
96
|
-
RWS_WEBPACK_PLUGINS_BAG.add(new BundleAnalyzerPlugin({
|
|
97
|
-
analyzerMode: 'static',
|
|
98
|
-
openAnalyzer: false,
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
1
|
+
const webpack = require('webpack')
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
4
|
+
const { processEnvDefines } = require('./_env_defines');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const RWS_WEBPACK_PLUGINS_BAG = {
|
|
8
|
+
_plugins: [],
|
|
9
|
+
add(plugin) {
|
|
10
|
+
if (Array.isArray(plugin)) {
|
|
11
|
+
if (!plugin.length) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
plugin.forEach((item) => {
|
|
16
|
+
RWS_WEBPACK_PLUGINS_BAG.add(item);
|
|
17
|
+
})
|
|
18
|
+
} else {
|
|
19
|
+
if (!plugin) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!this._plugins.includes(plugin)) {
|
|
24
|
+
this._plugins.push(plugin);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
getPlugins() {
|
|
29
|
+
return this._plugins
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getPackageModPlugins() {
|
|
34
|
+
return [
|
|
35
|
+
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb/),
|
|
36
|
+
new webpack.IgnorePlugin({
|
|
37
|
+
resourceRegExp: /.*\.es6\.js$/,
|
|
38
|
+
contextRegExp: /node_modules/
|
|
39
|
+
}),
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
|
|
44
|
+
const _rws_defines = processEnvDefines(BuildConfigurator, rwsFrontendConfig, devDebug);
|
|
45
|
+
|
|
46
|
+
return [
|
|
47
|
+
new webpack.DefinePlugin(_rws_defines)
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath, devDebug) {
|
|
52
|
+
if(!devDebug?.profiling){
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const profiling = new webpack.debug.ProfilingPlugin({
|
|
57
|
+
outputPath: path.join(BuildConfigurator.get('outputDir') || rwsFrontendConfig.outputDir, '.profiling/profileEvents.json'),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
profiling
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath) {
|
|
67
|
+
return [
|
|
68
|
+
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotReload, isReport, tsConfigPath) {
|
|
73
|
+
|
|
74
|
+
RWS_WEBPACK_PLUGINS_BAG.add([
|
|
75
|
+
...getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug),
|
|
76
|
+
...getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath, devDebug),
|
|
77
|
+
...getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath),
|
|
78
|
+
...getPackageModPlugins()
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
if (isHotReload) {
|
|
82
|
+
if (!publicDir) {
|
|
83
|
+
throw new Error('No public dir set')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
RWS_WEBPACK_PLUGINS_BAG.add(new HtmlWebpackPlugin({
|
|
87
|
+
template: publicDir + '/' + publicIndex,
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const overridePlugins = rwsFrontendConfig.plugins || []
|
|
92
|
+
|
|
93
|
+
RWS_WEBPACK_PLUGINS_BAG.add(overridePlugins);
|
|
94
|
+
|
|
95
|
+
if (isReport) {
|
|
96
|
+
RWS_WEBPACK_PLUGINS_BAG.add(new BundleAnalyzerPlugin({
|
|
97
|
+
analyzerMode: 'static',
|
|
98
|
+
openAnalyzer: false,
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
103
|
module.exports = { RWS_WEBPACK_PLUGINS_BAG, addStartPlugins };
|