dist_rewrite_imports.ts

view source

Declarations
#

4 declarations

rewrite_dist_imports
#

dist_rewrite_imports.ts view source

(dist_dir?: string, log?: Logger | undefined): Promise<RewriteDistImportsResult> import {rewrite_dist_imports} from '@fuzdev/gro/dist_rewrite_imports.js';

Walks dist_dir and rewrites relative .ts import specifiers to .js in every .js runtime file and .d.ts declaration file (whole-file) and .svelte file (<script> blocks only). Source maps (*.map) are skipped.

dist_dir

the packaged output directory; defaults to dist

type string
default SVELTEKIT_DIST_DIRNAME

log?

type Logger | undefined
optional

returns

Promise<RewriteDistImportsResult>

counts of files scanned and rewritten

rewrite_relative_ts_imports
#

dist_rewrite_imports.ts view source

(content: string): string import {rewrite_relative_ts_imports} from '@fuzdev/gro/dist_rewrite_imports.js';

Rewrites relative .ts (and .svelte.ts) import specifiers to .js (and .svelte.js) across a chunk of TypeScript source — a whole .d.ts file or a .svelte <script> block.

content

type string

returns

string

rewrite_svelte_ts_imports
#

dist_rewrite_imports.ts view source

(content: string): string import {rewrite_svelte_ts_imports} from '@fuzdev/gro/dist_rewrite_imports.js';

Rewrites relative .ts import specifiers to .js inside each <script> block of a .svelte file, leaving template markup untouched.

content

type string

returns

string

RewriteDistImportsResult
#

dist_rewrite_imports.ts view source

RewriteDistImportsResult import type {RewriteDistImportsResult} from '@fuzdev/gro/dist_rewrite_imports.js';

scanned

Number of files scanned (.js, .d.ts, and .svelte).

type number

rewritten

Number of scanned files whose contents changed.

type number

Depends on
#

Imported by
#