@plaudit/webpack-extensions 2.35.0 → 2.36.0
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.
|
@@ -79,7 +79,6 @@ class BlockJSONManagingPlugin {
|
|
|
79
79
|
if (!assetContents) {
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
|
-
blockDirConfigData[name] = true;
|
|
83
82
|
const json = JSON.parse(assetContents);
|
|
84
83
|
const currentAssetKeyMappings = { directMappings: {}, referencedFiles: {}, compositeHash: "" };
|
|
85
84
|
for (const mappableKey of BlockJSONManagingPlugin[this.processingModules ? 'mappableModuleKeys' : 'mappableNonModuleKeys']) {
|
|
@@ -193,10 +192,11 @@ class BlockJSONManagingPlugin {
|
|
|
193
192
|
}
|
|
194
193
|
}
|
|
195
194
|
compilation[name in compilation.assets ? 'updateAsset' : 'emitAsset'](name, new webpack_1.sources.RawSource(JSON.stringify(json, undefined, " ")));
|
|
195
|
+
blockDirConfigData[node_path_1.default.dirname(name)] = json;
|
|
196
196
|
}
|
|
197
197
|
const sortedBlockDirConfigData = Object.fromEntries(Object.entries(blockDirConfigData)
|
|
198
198
|
.sort(([a], [b]) => a.localeCompare(b)));
|
|
199
|
-
compilation.emitAsset("blockdir.config", new webpack_1.sources.RawSource((0, php_serializer_1.default)(sortedBlockDirConfigData)));
|
|
199
|
+
compilation.emitAsset("blockdir.config", new webpack_1.sources.RawSource((0, php_serializer_1.default)(sortedBlockDirConfigData, { excludedKeys: ["$schema"] })));
|
|
200
200
|
});
|
|
201
201
|
});
|
|
202
202
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = phpSerialize;
|
|
4
|
-
function phpSerialize(value,
|
|
4
|
+
function phpSerialize(value, config) {
|
|
5
5
|
switch (typeof value) {
|
|
6
6
|
case "undefined":
|
|
7
7
|
return "N;";
|
|
@@ -12,15 +12,15 @@ function phpSerialize(value, objectsAsArrays = true) {
|
|
|
12
12
|
else if (Array.isArray(value)) {
|
|
13
13
|
let res = `a:${value.length}:{`;
|
|
14
14
|
for (let i = 0; i < value.length; i++) {
|
|
15
|
-
res += `i:${i};${phpSerialize(value[i],
|
|
15
|
+
res += `i:${i};${phpSerialize(value[i], config)}`;
|
|
16
16
|
}
|
|
17
17
|
return (res.endsWith('};') ? res.substring(0, res.length - 1) : res) + "}";
|
|
18
18
|
}
|
|
19
|
-
return entriesInArrayAndObjectFormat(objectsAsArrays ? 'a' : 'O:8:"stdClass"', Object.entries(value),
|
|
19
|
+
return entriesInArrayAndObjectFormat(config?.objectsAsArrays ?? true ? 'a' : 'O:8:"stdClass"', Object.entries(value), config);
|
|
20
20
|
case "boolean":
|
|
21
21
|
return `b:${value ? 1 : 0};`;
|
|
22
22
|
case "number":
|
|
23
|
-
return Number.isInteger(value) ? serializeInteger(value) : `d:${value}
|
|
23
|
+
return Number.isInteger(value) ? serializeInteger(value) : `d:${value};`;
|
|
24
24
|
case "string":
|
|
25
25
|
return `s:${Buffer.byteLength(value, 'utf8')}:"${value}";`;
|
|
26
26
|
case "function":
|
|
@@ -35,14 +35,19 @@ function phpSerialize(value, objectsAsArrays = true) {
|
|
|
35
35
|
function serializeInteger(value) {
|
|
36
36
|
const str = value.toString();
|
|
37
37
|
if (str.includes("e") || str.includes("E")) {
|
|
38
|
-
return `d:${str.replace(/e/i, ".0e")}
|
|
38
|
+
return `d:${str.replace(/e/i, ".0e")};`;
|
|
39
39
|
}
|
|
40
|
-
return `i:${str}
|
|
40
|
+
return `i:${str};`;
|
|
41
41
|
}
|
|
42
|
-
function entriesInArrayAndObjectFormat(prefix, entries,
|
|
43
|
-
|
|
42
|
+
function entriesInArrayAndObjectFormat(prefix, entries, config) {
|
|
43
|
+
const excludedKeys = config?.excludedKeys ?? [];
|
|
44
|
+
let res = "";
|
|
45
|
+
let count = 0;
|
|
44
46
|
for (const [k, v] of entries) {
|
|
45
|
-
|
|
47
|
+
if (!excludedKeys.includes(k)) {
|
|
48
|
+
count++;
|
|
49
|
+
res += `${phpSerialize(k, config)}${phpSerialize(v, config)}`;
|
|
50
|
+
}
|
|
46
51
|
}
|
|
47
|
-
return (res.endsWith('};') ? res.substring(0, res.length - 1) : res) + "}";
|
|
52
|
+
return `${prefix}:${count}:{` + (res.endsWith('};') ? res.substring(0, res.length - 1) : res) + "}";
|
|
48
53
|
}
|