@plaudit/webpack-extensions 2.34.0 → 2.34.1
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.
|
@@ -20,18 +20,25 @@ function phpSerialize(value, objectsAsArrays = true) {
|
|
|
20
20
|
case "boolean":
|
|
21
21
|
return `b:${value ? 1 : 0};`;
|
|
22
22
|
case "number":
|
|
23
|
-
return
|
|
23
|
+
return Number.isInteger(value) ? serializeInteger(value) : `d:${value}`;
|
|
24
24
|
case "string":
|
|
25
|
-
return `s:${value
|
|
25
|
+
return `s:${Buffer.byteLength(value, 'utf8')}:"${value}";`;
|
|
26
26
|
case "function":
|
|
27
27
|
throw new Error(`We are unable to serialize functions into a form readable by PHP.`);
|
|
28
28
|
case "symbol":
|
|
29
29
|
value = value.toString();
|
|
30
|
-
return `s:${value
|
|
30
|
+
return `s:${Buffer.byteLength(value, 'utf8')}:"${value}";`;
|
|
31
31
|
case "bigint":
|
|
32
|
-
return
|
|
32
|
+
return serializeInteger(value);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
function serializeInteger(value) {
|
|
36
|
+
const str = value.toString();
|
|
37
|
+
if (str.includes("e") || str.includes("E")) {
|
|
38
|
+
return `d:${str.replace(/e/i, ".0e")}`;
|
|
39
|
+
}
|
|
40
|
+
return `i:${str}`;
|
|
41
|
+
}
|
|
35
42
|
function entriesInArrayAndObjectFormat(prefix, entries, objectsAsArrays) {
|
|
36
43
|
let res = `${prefix}:${entries.length}:{`;
|
|
37
44
|
for (const [k, v] of entries) {
|
|
@@ -17,6 +17,9 @@ const webpack_remove_empty_scripts_1 = __importDefault(require("webpack-remove-e
|
|
|
17
17
|
function joinPossiblyAbsolutePaths(...paths) {
|
|
18
18
|
return paths.reduce((res, p) => !res || node_path_1.default.isAbsolute(p) ? p : node_path_1.default.join(res, p), '') || '.';
|
|
19
19
|
}
|
|
20
|
+
function test(content, map, meta) {
|
|
21
|
+
this.resourcePath;
|
|
22
|
+
}
|
|
20
23
|
function mapToRealEntrypoints(entrypoint, dir, mapper = (entrypoint) => entrypoint, lazyDependent) {
|
|
21
24
|
return (Array.isArray(entrypoint) ? entrypoint : [entrypoint])
|
|
22
25
|
.map(ep => joinPossiblyAbsolutePaths(dir, mapper(ep)))
|