René's URL Explorer Experiment


Title: Add API to (de)serialize parsed Node objects · Issue #26871 · microsoft/TypeScript · GitHub

Open Graph Title: Add API to (de)serialize parsed Node objects · Issue #26871 · microsoft/TypeScript

X Title: Add API to (de)serialize parsed Node objects · Issue #26871 · microsoft/TypeScript

Description: Search Terms Serialization, deserialization, dumping, dump source file, compiler cache Related issues #25658, TypeStrong/ts-loader#825 Suggestion I'd like to suggest to add an API to be able to (de-)serialize any parsed Node or make pars...

Open Graph Description: Search Terms Serialization, deserialization, dumping, dump source file, compiler cache Related issues #25658, TypeStrong/ts-loader#825 Suggestion I'd like to suggest to add an API to be able to (de...

X Description: Search Terms Serialization, deserialization, dumping, dump source file, compiler cache Related issues #25658, TypeStrong/ts-loader#825 Suggestion I'd like to suggest to add an API to be able to...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/26871

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add API to (de)serialize parsed Node objects","articleBody":"## Search Terms\r\n\r\nSerialization, deserialization, dumping, dump source file, compiler cache\r\n\r\n## Related issues\r\n\r\n#25658, https://github.com/TypeStrong/ts-loader/issues/825\r\n\r\n## Suggestion\r\n\r\nI'd like to suggest to add an API to be able to (de-)serialize any parsed Node or make parsed AST be easy (de-)serializable by, for example, `JSON.stringify()`.\r\n\r\n## Use Cases\r\n\r\nIt can be used to make cache of parsed source files, which can be used between compilations without parsing unchanged source files again.\r\n\r\nFor example, for our project at the moment we have the following times for compilation:\r\n\r\n```\r\n$ ./node_modules/.bin/tsc --diagnostics --skipLibCheck\r\nFiles:          1767\r\nLines:        226078\r\nNodes:       1036945\r\nIdentifiers:  315470\r\nSymbols:      380158\r\nTypes:        137886\r\nMemory used: 497393K\r\nI/O read:      0.63s\r\nI/O write:     2.09s\r\nParse time:   10.79s\r\nBind time:     2.10s\r\nCheck time:   12.47s\r\nEmit time:    10.72s\r\nTotal time:   36.09s\r\n```\r\n\r\n```\r\n$ ./node_modules/.bin/tsc --diagnostics --skipLibCheck --noEmit\r\nFiles:          1767\r\nLines:        226078\r\nNodes:       1036945\r\nIdentifiers:  315470\r\nSymbols:      380158\r\nTypes:        137886\r\nMemory used: 500125K\r\nI/O read:      0.83s\r\nI/O write:     0.00s\r\nParse time:   15.20s\r\nBind time:     3.13s\r\nCheck time:   17.59s\r\nEmit time:     0.00s\r\nTotal time:   35.92s\r\n```\r\n\r\n_(I have no idea why `--noEmit` does not reduce \"Total time\" by \"Emit time\" - it is strange)_\r\n\r\nI hope, if we'll have such API or even cache by `tsc`, it can reduce compilation time, especially `Parse time`.\r\n\r\nAlso, in this case, the TypeScript package can be published with already parsed lib files, what can reduce compilation time even without enabling `--skipLibCheck` option.\r\n\r\n## Examples\r\n\r\nFor example, we can override `getSourceFile` method in `CompilerHost` and provide files from cache if file is not changed since last compilation. It can be done via provided methods like `ts.serializeNode(node: ts.Node): string | ByteArray` / `ts.deserializeNode(nodeData: string | ByteArray): ts.Node`.\r\n\r\nAlso it can be added to `tsc` command as arg `--use-cache` (or something like that) to do it by default (but I believe in this case we also need to have new option like `cacheDir` or `--force`).\r\n\r\nThe similar cache can be found in bazel [rules_typescript](https://github.com/bazelbuild/rules_typescript/blob/d4873377218c49d382275546d11fe590f2fa2ef0/internal/tsc_wrapped/compiler_host.ts#L405-L409), but it is in-memory cache.\r\nIn our internal tool we have very similar in-memory cache too (it allows [speedup multiple compilations the same files](https://github.com/TypeStrong/ts-loader/issues/825#issue-354725524)).\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n* [x] This wouldn't be a breaking change in existing TypeScript / JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. new expression-level syntax)\r\n\r\n","author":{"url":"https://github.com/timocov","@type":"Person","name":"timocov"},"datePublished":"2018-09-04T13:23:57Z","url":"https://github.com/microsoft/TypeScript/issues/26871"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1290f867-0e1c-be97-600b-0272cfcf164a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE3B4:4BB79:2EAC697:3BABB57:6B01CAAC
html-safe-nonce21ce057843a19c34f80071c1251547cec3f095a2b1f9c2dee2c26ac4e6ed2a87
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0I0OjRCQjc5OjJFQUM2OTc6M0JBQkI1Nzo2QjAxQ0FBQyIsInZpc2l0b3JfaWQiOiI0Mzg5MjY4MDY3ODk3NjkwNzk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd35fa3ec7a46182a0790be2a016fd23bbb702ae7d04b3d5ca84c6b22141692c3
hovercard-subject-tagissue:356808394
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/26871/issue_layout
twitter:imagehttps://opengraph.githubassets.com/571c6dcd87d8cac2533b537a884827b160f898379053279ef6a2e036cbced226/microsoft/TypeScript/issues/26871
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/571c6dcd87d8cac2533b537a884827b160f898379053279ef6a2e036cbced226/microsoft/TypeScript/issues/26871
og:image:altSearch Terms Serialization, deserialization, dumping, dump source file, compiler cache Related issues #25658, TypeStrong/ts-loader#825 Suggestion I'd like to suggest to add an API to be able to (de...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametimocov
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/26871#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F26871
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F26871
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/26871
Reloadhttps://github.com/microsoft/TypeScript/issues/26871
Reloadhttps://github.com/microsoft/TypeScript/issues/26871
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/26871
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/26871
Add API to (de)serialize parsed Node objectshttps://github.com/microsoft/TypeScript/issues/26871#top
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 4, 2018https://github.com/microsoft/TypeScript/issues/26871#issue-356808394
#25658https://github.com/microsoft/TypeScript/issues/25658
TypeStrong/ts-loader#825https://github.com/TypeStrong/ts-loader/issues/825
rules_typescripthttps://github.com/bazelbuild/rules_typescript/blob/d4873377218c49d382275546d11fe590f2fa2ef0/internal/tsc_wrapped/compiler_host.ts#L405-L409
speedup multiple compilations the same fileshttps://github.com/TypeStrong/ts-loader/issues/825#issue-354725524
https://github.com/Nipheris
Stanislav Makarov (Nipheris)https://github.com/Nipheris
on Sep 4, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418366653
Canonical S-expressionshttps://en.wikipedia.org/wiki/Canonical_S-expressions
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 4, 2018https://github.com/microsoft/TypeScript/issues/26871#event-1825488062
https://github.com/AlCalzone
AlCalzonehttps://github.com/AlCalzone
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418687928
https://github.com/AlCalzone/virtual-tschttps://github.com/AlCalzone/virtual-tsc
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418705928
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418823910
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#event-1828526989
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418853912
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418854929
https://github.com/ajafff
Klaus Meinhardt (ajafff)https://github.com/ajafff
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418858961
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 5, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-418860445
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 6, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-419021187
Klaus Meinhardt (@ajafff)https://github.com/ajafff
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 11, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-420314089
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://github.com/timocov
Evgeniy Timokhov (timocov)https://github.com/timocov
on Sep 12, 2018https://github.com/microsoft/TypeScript/issues/26871#issuecomment-420657599
Evgeniy Timokhov (timocov)https://github.com/timocov
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Sep 12, 2018https://github.com/microsoft/TypeScript/issues/26871#event-1841342984
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/26871
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/26871
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.