mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 05:35:33 +00:00
Unstable methods should not appear in runtime or d.ts (#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
This commit is contained in:
parent
4993a6504b
commit
80e2211141
35 changed files with 1659 additions and 1350 deletions
|
@ -51,7 +51,8 @@ interface CompilerRequestCompile {
|
|||
// options: ts.CompilerOptions;
|
||||
configPath?: string;
|
||||
config?: string;
|
||||
bundle?: boolean;
|
||||
unstable: boolean;
|
||||
bundle: boolean;
|
||||
outFile?: string;
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,7 @@ interface CompilerRequestRuntimeCompile {
|
|||
target: CompilerHostTarget;
|
||||
rootName: string;
|
||||
sources?: Record<string, string>;
|
||||
unstable?: boolean;
|
||||
bundle?: boolean;
|
||||
options?: string;
|
||||
}
|
||||
|
@ -90,7 +92,15 @@ type RuntimeBundleResult = [undefined | DiagnosticItem[], string];
|
|||
async function compile(
|
||||
request: CompilerRequestCompile
|
||||
): Promise<CompileResult> {
|
||||
const { bundle, config, configPath, outFile, rootNames, target } = request;
|
||||
const {
|
||||
bundle,
|
||||
config,
|
||||
configPath,
|
||||
outFile,
|
||||
rootNames,
|
||||
target,
|
||||
unstable,
|
||||
} = request;
|
||||
util.log(">>> compile start", {
|
||||
rootNames,
|
||||
type: CompilerRequestType[request.type],
|
||||
|
@ -116,6 +126,7 @@ async function compile(
|
|||
bundle,
|
||||
target,
|
||||
writeFile,
|
||||
unstable,
|
||||
}));
|
||||
let diagnostics: readonly ts.Diagnostic[] | undefined;
|
||||
|
||||
|
@ -185,7 +196,7 @@ async function compile(
|
|||
async function runtimeCompile(
|
||||
request: CompilerRequestRuntimeCompile
|
||||
): Promise<RuntimeCompileResult | RuntimeBundleResult> {
|
||||
const { rootName, sources, options, bundle, target } = request;
|
||||
const { bundle, options, rootName, sources, target, unstable } = request;
|
||||
|
||||
util.log(">>> runtime compile start", {
|
||||
rootName,
|
||||
|
@ -259,6 +270,14 @@ async function runtimeCompile(
|
|||
if (convertedOptions) {
|
||||
compilerOptions.push(convertedOptions);
|
||||
}
|
||||
if (unstable) {
|
||||
compilerOptions.push({
|
||||
lib: [
|
||||
"deno.unstable",
|
||||
...((convertedOptions && convertedOptions.lib) || ["deno.window"]),
|
||||
],
|
||||
});
|
||||
}
|
||||
if (bundle) {
|
||||
compilerOptions.push(defaultBundlerOptions);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue