@wavemaker/angular-codegen 11.6.0-next.139412 → 11.6.0-next.141923

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.
@@ -29,6 +29,11 @@
29
29
  "assets": [
30
30
  "src/favicon.ico",
31
31
  "src/assets",
32
+ {
33
+ "glob": "print.css",
34
+ "input": "src/assets/",
35
+ "output": "."
36
+ },
32
37
  {
33
38
  "glob": "**/*",
34
39
  "input": "libraries/locales/",
@@ -187,7 +192,12 @@
187
192
  "tsConfig": "src/tsconfig.app.json",
188
193
  "assets": [
189
194
  "src/favicon.ico",
190
- "src/assets"
195
+ "src/assets",
196
+ {
197
+ "glob": "print.css",
198
+ "input": "src/assets/",
199
+ "output": "."
200
+ }
191
201
  ],
192
202
  "styles": [
193
203
  "src/styles.css",
@@ -0,0 +1,28 @@
1
+ const { spawnSync } = require('child_process');
2
+
3
+ const args = process.argv.slice(2);
4
+
5
+ const ngBuildArgs = ['build', ...args];
6
+ console.log("Build params - ", ngBuildArgs);
7
+
8
+ //Trigger angular build with the passed params
9
+ const ngBuildProcess = spawnSync('ng', ngBuildArgs, { stdio: 'inherit' });
10
+
11
+ if (ngBuildProcess.status === 0) {
12
+ console.log('ng build completed successfully!');
13
+ } else {
14
+ console.error('Error during ng build:', ngBuildProcess.error || ngBuildProcess.stderr);
15
+ process.exit(1);
16
+ }
17
+
18
+ const ngPostBuildArgs = ['build-scripts/post-build.js', ...args];
19
+ console.log("Post build params - ", ngPostBuildArgs);
20
+
21
+ const ngPostBuildProcess = spawnSync('node', ngPostBuildArgs, { stdio: 'inherit' });
22
+
23
+ if (ngPostBuildProcess.status === 0) {
24
+ console.log('ng post build completed successfully!');
25
+ } else {
26
+ console.error('Error during ng build:', ngPostBuildProcess.error || ngPostBuildProcess.stderr);
27
+ process.exit(1);
28
+ }
@@ -108,8 +108,10 @@ const addScriptForWMStylesPath = (wm_styles_path) => {
108
108
  );
109
109
  }
110
110
  }
111
+ }
112
+ const addPrintStylesPath = (print_styles_path) => {
111
113
  $("head").append(
112
- `<link rel="stylesheet" type="text/css" media="print" href="print.css"/>`
114
+ `<link rel="stylesheet" type="text/css" media="print" href="${print_styles_path}"/>`
113
115
  );
114
116
  }
115
117
 
@@ -289,6 +291,11 @@ const generateSha1 = (content) => {
289
291
  }
290
292
 
291
293
  addScriptForWMStylesPath(wm_styles_path);
294
+ addPrintStylesPath(`${deployUrl}/print.css`);
295
+
296
+ //this is required to download all the assets
297
+ $('head').append('<meta name="deployUrl" content="_cdnUrl_" />');
298
+
292
299
  const htmlContent = $.html();
293
300
  await writeFile(`./dist/index.html`, htmlContent);
294
301
 
@@ -35,8 +35,8 @@
35
35
  "@babel/runtime": "^7.14.8",
36
36
  "@metrichor/jmespath": "^0.3.1",
37
37
  "@wavemaker/focus-trap": "^1.0.0",
38
- "@wavemaker/nvd3": "1.8.8",
39
- "@wavemaker/variables": "11.6.0-next.139412",
38
+ "@wavemaker/nvd3": "1.8.9",
39
+ "@wavemaker/variables": "11.6.0-next.141923",
40
40
  "@ztree/ztree_v3": "^3.5.48",
41
41
  "angular-imask": "6.3.0",
42
42
  "angular2-websocket": "0.9.7",
