@wavemaker/angular-codegen 11.7.0-next.42251 → 11.7.0-rc.162

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 (28) hide show
  1. angular-codegen/angular-app/angular.json +25 -1622
  2. angular-codegen/angular-app/build-scripts/build.js +35 -0
  3. angular-codegen/angular-app/build-scripts/post-build.js +17 -11
  4. angular-codegen/angular-app/build-scripts/update-version.js +24 -0
  5. angular-codegen/angular-app/package-lock.json +12339 -13436
  6. angular-codegen/angular-app/package.json +65 -63
  7. angular-codegen/angular-app/src/app/lazy-load-scripts.resolve.ts +2 -4
  8. angular-codegen/angular-app/src/assets/print.css +32 -0
  9. angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
  10. angular-codegen/angular-app/src/setup-jest.js +121 -0
  11. angular-codegen/angular-app/tsconfig.json +44 -33
  12. angular-codegen/angular-app/wm-custom-webpack.config.js +60 -0
  13. angular-codegen/build-angular-app.js +13 -5
  14. angular-codegen/dependencies/expression-parser.cjs.js +40465 -9308
  15. angular-codegen/dependencies/pipe-provider.cjs.js +186312 -93393
  16. angular-codegen/dependencies/transpilation-mobile.cjs.js +58913 -28706
  17. angular-codegen/dependencies/transpilation-web.cjs.js +75541 -28898
  18. angular-codegen/download-packages.js +8 -1
  19. angular-codegen/package-lock.json +4 -4368
  20. angular-codegen/package.json +2 -2
  21. angular-codegen/src/codegen.js +1 -1
  22. angular-codegen/src/handlebar-helpers.js +1 -1
  23. angular-codegen/templates/app-prefabs.module.ts.hbs +0 -1
  24. angular-codegen/templates/app-routes.ts.hbs +6 -5
  25. angular-codegen/templates/layout/layout.module.ts.hbs +1 -1
  26. angular-codegen/templates/page/page.module.ts.hbs +2 -2
  27. angular-codegen/templates/partial/partial.module.ts.hbs +0 -1
  28. angular-codegen/templates/prefab/prefab.module.ts.hbs +0 -1
