unwasm 0.5.1 → 0.5.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/dist/plugin/index.mjs +14 -4
- package/package.json +1 -1
package/dist/plugin/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { existsSync, promises } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
import { basename } from "pathe";
|
|
3
4
|
import MagicString from "magic-string";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
@@ -5798,11 +5799,20 @@ function unwasm(opts) {
|
|
|
5798
5799
|
external: true
|
|
5799
5800
|
};
|
|
5800
5801
|
if (WASM_ID_RE.test(id)) {
|
|
5801
|
-
const
|
|
5802
|
-
if (
|
|
5803
|
-
|
|
5802
|
+
const resolved = await this.resolve(id, importer);
|
|
5803
|
+
if (!resolved?.id) return resolved;
|
|
5804
|
+
let resolvedId = resolved?.id;
|
|
5805
|
+
if (resolvedId && resolvedId.startsWith("file://")) resolvedId = fileURLToPath(resolvedId);
|
|
5806
|
+
return {
|
|
5807
|
+
...resolved,
|
|
5808
|
+
id: resolvedId,
|
|
5804
5809
|
external: false,
|
|
5805
|
-
moduleSideEffects: false
|
|
5810
|
+
moduleSideEffects: false,
|
|
5811
|
+
resolvedBy: "unwasm",
|
|
5812
|
+
meta: {
|
|
5813
|
+
...resolved.meta,
|
|
5814
|
+
unwasm: { resolved }
|
|
5815
|
+
}
|
|
5806
5816
|
};
|
|
5807
5817
|
}
|
|
5808
5818
|
}
|