@wavemaker/angular-codegen 11.10.5-rc.6100 → 11.11.0-1.6140

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.
Files changed (38) hide show
  1. package/angular-app/angular.json +4 -11
  2. package/angular-app/build-scripts/post-build.js +7 -47
  3. package/angular-app/dependency-report.html +1 -1
  4. package/angular-app/npm-shrinkwrap.json +510 -650
  5. package/angular-app/package-lock.json +510 -650
  6. package/angular-app/package.json +11 -21
  7. package/angular-app/src/app/lazy-load-scripts.resolve.ts +2 -9
  8. package/angular-app/src/assets/styles/css/wm-style.css +1 -1
  9. package/angular-app/src/index.html +1 -1
  10. package/angular-app/src/main.ts +25 -31
  11. package/angular-app/tsconfig.json +0 -30
  12. package/angular-app/tsconfig.web-app.json +0 -21
  13. package/angular-app/wm-custom-webpack.config.js +18 -0
  14. package/build-angular-app.js +11 -7
  15. package/dependencies/app.component.html +34 -26
  16. package/dependencies/pipe-provider.cjs.js +24962 -186
  17. package/dependencies/transpilation-web.cjs.js +13329 -816
  18. package/download-packages.js +99 -31
  19. package/npm-shrinkwrap.json +180 -323
  20. package/package-lock.json +180 -323
  21. package/package.json +2 -2
  22. package/src/codegen.js +1 -1
  23. package/src/gen-app-codegen-module.js +1 -1
  24. package/src/gen-app-override-css.js +1 -1
  25. package/src/gen-app-routes.js +1 -1
  26. package/src/gen-components.js +1 -1
  27. package/src/gen-layouts.js +1 -1
  28. package/src/handlebar-helpers.js +1 -1
  29. package/src/pages-util.js +1 -1
  30. package/src/project-meta.js +1 -1
  31. package/src/update-angular-json.js +1 -1
  32. package/src/wm-utils.js +1 -1
  33. package/templates/app-routes.ts.hbs +2 -2
  34. package/templates/app.config.ts.hbs +128 -0
  35. package/templates/app.module.ts.hbs +0 -2
  36. package/templates/layout/layout.component.ts.hbs +26 -4
  37. package/templates/page/page.component.ts.hbs +36 -5
  38. package/dependencies/transpilation-mobile.cjs.js +0 -93554
@@ -11,7 +11,7 @@
11
11
  <link rel="icon" type="image/x-icon" href="favicon.ico">
12
12
 
13
13
  </head>
14
- <body class="wm-app">
14
+ <body class="wm-app">
15
15
  <app-root></app-root>
16
16
  </body>
17
17
  </html>
@@ -1,20 +1,19 @@
1
- import { ApplicationRef, enableProdMode, NgModuleRef } from '@angular/core';
2
- import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3
-
4
- import { AppModule } from './app/app.module';
1
+ import { ApplicationRef, enableProdMode } from '@angular/core';
2
+ import { bootstrapApplication } from '@angular/platform-browser';
5
3
  import { environment } from './environments/environment';
6
-
7
4
  import initWmProjectProperties from './app/wm-project-properties';
8
5
  import { WMAppProperties } from './app/wmProperties';
9
6
  import * as fontConfig from './font.config';
7
+ import { appConfig } from './app/app.config';
8
+ import { AppComponent } from '@wm/runtime/base';
10
9
 
