mirror of
https://github.com/denoland/deno.git
synced 2025-08-01 17:42:32 +00:00
refactor: Cleanup options object parameters (#4296)
This commit is contained in:
parent
fbc4731256
commit
6443e4aed1
17 changed files with 110 additions and 164 deletions
|
@ -302,12 +302,12 @@ export interface TranspileOnlyResult {
|
|||
*/
|
||||
export async function transpileOnly(
|
||||
sources: Record<string, string>,
|
||||
options?: CompilerOptions
|
||||
options: CompilerOptions = {}
|
||||
): Promise<Record<string, TranspileOnlyResult>> {
|
||||
util.log("Deno.transpileOnly", { sources: Object.keys(sources), options });
|
||||
const payload = {
|
||||
sources,
|
||||
options: options ? JSON.stringify(options) : undefined
|
||||
options: JSON.stringify(options)
|
||||
};
|
||||
const result = await runtimeCompilerOps.transpile(payload);
|
||||
return JSON.parse(result);
|
||||
|
@ -343,12 +343,12 @@ export async function transpileOnly(
|
|||
export async function compile(
|
||||
rootName: string,
|
||||
sources?: Record<string, string>,
|
||||
options?: CompilerOptions
|
||||
options: CompilerOptions = {}
|
||||
): Promise<[DiagnosticItem[] | undefined, Record<string, string>]> {
|
||||
const payload = {
|
||||
rootName: sources ? rootName : checkRelative(rootName),
|
||||
sources,
|
||||
options: options ? JSON.stringify(options) : undefined,
|
||||
options: JSON.stringify(options),
|
||||
bundle: false
|
||||
};
|
||||
util.log("Deno.compile", {
|
||||
|
@ -391,12 +391,12 @@ export async function compile(
|
|||
export async function bundle(
|
||||
rootName: string,
|
||||
sources?: Record<string, string>,
|
||||
options?: CompilerOptions
|
||||
options: CompilerOptions = {}
|
||||
): Promise<[DiagnosticItem[] | undefined, string]> {
|
||||
const payload = {
|
||||
rootName: sources ? rootName : checkRelative(rootName),
|
||||
sources,
|
||||
options: options ? JSON.stringify(options) : undefined,
|
||||
options: JSON.stringify(options),
|
||||
bundle: true
|
||||
};
|
||||
util.log("Deno.bundle", {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue