Uh oh!
There was an error while loading. Please reload this page.
module,src: add --experimental-entry-url flag - #49975
Conversation
nodejs-github-bot
commented
Sep 30, 2023
Review requested:
|
LiviaMedeiros
left a comment
There was a problem hiding this comment.
Is there a reason to reject relative URLs without leading ./?
| path. The URL must either start with `./` (e.g. `./entry.js`) or be absolute | ||
| (e.g. `file:///home/user/entry.js`). Bare specifier (e.g. `entry.js`) won't | ||
| work. |
There was a problem hiding this comment.
This part sounds a bit vague: does "won't work" mean throwing an error, or being interpreted as relative URL? Can relative URL start with ../? Would relative URL starting from /, ?, #, %2E/, etc. throw as well?
| assert.strictEqual(signal, null); | ||
| }); | ||
| it('should reject loading relative URLs without trailing `./`', async () => { |
There was a problem hiding this comment.
| it('should reject loading relative URLs without trailing `./`',async()=>{ | |
| it('should reject loading relative URLs without leading `./`',async()=>{ |
| execPath, | ||
| [ | ||
| '--experimental-entry-url', | ||
| './printA.js?key=value', |
There was a problem hiding this comment.
Doesn't have to be in this PR, but we'll need to test search and hash being passed correctly and not stripped by fileURLToPath() anywhere.
GeoffreyBooth
commented
Oct 1, 2023
I think that |
| WebAssembly magic number (`\0asm`); otherwise they will be treated as ES module | ||
| JavaScript. | ||
| ### `--experimental-entry-url` |
There was a problem hiding this comment.
I think we can call the flag --entry-url, with a printed experimental warning and the docs listing it as experimental. This isn’t a very risky feature that we need the experimental part in the flag name.
| } catch { | ||
| // Ignore exception | ||
| } catch (err) { | ||
| if (isMain && !shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { throw err; } |
There was a problem hiding this comment.
Can you please add a comment explaining this?
aduh95
commented
Jun 27, 2024
This has stalled. |
avivkeller
commented
Sep 13, 2024
👋 I implemented this with some slight differences, addressing comments, at #54933 |
Co-Authored-By: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #54933 Refs: #49975 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-Authored-By: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #54933 Refs: #49975 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-Authored-By: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #54933 Refs: #49975 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
--experimental-entry-urlis a new boolean flag that causes the entry point string to be parsed as a URL and loaded by the ESM loader:node --experimental-entry-url --enable-source-maps ./entry.js?foo=barRefs: #49432 (comment)