mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 16:42:21 -05:00
fix: move stable/unstable types/APIs to their correct places (#10880)
- Moved ppid and memoryUsage types from deno.unstable to deno.ns. - Moved sleepSync to unstable object, shutdown to stable object.
This commit is contained in:
parent
68c519d061
commit
388274e02e
7 changed files with 20 additions and 74 deletions
|
@ -628,45 +628,4 @@ mod tests {
|
||||||
let actual = diagnostics.to_string();
|
let actual = diagnostics.to_string();
|
||||||
assert_eq!(strip_ansi_codes(&actual), "TS2552 [ERROR]: Cannot find name \'foo_Bar\'. Did you mean \'foo_bar\'?\nfoo_Bar();\n~~~~~~~\n at test.ts:8:1\n\n \'foo_bar\' is declared here.\n function foo_bar() {\n ~~~~~~~\n at test.ts:4:10");
|
assert_eq!(strip_ansi_codes(&actual), "TS2552 [ERROR]: Cannot find name \'foo_Bar\'. Did you mean \'foo_bar\'?\nfoo_Bar();\n~~~~~~~\n at test.ts:8:1\n\n \'foo_bar\' is declared here.\n function foo_bar() {\n ~~~~~~~\n at test.ts:4:10");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_unstable_suggestion() {
|
|
||||||
let value = json![
|
|
||||||
{
|
|
||||||
"start": {
|
|
||||||
"line": 0,
|
|
||||||
"character": 17
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 0,
|
|
||||||
"character": 21
|
|
||||||
},
|
|
||||||
"fileName": "file:///cli/tests/unstable_ts2551.ts",
|
|
||||||
"messageText": "Property 'ppid' does not exist on type 'typeof Deno'. Did you mean 'pid'?",
|
|
||||||
"sourceLine": "console.log(Deno.ppid);",
|
|
||||||
"relatedInformation": [
|
|
||||||
{
|
|
||||||
"start": {
|
|
||||||
"line": 89,
|
|
||||||
"character": 15
|
|
||||||
},
|
|
||||||
"end": {
|
|
||||||
"line": 89,
|
|
||||||
"character": 18
|
|
||||||
},
|
|
||||||
"fileName": "asset:///lib.deno.ns.d.ts",
|
|
||||||
"messageText": "'pid' is declared here.",
|
|
||||||
"sourceLine": " export const pid: number;",
|
|
||||||
"category": 3,
|
|
||||||
"code": 2728
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"category": 1,
|
|
||||||
"code": 2551
|
|
||||||
}
|
|
||||||
];
|
|
||||||
let diagnostics: Diagnostic = serde_json::from_value(value).unwrap();
|
|
||||||
let actual = diagnostics.to_string();
|
|
||||||
assert_eq!(strip_ansi_codes(&actual), "TS2551 [ERROR]: Property \'ppid\' does not exist on type \'typeof Deno\'. \'Deno.ppid\' is an unstable API. Did you forget to run with the \'--unstable\' flag, or did you mean \'pid\'?\nconsole.log(Deno.ppid);\n ~~~~\n at file:///cli/tests/unstable_ts2551.ts:1:18\n\n \'pid\' is declared here.\n export const pid: number;\n ~~~\n at asset:///lib.deno.ns.d.ts:90:16");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
18
cli/dts/lib.deno.ns.d.ts
vendored
18
cli/dts/lib.deno.ns.d.ts
vendored
|
@ -90,6 +90,24 @@ declare namespace Deno {
|
||||||
/** The current process id of the runtime. */
|
/** The current process id of the runtime. */
|
||||||
export const pid: number;
|
export const pid: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pid of the current process's parent.
|
||||||
|
*/
|
||||||
|
export const ppid: number;
|
||||||
|
|
||||||
|
export interface MemoryUsage {
|
||||||
|
rss: number;
|
||||||
|
heapTotal: number;
|
||||||
|
heapUsed: number;
|
||||||
|
external: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an object describing the memory usage of the Deno process measured
|
||||||
|
* in bytes.
|
||||||
|
*/
|
||||||
|
export function memoryUsage(): MemoryUsage;
|
||||||
|
|
||||||
/** Reflects the `NO_COLOR` environment variable at program start.
|
/** Reflects the `NO_COLOR` environment variable at program start.
|
||||||
*
|
*
|
||||||
* See: https://no-color.org/ */
|
* See: https://no-color.org/ */
|
||||||
|
|
14
cli/dts/lib.deno.unstable.d.ts
vendored
14
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -1069,11 +1069,6 @@ declare namespace Deno {
|
||||||
*/
|
*/
|
||||||
export function hostname(): string;
|
export function hostname(): string;
|
||||||
|
|
||||||
/** **UNSTABLE**: New API, yet to be vetted.
|
|
||||||
* The pid of the current process's parent.
|
|
||||||
*/
|
|
||||||
export const ppid: number;
|
|
||||||
|
|
||||||
/** **UNSTABLE**: New API, yet to be vetted.
|
/** **UNSTABLE**: New API, yet to be vetted.
|
||||||
* A custom HttpClient for use with `fetch`.
|
* A custom HttpClient for use with `fetch`.
|
||||||
*
|
*
|
||||||
|
@ -1171,15 +1166,6 @@ declare namespace Deno {
|
||||||
bytesReceived: number;
|
bytesReceived: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MemoryUsage {
|
|
||||||
rss: number;
|
|
||||||
heapTotal: number;
|
|
||||||
heapUsed: number;
|
|
||||||
external: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function memoryUsage(): MemoryUsage;
|
|
||||||
|
|
||||||
export interface RequestEvent {
|
export interface RequestEvent {
|
||||||
readonly request: Request;
|
readonly request: Request;
|
||||||
respondWith(r: Response | Promise<Response>): Promise<void>;
|
respondWith(r: Response | Promise<Response>): Promise<void>;
|
||||||
|
|
|
@ -3976,12 +3976,6 @@ console.log("finish");
|
||||||
output: "unstable_enabled_js.out",
|
output: "unstable_enabled_js.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(unstable_disabled_ts2551 {
|
|
||||||
args: "run --reload unstable_ts2551.ts",
|
|
||||||
exit_code: 1,
|
|
||||||
output: "unstable_disabled_ts2551.out",
|
|
||||||
});
|
|
||||||
|
|
||||||
itest!(unstable_worker {
|
itest!(unstable_worker {
|
||||||
args: "run --reload --unstable --quiet --allow-read unstable_worker.ts",
|
args: "run --reload --unstable --quiet --allow-read unstable_worker.ts",
|
||||||
output: "unstable_worker.ts.out",
|
output: "unstable_worker.ts.out",
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
[WILDCARD]
|
|
||||||
error: TS2551 [ERROR]: Property 'ppid' does not exist on type 'typeof Deno'. 'Deno.ppid' is an unstable API. Did you forget to run with the '--unstable' flag, or did you mean 'pid'?
|
|
||||||
console.log(Deno.ppid);
|
|
||||||
~~~~
|
|
||||||
at [WILDCARD]cli/tests/unstable_ts2551.ts:1:18
|
|
||||||
|
|
||||||
'pid' is declared here.
|
|
||||||
export const pid: number;
|
|
||||||
~~~
|
|
||||||
at asset:///lib.deno.ns.d.ts:[WILDCARD]
|
|
|
@ -1 +0,0 @@
|
||||||
console.log(Deno.ppid);
|
|
|
@ -85,7 +85,7 @@
|
||||||
listen: __bootstrap.net.listen,
|
listen: __bootstrap.net.listen,
|
||||||
connectTls: __bootstrap.tls.connectTls,
|
connectTls: __bootstrap.tls.connectTls,
|
||||||
listenTls: __bootstrap.tls.listenTls,
|
listenTls: __bootstrap.tls.listenTls,
|
||||||
sleepSync: __bootstrap.timers.sleepSync,
|
shutdown: __bootstrap.net.shutdown,
|
||||||
fstatSync: __bootstrap.fs.fstatSync,
|
fstatSync: __bootstrap.fs.fstatSync,
|
||||||
fstat: __bootstrap.fs.fstat,
|
fstat: __bootstrap.fs.fstat,
|
||||||
fsyncSync: __bootstrap.fs.fsyncSync,
|
fsyncSync: __bootstrap.fs.fsyncSync,
|
||||||
|
@ -119,7 +119,7 @@
|
||||||
systemCpuInfo: __bootstrap.os.systemCpuInfo,
|
systemCpuInfo: __bootstrap.os.systemCpuInfo,
|
||||||
applySourceMap: __bootstrap.errorStack.opApplySourceMap,
|
applySourceMap: __bootstrap.errorStack.opApplySourceMap,
|
||||||
formatDiagnostics: __bootstrap.errorStack.opFormatDiagnostics,
|
formatDiagnostics: __bootstrap.errorStack.opFormatDiagnostics,
|
||||||
shutdown: __bootstrap.net.shutdown,
|
sleepSync: __bootstrap.timers.sleepSync,
|
||||||
resolveDns: __bootstrap.net.resolveDns,
|
resolveDns: __bootstrap.net.resolveDns,
|
||||||
listen: __bootstrap.netUnstable.listen,
|
listen: __bootstrap.netUnstable.listen,
|
||||||
connect: __bootstrap.netUnstable.connect,
|
connect: __bootstrap.netUnstable.connect,
|
||||||
|
|
Loading…
Reference in a new issue