@esmx/import 3.0.0-rc.39 → 3.0.0-rc.41
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/import-loader.mjs +3 -3
- package/package.json +3 -3
- package/src/import-loader.ts +3 -3
package/dist/import-loader.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import module from "node:module";
|
|
2
|
-
import {
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
3
|
import IM from "@import-maps/resolve";
|
|
4
4
|
let registered = "";
|
|
5
5
|
export function createLoaderImport(baseURL, importMap = {}) {
|
|
6
6
|
if (!registered) {
|
|
7
|
-
module.register(
|
|
7
|
+
module.register(import.meta.url, {
|
|
8
8
|
parentURL: baseURL,
|
|
9
9
|
data: {
|
|
10
10
|
baseURL: baseURL.href,
|
|
@@ -35,7 +35,7 @@ export function resolve(specifier, context, nextResolve) {
|
|
|
35
35
|
const scriptURL = new URL(context.parentURL);
|
|
36
36
|
const result = IM.resolve(specifier, loaderParsedImportMap, scriptURL);
|
|
37
37
|
if (result.matched && result.resolvedImport) {
|
|
38
|
-
return nextResolve(result.resolvedImport.href);
|
|
38
|
+
return nextResolve(pathToFileURL(result.resolvedImport.pathname).href);
|
|
39
39
|
}
|
|
40
40
|
return nextResolve(specifier, context);
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@biomejs/biome": "1.9.4",
|
|
36
|
-
"@esmx/lint": "3.0.0-rc.
|
|
36
|
+
"@esmx/lint": "3.0.0-rc.41",
|
|
37
37
|
"@types/node": "^24.0.0",
|
|
38
38
|
"@vitest/coverage-v8": "3.2.4",
|
|
39
39
|
"stylelint": "16.21.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"unbuild": "3.5.0",
|
|
42
42
|
"vitest": "3.2.4"
|
|
43
43
|
},
|
|
44
|
-
"version": "3.0.0-rc.
|
|
44
|
+
"version": "3.0.0-rc.41",
|
|
45
45
|
"type": "module",
|
|
46
46
|
"private": false,
|
|
47
47
|
"exports": {
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"template",
|
|
61
61
|
"public"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d3d8a4787b62ec580d61adc6bf2a907f27c413a9"
|
|
64
64
|
}
|
package/src/import-loader.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import module from 'node:module';
|
|
2
|
-
import {
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import IM from '@import-maps/resolve';
|
|
4
4
|
import type { ImportMap } from './types';
|
|
5
5
|
|
|
@@ -12,7 +12,7 @@ let registered = '';
|
|
|
12
12
|
|
|
13
13
|
export function createLoaderImport(baseURL: URL, importMap: ImportMap = {}) {
|
|
14
14
|
if (!registered) {
|
|
15
|
-
module.register<Data>(
|
|
15
|
+
module.register<Data>(import.meta.url, {
|
|
16
16
|
parentURL: baseURL,
|
|
17
17
|
data: {
|
|
18
18
|
baseURL: baseURL.href,
|
|
@@ -50,7 +50,7 @@ export function resolve(
|
|
|
50
50
|
const scriptURL = new URL(context.parentURL);
|
|
51
51
|
const result = IM.resolve(specifier, loaderParsedImportMap, scriptURL);
|
|
52
52
|
if (result.matched && result.resolvedImport) {
|
|
53
|
-
return nextResolve(result.resolvedImport.href);
|
|
53
|
+
return nextResolve(pathToFileURL(result.resolvedImport.pathname).href);
|
|
54
54
|
}
|
|
55
55
|
return nextResolve(specifier, context);
|
|
56
56
|
}
|