make-deno-edition
Version:
Automatically makes package.json projects (such as npm packages and node.js modules) compatible with Deno.
88 lines • 2.95 kB
TypeScript
export declare const importRegExp: RegExp;
export interface CompatibilityStatus {
success: true;
message: string;
}
export interface Import {
/** The type of import:
* - internal imports are mapped to their typescript file that should exist within the source directory
* - remote imports are assumed to be compatible
* - dep imports are mapped to a typescript entry, via manual entry, deno entry, or main entry
* - builtin imports are proxied to their deno compat layer if available
*/
type: null | 'internal' | 'remote' | 'dep' | 'builtin' | 'unnecessary';
label: string;
sourceIndex: number;
sourceStatement: string;
sourceTarget: string;
resultStatement?: string;
resultTarget?: string;
name: string;
entry: string;
dep?: Dependency;
path?: string;
file?: File;
errors: Set<string>;
}
export type Imports = Import[];
export interface File {
/** what the file should be referred to as */
label: string;
/** absolute filesystem path */
path: string;
/** relative to the package directory */
filename: string;
/** deno edition path */
denoPath: string;
/** whether or not the file is necessary or not */
necessary: boolean;
/** source file content */
source: string;
/** result file content */
result?: string;
imports: Imports;
errors: Set<string>;
}
export interface Files {
[path: string]: File;
}
/** package.json dependencies and devDependencies fields */
export interface DependencySemvers {
[key: string]: string;
}
export interface Dependency {
name: string;
version: string;
denoEntry: string | null;
unpkg: string;
esmsh: string;
errors: Set<string>;
}
export interface Dependencies {
[key: string]: Dependency;
}
export interface Details {
files: Files;
deps: Dependencies;
success: boolean;
}
export declare function convert(path: string, details: Details): File;
export interface MakeOpts {
/** The package directory that we will be making a deno edition for */
cwd?: string;
/** If the entry is incompatible, then fail */
failOnEntryIncompatibility?: boolean;
/** If any test module is incompatible, then fail */
failOnTestIncompatibility?: boolean;
/**
* If any other module is incompatible, then fail.
* This excludes entry, which is governed by {@link failOnEntryIncompatibility}
* This excludes tests, which are governed by {@link failOnTestIncompatibility}
*/
failOnOtherIncompatibility?: boolean;
/** Whether or not to run deno on the file to verify the conversion is compatible */
run?: boolean;
}
export declare function make({ run, cwd, failOnEntryIncompatibility, failOnTestIncompatibility, failOnOtherIncompatibility, }?: MakeOpts): Promise<Details>;
export declare function inform(details: Details, verbose?: boolean): void;
//# sourceMappingURL=index.d.ts.map