Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI imports #9962

Closed
stephenhandley opened this issue Apr 2, 2021 · 2 comments
Closed

CLI imports #9962

stephenhandley opened this issue Apr 2, 2021 · 2 comments

Comments

@stephenhandley
Copy link

~ $ deno
Deno 1.8.2
exit using ctrl+d or close()
> import { emptyDir } from "https://deno.land/std@0.91.0/fs/mod.ts";
Uncaught SyntaxError: Cannot use import statement outside a module

seems like import should probably work on cli without having to do something like this (which also didn't ultimately work)

> let emptyDir; import("https://deno.land/std@0.91.0/fs/mod.ts").then(m => ({emtpyDir} = m))
Check https://deno.land/std@0.91.0/fs/mod.ts
Promise {
  <rejected> TypeError: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.91.0/fs/copy.ts:96:16

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'. 'Deno.utimeSync' is an unstable API. Did you forget to run with the '--unstable' flag?
    Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std@0.91.0/fs/copy.ts:111:10

TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.91.0/fs/copy.ts:135:16

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'. 'Deno.utimeSync' is an unstable API. Did you forget to run with the '--unstable' flag?
    Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std@0.91.0/fs/copy.ts:160:10

TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
    await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.91.0/fs/copy.ts:183:16

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'. 'Deno.utimeSync' is an unstable API. Did you forget to run with the '--unstable' flag?
    Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std@0.91.0/fs/copy.ts:214:10

Found 6 errors.
}
> 
@crowlKats
Copy link
Member

Duplicate of #1285

@stephenhandley
Copy link
Author

Ok needed deno --unstable

let emptyDir; import("https://deno.land/std@0.91.0/fs/mod.ts").then(m => ({emptyDir} = m))
Promise {
  Module {
    EOL: { LF: "\n", CRLF: "\r\n" },
    _createWalkEntry: [AsyncFunction: _createWalkEntry],
    _createWalkEntrySync: [Function: _createWalkEntrySync],
    copy: [AsyncFunction: copy],
    copySync: [Function: copySync],
    detect: [Function: detect],
    emptyDir: [AsyncFunction: emptyDir],
    emptyDirSync: [Function: emptyDirSync],
    ensureDir: [AsyncFunction: ensureDir],
    ensureDirSync: [Function: ensureDirSync],
    ensureFile: [AsyncFunction: ensureFile],
    ensureFileSync: [Function: ensureFileSync],
    ensureLink: [AsyncFunction: ensureLink],
    ensureLinkSync: [Function: ensureLinkSync],
    ensureSymlink: [AsyncFunction: ensureSymlink],
    ensureSymlinkSync: [Function: ensureSymlinkSync],
    exists: [AsyncFunction: exists],
    existsSync: [Function: existsSync],
    expandGlob: [AsyncGeneratorFunction: expandGlob],
    expandGlobSync: [GeneratorFunction: expandGlobSync],
    format: [Function: format],
    move: [AsyncFunction: move],
    moveSync: [Function: moveSync],
    walk: [AsyncGeneratorFunction: walk],
    walkSync: [GeneratorFunction: walkSync]
  }
}

@kitsonk kitsonk closed this as completed Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants