| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d6a2317 commit 0dd4639
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -498,6 +498,7 @@ class ModuleLoader { | |||
| 498 | 498 | * @returns {{ format: string, url: URL['href'] }} | |
| 499 | 499 | */ | |
| 500 | 500 | resolve(originalSpecifier, parentURL, importAttributes) { | |
| 501 | + originalSpecifier = `${originalSpecifier}`; | ||
| 501 | 502 | if (this.#customizations) { | |
| 502 | 503 | return this.#customizations.resolve(originalSpecifier, parentURL, importAttributes); | |
| 503 | 504 | } | |
@@ -516,6 +517,7 @@ class ModuleLoader { | |||
| 516 | 517 | * `import.meta.resolve` which must happen synchronously. | |
| 517 | 518 | */ | |
| 518 | 519 | resolveSync(originalSpecifier, parentURL, importAttributes) { | |
| 520 | + originalSpecifier = `${originalSpecifier}`; | ||
| 519 | 521 | if (this.#customizations) { | |
| 520 | 522 | return this.#customizations.resolveSync(originalSpecifier, parentURL, importAttributes); | |
| 521 | 523 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | // Flags: --experimental-import-meta-resolve | |
| 2 | - import '../common/index.mjs'; | ||
| 2 | + import { spawnPromisified } from '../common/index.mjs'; | ||
| 3 | 3 | import assert from 'assert'; | |
| 4 | 4 | import { spawn } from 'child_process'; | |
| 5 | 5 | import { execPath } from 'process'; | |
@@ -90,3 +90,20 @@ await assert.rejects(import('data:text/javascript,export default import.meta.res | |||
| 90 | 90 | cp.stdin.end('import "data:text/javascript,console.log(import.meta.resolve(%22node:os%22))"'); | |
| 91 | 91 | assert.match((await cp.stdout.toArray()).toString(), /^node:os\r?\n$/); | |
| 92 | 92 | } | |
| 93 | + | ||
| 94 | + { | ||
| 95 | + const result = await spawnPromisified(execPath, [ | ||
| 96 | + '--no-warnings', | ||
| 97 | + '--input-type=module', | ||
| 98 | + '--import', 'data:text/javascript,import{register}from"node:module";register("data:text/javascript,")', | ||
| 99 | + '--eval', | ||
| 100 | + 'console.log(import.meta.resolve(new URL("http://example.com")))', | ||
| 101 | + ]); | ||
| 102 | + | ||
| 103 | + assert.deepStrictEqual(result, { | ||
| 104 | + code: 0, | ||
| 105 | + signal: null, | ||
| 106 | + stderr: '', | ||
| 107 | + stdout: 'http://example.com/\n', | ||
| 108 | + }); | ||
| 109 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments