Initial code test
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-internal (push) Has been cancelled

This commit is contained in:
chris committed 2026-08-26 11:51:58 -04:00
commit d4fae15f5c
1696 files changed
+271223

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
You must cause any modified files to carry prominent notices stating that You changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
+436
View File
@@ -0,0 +1,436 @@
NOTICES AND INFORMATION
Do Not Translate or Localize
This software incorporates material from third parties.
Microsoft makes certain open source code available at https://3rdpartysource.microsoft.com,
or you may send a check or money order for US $5.00, including the product name,
the open source component name, platform, and version number, to:
Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA
Notwithstanding any other terms, you may reverse engineer this software to the extent
required to debug changes to any libraries licensed under the GNU Lesser General Public License.
------------------- DefinitelyTyped --------------------
This file is based on or incorporates material from the projects listed below (collectively "Third Party Code"). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.
DefinitelyTyped
This project is licensed under the MIT license. Copyrights are respective of each contributor listed at the beginning of each definition file. Provided for Informational Purposes Only
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------------
------------------- Unicode --------------------
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
Unicode Data Files include all data files under the directories
http://www.unicode.org/Public/, http://www.unicode.org/reports/,
http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and
http://www.unicode.org/utility/trac/browser/.
Unicode Data Files do not include PDF online code charts under the
directory http://www.unicode.org/Public/.
Software includes any source code published in the Unicode Standard
or under the directories
http://www.unicode.org/Public/, http://www.unicode.org/reports/,
http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and
http://www.unicode.org/utility/trac/browser/.
NOTICE TO USER: Carefully read the following legal agreement.
BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
TERMS AND CONDITIONS OF THIS AGREEMENT.
IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
THE DATA FILES OR SOFTWARE.
COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1991-2017 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that either
(a) this copyright and permission notice appear with all copies
of the Data Files or Software, or
(b) this copyright and permission notice appear in associated
Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
-------------------------------------------------------------------------------------
-------------------Document Object Model-----------------------------
DOM
W3C License
This work is being provided by the copyright holders under the following license.
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following
on ALL copies of the work or portions thereof, including modifications:
* The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
* Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
* Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived
from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
Disclaimers
THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission.
Title to copyright in this work will at all times remain with copyright holders.
---------
DOM
Copyright © 2018 WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License: Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More_considerations for the public: wiki.creativecommons.org/Considerations_for_licensees =======================================================================
Creative Commons Attribution 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 -- Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 -- Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: a. reproduce and Share the Licensed Material, in whole or in part; and b. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material. 5. Downstream recipients. a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receivLine truncated
--------------------------------------------------------------------------------
----------------------Web Background Synchronization------------------------------
Web Background Synchronization Specification
Portions of spec © by W3C
W3C Community Final Specification Agreement
To secure commitments from participants for the full text of a Community or Business Group Report, the group may call for voluntary commitments to the following terms; a "summary" is
available. See also the related "W3C Community Contributor License Agreement".
1. The Purpose of this Agreement.
This Agreement sets forth the terms under which I make certain copyright and patent rights available to you for your implementation of the Specification.
Any other capitalized terms not specifically defined herein have the same meaning as those terms have in the "W3C Patent Policy", and if not defined there, in the "W3C Process Document".
2. Copyrights.
2.1. Copyright Grant. I grant to you a perpetual (for the duration of the applicable copyright), worldwide, non-exclusive, no-charge, royalty-free, copyright license, without any obligation for accounting to me, to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, distribute, and implement the Specification to the full extent of my copyright interest in the Specification.
2.2. Attribution. As a condition of the copyright grant, you must include an attribution to the Specification in any derivative work you make based on the Specification. That attribution must include, at minimum, the Specification name and version number.
3. Patents.
3.1. Patent Licensing Commitment. I agree to license my Essential Claims under the W3C Community RF Licensing Requirements. This requirement includes Essential Claims that I own and any that I have the right to license without obligation of payment or other consideration to an unrelated third party. W3C Community RF Licensing Requirements obligations made concerning the Specification and described in this policy are binding on me for the life of the patents in question and encumber the patents containing Essential Claims, regardless of changes in participation status or W3C Membership. I also agree to license my Essential Claims under the W3C Community RF Licensing Requirements in derivative works of the Specification so long as all normative portions of the Specification are maintained and that this licensing commitment does not extend to any portion of the derivative work that was not included in the Specification.
3.2. Optional, Additional Patent Grant. In addition to the provisions of Section 3.1, I may also, at my option, make certain intellectual property rights infringed by implementations of the Specification, including Essential Claims, available by providing those terms via the W3C Web site.
4. No Other Rights. Except as specifically set forth in this Agreement, no other express or implied patent, trademark, copyright, or other property rights are granted under this Agreement, including by implication, waiver, or estoppel.
5. Antitrust Compliance. I acknowledge that I may compete with other participants, that I am under no obligation to implement the Specification, that each participant is free to develop competing technologies and standards, and that each party is free to license its patent rights to third parties, including for the purpose of enabling competing technologies and standards.
6. Non-Circumvention. I agree that I will not intentionally take or willfully assist any third party to take any action for the purpose of circumventing my obligations under this Agreement.
7. Transition to W3C Recommendation Track. The Specification developed by the Project may transition to the W3C Recommendation Track. The W3C Team is responsible for notifying me that a Corresponding Working Group has been chartered. I have no obligation to join the Corresponding Working Group. If the Specification developed by the Project transitions to the W3C Recommendation Track, the following terms apply:
7.1. If I join the Corresponding Working Group. If I join the Corresponding Working Group, I will be subject to all W3C rules, obligations, licensing commitments, and policies that govern that Corresponding Working Group.
7.2. If I Do Not Join the Corresponding Working Group.
7.2.1. Licensing Obligations to Resulting Specification. If I do not join the Corresponding Working Group, I agree to offer patent licenses according to the W3C Royalty-Free licensing requirements described in Section 5 of the W3C Patent Policy for the portions of the Specification included in the resulting Recommendation. This licensing commitment does not extend to any portion of an implementation of the Recommendation that was not included in the Specification. This licensing commitment may not be revoked but may be modified through the exclusion process defined in Section 4 of the W3C Patent Policy. I am not required to join the Corresponding Working Group to exclude patents from the W3C Royalty-Free licensing commitment, but must otherwise follow the normal exclusion procedures defined by the W3C Patent Policy. The W3C Team will notify me of any Call for Exclusion in the Corresponding Working Group as set forth in Section 4.5 of the W3C Patent Policy.
7.2.2. No Disclosure Obligation. If I do not join the Corresponding Working Group, I have no patent disclosure obligations outside of those set forth in Section 6 of the W3C Patent Policy.
8. Conflict of Interest. I will disclose significant relationships when those relationships might reasonably be perceived as creating a conflict of interest with my role. I will notify W3C of any change in my affiliation using W3C-provided mechanisms.
9. Representations, Warranties and Disclaimers. I represent and warrant that I am legally entitled to grant the rights and promises set forth in this Agreement. IN ALL OTHER RESPECTS THE SPECIFICATION IS PROVIDED “AS IS.” The entire risk as to implementing or otherwise using the Specification is assumed by the implementer and user. Except as stated herein, I expressly disclaim any warranties (express, implied, or otherwise), including implied warranties of merchantability, non-infringement, fitness for a particular purpose, or title, related to the Specification. IN NO EVENT WILL ANY PARTY BE LIABLE TO ANY OTHER PARTY FOR LOST PROFITS OR ANY FORM OF INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER FROM ANY CAUSES OF ACTION OF ANY KIND WITH RESPECT TO THIS AGREEMENT, WHETHER BASED ON BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, AND WHETHER OR NOT THE OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. All of my obligations under Section 3 regarding the transfer, successors in interest, or assignment of Granted Claims will be satisfied if I notify the transferee or assignee of any patent that I know contains Granted Claims of the obligations under Section 3. Nothing in this Agreement requires me to undertake a patent search.
10. Definitions.
10.1. Agreement. “Agreement” means this W3C Community Final Specification Agreement.
10.2. Corresponding Working Group. “Corresponding Working Group” is a W3C Working Group that is chartered to develop a Recommendation, as defined in the W3C Process Document, that takes the Specification as an input.
10.3. Essential Claims. “Essential Claims” shall mean all claims in any patent or patent application in any jurisdiction in the world that would necessarily be infringed by implementation of the Specification. A claim is necessarily infringed hereunder only when it is not possible to avoid infringing it because there is no non-infringing alternative for implementing the normative portions of the Specification. Existence of a non-infringing alternative shall be judged based on the state of the art at the time of the publication of the Specification. The following are expressly excluded from and shall not be deemed to constitute Essential Claims:
10.3.1. any claims other than as set forth above even if contained in the same patent as Essential Claims; and
10.3.2. claims which would be infringed only by:
portions of an implementation that are not specified in the normative portions of the Specification, or
enabling technologies that may be necessary to make or use any product or portion thereof that complies with the Specification and are not themselves expressly set forth in the Specification (e.g., semiconductor manufacturing technology, compiler technology, object-oriented technology, basic operating system technology, and the like); or
the implementation of technology developed elsewhere and merely incorporated by reference in the body of the Specification.
10.3.3. design patents and design registrations.
For purposes of this definition, the normative portions of the Specification shall be deemed to include only architectural and interoperability requirements. Optional features in the RFC 2119 sense are considered normative unless they are specifically identified as informative. Implementation examples or any other material that merely illustrate the requirements of the Specification are informative, rather than normative.
10.4. I, Me, or My. “I,” “me,” or “my” refers to the signatory.
10.5 Project. “Project” means the W3C Community Group or Business Group for which I executed this Agreement.
10.6. Specification. “Specification” means the Specification identified by the Project as the target of this agreement in a call for Final Specification Commitments. W3C shall provide the authoritative mechanisms for the identification of this Specification.
10.7. W3C Community RF Licensing Requirements. “W3C Community RF Licensing Requirements” license shall mean a non-assignable, non-sublicensable license to make, have made, use, sell, have sold, offer to sell, import, and distribute and dispose of implementations of the Specification that:
10.7.1. shall be available to all, worldwide, whether or not they are W3C Members;
10.7.2. shall extend to all Essential Claims owned or controlled by me;
10.7.3. may be limited to implementations of the Specification, and to what is required by the Specification;
10.7.4. may be conditioned on a grant of a reciprocal RF license (as defined in this policy) to all Essential Claims owned or controlled by the licensee. A reciprocal license may be required to be available to all, and a reciprocal license may itself be conditioned on a further reciprocal license from all.
10.7.5. may not be conditioned on payment of royalties, fees or other consideration;
10.7.6. may be suspended with respect to any licensee when licensor issued by licensee for infringement of claims essential to implement the Specification or any W3C Recommendation;
10.7.7. may not impose any further conditions or restrictions on the use of any technology, intellectual property rights, or other restrictions on behavior of the licensee, but may include reasonable, customary terms relating to operation or maintenance of the license relationship such as the following: choice of law and dispute resolution;
10.7.8. shall not be considered accepted by an implementer who manifests an intent not to accept the terms of the W3C Community RF Licensing Requirements license as offered by the licensor.
10.7.9. The RF license conforming to the requirements in this policy shall be made available by the licensor as long as the Specification is in effect. The term of such license shall be for the life of the patents in question.
I am encouraged to provide a contact from which licensing information can be obtained and other relevant licensing information. Any such information will be made publicly available.
10.8. You or Your. “You,” “you,” or “your” means any person or entity who exercises copyright or patent rights granted under this Agreement, and any person that person or entity controls.
-------------------------------------------------------------------------------------
------------------- WebGL -----------------------------
Copyright (c) 2018 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
------------------------------------------------------
---------------------------------------------------------
github.com/zeebo/xxh3 v1.1.0 - BSD-2-Clause
Copyright (c) 2019, Jeff Wendling
Copyright (c) 2012-2014, Yann Collet
Copyright (c) <year> <owner> . All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------
---------------------------------------------------------
github.com/go-json-experiment/json v0.0.0-20260623181947-01eb4420fa68 - BSD-3-Clause
Copyright 2010 The Go Authors
Copyright 2011 The Go Authors
Copyright 2016 The Go Authors
Copyright 2018 The Go Authors
Copyright 2020 The Go Authors
Copyright 2021 The Go Authors
Copyright 2022 The Go Authors
Copyright 2023 The Go Authors
Copyright 2024 The Go Authors
Copyright (c) 2020 The Go Authors
Copyright (c) <year> <owner> . All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------
---------------------------------------------------------
golang.org/x/sync v0.21.0 - BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
Copyright 2009 The Go Authors
Copyright 2013 The Go Authors
Copyright 2016 The Go Authors
Copyright 2017 The Go Authors
Copyright 2019 The Go Authors
BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
---------------------------------------------------------
---------------------------------------------------------
golang.org/x/sys v0.46.0 - BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
Copyright 2009 The Go Authors
Copyright 2010 The Go Authors
Copyright 2011 The Go Authors
Copyright 2012 The Go Authors
Copyright 2013 The Go Authors
Copyright 2014 The Go Authors
Copyright 2015 The Go Authors
Copyright 2016 The Go Authors
Copyright 2017 The Go Authors
Copyright 2018 The Go Authors
Copyright 2019 The Go Authors
Copyright 2020 The Go Authors
Copyright 2021 The Go Authors
Copyright 2022 The Go Authors
Copyright 2023 The Go Authors
Copyright 2024 The Go Authors
Copyright 2025 The Go Authors
Copyright 2009,2010 The Go Authors
BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
---------------------------------------------------------
---------------------------------------------------------
golang.org/x/term v0.44.0 - BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
Copyright 2009 The Go Authors
Copyright 2011 The Go Authors
Copyright 2013 The Go Authors
Copyright 2019 The Go Authors
Copyright 2021 The Go Authors
BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
---------------------------------------------------------
---------------------------------------------------------
golang.org/x/text v0.38.0 - BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
(c) AeHa (c)
(c) EeAoq (c)
(c) EAiE (c) A
(c) lEEe (c) AE
(c) (c) AAEE (c)
(c) oav!A (c) AY
(c) aA"AE (c) 1AE (c)
Copyright 2009 The Go Authors
Copyright 2011 The Go Authors
Copyright 2012 The Go Authors
Copyright 2013 The Go Authors
Copyright 2014 The Go Authors
Copyright 2015 The Go Authors
Copyright 2016 The Go Authors
Copyright 2017 The Go Authors
Copyright 2018 The Go Authors
Copyright 2019 The Go Authors
Copyright 2021 The Go Authors
Copyright 2025 The Go Authors
BSD-3-Clause AND LicenseRef-scancode-google-patent-license-golang
---------------------------------------------------------
---------------------------------------------------------
github.com/klauspost/cpuid/v2 v2.2.10 - MIT
Copyright (c) 2015 Klaus Post
Copyright (c) 2020 Klaus Post
Copyright (c) 2021 Klaus Post
Copyright 2018 The Go Authors
Copyright (c) 2015- Klaus Post & Contributors
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------------------------
---------------------------------------------------------
github.com/Microsoft/go-winio v0.6.2 - MIT
Copyright (c) 2015 Microsoft
Copyright 2013 The Go Authors
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---------------------------------------------------------
---------------------------------------------------------
github.com/mackerelio/go-osstat v0.2.7 - Apache-2.0
Copyright 2017-2019 Hatena Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---------------------------------------------------------
---------------------------------------------------------
parcel-bundler/watcher 8926bb8b281733bbfcaf69bb4e62ab7a1431c42a - MIT
Copyright Node.js contributors
Copyright 2012-2020 Facebook, Inc.
Copyright (c) 2017-present Devon Govett
MIT License
Copyright (c) 2017-present Devon Govett
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---------------------------------------------------------
+49
View File
@@ -0,0 +1,49 @@
# TypeScript
[![CI](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml/badge.svg)](https://github.com/microsoft/TypeScript/actions/workflows/ci.yml)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript)
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://devblogs.microsoft.com/typescript/) and [Bluesky](https://bsky.app/profile/typescriptlang.org).
Find others who are using TypeScript at [our community page](https://www.typescriptlang.org/community/).
## Installing
For the latest stable version:
```bash
npm install -D typescript
```
For our nightly builds:
```bash
npm install -D typescript@next
```
## Contribute
There are many ways to [contribute](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [Stack Overflow](https://stackoverflow.com/questions/tagged/typescript).
* Help each other in the [TypeScript Community Discord](https://discord.gg/typescript).
* Join the [#typescript](https://bsky.app/search?q=%23typescript) discussion on Bluesky.
* [Contribute bug fixes](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md).
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
with any additional questions or comments.
## Documentation
* [TypeScript in 5 minutes](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html)
* [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
* [Homepage](https://www.typescriptlang.org/)
## Roadmap
For details on our planned features and future direction, please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap).
Generated Vendored Executable
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env node
import "../lib/tsc.js";
+529
View File
@@ -0,0 +1,529 @@
/// <reference path="../node/node.d.ts" preserve="true" />
import { CompletionItemKind } from "#enums/completionItemKind";
import { DiagnosticCategory } from "#enums/diagnosticCategory";
import { ElementFlags } from "#enums/elementFlags";
import { ModuleKind } from "#enums/moduleKind";
import { NodeBuilderFlags } from "#enums/nodeBuilderFlags";
import { ObjectFlags } from "#enums/objectFlags";
import { SignatureFlags } from "#enums/signatureFlags";
import { SignatureKind } from "#enums/signatureKind";
import { SymbolFlags } from "#enums/symbolFlags";
import { TypeFlags } from "#enums/typeFlags";
import { TypePredicateKind } from "#enums/typePredicateKind";
import { type __String, type Expression, type Identifier, ModifierFlags, type Node, type Path, type SourceFile, type SyntaxKind, type TypeNode } from "../../ast/index.ts";
import type { APIOptions, LSPConnectionOptions } from "../options.ts";
import type { CompilerOptions, ConfigResponse, DocumentIdentifier, DocumentPosition, LSPUpdateSnapshotParams, ProjectResponse, SignatureResponse, SourceFileMetadata, SymbolResponse, TypeResponse, UpdateSnapshotParams, UpdateSnapshotResponse } from "../proto.ts";
import { SourceFileCache } from "../sourceFileCache.ts";
import type { RequestTiming, TimingAccumulators, TimingInfo } from "../timing.ts";
import { Client, type ClientSocketOptions, type ClientSpawnOptions } from "./client.ts";
import type { AssertsIdentifierTypePredicate, AssertsThisTypePredicate, BigIntLiteralType, BooleanLiteralType, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, JSDocTagInfo, LiteralType, NumberLiteralType, ObjectType, StringLiteralType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType } from "./types.ts";
export { documentURIToFileName, fileNameToDocumentURI } from "../path.ts";
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
export type { APIOptions, AssertsIdentifierTypePredicate, AssertsThisTypePredicate, BigIntLiteralType, BooleanLiteralType, ClientSocketOptions, ClientSpawnOptions, CompilerOptions, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, DocumentIdentifier, DocumentPosition, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, JSDocTagInfo, LiteralType, LSPConnectionOptions, NumberLiteralType, ObjectType, RequestTiming, SourceFileMetadata, StringLiteralType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TimingAccumulators, TimingInfo, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType };
export declare class API<FromLSP extends boolean = false> {
private client;
private sourceFileCache;
private toPath;
private initialized;
private activeSnapshots;
private latestSnapshot;
readonly internal: InternalAPI;
constructor(options?: APIOptions | LSPConnectionOptions);
/**
* Create an API instance from an existing LSP connection's API session.
* Use this when connecting to an API pipe provided by an LSP server via custom/initializeAPISession.
*/
static fromLSPConnection(options: LSPConnectionOptions): Promise<API<true>>;
private ensureInitialized;
parseConfigFile(file: DocumentIdentifier): Promise<ConfigResponse>;
updateSnapshot(params?: FromLSP extends true ? LSPUpdateSnapshotParams : UpdateSnapshotParams): Promise<Snapshot>;
close(): Promise<void>;
clearSourceFileCache(): void;
/**
* Returns a snapshot of collected timing information for requests made
* through this API instance: client-measured round-trip latency and bytes
* transferred, folded together with the server's own per-request processing
* time and an estimated transport overhead (round-trip minus server time).
*
* Fetching the snapshot issues a lightweight request to the server to
* retrieve its timing collection. Collection must be enabled via the
* `collectTiming` option; when it is not, the returned snapshot has
* `enabled: false` and zeroed totals.
*/
getTimingInfo(): Promise<TimingInfo>;
/** Clears all accumulated timing totals and recent-request history, on both the client and the server. */
resetTimingInfo(): Promise<void>;
}
export declare class InternalAPI {
private client;
private ensureInitialized;
/** @internal */
constructor(client: Client, ensureInitialized: () => Promise<void>);
startCPUProfile(dir: string): Promise<void>;
stopCPUProfile(): Promise<string>;
saveHeapProfile(dir: string): Promise<string>;
}
export declare class Snapshot {
readonly id: number;
private projectMap;
private toPath;
private client;
private disposed;
private onDispose;
private snapshotRegistry;
constructor(data: UpdateSnapshotResponse, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path, onDispose: () => void);
getProjects(): readonly Project[];
getProject(configFileName: string): Project | undefined;
getDefaultProjectForFile(file: DocumentIdentifier): Promise<Project | undefined>;
[globalThis.Symbol.dispose](): void;
dispose(): Promise<void>;
isDisposed(): boolean;
private ensureNotDisposed;
}
declare class SnapshotObjectRegistry {
private readonly symbols;
private readonly client;
private readonly snapshotId;
private readonly resolveProject;
constructor(client: Client, snapshotId: number, resolveProject: (projectId: Path) => Project | undefined);
/** Resolve a project id (a config file path) to its Project within this snapshot. */
getProject(projectId: Path): Project | undefined;
getOrCreateSymbol(data: SymbolResponse): Symbol;
getSymbol(id: number): Symbol | undefined;
clear(): void;
fetchSymbol(source: Symbol | Signature | Type, method: string, handle: number | undefined, projectId?: Path): Promise<Symbol>;
fetchSymbols(source: Symbol | Signature | Type, method: string, handles?: readonly number[], projectId?: Path): Promise<readonly Symbol[]>;
}
declare class ProjectObjectRegistry {
private client;
private snapshotId;
private project;
private snapshotRegistry;
private types;
private signatures;
constructor(client: Client, snapshotId: number, project: Project, snapshotRegistry: SnapshotObjectRegistry);
getOrCreateSymbol(data: SymbolResponse): Symbol;
getSymbol(id: number): Symbol | undefined;
getOrCreateType(data: TypeResponse): TypeObject;
getType(id: number): TypeObject | undefined;
getOrCreateSignature(data: SignatureResponse): Signature;
getSignature(id: number): Signature | undefined;
clear(): void;
fetchType<T extends Type>(source: Symbol | Signature | Type, method: string, handle: number | false | undefined): Promise<T>;
fetchSymbol(source: Symbol | Signature | Type, method: string, handle: number | undefined): Promise<Symbol>;
fetchSignature(source: Symbol | Signature | Type, method: string, handle: number | undefined): Promise<Signature>;
fetchTypes(source: Symbol | Signature | Type, method: string, handles?: readonly number[]): Promise<readonly Type[]>;
fetchSymbols(source: Symbol | Signature | Type, method: string, handles?: readonly number[]): Promise<readonly Symbol[]>;
fetchBaseTypes(source: Type): Promise<readonly Type[]>;
}
export declare class Project {
readonly id: Path;
readonly configFileName: string;
readonly compilerOptions: CompilerOptions;
readonly rootFiles: readonly string[];
readonly program: Program;
readonly checker: Checker;
readonly emitter: Emitter;
private client;
constructor(data: ProjectResponse, snapshotId: number, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path, snapshotRegistry: SnapshotObjectRegistry);
dispose(): void;
}
export declare class Program {
private snapshotId;
private project;
private client;
private sourceFileCache;
private toPath;
private decoder;
private sourceFileMetadataCache;
constructor(snapshotId: number, project: Project, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path);
getCompilerOptions(): CompilerOptions;
getSourceFile(file: DocumentIdentifier): Promise<SourceFile | undefined>;
getSourceFileNames(): Promise<readonly string[]>;
/**
* Returns program-stored metadata for the given source file, or `undefined` if the file
* is not part of the program. Metadata is fetched lazily per file and cached on this
* `Program` instance.
*/
getSourceFileMetadata(fileName: string): Promise<SourceFileMetadata | undefined>;
/**
* Returns program-stored metadata for the source file at the given path, or `undefined`
* if the file is not part of the program. Like {@link getSourceFileMetadata}, but skips
* the file name to path conversion. Metadata is fetched lazily per file and cached on
* this `Program` instance.
*/
getSourceFileMetadataByPath(path: Path): Promise<SourceFileMetadata | undefined>;
private fetchSourceFileMetadata;
/**
* Returns whether the given source file was loaded as part of an external library
* (e.g. a dependency resolved from `node_modules`). The underlying program metadata is
* fetched lazily per file and cached on this `Program` instance.
*/
isSourceFileFromExternalLibrary(file: SourceFile): Promise<boolean>;
/**
* Returns whether the given source file is a default library file (e.g. `lib.d.ts`).
* The underlying program metadata is fetched lazily per file and cached on this
* `Program` instance.
*/
isSourceFileDefaultLibrary(file: SourceFile): Promise<boolean>;
/**
* Get syntactic (parse) diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getSyntacticDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
/**
* Get binder diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getBindDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
/**
* Get semantic (type-check) diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getSemanticDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
/**
* Get suggestion diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getSuggestionDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
/**
* Get declaration emit diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getDeclarationDiagnostics(file?: DocumentIdentifier): Promise<readonly Diagnostic[]>;
/**
* Get program-wide diagnostics for the project, including compiler options diagnostics.
*/
getProgramDiagnostics(): Promise<readonly Diagnostic[]>;
/**
* Get global (non-file-specific) semantic diagnostics for the project.
*/
getGlobalDiagnostics(): Promise<readonly Diagnostic[]>;
/**
* Get config file parsing diagnostics for the project.
*/
getConfigFileParsingDiagnostics(): Promise<readonly Diagnostic[]>;
}
export declare class Checker {
private snapshotId;
private project;
private client;
private objectRegistry;
private wellKnownSymbols;
constructor(snapshotId: number, project: Project, client: Client, objectRegistry: ProjectObjectRegistry);
dispose(): void;
getSymbolAtLocation(node: Node): Promise<Symbol | undefined>;
getSymbolAtLocation(nodes: readonly Node[]): Promise<(Symbol | undefined)[]>;
getSymbolAtPosition(file: DocumentIdentifier, position: number): Promise<Symbol | undefined>;
getSymbolAtPosition(file: DocumentIdentifier, positions: readonly number[]): Promise<(Symbol | undefined)[]>;
getTypeOfSymbol(symbol: Symbol): Promise<Type | undefined>;
getTypeOfSymbol(symbols: readonly Symbol[]): Promise<(Type | undefined)[]>;
/**
* Get the declared type of a symbol. Always returns a type; for symbols whose
* declared type cannot be determined the checker yields the error type (use
* {@link Type.isErrorType} to detect it).
*/
getDeclaredTypeOfSymbol(symbol: Symbol): Promise<Type>;
getReferencesToSymbolInFile(file: DocumentIdentifier, symbol: Symbol): Promise<NodeHandle[]>;
getReferencedSymbolsForNode(node: Node, position: number): Promise<ReferencedSymbolEntry[]>;
getSignatureUsage(signatureDecl: Node): Promise<SignatureUsage[]>;
getCompletionsAtPosition(document: string, position: number, options?: CompletionOptions): Promise<CompletionInfo | undefined>;
getTypeAtLocation(node: Node): Promise<Type | undefined>;
getTypeAtLocation(nodes: readonly Node[]): Promise<(Type | undefined)[]>;
getSignaturesOfType(type: Type, kind: SignatureKind): Promise<readonly Signature[]>;
getResolvedSignature(node: Node): Promise<Signature | undefined>;
getTypeAtPosition(file: DocumentIdentifier, position: number): Promise<Type | undefined>;
getTypeAtPosition(file: DocumentIdentifier, positions: readonly number[]): Promise<(Type | undefined)[]>;
resolveName(name: string, meaning: SymbolFlags, location?: Node | DocumentPosition, excludeGlobals?: boolean): Promise<Symbol | undefined>;
getResolvedSymbol(node: Identifier): Promise<Symbol | undefined>;
getContextualType(node: Expression): Promise<Type | undefined>;
getBaseTypeOfLiteralType(type: Type): Promise<Type | undefined>;
getNonNullableType(type: Type): Promise<Type | undefined>;
getTypeFromTypeNode(node: TypeNode): Promise<Type | undefined>;
getWidenedType(type: Type): Promise<Type | undefined>;
getParameterType(signature: Signature, index: number): Promise<Type | undefined>;
isArrayLikeType(type: Type): Promise<boolean>;
isTypeAssignableTo(source: Type, target: Type): Promise<boolean>;
getShorthandAssignmentValueSymbol(node: Node): Promise<Symbol | undefined>;
/**
* Get the type of a symbol as narrowed at a specific location. Always returns
* a type; for symbols whose type cannot be determined the checker yields the
* error type (use {@link Type.isErrorType} to detect it).
*/
getTypeOfSymbolAtLocation(symbol: Symbol, location: Node): Promise<Type>;
private getIntrinsicType;
getAnyType(): Promise<Type>;
getStringType(): Promise<Type>;
getNumberType(): Promise<Type>;
getBooleanType(): Promise<Type>;
getVoidType(): Promise<Type>;
getUndefinedType(): Promise<Type>;
getNullType(): Promise<Type>;
getNeverType(): Promise<Type>;
getUnknownType(): Promise<Type>;
getBigIntType(): Promise<Type>;
getESSymbolType(): Promise<Type>;
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: number): Promise<TypeNode | undefined>;
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Promise<Node | undefined>;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: number): Promise<string>;
isContextSensitive(node: Node): Promise<boolean>;
isArrayType(type: Type): Promise<boolean>;
isTupleType(type: Type): Promise<boolean>;
getReturnTypeOfSignature(signature: Signature): Promise<Type | undefined>;
getRestTypeOfSignature(signature: Signature): Promise<Type | undefined>;
getTypePredicateOfSignature(signature: Signature): Promise<TypePredicate | undefined>;
/**
* Get the base types of a class or interface type. A type with no base types
* yields an empty array.
*/
getBaseTypes(type: InterfaceType): Promise<readonly Type[]>;
getApparentType(type: Type): Promise<Type | undefined>;
getPropertiesOfType(type: Type): Promise<readonly Symbol[]>;
getIndexInfosOfType(type: Type): Promise<readonly IndexInfo[]>;
/**
* Get the constraint of a type parameter (the `T` in `<U extends T>`), or
* undefined if it has none.
*/
getConstraintOfTypeParameter(type: TypeParameter): Promise<Type | undefined>;
getBaseConstraintOfType(type: Type): Promise<Type | undefined>;
getPropertyOfType(type: Type, name: string): Promise<Symbol | undefined>;
getConstantValue(node: Node): Promise<string | number | undefined>;
getSignatureFromDeclaration(node: Node): Promise<Signature | undefined>;
getExportSpecifierLocalTargetSymbol(node: Node): Promise<Symbol | undefined>;
/**
* Follow all aliases to get the original symbol. Always returns a symbol; for
* an unresolved alias the checker yields the unknown symbol (use
* {@link Checker.isUnknownSymbol} to detect it).
*/
getAliasedSymbol(symbol: Symbol): Promise<Symbol>;
getImmediateAliasedSymbol(symbol: Symbol): Promise<Symbol | undefined>;
/**
* Fetch (once, then cache) the handle ids of the per-checker singleton
* symbols (unknown, undefined, arguments). These ids are stable for the life
* of the project's checker, so identity checks against them are local after
* the first call.
*/
private getWellKnownSymbols;
/**
* Returns `true` if the symbol is the checker's "unknown" symbol (e.g. the
* result of {@link Checker.getAliasedSymbol} on an unresolved alias).
*/
isUnknownSymbol(symbol: Symbol): Promise<boolean>;
/**
* Returns `true` if the symbol is the checker's "undefined" symbol.
*/
isUndefinedSymbol(symbol: Symbol): Promise<boolean>;
/**
* Returns `true` if the symbol is the checker's "arguments" symbol.
*/
isArgumentsSymbol(symbol: Symbol): Promise<boolean>;
getExportsOfModule(symbol: Symbol): Promise<readonly Symbol[]>;
getMemberInModuleExports(symbol: Symbol, name: string): Promise<Symbol | undefined>;
getJsDocTagsOfSymbol(symbol: Symbol): Promise<readonly JSDocTagInfo[]>;
getDocumentationCommentOfSymbol(symbol: Symbol): Promise<string>;
/**
* Get the type arguments of a type reference (e.g. the `string` in `Array<string>`).
*/
getTypeArguments(type: TypeReference): Promise<readonly Type[]>;
}
export interface PrintNodeOptions {
preserveSourceNewlines?: boolean | undefined;
neverAsciiEscape?: boolean | undefined;
terminateUnterminatedLiterals?: boolean | undefined;
}
export declare class Emitter {
private client;
constructor(client: Client);
printNode(node: Node, options?: PrintNodeOptions): Promise<string>;
}
export declare class NodeHandle {
/**
* The project this handle was produced in, used as the default for {@link resolve}.
* Node handles are only meaningful within a project's program, so the producing project
* is remembered so callers don't have to pass it explicitly.
*/
private readonly canonicalProject;
readonly index: number;
readonly kind: SyntaxKind;
readonly path: Path;
constructor(handle: string, canonicalProject: Project);
/**
* Resolve this handle to the actual AST node by fetching the source file from a project
* and looking up the node by index. If no project is passed, the project that produced
* the handle is used.
*/
resolve(project?: Project): Promise<Node | undefined>;
}
/** A symbol definition paired with all of its reference nodes. */
export interface ReferencedSymbolEntry {
/** The node handle for the symbol's definition. */
definition: NodeHandle;
/** The resolved symbol for the definition, if available. */
symbol?: Symbol | undefined;
/** The node handles for each reference to the symbol. */
references: NodeHandle[];
}
/** A single usage of a signature, pairing the reference name with its call expression (if any). */
export interface SignatureUsage {
/** The node handle for the name reference. */
name: NodeHandle;
/** The node handle for the call expression, if the reference is invoked. */
call?: NodeHandle | undefined;
}
export declare class Symbol {
private objectRegistry;
/**
* The project this symbol was first observed in, used as the default project for
* lookups that need a project context (members/exports/parent). Symbols are shared
* snapshot-wide, so these lookups can otherwise be ambiguous about which project to use.
*/
private readonly canonicalProject;
readonly id: number;
/** The escaped (`__String`) name, used as the key in member/export tables. */
readonly escapedName: __String;
/** The display name (escaped underscores removed). */
readonly name: string;
readonly flags: SymbolFlags;
readonly checkFlags: number;
readonly declarations: readonly NodeHandle[];
readonly valueDeclaration: NodeHandle | undefined;
private readonly parent;
private readonly exportSymbol;
private membersCache;
private exportsCache;
constructor(data: SymbolResponse, objectRegistry: SnapshotObjectRegistry);
getParent(): Promise<Symbol | undefined>;
/**
* Get this symbol's members keyed by escaped name. The result is cached on
* the symbol, so repeated calls do not round-trip to the server.
*/
getMembers(): Promise<ReadonlyMap<__String, Symbol>>;
/**
* Get this symbol's exports keyed by escaped name. The result is cached on
* the symbol, so repeated calls do not round-trip to the server.
*/
getExports(): Promise<ReadonlyMap<__String, Symbol>>;
private fetchSymbolTable;
getExportSymbol(): Promise<Symbol>;
getJsDocTags(checker: Checker): Promise<readonly JSDocTagInfo[]>;
getDocumentationComment(checker: Checker): Promise<string>;
}
declare class TypeObject implements Type {
private objectRegistry;
readonly id: number;
readonly flags: TypeFlags;
readonly objectFlags: ObjectFlags;
readonly symbol: number;
readonly value: string | number | boolean | bigint;
readonly intrinsicName: string;
readonly isThisType: boolean;
readonly freshType: number;
readonly regularType: number;
readonly target: number;
readonly typeParameters: readonly number[];
readonly outerTypeParameters: readonly number[];
readonly localTypeParameters: readonly number[];
readonly aliasTypeArguments: readonly number[];
readonly aliasSymbol: number;
readonly elementFlags: readonly ElementFlags[];
readonly fixedLength: number;
readonly readonly: boolean;
readonly texts: readonly string[];
readonly objectType: number;
readonly indexType: number;
readonly checkType: number;
readonly extendsType: number;
readonly baseType: number;
readonly substConstraint: number;
private trueType;
private falseType;
constructor(data: TypeResponse, objectRegistry: ProjectObjectRegistry);
getSymbol(): Promise<Symbol | undefined>;
getAliasSymbol(): Promise<Symbol | undefined>;
getTarget(): Promise<Type>;
getFreshType(): Promise<FreshableType | undefined>;
getRegularType(): Promise<FreshableType | undefined>;
getTypes(): Promise<readonly Type[] | undefined>;
getTypeParameters(): Promise<readonly TypeParameter[]>;
getOuterTypeParameters(): Promise<readonly TypeParameter[]>;
getLocalTypeParameters(): Promise<readonly TypeParameter[]>;
getAliasTypeArguments(): Promise<readonly Type[]>;
getObjectType(): Promise<Type>;
getIndexType(): Promise<Type>;
getCheckType(): Promise<Type>;
getExtendsType(): Promise<Type>;
getBaseType(): Promise<Type>;
getConstraint(): Promise<Type>;
getTrueType(): Promise<Type>;
getFalseType(): Promise<Type>;
/**
* Get the base types of this type. Returns `undefined` for any type that is
* not a class or interface.
*/
getBaseTypes(): Promise<readonly Type[] | undefined>;
isClassOrInterface(): this is InterfaceType;
isUnionType(): this is UnionType;
isIntersectionType(): this is IntersectionType;
isObjectType(): this is ObjectType;
isIntrinsicType(): this is IntrinsicType;
isErrorType(): boolean;
isLiteralType(): this is LiteralType;
isStringLiteralType(): this is StringLiteralType;
isNumberLiteralType(): this is NumberLiteralType;
isBigIntLiteralType(): this is BigIntLiteralType;
isBooleanLiteralType(): this is BooleanLiteralType;
isTypeReference(): this is TypeReference;
isTupleType(): this is TupleType;
isIndexType(): this is IndexType;
isIndexedAccessType(): this is IndexedAccessType;
isConditionalType(): this is ConditionalType;
isSubstitutionType(): this is SubstitutionType;
isTemplateLiteralType(): this is TemplateLiteralType;
isStringMappingType(): this is StringMappingType;
isTypeParameter(): this is TypeParameter;
}
export declare function isUnionType(type: Type): type is UnionType;
export declare function isIntersectionType(type: Type): type is IntersectionType;
export declare function isObjectType(type: Type): type is ObjectType;
export declare function isClassOrInterfaceType(type: Type): type is InterfaceType;
export declare function isIntrinsicType(type: Type): type is IntrinsicType;
/**
* Whether this is the error type — the placeholder the checker produces when a
* type cannot be determined (e.g. an unresolved reference). It is an intrinsic
* type named `"error"` (this covers both the singleton error type and the
* per-alias error types manufactured for unresolved type alias references).
*/
export declare function isErrorType(type: Type): boolean;
export declare function isLiteralType(type: Type): type is LiteralType;
export declare function isStringLiteralType(type: Type): type is StringLiteralType;
export declare function isNumberLiteralType(type: Type): type is NumberLiteralType;
export declare function isBigIntLiteralType(type: Type): type is BigIntLiteralType;
export declare function isBooleanLiteralType(type: Type): type is BooleanLiteralType;
export declare function isTypeReference(type: Type): type is TypeReference;
export declare function isTupleType(type: Type): type is TupleType;
export declare function isIndexType(type: Type): type is IndexType;
export declare function isIndexedAccessType(type: Type): type is IndexedAccessType;
export declare function isConditionalType(type: Type): type is ConditionalType;
export declare function isSubstitutionType(type: Type): type is SubstitutionType;
export declare function isTemplateLiteralType(type: Type): type is TemplateLiteralType;
export declare function isStringMappingType(type: Type): type is StringMappingType;
export declare function isTypeParameter(type: Type): type is TypeParameter;
export declare class Signature {
private flags;
private objectRegistry;
readonly id: number;
readonly declaration?: NodeHandle | undefined;
readonly typeParameters?: readonly number[] | undefined;
readonly parameters: readonly number[];
readonly thisParameter?: number | undefined;
readonly target?: number | undefined;
constructor(data: SignatureResponse, project: Project, objectRegistry: ProjectObjectRegistry);
getTypeParameters(): Promise<readonly TypeParameter[]>;
getParameters(): Promise<readonly Symbol[]>;
getThisParameter(): Promise<Symbol | undefined>;
getTarget(): Promise<Signature | undefined>;
get hasRestParameter(): boolean;
get isConstruct(): boolean;
get isAbstract(): boolean;
}
//# sourceMappingURL=api.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/async/api.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,O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AAS;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,UAAU,CAAqC;gBAGnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,sBAAsBLine truncated
+1657
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/api/async/api.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAIH,aAAa,EAMb,0BAA0B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,UAAU,EACV,kBAAkB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,UAAU,EACV,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,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,GAAG,MAAM,Line truncated
+39
View File
@@ -0,0 +1,39 @@
import { type ClientOptions, type ClientSocketOptions, type ClientSpawnOptions } from "../options.ts";
import { TimingCollector, type TimingInfo } from "../timing.ts";
export type { ClientOptions, ClientSocketOptions, ClientSpawnOptions };
/**
* Client handles communication with the TypeScript API server
* over STDIO (spawned process) or a Unix domain socket using JSON-RPC.
*/
export declare class Client {
private socket;
private process;
private connection;
private options;
private connected;
private timing;
constructor(options: ClientOptions);
connect(): Promise<void>;
private connectViaSpawn;
private connectViaSocket;
private registerFSCallbacks;
apiRequest<T>(method: string, params?: unknown): Promise<T>;
apiRequestBinary(method: string, params?: unknown): Promise<Uint8Array | undefined>;
/**
* Returns the timing collector that per-node materialization is reported
* into, or undefined when timing collection is disabled. The returned
* collector is the same one folded into {@link getTimingInfo}, so
* materialization totals surface alongside request timings.
*/
getTimingCollector(): TimingCollector | undefined;
/**
* Returns a combined timing snapshot: client-measured round-trip and byte
* counts folded together with the server's own per-request processing time
* (fetched via a getServerTiming request) and estimated transport overhead.
*/
getTimingInfo(): Promise<TimingInfo>;
resetTimingInfo(): Promise<void>;
private fetchServerTiming;
close(): Promise<void>;
}
//# sourceMappingURL=client.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/async/client.ts"],"names":[],"mappings":"AAeA,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAG1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAKH,eAAe,EACf,KAAK,UAAU,EAClB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAEvE;;;GAGG;AACH,qBAAa,MAAM;IACf,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,MAAM,CAA8B;gBAEhC,OAAO,EAAE,aAAa;IAO5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAWhB,eAAe;YAiDf,gBAAgB;IAmB9B,OAAO,CAAC,mBAAmB;IAoBrB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAgC3D,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAOzF;;;;;OAKG;IACH,kBAAkB,IAAI,eAAe,GAAG,SAAS;IAIjD;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAYpC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;YAUxB,iBAAiB;IAUzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAoB/B"}
+211
View File
@@ -0,0 +1,211 @@
import { createMessageConnection, RequestType, SocketMessageReader, SocketMessageWriter, StreamMessageReader, StreamMessageWriter, } from "#vscode-jsonrpc/node";
import { fsCallbackNames, } from "../fs.js";
import { isSpawnOptions, resolveExePath, } from "../options.js";
import { combineTimingInfo, disabledServerTimingInfo, disabledTimingInfo, TimingCollector, } from "../timing.js";
/**
* Client handles communication with the TypeScript API server
* over STDIO (spawned process) or a Unix domain socket using JSON-RPC.
*/
export class Client {
socket;
process;
connection;
options;
connected = false;
timing;
constructor(options) {
this.options = options;
if (isSpawnOptions(options) && options.collectTiming) {
this.timing = new TimingCollector();
}
}
async connect() {
if (this.connected)
return;
if (isSpawnOptions(this.options)) {
await this.connectViaSpawn(this.options);
}
else {
await this.connectViaSocket(this.options);
}
}
async connectViaSpawn(options) {
const { spawn } = await import("node:child_process");
return new Promise((resolve, reject) => {
const args = [
"--api",
"--async",
"--cwd",
options.cwd ?? process.cwd(),
];
if (options.collectTiming) {
args.push("--timing");
}
// Enable virtual FS callbacks for each provided FS function
const enabledCallbacks = [];
if (options.fs) {
for (const name of fsCallbackNames) {
if (options.fs[name]) {
enabledCallbacks.push(name);
}
}
}
if (enabledCallbacks.length > 0) {
args.push(`--callbacks=${enabledCallbacks.join(",")}`);
}
this.process = spawn(resolveExePath(options), args, {
stdio: ["pipe", "pipe", "inherit"],
});
this.process.once("error", error => {
reject(new Error(`Failed to start tsgo process: ${error.message}`));
});
this.process.once("spawn", () => {
this.connected = true;
resolve();
});
const reader = new StreamMessageReader(this.process.stdout);
const writer = new StreamMessageWriter(this.process.stdin);
this.connection = createMessageConnection(reader, writer);
this.registerFSCallbacks(this.connection, options.fs);
this.connection.listen();
});
}
async connectViaSocket(options) {
const { createConnection } = await import("node:net");
return new Promise((resolve, reject) => {
this.socket = createConnection(options.pipe, () => {
const reader = new SocketMessageReader(this.socket);
const writer = new SocketMessageWriter(this.socket);
this.connection = createMessageConnection(reader, writer);
this.connection.listen();
this.connected = true;
resolve();
});
this.socket.once("error", error => {
reject(new Error(`Socket error: ${error.message}`));
});
});
}
registerFSCallbacks(connection, fs) {
if (!fs)
return;
for (const name of fsCallbackNames) {
const callback = fs[name];
if (callback) {
const requestType = new RequestType(name);
connection.onRequest(requestType, (arg) => {
const result = callback(arg);
if (name === "readFile") {
// readFile has 3 returns: string (content), null (not found), undefined (fall back).
// JSON-RPC can't distinguish null from undefined, so wrap in object.
if (result === undefined)
return null;
return { content: result };
}
return result ?? null;
});
}
}
}
async apiRequest(method, params) {
if (!this.connected) {
await this.connect();
}
if (!this.connection) {
throw new Error("Connection not established");
}
const requestType = new RequestType(method);
if (!this.timing) {
return this.connection.sendRequest(requestType, params);
}
// Round-trip latency is measured here; byte counts approximate the wire
// payload via the serialized JSON. Server-side processing time is not
// carried on the response; it is retrieved separately (via a
// getServerTiming request) and folded in by getTimingInfo().
const bytesSent = params === undefined ? 0 : Buffer.byteLength(JSON.stringify(params), "utf-8");
const start = performance.now();
const result = await this.connection.sendRequest(requestType, params);
const roundTripMs = performance.now() - start;
this.timing.record({
method,
roundTripMs,
bytesSent,
bytesReceived: result === undefined || result === null
? 0
: Buffer.byteLength(JSON.stringify(result), "utf-8"),
});
return result;
}
async apiRequestBinary(method, params) {
const response = await this.apiRequest(method, params);
if (!response)
return undefined;
const buffer = Buffer.from(response.data, "base64");
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
}
/**
* Returns the timing collector that per-node materialization is reported
* into, or undefined when timing collection is disabled. The returned
* collector is the same one folded into {@link getTimingInfo}, so
* materialization totals surface alongside request timings.
*/
getTimingCollector() {
return this.timing;
}
/**
* Returns a combined timing snapshot: client-measured round-trip and byte
* counts folded together with the server's own per-request processing time
* (fetched via a getServerTiming request) and estimated transport overhead.
*/
async getTimingInfo() {
if (!this.timing) {
return disabledTimingInfo();
}
const local = this.timing.getInfo();
// No requests have been sent yet: nothing to fetch from the server.
if (!this.connected || !this.connection) {
return local;
}
return combineTimingInfo(local, await this.fetchServerTiming());
}
async resetTimingInfo() {
if (!this.timing)
return;
this.timing.reset();
if (this.connected && this.connection) {
// Keep the server's collection in sync so combined totals stay meaningful.
const requestType = new RequestType("resetServerTiming");
await this.connection.sendRequest(requestType, undefined);
}
}
async fetchServerTiming() {
if (!this.connection) {
return disabledServerTimingInfo();
}
// Fetch the server's own timing collection via a dedicated request. This
// bypasses the client-side collector so the query does not pollute it.
const requestType = new RequestType("getServerTiming");
return this.connection.sendRequest(requestType, undefined);
}
async close() {
if (this.connection) {
this.connection.dispose();
this.connection = undefined;
}
if (this.socket) {
this.socket.destroy();
this.socket = undefined;
}
if (this.process) {
// Close stdin to unblock the server's read loop, allowing it to exit cleanly.
// The server is blocked on stdin.Read(), so just sending SIGTERM would deadlock:
// - Node won't exit while child is alive
// - Child can't process SIGTERM while blocked on read
// - Read won't error until stdin is closed
this.process.stdin?.end();
this.process = undefined;
}
this.connected = false;
}
}
//# sourceMappingURL=client.js.map
+1
View File
@@ -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DAA6D;QAC7D,MAAM,SAAS,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QAChG,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YACf,MAAM;YACN,WAAW;YACX,SAAS;YACT,aAAa,EAAE,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;gBAClD,CAAC,CAAC,CAAC;gBACH,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;SAC3D,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAc,EAAE,MAAgB;QACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAA2B,MAAM,EAAE,MAAM,CAAC,CAAC;QACjF,IAAI,CAAC,QAAQ;YAAE,OAAO,SAAS,CAAC;QAChC,MLine truncated
+310
View File
@@ -0,0 +1,310 @@
import type { CompletionItemKind } from "#enums/completionItemKind";
import type { DiagnosticCategory } from "#enums/diagnosticCategory";
import type { ElementFlags } from "#enums/elementFlags";
import type { ObjectFlags } from "#enums/objectFlags";
import type { TypeFlags } from "#enums/typeFlags";
import type { TypePredicateKind } from "#enums/typePredicateKind";
import type { NodeHandle, Symbol } from "./api.ts";
/**
* A TypeScript type.
*
* Use TypeFlags to determine the specific kind of type and access
* kind-specific properties. For example:
*
* ```ts
* if (type.flags & TypeFlags.StringLiteral) {
* console.log((type as StringLiteralType).value); // string
* }
* ```
*/
export interface Type {
/** Type flags — use to determine the specific kind of type. */
readonly flags: TypeFlags;
/** Unique identifier for this type */
readonly id: number;
/** Get the symbol associated with this type, if any */
getSymbol(): Promise<Symbol | undefined>;
/** Get the type arguments of the type alias this type was instantiated from, if any */
getAliasTypeArguments(): Promise<readonly Type[]>;
/** Get the symbol of the type alias this type was instantiated from, if any */
getAliasSymbol(): Promise<Symbol | undefined>;
/**
* Get the base types of this type, or `undefined` if it is not a class or
* interface type.
*/
getBaseTypes(): Promise<readonly Type[] | undefined>;
/** Whether this type is a class or interface type */
isClassOrInterface(): this is InterfaceType;
/** Whether this type is a union type */
isUnionType(): this is UnionType;
/** Whether this type is an intersection type */
isIntersectionType(): this is IntersectionType;
/** Whether this type is an object type */
isObjectType(): this is ObjectType;
/** Whether this type is an intrinsic primitive type */
isIntrinsicType(): this is IntrinsicType;
/**
* Whether this is the error type — the placeholder produced when a type
* cannot be determined (e.g. an unresolved reference).
*/
isErrorType(): boolean;
/** Whether this type is a literal type */
isLiteralType(): this is LiteralType;
/** Whether this type is a string literal type */
isStringLiteralType(): this is StringLiteralType;
/** Whether this type is a number literal type */
isNumberLiteralType(): this is NumberLiteralType;
/** Whether this type is a bigint literal type */
isBigIntLiteralType(): this is BigIntLiteralType;
/** Whether this type is a boolean literal type */
isBooleanLiteralType(): this is BooleanLiteralType;
/** Whether this type is a type reference */
isTypeReference(): this is TypeReference;
/** Whether this type is a tuple type */
isTupleType(): this is TupleType;
/** Whether this type is an index type (`keyof T`) */
isIndexType(): this is IndexType;
/** Whether this type is an indexed access type (`T[K]`) */
isIndexedAccessType(): this is IndexedAccessType;
/** Whether this type is a conditional type */
isConditionalType(): this is ConditionalType;
/** Whether this type is a substitution type */
isSubstitutionType(): this is SubstitutionType;
/** Whether this type is a template literal type */
isTemplateLiteralType(): this is TemplateLiteralType;
/** Whether this type is a string mapping type */
isStringMappingType(): this is StringMappingType;
/** Whether this type is a type parameter */
isTypeParameter(): this is TypeParameter;
}
/**
* Freshable types (TypeFlags.Freshable) - literal types (TypeFlags.Literal) and computed enum types (TypeFlags.Enum).
*/
export interface FreshableType extends Type {
/** Get the fresh version of this type, if any */
getFreshType(): Promise<FreshableType | undefined>;
/** Get the regular (non-fresh) version of this type, if any */
getRegularType(): Promise<FreshableType | undefined>;
}
/** Literal types: StringLiteral, NumberLiteral, BigIntLiteral, BooleanLiteral */
export interface LiteralType extends FreshableType {
/** The literal value. Use TypeFlags to narrow to a specific literal subtype with a concrete value type. */
readonly value: string | number | boolean | bigint;
}
/** String literal types (TypeFlags.StringLiteral) */
export interface StringLiteralType extends LiteralType {
/** The string value of the literal */
readonly value: string;
}
/** Numeric literal types (TypeFlags.NumberLiteral) */
export interface NumberLiteralType extends LiteralType {
/** The numeric value of the literal */
readonly value: number;
}
/** BigInt literal types (TypeFlags.BigIntLiteral) */
export interface BigIntLiteralType extends LiteralType {
/** The bigint value of the literal */
readonly value: bigint;
}
/** Boolean literal types (TypeFlags.BooleanLiteral) */
export interface BooleanLiteralType extends LiteralType {
/** The boolean value of the literal */
readonly value: boolean;
}
/** Object types (TypeFlags.Object) */
export interface ObjectType extends Type {
/** Object flags — use to determine the specific kind of object type. */
readonly objectFlags: ObjectFlags;
}
/** Type references (ObjectFlags.Reference) — e.g. Array<string>, Map<K, V> */
export interface TypeReference extends ObjectType {
/** Get the generic target type (e.g. Array for Array<string>) */
getTarget(): Promise<Type>;
}
/** Interface types — classes and interfaces (ObjectFlags.ClassOrInterface) */
export interface InterfaceType extends TypeReference {
/** Get all type parameters (outer + local, excluding thisType) */
getTypeParameters(): Promise<readonly TypeParameter[]>;
/** Get outer type parameters from enclosing declarations */
getOuterTypeParameters(): Promise<readonly TypeParameter[]>;
/** Get local type parameters declared on this interface/class */
getLocalTypeParameters(): Promise<readonly TypeParameter[]>;
}
/** Tuple types (ObjectFlags.Tuple) */
export interface TupleType extends InterfaceType {
/** Per-element flags (Required, Optional, Rest, Variadic) */
readonly elementFlags: readonly ElementFlags[];
/** Number of initial required or optional elements */
readonly fixedLength: number;
/** Whether the tuple is readonly */
readonly readonly: boolean;
}
/** Union or intersection types (TypeFlags.Union | TypeFlags.Intersection) */
export interface UnionOrIntersectionType extends Type {
/** Get the constituent types */
getTypes(): Promise<readonly Type[]>;
}
/** Union types (TypeFlags.Union) */
export interface UnionType extends UnionOrIntersectionType {
}
/** Intersection types (TypeFlags.Intersection) */
export interface IntersectionType extends UnionOrIntersectionType {
}
/** Type parameters (TypeFlags.TypeParameter) */
export interface TypeParameter extends Type {
/** True if this is the synthetic `this` type of an interface, class, or tuple */
readonly isThisType?: boolean | undefined;
}
/** Index types — keyof T (TypeFlags.Index) */
export interface IndexType extends Type {
/** Get the target type T in `keyof T` */
getTarget(): Promise<Type>;
}
/** Indexed access types — T[K] (TypeFlags.IndexedAccess) */
export interface IndexedAccessType extends Type {
/** Get the object type T in `T[K]` */
getObjectType(): Promise<Type>;
/** Get the index type K in `T[K]` */
getIndexType(): Promise<Type>;
}
/** Conditional types — T extends U ? X : Y (TypeFlags.Conditional) */
export interface ConditionalType extends Type {
/** Get the check type T in `T extends U ? X : Y` */
getCheckType(): Promise<Type>;
/** Get the extends type U in `T extends U ? X : Y` */
getExtendsType(): Promise<Type>;
/** Get the true type X in `T extends U ? X : Y` */
getTrueType(): Promise<Type>;
/** Get the false type Y in `T extends U ? X : Y` */
getFalseType(): Promise<Type>;
}
/** Substitution types (TypeFlags.Substitution) */
export interface SubstitutionType extends Type {
getBaseType(): Promise<Type>;
getConstraint(): Promise<Type>;
}
/** Template literal types (TypeFlags.TemplateLiteral) */
export interface TemplateLiteralType extends Type {
/** Text segments (always one more than the number of type spans) */
readonly texts: readonly string[];
/** Get the types interspersed between text segments */
getTypes(): Promise<readonly Type[]>;
}
/** String mapping types — Uppercase<T>, Lowercase<T>, etc. (TypeFlags.StringMapping) */
export interface StringMappingType extends Type {
/** Get the mapped type */
getTarget(): Promise<Type>;
}
/** Intrinsic types — any, unknown, string, number, bigint, symbol, void, undefined, null, never, object (TypeFlags.Intrinsic) */
export interface IntrinsicType extends Type {
/** The intrinsic type name (e.g. "any", "string", "never") */
readonly intrinsicName: string;
}
/** Base for all type predicates */
export interface TypePredicateBase {
readonly kind: TypePredicateKind;
readonly type: Type | undefined;
}
/** `this is T` */
export interface ThisTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.This;
readonly parameterName: undefined;
readonly parameterIndex: undefined;
readonly type: Type;
}
/** `x is T` */
export interface IdentifierTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.Identifier;
readonly parameterName: string;
readonly parameterIndex: number;
readonly type: Type;
}
/** `asserts this is T` */
export interface AssertsThisTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.AssertsThis;
readonly parameterName: undefined;
readonly parameterIndex: undefined;
readonly type: Type | undefined;
}
/** `asserts x is T` */
export interface AssertsIdentifierTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.AssertsIdentifier;
readonly parameterName: string;
readonly parameterIndex: number;
readonly type: Type | undefined;
}
/** A type predicate — e.g. `x is T` or `asserts x is T` */
export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate;
/** An index signature — e.g. `[key: string]: T` */
export interface IndexInfo {
/** The index key type (e.g. string or number) */
readonly keyType: Type;
/** The index value type */
readonly valueType: Type;
/** Whether the index signature is readonly */
readonly isReadonly: boolean;
/** The index signature declaration, if any */
readonly declaration?: NodeHandle | undefined;
}
/**
* A single JSDoc tag attached to a symbol — e.g. `@param`, `@returns`.
*/
export interface JSDocTagInfo {
/** The tag name, without the leading `@` — e.g. `"param"`. */
readonly name: string;
/** The rendered tag text, if any — e.g. `"a the first number"` for `@param a the first number`. */
readonly text?: string | undefined;
}
export interface CompletionEntryLabelDetails {
detail?: string | undefined;
description?: string | undefined;
}
/** Options for {@link Checker.getCompletionsAtPosition}. */
export interface CompletionOptions {
triggerCharacter?: string | undefined;
/** Include a `symbol` property on each completion entry. Only populated for symbol-based completions (not keywords or literals). */
includeSymbol?: boolean | undefined;
}
/** A single completion item returned by {@link Checker.getCompletionsAtPosition}. */
export interface CompletionEntry {
readonly name: string;
readonly kind?: CompletionItemKind | undefined;
readonly sortText?: string | undefined;
readonly insertText?: string | undefined;
readonly filterText?: string | undefined;
readonly detail?: string | undefined;
readonly labelDetails?: CompletionEntryLabelDetails | undefined;
/** The symbol associated with this completion entry. Only set when `includeSymbol: true` is passed and a symbol is available. */
readonly symbol?: Symbol | undefined;
}
/** The result of {@link Checker.getCompletionsAtPosition}. */
export interface CompletionInfo {
readonly isIncomplete: boolean;
readonly entries: readonly CompletionEntry[];
}
/**
* A diagnostic message from the TypeScript compiler.
*/
export interface Diagnostic {
/** File name of the source file this diagnostic belongs to, if any */
readonly fileName?: string | undefined;
/** Start position of the diagnostic */
readonly pos: number;
/** End position of the diagnostic */
readonly end: number;
/** Diagnostic error code */
readonly code: number;
/** Diagnostic category (error, warning, suggestion, message) */
readonly category: DiagnosticCategory;
/** Localized diagnostic message text */
readonly text: string;
/** Whether this diagnostic highlights unnecessary code */
readonly reportsUnnecessary?: boolean | undefined;
/** Whether this diagnostic highlights deprecated code */
readonly reportsDeprecated?: boolean | undefined;
/** Chained diagnostic messages */
readonly messageChain?: readonly Diagnostic[] | undefined;
/** Related diagnostic information */
readonly relatedInformation?: readonly Diagnostic[] | undefined;
}
//# sourceMappingURL=types.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/api/async/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO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AAC;CAC9B;AAED,iIAAiI;AACjI,MAAM,WAAW,aAAc,SAAQ,IAAI;IACvC,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC;AAED,mCAAmC;AACnC,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;CACnC;AAED,kBAAkB;AAClB,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACvB;AAED,eAAe;AACf,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAC9D,Line truncated
+2
View File
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/async/types.ts"],"names":[],"mappings":""}
+109
View File
@@ -0,0 +1,109 @@
import type { JsxEmit } from "#enums/jsxEmit";
import type { ModuleDetectionKind } from "#enums/moduleDetectionKind";
import type { ModuleKind } from "#enums/moduleKind";
import type { ModuleResolutionKind } from "#enums/moduleResolutionKind";
import type { NewLineKind } from "#enums/newLineKind";
import type { ScriptTarget } from "#enums/scriptTarget";
export interface CompilerOptions {
allowJs?: boolean;
allowArbitraryExtensions?: boolean;
allowImportingTsExtensions?: boolean;
allowNonTsExtensions?: boolean;
allowUmdGlobalAccess?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
assumeChangesOnlyAffectDirectDependencies?: boolean;
checkJs?: boolean;
customConditions?: string[];
composite?: boolean;
emitDeclarationOnly?: boolean;
emitBOM?: boolean;
emitDecoratorMetadata?: boolean;
declaration?: boolean;
declarationDir?: string;
declarationMap?: boolean;
deduplicatePackages?: boolean;
disableSizeLimit?: boolean;
disableSourceOfProjectReferenceRedirect?: boolean;
disableSolutionSearching?: boolean;
disableReferencedProjectLoad?: boolean;
erasableSyntaxOnly?: boolean;
exactOptionalPropertyTypes?: boolean;
experimentalDecorators?: boolean;
forceConsistentCasingInFileNames?: boolean;
isolatedModules?: boolean;
isolatedDeclarations?: boolean;
ignoreConfig?: boolean;
ignoreDeprecations?: string;
importHelpers?: boolean;
inlineSourceMap?: boolean;
inlineSources?: boolean;
init?: boolean;
incremental?: boolean;
jsx?: JsxEmit;
jsxFactory?: string;
jsxFragmentFactory?: string;
jsxImportSource?: string;
lib?: string[];
libReplacement?: boolean;
locale?: string;
mapRoot?: string;
module?: ModuleKind;
moduleResolution?: ModuleResolutionKind;
moduleSuffixes?: string[];
moduleDetection?: ModuleDetectionKind;
newLine?: NewLineKind;
noEmit?: boolean;
noCheck?: boolean;
noErrorTruncation?: boolean;
noFallthroughCasesInSwitch?: boolean;
noImplicitAny?: boolean;
noImplicitThis?: boolean;
noImplicitReturns?: boolean;
noEmitHelpers?: boolean;
noLib?: boolean;
noPropertyAccessFromIndexSignature?: boolean;
noUncheckedIndexedAccess?: boolean;
noEmitOnError?: boolean;
noUnusedLocals?: boolean;
noUnusedParameters?: boolean;
noResolve?: boolean;
noImplicitOverride?: boolean;
noUncheckedSideEffectImports?: boolean;
outDir?: string;
paths?: Record<string, string[]>;
preserveConstEnums?: boolean;
preserveSymlinks?: boolean;
project?: string;
resolveJsonModule?: boolean;
resolvePackageJsonExports?: boolean;
resolvePackageJsonImports?: boolean;
removeComments?: boolean;
rewriteRelativeImportExtensions?: boolean;
reactNamespace?: string;
rootDir?: string;
rootDirs?: string[];
skipLibCheck?: boolean;
stableTypeOrdering?: boolean;
strict?: boolean;
strictBindCallApply?: boolean;
strictBuiltinIteratorReturn?: boolean;
strictFunctionTypes?: boolean;
strictNullChecks?: boolean;
strictPropertyInitialization?: boolean;
stripInternal?: boolean;
skipDefaultLibCheck?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
suppressOutputPathCheck?: boolean;
target?: ScriptTarget;
traceResolution?: boolean;
tsBuildInfoFile?: string;
typeRoots?: string[];
types?: string[];
useDefineForClassFields?: boolean;
useUnknownInCatchVariables?: boolean;
verbatimModuleSyntax?: boolean;
maxNodeModuleJsDepth?: number;
}
//# sourceMappingURL=compilerOptions.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"compilerOptions.d.ts","sourceRoot":"","sources":["../../src/api/compilerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,WAAW,eAAe;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,yCAAyC,CAAC,EAAE,OAAO,CAAC;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,E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C;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC"}
+2
View File
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=compilerOptions.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"compilerOptions.js","sourceRoot":"","sources":["../../src/api/compilerOptions.ts"],"names":[],"mappings":""}
+23
View File
@@ -0,0 +1,23 @@
export interface FileSystemEntries {
files: string[];
directories: string[];
}
export interface FileSystem {
directoryExists?: (directoryName: string) => boolean | undefined;
fileExists?: (fileName: string) => boolean | undefined;
getAccessibleEntries?: (directoryName: string) => FileSystemEntries | undefined;
/**
* Read a file's content.
* - Return the file content as a `string` (including `""` for empty files).
* - Return `null` to indicate the file does not exist (without falling back to the real FS).
* - Return `undefined` to fall back to the real filesystem.
*/
readFile?: (fileName: string) => string | null | undefined;
realpath?: (path: string) => string | undefined;
writeFile?: (path: string, content: string) => void;
removeFile?: (path: string) => void;
}
/** The callback names supported by the Go server for virtual FS delegation. */
export declare const fsCallbackNames: readonly ["readFile", "fileExists", "directoryExists", "getAccessibleEntries", "realpath"];
export declare function createVirtualFileSystem(files: Record<string, string>): FileSystem;
//# sourceMappingURL=fs.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/api/fs.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACvB,eAAe,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC;IACjE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAC;IACvD,oBAAoB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,CAAC;IAChF;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAChD,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,+EAA+E;AAC/E,eAAO,MAAM,eAAe,4FAA6F,CAAC;AAa1H,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,UAAU,CAkHjF"}
+109
View File
@@ -0,0 +1,109 @@
import { getPathComponents } from "./path.js";
/** The callback names supported by the Go server for virtual FS delegation. */
export const fsCallbackNames = ["readFile", "fileExists", "directoryExists", "getAccessibleEntries", "realpath"];
export function createVirtualFileSystem(files) {
const root = {
type: "directory",
children: {},
};
const content = {};
for (const filePath of Object.keys(files)) {
content[filePath] = files[filePath];
addToTree(filePath);
}
return {
directoryExists,
fileExists,
getAccessibleEntries,
readFile,
realpath: path => path,
writeFile,
removeFile,
};
function getNodeFromPath(path) {
if (!path || path === "/") {
return root;
}
const segments = getPathComponents(path).slice(1);
let current = root;
for (const segment of segments) {
if (current.type !== "directory") {
return undefined;
}
const child = current.children[segment];
if (!child) {
return undefined;
}
current = child;
}
return current;
}
function ensureDirectory(segments) {
let current = root;
for (const segment of segments) {
if (!current.children[segment]) {
current.children[segment] = { type: "directory", children: {} };
}
else if (current.children[segment].type !== "directory") {
throw new Error(`Cannot create directory: a file already exists at "/${segments.join("/")}"`);
}
current = current.children[segment];
}
return current;
}
function addToTree(path) {
const segments = getPathComponents(path).slice(1);
if (segments.length === 0) {
throw new Error(`Invalid file path: "${path}"`);
}
const filename = segments.pop();
const dirNode = ensureDirectory(segments);
dirNode.children[filename] = { type: "file" };
}
function writeFile(path, data) {
content[path] = data;
addToTree(path);
}
function removeFile(path) {
delete content[path];
const segments = getPathComponents(path).slice(1);
if (segments.length === 0)
return;
const filename = segments.pop();
const dirNode = getNodeFromPath("/" + segments.join("/"));
if (dirNode && dirNode.type === "directory") {
delete dirNode.children[filename];
}
}
function directoryExists(directoryName) {
const node = getNodeFromPath(directoryName);
return !!node && node.type === "directory";
}
function fileExists(fileName) {
return fileName in content;
}
function getAccessibleEntries(directoryName) {
const node = getNodeFromPath(directoryName);
if (!node || node.type !== "directory") {
return undefined;
}
const fileEntries = [];
const directories = [];
for (const [name, child] of Object.entries(node.children)) {
if (child.type === "file") {
fileEntries.push(name);
}
else {
directories.push(name);
}
}
return { files: fileEntries, directories };
}
function readFile(fileName) {
if (fileName in content) {
return content[fileName];
}
return undefined;
}
}
//# sourceMappingURL=fs.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/api/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAuB9C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,UAAU,CAAU,CAAC;AAa1H,MAAM,UAAU,uBAAuB,CAAC,KAA6B;IACjE,MAAM,IAAI,GAAe;QACrB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,EAAE;KACf,CAAC;IACF,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACH,eAAe;QACf,UAAU;QACV,oBAAoB;QACpB,QAAQ;QACR,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI;QACtB,SAAS;QACT,UAAU;KACb,CAAC;IAEF,SAAS,eAAe,CAAC,IAAY;QACjC,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClD,IAAI,OAAO,GAAU,IAAI,CAAC;QAC1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,OAAO,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ACD,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxD,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBACxB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;iBACI,CAAC;gBACF,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;QACL,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC/C,CAAC;IAED,SAAS,QAAQ,CAAC,QAAgB;QAC9B,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACtB,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC"}
+15
View File
@@ -0,0 +1,15 @@
import type { Node, SourceFile } from "../../ast/index.ts";
/**
* Encode a SourceFile AST node into the binary format.
*/
export declare function encodeSourceFile(sourceFile: SourceFile): Uint8Array;
/**
* Encode an arbitrary AST node into the binary format.
* When encoding a non-SourceFile node, the header hash and parse options fields will be zero.
*/
export declare function encodeNode(node: Node): Uint8Array;
/**
* Encode a Uint8Array to a base64 string.
*/
export declare function uint8ArrayToBase64(data: Uint8Array): string;
//# sourceMappingURL=encoder.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../../src/api/node/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGR,IAAI,EAEJ,UAAU,EAEb,MAAM,oBAAoB,CAAC;AAyL5B;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEnE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU,CAuKjD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAE3D"}
+5
View File
@@ -0,0 +1,5 @@
import type { Node } from "../../ast/index.ts";
import { SyntaxKind } from "../../ast/index.ts";
export declare function getNodeDataType(kind: SyntaxKind): number;
export declare function getNodeCommonData(node: Node): number;
//# sourceMappingURL=encoder.generated.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"encoder.generated.d.ts","sourceRoot":"","sources":["../../../src/api/node/encoder.generated.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAiBR,IAAI,EAMP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAuBxD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CA6CpD"}
+74
View File
@@ -0,0 +1,74 @@
// Code generated by _scripts/generate-encoder.ts. DO NOT EDIT.
import { SyntaxKind } from "../../ast/index.js";
import { NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING, } from "./protocol.js";
export function getNodeDataType(kind) {
switch (kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PrivateIdentifier:
case SyntaxKind.JsxText:
case SyntaxKind.JSDocText:
case SyntaxKind.JSDocLink:
case SyntaxKind.JSDocLinkPlain:
case SyntaxKind.JSDocLinkCode:
return NODE_DATA_TYPE_STRING;
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
case SyntaxKind.BigIntLiteral:
case SyntaxKind.RegularExpressionLiteral:
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.TemplateHead:
case SyntaxKind.TemplateMiddle:
case SyntaxKind.TemplateTail:
case SyntaxKind.SourceFile:
return NODE_DATA_TYPE_EXTENDED;
default:
return NODE_DATA_TYPE_CHILDREN;
}
}
export function getNodeCommonData(node) {
switch (node.kind) {
case SyntaxKind.Block:
return (node.multiLine ? 1 : 0) << 24;
case SyntaxKind.HeritageClause:
return (node.token === SyntaxKind.ImplementsKeyword ? 1 : 0) << 24;
case SyntaxKind.ExportAssignment:
return (node.isExportEquals ? 1 : 0) << 24;
case SyntaxKind.ExportSpecifier:
return (node.isTypeOnly ? 1 : 0) << 24;
case SyntaxKind.PrefixUnaryExpression:
return (node.operator === SyntaxKind.MinusToken ? 1 : node.operator === SyntaxKind.TildeToken ? 2 : node.operator === SyntaxKind.ExclamationToken ? 3 : node.operator === SyntaxKind.PlusPlusToken ? 4 : node.operator === SyntaxKind.MinusMinusToken ? 5 : 0) << 24;
case SyntaxKind.PostfixUnaryExpression:
return (node.operator === SyntaxKind.MinusMinusToken ? 1 : 0) << 24;
case SyntaxKind.MetaProperty:
return (node.keywordToken === SyntaxKind.NewKeyword ? 1 : 0) << 24;
case SyntaxKind.ArrayLiteralExpression:
return (node.multiLine ? 1 : 0) << 24;
case SyntaxKind.ObjectLiteralExpression:
return (node.multiLine ? 1 : 0) << 24;
case SyntaxKind.TypeOperator:
return (node.operator === SyntaxKind.ReadonlyKeyword ? 1 : node.operator === SyntaxKind.UniqueKeyword ? 2 : 0) << 24;
case SyntaxKind.ImportAttributes:
return (node.multiLine ? 1 : 0) << 24 | (node.token === SyntaxKind.AssertKeyword ? 1 : 0) << 25;
case SyntaxKind.JsxText:
return (node.containsOnlyTriviaWhiteSpaces ? 1 : 0) << 24;
case SyntaxKind.ModuleDeclaration:
return (node.keyword === SyntaxKind.NamespaceKeyword ? 1 : 0) << 24;
case SyntaxKind.ImportEqualsDeclaration:
return (node.isTypeOnly ? 1 : 0) << 24;
case SyntaxKind.ExportDeclaration:
return (node.isTypeOnly ? 1 : 0) << 24;
case SyntaxKind.ImportType:
return (node.isTypeOf ? 1 : 0) << 24;
case SyntaxKind.ImportClause:
return (node.phaseModifier === SyntaxKind.TypeKeyword ? 1 : node.phaseModifier === SyntaxKind.DeferKeyword ? 2 : 0) << 24;
case SyntaxKind.ImportSpecifier:
return (node.isTypeOnly ? 1 : 0) << 24;
case SyntaxKind.JSDocTypeLiteral:
return (node.isArrayType ? 1 : 0) << 24;
case SyntaxKind.JSDocParameterTag:
case SyntaxKind.JSDocPropertyTag:
return (node.isBracketed ? 1 : 0) << 24 | (node.isNameFirst ? 1 : 0) << 25;
}
return 0;
}
//# sourceMappingURL=encoder.generated.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"encoder.generated.js","sourceRoot":"","sources":["../../../src/api/node/encoder.generated.ts"],"names":[],"mappings":"AAAA,+DAA+D;AA0B/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,GACxB,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,eAAe,CAAC,IAAgB;IAC5C,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,UAAU,CAAC,UAAU,CAAC;QAC3B,KAAK,UAAU,CAAC,iBAAiB,CAAC;QAClC,KAAK,UAAU,CAAC,OAAO,CAAC;QACxB,KAAK,UAAU,CAAC,SAAS,CAAC;QAC1B,KAAK,UAAU,CAAC,SAAS,CAAC;QAC1B,KAAK,UAAU,CAAC,cAAc,CAAC;QAC/B,KAAK,UAAU,CAAC,aAAa;YACzB,OAAO,qBAAqB,CAAC;QACjC,KAAK,UAAU,CAAC,aAAa,CAAC;QAC9B,KAAK,UAAU,CAAC,cAAc,CAAC;QAC/B,KAAK,UAAU,CAAC,aAAa,CAAC;QAC9B,KAAK,UAAU,CAAC,wBAAwB,CAAC;QACzC,KAAK,UAAU,CAAC,6BAA6B,CAAC;QAC9C,KAAK,UAAU,CAAC,YAAY,CAAC;QAC7B,KAAK,UAAU,CAAC,cAAc,CAAC;QAC/B,KAAK,UAAU,CAAC,YAAY,CAAC;QAC7B,KAAK,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ClE,KAAK,UAAU,CAAC,iBAAiB,CAAC;QAClC,KAAK,UAAU,CAAC,gBAAgB;YAC5B,OAAO,CAAE,IAAoC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAE,IAAoC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACrJ,CAAC;IACD,OAAO,CAAC,CAAC;AACb,CAAC"}
+287
View File
@@ -0,0 +1,287 @@
import { SyntaxKind } from "../../ast/index.js";
import { getNodeCommonData, getNodeDataType, } from "./encoder.generated.js";
import { MsgpackWriter } from "./msgpack.js";
import { childProperties, HEADER_OFFSET_EXTENDED_DATA, HEADER_OFFSET_METADATA, HEADER_OFFSET_NODES, HEADER_OFFSET_STRING_TABLE, HEADER_OFFSET_STRING_TABLE_OFFSETS, HEADER_OFFSET_STRUCTURED_DATA, HEADER_SIZE, KIND_NODE_LIST, NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING, NODE_LEN, PROTOCOL_VERSION, } from "./protocol.js";
const NODE_FIELDS = NODE_LEN / 4;
const NODE_FIELD_NEXT = 3;
const NO_STRUCTURED_DATA = 0xFFFFFFFF;
// String table that accumulates strings into a flat byte pool.
class StringTable {
parts;
byteLen;
offsets;
constructor() {
this.parts = [];
this.byteLen = 0;
this.offsets = [];
}
add(text) {
const index = this.offsets.length;
const encoder = cachedEncoder();
const encodedLength = encoder.encode(text).length;
const offset = this.byteLen;
this.parts.push(text);
this.byteLen += encodedLength;
this.offsets.push(offset, offset + encodedLength);
return index;
}
encode() {
const encoder = cachedEncoder();
const dataBytes = encoder.encode(this.parts.join(""));
const offsetBytes = new Uint8Array(this.offsets.length * 4);
const view = new DataView(offsetBytes.buffer);
for (let i = 0; i < this.offsets.length; i++) {
view.setUint32(i * 4, this.offsets[i], true);
}
const result = new Uint8Array(offsetBytes.length + dataBytes.length);
result.set(offsetBytes, 0);
result.set(dataBytes, offsetBytes.length);
return result;
}
stringByteLength() {
return this.byteLen;
}
offsetsCount() {
return this.offsets.length;
}
}
let _encoder;
function cachedEncoder() {
return _encoder ??= new TextEncoder();
}
function getChildrenPropertyMask(node) {
const kind = node.kind;
const props = childProperties[kind];
if (!props) {
return 0;
}
const n = node;
let mask = 0;
for (let i = 0; i < props.length; i++) {
const prop = props[i];
if (prop !== undefined && isChildPresent(n[prop])) {
mask |= 1 << i;
}
}
return mask;
}
// A child is "present" if it's non-null/non-undefined.
// This matches the Go encoder's behavior where non-nil NodeLists (even empty)
// are treated as present, and only nil NodeLists are absent.
function isChildPresent(v) {
if (v === undefined || v === null)
return false;
return true;
}
function recordNodeStrings(node, strs) {
return strs.add(node.text ?? "");
}
function encodeFileReferences(refs, writer) {
if (!refs || refs.length === 0)
return NO_STRUCTURED_DATA;
const offset = writer.finish().length;
writer.writeArrayHeader(refs.length);
for (const ref of refs) {
writer.writeArrayHeader(5);
writer.writeUint(ref.pos);
writer.writeUint(ref.end);
writer.writeString(ref.fileName);
writer.writeUint(ref.resolutionMode ?? 0);
writer.writeBool(ref.preserve ?? false);
}
return offset;
}
function recordExtendedData(node, strs, extendedData, structuredWriter) {
const offset = extendedData.length * 4;
if (node.kind === SyntaxKind.SourceFile) {
const sf = node;
const textIndex = strs.add(sf.text);
const fileNameIndex = strs.add(sf.fileName);
const pathIndex = strs.add(sf.path);
const referencedFilesOffset = encodeFileReferences(sf.referencedFiles, structuredWriter);
const typeRefDirectivesOffset = encodeFileReferences(sf.typeReferenceDirectives, structuredWriter);
const libRefDirectivesOffset = encodeFileReferences(sf.libReferenceDirectives, structuredWriter);
extendedData.push(textIndex, fileNameIndex, pathIndex, sf.languageVariant, sf.scriptKind, referencedFilesOffset, typeRefDirectivesOffset, libRefDirectivesOffset, NO_STRUCTURED_DATA, NO_STRUCTURED_DATA, NO_STRUCTURED_DATA, 0);
}
else if (node.kind === SyntaxKind.TemplateHead ||
node.kind === SyntaxKind.TemplateMiddle ||
node.kind === SyntaxKind.TemplateTail) {
const tmpl = node;
const text = tmpl.text ?? "";
const rawText = tmpl.rawText ?? "";
const templateFlags = tmpl.templateFlags ?? 0;
const textIndex = strs.add(text);
const rawTextIndex = strs.add(rawText);
extendedData.push(textIndex, rawTextIndex, templateFlags);
}
else {
// StringLiteral, NumericLiteral, BigIntLiteral, RegularExpressionLiteral,
// NoSubstitutionTemplateLiteral — format: [textIndex, tokenFlags]
const n = node;
const text = n.text ?? "";
const tokenFlags = n.tokenFlags ?? 0;
const textIndex = strs.add(text);
extendedData.push(textIndex, tokenFlags);
}
return offset;
}
function getNodeData(node, strs, extendedData, structuredWriter) {
const t = getNodeDataType(node.kind);
const common = getNodeCommonData(node);
switch (t) {
case NODE_DATA_TYPE_CHILDREN:
return t | common | getChildrenPropertyMask(node);
case NODE_DATA_TYPE_STRING:
return t | common | recordNodeStrings(node, strs);
case NODE_DATA_TYPE_EXTENDED:
return t | common | recordExtendedData(node, strs, extendedData, structuredWriter);
default:
throw new Error("unreachable");
}
}
function getChildPropertiesForNode(node) {
return childProperties[node.kind];
}
// Returns whether a value is a NodeArray (array-like with pos and end).
function isNodeArray(value) {
return Array.isArray(value) && typeof value.pos === "number" && typeof value.end === "number";
}
/**
* Encode a SourceFile AST node into the binary format.
*/
export function encodeSourceFile(sourceFile) {
return encodeNode(sourceFile);
}
/**
* Encode an arbitrary AST node into the binary format.
* When encoding a non-SourceFile node, the header hash and parse options fields will be zero.
*/
export function encodeNode(node) {
const strs = new StringTable();
const extendedDataValues = [];
const structuredWriter = new MsgpackWriter();
// We'll build an array of uint32 values for the nodes section, 7 per node
const nodeValues = [];
// Nil node (index 0)
nodeValues.push(0, 0, 0, 0, 0, 0, 0);
let nodeCount = 0;
let parentIndex = 0;
let prevIndex = 0;
function visitNode(node) {
nodeCount++;
const currentIndex = nodeCount;
if (prevIndex !== 0) {
// Set next pointer on previous sibling
nodeValues[prevIndex * NODE_FIELDS + NODE_FIELD_NEXT] = currentIndex;
}
const data = getNodeData(node, strs, extendedDataValues, structuredWriter);
nodeValues.push(node.kind, node.pos >= 0 ? node.pos : 0, node.end >= 0 ? node.end : 0, 0, // next (filled in later)
parentIndex, data, node.flags);
const saveParentIndex = parentIndex;
const savePrevIndex = prevIndex;
parentIndex = currentIndex;
prevIndex = 0;
visitChildren(node);
prevIndex = currentIndex;
parentIndex = saveParentIndex;
}
function visitNodeList(list) {
if (!list) {
return;
}
nodeCount++;
const currentIndex = nodeCount;
if (prevIndex !== 0) {
nodeValues[prevIndex * NODE_FIELDS + NODE_FIELD_NEXT] = currentIndex;
}
nodeValues.push(KIND_NODE_LIST, list.pos >= 0 ? list.pos : 0, list.end >= 0 ? list.end : 0, 0, // next
parentIndex, list.length, // data for NodeList is its length
0);
const saveParentIndex = parentIndex;
parentIndex = currentIndex;
prevIndex = 0;
for (const child of list) {
visitNode(child);
}
prevIndex = currentIndex;
parentIndex = saveParentIndex;
}
function visitChildren(node) {
const props = getChildPropertiesForNode(node);
const n = node;
if (props) {
for (const propName of props) {
if (propName === undefined)
continue;
const child = n[propName];
if (child === undefined || child === null)
continue;
if (isNodeArray(child)) {
visitNodeList(child);
}
else {
visitNode(child);
}
}
}
}
// Encode root node
nodeCount++;
parentIndex++;
const rootData = getNodeData(node, strs, extendedDataValues, structuredWriter);
nodeValues.push(node.kind, node.pos >= 0 ? node.pos : 0, node.end >= 0 ? node.end : 0, 0, 0, rootData, node.flags);
const saveParent = parentIndex;
prevIndex = 0;
parentIndex = 1; // root is at index 1
visitChildren(node);
parentIndex = saveParent;
// Encode extended data section
const extendedDataBytes = new Uint8Array(extendedDataValues.length * 4);
const extView = new DataView(extendedDataBytes.buffer);
for (let i = 0; i < extendedDataValues.length; i++) {
extView.setUint32(i * 4, extendedDataValues[i], true);
}
// Encode structured data section
const structuredDataBytes = structuredWriter.finish();
// Encode string table
const strsBytes = strs.encode();
// Encode nodes section
const nodesBytes = new Uint8Array(nodeValues.length * 4);
const nodesView = new DataView(nodesBytes.buffer);
for (let i = 0; i < nodeValues.length; i++) {
nodesView.setUint32(i * 4, nodeValues[i] >>> 0, true);
}
// Calculate section offsets
const offsetStringTableOffsets = HEADER_SIZE;
const offsetStringTableData = HEADER_SIZE + strs.offsetsCount() * 4;
const offsetExtendedData = offsetStringTableData + strs.stringByteLength();
const offsetStructuredData = offsetExtendedData + extendedDataBytes.length;
const offsetNodes = offsetStructuredData + structuredDataBytes.length;
// Build header
const header = new Uint8Array(HEADER_SIZE);
const headerView = new DataView(header.buffer);
const metadata = PROTOCOL_VERSION << 24;
headerView.setUint32(HEADER_OFFSET_METADATA, metadata, true);
// bytes 4-19: hash (zero for non-SourceFile, we don't have access to xxh3 here)
// byte 20-23: parse options (zero for non-SourceFile)
headerView.setUint32(HEADER_OFFSET_STRING_TABLE_OFFSETS, offsetStringTableOffsets, true);
headerView.setUint32(HEADER_OFFSET_STRING_TABLE, offsetStringTableData, true);
headerView.setUint32(HEADER_OFFSET_EXTENDED_DATA, offsetExtendedData, true);
headerView.setUint32(HEADER_OFFSET_STRUCTURED_DATA, offsetStructuredData, true);
headerView.setUint32(HEADER_OFFSET_NODES, offsetNodes, true);
// Concatenate all sections
const result = new Uint8Array(header.length + strsBytes.length + extendedDataBytes.length + structuredDataBytes.length + nodesBytes.length);
result.set(header, 0);
result.set(strsBytes, HEADER_SIZE);
result.set(extendedDataBytes, offsetExtendedData);
result.set(structuredDataBytes, offsetStructuredData);
result.set(nodesBytes, offsetNodes);
return result;
}
/**
* Encode a Uint8Array to a base64 string.
*/
export function uint8ArrayToBase64(data) {
return Buffer.from(data).toString("base64");
}
//# sourceMappingURL=encoder.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../../src/api/node/encoder.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACH,iBAAiB,EACjB,eAAe,GAClB,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rC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,cAAc;QACvC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,YAAY,EACvC,CAAC;QACC,MAAM,IAAI,GAAG,IAA+B,CAAC;QAC7C,MAAM,IAAI,GAAW,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACrC,MAAM,OAAO,GAAW,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC3C,MAAM,aAAa,GAAW,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC;QACtD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;IAC9D,CAAC;SACI,CAAC;QACF,0EAA0E;QAC1E,kEAAkE;QAClE,MAAM,CAAC,GAAG,IAAW,CAAC;QACtB,MAAM,IAAI,GAAW,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QAClC,MAAM,UAAU,GAAW,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;Line truncated
+32
View File
@@ -0,0 +1,32 @@
export declare const MSGPACK_FIXARRAY3 = 147;
export declare const MSGPACK_BIN8 = 196;
export declare const MSGPACK_BIN16 = 197;
export declare const MSGPACK_BIN32 = 198;
export declare const MSGPACK_UINT8 = 204;
/** Compute the MessagePack bin header size for a given data length. */
export declare function binHeaderSize(len: number): number;
/** Write a MessagePack bin header into `buf` at `off`, return new offset. */
export declare function writeBinHeader(buf: Uint8Array, off: number, len: number): number;
export declare class MsgpackWriter {
private buf;
private view;
private pos;
constructor(initialSize?: number);
private ensure;
writeArrayHeader(length: number): void;
writeUint(value: number): void;
writeString(str: string): void;
writeBool(value: boolean): void;
finish(): Uint8Array;
}
export declare class MsgpackReader {
private buf;
private view;
private pos;
constructor(data: Uint8Array, offset?: number);
readArrayHeader(): number;
readUint(): number;
readString(): string;
readBool(): boolean;
}
//# sourceMappingURL=msgpack.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"msgpack.d.ts","sourceRoot":"","sources":["../../../src/api/node/msgpack.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,MAAO,CAAC;AACtC,eAAO,MAAM,YAAY,MAAO,CAAC;AACjC,eAAO,MAAM,aAAa,MAAO,CAAC;AAClC,eAAO,MAAM,aAAa,MAAO,CAAC;AAClC,eAAO,MAAM,aAAa,MAAO,CAAC;AAIlC,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBhF;AAKD,qBAAa,aAAa;IACtB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,GAAG,CAAS;gBAER,WAAW,SAAM;IAM7B,OAAO,CAAC,MAAM;IAWd,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAmBtC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAwB9B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IA4B9B,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAK/B,MAAM,IAAI,UAAU;CAGvB;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,IAAI,CAAW;IACvB,OAAO,CAAC,GAAG,CAAS;gBAER,IAAI,EAAE,UAAU,EAAE,MAAM,SAAI;IAMxC,eAAe,IAAI,MAAM;IAgBzB,QAAQ,IAAI,MAAM;IAiBlB,UAAU,IAAI,MAAM;IAyBpB,QAAQ,IAAI,OAAO;CAMtB"}
+213
View File
@@ -0,0 +1,213 @@
// Minimal msgpack encoder/decoder.
// Supports: arrays, unsigned integers, strings, booleans, binary data.
import { Wtf8Decoder } from "./wtf8.js";
// ── MessagePack format constants ────────────────────────────────────
export const MSGPACK_FIXARRAY3 = 0x93; // 3-element fixarray
export const MSGPACK_BIN8 = 0xc4;
export const MSGPACK_BIN16 = 0xc5;
export const MSGPACK_BIN32 = 0xc6;
export const MSGPACK_UINT8 = 0xcc;
// ── Bin header helpers ──────────────────────────────────────────────
/** Compute the MessagePack bin header size for a given data length. */
export function binHeaderSize(len) {
if (len < 0x100)
return 2; // BIN8: marker + 1-byte size
if (len < 0x10000)
return 3; // BIN16: marker + 2-byte size
return 5; // BIN32: marker + 4-byte size
}
/** Write a MessagePack bin header into `buf` at `off`, return new offset. */
export function writeBinHeader(buf, off, len) {
if (len < 0x100) {
buf[off++] = MSGPACK_BIN8;
buf[off++] = len;
}
else if (len < 0x10000) {
buf[off++] = MSGPACK_BIN16;
buf[off++] = (len >>> 8) & 0xff;
buf[off++] = len & 0xff;
}
else {
buf[off++] = MSGPACK_BIN32;
buf[off++] = (len >>> 24) & 0xff;
buf[off++] = (len >>> 16) & 0xff;
buf[off++] = (len >>> 8) & 0xff;
buf[off++] = len & 0xff;
}
return off;
}
const encoder = new TextEncoder();
const decoder = new Wtf8Decoder();
export class MsgpackWriter {
buf;
view;
pos;
constructor(initialSize = 256) {
this.buf = new Uint8Array(initialSize);
this.view = new DataView(this.buf.buffer);
this.pos = 0;
}
ensure(n) {
if (this.pos + n > this.buf.length) {
let newSize = this.buf.length * 2;
while (newSize < this.pos + n)
newSize *= 2;
const next = new Uint8Array(newSize);
next.set(this.buf);
this.buf = next;
this.view = new DataView(this.buf.buffer);
}
}
writeArrayHeader(length) {
if (length <= 0x0f) {
this.ensure(1);
this.buf[this.pos++] = 0x90 | length;
}
else if (length <= 0xffff) {
this.ensure(3);
this.buf[this.pos++] = 0xdc;
this.view.setUint16(this.pos, length, false);
this.pos += 2;
}
else {
this.ensure(5);
this.buf[this.pos++] = 0xdd;
this.view.setUint32(this.pos, length, false);
this.pos += 4;
}
}
writeUint(value) {
if (value <= 0x7f) {
this.ensure(1);
this.buf[this.pos++] = value;
}
else if (value <= 0xff) {
this.ensure(2);
this.buf[this.pos++] = 0xcc;
this.buf[this.pos++] = value;
}
else if (value <= 0xffff) {
this.ensure(3);
this.buf[this.pos++] = 0xcd;
this.view.setUint16(this.pos, value, false);
this.pos += 2;
}
else {
this.ensure(5);
this.buf[this.pos++] = 0xce;
this.view.setUint32(this.pos, value, false);
this.pos += 4;
}
}
writeString(str) {
const encoded = encoder.encode(str);
const len = encoded.length;
if (len <= 0x1f) {
this.ensure(1 + len);
this.buf[this.pos++] = 0xa0 | len;
}
else if (len <= 0xff) {
this.ensure(2 + len);
this.buf[this.pos++] = 0xd9;
this.buf[this.pos++] = len;
}
else if (len <= 0xffff) {
this.ensure(3 + len);
this.buf[this.pos++] = 0xda;
this.view.setUint16(this.pos, len, false);
this.pos += 2;
}
else {
this.ensure(5 + len);
this.buf[this.pos++] = 0xdb;
this.view.setUint32(this.pos, len, false);
this.pos += 4;
}
this.buf.set(encoded, this.pos);
this.pos += len;
}
writeBool(value) {
this.ensure(1);
this.buf[this.pos++] = value ? 0xc3 : 0xc2;
}
finish() {
return this.buf.subarray(0, this.pos);
}
}
export class MsgpackReader {
buf;
view;
pos;
constructor(data, offset = 0) {
this.buf = data;
this.view = new DataView(data.buffer, data.byteOffset, data.byteLength);
this.pos = offset;
}
readArrayHeader() {
const byte = this.buf[this.pos++];
if ((byte & 0xf0) === 0x90)
return byte & 0x0f;
if (byte === 0xdc) {
const len = this.view.getUint16(this.pos, false);
this.pos += 2;
return len;
}
if (byte === 0xdd) {
const len = this.view.getUint32(this.pos, false);
this.pos += 4;
return len;
}
throw new Error(`Expected array header, got 0x${byte.toString(16)}`);
}
readUint() {
const byte = this.buf[this.pos++];
if (byte <= 0x7f)
return byte;
if (byte === 0xcc)
return this.buf[this.pos++];
if (byte === 0xcd) {
const val = this.view.getUint16(this.pos, false);
this.pos += 2;
return val;
}
if (byte === 0xce) {
const val = this.view.getUint32(this.pos, false);
this.pos += 4;
return val;
}
throw new Error(`Expected uint, got 0x${byte.toString(16)}`);
}
readString() {
const byte = this.buf[this.pos++];
let len;
if ((byte & 0xe0) === 0xa0) {
len = byte & 0x1f;
}
else if (byte === 0xd9) {
len = this.buf[this.pos++];
}
else if (byte === 0xda) {
len = this.view.getUint16(this.pos, false);
this.pos += 2;
}
else if (byte === 0xdb) {
len = this.view.getUint32(this.pos, false);
this.pos += 4;
}
else {
throw new Error(`Expected string, got 0x${byte.toString(16)}`);
}
const str = decoder.decode(this.buf.subarray(this.pos, this.pos + len));
this.pos += len;
return str;
}
readBool() {
const byte = this.buf[this.pos++];
if (byte === 0xc3)
return true;
if (byte === 0xc2)
return false;
throw new Error(`Expected bool, got 0x${byte.toString(16)}`);
}
}
//# sourceMappingURL=msgpack.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"msgpack.js","sourceRoot":"","sources":["../../../src/api/node/msgpack.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,uEAAuE;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,CAAC,qBAAqB;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC,uEAAuE;AAEvE,uEAAuE;AACvE,MAAM,UAAU,aAAa,CAAC,GAAW;IACrC,IAAI,GAAG,GAAG,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC,6BAA6B;IACxD,IAAI,GAAG,GAAG,OAAO;QAAE,OAAO,CAAC,CAAC,CAAC,8BAA8B;IAC3D,OAAO,CA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G,EAAE,CAAC,GAAG,IAAI,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC1C,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;Line truncated
+76
View File
@@ -0,0 +1,76 @@
import { type FileReference, type LineAndCharacter, type Node, type Path, SyntaxKind } from "../../ast/index.ts";
import type { TimingCollector } from "../timing.ts";
import { RemoteNode, RemoteNodeList } from "./node.generated.ts";
import { type SourceFileInfo, type TextDecoder } from "./node.infrastructure.ts";
export { RemoteNode, RemoteNodeList } from "./node.generated.ts";
export { readParseOptionsKey, readSourceFileHash, RemoteNodeBase } from "./node.infrastructure.ts";
export declare class RemoteSourceFile extends RemoteNode implements SourceFileInfo {
readonly nodes: (RemoteNode | RemoteNodeList)[];
readonly _offsetNodes: number;
readonly _offsetStringTableOffsets: number;
readonly _offsetStringTable: number;
readonly _offsetExtendedData: number;
readonly _offsetStructuredData: number;
readonly _decoder: TextDecoder;
readonly _timing: TimingCollector | undefined;
private _lineStarts;
private _cachedText;
private _cachedReferencedFiles;
private _cachedTypeReferenceDirectives;
private _cachedLibReferenceDirectives;
private _cachedImports;
private _cachedModuleAugmentations;
private _cachedAmbientModuleNames;
constructor(data: Uint8Array, decoder: TextDecoder, timing?: TimingCollector);
readFileReferences(structuredDataOffset: number): readonly FileReference[];
readNodeIndexArray(structuredDataOffset: number): readonly Node[];
readStringArray(structuredDataOffset: number): readonly string[];
/** @internal */
getOrCreateNodeAtIndex(index: number): Node;
private get extendedDataOffset();
get fileName(): string;
get path(): string;
get languageVariant(): number;
get scriptKind(): number;
get referencedFiles(): readonly FileReference[];
get typeReferenceDirectives(): readonly FileReference[];
get libReferenceDirectives(): readonly FileReference[];
get imports(): readonly Node[];
get moduleAugmentations(): readonly Node[];
get ambientModuleNames(): readonly string[];
get externalModuleIndicator(): Node | true | undefined;
get isDeclarationFile(): boolean;
get text(): string;
getLineStarts(): readonly number[];
getLineAndCharacterOfPosition(position: number): LineAndCharacter;
getPositionOfLineAndCharacter(line: number, character: number): number;
}
/**
* Find a descendant node at a specific position with matching kind and end position.
*/
export declare function findDescendant(root: Node, pos: number, end: number, kind: SyntaxKind): Node | undefined;
/**
* Parsed components of a node handle.
*/
export interface ParsedNodeHandle {
index: number;
kind: SyntaxKind;
path: Path;
}
/**
* Parse a node handle string into its components.
* Handle format: "index.kind.path" where path may contain dots.
*/
export declare function parseNodeHandle(handle: string): ParsedNodeHandle;
/**
* Decode binary-encoded AST data into a Node.
* Works for any binary-encoded node, including synthetic nodes
* (e.g. from typeToTypeNode) that don't have a source file.
*/
export declare function decodeNode(data: Uint8Array): Node;
/**
* Get the unique ID string for a remote node.
* Throws if the node is not a RemoteNode (i.e. not decoded from binary data).
*/
export declare function getNodeId(node: Node): string;
//# sourceMappingURL=node.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/api/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,IAAI,EAET,KAAK,IAAI,EACT,UAAU,EAEb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EACH,UAAU,EACV,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEH,KAAK,cAAc,EACnB,KAAK,WAAW,EACnB,MAAM,0BAA0B,CAAC;AAelC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQnG,qBAAa,gBAAiB,SAAQ,UAAW,YAAW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a,EAAE,CAM9C;IAED,IAAI,uBAAuB,IAAI,SAAS,aAAa,EAAE,CAMtD;IAED,IAAI,sBAAsB,IAAI,SAAS,aAAa,EAAE,CAMrD;IAED,IAAI,OAAO,IAAI,SAAS,IAAI,EAAE,CAM7B;IAED,IAAI,mBAAmB,IAAI,SAAS,IAAI,EAAE,CAMzC;IAED,IAAI,kBAAkB,IAAI,SAAS,MAAM,EAAE,CAM1C;IAED,IAAI,uBAAuB,IAAI,IAAI,GAAG,IAAI,GAAG,SAAS,CAKrD;IAED,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED,IAAI,IAAI,IAAI,MAAM,CAKjB;IAID,aAAa,IAAI,SAAS,MAAM,EAAE;IAIlC,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IAMjE,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;CAOzE;AAyBD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAiBvG;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAehE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAGjD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAK5C"}
+182
View File
@@ -0,0 +1,182 @@
import { ModifierFlags, type Node, type NodeArray, type SourceFile, SyntaxKind } from "../../ast/index.ts";
import { RemoteNodeBase, type SourceFileInfo } from "./node.infrastructure.ts";
export declare class RemoteNodeList extends Array<RemoteNode> implements NodeArray<RemoteNode> {
static get [Symbol.species](): ArrayConstructor;
parent: RemoteNode;
hasTrailingComma?: boolean;
transformFlags: number;
protected view: DataView;
protected index: number;
private _byteIndex;
private _cursorIndex;
private _cursorNodeIndex;
get pos(): number;
get end(): number;
get next(): number;
private get data();
private sourceFile;
constructor(view: DataView, index: number, parent: RemoteNode, sourceFile: SourceFileInfo, offsetNodes: number);
get 0(): RemoteNode;
get 1(): RemoteNode;
get 2(): RemoteNode;
get 3(): RemoteNode;
get 4(): RemoteNode;
get 5(): RemoteNode;
get 6(): RemoteNode;
get 7(): RemoteNode;
get 8(): RemoteNode;
get 9(): RemoteNode;
get 10(): RemoteNode;
get 11(): RemoteNode;
get 12(): RemoteNode;
get 13(): RemoteNode;
get 14(): RemoteNode;
get 15(): RemoteNode;
[Symbol.iterator](): ArrayIterator<RemoteNode>;
forEachNode<T>(visitNode: (node: RemoteNode) => T | undefined): T | undefined;
at(index: number): RemoteNode;
private getOrCreateChildAtNodeIndex;
__print(): string;
}
export declare class RemoteNode extends RemoteNodeBase implements Node {
protected static NODE_LEN: number;
protected get sourceFile(): SourceFileInfo;
protected _sourceFile: SourceFileInfo;
get id(): string;
constructor(view: DataView, index: number, parent: RemoteNode, sourceFile: SourceFileInfo, offsetNodes: number);
forEachChild<T>(visitNode: (node: Node) => T, visitList?: (list: NodeArray<Node>) => T): T | undefined;
get jsDoc(): readonly Node[] | undefined;
getSourceFile(): SourceFile;
getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
getFullStart(): number;
getEnd(): number;
getWidth(sourceFile?: SourceFile): number;
getFullWidth(): number;
getLeadingTriviaWidth(sourceFile?: SourceFile): number;
getFullText(sourceFile?: SourceFile): string;
getText(sourceFile?: SourceFile): string;
protected getString(index: number): string;
private getOrCreateChildAtNodeIndex;
private hasChildren;
private getNamedChild;
private getChildAtOrder;
__print(): string;
__printChildren(): string;
__printSubtree(): string;
get containsOnlyTriviaWhiteSpaces(): boolean;
get isArrayType(): boolean;
get isBracketed(): boolean;
get isExportEquals(): boolean;
get isNameFirst(): boolean;
get isTypeOf(): boolean;
get isTypeOnly(): boolean;
get multiLine(): boolean;
get keyword(): SyntaxKind | undefined;
get keywordToken(): SyntaxKind | undefined;
get operator(): SyntaxKind | undefined;
get phaseModifier(): SyntaxKind | undefined;
get token(): SyntaxKind | undefined;
get templateFlags(): number | undefined;
get tokenFlags(): number;
get argument(): RemoteNode | undefined;
get argumentExpression(): RemoteNode | undefined;
get arguments(): RemoteNodeList | undefined;
get assertsModifier(): RemoteNode | undefined;
get asteriskToken(): RemoteNode | undefined;
get attributes(): RemoteNode | RemoteNodeList | undefined;
get awaitModifier(): RemoteNode | undefined;
get block(): RemoteNode | undefined;
get body(): RemoteNode | undefined;
get caseBlock(): RemoteNode | undefined;
get catchClause(): RemoteNode | undefined;
get checkType(): RemoteNode | undefined;
get children(): RemoteNode | RemoteNodeList | undefined;
get className(): RemoteNode | undefined;
get clauses(): RemoteNodeList | undefined;
get closingElement(): RemoteNode | undefined;
get closingFragment(): RemoteNode | undefined;
get colonToken(): RemoteNode | undefined;
get comment(): RemoteNodeList | undefined;
get condition(): RemoteNode | undefined;
get constraint(): RemoteNode | undefined;
get declarationList(): RemoteNode | undefined;
get declarations(): RemoteNodeList | undefined;
get defaultType(): RemoteNode | undefined;
get dotDotDotToken(): RemoteNode | undefined;
get elements(): RemoteNodeList | undefined;
get elementType(): RemoteNode | undefined;
get elseStatement(): RemoteNode | undefined;
get endOfFileToken(): RemoteNode | undefined;
get equalsGreaterThanToken(): RemoteNode | undefined;
get equalsToken(): RemoteNode | undefined;
get exclamationToken(): RemoteNode | undefined;
get exportClause(): RemoteNode | undefined;
get expression(): RemoteNode | undefined;
get exprName(): RemoteNode | undefined;
get extendsType(): RemoteNode | undefined;
get falseType(): RemoteNode | undefined;
get finallyBlock(): RemoteNode | undefined;
get head(): RemoteNode | undefined;
get heritageClauses(): RemoteNodeList | undefined;
get importClause(): RemoteNode | undefined;
get incrementor(): RemoteNode | undefined;
get indexType(): RemoteNode | undefined;
get initializer(): RemoteNode | undefined;
get jsdocPropertyTags(): RemoteNode | undefined;
get label(): RemoteNode | undefined;
get left(): RemoteNode | undefined;
get literal(): RemoteNode | undefined;
get members(): RemoteNodeList | undefined;
get modifiers(): RemoteNodeList | undefined;
get moduleReference(): RemoteNode | undefined;
get moduleSpecifier(): RemoteNode | undefined;
get name(): RemoteNode | undefined;
get namedBindings(): RemoteNode | undefined;
get nameExpression(): RemoteNode | undefined;
get namespace(): RemoteNode | undefined;
get nameType(): RemoteNode | undefined;
get objectAssignmentInitializer(): RemoteNode | undefined;
get objectType(): RemoteNode | undefined;
get openingElement(): RemoteNode | undefined;
get openingFragment(): RemoteNode | undefined;
get operand(): RemoteNode | undefined;
get operatorToken(): RemoteNode | undefined;
get parameterName(): RemoteNode | undefined;
get parameters(): RemoteNodeList | undefined;
get postfixToken(): RemoteNode | undefined;
get properties(): RemoteNodeList | undefined;
get propertyName(): RemoteNode | undefined;
get qualifier(): RemoteNode | undefined;
get questionDotToken(): RemoteNode | undefined;
get questionToken(): RemoteNode | undefined;
get readonlyToken(): RemoteNode | undefined;
get right(): RemoteNode | undefined;
get statement(): RemoteNode | undefined;
get statements(): RemoteNodeList | undefined;
get tag(): RemoteNode | undefined;
get tagName(): RemoteNode | undefined;
get tags(): RemoteNodeList | undefined;
get template(): RemoteNode | undefined;
get templateSpans(): RemoteNodeList | undefined;
get thenStatement(): RemoteNode | undefined;
get thisArg(): RemoteNode | undefined;
get trueType(): RemoteNode | undefined;
get tryBlock(): RemoteNode | undefined;
get tupleNameSource(): RemoteNode | undefined;
get type(): RemoteNode | undefined;
get typeArguments(): RemoteNodeList | undefined;
get typeExpression(): RemoteNode | undefined;
get typeName(): RemoteNode | undefined;
get typeParameter(): RemoteNode | undefined;
get typeParameters(): RemoteNodeList | undefined;
get types(): RemoteNodeList | undefined;
get value(): RemoteNode | undefined;
get variableDeclaration(): RemoteNode | undefined;
get whenFalse(): RemoteNode | undefined;
get whenTrue(): RemoteNode | undefined;
get text(): string | undefined;
get rawText(): string | undefined;
get flags(): number;
get modifierFlags(): ModifierFlags;
}
//# sourceMappingURL=node.generated.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"node.generated.d.ts","sourceRoot":"","sources":["../../../src/api/node/node.generated.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,aAAa,EACb,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,UAAU,EACf,UAAU,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAQH,cAAc,EACd,KAAK,cAAc,EACtB,MAAM,0BAA0B,CAAC;AAiBlC,qBAAa,cAAe,SAAQ,KAAK,CAAC,UAAU,CAAE,YAAW,SAAS,CAAC,UAAU,CAAC;IAGlF,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAE9C;IAED,MAAM,EAAE,UAAU,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAK;IAC3B,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC;IACzB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,UAAU,CAAS;IAK3B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,gBAAgB,CAAa;IAErC,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,KAAK,IAAI,GAEf;IAED,OAAO,CAAC,UAAU,CAAiB;gBAEvB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM;IAmB9G,IAAI,CAAC,IAAI,UAAU,CAElB;IACD,IAAI,CAAC,IAAI,UAAU,CAElB;IACD,IAAI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AAG,SAAS,CAE5C;IACD,IAAI,YAAY,IAAI,cAAc,GAAG,SAAS,CAE7C;IACD,IAAI,WAAW,IAAI,UAAU,GAAG,SAAS,CAExC;IACD,IAAI,cAAc,IAAI,UAAU,GAAG,SAAS,CAE3C;IACD,IAAI,QAAQ,IAAI,cAAc,GAAG,SAAS,CAEzC;IACD,IAAI,WAAW,IAAI,UAAU,GAAG,SAAS,CAExC;IACD,IAAI,aAAa,IAAI,UAAU,GAAG,SAAS,CAE1C;IACD,IAAI,cAAc,IAAI,UAAU,GAAG,SAAS,CAE3C;IACD,IAAI,sBAAsB,IAAI,UAAU,GAAG,SAAS,CAEnD;IACD,IAAI,WAAW,IAAI,UAAU,GAAG,SAAS,CAExC;IACD,IAAI,gBAAgB,IAAI,UAAU,GAAG,SAAS,CAE7C;IACD,IAAI,YAAY,IAAI,UAAU,GAAG,SAAS,CAEzC;IACD,IAAI,UAAU,IAAI,UAAU,GAAG,SAAS,CAEvC;IACD,IAAI,QAAQ,IAAI,UAAU,GAAG,SAAS,CAErC;IACD,IAAI,WAAW,IAAI,UAAU,GAAG,SAAS,CAExC;IACD,IAAI,SAAS,IAAI,UAAU,GAAG,SAAS,CAEtC;IACD,IAAI,YAAY,IAAI,UAAU,GAAG,SAAS,CAEzC;IACD,IAAI,IAAI,IAAI,UAAU,GAAG,SAAS,CAEjC;IACD,IAAI,eAAe,IAAI,cAAc,GAAG,SAAS,CAEhD;IACD,IAAI,YAAY,IAAI,UAAU,GAAG,SAAS,CAEzC;IACD,IAAI,WAAW,IAAI,UAAU,GAAG,SAAS,CAExC;IACD,IAAI,SAAS,IAAI,UAAU,GAAG,SAAS,CAEtC;IACD,IAAILine truncated
+835
View File
@@ -0,0 +1,835 @@
// Code generated by _scripts/generate-encoder.ts. DO NOT EDIT.
import { getTokenPosOfNode, ModifierFlags, SyntaxKind, } from "../../ast/index.js";
import { modifierToFlag, NODE_CHILD_MASK, NODE_DATA_TYPE_MASK, NODE_EXTENDED_DATA_MASK, NODE_STRING_INDEX_MASK, popcount8, RemoteNodeBase, } from "./node.infrastructure.js";
import { childProperties, KIND_NODE_LIST, NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING, NODE_LEN, NODE_OFFSET_DATA, NODE_OFFSET_END, NODE_OFFSET_FLAGS, NODE_OFFSET_KIND, NODE_OFFSET_NEXT, NODE_OFFSET_PARENT, NODE_OFFSET_POS, } from "./protocol.js";
export class RemoteNodeList extends Array {
// Inherited Array methods like filter/map/slice use ArraySpeciesCreate, which would
// otherwise call `new RemoteNodeList(length)` and fail. Produce a plain Array instead.
static get [Symbol.species]() {
return Array;
}
parent;
hasTrailingComma;
transformFlags = 0;
view;
index;
_byteIndex;
// Cursor memoizing the last resolved (logical index -> node index) so that
// sequential forward access (index loops and list[i], plus forEach/map/
// reduce/filter) resumes instead of re-walking from the head, turning an
// O(n) pass over the whole list from O(n^2) into O(n).
_cursorIndex = 0;
_cursorNodeIndex = 0;
get pos() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_POS, true);
}
get end() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_END, true);
}
get next() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_NEXT, true);
}
get data() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_DATA, true);
}
sourceFile;
constructor(view, index, parent, sourceFile, offsetNodes) {
super();
this.view = view;
this.index = index;
this.parent = parent;
this.sourceFile = sourceFile;
this._byteIndex = offsetNodes + index * NODE_LEN;
this.length = this.data;
this._cursorNodeIndex = index + 1;
const length = this.length;
for (let i = 16; i < length; i++) {
Object.defineProperty(this, i, {
get() {
return this.at(i);
},
});
}
}
get 0() {
return this.at(0);
}
get 1() {
return this.at(1);
}
get 2() {
return this.at(2);
}
get 3() {
return this.at(3);
}
get 4() {
return this.at(4);
}
get 5() {
return this.at(5);
}
get 6() {
return this.at(6);
}
get 7() {
return this.at(7);
}
get 8() {
return this.at(8);
}
get 9() {
return this.at(9);
}
get 10() {
return this.at(10);
}
get 11() {
return this.at(11);
}
get 12() {
return this.at(12);
}
get 13() {
return this.at(13);
}
get 14() {
return this.at(14);
}
get 15() {
return this.at(15);
}
*[Symbol.iterator]() {
if (!this.length)
return;
let next = this.index + 1;
while (next) {
const child = this.getOrCreateChildAtNodeIndex(next);
next = child.next;
yield child;
}
}
forEachNode(visitNode) {
if (!this.length)
return;
let next = this.index + 1;
while (next) {
const child = this.getOrCreateChildAtNodeIndex(next);
next = child.next;
const result = visitNode(child);
if (result)
return result;
}
}
at(index) {
if (!Number.isInteger(index)) {
return undefined;
}
if (index >= this.data || (index < 0 && -index > this.data)) {
return undefined;
}
if (index < 0) {
index = this.length + index;
}
// Walk the raw buffer following each node's `next` pointer instead of
// materializing every intermediate RemoteNode just to read it. Resume from
// the memoized cursor when possible so sequential forward access is O(1)
// amortized (a full in-order pass is O(n) rather than O(n^2)).
const offsetNodes = this.sourceFile._offsetNodes;
let i;
let next;
if (index >= this._cursorIndex) {
i = this._cursorIndex;
next = this._cursorNodeIndex;
}
else {
i = 0;
next = this.index + 1;
}
for (; i < index; i++) {
next = this.view.getUint32(offsetNodes + next * NODE_LEN + NODE_OFFSET_NEXT, true);
}
this._cursorIndex = index;
this._cursorNodeIndex = next;
return this.getOrCreateChildAtNodeIndex(next);
}
getOrCreateChildAtNodeIndex(index) {
let child = this.sourceFile.nodes[index];
if (!child) {
const kind = this.view.getUint32(this.sourceFile._offsetNodes + index * NODE_LEN + NODE_OFFSET_KIND, true);
if (kind === KIND_NODE_LIST) {
throw new Error("NodeList cannot directly contain another NodeList");
}
const sf = this.sourceFile;
child = new RemoteNode(this.view, index, this.parent, sf, sf._offsetNodes);
sf.nodes[index] = child;
sf._timing?.recordMaterialization();
}
return child;
}
__print() {
const result = [];
result.push(`kind: NodeList`);
result.push(`index: ${this.index}`);
result.push(`byteIndex: ${this._byteIndex}`);
result.push(`length: ${this.length}`);
return result.join("\n");
}
}
export class RemoteNode extends RemoteNodeBase {
static NODE_LEN = NODE_LEN;
get sourceFile() {
return this._sourceFile;
}
_sourceFile;
get id() {
return `${this.index}.${this.kind}.${this.sourceFile.path}`;
}
constructor(view, index, parent, sourceFile, offsetNodes) {
super(view, index, parent, offsetNodes + index * NODE_LEN);
this._sourceFile = sourceFile;
}
forEachChild(visitNode, visitList) {
if (this.hasChildren()) {
let next = this.index + 1;
do {
const child = this.getOrCreateChildAtNodeIndex(next);
if (child instanceof RemoteNodeList) {
if (visitList) {
const result = visitList(child);
if (result) {
return result;
}
}
else {
const result = child.forEachNode(visitNode);
if (result) {
return result;
}
}
}
else if (child.kind !== SyntaxKind.JSDoc) {
const result = visitNode(child);
if (result) {
return result;
}
}
next = child.next;
} while (next);
}
}
get jsDoc() {
if (!this.hasChildren()) {
return undefined;
}
let result;
let next = this.index + 1;
do {
const child = this.getOrCreateChildAtNodeIndex(next);
if (!(child instanceof RemoteNodeList) && child.kind === SyntaxKind.JSDoc) {
(result ??= []).push(child);
}
next = child.next;
} while (next);
return result;
}
getSourceFile() {
return this.sourceFile;
}
getStart(sourceFile, includeJsDocComment) {
return getTokenPosOfNode(this, sourceFile ?? this.getSourceFile(), includeJsDocComment);
}
getFullStart() {
return this.pos;
}
getEnd() {
return this.end;
}
getWidth(sourceFile) {
return this.getEnd() - this.getStart(sourceFile);
}
getFullWidth() {
return this.end - this.pos;
}
getLeadingTriviaWidth(sourceFile) {
return this.getStart(sourceFile) - this.pos;
}
getFullText(sourceFile) {
return (sourceFile ?? this.getSourceFile()).text.substring(this.pos, this.end);
}
getText(sourceFile) {
sourceFile ??= this.getSourceFile();
return sourceFile.text.substring(this.getStart(sourceFile), this.end);
}
getString(index) {
const offsetStringTableOffsets = this.sourceFile._offsetStringTableOffsets;
const start = this.view.getUint32(offsetStringTableOffsets + index * 4, true);
const end = this.view.getUint32(offsetStringTableOffsets + (index + 1) * 4, true);
const offsetStringTable = this.sourceFile._offsetStringTable;
const text = new Uint8Array(this.view.buffer, this.view.byteOffset + offsetStringTable + start, end - start);
return this.sourceFile._decoder.decode(text);
}
getOrCreateChildAtNodeIndex(index) {
let child = this.sourceFile.nodes[index];
if (!child) {
const sf = this.sourceFile;
const offsetNodes = sf._offsetNodes;
const kind = this.view.getUint32(offsetNodes + index * NODE_LEN + NODE_OFFSET_KIND, true);
child = kind === KIND_NODE_LIST
? new RemoteNodeList(this.view, index, this, sf, offsetNodes)
: new RemoteNode(this.view, index, this, sf, offsetNodes);
sf.nodes[index] = child;
sf._timing?.recordMaterialization();
}
return child;
}
hasChildren() {
if (this._byteIndex >= this.view.byteLength - NODE_LEN) {
return false;
}
const nextNodeParent = this.view.getUint32(this.sourceFile._offsetNodes + (this.index + 1) * NODE_LEN + NODE_OFFSET_PARENT, true);
return nextNodeParent === this.index;
}
getNamedChild(propertyName) {
const kind = this.kind;
const propertyNames = childProperties[kind];
if (!propertyNames) {
return undefined;
}
const order = propertyNames.indexOf(propertyName);
if (order === -1) {
return undefined;
}
return this.getChildAtOrder(order);
}
getChildAtOrder(order) {
const mask = this.childMask;
if (!(mask & (1 << order))) {
// Property is not present
return undefined;
}
// The property index is `order`, minus the number of zeros in the mask that are in bit positions less
// than the `order`th bit. Example:
//
// This is a MethodDeclaration with mask 0b01110101. The possible properties are
// ["modifiers", "asteriskToken", "name", "postfixToken", "typeParameters", "parameters", "type", "body"]
// (it has modifiers, name, typeParameters, parameters, and type).
//
// | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// | ----- | ---- | ---- | ---------- | -------------- | ------------ | ---- | ------------- | --------- |
// | Value | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
// | Name | body | type | parameters | typeParameters | postfixToken | name | asteriskToken | modifiers |
//
// We are trying to get the index of "parameters" (bit = 5).
// First, set all the more significant bits to 1:
//
// | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// | ----- | ---- | ---- | ---------- | -------------- | ------------ | ---- | ------------- | --------- |
// | Value | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
//
// Then, flip the bits:
//
// | Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// | ----- | ---- | ---- | ---------- | -------------- | ------------ | ---- | ------------- | --------- |
// | Value | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 |
//
// Counting the 1s gives us the number of *missing properties* before the `order`th property. If every property
// were present, we would have `parameters = children[5]`, but since `postfixToken` and `astersiskToken` are
// missing, we have `parameters = children[5 - 2]`.
const propertyIndex = order - popcount8[~(mask | ((0xff << order) & 0xff)) & 0xff];
let childIndex = this.index + 1;
for (let i = 0; i < propertyIndex; i++) {
// Walk through children via their `next` pointer until we get to the right property index
childIndex = this.view.getUint32(this.sourceFile._offsetNodes + childIndex * NODE_LEN + NODE_OFFSET_NEXT, true);
}
return this.getOrCreateChildAtNodeIndex(childIndex);
}
__print() {
const result = [];
result.push(`index: ${this.index}`);
result.push(`byteIndex: ${this._byteIndex}`);
result.push(`kind: ${SyntaxKind[this.kind]}`);
result.push(`pos: ${this.pos}`);
result.push(`end: ${this.end}`);
result.push(`next: ${this.next}`);
result.push(`parent: ${this.parentIndex}`);
result.push(`data: ${this.data.toString(2).padStart(32, "0")}`);
const dataType = this.dataType === NODE_DATA_TYPE_CHILDREN ? "children" :
this.dataType === NODE_DATA_TYPE_STRING ? "string" :
"extended";
result.push(`dataType: ${dataType}`);
if (this.dataType === NODE_DATA_TYPE_CHILDREN) {
result.push(`childMask: ${this.childMask.toString(2).padStart(8, "0")}`);
result.push(`childProperties: ${childProperties[this.kind]?.join(", ")}`);
}
return result.join("\n");
}
__printChildren() {
const result = [];
let next = this.index + 1;
while (next) {
const child = this.getOrCreateChildAtNodeIndex(next);
next = child.next;
result.push(child.__print());
}
return result.join("\n\n");
}
__printSubtree() {
const result = [this.__print()];
this.forEachChild(function visitNode(node) {
result.push(node.__print());
node.forEachChild(visitNode);
}, visitList => {
result.push(visitList.__print());
});
return result.join("\n\n");
}
// ═══ Generated boolean property getters ═══
get containsOnlyTriviaWhiteSpaces() {
return (this.data & (1 << 24)) !== 0;
}
get isArrayType() {
return (this.data & (1 << 24)) !== 0;
}
get isBracketed() {
return (this.data & (1 << 24)) !== 0;
}
get isExportEquals() {
return (this.data & (1 << 24)) !== 0;
}
get isNameFirst() {
return (this.data & (1 << 25)) !== 0;
}
get isTypeOf() {
return (this.data & (1 << 24)) !== 0;
}
get isTypeOnly() {
return (this.data & (1 << 24)) !== 0;
}
get multiLine() {
return (this.data & (1 << 24)) !== 0;
}
// ═══ Generated SyntaxKind union property getters ═══
get keyword() {
switch (this.kind) {
case SyntaxKind.ModuleDeclaration:
return (this.data >> 24) & 0x1 ? SyntaxKind.NamespaceKeyword : SyntaxKind.ModuleKeyword;
}
}
get keywordToken() {
switch (this.kind) {
case SyntaxKind.MetaProperty:
return (this.data >> 24) & 0x1 ? SyntaxKind.NewKeyword : SyntaxKind.ImportKeyword;
}
}
get operator() {
switch (this.kind) {
case SyntaxKind.PrefixUnaryExpression: {
const idx = (this.data >> 24) & 0x7;
if (idx === 1)
return SyntaxKind.MinusToken;
if (idx === 2)
return SyntaxKind.TildeToken;
if (idx === 3)
return SyntaxKind.ExclamationToken;
if (idx === 4)
return SyntaxKind.PlusPlusToken;
if (idx === 5)
return SyntaxKind.MinusMinusToken;
return SyntaxKind.PlusToken;
}
case SyntaxKind.PostfixUnaryExpression:
return (this.data >> 24) & 0x1 ? SyntaxKind.MinusMinusToken : SyntaxKind.PlusPlusToken;
case SyntaxKind.TypeOperator: {
const idx = (this.data >> 24) & 0x3;
if (idx === 1)
return SyntaxKind.ReadonlyKeyword;
if (idx === 2)
return SyntaxKind.UniqueKeyword;
return SyntaxKind.KeyOfKeyword;
}
}
}
get phaseModifier() {
switch (this.kind) {
case SyntaxKind.ImportClause: {
const idx = (this.data >> 24) & 0x3;
if (idx === 0)
return undefined;
return idx === 1 ? SyntaxKind.TypeKeyword : idx === 2 ? SyntaxKind.DeferKeyword : undefined;
}
}
}
get token() {
switch (this.kind) {
case SyntaxKind.HeritageClause:
return (this.data >> 24) & 0x1 ? SyntaxKind.ImplementsKeyword : SyntaxKind.ExtendsKeyword;
case SyntaxKind.ImportAttributes:
return (this.data >> 25) & 0x1 ? SyntaxKind.AssertKeyword : SyntaxKind.WithKeyword;
}
}
get templateFlags() {
switch (this.kind) {
case SyntaxKind.TemplateHead:
case SyntaxKind.TemplateMiddle:
case SyntaxKind.TemplateTail:
const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
return this.view.getUint32(extendedDataOffset + 8, true);
}
}
get tokenFlags() {
switch (this.kind) {
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
case SyntaxKind.BigIntLiteral:
case SyntaxKind.RegularExpressionLiteral:
const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
return this.view.getUint32(extendedDataOffset + 4, true);
default:
return 0;
}
}
// ═══ Generated child property getters ═══
get argument() {
return this.getNamedChild("argument");
}
get argumentExpression() {
return this.getNamedChild("argumentExpression");
}
get arguments() {
return this.getNamedChild("arguments");
}
get assertsModifier() {
return this.getNamedChild("assertsModifier");
}
get asteriskToken() {
return this.getNamedChild("asteriskToken");
}
get attributes() {
return this.getNamedChild("attributes");
}
get awaitModifier() {
return this.getNamedChild("awaitModifier");
}
get block() {
return this.getNamedChild("block");
}
get body() {
return this.getNamedChild("body");
}
get caseBlock() {
return this.getNamedChild("caseBlock");
}
get catchClause() {
return this.getNamedChild("catchClause");
}
get checkType() {
return this.getNamedChild("checkType");
}
get children() {
return this.getNamedChild("children");
}
get className() {
return this.getNamedChild("className");
}
get clauses() {
return this.getNamedChild("clauses");
}
get closingElement() {
return this.getNamedChild("closingElement");
}
get closingFragment() {
return this.getNamedChild("closingFragment");
}
get colonToken() {
return this.getNamedChild("colonToken");
}
get comment() {
return this.getNamedChild("comment");
}
get condition() {
return this.getNamedChild("condition");
}
get constraint() {
return this.getNamedChild("constraint");
}
get declarationList() {
return this.getNamedChild("declarationList");
}
get declarations() {
return this.getNamedChild("declarations");
}
get defaultType() {
return this.getNamedChild("defaultType");
}
get dotDotDotToken() {
return this.getNamedChild("dotDotDotToken");
}
get elements() {
return this.getNamedChild("elements");
}
get elementType() {
return this.getNamedChild("elementType");
}
get elseStatement() {
return this.getNamedChild("elseStatement");
}
get endOfFileToken() {
return this.getNamedChild("endOfFileToken");
}
get equalsGreaterThanToken() {
return this.getNamedChild("equalsGreaterThanToken");
}
get equalsToken() {
return this.getNamedChild("equalsToken");
}
get exclamationToken() {
return this.getNamedChild("exclamationToken");
}
get exportClause() {
return this.getNamedChild("exportClause");
}
get expression() {
return this.getNamedChild("expression");
}
get exprName() {
return this.getNamedChild("exprName");
}
get extendsType() {
return this.getNamedChild("extendsType");
}
get falseType() {
return this.getNamedChild("falseType");
}
get finallyBlock() {
return this.getNamedChild("finallyBlock");
}
get head() {
return this.getNamedChild("head");
}
get heritageClauses() {
return this.getNamedChild("heritageClauses");
}
get importClause() {
return this.getNamedChild("importClause");
}
get incrementor() {
return this.getNamedChild("incrementor");
}
get indexType() {
return this.getNamedChild("indexType");
}
get initializer() {
return this.getNamedChild("initializer");
}
get jsdocPropertyTags() {
return this.getNamedChild("jsdocPropertyTags");
}
get label() {
return this.getNamedChild("label");
}
get left() {
return this.getNamedChild("left");
}
get literal() {
return this.getNamedChild("literal");
}
get members() {
return this.getNamedChild("members");
}
get modifiers() {
return this.getNamedChild("modifiers");
}
get moduleReference() {
return this.getNamedChild("moduleReference");
}
get moduleSpecifier() {
return this.getNamedChild("moduleSpecifier");
}
get name() {
return this.getNamedChild("name");
}
get namedBindings() {
return this.getNamedChild("namedBindings");
}
get nameExpression() {
return this.getNamedChild("nameExpression");
}
get namespace() {
return this.getNamedChild("namespace");
}
get nameType() {
return this.getNamedChild("nameType");
}
get objectAssignmentInitializer() {
return this.getNamedChild("objectAssignmentInitializer");
}
get objectType() {
return this.getNamedChild("objectType");
}
get openingElement() {
return this.getNamedChild("openingElement");
}
get openingFragment() {
return this.getNamedChild("openingFragment");
}
get operand() {
return this.getNamedChild("operand");
}
get operatorToken() {
return this.getNamedChild("operatorToken");
}
get parameterName() {
return this.getNamedChild("parameterName");
}
get parameters() {
return this.getNamedChild("parameters");
}
get postfixToken() {
return this.getNamedChild("postfixToken");
}
get properties() {
return this.getNamedChild("properties");
}
get propertyName() {
return this.getNamedChild("propertyName");
}
get qualifier() {
return this.getNamedChild("qualifier");
}
get questionDotToken() {
return this.getNamedChild("questionDotToken");
}
get questionToken() {
return this.getNamedChild("questionToken");
}
get readonlyToken() {
return this.getNamedChild("readonlyToken");
}
get right() {
return this.getNamedChild("right");
}
get statement() {
return this.getNamedChild("statement");
}
get statements() {
return this.getNamedChild("statements");
}
get tag() {
return this.getNamedChild("tag");
}
get tagName() {
return this.getNamedChild("tagName");
}
get tags() {
return this.getNamedChild("tags");
}
get template() {
return this.getNamedChild("template");
}
get templateSpans() {
return this.getNamedChild("templateSpans");
}
get thenStatement() {
return this.getNamedChild("thenStatement");
}
get thisArg() {
return this.getNamedChild("thisArg");
}
get trueType() {
return this.getNamedChild("trueType");
}
get tryBlock() {
return this.getNamedChild("tryBlock");
}
get tupleNameSource() {
return this.getNamedChild("tupleNameSource");
}
get type() {
return this.getNamedChild("type");
}
get typeArguments() {
return this.getNamedChild("typeArguments");
}
get typeExpression() {
return this.getNamedChild("typeExpression");
}
get typeName() {
return this.getNamedChild("typeName");
}
get typeParameter() {
return this.getNamedChild("typeParameter");
}
get typeParameters() {
return this.getNamedChild("typeParameters");
}
get types() {
return this.getNamedChild("types");
}
get value() {
return this.getNamedChild("value");
}
get variableDeclaration() {
return this.getNamedChild("variableDeclaration");
}
get whenFalse() {
return this.getNamedChild("whenFalse");
}
get whenTrue() {
return this.getNamedChild("whenTrue");
}
// ═══ Generated string property getters ═══
get text() {
switch (this.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PrivateIdentifier:
case SyntaxKind.JsxText:
case SyntaxKind.JSDocText:
case SyntaxKind.JSDocLink:
case SyntaxKind.JSDocLinkPlain:
case SyntaxKind.JSDocLinkCode: {
const stringIndex = this.data & NODE_STRING_INDEX_MASK;
return this.getString(stringIndex);
}
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
case SyntaxKind.BigIntLiteral:
case SyntaxKind.RegularExpressionLiteral:
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.TemplateHead:
case SyntaxKind.TemplateMiddle:
case SyntaxKind.TemplateTail:
case SyntaxKind.SourceFile: {
const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
const stringIndex = this.view.getUint32(extendedDataOffset, true);
return this.getString(stringIndex);
}
}
}
get rawText() {
switch (this.kind) {
case SyntaxKind.TemplateHead:
case SyntaxKind.TemplateMiddle:
case SyntaxKind.TemplateTail:
const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
const stringIndex = this.view.getUint32(extendedDataOffset + 4, true);
return this.getString(stringIndex);
}
}
// ═══ Generated extended data property getters ═══
// ═══ Other property getters ═══
get flags() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_FLAGS, true);
}
get modifierFlags() {
const mods = this.modifiers;
if (!mods)
return ModifierFlags.None;
let flags = ModifierFlags.None;
for (const mod of mods) {
flags |= modifierToFlag(mod.kind);
}
return flags;
}
}
//# sourceMappingURL=node.generated.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"node.generated.js","sourceRoot":"","sources":["../../../src/api/node/node.generated.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,OAAO,EACH,iBAAiB,EACjB,aAAa,EAIb,UAAU,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EAEtB,SAAS,EACT,cAAc,GAEjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,eAAe,EACf,cAAc,EACd,uBAAuB,E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AC;QACD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,OAAO,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAe,CAAC;IAChE,CAAC;IAEO,2BAA2B,CAAC,KAAa;QAC7C,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,gBAAgB,EAAE,IAAI,CAAC,CAAC;YAC3G,IAAI,IAAI,KAAK,cAAc,EAAE,CLine truncated
+62
View File
@@ -0,0 +1,62 @@
import { type FileReference, ModifierFlags, type Node, SyntaxKind } from "../../ast/index.ts";
import type { TimingCollector } from "../timing.ts";
import { NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING } from "./protocol.ts";
export declare const popcount8: number[];
export type NodeDataType = typeof NODE_DATA_TYPE_CHILDREN | typeof NODE_DATA_TYPE_STRING | typeof NODE_DATA_TYPE_EXTENDED;
export declare const NODE_DATA_TYPE_MASK = 3221225472;
export declare const NODE_CHILD_MASK = 255;
export declare const NODE_STRING_INDEX_MASK = 16777215;
export declare const NODE_EXTENDED_DATA_MASK = 16777215;
export interface TextDecoder {
decode(input?: ArrayBufferView | ArrayBufferLike): string;
}
export interface SourceFileInfo {
readonly _offsetNodes: number;
readonly _offsetStringTableOffsets: number;
readonly _offsetStringTable: number;
readonly _offsetExtendedData: number;
readonly _offsetStructuredData: number;
readonly _decoder: TextDecoder;
nodes: any[];
readonly path?: string;
/**
* The timing collector that per-node materialization is reported into, and
* that this source file registered itself with when fetched. Present only
* when timing collection is enabled; when undefined, materialization is not
* timed and no clock is read.
*/
readonly _timing?: TimingCollector | undefined;
readFileReferences(offset: number): readonly FileReference[];
readNodeIndexArray(offset: number): readonly Node[];
readStringArray(offset: number): readonly string[];
getOrCreateNodeAtIndex(index: number): Node;
}
/**
* Read the 128-bit content hash from a source file binary response as a hex string.
*/
export declare function readSourceFileHash(data: DataView): string;
/**
* Read the per-file parse options key from a source file binary response.
* This encodes the ExternalModuleIndicatorOptions bitmask as a string,
* allowing the client to distinguish files parsed with different options.
*/
export declare function readParseOptionsKey(data: DataView): string;
export declare function modifierToFlag(kind: SyntaxKind): ModifierFlags;
export declare class RemoteNodeBase {
parent: any;
view: DataView;
protected index: number;
protected _byteIndex: number;
constructor(view: DataView, index: number, parent: any, byteIndex: number);
get kind(): SyntaxKind;
get pos(): number;
get end(): number;
get next(): number;
protected get parentIndex(): number;
protected get data(): number;
protected get dataType(): NodeDataType;
protected get childMask(): number;
protected getFileText(start: number, end: number): string;
protected get sourceFile(): SourceFileInfo;
}
//# sourceMappingURL=node.infrastructure.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"node.infrastructure.d.ts","sourceRoot":"","sources":["../../../src/api/node/node.infrastructure.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,IAAI,EACT,UAAU,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAMH,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EAOxB,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,SAAS,EAAE,MAAM,EAAqwB,CAAC;AAEpyB,MAAM,MAAM,YAAY,GAAG,OAAO,uBAAuB,GAAG,OAAO,qBAAqB,GAAG,OAAO,uBAAuB,CAAC;AAC1H,eAAO,MAAM,mBAAmB,aAAgB,CAAC;AACjD,eAAO,MAAM,eAAe,MAAgB,CAAC;AAC7C,eAAO,MAAM,sBAAsB,WAAgB,CAAC;AACpD,eAAO,MAAM,uBAAuB,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AC;gBAEjB,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM;IAOzE,IAAI,IAAI,IAAI,UAAU,CAErB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,SAAS,KAAK,WAAW,IAAI,MAAM,CAElC;IAED,SAAS,KAAK,IAAI,IAAI,MAAM,CAE3B;IAED,SAAS,KAAK,QAAQ,IAAI,YAAY,CAErC;IAED,SAAS,KAAK,SAAS,IAAI,MAAM,CAKhC;IAED,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAIzD,SAAS,KAAK,UAAU,IAAI,cAAc,CAGzC;CACJ"}
+122
View File
@@ -0,0 +1,122 @@
import { ModifierFlags, SyntaxKind, } from "../../ast/index.js";
import { HEADER_OFFSET_HASH_HI0, HEADER_OFFSET_HASH_HI1, HEADER_OFFSET_HASH_LO0, HEADER_OFFSET_HASH_LO1, HEADER_OFFSET_PARSE_OPTIONS, NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING, NODE_OFFSET_DATA, NODE_OFFSET_END, NODE_OFFSET_KIND, NODE_OFFSET_NEXT, NODE_OFFSET_PARENT, NODE_OFFSET_POS, } from "./protocol.js";
// ═══════════════════════════════════════════════════════════════════════════
// Constants
// ═══════════════════════════════════════════════════════════════════════════
export const popcount8 = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8];
export const NODE_DATA_TYPE_MASK = 0xc0_00_00_00;
export const NODE_CHILD_MASK = 0x00_00_00_ff;
export const NODE_STRING_INDEX_MASK = 0x00_ff_ff_ff;
export const NODE_EXTENDED_DATA_MASK = 0x00_ff_ff_ff;
// ═══════════════════════════════════════════════════════════════════════════
// Free functions
// ═══════════════════════════════════════════════════════════════════════════
/**
* Read the 128-bit content hash from a source file binary response as a hex string.
*/
export function readSourceFileHash(data) {
const lo0 = data.getUint32(HEADER_OFFSET_HASH_LO0, true);
const lo1 = data.getUint32(HEADER_OFFSET_HASH_LO1, true);
const hi0 = data.getUint32(HEADER_OFFSET_HASH_HI0, true);
const hi1 = data.getUint32(HEADER_OFFSET_HASH_HI1, true);
return hex8(hi1) + hex8(hi0) + hex8(lo1) + hex8(lo0);
}
/**
* Read the per-file parse options key from a source file binary response.
* This encodes the ExternalModuleIndicatorOptions bitmask as a string,
* allowing the client to distinguish files parsed with different options.
*/
export function readParseOptionsKey(data) {
return data.getUint32(HEADER_OFFSET_PARSE_OPTIONS, true).toString();
}
function hex8(n) {
return (n >>> 0).toString(16).padStart(8, "0");
}
export function modifierToFlag(kind) {
switch (kind) {
case SyntaxKind.StaticKeyword:
return ModifierFlags.Static;
case SyntaxKind.PublicKeyword:
return ModifierFlags.Public;
case SyntaxKind.ProtectedKeyword:
return ModifierFlags.Protected;
case SyntaxKind.PrivateKeyword:
return ModifierFlags.Private;
case SyntaxKind.AbstractKeyword:
return ModifierFlags.Abstract;
case SyntaxKind.AccessorKeyword:
return ModifierFlags.Accessor;
case SyntaxKind.ExportKeyword:
return ModifierFlags.Export;
case SyntaxKind.DeclareKeyword:
return ModifierFlags.Ambient;
case SyntaxKind.ConstKeyword:
return ModifierFlags.Const;
case SyntaxKind.DefaultKeyword:
return ModifierFlags.Default;
case SyntaxKind.AsyncKeyword:
return ModifierFlags.Async;
case SyntaxKind.ReadonlyKeyword:
return ModifierFlags.Readonly;
case SyntaxKind.OverrideKeyword:
return ModifierFlags.Override;
case SyntaxKind.InKeyword:
return ModifierFlags.In;
case SyntaxKind.OutKeyword:
return ModifierFlags.Out;
case SyntaxKind.Decorator:
return ModifierFlags.Decorator;
default:
return ModifierFlags.None;
}
}
// ═══════════════════════════════════════════════════════════════════════════
// RemoteNodeBase
// ═══════════════════════════════════════════════════════════════════════════
export class RemoteNodeBase {
parent; // RemoteNode at runtime
view;
index;
_byteIndex;
constructor(view, index, parent, byteIndex) {
this.view = view;
this.index = index;
this.parent = parent;
this._byteIndex = byteIndex;
}
get kind() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_KIND, true);
}
get pos() {
return this.view.getInt32(this._byteIndex + NODE_OFFSET_POS, true);
}
get end() {
return this.view.getInt32(this._byteIndex + NODE_OFFSET_END, true);
}
get next() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_NEXT, true);
}
get parentIndex() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_PARENT, true);
}
get data() {
return this.view.getUint32(this._byteIndex + NODE_OFFSET_DATA, true);
}
get dataType() {
return (this.data & NODE_DATA_TYPE_MASK);
}
get childMask() {
if (this.dataType !== NODE_DATA_TYPE_CHILDREN) {
return -1;
}
return this.data & NODE_CHILD_MASK;
}
getFileText(start, end) {
return this.sourceFile._decoder.decode(new Uint8Array(this.view.buffer, this.view.byteOffset + this.sourceFile._offsetStringTable + start, end - start));
}
get sourceFile() {
// Overridden in RemoteNode; exists here for getFileText access
throw new Error("sourceFile not available on base");
}
}
//# sourceMappingURL=node.infrastructure.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"node.infrastructure.js","sourceRoot":"","sources":["../../../src/api/node/node.infrastructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,aAAa,EAEb,UAAU,GACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAClB,MAAM,eAAe,CAAC;AAEvB,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,CAAC,MAAM,SAAS,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,E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aAAa,CAAC,SAAS,CAAC;QACnC;YACI,OAAO,aAAa,CAAC,IAAI,CAAC;IAClC,CAAC;AACL,CAAC;AAED,8EAA8E;AAC9ELine truncated
+298
View File
@@ -0,0 +1,298 @@
import { computeLineStarts, NodeFlags, SyntaxKind, TokenFlags, } from "../../ast/index.js";
import { MsgpackReader } from "./msgpack.js";
import { RemoteNode, RemoteNodeList, } from "./node.generated.js";
import { NODE_EXTENDED_DATA_MASK, } from "./node.infrastructure.js";
import { HEADER_OFFSET_EXTENDED_DATA, HEADER_OFFSET_NODES, HEADER_OFFSET_STRING_TABLE, HEADER_OFFSET_STRING_TABLE_OFFSETS, HEADER_OFFSET_STRUCTURED_DATA, KIND_NODE_LIST, NODE_LEN, NODE_OFFSET_KIND, NODE_OFFSET_PARENT, } from "./protocol.js";
import { Wtf8Decoder } from "./wtf8.js";
// Re-export everything consumers need from the other two files.
export { RemoteNode, RemoteNodeList } from "./node.generated.js";
export { readParseOptionsKey, readSourceFileHash, RemoteNodeBase } from "./node.infrastructure.js";
// ═══════════════════════════════════════════════════════════════════════════
// RemoteSourceFile
// ═══════════════════════════════════════════════════════════════════════════
const NO_STRUCTURED_DATA = 0xFFFFFFFF;
export class RemoteSourceFile extends RemoteNode {
nodes;
_offsetNodes;
_offsetStringTableOffsets;
_offsetStringTable;
_offsetExtendedData;
_offsetStructuredData;
_decoder;
_timing;
_lineStarts;
_cachedText;
_cachedReferencedFiles;
_cachedTypeReferenceDirectives;
_cachedLibReferenceDirectives;
_cachedImports;
_cachedModuleAugmentations;
_cachedAmbientModuleNames;
constructor(data, decoder, timing) {
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
const offsetNodes = view.getUint32(HEADER_OFFSET_NODES, true);
super(view, 1, undefined, undefined, offsetNodes);
this._sourceFile = this;
this._offsetNodes = offsetNodes;
this._offsetStringTableOffsets = view.getUint32(HEADER_OFFSET_STRING_TABLE_OFFSETS, true);
this._offsetStringTable = view.getUint32(HEADER_OFFSET_STRING_TABLE, true);
this._offsetExtendedData = view.getUint32(HEADER_OFFSET_EXTENDED_DATA, true);
this._offsetStructuredData = view.getUint32(HEADER_OFFSET_STRUCTURED_DATA, true);
this._decoder = decoder;
this._timing = timing;
this.nodes = Array((view.byteLength - offsetNodes) / NODE_LEN);
this.nodes[1] = this;
// Every node slot is materializable on demand except the nil sentinel at
// index 0 and the source-file node at index 1, which is pre-materialized.
timing?.recordSourceFileFetched(Math.max(0, this.nodes.length - 2));
}
readFileReferences(structuredDataOffset) {
if (structuredDataOffset === NO_STRUCTURED_DATA) {
return [];
}
const buf = new Uint8Array(this.view.buffer, this.view.byteOffset, this.view.byteLength);
const reader = new MsgpackReader(buf, this._offsetStructuredData + structuredDataOffset);
const count = reader.readArrayHeader();
const result = [];
for (let i = 0; i < count; i++) {
reader.readArrayHeader(); // 5-element tuple
const pos = reader.readUint();
const end = reader.readUint();
const fileName = reader.readString();
const resolutionMode = reader.readUint();
const preserve = reader.readBool();
result.push({ pos, end, fileName, resolutionMode, preserve });
}
return result;
}
readNodeIndexArray(structuredDataOffset) {
if (structuredDataOffset === NO_STRUCTURED_DATA) {
return [];
}
const buf = new Uint8Array(this.view.buffer, this.view.byteOffset, this.view.byteLength);
const reader = new MsgpackReader(buf, this._offsetStructuredData + structuredDataOffset);
const count = reader.readArrayHeader();
const result = [];
for (let i = 0; i < count; i++) {
const nodeIndex = reader.readUint();
result.push(this.getOrCreateNodeAtIndex(nodeIndex));
}
return result;
}
readStringArray(structuredDataOffset) {
if (structuredDataOffset === NO_STRUCTURED_DATA) {
return [];
}
const buf = new Uint8Array(this.view.buffer, this.view.byteOffset, this.view.byteLength);
const reader = new MsgpackReader(buf, this._offsetStructuredData + structuredDataOffset);
const count = reader.readArrayHeader();
const result = [];
for (let i = 0; i < count; i++) {
result.push(reader.readString());
}
return result;
}
/** @internal */
getOrCreateNodeAtIndex(index) {
let node = this.nodes[index];
if (!node) {
// Resolve the real parent so that nodes looked up directly by index (e.g. via
// NodeHandle.resolve) report the correct `parent`, rather than always pointing at
// the source file. The stored parent index can refer to a synthetic NodeList
// container; skip those to mirror normal traversal, where list elements take the
// list's parent. The walk terminates at the source file, which occupies index 1
// and is already cached.
let parentIndex = this.view.getUint32(this._offsetNodes + index * NODE_LEN + NODE_OFFSET_PARENT, true);
while (parentIndex !== index &&
this.view.getUint32(this._offsetNodes + parentIndex * NODE_LEN + NODE_OFFSET_KIND, true) === KIND_NODE_LIST) {
parentIndex = this.view.getUint32(this._offsetNodes + parentIndex * NODE_LEN + NODE_OFFSET_PARENT, true);
}
const parent = parentIndex === index ? this : this.getOrCreateNodeAtIndex(parentIndex);
node = new RemoteNode(this.view, index, parent, this, this._offsetNodes);
this.nodes[index] = node;
this._timing?.recordMaterialization();
}
return node;
}
// ═══ SourceFile-specific extended data getters ═══
get extendedDataOffset() {
return this._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
}
get fileName() {
const stringIndex = this.view.getUint32(this.extendedDataOffset + 4, true);
return this.getString(stringIndex);
}
get path() {
const stringIndex = this.view.getUint32(this.extendedDataOffset + 8, true);
return this.getString(stringIndex);
}
get languageVariant() {
return this.view.getUint32(this.extendedDataOffset + 12, true);
}
get scriptKind() {
return this.view.getUint32(this.extendedDataOffset + 16, true);
}
get referencedFiles() {
if (this._cachedReferencedFiles !== undefined)
return this._cachedReferencedFiles;
const offset = this.view.getUint32(this.extendedDataOffset + 20, true);
const files = this.readFileReferences(offset);
this._cachedReferencedFiles = files;
return files;
}
get typeReferenceDirectives() {
if (this._cachedTypeReferenceDirectives !== undefined)
return this._cachedTypeReferenceDirectives;
const offset = this.view.getUint32(this.extendedDataOffset + 24, true);
const directives = this.readFileReferences(offset);
this._cachedTypeReferenceDirectives = directives;
return directives;
}
get libReferenceDirectives() {
if (this._cachedLibReferenceDirectives !== undefined)
return this._cachedLibReferenceDirectives;
const offset = this.view.getUint32(this.extendedDataOffset + 28, true);
const directives = this.readFileReferences(offset);
this._cachedLibReferenceDirectives = directives;
return directives;
}
get imports() {
if (this._cachedImports !== undefined)
return this._cachedImports;
const offset = this.view.getUint32(this.extendedDataOffset + 32, true);
const imports = this.readNodeIndexArray(offset);
this._cachedImports = imports;
return imports;
}
get moduleAugmentations() {
if (this._cachedModuleAugmentations !== undefined)
return this._cachedModuleAugmentations;
const offset = this.view.getUint32(this.extendedDataOffset + 36, true);
const moduleAugmentations = this.readNodeIndexArray(offset);
this._cachedModuleAugmentations = moduleAugmentations;
return moduleAugmentations;
}
get ambientModuleNames() {
if (this._cachedAmbientModuleNames !== undefined)
return this._cachedAmbientModuleNames;
const offset = this.view.getUint32(this.extendedDataOffset + 40, true);
const names = this.readStringArray(offset);
this._cachedAmbientModuleNames = names;
return names;
}
get externalModuleIndicator() {
const nodeIndex = this.view.getUint32(this.extendedDataOffset + 44, true);
if (nodeIndex === 0)
return undefined;
if (nodeIndex === this.index)
return true;
return this.getOrCreateNodeAtIndex(nodeIndex);
}
get isDeclarationFile() {
return (this.flags & NodeFlags.Ambient) !== 0;
}
get text() {
if (this._cachedText !== undefined)
return this._cachedText;
const text = super.text;
this._cachedText = text;
return text;
}
// ═══ Line/character position mapping ═══
getLineStarts() {
return this._lineStarts ??= computeLineStarts(this.text ?? "");
}
getLineAndCharacterOfPosition(position) {
const lineStarts = this.getLineStarts();
const line = computeLineOfPosition(lineStarts, position);
return { line, character: position - lineStarts[line] };
}
getPositionOfLineAndCharacter(line, character) {
const lineStarts = this.getLineStarts();
if (line < 0 || line >= lineStarts.length) {
throw new Error(`Bad line number. Line: ${line}, lineStarts.length: ${lineStarts.length}`);
}
return lineStarts[line] + character;
}
}
/**
* Find the 0-based line number containing the given position via binary search.
* Assumes the first line starts at position 0 and `position` is non-negative.
*/
function computeLineOfPosition(lineStarts, position) {
let low = 0;
let high = lineStarts.length - 1;
while (low <= high) {
const middle = low + ((high - low) >> 1);
const value = lineStarts[middle];
if (value < position) {
low = middle + 1;
}
else if (value > position) {
high = middle - 1;
}
else {
return middle;
}
}
return low - 1;
}
/**
* Find a descendant node at a specific position with matching kind and end position.
*/
export function findDescendant(root, pos, end, kind) {
if (root.pos === pos && root.end === end && root.kind === kind) {
return root;
}
// Search children
let result;
root.forEachChild(child => {
if (result)
return result; // Already found
// Only search in children that could contain our target
if (child.pos <= pos && child.end >= end) {
result = findDescendant(child, pos, end, kind);
}
return undefined;
});
return result;
}
/**
* Parse a node handle string into its components.
* Handle format: "index.kind.path" where path may contain dots.
*/
export function parseNodeHandle(handle) {
const firstDot = handle.indexOf(".");
if (firstDot === -1) {
throw new Error(`Invalid node handle: ${handle}`);
}
const secondDot = handle.indexOf(".", firstDot + 1);
if (secondDot === -1) {
throw new Error(`Invalid node handle: ${handle}`);
}
return {
index: parseInt(handle.slice(0, firstDot), 10),
kind: parseInt(handle.slice(firstDot + 1, secondDot), 10),
path: handle.slice(secondDot + 1),
};
}
/**
* Decode binary-encoded AST data into a Node.
* Works for any binary-encoded node, including synthetic nodes
* (e.g. from typeToTypeNode) that don't have a source file.
*/
export function decodeNode(data) {
const sf = new RemoteSourceFile(data, new Wtf8Decoder());
return sf;
}
/**
* Get the unique ID string for a remote node.
* Throws if the node is not a RemoteNode (i.e. not decoded from binary data).
*/
export function getNodeId(node) {
if (!(node instanceof RemoteNode)) {
throw new Error("getNodeId requires a RemoteNode");
}
return node.id;
}
//# sourceMappingURL=node.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/api/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EAIjB,SAAS,EAET,UAAU,EACV,UAAU,GACb,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACH,UAAU,EACV,cAAc,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,uBAAuB,GAG1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,2BAA2B,EAC3B,mBAAmB,EACnB,0BAA0B,EAC1B,kCAAkC,EA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7G,CAAC;gBACC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,kBAAkB,EAAE,IAAI,CAAC,CAAC;YAC7G,CAAC;YACD,MAAM,MAAM,GAAG,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAe,CAAC;YACrG,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YACzE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,OAAO,EAAE,qBAAqB,EAAE,CAAC;QAC1C,CAAC;QALine truncated
+29
View File
@@ -0,0 +1,29 @@
export declare const PROTOCOL_VERSION = 5;
export declare const HEADER_OFFSET_METADATA = 0;
export declare const HEADER_OFFSET_HASH_LO0 = 4;
export declare const HEADER_OFFSET_HASH_LO1 = 8;
export declare const HEADER_OFFSET_HASH_HI0 = 12;
export declare const HEADER_OFFSET_HASH_HI1 = 16;
export declare const HEADER_OFFSET_PARSE_OPTIONS = 20;
export declare const HEADER_OFFSET_STRING_TABLE_OFFSETS = 24;
export declare const HEADER_OFFSET_STRING_TABLE = 28;
export declare const HEADER_OFFSET_EXTENDED_DATA = 32;
export declare const HEADER_OFFSET_STRUCTURED_DATA = 36;
export declare const HEADER_OFFSET_NODES = 40;
export declare const HEADER_SIZE = 44;
export declare const NODE_LEN = 28;
export declare const NODE_OFFSET_KIND = 0;
export declare const NODE_OFFSET_POS = 4;
export declare const NODE_OFFSET_END = 8;
export declare const NODE_OFFSET_NEXT = 12;
export declare const NODE_OFFSET_PARENT = 16;
export declare const NODE_OFFSET_DATA = 20;
export declare const NODE_OFFSET_FLAGS = 24;
export declare const KIND_NODE_LIST = 4294967295;
export declare const NODE_DATA_TYPE_CHILDREN = 0;
export declare const NODE_DATA_TYPE_STRING = 1073741824;
export declare const NODE_DATA_TYPE_EXTENDED = 2147483648;
export declare const NODE_STRING_INDEX_MASK = 16777215;
export declare const NODE_EXTENDED_DATA_MASK = 16777215;
export { childProperties, singleChildNodePropertyNames } from "./protocol.generated.ts";
//# sourceMappingURL=protocol.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/api/node/protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,kCAAkC,KAAK,CAAC;AACrD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,eAAO,MAAM,QAAQ,KAAK,CAAC;AAE3B,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC,eAAO,MAAM,uBAAuB,IAAa,CAAC;AAClD,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAChD,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAElD,eAAO,MAAM,sBAAsB,WAAa,CAAC;AACjD,eAAO,MAAM,uBAAuB,WAAa,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC"}
+4
View File
@@ -0,0 +1,4 @@
import { SyntaxKind } from "../../ast/index.ts";
export declare const childProperties: Readonly<Partial<Record<SyntaxKind, readonly (string | undefined)[]>>>;
export declare const singleChildNodePropertyNames: Readonly<Partial<Record<SyntaxKind, string>>>;
//# sourceMappingURL=protocol.generated.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"protocol.generated.d.ts","sourceRoot":"","sources":["../../../src/api/node/protocol.generated.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC,CA8KlG,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CA8DtF,CAAC"}
+241
View File
@@ -0,0 +1,241 @@
// Code generated by _scripts/generate-encoder.ts. DO NOT EDIT.
import { SyntaxKind } from "../../ast/index.js";
export const childProperties = {
[SyntaxKind.QualifiedName]: ["left", "right"],
[SyntaxKind.ComputedPropertyName]: ["expression"],
[SyntaxKind.Decorator]: ["expression"],
[SyntaxKind.IfStatement]: ["expression", "thenStatement", "elseStatement"],
[SyntaxKind.DoStatement]: ["statement", "expression"],
[SyntaxKind.WhileStatement]: ["expression", "statement"],
[SyntaxKind.ForStatement]: ["initializer", "condition", "incrementor", "statement"],
[SyntaxKind.ForInStatement]: ["awaitModifier", "initializer", "expression", "statement"],
[SyntaxKind.ForOfStatement]: ["awaitModifier", "initializer", "expression", "statement"],
[SyntaxKind.BreakStatement]: ["label"],
[SyntaxKind.ContinueStatement]: ["label"],
[SyntaxKind.ReturnStatement]: ["expression"],
[SyntaxKind.WithStatement]: ["expression", "statement"],
[SyntaxKind.SwitchStatement]: ["expression", "caseBlock"],
[SyntaxKind.CaseBlock]: ["clauses"],
[SyntaxKind.CaseClause]: ["expression", "statements"],
[SyntaxKind.DefaultClause]: ["expression", "statements"],
[SyntaxKind.ThrowStatement]: ["expression"],
[SyntaxKind.TryStatement]: ["tryBlock", "catchClause", "finallyBlock"],
[SyntaxKind.CatchClause]: ["variableDeclaration", "block"],
[SyntaxKind.LabeledStatement]: ["label", "statement"],
[SyntaxKind.ExpressionStatement]: ["expression"],
[SyntaxKind.Block]: ["statements"],
[SyntaxKind.VariableStatement]: ["modifiers", "declarationList"],
[SyntaxKind.VariableDeclaration]: ["name", "exclamationToken", "type", "initializer"],
[SyntaxKind.VariableDeclarationList]: ["declarations"],
[SyntaxKind.ObjectBindingPattern]: ["elements"],
[SyntaxKind.ArrayBindingPattern]: ["elements"],
[SyntaxKind.Parameter]: ["modifiers", "dotDotDotToken", "name", "questionToken", "type", "initializer"],
[SyntaxKind.BindingElement]: ["dotDotDotToken", "propertyName", "name", "initializer"],
[SyntaxKind.MissingDeclaration]: ["modifiers"],
[SyntaxKind.FunctionDeclaration]: ["modifiers", "asteriskToken", "name", "typeParameters", "parameters", "type", "body"],
[SyntaxKind.ClassDeclaration]: ["modifiers", "name", "typeParameters", "heritageClauses", "members"],
[SyntaxKind.ClassExpression]: ["modifiers", "name", "typeParameters", "heritageClauses", "members"],
[SyntaxKind.HeritageClause]: ["types"],
[SyntaxKind.InterfaceDeclaration]: ["modifiers", "name", "typeParameters", "heritageClauses", "members"],
[SyntaxKind.TypeAliasDeclaration]: ["modifiers", "name", "typeParameters", "type"],
[SyntaxKind.JSTypeAliasDeclaration]: ["modifiers", "name", "typeParameters", "type"],
[SyntaxKind.EnumMember]: ["name", "initializer"],
[SyntaxKind.EnumDeclaration]: ["modifiers", "name", "members"],
[SyntaxKind.ModuleBlock]: ["statements"],
[SyntaxKind.ImportDeclaration]: ["modifiers", "importClause", "moduleSpecifier", "attributes"],
[SyntaxKind.JSImportDeclaration]: ["modifiers", "importClause", "moduleSpecifier", "attributes"],
[SyntaxKind.ExternalModuleReference]: ["expression"],
[SyntaxKind.NamespaceImport]: ["name"],
[SyntaxKind.NamedImports]: ["elements"],
[SyntaxKind.ExportAssignment]: ["modifiers", "type", "expression"],
[SyntaxKind.NamespaceExportDeclaration]: ["modifiers", "name"],
[SyntaxKind.NamespaceExport]: ["name"],
[SyntaxKind.NamedExports]: ["elements"],
[SyntaxKind.ExportSpecifier]: ["propertyName", "name"],
[SyntaxKind.CallSignature]: ["typeParameters", "parameters", "type"],
[SyntaxKind.ConstructSignature]: ["typeParameters", "parameters", "type"],
[SyntaxKind.Constructor]: ["modifiers", "typeParameters", "parameters", "type", "body"],
[SyntaxKind.GetAccessor]: ["modifiers", "name", "typeParameters", "parameters", "type", "body"],
[SyntaxKind.SetAccessor]: ["modifiers", "name", "typeParameters", "parameters", "type", "body"],
[SyntaxKind.IndexSignature]: ["modifiers", "parameters", "type"],
[SyntaxKind.MethodSignature]: ["modifiers", "name", "postfixToken", "typeParameters", "parameters", "type"],
[SyntaxKind.MethodDeclaration]: ["modifiers", "asteriskToken", "name", "postfixToken", "typeParameters", "parameters", "type", "body"],
[SyntaxKind.PropertySignature]: ["modifiers", "name", "postfixToken", "type", "initializer"],
[SyntaxKind.PropertyDeclaration]: ["modifiers", "name", "postfixToken", "type", "initializer"],
[SyntaxKind.ClassStaticBlockDeclaration]: ["modifiers", "body"],
[SyntaxKind.BinaryExpression]: ["modifiers", "left", "type", "operatorToken", "right"],
[SyntaxKind.PrefixUnaryExpression]: ["operand"],
[SyntaxKind.PostfixUnaryExpression]: ["operand"],
[SyntaxKind.YieldExpression]: ["asteriskToken", "expression"],
[SyntaxKind.ArrowFunction]: ["modifiers", "typeParameters", "parameters", "type", "equalsGreaterThanToken", "body"],
[SyntaxKind.FunctionExpression]: ["modifiers", "asteriskToken", "name", "typeParameters", "parameters", "type", "body"],
[SyntaxKind.AsExpression]: ["expression", "type"],
[SyntaxKind.SatisfiesExpression]: ["expression", "type"],
[SyntaxKind.ConditionalExpression]: ["condition", "questionToken", "whenTrue", "colonToken", "whenFalse"],
[SyntaxKind.PropertyAccessExpression]: ["expression", "questionDotToken", "name"],
[SyntaxKind.ElementAccessExpression]: ["expression", "questionDotToken", "argumentExpression"],
[SyntaxKind.CallExpression]: ["expression", "questionDotToken", "typeArguments", "arguments"],
[SyntaxKind.NewExpression]: ["expression", "typeArguments", "arguments"],
[SyntaxKind.MetaProperty]: ["name"],
[SyntaxKind.NonNullExpression]: ["expression"],
[SyntaxKind.SpreadElement]: ["expression"],
[SyntaxKind.TemplateExpression]: ["head", "templateSpans"],
[SyntaxKind.TemplateSpan]: ["expression", "literal"],
[SyntaxKind.TaggedTemplateExpression]: ["tag", "questionDotToken", "typeArguments", "template"],
[SyntaxKind.ParenthesizedExpression]: ["expression"],
[SyntaxKind.ArrayLiteralExpression]: ["elements"],
[SyntaxKind.ObjectLiteralExpression]: ["properties"],
[SyntaxKind.SpreadAssignment]: ["expression"],
[SyntaxKind.PropertyAssignment]: ["modifiers", "name", "postfixToken", "type", "initializer"],
[SyntaxKind.ShorthandPropertyAssignment]: ["modifiers", "name", "postfixToken", "type", "equalsToken", "objectAssignmentInitializer"],
[SyntaxKind.DeleteExpression]: ["expression"],
[SyntaxKind.TypeOfExpression]: ["expression"],
[SyntaxKind.VoidExpression]: ["expression"],
[SyntaxKind.AwaitExpression]: ["expression"],
[SyntaxKind.TypeAssertionExpression]: ["type", "expression"],
[SyntaxKind.UnionType]: ["types"],
[SyntaxKind.IntersectionType]: ["types"],
[SyntaxKind.ConditionalType]: ["checkType", "extendsType", "trueType", "falseType"],
[SyntaxKind.TypeOperator]: ["type"],
[SyntaxKind.InferType]: ["typeParameter"],
[SyntaxKind.ArrayType]: ["elementType"],
[SyntaxKind.IndexedAccessType]: ["objectType", "indexType"],
[SyntaxKind.TypeReference]: ["typeName", "typeArguments"],
[SyntaxKind.ExpressionWithTypeArguments]: ["expression", "typeArguments"],
[SyntaxKind.LiteralType]: ["literal"],
[SyntaxKind.TypePredicate]: ["assertsModifier", "parameterName", "type"],
[SyntaxKind.ImportAttribute]: ["name", "value"],
[SyntaxKind.ImportAttributes]: ["attributes"],
[SyntaxKind.TypeQuery]: ["exprName", "typeArguments"],
[SyntaxKind.MappedType]: ["readonlyToken", "typeParameter", "nameType", "questionToken", "type", "members"],
[SyntaxKind.TypeLiteral]: ["members"],
[SyntaxKind.TupleType]: ["elements"],
[SyntaxKind.NamedTupleMember]: ["dotDotDotToken", "name", "questionToken", "type"],
[SyntaxKind.OptionalType]: ["type"],
[SyntaxKind.RestType]: ["type"],
[SyntaxKind.ParenthesizedType]: ["type"],
[SyntaxKind.FunctionType]: ["typeParameters", "parameters", "type"],
[SyntaxKind.ConstructorType]: ["modifiers", "typeParameters", "parameters", "type"],
[SyntaxKind.TemplateLiteralType]: ["head", "templateSpans"],
[SyntaxKind.TemplateLiteralTypeSpan]: ["type", "literal"],
[SyntaxKind.SyntheticExpression]: ["tupleNameSource"],
[SyntaxKind.PartiallyEmittedExpression]: ["expression"],
[SyntaxKind.JsxElement]: ["openingElement", "children", "closingElement"],
[SyntaxKind.JsxAttributes]: ["properties"],
[SyntaxKind.JsxNamespacedName]: ["namespace", "name"],
[SyntaxKind.JsxOpeningElement]: ["tagName", "typeArguments", "attributes"],
[SyntaxKind.JsxSelfClosingElement]: ["tagName", "typeArguments", "attributes"],
[SyntaxKind.JsxFragment]: ["openingFragment", "children", "closingFragment"],
[SyntaxKind.JsxAttribute]: ["name", "initializer"],
[SyntaxKind.JsxSpreadAttribute]: ["expression"],
[SyntaxKind.JsxClosingElement]: ["tagName"],
[SyntaxKind.JsxExpression]: ["dotDotDotToken", "expression"],
[SyntaxKind.SyntaxList]: ["children"],
[SyntaxKind.JSDoc]: ["comment", "tags"],
[SyntaxKind.JSDocTypeExpression]: ["type"],
[SyntaxKind.JSDocNonNullableType]: ["type"],
[SyntaxKind.JSDocNullableType]: ["type"],
[SyntaxKind.JSDocVariadicType]: ["type"],
[SyntaxKind.JSDocOptionalType]: ["type"],
[SyntaxKind.JSDocTypeTag]: ["tagName", "typeExpression", "comment"],
[SyntaxKind.JSDocUnknownTag]: ["tagName", "comment"],
[SyntaxKind.JSDocTemplateTag]: ["tagName", "constraint", "typeParameters", "comment"],
[SyntaxKind.JSDocReturnTag]: ["tagName", "typeExpression", "comment"],
[SyntaxKind.JSDocPublicTag]: ["tagName", "comment"],
[SyntaxKind.JSDocPrivateTag]: ["tagName", "comment"],
[SyntaxKind.JSDocProtectedTag]: ["tagName", "comment"],
[SyntaxKind.JSDocReadonlyTag]: ["tagName", "comment"],
[SyntaxKind.JSDocOverrideTag]: ["tagName", "comment"],
[SyntaxKind.JSDocDeprecatedTag]: ["tagName", "comment"],
[SyntaxKind.JSDocSeeTag]: ["tagName", "nameExpression", "comment"],
[SyntaxKind.JSDocImplementsTag]: ["tagName", "className", "comment"],
[SyntaxKind.JSDocAugmentsTag]: ["tagName", "className", "comment"],
[SyntaxKind.JSDocSatisfiesTag]: ["tagName", "typeExpression", "comment"],
[SyntaxKind.JSDocThrowsTag]: ["tagName", "typeExpression", "comment"],
[SyntaxKind.JSDocThisTag]: ["tagName", "typeExpression", "comment"],
[SyntaxKind.JSDocImportTag]: ["tagName", "importClause", "moduleSpecifier", "attributes", "comment"],
[SyntaxKind.JSDocCallbackTag]: ["tagName", "typeExpression", "name", "comment"],
[SyntaxKind.JSDocOverloadTag]: ["tagName", "typeExpression", "comment"],
[SyntaxKind.JSDocTypedefTag]: ["tagName", "typeExpression", "name", "comment"],
[SyntaxKind.JSDocSignature]: ["typeParameters", "parameters", "type"],
[SyntaxKind.JSDocNameReference]: ["name"],
[SyntaxKind.SourceFile]: ["statements", "endOfFileToken"],
[SyntaxKind.ModuleDeclaration]: ["modifiers", "name", "body"],
[SyntaxKind.ImportEqualsDeclaration]: ["modifiers", "name", "moduleReference"],
[SyntaxKind.ExportDeclaration]: ["modifiers", "exportClause", "moduleSpecifier", "attributes"],
[SyntaxKind.ImportType]: ["argument", "attributes", "qualifier", "typeArguments"],
[SyntaxKind.ImportClause]: ["name", "namedBindings"],
[SyntaxKind.ImportSpecifier]: ["propertyName", "name"],
[SyntaxKind.JSDocLink]: ["name"],
[SyntaxKind.JSDocLinkPlain]: ["name"],
[SyntaxKind.JSDocLinkCode]: ["name"],
[SyntaxKind.TypeParameter]: ["modifiers", "name", "constraint", "expression", "defaultType"],
[SyntaxKind.SyntheticReferenceExpression]: ["expression", "thisArg"],
[SyntaxKind.JSDocTypeLiteral]: ["jsdocPropertyTags"],
[SyntaxKind.JSDocParameterTag]: ["tagName", "name", "typeExpression", "comment"],
[SyntaxKind.JSDocPropertyTag]: ["tagName", "name", "typeExpression", "comment"],
};
export const singleChildNodePropertyNames = {
[SyntaxKind.ComputedPropertyName]: "expression",
[SyntaxKind.Decorator]: "expression",
[SyntaxKind.BreakStatement]: "label",
[SyntaxKind.ContinueStatement]: "label",
[SyntaxKind.ReturnStatement]: "expression",
[SyntaxKind.CaseBlock]: "clauses",
[SyntaxKind.ThrowStatement]: "expression",
[SyntaxKind.ExpressionStatement]: "expression",
[SyntaxKind.Block]: "statements",
[SyntaxKind.VariableDeclarationList]: "declarations",
[SyntaxKind.ObjectBindingPattern]: "elements",
[SyntaxKind.ArrayBindingPattern]: "elements",
[SyntaxKind.MissingDeclaration]: "modifiers",
[SyntaxKind.HeritageClause]: "types",
[SyntaxKind.ModuleBlock]: "statements",
[SyntaxKind.ExternalModuleReference]: "expression",
[SyntaxKind.NamespaceImport]: "name",
[SyntaxKind.NamedImports]: "elements",
[SyntaxKind.NamespaceExport]: "name",
[SyntaxKind.NamedExports]: "elements",
[SyntaxKind.PrefixUnaryExpression]: "operand",
[SyntaxKind.PostfixUnaryExpression]: "operand",
[SyntaxKind.MetaProperty]: "name",
[SyntaxKind.NonNullExpression]: "expression",
[SyntaxKind.SpreadElement]: "expression",
[SyntaxKind.ParenthesizedExpression]: "expression",
[SyntaxKind.ArrayLiteralExpression]: "elements",
[SyntaxKind.ObjectLiteralExpression]: "properties",
[SyntaxKind.SpreadAssignment]: "expression",
[SyntaxKind.DeleteExpression]: "expression",
[SyntaxKind.TypeOfExpression]: "expression",
[SyntaxKind.VoidExpression]: "expression",
[SyntaxKind.AwaitExpression]: "expression",
[SyntaxKind.UnionType]: "types",
[SyntaxKind.IntersectionType]: "types",
[SyntaxKind.TypeOperator]: "type",
[SyntaxKind.InferType]: "typeParameter",
[SyntaxKind.ArrayType]: "elementType",
[SyntaxKind.LiteralType]: "literal",
[SyntaxKind.ImportAttributes]: "attributes",
[SyntaxKind.TypeLiteral]: "members",
[SyntaxKind.TupleType]: "elements",
[SyntaxKind.OptionalType]: "type",
[SyntaxKind.RestType]: "type",
[SyntaxKind.ParenthesizedType]: "type",
[SyntaxKind.SyntheticExpression]: "tupleNameSource",
[SyntaxKind.PartiallyEmittedExpression]: "expression",
[SyntaxKind.JsxAttributes]: "properties",
[SyntaxKind.JsxSpreadAttribute]: "expression",
[SyntaxKind.JsxClosingElement]: "tagName",
[SyntaxKind.SyntaxList]: "children",
[SyntaxKind.JSDocTypeExpression]: "type",
[SyntaxKind.JSDocNonNullableType]: "type",
[SyntaxKind.JSDocNullableType]: "type",
[SyntaxKind.JSDocVariadicType]: "type",
[SyntaxKind.JSDocOptionalType]: "type",
[SyntaxKind.JSDocNameReference]: "name",
[SyntaxKind.JSDocLink]: "name",
[SyntaxKind.JSDocLinkPlain]: "name",
[SyntaxKind.JSDocLinkCode]: "name",
[SyntaxKind.JSDocTypeLiteral]: "jsdocPropertyTags",
};
//# sourceMappingURL=protocol.generated.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"protocol.generated.js","sourceRoot":"","sources":["../../../src/api/node/protocol.generated.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E,CAAC,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC;IACtI,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC;IAC5F,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC;IAC9F,CAAC,UAAU,CAAC,2BAA2B,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;IAC/D,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC;IACtF,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC,SAAS,CAAC;IAC/C,CAAC,UAAU,CAAC,sBAAsB,CAAC,EAAE,CAAC,SAAS,CAAC;IAChD,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC;IAC7D,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,CAAC;IACnH,CAAC,UAAU,CAAC,kBAAkB,Line truncated
+30
View File
@@ -0,0 +1,30 @@
export const PROTOCOL_VERSION = 5;
export const HEADER_OFFSET_METADATA = 0;
export const HEADER_OFFSET_HASH_LO0 = 4;
export const HEADER_OFFSET_HASH_LO1 = 8;
export const HEADER_OFFSET_HASH_HI0 = 12;
export const HEADER_OFFSET_HASH_HI1 = 16;
export const HEADER_OFFSET_PARSE_OPTIONS = 20;
export const HEADER_OFFSET_STRING_TABLE_OFFSETS = 24;
export const HEADER_OFFSET_STRING_TABLE = 28;
export const HEADER_OFFSET_EXTENDED_DATA = 32;
export const HEADER_OFFSET_STRUCTURED_DATA = 36;
export const HEADER_OFFSET_NODES = 40;
export const HEADER_SIZE = 44;
export const NODE_LEN = 28;
export const NODE_OFFSET_KIND = 0;
export const NODE_OFFSET_POS = 4;
export const NODE_OFFSET_END = 8;
export const NODE_OFFSET_NEXT = 12;
export const NODE_OFFSET_PARENT = 16;
export const NODE_OFFSET_DATA = 20;
export const NODE_OFFSET_FLAGS = 24;
export const KIND_NODE_LIST = 0xFFFFFFFF;
export const NODE_DATA_TYPE_CHILDREN = 0x00000000;
export const NODE_DATA_TYPE_STRING = 0x40000000;
export const NODE_DATA_TYPE_EXTENDED = 0x80000000;
export const NODE_STRING_INDEX_MASK = 0x00FFFFFF;
export const NODE_EXTENDED_DATA_MASK = 0x00FFFFFF;
// Re-export generated child properties
export { childProperties, singleChildNodePropertyNames } from "./protocol.generated.js";
//# sourceMappingURL=protocol.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/api/node/protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AACrD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAE3B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAElD,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC"}
+6
View File
@@ -0,0 +1,6 @@
type DecodeOptions = Parameters<TextDecoder["decode"]>[1];
export declare class Wtf8Decoder extends TextDecoder {
decode(input?: NodeJS.AllowSharedBufferSource, options?: DecodeOptions): string;
}
export {};
//# sourceMappingURL=wtf8.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"wtf8.d.ts","sourceRoot":"","sources":["../../../src/api/node/wtf8.ts"],"names":[],"mappings":"AAOA,KAAK,aAAa,GAAG,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AA6B1D,qBAAa,WAAY,SAAQ,WAAW;IAC/B,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,uBAAuB,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM;CAkC3F"}
+61
View File
@@ -0,0 +1,61 @@
import { Buffer } from "node:buffer";
const surrogateLeadByte = 0xED;
const surrogateSecondByteMin = 0xA0;
const surrogateSecondByteMax = 0xBF;
const continuationByteMin = 0x80;
const continuationByteMax = 0xBF;
function isWtf8Surrogate(bytes, index) {
return index + 2 < bytes.length
&& bytes[index] === surrogateLeadByte
&& bytes[index + 1] >= surrogateSecondByteMin
&& bytes[index + 1] <= surrogateSecondByteMax
&& bytes[index + 2] >= continuationByteMin
&& bytes[index + 2] <= continuationByteMax;
}
function getSurrogateCodeUnit(bytes, index) {
return 0xD000 | ((bytes[index + 1] & 0x3F) << 6) | (bytes[index + 2] & 0x3F);
}
function hasSurrogateLeadByte(bytes) {
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).indexOf(surrogateLeadByte) >= 0;
}
function toUint8Array(input) {
if (input instanceof Uint8Array) {
return input;
}
if (ArrayBuffer.isView(input)) {
return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
}
return new Uint8Array(input);
}
export class Wtf8Decoder extends TextDecoder {
decode(input, options) {
if (input === undefined) {
return super.decode(input, options);
}
const bytes = toUint8Array(input);
if (!hasSurrogateLeadByte(bytes)) {
return super.decode(bytes, options);
}
const parts = [];
let segmentStart = 0;
for (let i = 0; i < bytes.length; i++) {
if (!isWtf8Surrogate(bytes, i)) {
continue;
}
if (segmentStart < i) {
parts.push(super.decode(bytes.subarray(segmentStart, i), options));
}
parts.push(String.fromCharCode(getSurrogateCodeUnit(bytes, i)));
i += 2;
segmentStart = i + 1;
}
if (segmentStart === 0) {
return super.decode(bytes, options);
}
if (segmentStart < bytes.length) {
parts.push(super.decode(bytes.subarray(segmentStart), options));
}
return parts.join("");
}
}
//# sourceMappingURL=wtf8.js.map
+1
View File
@@ -0,0 +1 @@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CAAC,CAAC;YACP,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QAED,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,YAAY,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;CACJ"}
+32
View File
@@ -0,0 +1,32 @@
/**
* Shared utilities for the TypeScript API client.
*/
import type { FileSystem } from "./fs.ts";
export interface ClientSocketOptions {
/** Path to the Unix domain socket or Windows named pipe for API communication */
pipe: string;
}
export interface ClientSpawnOptions {
/** Path to the tsgo executable. Defaults to the bundled tsgo binary. */
tsserverPath?: string;
/** Current working directory */
cwd?: string;
/** Virtual filesystem callbacks */
fs?: FileSystem;
/**
* When true, collect timing information for each request. The client
* measures round-trip latency and bytes sent/received, and the server
* measures its own per-request processing time; both are combined (along
* with an estimated transport overhead) in the snapshot returned by
* {@link API.getTimingInfo}.
*/
collectTiming?: boolean;
}
export type ClientOptions = ClientSocketOptions | ClientSpawnOptions;
export declare function isSpawnOptions(options: ClientOptions): options is ClientSpawnOptions;
export declare function resolveExePath(options: ClientSpawnOptions): string;
export interface LSPConnectionOptions extends ClientSocketOptions {
}
export interface APIOptions extends ClientSpawnOptions {
}
//# sourceMappingURL=options.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/api/options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAChC,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAErE,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,IAAI,kBAAkB,CAEpF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAElE;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;CAChE;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;CACrD"}
+11
View File
@@ -0,0 +1,11 @@
/**
* Shared utilities for the TypeScript API client.
*/
import getExePath from "#getExePath";
export function isSpawnOptions(options) {
return !("pipe" in options);
}
export function resolveExePath(options) {
return options.tsserverPath ?? getExePath();
}
//# sourceMappingURL=options.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/api/options.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,UAAU,MAAM,aAAa,CAAC;AA2BrC,MAAM,UAAU,cAAc,CAAC,OAAsB;IACjD,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAA2B;IACtD,OAAO,OAAO,CAAC,YAAY,IAAI,UAAU,EAAE,CAAC;AAChD,CAAC"}
+110
View File
@@ -0,0 +1,110 @@
/**
* Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
*
* For example:
* ```ts
* getRootLength("a") === 0 // ""
* getRootLength("/") === 1 // "/"
* getRootLength("c:") === 2 // "c:"
* getRootLength("c:d") === 0 // ""
* getRootLength("c:/") === 3 // "c:/"
* getRootLength("c:\\") === 3 // "c:\\"
* getRootLength("//server") === 7 // "//server"
* getRootLength("//server/share") === 8 // "//server/"
* getRootLength("\\\\server") === 7 // "\\\\server"
* getRootLength("\\\\server\\share") === 8 // "\\\\server\\"
* getRootLength("file:///path") === 8 // "file:///"
* getRootLength("file:///c:") === 10 // "file:///c:"
* getRootLength("file:///c:d") === 8 // "file:///"
* getRootLength("file:///c:/path") === 11 // "file:///c:/"
* getRootLength("file://server") === 13 // "file://server"
* getRootLength("file://server/path") === 14 // "file://server/"
* getRootLength("http://server") === 13 // "http://server"
* getRootLength("http://server/path") === 14 // "http://server/"
* ```
*
* @internal
*/
export declare function getRootLength(path: string): number;
export declare function getPathComponents(path: string): string[];
/**
* Determines whether a path has a trailing separator (`/` or `\\`).
*/
export declare function hasTrailingDirectorySeparator(path: string): boolean;
/**
* Removes a trailing directory separator from a path, if it does not already have one.
*/
export declare function removeTrailingDirectorySeparator(path: string): string;
/**
* Adds a trailing directory separator to a path, if it does not already have one.
*/
export declare function ensureTrailingDirectorySeparator(path: string): string;
/**
* Normalize path separators, converting `\\` into `/`.
*/
export declare function normalizeSlashes(path: string): string;
/**
* Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified.
*/
export declare function combinePaths(path: string, ...paths: (string | undefined)[]): string;
/**
* Returns the normalized absolute path, resolving `.` and `..` segments.
*/
export declare function getNormalizedAbsolutePath(path: string, currentDirectory: string | undefined): string;
/**
* Normalizes a path, resolving `.` and `..` segments and converting backslashes to forward slashes.
*/
export declare function normalizePath(path: string): string;
/**
* Determines whether a path is an absolute disk path (e.g. starts with `/`, or a DOS path
* like `c:`, `c:\\` or `c:/`).
*/
export declare function isRootedDiskPath(path: string): boolean;
/**
* Converts a file name to a normalized path.
*
* @param fileName The file name to convert
* @param basePath The base path to use for relative file names
* @param getCanonicalFileName A function to get the canonical file name (e.g., toLowerCase for case-insensitive systems)
* @returns The normalized path
*/
export declare function toPath(fileName: string, basePath: string | undefined, getCanonicalFileName: (path: string) => string): string;
/**
* Creates a getCanonicalFileName function based on case sensitivity.
*/
export declare function createGetCanonicalFileName(useCaseSensitiveFileNames: boolean): (fileName: string) => string;
/**
* Returns true if the path refers to a bundled library file.
*/
export declare function isBundled(path: string): boolean;
/**
* Returns true if the file name represents a dynamic/virtual file
* that doesn't exist on disk (e.g., untitled files with paths like "^/untitled/...").
*/
export declare function isDynamicFileName(fileName: string): boolean;
/**
* Splits a Windows volume (e.g., "c:") from the rest of the path.
* Returns [volume, rest, ok] where ok is true if a volume was found.
*/
export declare function splitVolumePath(path: string): [volume: string, rest: string, ok: boolean];
/**
* Converts a file name to a document URI.
*
* @example
* fileNameToDocumentURI("/path/to/file.ts") === "file:///path/to/file.ts"
* fileNameToDocumentURI("c:/path/to/file.ts") === "file:///c%3A/path/to/file.ts"
* fileNameToDocumentURI("^/untitled/ts-nul-authority/Untitled-1") === "untitled:Untitled-1"
* fileNameToDocumentURI("^/vscode-vfs/github/microsoft/typescript-go/file.ts") === "vscode-vfs://github/microsoft/typescript-go/file.ts"
*/
export declare function fileNameToDocumentURI(fileName: string): string;
/**
* Converts a document URI to a file name.
*
* @example
* documentURIToFileName("file:///path/to/file.ts") === "/path/to/file.ts"
* documentURIToFileName("file:///c%3A/path/to/file.ts") === "c:/path/to/file.ts"
* documentURIToFileName("untitled:Untitled-1") === "^/untitled/ts-nul-authority/Untitled-1"
* documentURIToFileName("vscode-vfs://github/microsoft/typescript-go/file.ts") === "^/vscode-vfs/github/microsoft/typescript-go/file.ts"
*/
export declare function documentURIToFileName(uri: string): string;
//# sourceMappingURL=path.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/api/path.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM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G,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAKzF;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA8C9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAuDzD"}
+508
View File
@@ -0,0 +1,508 @@
const CharacterCodesSlash = "/".charCodeAt(0);
const CharacterCodesBackslash = "\\".charCodeAt(0);
const CharacterCodesColon = ":".charCodeAt(0);
const CharacterCodesPercent = "%".charCodeAt(0);
const CharacterCodes3 = "3".charCodeAt(0);
const CharacterCodesa = "a".charCodeAt(0);
const CharacterCodesz = "z".charCodeAt(0);
const CharacterCodesA = "A".charCodeAt(0);
const CharacterCodesZ = "Z".charCodeAt(0);
const CharacterCodesDot = ".".charCodeAt(0);
const directorySeparator = "/";
const altDirectorySeparator = "\\";
const urlSchemeSeparator = "://";
const backslashRegExp = /\\/g;
// check path for these segments: '', '.'. '..'
const relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
/**
* Determines whether a charCode corresponds to `/` or `\\`.
*/
function isAnyDirectorySeparator(charCode) {
return charCode === CharacterCodesSlash || charCode === CharacterCodesBackslash;
}
function isVolumeCharacter(charCode) {
return (charCode >= CharacterCodesa && charCode <= CharacterCodesz) ||
(charCode >= CharacterCodesA && charCode <= CharacterCodesZ);
}
function getFileUrlVolumeSeparatorEnd(url, start) {
const ch0 = url.charCodeAt(start);
if (ch0 === CharacterCodesColon)
return start + 1;
if (ch0 === CharacterCodesPercent && url.charCodeAt(start + 1) === CharacterCodes3) {
const ch2 = url.charCodeAt(start + 2);
if (ch2 === CharacterCodesa || ch2 === CharacterCodesA)
return start + 3;
}
return -1;
}
/**
* Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
*
* For example:
* ```ts
* getRootLength("a") === 0 // ""
* getRootLength("/") === 1 // "/"
* getRootLength("c:") === 2 // "c:"
* getRootLength("c:d") === 0 // ""
* getRootLength("c:/") === 3 // "c:/"
* getRootLength("c:\\") === 3 // "c:\\"
* getRootLength("//server") === 7 // "//server"
* getRootLength("//server/share") === 8 // "//server/"
* getRootLength("\\\\server") === 7 // "\\\\server"
* getRootLength("\\\\server\\share") === 8 // "\\\\server\\"
* getRootLength("file:///path") === 8 // "file:///"
* getRootLength("file:///c:") === 10 // "file:///c:"
* getRootLength("file:///c:d") === 8 // "file:///"
* getRootLength("file:///c:/path") === 11 // "file:///c:/"
* getRootLength("file://server") === 13 // "file://server"
* getRootLength("file://server/path") === 14 // "file://server/"
* getRootLength("http://server") === 13 // "http://server"
* getRootLength("http://server/path") === 14 // "http://server/"
* ```
*
* @internal
*/
export function getRootLength(path) {
const rootLength = getEncodedRootLength(path);
return rootLength < 0 ? ~rootLength : rootLength;
}
/**
* Returns length of the root part of a path or URL (i.e. length of "/", "x:/", "//server/share/, file:///user/files").
* If the root is part of a URL, the twos-complement of the root length is returned.
*/
function getEncodedRootLength(path) {
if (!path)
return 0;
const ch0 = path.charCodeAt(0);
// POSIX or UNC
if (ch0 === CharacterCodesSlash || ch0 === CharacterCodesBackslash) {
if (path.charCodeAt(1) !== ch0)
return 1; // POSIX: "/" (or non-normalized "\")
const p1 = path.indexOf(ch0 === CharacterCodesSlash ? directorySeparator : altDirectorySeparator, 2);
if (p1 < 0)
return path.length; // UNC: "//server" or "\\server"
return p1 + 1; // UNC: "//server/" or "\\server\"
}
// DOS
if (isVolumeCharacter(ch0) && path.charCodeAt(1) === CharacterCodesColon) {
const ch2 = path.charCodeAt(2);
if (ch2 === CharacterCodesSlash || ch2 === CharacterCodesBackslash)
return 3; // DOS: "c:/" or "c:\"
if (path.length === 2)
return 2; // DOS: "c:" (but not "c:d")
}
// URL
const schemeEnd = path.indexOf(urlSchemeSeparator);
if (schemeEnd !== -1) {
const authorityStart = schemeEnd + urlSchemeSeparator.length;
const authorityEnd = path.indexOf(directorySeparator, authorityStart);
if (authorityEnd !== -1) { // URL: "file:///", "file://server/", "file://server/path"
// For local "file" URLs, include the leading DOS volume (if present).
// Per https://www.ietf.org/rfc/rfc1738.txt, a host of "" or "localhost" is a
// special case interpreted as "the machine from which the URL is being interpreted".
const scheme = path.slice(0, schemeEnd);
const authority = path.slice(authorityStart, authorityEnd);
if (scheme === "file" && (authority === "" || authority === "localhost") &&
isVolumeCharacter(path.charCodeAt(authorityEnd + 1))) {
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path, authorityEnd + 2);
if (volumeSeparatorEnd !== -1) {
if (path.charCodeAt(volumeSeparatorEnd) === CharacterCodesSlash) {
// URL: "file:///c:/", "file://localhost/c:/", "file:///c%3a/", "file://localhost/c%3a/"
return ~(volumeSeparatorEnd + 1);
}
if (volumeSeparatorEnd === path.length) {
// URL: "file:///c:", "file://localhost/c:", "file:///c$3a", "file://localhost/c%3a"
// but not "file:///c:d" or "file:///c%3ad"
return ~volumeSeparatorEnd;
}
}
}
return ~(authorityEnd + 1); // URL: "file://server/", "http://server/"
}
return ~path.length; // URL: "file://server", "http://server"
}
// relative
return 0;
}
export function getPathComponents(path) {
return pathComponents(path, getRootLength(path));
}
function pathComponents(path, rootLength) {
const root = path.substring(0, rootLength);
const rest = path.substring(rootLength).split("/");
if (rest.length && !lastOrUndefined(rest))
rest.pop();
return [root, ...rest];
}
function lastOrUndefined(array) {
return array.length ? array[array.length - 1] : undefined;
}
/**
* Determines whether a path has a trailing separator (`/` or `\\`).
*/
export function hasTrailingDirectorySeparator(path) {
return path.length > 0 && isAnyDirectorySeparator(path.charCodeAt(path.length - 1));
}
/**
* Removes a trailing directory separator from a path, if it does not already have one.
*/
export function removeTrailingDirectorySeparator(path) {
if (hasTrailingDirectorySeparator(path)) {
return path.substr(0, path.length - 1);
}
return path;
}
/**
* Adds a trailing directory separator to a path, if it does not already have one.
*/
export function ensureTrailingDirectorySeparator(path) {
if (!hasTrailingDirectorySeparator(path)) {
return path + directorySeparator;
}
return path;
}
/**
* Normalize path separators, converting `\\` into `/`.
*/
export function normalizeSlashes(path) {
return path.includes("\\")
? path.replace(backslashRegExp, directorySeparator)
: path;
}
/**
* Combines paths. If a path is absolute, it replaces any previous path. Relative paths are not simplified.
*/
export function combinePaths(path, ...paths) {
if (path)
path = normalizeSlashes(path);
for (let relativePath of paths) {
if (!relativePath)
continue;
relativePath = normalizeSlashes(relativePath);
if (!path || getRootLength(relativePath) !== 0) {
path = relativePath;
}
else {
path = ensureTrailingDirectorySeparator(path) + relativePath;
}
}
return path;
}
function simpleNormalizePath(path) {
// Most paths don't require normalization
if (!relativePathSegmentRegExp.test(path)) {
return path;
}
// Some paths only require cleanup of `/./` or leading `./`
let simplified = path.replace(/\/\.\//g, "/");
if (simplified.startsWith("./")) {
simplified = simplified.slice(2);
}
if (simplified !== path) {
path = simplified;
if (!relativePathSegmentRegExp.test(path)) {
return path;
}
}
return undefined;
}
/**
* Returns the normalized absolute path, resolving `.` and `..` segments.
*/
export function getNormalizedAbsolutePath(path, currentDirectory) {
let rootLength = getRootLength(path);
if (rootLength === 0 && currentDirectory) {
path = combinePaths(currentDirectory, path);
rootLength = getRootLength(path);
}
else {
// combinePaths normalizes slashes, so not necessary in the other branch
path = normalizeSlashes(path);
}
const simpleNormalized = simpleNormalizePath(path);
if (simpleNormalized !== undefined) {
return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
}
const length = path.length;
const root = path.substring(0, rootLength);
// `normalized` is only initialized once `path` is determined to be non-normalized
let normalized;
let index = rootLength;
let segmentStart = index;
let normalizedUpTo = index;
let seenNonDotDotSegment = rootLength !== 0;
while (index < length) {
// At beginning of segment
segmentStart = index;
let ch = path.charCodeAt(index);
while (ch === CharacterCodesSlash && index + 1 < length) {
index++;
ch = path.charCodeAt(index);
}
if (index > segmentStart) {
// Seen superfluous separator
normalized ??= path.substring(0, segmentStart - 1);
segmentStart = index;
}
// Past any superfluous separators
let segmentEnd = path.indexOf(directorySeparator, index + 1);
if (segmentEnd === -1) {
segmentEnd = length;
}
const segmentLength = segmentEnd - segmentStart;
if (segmentLength === 1 && path.charCodeAt(index) === CharacterCodesDot) {
// "." segment (skip)
normalized ??= path.substring(0, normalizedUpTo);
}
else if (segmentLength === 2 && path.charCodeAt(index) === CharacterCodesDot && path.charCodeAt(index + 1) === CharacterCodesDot) {
// ".." segment
if (!seenNonDotDotSegment) {
if (normalized !== undefined) {
normalized += normalized.length === rootLength ? ".." : "/..";
}
else {
normalizedUpTo = index + 2;
}
}
else if (normalized === undefined) {
if (normalizedUpTo - 2 >= 0) {
normalized = path.substring(0, Math.max(rootLength, path.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
}
else {
normalized = path.substring(0, normalizedUpTo);
}
}
else {
const lastSlash = normalized.lastIndexOf(directorySeparator);
if (lastSlash !== -1) {
normalized = normalized.substring(0, Math.max(rootLength, lastSlash));
}
else {
normalized = root;
}
if (normalized.length === rootLength) {
seenNonDotDotSegment = rootLength !== 0;
}
}
}
else if (normalized !== undefined) {
if (normalized.length !== rootLength) {
normalized += directorySeparator;
}
seenNonDotDotSegment = true;
normalized += path.substring(segmentStart, segmentEnd);
}
else {
seenNonDotDotSegment = true;
normalizedUpTo = segmentEnd;
}
index = segmentEnd + 1;
}
return normalized ?? (length > rootLength ? removeTrailingDirectorySeparator(path) : path);
}
/**
* Normalizes a path, resolving `.` and `..` segments and converting backslashes to forward slashes.
*/
export function normalizePath(path) {
path = normalizeSlashes(path);
let normalized = simpleNormalizePath(path);
if (normalized !== undefined) {
return normalized;
}
normalized = getNormalizedAbsolutePath(path, "");
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
}
/**
* Determines whether a path is an absolute disk path (e.g. starts with `/`, or a DOS path
* like `c:`, `c:\\` or `c:/`).
*/
export function isRootedDiskPath(path) {
return getEncodedRootLength(path) > 0;
}
/**
* Converts a file name to a normalized path.
*
* @param fileName The file name to convert
* @param basePath The base path to use for relative file names
* @param getCanonicalFileName A function to get the canonical file name (e.g., toLowerCase for case-insensitive systems)
* @returns The normalized path
*/
export function toPath(fileName, basePath, getCanonicalFileName) {
const nonCanonicalizedPath = isRootedDiskPath(fileName)
? normalizePath(fileName)
: getNormalizedAbsolutePath(fileName, basePath);
return getCanonicalFileName(nonCanonicalizedPath);
}
/**
* Creates a getCanonicalFileName function based on case sensitivity.
*/
export function createGetCanonicalFileName(useCaseSensitiveFileNames) {
return useCaseSensitiveFileNames ? identity : toLowerCase;
}
function identity(x) {
return x;
}
function toLowerCase(s) {
return s.toLowerCase();
}
const bundledScheme = "bundled:///";
/**
* Returns true if the path refers to a bundled library file.
*/
export function isBundled(path) {
return path.startsWith(bundledScheme);
}
/**
* Returns true if the file name represents a dynamic/virtual file
* that doesn't exist on disk (e.g., untitled files with paths like "^/untitled/...").
*/
export function isDynamicFileName(fileName) {
return fileName.startsWith("^/");
}
/**
* Splits a Windows volume (e.g., "c:") from the rest of the path.
* Returns [volume, rest, ok] where ok is true if a volume was found.
*/
export function splitVolumePath(path) {
if (path.length >= 2 && isVolumeCharacter(path.charCodeAt(0)) && path.charCodeAt(1) === CharacterCodesColon) {
return [path.substring(0, 2).toLowerCase(), path.substring(2), true];
}
return ["", path, false];
}
// Characters that need extra escaping in URI path segments
// https://github.com/microsoft/vscode-uri/blob/edfdccd976efaf4bb8fdeca87e97c47257721729/src/uri.ts#L455
const extraEscapeChars = {
":": "%3A",
"/": "%2F",
"?": "%3F",
"#": "%23",
"[": "%5B",
"]": "%5D",
"@": "%40",
"!": "%21",
"$": "%24",
"&": "%26",
"'": "%27",
"(": "%28",
")": "%29",
"*": "%2A",
"+": "%2B",
",": "%2C",
";": "%3B",
"=": "%3D",
" ": "%20",
};
function extraEscape(s) {
let result = s;
for (const [char, escape] of Object.entries(extraEscapeChars)) {
result = result.replaceAll(char, escape);
}
return result;
}
/**
* Converts a file name to a document URI.
*
* @example
* fileNameToDocumentURI("/path/to/file.ts") === "file:///path/to/file.ts"
* fileNameToDocumentURI("c:/path/to/file.ts") === "file:///c%3A/path/to/file.ts"
* fileNameToDocumentURI("^/untitled/ts-nul-authority/Untitled-1") === "untitled:Untitled-1"
* fileNameToDocumentURI("^/vscode-vfs/github/microsoft/typescript-go/file.ts") === "vscode-vfs://github/microsoft/typescript-go/file.ts"
*/
export function fileNameToDocumentURI(fileName) {
// Bundled files are returned as-is
if (isBundled(fileName)) {
return fileName;
}
// Dynamic/virtual files (untitled, vscode-vfs, etc.) need special handling
if (isDynamicFileName(fileName)) {
// Format: ^/scheme/authority/path
const withoutPrefix = fileName.substring(2); // Remove "^/"
const firstSlash = withoutPrefix.indexOf("/");
if (firstSlash === -1) {
throw new Error("invalid file name: " + fileName);
}
const scheme = withoutPrefix.substring(0, firstSlash);
const rest = withoutPrefix.substring(firstSlash + 1);
const secondSlash = rest.indexOf("/");
if (secondSlash === -1) {
throw new Error("invalid file name: " + fileName);
}
const authority = rest.substring(0, secondSlash);
const path = rest.substring(secondSlash + 1);
// ts-nul-authority is a placeholder for URIs without an authority
if (authority === "ts-nul-authority") {
return scheme + ":" + path;
}
return scheme + "://" + authority + "/" + path;
}
// Regular file path - convert to file:// URI
let [volume, rest] = splitVolumePath(fileName);
if (volume !== "") {
volume = "/" + extraEscape(volume);
}
// Remove leading // for UNC paths (already handled by file://)
if (rest.startsWith("//")) {
rest = rest.substring(2);
}
const parts = rest.split("/");
const encodedParts = parts.map(part => extraEscape(encodeURIComponent(part)));
return "file://" + volume + encodedParts.join("/");
}
/**
* Converts a document URI to a file name.
*
* @example
* documentURIToFileName("file:///path/to/file.ts") === "/path/to/file.ts"
* documentURIToFileName("file:///c%3A/path/to/file.ts") === "c:/path/to/file.ts"
* documentURIToFileName("untitled:Untitled-1") === "^/untitled/ts-nul-authority/Untitled-1"
* documentURIToFileName("vscode-vfs://github/microsoft/typescript-go/file.ts") === "^/vscode-vfs/github/microsoft/typescript-go/file.ts"
*/
export function documentURIToFileName(uri) {
// Bundled files are returned as-is
if (isBundled(uri)) {
return uri;
}
// Handle file:// URIs
if (uri.startsWith("file://")) {
let parsed;
try {
parsed = new URL(uri);
}
catch {
throw new Error("invalid file URI: " + uri);
}
// UNC path: file://server/share/...
if (parsed.host !== "") {
return "//" + parsed.host + parsed.pathname;
}
// Local file - fix Windows path by removing leading slash before volume
const path = decodeURIComponent(parsed.pathname);
if (path.length >= 3 && path.charCodeAt(0) === CharacterCodesSlash) {
const [volume, rest, ok] = splitVolumePath(path.substring(1));
if (ok) {
return volume + rest;
}
}
return path;
}
// Leave all other URIs escaped so we can round-trip them.
// Convert to dynamic file name format: ^/scheme/authority/path
const colonIndex = uri.indexOf(":");
if (colonIndex === -1) {
throw new Error("invalid URI: " + uri);
}
const scheme = uri.substring(0, colonIndex);
let path = uri.substring(colonIndex + 1);
let authority = "ts-nul-authority";
if (path.startsWith("//")) {
const rest = path.substring(2);
const slashIndex = rest.indexOf("/");
if (slashIndex === -1) {
throw new Error("invalid URI: " + uri);
}
authority = rest.substring(0, slashIndex);
path = rest.substring(slashIndex + 1);
}
return "^/" + scheme + "/" + authority + "/" + path;
}
//# sourceMappingURL=path.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/api/path.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC9C,MAAM,uBAAuB,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AACnD,MAAM,mBAAmB,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC9C,MAAM,qBAAqB,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAChD,MAAM,eAAe,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CA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6BAA6B,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAAC,IAAY;IACzD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO,IAAI,GAAG,kBAAkB,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,kBAAkBLine truncated
+239
View File
@@ -0,0 +1,239 @@
import type { CompletionItemKind } from "#enums/completionItemKind";
import type { ModuleKind } from "#enums/moduleKind";
import type { __String, Path } from "../ast/index.ts";
import type { CompilerOptions } from "./compilerOptions.ts";
export type { CompilerOptions } from "./compilerOptions.ts";
/**
* A document identifier that can be either a file name (path string) or a document URI object.
*
* @example
* // Using a file name
* project.program.getSourceFile("/path/to/file.ts");
*
* // Using a URI
* project.program.getSourceFile({ uri: "file:///path/to/file.ts" });
*/
export type DocumentIdentifier = string | {
uri: string;
};
/**
* A position within a document, combining a document identifier with an offset.
*/
export interface DocumentPosition {
/** The document containing the position */
document: DocumentIdentifier;
/** The character offset within the document */
position: number;
}
/**
* Resolves a DocumentIdentifier to a file name.
* If the identifier contains a URI, it is converted to a file name.
*/
export declare function resolveFileName(identifier: DocumentIdentifier): string;
/**
* Resolves a DocumentIdentifier to a document URI.
* If the identifier contains a file name, it is converted to a URI.
*/
export declare function resolveDocumentURI(identifier: DocumentIdentifier): string;
/**
* Response from the initialize method.
*/
export interface InitializeResponse {
/** Whether the host file system is case-sensitive */
useCaseSensitiveFileNames: boolean;
/** The server's current working directory */
currentDirectory: string;
}
export interface ConfigResponse {
options: Record<string, unknown>;
fileNames: string[];
}
export interface LSPUpdateSnapshotParams {
/**
* @deprecated Use {@link openProjects} instead.
* Path to a tsconfig.json file to open in the new snapshot.
*/
openProject?: string;
/**
* tsconfig.json files to open/load in the new snapshot. Opens are ref-counted
* and persist across snapshots until closed via {@link closeProjects}.
*/
openProjects?: DocumentIdentifier[];
/**
* tsconfig.json files to release in the new snapshot. A project is only unloaded
* once every API client that opened it closes it.
*/
closeProjects?: DocumentIdentifier[];
/**
* Files to keep open for the API client, mirroring LSP's `textDocument/didOpen`.
* For each file, ancestor directories are searched for a tsconfig that contains it;
* if one is found, that configured project is loaded and becomes the file's default
* project. Otherwise the file is loaded into the inferred project (e.g. a d.ts in
* node_modules that is not part of any project's import graph). Opens persist across
* subsequent snapshots until the file is closed via {@link closeFiles}.
* After calling updateSnapshot with openFiles, getDefaultProjectForFile returns the
* resolved configured or inferred project.
*/
openFiles?: DocumentIdentifier[];
/**
* Files to release in the new snapshot. A file is only fully closed once every
* API client that opened it closes it.
*/
closeFiles?: DocumentIdentifier[];
}
export interface FileChangeSummary {
changed?: DocumentIdentifier[];
created?: DocumentIdentifier[];
deleted?: DocumentIdentifier[];
}
export type FileChanges = FileChangeSummary | {
invalidateAll: true;
};
/**
* Parameters for updateSnapshot.
*/
export interface UpdateSnapshotParams extends LSPUpdateSnapshotParams {
fileChanges?: FileChanges;
}
/**
* Builds the wire request for updateSnapshot, applying the deprecated `openProject`
* compatibility shim: a single `openProject` is folded into `openProjects` and is
* never sent on the wire.
*/
export declare function toUpdateSnapshotRequest(params?: UpdateSnapshotParams): UpdateSnapshotParams;
/**
* Changes to source files within a single project.
*/
export interface ProjectFileChanges {
/** Source file paths whose content changed */
changedFiles?: string[];
/** Source file paths removed from the project's program */
deletedFiles?: string[];
}
/**
* Changes between two consecutive snapshots, reported per-project.
*/
export interface SnapshotChanges {
/** Project handles mapped to their file changes. Projects not listed are unchanged. */
changedProjects?: Record<string, ProjectFileChanges>;
/** Project handles that were removed from the snapshot */
removedProjects?: string[];
}
/**
* Response from updateSnapshot.
*/
export interface UpdateSnapshotResponse {
/** Handle for the newly created snapshot */
snapshot: number;
/** List of projects in the snapshot */
projects: ProjectResponse[];
/** Changes from the previous snapshot (absent for the first snapshot) */
changes?: SnapshotChanges;
}
export interface ProjectResponse {
id: Path;
configFileName: string;
compilerOptions: CompilerOptions;
rootFiles: string[];
}
export interface SourceFileResponse {
/** Base64-encoded binary AST data */
data: string;
}
export interface SourceFileMetadata {
isDefaultLibrary: boolean;
isFromExternalLibrary: boolean;
packageJsonType: string;
packageJsonDirectory: string;
impliedNodeFormat: ModuleKind;
}
export interface SymbolResponse {
id: number;
/**
* The project the symbol was first observed in. Used as the default project for
* follow-up lookups that need a project context (e.g. members/exports), since symbols
* are shared snapshot-wide and such lookups can vary by project.
*/
project: Path;
name: __String;
flags: number;
checkFlags: number;
declarations?: string[];
valueDeclaration?: string;
parent?: number;
exportSymbol?: number;
}
export interface TypeResponse {
id: number;
flags: number;
objectFlags?: number;
/** Literal value. BigInt literals are encoded as a decimal string (e.g. "-123") since JSON cannot represent bigint. Absent values are serialized as null. */
value?: string | number | boolean | null;
freshType?: number;
regularType?: number;
target?: number;
typeParameters?: number[];
outerTypeParameters?: number[];
localTypeParameters?: number[];
elementFlags?: number[];
fixedLength?: number;
readonly?: boolean;
objectType?: number;
indexType?: number;
checkType?: number;
extendsType?: number;
baseType?: number;
substConstraint?: number;
texts?: string[];
intrinsicName?: string;
isThisType?: boolean;
aliasTypeArguments?: number[];
aliasSymbol?: number;
symbol?: number;
}
export interface SignatureResponse {
id: number;
flags: number;
declaration?: string;
typeParameters?: number[];
parameters?: number[];
thisParameter?: number;
target?: number;
}
export interface TypePredicateResponse {
kind: number;
parameterIndex: number;
parameterName?: string;
type?: TypeResponse;
}
export interface IndexInfoResponse {
keyType: TypeResponse;
valueType: TypeResponse;
isReadonly?: boolean;
declaration?: string;
}
export interface ProfileParams {
dir: string;
}
export interface ProfileResult {
file: string;
}
export interface CompletionEntryLabelDetailsResponse {
detail?: string;
description?: string;
}
export interface CompletionEntryResponse {
name: string;
kind?: CompletionItemKind;
sortText?: string;
insertText?: string;
filterText?: string;
detail?: string;
labelDetails?: CompletionEntryLabelDetailsResponse;
symbol?: SymbolResponse;
}
export interface CompletionInfoResponse {
isIncomplete: boolean;
entries: CompletionEntryResponse[];
}
//# sourceMappingURL=proto.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"proto.d.ts","sourceRoot":"","sources":["../../src/api/proto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EACR,QAAQ,EACR,IAAI,EACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;CAAE,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,2CAA2C;IAC3C,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAKtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAKzE;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,qDAAqD;IACrD,yBAAyB,EAAE,OAAO,CAAC;IACnC,6CAA6C;IAC7C,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAA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YAAY,CAAC;IACtB,SAAS,EAAE,YAAY,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mCAAmC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,mCAAmC,CAAC;IACnD,MAAM,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,uBAAuB,EAAE,CAAC;CACtC"}
+37
View File
@@ -0,0 +1,37 @@
import { documentURIToFileName, fileNameToDocumentURI, } from "./path.js";
/**
* Resolves a DocumentIdentifier to a file name.
* If the identifier contains a URI, it is converted to a file name.
*/
export function resolveFileName(identifier) {
if (typeof identifier === "string") {
return identifier;
}
return documentURIToFileName(identifier.uri);
}
/**
* Resolves a DocumentIdentifier to a document URI.
* If the identifier contains a file name, it is converted to a URI.
*/
export function resolveDocumentURI(identifier) {
if (typeof identifier === "string") {
return fileNameToDocumentURI(identifier);
}
return identifier.uri;
}
/**
* Builds the wire request for updateSnapshot, applying the deprecated `openProject`
* compatibility shim: a single `openProject` is folded into `openProjects` and is
* never sent on the wire.
*/
export function toUpdateSnapshotRequest(params) {
const { openProject, openProjects, ...rest } = params ?? {};
const mergedOpenProjects = openProject !== undefined
? [resolveFileName(openProject), ...(openProjects ?? [])]
: openProjects;
return {
...rest,
...(mergedOpenProjects !== undefined ? { openProjects: mergedOpenProjects } : {}),
};
}
//# sourceMappingURL=proto.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"proto.js","sourceRoot":"","sources":["../../src/api/proto.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,WAAW,CAAC;AA0BnB;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,UAA8B;IAC1D,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,UAAU,CAAC;IACtB,CAAC;IACD,OAAO,qBAAqB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAA8B;IAC7D,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,UAAU,CAAC,GAAG,CAAC;AAC1B,CAAC;AAkED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAA6B;IACjE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAC5D,MAAM,kBAAkB,GAAG,WAAW,KAAK,SAAS;QAChD,CAAC,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,YAAY,CAAC;IACnB,OAAO;QACH,GAAG,IAAI;QACP,GAAG,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpF,CAAC;AACN,CAAC"}
+79
View File
@@ -0,0 +1,79 @@
import type { Path, SourceFile } from "../ast/index.ts";
import type { SnapshotChanges } from "./proto.ts";
/**
* A cached source file entry, identified by content hash.
*/
export interface CachedSourceFile {
/** The cached source file object */
file: SourceFile;
/** The content hash from the server */
contentHash: string;
/** The parse options key that was used to create this file */
parseOptionsKey: string;
/** Set of (snapshot, project) ref keys that reference this entry */
refs: Set<string>;
}
/**
* Client-side cache for source files keyed by (path, parseOptionsKey, contentHash).
*
* Supports multiple versions of the same file at the same path (e.g., from
* different snapshots with different file contents). Each version is identified
* by its content hash and parse options key.
*
* Entries are ref-counted by (snapshot, project) pairs. When a snapshot is
* disposed, all refs for that snapshot across all projects are released,
* and entries with no remaining references are evicted.
*
* When a new snapshot is created, unchanged cache entries from the previous
* snapshot are retained per-project. Only files within changed or removed
* projects are invalidated.
*/
export declare class SourceFileCache {
/** Map from path to all cached versions of that file */
private cache;
/** Map from snapshotId to (projectId → Set of paths fetched through that project) */
private snapshotProjectPaths;
/**
* Get a cached source file already retained for the given (snapshot, project) pair.
* This does not require a content hash or parse options key — it returns the entry
* if one exists with a matching ref. Used to skip the server request entirely when
* retainForSnapshot has already carried over the ref.
*
* A given (snapshot, project) pair always parses a file the same way, so there is
* at most one matching entry per ref.
*/
getRetained(path: Path, snapshotId: number, projectId: string): SourceFile | undefined;
/**
* Store a source file in the cache and retain it for the given (snapshot, project) pair.
* Returns the cached file — which may be an existing entry if the hash matches.
*/
set(path: Path, file: SourceFile, parseOptionsKey: string, contentHash: string, snapshotId: number, projectId: string): SourceFile;
/**
* Retain cache entries from a previous snapshot for a new snapshot.
* For each project in the previous snapshot:
* - Removed projects: skip (don't retain any refs).
* - Changed projects: retain refs for files not listed in changedFiles/deletedFiles.
* - Unchanged projects: retain all refs.
*/
retainForSnapshot(newSnapshotId: number, previousSnapshotId: number, changes: SnapshotChanges | undefined): void;
/**
* Release all entries retained by the given snapshot across all projects.
* Only visits paths that the snapshot actually referenced.
* Entries with no remaining refs are evicted.
*/
releaseSnapshot(snapshotId: number): void;
private trackPath;
/**
* Clear all entries from the cache.
*/
clear(): void;
/**
* Get the number of unique paths in the cache.
*/
get size(): number;
/**
* Check if a path is in the cache.
*/
has(path: Path): boolean;
}
//# sourceMappingURL=sourceFileCache.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"sourceFileCache.d.ts","sourceRoot":"","sources":["../../src/api/sourceFileCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,IAAI,EACJ,UAAU,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AASlD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,oCAAoC;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,eAAe;IACxB,wDAAwD;IACxD,OAAO,CAAC,KAAK,CAA4C;IACzD,qFAAqF;IACrF,OAAO,CAAC,oBAAoB,CAAkD;IAE9E;;;;;;;;OAQG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAQtF;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU;IAmBlI;;;;;;OAMG;IACH,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI;IAmChH;;;;OAIG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAsBzC,OAAO,CAAC,SAAS;IAcjB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;CAG3B"}
+169
View File
@@ -0,0 +1,169 @@
/**
* Builds a composite ref key from a snapshot ID and project ID.
*/
function refKey(snapshotId, projectId) {
return `${snapshotId}:${projectId}`;
}
/**
* Client-side cache for source files keyed by (path, parseOptionsKey, contentHash).
*
* Supports multiple versions of the same file at the same path (e.g., from
* different snapshots with different file contents). Each version is identified
* by its content hash and parse options key.
*
* Entries are ref-counted by (snapshot, project) pairs. When a snapshot is
* disposed, all refs for that snapshot across all projects are released,
* and entries with no remaining references are evicted.
*
* When a new snapshot is created, unchanged cache entries from the previous
* snapshot are retained per-project. Only files within changed or removed
* projects are invalidated.
*/
export class SourceFileCache {
/** Map from path to all cached versions of that file */
cache = new Map();
/** Map from snapshotId to (projectId → Set of paths fetched through that project) */
snapshotProjectPaths = new Map();
/**
* Get a cached source file already retained for the given (snapshot, project) pair.
* This does not require a content hash or parse options key — it returns the entry
* if one exists with a matching ref. Used to skip the server request entirely when
* retainForSnapshot has already carried over the ref.
*
* A given (snapshot, project) pair always parses a file the same way, so there is
* at most one matching entry per ref.
*/
getRetained(path, snapshotId, projectId) {
const entries = this.cache.get(path);
if (!entries)
return undefined;
const key = refKey(snapshotId, projectId);
const entry = entries.find(e => e.refs.has(key));
return entry?.file;
}
/**
* Store a source file in the cache and retain it for the given (snapshot, project) pair.
* Returns the cached file — which may be an existing entry if the hash matches.
*/
set(path, file, parseOptionsKey, contentHash, snapshotId, projectId) {
let entries = this.cache.get(path);
if (!entries) {
entries = [];
this.cache.set(path, entries);
}
const ref = refKey(snapshotId, projectId);
// Check if we already have this exact version
const existing = entries.find(e => e.parseOptionsKey === parseOptionsKey && e.contentHash === contentHash);
if (existing) {
existing.refs.add(ref);
this.trackPath(snapshotId, projectId, path);
return existing.file;
}
entries.push({ file, contentHash, parseOptionsKey, refs: new Set([ref]) });
this.trackPath(snapshotId, projectId, path);
return file;
}
/**
* Retain cache entries from a previous snapshot for a new snapshot.
* For each project in the previous snapshot:
* - Removed projects: skip (don't retain any refs).
* - Changed projects: retain refs for files not listed in changedFiles/deletedFiles.
* - Unchanged projects: retain all refs.
*/
retainForSnapshot(newSnapshotId, previousSnapshotId, changes) {
const prevProjectMap = this.snapshotProjectPaths.get(previousSnapshotId);
if (!prevProjectMap)
return;
const removedProjects = new Set(changes?.removedProjects ?? []);
const changedProjects = changes?.changedProjects ?? {};
for (const [projectId, paths] of prevProjectMap) {
if (removedProjects.has(projectId))
continue;
const projectChanges = changedProjects[projectId];
let invalidPaths;
if (projectChanges) {
invalidPaths = new Set();
for (const p of projectChanges.changedFiles ?? [])
invalidPaths.add(p);
for (const p of projectChanges.deletedFiles ?? [])
invalidPaths.add(p);
}
const prevRef = refKey(previousSnapshotId, projectId);
const newRef = refKey(newSnapshotId, projectId);
for (const path of paths) {
if (invalidPaths?.has(path))
continue;
const entries = this.cache.get(path);
if (!entries)
continue;
for (const entry of entries) {
if (entry.refs.has(prevRef)) {
entry.refs.add(newRef);
this.trackPath(newSnapshotId, projectId, path);
}
}
}
}
}
/**
* Release all entries retained by the given snapshot across all projects.
* Only visits paths that the snapshot actually referenced.
* Entries with no remaining refs are evicted.
*/
releaseSnapshot(snapshotId) {
const projectMap = this.snapshotProjectPaths.get(snapshotId);
if (!projectMap)
return;
for (const [projectId, paths] of projectMap) {
const key = refKey(snapshotId, projectId);
for (const path of paths) {
const entries = this.cache.get(path);
if (!entries)
continue;
for (let i = entries.length - 1; i >= 0; i--) {
entries[i].refs.delete(key);
if (entries[i].refs.size === 0) {
entries.splice(i, 1);
}
}
if (entries.length === 0) {
this.cache.delete(path);
}
}
}
this.snapshotProjectPaths.delete(snapshotId);
}
trackPath(snapshotId, projectId, path) {
let projectMap = this.snapshotProjectPaths.get(snapshotId);
if (!projectMap) {
projectMap = new Map();
this.snapshotProjectPaths.set(snapshotId, projectMap);
}
let paths = projectMap.get(projectId);
if (!paths) {
paths = new Set();
projectMap.set(projectId, paths);
}
paths.add(path);
}
/**
* Clear all entries from the cache.
*/
clear() {
this.cache.clear();
this.snapshotProjectPaths.clear();
}
/**
* Get the number of unique paths in the cache.
*/
get size() {
return this.cache.size;
}
/**
* Check if a path is in the cache.
*/
has(path) {
return this.cache.has(path);
}
}
//# sourceMappingURL=sourceFileCache.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"sourceFileCache.js","sourceRoot":"","sources":["../../src/api/sourceFileCache.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,SAAS,MAAM,CAAC,UAAkB,EAAE,SAAiB;IACjD,OAAO,GAAG,UAAU,IAAI,SAAS,EAAE,CAAC;AACxC,CAAC;AAgBD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,eAAe;IACxB,wDAAwD;IAChD,KAAK,GAAkC,IAAI,GAAG,EAAE,CAAC;IACzD,qFAAqF;IAC7E,oBAAoB,GAAwC,IAAI,GAAG,EAAE,CAAC;IAE9E;;;;;;;;OAQG;IACH,WAAW,CAAC,IAAU,EAAE,UAAkB,EAAE,SAAiB;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,OAAO,KAAK,EAAE,IAAI,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,IAAU,EAAE,IAAgB,EAAE,eAAuB,EAAE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C;QAC3D,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;YACvB,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;YAClB,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAU;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACJ"}
+529
View File
@@ -0,0 +1,529 @@
/// <reference path="../node/node.d.ts" preserve="true" />
import { CompletionItemKind } from "#enums/completionItemKind";
import { DiagnosticCategory } from "#enums/diagnosticCategory";
import { ElementFlags } from "#enums/elementFlags";
import { ModuleKind } from "#enums/moduleKind";
import { NodeBuilderFlags } from "#enums/nodeBuilderFlags";
import { ObjectFlags } from "#enums/objectFlags";
import { SignatureFlags } from "#enums/signatureFlags";
import { SignatureKind } from "#enums/signatureKind";
import { SymbolFlags } from "#enums/symbolFlags";
import { TypeFlags } from "#enums/typeFlags";
import { TypePredicateKind } from "#enums/typePredicateKind";
import { type __String, type Expression, type Identifier, ModifierFlags, type Node, type Path, type SourceFile, type SyntaxKind, type TypeNode } from "../../ast/index.ts";
import type { APIOptions, LSPConnectionOptions } from "../options.ts";
import type { CompilerOptions, ConfigResponse, DocumentIdentifier, DocumentPosition, LSPUpdateSnapshotParams, ProjectResponse, SignatureResponse, SourceFileMetadata, SymbolResponse, TypeResponse, UpdateSnapshotParams, UpdateSnapshotResponse } from "../proto.ts";
import { SourceFileCache } from "../sourceFileCache.ts";
import type { RequestTiming, TimingAccumulators, TimingInfo } from "../timing.ts";
import { Client, type ClientSocketOptions, type ClientSpawnOptions } from "./client.ts";
import type { AssertsIdentifierTypePredicate, AssertsThisTypePredicate, BigIntLiteralType, BooleanLiteralType, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, JSDocTagInfo, LiteralType, NumberLiteralType, ObjectType, StringLiteralType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType } from "./types.ts";
export { documentURIToFileName, fileNameToDocumentURI } from "../path.ts";
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
export type { APIOptions, AssertsIdentifierTypePredicate, AssertsThisTypePredicate, BigIntLiteralType, BooleanLiteralType, ClientSocketOptions, ClientSpawnOptions, CompilerOptions, CompletionEntry, CompletionInfo, CompletionOptions, ConditionalType, Diagnostic, DocumentIdentifier, DocumentPosition, FreshableType, IdentifierTypePredicate, IndexedAccessType, IndexInfo, IndexType, InterfaceType, IntersectionType, IntrinsicType, JSDocTagInfo, LiteralType, LSPConnectionOptions, NumberLiteralType, ObjectType, RequestTiming, SourceFileMetadata, StringLiteralType, StringMappingType, SubstitutionType, TemplateLiteralType, ThisTypePredicate, TimingAccumulators, TimingInfo, TupleType, Type, TypeParameter, TypePredicate, TypePredicateBase, TypeReference, UnionOrIntersectionType, UnionType };
export declare class API<FromLSP extends boolean = false> {
private client;
private sourceFileCache;
private toPath;
private initialized;
private activeSnapshots;
private latestSnapshot;
readonly internal: InternalAPI;
constructor(options?: APIOptions | LSPConnectionOptions);
/**
* Create an API instance from an existing LSP connection's API session.
* Use this when connecting to an API pipe provided by an LSP server via custom/initializeAPISession.
*/
static fromLSPConnection(options: LSPConnectionOptions): API<true>;
private ensureInitialized;
parseConfigFile(file: DocumentIdentifier): ConfigResponse;
updateSnapshot(params?: FromLSP extends true ? LSPUpdateSnapshotParams : UpdateSnapshotParams): Snapshot;
close(): void;
clearSourceFileCache(): void;
/**
* Returns a snapshot of collected timing information for requests made
* through this API instance: client-measured round-trip latency and bytes
* transferred, folded together with the server's own per-request processing
* time and an estimated transport overhead (round-trip minus server time).
*
* Fetching the snapshot issues a lightweight request to the server to
* retrieve its timing collection. Collection must be enabled via the
* `collectTiming` option; when it is not, the returned snapshot has
* `enabled: false` and zeroed totals.
*/
getTimingInfo(): TimingInfo;
/** Clears all accumulated timing totals and recent-request history, on both the client and the server. */
resetTimingInfo(): void;
}
export declare class InternalAPI {
private client;
private ensureInitialized;
/** @internal */
constructor(client: Client, ensureInitialized: () => void);
startCPUProfile(dir: string): void;
stopCPUProfile(): string;
saveHeapProfile(dir: string): string;
}
export declare class Snapshot {
readonly id: number;
private projectMap;
private toPath;
private client;
private disposed;
private onDispose;
private snapshotRegistry;
constructor(data: UpdateSnapshotResponse, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path, onDispose: () => void);
getProjects(): readonly Project[];
getProject(configFileName: string): Project | undefined;
getDefaultProjectForFile(file: DocumentIdentifier): Project | undefined;
[globalThis.Symbol.dispose](): void;
dispose(): void;
isDisposed(): boolean;
private ensureNotDisposed;
}
declare class SnapshotObjectRegistry {
private readonly symbols;
private readonly client;
private readonly snapshotId;
private readonly resolveProject;
constructor(client: Client, snapshotId: number, resolveProject: (projectId: Path) => Project | undefined);
/** Resolve a project id (a config file path) to its Project within this snapshot. */
getProject(projectId: Path): Project | undefined;
getOrCreateSymbol(data: SymbolResponse): Symbol;
getSymbol(id: number): Symbol | undefined;
clear(): void;
fetchSymbol(source: Symbol | Signature | Type, method: string, handle: number | undefined, projectId?: Path): Symbol;
fetchSymbols(source: Symbol | Signature | Type, method: string, handles?: readonly number[], projectId?: Path): readonly Symbol[];
}
declare class ProjectObjectRegistry {
private client;
private snapshotId;
private project;
private snapshotRegistry;
private types;
private signatures;
constructor(client: Client, snapshotId: number, project: Project, snapshotRegistry: SnapshotObjectRegistry);
getOrCreateSymbol(data: SymbolResponse): Symbol;
getSymbol(id: number): Symbol | undefined;
getOrCreateType(data: TypeResponse): TypeObject;
getType(id: number): TypeObject | undefined;
getOrCreateSignature(data: SignatureResponse): Signature;
getSignature(id: number): Signature | undefined;
clear(): void;
fetchType<T extends Type>(source: Symbol | Signature | Type, method: string, handle: number | false | undefined): T;
fetchSymbol(source: Symbol | Signature | Type, method: string, handle: number | undefined): Symbol;
fetchSignature(source: Symbol | Signature | Type, method: string, handle: number | undefined): Signature;
fetchTypes(source: Symbol | Signature | Type, method: string, handles?: readonly number[]): readonly Type[];
fetchSymbols(source: Symbol | Signature | Type, method: string, handles?: readonly number[]): readonly Symbol[];
fetchBaseTypes(source: Type): readonly Type[];
}
export declare class Project {
readonly id: Path;
readonly configFileName: string;
readonly compilerOptions: CompilerOptions;
readonly rootFiles: readonly string[];
readonly program: Program;
readonly checker: Checker;
readonly emitter: Emitter;
private client;
constructor(data: ProjectResponse, snapshotId: number, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path, snapshotRegistry: SnapshotObjectRegistry);
dispose(): void;
}
export declare class Program {
private snapshotId;
private project;
private client;
private sourceFileCache;
private toPath;
private decoder;
private sourceFileMetadataCache;
constructor(snapshotId: number, project: Project, client: Client, sourceFileCache: SourceFileCache, toPath: (fileName: string) => Path);
getCompilerOptions(): CompilerOptions;
getSourceFile(file: DocumentIdentifier): SourceFile | undefined;
getSourceFileNames(): readonly string[];
/**
* Returns program-stored metadata for the given source file, or `undefined` if the file
* is not part of the program. Metadata is fetched lazily per file and cached on this
* `Program` instance.
*/
getSourceFileMetadata(fileName: string): SourceFileMetadata | undefined;
/**
* Returns program-stored metadata for the source file at the given path, or `undefined`
* if the file is not part of the program. Like {@link getSourceFileMetadata}, but skips
* the file name to path conversion. Metadata is fetched lazily per file and cached on
* this `Program` instance.
*/
getSourceFileMetadataByPath(path: Path): SourceFileMetadata | undefined;
private fetchSourceFileMetadata;
/**
* Returns whether the given source file was loaded as part of an external library
* (e.g. a dependency resolved from `node_modules`). The underlying program metadata is
* fetched lazily per file and cached on this `Program` instance.
*/
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
/**
* Returns whether the given source file is a default library file (e.g. `lib.d.ts`).
* The underlying program metadata is fetched lazily per file and cached on this
* `Program` instance.
*/
isSourceFileDefaultLibrary(file: SourceFile): boolean;
/**
* Get syntactic (parse) diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getSyntacticDiagnostics(file?: DocumentIdentifier): readonly Diagnostic[];
/**
* Get binder diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getBindDiagnostics(file?: DocumentIdentifier): readonly Diagnostic[];
/**
* Get semantic (type-check) diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getSemanticDiagnostics(file?: DocumentIdentifier): readonly Diagnostic[];
/**
* Get suggestion diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getSuggestionDiagnostics(file?: DocumentIdentifier): readonly Diagnostic[];
/**
* Get declaration emit diagnostics for a specific file or all files.
* @param file - Optional file to get diagnostics for. If omitted, returns diagnostics for all files.
*/
getDeclarationDiagnostics(file?: DocumentIdentifier): readonly Diagnostic[];
/**
* Get program-wide diagnostics for the project, including compiler options diagnostics.
*/
getProgramDiagnostics(): readonly Diagnostic[];
/**
* Get global (non-file-specific) semantic diagnostics for the project.
*/
getGlobalDiagnostics(): readonly Diagnostic[];
/**
* Get config file parsing diagnostics for the project.
*/
getConfigFileParsingDiagnostics(): readonly Diagnostic[];
}
export declare class Checker {
private snapshotId;
private project;
private client;
private objectRegistry;
private wellKnownSymbols;
constructor(snapshotId: number, project: Project, client: Client, objectRegistry: ProjectObjectRegistry);
dispose(): void;
getSymbolAtLocation(node: Node): Symbol | undefined;
getSymbolAtLocation(nodes: readonly Node[]): (Symbol | undefined)[];
getSymbolAtPosition(file: DocumentIdentifier, position: number): Symbol | undefined;
getSymbolAtPosition(file: DocumentIdentifier, positions: readonly number[]): (Symbol | undefined)[];
getTypeOfSymbol(symbol: Symbol): Type | undefined;
getTypeOfSymbol(symbols: readonly Symbol[]): (Type | undefined)[];
/**
* Get the declared type of a symbol. Always returns a type; for symbols whose
* declared type cannot be determined the checker yields the error type (use
* {@link Type.isErrorType} to detect it).
*/
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
getReferencesToSymbolInFile(file: DocumentIdentifier, symbol: Symbol): NodeHandle[];
getReferencedSymbolsForNode(node: Node, position: number): ReferencedSymbolEntry[];
getSignatureUsage(signatureDecl: Node): SignatureUsage[];
getCompletionsAtPosition(document: string, position: number, options?: CompletionOptions): CompletionInfo | undefined;
getTypeAtLocation(node: Node): Type | undefined;
getTypeAtLocation(nodes: readonly Node[]): (Type | undefined)[];
getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[];
getResolvedSignature(node: Node): Signature | undefined;
getTypeAtPosition(file: DocumentIdentifier, position: number): Type | undefined;
getTypeAtPosition(file: DocumentIdentifier, positions: readonly number[]): (Type | undefined)[];
resolveName(name: string, meaning: SymbolFlags, location?: Node | DocumentPosition, excludeGlobals?: boolean): Symbol | undefined;
getResolvedSymbol(node: Identifier): Symbol | undefined;
getContextualType(node: Expression): Type | undefined;
getBaseTypeOfLiteralType(type: Type): Type | undefined;
getNonNullableType(type: Type): Type | undefined;
getTypeFromTypeNode(node: TypeNode): Type | undefined;
getWidenedType(type: Type): Type | undefined;
getParameterType(signature: Signature, index: number): Type | undefined;
isArrayLikeType(type: Type): boolean;
isTypeAssignableTo(source: Type, target: Type): boolean;
getShorthandAssignmentValueSymbol(node: Node): Symbol | undefined;
/**
* Get the type of a symbol as narrowed at a specific location. Always returns
* a type; for symbols whose type cannot be determined the checker yields the
* error type (use {@link Type.isErrorType} to detect it).
*/
getTypeOfSymbolAtLocation(symbol: Symbol, location: Node): Type;
private getIntrinsicType;
getAnyType(): Type;
getStringType(): Type;
getNumberType(): Type;
getBooleanType(): Type;
getVoidType(): Type;
getUndefinedType(): Type;
getNullType(): Type;
getNeverType(): Type;
getUnknownType(): Type;
getBigIntType(): Type;
getESSymbolType(): Type;
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: number): TypeNode | undefined;
signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): Node | undefined;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: number): string;
isContextSensitive(node: Node): boolean;
isArrayType(type: Type): boolean;
isTupleType(type: Type): boolean;
getReturnTypeOfSignature(signature: Signature): Type | undefined;
getRestTypeOfSignature(signature: Signature): Type | undefined;
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
/**
* Get the base types of a class or interface type. A type with no base types
* yields an empty array.
*/
getBaseTypes(type: InterfaceType): readonly Type[];
getApparentType(type: Type): Type | undefined;
getPropertiesOfType(type: Type): readonly Symbol[];
getIndexInfosOfType(type: Type): readonly IndexInfo[];
/**
* Get the constraint of a type parameter (the `T` in `<U extends T>`), or
* undefined if it has none.
*/
getConstraintOfTypeParameter(type: TypeParameter): Type | undefined;
getBaseConstraintOfType(type: Type): Type | undefined;
getPropertyOfType(type: Type, name: string): Symbol | undefined;
getConstantValue(node: Node): string | number | undefined;
getSignatureFromDeclaration(node: Node): Signature | undefined;
getExportSpecifierLocalTargetSymbol(node: Node): Symbol | undefined;
/**
* Follow all aliases to get the original symbol. Always returns a symbol; for
* an unresolved alias the checker yields the unknown symbol (use
* {@link Checker.isUnknownSymbol} to detect it).
*/
getAliasedSymbol(symbol: Symbol): Symbol;
getImmediateAliasedSymbol(symbol: Symbol): Symbol | undefined;
/**
* Fetch (once, then cache) the handle ids of the per-checker singleton
* symbols (unknown, undefined, arguments). These ids are stable for the life
* of the project's checker, so identity checks against them are local after
* the first call.
*/
private getWellKnownSymbols;
/**
* Returns `true` if the symbol is the checker's "unknown" symbol (e.g. the
* result of {@link Checker.getAliasedSymbol} on an unresolved alias).
*/
isUnknownSymbol(symbol: Symbol): boolean;
/**
* Returns `true` if the symbol is the checker's "undefined" symbol.
*/
isUndefinedSymbol(symbol: Symbol): boolean;
/**
* Returns `true` if the symbol is the checker's "arguments" symbol.
*/
isArgumentsSymbol(symbol: Symbol): boolean;
getExportsOfModule(symbol: Symbol): readonly Symbol[];
getMemberInModuleExports(symbol: Symbol, name: string): Symbol | undefined;
getJsDocTagsOfSymbol(symbol: Symbol): readonly JSDocTagInfo[];
getDocumentationCommentOfSymbol(symbol: Symbol): string;
/**
* Get the type arguments of a type reference (e.g. the `string` in `Array<string>`).
*/
getTypeArguments(type: TypeReference): readonly Type[];
}
export interface PrintNodeOptions {
preserveSourceNewlines?: boolean | undefined;
neverAsciiEscape?: boolean | undefined;
terminateUnterminatedLiterals?: boolean | undefined;
}
export declare class Emitter {
private client;
constructor(client: Client);
printNode(node: Node, options?: PrintNodeOptions): string;
}
export declare class NodeHandle {
/**
* The project this handle was produced in, used as the default for {@link resolve}.
* Node handles are only meaningful within a project's program, so the producing project
* is remembered so callers don't have to pass it explicitly.
*/
private readonly canonicalProject;
readonly index: number;
readonly kind: SyntaxKind;
readonly path: Path;
constructor(handle: string, canonicalProject: Project);
/**
* Resolve this handle to the actual AST node by fetching the source file from a project
* and looking up the node by index. If no project is passed, the project that produced
* the handle is used.
*/
resolve(project?: Project): Node | undefined;
}
/** A symbol definition paired with all of its reference nodes. */
export interface ReferencedSymbolEntry {
/** The node handle for the symbol's definition. */
definition: NodeHandle;
/** The resolved symbol for the definition, if available. */
symbol?: Symbol | undefined;
/** The node handles for each reference to the symbol. */
references: NodeHandle[];
}
/** A single usage of a signature, pairing the reference name with its call expression (if any). */
export interface SignatureUsage {
/** The node handle for the name reference. */
name: NodeHandle;
/** The node handle for the call expression, if the reference is invoked. */
call?: NodeHandle | undefined;
}
export declare class Symbol {
private objectRegistry;
/**
* The project this symbol was first observed in, used as the default project for
* lookups that need a project context (members/exports/parent). Symbols are shared
* snapshot-wide, so these lookups can otherwise be ambiguous about which project to use.
*/
private readonly canonicalProject;
readonly id: number;
/** The escaped (`__String`) name, used as the key in member/export tables. */
readonly escapedName: __String;
/** The display name (escaped underscores removed). */
readonly name: string;
readonly flags: SymbolFlags;
readonly checkFlags: number;
readonly declarations: readonly NodeHandle[];
readonly valueDeclaration: NodeHandle | undefined;
private readonly parent;
private readonly exportSymbol;
private membersCache;
private exportsCache;
constructor(data: SymbolResponse, objectRegistry: SnapshotObjectRegistry);
getParent(): Symbol | undefined;
/**
* Get this symbol's members keyed by escaped name. The result is cached on
* the symbol, so repeated calls do not round-trip to the server.
*/
getMembers(): ReadonlyMap<__String, Symbol>;
/**
* Get this symbol's exports keyed by escaped name. The result is cached on
* the symbol, so repeated calls do not round-trip to the server.
*/
getExports(): ReadonlyMap<__String, Symbol>;
private fetchSymbolTable;
getExportSymbol(): Symbol;
getJsDocTags(checker: Checker): readonly JSDocTagInfo[];
getDocumentationComment(checker: Checker): string;
}
declare class TypeObject implements Type {
private objectRegistry;
readonly id: number;
readonly flags: TypeFlags;
readonly objectFlags: ObjectFlags;
readonly symbol: number;
readonly value: string | number | boolean | bigint;
readonly intrinsicName: string;
readonly isThisType: boolean;
readonly freshType: number;
readonly regularType: number;
readonly target: number;
readonly typeParameters: readonly number[];
readonly outerTypeParameters: readonly number[];
readonly localTypeParameters: readonly number[];
readonly aliasTypeArguments: readonly number[];
readonly aliasSymbol: number;
readonly elementFlags: readonly ElementFlags[];
readonly fixedLength: number;
readonly readonly: boolean;
readonly texts: readonly string[];
readonly objectType: number;
readonly indexType: number;
readonly checkType: number;
readonly extendsType: number;
readonly baseType: number;
readonly substConstraint: number;
private trueType;
private falseType;
constructor(data: TypeResponse, objectRegistry: ProjectObjectRegistry);
getSymbol(): Symbol | undefined;
getAliasSymbol(): Symbol | undefined;
getTarget(): Type;
getFreshType(): FreshableType | undefined;
getRegularType(): FreshableType | undefined;
getTypes(): readonly Type[] | undefined;
getTypeParameters(): readonly TypeParameter[];
getOuterTypeParameters(): readonly TypeParameter[];
getLocalTypeParameters(): readonly TypeParameter[];
getAliasTypeArguments(): readonly Type[];
getObjectType(): Type;
getIndexType(): Type;
getCheckType(): Type;
getExtendsType(): Type;
getBaseType(): Type;
getConstraint(): Type;
getTrueType(): Type;
getFalseType(): Type;
/**
* Get the base types of this type. Returns `undefined` for any type that is
* not a class or interface.
*/
getBaseTypes(): readonly Type[] | undefined;
isClassOrInterface(): this is InterfaceType;
isUnionType(): this is UnionType;
isIntersectionType(): this is IntersectionType;
isObjectType(): this is ObjectType;
isIntrinsicType(): this is IntrinsicType;
isErrorType(): boolean;
isLiteralType(): this is LiteralType;
isStringLiteralType(): this is StringLiteralType;
isNumberLiteralType(): this is NumberLiteralType;
isBigIntLiteralType(): this is BigIntLiteralType;
isBooleanLiteralType(): this is BooleanLiteralType;
isTypeReference(): this is TypeReference;
isTupleType(): this is TupleType;
isIndexType(): this is IndexType;
isIndexedAccessType(): this is IndexedAccessType;
isConditionalType(): this is ConditionalType;
isSubstitutionType(): this is SubstitutionType;
isTemplateLiteralType(): this is TemplateLiteralType;
isStringMappingType(): this is StringMappingType;
isTypeParameter(): this is TypeParameter;
}
export declare function isUnionType(type: Type): type is UnionType;
export declare function isIntersectionType(type: Type): type is IntersectionType;
export declare function isObjectType(type: Type): type is ObjectType;
export declare function isClassOrInterfaceType(type: Type): type is InterfaceType;
export declare function isIntrinsicType(type: Type): type is IntrinsicType;
/**
* Whether this is the error type — the placeholder the checker produces when a
* type cannot be determined (e.g. an unresolved reference). It is an intrinsic
* type named `"error"` (this covers both the singleton error type and the
* per-alias error types manufactured for unresolved type alias references).
*/
export declare function isErrorType(type: Type): boolean;
export declare function isLiteralType(type: Type): type is LiteralType;
export declare function isStringLiteralType(type: Type): type is StringLiteralType;
export declare function isNumberLiteralType(type: Type): type is NumberLiteralType;
export declare function isBigIntLiteralType(type: Type): type is BigIntLiteralType;
export declare function isBooleanLiteralType(type: Type): type is BooleanLiteralType;
export declare function isTypeReference(type: Type): type is TypeReference;
export declare function isTupleType(type: Type): type is TupleType;
export declare function isIndexType(type: Type): type is IndexType;
export declare function isIndexedAccessType(type: Type): type is IndexedAccessType;
export declare function isConditionalType(type: Type): type is ConditionalType;
export declare function isSubstitutionType(type: Type): type is SubstitutionType;
export declare function isTemplateLiteralType(type: Type): type is TemplateLiteralType;
export declare function isStringMappingType(type: Type): type is StringMappingType;
export declare function isTypeParameter(type: Type): type is TypeParameter;
export declare class Signature {
private flags;
private objectRegistry;
readonly id: number;
readonly declaration?: NodeHandle | undefined;
readonly typeParameters?: readonly number[] | undefined;
readonly parameters: readonly number[];
readonly thisParameter?: number | undefined;
readonly target?: number | undefined;
constructor(data: SignatureResponse, project: Project, objectRegistry: ProjectObjectRegistry);
getTypeParameters(): readonly TypeParameter[];
getParameters(): readonly Symbol[];
getThisParameter(): Symbol | undefined;
getTarget(): Signature | undefined;
get hasRestParameter(): boolean;
get isConstruct(): boolean;
get isAbstract(): boolean;
}
//# sourceMappingURL=api.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/sync/api.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/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AcpH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG,SAAS,MAAM,EAAE;CAsBpI;AAED,cAAM,qBAAqB;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,UAAU,CAAqC;gBAGnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,sBAAsB;IAQ5C,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IAI/C,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzC,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU;IAS/C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI3C,oLine truncated
+1665
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/api/sync/api.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,oDAAoD;AACpD,oDAAoD;AACpD,oDAAoD;AACpD,EAAE;AACF,+BAA+B;AAC/B,+DAA+D;AAC/D,EAAE;AACF,wDAAwD;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBA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AAC,CAAC;QACjF,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;CACJ;AAED,MAAM,OAAO,QAAQ;IACR,EAAE,CAAS;IACZ,UAAU,CAAqB;IAC/B,MAAM,CAA6B;IACnC,MAAM,CAAS;IACf,QAAQ,GAAY,KAAK,CAAC;IAC1B,SAAS,CAAa;IACtB,gBAAgB,CAAyB;IAEjD,YACI,IAA4B,EAC5B,MAAc,EACd,eAAgC,EAChC,MAAkC,EAClC,SAAqB;QAErB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CLine truncated
+30
View File
@@ -0,0 +1,30 @@
import { type ClientOptions, type ClientSocketOptions, type ClientSpawnOptions } from "../options.ts";
import { TimingCollector, type TimingInfo } from "../timing.ts";
export type { ClientOptions, ClientSocketOptions, ClientSpawnOptions };
export declare class Client {
private channel;
private encoder;
private timing;
constructor(options: ClientOptions);
apiRequest<T>(method: string, params?: unknown): T;
apiRequestBinary(method: string, params?: unknown): Uint8Array | undefined;
echo(payload: string): string;
echoBinary(payload: Uint8Array): Uint8Array;
/**
* Returns a combined timing snapshot: client-measured round-trip and byte
* counts folded together with the server's own per-request processing time
* (fetched via a getServerTiming request) and estimated transport overhead.
*/
getTimingInfo(): TimingInfo;
resetTimingInfo(): void;
/**
* Returns the timing collector that per-node materialization is reported
* into, or undefined when timing collection is disabled. The returned
* collector is the same one folded into {@link getTimingInfo}, so
* materialization totals surface alongside request timings.
*/
getTimingCollector(): TimingCollector | undefined;
private recordTiming;
close(): void;
}
//# sourceMappingURL=client.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/sync/client.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAG1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAIH,eAAe,EACf,KAAK,UAAU,EAClB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAEvE,qBAAa,MAAM;IACf,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,MAAM,CAA8B;gBAEhC,OAAO,EAAE,aAAa;IAmDlC,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,CAAC;IAWlD,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS;IAQ1E,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAI7B,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU;IAI3C;;;;OAIG;IACH,aAAa,IAAI,UAAU;IAW3B,eAAe,IAAI,IAAI;IAOvB;;;;;OAKG;IACH,kBAAkB,IAAI,eAAe,GAAG,SAAS;IAIjD,OAAO,CAAC,YAAY;IAUpB,KAAK,IAAI,IAAI;CAGhB"}
+124
View File
@@ -0,0 +1,124 @@
import { fsCallbackNames } from "../fs.js";
import { isSpawnOptions, resolveExePath, } from "../options.js";
import { SyncRpcChannel } from "../syncChannel.js";
import { combineTimingInfo, disabledTimingInfo, TimingCollector, } from "../timing.js";
export class Client {
channel;
encoder = new TextEncoder();
timing;
constructor(options) {
if (!isSpawnOptions(options)) {
throw new Error("Socket connections are not yet supported in the sync client");
}
const cwd = options.cwd ?? process.cwd();
const args = [
"--api",
"--cwd",
cwd,
];
// Enable virtual FS callbacks for each provided FS function
const enabledCallbacks = [];
if (options.fs) {
for (const name of fsCallbackNames) {
if (options.fs[name]) {
enabledCallbacks.push(name);
}
}
}
if (enabledCallbacks.length > 0) {
args.push(`--callbacks=${enabledCallbacks.join(",")}`);
}
const collectTiming = options.collectTiming ?? false;
if (collectTiming) {
args.push("--timing");
this.timing = new TimingCollector();
}
const channel = new SyncRpcChannel(resolveExePath(options), args, collectTiming);
this.channel = channel;
if (options.fs) {
for (const name of enabledCallbacks) {
const callback = options.fs[name];
channel.registerCallback(name, (_, arg) => {
const result = callback(JSON.parse(arg));
if (name === "readFile") {
// readFile has 3 returns: string (content), null (not found), undefined (fall back).
// Wrap in object to preserve null vs undefined distinction.
if (result === undefined)
return "";
return JSON.stringify({ content: result });
}
return JSON.stringify(result) ?? "";
});
}
}
}
apiRequest(method, params) {
const encodedPayload = JSON.stringify(params);
const start = performance.now();
const result = this.channel.requestSync(method, encodedPayload);
this.recordTiming(method, start);
if (result.length) {
return JSON.parse(result);
}
return undefined;
}
apiRequestBinary(method, params) {
const start = performance.now();
const result = this.channel.requestBinarySync(method, this.encoder.encode(JSON.stringify(params)));
this.recordTiming(method, start);
if (result.length === 0)
return undefined;
return result;
}
echo(payload) {
return this.channel.requestSync("echo", payload);
}
echoBinary(payload) {
return this.channel.requestBinarySync("echo", payload);
}
/**
* Returns a combined timing snapshot: client-measured round-trip and byte
* counts folded together with the server's own per-request processing time
* (fetched via a getServerTiming request) and estimated transport overhead.
*/
getTimingInfo() {
if (!this.timing) {
return disabledTimingInfo();
}
const local = this.timing.getInfo();
// requestSync bypasses recordTiming, so this query does not pollute the
// client-side collector.
const result = this.channel.requestSync("getServerTiming", "");
return combineTimingInfo(local, JSON.parse(result));
}
resetTimingInfo() {
if (!this.timing)
return;
this.timing.reset();
// Keep the server's collection in sync so combined totals stay meaningful.
this.channel.requestSync("resetServerTiming", "");
}
/**
* Returns the timing collector that per-node materialization is reported
* into, or undefined when timing collection is disabled. The returned
* collector is the same one folded into {@link getTimingInfo}, so
* materialization totals surface alongside request timings.
*/
getTimingCollector() {
return this.timing;
}
recordTiming(method, start) {
if (!this.timing)
return;
this.timing.record({
method,
roundTripMs: performance.now() - start,
bytesSent: this.channel.lastBytesSent,
bytesReceived: this.channel.lastBytesReceived,
});
}
close() {
this.channel.close();
}
}
//# sourceMappingURL=client.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/sync/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAIH,cAAc,EACd,cAAc,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAElB,eAAe,GAElB,MAAM,cAAc,CAAC;AAItB,MAAM,OAAO,MAAM;IACP,OAAO,CAAiB;IACxB,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAC5B,MAAM,CAA8B;IAE5C,YAAY,OAAsB;QAC9B,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACnF,CAAC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG;YACT,OAAO;YACP,OAAO;YACP,GAAG;SACN,CAAC;QAEF,4DAA4D;QAC5D,MAAM,gBAAgB,GAAuC,EAAE,CAAC;QAChE,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;YACb,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;gBACjC,IAAI,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChC,CAAC;YACL,CAAC;QACL,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED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K,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAqB,CAAC,CAAC;IAC5E,CAAC;IAED,eAAe;QACX,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,2EAA2E;QAC3E,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,kBAAkB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAEO,YAAY,CAAC,MAAc,EAAE,KAAa;QAC9C,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YACf,MAAM;YACN,WAAW,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK;YACtC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa;YACrC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,iBAAiB;SAChD,CAAC,CAAC;IACP,CAAC;IAED,KAAK;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ"}
+310
View File
@@ -0,0 +1,310 @@
import type { CompletionItemKind } from "#enums/completionItemKind";
import type { DiagnosticCategory } from "#enums/diagnosticCategory";
import type { ElementFlags } from "#enums/elementFlags";
import type { ObjectFlags } from "#enums/objectFlags";
import type { TypeFlags } from "#enums/typeFlags";
import type { TypePredicateKind } from "#enums/typePredicateKind";
import type { NodeHandle, Symbol } from "./api.ts";
/**
* A TypeScript type.
*
* Use TypeFlags to determine the specific kind of type and access
* kind-specific properties. For example:
*
* ```ts
* if (type.flags & TypeFlags.StringLiteral) {
* console.log((type as StringLiteralType).value); // string
* }
* ```
*/
export interface Type {
/** Type flags — use to determine the specific kind of type. */
readonly flags: TypeFlags;
/** Unique identifier for this type */
readonly id: number;
/** Get the symbol associated with this type, if any */
getSymbol(): Symbol | undefined;
/** Get the type arguments of the type alias this type was instantiated from, if any */
getAliasTypeArguments(): readonly Type[];
/** Get the symbol of the type alias this type was instantiated from, if any */
getAliasSymbol(): Symbol | undefined;
/**
* Get the base types of this type, or `undefined` if it is not a class or
* interface type.
*/
getBaseTypes(): readonly Type[] | undefined;
/** Whether this type is a class or interface type */
isClassOrInterface(): this is InterfaceType;
/** Whether this type is a union type */
isUnionType(): this is UnionType;
/** Whether this type is an intersection type */
isIntersectionType(): this is IntersectionType;
/** Whether this type is an object type */
isObjectType(): this is ObjectType;
/** Whether this type is an intrinsic primitive type */
isIntrinsicType(): this is IntrinsicType;
/**
* Whether this is the error type — the placeholder produced when a type
* cannot be determined (e.g. an unresolved reference).
*/
isErrorType(): boolean;
/** Whether this type is a literal type */
isLiteralType(): this is LiteralType;
/** Whether this type is a string literal type */
isStringLiteralType(): this is StringLiteralType;
/** Whether this type is a number literal type */
isNumberLiteralType(): this is NumberLiteralType;
/** Whether this type is a bigint literal type */
isBigIntLiteralType(): this is BigIntLiteralType;
/** Whether this type is a boolean literal type */
isBooleanLiteralType(): this is BooleanLiteralType;
/** Whether this type is a type reference */
isTypeReference(): this is TypeReference;
/** Whether this type is a tuple type */
isTupleType(): this is TupleType;
/** Whether this type is an index type (`keyof T`) */
isIndexType(): this is IndexType;
/** Whether this type is an indexed access type (`T[K]`) */
isIndexedAccessType(): this is IndexedAccessType;
/** Whether this type is a conditional type */
isConditionalType(): this is ConditionalType;
/** Whether this type is a substitution type */
isSubstitutionType(): this is SubstitutionType;
/** Whether this type is a template literal type */
isTemplateLiteralType(): this is TemplateLiteralType;
/** Whether this type is a string mapping type */
isStringMappingType(): this is StringMappingType;
/** Whether this type is a type parameter */
isTypeParameter(): this is TypeParameter;
}
/**
* Freshable types (TypeFlags.Freshable) - literal types (TypeFlags.Literal) and computed enum types (TypeFlags.Enum).
*/
export interface FreshableType extends Type {
/** Get the fresh version of this type, if any */
getFreshType(): FreshableType | undefined;
/** Get the regular (non-fresh) version of this type, if any */
getRegularType(): FreshableType | undefined;
}
/** Literal types: StringLiteral, NumberLiteral, BigIntLiteral, BooleanLiteral */
export interface LiteralType extends FreshableType {
/** The literal value. Use TypeFlags to narrow to a specific literal subtype with a concrete value type. */
readonly value: string | number | boolean | bigint;
}
/** String literal types (TypeFlags.StringLiteral) */
export interface StringLiteralType extends LiteralType {
/** The string value of the literal */
readonly value: string;
}
/** Numeric literal types (TypeFlags.NumberLiteral) */
export interface NumberLiteralType extends LiteralType {
/** The numeric value of the literal */
readonly value: number;
}
/** BigInt literal types (TypeFlags.BigIntLiteral) */
export interface BigIntLiteralType extends LiteralType {
/** The bigint value of the literal */
readonly value: bigint;
}
/** Boolean literal types (TypeFlags.BooleanLiteral) */
export interface BooleanLiteralType extends LiteralType {
/** The boolean value of the literal */
readonly value: boolean;
}
/** Object types (TypeFlags.Object) */
export interface ObjectType extends Type {
/** Object flags — use to determine the specific kind of object type. */
readonly objectFlags: ObjectFlags;
}
/** Type references (ObjectFlags.Reference) — e.g. Array<string>, Map<K, V> */
export interface TypeReference extends ObjectType {
/** Get the generic target type (e.g. Array for Array<string>) */
getTarget(): Type;
}
/** Interface types — classes and interfaces (ObjectFlags.ClassOrInterface) */
export interface InterfaceType extends TypeReference {
/** Get all type parameters (outer + local, excluding thisType) */
getTypeParameters(): readonly TypeParameter[];
/** Get outer type parameters from enclosing declarations */
getOuterTypeParameters(): readonly TypeParameter[];
/** Get local type parameters declared on this interface/class */
getLocalTypeParameters(): readonly TypeParameter[];
}
/** Tuple types (ObjectFlags.Tuple) */
export interface TupleType extends InterfaceType {
/** Per-element flags (Required, Optional, Rest, Variadic) */
readonly elementFlags: readonly ElementFlags[];
/** Number of initial required or optional elements */
readonly fixedLength: number;
/** Whether the tuple is readonly */
readonly readonly: boolean;
}
/** Union or intersection types (TypeFlags.Union | TypeFlags.Intersection) */
export interface UnionOrIntersectionType extends Type {
/** Get the constituent types */
getTypes(): readonly Type[];
}
/** Union types (TypeFlags.Union) */
export interface UnionType extends UnionOrIntersectionType {
}
/** Intersection types (TypeFlags.Intersection) */
export interface IntersectionType extends UnionOrIntersectionType {
}
/** Type parameters (TypeFlags.TypeParameter) */
export interface TypeParameter extends Type {
/** True if this is the synthetic `this` type of an interface, class, or tuple */
readonly isThisType?: boolean | undefined;
}
/** Index types — keyof T (TypeFlags.Index) */
export interface IndexType extends Type {
/** Get the target type T in `keyof T` */
getTarget(): Type;
}
/** Indexed access types — T[K] (TypeFlags.IndexedAccess) */
export interface IndexedAccessType extends Type {
/** Get the object type T in `T[K]` */
getObjectType(): Type;
/** Get the index type K in `T[K]` */
getIndexType(): Type;
}
/** Conditional types — T extends U ? X : Y (TypeFlags.Conditional) */
export interface ConditionalType extends Type {
/** Get the check type T in `T extends U ? X : Y` */
getCheckType(): Type;
/** Get the extends type U in `T extends U ? X : Y` */
getExtendsType(): Type;
/** Get the true type X in `T extends U ? X : Y` */
getTrueType(): Type;
/** Get the false type Y in `T extends U ? X : Y` */
getFalseType(): Type;
}
/** Substitution types (TypeFlags.Substitution) */
export interface SubstitutionType extends Type {
getBaseType(): Type;
getConstraint(): Type;
}
/** Template literal types (TypeFlags.TemplateLiteral) */
export interface TemplateLiteralType extends Type {
/** Text segments (always one more than the number of type spans) */
readonly texts: readonly string[];
/** Get the types interspersed between text segments */
getTypes(): readonly Type[];
}
/** String mapping types — Uppercase<T>, Lowercase<T>, etc. (TypeFlags.StringMapping) */
export interface StringMappingType extends Type {
/** Get the mapped type */
getTarget(): Type;
}
/** Intrinsic types — any, unknown, string, number, bigint, symbol, void, undefined, null, never, object (TypeFlags.Intrinsic) */
export interface IntrinsicType extends Type {
/** The intrinsic type name (e.g. "any", "string", "never") */
readonly intrinsicName: string;
}
/** Base for all type predicates */
export interface TypePredicateBase {
readonly kind: TypePredicateKind;
readonly type: Type | undefined;
}
/** `this is T` */
export interface ThisTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.This;
readonly parameterName: undefined;
readonly parameterIndex: undefined;
readonly type: Type;
}
/** `x is T` */
export interface IdentifierTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.Identifier;
readonly parameterName: string;
readonly parameterIndex: number;
readonly type: Type;
}
/** `asserts this is T` */
export interface AssertsThisTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.AssertsThis;
readonly parameterName: undefined;
readonly parameterIndex: undefined;
readonly type: Type | undefined;
}
/** `asserts x is T` */
export interface AssertsIdentifierTypePredicate extends TypePredicateBase {
readonly kind: TypePredicateKind.AssertsIdentifier;
readonly parameterName: string;
readonly parameterIndex: number;
readonly type: Type | undefined;
}
/** A type predicate — e.g. `x is T` or `asserts x is T` */
export type TypePredicate = ThisTypePredicate | IdentifierTypePredicate | AssertsThisTypePredicate | AssertsIdentifierTypePredicate;
/** An index signature — e.g. `[key: string]: T` */
export interface IndexInfo {
/** The index key type (e.g. string or number) */
readonly keyType: Type;
/** The index value type */
readonly valueType: Type;
/** Whether the index signature is readonly */
readonly isReadonly: boolean;
/** The index signature declaration, if any */
readonly declaration?: NodeHandle | undefined;
}
/**
* A single JSDoc tag attached to a symbol — e.g. `@param`, `@returns`.
*/
export interface JSDocTagInfo {
/** The tag name, without the leading `@` — e.g. `"param"`. */
readonly name: string;
/** The rendered tag text, if any — e.g. `"a the first number"` for `@param a the first number`. */
readonly text?: string | undefined;
}
export interface CompletionEntryLabelDetails {
detail?: string | undefined;
description?: string | undefined;
}
/** Options for {@link Checker.getCompletionsAtPosition}. */
export interface CompletionOptions {
triggerCharacter?: string | undefined;
/** Include a `symbol` property on each completion entry. Only populated for symbol-based completions (not keywords or literals). */
includeSymbol?: boolean | undefined;
}
/** A single completion item returned by {@link Checker.getCompletionsAtPosition}. */
export interface CompletionEntry {
readonly name: string;
readonly kind?: CompletionItemKind | undefined;
readonly sortText?: string | undefined;
readonly insertText?: string | undefined;
readonly filterText?: string | undefined;
readonly detail?: string | undefined;
readonly labelDetails?: CompletionEntryLabelDetails | undefined;
/** The symbol associated with this completion entry. Only set when `includeSymbol: true` is passed and a symbol is available. */
readonly symbol?: Symbol | undefined;
}
/** The result of {@link Checker.getCompletionsAtPosition}. */
export interface CompletionInfo {
readonly isIncomplete: boolean;
readonly entries: readonly CompletionEntry[];
}
/**
* A diagnostic message from the TypeScript compiler.
*/
export interface Diagnostic {
/** File name of the source file this diagnostic belongs to, if any */
readonly fileName?: string | undefined;
/** Start position of the diagnostic */
readonly pos: number;
/** End position of the diagnostic */
readonly end: number;
/** Diagnostic error code */
readonly code: number;
/** Diagnostic category (error, warning, suggestion, message) */
readonly category: DiagnosticCategory;
/** Localized diagnostic message text */
readonly text: string;
/** Whether this diagnostic highlights unnecessary code */
readonly reportsUnnecessary?: boolean | undefined;
/** Whether this diagnostic highlights deprecated code */
readonly reportsDeprecated?: boolean | undefined;
/** Chained diagnostic messages */
readonly messageChain?: readonly Diagnostic[] | undefined;
/** Related diagnostic information */
readonly relatedInformation?: readonly Diagnostic[] | undefined;
}
//# sourceMappingURL=types.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/api/sync/types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EACR,UAAU,EACV,MAAM,EACT,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,IAAI;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAE1B,sCAAsC;IAC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,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACvB;AAED,0BAA0B;AAC1B,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAC/D,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC;IAC7C,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC;IACnC,QALine truncated
+2
View File
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/api/sync/types.ts"],"names":[],"mappings":""}
+114
View File
@@ -0,0 +1,114 @@
/**
* Pure JS replacement for @typescript/libsyncrpc.
*
* Spawns a child process and communicates with it synchronously over
* stdin/stdout pipes using the same MessagePack-based tuple protocol:
* [MessageType (u8), method (bin), payload (bin)]
*
* Synchronous I/O is achieved by calling fs.readSync / fs.writeSync
* directly on the pipe file descriptors obtained from the spawned
* ChildProcess.
*/
/**
* SyncRpcChannel – drop-in replacement for the native libsyncrpc class.
*
* API surface intentionally matches the original:
* - constructor(exe, args)
* - requestSync(method, payload): string
* - requestBinarySync(method, payload): Uint8Array
* - registerCallback(name, cb)
* - close()
*
* The protocol is unversioned; both sides (this JS channel and the Go
* child process) must be built from the same tree.
*
* This class is **not** thread-safe. All calls must originate from a
* single thread — do not share an instance across worker threads.
*/
export declare class SyncRpcChannel {
private child;
private readFd;
private writeFd;
private pipeFd;
private callbacks;
private methodBufCache;
private readonly collectTiming;
lastBytesSent: number;
lastBytesReceived: number;
private _msgType;
private _msgName;
private _msgPayload;
private headerBuf;
private readBuf;
private readBufPos;
private readBufLen;
private writeBuf;
constructor(exe: string, args: string[], collectTiming?: boolean);
/**
* Send a request and synchronously wait for the response (string).
* Handles Call (callback) messages from the child inline.
*/
requestSync(method: string, payload: string): string;
/**
* Send a request and synchronously wait for the response (binary).
* Handles Call (callback) messages from the child inline.
*/
requestBinarySync(method: string, payload: Uint8Array): Uint8Array;
/** Register a string→string callback that the child may invoke. */
registerCallback(name: string, callback: (name: string, payload: string) => string): void;
/** Kill the child process and release resources. */
close(): void;
private ensureOpen;
private getMethodBuf;
private requestBytesSync;
/**
* Handle an incoming MSG_CALL from the child process.
*
* After sending the error response back to the child, this method
* intentionally re-throws to abort the caller's request loop.
* A failed callback is treated as unrecoverable to match the
* behavior of the native libsyncrpc addon.
*/
private handleCall;
/**
* Write a complete [type, name, payload] tuple in as few writeSync
* calls as possible. For messages that fit in the pre-allocated
* write buffer (64 KB), everything is assembled and sent in a single
* syscall. Larger messages use two syscalls: one for the header
* portion and one for the payload data.
*/
private writeTuple;
/**
* Read a [type, name, payload] tuple into instance fields
* (_msgType, _msgName, _msgPayload) to avoid allocating a
* short-lived 3-element array on every call.
*/
private readTuple;
/**
* Read a MessagePack bin field.
*/
private readBin;
/** Build an EOF error with the child's exit code/signal if available. */
private eofError;
/** Read a single byte from the buffered read-ahead. */
private readByte;
private readExact;
/**
* Fill the internal read-ahead buffer from the pipe fd.
* Retries on EAGAIN for non-blocking mode compatibility.
*/
private fillReadBuffer;
/**
* Synchronously read exactly `length` bytes into `buffer`.
* Serves from the internal read-ahead buffer first; for large reads
* that exceed the buffer size, reads directly from the fd to avoid
* an extra copy.
*/
private readExactInto;
/**
* Synchronously write all bytes from `data` (up to `length`).
* Retries on EAGAIN.
*/
private writeAllBuf;
}
//# sourceMappingURL=syncChannel.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"syncChannel.d.ts","sourceRoot":"","sources":["../../src/api/syncChannel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8EH;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAqB;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IAsBtB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAoCrB;;;OAGG;IACH,OAAO,CAAC,WAAW;CAiBtB"}
+508
View File
@@ -0,0 +1,508 @@
/**
* Pure JS replacement for @typescript/libsyncrpc.
*
* Spawns a child process and communicates with it synchronously over
* stdin/stdout pipes using the same MessagePack-based tuple protocol:
* [MessageType (u8), method (bin), payload (bin)]
*
* Synchronous I/O is achieved by calling fs.readSync / fs.writeSync
* directly on the pipe file descriptors obtained from the spawned
* ChildProcess.
*/
import { spawn, } from "node:child_process";
import { closeSync, openSync, readSync, writeSync, } from "node:fs";
import { binHeaderSize, MSGPACK_BIN16, MSGPACK_BIN32, MSGPACK_BIN8, MSGPACK_FIXARRAY3, MSGPACK_UINT8, writeBinHeader, } from "./node/msgpack.js";
// ── MessageType constants ────────────────────────────────────────────
// Sent by channel (parent → child)
const MSG_REQUEST = 1;
const MSG_CALL_RESPONSE = 2;
const MSG_CALL_ERROR = 3;
// Sent by child (child → parent)
const MSG_RESPONSE = 4;
const MSG_ERROR = 5;
const MSG_CALL = 6;
// Pre-allocated buffer used by Atomics.wait for tiny sleeps when a
// non-blocking fd returns EAGAIN.
const sleepBuf = new Int32Array(new SharedArrayBuffer(4));
// Shared empty buffer – avoids allocating Buffer.alloc(0) on every
// zero-length bin field.
const EMPTY_BUF = Buffer.alloc(0);
// ── Global cleanup tracking ─────────────────────────────────────────
// Track all live child processes so they can be killed on process exit.
// This mimics the auto-cleanup behavior of the native libsyncrpc module,
// whose Rust/C++ destructors would kill children automatically.
const liveChildren = new Set();
process.on("exit", () => {
for (const child of liveChildren) {
try {
child.kill();
}
catch {
// swallow – process may already be dead
}
}
liveChildren.clear();
});
/**
* SyncRpcChannel – drop-in replacement for the native libsyncrpc class.
*
* API surface intentionally matches the original:
* - constructor(exe, args)
* - requestSync(method, payload): string
* - requestBinarySync(method, payload): Uint8Array
* - registerCallback(name, cb)
* - close()
*
* The protocol is unversioned; both sides (this JS channel and the Go
* child process) must be built from the same tree.
*
* This class is **not** thread-safe. All calls must originate from a
* single thread — do not share an instance across worker threads.
*/
export class SyncRpcChannel {
child;
readFd;
writeFd;
pipeFd;
callbacks = new Map();
methodBufCache = new Map();
// When true, the payload byte lengths of each request/response are recorded
// and exposed via the `last*` fields below. These count only the JSON/binary
// payload bytes, not the MessagePack tuple framing (message type, method
// name, and length headers).
collectTiming;
// Per-request payload byte measurements for the most recently completed
// request. Only meaningful when `collectTiming` is true. Callers read these
// immediately after a request returns (the channel is strictly serial).
lastBytesSent = 0;
lastBytesReceived = 0;
_msgType = 0;
_msgName = EMPTY_BUF;
_msgPayload = EMPTY_BUF;
headerBuf = Buffer.allocUnsafe(4);
// Read-ahead buffer – reduces readSync syscalls by buffering data from the pipe.
readBuf = Buffer.allocUnsafe(65536);
readBufPos = 0;
readBufLen = 0;
// Write buffer – assembles entire tuples for a single writeSync.
writeBuf = Buffer.allocUnsafe(65536);
constructor(exe, args, collectTiming = false) {
this.collectTiming = collectTiming;
const isWindows = process.platform === "win32";
if (isWindows) {
// On Windows, libuv pipe handles don't expose POSIX fds, so
// readSync/writeSync can't be used on stdio pipes. Instead,
// we create a Windows named pipe path, pass it to the child
// via --pipe, and open it with fs.openSync which returns a
// real C-runtime fd backed by a proper HANDLE.
const pipePath = `\\\\.\\pipe\\tsgo-sync-${process.pid}-${Date.now()}`;
this.child = spawn(exe, [...args, "--pipe", pipePath], {
stdio: ["ignore", "ignore", "inherit"],
});
// Retry openSync until the child creates the named pipe.
let fd;
for (let i = 0; i < 500; i++) {
try {
fd = openSync(pipePath, "r+");
break;
}
catch {
if (this.child.exitCode !== null) {
throw new Error(`Child process exited with code ${this.child.exitCode} before pipe was ready`);
}
Atomics.wait(sleepBuf, 0, 0, 10);
}
}
if (fd === undefined) {
this.child.kill();
throw new Error("SyncRpcChannel: timed out connecting to named pipe");
}
this.readFd = fd;
this.writeFd = fd;
this.pipeFd = fd;
}
else {
// POSIX: use stdio pipe file descriptors directly.
this.child = spawn(exe, args, {
stdio: ["pipe", "pipe", "inherit"],
});
const stdout = this.child.stdout;
const stdin = this.child.stdin;
this.readFd = stdout._handle.fd;
this.writeFd = stdin._handle.fd;
if (typeof this.readFd !== "number" || this.readFd < 0 || typeof this.writeFd !== "number" || this.writeFd < 0) {
stdout.destroy();
stdin.destroy();
this.child.kill();
throw new Error("SyncRpcChannel: could not obtain pipe file descriptors.");
}
// Set the pipe handles to blocking mode. Under node --test's
// process isolation, pipes are created in non-blocking mode
// (for the IPC channel). This causes readSync/writeSync to get
// EAGAIN, requiring costly 1ms sleeps per retry. Setting
// blocking mode ensures readSync blocks properly until data
// arrives, matching the behavior of the native libsyncrpc.
stdout._handle.setBlocking?.(true);
stdin._handle.setBlocking?.(true);
// Prevent Node's event-loop from reading stdout or keeping the
// process alive – we will use fs.readSync exclusively.
stdout.pause();
stdout.unref();
stdin.unref();
}
// Track for auto-cleanup on process exit.
liveChildren.add(this.child);
this.child.unref();
}
// ── Public API ──────────────────────────────────────────────────
/**
* Send a request and synchronously wait for the response (string).
* Handles Call (callback) messages from the child inline.
*/
requestSync(method, payload) {
this.ensureOpen();
const result = this.requestBytesSync(method, payload);
return result.toString("utf-8");
}
/**
* Send a request and synchronously wait for the response (binary).
* Handles Call (callback) messages from the child inline.
*/
requestBinarySync(method, payload) {
this.ensureOpen();
return this.requestBytesSync(method, payload);
}
/** Register a string→string callback that the child may invoke. */
registerCallback(name, callback) {
this.callbacks.set(name, callback);
}
/** Kill the child process and release resources. */
close() {
try {
liveChildren.delete(this.child);
if (this.pipeFd !== undefined) {
closeSync(this.pipeFd);
this.pipeFd = undefined;
}
// Destroy the stdio streams so that their pipe handles are closed
// and no longer prevent the event loop from draining.
this.child.stdout?.destroy();
this.child.stdin?.destroy();
this.child.kill();
this.readFd = -1;
this.writeFd = -1;
}
catch {
// swallow – process may already be dead
}
}
// ── Core request loop ───────────────────────────────────────────
ensureOpen() {
if (this.readFd < 0) {
throw new Error("SyncRpcChannel is closed");
}
}
getMethodBuf(method) {
let buf = this.methodBufCache.get(method);
if (buf === undefined) {
buf = Buffer.from(method, "utf-8");
this.methodBufCache.set(method, buf);
}
return buf;
}
requestBytesSync(method, payload) {
const methodBuf = this.getMethodBuf(method);
if (this.collectTiming) {
this.lastBytesSent = typeof payload === "string"
? Buffer.byteLength(payload, "utf-8")
: payload.length;
this.lastBytesReceived = 0;
}
this.writeTuple(MSG_REQUEST, methodBuf, payload);
for (;;) {
this.readTuple();
switch (this._msgType) {
case MSG_RESPONSE: {
// Compare raw bytes instead of decoding to string.
if (!methodBuf.equals(this._msgName)) {
throw new Error(`name mismatch for response: expected \`${method}\`, got \`${this._msgName.toString("utf-8")}\``);
}
if (this.collectTiming) {
this.lastBytesReceived = this._msgPayload.length;
}
return this._msgPayload;
}
case MSG_ERROR: {
if (methodBuf.equals(this._msgName)) {
throw new Error(this._msgPayload.toString("utf-8"));
}
throw new Error(`name mismatch for response: expected \`${method}\`, got \`${this._msgName.toString("utf-8")}\``);
}
case MSG_CALL: {
this.handleCall(this._msgName.toString("utf-8"), this._msgPayload);
break;
}
default:
throw new Error(`Invalid message type from child: ${this._msgType}`);
}
}
}
// ── Callback handling ───────────────────────────────────────────
/**
* Handle an incoming MSG_CALL from the child process.
*
* After sending the error response back to the child, this method
* intentionally re-throws to abort the caller's request loop.
* A failed callback is treated as unrecoverable to match the
* behavior of the native libsyncrpc addon.
*/
handleCall(name, payload) {
const cb = this.callbacks.get(name);
if (!cb) {
const errMsg = `unknown callback: \`${name}\`. Please make sure to register it on the JavaScript side before invoking it.`;
this.writeTuple(MSG_CALL_ERROR, Buffer.from(name, "utf-8"), Buffer.from(errMsg, "utf-8"));
throw new Error(`no callback named \`${name}\` found`);
}
try {
const result = cb(name, payload.toString("utf-8"));
this.writeTuple(MSG_CALL_RESPONSE, Buffer.from(name, "utf-8"), Buffer.from(result, "utf-8"));
}
catch (e) {
const errMsg = String(e instanceof Error ? e.message : e).trim();
this.writeTuple(MSG_CALL_ERROR, Buffer.from(name, "utf-8"), Buffer.from(errMsg, "utf-8"));
throw new Error(`Error calling callback \`${name}\`: ${errMsg}`);
}
}
// ── MessagePack tuple write ─────────────────────────────────────
/**
* Write a complete [type, name, payload] tuple in as few writeSync
* calls as possible. For messages that fit in the pre-allocated
* write buffer (64 KB), everything is assembled and sent in a single
* syscall. Larger messages use two syscalls: one for the header
* portion and one for the payload data.
*/
writeTuple(type, name, payload) {
const nameLen = name.length;
const payloadIsString = typeof payload === "string";
const payloadLen = payloadIsString ? Buffer.byteLength(payload, "utf-8") : payload.length;
const nameHdrSize = binHeaderSize(nameLen);
const payloadHdrSize = binHeaderSize(payloadLen);
const headerSize = 2 + nameHdrSize + nameLen + payloadHdrSize;
const totalSize = headerSize + payloadLen;
if (totalSize <= this.writeBuf.length) {
// Small message: assemble into write buffer, one syscall
let off = 0;
this.writeBuf[off++] = MSGPACK_FIXARRAY3;
this.writeBuf[off++] = type;
off = writeBinHeader(this.writeBuf, off, nameLen);
name.copy(this.writeBuf, off);
off += nameLen;
off = writeBinHeader(this.writeBuf, off, payloadLen);
if (payloadLen > 0) {
if (payloadIsString) {
// Encode string directly into write buffer — avoids
// Buffer.from(string, 'utf-8') allocation entirely.
this.writeBuf.write(payload, off, payloadLen, "utf-8");
}
else if (payload instanceof Buffer) {
payload.copy(this.writeBuf, off);
}
else {
this.writeBuf.set(payload, off);
}
}
this.writeAllBuf(this.writeBuf, totalSize);
}
else {
// Large message: header + name in one call, payload in another
let off = 0;
this.writeBuf[off++] = MSGPACK_FIXARRAY3;
this.writeBuf[off++] = type;
off = writeBinHeader(this.writeBuf, off, nameLen);
name.copy(this.writeBuf, off);
off += nameLen;
off = writeBinHeader(this.writeBuf, off, payloadLen);
this.writeAllBuf(this.writeBuf, off);
if (payloadLen > 0) {
if (payloadIsString) {
// Large string: must allocate (can't stream-encode
// across multiple writeSync calls).
this.writeAllBuf(Buffer.from(payload, "utf-8"));
}
else {
this.writeAllBuf(payload);
}
}
}
}
// ── MessagePack tuple read ──────────────────────────────────────
/**
* Read a [type, name, payload] tuple into instance fields
* (_msgType, _msgName, _msgPayload) to avoid allocating a
* short-lived 3-element array on every call.
*/
readTuple() {
// Fixed 3-element array marker
const marker = this.readByte();
if (marker !== MSGPACK_FIXARRAY3) {
throw new Error(`Expected fixed 3-element array (0x93), received: 0x${marker.toString(16)}`);
}
// Message type – positive fixint or uint8
const tb = this.readByte();
if (tb <= 0x7f) {
this._msgType = tb;
}
else if (tb === MSGPACK_UINT8) {
this._msgType = this.readByte();
}
else {
throw new Error(`Expected positive fixint or uint8 marker, received: 0x${tb.toString(16)}`);
}
this._msgName = this.readBin();
this._msgPayload = this.readBin();
}
/**
* Read a MessagePack bin field.
*/
readBin() {
const marker = this.readByte();
let size;
switch (marker) {
case MSGPACK_BIN8:
size = this.readByte();
break;
case MSGPACK_BIN16:
this.readExactInto(this.headerBuf, 2);
size = (this.headerBuf[0] << 8) | this.headerBuf[1];
break;
case MSGPACK_BIN32:
this.readExactInto(this.headerBuf, 4);
size = this.headerBuf.readUInt32BE(0);
break;
default:
throw new Error(`Expected binary data (0xc4-0xc6), received: 0x${marker.toString(16)}`);
}
if (size === 0)
return EMPTY_BUF;
return this.readExact(size);
}
// ── Low-level synchronous I/O ───────────────────────────────────
/** Build an EOF error with the child's exit code/signal if available. */
eofError() {
const code = this.child.exitCode;
const signal = this.child.signalCode;
const detail = signal ? `killed by signal ${signal}` : code !== null ? `exited with code ${code}` : "unknown reason";
return new Error(`Unexpected EOF while reading from child process (${detail})`);
}
/** Read a single byte from the buffered read-ahead. */
readByte() {
if (this.readBufPos >= this.readBufLen) {
this.fillReadBuffer();
}
return this.readBuf[this.readBufPos++];
}
readExact(length) {
// Use allocUnsafeSlow (not allocUnsafe) so the buffer has its own
// backing ArrayBuffer at byteOffset 0. This is critical because
// callers such as RemoteSourceFile create DataView/Uint8Array over
// buffer.buffer with absolute offsets. Buffer.allocUnsafe returns
// slices of a shared pool whose byteOffset is non-zero, corrupting
// those downstream views.
//
// allocUnsafeSlow (vs alloc) skips zero-fill, which matters for
// large transfers — e.g. checker.ts at ~57 MB saves ~5 ms of
// unnecessary memset. The buffer is immediately filled by
// readExactInto so uninitialized memory is never exposed.
const buf = Buffer.allocUnsafeSlow(length);
this.readExactInto(buf, length);
return buf;
}
/**
* Fill the internal read-ahead buffer from the pipe fd.
* Retries on EAGAIN for non-blocking mode compatibility.
*/
fillReadBuffer() {
this.readBufPos = 0;
this.readBufLen = 0;
for (;;) {
try {
const n = readSync(this.readFd, this.readBuf, 0, this.readBuf.length, null);
if (n === 0) {
throw this.eofError();
}
this.readBufLen = n;
return;
}
catch (e) {
if (e instanceof Error && ("code" in e) && (e.code === "EAGAIN" || e.code === "EWOULDBLOCK")) {
Atomics.wait(sleepBuf, 0, 0, 1);
continue;
}
throw e;
}
}
}
/**
* Synchronously read exactly `length` bytes into `buffer`.
* Serves from the internal read-ahead buffer first; for large reads
* that exceed the buffer size, reads directly from the fd to avoid
* an extra copy.
*/
readExactInto(buffer, length) {
let pos = 0;
while (pos < length) {
const avail = this.readBufLen - this.readBufPos;
if (avail > 0) {
// Serve from read-ahead buffer
const toCopy = Math.min(avail, length - pos);
this.readBuf.copy(buffer, pos, this.readBufPos, this.readBufPos + toCopy);
this.readBufPos += toCopy;
pos += toCopy;
}
else if (length - pos >= this.readBuf.length) {
// Remaining data is larger than read buffer; read directly
// into the target to avoid unnecessary copying.
try {
const n = readSync(this.readFd, buffer, pos, length - pos, null);
if (n === 0) {
throw this.eofError();
}
pos += n;
}
catch (e) {
if (e instanceof Error && ("code" in e) && (e.code === "EAGAIN" || e.code === "EWOULDBLOCK")) {
Atomics.wait(sleepBuf, 0, 0, 1);
continue;
}
throw e;
}
}
else {
// Refill the read-ahead buffer
this.fillReadBuffer();
}
}
}
/**
* Synchronously write all bytes from `data` (up to `length`).
* Retries on EAGAIN.
*/
writeAllBuf(data, length) {
const total = length ?? data.length;
let pos = 0;
while (pos < total) {
try {
const n = writeSync(this.writeFd, data, pos, total - pos);
pos += n;
}
catch (e) {
if (e instanceof Error && ("code" in e) && (e.code === "EAGAIN" || e.code === "EWOULDBLOCK")) {
Atomics.wait(sleepBuf, 0, 0, 1);
continue;
}
throw e;
}
}
}
}
//# sourceMappingURL=syncChannel.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"syncChannel.js","sourceRoot":"","sources":["../../src/api/syncChannel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEH,KAAK,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,GACZ,MAAM,SAAS,CAAC;AAqBjB,OAAO,EACH,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,cAAc,GACjB,MAAM,mBAAmB,CAAC;AAE3B,wEAAwE;AACxE,mCAAmC;AACnC,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,iCAAiC;AACjC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,mEAAmE;AACnE,kCAAkC;AAClC,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1D,mEAAmE;AACnE,yBAAyB;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAElC,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,gEAAgE;AAChE,MAAM,YAAY,GAAG,IAAI,GAAG,EAAgB,CAAC;AAE7C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QAC/B,IAAI,CAAC;YACD,KAAK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CAAC;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,MAAc,EAAE,OAAmB;QACjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,mEAAmE;IACnE,gBAAgB,CAAC,IAAY,EAAE,QAAmD;QAC9E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED,oDAAoD;IACpD,KAAK;QACD,IAAI,CAAC;YACD,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC5B,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YAC5B,CAAC;YACD,kEAAkE;YAClE,sDAAsD;YACtD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QACtB,CAAC;QACD,MAAM,CAAC;YACH,wCAAwLine truncated
+175
View File
@@ -0,0 +1,175 @@
/**
* Client-side collection of per-request timing and transfer measurements.
*
* When enabled, each request records its round-trip latency and the number of
* payload bytes sent and received, accumulated into running totals and a
* fixed-size ring buffer of the most recent requests.
*
* The server measures its own per-request processing time independently. When a
* timing snapshot is requested, the client fetches the server's collection via
* a `getServerTiming` request and folds it into the returned {@link TimingInfo},
* yielding per-request and total server processing time and an estimated
* transport overhead (round-trip minus server processing time). Normal response
* messages are left unchanged.
*/
/** Number of most-recent requests retained in the ring buffer. */
export declare const RECENT_REQUEST_CAPACITY = 5;
/** A single request's measured timing and transfer sample. */
export interface RequestTiming {
/** The API method that was invoked. */
method: string;
/** Wall-clock round-trip time measured by the client, in milliseconds. */
roundTripMs: number;
/** Number of request payload bytes sent to the server. */
bytesSent: number;
/** Number of response payload bytes received from the server. */
bytesReceived: number;
/** Wall-clock timestamp ({@link Date.now}) captured when the request completed. */
timestamp: number;
/**
* Server-side processing time for this request, in milliseconds, as folded
* in from the server's own timing collection. Undefined when server timing
* for the request could not be matched.
*/
serverTimeMs?: number;
/**
* Estimated transport overhead for this request, in milliseconds
* (`roundTripMs - serverTimeMs`, clamped to be non-negative). Present
* exactly when {@link serverTimeMs} is.
*/
transportOverheadMs?: number;
}
/** Running totals accumulated across every measured request. */
export interface TimingAccumulators {
/** Number of requests measured. */
requestCount: number;
/** Sum of round-trip latencies, in milliseconds. */
roundTripMs: number;
/** Sum of request payload bytes sent. */
bytesSent: number;
/** Sum of response payload bytes received. */
bytesReceived: number;
/** Sum of server-side processing time, in milliseconds. */
serverTimeMs: number;
/**
* Estimated total transport overhead, in milliseconds
* (`roundTripMs - serverTimeMs`, clamped to be non-negative).
*/
transportOverheadMs: number;
/**
* Number of AST nodes materialized from binary source-file responses as the
* client walked the returned trees. Materialization is lazy and happens on
* demand, so this accrues after the originating request completes.
*/
nodesMaterialized: number;
/**
* Number of source files fetched from the server (each decoded into a
* lazily-materialized tree).
*/
sourceFilesFetched: number;
/**
* Number of AST nodes across all fetched source files that can be
* materialized on demand. Each fetched file contributes its full node count
* (excluding the pre-materialized source-file node), whether or not those
* nodes are ever walked. Serves as the denominator for the share of fetched
* nodes that end up materialized (`nodesMaterialized / nodesFetched`).
*/
nodesFetched: number;
}
/** A point-in-time snapshot of collected timing information. */
export interface TimingInfo {
/** Whether timing collection is enabled for this API instance. */
enabled: boolean;
/** Running totals across every measured request. */
totals: TimingAccumulators;
/**
* The most recent requests, up to {@link RECENT_REQUEST_CAPACITY}, ordered
* from oldest to newest.
*/
recentRequests: RequestTiming[];
}
/** A raw measurement handed to {@link TimingCollector.record}. */
export interface TimingSample {
method: string;
roundTripMs: number;
bytesSent: number;
bytesReceived: number;
}
/**
* A single server-side request's processing-time sample, as returned by a
* `getServerTiming` request. This is an internal wire shape; consumers see the
* folded-in {@link RequestTiming.serverTimeMs}.
*/
export interface ServerRequestTiming {
/** The API method that was handled. */
method: string;
/** Server-side processing time, in milliseconds. */
processingTimeMs: number;
/** Unix timestamp in milliseconds captured when the request completed. */
timestamp: number;
}
/** Running totals accumulated on the server across every handled request. */
export interface ServerTimingTotals {
/** Total number of requests handled. */
requestCount: number;
/** Sum of server-side processing time, in milliseconds. */
totalProcessingTimeMs: number;
}
/**
* A snapshot of the server's own timing collection, retrieved via a
* `getServerTiming` request. This is an internal wire shape used to compute the
* server-derived fields of {@link TimingInfo}.
*/
export interface ServerTimingInfo {
/** Whether server-side timing collection is enabled. */
enabled: boolean;
/** Running totals across every request the server handled. */
totals: ServerTimingTotals;
/**
* The most recent requests as seen by the server, ordered from oldest to
* newest.
*/
recentRequests: ServerRequestTiming[];
}
/** Returns a snapshot representing a disabled (never-collecting) timing state. */
export declare function disabledTimingInfo(): TimingInfo;
/** Returns a snapshot representing disabled server-side timing collection. */
export declare function disabledServerTimingInfo(): ServerTimingInfo;
/**
* Folds a server-side timing snapshot into a client-side snapshot, producing a
* combined {@link TimingInfo} with per-request and total server processing time
* plus estimated transport overhead.
*
* Recent requests are paired newest-to-newest and only matched when the method
* names agree, so that requests recorded by only one side (e.g. the meta
* requests used to fetch timing) do not misalign the two ring buffers.
*/
export declare function combineTimingInfo(client: TimingInfo, server: ServerTimingInfo): TimingInfo;
/**
* Accumulates request timing samples into running totals and a fixed-size ring
* buffer of the most recent requests.
*/
export declare class TimingCollector {
private totals;
private ring;
private head;
/** Records a single request's measurements. */
record(sample: TimingSample): void;
/**
* Records a single AST node materialization. Called on demand as the consumer
* walks a binary source-file response's tree, so it is not tied to any one
* request.
*/
recordMaterialization(): void;
/**
* Records a fetched source file: increments the fetched-file counter and adds
* the file's materializable node count to the fetched-node total, which serves
* as the denominator for the share of fetched nodes that end up materialized.
*/
recordSourceFileFetched(materializableNodeCount: number): void;
/** Returns a snapshot of the collected timing information. */
getInfo(): TimingInfo;
/** Clears all accumulated totals and recent-request history. */
reset(): void;
}
//# sourceMappingURL=timing.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/api/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC1B,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IAC/B,mCAAmC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC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B1F;AAED;;;GAGG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,MAAM,CAA2C;IAGzD,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,IAAI,CAAK;IAEjB,+CAA+C;IAC/C,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAuBlC;;;;OAIG;IACH,qBAAqB,IAAI,IAAI;IAI7B;;;;OAIG;IACH,uBAAuB,CAAC,uBAAuB,EAAE,MAAM,GAAG,IAAI;IAK9D,8DAA8D;IAC9D,OAAO,IAAI,UAAU;IAYrB,gEAAgE;IAChE,KAAK,IAAI,IAAI;CAKhB"}
+149
View File
@@ -0,0 +1,149 @@
/**
* Client-side collection of per-request timing and transfer measurements.
*
* When enabled, each request records its round-trip latency and the number of
* payload bytes sent and received, accumulated into running totals and a
* fixed-size ring buffer of the most recent requests.
*
* The server measures its own per-request processing time independently. When a
* timing snapshot is requested, the client fetches the server's collection via
* a `getServerTiming` request and folds it into the returned {@link TimingInfo},
* yielding per-request and total server processing time and an estimated
* transport overhead (round-trip minus server processing time). Normal response
* messages are left unchanged.
*/
/** Number of most-recent requests retained in the ring buffer. */
export const RECENT_REQUEST_CAPACITY = 5;
function emptyAccumulators() {
return {
requestCount: 0,
roundTripMs: 0,
bytesSent: 0,
bytesReceived: 0,
serverTimeMs: 0,
transportOverheadMs: 0,
nodesMaterialized: 0,
sourceFilesFetched: 0,
nodesFetched: 0,
};
}
/** Returns a snapshot representing a disabled (never-collecting) timing state. */
export function disabledTimingInfo() {
return {
enabled: false,
totals: emptyAccumulators(),
recentRequests: [],
};
}
/** Returns a snapshot representing disabled server-side timing collection. */
export function disabledServerTimingInfo() {
return {
enabled: false,
totals: { requestCount: 0, totalProcessingTimeMs: 0 },
recentRequests: [],
};
}
/**
* Folds a server-side timing snapshot into a client-side snapshot, producing a
* combined {@link TimingInfo} with per-request and total server processing time
* plus estimated transport overhead.
*
* Recent requests are paired newest-to-newest and only matched when the method
* names agree, so that requests recorded by only one side (e.g. the meta
* requests used to fetch timing) do not misalign the two ring buffers.
*/
export function combineTimingInfo(client, server) {
if (!client.enabled) {
return client;
}
const serverTimeMs = server.totals.totalProcessingTimeMs;
const totals = {
...client.totals,
serverTimeMs,
transportOverheadMs: Math.max(0, client.totals.roundTripMs - serverTimeMs),
};
const recentRequests = client.recentRequests.map(r => ({ ...r }));
const serverRecent = server.recentRequests;
const pairs = Math.min(recentRequests.length, serverRecent.length);
for (let i = 1; i <= pairs; i++) {
const c = recentRequests[recentRequests.length - i];
const s = serverRecent[serverRecent.length - i];
if (c.method === s.method) {
c.serverTimeMs = s.processingTimeMs;
c.transportOverheadMs = Math.max(0, c.roundTripMs - s.processingTimeMs);
}
}
return {
enabled: true,
totals,
recentRequests,
};
}
/**
* Accumulates request timing samples into running totals and a fixed-size ring
* buffer of the most recent requests.
*/
export class TimingCollector {
totals = emptyAccumulators();
// Ring buffer of the most recent requests. `ring` grows to at most
// RECENT_REQUEST_CAPACITY; once full, `head` marks the oldest entry.
ring = [];
head = 0;
/** Records a single request's measurements. */
record(sample) {
this.totals.requestCount++;
this.totals.roundTripMs += sample.roundTripMs;
this.totals.bytesSent += sample.bytesSent;
this.totals.bytesReceived += sample.bytesReceived;
const entry = {
method: sample.method,
roundTripMs: sample.roundTripMs,
bytesSent: sample.bytesSent,
bytesReceived: sample.bytesReceived,
timestamp: Date.now(),
};
if (this.ring.length < RECENT_REQUEST_CAPACITY) {
this.ring.push(entry);
}
else {
this.ring[this.head] = entry;
this.head = (this.head + 1) % RECENT_REQUEST_CAPACITY;
}
}
/**
* Records a single AST node materialization. Called on demand as the consumer
* walks a binary source-file response's tree, so it is not tied to any one
* request.
*/
recordMaterialization() {
this.totals.nodesMaterialized++;
}
/**
* Records a fetched source file: increments the fetched-file counter and adds
* the file's materializable node count to the fetched-node total, which serves
* as the denominator for the share of fetched nodes that end up materialized.
*/
recordSourceFileFetched(materializableNodeCount) {
this.totals.sourceFilesFetched++;
this.totals.nodesFetched += materializableNodeCount;
}
/** Returns a snapshot of the collected timing information. */
getInfo() {
const recentRequests = [];
for (let i = 0; i < this.ring.length; i++) {
recentRequests.push(this.ring[(this.head + i) % this.ring.length]);
}
return {
enabled: true,
totals: { ...this.totals },
recentRequests,
};
}
/** Clears all accumulated totals and recent-request history. */
reset() {
this.totals = emptyAccumulators();
this.ring = [];
this.head = 0;
}
}
//# sourceMappingURL=timing.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"timing.js","sourceRoot":"","sources":["../../src/api/timing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AA8HzC,SAAS,iBAAiB;IACtB,OAAO;QACH,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,CAAC;QACZ,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,CAAC;QACf,mBAAmB,EAAE,CAAC;QACtB,iBAAiB,EAAE,CAAC;QACpB,kBAAkB,EAAE,CAAC;QACrB,YAAY,EAAE,CAAC;KAClB,CAAC;AACN,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,kBAAkB;IAC9B,OAAO;QACH,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,iBAAiB,EAAE;QAC3B,cAAc,EAAE,EAAE;KACrB,CAAC;AACN,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,wBAAwB;IACpC,OAAO;QACH,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE;QACrD,cAAc,EAAE,EAAE;KACrB,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAkB,EAAE,MAAwB;IAC1E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,YAAY,GA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AK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,OAAO;YACH,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;YAC1B,cAAc;SACjB,CAAC;IACN,CAAC;IAED,gEAAgE;IAChE,KAAK;QACD,IAAI,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAClB,CAAC;CACJ"}
+100
View File
@@ -0,0 +1,100 @@
import type { InternalSymbolName } from "#enums/internalSymbolName";
import type { LanguageVariant } from "#enums/languageVariant";
import type { NodeFlags } from "#enums/nodeFlags";
import type { ScriptKind } from "#enums/scriptKind";
import { SyntaxKind } from "#enums/syntaxKind";
import type { EndOfFile, EntityName, Identifier, KeywordSyntaxKind, ModifierSyntaxKind, PropertyAccessExpression, PunctuationSyntaxKind, Statement, ThisExpression, Token } from "./ast.generated.ts";
export { SyntaxKind } from "#enums/syntaxKind";
export { TokenFlags } from "#enums/tokenFlags";
export * from "./ast.generated.ts";
export type Path = string & {
__pathBrand: any;
};
/**
* The escaped form of a symbol/identifier name. Internal compiler names are
* prefixed with `__` (e.g. `__type`, `__call`), and user names that already
* begin with `__` carry an extra leading underscore. Use
* {@link unescapeLeadingUnderscores} to recover the display name and
* {@link escapeLeadingUnderscores} to produce a key from a display name.
*/
export type __String = (string & {
__escapedIdentifier: void;
}) | InternalSymbolName;
export interface TextRange {
pos: number;
end: number;
}
export interface ReadonlyTextRange {
readonly pos: number;
readonly end: number;
}
export interface NodeArray<T extends Node> extends ReadonlyArray<T>, ReadonlyTextRange {
hasTrailingComma?: boolean;
transformFlags: number;
}
export interface Node extends ReadonlyTextRange {
readonly kind: SyntaxKind;
readonly flags: NodeFlags;
readonly parent: Node;
readonly jsDoc?: readonly Node[] | undefined;
forEachChild<T>(visitor: (node: Node) => T, visitArray?: (nodes: NodeArray<Node>) => T): T | undefined;
getSourceFile(): SourceFile;
getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number;
getFullStart(): number;
getEnd(): number;
getWidth(sourceFile?: SourceFile): number;
getFullWidth(): number;
getLeadingTriviaWidth(sourceFile?: SourceFile): number;
getFullText(sourceFile?: SourceFile): string;
getText(sourceFile?: SourceFile): string;
}
export interface FileReference extends TextRange {
readonly fileName: string;
readonly resolutionMode: number;
readonly preserve: boolean;
}
export interface LineAndCharacter {
/** 0-based line number. */
readonly line: number;
/** 0-based character offset, in UTF-16 code units, from the start of the line. */
readonly character: number;
}
export interface SourceFile extends Node {
readonly kind: SyntaxKind.SourceFile;
readonly statements: NodeArray<Statement>;
readonly endOfFileToken: EndOfFile;
readonly text: string;
readonly fileName: string;
readonly path: Path;
readonly languageVariant: LanguageVariant;
readonly scriptKind: ScriptKind;
readonly isDeclarationFile: boolean;
readonly referencedFiles: readonly FileReference[];
readonly typeReferenceDirectives: readonly FileReference[];
readonly libReferenceDirectives: readonly FileReference[];
readonly imports: readonly Node[];
readonly moduleAugmentations: readonly Node[];
readonly ambientModuleNames: readonly string[];
readonly externalModuleIndicator: Node | true | undefined;
/** Returns the UTF-16 code unit offset of the start of each line. */
getLineStarts(): readonly number[];
/** Converts a UTF-16 code unit position into a 0-based line and character. */
getLineAndCharacterOfPosition(position: number): LineAndCharacter;
/** Converts a 0-based line and character into a UTF-16 code unit position. */
getPositionOfLineAndCharacter(line: number, character: number): number;
/** @internal */
tokenCache?: Map<string, Node>;
}
export type PunctuationToken<TKind extends PunctuationSyntaxKind> = Token<TKind>;
export type KeywordToken<TKind extends KeywordSyntaxKind> = Token<TKind>;
export type ModifierToken<TKind extends ModifierSyntaxKind> = KeywordToken<TKind>;
export interface PropertyAccessEntityNameExpression extends PropertyAccessExpression {
readonly expression: EntityNameExpression;
readonly name: Identifier;
}
export type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression;
export type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression;
export interface JsxTagNamePropertyAccess extends PropertyAccessExpression {
readonly expression: Identifier | ThisExpression | JsxTagNamePropertyAccess;
}
//# sourceMappingURL=ast.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast/ast.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,SAAS,EACT,cAAc,EACd,KAAK,EACR,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,cAAc,oBAAoB,CAAC;AAInC,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG;IAAE,WAAW,EAAE,GAAG,CAAC;CAAE,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,GAAG;IAAE,mBAAmB,EAAE,IAAI,CAAC;CAAE,CAAC,GAAG,kBAAkB,CAAC;AAEtF,MAAM,WAAW,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SAAS,CAAC;IAC1D,qEAAqE;IACrE,aAAa,IAAI,SAAS,MAAM,EAAE,CAAC;IACnC,8EAA8E;IAC9E,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAClE,8EAA8E;IAC9E,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACvE,gBAAgB;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAClC;AAID,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,qBAAqB,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AACjF,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,iBAAiB,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AACzE,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,kBAAkB,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AAIlF,MAAM,WAAW,kCAAmC,SAAQ,wBAAwB;IAChF,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,kCAAkC,CAAC;AACnF,MAAM,MAAM,gCAAgC,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAEjF,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACtE,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,cAAc,GAAG,wBAAwB,CAAC;CAC/E"}
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ast.generated.d.ts","sourceRoot":"","sources":["../../src/ast/ast.generated.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAA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