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

Upgrade Denofill to work with Deno 1.12.2 and deno_std 0.103.0 #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

WolfGangS
Copy link

@WolfGangS WolfGangS commented Aug 8, 2021

@kitsonk

I'd like to see about updating denofill.

You mentioned here ( denoland/std#641 (comment) ) that you would like to. But I assume that you have your hands full with the standard deno projects.

I have tried to keep the project as close to what it already was as possible.

All tests pass and it runs in my browser project at the moment.

Major Changes

  1. Included the errors.ts from the old deno/cli/js folder into this project as I could not find a good similar source for that info in cuurrent versions.
  2. Switched to using regular imports as they seem to work now.
  3. Moved imports to a deps.ts file as that seems to be the common way of doing this atm.
  4. Deno.build in teh polyfill now states it's os to be linux, this is due to libraries in deno_std failing if that is not a recognized value. And linuux seemed teh best fit.
  5. Extended the tests slightly to aslo check that denofill does not implement anything not present in the version of deno tested against.
  6. Added a Makefile and a script to dynamically generate the unstable keys for testing from the current deno version rather than a fixed list.

Minor Changes

  1. Added missing functions on deno, most just map to not implemented for now.
  2. Some possibly hacky changes to metrics, as in unstable that now specifies extra keys.

I'm more than happy to look at making changes per any suggestions maybe removing makefile and finding a more deno way of batching commands.

Errors fixed.

Trying to bundle or run with the current version results in the following errors (Deno 1.12.2 and deno_std 0.103.0)

error: TS2322 [ERROR]: Type '(value: T | PromiseLike<T>) => void' is not assignable to type 'ResolveFunction<T>'.
  Types of parameters 'value' and 'value' are incompatible.
    Type 'T | PromiseLike<T> | undefined' is not assignable to type 'T | PromiseLike<T>'.
      Type 'undefined' is not assignable to type 'T | PromiseLike<T>'.
    resolve = res;
    ~~~~~~~
    at https://raw.githubusercontent.com/denoland/deno/v1.1.0/cli/js/util.ts:56:5

TS2720 [ERROR]: Class 'File' incorrectly implements class 'Deno.File'. Did you mean to extend 'Deno.File' and inherit its members as a subclass?
  Type 'File' is missing the following properties from type 'File': truncate, truncateSync, stat, statSync
  class File implements Deno.File {
        ~~~~
    at https://deno.land/x/denofill@v0.1.2/mod.ts:290:9

TS2741 [ERROR]: Property 'ops' is missing in type '{ opsDispatched: number; opsDispatchedSync: number; opsDispatchedAsync: number; opsDispatchedAsyncUnref: number; opsCompleted: number; opsCompletedSync: number; opsCompletedAsync: number; opsCompletedAsyncUnref: number; bytesSentControl: number; bytesSentData: number; bytesReceived: number; }' but required in type 'Metrics'.
    return {
    ^
    at https://deno.land/x/denofill@v0.1.2/mod.ts:558:5

    'ops' is declared here.
        ops: Record<string, OpMetrics>;
        ~~~
        at asset:///lib.deno.unstable.d.ts:944:5

TS2724 [ERROR]: 'Deno' has no exported member named 'Version'. Did you mean 'version'?
  const version: Deno.Version = {
                      ~~~~~~~
    at https://deno.land/x/denofill@v0.1.2/mod.ts:582:23

Found 4 errors.

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

Successfully merging this pull request may close these issues.

2 participants