Prototype for a Deno to npm package build tool.

Related tags

GUI dnt
Overview

dnt - Deno to Node Transform

deno doc

Prototype for a Deno to npm package build tool.

What does this do?

It takes a Deno module and creates an npm package for use on Node.

There are several steps done in a pipeline:

  1. Transforms Deno code to Node/canonical TypeScript including files found by deno test.
    • Rewrites module specifiers.
    • Injects a Deno shim for any Deno namespace usages.
    • Rewrites Skypack and ESM specifiers to a bare specifier and includes these dependencies in a package.json.
    • When remote modules cannot be resolved to an npm package, it downloads them and rewrites specifiers to make them local.
    • Allows mapping any specifier to an npm package.
  2. Type checks the output.
  3. Emits ESM, CommonJS, and TypeScript declaration files along with a package.json file.
  4. Runs the final output in Node through a test runner running all Deno.test calls. Deletes the test files when complete.

Setup

// ex. scripts/build_npm.ts
import { build } from "https://deno.land/x/dnt/mod.ts";

await build({
  entryPoints: ["./mod.ts"],
  outDir: "./npm",
  typeCheck: true,
  declaration: true,
  test: true,
  package: {
    // package.json properties
    name: "my-package",
    version: Deno.args[0],
    description: "My package.",
    license: "MIT",
    repository: {
      type: "git",
      url: "git+https://github.com/dsherret/my-package.git",
    },
    bugs: {
      url: "https://github.com/dsherret/my-package/issues",
    },
  },
  // optional specifier to npm package mappings
  mappings: {
    "https://deno.land/x/[email protected]/mod.ts": {
      name: "code-block-writer",
      version: "^10.1.1",
    },
  },
});
# run script
deno run --allow-read --allow-write --allow-net --allow-run scripts/build_npm.ts 0.1.0

# go to output directory and publish
cd npm
npm publish

Example Build Logs

[dnt] Transforming...
[dnt] Running npm install...
[dnt] Building project...
[dnt] Type checking...
[dnt] Emitting declaration files...
[dnt] Emitting ESM package...
[dnt] Emitting CommonJS package...
[dnt] Running tests...

> test
> node test_runner.js

Running tests in ./umd/mod.test.js...

test escapeForWithinString ... ok
test escapeChar ... ok

Running tests in ./esm/mod.test.js...

test escapeForWithinString ... ok
test escapeChar ... ok
[dnt] Complete!

JS API Example

For only the Deno to canonical TypeScript transform which may be useful for bundlers, use the following:

// docs: https://doc.deno.land/https/deno.land/x/dnt/transform.ts
import { transform } from "https://deno.land/x/dnt/transform.ts";

const outputResult = await transform({
  entryPoints: ["./mod.ts"],
  testEntryPoints: ["./mod.test.ts"],
  shimPackageName: "deno.ns",
  // mappings: {}, // optional specifier mappings
});

Rust API Example

use std::path::PathBuf;

use deno_node_transform::ModuleSpecifier;
use deno_node_transform::transform;
use deno_node_transform::TransformOptions;

