mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 04:51:22 +00:00
Upgrade TypeScript (3.0.1)
Update runtime to use lib.deno.d.ts Add proper console declaration Upgrade prettier (There was an issue formatting lib.deno.d.ts)
This commit is contained in:
parent
b44c235579
commit
36fa1cea4a
1
BUILD.gn
1
BUILD.gn
@ -199,6 +199,7 @@ run_node("bundle") {
|
||||
"js/deno.d.ts",
|
||||
"js/dispatch.ts",
|
||||
"js/globals.ts",
|
||||
"js/lib.deno.d.ts",
|
||||
"js/main.ts",
|
||||
"js/os.ts",
|
||||
"js/runtime.ts",
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## A secure TypeScript runtime built on V8
|
||||
|
||||
* Supports TypeScript 2.8 out of the box. Uses V8 6.9.297. That is, it's
|
||||
* Supports TypeScript 3.0.1 out of the box. Uses V8 6.9.297. That is, it's
|
||||
very modern JavaScript.
|
||||
|
||||
* No `package.json`. No npm. Not explicitly compatible with Node.
|
||||
|
40
js/assets.ts
40
js/assets.ts
@ -6,8 +6,11 @@
|
||||
// There is a rollup plugin that will inline any module ending with `!string`
|
||||
// tslint:disable:max-line-length
|
||||
import denoDts from "/js/deno.d.ts!string";
|
||||
import libDts from "/third_party/node_modules/typescript/lib/lib.d.ts!string";
|
||||
import libDomIterableDts from "/third_party/node_modules/typescript/lib/lib.dom.iterable.d.ts!string";
|
||||
// import libDts from "/third_party/node_modules/typescript/lib/lib.d.ts!string";
|
||||
import libDenoDts from "/js/lib.deno.d.ts!string";
|
||||
// import libDomD qts from "/third_party/node_modules/typescript/lib/lib.dom.d.ts!string";
|
||||
// import libDomIterableDts from "/third_party/node_modules/typescript/lib/lib.dom.iterable.d.ts!string";
|
||||
import libEs2015Dts from "/third_party/node_modules/typescript/lib/lib.es2015.d.ts!string";
|
||||
import libEs2015CollectionDts from "/third_party/node_modules/typescript/lib/lib.es2015.collection.d.ts!string";
|
||||
import libEs2015CoreDts from "/third_party/node_modules/typescript/lib/lib.es2015.core.d.ts!string";
|
||||
import libEs2015GeneratorDts from "/third_party/node_modules/typescript/lib/lib.es2015.generator.d.ts!string";
|
||||
@ -17,29 +20,38 @@ import libEs2015ProxyDts from "/third_party/node_modules/typescript/lib/lib.es20
|
||||
import libEs2015ReflectDts from "/third_party/node_modules/typescript/lib/lib.es2015.reflect.d.ts!string";
|
||||
import libEs2015SymbolDts from "/third_party/node_modules/typescript/lib/lib.es2015.symbol.d.ts!string";
|
||||
import libEs2015SymbolWellknownDts from "/third_party/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts!string";
|
||||
import libEs2016Dts from "/third_party/node_modules/typescript/lib/lib.es2016.d.ts!string";
|
||||
import libEs2016ArrayIncludeDts from "/third_party/node_modules/typescript/lib/lib.es2016.array.include.d.ts!string";
|
||||
import libEs2017Dts from "/third_party/node_modules/typescript/lib/lib.es2017.d.ts!string";
|
||||
import libEs2017IntlDts from "/third_party/node_modules/typescript/lib/lib.es2017.intl.d.ts!string";
|
||||
import libEs2017ObjectDts from "/third_party/node_modules/typescript/lib/lib.es2017.object.d.ts!string";
|
||||
import libEs2017SharedmemoryDts from "/third_party/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts!string";
|
||||
import libEs2017StringDts from "/third_party/node_modules/typescript/lib/lib.es2017.string.d.ts!string";
|
||||
import libEs2017TypedarraysDts from "/third_party/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts!string";
|
||||
import libEs2018Dts from "/third_party/node_modules/typescript/lib/lib.es2018.d.ts!string";
|
||||
import libEs2018IntlDts from "/third_party/node_modules/typescript/lib/lib.es2018.intl.d.ts!string";
|
||||
import libEs2018PromiseDts from "/third_party/node_modules/typescript/lib/lib.es2018.promise.d.ts!string";
|
||||
import libEs2018RegexpDts from "/third_party/node_modules/typescript/lib/lib.es2018.regexp.d.ts!string";
|
||||
import libEs5Dts from "/third_party/node_modules/typescript/lib/lib.es5.d.ts!string";
|
||||
import libEsnextArrayDts from "/third_party/node_modules/typescript/lib/lib.esnext.array.d.ts!string";
|
||||
import libEsnextAsynciterablesDts from "/third_party/node_modules/typescript/lib/lib.esnext.asynciterable.d.ts!string";
|
||||
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 libScripthost from "/third_party/node_modules/typescript/lib/lib.scripthost.d.ts!string";
|
||||
// import libWebworkerImportscripts from "/third_party/node_modules/typescript/lib/lib.webworker.importscripts.d.ts!string";
|
||||
import typescriptDts from "/third_party/node_modules/typescript/lib/typescript.d.ts!string";
|
||||
|
||||
// prettier-ignore
|
||||
export const assetSourceCode: { [key: string]: string } = {
|
||||
"deno.d.ts": denoDts,
|
||||
"lib.d.ts": libDts,
|
||||
//"lib.dom.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.dom.d.ts", "utf8"),
|
||||
"lib.dom.iterable.d.ts": libDomIterableDts,
|
||||
// "lib.d.ts": libDts,
|
||||
"lib.deno.d.ts": libDenoDts,
|
||||
// "lib.dom.d.ts": libDomDts,
|
||||
// "lib.dom.iterable.d.ts": libDomIterableDts,
|
||||
"lib.es2015.collection.d.ts": libEs2015CollectionDts,
|
||||
"lib.es2015.core.d.ts": libEs2015CoreDts,
|
||||
//"lib.es2015.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es2015.d.ts", "utf8"),
|
||||
"lib.es2015.d.ts": libEs2015Dts,
|
||||
"lib.es2015.generator.d.ts": libEs2015GeneratorDts,
|
||||
"lib.es2015.iterable.d.ts": libEs2015IterableDts,
|
||||
"lib.es2015.promise.d.ts": libEs2015PromiseDts,
|
||||
@ -48,9 +60,9 @@ export const assetSourceCode: { [key: string]: string } = {
|
||||
"lib.es2015.symbol.d.ts": libEs2015SymbolDts,
|
||||
"lib.es2015.symbol.wellknown.d.ts": libEs2015SymbolWellknownDts,
|
||||
"lib.es2016.array.include.d.ts": libEs2016ArrayIncludeDts,
|
||||
//"lib.es2016.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es2016.d.ts", "utf8"),
|
||||
"lib.es2016.d.ts": libEs2016Dts,
|
||||
//"lib.es2016.full.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es2016.full.d.ts", "utf8"),
|
||||
//"lib.es2017.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es2017.d.ts", "utf8"),
|
||||
"lib.es2017.d.ts": libEs2017Dts,
|
||||
//"lib.es2017.full.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es2017.full.d.ts", "utf8"),
|
||||
"lib.es2017.intl.d.ts": libEs2017IntlDts,
|
||||
"lib.es2017.object.d.ts": libEs2017ObjectDts,
|
||||
@ -59,16 +71,20 @@ export const assetSourceCode: { [key: string]: string } = {
|
||||
"lib.es2017.typedarrays.d.ts": libEs2017TypedarraysDts,
|
||||
"lib.es2018.d.ts": libEs2018Dts,
|
||||
//"lib.es2018.full.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es2018.full.d.ts", "utf8"),
|
||||
"lib.es2018.intl.d.ts": libEs2018IntlDts,
|
||||
"lib.es2018.promise.d.ts": libEs2018PromiseDts,
|
||||
"lib.es2018.regexp.d.ts": libEs2018RegexpDts,
|
||||
//"lib.es5.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es5.d.ts", "utf8"),
|
||||
"lib.es5.d.ts": libEs5Dts,
|
||||
//"lib.es6.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.es6.d.ts", "utf8"),
|
||||
"lib.esnext.d.ts": libEsnextDts,
|
||||
"lib.esnext.array.d.ts": libEsnextArrayDts,
|
||||
"lib.esnext.asynciterable.d.ts": libEsnextAsynciterablesDts,
|
||||
"lib.esnext.d.ts": libEsnextDts,
|
||||
"lib.esnext.intl.d.ts": libEsnextIntlDts,
|
||||
"lib.esnext.symbol.d.ts": libEsnextSymbolDts,
|
||||
//"lib.esnext.full.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.esnext.full.d.ts", "utf8"),
|
||||
//"lib.scripthost.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.scripthost.d.ts", "utf8"),
|
||||
//"lib.webworker.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/lib.webworker.d.ts", "utf8"),
|
||||
// "lib.scripthost.d.ts": libScripthost,
|
||||
// "lib.webworker.d.ts": libWebworker,
|
||||
// "lib.webworker.importscripts.d.ts": libWebworkerImportscripts,
|
||||
//"protocol.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/protocol.d.ts", "utf8"),
|
||||
//"tsserverlibrary.d.ts": readFileSync(__dirname + "/../third_party/node_modules/typescript/lib/tsserverlibrary.d.ts", "utf8"),
|
||||
"typescript.d.ts": typescriptDts,
|
||||
|
34
js/lib.deno.d.ts
vendored
Normal file
34
js/lib.deno.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// This file contains the default TypeScript libraries for the runtime
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
// TODO generate `console.d.ts` and inline it in `assets.ts` and remove
|
||||
// declaration of `Console`
|
||||
// import { Console } from 'gen/console';
|
||||
|
||||
declare class Console {
|
||||
// tslint:disable-next-line:no-any
|
||||
log(...args: any[]): void;
|
||||
// tslint:disable-next-line:no-any
|
||||
debug(...args: any[]): void;
|
||||
// tslint:disable-next-line:no-any
|
||||
info(...args: any[]): void;
|
||||
// tslint:disable-next-line:no-any
|
||||
warn(...args: any[]): void;
|
||||
// tslint:disable-next-line:no-any
|
||||
error(...args: any[]): void;
|
||||
// tslint:disable-next-line:no-any
|
||||
assert(condition: boolean, ...args: any[]): void;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
console: Console;
|
||||
}
|
||||
|
||||
// Globals in the runtime environment
|
||||
declare let console: Console;
|
||||
declare const window: Window;
|
@ -214,9 +214,8 @@ class Compiler {
|
||||
module: ts.ModuleKind.AMD,
|
||||
outDir: "$deno$",
|
||||
inlineSourceMap: true,
|
||||
lib: ["es2017"],
|
||||
inlineSources: true,
|
||||
target: ts.ScriptTarget.ES2017
|
||||
target: ts.ScriptTarget.ESNext
|
||||
};
|
||||
/*
|
||||
allowJs: true,
|
||||
@ -317,7 +316,7 @@ class TypeScriptHost implements ts.LanguageServiceHost {
|
||||
}
|
||||
|
||||
getDefaultLibFileName(options: ts.CompilerOptions): string {
|
||||
const fn = "lib.d.ts"; // ts.getDefaultLibFileName(options);
|
||||
const fn = "lib.deno.d.ts"; // ts.getDefaultLibFileName(options);
|
||||
util.log("getDefaultLibFileName", fn);
|
||||
const m = resolveModule(fn, "/$asset$/");
|
||||
return m.fileName;
|
||||
|
@ -4,7 +4,7 @@
|
||||
"@types/flatbuffers": "^1.9.0",
|
||||
"@types/source-map-support": "^0.4.1",
|
||||
"flatbuffers": "^1.9.0",
|
||||
"prettier": "^1.13.7",
|
||||
"prettier": "^1.14.0",
|
||||
"rollup": "^0.63.2",
|
||||
"rollup-pluginutils": "^2.3.0",
|
||||
"rollup-plugin-alias": "^1.4.0",
|
||||
@ -18,6 +18,6 @@
|
||||
"tslint": "^5.10.0",
|
||||
"tslint-eslint-rules": "^5.3.1",
|
||||
"tslint-no-circular-imports": "^0.5.0",
|
||||
"typescript": "2.8.3"
|
||||
"typescript": "3.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,9 @@ import { plugin as analyze } from "rollup-plugin-analyzer";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import globals from "rollup-plugin-node-globals";
|
||||
import nodeResolve from "rollup-plugin-node-resolve";
|
||||
import typescript from "rollup-plugin-typescript2";
|
||||
import typescriptPlugin from "rollup-plugin-typescript2";
|
||||
import { createFilter } from "rollup-pluginutils";
|
||||
import typescript from "typescript";
|
||||
|
||||
const mockPath = path.join(__dirname, "js", "mock_builtin");
|
||||
const tsconfig = path.join(__dirname, "tsconfig.json");
|
||||
@ -122,13 +123,17 @@ export default function makeConfig(commandOptions) {
|
||||
}
|
||||
}),
|
||||
|
||||
typescript({
|
||||
typescriptPlugin({
|
||||
// The build script is invoked from `out/:target` so passing an absolute file path is needed
|
||||
tsconfig,
|
||||
|
||||
// This provides any overrides to the `tsconfig.json` that are needed to bundle
|
||||
tsconfigOverride,
|
||||
|
||||
// This provides the locally configured version of TypeScript instead of the plugins
|
||||
// default version
|
||||
typescript,
|
||||
|
||||
// By default, the include path only includes the cwd and below, need to include the root of the project
|
||||
// and build path to be passed to this plugin. This is different front tsconfig.json include
|
||||
include: ["*.ts", `${__dirname}/**/*.ts`, `${process.cwd()}/**/*.ts`],
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 142a1b091123804afa92d03381094db521bb08bb
|
||||
Subproject commit ba730b48a1565ee19ebd336615a50e21dc2eb98d
|
@ -7,7 +7,7 @@
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"target": "es2017",
|
||||
"target": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noImplicitReturns": true,
|
||||
"pretty": true,
|
||||
|
12
yarn.lock
12
yarn.lock
@ -448,9 +448,9 @@ preserve@^0.2.0:
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
|
||||
|
||||
prettier@^1.13.7:
|
||||
version "1.13.7"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281"
|
||||
prettier@^1.14.0:
|
||||
version "1.14.0"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372"
|
||||
|
||||
process-es6@^0.11.6:
|
||||
version "0.11.6"
|
||||
@ -650,9 +650,9 @@ tsutils@^2.12.1:
|
||||
dependencies:
|
||||
tslib "^1.8.1"
|
||||
|
||||
typescript@2.8.3:
|
||||
version "2.8.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170"
|
||||
typescript@3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
|
||||
|
||||
universalify@^0.1.0:
|
||||
version "0.1.2"
|
||||
|
Loading…
Reference in New Issue
Block a user