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.
@@ -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 r = await this.resolve(id, importer, { skipSelf: true });
5802
- if (r?.id && r.id !== id) return {
5803
- id: r.id.startsWith("file://") ? r.id.slice(7) : r.id,
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unwasm",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "WebAssembly tools for JavaScript",
5
5
  "repository": "unjs/unwasm",
6
6
  "license": "MIT",