@@ -0,0 +1,121 @@
1
+ import "jest-preset-angular/setup-jest";
2
+ import { ToastrModule } from 'ngx-toastr';
3
+ import { TestBed } from '@angular/core/testing';
4
+ import _ from 'lodash-es';
5
+ import 'jest-canvas-mock';
6
+
7
+ // Mock global objects if necessary
8
+ global.jQuery = require("jquery");
9
+ global.$ = global.jQuery;
10
+ global._ = _;
11
+
12
+
13
+ global.moment = require("moment");
14
+
15
+ class IntersectionObserver {
16
+ constructor(callback, options) {
17
+
18
+ }
19
+
20
+ observe(element) {
21
+
22
+ }
23
+
24
+ unobserve() {
25
+ return null;
26
+ }
27
+
28
+ disconnect() {
29
+ return null;
30
+ }
31
+ }
32
+ global.IntersectionObserver = IntersectionObserver;
33
+ // jest.setup.js
34
+
35
+ // Mock MSCSSMatrix
36
+ class MockMSCSSMatrix {
37
+ constructor() {
38
+ // Initialize with default values or any necessary properties
39
+ }
40
+
41
+ // Add any methods that your tests might call
42
+ setMatrixValue(value) {
43
+ // Mock implementation of setMatrixValue
44
+ }
45
+
46
+ multiply(matrix) {
47
+ // Mock implementation of multiply
48
+ return this;
49
+ }
50
+
51
+ // Add other methods as needed
52
+ }
53
+
54
+ // Attach the mock to the global scope
55
+ global.MSCSSMatrix = MockMSCSSMatrix;
56
+
57
+ import "jquery-ui/ui/disable-selection.js";
58
+ import "jquery-ui/ui/version.js";
59
+ import "jquery-ui/ui/widget.js";
60
+ import "jquery-ui/ui/scroll-parent.js";
61
+ import "jquery-ui/ui/plugin.js";
62
+ import "jquery-ui/ui/data.js";
63
+ import "jquery-ui/ui/widgets/mouse.js";
64
+ import "jquery-ui/ui/widgets/resizable.js";
65
+ import "jquery-ui/ui/widgets/sortable.js";
66
+ import "jquery-ui/ui/widgets/draggable.js";
67
+ import "jquery-ui/ui/widgets/droppable.js";
68
+ import "libraries/scripts/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js";
69
+ import "moment-timezone/builds/moment-timezone.min.js";
70
+ import "hammerjs/hammer.min.js";
71
+ import "iscroll/build/iscroll.js";
72
+ import "tabbable/dist/index.umd.min.js";
73
+ import "@wavemaker/focus-trap/dist/focus-trap.umd.min.js";
74
+ import "x2js"
75
+
76
+
77
+
78
+ beforeEach(() => {
79
+ TestBed.configureTestingModule({
80
+ imports : [
81
+ ToastrModule.forRoot(),
82
+ ],
83
+ })
84
+ Object.defineProperties(window, {
85
+ location: {
86
+ writable: true,
87
+ value: {
88
+ reload: jest.fn(),
89
+ },
90
+ },
91
+ });
92
+ });
93
+
94
+ // jest.setup.js
95
+ Object.defineProperty(global.HTMLMediaElement.prototype, 'load', {
96
+ configurable: true,
97
+ enumerable: true,
98
+ writable: true,
99
+ value: jest.fn(),
100
+ });
101
+
102
+ Object.defineProperty(global.HTMLMediaElement.prototype, 'play', {
103
+ configurable: true,
104
+ enumerable: true,
105
+ writable: true,
106
+ value: jest.fn().mockResolvedValue(),
107
+ });
108
+
109
+ Object.defineProperty(global.HTMLMediaElement.prototype, 'pause', {
110
+ configurable: true,
111
+ enumerable: true,
112
+ writable: true,
113
+ value: jest.fn(),
114
+ });
115
+
116
+ Object.defineProperty(global.HTMLMediaElement.prototype, 'addTextTrack', {
117
+ configurable: true,
118
+ enumerable: true,
119
+ writable: true,
120
+ value: jest.fn(),
121
+ });
@@ -2,22 +2,19 @@
2
2
  "compileOnSave": false,
