@wavemaker/angular-codegen 11.7.0-next.26332 → 11.7.0-next.26334

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.
@@ -4,11 +4,11 @@ const path = require('path');
4
4
  let processArgs = process.argv;
5
5
  if (processArgs.findIndex(arg => arg.startsWith('--max-old-space-size')) !== -1) {
6
6
  process.env.NODE_OPTIONS = processArgs.pop();
7
+ console.log("Setting node options: ", process.env.NODE_OPTIONS);
7
8
  }
8
9
  const args = processArgs.slice(2);
9
10
  const ngBuildArgs = ['build', ...args];
10
- console.log("Build params - ", ngBuildArgs);
11
- console.log("Setting node options - ", process.env.NODE_OPTIONS);
11
+ console.log("\x1b[33m", "Angular build params: ", ngBuildArgs);
12
12
 
13
13
  //Trigger angular build with the passed params
14
14
  const ngPath = path.resolve(process.cwd(), 'node_modules', '.bin', "ng");
@@ -36,7 +36,7 @@
36
36
  "@metrichor/jmespath": "^0.3.1",
37
37
  "@wavemaker/focus-trap": "^1.0.0",
38
38
  "@wavemaker/nvd3": "1.8.11",
39
- "@wavemaker/variables": "11.7.0-next.26332",
39
+ "@wavemaker/variables": "11.7.0-next.26334",
40
40
  "@ztree/ztree_v3": "^3.5.48",
41
41
  "angular-imask": "7.4.0",
42
42
  "angular2-websocket": "0.9.7",
@@ -5689,9 +5689,9 @@
5689
5689
  }
5690
5690
  },
5691
5691
  "node_modules/@wavemaker/variables": {
5692
- "version": "11.7.0-next.26332",
5693
- "resolved": "https://registry.npmjs.org/@wavemaker/variables/-/variables-11.7.0-next.26332.tgz",
5694
- "integrity": "sha512-StScnQNm74StPKdDn3k5g4xlG4C6CQgDfYsVr9o1GGwHLFkXFkDbARr9LulejDz2a/4vpwg7J8zjaueFbuYnpg==",
5692
+ "version": "11.7.0-next.26334",
5693
+ "resolved": "https://registry.npmjs.org/@wavemaker/variables/-/variables-11.7.0-next.26334.tgz",
5694
+ "integrity": "sha512-/1QZlsA731sxdSFYJaY7qHan8pG2i2YuVjsT6G/+W8GJkWqKRdxlNTGETr4haHqK7dcfsviq23InC/uRN4xbZw==",
5695
5695
  "dependencies": {
5696
5696
  "@metrichor/jmespath": "^0.3.1",
5697
5697
  "he": "^1.2.0",
@@ -47,7 +47,7 @@
47
47
  "@metrichor/jmespath": "^0.3.1",
48
48
  "@wavemaker/focus-trap": "^1.0.0",
49
49
  "@wavemaker/nvd3": "1.8.11",
50
- "@wavemaker/variables": "11.7.0-next.26332",
50
+ "@wavemaker/variables": "11.7.0-next.26334",
51
51
  "@ztree/ztree_v3": "^3.5.48",
52
52
  "angular-imask": "7.4.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.13.3",
75
- "@wavemaker/app-ng-runtime": "11.7.0-next.26332"
75
+ "@wavemaker/app-ng-runtime": "11.7.0-next.26334"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@ampproject/rollup-plugin-closure-compiler": "^0.27.0",
@@ -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]",
@@ -25,9 +25,16 @@ const updateDeployUrl = (args) => {
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
36
  buildArgs.push(args.nodeVMArgs);
30
- return ngBuildParams = buildArgs.join(" ");
37
+ return buildArgs.join(" ");
31
38
  };
32
39
 
33
40
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/angular-codegen",
3
- "version": "11.7.0-next.26332",
3
+ "version": "11.7.0-next.26334",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {