@wavemaker/angular-codegen 11.7.0-rc.5528 → 11.7.5-rc.5532

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
  /**
@@ -67841,11 +67841,21 @@ var iframe_build$1 = /*#__PURE__*/Object.freeze({
67841
67841
  default: iframe_build
67842
67842
  });
67843
67843
 
67844
- const tagName$1v = 'label';
67844
+ let tagName$1v = 'p';
67845
67845
  const idGen$p = new IDGenerator('wm_label');
67846
67846
  register('wm-label', () => {
67847
67847
  return {
67848
67848
  pre: (attrs) => {
67849
+ if (!attrs.get("notag")) {
67850
+ if (!attrs.get('type')) {
67851
+ const classList = attrs.get('class') ? attrs.get('class').split(' ').filter(element => ["h1", "h2", "h3", "h4", "h5", "h6", "p"].includes(element)) : [];
67852
+ attrs.set('type', classList.length ? classList[0] : "p");
67853
+ }
67854
+ tagName$1v = attrs.get('type');
67855
+ }
67856
+ else {
67857
+ tagName$1v = 'label';
67858
+ }
67849
67859
  const counter = idGen$p.nextUid();
67850
67860
  return `<${tagName$1v} wmLabel #${counter}="wmLabel" [attr.aria-label]="${counter}.hint" ${getAttrMarkup(attrs)}>`;
67851
67861
  },
@@ -67841,11 +67841,21 @@ var iframe_build$1 = /*#__PURE__*/Object.freeze({
67841
67841
  default: iframe_build
67842
67842
  });
67843
67843
 
67844
- const tagName$1v = 'label';
67844
+ let tagName$1v = 'p';
67845
67845
  const idGen$p = new IDGenerator('wm_label');
67846
67846
  register('wm-label', () => {
67847
67847
  return {
67848
67848
  pre: (attrs) => {
67849
+ if (!attrs.get("notag")) {
67850
+ if (!attrs.get('type')) {
67851
+ const classList = attrs.get('class') ? attrs.get('class').split(' ').filter(element => ["h1", "h2", "h3", "h4", "h5", "h6", "p"].includes(element)) : [];
67852
+ attrs.set('type', classList.length ? classList[0] : "p");
67853
+ }
67854
+ tagName$1v = attrs.get('type');
67855
+ }
67856
+ else {
67857
+ tagName$1v = 'label';
67858
+ }
67849
67859
  const counter = idGen$p.nextUid();
67850
67860
  return `<${tagName$1v} wmLabel #${counter}="wmLabel" [attr.aria-label]="${counter}.hint" ${getAttrMarkup(attrs)}>`;
67851
67861
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/angular-codegen",
3
- "version": "11.7.0-rc.5528",
3
+ "version": "11.7.5-rc.5532",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {