Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno2node/src/deps.deno.ts>ModuledNode

Compile your Deno project to run on Node.js.
Go to Latest
interface ModuledNode
import { type ModuledNode } from "https://deno.land/x/deno2node@v1.10.0/src/deps.deno.ts";

Methods

addImportDeclaration(structure: OptionalKind<ImportDeclarationStructure>): ImportDeclaration

Adds an import.

addImportDeclarations(structures: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>): ImportDeclaration[]

Adds imports.

insertImportDeclaration(index: number, structure: OptionalKind<ImportDeclarationStructure>): ImportDeclaration

Insert an import.

insertImportDeclarations(index: number, structures: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>): ImportDeclaration[]

Inserts imports.

getImportDeclaration(condition: (importDeclaration: ImportDeclaration) => boolean): ImportDeclaration | undefined

Gets the first import declaration that matches a condition, or undefined if it doesn't exist.

getImportDeclaration(moduleSpecifier: string): ImportDeclaration | undefined

Gets the first import declaration that matches a module specifier, or undefined if it doesn't exist.

getImportDeclarationOrThrow(condition: (importDeclaration: ImportDeclaration) => boolean): ImportDeclaration

Gets the first import declaration that matches a condition, or throws if it doesn't exist.

getImportDeclarationOrThrow(moduleSpecifier: string): ImportDeclaration

Gets the first import declaration that matches a module specifier, or throws if it doesn't exist.

getImportDeclarations(): ImportDeclaration[]

Get the module's import declarations.

addExportDeclaration(structure: OptionalKind<ExportDeclarationStructure>): ExportDeclaration

Add export declarations.

addExportDeclarations(structures: ReadonlyArray<OptionalKind<ExportDeclarationStructure>>): ExportDeclaration[]

Add export declarations.

insertExportDeclaration(index: number, structure: OptionalKind<ExportDeclarationStructure>): ExportDeclaration

Insert an export declaration.

insertExportDeclarations(index: number, structures: ReadonlyArray<OptionalKind<ExportDeclarationStructure>>): ExportDeclaration[]

Insert export declarations.

getExportDeclaration(condition: (exportDeclaration: ExportDeclaration) => boolean, message?: string | (() => string)): ExportDeclaration | undefined
getExportDeclaration(moduleSpecifier: string): ExportDeclaration | undefined

Gets the first export declaration that matches a module specifier, or undefined if it doesn't exist.

getExportDeclarationOrThrow(condition: (exportDeclaration: ExportDeclaration) => boolean, message?: string | (() => string)): ExportDeclaration

Gets the first export declaration that matches a condition, or throws if it doesn't exist.

getExportDeclarationOrThrow(moduleSpecifier: string, message?: string | (() => string)): ExportDeclaration

Gets the first export declaration that matches a module specifier, or throws if it doesn't exist.

getExportDeclarations(): ExportDeclaration[]

Get the export declarations.

addExportAssignment(structure: OptionalKind<ExportAssignmentStructure>): ExportAssignment

Add export assignments.

addExportAssignments(structures: ReadonlyArray<OptionalKind<ExportAssignmentStructure>>): ExportAssignment[]

Add export assignments.

insertExportAssignment(index: number, structure: OptionalKind<ExportAssignmentStructure>): ExportAssignment

Insert an export assignment.

insertExportAssignments(index: number, structures: ReadonlyArray<OptionalKind<ExportAssignmentStructure>>): ExportAssignment[]

Insert export assignments into a file.

getExportAssignment(condition: (exportAssignment: ExportAssignment) => boolean): ExportAssignment | undefined

Gets the first export assignment that matches a condition, or undefined if it doesn't exist.

getExportAssignmentOrThrow(condition: (exportAssignment: ExportAssignment) => boolean, message?: string | (() => string)): ExportAssignment

Gets the first export assignment that matches a condition, or throws if it doesn't exist.

getExportAssignments(): ExportAssignment[]

Get the file's export assignments.

getDefaultExportSymbol(): Symbol | undefined

Gets the default export symbol.

getDefaultExportSymbolOrThrow(message?: string | (() => string)): Symbol

Gets the default export symbol or throws if it doesn't exist.

getExportSymbols(): Symbol[]

Gets the export symbols.

getExportedDeclarations(): ReadonlyMap<string, ExportedDeclarations[]>

Gets all the declarations that are exported from the module.

The key is the name it's exported on and the value is the array of declarations for that name.

This will include declarations that are transitively exported from other modules. If you mean to get the export declarations then use .getExportDeclarations().

removeDefaultExport(defaultExportSymbol?: Symbol | undefined): this

Removes any "export default".

function ModuledNode
import { ModuledNode } from "https://deno.land/x/deno2node@v1.10.0/src/deps.deno.ts";

Type Parameters

T extends Constructor<ModuledNodeExtensionType>