@zohodesk/client_build_tool 0.0.5-exp.2 → 0.0.5-exp.3
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/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -84,6 +84,10 @@ These commands provide flexibility and control over your client-side build proce
|
|
|
84
84
|
For more [Details](ConfigurationDocumentation.md)
|
|
85
85
|
# Changelog and Release Notes
|
|
86
86
|
|
|
87
|
+
## v0.0.5-exp.3 (11-09-2023)
|
|
88
|
+
|
|
89
|
+
**changes:--**
|
|
90
|
+
- changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
|
|
87
91
|
## v0.0.5 (6-08-2023)
|
|
88
92
|
|
|
89
93
|
**Changes:--**
|
package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js
CHANGED
|
@@ -145,7 +145,7 @@ class I18nRuntimeDealerPlugin {
|
|
|
145
145
|
if (chunkFilenameHasContentHash) {
|
|
146
146
|
compilation.hooks.processAssets.tap({
|
|
147
147
|
name: pluginName,
|
|
148
|
-
stage: _webpack.Compilation.
|
|
148
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVED // additionalAssets: true
|
|
149
149
|
|
|
150
150
|
}, assets => {
|
|
151
151
|
// eslint-disable-next-line no-underscore-dangle
|
|
@@ -174,32 +174,28 @@ class I18nRuntimeDealerPlugin {
|
|
|
174
174
|
runtimeFileName,
|
|
175
175
|
runtimeFileSourceStr,
|
|
176
176
|
i18nChunks
|
|
177
|
-
})); // NOTE: we don't delete, Because of HTML plugin needs to add runtime file in html and efc
|
|
177
|
+
})); // NOTE: we don't delete, Because of HTML plugin needs to add runtime file in html and efc
|
|
178
178
|
// compilation.deleteAsset(runtimeFileName);
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
compilation.hooks.processAssets.tap({
|
|
182
182
|
name: pluginName,
|
|
183
|
-
stage: _webpack.Compilation.
|
|
183
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE // additionalAssets: true
|
|
184
184
|
|
|
185
185
|
}, () => {
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
188
187
|
const entries = compilation._getChunkGraphEntries(); // eslint-disable-next-line no-restricted-syntax
|
|
189
188
|
|
|
190
189
|
|
|
191
190
|
for (const entryChunk of entries) {
|
|
192
191
|
const runtimeFileName = [...entryChunk.files][0] || '';
|
|
193
|
-
console.log(runtimeFileName, 'runtimeFile==');
|
|
194
192
|
|
|
195
193
|
if (runtimeFileName.includes('runtime') && runtimeFileName.includes('[locale]')) {
|
|
196
194
|
(0, _logger.verboseLogger)('deleteAsset', runtimeFileName);
|
|
197
|
-
console.log('deleted successuly====');
|
|
198
195
|
compilation.deleteAsset(runtimeFileName);
|
|
199
196
|
}
|
|
200
197
|
}
|
|
201
198
|
});
|
|
202
|
-
console.log('completed ====');
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
201
|
|
|
@@ -8,7 +8,20 @@ exports.SourceMapPlugin = void 0;
|
|
|
8
8
|
var _webpack = require("webpack");
|
|
9
9
|
|
|
10
10
|
/* eslint-disable class-methods-use-this */
|
|
11
|
-
|
|
11
|
+
function checkSmapFilePattern(assetName) {
|
|
12
|
+
return /\.js$/.test(assetName) && !/\.i18n\.js$/.test(assetName) || /\.js\.map$/.test(assetName) && !/\.i18n\.js\.map$/.test(assetName);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function skipRuntimeFiles(assetName) {
|
|
16
|
+
return !assetName.includes('runtime') || !assetName.includes('[locale]');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const pluginName = 'SplitSourceMapPlugin'; // Purpose:
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* we want build that can load files source map and without sourcemap at the same time,
|
|
23
|
+
* or can be mentioned as so single build need to support two different clients that one for fast load and one for debugging.
|
|
24
|
+
*/
|
|
12
25
|
|
|
13
26
|
class SourceMapPlugin {
|
|
14
27
|
apply(compiler) {
|
|
@@ -18,12 +31,12 @@ class SourceMapPlugin {
|
|
|
18
31
|
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
19
32
|
compilation.hooks.processAssets.tap({
|
|
20
33
|
name: pluginName,
|
|
21
|
-
stage: _webpack.Compilation.
|
|
34
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
22
35
|
}, assets => {
|
|
23
36
|
Object.keys(assets).forEach(assetName => {
|
|
24
37
|
const assetCode = assets[assetName].source();
|
|
25
38
|
|
|
26
|
-
if (
|
|
39
|
+
if (checkSmapFilePattern(assetName) && skipRuntimeFiles(assetName)) {
|
|
27
40
|
compilation.renameAsset(assetName, `smap/${assetName}`);
|
|
28
41
|
|
|
29
42
|
if (!/\.map$/.test(assetName)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/client_build_tool",
|
|
3
|
-
"version": "0.0.5-exp.
|
|
3
|
+
"version": "0.0.5-exp.3",
|
|
4
4
|
"description": "A CLI tool to build web applications and client libraries",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"cbt": "cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
+
"exp:publish": "npm publish --tag exp",
|
|
11
12
|
"start": "rm -r lib && npm run build -- -w",
|
|
12
13
|
"prepare": "npm run build",
|
|
13
14
|
"build": "babel src --out-dir lib --copy-files --config-file=./.babelrc",
|