let output_result = transform(TransformOptions {
  entry_points: vec![ModuleSpecifier::from_file_path(PathBuf::from("./mod.ts")).unwrap()],
  test_entry_points: vec![ModuleSpecifier::from_file_path(PathBuf::from("./mod.test.ts")).unwrap()],
  shim_package_name: "deno.ns".to_string(),
  loader: None, // use the default loader
  specifier_mappings: None,
}).await?;
Comments
  • bug: `assertEquals` is not transpiled correctly

    bug: `assertEquals` is not transpiled correctly

    Description

    Node implements __proto__ and Deno does not. assertEquals relies on comparing string representations so it fails on Node but works on Deno.

    Repro

    1. Take this file
    import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
    
    let p = "__proto__";
    let o = {};
    (o as any)[p] = 0;
    assertEquals({ ["__proto__"]: 0 }, o);
    
    1. Use the build script from the README
    // ex. scripts/build_npm.ts
    import { build, emptyDir } from "https://deno.land/x/dnt/mod.ts";
    
    await emptyDir("./npm");
    
    await build({
      entryPoints: ["./mod.ts"],
      outDir: "./npm",
      shims: {
        // see JS docs for overview and more options
        deno: true,
      },
      package: {
        // package.json properties
        name: "your-package",
        version: Deno.args[0],
        description: "Your package.",
        license: "MIT",
        repository: {
          type: "git",
          url: "git+https://github.com/username/repo.git",
        },
        bugs: {
          url: "https://github.com/username/repo/issues",
        },
      },
    });
    
    1. Run deno run mod.ts and see how it works
    2. Run node npm and see how it throws:
    $ node npm
    /tmp/test/npm/script/deps/deno.land/[email protected]/testing/asserts.js:178
        throw new AssertionError(message);
        ^
    
    AssertionError: Values are not equal:
    
    
        [Diff] Actual / Expected
    
    
    -   {
    -     ['__proto__']: 0
    -   }
    +   {}
    
        at assertEquals (/tmp/test/npm/script/deps/deno.land/[email protected]/testing/asserts.js:178:11)
        at Object.<anonymous> (/tmp/test/npm/script/mod.js:7:31)
        at Module._compile (node:internal/modules/cjs/loader:1119:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
        at Module.load (node:internal/modules/cjs/loader:997:32)
        at Module._load (node:internal/modules/cjs/loader:838:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
        at node:internal/main/run_main_module:18:47
    
    Node.js v18.9.0
    
    opened by KnorpelSenf 13
  • GitHub installs from npm

    GitHub installs from npm

    I prefer to develop code for Deno and with Deno tooling, but more than 90 % of my users are consuming my library from npm. (I'm currently using deno2node.) I was looking into what a migration to dnt would mean. Since #57 I'm pretty sure the module would work perfectly on Node once I get the config right.

    However, it is a priority that Node users aren't second-class citizens. I don't want to have a much worse npm package in terms of tooling for my users, just because I'm natively targeting Deno. Here are a number of things that I believe to be worse when using dnt with all its magic to generate configuration files.

    Currently, apart from actual development, the npm package looks perfectly like it's native Node stuff. A lot of things would turn into magic from a Node point of view with a migration:

    1. No package.json in repo, so it doesn't look like a repo that contains code which would run on Node.
    2. No GitHub installs because of 1.
    3. You must know the concepts of Deno to understand that there can be TypeScript but no tsconfig.json file
    4. No npm scripts for running formatting, linting, building, etc. My current scripts are using deno fmt --config deno.json, so people would still need to have the CLI installed, but npm scripts often serve as landmarks to tell people how the repo works. If I'd use dnt, they'd need to know what Deno is, how to invoke the CLI of Deno with all the commands, and need to know the --config option.

    Basically, dnt may make the build output look like a Node module, but from a development point of view, people would have to have a fair bit of knowledge about Deno.

    For example, when people report a bug or request a feature, we'll implement it on a feature branch. We can now tell them to install the feature branch into their node_modules folder to try out if that's what they expected. They just need to run npm install grammyjs/grammY#feature-branch and they're good to go. Once they confirm, we can merge and everything's well tested. It would not be feasible to have them

    • install Deno
    • clone the repo
    • run the build script
    • npm link the build output into their other project

    just to try out a small fix.

    Do you have any ideas how to tackle these problems?

    opened by KnorpelSenf 10
  • dnt on WebSocket base project.

    dnt on WebSocket base project.

    I'm trying to convert a simple project from nodeJS to deno.

    Deno branch: chrome-remote-interface

    but building nodejs version give me those Errors:

    src/deps/deno.land/x/[email protected]/mod.ts:15:19 - error TS2304: Cannot find name 'WritableStreamDefaultWriter'.
    
    15   #globalWriters: WritableStreamDefaultWriter<Entry<E, keyof E>>[] = [];
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/deps/deno.land/x/[email protected]/mod.ts:17:22 - error TS2304: Cannot find name 'WritableStreamDefaultWriter'.
    
    17     [K in keyof E]?: WritableStreamDefaultWriter<E[K]>[];
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/deps/deno.land/x/[email protected]/mod.ts:65:42 - error TS2304: Cannot find name 'TransformStream'.
    
    65       const { readable, writable } = new TransformStream<E[K], E[K]>();
                                                ~~~~~~~~~~~~~~~
    src/deps/deno.land/x/[email protected]/mod.ts:140:14 - error TS2304: Cannot find name 'WritableStreamDefaultWriter'.
    
    140         ) as WritableStreamDefaultWriter<E[K]>[][]
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/deps/deno.land/x/[email protected]/mod.ts:193:40 - error TS2304: Cannot find name 'TransformStream'.
    
    193     const { readable, writable } = new TransformStream<
                                               ~~~~~~~~~~~~~~~
    src/lib/chrome.ts:165:27 - error TS2304: Cannot find name 'MessageEvent'.
    
    165     ws.onmessage = (data: MessageEvent) => {
                                  ~~~~~~~~~~~~
    src/lib/devtools.ts:65:46 - error TS2339: Property 'resolveDns' does not exist on type 'typeof Deno'.
    
    65         const [address] = await dntShim.Deno.resolveDns(u.hostname, "A");
                                                    ~~~~~~~~~~
    

    is https://deno.land/x/event have a dntShim? or can I use an alternative lib?

    how can I fix the Deno.resolveDns(hostname, "A");

    Just 2 mapping errors to fix.

    opened by UrielCh 7
  • Type checking regressions related to dom types upgrading from 0.22.0 to 0.24.0

    Type checking regressions related to dom types upgrading from 0.22.0 to 0.24.0

    I tried updating from 0.22.0 to 0.24.0 and get all sort of regression issues. Using the following build config:

    {
        entryPoints: ["./mod.ts"],
        outDir: "./npm",
        mappings: {
          "./http_server_native.ts": "./http_server_node.ts",
        },
        shims: {
          blob: true,
          crypto: true,
          deno: true,
          undici: true,
          custom: [{
            package: {
              name: "stream/web",
            },
            globalNames: ["ReadableStream", "TransformStream"],
          }, {
            module: "./node_shims.ts",
            globalNames: ["ErrorEvent"],
          }],
        },
        test: true,
        compilerOptions: {
          importHelpers: true,
          target: "ES2021",
        },
        package: {
          name: "@oakserver/oak",
          version: Deno.args[0],
          description: "A middleware framework for handling HTTP requests",
          license: "MIT",
          engines: {
            node: ">=16.5.0 <18",
          },
          repository: {
            type: "git",
            url: "git+https://github.com/oakserver/oak.git",
          },
          bugs: {
            url: "https://github.com/oakserver/oak/issues",
          },
          dependencies: {
            "tslib": "~2.3.1",
          },
          devDependencies: {
            "@types/node": "^16",
          },
        },
      }
    
    And get all sorts of type issues:
    npm/src/application.ts:76:11 - error TS2304: Cannot find name 'ErrorEventInit'.
    
    76   extends ErrorEventInit {
                 ~~~~~~~~~~~~~~
    npm/src/application.ts:76:11 - error TS4022: 'extends' clause of exported interface 'ApplicationErrorEventInit' has or is using private name 'ErrorEventInit'.
    
    76   extends ErrorEventInit {
                 ~~~~~~~~~~~~~~
    npm/src/application.ts:92:46 - error TS2304: Cannot find name 'EventInit'.
    
    92 interface ApplicationListenEventInit extends EventInit {
                                                    ~~~~~~~~~
    npm/src/application.ts:92:46 - error TS4022: 'extends' clause of exported interface 'ApplicationListenEventInit' has or is using private name 'EventInit'.
    
    92 interface ApplicationListenEventInit extends EventInit {
                                                    ~~~~~~~~~
    npm/src/application.ts:215:45 - error TS2304: Cannot find name 'Event'.
    
    215 export class ApplicationListenEvent extends Event {
                                                    ~~~~~
    npm/src/application.ts:215:45 - error TS4020: 'extends' clause of exported class 'ApplicationListenEvent' has or is using private name 'Event'.
    
    215 export class ApplicationListenEvent extends Event {
                                                    ~~~~~
    npm/src/application.ts:261:11 - error TS2304: Cannot find name 'EventTarget'.
    
    261   extends EventTarget {
                  ~~~~~~~~~~~
    npm/src/application.ts:261:11 - error TS4020: 'extends' clause of exported class 'Application' has or is using private name 'EventTarget'.
    
    261   extends EventTarget {
                  ~~~~~~~~~~~
    npm/src/application.ts:355:10 - error TS2339: Property 'dispatchEvent' does not exist on type 'Application<AS>'.
    
    355     this.dispatchEvent(new ApplicationErrorEvent({ context, message, error }));
                 ~~~~~~~~~~~~~
    npm/src/application.ts:355:61 - error TS2345: Argument of type '{ context: Context<AS, Record<string, any>>; message: any; error: any; }' is not assignable to parameter of type 'ApplicationErrorEventInit<AS, Record<string, any>>'.
      Object literal may only specify known properties, and 'message' does not exist in type 'ApplicationErrorEventInit<AS, Record<string, any>>'.
    
    355     this.dispatchEvent(new ApplicationErrorEvent({ context, message, error }));
                                                                    ~~~~~~~
    npm/src/application.ts:433:25 - error TS2304: Cannot find name 'AddEventListenerOptions'.
    
    433     options?: boolean | AddEventListenerOptions,
                                ~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/application.ts:433:25 - error TS4073: Parameter 'options' of public method from exported class has or is using private name 'AddEventListenerOptions'.
    
    433     options?: boolean | AddEventListenerOptions,
                                ~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/application.ts:440:25 - error TS2304: Cannot find name 'AddEventListenerOptions'.
    
    440     options?: boolean | AddEventListenerOptions,
                                ~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/application.ts:440:25 - error TS4073: Parameter 'options' of public method from exported class has or is using private name 'AddEventListenerOptions'.
    
    440     options?: boolean | AddEventListenerOptions,
                                ~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/application.ts:446:15 - error TS2304: Cannot find name 'EventListenerOrEventListenerObject'.
    
    446     listener: EventListenerOrEventListenerObject | null,
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/application.ts:447:25 - error TS2304: Cannot find name 'AddEventListenerOptions'.
    
    447     options?: boolean | AddEventListenerOptions,
                                ~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/application.ts:538:14 - error TS2339: Property 'addEventListener' does not exist on type 'AbortSignal'.
    
    538       signal.addEventListener("abort", () => {
                     ~~~~~~~~~~~~~~~~
    npm/src/application.ts:550:10 - error TS2339: Property 'dispatchEvent' does not exist on type 'Application<AS>'.
    
    550     this.dispatchEvent(
                 ~~~~~~~~~~~~~
    npm/src/application.ts:568:12 - error TS2339: Property 'dispatchEvent' does not exist on type 'Application<AS>'.
    
    568       this.dispatchEvent(
                   ~~~~~~~~~~~~~
    npm/src/application.ts:569:37 - error TS2345: Argument of type '{ message: string; error: any; }' is not assignable to parameter of type 'ApplicationErrorEventInit<State, State>'.
      Object literal may only specify known properties, and 'message' does not exist in type 'ApplicationErrorEventInit<State, State>'.
    
    569         new ApplicationErrorEvent({ message, error }),
                                            ~~~~~~~
    npm/src/body.ts:186:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    186 const decoder = new TextDecoder();
                            ~~~~~~~~~~~
    npm/src/body_test.ts:17:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    17 const decoder = new TextDecoder();
                           ~~~~~~~~~~~
    npm/src/buf_reader_test.ts:10:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    10 const decoder = new TextDecoder();
                           ~~~~~~~~~~~
    npm/src/content_disposition.ts:103:27 - error TS2304: Cannot find name 'TextDecoder'.
    
    103       const decoder = new TextDecoder(encoding, { fatal: true });
                                  ~~~~~~~~~~~
    npm/src/context.ts:67:13 - error TS2304: Cannot find name 'WebSocket'.
    
    67   #socket?: WebSocket;
                   ~~~~~~~~~
    npm/src/context.ts:108:17 - error TS2304: Cannot find name 'WebSocket'.
    
    108   get socket(): WebSocket | undefined {
                        ~~~~~~~~~
    npm/src/context.ts:108:17 - error TS4043: Return type of public getter 'socket' from exported class has or is using private name 'WebSocket'.
    
    108   get socket(): WebSocket | undefined {
                        ~~~~~~~~~
    npm/src/context.ts:233:47 - error TS2304: Cannot find name 'WebSocket'.
    
    233   upgrade(options?: UpgradeWebSocketOptions): WebSocket {
                                                      ~~~~~~~~~
    npm/src/context.ts:233:47 - error TS4055: Return type of public method from exported class has or is using private name 'WebSocket'.
    
    233   upgrade(options?: UpgradeWebSocketOptions): WebSocket {
                                                      ~~~~~~~~~
    npm/src/context_test.ts:66:29 - error TS2304: Cannot find name 'WebSocket'.
    
    66 const mockWebSocket = {} as WebSocket;
                                   ~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/encoding/base64.ts:78:11 - error TS2304: Cannot find name 'TextEncoder'.
    
    78     ? new TextEncoder().encode(data)
                 ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/buffer.ts:470:16 - error TS2304: Cannot find name 'TextDecoder'.
    
    470     return new TextDecoder().decode(buffer);
                       ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/buffer.ts:986:23 - error TS2304: Cannot find name 'TextEncoder'.
    
    986   const encoder = new TextEncoder();
                              ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/buffer.ts:987:23 - error TS2304: Cannot find name 'TextDecoder'.
    
    987   const decoder = new TextDecoder(decoderOpts?.encoding, decoderOpts);
                              ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/buffer.ts:1004:23 - error TS2304: Cannot find name 'TextDecoder'.
    
    1004   const decoder = new TextDecoder(decoderOpts?.encoding, decoderOpts);
                               ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/readers.ts:14:15 - error TS2304: Cannot find name 'TextEncoder'.
    
    14     super(new TextEncoder().encode(s).buffer);
                     ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/writers.ts:6:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    6 const decoder = new TextDecoder();
                          ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/writers.ts:15:19 - error TS2304: Cannot find name 'TextEncoder'.
    
    15     const c = new TextEncoder().encode(base);
                         ~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/io/writers.ts:42:5 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
      Type 'undefined' is not assignable to type 'string'.
    
    42     return this.#cache;
           ~~~~~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:67:17 - error TS2304: Cannot find name 'WritableStreamDefaultWriter'.
    
    67   streamWriter: WritableStreamDefaultWriter<Uint8Array>,
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:67:17 - error TS4078: Parameter 'streamWriter' of exported function has or is using private name 'WritableStreamDefaultWriter'.
    
    67   streamWriter: WritableStreamDefaultWriter<Uint8Array>,
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:80:17 - error TS2304: Cannot find name 'ReadableStreamDefaultReader'.
    
    80   streamReader: ReadableStreamDefaultReader<Uint8Array>,
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:80:17 - error TS4078: Parameter 'streamReader' of exported function has or is using private name 'ReadableStreamDefaultReader'.
    
    80   streamReader: ReadableStreamDefaultReader<Uint8Array>,
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:113:4 - error TS2304: Cannot find name 'WritableStream'.
    
    113 ): WritableStream<Uint8Array> {
           ~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:113:4 - error TS4060: Return type of exported function has or is using private name 'WritableStream'.
    
    113 ): WritableStream<Uint8Array> {
           ~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:116:14 - error TS2304: Cannot find name 'WritableStream'.
    
    116   return new WritableStream({
                     ~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:117:17 - error TS7006: Parameter 'chunk' implicitly has an 'any' type.
    
    117     async write(chunk, controller) {
                        ~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:117:24 - error TS7006: Parameter 'controller' implicitly has an 'any' type.
    
    117     async write(chunk, controller) {
                               ~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:226:22 - error TS2304: Cannot find name 'QueuingStrategy'.
    
    226   writableStrategy?: QueuingStrategy<I>,
                             ~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:226:22 - error TS4078: Parameter 'writableStrategy' of exported function has or is using private name 'QueuingStrategy'.
    
    226   writableStrategy?: QueuingStrategy<I>,
                             ~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:227:22 - error TS2304: Cannot find name 'QueuingStrategy'.
    
    227   readableStrategy?: QueuingStrategy<O>,
                             ~~~~~~~~~~~~~~~
    npm/src/deps/deno.land/[email protected]/streams/conversion.ts:227:22 - error TS4078: Parameter 'readableStrategy' of exported function has or is using private name 'QueuingStrategy'.
    
    227   readableStrategy?: QueuingStrategy<O>,
                             ~~~~~~~~~~~~~~~
    npm/src/etag.ts:45:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    45 const encoder = new TextEncoder();
                           ~~~~~~~~~~~
    npm/src/etag.ts:56:74 - error TS2345: Argument of type 'string | Uint8Array' is not assignable to parameter of type 'BufferSource'.
      Type 'string' is not assignable to type 'BufferSource'.
    
    56   const hash = base64.encode(await dntShim.crypto.subtle.digest("SHA-1", entity))
                                                                                ~~~~~~
    npm/src/etag_test.ts:41:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    41 const encoder = new TextEncoder();
                           ~~~~~~~~~~~
    npm/src/headers.ts:10:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    10 const decoder = new TextDecoder();
                           ~~~~~~~~~~~
    npm/src/headers_test.ts:33:22 - error TS2304: Cannot find name 'TextEncoder'.
    
    33       new Buffer(new TextEncoder().encode(fixture)),
                            ~~~~~~~~~~~
    npm/src/headers_test.ts:42:11 - error TS2304: Cannot find name 'TextDecoder'.
    
    42       new TextDecoder().decode((await body.readLine())?.bytes),
                 ~~~~~~~~~~~
    npm/src/http_server_native_request.ts:130:47 - error TS2304: Cannot find name 'WebSocket'.
    
    130   upgrade(options?: UpgradeWebSocketOptions): WebSocket {
                                                      ~~~~~~~~~
    npm/src/http_server_native_request.ts:130:47 - error TS4055: Return type of public method from exported class has or is using private name 'WebSocket'.
    
    130   upgrade(options?: UpgradeWebSocketOptions): WebSocket {
                                                      ~~~~~~~~~
    npm/src/middleware/proxy_test.ts:12:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    12 const decoder = new TextDecoder();
                           ~~~~~~~~~~~
    npm/src/multipart.ts:12:21 - error TS2304: Cannot find name 'TextDecoder'.
    
    12 const decoder = new TextDecoder();
                           ~~~~~~~~~~~
    npm/src/multipart.ts:13:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    13 const encoder = new TextEncoder();
                           ~~~~~~~~~~~
    npm/src/multipart_test.ts:20:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    20 const encoder = new TextEncoder();
                           ~~~~~~~~~~~
    npm/src/node_shims.ts:3:33 - error TS2304: Cannot find name 'Event'.
    
    3 export class ErrorEvent extends Event {
                                      ~~~~~
    npm/src/node_shims.ts:3:33 - error TS4020: 'extends' clause of exported class 'ErrorEvent' has or is using private name 'Event'.
    
    3 export class ErrorEvent extends Event {
                                      ~~~~~
    npm/src/node_shims.ts:28:44 - error TS2304: Cannot find name 'ErrorEventInit'.
    
    28   constructor(type: string, eventInitDict: ErrorEventInit = {}) {
                                                  ~~~~~~~~~~~~~~
    npm/src/node_shims.ts:28:44 - error TS4063: Parameter 'eventInitDict' of constructor from exported class has or is using private name 'ErrorEventInit'.
    
    28   constructor(type: string, eventInitDict: ErrorEventInit = {}) {
                                                  ~~~~~~~~~~~~~~
    npm/src/range.ts:99:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    99 const encoder = new TextEncoder();
                           ~~~~~~~~~~~
    npm/src/range_test.ts:81:25 - error TS2304: Cannot find name 'TextEncoder'.
    
    81     const content = new TextEncoder().encode("hello deno");
                               ~~~~~~~~~~~
    npm/src/range_test.ts:91:25 - error TS2304: Cannot find name 'TextEncoder'.
    
    91     const content = new TextEncoder().encode("hello deno");
                               ~~~~~~~~~~~
    npm/src/range_test.ts:148:25 - error TS2304: Cannot find name 'TextEncoder'.
    
    148     const encoder = new TextEncoder();
                                ~~~~~~~~~~~
    npm/src/range_test.ts:162:25 - error TS2304: Cannot find name 'TextDecoder'.
    
    162     const decoder = new TextDecoder();
                                ~~~~~~~~~~~
    npm/src/range_test.ts:175:25 - error TS2304: Cannot find name 'TextEncoder'.
    
    175     const encoder = new TextEncoder();
                                ~~~~~~~~~~~
    npm/src/range_test.ts:189:25 - error TS2304: Cannot find name 'TextDecoder'.
    
    189     const decoder = new TextDecoder();
                                ~~~~~~~~~~~
    npm/src/response_test.ts:122:25 - error TS2304: Cannot find name 'TextEncoder'.
    
    122     response.body = new TextEncoder().encode("Hello world!");
                                ~~~~~~~~~~~
    npm/src/server_sent_event.ts:8:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    8 const encoder = new TextEncoder();
                          ~~~~~~~~~~~
    npm/src/server_sent_event.ts:12:46 - error TS2304: Cannot find name 'EventInit'.
    
    12 export interface ServerSentEventInit extends EventInit {
                                                    ~~~~~~~~~
    npm/src/server_sent_event.ts:12:46 - error TS4022: 'extends' clause of exported interface 'ServerSentEventInit' has or is using private name 'EventInit'.
    
    12 export interface ServerSentEventInit extends EventInit {
                                                    ~~~~~~~~~
    npm/src/server_sent_event.ts:41:26 - error TS2304: Cannot find name 'Event'.
    
    41 class CloseEvent extends Event {
                                ~~~~~
    npm/src/server_sent_event.ts:41:26 - error TS4020: 'extends' clause of exported class 'CloseEvent' has or is using private name 'Event'.
    
    41 class CloseEvent extends Event {
                                ~~~~~
    npm/src/server_sent_event.ts:42:26 - error TS2304: Cannot find name 'EventInit'.
    
    42   constructor(eventInit: EventInit) {
                                ~~~~~~~~~
    npm/src/server_sent_event.ts:42:26 - error TS4063: Parameter 'eventInit' of constructor from exported class has or is using private name 'EventInit'.
    
    42   constructor(eventInit: EventInit) {
                                ~~~~~~~~~
    npm/src/server_sent_event.ts:72:38 - error TS2304: Cannot find name 'Event'.
    
    72 export class ServerSentEvent extends Event {
                                            ~~~~~
    npm/src/server_sent_event.ts:72:38 - error TS4020: 'extends' clause of exported class 'ServerSentEvent' has or is using private name 'Event'.
    
    72 export class ServerSentEvent extends Event {
                                            ~~~~~
    npm/src/server_sent_event.ts:135:48 - error TS2304: Cannot find name 'EventTarget'.
    
    135 export interface ServerSentEventTarget extends EventTarget {
                                                       ~~~~~~~~~~~
    npm/src/server_sent_event.ts:135:48 - error TS4022: 'extends' clause of exported interface 'ServerSentEventTarget' has or is using private name 'EventTarget'.
    
    135 export interface ServerSentEventTarget extends EventTarget {
                                                       ~~~~~~~~~~~
    npm/src/server_sent_event.ts:217:38 - error TS2304: Cannot find name 'EventTarget'.
    
    217 export class SSEStreamTarget extends EventTarget
                                             ~~~~~~~~~~~
    npm/src/server_sent_event.ts:217:38 - error TS4020: 'extends' clause of exported class 'SSEStreamTarget' has or is using private name 'EventTarget'.
    
    217 export class SSEStreamTarget extends EventTarget
                                             ~~~~~~~~~~~
    npm/src/server_sent_event.ts:221:17 - error TS2304: Cannot find name 'ReadableStreamDefaultController'.
    
    221   #controller?: ReadableStreamDefaultController<Uint8Array>;
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/server_sent_event.ts:233:23 - error TS2339: Property 'dispatchEvent' does not exist on type 'Application<Record<string, any>>'.
    
    233     this.#context.app.dispatchEvent(errorEvent);
                              ~~~~~~~~~~~~~
    npm/src/server_sent_event.ts:285:10 - error TS2339: Property 'addEventListener' does not exist on type 'SSEStreamTarget'.
    
    285     this.addEventListener("close", () => {
                 ~~~~~~~~~~~~~~~~
    npm/src/server_sent_event_test.ts:26:18 - error TS2304: Cannot find name 'EventTarget'.
    
    26   appTarget: new EventTarget(),
                        ~~~~~~~~~~~
    npm/src/server_sent_event_test.ts:34:23 - error TS2304: Cannot find name 'EventTarget'.
    
    34   env.appTarget = new EventTarget();
                             ~~~~~~~~~~~
    npm/src/server_sent_event_test.ts:38:6 - error TS7006: Parameter 'evt' implicitly has an 'any' type.
    
    38     (evt) => {
            ~~~
    npm/src/server_sent_event_test.ts:59:22 - error TS2339: Property 'type' does not exist on type 'ServerSentEvent'.
    
    59     assertEquals(evt.type, "message");
                            ~~~~
    npm/src/server_sent_event_test.ts:70:22 - error TS2339: Property 'type' does not exist on type 'ServerSentEvent'.
    
    70     assertEquals(evt.type, "ping");
                            ~~~~
    npm/src/server_sent_event_test.ts:81:22 - error TS2339: Property 'type' does not exist on type 'ServerSentEvent'.
    
    81     assertEquals(evt.type, "ping");
                            ~~~~
    npm/src/server_sent_event_test.ts:95:22 - error TS2339: Property 'type' does not exist on type 'ServerSentEvent'.
    
    95     assertEquals(evt.type, "ping");
                            ~~~~
    npm/src/server_sent_event_test.ts:108:22 - error TS2339: Property 'type' does not exist on type 'ServerSentEvent'.
    
    108     assertEquals(evt.type, "__message");
                             ~~~~
    npm/src/server_sent_event_test.ts:236:9 - error TS2339: Property 'addEventListener' does not exist on type 'SSEStreamTarget'.
    
    236     sse.addEventListener("close", () => {
                ~~~~~~~~~~~~~~~~
    npm/src/server_sent_event_test.ts:239:9 - error TS2339: Property 'addEventListener' does not exist on type 'SSEStreamTarget'.
    
    239     sse.addEventListener("error", () => {
                ~~~~~~~~~~~~~~~~
    npm/src/structured_clone.ts:142:17 - error TS2304: Cannot find name 'DOMException'.
    
    142       throw new DOMException("Uncloneable value in stream", "DataCloneError");
                        ~~~~~~~~~~~~
    npm/src/types.d.d.ts:94:48 - error TS2304: Cannot find name 'WebSocket'.
    
    94   upgrade?(options?: UpgradeWebSocketOptions): WebSocket;
                                                      ~~~~~~~~~
    npm/src/types.d.d.ts:120:11 - error TS2304: Cannot find name 'WebSocket'.
    
    120   socket: WebSocket;
                  ~~~~~~~~~
    npm/src/util.ts:378:21 - error TS2304: Cannot find name 'TransformStreamDefaultController'.
    
    378         controller: TransformStreamDefaultController<Uint8Array>,
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm/src/util.ts:420:20 - error TS2304: Cannot find name 'TextEncoder'.
    
    420       encoder: new TextEncoder(),
                           ~~~~~~~~~~~
    npm/src/util.ts:432:21 - error TS2304: Cannot find name 'TextEncoder'.
    
    432 const encoder = new TextEncoder();
                            ~~~~~~~~~~~
    npm/src/util.ts:448:10 - error TS2769: No overload matches this call.
      Overload 1 of 2, '(format: "jwk", keyData: JsonWebKey, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<...>', gave the following error.
        Argument of type '"raw"' is not assignable to parameter of type '"jwk"'.
      Overload 2 of 2, '(format: "raw" | "spki" | "pkcs8", keyData: BufferSource, algorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams | AesKeyAlgorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<...>', gave the following error.
        Argument of type 'Key' is not assignable to parameter of type 'BufferSource'.
          Type 'string' is not assignable to type 'BufferSource'.
    
    448   return dntShim.crypto.subtle.importKey(
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    449     "raw",
        ~~~~~~~~~~
    ... 
    456     ["sign", "verify"],
        ~~~~~~~~~~~~~~~~~~~~~~~
    457   );
        ~~~
    
    npm/src/util.ts:466:50 - error TS2345: Argument of type 'Data' is not assignable to parameter of type 'BufferSource'.
      Type 'string' is not assignable to type 'BufferSource'.
    
    466   return dntShim.crypto.subtle.sign("HMAC", key, data);
                                                         ~~~~
    
    

    I'm not sure what has changed... it is non-obvious to me.

    opened by kitsonk 6
  • Comparison to deno2node

    Comparison to deno2node

    There are already existing working solutions for this problem, I am mainly aware of deno2node.

    Can you explain if you have any objections regarding that project, and outline what advantages you're aiming for?

    opened by KnorpelSenf 6
  • Upgrading from 0.30.0 to 0.31.0 breaks webpack

    Upgrading from 0.30.0 to 0.31.0 breaks webpack

    We've encountered that upgrading to the latest release causes problems downstream in our React/Webpack setup.

    Creating an optimized production build...
    Failed to compile.
    
    Module not found: Error: Default condition should be last one
    

    This looks related to PR #221

    Downgrading back to 0.30.0 makes everything work again.

    bug 
    opened by suneg 5
  • `@types/node` not recognized

    `@types/node` not recognized

    {
      packageManager: 'pnpm',
      scriptModule: false,
      test: false,
      entryPoints: ['./mod.ts'],
      outDir: './npm',
      shims: {},
      compilerOptions: {
        target: "ES2021",
      },
      package: {
        name: '@itchatapp/migrations',
        version: Deno.args[0].replace(/[A-Z]+/gi, ''),
        description: 'migrations module for itchat',
        license: 'MIT',
        devDependencies: {
          "@types/node": "16.x",
        },
        repository: {
          type: 'git',
          url: 'git+https://github.com/itchatapp/migrations.git',
        },
        bugs: {
          url: 'https://github.com/itchatapp/migrations/issues',
        },
        engines: {
          node: '>=16.0.0',
        },
        files: [
          'esm/*',
          'types/*',
        ],
      },
    }
    
    Logs:
    [dnt] Transforming...
    [dnt] Running pnpm install...
    Packages: +1
    +
    Packages are cloned from the content-addressable store to the virtual store.
      Content-addressable store is at: /home/abdulrahman/.local/share/pnpm/store/v3
      Virtual store is at:             node_modules/.pnpm
    Progress: resolved 1, reused 1, downloaded 0, added 1, done
    
    devDependencies:
    + @types/node 16.11.37 (17.0.38 is available)
    [dnt] Building project...
    [dnt] Type checking...
    npm/src/src/lib.ts:1:22 - error TS2307: Cannot find module 'path' or its corresponding type declarations.
    
    1 import { join } from 'path';
                           ~~~~~~
    npm/src/src/lib.ts:2:16 - error TS2307: Cannot find module 'fs' or its corresponding type declarations.
    
    2 import fs from 'fs';
                     ~~~~
    npm/src/src/lib.ts:18:14 - error TS7006: Parameter 'x' implicitly has an 'any' type.
    
    18     .filter((x) =>
                    ~
    npm/src/src/lib.ts:22:11 - error TS7006: Parameter 'x' implicitly has an 'any' type.
    
    22     .map((x) => ({
                 ~
    
    error: Uncaught (in promise) Error: Had 4 diagnostics.
          throw new Error(`Had ${diagnostics.length} diagnostics.`);
    

    version: 0.24.0 (I also tried 0.23.0 and 0.22.0 all of them the same result)

    bug 
    opened by abdulrahman1s 5
  • Support for import-map

    Support for import-map

    I'm building a library of multiple packages under /modules folder, called Baseless. I've both configured an importmap.json while developing to redirect import to the local version. Everything works fine with the Deno CLI and with VSCode.

    Is there a way to specify the path to my import map to build?

    enhancement 
    opened by grenierdev 5
  • Bug: `undici` shim breaks

    Bug: `undici` shim breaks

    The undici shim fails to install.

    Steps to Reproduce:

    1. Build a file that uses fetch with the snippet in the README, plus undici shim.
    2. Observe

    Expected Behavior: It builds.

    Actual Behavior: Won't build. Lots of errors about Node packages not being found.

    Workarounds: Via this custom shim, but it will put @types/node as a full dependency:

    custom: [
      {
        typesPackage: { name: "@types/node", version: "17.0.24" },
        package: { name: "@types/node", version: "17.0.24" },
        globalNames: [],
      },
    ],
    

    System Details
    • MacBook Pro 2020 M1 (ARM64)
    • macOS Big Sur 11.6.5
    • Deno 1.20.4
    • v8 10.0.139.6
    • TypeScript 4.6.2
    • dnt 0.23.0
    question 
    opened by andre4ik3 4
  • Targeted shimming

    Targeted shimming

    Right now the shim is too broad, for example #36 and the shim being injected for something like setTimeout and setInterval. It is also not ideal for any package that uses the shim to have to depend on undici because of deno.ns.

    1. We should probably only use deno.ns for the deno namespace shimming and everything else can be injected into the build output based on if it's used.
    2. Maybe instead of having deno.ns as a dependency of the output, we could analyze which parts of the Deno namespace are used and then bundle those parts in the final output.
    enhancement 
    opened by dsherret 4
  • Usage of Deno Namespace-using DNT-built modules in NextJS App

    Usage of Deno Namespace-using DNT-built modules in NextJS App

    Conditions:

    • I'm using the Deno namespace for innocuous things. Deno.inspect, the std lib's assert, misc.
    • I'm building the pkg with DNT using the following configuration.
    Config
    {
      entryPoints: ["mod.ts", {
        name: "./fluent",
        path: "fluent/mod.ts",
      }, {
        name: "./test-util",
        path: "test-util/mod.ts",
      }, {
        name: "./frame_metadata",
        path: "frame_metadata/mod.ts",
      }, {
        name: "./config",
        path: "config/mod.ts",
      }, {
        name: "./known",
        path: "known/mod.ts",
      }, {
        name: "./rpc",
        path: "rpc/mod.ts",
      }],
      outDir,
      package: {
        name: "capi",
        version: Deno.args[0]!,
        license: "Apache-2.0",
      },
      compilerOptions: {
        lib: ["dom", "es2021"],
        importHelpers: true,
        sourceMap: true,
        target: "ES2021",
      },
      scriptModule: "cjs",
      shims: {
        deno: {
          test: true,
        },
        webSocket: true,
      },
      test: false,
      typeCheck: false,
    }
    
    • I'm attempting to use the (successfully built) DNT pkg in a NextJS application

    This results in the following error:

    error - ./node_modules/@deno/shim-deno/dist/deno/internal/fs_flags.js:29:0
    Module not found: Can't resolve 'fs'
    
    Import trace for requested module:
    ./node_modules/@deno/shim-deno/dist/deno/stable/functions/open.js
    ./node_modules/@deno/shim-deno/dist/deno/stable/functions.js
    ./node_modules/@deno/shim-deno/dist/deno/stable/main.js
    ./node_modules/@deno/shim-deno/dist/deno.js
    ./node_modules/@deno/shim-deno/dist/index.js
    ./node_modules/parity-scale-codec/esm/_dnt.shims.js
    ./node_modules/parity-scale-codec/esm/constantPattern/codec.js
    ./node_modules/parity-scale-codec/esm/mod.js
    ./node_modules/capi/esm/_deps/scale.js
    ./node_modules/capi/esm/mod.js
    ./state/atoms/metadata.ts
    ./components/search/SearchActions.tsx
    ./components/search/SearchContext.tsx
    ./pages/_app.tsx
    
    https://nextjs.org/docs/messages/module-not-found
    

    This does not change when I get rid of the dependency on the std lib's assert.

    Any tips on getting this working would be greatly appreciated. Thank you!

    opened by harrysolovay 3
  • Allow CJS to expose the default export with `require(...)` instead of `require(...).default`

    Allow CJS to expose the default export with `require(...)` instead of `require(...).default`

    Hi, I've been trying to migrate the TinyColor library to use Deno and cross compile to Node (CJS and ESM). It's all working fine (https://github.com/bgrins/TinyColor/pull/241), except for one problem:

    The generated CJS exports the object on default when requiring (https://github.com/bgrins/TinyColor/blob/bcfcd1d49181a45fab2dd1858ef22890adba1809/npm/script/mod.js#L50) such that to access it I need to do var tinycolor = require("tinycolor2").default whereas the current behavior and external API works like var tinycolor = require("tinycolor2");. I don't want to change the existing API as the library is used by a lot of people - is there a way to change the output from dnt to match the current behavior?

    My best guess was that it's the esModuleInterop option at https://github.com/denoland/dnt/blob/main/mod.ts#L348 which is causing this behavior, but the generated test output also expects to pull the object out of .default so maybe there would need to be more changes as well.

    opened by bgrins 1
  • support `file://` path?

    support `file://` path?

    import { build } from "https://deno.land/x/[email protected]/mod.ts";
    
    await build({
      entryPoints: [import.meta.resolve("./main.ts")],
      outDir: import.meta.resolve("./dist/"),
      package: {
        name: "my-package",
        version: "1.0.0",
      },
      shims: {},
    });
    

    output

    error: Uncaught (in promise) 'Module not found "file:///C:/Users/narum/Documents/GitHub/definy/deno-lib/file:/C:/Users/narum/Documents/GitHub/definy/deno-lib/main.ts".'
    

    By using import.meta.resolve, you can specify a path relative from the file containing this script, whatever the current directory is.

    This is the same as path.resolve(__dirname, 'dist') as often seen in webpack.config.js.

    If it is difficult to distinguish between relative and absolute paths, you could use this behavior only when received as a URL

    await build({
      entryPoints: [new URL(import.meta.resolve("./main.ts"))],
      outDir: new URL(import.meta.resolve("./dist/")),
      package: {
        name: "my-package",
        version: "1.0.0",
      },
      shims: {},
    });
    
    opened by narumincho 0
  • Support for pinned ESM modules?

    Support for pinned ESM modules?

    Hi 👋.

    Firstly, thanks so much for making this awesome tool! This may not be something in your power to address, but I thought I'd create a ticket since there doesn't yet seem to be one on the topic of version pinning within the ESM CDN.

    So for context, I recently discovered that the latest version of ESM (v96) has a regression that breaks support for the graphql module, which I've just now reported here:

    • https://github.com/ije/esm.sh/issues/437

    I can fix the tests by pinning the version back to v95 (achieved by adding a ?pin=v95 suffix to the ESModule URL) however, but doing this causes my build to fail with the following error:

    panicked at 'dnt bug - Could not find mapping for types code specifier https://esm.sh/v95/[email protected]/error/GraphQLError.d.ts', rs-lib\src\mappings.rs:97:9
    

    Any thoughts / suggestions here would be very much appreciated?

    opened by dchambers 0
  • 1.0 Release

    1.0 Release

    Even though the README claims that this tool is under “active early development,” there have not been any commits for almost two months.

    What is necessary for dnt to be considered stable?

    question 
    opened by KnorpelSenf 2
  • Stack overflow when emitting ESM package

    Stack overflow when emitting ESM package

    Steps to reproduce:

    1. Check out this commit: https://github.com/NfNitLoop/feoblog-client/commit/ba0de8f73f47f726307edae5a90006e00d5e52d1
    2. run deno task build-npm

    Output:

    PS C:\Users\Cody\code\feoblog-client> deno task build-npm
    Warning deno task is unstable and may drastically change in the future
    Task build-npm deno run -A ./build/npm.ts
    [dnt] Transforming...
    [dnt] Running npm install...
    
    added 12 packages, and audited 13 packages in 3s
    
    2 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities
    [dnt] Building project...
    [dnt] Emitting declaration files...
    [dnt] Emitting ESM package...
    error: Uncaught (in promise) RangeError: Maximum call stack size exceeded
        function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor, nodeVisitor) {
                               ^
        at Object.visitEachChild (https://deno.land/x/[email protected]/common/typescript.js:89515:28)
        at visitorWorker (https://deno.land/x/[email protected]/common/typescript.js:94391:23)
        at visitor (https://deno.land/x/[email protected]/common/typescript.js:94397:20)
        at visitNode (https://deno.land/x/[email protected]/common/typescript.js:89313:23)
        at Object.visitEachChild (https://deno.land/x/[email protected]/common/typescript.js:89735:61)
        at visitorWorker (https://deno.land/x/[email protected]/common/typescript.js:94391:23)
        at visitor (https://deno.land/x/[email protected]/common/typescript.js:94397:20)
        at visitNode (https://deno.land/x/[email protected]/common/typescript.js:89313:23)
        at Object.visitEachChild (https://deno.land/x/[email protected]/common/typescript.js:89735:61)
        at visitorWorker (https://deno.land/x/[email protected]/common/typescript.js:94391:23)
    
    bug 
    opened by NfNitLoop 2
Releases(0.32.1)
  • 0.32.1(Dec 19, 2022)

    What's Changed

    • fix: exports types resolution in package.json and Webpack compatibility @Macil in https://github.com/denoland/dnt/pull/237

    If you are distributing an esm module or mixed cjs/esm module or package with exports, then please upgrade to this version so the types get resolved correctly and so that your package works with webpack.

    New Contributors

    • @Macil made their first contribution in https://github.com/denoland/dnt/pull/237

    Full Changelog: https://github.com/denoland/dnt/compare/0.32.0...0.32.1

    Source code(tar.gz)
    Source code(zip)
  • 0.32.0(Nov 23, 2022)

    What's Changed

    • feat: add more node module map by @Gaubee in https://github.com/denoland/dnt/pull/227
    • feat: add npm: specifier imports by @kingsword09 in https://github.com/denoland/dnt/pull/232
    • Update docs for multiple entry points by @malinowskip in https://github.com/denoland/dnt/pull/231
    • feat: upgrade dependencies by @dsherret in https://github.com/denoland/dnt/pull/234

    New Contributors

    • @kingsword09 made their first contribution in https://github.com/denoland/dnt/pull/232
    • @malinowskip made their first contribution in https://github.com/denoland/dnt/pull/231

    Full Changelog: https://github.com/denoland/dnt/compare/0.31.0...0.32.0

    Source code(tar.gz)
    Source code(zip)
  • 0.31.0(Sep 26, 2022)

    What's Changed

    • feat: add emitDecoratorMetadata compiler option by @Gaubee in https://github.com/denoland/dnt/pull/217
    • feat: upgrade deps including @deno/shim-deno to 0.10 by @dsherret in https://github.com/denoland/dnt/pull/219
    • fix: support NO_COLOR for ts diagnostics by @dsherret in https://github.com/denoland/dnt/pull/220
    • fix: correct exports in package.json by @dsherret in https://github.com/denoland/dnt/pull/221
    • fix: ensure test context's name is set by @dsherret in https://github.com/denoland/dnt/pull/222
    • fix: transform import types by @dsherret in https://github.com/denoland/dnt/pull/224
    • fix: transform specifiers in module declarations by @dsherret in https://github.com/denoland/dnt/pull/225

    New Contributors

    • @Gaubee made their first contribution in https://github.com/denoland/dnt/pull/217

    Full Changelog: https://github.com/denoland/dnt/compare/0.30.0...0.31.0

    Source code(tar.gz)
    Source code(zip)
  • 0.30.0(Aug 4, 2022)

    What's Changed

    • fix: do not panic for removed comment at top of the file when injecting shim https://github.com/denoland/dnt/pull/203
    • feat: update @deno/shim-deno to 0.9.0 https://github.com/denoland/dnt/pull/204

    Full Changelog: https://github.com/denoland/dnt/compare/0.29.1...0.30.0

    Source code(tar.gz)
    Source code(zip)
  • 0.29.1(Jul 29, 2022)

    What's Changed

    • fix: do not use exports for cjs only package by @dsherret in https://github.com/denoland/dnt/pull/200

    Full Changelog: https://github.com/denoland/dnt/compare/0.29.0...0.29.1

    Source code(tar.gz)
    Source code(zip)
  • 0.29.0(Jul 26, 2022)

    What's Changed

    • feat: upgrade for deno 1.24 https://github.com/denoland/dnt/pull/197
    • feat: add postBuild action https://github.com/denoland/dnt/pull/198

    Full Changelog: https://github.com/denoland/dnt/compare/0.28.0...0.29.0

    Source code(tar.gz)
    Source code(zip)
  • 0.28.0(Jul 6, 2022)

    What's Changed

    • feat: add esModule option by @roj1512 in https://github.com/denoland/dnt/pull/190

    Full Changelog: https://github.com/denoland/dnt/compare/0.27.0...0.28.0

    Source code(tar.gz)
    Source code(zip)
  • 0.27.0(Jun 28, 2022)

    What's Changed

    • feat: add skipLibCheck option and enable by default by @roj1512 in https://github.com/denoland/dnt/pull/183
    • fix: handle unversioned skypack or esm.sh specifiers by not mapping them https://github.com/denoland/dnt/pull/184

    New Contributors

    • @roj1512 made their first contribution in https://github.com/denoland/dnt/pull/183

    Full Changelog: https://github.com/denoland/dnt/compare/0.26.0...0.27.0

    Source code(tar.gz)
    Source code(zip)
  • 0.26.0(Jun 15, 2022)

    What's Changed

    • feat: support peer dependencies in mappings https://github.com/denoland/dnt/pull/175
    • chore: upgrade deno_std to 0.143 https://github.com/denoland/dnt/pull/176

    Full Changelog: https://github.com/denoland/dnt/compare/0.25.3...0.26.0

    Source code(tar.gz)
    Source code(zip)
  • 0.25.3(Jun 13, 2022)

    What's Changed

    • fix: upgrade undici shim from 5.3.0 to 5.5.1 https://github.com/denoland/dnt/pull/174
      • Undici >= v4.8.2 <= 5.5.0 had a MITM vulnerability: https://github.com/nodejs/undici/security/advisories/GHSA-pgw7-wx7w-2w33

    Full Changelog: https://github.com/denoland/dnt/compare/0.25.2...0.25.3

    Source code(tar.gz)
    Source code(zip)
  • 0.25.2(Jun 6, 2022)

    What's Changed

    • fix: better pnpm support https://github.com/denoland/dnt/pull/171
    • fix: support declaration files being imported https://github.com/denoland/dnt/pull/172
    • chore: use wasmbuild https://github.com/denoland/dnt/pull/173

    Full Changelog: https://github.com/denoland/dnt/compare/0.25.1...0.25.2

    Source code(tar.gz)
    Source code(zip)
  • 0.25.1(Jun 3, 2022)

    What's Changed

    • fix: ensure that @types/... packages are resolved in more scenarios https://github.com/denoland/dnt/pull/170

    Full Changelog: https://github.com/denoland/dnt/compare/0.25.0...0.25.1

    Source code(tar.gz)
    Source code(zip)
  • 0.25.0(Jun 3, 2022)

    What's Changed

    • feat: align lib option with tsconfig lib option https://github.com/denoland/dnt/pull/167 BREAKING CHANGE: The lib option now aligns with how you would specify it in tsconfig.json. For example, to include DOM types do:
      await build({
        // ...etc...
        compilerOptions: {
          lib: ["es2021", "dom"],
        },
      });
      
    • feat: add Array.prototype.findLast and findLastIndex polyfills https://github.com/denoland/dnt/pull/168
    • fix: correct Error#cause typings https://github.com/denoland/dnt/pull/169

    Full Changelog: https://github.com/denoland/dnt/compare/0.24.0...0.25.0

    Source code(tar.gz)
    Source code(zip)
  • 0.24.0(May 31, 2022)

    What's Changed

    • feat: upgrade to deno-shim 0.6 and crypto-shim 0.3 https://github.com/denoland/dnt/pull/158
    • feat: upgrade undici to 5.3 & automatically include @types/node dev dependency for undici https://github.com/denoland/dnt/pull/159
    • feat: add types for lib options (https://github.com/denoland/dnt/pull/162)
    • fix: exclude DOM types by default https://github.com/denoland/dnt/pull/160 BREAKING CHANGE: DOM types were erroenously included by default before. If you still want them then you can do:
      await build({
        // ...etc...
        compilerOptions: {
          lib: ["lib.es2021.d.ts", "lib.dom.d.ts"],
        },
      });
      
    Source code(tar.gz)
    Source code(zip)
  • 0.23.0(Apr 11, 2022)

    What's Changed

    • fix: add json import assertion types by inlining the json as a JS value https://github.com/denoland/dnt/pull/149
    • feat: upgrade deno shim to 0.5 https://github.com/denoland/dnt/pull/152

    Full Changelog: https://github.com/denoland/dnt/compare/0.22.0...0.23.0

    Source code(tar.gz)
    Source code(zip)
  • 0.22.0(Mar 11, 2022)

    What's Changed

    • feat: add shim for WebSocket https://github.com/denoland/dnt/pull/145

    Full Changelog: https://github.com/denoland/dnt/compare/0.21.2...0.22.0

    Source code(tar.gz)
    Source code(zip)
  • 0.21.2(Mar 6, 2022)

    What's Changed

    • fix: support custom shim w/ node scheme by @hyp3rflow in https://github.com/denoland/dnt/pull/144

    Full Changelog: https://github.com/denoland/dnt/compare/0.21.1...0.21.2

    Source code(tar.gz)
    Source code(zip)
  • 0.21.1(Mar 3, 2022)

    What's Changed

    • fix: do not panic getting declaration file when code specifier was already mapped by @hyp3rflow in https://github.com/denoland/dnt/pull/141
    • Upgrade dependencies and Rust version

    Full Changelog: https://github.com/denoland/dnt/compare/0.21.0...0.21.1

    Source code(tar.gz)
    Source code(zip)
  • 0.21.0(Feb 28, 2022)

  • 0.20.1(Feb 23, 2022)

    • fix: complete logic in getTopLevelAwait function by @ah-yu in https://github.com/denoland/dnt/pull/132
    • feat: replace import.meta.main in CJS by @kt3k in https://github.com/denoland/dnt/pull/133
    Source code(tar.gz)
    Source code(zip)
  • 0.20.0(Feb 18, 2022)

    • feat: combine mappings and redirects (https://github.com/denoland/dnt/pull/129)
    • feat: inject import declarations after leading trivia (https://github.com/denoland/dnt/pull/130)

    This release combines the concept of "redirects" and "mappings" into just "mappings".

    Before:

    await build({
      // ...etc...
      mappings: {
        "https://deno.land/x/[email protected]/mod.ts": {
          name: "code-block-writer",
          version: "^11.0.0",
        },
      },
      redirects: {
        "./file.deno.ts": "./file.node.ts",
      },
    });
    

    After:

    await build({
      // ...etc...
      mappings: {
        "https://deno.land/x/[email protected]/mod.ts": {
          name: "code-block-writer",
          version: "^11.0.0",
        },
        "./file.deno.ts": "./file.node.ts",
      },
    });
    
    Source code(tar.gz)
    Source code(zip)
  • 0.19.0(Feb 18, 2022)

    • feat: local and remote shim modules (https://github.com/denoland/dnt/pull/128)

    Read more: https://github.com/denoland/dnt#local-or-remote-shim-modules

    Source code(tar.gz)
    Source code(zip)
  • 0.18.1(Feb 16, 2022)

  • 0.18.0(Feb 16, 2022)

    • fix: test runner was not respecting ignore (https://github.com/denoland/dnt/pull/124)
    • feat: better specifier to path mapping (https://github.com/denoland/dnt/pull/109)
    • feat: windows 260 char path truncation (https://github.com/denoland/dnt/pull/125)
    Source code(tar.gz)
    Source code(zip)
  • 0.17.0(Feb 5, 2022)

    • feat: ability to specify to use cjs or umd for the script module output https://github.com/denoland/dnt/pull/114
    • feat: update to @deno/shim-deno 0.3.0 https://github.com/denoland/dnt/pull/115
    • feat: add emptyDir re-export and recommend using it https://github.com/denoland/dnt/pull/116

    Breaking Changes

    1. dnt now outputs a CommonJS module by default, instead of UMD
    2. The poorly named cjs setting is now scriptModule and you may specify "umd", "cjs" or false. So to get the old behavior, use scriptModule: "umd".
    3. The output sub folder name of the CommonJS/UMD module is now "script" instead of "umd".
    Source code(tar.gz)
    Source code(zip)
  • 0.16.1(Jan 20, 2022)

    • fix: do not crash when a non-declaration file module is referenced as both a code and types dependency (https://github.com/denoland/dnt/pull/105)
    Source code(tar.gz)
    Source code(zip)
  • 0.16.0(Jan 14, 2022)

    • feat: support sub path in CDN imports (https://github.com/denoland/dnt/pull/99)
    • feat: support import maps (https://github.com/denoland/dnt/pull/103)
    • fix: show selected package manager in logs when installing (https://github.com/denoland/dnt/pull/100)
    Source code(tar.gz)
    Source code(zip)
  • 0.15.0(Jan 12, 2022)

    • feat: ability to specify "types" package for shim (https://github.com/denoland/dnt/pull/95)
    • feat: add DOMException shim (https://github.com/denoland/dnt/pull/95)
    • feat: add sham for WeakRef (https://github.com/denoland/dnt/pull/96)
    • fix: Object.hasOwn polyfill now works for destructuring (https://github.com/denoland/dnt/pull/94)
    • fix: remove dntGlobalThisType and try to inline globalThis.X shim types directly instead (https://github.com/denoland/dnt/pull/97)
    Source code(tar.gz)
    Source code(zip)
  • 0.14.0(Jan 8, 2022)

    • feat: polyfill based on compiler script target and add String.prototype.replaceAll polyfill (https://github.com/denoland/dnt/pull/87)
    • fix: ensure test runner actually exits on failure for cjs tests (https://github.com/denoland/dnt/pull/89)
    • fix: npmignore test declaration files (https://github.com/denoland/dnt/pull/90)
    Source code(tar.gz)
    Source code(zip)
  • 0.13.0(Jan 7, 2022)

    • feat: add Deno.test-only shim (https://github.com/denoland/dnt/pull/84)
    • fix: transform test runner code to specified compiler option target (https://github.com/denoland/dnt/pull/83)
    Source code(tar.gz)
    Source code(zip)
Owner
Deno Land
Deno Land
Foreign Function Interface Plugin for Deno.

Deno FFI Plugin to call dynamic library functions in Deno. Usage import { Library } from "https://deno.land/x/[email protected]/mod.ts"; const lib = new

DjDeveloper 4 Aug 18, 2022
SDL2 module for Deno

Deno SDL2 Cross platform and stable bindings to SDL2. Have fun! Features Bindings to Video, Graphics, Font and Mixer subsystems. (Uses rodio instead o

Divy Srivastava 102 Jan 4, 2023
Windowing support for Deno WebGPU.

deno_desktop Windowing support for Deno WebGPU. In very early stages at the moment. Usage const win = Deno.createWindow({ title: "Deno Desktop", w

DjDeveloper 56 Oct 26, 2022
Examples for Deno Deploy

Deno Deploy Examples This repository contains a list of examples for Deno Deploy. fetch - Make outbound requests using the fetch() API. json_html - Re

Deno Land 118 Dec 19, 2022
Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

Deno Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. Features Secure by default. No file,

Derek Jones 2 Aug 13, 2022
autogen website (with Deno Core)

Kurit Static website generator ?? Warning WIP: It is still under development, so some of the features may not be developed. Project Structures graph T

null 11 Oct 16, 2023
Experimental package manager/system configurator for system hoppers

mascara An experimental package manager/config initializer tool for system hoppers. mascara.toml [mascara] feature = "Debian" logs = { stdout = "blue"

Ethan Gallucci 1 Apr 15, 2022
Create cairo_project.toml for a given Scarb package.

scarb-eject Create cairo_project.toml for a given Scarb package. ⚠️ Caveats This tool is just a temporary hack, use with caution! Scarb team does not

Software Mansion – Labs 3 May 9, 2023
Build beautiful desktop apps with flutter and rust. 🌠 (wip)

flutter-rs Build flutter desktop app in dart & rust. Get Started Install requirements Rust flutter sdk Develop install the cargo flutter command cargo

null 2k Dec 26, 2022
Build smaller, faster, and more secure desktop applications with a web frontend.

TAURI Tauri Apps footprint: minuscule performance: ludicrous flexibility: gymnastic security: hardened Current Releases Component Descrip

Tauri 56.3k Jan 3, 2023
Build GUI applications with minimal dependencies in Rust

winapi-app-windows A crate to build applications' windows in Windows using WinAPI. This would be less confusing if the operating system was called som

Lonami 5 Jul 26, 2022
nats-spy is a terminal tool to help you to monitor NATS messages.

nats-spy nats-spy is a terminal tool to help you to monitor NATS messages. Install Homebrew (macOS) brew install alihanyalcin/nats-spy/nats-spy Usage

Alihan Doğuş Yalçın 23 Oct 23, 2022
A small tool to use along with i3/Sway to add CSS-powered decorations to your focused windows, for better usability.

glimmer What A tool for decorating i3 windows when they get focused, written in Rust. classic.mp4 Why When using i3-gaps I ran into the following prob

Daniel Acuña 26 Dec 17, 2022
A simple GUI version of the pH calibration tool written in egui, based on the eframe template.

caliphui A simple GUI version of the pH calibration tool written in egui, based on the eframe template. Usage Native binaries are provided under relea

Peter Dunne 0 Dec 29, 2021
GUI based tool to sort and categorize images written in Rust

ImageSieve GUI based tool to sort out images based on similarity, categorize them according to their creation date and archive them in a target folder

Florian Fetz 67 Dec 14, 2022
Toolbx Tuner is a tool to improve the experience with toolbx.

Tuner Toolbx Tuner is a tool to improve the experience with toolbx. Project Roadmap The project is currently only a user-interface concept. The

Hannes Kuchelmeister 50 Dec 28, 2022
A small tool to display markdown files as a slideshow.

Rusty Slider A small tool to display markdown files as a slideshow. Demo Try out Rusty Slider online: Example slideshows. Download Rusty Slider is ava

Olle Wreede 37 Dec 21, 2022
A tool for creating egui Visuals (themes).

egui-visuals-utility A tool for creating egui Visuals (themes). The code is rather messy and might crash but it seems to work. To load the theme use s

null 7 Jan 13, 2023
Prototype for a Deno to npm package build tool.

dnt - Deno to Node Transform Prototype for a Deno to npm package build tool. What does this do? It takes a Deno module and creates an npm package for

Deno Land 570 Dec 28, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022