@rws-framework/client 2.18.16 → 2.18.18

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.
@@ -45,7 +45,8 @@ const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
45
45
  rwsPlugins,
46
46
  BuildConfigurator,
47
47
  hotReload,
48
- hotReloadPort
48
+ hotReloadPort,
49
+ loaderIgnoreExceptions
49
50
  } = await getBuildConfig(rwsFrontendConfig, _packageDir);
50
51
 
51
52
  timeLog({ devDebug });
@@ -57,6 +58,7 @@ const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
57
58
  rwsPath.removeDirectory(outputDir, true);
58
59
  buildInfo.start(executionDir, tsConfig, outputDir, isDev, publicDir, isParted, partedPrefix, partedDirUrlPrefix, devTools, rwsFrontendConfig.rwsPlugins);
59
60
 
61
+
60
62
  // #SECTION INIT PLUGINS && ENV VARS DEFINES
61
63
  addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, hotReload, isReport);
62
64
 
@@ -94,7 +96,7 @@ const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
94
96
  optimConfig = {};
95
97
  }
96
98
 
97
- optimConfig = getRWSProductionSetup(optimConfig, tsConfigPath);
99
+ optimConfig = getRWSProductionSetup(optimConfig, tsConfig.path);
98
100
  }
99
101
 
100
102
  // #SECTION RWS DEV ACTIONS
@@ -133,9 +135,11 @@ const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
133
135
  appRootDir: appRoot,
134
136
  entrypoint: rwsFrontendConfig.entrypoint,
135
137
  hotReload,
136
- hotReloadPort
138
+ hotReloadPort,
139
+ loaderIgnoreExceptions
137
140
  });
138
141
 
