@wavemaker/angular-codegen 11.0.2-rc.5180 → 11.0.2-rc.5185

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. angular-codegen/angular-app/angular.json +20 -8
  2. angular-codegen/angular-app/build-scripts/post-build.js +30 -52
  3. angular-codegen/angular-app/package-lock.json +7814 -4598
  4. angular-codegen/angular-app/package.json +32 -32
  5. angular-codegen/angular-app/src/.browserslistrc +1 -1
  6. angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
  7. angular-codegen/angular-app/src/environments/environment.ts +1 -1
  8. angular-codegen/angular-app/src/polyfills.ts +1 -1
  9. angular-codegen/build-angular-app.js +7 -4
  10. angular-codegen/dependencies/app.component.html +22 -0
  11. angular-codegen/dependencies/expression-parser.cjs.js +20263 -0
  12. angular-codegen/dependencies/pipe-provider.cjs.js +71744 -0
  13. angular-codegen/dependencies/transpilation-mobile.cjs.js +4867 -2030
  14. angular-codegen/dependencies/transpilation-web.cjs.js +4867 -2030
  15. angular-codegen/package.json +1 -1
  16. angular-codegen/src/codegen-args-cli.js +1 -1
  17. angular-codegen/src/codegen-cli.js +1 -1
  18. angular-codegen/src/codegen.js +1 -1
  19. angular-codegen/src/expr-parser-utils.js +1 -0
  20. angular-codegen/src/gen-app-variables.js +1 -1
  21. angular-codegen/src/gen-components.js +1 -1
  22. angular-codegen/src/handlebar-helpers.js +1 -1
  23. angular-codegen/src/pages-util.js +1 -1
  24. angular-codegen/src/update-angular-json.js +1 -1
  25. angular-codegen/src/wm-utils.js +1 -1
  26. angular-codegen/templates/app.component.script.js.hbs +6 -1
  27. angular-codegen/templates/component.expressions.ts.hbs +3 -0
  28. angular-codegen/templates/expr-vs-fn.hbs +3 -0
  29. angular-codegen/templates/page/page.component.ts.hbs +7 -1
  30. angular-codegen/templates/partial/partial.component.ts.hbs +6 -0
  31. angular-codegen/templates/prefab/prefab.component.ts.hbs +6 -0
@@ -19,7 +19,10 @@
19
19
  "indexTransform": "./build-scripts/index-html-transform.js",
20
20
  "deployUrl": "ng-bundle/",
21
21
  "outputPath": "dist/ng-bundle",
22
- "index": "src/index.html",
22
+ "index": {
23
+ "input": "src/index.html",
24
+ "output": "../index.html"
25
+ },
23
26
  "main": "src/main.ts",
24
27
  "polyfills": "src/polyfills.ts",
25
28
  "tsConfig": "src/tsconfig.app.json",
@@ -74,7 +77,7 @@
74
77
  "./node_modules/@wavemaker/app-ng-runtime/scripts/swipey/swipey.jquery.plugin.js",
75
78
  "./node_modules/@wavemaker/app-ng-runtime/scripts/jquery.ui.touch-punch/jquery.ui.touch-punch.min.js",
76
79
  "./node_modules/moment/min/moment.min.js",
77
- "./node_modules/fullcalendar/dist/fullcalendar.min.js",
80
+ "./node_modules/fullcalendar/main.min.js",
78
81
  "./node_modules/summernote/dist/summernote-lite.min.js",
79
82
  "./node_modules/hammerjs/hammer.min.js",
80
83
  "./node_modules/iscroll/build/iscroll.js",
@@ -93,7 +96,6 @@
93
96
  "optimization": true,
94
97
  "outputHashing": "all",
95
98
  "sourceMap": false,
96
- "extractCss": true,
97
99
  "namedChunks": false,
98
100
  "aot": true,
99
101
  "extractLicenses": true,
@@ -116,7 +118,6 @@
116
118
  "optimization": false,
117
119
  "outputHashing": "all",
118
120
  "sourceMap": false,
119
- "extractCss": true,
120
121
  "namedChunks": true,
121
122
  "aot": true,
122
123
  "extractLicenses": false,
@@ -135,7 +136,10 @@
135
136
  "builder": "@angular-devkit/build-angular:browser",
