@zohodesk/client_build_tool 0.0.2 → 0.0.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
@@ -1,5 +1,15 @@
1
1
  # Changelog and Release Notes
2
2
 
3
+ ## v0.0.2 (28-04-2023)
4
+
5
+ **Changes:--**
6
+ - `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
7
+ - unwanted files deleted from build
8
+
9
+ **Issue Fix:--**
10
+ - The issue with the source map not being created in the build has been fixed."
11
+
12
+
3
13
  ## v0.0.2 (28-04-2023)
4
14
 
5
15
  **Features:-**
@@ -18,6 +28,7 @@
18
28
  - `manifestJson` default value set as false.
19
29
  - `customAttributes` support for add attributes to html, link , script tag in the output build.
20
30
 
31
+
21
32
  ## v0.0.1 (18-04-2023)
22
33
 
23
34
  First Release
package/README.md CHANGED
@@ -84,6 +84,16 @@ 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.2 (28-04-2023)
88
+
89
+ **Changes:--**
90
+ - `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
91
+ - unwanted files deleted from build
92
+
93
+ **Issue Fix:--**
94
+ - The issue with the source map not being created in the build has been fixed."
95
+
96
+
87
97
  ## v0.0.2 (28-04-2023)
88
98
 
89
99
  **Features:-**
@@ -102,6 +112,7 @@ For more [Details](ConfigurationDocumentation.md)
102
112
  - `manifestJson` default value set as false.
103
113
  - `customAttributes` support for add attributes to html, link , script tag in the output build.
104
114
 
115
+
105
116
  ## v0.0.1 (18-04-2023)
106
117
 
107
118
  First Release
@@ -13,7 +13,7 @@ var _default = {
13
13
  value: 'app',
14
14
  cli: 'context'
15
15
  },
16
- devtool: 'hidden-cheap-source-map',
16
+ devtool: 'source-map',
17
17
  statsLogConfig: null,
18
18
  enableFileNameHashing: {
19
19
  value: false,
@@ -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 = 'qwertyuiopasdfghjkl';
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('[local]')) {
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('InitialHtmlPlugin', compilation => {
34
- _htmlWebpackPlugin.default.getHooks(compilation).alterAssetTagGroups.tapAsync('MyPlugin', (data, cb) => {
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('MyWebpackPlugin', compilation => {
23
+ compiler.hooks.thisCompilation.tap(pluginName, compilation => {
22
24
  compilation.hooks.processAssets.tap({
23
- name: 'MyPlugin',
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('splitSourceMap', compilation => {
18
+ compiler.hooks.thisCompilation.tap(pluginName, compilation => {
17
19
  compilation.hooks.processAssets.tap({
18
- name: 'splitSourceMap',
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)
@@ -27,7 +27,7 @@ var _configWebWorkerLoader = require("./loaderConfigs/configWebWorkerLoader");
27
27
 
28
28
  var _statsConfig = require("./statsConfig");
29
29
 
30
- var _getSourceMapType = require("./getSourceMapType");
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, _getSourceMapType.devtoolConfig)(options),
43
+ devtool: (0, _devtoolConfig.devtoolConfig)(options),
44
44
  stats: (0, _statsConfig.statsConfig)(options),
45
45
  optimization: (0, _optimizationConfig.optimizationConfig)(options),
46
46
  module: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.errorHander = errorHander;
7
-
8
- function errorHander(e) {
9
- console.error(e);
10
- }
@@ -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,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.errorHander = errorHander;
7
-
8
- function errorHander(e) {
9
- console.error(e);
10
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.postProcessor = postProcessor;
7
-
8
- function postProcessor(options) {
9
- console.log('postProcessor');
10
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.errorHander = errorHander;
7
-
8
- function errorHander(e) {
9
- console.error(e);
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
- }