@wavemaker/angular-codegen 11.7.0-rc.5592 → 11.7.1-next.141118
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.
- angular-codegen/angular-app/build-scripts/build.js +9 -4
- angular-codegen/angular-app/package-lock.json +5928 -4676
- angular-codegen/angular-app/package.json +25 -25
- angular-codegen/angular-app/src/app/lazy-load-scripts.resolve.ts +2 -4
- angular-codegen/angular-app/src/assets/styles/css/wm-style.css +1 -1
- angular-codegen/angular-app/wm-custom-webpack.config.js +60 -0
- angular-codegen/build-angular-app.js +13 -5
- angular-codegen/dependencies/expression-parser.cjs.js +2511 -592
- angular-codegen/dependencies/pipe-provider.cjs.js +30481 -17343
- angular-codegen/dependencies/transpilation-mobile.cjs.js +17407 -10686
- angular-codegen/dependencies/transpilation-web.cjs.js +17407 -10686
- angular-codegen/package-lock.json +3 -4367
- angular-codegen/package.json +1 -1
- angular-codegen/src/handlebar-helpers.js +1 -1
- angular-codegen/templates/app-prefabs.module.ts.hbs +0 -1
- angular-codegen/templates/app-routes.ts.hbs +6 -5
- angular-codegen/templates/layout/layout.module.ts.hbs +1 -1
- angular-codegen/templates/page/page.module.ts.hbs +2 -2
- angular-codegen/templates/partial/partial.module.ts.hbs +0 -1
- angular-codegen/templates/prefab/prefab.module.ts.hbs +0 -1
|
@@ -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]",
|
|
@@ -20,13 +20,21 @@ const { executeSyncCmd, MSG_NG_RUNTIME_LOG, MSG_NG_RUNTIME_SUCCESS } = require(
|
|
|
20
20
|
/**
|
|
21
21
|
* @TODO: This is a temporary workaround to extract deploy-url from 'ngBuildParams', need to be replaced in future.
|
|
22
22
|
*/
|
|
23
|
-
const updateDeployUrl = (
|
|
24
|
-
let buildArgs = ngBuildParams.split(' ');
|
|
23
|
+
const updateDeployUrl = (args) => {
|
|
24
|
+
let buildArgs = args.ngBuildParams.split(' ');
|
|
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);
|
|
37
|
+
return buildArgs.join(" ");
|
|
30
38
|
};
|
|
31
39
|
|
|
32
40
|
/**
|
|
@@ -59,10 +67,10 @@ const buildAngularApp = (args) => {
|
|
|
59
67
|
process.exit(err.code || err.pid);
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
let ngBuildParams = updateDeployUrl(args
|
|
70
|
+
let ngBuildParams = updateDeployUrl(args);
|
|
63
71
|
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
72
|
// Generating the angular build and post build process.
|
|
65
|
-
executeSyncCmd('cd ' + args.appTarget + ' && node
|
|
73
|
+
executeSyncCmd('cd ' + args.appTarget + ' && node ./build-scripts/build.js ' + ngBuildParams, null, MSG_NG_RUNTIME_LOG, false, NG_BUILD_MSG);
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
|