136
137
  "options": {
137
138
  "outputPath": "dist",
138
- "index": "src/index.html",
139
+ "index": {
140
+ "input": "src/index.html",
141
+ "output": "../index.html"
142
+ },
139
143
  "main": "src/main.ts",
140
144
  "polyfills": "src/polyfills.ts",
141
145
  "tsConfig": "src/tsconfig.app.json",
@@ -168,19 +172,27 @@
168
172
  "./node_modules/jquery-ui/ui/widgets/droppable.js",
169
173
  "./libraries/scripts/datatable/datatable.js",
170
174
  "./node_modules/moment/min/moment.min.js",
171
- "./node_modules/fullcalendar/dist/fullcalendar.min.js",
175
+ "./node_modules/fullcalendar/main.min.js",
172
176
  "./node_modules/summernote/dist/summernote-lite.min.js",
173
177
  "./node_modules/hammerjs/hammer.min.js",
174
178
  "./node_modules/iscroll/build/iscroll.js",
175
179
  "./node_modules/js-cookie/src/js.cookie.js",
176
180
  "./node_modules/jssha/dist/sha256.js"
177
- ]
181
+ ],
182
+ "aot": false,
183
+ "vendorChunk": true,
184
+ "extractLicenses": false,
185
+ "buildOptimizer": false,
186
+ "sourceMap": true,
187
+ "optimization": false,
188
+ "namedChunks": true
178
189
  },
179
190
  "configurations": {
180
191
  "production": {
181
192
  "browserTarget": "angular-app:build:production"
182
193
  }
183
- }
194
+ },
195
+ "defaultConfiguration": ""
184
196
  },
