esm-dev / esm.sh

A fast, smart, & global CDN for modern(es2015+) web development.
https://esm.sh
MIT License
3.14k stars 151 forks source link

Failed to import - ink (types) #247

Open drmercer-lucid opened 2 years ago

drmercer-lucid commented 2 years ago

Failing module

// test.ts
import * as i from 'https://esm.sh/ink';

Error message

After running deno run --unstable test.ts I get this:

Download https://cdn.esm.shchalk/
Download https://cdn.esm.shcli-boxes/
Check file:///path/to/test.ts
error: TS2300 [ERROR]: Duplicate identifier 'Buffer'.
  var Buffer: typeof bufferModule;
      ~~~~~~
    at https://deno.land/std@0.115.0/node/global.ts:25:7

    'Buffer' was also declared here.
    declare class Buffer extends Uint8Array {
                  ~~~~~~
        at https://cdn.esm.sh/v58/node.ns.d.ts:16:15

TS2300 [ERROR]: Duplicate identifier 'Buffer'.
  type Buffer = bufferModule;
       ~~~~~~
    at https://deno.land/std@0.115.0/node/global.ts:26:8

    'Buffer' was also declared here.
    declare class Buffer extends Uint8Array {
                  ~~~~~~
        at https://cdn.esm.sh/v58/node.ns.d.ts:16:15

TS2300 [ERROR]: Duplicate identifier 'Buffer'.
declare class Buffer extends Uint8Array {
              ~~~~~~
    at https://cdn.esm.sh/v58/node.ns.d.ts:16:15

    'Buffer' was also declared here.
      var Buffer: typeof bufferModule;
          ~~~~~~
        at https://deno.land/std@0.115.0/node/global.ts:25:7    and here.
      type Buffer = bufferModule;
           ~~~~~~
        at https://deno.land/std@0.115.0/node/global.ts:26:8

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
    stdout: NodeJS.WriteStream;
                   ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/ink.d.ts:4:20

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'ReadStream'.
    stdin: NodeJS.ReadStream;
                  ~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/ink.d.ts:5:19

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
    stderr: NodeJS.WriteStream;
                   ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/ink.d.ts:6:20

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
    stdout?: NodeJS.WriteStream;
                    ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/render.d.ts:10:21

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'ReadStream'.
    stdin?: NodeJS.ReadStream;
                   ~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/render.d.ts:16:20

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
    stderr?: NodeJS.WriteStream;
                    ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/render.d.ts:21:21

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
declare type RenderFunction = <Props, K extends NodeJS.WriteStream | RenderOptions>(tree: ReactElement<Props>, options?: K) => Instance;
                                                       ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/render.d.ts:60:56

TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'Boxes'.
import { Boxes } from 'https://cdn.esm.shcli-boxes';
         ~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/styles.d.ts:2:10

TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'ForegroundColor'.
import { ForegroundColor } from 'https://cdn.esm.shchalk';
         ~~~~~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/styles.d.ts:4:10

TS2305 [ERROR]: Module '"deno:///missing_dependency.d.ts"' has no exported member 'ForegroundColor'.
import { ForegroundColor } from 'https://cdn.esm.shchalk';
         ~~~~~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/components/Text.d.ts:2:10

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'ReadStream'.
    readonly stdin?: NodeJS.ReadStream;
                            ~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/components/StdinContext.d.ts:7:29

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
    readonly stdout?: NodeJS.WriteStream;
                             ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/components/StdoutContext.d.ts:7:30

TS2694 [ERROR]: Namespace 'NodeJS' has no exported member 'WriteStream'.
    readonly stderr?: NodeJS.WriteStream;
                             ~~~~~~~~~~~
    at https://cdn.esm.sh/v58/ink@3.2.0/build/components/StderrContext.d.ts:7:30

Found 16 errors.

Additional info

The Download https://cdn.esm.shchalk/ and Download https://cdn.esm.shcli-boxes/ lines seem very broken. If I do deno info test.ts, this is what I get:

Download https://cdn.esm.shchalk/
Download https://cdn.esm.shcli-boxes/
local: /home/dmercer/lucid/dans-tools/deno/temp-test.ts
emit: /home/dmercer/.cache/deno/gen/file/home/dmercer/lucid/dans-tools/deno/temp-test.ts.js
type: TypeScript
dependencies: 277 unique (total 3.32MB)

file:///home/dmercer/lucid/dans-tools/deno/temp-test.ts (40B)
└─┬ https://esm.sh/ink (159B)
  ├─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/index.d.ts (1.37KB)
  │ ├─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/components/AppContext.d.ts (445B)
  │ │ └─┬ https://cdn.esm.sh/v58/@types/react@17.0.37/index.d.ts (148.67KB)
  │ │   ├── https://cdn.esm.sh/v58/@types/react@17.0.37/global.d.ts (7.01KB)
  │ │   ├── https://cdn.esm.sh/v58/@types/prop-types@15.7.4/index.d.ts (3.58KB)
  │ │   ├── https://cdn.esm.sh/v58/@types/scheduler@0.16.2/tracing.d.ts (4.03KB)
  │ │   └── https://cdn.esm.sh/v58/csstype@3.0.10/index.d.ts (844.54KB)
  │ ├─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/components/Box.d.ts (2.9KB)
  │ │ ├─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/dom.d.ts (1.93KB)
  │ │ │ ├─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/render-node-to-output.d.ts (384B)
  │ │ │ │ ├── https://cdn.esm.sh/v58/ink@3.2.0/build/dom.d.ts *
  │ │ │ │ └─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/output.d.ts (761B)
  │ │ │ │   └── https://cdn.esm.sh/v58/ink@3.2.0/build/render-node-to-output.d.ts *
  │ │ │ ├─┬ https://cdn.esm.sh/v58/ink@3.2.0/build/styles.d.ts (4.1KB)
  │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/index.d.ts (1.27KB)
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/async-return-type.d.ts (724B)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/promise-value.d.ts (637B)
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/basic.d.ts (2.04KB)
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/conditional-except.d.ts (1022B)
  │ │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/conditional-keys.d.ts (1.17KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/except.d.ts (886B)
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/conditional-keys.d.ts *
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/conditional-pick.d.ts (938B)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/conditional-keys.d.ts *
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/except.d.ts *
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/literal-union.d.ts (1.13KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/basic.d.ts *
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/merge-exclusive.d.ts (1.31KB)
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/merge.d.ts (420B)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/except.d.ts *
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/mutable.d.ts (860B)
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/opaque.d.ts (2.61KB)
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/package-json.d.ts (12.73KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/index.d.ts *
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/partial-deep.d.ts (2.26KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/basic.d.ts *
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/promisable.d.ts (775B)
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/promise-value.d.ts *
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/readonly-deep.d.ts (1.79KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/basic.d.ts *
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/require-at-least-one.d.ts (814B)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/except.d.ts *
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/require-exactly-one.d.ts (1.23KB)
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/set-optional.d.ts (1.05KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/except.d.ts *
  │ │ │ │ │ ├─┬ https://cdn.esm.sh/v58/type-fest@0.12.0/source/set-required.d.ts (1.05KB)
  │ │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/except.d.ts *
  │ │ │ │ │ ├── https://cdn.esm.sh/v58/type-fest@0.12.0/source/tsconfig-json.d.ts (16.45KB)
  │ │ │ │ │ └── https://cdn.esm.sh/v58/type-fest@0.12.0/source/union-to-intersection.d.ts (1.91KB)
  │ │ │ │ ├─┬ https://cdn.esm.sh/v58/yoga-layout-prebuilt@1.10.0/index.d.ts (100B)
  │ │ │ │ │ └── https://cdn.esm.sh/v58/@types/yoga-layout@1.9.2/index.d.ts (14.72KB)
  │ │ │ │ ├── https://cdn.esm.shchalk/ (loading error)
  │ │ │ │ └── https://cdn.esm.shcli-boxes/ (loading error)
  │ │ │ ├── https://cdn.esm.sh/v58/@types/yoga-layout@1.9.2/index.d.ts *
  │ │ │ └── https://cdn.esm.sh/v58/yoga-layout-prebuilt@1.10.0/index.d.ts *
  │ │ ├── https://cdn.esm.sh/v58/ink@3.2.0/build/styles.d.ts *
  ...

The problem seems to happen in https://cdn.esm.sh/v58/ink@3.2.0/build/styles.d.ts:

$ curl -s https://cdn.esm.sh/v58/ink@3.2.0/build/styles.d.ts | less | head
import { YogaNode } from 'https://cdn.esm.sh/v58/yoga-layout-prebuilt@1.10.0/index.d.ts';
import { Boxes } from 'https://cdn.esm.shcli-boxes';
import { LiteralUnion } from 'https://cdn.esm.sh/v58/type-fest@0.12.0/index.d.ts';
import { ForegroundColor } from 'https://cdn.esm.shchalk';
export interface Styles {
    readonly textWrap?: 'wrap' | 'end' | 'middle' | 'truncate-end' | 'truncate' | 'truncate-middle' | 'truncate-start';
    readonly position?: 'absolute' | 'relative';
    /**
     * Top margin.
     */
talentlessguy commented 2 years ago

latest version is v61

but it still fails to build due to this:

➜ deno eval --unstable "import * as i from 'https://esm.sh/ink?pin=v61'"
Download https://cdn.esm.shchalk/
Download https://cdn.esm.shcli-boxes/
This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
error: Uncaught ReferenceError: _a is not defined
    at https://cdn.esm.sh/v61/yoga-layout-prebuilt@1.10.0/deno/yoga-layout-prebuilt.js:3:58800
    at https://cdn.esm.sh/v61/yoga-layout-prebuilt@1.10.0/deno/yoga-layout-prebuilt.js:3:77999
    at https://cdn.esm.sh/v61/yoga-layout-prebuilt@1.10.0/deno/yoga-layout-prebuilt.js:4:508
    at https://cdn.esm.sh/v61/yoga-layout-prebuilt@1.10.0/deno/yoga-layout-prebuilt.js:2:681
    at https://cdn.esm.sh/v61/yoga-layout-prebuilt@1.10.0/deno/yoga-layout-prebuilt.js:4:713
drmercer-lucid commented 2 years ago

@talentlessguy Thanks for the tip about the version. If you add --ext ts to your command to make it do type checking, you'll see the type errors still happen:

$ deno eval --unstable --ext ts "import * as i from 'https://esm.sh/ink?pin=v61'"
Download https://cdn.esm.shchalk/
Download https://cdn.esm.shcli-boxes/
error: TS2300 [ERROR]: Duplicate identifier 'Buffer'.
  var Buffer: typeof bufferModule;
      ~~~~~~
    at https://deno.land/std@0.119.0/node/global.ts:25:7

    'Buffer' was also declared here.
    declare class Buffer extends Uint8Array {
                  ~~~~~~
        at https://cdn.esm.sh/v61/node.ns.d.ts:16:15

... etc.