@@ -5939,17 +5939,17 @@
5939
5939
  }
5940
5940
  },
5941
5941
  "node_modules/@wavemaker/nvd3": {
5942
- "version": "1.8.8",
5943
- "resolved": "https://registry.npmjs.org/@wavemaker/nvd3/-/nvd3-1.8.8.tgz",
5944
- "integrity": "sha512-8YWAmd2tXCjyac8JYzjAm3DHZ8KVAyT/4QiR3iZScOCVLpjNTfY2oSpLUp+JQV5WSB7Vi0v5u6Ajb/k8LP1jBA==",
5942
+ "version": "1.8.9",
5943
+ "resolved": "https://registry.npmjs.org/@wavemaker/nvd3/-/nvd3-1.8.9.tgz",
5944
+ "integrity": "sha512-J3uleu0akL+Kvw5j9EcP6JRRtkqHl3p1CBqKywiOYeR86+dao415i3V3xMbI8wHKAjIgf54mqIb9qR7M+74xjw==",
5945
5945
  "peerDependencies": {
5946
5946
  "d3": "7.8.5"
5947
5947
  }
5948
5948
  },
5949
5949
  "node_modules/@wavemaker/variables": {
5950
- "version": "11.6.0-next.139412",
5951
- "resolved": "https://registry.npmjs.org/@wavemaker/variables/-/variables-11.6.0-next.139412.tgz",
5952
- "integrity": "sha512-wqTcW5BvcpTa6VKmKys7FuG3fMjqgQnfv1SjniqCB//QxTcUxkyv29omI2m0lsM07CgfOxAoXPJO8Oa4eJZxXg==",
5950
+ "version": "11.6.0-next.141923",
5951
+ "resolved": "https://registry.npmjs.org/@wavemaker/variables/-/variables-11.6.0-next.141923.tgz",
5952
+ "integrity": "sha512-e4NbjITCXg6puP+AWVUUPdUXd0yoFB54wLMo191jBy4NVB1rBsnc8dFwOSPtlMSyLPf4VfwHYxYZgApqv9CIxw==",
5953
5953
  "dependencies": {
5954
5954
  "@metrichor/jmespath": "^0.3.1",
5955
5955
  "he": "^1.2.0",
@@ -4,8 +4,8 @@
4
4
  "scripts": {
5
5
  "ng": "ng",
6
6
  "start": "./node_modules/.bin/ng serve",
7
- "build": "./node_modules/.bin/ng build",
8
- "postbuild": "node build-scripts/post-build.js",
7
+ "build": "node build-scripts/build.js",
8
+ "post-build": "node build-scripts/post-build.js",
9
9
  "test": "./node_modules/.bin/ng test",
10
10
  "test_components": "./node_modules/.bin/ng t @wm/components/base",
11
11
  "test_mobile": "./node_modules/.bin/ng t @wm/mobile/components/basic",
@@ -45,9 +45,9 @@
45
45
  "@awesome-cordova-plugins/vibration": "5.39.1",
46
46
  "@babel/runtime": "^7.14.8",
47
47
  "@metrichor/jmespath": "^0.3.1",
48
- "@wavemaker/nvd3": "1.8.8",
49
48
  "@wavemaker/focus-trap": "^1.0.0",
50
- "@wavemaker/variables": "11.6.0-next.139412",
49
+ "@wavemaker/nvd3": "1.8.9",
50
+ "@wavemaker/variables": "11.6.0-next.141923",
51
51
  "@ztree/ztree_v3": "^3.5.48",
52
52
  "angular-imask": "6.3.0",
53
53
  "angular2-websocket": "0.9.7",
@@ -72,7 +72,7 @@
72
72
  "tslib": "2.4.1",
73
73
  "x2js": "^3.4.4",
74
74
  "zone.js": "~0.11.4",
75
- "@wavemaker/app-ng-runtime": "11.6.0-next.139412"
75
+ "@wavemaker/app-ng-runtime": "11.6.0-next.141923"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@ampproject/rollup-plugin-closure-compiler": "^0.27.0",
@@ -83,6 +83,10 @@
83
83
  "@angular/language-service": "15.2.9",
84
84
  "@babel/plugin-transform-runtime": "^7.14.5",
85
85
  "@compodoc/compodoc": "^1.1.19",
86
+ "@rollup/plugin-alias": "4.0.2",
87
+ "@rollup/plugin-commonjs": "24.0.0",
88
+ "@rollup/plugin-multi-entry": "6.0.0",
89
+ "@rollup/plugin-node-resolve": "15.0.1",
86
90
  "@types/jasmine": "2.8.8",
87
91
  "@types/jasminewd2": "2.0.3",
88
92
  "@types/jquery": "3.3.22",
@@ -113,13 +117,9 @@
113
117
  "owasp-dependency-check": "0.0.21",
114
118
  "rimraf": "2.6.3",
115
119
  "rollup": "3.9.1",
116
- "@rollup/plugin-alias": "4.0.2",
117
- "@rollup/plugin-commonjs": "24.0.0",
118
120
  "rollup-plugin-includepaths": "0.2.3",
119
- "@rollup/plugin-multi-entry": "6.0.0",
120
- "@rollup/plugin-node-resolve": "15.0.1",
121
- "terser": "^5.15.1",
122
121
  "sonarqube-scanner": "^2.8.2",
122
+ "terser": "^5.15.1",
123
123
  "ts-node": "7.0.1",
124
124
  "tslint": "~6.1.0",
125
125
  "typescript": "4.9.5",
@@ -0,0 +1,32 @@
1
+ body {margin:0; padding:0; line-height: 1.4em; word-spacing:1px; letter-spacing:0.2px; font: 13px Arial, Helvetica,"Lucida Grande", serif; color: #000;}
2
+
3
+ /*Header*/
4
+ h2 {color:#000; font-size:25px;}
5
+
6
+ /* Links */
7
+ a:link, a:visited {background: transparent; color:#333; text-decoration:none;}
8
+ a:link[href^="http://"]:after, a[href^="http://"]:visited:after {content: " (" attr(href) ") "; font-size: 11px;}
9
+ a[href^="http://"] {color:#000;}
10
+
11
+ /*Image*/
12
+ img, img a, .more-link a {border:none;}
13
+
14
+ /*Remove Element*/
15
+ .app-header, .app-top-nav, .app-footer, .app-left-panel, .app-right-panel {display: none !important;}
16
+
17
+ /*Remove Form Controls*/
18
+ .app-checkboxset, .app-button, .app-button-group, .app-menu, .app-composite-widget,
19
+ .form-group, .form-control,
20
+ .app-fileupload, .app-grid .table-footer
21
+ {display: none !important;}
22
+
23
+ /*Show all of the grid data*/
24
+ .app-grid .app-datagrid .app-datagrid-cell {
25
+ overflow: visible;
26
+ word-wrap: break-word;
27
+ }
28
+
29
+ /*Show Grid record data*/
30
+ .app-grid-layout .form-group {
31
+ display: block !important;
32
+ }
@@ -62,7 +62,7 @@ const buildAngularApp = (args) => {
62
62
  let ngBuildParams = updateDeployUrl(args.ngBuildParams);
63
63
  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
64
  // 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);
65
+ executeSyncCmd('cd ' + args.appTarget + ' && NODE_OPTIONS=' + args.nodeVMArgs.trim() + ' npm run build -- ' + ngBuildParams , null, MSG_NG_RUNTIME_LOG, false, NG_BUILD_MSG);
66
66
  }
67
67
 
68
68
 
@@ -93985,6 +93985,7 @@ const REGEX$1 = {
93985
93985
  IPOD: /iPod/i,
93986
93986
  IPAD: /iPad/i,
93987
93987
  MAC: /Mac/i,
93988
+ MACINTEL: /MacIntel/i,
93988
93989
  ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
93989
93990
  MOBILE: /Mobile/i,
93990
93991
  WINDOWS: /Windows Phone/i,
@@ -94028,7 +94029,7 @@ const isAndroidTablet$1 = () => REGEX$1.ANDROID_TABLET.test(userAgent$1) && !((/
94028
94029
  const isIphone$1 = () => REGEX$1.IPHONE.test(userAgent$1);
94029
94030
  const isIpod$1 = () => REGEX$1.IPOD.test(userAgent$1);
94030
94031
  const isIpad$1 = () => {
94031
- return REGEX$1.IPAD.test(userAgent$1) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX$1.MAC.test(window.navigator.platform));
94032
+ return REGEX$1.IPAD.test(userAgent$1) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX$1.MAC.test(window.navigator.platform) || REGEX$1.MACINTEL.test(window.navigator.platform)));
94032
94033
  };
94033
94034
  const isIos$1 = () => isIphone$1() || isIpod$1() || isIpad$1();
94034
94035
  const isLargeTabletLandscape$1 = (landScapeWidth, landScapeHeight) => {
@@ -120822,6 +120823,7 @@ const REGEX = {
120822
120823
  IPOD: /iPod/i,
120823
120824
  IPAD: /iPad/i,
120824
120825
  MAC: /Mac/i,
120826
+ MACINTEL: /MacIntel/i,
120825
120827
  ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
120826
120828
  MOBILE: /Mobile/i,
120827
120829
  WINDOWS: /Windows Phone/i,
@@ -120865,7 +120867,7 @@ const isAndroidTablet = () => REGEX.ANDROID_TABLET.test(userAgent) && !((/Tablet
120865
120867
  const isIphone = () => REGEX.IPHONE.test(userAgent);
120866
120868
  const isIpod = () => REGEX.IPOD.test(userAgent);
120867
120869
  const isIpad = () => {
120868
- return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX.MAC.test(window.navigator.platform));
120870
+ return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX.MAC.test(window.navigator.platform) || REGEX.MACINTEL.test(window.navigator.platform)));
120869
120871
  };
120870
120872
  const isIos = () => isIphone() || isIpod() || isIpad();
120871
120873
  const isLargeTabletLandscape = (landScapeWidth, landScapeHeight) => {
@@ -57611,6 +57611,7 @@ const REGEX = {
57611
57611
  IPOD: /iPod/i,
57612
57612
  IPAD: /iPad/i,
57613
57613
  MAC: /Mac/i,
57614
+ MACINTEL: /MacIntel/i,
57614
57615
  ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
57615
57616
  MOBILE: /Mobile/i,
57616
57617
  WINDOWS: /Windows Phone/i,
@@ -57654,7 +57655,7 @@ const isAndroidTablet = () => REGEX.ANDROID_TABLET.test(userAgent) && !((/Tablet
57654
57655
  const isIphone = () => REGEX.IPHONE.test(userAgent);
57655
57656
  const isIpod = () => REGEX.IPOD.test(userAgent);
57656
57657
  const isIpad = () => {
57657
- return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX.MAC.test(window.navigator.platform));
57658
+ return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX.MAC.test(window.navigator.platform) || REGEX.MACINTEL.test(window.navigator.platform)));
57658
57659
  };
57659
57660
  const isIos = () => isIphone() || isIpod() || isIpad();
57660
57661
  const isLargeTabletLandscape = (landScapeWidth, landScapeHeight) => {
@@ -61993,7 +61994,7 @@ const registerFormField = (isFormField) => {
61993
61994
  const dataRole = isFormField ? 'form-field' : 'filter-field';
61994
61995
  const formFieldErrorMsgId = 'wmform-field-error-' + generateGUId();
61995
61996
  const validationMsg = isFormField ? `<p *ngIf="${counter}._control?.invalid && ${counter}._control?.touched && ${pCounter}.isUpdateMode"
61996
- class="help-block text-danger" aria-hidden="false" role="alert"
61997
+ class="help-block text-danger" aria-hidden="false"
61997
61998
  aria-live="assertive" [attr.aria-label]="${counter}.validationmessage" id="${formFieldErrorMsgId}"><span aria-hidden="true" [textContent]="${counter}.validationmessage"></span></p>` : '';
61998
61999
  const eventsTmpl = widgetType === FormWidgetType.UPLOAD ? '' : getEventsTemplate(attrs);
61999
62000
  const controlLayout = isMobileApp() ? 'col-xs-12' : 'col-sm-12';
@@ -57611,6 +57611,7 @@ const REGEX = {
57611
57611
  IPOD: /iPod/i,
57612
57612
  IPAD: /iPad/i,
57613
57613
  MAC: /Mac/i,
57614
+ MACINTEL: /MacIntel/i,
57614
57615
  ANDROID_TABLET: /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i,
57615
57616
  MOBILE: /Mobile/i,
57616
57617
  WINDOWS: /Windows Phone/i,
@@ -57654,7 +57655,7 @@ const isAndroidTablet = () => REGEX.ANDROID_TABLET.test(userAgent) && !((/Tablet
57654
57655
  const isIphone = () => REGEX.IPHONE.test(userAgent);
57655
57656
  const isIpod = () => REGEX.IPOD.test(userAgent);
57656
57657
  const isIpad = () => {
57657
- return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && REGEX.MAC.test(window.navigator.platform));
57658
+ return REGEX.IPAD.test(userAgent) || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2 && (REGEX.MAC.test(window.navigator.platform) || REGEX.MACINTEL.test(window.navigator.platform)));
57658
57659
  };
57659
57660
  const isIos = () => isIphone() || isIpod() || isIpad();
57660
57661
  const isLargeTabletLandscape = (landScapeWidth, landScapeHeight) => {
@@ -61993,7 +61994,7 @@ const registerFormField = (isFormField) => {
61993
61994
  const dataRole = isFormField ? 'form-field' : 'filter-field';
61994
61995
  const formFieldErrorMsgId = 'wmform-field-error-' + generateGUId();
61995
61996
  const validationMsg = isFormField ? `<p *ngIf="${counter}._control?.invalid && ${counter}._control?.touched && ${pCounter}.isUpdateMode"
61996
- class="help-block text-danger" aria-hidden="false" role="alert"
61997
+ class="help-block text-danger" aria-hidden="false"
61997
61998
  aria-live="assertive" [attr.aria-label]="${counter}.validationmessage" id="${formFieldErrorMsgId}"><span aria-hidden="true" [textContent]="${counter}.validationmessage"></span></p>` : '';
61998
61999
  const eventsTmpl = widgetType === FormWidgetType.UPLOAD ? '' : getEventsTemplate(attrs);
61999
62000
  const controlLayout = isMobileApp() ? 'col-xs-12' : 'col-sm-12';
@@ -32,6 +32,7 @@ const downloadNPMPackage = (packageInfo) => {
32
32
  const HOME_DIR = os.homedir();
33
33
  const PATH_NPM_PACKAGE = (packageInfo.baseDir || HOME_DIR + '/.wm/node_modules/') + packageInfo.name + '/' + packageInfo.version;
34
34
  const PATH_NPM_PACKAGE_SUCCESS = PATH_NPM_PACKAGE + '/.SUCCESS';
35
+ let isError = false;
35
36
 
36
37
  // To check global app runtime node modules.
37
38
  if (!isNPMPackageExist(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg)) {
@@ -44,10 +45,16 @@ const downloadNPMPackage = (packageInfo) => {
44
45
  }
45
46
 
46
47
  executeSyncCmd('cd ' + PATH_NPM_PACKAGE + ' && ' + npmInstallCMD, (errMsg) => {
48
+ isError = true;
47
49
  console.log(packageInfo.infoMsg + ' Something wrong with npm installation ', errMsg);
48
50
  }, packageInfo.infoMsg);
49
51
 
50
- fs.writeFileSync(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg);
52
+ //only create a .SUCCESS file when there is no error
53
+ if(!isError) {
54
+ isError = false;
55
+ fs.writeFileSync(PATH_NPM_PACKAGE_SUCCESS, packageInfo.successMsg);
56
+ }
57
+
51
58
  } else {
52
59
  console.log(packageInfo.infoMsg + ' Node packages already installed!');
53
60
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/angular-codegen",
3
- "version": "11.6.0-next.139412",
3
+ "version": "11.6.0-next.141923",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1 +1 @@
1
- global.$=require("jquery"),global._=require("lodash"),global._WM_APP_PROPERTIES={};const cheerio=require("cheerio"),{generatePageExpressions:generatePageExpressions}=require("./expr-parser-utils"),{readFile:readFile,isMobileProject:isMobileProject}=require("./wm-utils"),nodePolyfill=require("node-window-polyfill").register(!1),getRequiredScripts=e=>{const r={wmCalendar:["./node_modules/fullcalendar/main.min.js"],wmChart:["./node_modules/d3/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js"],wmChips:["./node_modules/jquery-ui/ui/widgets/sortable.js"],wmList:["./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/sortable.js"],wmRichtexteditor:["./node_modules/summernote/dist/summernote-lite.min.js"],wmTable:[global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/resizable.js"]};let t=[];return _.each(r,(r,i)=>{e("["+i+"]").length>0&&(t=t.concat(r))}),t=t.map(e=>e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"")),_.uniq(t)},includesCustomElement=e=>{return cheerio.load(e)('[html-custom-element="true"]').length},getPageContents=async(e,r,t,i,s,o,l)=>{try{const a=`${r}/${t}`,n=await readFile(`${a}.html`,"utf8");let u,d,m,p="{}";"LAYOUT"!==s&&(u=await readFile(`${a}.js`,"utf8"),d=await readFile(`${a}.css`,"utf8"),p=await readFile(`${a}.variables.json`,"utf8")),global._WM_APP_PROPERTIES=e,window=window||{},window._WM_APP_PROPERTIES=e;const c=(m=isMobileProject(e)?require("../dependencies/transpilation-mobile.cjs"):require("../dependencies/transpilation-web.cjs")).transpile(n),g=cheerio.load(c.markup),w=getRequiredScripts(g);return w.length>0&&(c.markup=c.markup.replace(">",` scripts-to-load="${w.join(",")}">`)),{markup:c.markup,script:u,styles:m.scopeComponentStyles(i,s,d),variables:p,expressions:l?generatePageExpressions(c.markup,p,o):"",requiredWMComponents:c.requiredWMComponents.filter(r=>!r.platformType||r.platformType===e.platformType),hasCustomElement:includesCustomElement(n)}}catch(e){throw console.error(`error occurred in transpilation of ${t}`,e),e}};module.exports={getPageContents:getPageContents};
1
+ global.$=require("jquery"),global._=require("lodash"),global._WM_APP_PROPERTIES={};const cheerio=require("cheerio"),{generatePageExpressions:generatePageExpressions}=require("./expr-parser-utils"),{readFile:readFile,isMobileProject:isMobileProject}=require("./wm-utils"),nodePolyfill=require("node-window-polyfill").register(!1),getRequiredScripts=e=>{const r={wmCalendar:["./node_modules/fullcalendar/main.min.js"],wmChart:["./node_modules/d3/dist/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js"],wmChips:["./node_modules/jquery-ui/ui/widgets/sortable.js"],wmList:["./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/sortable.js"],wmRichtexteditor:["./node_modules/summernote/dist/summernote-lite.min.js"],wmTable:[global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/resizable.js"]};let t=[];return _.each(r,(r,i)=>{e("["+i+"]").length>0&&(t=t.concat(r))}),t=t.map(e=>e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"")),_.uniq(t)},includesCustomElement=e=>{return cheerio.load(e)('[html-custom-element="true"]').length},getPageContents=async(e,r,t,i,s,o,l)=>{try{const a=`${r}/${t}`,n=await readFile(`${a}.html`,"utf8");let u,d,m,p="{}";"LAYOUT"!==s&&(u=await readFile(`${a}.js`,"utf8"),d=await readFile(`${a}.css`,"utf8"),p=await readFile(`${a}.variables.json`,"utf8")),global._WM_APP_PROPERTIES=e,window=window||{},window._WM_APP_PROPERTIES=e;const c=(m=isMobileProject(e)?require("../dependencies/transpilation-mobile.cjs"):require("../dependencies/transpilation-web.cjs")).transpile(n),g=cheerio.load(c.markup),w=getRequiredScripts(g);return w.length>0&&(c.markup=c.markup.replace(">",` scripts-to-load="${w.join(",")}">`)),{markup:c.markup,script:u,styles:m.scopeComponentStyles(i,s,d),variables:p,expressions:l?generatePageExpressions(c.markup,p,o):"",requiredWMComponents:c.requiredWMComponents.filter(r=>!r.platformType||r.platformType===e.platformType),hasCustomElement:includesCustomElement(n)}}catch(e){throw console.error(`error occurred in transpilation of ${t}`,e),e}};module.exports={getPageContents:getPageContents};
@@ -1 +1 @@
1
- const cheerio=require("cheerio"),{writeFile:writeFile,readFileSync:readFileSync,readDir:readDir,isMobileProject:isMobileProject}=require("./wm-utils"),markScriptsAsLazy=e=>{const s=["./node_modules/d3/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js","./node_modules/fullcalendar/main.min.js","./node_modules/summernote/dist/summernote-lite.min.js",global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/sortable.js","./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/resizable.js","./node_modules/hammerjs/hammer.min.js","./node_modules/iscroll/build/iscroll.js"];let t=e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"");return t=t.substring(0,t.lastIndexOf(".")),t+="-NOHASH",s.includes(e)?{input:e,inject:!1,bundleName:t}:e},setBuildCustomizations=async e=>{const s=e.projects["angular-app"].architect.build,t=s.options.scripts;s.options.scripts=t.map(e=>markScriptsAsLazy(e))},addToScripts=async(e,s,t=[],i=[])=>{const n=`${s}/angular.json`;let o=readFileSync(n,!0);const a=o.projects["angular-app"].architect.build;let r=a.options.scripts;const l=`${s+"/src/app/extensions"}`,c=await readDir(l);c.length&&i.push("./src/app/extensions/"+c[0]),a.options.scripts=[...t,...r,...i],await writeFile(n,JSON.stringify(o,null,4))},updateAngularJSON=async(e,s,t,i,n,o,a,r,l,c)=>{const d=`${s}/angular.json`;let u=readFileSync(d,!0);const p=u.projects["angular-app"].architect.build;a&&a.trim().length>0&&(p.options.deployUrl=a);const m=p.options.styles;if(isMobileProject(t)){const e=m.findIndex(e=>{let s="object"==typeof e;if(s){return(s?e.input:e).includes("themes")}return!1}),s=m[e].input;m[e].bundleName="wm-android-styles",m[e].input=m[e].input.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/android/style.css`);const t=Object.assign({},m[e]);t.input=s.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/ios/style.css`),t.bundleName="wm-ios-styles",m.push(t);const n=m.findIndex(e=>{let s="object"==typeof e;if(s){return"src/assets/app.css"===(s?e.input:e)}return!1});m[n].bundleName="wm-android-styles";const o=Object.assign({},m[n]);o.bundleName="wm-ios-styles",m.push(o)}m.forEach((e,s)=>{let t="object"==typeof e,n=t?e.input:e;!n.includes("themes")||n.includes("/android/")||n.includes("/ios/")||(t?m[s].input=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`):m[s]=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`))}),await setBuildCustomizations(u);const g=p.configurations.production;if(g.aot=!1!==r.aot,g.buildOptimizer=!1!==r.buildOptimizer,c){const e=p.options.assets;e.push("src/manifest.json"),e.push("src/wmsw-worker.js"),g.serviceWorker=!0,g.ngswConfigPath="ngsw-config.json",delete p.options.customWebpackConfig}await writeFile(d,JSON.stringify(u,null,4))};module.exports={updateAngularJSON:updateAngularJSON,addToScripts:addToScripts};
1
+ const cheerio=require("cheerio"),{writeFile:writeFile,readFileSync:readFileSync,readDir:readDir,isMobileProject:isMobileProject}=require("./wm-utils"),markScriptsAsLazy=e=>{const s=["./node_modules/d3/dist/d3.min.js","./node_modules/@wavemaker/nvd3/build/nv.d3.min.js","./node_modules/fullcalendar/main.min.js","./node_modules/summernote/dist/summernote-lite.min.js",global._WM_PACKAGE_PATH+"/scripts/datatable/datatable.js","./node_modules/jquery-ui/ui/widgets/sortable.js","./node_modules/jquery-ui/ui/widgets/droppable.js","./node_modules/jquery-ui/ui/widgets/resizable.js","./node_modules/hammerjs/hammer.min.js","./node_modules/iscroll/build/iscroll.js"];let t=e.replace(/^(\.\/)/,"").replace(/\//g,"-").replace(/@/g,"");return t=t.substring(0,t.lastIndexOf(".")),t+="-NOHASH",s.includes(e)?{input:e,inject:!1,bundleName:t}:e},setBuildCustomizations=async e=>{const s=e.projects["angular-app"].architect.build,t=s.options.scripts;s.options.scripts=t.map(e=>markScriptsAsLazy(e))},addToScripts=async(e,s,t=[],i=[])=>{const n=`${s}/angular.json`;let o=readFileSync(n,!0);const a=o.projects["angular-app"].architect.build;let r=a.options.scripts;const l=`${s+"/src/app/extensions"}`,c=await readDir(l);c.length&&i.push("./src/app/extensions/"+c[0]),a.options.scripts=[...t,...r,...i],await writeFile(n,JSON.stringify(o,null,4))},updateAngularJSON=async(e,s,t,i,n,o,a,r,l,c)=>{const d=`${s}/angular.json`;let u=readFileSync(d,!0);const p=u.projects["angular-app"].architect.build;a&&a.trim().length>0&&(p.options.deployUrl=a);const m=p.options.styles;if(isMobileProject(t)){const e=m.findIndex(e=>{let s="object"==typeof e;if(s){return(s?e.input:e).includes("themes")}return!1}),s=m[e].input;m[e].bundleName="wm-android-styles",m[e].input=m[e].input.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/android/style.css`);const t=Object.assign({},m[e]);t.input=s.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/ios/style.css`),t.bundleName="wm-ios-styles",m.push(t);const n=m.findIndex(e=>{let s="object"==typeof e;if(s){return"src/assets/app.css"===(s?e.input:e)}return!1});m[n].bundleName="wm-android-styles";const o=Object.assign({},m[n]);o.bundleName="wm-ios-styles",m.push(o)}m.forEach((e,s)=>{let t="object"==typeof e,n=t?e.input:e;!n.includes("themes")||n.includes("/android/")||n.includes("/ios/")||(t?m[s].input=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`):m[s]=n.replace(new RegExp("/[a-z]*/style.css$"),`/${i.activeTheme}/style.css`))}),await setBuildCustomizations(u);const g=p.configurations.production;if(g.aot=!1!==r.aot,g.buildOptimizer=!1!==r.buildOptimizer,c){const e=p.options.assets;e.push("src/manifest.json"),e.push("src/wmsw-worker.js"),g.serviceWorker=!0,g.ngswConfigPath="ngsw-config.json",delete p.options.customWebpackConfig}await writeFile(d,JSON.stringify(u,null,4))};module.exports={updateAngularJSON:updateAngularJSON,addToScripts:addToScripts};