memory-extract 0.1.1 → 0.1.2
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/package.json
CHANGED
package/src/loadMemory.js
CHANGED
|
@@ -41,6 +41,9 @@ const readInput = async (input) => {
|
|
|
41
41
|
|
|
42
42
|
const normalizeAssetPath = (value) => value.replace(/^\.\//, "");
|
|
43
43
|
|
|
44
|
+
const stripLeadingSlash = (value) =>
|
|
45
|
+
value.startsWith("/") ? value.slice(1) : value;
|
|
46
|
+
|
|
44
47
|
const guessMimeType = (filePath, record) => {
|
|
45
48
|
if (record?.mime) return record.mime;
|
|
46
49
|
if (filePath.endsWith(".html")) return "text/html";
|
|
@@ -64,7 +67,7 @@ const resolveAssetUrl = (rawPath, urlByPath) => {
|
|
|
64
67
|
|
|
65
68
|
const resolveManifestPath = (basePath, rawPath, manifestPaths) => {
|
|
66
69
|
const manifestSet = new Set(manifestPaths);
|
|
67
|
-
const normalized = normalizeAssetPath(rawPath);
|
|
70
|
+
const normalized = stripLeadingSlash(normalizeAssetPath(rawPath));
|
|
68
71
|
|
|
69
72
|
if (manifestSet.has(normalized)) {
|
|
70
73
|
return normalized;
|
|
@@ -509,6 +509,7 @@ var MemoryExtract = (() => {
|
|
|
509
509
|
throw new Error("Expected a PNG memory image.");
|
|
510
510
|
};
|
|
511
511
|
var normalizeAssetPath = (value) => value.replace(/^\.\//, "");
|
|
512
|
+
var stripLeadingSlash = (value) => value.startsWith("/") ? value.slice(1) : value;
|
|
512
513
|
var guessMimeType2 = (filePath, record) => {
|
|
513
514
|
if (record?.mime) return record.mime;
|
|
514
515
|
if (filePath.endsWith(".html")) return "text/html";
|
|
@@ -529,7 +530,7 @@ var MemoryExtract = (() => {
|
|
|
529
530
|
};
|
|
530
531
|
var resolveManifestPath = (basePath, rawPath, manifestPaths) => {
|
|
531
532
|
const manifestSet = new Set(manifestPaths);
|
|
532
|
-
const normalized = normalizeAssetPath(rawPath);
|
|
533
|
+
const normalized = stripLeadingSlash(normalizeAssetPath(rawPath));
|
|
533
534
|
if (manifestSet.has(normalized)) {
|
|
534
535
|
return normalized;
|
|
535
536
|
}
|