-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Enable defaultJSDocParsingMode
of TypeScript v5.3
#134
Comments
Thanks for the research, @samchon ! I think the best route would be to add a plugin config option which allows the user to specify jsdoc parsing mode. If we have default be off, then plugin packages that rely on it will need to update their docs. Conversely, if default is on, I generally hate to put the burden of keeping up on the plugin maintainers, especially as some aren't maintained anymore. At the same time, it's difficult to justify slowing everyone else down by default. I'm open to input on this from you or anyone else. Right now, I think I'm inclined toward leaving the default to off and requiring an extra config option in the plugins entry. |
Yes, the 2nd way would be suitable for the goal of TypeScript v5.3 update. By the way, may I add a new idea about the 2nd way? I'd thought about the {
"compilerOptions": {
"plugins": [
{
"transform": "typia/lib/transform",
"parseJSDoc": true // not a matter whatever the variable name be
}
]
} |
Yes, that is what I was referring to here
|
@nonara Ts v5.3 be released, and time to determine the spec. |
As I don't know how @nonara determines about the `defaultJSDocParsingMode` and have no idea about the caching logic which can be compatible with before TS 5.2, just send a simple PR that changing `defaultJSDocParsingMode` variable value of `tsc.js` to be zero. Hope @nonara to determine the `defaultJSDocParsingMode` strategy faster, and publish the new version of `ts-patch` for the TypeScript v5.3 update. Thanks for your amazing transformatoin ecosystem contributions.
Considering this spec, I think the cashing feature no more can maintainable, and just check the How do you think about @nonara ? |
Since TypeScript v5.3 update, `tsc` no more parses `JSDocComment`s. Therefore, Therefore, `typia` and `@nestia/core` also cannot utilize those `JSDocComment` related features too, especially "Comment Tags" and "JSON schema generator". However, in relation to this, the upgrade of `ts-patch` continues to be delayed, and I still don't know how long the delay would be continue. Furthermore, there're some `typia`/`nestia` users urging to resolve the `peerDependencies` of `typia`/`nestia` that blocking the TypeScript v5.3 update. Therefore, before the `ts-patch` being prepared, I've decoded to provide `typia`'s own solution for a while. It is the new CLI command `npx typia patch`, and `nestia` also adapts it (`npx nestia setup` command performs it). Also, if the `defaultJSDocParsingMode` value not being patched, `typia` will generate an warning message of TypeScript compiler API. For reference, as it is an warning message, it does not interrupt the TypeScript compilation like the compilation error case. If there're some `typia`/`nestia` users never using "Comment Tags" or "JSON schema generator" at all, they don't need to run the CLI command. This is not mandatory command, but just optional command. Of course, when `ts-patch` being updated, this CLI command would be disabled immediately, if the installed `ts-patch` version is the latest one. Related issues: - samchon/typia#883 - microsoft/TypeScript#55739 - nonara/ts-patch#134
Ok. Doing this properly required a little bit of thought. I didn't like the option of universally overriding the default mode for tsc and losing the perf gains. The idea of forcing all end users to add something to their plugin entry config for libraries like I decided to take another step toward what we'll be doing in tsp-next and allow for basic configuration to be set within the actual plugin library itself. Here's the working PR if you'd like to check it out: #138 I haven't it tested yet or added any tests. I'll try with typia tomorrow and ensure it works. How It WorksWhat you'd be able to do here is specify configuration inside of typia's package.json file. Something like this:
This will allow plugin authors to specify that they need full JSDoc parsing. The way it works now, it will preload the config for all plugins, and if any require that option, it will ensure that the host is updated to use the @samchon Feel free to let me know if you have any comments on that approach. |
@nonara Good idea. By the way, I think it would better to place into the For reference, regardless of which configuration file being targeted, whether In such reasons, I want to suggest such configurations into the In my case, I prefer 4th way. 1.
|
Sounds like there's a misunderstanding. What I've done is made it so that you (the plugin author) can add some config on your plugin library's side, so that your users don't have to change anything. In that case, you simply add the clause to your package.json. That will inform tsp that the plugin within your package requires full jsdoc during tsc. In the plugin side, it wouldn't make sense to use tsconfig, as most libraries don't ship their tsconfig file, but all have a package file. The way we're doing it is a common convention for this sort of thing, and it provides a place within the package file to define tsp specific detail. Also – we definitely wouldn't add anything to In the future, we'll be moving plugins to a special tsp section in tsconfig, but right now there is no change being made to user config. |
Oh, I understood. It sounds amazing. |
Added to |
Outline
microsoft/TypeScript#55739
After TypeScript v5.3 being released, it will no more parse
JSDocComments
as default.To turn it on,
ts.Program
instance must be created withts.CompilerHost.jsDocParsingMode
configuration like below. By the way, transformer libraries can't create thets.Program
instance by themselves, so if there're some transformer libraries utilizing theJSDocComment
feature, they would be disabled after the TypeScript v5.3 release.To support those
JSDocComment
utilizing transformers,ts-patch
needs to hack thedefaultJSDocParsingMode
variable of below.Suggestion
I think there can be two options.
defaultJSDocParsingMode
value globallyts-patch install --jsDoc
The 1st way is to changing the
defaultJSDocParsingMode
variable oftsc
to be0
as default.Comparing with other fast compilers like
swc
andesbuild
, standard TypeScript compiler is hundreds of times slower. Therefore, as transformer library users are already enduring such slower compilation speed, I think they may not consider about the performance enhancement by skippingJsDocComment
parsing.The 2nd way is to providing special CLI argument
ts-patch install --jsDoc
.Although saving compilation time by ignoring
JsDocComment
does not mean for transformer library users, it is the new formal spec of the standard TypeScript compiler. Therefore, rather than changing thedefaultJSDocParsingMode
variables globally, it may be more correct to give the user a choice.The text was updated successfully, but these errors were encountered: