Module

x/dnt/mod.ts>BuildOptions

Deno to npm package build tool.
Latest
interface BuildOptions
import { type BuildOptions } from "https://dotland.deno.dev/x/dnt@0.40.0/mod.ts";

Properties

entryPoints: (string | EntryPoint)[]

Entrypoint(s) to the Deno module. Ex. ./mod.ts

outDir: string

Directory to output to.

Shims to use.

optional
typeCheck: "both" | "single" | false

Type check the output.

  • "both" - Type checks both the ESM and script modules separately. This is the recommended option when publishing a dual ESM and script package, but it runs slower so it's not the default.
  • "single" - Type checks the ESM module only or the script module if not emitting ESM.
  • false - Do not type check the output.
optional
test: boolean

Collect and run test files.

optional
declaration: "inline" | "separate" | false

Create declaration files.

  • "inline" - Emit declaration files beside the .js files in both the esm and script folders. This is the recommended option when publishing a dual ESM and script package to npm.
  • "separate" - Emits declaration files to the types folder where both the ESM and script code share the same type declarations.
  • false - Do not emit declaration files.
optional
scriptModule: "cjs" | "umd" | false

Include a CommonJS or UMD module.

optional
esModule: boolean

Whether to emit an ES module.

optional
skipNpmInstall: boolean

Skip running npm install.

optional
skipSourceOutput: boolean

Skip outputting the canonical TypeScript in the output directory before emitting.

optional
rootTestDir: string

Root directory to find test files in. Defaults to the cwd.

optional
testPattern: string

Glob pattern to use to find tests files. Defaults to deno test's pattern.

optional
mappings: SpecifierMappings

Specifiers to map from and to.

This can be used to create a node specific file:

mappings: {
  "./file.deno.ts": "./file.node.ts",
}

Or map a specifier to an npm package:

mappings: {
"https://deno.land/x/code_block_writer@11.0.0/mod.ts": {
  name: "code-block-writer",
  version: "^11.0.0",
}
package: PackageJson

Package.json output. You may override dependencies and dev dependencies in here.

optional
importMap: string

Path or url to import map.

optional
packageManager:
| "npm"
| "yarn"
| "pnpm"
| string

Package manager used to install dependencies and run npm scripts. This also can be an absolute path to the executable file of package manager.

optional
compilerOptions: { importHelpers?: boolean; strictBindCallApply?: boolean; strictFunctionTypes?: boolean; strictNullChecks?: boolean; strictPropertyInitialization?: boolean; noImplicitAny?: boolean; noImplicitReturns?: boolean; noImplicitThis?: boolean; noStrictGenericChecks?: boolean; noUncheckedIndexedAccess?: boolean; target?: ScriptTarget; sourceMap?: SourceMapOptions; inlineSources?: boolean; lib?: LibName[]; skipLibCheck?: boolean; emitDecoratorMetadata?: boolean; useUnknownInCatchVariables?: boolean; }

Optional TypeScript compiler options.

optional
filterDiagnostic: (diagnostic: ts.Diagnostic) => boolean

Filter out diagnostics that you want to ignore during type checking and emitting.

optional
postBuild: () => void | Promise<void>

Action to do after emitting and before running tests.

optional
internalWasmUrl: string

Custom Wasm URL for the internal Wasm module used by dnt.