hasundue / molt

Update dependencies the Deno way
https://jsr.io/@molt
MIT License
79 stars 5 forks source link

`--unstable-lock` errors if a source has a local import #178

Closed hasundue closed 3 months ago

hasundue commented 4 months ago

Example:

> molt core/mod.ts --unstable-lock --debug
error: Uncaught (in promise) Error: error: Relative import path "@core/unknownutil" not prefixed with / or ./ or ../
    at file:///home/hasundue/molt/core/lockfile.ts:5:28

    throw new CommandError(new TextDecoder().decode(stderr));
          ^
    at createLockPart (https://jsr.io/@molt/core/0.18.4/lockfile.ts:176:11)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async collectFromDependency (https://jsr.io/@molt/core/0.18.4/update.ts:290:7)
    at async Promise.all (index 9)
    at async collect (https://jsr.io/@molt/core/0.18.4/update.ts:224:5)
    at async Module.default (https://jsr.io/@molt/cli/0.18.4/modules/collect.ts:14:18)
    at async Command.actionHandler (https://jsr.io/@molt/cli/0.18.4/main.ts:48:21)
    at async Command.execute (https://jsr.io/@cliffy/command/1.0.0-rc.4/command.ts:1937:7)
    at async Command.parseCommand (https://jsr.io/@cliffy/command/1.0.0-rc.4/command.ts:1769:14)
    at async https://jsr.io/@molt/cli/0.18.4/main.ts:100:5
hasundue commented 4 months ago

I forgot to pass --import-map in the example above.

> molt core/mod.ts --unstable-lock --debug --import-map core/deno.json
error: Uncaught (in promise) Error: error: Relative import path "@std/fs" not prefixed with / or ./ or ../
    at file:///home/hasundue/molt/core/update.ts:4:24

    throw new CommandError(new TextDecoder().decode(stderr));
          ^
    at createLockPart (https://jsr.io/@molt/core/0.18.4/lockfile.ts:176:11)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async collectFromDependency (https://jsr.io/@molt/core/0.18.4/update.ts:290:7)
    at async Promise.all (index 15)
    at async collect (https://jsr.io/@molt/core/0.18.4/update.ts:224:5)
    at async Module.default (https://jsr.io/@molt/cli/0.18.4/modules/collect.ts:14:18)
    at async Command.actionHandler (https://jsr.io/@molt/cli/0.18.4/main.ts:48:21)
    at async Command.execute (https://jsr.io/@cliffy/command/1.0.0-rc.4/command.ts:1937:7)
    at async Command.parseCommand (https://jsr.io/@cliffy/command/1.0.0-rc.4/command.ts:1769:14)
    at async https://jsr.io/@molt/cli/0.18.4/main.ts:100:5
hasundue commented 4 months ago

Found that this is not due to JSR imports but caused by local imports like import ... from "./update.ts". Easy to fix.