185
197
  "serve": {
186
198
  "builder": "@angular-devkit/build-angular:dev-server",
@@ -74,8 +74,8 @@ const setMobileProjectType = (angularJson) => {
74
74
  const addMobileSpecificStyles = async (deployUrl) => {
75
75
  if (isDevBuild) {
76
76
  $("body").append(
77
- `<script> const WMStylesPath ="${deployUrl}/wm-android-styles.js" </script>`
78
- )
77
+ `<script type="text/javascript" defer="true" src="${deployUrl}/wm-android-styles.js"></script>`
78
+ );
79
79
  }
80
80
 
81
81
  if (isProdBuild) {
@@ -92,40 +92,23 @@ const addMobileSpecificStyles = async (deployUrl) => {
92
92
  }
93
93
  }
94
94
 
95
- const addScriptForWMStylesPath = () => {
96
- // Add print css on load
97
- $("body").append(`<script>
98
- (function () {
99
- if (typeof WMStylesPath !== "undefined") {
100
- let styleType = WMStylesPath.split(".").pop();
101
- let styleNode;
102
- if(styleType==="css"){
103
- styleNode = document.createElement("link");
104
- styleNode.type = "text/css";
105
- styleNode.rel = "stylesheet";
106
- styleNode.href = WMStylesPath;
107
- }
108
- else if(styleType==="js"){
109
- styleNode = document.createElement("script");
110
- styleNode.type = "text/javascript";
111
- styleNode.src = WMStylesPath;
112
- styleNode.defer = true;
113
- }
114
-
115
- styleNode && document
116
- .getElementsByTagName("head")[0]
117
- .appendChild(styleNode);
118
- }
119
- })()
120
- window.onload = function() {
121
- var printCssNode = document.createElement('link');
122
- printCssNode.type = 'text/css';
123
- printCssNode.rel = 'stylesheet';
124
- printCssNode.href = 'print.css';
125
- printCssNode.media = 'print';
126
- document.getElementsByTagName("head")[0].appendChild(printCssNode);
127
- }
128
- </script>`);
95
+ const addScriptForWMStylesPath = (wm_styles_path) => {
96
+ // wm_styles_path will not be present for mobile apps
97
+ if (wm_styles_path) {
98
+ let styleType = wm_styles_path.split(".").pop();
99
+ if(styleType==="css"){
100
+ $("head").append(
101
+ `<link rel="stylesheet" type="text/css" href="${wm_styles_path}"/>`
102
+ );
103
+ } else {
104
+ $("body").append(
105
+ `<script type="text/javascript" defer="true" src="${wm_styles_path}"></script>`
106
+ );
107
+ }
108
+ }
109
+ $("head").append(
110
+ `<link rel="stylesheet" type="text/css" media="print" href="print.css"/>`
111
+ );
129
112
  }
130
113
 
131
114
  /**
@@ -155,9 +138,9 @@ const SKIP_UPDATE = ['index.html', 'manifest.json'];
155
138
  /**
156
139
  * Checks if a file's name has been changed during the build process
157
140
  * and if changed, returns an updated file path.
158
- *
141
+ *
159
142
  * @param {string} deployUrl deployment url
160
- * @param {string} url an absolute url to check if its filename has changed
143
+ * @param {string} url an absolute url to check if its filename has changed
161
144
  * @param {object} updatedFileNames a map from old filenames to new filenames
162
145
  * @returns {string} an updated file path
163
146
  */
@@ -176,8 +159,8 @@ const getUpdatedFileName = (deployUrl, url, updatedFileNames) => {
176
159
  /**
177
160
  * Checks if a file's content has been changed during the build process
178
161
  * and if changed, returns a new hash to be updated in ngsw.json
179
- *
180
- * @param {string} url an absolute url to check if its filename has changed
162
+ *
163
+ * @param {string} url an absolute url to check if its filename has changed
181
164
  * @param {object} updatedFileHashes a map from filenames to file hashes
182
165
  * @returns {string} an updated file hash
183
166
  */
@@ -191,7 +174,7 @@ const getUpdatedFileHashes = (url, oldHash, updatedFileHashes) => {
191
174
 
192
175
  /**
193
176
  * Get the path of the icon without '/ng-bundle'
194
- *
177
+ *
195
178
  * @param {string} iconPath path with '/ng-bundle'
196
179
  * @returns {string} path of the icon without '/ng-bundle'
197
180
  */
@@ -202,7 +185,7 @@ const getIconPath = (iconPath) => {
202
185
 
203
186
  /**
204
187
  * Updates name, location and content of PWA related assets.
205
- *
188
+ *
206
189
  * @param {string} deployUrl deployment url
207
190
  * @param {object} updatedFileNames a map from old filenames to new filenames
208
191
  * @returns {void}
@@ -245,7 +228,7 @@ const updatePwaAssets = (deployUrl, updatedFileNames, updatedFileHashes) => {
245
228
 
246
229
  /**
247
230
  * Generated sha1 hash for the content supplied.
248
- *
231
+ *
249
232
  * @param {string} content the content to be hashed
250
233
  * @returns {string} the hash value
251
234
  */
@@ -263,10 +246,8 @@ const generateSha1 = (content) => {
263
246
  deployUrl = deployUrl.slice(0, deployUrl.length - 1);
264
247
  }
265
248
 
266
- fs.copyFileSync('./dist/ng-bundle/index.html', './dist/index.html');
267
249
  const contents = await readFile(`./dist/index.html`, `utf8`);
268
250
  $ = cheerio.load(contents);
269
- $('script').attr('defer', 'true');
270
251
  setMobileProjectType(angularJson);
271
252
  if (!isMobileProject) {
272
253
  isProdBuild = fs.existsSync(`${process.cwd()}/dist/ng-bundle/wm-styles.css`);
@@ -291,26 +272,23 @@ const generateSha1 = (content) => {
291
272
  const serviceWorkerEnabled = build['configurations']['production']['serviceWorker'];
292
273
  const updatedFilenames = {}
293
274
  const updatedFileHashes = {}
275
+ let wm_styles_path;
294
276
 
295
277
  if (isMobileProject) {
296
278
  await addMobileSpecificStyles(deployUrl);
297
279
  } else {
298
280
  if (isDevBuild) {
299
- $("head").append(
300
- `<script> const WMStylesPath = "${deployUrl}/wm-styles.js" </script>`
301
- )
281
+ wm_styles_path = `${deployUrl}/wm-styles.js`;
302
282
  } else {
303
283
  const fileName = 'wm-styles';
304
284
  const hash = await generateHash(`${opPath}/${fileName}.css`);
305
285
  copyCssFiles(hash, updatedFilenames);
306
286
  const updatedFileName = `${fileName}.${hash}.css`
307
- $("head").append(
308
- `<script> const WMStylesPath = "${deployUrl}/${updatedFileName}" </script>`
309
- );
287
+ wm_styles_path = `${deployUrl}/${updatedFileName}`;
310
288
  }
311
289
  }
312
290
 
313
- addScriptForWMStylesPath();
291
+ addScriptForWMStylesPath(wm_styles_path);
314
292
  const htmlContent = $.html();
315
293
  await writeFile(`./dist/index.html`, htmlContent);
316
294