@zohodesk/client_build_tool 0.0.6-exp.39 → 0.0.6-exp.40

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.
@@ -15,6 +15,8 @@ var _replaceCssDirTemplate = require("./RtlSplitPlugin/replaceCssDirTemplate");
15
15
 
16
16
  var _getInitialAssetsFuncTemplate = require("./getInitialAssetsFuncTemplate");
17
17
 
18
+ var _ServiceWorkerPluginUtils = require("./ServiceWorkerPluginUtils");
19
+
18
20
  const pluginName = 'ServiceWorkerPlugin';
19
21
 
20
22
  class ServiceWorkerPlugin {
@@ -83,6 +85,7 @@ class ServiceWorkerPlugin {
83
85
 
84
86
  [...compilation.chunks].filter(c => !this.isInitialChunk(c)).forEach(chunk => {
85
87
  allChunkUrls = [...allChunkUrls, ...chunk.files];
88
+ allI18nAssets.push((0, _ServiceWorkerPluginUtils.getI18nFileUrlPathTemplate)(compilation, chunk, this.i18nFileNameTemplate, '@locale@'));
86
89
  });
87
90
  allChunkUrls = allChunkUrls.filter(fileName => !fileName.endsWith('.map'));
88
91
  allChunkUrls = allChunkUrls.map(fileName => fileName.replace('smap/', ''));
@@ -94,7 +97,7 @@ class ServiceWorkerPlugin {
94
97
  const mod = templateContent.replace(this.replaceText, `
95
98
  ${initialAssetsFuncTemplate}
96
99
 
97
- let initialAssetsObj = getInitialAssets({ lang: langLocale, dir: cssDir });
100
+ let initialAssetsObj = getInitialAssets();
98
101
 
99
102
  let initialAssets = initialAssetsObj.i18n.concat(
100
103
  initialAssetsObj.css,
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getI18nFileUrlPathTemplate = getI18nFileUrlPathTemplate;
7
+
8
+ function getI18nFileUrlPathTemplate(compilation, chunk, filenameTemplate, localeTemplate) {
9
+ const urlpath = compilation.getPath(filenameTemplate, {
10
+ chunk
11
+ });
12
+ return urlpath.replace('[locale]', localeTemplate);
13
+ }
@@ -46,11 +46,11 @@ function getInitialAssetsFuncTemplate({
46
46
  chunkSplitEnable,
47
47
  i18nFileNameTemplate
48
48
  });
49
- const initialAssetsFuncTemplate = `function ${functionName}({ lang, dir}) {
49
+ const initialAssetsFuncTemplate = `function ${functionName}() {
50
50
  return {
51
- js: ${JSON.stringify(initialJsFiles)}.map(urlPath => urlPath.replace(/@locale@/g, lang)),
52
- css: ${JSON.stringify(initialCssFiles)}${enableRTLSplit ? '.map(urlPath => urlPath.replace(/@dir@/g, dir))' : ''},
53
- i18n: ${initialI18nAssets},
51
+ js: ${JSON.stringify(initialJsFiles)}.map(urlPath => urlPath.replace('smap/', '')),
52
+ css: ${JSON.stringify(initialCssFiles)},
53
+ i18n: ${initialI18nAssets}
54
54
  }
55
55
  }`;
56
56
  return initialAssetsFuncTemplate;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.6-exp.37",
3
+ "version": "0.0.6-exp.36",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.6-exp.39",
3
+ "version": "0.0.6-exp.40",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {