Skip to content
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

Implement the host side of the deprecations API #279

Merged
merged 7 commits into from
Apr 3, 2024
Merged

Conversation

jathak
Copy link
Member

@jathak jathak commented Apr 1, 2024

@jathak jathak requested a review from nex3 April 1, 2024 21:37
Copy link
Contributor

@ntkme ntkme Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to not duplicate this list of deprecations on every host implementation. Either that we just don't expose the list of all deprecations as part of the JS API, or we implement a protocol to allow embedded host to send query to compiler and ask this information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not having any metadata as part of the client API would mean that TypeScript users don't get any static checking of their deprecation names. That's not an unbearable cost, but I'd prefer to have better devx there if possible.

I do agree that we need a better story for synchronizing the deprecation list across various repos and packages, though. As it stands, every time we need to add a new deprecation it'll have to be added to Dart Sass, the language repo, and the embedded host separately even if it's a pure language-level deprecation that has no bearing on the JS API. What's worse, I don't think we have any verification in place that will fail if we forget one or more of these locations.

I wonder if it makes sense to include a JSON file (or a text proto?) that just lists all the known deprecations, from which we can generate the code representations. Then we can have simple diff tests that verify that all the generated versions are based on the latest deprecation list. @jathak what do you think?

Copy link
Contributor

@ntkme ntkme Apr 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of maintaining a text proto, which can generate ts definition and be directly used as argument in embedded-protocol.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think having a single representation and generating code for each implementation makes sense. I'd vote for writing it in YAML since it's a better authoring experience than JSON and I don't think the Dart protobuf library supports parsing text protos (google/protobuf.dart#125).

Should this block releasing the deprecations API, or should we release it with just a simple synchronization test and then switch to generating the code afterwards?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the latter is fine.

@@ -137,6 +141,12 @@ export function newCompileStringRequest(
return request;
}

function validDeprecationId(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: document this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not having any metadata as part of the client API would mean that TypeScript users don't get any static checking of their deprecation names. That's not an unbearable cost, but I'd prefer to have better devx there if possible.

I do agree that we need a better story for synchronizing the deprecation list across various repos and packages, though. As it stands, every time we need to add a new deprecation it'll have to be added to Dart Sass, the language repo, and the embedded host separately even if it's a pure language-level deprecation that has no bearing on the JS API. What's worse, I don't think we have any verification in place that will fail if we forget one or more of these locations.

I wonder if it makes sense to include a JSON file (or a text proto?) that just lists all the known deprecations, from which we can generate the code representations. Then we can have simple diff tests that verify that all the generated versions are based on the latest deprecation list. @jathak what do you think?

@jathak jathak requested a review from nex3 April 3, 2024 02:08
package.json Outdated
"version": "1.72.0",
"protocol-version": "2.5.0",
"compiler-version": "1.72.0",
"version": "1.74.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to update the version and compiler-version here manually, it's done as part of the release process.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I got the error for the protocol version and just updated all of them. Fixed.

@jathak jathak merged commit 573e2e3 into main Apr 3, 2024
16 checks passed
@jathak jathak deleted the deprecations branch April 3, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants