@wavemaker/angular-codegen 12.0.0-next.25480 → 12.0.0-next.28533

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/angular-codegen",
3
- "version": "12.0.0-next.25480",
3
+ "version": "12.0.0-next.28533",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  ".npmrc"
16
16
  ],
17
17
  "dependencies": {
18
- "@wavemaker/angular-app": "12.0.0-next.25480",
18
+ "@wavemaker/angular-app": "12.0.0-next.28533",
19
19
  "archiver": "^7.0.1",
20
20
  "cheerio": "1.0.0-rc.12",
21
21
  "decode-uri-component": "^0.2.0",
@@ -1 +1 @@
1
- const{deleteResource:deleteResource,createDir:createDir,writeFile:writeFile,readFile:readFile,getPagesDirPath:getPagesDirPath,getLayoutsDirPath:getLayoutsDirPath}=require("./wm-utils"),{getPagesConfig:getPagesConfig}=require("./project-meta"),util=require("util"),cheerio=require("cheerio"),{safeString:safeString}=require("./handlebar-helpers"),{formatMarkup:formatMarkup}=require("./wm-utils"),path=require("path"),ncp=util.promisify(require("ncp").ncp),createIntermediateAppSkeleton=async(e,t)=>{await deleteResource(t),await createDir(t,{recursive:!0}),await ncp(e,t,{filter:t=>!path.relative(e,t).startsWith("target")}),await createDir(`${t}/target/ui-resources`,{recursive:!0}),console.log("copying ui-resources into destination"),await ncp(`${e}/target/ui-resources`,`${t}/target/ui-resources`)},generateLayoutsAndPages=async e=>{const t=getLayoutsDirPath(e);await createDir(t,{recursive:!0});const a=await getPagesConfig(e),r=getPagesDirPath(e),n=[],i=[];for(let e of a)if("PAGE"===e.type){const a=await readFile(`${r}/${e.name}/${e.name}.html`,"utf8"),o=cheerio.load(a),s=o("wm-page"),l=o("wm-page-content");["wm-alertdialog","wm-confirmdialog","wm-dialog","wm-iframedialog","wm-pagedialog","wm-logindialog"].forEach(e=>{const t=o(e);t.length&&l.append(t)});const u=await getLayoutMarkup(o,s,l,n);u.markup&&(n.push({name:u.name,layoutInfo:u.layoutInfo}),i.push({name:u.name,type:"LAYOUT"}),await createDir(`${t}/${u.name}`,{recursive:!0}),await writeFile(`${t}/${u.name}/${u.name}.html`,u.markup)),e.layout=u.name,l.attr("spa","true"),l.attr("columnwidth","12"),l.attr(s.attr()),l.attr("layout",u.name);const c=formatMarkup(safeString(l.toString()).string);await writeFile(`${r}/${e.name}/${e.name}.html`,c)}await writeFile(`${r}/pages-config.json`,JSON.stringify(a,null,4)),await writeFile(`${t}/layouts-config.json`,JSON.stringify(i,null,4))},getLayoutMarkup=async(e,t,a,r)=>{const n=getLayoutInfo(e);let i=getLayoutName(n,r);if(i)return{name:i};{const o=r.length+1;i=`layout_${o}`,n.leftNav&&e("wm-left-panel").attr("spa","true");const s=e("<wm-router-outlet>");s.attr("columnwidth",a.attr().columnwidth),e("wm-page-content").replaceWith(s);const l=e("<wm-layout>");return l.attr("name",`layout${o}`),l.append(t.children()),{name:i,markup:formatMarkup(safeString(l.toString()).string),layoutInfo:n}}},getLayoutInfo=e=>{const t={header:e("wm-header"),topNav:e("wm-top-nav"),leftNav:e("wm-left-panel"),rightNav:e("wm-right-panel"),footer:e("wm-footer")},a={};for(const e in t)if(t.hasOwnProperty(e)&&t[e].length){const r=t[e].attr().content,n=r&&r.startsWith("bind:"),i=t[e].children().length;a[e]={content:r,hasBindExpr:n,hasChildren:i}}return a},getLayoutName=(e,t)=>{for(const a of t)if(Object.keys(a.layoutInfo).sort().join(",")===Object.keys(e).sort().join(",")){if(Object.keys(e).every(t=>e[t].content===a.layoutInfo[t].content&&!(e[t].hasBindExpr||a.layoutInfo[t].hasBindExpr||e[t].hasChildren||a.layoutInfo[t].hasChildren)))return a.name}};module.exports={createIntermediateAppSkeleton:createIntermediateAppSkeleton,generateLayoutsAndPages:generateLayoutsAndPages};
1
+ const{deleteResource:deleteResource,createDir:createDir,writeFile:writeFile,readFile:readFile,getPagesDirPath:getPagesDirPath,getLayoutsDirPath:getLayoutsDirPath}=require("./wm-utils"),{getPagesConfig:getPagesConfig}=require("./project-meta"),util=require("util"),cheerio=require("cheerio"),{safeString:safeString}=require("./handlebar-helpers"),{formatMarkup:formatMarkup}=require("./wm-utils"),path=require("path"),ncp=util.promisify(require("ncp").ncp),createIntermediateAppSkeleton=async(e,t)=>{await deleteResource(t),await createDir(t,{recursive:!0}),await ncp(e,t,{filter:t=>!path.relative(e,t).startsWith("target")}),await createDir(`${t}/target/ui-resources`,{recursive:!0}),console.log("copying ui-resources into destination"),await ncp(`${e}/target/ui-resources`,`${t}/target/ui-resources`)},generateLayoutsAndPages=async e=>{const t=getLayoutsDirPath(e);await createDir(t,{recursive:!0});const a=await getPagesConfig(e),r=getPagesDirPath(e),i=[],n=[];for(let e of a)if("PAGE"===e.type){const a=await readFile(`${r}/${e.name}/${e.name}.html`,"utf8"),o=cheerio.load(a),s=o("wm-page"),u=o("wm-page-content");["wm-alertdialog","wm-confirmdialog","wm-dialog","wm-iframedialog","wm-pagedialog","wm-logindialog"].forEach(e=>{const t=o(e);t.length&&u.append(t)});const l=await getLayoutMarkup(o,s,u,i);l.markup&&(i.push({name:l.name,layoutInfo:l.layoutInfo}),n.push({name:l.name,type:"LAYOUT"}),await createDir(`${t}/${l.name}`,{recursive:!0}),await writeFile(`${t}/${l.name}/${l.name}.html`,l.markup)),e.layout=l.name,u.attr("spa","true"),u.attr("columnwidth","12"),u.attr(s.attr()),u.attr("layout",l.name);const c=formatMarkup(safeString(u.toString()).string);await writeFile(`${r}/${e.name}/${e.name}.html`,c)}await writeFile(`${r}/pages-config.json`,JSON.stringify(a,null,4)),await writeFile(`${t}/layouts-config.json`,JSON.stringify(n,null,4))},getLayoutMarkup=async(e,t,a,r)=>{const i=getLayoutInfo(e);let n=getLayoutName(i,r);if(n)return{name:n};{const o=r.length+1;n=`layout_${o}`,i.leftNav&&e("wm-left-panel").attr("spa","true");const s=e("<wm-router-outlet>");s.attr("columnwidth",a.attr().columnwidth),e("wm-page-content").replaceWith(s);const u=e("<wm-layout>");return u.attr("name",`layout${o}`),u.append(t.children()),{name:n,markup:formatMarkup(safeString(u.toString()).string),layoutInfo:i}}},getLayoutInfo=e=>{const t={header:e("wm-header"),topNav:e("wm-top-nav"),leftNav:e("wm-left-panel"),rightNav:e("wm-right-panel"),footer:e("wm-footer")},a={};for(const e in t){const r=t[e];if(r.length){const t=r.attr(),i={};Object.keys(t||{}).forEach(e=>{i[e]=t[e]}),a[e]={attributes:i,hasBindExpr:Object.values(i).some(e=>"string"==typeof e&&e.startsWith("bind:")),hasChildren:r.children().length}}}return a},getLayoutName=(e,t)=>{for(const a of t){if(Object.keys(a.layoutInfo).sort().join(",")===Object.keys(e).sort().join(",")&&Object.keys(e).every(t=>{const r=e[t],i=a.layoutInfo[t];if(r.hasBindExpr||i.hasBindExpr||r.hasChildren||i.hasChildren)return!1;const n=r.attributes||{},o=i.attributes||{};return Object.keys(n).length===Object.keys(o).length&&Object.keys(n).every(e=>n[e]===o[e])}))return a.name}return null};module.exports={createIntermediateAppSkeleton:createIntermediateAppSkeleton,generateLayoutsAndPages:generateLayoutsAndPages};
@@ -1,11 +0,0 @@
1
-
2
- // this file will be generated from the wavemaker application sources
3
-
4
- import { NgModule } from '@angular/core';
5
-
6
- @NgModule({})
7
- export class AppCodeGenModule {
8
-
9
- }
10
-
11
- export const xsrfHeaderName = 'X-WM-XSRF-TOKEN';
@@ -1,36 +0,0 @@
1
- const win = window as any;
2
-
3
- win.Application = win.angular = {};
4
-
5
- const deprecatedAngularJSFeature = (feature) => {
6
- return () => {
7
- console.warn(`DEPRECATED AngularJS 1.x feature: ${feature}`);
8
- return win.angular;
9
- };
10
- };
11
-
12
- [
13
- 'module',
14
- 'controller',
15
- 'directive',
16
- 'run',
17
- 'config',
18
- 'service',
19
- 'factory',
20
- 'constant',
21
- 'value',
22
- 'animation',
23
- 'component',
24
- 'decorator',
25
- 'filter',
26
- 'info',
27
- 'provider',
28
- 'requires',
29
- '$watch'
30
- ].forEach(feature => {
31
- win.angular[feature] = deprecatedAngularJSFeature(feature);
32
- });
33
-
34
-
35
-
36
- export const patchAngular1Deprecations = () => {};