3
3
  "compilerOptions": {
4
4
  "baseUrl": "./",
5
- "downlevelIteration": true,
6
5
  "outDir": "./dist/out-tsc",
7
- "sourceMap": true,
6
+ "downlevelIteration": true,
8
7
  "declaration": false,
9
- "target": "es2022",
10
- "module": "es2020",
11
- "moduleResolution": "node",
8
+ "sourceMap": true,
12
9
  "emitDecoratorMetadata": true,
13
10
  "experimentalDecorators": true,
11
+ "esModuleInterop": true,
12
+ "moduleResolution": "node",
13
+ "target": "ES2022",
14
+ "module": "ES2022",
14
15
  "typeRoots": [
15
16
  "node_modules/@types"
16
17
  ],
17
- "lib": [
18
- "es2018",
19
- "dom"
20
- ],
21
18
  "paths": {
22
19
  "rxjs/observable/throw": [
23
20
  "node_modules/rxjs-compat/_esm2015/observable/throw"
@@ -35,31 +32,31 @@
35
32
  "node_modules/@wavemaker/app-ng-runtime/mobile-build-task"
36
33
  ],
37
34
  "@wm/core": [
38
- "node_modules/@wavemaker/app-ng-runtime/core"
35
+ "node_modules/@wavemaker/app-ng-runtime/core/index.d.ts"
39
36
  ],
40
37
  "@wavemaker/variables": [
41
38
  "node_modules/@wavemaker/variables/"
42
39
  ],
43
40
  "@wm/components/base": [
44
- "node_modules/@wavemaker/app-ng-runtime/components/base"
41
+ "node_modules/@wavemaker/app-ng-runtime/components/base/public_api.d.ts"
45
42
  ],
46
43
  "@wm/components/basic": [
47
- "node_modules/@wavemaker/app-ng-runtime/components/basic/default"
44
+ "node_modules/@wavemaker/app-ng-runtime/components/basic/default/index.d.ts"
48
45
  ],
49
46
  "@wm/components/input": [
50
- "node_modules/@wavemaker/app-ng-runtime/components/input/default"
47
+ "node_modules/@wavemaker/app-ng-runtime/components/input/default/index.d.ts"
51
48
  ],
52
49
  "@wm/components/page": [
53
- "node_modules/@wavemaker/app-ng-runtime/components/page/default"
50
+ "node_modules/@wavemaker/app-ng-runtime/components/page/default/index.d.ts"
54
51
  ],
55
52
  "@wm/mobile/components/basic": [
56
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/basic/default"
53
+ "node_modules/@wavemaker/app-ng-runtime/mobile/components/basic/default/index.d.ts"
57
54
  ],
58
55
  "@wm/mobile/components/page": [
59
- "node_modules/@wavemaker/app-ng-runtime/mobile/components/page/default"
56
+ "node_modules/@wavemaker/app-ng-runtime/mobile/components/page/default/index.d.ts"
60
57
  ],
61
58
  "@wm/components/dialogs": [
62
- "node_modules/@wavemaker/app-ng-runtime/components/dialogs/default"
59
+ "node_modules/@wavemaker/app-ng-runtime/components/dialogs/default/index.d.ts"
63
60
  ],
64
61
  "@wm/mobile/components/*": [
65
62
  "node_modules/@wavemaker/app-ng-runtime/mobile/components/*"
@@ -68,53 +65,67 @@
68
65
  "node_modules/@wavemaker/app-ng-runtime/components/*"
69
66
  ],
70
67
  "@wm/transpiler": [
71
- "node_modules/@wavemaker/app-ng-runtime/transpiler"
68
+ "node_modules/@wavemaker/app-ng-runtime/transpiler/index.d.ts"
72
69
  ],
73
70
  "@wm/security": [
74
- "node_modules/@wavemaker/app-ng-runtime/security"
71
+ "node_modules/@wavemaker/app-ng-runtime/security/index.d.ts"
75
72
  ],
76
73
  "@swipey": [
77
- "node_modules/@wavemaker/app-ng-runtime/swipey"
74
+ "node_modules/@wavemaker/app-ng-runtime/swipey/index.d.ts"
78
75
  ],
79
76
  "@wm/http": [
80
- "node_modules/@wavemaker/app-ng-runtime/http"
77
+ "node_modules/@wavemaker/app-ng-runtime/http/index.d.ts"
81
78
  ],
82
79
  "@wm/oAuth": [
83
- "node_modules/@wavemaker/app-ng-runtime/oAuth"
80
+ "node_modules/@wavemaker/app-ng-runtime/oAuth/index.d.ts"
84
81
  ],
85
82
  "@wm/variables": [
86
- "node_modules/@wavemaker/app-ng-runtime/variables"
83
+ "node_modules/@wavemaker/app-ng-runtime/variables/index.d.ts"
87
84
  ],
88
85
  "@wm/mobile/core": [
89
- "node_modules/@wavemaker/app-ng-runtime/mobile/core"
86
+ "node_modules/@wavemaker/app-ng-runtime/mobile/core/index.d.ts"
90
87
  ],
91
88
  "@wm/mobile/components": [
92
- "node_modules/@wavemaker/app-ng-runtime/mobile/components"
89
+ "node_modules/@wavemaker/app-ng-runtime/mobile/components/index.d.ts"
93
90
  ],
94
91
  "@wm/mobile/offline": [
95
- "node_modules/@wavemaker/app-ng-runtime/mobile/offline"
92
+ "node_modules/@wavemaker/app-ng-runtime/mobile/offline/index.d.ts"
96
93
  ],
97
94
  "@wm/mobile/variables": [
98
- "node_modules/@wavemaker/app-ng-runtime/mobile/variables"
95
+ "node_modules/@wavemaker/app-ng-runtime/mobile/variables/index.d.ts"
99
96
  ],
100
97
  "@wm/runtime/base": [
101
- "node_modules/@wavemaker/app-ng-runtime/runtime/base"
98
+ "node_modules/@wavemaker/app-ng-runtime/runtime/base/index.d.ts"
102
99
  ],
103
100
  "@wm/runtime/dynamic": [
104
- "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic"
101
+ "node_modules/@wavemaker/app-ng-runtime/runtime/dynamic/index.d.ts"
105
102
  ],
106
103
  "@wm/mobile/runtime": [
107
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime"
104
+ "node_modules/@wavemaker/app-ng-runtime/mobile/runtime/index.d.ts"
108
105
  ],
109
106
  "@wm/mobile/runtime/dynamic": [
110
- "node_modules/@wavemaker/app-ng-runtime/mobile/runtime-dynamic"
107
+ "node_modules/@wavemaker/app-ng-runtime/mobile/runtime-dynamic/index.d.ts"
111
108
  ]
112
109
  },
113
- "useDefineForClassFields": false
110
+ "lib": [
111
+ "es2020",
112
+ "dom"
113
+ ],
114
+ "useDefineForClassFields": false,
115
+ "resolveJsonModule": true
114
116
  },
