@zohodesk/client_build_tool 0.0.10-exp.5 → 0.0.10-exp.7
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.
|
@@ -7,6 +7,10 @@ exports.SourceMapPlugin = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _webpack = require("webpack");
|
|
9
9
|
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
10
14
|
/* eslint-disable class-methods-use-this */
|
|
11
15
|
function checkSmapFilePattern(assetName) {
|
|
12
16
|
return /\.js$/.test(assetName) && !/\.i18n\.js$/.test(assetName) || /\.js\.map$/.test(assetName) && !/\.i18n\.js\.map$/.test(assetName);
|
|
@@ -44,6 +48,38 @@ class SourceMapPlugin {
|
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
});
|
|
51
|
+
});
|
|
52
|
+
compilation.hooks.processAssets.tap({
|
|
53
|
+
name: 'CustomSourceMapPathPlugin',
|
|
54
|
+
stage: _webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT
|
|
55
|
+
}, assets => {
|
|
56
|
+
const newAssets = {};
|
|
57
|
+
|
|
58
|
+
for (const [filename, asset] of Object.entries(assets)) {
|
|
59
|
+
if (!filename.endsWith('.map')) {
|
|
60
|
+
const source = asset.source().toString();
|
|
61
|
+
const updatedSource = source.replace(/\/\/# sourceMappingURL=(.*\.js\.map)/, `//# sourceMappingURL=../../js/$1`);
|
|
62
|
+
compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(updatedSource));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
;
|
|
66
|
+
const jsFile = filename.slice(0, -4);
|
|
67
|
+
const chunk = compilation.chunks.find(c => c.files.has(jsFile));
|
|
68
|
+
|
|
69
|
+
if (chunk) {
|
|
70
|
+
;
|
|
71
|
+
const isInitial = chunk.canBeInitial();
|
|
72
|
+
const folder = isInitial ? 'js/' : 'js-chunks/';
|
|
73
|
+
|
|
74
|
+
const baseName = _path.default.basename(jsFile);
|
|
75
|
+
|
|
76
|
+
const newMapPath = folder + baseName + '.map';
|
|
77
|
+
newAssets[newMapPath] = asset;
|
|
78
|
+
delete compilation.assets[filename];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
Object.assign(compilation.assets, newAssets);
|
|
47
83
|
}); // if contenthash enabled we need to add this to include the runtime files
|
|
48
84
|
// compilation.hooks.processAssets.tap(
|
|
49
85
|
// {
|
|
@@ -259,7 +259,7 @@ var _default = ({
|
|
|
259
259
|
if (range) {
|
|
260
260
|
// console.log('multiple :', decl.value)
|
|
261
261
|
let newVal = '';
|
|
262
|
-
decl.value.split(' ').
|
|
262
|
+
decl.value.split(' ').forEach(singleVal => {
|
|
263
263
|
newVal += `${singleConvertor(singleVal, settings.replacements.px, {
|
|
264
264
|
decl,
|
|
265
265
|
filename,
|