mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
Remove lib.globals.d.ts
This commit is contained in:
parent
f83aee02e6
commit
b3dac82887
6 changed files with 15 additions and 19 deletions
1
BUILD.gn
1
BUILD.gn
|
@ -227,7 +227,6 @@ run_node("bundle") {
|
|||
"js/fetch.ts",
|
||||
"js/fetch_types.d.ts",
|
||||
"js/globals.ts",
|
||||
"js/lib.globals.d.ts",
|
||||
"js/main.ts",
|
||||
"js/os.ts",
|
||||
"js/plugins.d.ts",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// There is a rollup plugin that will inline any module ending with `!string`
|
||||
// tslint:disable:max-line-length
|
||||
|
||||
// Generated definitions
|
||||
// Generated default library
|
||||
import globalsDts from "gen/types/globals.d.ts!string";
|
||||
|
||||
// Static libraries
|
||||
|
@ -38,7 +38,6 @@ import libEsnextAsynciterablesDts from "/third_party/node_modules/typescript/lib
|
|||
import libEsnextDts from "/third_party/node_modules/typescript/lib/lib.esnext.d.ts!string";
|
||||
import libEsnextIntlDts from "/third_party/node_modules/typescript/lib/lib.esnext.intl.d.ts!string";
|
||||
import libEsnextSymbolDts from "/third_party/node_modules/typescript/lib/lib.esnext.symbol.d.ts!string";
|
||||
import libGlobalsDts from "/js/lib.globals.d.ts!string";
|
||||
|
||||
// Static definitions
|
||||
import fetchTypesDts from "/js/fetch_types.d.ts!string";
|
||||
|
@ -49,7 +48,7 @@ import typescriptDts from "/third_party/node_modules/typescript/lib/typescript.d
|
|||
|
||||
// prettier-ignore
|
||||
export const assetSourceCode: { [key: string]: string } = {
|
||||
// Generated definitions
|
||||
// Generated library
|
||||
"globals.d.ts": globalsDts,
|
||||
|
||||
// Static libraries
|
||||
|
@ -81,7 +80,6 @@ export const assetSourceCode: { [key: string]: string } = {
|
|||
"lib.esnext.asynciterable.d.ts": libEsnextAsynciterablesDts,
|
||||
"lib.esnext.intl.d.ts": libEsnextIntlDts,
|
||||
"lib.esnext.symbol.d.ts": libEsnextSymbolDts,
|
||||
"lib.globals.d.ts": libGlobalsDts,
|
||||
|
||||
// Static definitions
|
||||
"fetch-types.d.ts": fetchTypesDts,
|
||||
|
|
|
@ -641,7 +641,7 @@ export class DenoCompiler implements ts.LanguageServiceHost {
|
|||
|
||||
getDefaultLibFileName(): string {
|
||||
this._log("getDefaultLibFileName()");
|
||||
const moduleSpecifier = "lib.globals.d.ts";
|
||||
const moduleSpecifier = "globals.d.ts";
|
||||
const moduleMetaData = this.resolveModule(moduleSpecifier, ASSETS);
|
||||
return moduleMetaData.fileName;
|
||||
}
|
||||
|
|
|
@ -445,10 +445,7 @@ test(function compilerGetCurrentDirectory() {
|
|||
|
||||
test(function compilerGetDefaultLibFileName() {
|
||||
setup();
|
||||
assertEqual(
|
||||
compilerInstance.getDefaultLibFileName(),
|
||||
"$asset$/lib.globals.d.ts"
|
||||
);
|
||||
assertEqual(compilerInstance.getDefaultLibFileName(), "$asset$/globals.d.ts");
|
||||
teardown();
|
||||
});
|
||||
|
||||
|
@ -485,14 +482,13 @@ test(function compilerFileExists() {
|
|||
test(function compilerResolveModuleNames() {
|
||||
setup();
|
||||
const results = compilerInstance.resolveModuleNames(
|
||||
["foo/bar.ts", "foo/baz.ts", "$asset$/lib.globals.d.ts", "deno"],
|
||||
["foo/bar.ts", "foo/baz.ts", "deno"],
|
||||
"/root/project"
|
||||
);
|
||||
assertEqual(results.length, 4);
|
||||
assertEqual(results.length, 3);
|
||||
const fixtures: Array<[string, boolean]> = [
|
||||
["/root/project/foo/bar.ts", false],
|
||||
["/root/project/foo/baz.ts", false],
|
||||
["$asset$/lib.globals.d.ts", true],
|
||||
["$asset$/globals.d.ts", true]
|
||||
];
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
|
|
5
js/lib.globals.d.ts
vendored
5
js/lib.globals.d.ts
vendored
|
@ -1,5 +0,0 @@
|
|||
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
||||
// This file contains the default TypeScript libraries for the deno runtime.
|
||||
/// <reference no-default-lib="true"/>
|
||||
/// <reference lib="esnext" />
|
||||
/// <reference path="globals.d.ts"/>
|
|
@ -24,6 +24,12 @@ const tsconfigOverride = {
|
|||
}
|
||||
};
|
||||
|
||||
// this is a preamble for the `globals.d.ts` file to allow it to be the default
|
||||
// lib for deno.
|
||||
const libPreamble = `/// <reference no-default-lib="true"/>
|
||||
/// <reference lib="esnext" />
|
||||
`;
|
||||
|
||||
// this is a rollup plugin which will look for imports ending with `!string` and resolve
|
||||
// them with a module that will inline the contents of the file as a string. Needed to
|
||||
// support `js/assets.ts`.
|
||||
|
@ -62,7 +68,9 @@ function strings({ include, exclude } = {}) {
|
|||
transform(code, id) {
|
||||
if (filter(id)) {
|
||||
return {
|
||||
code: `export default ${JSON.stringify(code)};`,
|
||||
code: `export default ${JSON.stringify(
|
||||
id.endsWith("globals.d.ts") ? libPreamble + code : code
|
||||
)};`,
|
||||
map: { mappings: "" }
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue