@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.
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPlugin.js +4 -1
- package/lib/shared/bundler/webpack/custom_plugins/ServiceWorkerPluginUtils.js +13 -0
- package/lib/shared/bundler/webpack/custom_plugins/getInitialAssetsFuncTemplate.js +4 -4
- package/npm-shrinkwrap.json +1 -1
- package/package.json +1 -1
|
@@ -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(
|
|
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}(
|
|
49
|
+
const initialAssetsFuncTemplate = `function ${functionName}() {
|
|
50
50
|
return {
|
|
51
|
-
js: ${JSON.stringify(initialJsFiles)}.map(urlPath => urlPath.replace(
|
|
52
|
-
css: ${JSON.stringify(initialCssFiles)}
|
|
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;
|
package/npm-shrinkwrap.json
CHANGED