@zohodesk/client_build_tool 0.0.2 → 0.0.5
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 +17 -0
- package/README.md +17 -0
- package/lib/schemas/defaultConfigValues.js +1 -1
- package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js +22 -2
- package/lib/shared/bundler/webpack/custom_plugins/InitialHtmlPlugin.js +4 -2
- package/lib/shared/bundler/webpack/custom_plugins/ManifestJsonPlugin/index.js +4 -2
- package/lib/shared/bundler/webpack/custom_plugins/SourceMapPlugin/index.js +4 -2
- package/lib/shared/bundler/webpack/outputConfig.js +3 -1
- package/lib/shared/bundler/webpack/resolvers.js +1 -1
- package/lib/shared/bundler/webpack/webpackConfig.js +2 -2
- package/lib/shared/constants.js +4 -1
- package/package.json +1 -1
- package/lib/commands/build/errorHander.js +0 -10
- package/lib/commands/start/deprecationHandler.js +0 -10
- package/lib/commands/start/errorHander.js +0 -10
- package/lib/commands/start/postProcessor.js +0 -10
- package/lib/commands/version/errorHander.js +0 -10
- package/lib/shared/bundler/webpack/pluginConfigs/dummy.js +0 -23
- /package/lib/shared/bundler/webpack/{getSourceMapType.js → devtoolConfig.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog and Release Notes
|
|
2
2
|
|
|
3
|
+
## v0.0.5 (6-08-2023)
|
|
4
|
+
|
|
5
|
+
**Changes:--**
|
|
6
|
+
- Typo fix in i18nRuntimeDealerPlugin.js
|
|
7
|
+
- fixing some bugs in resolvers.js file
|
|
8
|
+
|
|
9
|
+
## v0.0.3 (1-08-2023)
|
|
10
|
+
|
|
11
|
+
**Changes:--**
|
|
12
|
+
- `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
|
|
13
|
+
- unwanted files deleted from build
|
|
14
|
+
|
|
15
|
+
**Issue Fix:--**
|
|
16
|
+
- The issue with the source map not being created in the build has been fixed."
|
|
17
|
+
|
|
18
|
+
|
|
3
19
|
## v0.0.2 (28-04-2023)
|
|
4
20
|
|
|
5
21
|
**Features:-**
|
|
@@ -18,6 +34,7 @@
|
|
|
18
34
|
- `manifestJson` default value set as false.
|
|
19
35
|
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
20
36
|
|
|
37
|
+
|
|
21
38
|
## v0.0.1 (18-04-2023)
|
|
22
39
|
|
|
23
40
|
First Release
|
package/README.md
CHANGED
|
@@ -84,6 +84,22 @@ 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 (6-08-2023)
|
|
88
|
+
|
|
89
|
+
**Changes:--**
|
|
90
|
+
- Typo fix in i18nRuntimeDealerPlugin.js
|
|
91
|
+
- fixing some bugs in resolvers.js file
|
|
92
|
+
|
|
93
|
+
## v0.0.3 (1-08-2023)
|
|
94
|
+
|
|
95
|
+
**Changes:--**
|
|
96
|
+
- `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
|
|
97
|
+
- unwanted files deleted from build
|
|
98
|
+
|
|
99
|
+
**Issue Fix:--**
|
|
100
|
+
- The issue with the source map not being created in the build has been fixed."
|
|
101
|
+
|
|
102
|
+
|
|
87
103
|
## v0.0.2 (28-04-2023)
|
|
88
104
|
|
|
89
105
|
**Features:-**
|
|
@@ -102,6 +118,7 @@ For more [Details](ConfigurationDocumentation.md)
|
|
|
102
118
|
- `manifestJson` default value set as false.
|
|
103
119
|
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
104
120
|
|
|
121
|
+
|
|
105
122
|
## v0.0.1 (18-04-2023)
|
|
106
123
|
|
|
107
124
|
First Release
|
package/lib/shared/bundler/webpack/custom_plugins/I18nSplitPlugin/I18nRuntimeDealerPlugin.js
CHANGED
|
@@ -23,6 +23,8 @@ var _I18nFilesEmitPlugin = require("./I18nFilesEmitPlugin");
|
|
|
23
23
|
|
|
24
24
|
var _LocaleChunkAssetsStore = require("./LocaleChunkAssetsStore");
|
|
25
25
|
|
|
26
|
+
var _logger = require("../../../../../logger");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
const {
|
|
@@ -63,7 +65,7 @@ class I18nRuntimeDealerPlugin {
|
|
|
63
65
|
mainChunkName
|
|
64
66
|
} = this.options; // const dummyContent = '// dummy comment';
|
|
65
67
|
|
|
66
|
-
const dummyContentHash = '
|
|
68
|
+
const dummyContentHash = 'dummy0content0hashes';
|
|
67
69
|
const entryPoint = compilation.entrypoints.get(mainChunkName);
|
|
68
70
|
const initialChunks = Array.from(entryPoint.chunks).filter(c => c.canBeInitial() && c.id !== c.runtime);
|
|
69
71
|
const initialI18nAssets = initialChunks.filter(c => i18nStore.isChunkHasI18n(c)).map(c => {
|
|
@@ -172,10 +174,28 @@ class I18nRuntimeDealerPlugin {
|
|
|
172
174
|
runtimeFileName,
|
|
173
175
|
runtimeFileSourceStr,
|
|
174
176
|
i18nChunks
|
|
175
|
-
})); // NOTE: we don't delete, Because of HTML plugin needs to add runtime file in html
|
|
177
|
+
})); // NOTE: we don't delete, Because of HTML plugin needs to add runtime file in html and efc
|
|
176
178
|
// compilation.deleteAsset(runtimeFileName);
|
|
177
179
|
}
|
|
178
180
|
});
|
|
181
|
+
compilation.hooks.processAssets.tap({
|
|
182
|
+
name: pluginName,
|
|
183
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE // additionalAssets: true
|
|
184
|
+
|
|
185
|
+
}, () => {
|
|
186
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
187
|
+
const entries = compilation._getChunkGraphEntries(); // eslint-disable-next-line no-restricted-syntax
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
for (const entryChunk of entries) {
|
|
191
|
+
const runtimeFileName = [...entryChunk.files][0] || '';
|
|
192
|
+
|
|
193
|
+
if (runtimeFileName.includes('runtime') && runtimeFileName.includes('[locale]')) {
|
|
194
|
+
(0, _logger.verboseLogger)('deleteAsset', runtimeFileName);
|
|
195
|
+
compilation.deleteAsset(runtimeFileName);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
});
|
|
179
199
|
}
|
|
180
200
|
}
|
|
181
201
|
|
|
@@ -9,6 +9,8 @@ var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
+
const pluginName = 'InitialHtmlPlugin';
|
|
13
|
+
|
|
12
14
|
class InitialHtmlPlugin {
|
|
13
15
|
constructor(options) {
|
|
14
16
|
this.options = options;
|
|
@@ -30,8 +32,8 @@ class InitialHtmlPlugin {
|
|
|
30
32
|
inject,
|
|
31
33
|
scriptLoading: 'defer'
|
|
32
34
|
}).apply(compiler);
|
|
33
|
-
compiler.hooks.thisCompilation.tap(
|
|
34
|
-
_htmlWebpackPlugin.default.getHooks(compilation).alterAssetTagGroups.tapAsync(
|
|
35
|
+
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
36
|
+
_htmlWebpackPlugin.default.getHooks(compilation).alterAssetTagGroups.tapAsync(pluginName, (data, cb) => {
|
|
35
37
|
const headTags = [];
|
|
36
38
|
const bodyTags = [];
|
|
37
39
|
data.headTags.forEach(tag => {
|
|
@@ -9,6 +9,8 @@ var _webpack = require("webpack");
|
|
|
9
9
|
|
|
10
10
|
var _createManifestJson = require("./createManifestJson");
|
|
11
11
|
|
|
12
|
+
const pluginName = 'AddFileToManifestJson';
|
|
13
|
+
|
|
12
14
|
class AddFileToManifestJson {
|
|
13
15
|
constructor(options) {
|
|
14
16
|
this.options = options;
|
|
@@ -18,9 +20,9 @@ class AddFileToManifestJson {
|
|
|
18
20
|
const {
|
|
19
21
|
RawSource
|
|
20
22
|
} = compiler.webpack.sources;
|
|
21
|
-
compiler.hooks.thisCompilation.tap(
|
|
23
|
+
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
22
24
|
compilation.hooks.processAssets.tap({
|
|
23
|
-
name:
|
|
25
|
+
name: pluginName,
|
|
24
26
|
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
25
27
|
}, assets => {
|
|
26
28
|
const {
|
|
@@ -8,14 +8,16 @@ exports.SourceMapPlugin = void 0;
|
|
|
8
8
|
var _webpack = require("webpack");
|
|
9
9
|
|
|
10
10
|
/* eslint-disable class-methods-use-this */
|
|
11
|
+
const pluginName = 'SplitSourceMapPlugin';
|
|
12
|
+
|
|
11
13
|
class SourceMapPlugin {
|
|
12
14
|
apply(compiler) {
|
|
13
15
|
const {
|
|
14
16
|
RawSource
|
|
15
17
|
} = compiler.webpack.sources;
|
|
16
|
-
compiler.hooks.thisCompilation.tap(
|
|
18
|
+
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
17
19
|
compilation.hooks.processAssets.tap({
|
|
18
|
-
name:
|
|
20
|
+
name: pluginName,
|
|
19
21
|
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
|
|
20
22
|
}, assets => {
|
|
21
23
|
Object.keys(assets).forEach(assetName => {
|
|
@@ -17,11 +17,13 @@ function outputConfig(options) {
|
|
|
17
17
|
const {
|
|
18
18
|
output,
|
|
19
19
|
publicPath,
|
|
20
|
-
htmlTemplate
|
|
20
|
+
htmlTemplate,
|
|
21
|
+
context
|
|
21
22
|
} = options;
|
|
22
23
|
const outputO = {
|
|
23
24
|
filename: (0, _nameTemplates.nameTemplates)('js', options),
|
|
24
25
|
chunkFilename: (0, _nameTemplates.nameTemplates)('chunkjs', options),
|
|
26
|
+
chunkLoadingGlobal: `${context}Jsonp`,
|
|
25
27
|
publicPath,
|
|
26
28
|
// clean: true,
|
|
27
29
|
path: _path.default.resolve(_constants.appPath, output)
|
|
@@ -77,5 +77,5 @@ function loaderResolver(options) {
|
|
|
77
77
|
|
|
78
78
|
function useAppNodeModulesAsPreferred(preferLocalFirst = false, paths = []) {
|
|
79
79
|
const filteredPaths = paths.filter(Boolean);
|
|
80
|
-
return preferLocalFirst ? ['node_modules', ...filteredPaths] : [...filteredPaths, 'node_modules'];
|
|
80
|
+
return preferLocalFirst ? ['node_modules', ...filteredPaths, _constants.appNodeModules] : [...filteredPaths, 'node_modules', _constants.appNodeModules];
|
|
81
81
|
}
|
|
@@ -27,7 +27,7 @@ var _configWebWorkerLoader = require("./loaderConfigs/configWebWorkerLoader");
|
|
|
27
27
|
|
|
28
28
|
var _statsConfig = require("./statsConfig");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _devtoolConfig = require("./devtoolConfig");
|
|
31
31
|
|
|
32
32
|
var _modeUtils = require("./common/modeUtils");
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ function webpackConfigCreator(options) {
|
|
|
40
40
|
entry: (0, _entryConfig.entryConfig)(options),
|
|
41
41
|
mode: (0, _modeUtils.getWebpackMode)(options),
|
|
42
42
|
output: (0, _outputConfig.outputConfig)(options),
|
|
43
|
-
devtool: (0,
|
|
43
|
+
devtool: (0, _devtoolConfig.devtoolConfig)(options),
|
|
44
44
|
stats: (0, _statsConfig.statsConfig)(options),
|
|
45
45
|
optimization: (0, _optimizationConfig.optimizationConfig)(options),
|
|
46
46
|
module: {
|
package/lib/shared/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.cliRootPath = exports.cliNodeModulesPath = exports.babelrcPath = exports.appPath = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
|
|
6
|
+
exports.cliRootPath = exports.cliNodeModulesPath = exports.babelrcPath = exports.appPath = exports.appNodeModules = exports.CONFIG_ROOT = exports.BASE_CONFIG_KEY = void 0;
|
|
7
7
|
exports.getTemplatePath = getTemplatePath;
|
|
8
8
|
exports.joinWithAppPath = joinWithAppPath;
|
|
9
9
|
exports.templatesPath = void 0;
|
|
@@ -36,6 +36,9 @@ function joinWithAppPath(filePath) {
|
|
|
36
36
|
return (0, _path.join)(appPath, filePath);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
;
|
|
40
|
+
const appNodeModules = joinWithAppPath('node_modules');
|
|
41
|
+
exports.appNodeModules = appNodeModules;
|
|
39
42
|
const templatesPath = (0, _path.join)(__dirname, '..', '..', 'templates');
|
|
40
43
|
exports.templatesPath = templatesPath;
|
|
41
44
|
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.deprecationHandler = deprecationHandler;
|
|
7
|
-
|
|
8
|
-
function deprecationHandler(options) {// options.app.deprecated &&
|
|
9
|
-
// console.log('options.app.deprecated this option was deprecated since V1.3.1' );
|
|
10
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dummy = dummy;
|
|
7
|
-
|
|
8
|
-
class Demo {
|
|
9
|
-
// eslint-disable-next-line class-methods-use-this
|
|
10
|
-
apply(compiler) {
|
|
11
|
-
compiler.hooks.done.tap('vbxhb', stats => {
|
|
12
|
-
const statsJson = stats.toJson({
|
|
13
|
-
all: true
|
|
14
|
-
});
|
|
15
|
-
console.log(statsJson);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function dummy() {
|
|
22
|
-
return new Demo();
|
|
23
|
-
}
|
|
File without changes
|