11
-
12
- let formatAcceptHeader = (languages: any) => {
13
- let result: string[] = [];
14
- let addedLanguages = new Set<string>(); // To track already added languages
10
+ // Format Accept-Language header
11
+ const formatAcceptHeader = (languages: string[]): string => {
12
+ const result: string[] = [];
13
+ const addedLanguages = new Set<string>(); // To track already added languages
15
14
  let qValue = 1.0;
16
15
 
17
- languages.forEach((lang: any) => {
16
+ languages.forEach((lang: string) => {
18
17
  if (!addedLanguages.has(lang)) {
19
18
  // Add the full language (e.g., en-US or en) if not already added
20
19
  result.push(`${lang}${qValue === 1.0 ? '' : `;q=${qValue.toFixed(1)}`}`);
@@ -37,31 +36,26 @@ let formatAcceptHeader = (languages: any) => {
37
36
  });
38
37
 
39
38
  return result.join(',');
40
- }
41
- WMAppProperties['preferredLanguage'] = formatAcceptHeader(navigator.languages);
42
- WMAppProperties['fontConfig'] = fontConfig;
43
-
39
+ };
44
40
 
45
- (window as any)._WM_APP_PROPERTIES = WMAppProperties
41
+ // Initialize WMAppProperties
42
+ WMAppProperties['preferredLanguage'] = formatAcceptHeader((navigator as any).languages);
43
+ WMAppProperties['fontConfig'] = fontConfig;
44
+ (window as any)._WM_APP_PROPERTIES = WMAppProperties;
46
45
  initWmProjectProperties();
47
46
 
48
47
  if (environment.production) {
49
- enableProdMode();
48
+ enableProdMode();
50
49
  }
51
50
 
52
51
  document.addEventListener('DOMContentLoaded', () => {
53
- new Promise<Event | void>( resolve => {
54
- if (window['cordova']) {
55
- document.addEventListener('deviceready', resolve);
56
- } else {
57
- resolve();
58
- }
59
- }).then(() => platformBrowserDynamic().bootstrapModule(AppModule))
60
- .then((appModuleRef: NgModuleRef<AppModule>) => {
61
- const applicationRef = appModuleRef.injector.get(ApplicationRef);
62
- window.addEventListener('unload', () => {
63
- applicationRef.components.map(c => c && c.destroy());
64
- });
65
- //console.timeEnd('bootstrap'), err => console.log(err);
66
- }, err => console.log(err));
67
- });
52
+ new Promise<Event | void>(resolve => {
53
+ resolve();
54
+ }).then(() => bootstrapApplication(AppComponent, appConfig))
55
+ .then((appRef: ApplicationRef) => {
56
+ window.addEventListener('unload', () => {
57
+ appRef.components.map(c => c?.destroy());
58
+ });
59
+ })
60
+ .catch(err => console.error('Error bootstrapping app:', err));
61
+ });
@@ -32,9 +32,6 @@
32
32
  "@wm/build-task": [
33
33
  "node_modules/@wavemaker/app-ng-runtime/build-task/"
34
34
  ],
35
- "@wm/mobile-build-task": [
36
- "node_modules/@wavemaker/app-ng-runtime/mobile-build-task"
37
- ],
38
35
  "@wm/core": [
39
36
  "node_modules/@wavemaker/app-ng-runtime/core"
40
37
  ],
@@ -56,18 +53,9 @@
56
53
  "@wm/components/page": [
57
54
  "node_modules/@wavemaker/app-ng-runtime/components/page/default"
58
55
  ],
59
- "@wm/mobile/components/basic": [
60
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/basic/default"
61
- ],
62
- "@wm/mobile/components/page": [
63
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/page/default"
64
- ],
65
56
  "@wm/components/dialogs": [
66
57
  "node_modules/@wavemaker/app-ng-runtime/components/dialogs/default"
67
58
  ],
68
- "@wm/mobile/components/*": [
69
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/*"
70
- ],
71
59
  "@wm/components/*": [
72
60
  "node_modules/@wavemaker/app-ng-runtime/components/*"
73
61
  ],
@@ -89,29 +77,11 @@
89
77
  "@wm/variables": [
90
78
  "node_modules/@wavemaker/app-ng-runtime/variables"
91
79
  ],
92
- "@wm/mobile/core": [
93
- "node_modules/@wavemaker/app-ng-runtime/mobile/core"
94
- ],
95
- "@wm/mobile/components": [
96
- "node_modules/@wavemaker/app-ng-runtime/mobile/components"
97
- ],
98
- "@wm/mobile/offline": [
99
- "node_modules/@wavemaker/app-ng-runtime/mobile/offline"
100
- ],
101
- "@wm/mobile/variables": [
102
- "node_modules/@wavemaker/app-ng-runtime/mobile/variables"
103
- ],
104
80
  "@wm/runtime/base": [
105
81
  "node_modules/@wavemaker/app-ng-runtime/runtime/base"
106
82
  ],
107
83
  "@wm/runtime/dynamic": [
108
84
  "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic"
109
- ],
110
- "@wm/mobile/runtime": [
111
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime"
112
- ],
113
- "@wm/mobile/runtime/dynamic": [
114
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime-dynamic"
115
85
  ]
116
86
  },
117
87
  "useDefineForClassFields": false
@@ -31,9 +31,6 @@
31
31
  "@wm/build-task": [
32
32
  "node_modules/@wavemaker/app-ng-runtime/build-task/"
33
33
  ],
34
- "@wm/mobile-build-task": [
35
- "node_modules/@wavemaker/app-ng-runtime/mobile-build-task"
36
- ],
37
34
  "@wm/core": [
38
35
  "node_modules/@wavemaker/app-ng-runtime/core"
39
36
  ],
@@ -70,29 +67,11 @@
70
67
  "@wm/variables": [
71
68
  "node_modules/@wavemaker/app-ng-runtime/variables"
72
69
  ],
73
- "@wm/mobile/core": [
74
- "node_modules/@wavemaker/app-ng-runtime/mobile/core"
75
- ],
76
- "@wm/mobile/components": [
77
- "node_modules/@wavemaker/app-ng-runtime/mobile/components"
78
- ],
79
- "@wm/mobile/offline": [
80
- "node_modules/@wavemaker/app-ng-runtime/mobile/offline"
81
- ],
82
- "@wm/mobile/variables": [
83
- "node_modules/@wavemaker/app-ng-runtime/mobile/variables"
84
- ],
85
70
  "@wm/runtime/base": [
86
71
  "node_modules/@wavemaker/app-ng-runtime/runtime/base"
87
72
  ],
88
73
  "@wm/runtime/dynamic": [
89
74
  "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic"
90
- ],
91
- "@wm/mobile/runtime": [
92
- "node_modules/@wavemaker/app-ng-runtime/mobile/placeholder/runtime"
93
- ],
94
- "@wm/mobile/runtime-dynamic": [
95
- "node_modules/@wavemaker/app-ng-runtime/mobile/placeholder/runtime/dynamic"
96
75
  ]
97
76
  }
98
77
  },
@@ -2,6 +2,18 @@ const CompressionPlugin = require(`compression-webpack-plugin`);
2
2
  const path = require(`path`);
3
3
  const {ConcatSource} = require("webpack-sources");
4
4
 
5
+ const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
6
+
7
+ const wmPropertiesPath = path.join(__dirname, '/src/app/wmProperties.js');
8
+
9
+ const { WMAppProperties } = require(wmPropertiesPath);
10
+
11
+ const localesToKeep = Object.values(WMAppProperties.supportedLanguages)
12
+ .map(lang => lang.moment)
13
+ .filter(locale => locale !== null);
14
+
15
+ const includeMomentPlugin = WMAppProperties.languageBundleSources === "STATIC";
16
+
5
17
  class ModifyCssAssetUrlsPlugin {
6
18
  apply(compiler) {
7
19
  compiler.hooks.compilation.tap('ModifyCssAssetUrlsPlugin', compilation => {
@@ -78,6 +90,12 @@ module.exports = {
78
90
  filename: "[name].br[ext]",
79
91
  algorithm: "brotliCompress"
80
92
  }),
93
+ // On STATIC WMAppProperties.languageBundleSources, required moment locales are included in the bundle
94
+
95
+ /**
96
+ * MomentLocalesPlugin is used to include only the required moment locales in the bundle.
97
+ */
98
+ ...(includeMomentPlugin ? [ new MomentLocalesPlugin({ localesToKeep }) ] : [])
81
99
  ],
82
100
  optimization: {
83
101
  splitChunks: {
@@ -148,10 +148,11 @@ const buildAngularApp = async (args) => {
148
148
  if (!fs.existsSync(SUCCESS_FILE)) {
149
149
  // Check if another process is already installing
150
150
  if (fs.existsSync(LOCK_FILE)) {
151
- console.log('Waiting for another build to complete npm install...');
151
+ console.log(`Waiting for another build to complete npm install... for package ${PACKAGE_NAME}`);
152
152
  await waitForLock(LOCK_FILE, 20 * 60 * 1000); // Wait for 20 minutes (timeout in milliseconds)
153
153
  } else {
154
154
  // Acquire the lock
155
+ fs.mkdirSync(TARBALL_DOWNLOAD_PATH, { recursive: true });
155
156
  fs.writeFileSync(LOCK_FILE, "PROGRESS");
156
157
  await processAngularAppPackage(TARBALL_DOWNLOAD_PATH, TARBALL_DOWNLOAD_PATH, PACKAGE_NAME, true);
157
158
  fs.writeFileSync(SUCCESS_FILE, "SUCCESS");
@@ -166,11 +167,13 @@ const buildAngularApp = async (args) => {
166
167
  }
167
168
  } catch (err) {
168
169
  deleteFiles([SUCCESS_FILE, LOCK_FILE])
169
- console.log(MSG_NG_RUNTIME_LOG + 'Something went wrong - ', err);
170
+ console.log(MSG_NG_RUNTIME_LOG + `Something went wrong - for package ${PACKAGE_NAME}`, err);
170
171
  process.exit(err.code || err.pid);
171
172
  } finally {
172
173
  //cleanup : in windows / optimizeUIBuild is false, we need to delete the temp downloaded package
173
- deleteFiles([path.join(TARBALL_DOWNLOAD_PATH, 'package'), path.join(TARBALL_DOWNLOAD_PATH, ANGULAR_APP_TARBALL_NAME), LOCK_FILE])
174
+ if (args.optimizeUIBuild) {
175
+ deleteFiles([path.join(TARBALL_DOWNLOAD_PATH, 'package'), path.join(TARBALL_DOWNLOAD_PATH, ANGULAR_APP_TARBALL_NAME), LOCK_FILE])
176
+ }
174
177
  }
175
178
 
176
179
  let ngBuildParams = updateDeployUrl(args);
@@ -308,9 +311,10 @@ const copyRecursiveSync = (src, dest) => {
308
311
  * Install the app-runtime-wm-build if package not yet installed.
309
312
  * Based on the platform type copy the bundle script into '/src/main/webapp'
310
313
  * @param {*} sourceDir
314
+ * @param {*} baseDir
311
315
  * @returns
312
316
  */
313
- const buildAppInWMMode = (sourceDir, baseDir) => {
317
+ const buildAppInWMMode = async (sourceDir, baseDir) => {
314
318
 
315
319
  /**
316
320
  * Download app-runtime-wm-build package and install if it doesn't exist
@@ -325,7 +329,7 @@ const buildAppInWMMode = (sourceDir, baseDir) => {
325
329
  };
326
330
 
327
331
  appRuntimeWMBuildPackageInfo.baseDir = baseDir;
328
- const PATH_WAVEMAKER_APP_RUNTIME_WM_BUILD = downloadNPMPackage(appRuntimeWMBuildPackageInfo);
332
+ const PATH_WAVEMAKER_APP_RUNTIME_WM_BUILD = await downloadNPMPackage(appRuntimeWMBuildPackageInfo);
329
333
 
330
334
  const FILE_PATH_WAVEMAKER_APP_RUNTIME_WM_BUILD = PATH_WAVEMAKER_APP_RUNTIME_WM_BUILD + '/node_modules/' + appRuntimeWMBuildPackageInfo.scope + '/' + appRuntimeWMBuildPackageInfo.name + '/';
331
335
 
@@ -456,7 +460,7 @@ const initBuild = async (buildConfigObj) => {
456
460
  const sourceDir = buildConfigObj.appSrc;
457
461
  let appTarget = buildConfigObj.appTarget;
458
462
 
459
- let baseDir = buildConfigObj.optimizeUIBuild ? undefined : appTarget.split('/').slice(0, 2).join('/') + '/';
463
+ let baseDir = buildConfigObj.optimizeUIBuild ? undefined : appTarget.split('/').slice(0, -2).join('/') + '/';
460
464
  if (buildConfigObj.generateOverrideCSS) {
461
465
  const { generateOverrideCSS } = require(CODEGEN_INSTALLATION + 'src/gen-app-override-css.js');
462
466
  await generateOverrideCSS(buildConfigObj, sourceDir, baseDir);
@@ -469,7 +473,7 @@ const initBuild = async (buildConfigObj) => {
469
473
  console.log('Angular app generation mode');
470
474
  await generateAngularApp(sourceDir, getNgBuildParams(), CODEGEN_INSTALLATION, appTarget, baseDir);
471
475
  } else if (buildType === BUILD_TYPE.WM) {
472
- buildAppInWMMode(sourceDir, baseDir);
476
+ await buildAppInWMMode(sourceDir, baseDir);
473
477
  } else if (buildType === BUILD_TYPE.ANGULAR) {
474
478
  if(!isWebComponentBuild) {
475
479
  await generateAngularApp(sourceDir, getNgBuildParams(), CODEGEN_INSTALLATION, appTarget, baseDir);
@@ -1,28 +1,36 @@
1
- <ng-container *ngIf="startApp">
2
- <router-outlet></router-outlet>
3
- <div wmContainer partialContainer content="Common" hidden class="ng-hide" *ngIf="isApplicationType"></div>
4
- <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
5
- <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
6
- close.event="closeOAuthDialog()">
7
- <ng-template #dialogBody>
8
- <ul class="list-items">
9
- <li class="list-item" *ngFor="let provider of providersConfig">
10
- <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
11
- </li>
12
- </ul>
13
- </ng-template>
14
- </div>
15
- <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
16
- canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
17
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
18
- <div *ngIf="!isApplicationType" wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
19
- canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
20
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
21
- <div *ngIf="!isApplicationType" wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
22
- canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
23
- escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
24
- <div wmAppExt></div>
25
- <i id="wm-mobile-display"></i>
26
- </ng-container>
1
+ @if (startApp) {
2
+ <router-outlet></router-outlet>
3
+ @if (isApplicationType) {
4
+ <div wmContainer partialContainer content="Common" hidden class="ng-hide"></div>
5
+ }
6
+ <app-spinner name="globalspinner" classname="global-spinner" role="alert" aria-live="assertive" [attr.aria-label]="spinner.arialabel || 'Loading'" [show]="spinner.show" [spinnermessages]="spinner.messages"></app-spinner>
7
+ <div wmDialog name="oAuthLoginDialog" title="Application is requesting you to sign in with"
8
+ close.event="closeOAuthDialog()">
9
+ <ng-template #dialogBody>
10
+ <ul class="list-items">
11
+ @for (provider of providersConfig; track provider) {
12
+ <li class="list-item">
13
+ <button class="btn" (click)="provider.invoke()">{{provider.name}}</button>
14
+ </li>
15
+ }
16
+ </ul>
17
+ </ng-template>
18
+ </div>
19
+ <div wmConfirmDialog name="_app-confirm-dialog" title.bind="title" message.bind="message" oktext.bind="oktext"
20
+ canceltext.bind="canceltext" closable="false" iconclass.bind="iconclass"
21
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
22
+ @if (!isApplicationType) {
23
+ <div wmConfirmDialog name="PrefabConfirmDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
24
+ canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
25
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
26
+ }
27
+ @if (!isApplicationType) {
28
+ <div wmAlertDialog name="PrefabAlertDialog" title.bind="title" message.bind="text" oktext.bind="okButtonText"
29
+ canceltext.bind="cancelButtonText" closable="false" iconclass.bind="iconclass"
30
+ escape.event="onEscape()" ok.event="onOk()" cancel.event="onCancel()" close.event="onClose()" opened.event="onOpen()"></div>
31
+ }
32
+ <div wmAppExt></div>
33
+ <i id="wm-mobile-display"></i>
34
+ }
27
35
  <!--Dummy container to create the component dynamically-->
28
36
  <ng-container #dynamicComponent></ng-container>