@zohodesk/client_build_tool 0.0.6-exp.10 → 0.0.6-exp.11

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.
@@ -89,7 +89,7 @@ class CdnChangePlugin {
89
89
 
90
90
  compilation.hooks.runtimeRequirementInTree.for(_webpack.RuntimeGlobals.getChunkScriptFilename).tap(pluginName, (chunk, set) => {
91
91
  compilation.addRuntimeModule(chunk, // eslint-disable-next-line new-cap
92
- new _webpackCustomJsUrlLoader.default('javascript', 'javascript', _webpack.RuntimeGlobals.getChunkScriptFilename, chunk => chunk.filenameTemplate || (chunk.canBeInitial() ? compilation.outputOptions.filename : compilation.outputOptions.chunkFilename), false));
92
+ new _webpackCustomJsUrlLoader.default('javascript', 'javascript', _webpack.RuntimeGlobals.getChunkScriptFilename, chunk => chunk.filenameTemplate || (chunk.canBeInitial() ? compilation.outputOptions.filename : compilation.outputOptions.chunkFilename), false, this.variableName));
93
93
  return true;
94
94
  });
95
95
  });
@@ -14,19 +14,20 @@ const first = set => {
14
14
 
15
15
  class CustomizedGetChunkFilenameRuntimeModule extends _webpack.RuntimeModule {
16
16
  /**
17
- * @param {string} contentType the contentType to use the content hash for
17
+ * @param {string} contentType the to use the content hash for
18
18
  * @param {string} name kind of filename
19
19
  * @param {string} global function name to be assigned
20
20
  * @param {function(Chunk): string | FilenameFunction} getFilenameForChunk functor to get the filename or function
21
21
  * @param {boolean} allChunks when false, only async chunks are included
22
22
  */
23
- constructor(contentType, name, global, getFilenameForChunk, allChunks) {
23
+ constructor(contentType, name, global, getFilenameForChunk, allChunks, variableName) {
24
24
  super(`get ${name} chunk filename`);
25
25
  this.contentType = contentType;
26
26
  this.global = global;
27
27
  this.getFilenameForChunk = getFilenameForChunk;
28
28
  this.allChunks = allChunks;
29
29
  this.dependentHash = true;
30
+ this.variableName = variableName;
30
31
  }
31
32
 
32
33
  generate() {
@@ -95,7 +95,8 @@ class I18nRuntimeDealerPlugin {
95
95
  const {
96
96
  chunkFilename,
97
97
  locales,
98
- localeVarName
98
+ localeVarName,
99
+ createSeparateSMap
99
100
  } = this.options;
100
101
  const chunkFilenameHasContentHash = (0, _hashUtils.hasContentHash)(chunkFilename);
101
102
 
@@ -161,6 +162,11 @@ class I18nRuntimeDealerPlugin {
161
162
  const replaceText = chunkFilenameUrlGenerator(i18nChunks, locale);
162
163
  const replacedStr = runtimeFileSourceStr.replace(_constants.I18N_CHUNK_NAME_GENERATION_SEGMENT, replaceText);
163
164
  compilation.emitAsset(newRuntimeName, new RawSource(replacedStr));
165
+
166
+ if (createSeparateSMap) {
167
+ const updatedPath = newRuntimeName.replace('smap/', '');
168
+ compilation.emitAsset(updatedPath, new RawSource(replacedStr));
169
+ }
164
170
  } // eslint-disable-next-line no-restricted-syntax
165
171
 
166
172
 
@@ -27,6 +27,7 @@ function optionsHandler(options) {
27
27
  });
28
28
  return {
29
29
  filename: options.filename || _constants.DEFAULT_FILENAME,
30
+ createSeparateSMap: options.sourceMapOptions,
30
31
  chunkFilename: options.chunkFilename || chunkNameDecider(options.filename),
31
32
  mainChunkName: options.mainChunkName,
32
33
  templateLabel: options.templateLabel,
@@ -13,7 +13,7 @@ function checkSmapFilePattern(assetName) {
13
13
  }
14
14
 
15
15
  function skipRuntimeFiles(assetName) {
16
- return !assetName.includes('runtime') || !assetName.includes('[locale]');
16
+ return !assetName.includes('[locale]');
17
17
  }
18
18
 
19
19
  const pluginName = 'SplitSourceMapPlugin'; // Purpose:
@@ -34,6 +34,10 @@ class SourceMapPlugin {
34
34
  stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
35
35
  }, assets => {
36
36
  Object.keys(assets).forEach(assetName => {
37
+ if (assetName.includes('runtime')) {
38
+ console.log(assetName);
39
+ }
40
+
37
41
  const assetCode = assets[assetName].source();
38
42
 
39
43
  if (checkSmapFilePattern(assetName) // skipRuntimeFiles(assetName)
@@ -15,7 +15,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
 
16
16
  function configI18nSplitPlugin(options) {
17
17
  const {
18
- i18nChunkSplit
18
+ i18nChunkSplit,
19
+ createSeparateSMap
19
20
  } = options;
20
21
 
21
22
  if (!i18nChunkSplit.chunkSplitEnable) {
@@ -36,6 +37,7 @@ function configI18nSplitPlugin(options) {
36
37
  publicPath: i18nPublicPath,
37
38
  i18nManifestFileName: (0, _nameTemplates.nameTemplates)('i18nmanifest', options),
38
39
  // template: (object, locale) => `window.loadI18n(${JSON.stringify(object)}, ${JSON.stringify(locale)})`,
39
- propertiesFolder: i18nChunkSplit.propertiesFolder
40
+ propertiesFolder: i18nChunkSplit.propertiesFolder,
41
+ sourceMapOptions: createSeparateSMap
40
42
  });
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.6-exp.10",
3
+ "version": "0.0.6-exp.11",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {