skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

Unable to Import Unified - Possibly due to @types scope #273

Open ericdmoore opened 2 years ago

ericdmoore commented 2 years ago

Root Cause Suspicion

The types for this package are from the Definitely Typed's @types npm scope - which seems to be turning into an unknown Thus when the URL rewrite patterns are applied - its not picking up the types as it should.

To Reproduce

test.ts

import { unified } from 'https://cdn.skypack.dev/unified@10.1.1?dts';
console.log(unified)

run it

deno run test.ts

output

Download https://cdn.skypack.dev/error/buffer?from=vfile
Check file:///Users/ericmoore/Web/feedBarber/_scratch/uni.ts
error: TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile-message.js"' has no exported member 'Node'.
export type Node = import('/error/unknown:unist?from=vfile-message').Node
                                                                     ~~~~
    at https://cdn.skypack.dev/-/vfile-message@v3.1.0-pPrDDqBkf5K1GBeD5q5L/dist=es2019,mode=types/index.d.ts:79:70

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile-message.js"' has no exported member 'Position'.
export type Position = import('/error/unknown:unist?from=vfile-message').Position
                                                                         ~~~~~~~~
    at https://cdn.skypack.dev/-/vfile-message@v3.1.0-pPrDDqBkf5K1GBeD5q5L/dist=es2019,mode=types/index.d.ts:80:74

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile-message.js"' has no exported member 'Point'.
export type Point = import('/error/unknown:unist?from=vfile-message').Point
                                                                      ~~~~~
    at https://cdn.skypack.dev/-/vfile-message@v3.1.0-pPrDDqBkf5K1GBeD5q5L/dist=es2019,mode=types/index.d.ts:81:71

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Node'.
      | import('/error/unknown:unist?from=vfile').Node<import('/error/unknown:unist?from=vfile').Data>
                                                  ~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:136:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Position'.
      | import('/error/unknown:unist?from=vfile').Position
                                                  ~~~~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:137:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Point'.
      | import('/error/unknown:unist?from=vfile').Point
                                                  ~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:138:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Node'.
      | import('/error/unknown:unist?from=vfile').Node<import('/error/unknown:unist?from=vfile').Data>
                                                  ~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:155:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Position'.
      | import('/error/unknown:unist?from=vfile').Position
                                                  ~~~~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:156:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Point'.
      | import('/error/unknown:unist?from=vfile').Point
                                                  ~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:157:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Node'.
      | import('/error/unknown:unist?from=vfile').Node<import('/error/unknown:unist?from=vfile').Data>
                                                  ~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:175:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Position'.
      | import('/error/unknown:unist?from=vfile').Position
                                                  ~~~~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:176:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Point'.
      | import('/error/unknown:unist?from=vfile').Point
                                                  ~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:177:51

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Node'.
export type Node = import('/error/unknown:unist?from=vfile').Node
                                                             ~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:182:62

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Position'.
export type Position = import('/error/unknown:unist?from=vfile').Position
                                                                 ~~~~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:183:66

TS2694 [ERROR]: Namespace '"https://cdn.skypack.dev/error/unknown:unist?from=vfile.js"' has no exported member 'Point'.
export type Point = import('/error/unknown:unist?from=vfile').Point
                                                              ~~~~~
    at https://cdn.skypack.dev/-/vfile@v5.2.1-yvj38nmjXrpjntT9CT8v/dist=es2019,mode=types/lib/index.d.ts:184:63

TS2614 [ERROR]: Module '"https://cdn.skypack.dev/error/unknown:unist?from=unified.js"' has no exported member 'Node'. Did you mean to use 'import Node from "https://cdn.skypack.dev/error/unknown:unist?from=unified.js"' instead?
import {Node} from '/error/unknown:unist?from=unified'
        ~~~~
    at https://cdn.skypack.dev/-/unified@v10.1.1-QclwV7lcF6NTwReuY9uK/dist=es2019,mode=types/index.d.ts:16:9

Found 16 errors.
ericdmoore commented 2 years ago

I suspect the deno repl has less or no type checking since I am able to import via the repl.

Deno 1.19.0
exit using ctrl+d or close()
> import { unified } from 'https://cdn.skypack.dev/unified@10.1.1?dts'; console.log(unified);
Download https://cdn.skypack.dev/error/buffer?from=vfile
[Function: processor] {
  data: [Function: data],
  Parser: undefined,
  Compiler: undefined,
  freeze: [Function: freeze],
  attachers: [],
  use: [Function: use],
  parse: [Function: parse],
  stringify: [Function: stringify],
  run: [Function: run],
  runSync: [Function: runSync],
  process: [Function: process],
  processSync: [Function: processSync]
}