115
117
  "angularCompilerOptions": {
116
118
  "compilationMode": "full",
117
119
  "strictMetadataEmit": false,
118
- "fullTemplateTypeCheck": false
120
+ "fullTemplateTypeCheck": false,
121
+ "extendedDiagnostics": {
122
+ "checks": {
123
+ "optionalChainNotNullable": "suppress"
124
+ }
125
+ },
126
+ "enableI18nLegacyMessageIdFormat": false,
127
+ "strictInjectionParameters": false,
128
+ "strictInputAccessModifiers": false,
129
+ "trace": true
119
130
  }
120
131
  }
@@ -1,5 +1,64 @@
1
1
  const CompressionPlugin = require(`compression-webpack-plugin`);
2
2
  const path = require(`path`);
3
+ const {ConcatSource} = require("webpack-sources");
4
+
5
+ class ModifyCssAssetUrlsPlugin {
6
+ apply(compiler) {
7
+ compiler.hooks.compilation.tap('ModifyCssAssetUrlsPlugin', compilation => {
8
+ compilation.hooks.optimizeAssets.tapAsync('ModifyCssAssetUrlsPlugin', (assets, callback) => {
9
+ let publicPath = compilation.options.output.publicPath;
10
+ let isResourceWithDeployUrl = false;
11
+ for (const assetName in assets) {
12
+ if (!assets.hasOwnProperty(assetName)) continue;
13
+
14
+ const asset = assets[assetName];
15
+ if (asset.sourceAndMap) {
16
+ const sourceAndMap = asset.sourceAndMap();
17
+ let updatedSource = sourceAndMap.source;
18
+ // Handle potential non-string source (e.g., convert to string)
19
+ if (typeof updatedSource !== 'string') {
20
+ updatedSource = updatedSource.toString('utf-8');
21
+ }
22
+ let modifiedSource = updatedSource.replace(/url\((.*?)\)/g, (match, url) => {
23
+ isResourceWithDeployUrl = true;
24
+
25
+ let qUrl = url.slice(1, -1);
26
+
27
+ if (!qUrl.startsWith(publicPath)) {
28
+ return match;
29
+ } else {
30
+ const newUrl = this.modifyUrl(publicPath, qUrl);
31
+ let urlString = `url('${newUrl}')`;
32
+ return urlString;
33
+ }
34
+
35
+ });
36
+ if (isResourceWithDeployUrl) {
37
+ isResourceWithDeployUrl = false;
38
+ assets[assetName] = new ConcatSource(modifiedSource);
39
+ }
40
+ }
41
+ }
42
+ callback(null, assets);
43
+ });
44
+ });
45
+ }
46
+
47
+ modifyUrl(publicPath, url) {
48
+ let qUrl = url;
49
+ let resourceName = qUrl;
50
+ try {
51
+ const parsedUrl = new URL(qUrl);
52
+ resourceName = parsedUrl.pathname.split('/').pop();
53
+ } catch (e) {
54
+ //this is relative url
55
+ let parts = qUrl.split('/');
56
+ resourceName = parts[parts.length - 1];
57
+ }
58
+ let newUrl = `ng-bundle/${resourceName}`;
59
+ return newUrl;
60
+ }
61
+ };
3
62
 
