New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add back typescript version number and add Deno.version object. #1788
Conversation
92bf38d
to
93a0f8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple comments.
Also the diff is pulling in sourcemap-codec
into third_party/node_modules
and I am not sure why. Seems like something we don't want/need in the project.
js/version.ts
Outdated
@@ -0,0 +1,15 @@ | |||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. | |||
// tslint:disable-next-line:no-reference | |||
/// <reference path="./const.d.ts" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, I would just add it to the globals in globals.ts
:
Lines 35 to 38 in 4dc4329
declare global { | |
const console: consoleTypes.Console; | |
const setTimeout: typeof timers.setTimeout; | |
} |
Then you won't need an additional type declaration file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The situation seems a little tricky here. rollup-plugin-replace replaces the occurence even in type declaration. So const TS_VERSION: string
becomes const "3.2.1": string;
before passed to typescript.
I found that rollup-plugin-replace doesn't do any parsing of the source code. So we can do something like: { version: "TS_VERSION" }
. This seems better because it doesn't require any type declaration. So I swtich to this pattern.
js/main.ts
Outdated
@@ -24,12 +25,14 @@ export default function denoMain() { | |||
libdeno.builtinModules["deno"] = deno; | |||
Object.freeze(libdeno.builtinModules); | |||
|
|||
version.deno = startResMsg.denoVersion(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider adding a set function that is exported from version.ts
and marked @internal
to do the setting, like we have with setEnv()
now. This will make it more maintainable in the long term and keep logic out of here. And setVersions()
should freeze the version
object too.
eb0cb79
to
269aba6
Compare
rollup-plugin-replace@2.1.0 depends on magic-string@^0.25.1. If we pinned the version of rollup-plugin-replace to v2.0.0 which depends |
This doesn't need any type declartion
269aba6
to
849b184
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final comment.
I understand the sourcemap-codec
as well now, so am ok with that.
}; | ||
|
||
/** | ||
* Sets the deno and v8 versions and freezes the version object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would set this to @internal
so it doesn't get leaked to the runtime type library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - this is great to have back - and also Deno.version
- thank you!
This is a continuation of #1676. This adds back the printing of typescript version number.
This also addresses the comment:
This PR uses rollup-plugin-replace for embedding typescript version in the bundle.
depends on denoland/deno_third_party#33