@agoric/internal 0.3.3-dev-aa6629d.0.aa6629d → 0.3.3-dev-f212cfd.0.f212cfd

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/internal",
3
- "version": "0.3.3-dev-aa6629d.0.aa6629d",
3
+ "version": "0.3.3-dev-f212cfd.0.f212cfd",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -20,7 +20,7 @@
20
20
  "lint:types": "yarn run -T tsc"
21
21
  },
22
22
  "dependencies": {
23
- "@agoric/base-zone": "0.1.1-dev-aa6629d.0.aa6629d",
23
+ "@agoric/base-zone": "0.1.1-dev-f212cfd.0.f212cfd",
24
24
  "@endo/cache-map": "^1.1.0",
25
25
  "@endo/common": "^1.2.13",
26
26
  "@endo/compartment-mapper": "^1.6.3",
@@ -35,10 +35,11 @@
35
35
  "@endo/promise-kit": "^1.1.13",
36
36
  "@endo/stream": "^1.2.13",
37
37
  "anylogger": "^0.21.0",
38
+ "import-meta-resolve": "^4.1.0",
38
39
  "jessie.js": "^0.3.4"
39
40
  },
40
41
  "devDependencies": {
41
- "@agoric/cosmic-proto": "0.4.1-dev-aa6629d.0.aa6629d",
42
+ "@agoric/cosmic-proto": "0.4.1-dev-f212cfd.0.f212cfd",
42
43
  "@endo/exo": "^1.5.12",
43
44
  "@endo/init": "^1.1.12",
44
45
  "@endo/ses-ava": "^1.3.2",
@@ -66,5 +67,5 @@
66
67
  "typeCoverage": {
67
68
  "atLeast": 92.89
68
69
  },
69
- "gitHead": "aa6629dd5d80a450843e2916ff9507265610503f"
70
+ "gitHead": "f212cfdd1987748d593ba731f0a9e837065ce0a6"
70
71
  }
@@ -1,2 +1,3 @@
1
1
  export function getSpecifier(fileUrl: string): Promise<string>;
2
+ export function resolveToPath(specifier: string, baseURL: string): string;
2
3
  //# sourceMappingURL=module-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-utils.d.ts","sourceRoot":"","sources":["module-utils.js"],"names":[],"mappings":"AAaO,sCAHI,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAc3B"}
1
+ {"version":3,"file":"module-utils.d.ts","sourceRoot":"","sources":["module-utils.js"],"names":[],"mappings":"AAcO,sCAHI,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAc3B;AAWM,yCAJI,MAAM,WACN,MAAM,GACJ,MAAM,CAMlB"}
@@ -1,5 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  import { fileURLToPath } from 'node:url';
3
+ import { resolve as importMetaResolve } from 'import-meta-resolve';
3
4
  import { search } from '@endo/compartment-mapper';
4
5
  import { Fail } from '@endo/errors';
5
6
 
@@ -25,3 +26,18 @@ export const getSpecifier = async fileUrl => {
25
26
  return `${name}/${moduleSpecifier.replace(/^\.\//, '')}`;
26
27
  };
27
28
  harden(getSpecifier);
29
+
30
+ /**
31
+ * Given an import specifier and importer URL (usually import.meta.url), return
32
+ * a file system path corresponding with the specifier for the importer.
33
+ *
34
+ * @param {string} specifier
35
+ * @param {string} baseURL
36
+ * @returns {string}
37
+ */
38
+ export const resolveToPath = (specifier, baseURL) => {
39
+ const resolved = importMetaResolve(specifier, baseURL);
40
+ const resolvedURL = new URL(resolved);
41
+ return fileURLToPath(resolvedURL);
42
+ };
43
+ harden(resolveToPath);