4
63
  module.exports = {
5
64
  resolve:{
@@ -8,6 +67,7 @@ module.exports = {
8
67
  }
9
68
  },
10
69
  plugins:[
70
+ new ModifyCssAssetUrlsPlugin(),
11
71
  new CompressionPlugin({
12
72
  test: /\.(js|css|html|svg|txt|eot|otf|ttf|gif)$/,
13
73
  filename: "[name].gzip[ext]",
@@ -20,13 +20,21 @@ const { executeSyncCmd, MSG_NG_RUNTIME_LOG, MSG_NG_RUNTIME_SUCCESS } = require(
20
20
  /**
21
21
  * @TODO: This is a temporary workaround to extract deploy-url from 'ngBuildParams', need to be replaced in future.
22
22
  */
23
- const updateDeployUrl = (ngBuildParams) => {
24
- let buildArgs = ngBuildParams.split(' ');
23
+ const updateDeployUrl = (args) => {
24
+ let buildArgs = args.ngBuildParams.split(' ');
25
25
  const deployParam = buildArgs.find(i => i.startsWith("--deploy-url="));
26
26
  if(!deployParam) {
27
27
  buildArgs.push("--deploy-url=ng-bundle/");
28
+ } else {
29
+ buildArgs.filter((param, index) => {
30
+ if (param.includes('--deploy-url=_cdnUrl_')) {
31
+ buildArgs[index] = "--deploy-url=_cdnUrl_/ng-bundle/"
32
+ return true;
33
+ }
34
+ });
28
35
  }
29
- return ngBuildParams = buildArgs.join(" ");
36
+ buildArgs.push(args.nodeVMArgs);
37
+ return buildArgs.join(" ");
30
38
  };
31
39
 
32
40
  /**
@@ -59,10 +67,10 @@ const buildAngularApp = (args) => {
59
67
  process.exit(err.code || err.pid);
60
68
  }
61
69
 
62
- let ngBuildParams = updateDeployUrl(args.ngBuildParams);
70
+ let ngBuildParams = updateDeployUrl(args);
63
71
  const NG_BUILD_MSG = 'NG BUILD MIGHT HAVE FAILED WITH HEAP OUT OF MEMORY, RE-EXECUTE THE BUILD BY INCREASING THE MAX-OLD-SPACE-SIZE ARGUMENT VALUE FOR BUILD.UI.NODE.ARGS PROPERTY IN DEPLOYMENT PROFILE';
64
72
  // Generating the angular build and post build process.
65
- executeSyncCmd('cd ' + args.appTarget + ' && node ' + args.nodeVMArgs + ' ./node_modules/@angular/cli/bin/ng build ' + ngBuildParams + ' && node build-scripts/post-build.js', null, MSG_NG_RUNTIME_LOG, false, NG_BUILD_MSG);
73
+ executeSyncCmd('cd ' + args.appTarget + ' && node ./build-scripts/build.js ' + ngBuildParams, null, MSG_NG_RUNTIME_LOG, false, NG_BUILD_MSG);
66
74
  }
67
75
 
68
76