@swc-next/generator 0.0.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024 SWC contributors.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @swc-next/generator
2
+
3
+ A JavaScript and TypeScript code generator written in Rust. Generate source from ESTree-based ASTs with SWC Next.
4
+
5
+ ## Documentation
6
+
7
+ See the [Generator API documentation](https://next.swc.rs/api/javascript/generator) for details.
@@ -0,0 +1,31 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export interface GenerateOutput {
4
+ code: string
5
+ }
6
+
7
+ /**
8
+ * JavaScript code generation options.
9
+ *
10
+ * Standalone generation prints a caller-supplied AST, which commonly lacks
11
+ * original source text and reliable comment attachments. Comment preservation
12
+ * and source maps are therefore provided by the source-to-source transform and
13
+ * minify APIs instead of this AST-only API.
14
+ */
15
+ export interface GeneratorConfig {
16
+ asciiOnly?: boolean
17
+ /** Escape closing script tags. Tagged template raw text is preserved. */
18
+ inlineScript?: boolean
19
+ /** Print compact code independently of AST compression and mangling. */
20
+ minify?: boolean
21
+ }
22
+ /**
23
+ * Internal binding API and binary protocol, not covered by semver. Use a matching SWC Next wrapper.
24
+ *
25
+ * # Safety
26
+ *
27
+ * Sections must be produced by the matching JavaScript encoder and satisfy
28
+ * the validity, alignment, and immutability contracts of
29
+ * `swc_next_core::js::generator::generate_from_parts`.
30
+ */
31
+ export declare function generateSync(header: Uint8Array, spans: Uint8Array, kinds: Uint8Array, payloads: Uint8Array, extra: Uint8Array, strings: Uint8Array, options: number): string
@@ -0,0 +1 @@
1
+ import{createRequire as e}from"module";let require=e(import.meta.url);new URL(".",import.meta.url).pathname;let{readFileSync:r}=require("fs"),nativeBinding=null,loadErrors=[],isMusl=()=>{let e=!1;return"linux"===process.platform&&(null===(e=isMuslFromFilesystem())&&(e=isMuslFromReport()),null===e&&(e=isMuslFromChildProcess())),e},isFileMusl=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),isMuslFromFilesystem=()=>{try{return r("/usr/bin/ldd","utf-8").includes("musl")}catch{return null}},isMuslFromReport=()=>{let e=null;return(process.report&&"function"==typeof process.report.getReport&&(process.report.excludeNetwork=!0,e=process.report.getReport()),e)?(!e.header||!e.header.glibcVersionRuntime)&&!!(Array.isArray(e.sharedObjects)&&e.sharedObjects.some(isFileMusl)):null},isMuslFromChildProcess=()=>{try{return require("child_process").execSync("ldd --version",{encoding:"utf8"}).includes("musl")}catch(e){return!1}};nativeBinding=function(){if(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)try{return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)}catch(e){loadErrors.push(e)}else if("android"===process.platform)if("arm64"===process.arch){try{return require("./swc-next-generator.android-arm64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-android-arm64"),r=require("@swc-next/generator-binding-android-arm64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm"===process.arch){try{return require("./swc-next-generator.android-arm-eabi.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-android-arm-eabi"),r=require("@swc-next/generator-binding-android-arm-eabi/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else loadErrors.push(Error(`Unsupported architecture on Android ${process.arch}`));else if("win32"===process.platform)if("x64"===process.arch){try{return require("./swc-next-generator.win32-x64-msvc.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-win32-x64-msvc"),r=require("@swc-next/generator-binding-win32-x64-msvc/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("ia32"===process.arch){try{return require("./swc-next-generator.win32-ia32-msvc.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-win32-ia32-msvc"),r=require("@swc-next/generator-binding-win32-ia32-msvc/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm64"===process.arch){try{return require("./swc-next-generator.win32-arm64-msvc.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-win32-arm64-msvc"),r=require("@swc-next/generator-binding-win32-arm64-msvc/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else loadErrors.push(Error(`Unsupported architecture on Windows: ${process.arch}`));else if("darwin"===process.platform){try{return require("./swc-next-generator.darwin-universal.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-darwin-universal"),r=require("@swc-next/generator-binding-darwin-universal/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}if("x64"===process.arch){try{return require("./swc-next-generator.darwin-x64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-darwin-x64"),r=require("@swc-next/generator-binding-darwin-x64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm64"===process.arch){try{return require("./swc-next-generator.darwin-arm64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-darwin-arm64"),r=require("@swc-next/generator-binding-darwin-arm64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else loadErrors.push(Error(`Unsupported architecture on macOS: ${process.arch}`))}else if("freebsd"===process.platform)if("x64"===process.arch){try{return require("./swc-next-generator.freebsd-x64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-freebsd-x64"),r=require("@swc-next/generator-binding-freebsd-x64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm64"===process.arch){try{return require("./swc-next-generator.freebsd-arm64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-freebsd-arm64"),r=require("@swc-next/generator-binding-freebsd-arm64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else loadErrors.push(Error(`Unsupported architecture on FreeBSD: ${process.arch}`));else if("linux"===process.platform)if("x64"===process.arch)if(isMusl()){try{return require("./swc-next-generator.linux-x64-musl.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-x64-musl"),r=require("@swc-next/generator-binding-linux-x64-musl/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else{try{return require("./swc-next-generator.linux-x64-gnu.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-x64-gnu"),r=require("@swc-next/generator-binding-linux-x64-gnu/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm64"===process.arch)if(isMusl()){try{return require("./swc-next-generator.linux-arm64-musl.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-arm64-musl"),r=require("@swc-next/generator-binding-linux-arm64-musl/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else{try{return require("./swc-next-generator.linux-arm64-gnu.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-arm64-gnu"),r=require("@swc-next/generator-binding-linux-arm64-gnu/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm"===process.arch)if(isMusl()){try{return require("./swc-next-generator.linux-arm-musleabihf.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-arm-musleabihf"),r=require("@swc-next/generator-binding-linux-arm-musleabihf/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else{try{return require("./swc-next-generator.linux-arm-gnueabihf.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-arm-gnueabihf"),r=require("@swc-next/generator-binding-linux-arm-gnueabihf/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("loong64"===process.arch)if(isMusl()){try{return require("./swc-next-generator.linux-loong64-musl.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-loong64-musl"),r=require("@swc-next/generator-binding-linux-loong64-musl/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else{try{return require("./swc-next-generator.linux-loong64-gnu.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-loong64-gnu"),r=require("@swc-next/generator-binding-linux-loong64-gnu/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("riscv64"===process.arch)if(isMusl()){try{return require("./swc-next-generator.linux-riscv64-musl.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-riscv64-musl"),r=require("@swc-next/generator-binding-linux-riscv64-musl/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else{try{return require("./swc-next-generator.linux-riscv64-gnu.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-riscv64-gnu"),r=require("@swc-next/generator-binding-linux-riscv64-gnu/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("ppc64"===process.arch){try{return require("./swc-next-generator.linux-ppc64-gnu.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-ppc64-gnu"),r=require("@swc-next/generator-binding-linux-ppc64-gnu/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("s390x"===process.arch){try{return require("./swc-next-generator.linux-s390x-gnu.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-linux-s390x-gnu"),r=require("@swc-next/generator-binding-linux-s390x-gnu/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else loadErrors.push(Error(`Unsupported architecture on Linux: ${process.arch}`));else if("openharmony"===process.platform)if("arm64"===process.arch){try{return require("./swc-next-generator.openharmony-arm64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-openharmony-arm64"),r=require("@swc-next/generator-binding-openharmony-arm64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("x64"===process.arch){try{return require("./swc-next-generator.openharmony-x64.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-openharmony-x64"),r=require("@swc-next/generator-binding-openharmony-x64/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else if("arm"===process.arch){try{return require("./swc-next-generator.openharmony-arm.node")}catch(e){loadErrors.push(e)}try{let e=require("@swc-next/generator-binding-openharmony-arm"),r=require("@swc-next/generator-binding-openharmony-arm/package.json").version;if("0.7.0"!==r&&process.env.NAPI_RS_ENFORCE_VERSION_CHECK&&"0"!==process.env.NAPI_RS_ENFORCE_VERSION_CHECK)throw Error(`Native binding package version mismatch, expected 0.7.0 but got ${r}. You can reinstall dependencies to fix this issue.`);return e}catch(e){loadErrors.push(e)}}else loadErrors.push(Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));else loadErrors.push(Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))}();let forceWasi="true"===process.env.NAPI_RS_FORCE_WASI||"error"===process.env.NAPI_RS_FORCE_WASI;if(!nativeBinding||forceWasi){let e=null,r=null;try{nativeBinding=e=require("./swc-next-generator.node.mjs")}catch(e){forceWasi&&(r=e)}if(!nativeBinding||forceWasi)try{nativeBinding=e=require("@swc-next/generator-binding-wasm")}catch(e){forceWasi&&(r?r.cause=e:r=e,loadErrors.push(e))}if("error"===process.env.NAPI_RS_FORCE_WASI&&!e){let e=Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");throw e.cause=r,e}}if(!nativeBinding){if(loadErrors.length>0){let e=Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");throw e.cause=loadErrors.reduce((e,r)=>(r.cause=e,r)),e}throw Error("Failed to load native binding")}let{generateSync:n}=nativeBinding;export{n as generateSync};
@@ -0,0 +1,12 @@
1
+ import type { Program } from "@swc-next/types";
2
+ export type * from "@swc-next/types";
3
+
4
+ import type { GeneratorConfig, GenerateOutput } from "./binding.js";
5
+ export type { GeneratorConfig, GenerateOutput } from "./binding.js";
6
+
7
+ export type GenerateApiOptions = GeneratorConfig;
8
+
9
+ export declare function generateSync(
10
+ program: Program,
11
+ options?: GenerateApiOptions | undefined | null,
12
+ ): GenerateOutput;
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ let e,t,n,r,a,u,i,s,o,l,c;import{generateSync as p}from"./binding.js";let d=0xffffffff,f=(()=>{if("u">typeof Buffer&&"function"==typeof Buffer.prototype.write){let e=Buffer.prototype.write;try{let t=new Uint8Array(1);if(1===e.call(t,"x",0,1,"utf8")&&120===t[0])return e}catch{}}let e=new TextEncoder;return function(t,n,r){return e.encodeInto(t,this.subarray(n,n+r)).written}})(),y=1===new Uint8Array(new Uint32Array([1]).buffer)[0],m=String.prototype.isWellFormed?e=>e.isWellFormed():e=>{for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(++t);if(!(n>=56320&&n<=57343))return!1}else if(n>=56320&&n<=57343)return!1}return!0},T=Object.freeze([["js","ts","jsx","tsx","dts"],["module","script","commonjs","unambiguous"],["constructor","method","get","set"],["ClassDeclaration","ClassExpression"],["==","!=","===","!==","<","<=",">",">=","+","-","*","/","%","**","|","^","&","<<",">>",">>>","in","instanceof"],["&&","||","??"],["-","+","!","~","typeof","void","delete"],["++","--"],["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","|=","^=","&=","||=","&&=","??="],["var","let","const","using","await using"],["FunctionDeclaration","FunctionExpression"],["formal","unique","arrow","signature"],["init","get","set"],["source","defer"],[null,"public","private","protected"],["value","type"],["keyof","unique","readonly"],["method","get","set"],["namespace","module"],[null,!0,"+","-"],["decimal","hex","octal","binary"]]),S=0,g=0,h=0,w=!1,b=d,x=0;function E(e){let t=Math.max(512,e/7|0),n=Math.max(512,e/20|0),r=Math.max(4096,e/8|0),a=new ArrayBuffer(16*t),u=new ArrayBuffer(4*n);return{nodeCapacity:t,extraCapacity:n,poolCapacity:r,spans:new Uint32Array(2*t),kinds:new Uint8Array(t),payloadBuffer:a,payload:new DataView(a),extraBuffer:u,extra:new DataView(u),pool:new Uint8Array(r),header:new Uint8Array(40),nodeCount:0,extraCount:0}}function A(){n=r=a=u=s=o=c=void 0}function U(e,t){let n=T[e]?.indexOf(t);return null==n||n<0?0:n}function v(){if(S<t)return;let e=new Uint32Array(2*(t*=2));e.set(n),n=e;let i=new Uint8Array(t);i.set(r),r=i;let s=new ArrayBuffer(16*t);new Uint8Array(s).set(new Uint8Array(a)),u=new DataView(a=s)}function C(e,t,a){v();let u=S++;return n[2*u]=t>>>0,n[2*u+1]=a>>>0,r[u]=e,u}function P(e){let t=g;if((g+=e)>i){do i*=2;while(g>i);let e=new ArrayBuffer(4*i);new Uint8Array(e).set(new Uint8Array(s)),o=new DataView(s=e)}return t}function I(e,t,n){u.setUint8(16*e+t,n)}function D(e,t,n){u.setUint32(16*e+t,n,!0)}function k(e,t,n){u.setFloat64(16*e+t,n,!0)}function $(e,t,n){o.setUint8(4*e+t,n)}function F(e,t,n){o.setUint32(4*e+t,n,!0)}function L(e,t,n){let r=e?.length??0;if(!r)return 0;let a=P(r);for(let u=0;u<r;u++){let r=e[u];F(a+u,0,n&&null==r?d:t(r))}return a}function N(e,t,n,r){if(n===r)return 0;let a=P(r-n);for(let u=n,i=a;u<r;u++,i++)F(i,0,t(e[u]));return a}function B(e,t){let n=e?.length??0;if(!n)return 0;let r=P(n),a=e[0].start===t;for(let t=0;t<n;t++){let n=eo(e[t],a);F(r+t,0,n)}return r}function J(e,t,n,r){n.setUint32(r,e,!0),n.setUint32(r+4,e+(t?.length??0),!0)}function j(e,t,n,r){n.setUint32(r,e,!0),n.setUint32(r+4,e+t,!0)}function X(e,t,n,r){if("string"==typeof e){let r=e.length,a=h,u=a+r;if(r>0&&r<=64&&u<=c.length&&u<=0x7fffffff){let i=0;for(;i<r;i++){let t=e.charCodeAt(i);if(t>=128)break;c[a+i]=t}if(i===r){h=u,t.setUint32(n,a,!0),t.setUint32(n+4,u,!0);return}}}K(e,t,n,r)}function K(e,t,n,r=!1){if(null==e||""===e){t.setUint32(n,0,!0),t.setUint32(n+4,0,!0);return}"string"!=typeof e&&(e=String(e));let a=h,u=e.length;M(3*u);let i=r&&!m(e),s=i?q(e,a):f.call(c,e,a,l-a,"utf8");if(w||=i,h+=s,b===d&&s!==u){let t=0;for(;128>e.charCodeAt(t);)t++;b=a+t}t.setUint32(n,a,!0),t.setUint32(n+4,h,!0)}function q(e,t){let n=t;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<128)c[n++]=r;else if(r<2048)c[n++]=192|r>>6,c[n++]=128|63&r;else{if(r>=55296&&r<=56319){let a=e.charCodeAt(t+1);if(a>=56320&&a<=57343){r=65536+(r-55296<<10)+a-56320,t++,c[n++]=240|r>>18,c[n++]=128|r>>12&63,c[n++]=128|r>>6&63,c[n++]=128|63&r;continue}}c[n++]=224|r>>12,c[n++]=128|r>>6&63,c[n++]=128|63&r}}return n-t}function M(e){let t=h+e;if(t>0x7fffffff)throw RangeError("AST string source exceeds signed 32-bit range");if(t<=l)return;do l*=2;while(t>l);let n=new Uint8Array(l);n.set(c.subarray(0,h)),c=n}function O(e){return e.includes("\r")?e.replace(/\r\n?/g,"\n"):e}function R(e){if("string"!=typeof e||e.length<2||48!==e.charCodeAt(0))return"decimal";let t=e[1].toLowerCase();return"x"===t?"hex":"o"===t||/^0[0-7]+$/.test(e)?"octal":"b"===t?"binary":"decimal"}function V(e){if("string"!=typeof e.raw)return null;let t=e.raw.includes("_")?e.raw.replaceAll("_",""):e.raw;return Object.is("octal"===R(t)&&t[1]?.toLowerCase()!=="o"?parseInt(t.slice(1),8):+t,e.value)?e.raw:null}function W(e){return"bigint"==typeof e.value?e.value:BigInt(e.bigint??0)}function z(e){let t=W(e);if("string"==typeof e.raw&&e.raw.endsWith("n")){let n=e.raw.slice(0,-1);try{if(BigInt(n.replaceAll("_",""))===t)return n}catch{}}return String(t)}function Q(e){return e?.type!=="Literal"||null==e.bigint&&"bigint"!=typeof e.value||W(e)>=0n?e:{...e,value:String(W(e)),bigint:null,raw:""}}function _(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:-1}function Y(e,t){if(-1===e.indexOf("\\",1))return t;let n="";for(let t=1;t<e.length-1;t++){let r=e.charCodeAt(t);if(92!==r){n+=e[t];continue}if(++t>=e.length-1)return null;if(10===(r=e.charCodeAt(t))||8232===r||8233===r)continue;if(13===r){10===e.charCodeAt(t+1)&&t++;continue}let a={98:8,102:12,110:10,114:13,116:9,118:11}[r];if(void 0!==a){n+=String.fromCharCode(a);continue}if(120===r||117===r){let a=t+1,u=a+(120===r?2:4);if(117===r&&123===e.charCodeAt(a)&&(a++,(u=e.indexOf("}",a))<0||u===a))return null;let i=0;for(let t=a;t<u;t++){let n=_(e.charCodeAt(t));if(n<0)return null;i=16*i+n}if(u>e.length-1||i>1114111)return null;n+=117===r&&123===e.charCodeAt(t+1)?String.fromCodePoint(i):String.fromCharCode(i),t=117===r&&123===e.charCodeAt(t+1)?u:u-1;continue}if(r>=48&&r<=55){let a=r-48,u=r<=51?3:2,i=1;for(;i<u;){let n=e.charCodeAt(t+1);if(n<48||n>55)break;a=8*a+n-48,t++,i++}n+=String.fromCharCode(a);continue}n+=e[t]}return n}function G(e){let t=e.raw;if("string"!=typeof t||t.length<2)return"";let n=t[0];return('"'===n||"'"===n)&&t[t.length-1]===n&&t.slice(1,-1)===e.value?t:""}function H(e){let t=e.body,n=t?.length??0,r=0;for(;r<n;){let e=t[r];if(e?.type!=="ExpressionStatement"||"string"!=typeof e.directive||e.expression?.type!=="Literal"||"string"!=typeof e.expression.value)break;r++}let a=N(t,eO,0,r),i=N(t,nW,r,n),s=null==e.hashbang?d:tw(e.hashbang),l=P(2),c=C(0,e.start,e.end);return D(c,12,l),j(a,r,u,16*c+0),j(i,n-r,o,(l+0)*4),D(c,8,s),c}function Z(e){return C(1,e.start,e.end)}function ee(e){return C(2,e.start,e.end)}function et(e){let t=e.value,n=e.raw,r=C(3,e.start,e.end);return X(t,u,16*r+0,!0),X(n,u,16*r+8),r}function en(e){let t=null==e.raw?null:V(e),n=e.value??0,r=t,a=C(4,e.start,e.end);return k(a,0,n),null==r?(D(a,8,d),D(a,12,0)):X(r,u,16*a+8),a}function er(e){let t=W(e);if(t<0n){let n=-t;return ex({type:"UnaryExpression",start:e.start,end:e.end,operator:"-",argument:{...e,value:n,bigint:String(n),raw:null}})}let n=z(e),r=C(5,e.start,e.end);return X(n,u,16*r+0),r}function ea(e){let t=+!!e.value,n=C(6,e.start,e.end);return I(n,0,t),n}function eu(e){return C(7,e.start,e.end)}function ei(e){let t=e.regex?.pattern??e.value?.source??"",n=e.regex?.flags??e.value?.flags??"",r=C(8,e.start,e.end);return X(t,u,16*r+0),X(n,u,16*r+8),r}function es(e){let t=B(e.quasis,e.start),n=L(e.expressions,nQ,!1),r=C(9,e.start,e.end);return J(t,e.quasis,u,16*r+0),J(n,e.expressions,u,16*r+8),r}function eo(e,t){let r=e.value?.cooked??"",a=O(e.value?.raw??""),i=+!!e.tail,s=+(e.value?.cooked==null),l=P(2),c=C(10,e.start,e.end);if(t){let e=2*c,t=2-i,r=n[e+1]-n[e]>t;n[e]+=r,n[e+1]-=t*r}return D(c,12,l),X(r,u,16*c+0,!0),X(a,o,(l+0)*4),I(c,8,i),I(c,9,s),c}function el(e){let t=e.name,n=C(11,e.start,e.end);return X(t,u,16*n+0),n}function ec(e){let t=e.name,n=C(12,e.start,e.end);return X(t,u,16*n+0),n}function ep(e){let t=e.name,n=C(13,e.start,e.end);return X(t,u,16*n+0),n}function ed(e){let t=e.name,n=C(14,e.start,e.end);return X(t,u,16*n+0),n}function ef(e){let t=e.name,n=C(15,e.start,e.end);return X(t,u,16*n+0),n}function ey(e){let t=n_(e.left),n=nQ(e.right),r=C(16,e.start,e.end);return D(r,0,t),D(r,4,n),r}function em(e){let t=n_(e.argument),n=C(17,e.start,e.end);return D(n,0,t),n}function eT(e){let t=e.elements,n=t?.length??0,r=t?.[n-1],a=r?.type==="RestElement"?r:null,i=n-(null!==a),s=i?P(i):0;for(let e=0;e<i;e++){let n=t[e];F(s+e,0,null==n?d:n_(n))}let o=null==a?d:em(a),l=C(18,e.start,e.end);return j(s,i,u,16*l+0),D(l,8,o),l}function eS(e){let t=e.properties,n=t?.length??0,r=n-0,a=null;for(let e=0;e<n;e++){let n=t[e];n?.type==="RestElement"&&(a=n,r--)}let i=r?P(r):0,s=i;for(let e=0;e<n;e++){let n=t[e];if(n?.type!=="RestElement"){let e=eg(n);F(s++,0,e)}}let o=null==a?d:em(a),l=C(19,e.start,e.end);return j(i,r,u,16*l+0),D(l,8,o),l}function eg(e){let t=e.computed?nQ(e.key):nH(Q(e.key)),n=n_(e.value),r=+!!e.shorthand,a=+!!e.computed,u=C(20,e.start,e.end);return D(u,0,t),D(u,4,n),I(u,8,r),I(u,9,a),u}function eh(e){let t=nQ(e.left),n=nQ(e.right),r=U(4,e.operator),a=C(21,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function ew(e){let t=nQ(e.left),n=nQ(e.right),r=U(5,e.operator),a=C(22,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function eb(e){let t=nQ(e.test),n=nQ(e.consequent),r=nQ(e.alternate),a=C(23,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function ex(e){let t=nQ(e.argument),n=U(6,e.operator),r=C(24,e.start,e.end);return D(r,0,t),I(r,4,n),r}function eE(e){let t=nG(e.argument),n=U(7,e.operator),r=+!!e.prefix,a=C(25,e.start,e.end);return D(a,0,t),I(a,4,n),I(a,5,r),a}function eA(e){let t=nY(e.left),n=nQ(e.right),r=U(8,e.operator),a=C(26,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function eU(e){let t=U(9,e.kind),n=L(e.declarations,ev,!1),r=+!!e.declare;x|=r;let a=C(27,e.start,e.end);return I(a,8,t),J(n,e.declarations,u,16*a+0),I(a,9,r),a}function ev(e){let t=n_(e.id),n=e.id?.typeAnnotation==null?d:tE(e.id?.typeAnnotation),r=null==e.init?d:nQ(e.init),a=+!!e.definite;x|=a;let u=C(28,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),I(u,12,a),u}function eC(e){let t=nQ(e.test),n=nW(e.consequent),r=null==e.alternate?d:nW(e.alternate),a=C(29,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function eP(e){let t=nQ(e.discriminant),n=L(e.cases,eI,!1),r=C(30,e.start,e.end);return D(r,8,t),J(n,e.cases,u,16*r+0),r}function eI(e){let t=null==e.test?d:nQ(e.test),n=L(e.consequent,nW,!1),r=C(31,e.start,e.end);return D(r,8,t),J(n,e.consequent,u,16*r+0),r}function eD(e){let t=null==e.init?d:n2(e.init),n=null==e.test?d:nQ(e.test),r=null==e.update?d:nQ(e.update),a=nW(e.body),u=C(32,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),D(u,12,a),u}function ek(e){let t=n4(e.left),n=nQ(e.right),r=nW(e.body),a=C(33,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function e$(e){let t=n4(e.left),n=nQ(e.right),r=nW(e.body),a=+!!e.await,u=C(34,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),I(u,12,a),u}function eF(e){let t=eH(e.block),n=null==e.handler?d:eL(e.handler),r=null==e.finalizer?d:eH(e.finalizer),a=C(35,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function eL(e){let t=null==e.param?d:n_(e.param),n=e.param?.typeAnnotation==null?d:tE(e.param?.typeAnnotation),r=eH(e.body),a=C(36,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function eN(e){let t=null==e.label?d:ef(e.label),n=C(37,e.start,e.end);return D(n,0,t),n}function eB(e){let t=null==e.label?d:ef(e.label),n=C(38,e.start,e.end);return D(n,0,t),n}function eJ(e){let t=ef(e.label),n=nW(e.body),r=C(39,e.start,e.end);return D(r,0,t),D(r,4,n),r}function ej(e){let t=nQ(e.expression),n=C(40,e.start,e.end);return D(n,0,t),n}function eX(e){let t=null==e.argument?d:nQ(e.argument),n=C(41,e.start,e.end);return D(n,0,t),n}function eK(e){let t=nQ(e.argument),n=C(42,e.start,e.end);return D(n,0,t),n}function eq(e){return C(43,e.start,e.end)}function eM(e){return C(44,e.start,e.end)}function eO(e){let t=e.expression?.raw,n=t?.[0],r=et("string"==typeof t&&t.length>=2&&('"'===n||"'"===n)&&t[t.length-1]===n&&"string"==typeof e.directive&&t.length===e.directive.length+2&&t.startsWith(e.directive,1)&&Y(t,e.directive)===e.expression?.value?e.expression:{...e.expression,raw:""}),a=e.directive,i=C(45,e.start,e.end);return D(i,8,r),X(a,u,16*i+0),i}function eR(e){let t=nQ(e.expression),n=C(46,e.start,e.end);return D(n,0,t),n}function eV(e){let t=U(3,"ClassExpression"===e.type?"ClassExpression":"ClassDeclaration"),n=L(e.decorators,eR,!1),r=null==e.id?d:ep(e.id),a=null==e.typeParameters?d:tO(e.typeParameters),u=null==e.superClass?d:nQ(e.superClass),i=null==e.superTypeArguments?d:tR(e.superTypeArguments),s=L(e.implements,nd,!1),l=eW(e.body),c=+!!e.abstract,p=+!!e.declare;x|=c|p;let f=P(7),y=C(47,e.start,e.end);return D(y,12,f),I(y,8,t),J(n,e.decorators,o,(f+0)*4),D(y,0,r),D(y,4,a),F(f+2,0,u),F(f+3,0,i),J(s,e.implements,o,(f+4)*4),F(f+6,0,l),I(y,9,c),I(y,10,p),y}function eW(e){let t=L(e.body,n5,!1),n=C(48,e.start,e.end);return J(t,e.body,u,16*n+0),n}function ez(e){let t=L(e.decorators,eR,!1),n=e.computed?nQ(e.key):nH(Q(e.key)),r=eY(e.value,"unique"),a=U(2,e.kind),u=+!!e.computed,i=+!!e.static,s=+!!e.override,l=+!!e.optional,c=+!!e.type.startsWith("TSAbstract"),p=U(14,e.accessibility);x|=s|l|c|p;let d=P(3),f=C(49,e.start,e.end);return D(f,12,d),J(t,e.decorators,o,(d+0)*4),D(f,0,n),F(d+2,0,r),I(f,4,a),I(f,5,u),I(f,6,i),I(f,7,s),I(f,8,l),I(f,9,c),I(f,10,p),f}function eQ(e){let t=L(e.decorators,eR,!1),n=e.computed?nQ(e.key):nH(Q(e.key)),r=null==e.typeAnnotation?d:tE(e.typeAnnotation),a=null==e.value?d:nQ(e.value),u=+!!e.computed,i=+!!e.static,s=+("AccessorProperty"===e.type||"TSAbstractAccessorProperty"===e.type),l=+!!e.declare,c=+!!e.override,p=+!!e.optional,f=+!!e.definite,y=+!!e.readonly,m=+!!e.type.startsWith("TSAbstract"),T=U(14,e.accessibility);x|=l|c|p|f|y|m|T;let S=P(5),g=C(50,e.start,e.end);return D(g,12,S),J(t,e.decorators,o,(S+0)*4),F(S+2,0,n),F(S+3,0,r),F(S+4,0,a),I(g,0,u),I(g,1,i),I(g,2,s),I(g,3,l),I(g,4,c),I(g,5,p),I(g,6,f),I(g,7,y),I(g,8,m),I(g,9,T),g}function e_(e){let t=L(e.body,nW,!1),n=C(51,e.start,e.end);return J(t,e.body,u,16*n+0),n}function eY(e,t="formal"){let n=e.params?.[0],r=n?.type==="Identifier"&&"this"===n.name?n:null,a=U(10,"FunctionExpression"===e.type?"FunctionExpression":"FunctionDeclaration"),u=null==e.id?d:ep(e.id),i=null==e.typeParameters?d:tO(e.typeParameters),s=null==r?d:nw(r),o=e2(e.params,+(null!==r),t),l=null==e.returnType?d:tE(e.returnType),c=eG(e.body),p=+!!e.generator,f=+!!e.async,y=P(4),m=C(52,e.start,e.end);return D(m,12,y),I(m,8,a),D(m,0,u),D(m,4,i),F(y+0,0,s),F(y+1,0,o),F(y+2,0,l),F(y+3,0,c),I(m,9,p),I(m,10,f),m}function eG(e){let t=e.body,n=t?.length??0,r=0;for(;r<n;){let e=t[r];if(e?.type!=="ExpressionStatement"||"string"!=typeof e.directive||e.expression?.type!=="Literal"||"string"!=typeof e.expression.value)break;r++}let a=N(t,eO,0,r),i=N(t,nW,r,n),s=C(53,e.start,e.end);return j(a,r,u,16*s+0),j(i,n-r,u,16*s+8),s}function eH(e){let t=L(e.body,nW,!1),n=C(54,e.start,e.end);return J(t,e.body,u,16*n+0),n}function eZ(e){let t=nQ(e.test),n=nW(e.body),r=C(55,e.start,e.end);return D(r,0,t),D(r,4,n),r}function e1(e){let t=nW(e.body),n=nQ(e.test),r=C(56,e.start,e.end);return D(r,0,t),D(r,4,n),r}function e0(e){let t=nQ(e.object),n=nW(e.body),r=C(57,e.start,e.end);return D(r,0,t),D(r,4,n),r}function e2(e,t=0,n="formal"){let r=e,a=r?.length??0,i=a-t,s=null;for(let e=t;e<a;e++){let t=r[e];t?.type==="RestElement"&&(s=t,i--)}let o=a>t?r[t].start:0,l=a>t?r[a-1].end:0,c=i?P(i):0,p=c;for(let e=t;e<a;e++){let t=r[e];if(t?.type!=="RestElement"){let e=n6(t);F(p++,0,e)}}let f=null==s?d:e8(s),y=U(11,n),m=C(58,o,l);return j(c,i,u,16*m+0),D(m,8,f),I(m,12,y),m}function e4(e){let t="AssignmentPattern"===e.type,r=t?e.left:e,a=t?e.right:null,u=L(e.decorators,eR,!1),i=n3(r),s=null==r.typeAnnotation?d:tE(r.typeAnnotation),l=null==a?d:nQ(a),c=+!!r.optional;if(x|=(e.decorators?.length??0)|c,c&&s===d&&l!==d){let e=2*i;n[e+1]-=n[e+1]>n[e]}let p=P(3),f=C(59,e.start,e.end);return D(f,12,p),J(u,e.decorators,o,(p+0)*4),D(f,0,i),D(f,4,s),F(p+2,0,l),I(f,8,c),f}function e8(e){let t=L(e.decorators,eR,!1),n=n3(e.argument),r=null==e.typeAnnotation?d:tE(e.typeAnnotation);x|=e.decorators?.length??0;let a=C(60,e.start,e.end);return J(t,e.decorators,u,16*a+0),D(a,8,n),D(a,12,r),a}function e6(e){let t=L(e.elements,n1,!0),n=C(61,e.start,e.end);return J(t,e.elements,u,16*n+0),n}function e3(e){let t=L(e.properties,n0,!1),n=C(62,e.start,e.end);return J(t,e.properties,u,16*n+0),n}function e5(e){let t=nQ(e.argument),n=C(63,e.start,e.end);return D(n,0,t),n}function e9(e){let t=e.computed?nQ(e.key):nH(Q(e.key)),n="FunctionExpression"===e.value.type&&(e.method||"get"===e.kind||"set"===e.kind)?eY(e.value,"unique"):nQ(e.value),r=U(12,e.kind),a=+!!e.method,u=+!!e.shorthand,i=+!!e.computed,s=C(64,e.start,e.end);return D(s,0,t),D(s,4,n),I(s,8,r),I(s,9,a),I(s,10,u),I(s,11,i),s}function e7(e){let t=nQ(e.expression),n=C(65,e.start,e.end);return D(n,0,t),n}function te(e){let t=+!!e.expression,n=+!!e.async,r=null==e.typeParameters?d:tO(e.typeParameters),a=e2(e.params,0,"arrow"),u=null==e.returnType?d:tE(e.returnType),i=n8(e.body),s=P(2),o=C(66,e.start,e.end);return D(o,12,s),I(o,8,t),I(o,9,n),D(o,0,r),D(o,4,a),F(s+0,0,u),F(s+1,0,i),o}function tt(e){let t=L(e.expressions,nQ,!1),n=C(67,e.start,e.end);return J(t,e.expressions,u,16*n+0),n}function tn(e){let t=nQ(e.object),n=e.computed?nQ(e.property):nH(e.property),r=+!!e.computed,a=+!!e.optional,u=C(68,e.start,e.end);return D(u,0,t),D(u,4,n),I(u,8,r),I(u,9,a),u}function tr(e){let t=nQ(e.callee),n=null==e.typeArguments?d:tR(e.typeArguments),r=L(e.arguments,n1,!1),a=+!!e.optional,u=P(2),i=C(69,e.start,e.end);return D(i,12,u),D(i,0,t),D(i,4,n),J(r,e.arguments,o,(u+0)*4),I(i,8,a),I(i,9,0),i}function ta(e){let t=nQ(e.expression),n=C(70,e.start,e.end);return D(n,0,t),n}function tu(e){let t=nQ(e.tag),n=null==e.typeArguments?d:tR(e.typeArguments),r=es(e.quasi),a=C(71,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function ti(e){let t=nQ(e.callee),n=null==e.typeArguments?d:tR(e.typeArguments),r=L(e.arguments,n1,!1),a=C(72,e.start,e.end);return D(a,8,t),D(a,12,n),J(r,e.arguments,u,16*a+0),a}function ts(e){let t=nQ(e.argument),n=C(73,e.start,e.end);return D(n,0,t),n}function to(e){let t=null==e.argument?d:nQ(e.argument),n=+!!e.delegate,r=C(74,e.start,e.end);return D(r,0,t),I(r,4,n),r}function tl(e){let t=ed(e.meta),n=ed(e.property),r=C(75,e.start,e.end);return D(r,0,t),D(r,4,n),r}function tc(e){let t=nQ(e.source),n=null==e.options?d:nQ(e.options),r=null==e.phase?255:U(13,e.phase),a=P(1),u=C(76,e.start,e.end);return D(u,12,a),D(u,0,t),D(u,4,n),$(a+0,0,r),I(u,8,0),u}function tp(e){let t=L(e.specifiers,n9,!1),n=et(e.source),r=L(e.attributes,tm,!1),a=null==e.phase?255:U(13,e.phase),u=U(15,e.importKind);x|=u;let i=P(5),s=C(77,e.start,e.end);return D(s,12,i),J(t,e.specifiers,o,(i+0)*4),D(s,0,n),J(r,e.attributes,o,(i+2)*4),$(i+4,0,a),I(s,4,u),s}function td(e){let t=nZ(e.imported),n=ep(e.local),r=U(15,e.importKind);x|=r;let a=C(78,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function tf(e){let t=ep(e.local),n=C(79,e.start,e.end);return D(n,0,t),n}function ty(e){let t=ep(e.local),n=C(80,e.start,e.end);return D(n,0,t),n}function tm(e){let t=nZ(e.key),n=et(e.value),r=C(81,e.start,e.end);return D(r,0,t),D(r,4,n),r}function tT(e){let t=null==e.declaration?d:nz(e.declaration),n=L(e.specifiers,th,!1),r=null==e.source?d:et(e.source),a=L(e.attributes,tm,!1),u=U(15,e.exportKind);x|=u;let i=P(4),s=C(82,e.start,e.end);return D(s,12,i),D(s,0,t),J(n,e.specifiers,o,(i+0)*4),D(s,4,r),J(a,e.attributes,o,(i+2)*4),I(s,8,u),s}function tS(e){let t=n7(e.declaration),n=C(83,e.start,e.end);return D(n,0,t),n}function tg(e){let t=null==e.exported?d:nZ(e.exported),n=et(e.source),r=L(e.attributes,tm,!1),a=U(15,e.exportKind);x|=a;let u=P(2),i=C(84,e.start,e.end);return D(i,12,u),D(i,0,t),D(i,4,n),J(r,e.attributes,o,(u+0)*4),I(i,8,a),i}function th(e){let t=nZ(e.local),n=nZ(e.exported),r=U(15,e.exportKind);x|=r;let a=C(85,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function tw(e){let t=e.value,n=C(86,e.start,e.end);return X(t,u,16*n+0),n}function tb(e,t="formal"){x=1;let n=e.params?.[0],r=n?.type==="Identifier"&&"this"===n.name?n:null,a=null==e.id?d:ep(e.id),u=null==e.typeParameters?d:tO(e.typeParameters),i=null==r?d:nw(r),s=e2(e.params,+(null!==r),t),o=null==e.returnType?d:tE(e.returnType),l=+!!e.generator,c=+!!e.async,p=+!!e.declare,f=P(3),y=C(87,e.start,e.end);return D(y,12,f),D(y,0,a),D(y,4,u),F(f+0,0,i),F(f+1,0,s),F(f+2,0,o),I(y,8,l),I(y,9,c),I(y,10,p),y}function tx(e){x=1;let t=L(e.decorators,eR,!1),n=e.computed?nQ(e.key):nH(Q(e.key)),r=tb(e.value,"unique"),a=U(2,e.kind),u=+!!e.computed,i=+!!e.static,s=+!!e.override,l=+!!e.optional,c=+!!e.type.startsWith("TSAbstract"),p=U(14,e.accessibility),d=P(3),f=C(88,e.start,e.end);return D(f,12,d),J(t,e.decorators,o,(d+0)*4),D(f,0,n),F(d+2,0,r),I(f,4,a),I(f,5,u),I(f,6,i),I(f,7,s),I(f,8,l),I(f,9,c),I(f,10,p),f}function tE(e){x=1;let t=re(e.typeAnnotation),n=C(89,e.start,e.end);return D(n,0,t),n}function tA(e){return x=1,C(90,e.start,e.end)}function tU(e){return x=1,C(91,e.start,e.end)}function tv(e){return x=1,C(92,e.start,e.end)}function tC(e){return x=1,C(93,e.start,e.end)}function tP(e){return x=1,C(94,e.start,e.end)}function tI(e){return x=1,C(95,e.start,e.end)}function tD(e){return x=1,C(96,e.start,e.end)}function tk(e){return x=1,C(97,e.start,e.end)}function t$(e){return x=1,C(98,e.start,e.end)}function tF(e){return x=1,C(99,e.start,e.end)}function tL(e){return x=1,C(100,e.start,e.end)}function tN(e){return x=1,C(101,e.start,e.end)}function tB(e){return x=1,C(102,e.start,e.end)}function tJ(e){return x=1,C(103,e.start,e.end)}function tj(e){x=1;let t=rt(e.typeName),n=null==e.typeArguments?d:tR(e.typeArguments),r=C(104,e.start,e.end);return D(r,0,t),D(r,4,n),r}function tX(e){x=1;let t=rn(e.left),n=ed(e.right),r=C(105,e.start,e.end);return D(r,0,t),D(r,4,n),r}function tK(e){x=1;let t=ra(e.exprName),n=null==e.typeArguments?d:tR(e.typeArguments),r=C(106,e.start,e.end);return D(r,0,t),D(r,4,n),r}function tq(e){x=1;let t=et(e.source),n=null==e.options?d:nQ(e.options),r=null==e.qualifier?d:rr(e.qualifier),a=null==e.typeArguments?d:tR(e.typeArguments),u=C(107,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),D(u,12,a),u}function tM(e){x=1;let t=ep(e.name),n=null==e.constraint?d:re(e.constraint),r=null==e.default?d:re(e.default),a=+!!e.in,u=+!!e.out,i=+!!e.const,s=C(108,e.start,e.end);return D(s,0,t),D(s,4,n),D(s,8,r),I(s,12,a),I(s,13,u),I(s,14,i),s}function tO(e){x=1;let t=L(e.params,tM,!1),n=C(109,e.start,e.end);return J(t,e.params,u,16*n+0),n}function tR(e){x=1;let t=L(e.params,re,!1),n=C(110,e.start,e.end);return J(t,e.params,u,16*n+0),n}function tV(e){x=1;let t=ru(e.literal),n=C(111,e.start,e.end);return D(n,0,t),n}function tW(e){x=1;let t=B(e.quasis,e.start),n=L(e.types,re,!1),r=C(112,e.start,e.end);return J(t,e.quasis,u,16*r+0),J(n,e.types,u,16*r+8),r}function tz(e){x=1;let t=re(e.elementType),n=C(113,e.start,e.end);return D(n,0,t),n}function tQ(e){x=1;let t=re(e.objectType),n=re(e.indexType),r=C(114,e.start,e.end);return D(r,0,t),D(r,4,n),r}function t_(e){x=1;let t=L(e.elementTypes,ri,!1),n=C(115,e.start,e.end);return J(t,e.elementTypes,u,16*n+0),n}function tY(e){x=1;let t=ed(e.label),n=re(e.elementType),r=+!!e.optional,a=C(116,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function tG(e){x=1;let t=re(e.typeAnnotation),n=C(117,e.start,e.end);return D(n,0,t),n}function tH(e){x=1;let t=ri(e.typeAnnotation),n=C(118,e.start,e.end);return D(n,0,t),n}function tZ(e){x=1;let t=re(e.typeAnnotation),n=+!!e.postfix,r=C(119,e.start,e.end);return D(r,0,t),I(r,4,n),r}function t1(e){x=1;let t=re(e.typeAnnotation),n=+!!e.postfix,r=C(120,e.start,e.end);return D(r,0,t),I(r,4,n),r}function t0(e){return x=1,C(121,e.start,e.end)}function t2(e){x=1;let t=L(e.types,re,!1),n=C(122,e.start,e.end);return J(t,e.types,u,16*n+0),n}function t4(e){x=1;let t=L(e.types,re,!1),n=C(123,e.start,e.end);return J(t,e.types,u,16*n+0),n}function t8(e){x=1;let t=re(e.checkType),n=re(e.extendsType),r=re(e.trueType),a=re(e.falseType),u=C(124,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),D(u,12,a),u}function t6(e){x=1;let t=tM(e.typeParameter),n=C(125,e.start,e.end);return D(n,0,t),n}function t3(e){x=1;let t=U(16,e.operator),n=re(e.typeAnnotation),r=C(126,e.start,e.end);return I(r,4,t),D(r,0,n),r}function t5(e){x=1;let t=re(e.typeAnnotation),n=C(127,e.start,e.end);return D(n,0,t),n}function t9(e){x=1;let t=e.params?.[0],n=t?.type==="Identifier"&&"this"===t.name?t:null,r=null==e.typeParameters?d:tO(e.typeParameters),a=null==n?d:nw(n),u=e2(e.params,+(null!==n),"signature"),i=tE(e.returnType),s=C(128,e.start,e.end);return D(s,0,r),D(s,4,a),D(s,8,u),D(s,12,i),s}function t7(e){x=1;let t=null==e.typeParameters?d:tO(e.typeParameters),n=e2(e.params,0,"signature"),r=tE(e.returnType),a=+!!e.abstract,u=C(129,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),I(u,12,a),u}function ne(e){x=1;let t=ro(e.parameterName),n=null==e.typeAnnotation?d:tE(e.typeAnnotation),r=+!!e.asserts,a=C(130,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function nt(e){x=1;let t=L(e.members,rs,!1),n=C(131,e.start,e.end);return J(t,e.members,u,16*n+0),n}function nn(e){x=1;let t=ep(e.key),n=re(e.constraint),r=null==e.nameType?d:re(e.nameType),a=null==e.typeAnnotation?d:re(e.typeAnnotation),u=U(19,!1===e.optional?null:e.optional),i=U(19,e.readonly),s=P(2),o=C(132,e.start,e.end);return D(o,12,s),D(o,0,t),D(o,4,n),F(s+0,0,r),F(s+1,0,a),I(o,8,u),I(o,9,i),o}function nr(e){x=1;let t=e.computed?nQ(e.key):nH(Q(e.key)),n=null==e.typeAnnotation?d:tE(e.typeAnnotation),r=+!!e.computed,a=+!!e.optional,u=+!!e.readonly,i=C(133,e.start,e.end);return D(i,0,t),D(i,4,n),I(i,8,r),I(i,9,a),I(i,10,u),i}function na(e){x=1;let t=e.params?.[0],n=t?.type==="Identifier"&&"this"===t.name?t:null,r=e.computed?nQ(e.key):nH(Q(e.key)),a=null==e.typeParameters?d:tO(e.typeParameters),u=null==n?d:nw(n),i=e2(e.params,+(null!==n),"signature"),s=null==e.returnType?d:tE(e.returnType),o=U(17,e.kind),l=+!!e.computed,c=+!!e.optional,p=P(3),f=C(134,e.start,e.end);return D(f,12,p),D(f,0,r),D(f,4,a),F(p+0,0,u),F(p+1,0,i),F(p+2,0,s),I(f,8,o),I(f,9,l),I(f,10,c),f}function nu(e){x=1;let t=e.params?.[0],n=t?.type==="Identifier"&&"this"===t.name?t:null,r=null==e.typeParameters?d:tO(e.typeParameters),a=null==n?d:nw(n),u=e2(e.params,+(null!==n),"signature"),i=null==e.returnType?d:tE(e.returnType),s=C(135,e.start,e.end);return D(s,0,r),D(s,4,a),D(s,8,u),D(s,12,i),s}function ni(e){x=1;let t=null==e.typeParameters?d:tO(e.typeParameters),n=e2(e.params,0,"signature"),r=null==e.returnType?d:tE(e.returnType),a=C(136,e.start,e.end);return D(a,0,t),D(a,4,n),D(a,8,r),a}function ns(e){x=1;let t=L(e.parameters,nD,!1),n=tE(e.typeAnnotation),r=+!!e.readonly,a=+!!e.static,i=C(137,e.start,e.end);return J(t,e.parameters,u,16*i+0),D(i,8,n),I(i,12,r),I(i,13,a),i}function no(e){x=1;let t=ep(e.id),n=null==e.typeParameters?d:tO(e.typeParameters),r=re(e.typeAnnotation),a=+!!e.declare,u=C(138,e.start,e.end);return D(u,0,t),D(u,4,n),D(u,8,r),I(u,12,a),u}function nl(e){x=1;let t=ep(e.id),n=null==e.typeParameters?d:tO(e.typeParameters),r=L(e.extends,np,!1),a=nc(e.body),u=+!!e.declare,i=P(3),s=C(139,e.start,e.end);return D(s,12,i),D(s,0,t),D(s,4,n),J(r,e.extends,o,(i+0)*4),F(i+2,0,a),I(s,8,u),s}function nc(e){x=1;let t=L(e.body,rs,!1),n=C(140,e.start,e.end);return J(t,e.body,u,16*n+0),n}function np(e){x=1;let t=nQ(e.expression),n=null==e.typeArguments?d:tR(e.typeArguments),r=C(141,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nd(e){x=1;let t=nQ(e.expression),n=null==e.typeArguments?d:tR(e.typeArguments),r=C(142,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nf(e){x=1;let t=ep(e.id),n=ny(e.body),r=+!!e.const,a=+!!e.declare,u=C(143,e.start,e.end);return D(u,0,t),D(u,4,n),I(u,8,r),I(u,9,a),u}function ny(e){x=1;let t=L(e.members,nm,!1),n=C(144,e.start,e.end);return J(t,e.members,u,16*n+0),n}function nm(e){x=1;let t=rl(e.id),n=null==e.initializer?d:nQ(e.initializer),r=+!!e.computed,a=C(145,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function nT(e){x=1;let t=rc(e.id),n=null==e.attributes?d:nt(e.attributes),r=null==e.body?d:rp(e.body),a=U(18,e.kind),u=+!!e.declare,i=C(146,e.start,e.end);return D(i,0,t),D(i,4,n),D(i,8,r),I(i,12,a),I(i,13,u),i}function nS(e){x=1;let t=e.body,n=t?.length??0,r=0;for(;r<n;){let e=t[r];if(e?.type!=="ExpressionStatement"||"string"!=typeof e.directive||e.expression?.type!=="Literal"||"string"!=typeof e.expression.value)break;r++}let a=N(t,eO,0,r),i=N(t,nW,r,n),s=C(147,e.start,e.end);return j(a,r,u,16*s+0),j(i,n-r,u,16*s+8),s}function ng(e){x=1;let t=ed(e.id),n=nS(e.body),r=+!!e.declare,a=C(148,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function nh(e){x=1;let t=L(e.decorators,eR,!1),n=e4(e.parameter),r=+!!e.override,a=+!!e.readonly,i=U(14,e.accessibility),s=C(149,e.start,e.end);return J(t,e.decorators,u,16*s+0),D(s,8,n),I(s,12,r),I(s,13,a),I(s,14,i),s}function nw(e){x=1;let t=null==e.typeAnnotation?d:tE(e.typeAnnotation),n=C(150,e.start,e.end);return D(n,0,t),n}function nb(e){x=1;let t=nQ(e.expression),n=re(e.typeAnnotation),r=C(151,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nx(e){x=1;let t=nQ(e.expression),n=re(e.typeAnnotation),r=C(152,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nE(e){x=1;let t=re(e.typeAnnotation),n=nQ(e.expression),r=C(153,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nA(e){x=1;let t=nQ(e.expression),n=C(154,e.start,e.end);return D(n,0,t),n}function nU(e){x=1;let t=nQ(e.expression),n=tR(e.typeArguments),r=C(155,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nv(e){x=1;let t=nQ(e.expression),n=C(156,e.start,e.end);return D(n,0,t),n}function nC(e){x=1;let t=ed(e.id),n=C(157,e.start,e.end);return D(n,0,t),n}function nP(e){x=1;let t=ep(e.id),n=rd(e.moduleReference),r=U(15,e.importKind),a=C(158,e.start,e.end);return D(a,0,t),D(a,4,n),I(a,8,r),a}function nI(e){x=1;let t=et(e.expression),n=C(159,e.start,e.end);return D(n,0,t),n}function nD(e){x=1;let t=ep(e),n=tE(e.typeAnnotation),r=C(160,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nk(e){let t=n$(e.openingElement),n=L(e.children,rh,!1),r=null==e.closingElement?d:nF(e.closingElement),a=C(161,e.start,e.end);return D(a,8,t),J(n,e.children,u,16*a+0),D(a,12,r),a}function n$(e){let t=rf(e.name),n=null==e.typeArguments?d:tR(e.typeArguments),r=L(e.attributes,rT,!1),a=+!!e.selfClosing,u=P(2),i=C(162,e.start,e.end);return D(i,12,u),D(i,0,t),D(i,4,n),J(r,e.attributes,o,(u+0)*4),I(i,8,a),i}function nF(e){let t=rf(e.name),n=C(163,e.start,e.end);return D(n,0,t),n}function nL(e){let t=nN(e.openingFragment),n=L(e.children,rh,!1),r=nB(e.closingFragment),a=C(164,e.start,e.end);return D(a,8,t),J(n,e.children,u,16*a+0),D(a,12,r),a}function nN(e){return C(165,e.start,e.end)}function nB(e){return C(166,e.start,e.end)}function nJ(e){let t=e.name,n=C(167,e.start,e.end);return X(t,u,16*n+0),n}function nj(e){let t=nJ(e.namespace),n=nJ(e.name),r=C(168,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nX(e){let t=ry(e.object),n=nJ(e.property),r=C(169,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nK(e){let t=rm(e.name),n=null==e.value?d:rS(e.value),r=C(170,e.start,e.end);return D(r,0,t),D(r,4,n),r}function nq(e){let t=nQ(e.argument),n=C(171,e.start,e.end);return D(n,0,t),n}function nM(e){let t=rg(e.expression),n=C(172,e.start,e.end);return D(n,0,t),n}function nO(e){return C(173,e.start,e.end)}function nR(e){let t=e.value??e.raw??"",n=C(174,e.start,e.end);return X(t,u,16*n+0),n}function nV(e){let t=nQ(e.expression),n=C(175,e.start,e.end);return D(n,0,t),n}function nW(e){switch(e.type){case"ExpressionStatement":return ej(e);case"BlockStatement":return eH(e);case"IfStatement":return eC(e);case"ReturnStatement":return eX(e);case"ImportDeclaration":return tp(e);case"ExportNamedDeclaration":return tT(e);case"ForStatement":return eD(e);case"BreakStatement":return eN(e);case"ThrowStatement":return eK(e);case"WhileStatement":return eZ(e);case"ForOfStatement":return e$(e);case"SwitchStatement":return eP(e);case"TryStatement":return eF(e);case"ForInStatement":return ek(e);case"ExportDefaultDeclaration":return tS(e);case"ContinueStatement":return eB(e);case"DoWhileStatement":return e1(e);case"EmptyStatement":return eM(e);case"LabeledStatement":return eJ(e);case"DebuggerStatement":return eq(e);case"WithStatement":return e0(e);case"ExportAllDeclaration":return tg(e);case"TSExportAssignment":return nv(e);case"TSNamespaceExportDeclaration":return nC(e);default:return nz(e)}}function nz(e){switch(e.type){case"VariableDeclaration":return eU(e);case"FunctionDeclaration":return eY(e);case"TSTypeAliasDeclaration":return no(e);case"TSInterfaceDeclaration":return nl(e);case"ClassDeclaration":return eV(e);case"TSEnumDeclaration":return nf(e);case"TSModuleDeclaration":if(e.global||"global"===e.kind)return ng(e);return nT(e);case"TSDeclareFunction":return tb(e);case"TSImportEqualsDeclaration":return nP(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function nQ(e){switch(e.type){case"Identifier":return el(e);case"MemberExpression":return tn(e);case"Literal":if(null!=e.regex||e.value instanceof RegExp)return ei(e);if(null!=e.bigint||"bigint"==typeof e.value)return er(e);if("string"==typeof e.value)return et(e);if("number"==typeof e.value)return en(e);if("boolean"==typeof e.value)return ea(e);return eu(e);case"CallExpression":return tr(e);case"BinaryExpression":return eh(e);case"AssignmentExpression":return eA(e);case"LogicalExpression":return ew(e);case"ThisExpression":return ee(e);case"ObjectExpression":return e3(e);case"UnaryExpression":return ex(e);case"ParenthesizedExpression":return e7(e);case"FunctionExpression":return eY(e);case"ConditionalExpression":return eb(e);case"JSXElement":return nk(e);case"ArrowFunctionExpression":return te(e);case"ArrayExpression":return e6(e);case"TemplateLiteral":return es(e);case"TSAsExpression":return nb(e);case"ChainExpression":return ta(e);case"NewExpression":return ti(e);case"UpdateExpression":return eE(e);case"AwaitExpression":return ts(e);case"PrivateIdentifier":return ec(e);case"TSNonNullExpression":return nA(e);case"SequenceExpression":return tt(e);case"TaggedTemplateExpression":return tu(e);case"JSXFragment":return nL(e);case"ImportExpression":return tc(e);case"TSInstantiationExpression":return nU(e);case"Super":return Z(e);case"YieldExpression":return to(e);case"MetaProperty":return tl(e);case"TSSatisfiesExpression":return nx(e);case"ClassExpression":return eV(e);case"TSTypeAssertion":return nE(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n_(e){switch(e.type){case"Identifier":return ep(e);case"ObjectPattern":return eS(e);case"ArrayPattern":return eT(e);case"AssignmentPattern":return ey(e);case"RestElement":return em(e);default:return nG(e)}}function nY(e){switch(e.type){case"ObjectPattern":return eS(e);case"ArrayPattern":return eT(e);default:return nG(e)}}function nG(e){switch(e.type){case"Identifier":return el(e);case"MemberExpression":return tn(e);case"TSAsExpression":return nb(e);case"TSNonNullExpression":return nA(e);case"TSSatisfiesExpression":return nx(e);case"TSTypeAssertion":return nE(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function nH(e){return"Identifier"===e.type?ed(e):nQ(e)}function nZ(e){switch(e.type){case"Identifier":return ed(e);case"Literal":return et(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n1(e){return"SpreadElement"===e.type?e5(e):nQ(e)}function n0(e){switch(e.type){case"Property":return e9(e);case"SpreadElement":return e5(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n2(e){return"VariableDeclaration"===e.type?eU(e):nQ(e)}function n4(e){return"VariableDeclaration"===e.type?eU(e):nY(e)}function n8(e){return"BlockStatement"===e.type?eG(e):nQ(e)}function n6(e){switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":return e4(e);case"TSParameterProperty":return nh(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n3(e){switch(e.type){case"Identifier":return ep(e);case"ObjectPattern":return eS(e);case"ArrayPattern":return eT(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n5(e){switch(e.type){case"MethodDefinition":if(e.value?.type==="TSEmptyBodyFunctionExpression")return tx(e);return ez(e);case"PropertyDefinition":case"TSAbstractPropertyDefinition":case"AccessorProperty":case"TSAbstractAccessorProperty":return eQ(e);case"TSIndexSignature":return ns(e);case"TSAbstractMethodDefinition":if(x=1,e.value?.type==="TSEmptyBodyFunctionExpression")return tx(e);return ez(e);case"StaticBlock":return e_(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n9(e){switch(e.type){case"ImportSpecifier":return td(e);case"ImportDefaultSpecifier":return tf(e);case"ImportNamespaceSpecifier":return ty(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function n7(e){switch(e.type){case"FunctionDeclaration":return eY(e);case"TSInterfaceDeclaration":return nl(e);case"ClassDeclaration":return eV(e);case"TSDeclareFunction":return tb(e);default:return nQ(e)}}function re(e){switch(e.type){case"TSTypeReference":return tj(e);case"TSStringKeyword":return tD(e);case"TSUnionType":return t2(e);case"TSAnyKeyword":return tA(e);case"TSIntersectionType":return t4(e);case"TSTupleType":return t_(e);case"TSLiteralType":return tV(e);case"TSIndexedAccessType":return tQ(e);case"TSVoidKeyword":return tC(e);case"TSTypeLiteral":return nt(e);case"TSUndefinedKeyword":return tI(e);case"TSBooleanKeyword":return tF(e);case"TSNumberKeyword":return tk(e);case"TSArrayType":return tz(e);case"TSTypeQuery":return tK(e);case"TSFunctionType":return t9(e);case"TSNullKeyword":return tP(e);case"TSConditionalType":return t8(e);case"TSImportType":return tq(e);case"TSNeverKeyword":return tv(e);case"TSUnknownKeyword":return tU(e);case"TSInferType":return t6(e);case"TSTypeOperator":return t3(e);case"TSTemplateLiteralType":return tW(e);case"TSParenthesizedType":return t5(e);case"TSMappedType":return nn(e);case"TSTypePredicate":return ne(e);case"TSRestType":return tH(e);case"TSObjectKeyword":return tN(e);case"TSSymbolKeyword":return tL(e);case"TSConstructorType":return t7(e);case"TSBigIntKeyword":return t$(e);case"TSIntrinsicKeyword":return tB(e);case"TSThisType":return tJ(e);case"TSOptionalType":return tG(e);case"TSJSDocNullableType":return tZ(e);case"TSJSDocNonNullableType":return t1(e);case"TSJSDocUnknownType":return t0(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rt(e){switch(e.type){case"Identifier":return el(e);case"TSQualifiedName":return tX(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rn(e){switch(e.type){case"Identifier":return el(e);case"ThisExpression":return ee(e);case"TSQualifiedName":return tX(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rr(e){switch(e.type){case"Identifier":return ed(e);case"TSQualifiedName":return tX(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function ra(e){switch(e.type){case"ThisExpression":return ee(e);case"TSImportType":return tq(e);default:return rt(e)}}function ru(e){switch(e.type){case"Literal":if(null!=e.bigint||"bigint"==typeof e.value)return er(e);if("string"==typeof e.value)return et(e);if("number"==typeof e.value)return en(e);if("boolean"==typeof e.value)return ea(e);return et(e);case"UnaryExpression":return ex(e);case"TemplateLiteral":return es(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function ri(e){return"TSNamedTupleMember"===e.type?tY(e):re(e)}function rs(e){switch(e.type){case"TSPropertySignature":return nr(e);case"TSMethodSignature":return na(e);case"TSCallSignatureDeclaration":return nu(e);case"TSIndexSignature":return ns(e);case"TSConstructSignatureDeclaration":return ni(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function ro(e){switch(e.type){case"Identifier":return ed(e);case"TSThisType":return tJ(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rl(e){switch(e.type){case"Identifier":return ed(e);case"Literal":return et(e);case"TemplateLiteral":return es(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rc(e){switch(e.type){case"Identifier":return ep(e);case"Literal":return et(e);case"TSQualifiedName":return tX(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rp(e){switch(e.type){case"TSModuleDeclaration":return nT(e);case"TSModuleBlock":return nS(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rd(e){return"TSExternalModuleReference"===e.type?nI(e):rt(e)}function rf(e){switch(e.type){case"JSXIdentifier":return nJ(e);case"JSXMemberExpression":return nX(e);case"JSXNamespacedName":return nj(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function ry(e){switch(e.type){case"JSXIdentifier":return nJ(e);case"JSXMemberExpression":return nX(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rm(e){switch(e.type){case"JSXIdentifier":return nJ(e);case"JSXNamespacedName":return nj(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rT(e){switch(e.type){case"JSXAttribute":return nK(e);case"JSXSpreadAttribute":return nq(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rS(e){if("Literal"===e.type&&"string"==typeof e.value)return et({...e,raw:G(e)});switch(e.type){case"Literal":return et(e);case"JSXElement":return nk(e);case"JSXExpressionContainer":return nM(e);case"JSXFragment":return nL(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rg(e){return"JSXEmptyExpression"===e.type?nO(e):nQ(e)}function rh(e){switch(e.type){case"JSXText":return nR(e);case"JSXElement":return nk(e);case"JSXExpressionContainer":return nM(e);case"JSXFragment":return nL(e);case"JSXSpreadChild":return nV(e);default:throw TypeError(`Unsupported ESTree node type ${e.type}`)}}function rw(e){try{return rb(e)}finally{A()}}function rb(p){let f=p.end||0,m=e??E(f);e=void 0,({nodeCapacity:t,spans:n,kinds:r,payloadBuffer:a,payload:u,extraCapacity:i,extraBuffer:s,extra:o,poolCapacity:l,pool:c}=m),S=g=h=0,w=!1,x=0,b=d,new Uint8Array(a).fill(0,0,16*m.nodeCount),new Uint8Array(s).fill(0,0,4*m.extraCount);let T=H(p),A=m.header,v=new DataView(A.buffer);v.setUint32(0,S,!0),v.setUint32(4,g,!0),v.setUint32(8,w?h:0,!0),v.setUint32(12,w?0:h,!0),v.setUint32(16,0,!0),v.setUint32(20,0,!0),v.setUint32(24,0,!0),v.setUint32(28,T,!0);let C=U(1,p.sourceType);v.setUint32(32,C|(0!==x)<<2,!0),v.setUint32(36,w?0:b===d?h:b,!0);let P=new Uint8Array(n.buffer,0,8*S);if(!y){let e=new DataView((P=new Uint8Array(8*S)).buffer);for(let t=0;t<2*S;t++)e.setUint32(4*t,n[t],!0)}let I=[A,P,r.subarray(0,S),new Uint8Array(a,0,16*S),new Uint8Array(s,0,4*g),c.subarray(0,h)];return n.byteLength+r.byteLength+a.byteLength+s.byteLength+c.byteLength<=0x2000000&&(Object.assign(m,{nodeCapacity:t,spans:n,kinds:r,payloadBuffer:a,payload:u,nodeCount:S,extraCapacity:i,extraBuffer:s,extra:o,extraCount:g,poolCapacity:l,pool:c}),e=m),I}function rx(e){if(null==e)return 0;if("object"!=typeof e||Array.isArray(e))throw TypeError("options must be an object");return(1|rE(e.asciiOnly,"asciiOnly")<<1|rE(e.minify,"minify")<<3|rE(e.inlineScript,"inlineScript")<<5)>>>0}function rE(e,t){if(null==e)return 0;if("boolean"!=typeof e)throw TypeError(`${t} must be a boolean`);return e?2:1}function rA(e,t){let n=rx(t);return{code:p(...rw(e),n)}}export{rA as generateSync};
package/package.json CHANGED
@@ -1,14 +1,97 @@
1
1
  {
2
2
  "name": "@swc-next/generator",
3
- "version": "0.0.0",
4
- "description": "Reserved package name for SWC Next generator",
5
- "license": "Apache-2.0",
3
+ "version": "0.7.0",
4
+ "description": "The focused JavaScript and TypeScript code generator for SWC Next",
6
5
  "repository": {
7
6
  "type": "git",
8
- "url": "git+https://github.com/swc-project/swc-next.git"
7
+ "url": "git+https://github.com/swc-project/swc-next.git",
8
+ "directory": "npm/generator"
9
+ },
10
+ "main": "dist/index.js",
11
+ "type": "module",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
9
18
  },
19
+ "files": [
20
+ "dist/binding.d.ts",
21
+ "dist/binding.js",
22
+ "dist/index.d.ts",
23
+ "dist/index.js"
24
+ ],
10
25
  "publishConfig": {
11
26
  "access": "public",
12
27
  "registry": "https://registry.npmjs.org/"
28
+ },
29
+ "keywords": [
30
+ "ast",
31
+ "generator",
32
+ "javascript",
33
+ "swc",
34
+ "typescript"
35
+ ],
36
+ "license": "Apache-2.0",
37
+ "napi": {
38
+ "constEnum": false,
39
+ "binaryName": "swc-next-generator",
40
+ "packageName": "@swc-next/generator-binding",
41
+ "targets": [
42
+ "aarch64-apple-darwin",
43
+ "aarch64-pc-windows-msvc",
44
+ "aarch64-unknown-linux-gnu",
45
+ "aarch64-unknown-linux-musl",
46
+ "i686-pc-windows-msvc",
47
+ "powerpc64le-unknown-linux-gnu",
48
+ "riscv64gc-unknown-linux-gnu",
49
+ "riscv64gc-unknown-linux-musl",
50
+ "s390x-unknown-linux-gnu",
51
+ "x86_64-apple-darwin",
52
+ "x86_64-pc-windows-msvc",
53
+ "x86_64-unknown-linux-gnu",
54
+ "x86_64-unknown-linux-musl"
55
+ ]
56
+ },
57
+ "dependencies": {
58
+ "@swc-next/types": "0.7.0"
59
+ },
60
+ "wasm": {
61
+ "binaryName": "swc-next-generator",
62
+ "packageName": "@swc-next/generator-binding-wasm"
63
+ },
64
+ "devDependencies": {
65
+ "@napi-rs/cli": "^3.7.4",
66
+ "@types/node": "^26.1.1",
67
+ "@swc-next/protocol": "0.7.0"
68
+ },
69
+ "optionalDependencies": {
70
+ "@swc-next/generator-binding-darwin-arm64": "0.7.0",
71
+ "@swc-next/generator-binding-win32-arm64-msvc": "0.7.0",
72
+ "@swc-next/generator-binding-linux-arm64-gnu": "0.7.0",
73
+ "@swc-next/generator-binding-linux-arm64-musl": "0.7.0",
74
+ "@swc-next/generator-binding-win32-ia32-msvc": "0.7.0",
75
+ "@swc-next/generator-binding-linux-ppc64-gnu": "0.7.0",
76
+ "@swc-next/generator-binding-linux-riscv64-gnu": "0.7.0",
77
+ "@swc-next/generator-binding-linux-riscv64-musl": "0.7.0",
78
+ "@swc-next/generator-binding-linux-s390x-gnu": "0.7.0",
79
+ "@swc-next/generator-binding-darwin-x64": "0.7.0",
80
+ "@swc-next/generator-binding-win32-x64-msvc": "0.7.0",
81
+ "@swc-next/generator-binding-linux-x64-gnu": "0.7.0",
82
+ "@swc-next/generator-binding-linux-x64-musl": "0.7.0"
83
+ },
84
+ "peerDependencies": {
85
+ "@swc-next/generator-binding-wasm": "0.7.0"
86
+ },
87
+ "peerDependenciesMeta": {
88
+ "@swc-next/generator-binding-wasm": {
89
+ "optional": true
90
+ }
91
+ },
92
+ "scripts": {
93
+ "build": "napi build --platform --no-js --dts ../src-js/binding.d.ts --output-dir dist",
94
+ "build:js": "pnpm -w exec rslib build --lib generator",
95
+ "build:wasm": "cargo run --quiet --locked -p bridge_cli -- build generator --output-dir dist"
13
96
  }
14
- }
97
+ }