142
+
139
143
  if (optimConfig) {
140
144
  // setup production config if it got created above
141
145
  cfgExport.optimization = optimConfig;
@@ -14,7 +14,7 @@ async function loadAliases(packageDir, tsConfig, nodeModulesPath, executionDir){
14
14
  const alias = tsConfig.config.compilerOptions.paths[aliasKey];
15
15
  tsPaths[aliasKey] = path.resolve(executionDir, alias[0]);
16
16
  }
17
-
17
+
18
18
  for(const pkgName of packageNames){
19
19
  const symlinkPath = path.join(nodeModulesPath, '@rws-framework', pkgName);
20
20
 
@@ -43,6 +43,8 @@ async function getBuildConfig(rwsFrontBuildConfig, _packageDir){
43
43
 
44
44
  const rwsPlugins = {};
45
45
 
46
+ const loaderIgnoreExceptions = await (BuildConfigurator.get('loaderIgnoreExceptions') || rwsFrontBuildConfig.loaderIgnoreExceptions)
47
+
46
48
  if(rwsFrontBuildConfig.rwsPlugins){
47
49
  for(const pluginEntry of rwsFrontBuildConfig.rwsPlugins){
48
50
  const pluginBuilder = (await import(`${pluginEntry}/build.js`)).default;
@@ -72,7 +74,8 @@ async function getBuildConfig(rwsFrontBuildConfig, _packageDir){
72
74
  rwsPlugins,
73
75
  BuildConfigurator,
74
76
  hotReload,
75
- hotReloadPort
77
+ hotReloadPort,
78
+ loaderIgnoreExceptions
76
79
  }
77
80
  }
78
81
 
@@ -9,7 +9,6 @@ function processEnvDefines(BuildConfigurator, config, devDebug) {
9
9
  }
10
10
 
11
11
  const rwsDefines = BuildConfigurator.get('env') || config.env || null;
12
-
13
12
  if (rwsDefines) {
14
13
  const stringifiedDefines = Object.entries(rwsDefines).reduce((acc, [key, value]) => ({
15
14
  ...acc,
@@ -5,19 +5,29 @@ const os = require('os');
5
5
  const { parseWebpackPath } = require('./_parser');
6
6
 
7
7
  const RWSCssPlugin = require("../../../builder/webpack/rws_scss_plugin");
8
-
9
8
  const chalk = require('chalk');
10
9
  const { timingCounterStart, timingCounterStop } = require('./_timing');
11
10
  const { rwsRuntimeHelper, rwsPath } = require('@rws-framework/console');
12
11
 
13
- function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entrypoint) {
12
+ function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entrypoint, loaderIgnoreExceptions) {
14
13
  const scssLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_scss_loader.js');
15
14
  const tsLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_ts_loader.js');
16
15
  const htmlLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_html_loader.js');
17
16
 
18
17
  const tsConfigPath = tsConfigData.path;
19
18
 
20
- const loaders = [
19
+ const allowedModules = ['@rws-framework\\/[A-Z0-9a-z]'];
20
+ // console.log('XXX', config);
21
+
22
+ if(loaderIgnoreExceptions){
23
+ for(const ignoreException of loaderIgnoreExceptions){
24
+ allowedModules.push(ignoreException);
25
+ }
26
+ }
27
+
28
+ const modulePattern = `node_modules\\/(?!(${allowedModules.join('|')}))`;
29
+
30
+ const loaders = [
21
31
  {
22
32
  test: /\.json$/,
23
33
  type: 'javascript/auto',
@@ -35,7 +45,7 @@ function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entry
35
45
  },
36
46
  {
37
47
  test: /\.(ts)$/,
38
- use: [
48
+ use: [
39
49
  {
40
50
  loader: 'ts-loader',
41
51
  options: {
@@ -45,11 +55,14 @@ function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entry
45
55
  experimentalDecorators: true,
46
56
  target: "ES2018",
47
57
  module: "commonjs"
48
- },
49
- transpileOnly: false,
58
+ },
59
+ allowTsInNodeModules: true,
60
+ reportFiles: true,
50
61
  logLevel: "info",
51
62
  logInfoToStdOut: true,
52
63
  context: executionDir,
64
+ transpileOnly: true,
65
+ experimentalWatchApi: true,
53
66
  errorFormatter: (message, colors) => {
54
67
  console.log({message});
55
68
  const messageText = typeof message === 'object' ? JSON.stringify(message, null, 2) : message;
@@ -71,6 +84,7 @@ function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entry
71
84
  ],
72
85
  exclude: [
73
86
  ...tsConfigData.excludes.map(item => item.abs()),
87
+ new RegExp(modulePattern),
74
88
  path.resolve(packageDir, 'builder'),
75
89
  /\.debug\.ts$/,
76
90
  /\.d\.ts$/
@@ -3,6 +3,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
3
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
4
4
  const { processEnvDefines } = require('./_env_defines');
5
5
  const path = require('path');
6
+ const fs = require('fs');
6
7
 
7
8
  const RWS_WEBPACK_PLUGINS_BAG = {
8
9
  _plugins: [],
@@ -48,19 +49,46 @@ function getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
48
49
  ]
49
50
  }
50
51
 
51
- function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
52
- if(!devDebug?.profiling){
53
- return [];
54
- }
52
+ function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
53
+ const plugins = [];
54
+
55
55
 
56
- const profiling = new webpack.debug.ProfilingPlugin({
57
- outputPath: path.join(BuildConfigurator.get('outputDir') || rwsFrontendConfig.outputDir, '.profiling/profileEvents.json'),
58
- });
56
+ if(devDebug?.profiling){
57
+ const profiling = new webpack.debug.ProfilingPlugin({
58
+ outputPath: path.resolve(BuildConfigurator.get('executionDir'), BuildConfigurator.get('outputDir') || rwsFrontendConfig.outputDir, '.profiling/profileEvents.json'),
59
+ });
60
+ plugins.push(profiling);
61
+
62
+ class FileListPlugin {
63
+ apply(compiler) {
64
+ compiler.hooks.done.tap('FileListPlugin', (stats) => {
65
+ const files = [];
66
+ stats.compilation.modules.forEach(module => {
67
+ if (module.resource) {
68
+ files.push(module.resource);
69
+ }
70
+ });
71
+
72
+ const output = `// Generated on ${new Date().toISOString()}\n` +
73
+ `// Total files processed: ${files.length}\n\n` +
74
+ `module.exports = ${JSON.stringify(files, null, 2)};\n`;
75
+
76
+ const reportPath = path.join(BuildConfigurator.get('executionDir'), 'processed-files.js');
77
+
78
+ fs.writeFileSync(
79
+ reportPath,
80
+ output
81
+ );
82
+
83
+ console.log(`\n[FileListPlugin] Saved ${files.length} processed files to ${reportPath}`);
84
+ });
85
+ }
86
+ }
59
87
 
88
+ plugins.push(new FileListPlugin());
89
+ }
60
90
 
61
- return [
62
- profiling
63
- ]
91
+ return plugins;
64
92
  }
65
93
 
66
94
  function getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig) {
@@ -23,7 +23,8 @@ async function createWebpackConfig({
23
23
  appRootDir,
24
24
  entrypoint,
25
25
  hotReload,
26
- hotReloadPort
26
+ hotReloadPort,
27
+ loaderIgnoreExceptions
27
28
  }) {
28
29
 
29
30
  if(hotReload){
@@ -57,7 +58,7 @@ async function createWebpackConfig({
57
58
  },
58
59
  devServer: hotReload ? getRWSHotReloadSetup(hotReloadPort, outputDir) : false,
59
60
  module: {
60
- rules: getRWSLoaders(_packageDir, executionDir, tsConfig, appRootDir, entrypoint),
61
+ rules: getRWSLoaders(_packageDir, executionDir, tsConfig, appRootDir, entrypoint, loaderIgnoreExceptions),
61
62
  },
62
63
  plugins: WEBPACK_PLUGINS,
63
64
  // externals: rwsExternals(_packageDir, executionDir, modules_setup, automatedChunks, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.18.16",
4
+ "version": "2.18.18",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -78,6 +78,7 @@
78
78
  "stacktrace-gps": "^3.1.2",
79
79
  "style-loader": "^3.3.3",
80
80
  "terser-webpack-plugin": "^5.3.9",
81
+ "thread-loader": "^4.0.4",
81
82
  "ts-loader": "^9.4.4",
82
83
  "ts-node": "^10.9.1",
83
84
  "ts-transformer-keys": "^0.4.4",
File without changes