larry babby and threejs for glsl

This commit is contained in:
Sam
2024-06-24 21:24:00 +12:00
parent 87d5dc634d
commit 907ebae4c0
6474 changed files with 1279596 additions and 8 deletions

1358
webGl/my-threejs-test/node_modules/@swc/core/CHANGELOG.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

201
webGl/my-threejs-test/node_modules/@swc/core/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,201 @@
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:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) 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
(d) 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
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

97
webGl/my-threejs-test/node_modules/@swc/core/README.md generated vendored Normal file
View File

@@ -0,0 +1,97 @@
<p align="center">
<a href="https://swc.rs/">
<img alt="swc" src="https://raw.githubusercontent.com/swc-project/logo/master/swc.png" width="546">
</a>
</p>
<p align="center">
Make the web (development) faster.
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@swc/core">
<img alt="downloads (@swc/core)" src="https://img.shields.io/npm/dm/@swc/core?label=downloads%20%28%40swc%2Fcore%29">
</a>
<a href="https://www.npmjs.com/package/@swc/helpers">
<img alt="downloads (3rd party)" src="https://img.shields.io/npm/dm/@swc/helpers?label=downloads%20%283rd%20party%29">
</a>
</p>
<p align="center">
<a href="https://crates.io/crates/swc_ecma_parser">
<img alt="undefined" src="https://img.shields.io/crates/d/swc_ecma_parser.svg?label=crates.io%20downloads">
</a>
<a href="https://github.com/swc-project/swc/releases/latest">
<img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/swc-project/swc">
</a>
</p>
<p align="center">
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/swc-project/swc">
<a href="https://github.com/swc-project/swc/blob/main/package.json#L22">
<img alt="node-current (scoped)" src="https://img.shields.io/node/v/@swc/core">
</a>
</p>
<p align="center">
<a href="https://discord.com/invite/GnHbXTdZz6">
<img alt="Discord" src="https://img.shields.io/discord/889779439272075314">
</a>
</p>
SWC (stands for `Speedy Web Compiler`) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a library for Rust and JavaScript at the same time. If you are using SWC from Rust, see [rustdoc](https://rustdoc.swc.rs/swc/) and for most users, your entry point for using the library will be [parser](https://rustdoc.swc.rs/swc_ecma_parser/).
Also, SWC tries to ensure that
> If you select the latest version of each crates, it will work
for rust users.
MSRV of crates is currently `1.71`.
To update all SWC crates you use, you can run `curl https://raw.githubusercontent.com/swc-project/swc/main/scripts/update-all-swc-crates.sh | bash -s`. This script will update all dependencies to the latest version and run `cargo build` to ensure that everything works.
Note that you need
- `jq`
- `cargo upgrade`
command to run the script.
---
If you are using SWC from JavaScript, please refer to [docs on the website](https://swc.rs/docs/installation/).
# Documentation
Check out the documentation [in the website](https://swc.rs/docs/installation/).
# Features
Please see [comparison with babel](https://swc.rs/docs/migrating-from-babel).
# Performance
Please see [benchmark results](https://swc.rs/docs/benchmark-transform) on the website.
<h2 align="center">Supporting swc</h2>
<p align="center">
<a href="https://opencollective.com/swc">
<img src="https://raw.githubusercontent.com/swc-project/swc-sponsor-images/main/sponsors.svg" alt="Sponsors">
</a>
</p>
SWC is a community-driven project, and is maintained by a group of [volunteers](https://opencollective.com/swc#team). If you'd like to help support the future of the project, please consider:
- Giving developer time on the project. (Message us on [Discord](https://discord.gg/GnHbXTdZz6) (preferred) or [Github discussions](https://github.com/swc-project/swc/discussions) for guidance!)
- Giving funds by becoming a sponsor (see https://opencollective.com/swc)!
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md). You may also find the architecture
documentation useful ([ARCHITECTURE.md](ARCHITECTURE.md)).
## License
SWC is primarily distributed under the terms of the Apache License (Version 2.0).
See [LICENSE](LICENSE) for details.

View File

@@ -0,0 +1,218 @@
import { Accessibility, Argument, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BindingIdentifier, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, ExprOrSpread, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, Import, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttrValue, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleExportName, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingCall, OptionalChainingExpression, Param, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SuperPropExpression, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsCallSignatureDeclaration, TsConstAssertion, TsConstructSignatureDeclaration, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsGetterSignature, TsImportEqualsDeclaration, TsIndexSignature, TsInstantiation, TsInterfaceBody, TsInterfaceDeclaration, TsMethodSignature, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsPropertySignature, TsQualifiedName, TsSatisfiesExpression, TsSetterSignature, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression } from "@swc/types";
/**
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
*/
export declare class Visitor {
visitProgram(n: Program): Program;
visitModule(m: Module): Module;
visitScript(m: Script): Script;
visitModuleItems(items: ModuleItem[]): ModuleItem[];
visitModuleItem(n: ModuleItem): ModuleItem;
visitModuleDeclaration(n: ModuleDeclaration): ModuleDeclaration;
visitTsNamespaceExportDeclaration(n: TsNamespaceExportDeclaration): ModuleDeclaration;
visitTsExportAssignment(n: TsExportAssignment): TsExportAssignment;
visitTsImportEqualsDeclaration(n: TsImportEqualsDeclaration): ModuleDeclaration;
visitTsModuleReference(n: TsModuleReference): TsModuleReference;
visitTsExternalModuleReference(n: TsExternalModuleReference): TsExternalModuleReference;
visitExportAllDeclaration(n: ExportAllDeclaration): ModuleDeclaration;
visitExportDefaultExpression(n: ExportDefaultExpression): ModuleDeclaration;
visitExportNamedDeclaration(n: ExportNamedDeclaration): ModuleDeclaration;
visitExportSpecifiers(nodes: ExportSpecifier[]): ExportSpecifier[];
visitExportSpecifier(n: ExportSpecifier): ExportSpecifier;
visitNamedExportSpecifier(n: NamedExportSpecifier): ExportSpecifier;
visitModuleExportName(n: ModuleExportName): ModuleExportName;
visitExportNamespaceSpecifier(n: ExportNamespaceSpecifier): ExportSpecifier;
visitExportDefaultSpecifier(n: ExportDefaultSpecifier): ExportSpecifier;
visitOptionalStringLiteral(n: StringLiteral | undefined): StringLiteral | undefined;
visitExportDefaultDeclaration(n: ExportDefaultDeclaration): ModuleDeclaration;
visitDefaultDeclaration(n: DefaultDecl): DefaultDecl;
visitFunctionExpression(n: FunctionExpression): FunctionExpression;
visitClassExpression(n: ClassExpression): ClassExpression;
visitExportDeclaration(n: ExportDeclaration): ModuleDeclaration;
visitArrayExpression(e: ArrayExpression): Expression;
visitArrayElement(e: ExprOrSpread | undefined): ExprOrSpread | undefined;
visitExprOrSpread(e: ExprOrSpread): ExprOrSpread;
visitExprOrSpreads(nodes: ExprOrSpread[]): ExprOrSpread[];
visitSpreadElement(e: SpreadElement): SpreadElement;
visitOptionalExpression(e: Expression | undefined): Expression | undefined;
visitArrowFunctionExpression(e: ArrowFunctionExpression): Expression;
visitArrowBody(body: BlockStatement | Expression): BlockStatement | Expression;
visitBlockStatement(block: BlockStatement): BlockStatement;
visitStatements(stmts: Statement[]): Statement[];
visitStatement(stmt: Statement): Statement;
visitSwitchStatement(stmt: SwitchStatement): Statement;
visitSwitchCases(cases: SwitchCase[]): SwitchCase[];
visitSwitchCase(c: SwitchCase): SwitchCase;
visitIfStatement(stmt: IfStatement): Statement;
visitOptionalStatement(stmt: Statement | undefined): Statement | undefined;
visitBreakStatement(stmt: BreakStatement): Statement;
visitWhileStatement(stmt: WhileStatement): Statement;
visitTryStatement(stmt: TryStatement): Statement;
visitCatchClause(handler: CatchClause | undefined): CatchClause | undefined;
visitThrowStatement(stmt: ThrowStatement): Statement;
visitReturnStatement(stmt: ReturnStatement): Statement;
visitLabeledStatement(stmt: LabeledStatement): Statement;
visitForStatement(stmt: ForStatement): Statement;
visitForOfStatement(stmt: ForOfStatement): Statement;
visitForInStatement(stmt: ForInStatement): Statement;
visitEmptyStatement(stmt: EmptyStatement): EmptyStatement;
visitDoWhileStatement(stmt: DoWhileStatement): Statement;
visitDebuggerStatement(stmt: DebuggerStatement): Statement;
visitWithStatement(stmt: WithStatement): Statement;
visitDeclaration(decl: Declaration): Declaration;
visitVariableDeclaration(n: VariableDeclaration): VariableDeclaration;
visitVariableDeclarators(nodes: VariableDeclarator[]): VariableDeclarator[];
visitVariableDeclarator(n: VariableDeclarator): VariableDeclarator;
visitTsTypeAliasDeclaration(n: TsTypeAliasDeclaration): Declaration;
visitTsModuleDeclaration(n: TsModuleDeclaration): Declaration;
visitTsModuleName(n: TsModuleName): TsModuleName;
visitTsNamespaceBody(n: TsNamespaceBody): TsNamespaceBody | undefined;
visitTsNamespaceDeclaration(n: TsNamespaceDeclaration): TsModuleBlock | TsNamespaceDeclaration;
visitTsModuleBlock(n: TsModuleBlock): TsModuleBlock | TsNamespaceDeclaration;
visitTsInterfaceDeclaration(n: TsInterfaceDeclaration): TsInterfaceDeclaration;
visitTsInterfaceBody(n: TsInterfaceBody): TsInterfaceBody;
visitTsTypeElements(nodes: TsTypeElement[]): TsTypeElement[];
visitTsTypeElement(n: TsTypeElement): TsTypeElement;
visitTsCallSignatureDeclaration(n: TsCallSignatureDeclaration): TsCallSignatureDeclaration;
visitTsConstructSignatureDeclaration(n: TsConstructSignatureDeclaration): TsConstructSignatureDeclaration;
visitTsPropertySignature(n: TsPropertySignature): TsPropertySignature;
visitTsGetterSignature(n: TsGetterSignature): TsGetterSignature;
visitTsSetterSignature(n: TsSetterSignature): TsSetterSignature;
visitTsMethodSignature(n: TsMethodSignature): TsMethodSignature;
visitTsEnumDeclaration(n: TsEnumDeclaration): Declaration;
visitTsEnumMembers(nodes: TsEnumMember[]): TsEnumMember[];
visitTsEnumMember(n: TsEnumMember): TsEnumMember;
visitTsEnumMemberId(n: TsEnumMemberId): TsEnumMemberId;
visitFunctionDeclaration(decl: FunctionDeclaration): Declaration;
visitClassDeclaration(decl: ClassDeclaration): Declaration;
visitClassBody(members: ClassMember[]): ClassMember[];
visitClassMember(member: ClassMember): ClassMember;
visitTsIndexSignature(n: TsIndexSignature): TsIndexSignature;
visitTsFnParameters(params: TsFnParameter[]): TsFnParameter[];
visitTsFnParameter(n: TsFnParameter): TsFnParameter;
visitPrivateProperty(n: PrivateProperty): ClassMember;
visitPrivateMethod(n: PrivateMethod): ClassMember;
visitPrivateName(n: PrivateName): PrivateName;
visitConstructor(n: Constructor): ClassMember;
visitConstructorParameters(nodes: (Param | TsParameterProperty)[]): (Param | TsParameterProperty)[];
visitConstructorParameter(n: Param | TsParameterProperty): Param | TsParameterProperty;
visitStaticBlock(n: StaticBlock): StaticBlock;
visitTsParameterProperty(n: TsParameterProperty): TsParameterProperty | Param;
visitTsParameterPropertyParameter(n: TsParameterPropertyParameter): TsParameterPropertyParameter;
visitPropertyName(key: PropertyName): PropertyName;
visitAccessibility(n: Accessibility | undefined): Accessibility | undefined;
visitClassProperty(n: ClassProperty): ClassMember;
visitClassMethod(n: ClassMethod): ClassMember;
visitComputedPropertyKey(n: ComputedPropName): ComputedPropName;
visitClass<T extends Class>(n: T): T;
visitFunction<T extends Fn>(n: T): T;
visitTsExpressionsWithTypeArguments(nodes: TsExpressionWithTypeArguments[]): TsExpressionWithTypeArguments[];
visitTsExpressionWithTypeArguments(n: TsExpressionWithTypeArguments): TsExpressionWithTypeArguments;
visitTsTypeParameterInstantiation(n: TsTypeParameterInstantiation | undefined): TsTypeParameterInstantiation | undefined;
visitTsTypes(nodes: TsType[]): TsType[];
visitTsEntityName(n: TsEntityName): TsEntityName;
visitTsQualifiedName(n: TsQualifiedName): TsQualifiedName;
visitDecorators(nodes: Decorator[] | undefined): Decorator[] | undefined;
visitDecorator(n: Decorator): Decorator;
visitExpressionStatement(stmt: ExpressionStatement): Statement;
visitContinueStatement(stmt: ContinueStatement): Statement;
visitExpression(n: Expression): Expression;
visitOptionalChainingExpression(n: OptionalChainingExpression): Expression;
visitMemberExpressionOrOptionalChainingCall(n: MemberExpression | OptionalChainingCall): MemberExpression | OptionalChainingCall;
visitOptionalChainingCall(n: OptionalChainingCall): OptionalChainingCall;
visitAssignmentExpression(n: AssignmentExpression): Expression;
visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression;
visitYieldExpression(n: YieldExpression): Expression;
visitUpdateExpression(n: UpdateExpression): Expression;
visitUnaryExpression(n: UnaryExpression): Expression;
visitTsTypeAssertion(n: TsTypeAssertion): Expression;
visitTsConstAssertion(n: TsConstAssertion): Expression;
visitTsInstantiation(n: TsInstantiation): TsInstantiation;
visitTsNonNullExpression(n: TsNonNullExpression): Expression;
visitTsAsExpression(n: TsAsExpression): Expression;
visitTsSatisfiesExpression(n: TsSatisfiesExpression): Expression;
visitThisExpression(n: ThisExpression): Expression;
visitTemplateLiteral(n: TemplateLiteral): Expression;
visitParameters(n: Param[]): Param[];
visitParameter(n: Param): Param;
visitTaggedTemplateExpression(n: TaggedTemplateExpression): Expression;
visitSequenceExpression(n: SequenceExpression): Expression;
visitRegExpLiteral(n: RegExpLiteral): Expression;
visitParenthesisExpression(n: ParenthesisExpression): Expression;
visitObjectExpression(n: ObjectExpression): Expression;
visitObjectProperties(nodes: (Property | SpreadElement)[]): (Property | SpreadElement)[];
visitObjectProperty(n: Property | SpreadElement): Property | SpreadElement;
visitProperty(n: Property): Property | SpreadElement;
visitSetterProperty(n: SetterProperty): Property | SpreadElement;
visitMethodProperty(n: MethodProperty): Property | SpreadElement;
visitKeyValueProperty(n: KeyValueProperty): Property | SpreadElement;
visitGetterProperty(n: GetterProperty): Property | SpreadElement;
visitAssignmentProperty(n: AssignmentProperty): Property | SpreadElement;
visitNullLiteral(n: NullLiteral): NullLiteral;
visitNewExpression(n: NewExpression): Expression;
visitTsTypeArguments(n: TsTypeParameterInstantiation | undefined): TsTypeParameterInstantiation | undefined;
visitArguments(nodes: Argument[]): Argument[];
visitArgument(n: Argument): Argument;
visitMetaProperty(n: MetaProperty): Expression;
visitMemberExpression(n: MemberExpression): MemberExpression;
visitSuperPropExpression(n: SuperPropExpression): Expression;
visitCallee(n: Expression | Super | Import): Expression | Super | Import;
visitJSXText(n: JSXText): JSXText;
visitJSXNamespacedName(n: JSXNamespacedName): JSXNamespacedName;
visitJSXMemberExpression(n: JSXMemberExpression): JSXMemberExpression;
visitJSXObject(n: JSXObject): JSXObject;
visitJSXFragment(n: JSXFragment): JSXFragment;
visitJSXClosingFragment(n: JSXClosingFragment): JSXClosingFragment;
visitJSXElementChildren(nodes: JSXElementChild[]): JSXElementChild[];
visitJSXElementChild(n: JSXElementChild): JSXElementChild;
visitJSXExpressionContainer(n: JSXExpressionContainer): JSXExpressionContainer;
visitJSXSpreadChild(n: JSXSpreadChild): JSXElementChild;
visitJSXOpeningFragment(n: JSXOpeningFragment): JSXOpeningFragment;
visitJSXEmptyExpression(n: JSXEmptyExpression): Expression;
visitJSXElement(n: JSXElement): JSXElement;
visitJSXClosingElement(n: JSXClosingElement | undefined): JSXClosingElement | undefined;
visitJSXElementName(n: JSXElementName): JSXElementName;
visitJSXOpeningElement(n: JSXOpeningElement): JSXOpeningElement;
visitJSXAttributes(attrs: JSXAttributeOrSpread[] | undefined): JSXAttributeOrSpread[] | undefined;
visitJSXAttributeOrSpread(n: JSXAttributeOrSpread): JSXAttributeOrSpread;
visitJSXAttributeOrSpreads(nodes: JSXAttributeOrSpread[]): JSXAttributeOrSpread[];
visitJSXAttribute(n: JSXAttribute): JSXAttributeOrSpread;
visitJSXAttributeValue(n: JSXAttrValue | undefined): JSXAttrValue | undefined;
visitJSXAttributeName(n: JSXAttributeName): JSXAttributeName;
visitConditionalExpression(n: ConditionalExpression): Expression;
visitCallExpression(n: CallExpression): Expression;
visitBooleanLiteral(n: BooleanLiteral): BooleanLiteral;
visitBinaryExpression(n: BinaryExpression): Expression;
visitAwaitExpression(n: AwaitExpression): Expression;
visitTsTypeParameterDeclaration(n: TsTypeParameterDeclaration | undefined): TsTypeParameterDeclaration | undefined;
visitTsTypeParameters(nodes: TsTypeParameter[]): TsTypeParameter[];
visitTsTypeParameter(n: TsTypeParameter): TsTypeParameter;
visitTsTypeAnnotation(a: TsTypeAnnotation | undefined): TsTypeAnnotation | undefined;
visitTsType(n: TsType): TsType;
visitPatterns(nodes: Pattern[]): Pattern[];
visitImportDeclaration(n: ImportDeclaration): ImportDeclaration;
visitImportSpecifiers(nodes: ImportSpecifier[]): ImportSpecifier[];
visitImportSpecifier(node: ImportSpecifier): ImportSpecifier;
visitNamedImportSpecifier(node: NamedImportSpecifier): NamedImportSpecifier;
visitImportNamespaceSpecifier(node: ImportNamespaceSpecifier): ImportNamespaceSpecifier;
visitImportDefaultSpecifier(node: ImportDefaultSpecifier): ImportSpecifier;
visitBindingIdentifier(i: BindingIdentifier): BindingIdentifier;
visitIdentifierReference(i: Identifier): Identifier;
visitLabelIdentifier(label: Identifier): Identifier;
visitIdentifier(n: Identifier): Identifier;
visitStringLiteral(n: StringLiteral): StringLiteral;
visitNumericLiteral(n: NumericLiteral): NumericLiteral;
visitBigIntLiteral(n: BigIntLiteral): BigIntLiteral;
visitPattern(n: Pattern): Pattern;
visitRestElement(n: RestElement): RestElement;
visitAssignmentPattern(n: AssignmentPattern): Pattern;
visitObjectPattern(n: ObjectPattern): Pattern;
visitObjectPatternProperties(nodes: ObjectPatternProperty[]): ObjectPatternProperty[];
visitObjectPatternProperty(n: ObjectPatternProperty): ObjectPatternProperty;
visitKeyValuePatternProperty(n: KeyValuePatternProperty): ObjectPatternProperty;
visitAssignmentPatternProperty(n: AssignmentPatternProperty): ObjectPatternProperty;
visitArrayPattern(n: ArrayPattern): Pattern;
visitArrayPatternElements(nodes: (Pattern | undefined)[]): (Pattern | undefined)[];
visitArrayPatternElement(n: Pattern | undefined): Pattern | undefined;
}
export default Visitor;

1408
webGl/my-threejs-test/node_modules/@swc/core/Visitor.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
export {};

337
webGl/my-threejs-test/node_modules/@swc/core/binding.js generated vendored Normal file
View File

@@ -0,0 +1,337 @@
"use strict";
// prettier-ignore
/* eslint-disable */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs');
const { join } = require('path');
const { platform, arch } = process;
let nativeBinding = null;
let localFileExisted = false;
let loadError = null;
const isMusl = () => {
let musl = false;
if (process.platform === 'linux') {
musl = isMuslFromFilesystem();
if (musl === null) {
musl = isMuslFromReport();
}
if (musl === null) {
musl = isMuslFromChildProcess();
}
}
return musl;
};
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-');
const isMuslFromFilesystem = () => {
try {
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl');
}
catch (_a) {
return null;
}
};
const isMuslFromReport = () => {
const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null;
if (!report) {
return null;
}
if (report.header && report.header.glibcVersionRuntime) {
return false;
}
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) {
return true;
}
}
return false;
};
const isMuslFromChildProcess = () => {
try {
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl');
}
catch (e) {
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
return false;
}
};
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'swc.android-arm64.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.android-arm64.node');
}
else {
nativeBinding = require('@swc/core-android-arm64');
}
}
catch (e) {
loadError = e;
}
break;
case 'arm':
localFileExisted = existsSync(join(__dirname, 'swc.android-arm-eabi.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.android-arm-eabi.node');
}
else {
nativeBinding = require('@swc/core-android-arm-eabi');
}
}
catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Android ${arch}`);
}
break;
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'swc.win32-x64-msvc.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.win32-x64-msvc.node');
}
else {
nativeBinding = require('@swc/core-win32-x64-msvc');
}
}
catch (e) {
loadError = e;
}
break;
case 'ia32':
localFileExisted = existsSync(join(__dirname, 'swc.win32-ia32-msvc.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.win32-ia32-msvc.node');
}
else {
nativeBinding = require('@swc/core-win32-ia32-msvc');
}
}
catch (e) {
loadError = e;
}
break;
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'swc.win32-arm64-msvc.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.win32-arm64-msvc.node');
}
else {
nativeBinding = require('@swc/core-win32-arm64-msvc');
}
}
catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`);
}
break;
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'swc.darwin-universal.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.darwin-universal.node');
}
else {
nativeBinding = require('@swc/core-darwin-universal');
}
break;
}
catch (_a) { }
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'swc.darwin-x64.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.darwin-x64.node');
}
else {
nativeBinding = require('@swc/core-darwin-x64');
}
}
catch (e) {
loadError = e;
}
break;
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'swc.darwin-arm64.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.darwin-arm64.node');
}
else {
nativeBinding = require('@swc/core-darwin-arm64');
}
}
catch (e) {
loadError = e;
}
break;
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`);
}
break;
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
}
localFileExisted = existsSync(join(__dirname, 'swc.freebsd-x64.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.freebsd-x64.node');
}
else {
nativeBinding = require('@swc/core-freebsd-x64');
}
}
catch (e) {
loadError = e;
}
break;
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'swc.linux-x64-musl.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-x64-musl.node');
}
else {
nativeBinding = require('@swc/core-linux-x64-musl');
}
}
catch (e) {
loadError = e;
}
}
else {
localFileExisted = existsSync(join(__dirname, 'swc.linux-x64-gnu.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-x64-gnu.node');
}
else {
nativeBinding = require('@swc/core-linux-x64-gnu');
}
}
catch (e) {
loadError = e;
}
}
break;
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'swc.linux-arm64-musl.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-arm64-musl.node');
}
else {
nativeBinding = require('@swc/core-linux-arm64-musl');
}
}
catch (e) {
loadError = e;
}
}
else {
localFileExisted = existsSync(join(__dirname, 'swc.linux-arm64-gnu.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-arm64-gnu.node');
}
else {
nativeBinding = require('@swc/core-linux-arm64-gnu');
}
}
catch (e) {
loadError = e;
}
}
break;
case 'arm':
localFileExisted = existsSync(join(__dirname, 'swc.linux-arm-gnueabihf.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-arm-gnueabihf.node');
}
else {
nativeBinding = require('@swc/core-linux-arm-gnueabihf');
}
}
catch (e) {
loadError = e;
}
break;
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(join(__dirname, 'swc.linux-riscv64-musl.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-riscv64-musl.node');
}
else {
nativeBinding = require('@swc/core-linux-riscv64-musl');
}
}
catch (e) {
loadError = e;
}
}
else {
localFileExisted = existsSync(join(__dirname, 'swc.linux-riscv64-gnu.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.linux-riscv64-gnu.node');
}
else {
nativeBinding = require('@swc/core-linux-riscv64-gnu');
}
}
catch (e) {
loadError = e;
}
}
break;
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`);
}
break;
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
}
if (!nativeBinding) {
if (loadError) {
throw loadError;
}
throw new Error(`Failed to load native binding`);
}
module.exports.Compiler = nativeBinding.Compiler;
module.exports.JsCompiler = nativeBinding.JsCompiler;
module.exports.bundle = nativeBinding.bundle;
module.exports.getTargetTriple = nativeBinding.getTargetTriple;
module.exports.initCustomTraceSubscriber = nativeBinding.initCustomTraceSubscriber;
module.exports.minify = nativeBinding.minify;
module.exports.minifySync = nativeBinding.minifySync;
module.exports.parse = nativeBinding.parse;
module.exports.parseFile = nativeBinding.parseFile;
module.exports.parseFileSync = nativeBinding.parseFileSync;
module.exports.parseSync = nativeBinding.parseSync;
module.exports.print = nativeBinding.print;
module.exports.printSync = nativeBinding.printSync;
module.exports.transform = nativeBinding.transform;
module.exports.transformFile = nativeBinding.transformFile;
module.exports.transformFileSync = nativeBinding.transformFileSync;
module.exports.transformSync = nativeBinding.transformSync;

View File

@@ -0,0 +1,6 @@
## SWC bindings
This folder contains actual bindings binary SWC will build for the supported platforms (`@swc/core`, `swc_cli`, `@swc/wasm`).
All the bindings binary uses publicly published `swc_core` SDK to build deterministic host binary for the specific changes, in result Cargo's workspace gets confused to select dependency versions if it belongs to the workspace contains unpublished packages. To avoid those problems, these bindings are not being built as part of the workspace.

View File

@@ -0,0 +1,5 @@
{
"devDependencies": {
"jest": "^29.7.0"
}
}

110
webGl/my-threejs-test/node_modules/@swc/core/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,110 @@
import type { Plugin, ParseOptions, Module, Output, Options, Script, Program, JsMinifyOptions } from "@swc/types";
export * from "@swc/types";
import { BundleInput } from "./spack";
/**
* Version of the swc binding.
*/
export declare const version: string;
/**
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
*/
export declare function plugins(ps: Plugin[]): Plugin;
export declare class Compiler {
private fallbackBindingsPluginWarningDisplayed;
minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
minifySync(src: string, opts?: JsMinifyOptions): Output;
parse(src: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
parse(src: string, options?: ParseOptions, filename?: string): Promise<Module>;
parseSync(src: string, options: ParseOptions & {
isModule: false;
}): Script;
parseSync(src: string, options?: ParseOptions, filename?: string): Module;
parseFile(path: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
parseFile(path: string, options?: ParseOptions): Promise<Module>;
parseFileSync(path: string, options: ParseOptions & {
isModule: false;
}): Script;
parseFileSync(path: string, options?: ParseOptions): Module;
/**
* Note: this method should be invoked on the compiler instance used
* for `parse()` / `parseSync()`.
*/
print(m: Program, options?: Options): Promise<Output>;
/**
* Note: this method should be invoked on the compiler instance used
* for `parse()` / `parseSync()`.
*/
printSync(m: Program, options?: Options): Output;
transform(src: string | Program, options?: Options): Promise<Output>;
transformSync(src: string | Program, options?: Options): Output;
transformFile(path: string, options?: Options): Promise<Output>;
transformFileSync(path: string, options?: Options): Output;
bundle(options?: BundleInput | string): Promise<{
[name: string]: Output;
}>;
}
export declare function parse(src: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
export declare function parse(src: string, options?: ParseOptions): Promise<Module>;
export declare function parseSync(src: string, options: ParseOptions & {
isModule: false;
}): Script;
export declare function parseSync(src: string, options?: ParseOptions): Module;
export declare function parseFile(path: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
export declare function parseFile(path: string, options?: ParseOptions): Promise<Module>;
export declare function parseFileSync(path: string, options: ParseOptions & {
isModule: false;
}): Script;
export declare function parseFileSync(path: string, options?: ParseOptions): Module;
export declare function print(m: Program, options?: Options): Promise<Output>;
export declare function printSync(m: Program, options?: Options): Output;
export declare function transform(src: string | Program, options?: Options): Promise<Output>;
export declare function transformSync(src: string | Program, options?: Options): Output;
export declare function transformFile(path: string, options?: Options): Promise<Output>;
export declare function transformFileSync(path: string, options?: Options): Output;
export declare function bundle(options?: BundleInput | string): Promise<{
[name: string]: Output;
}>;
export declare function minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
export declare function minifySync(src: string, opts?: JsMinifyOptions): Output;
/**
* Configure custom trace configuration runs for a process lifecycle.
* Currently only chromium's trace event format is supported.
* (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)
*
* This should be called before calling any binding interfaces exported in `@swc/core`, such as
* `transform*`, or `parse*` or anything. To avoid breaking changes, each binding fn internally
* sets default trace subscriber if not set.
*
* Unlike other configuration, this does not belong to individual api surface using swcrc
* or api's parameters (`transform(..., {trace})`). This is due to current tracing subscriber
* can be configured only once for the global scope. Calling `registerGlobalTraceConfig` multiple
* time won't cause error, subsequent calls will be ignored.
*
* As name implies currently this is experimental interface may change over time without semver
* major breaking changes. Please provide feedbacks,
* or bug report at https://github.com/swc-project/swc/discussions.
*/
export declare function __experimental_registerGlobalTraceConfig(traceConfig: {
type: 'traceEvent';
fileName?: string;
}): void;
/**
* @ignore
*
* Returns current binary's metadata to determine which binary is actually loaded.
*
* This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
* as internal representation may change anytime. Use it with caution.
*/
export declare function getBinaryMetadata(): {
target: string | undefined;
};
export declare const DEFAULT_EXTENSIONS: readonly string[];

431
webGl/my-threejs-test/node_modules/@swc/core/index.js generated vendored Normal file
View File

@@ -0,0 +1,431 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_EXTENSIONS = exports.getBinaryMetadata = exports.__experimental_registerGlobalTraceConfig = exports.minifySync = exports.minify = exports.bundle = exports.transformFileSync = exports.transformFile = exports.transformSync = exports.transform = exports.printSync = exports.print = exports.parseFileSync = exports.parseFile = exports.parseSync = exports.parse = exports.Compiler = exports.plugins = exports.version = void 0;
const path_1 = require("path");
__exportStar(require("@swc/types"), exports);
const spack_1 = require("./spack");
const assert = __importStar(require("assert"));
// Allow overrides to the location of the .node binding file
const bindingsOverride = process.env["SWC_BINARY_PATH"];
// `@swc/core` includes d.ts for the `@swc/wasm` to provide typed fallback bindings
// todo: fix package.json scripts
let fallbackBindings;
const bindings = (() => {
let binding;
try {
binding = !!bindingsOverride ? require((0, path_1.resolve)(bindingsOverride)) : require('./binding');
// If native binding loaded successfully, it should return proper target triple constant.
const triple = binding.getTargetTriple();
assert.ok(triple, 'Failed to read target triple from native binary.');
return binding;
}
catch (_) {
// postinstall supposed to install `@swc/wasm` already
fallbackBindings = require('@swc/wasm');
}
finally {
return binding;
}
})();
/**
* Version of the swc binding.
*/
exports.version = require("./package.json").version;
/**
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
*/
function plugins(ps) {
return mod => {
let m = mod;
for (const p of ps) {
m = p(m);
}
return m;
};
}
exports.plugins = plugins;
class Compiler {
constructor() {
this.fallbackBindingsPluginWarningDisplayed = false;
}
minify(src, opts) {
return __awaiter(this, void 0, void 0, function* () {
if (bindings) {
return bindings.minify(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
}
else if (fallbackBindings) {
return fallbackBindings.minify(src, opts);
}
throw new Error('Bindings not found.');
});
}
minifySync(src, opts) {
if (bindings) {
return bindings.minifySync(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
}
else if (fallbackBindings) {
return fallbackBindings.minifySync(src, opts);
}
throw new Error('Bindings not found.');
}
parse(src, options, filename) {
return __awaiter(this, void 0, void 0, function* () {
options = options || { syntax: "ecmascript" };
options.syntax = options.syntax || "ecmascript";
if (!bindings && !!fallbackBindings) {
throw new Error('Fallback bindings does not support this interface yet.');
}
else if (!bindings) {
throw new Error('Bindings not found.');
}
if (bindings) {
const res = yield bindings.parse(src, toBuffer(options), filename);
return JSON.parse(res);
}
else if (fallbackBindings) {
return fallbackBindings.parse(src, options);
}
throw new Error('Bindings not found.');
});
}
parseSync(src, options, filename) {
options = options || { syntax: "ecmascript" };
options.syntax = options.syntax || "ecmascript";
if (bindings) {
return JSON.parse(bindings.parseSync(src, toBuffer(options), filename));
}
else if (fallbackBindings) {
return fallbackBindings.parseSync(src, options);
}
throw new Error('Bindings not found.');
}
parseFile(path, options) {
return __awaiter(this, void 0, void 0, function* () {
options = options || { syntax: "ecmascript" };
options.syntax = options.syntax || "ecmascript";
if (!bindings && !!fallbackBindings) {
throw new Error('Fallback bindings does not support filesystem access.');
}
else if (!bindings) {
throw new Error('Bindings not found.');
}
const res = yield bindings.parseFile(path, toBuffer(options));
return JSON.parse(res);
});
}
parseFileSync(path, options) {
options = options || { syntax: "ecmascript" };
options.syntax = options.syntax || "ecmascript";
if (!bindings && !!fallbackBindings) {
throw new Error('Fallback bindings does not support filesystem access');
}
else if (!bindings) {
throw new Error('Bindings not found.');
}
return JSON.parse(bindings.parseFileSync(path, toBuffer(options)));
}
/**
* Note: this method should be invoked on the compiler instance used
* for `parse()` / `parseSync()`.
*/
print(m, options) {
return __awaiter(this, void 0, void 0, function* () {
options = options || {};
if (bindings) {
return bindings.print(JSON.stringify(m), toBuffer(options));
}
else if (fallbackBindings) {
return fallbackBindings.print(m, options);
}
throw new Error('Bindings not found.');
});
}
/**
* Note: this method should be invoked on the compiler instance used
* for `parse()` / `parseSync()`.
*/
printSync(m, options) {
options = options || {};
if (bindings) {
return bindings.printSync(JSON.stringify(m), toBuffer(options));
}
else if (fallbackBindings) {
return fallbackBindings.printSync(m, options);
}
throw new Error('Bindings not found.');
}
transform(src, options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
const isModule = typeof src !== "string";
options = options || {};
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
}
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
if (bindings) {
if (plugin) {
const m = typeof src === "string"
? yield this.parse(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename)
: src;
return this.transform(plugin(m), newOptions);
}
return bindings.transform(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
}
else if (fallbackBindings) {
if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
this.fallbackBindingsPluginWarningDisplayed = true;
}
return fallbackBindings.transform(src, options);
}
throw new Error('Bindings not found.');
});
}
transformSync(src, options) {
var _a, _b, _c;
const isModule = typeof src !== "string";
options = options || {};
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
}
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
if (bindings) {
if (plugin) {
const m = typeof src === "string" ? this.parseSync(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename) : src;
return this.transformSync(plugin(m), newOptions);
}
return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
}
else if (fallbackBindings) {
if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
this.fallbackBindingsPluginWarningDisplayed = true;
}
return fallbackBindings.transformSync(isModule ? JSON.stringify(src) : src, options);
}
throw new Error("Bindings not found");
}
transformFile(path, options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
if (!bindings && !!fallbackBindings) {
throw new Error('Fallback bindings does not support filesystem access.');
}
else if (!bindings) {
throw new Error('Bindings not found.');
}
options = options || {};
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
}
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
newOptions.filename = path;
if (plugin) {
const m = yield this.parseFile(path, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser);
return this.transform(plugin(m), newOptions);
}
return bindings.transformFile(path, false, toBuffer(newOptions));
});
}
transformFileSync(path, options) {
var _a, _b, _c;
if (!bindings && !!fallbackBindings) {
throw new Error('Fallback bindings does not support filesystem access.');
}
else if (!bindings) {
throw new Error('Bindings not found.');
}
options = options || {};
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
}
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
newOptions.filename = path;
if (plugin) {
const m = this.parseFileSync(path, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser);
return this.transformSync(plugin(m), newOptions);
}
return bindings.transformFileSync(path, /* isModule */ false, toBuffer(newOptions));
}
bundle(options) {
return __awaiter(this, void 0, void 0, function* () {
if (!bindings && !!fallbackBindings) {
throw new Error('Fallback bindings does not support this interface yet.');
}
else if (!bindings) {
throw new Error('Bindings not found.');
}
const opts = yield (0, spack_1.compileBundleOptions)(options);
if (Array.isArray(opts)) {
const all = yield Promise.all(opts.map((opt) => __awaiter(this, void 0, void 0, function* () {
return this.bundle(opt);
})));
let obj = {};
for (const o of all) {
obj = Object.assign(Object.assign({}, obj), o);
}
return obj;
}
return bindings.bundle(toBuffer(Object.assign({}, opts)));
});
}
}
exports.Compiler = Compiler;
const compiler = new Compiler();
function parse(src, options) {
return compiler.parse(src, options);
}
exports.parse = parse;
function parseSync(src, options) {
return compiler.parseSync(src, options);
}
exports.parseSync = parseSync;
function parseFile(path, options) {
return compiler.parseFile(path, options);
}
exports.parseFile = parseFile;
function parseFileSync(path, options) {
return compiler.parseFileSync(path, options);
}
exports.parseFileSync = parseFileSync;
function print(m, options) {
return compiler.print(m, options);
}
exports.print = print;
function printSync(m, options) {
return compiler.printSync(m, options);
}
exports.printSync = printSync;
function transform(src, options) {
return compiler.transform(src, options);
}
exports.transform = transform;
function transformSync(src, options) {
return compiler.transformSync(src, options);
}
exports.transformSync = transformSync;
function transformFile(path, options) {
return compiler.transformFile(path, options);
}
exports.transformFile = transformFile;
function transformFileSync(path, options) {
return compiler.transformFileSync(path, options);
}
exports.transformFileSync = transformFileSync;
function bundle(options) {
return compiler.bundle(options);
}
exports.bundle = bundle;
function minify(src, opts) {
return __awaiter(this, void 0, void 0, function* () {
return compiler.minify(src, opts);
});
}
exports.minify = minify;
function minifySync(src, opts) {
return compiler.minifySync(src, opts);
}
exports.minifySync = minifySync;
/**
* Configure custom trace configuration runs for a process lifecycle.
* Currently only chromium's trace event format is supported.
* (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)
*
* This should be called before calling any binding interfaces exported in `@swc/core`, such as
* `transform*`, or `parse*` or anything. To avoid breaking changes, each binding fn internally
* sets default trace subscriber if not set.
*
* Unlike other configuration, this does not belong to individual api surface using swcrc
* or api's parameters (`transform(..., {trace})`). This is due to current tracing subscriber
* can be configured only once for the global scope. Calling `registerGlobalTraceConfig` multiple
* time won't cause error, subsequent calls will be ignored.
*
* As name implies currently this is experimental interface may change over time without semver
* major breaking changes. Please provide feedbacks,
* or bug report at https://github.com/swc-project/swc/discussions.
*/
function __experimental_registerGlobalTraceConfig(traceConfig) {
// Do not raise error if binding doesn't exists - fallback binding will not support
// this ever.
if (bindings) {
if (traceConfig.type === 'traceEvent') {
bindings.initCustomTraceSubscriber(traceConfig.fileName);
}
}
}
exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobalTraceConfig;
/**
* @ignore
*
* Returns current binary's metadata to determine which binary is actually loaded.
*
* This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
* as internal representation may change anytime. Use it with caution.
*/
function getBinaryMetadata() {
return {
target: bindings ? bindings === null || bindings === void 0 ? void 0 : bindings.getTargetTriple() : undefined
};
}
exports.getBinaryMetadata = getBinaryMetadata;
exports.DEFAULT_EXTENSIONS = Object.freeze([
".js",
".jsx",
".es6",
".es",
".mjs",
".ts",
".tsx",
".cts",
".mts"
]);
function toBuffer(t) {
return Buffer.from(JSON.stringify(t));
}

View File

@@ -0,0 +1,187 @@
{
"name": "@swc/core",
"version": "1.4.16",
"description": "Super-fast alternative for babel",
"homepage": "https://swc.rs",
"main": "./index.js",
"author": "강동윤 <kdy1997.dev@gmail.com>",
"license": "Apache-2.0",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"engines": {
"node": ">=10"
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"napi": {
"binaryName": "swc",
"targets": [
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"aarch64-unknown-linux-gnu",
"aarch64-apple-darwin",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc"
]
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"types": "./index.d.ts",
"scripts": {
"changelog": "git cliff --output CHANGELOG.md",
"setup": "husky install && git config feature.manyFiles true && node ./crates/swc_ecma_preset_env/scripts/copy-data.js",
"postinstall": "node postinstall.js",
"artifacts": "napi artifacts --npm-dir scripts/npm",
"prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tag-style npm",
"pack": "wasm-pack",
"build:ts": "tsc -d",
"build:wasm": "npm-run-all \"pack -- build ./bindings/binding_core_wasm --scope swc {1} -t {2} --features plugin\" --",
"build": "tsc -d && napi build --manifest-path bindings/Cargo.toml --platform -p binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts --release -o .",
"build:dev": "tsc -d && napi build --manifest-path bindings/Cargo.toml --platform -p binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -o .",
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --config ./node-swc/jest.config.js",
"version": "napi version --npm-dir scripts/npm"
},
"lint-staged": {
"*.toml": [
"taplo format"
],
"*.rs": [
"rustfmt --"
],
"*.json": [
"prettier --write"
],
"!(**/tests/**/*)*.js": [
"prettier --write"
],
"!(**/tests/**/*)*.ts": [
"prettier --write"
],
"!(**/tests/**/*)*.jsx": [
"prettier --write"
],
"!(**/tests/**/*)*.tsx": [
"prettier --write"
]
},
"devDependencies": {
"@babel/compat-data": "^7.23.2",
"@babel/core": "^7.13.16",
"@babel/generator": "^7.18.13",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-decorators": "^7.13.15",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/preset-env": "^7.13.15",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/types": "^7.14.0",
"@napi-rs/cli": "^3.0.0-alpha.43",
"@swc/core": "=1.2.220",
"@swc/helpers": "^0.5.0",
"@swc/plugin-jest": "^1.5.117",
"@taplo/cli": "^0.5.2",
"@types/jest": "^29.5.11",
"@types/node": "^20.5.0",
"@types/terser": "^3.12.0",
"acorn": "^8.6.0",
"acorn-jsx": "^5.3.2",
"axios": "^0.21.1",
"babel-plugin-transform-node-env-inline": "^0.4.3",
"benchmark": "^2.1.4",
"bootstrap": "^5.2.1",
"class-validator": "^0.13.1",
"core-js": "^2.6.11",
"core-js-compat": "^3.33.1",
"cross-env": "^7.0.3",
"cspell": "^5.12.3",
"expect": "^27.4.2",
"glob": "^8.0.3",
"husky": "^7.0.2",
"jest": "^29.7.0",
"js-beautify": "^1.14.3",
"lint-staged": "^12.3.6",
"lodash": "^4.17.21",
"mocha": "^9.1.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.6.2",
"progress": "^2.0.3",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"reflect-metadata": "^0.1.13",
"regenerator-runtime": "^0.13.9",
"source-map": "^0.7.3",
"source-map-support": "^0.5.19",
"sourcemap-validator": "^2.1.0",
"swc-plugin-coverage-instrument": "^0.0.12",
"terser": "^5.7.1",
"ts-node": "^10.5.0",
"typescript": "^5.3.3"
},
"peerDependencies": {
"@swc/helpers": "^0.5.0"
},
"peerDependenciesMeta": {
"@swc/helpers": {
"optional": true
}
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/swc"
},
"files": [
"CHANGELOG.md",
"Visitor.d.ts",
"index.d.ts",
"spack.js",
"util.d.ts",
"LICENSE",
"Visitor.js",
"binding.d.ts",
"index.js",
"types.d.ts",
"util.js",
"README.md",
"binding.js",
"package.json",
"spack.d.ts",
"types.js",
"postinstall.js",
"bindings/binding_core_wasm/pkg/binding_core_wasm.d.ts"
],
"packageManager": "yarn@4.1.1",
"dependencies": {
"@swc/counter": "^0.1.2",
"@swc/types": "^0.1.5"
},
"optionalDependencies": {
"@swc/core-darwin-x64": "1.4.16",
"@swc/core-win32-x64-msvc": "1.4.16",
"@swc/core-linux-x64-gnu": "1.4.16",
"@swc/core-linux-x64-musl": "1.4.16",
"@swc/core-win32-ia32-msvc": "1.4.16",
"@swc/core-linux-arm-gnueabihf": "1.4.16",
"@swc/core-linux-arm64-gnu": "1.4.16",
"@swc/core-darwin-arm64": "1.4.16",
"@swc/core-linux-arm64-musl": "1.4.16",
"@swc/core-win32-arm64-msvc": "1.4.16"
}
}

View File

@@ -0,0 +1,147 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A postinstall script runs after `@swc/core` is installed.
*
* It checks if corresponding optional dependencies for native binary is installed and can be loaded properly.
* If it fails, it'll internally try to install `@swc/wasm` as fallback.
*/
const fs_1 = require("fs");
const assert = __importStar(require("assert"));
const path = __importStar(require("path"));
const child_process = __importStar(require("child_process"));
const fs = __importStar(require("fs"));
function removeRecursive(dir) {
for (const entry of fs.readdirSync(dir)) {
const entryPath = path.join(dir, entry);
let stats;
try {
stats = fs.lstatSync(entryPath);
}
catch (_a) {
continue; // Guard against https://github.com/nodejs/node/issues/4760
}
if (stats.isDirectory())
removeRecursive(entryPath);
else
fs.unlinkSync(entryPath);
}
fs.rmdirSync(dir);
}
/**
* Trying to validate @swc/core's native binary installation, then installs if it is not supported.
*/
const validateBinary = () => __awaiter(void 0, void 0, void 0, function* () {
var _a;
try {
const { name } = require(path.resolve(process.env.INIT_CWD, 'package.json'));
if (name === '@swc/core') {
return;
}
}
catch (_) {
return;
}
// TODO: We do not take care of the case if user try to install with `--no-optional`.
// For now, it is considered as deliberate decision.
let binding;
try {
binding = require('./binding');
// Check if binding binary actually works.
// For the latest version, checks target triple. If it's old version doesn't have target triple, use parseSync instead.
const triple = binding.getTargetTriple ? binding.getTargetTriple() : binding.parseSync('console.log()', Buffer.from(JSON.stringify({ syntax: "ecmascript" })));
assert.ok(triple, 'Failed to read target triple from native binary.');
}
catch (error) {
// if error is unsupported architecture, ignore to display.
if (!((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('Unsupported architecture'))) {
console.warn(error);
}
console.warn(`@swc/core was not able to resolve native bindings installation. It'll try to use @swc/wasm as fallback instead.`);
}
if (!!binding) {
return;
}
// User choose to override the binary installation. Skip remanining validation.
if (!!process.env["SWC_BINARY_PATH"]) {
console.warn(`@swc/core could not resolve native bindings installation, but found manual override config SWC_BINARY_PATH specified. Skipping remaning validation.`);
return;
}
// Check if top-level package.json installs @swc/wasm separately already
let wasmBinding;
try {
wasmBinding = require.resolve(`@swc/wasm`);
}
catch (_) {
}
if (!!wasmBinding && (0, fs_1.existsSync)(wasmBinding)) {
return;
}
const env = Object.assign(Object.assign({}, process.env), { npm_config_global: undefined });
const { version } = require(path.join(path.dirname(require.resolve('@swc/core')), 'package.json'));
// We want to place @swc/wasm next to the @swc/core as if normal installation was done,
// but can't directly set cwd to INIT_CWD as npm seems to acquire lock to the working dir.
// Instead, create a temporary inner and move it out.
const coreDir = path.dirname(require.resolve('@swc/core'));
const installDir = path.join(coreDir, 'npm-install');
try {
fs.mkdirSync(installDir);
fs.writeFileSync(path.join(installDir, 'package.json'), '{}');
// Instead of carrying over own dependencies to download & resolve package which increases installation sizes of `@swc/core`,
// assume & relies on system's npm installation.
child_process.execSync(`npm install --no-save --loglevel=error --prefer-offline --no-audit --progress=false @swc/wasm@${version}`, { cwd: installDir, stdio: 'pipe', env });
const installedBinPath = path.join(installDir, 'node_modules', `@swc/wasm`);
// INIT_CWD is injected via npm. If it doesn't exists, can't proceed.
fs.renameSync(installedBinPath, path.resolve(process.env.INIT_CWD, 'node_modules', `@swc/wasm`));
}
catch (error) {
console.error(error);
console.error(`Failed to install fallback @swc/wasm@${version}. @swc/core will not properly.
Please install @swc/wasm manually, or retry whole installation.
If there are unexpected errors, please report at https://github.com/swc-project/swc/issues`);
}
finally {
try {
removeRecursive(installDir);
}
catch (_) {
// Gracefully ignore any failures. This'll make few leftover files but it shouldn't block installation.
}
}
});
validateBinary().catch((error) => {
// for now just throw the error as-is.
throw error;
});

View File

@@ -0,0 +1,51 @@
import { Options } from "@swc/types";
export type BundleInput = BundleOptions | BundleOptions[];
export declare const isLocalFile: RegExp;
export declare function compileBundleOptions(config: BundleInput | string | undefined): Promise<BundleInput>;
/**
* Usage: In `spack.config.js` / `spack.config.ts`, you can utilize type annotations (to get autocompletions) like
*
* ```ts
* import { config } from '@swc/core/spack';
*
* export default config({
* name: 'web',
* });
* ```
*
*
*
*/
export declare function config(c: BundleInput): BundleInput;
export interface BundleOptions extends SpackConfig {
workingDir?: string;
}
/**
* `spack.config,js`
*/
export interface SpackConfig {
/**
* @default process.env.NODE_ENV
*/
mode?: Mode;
target?: Target;
entry: EntryConfig;
output: OutputConfig;
module: ModuleConfig;
options?: Options;
/**
* Modules to exclude from bundle.
*/
externalModules?: string[];
}
export interface OutputConfig {
name: string;
path: string;
}
export interface ModuleConfig {
}
export type Mode = 'production' | 'development' | 'none';
export type Target = 'browser' | 'node';
export type EntryConfig = string | string[] | {
[name: string]: string;
};

85
webGl/my-threejs-test/node_modules/@swc/core/spack.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = exports.compileBundleOptions = exports.isLocalFile = void 0;
const path = __importStar(require("path"));
exports.isLocalFile = /^\.{0,2}\//; // starts with '/' './' '../'
function compileBundleOptions(config) {
return __awaiter(this, void 0, void 0, function* () {
const f = config === undefined ? '.' : config;
try {
const filepath = typeof f === 'string' ? f : 'spack.config.js';
const fileModule = exports.isLocalFile.test(filepath) ? path.resolve(filepath) : filepath;
let configFromFile = require(fileModule);
if (configFromFile.default) {
configFromFile = configFromFile.default;
}
if (Array.isArray(configFromFile)) {
if (Array.isArray(f)) {
return [...configFromFile, ...f];
}
if (typeof f !== 'string') {
configFromFile.push(f);
}
return configFromFile;
}
return Object.assign(Object.assign({}, configFromFile), (typeof config === 'string') ? {} : config);
}
catch (e) {
if (typeof f === 'string') {
throw new Error(`Error occurred while loading config file at ${config}: ${e}`);
}
return f;
}
});
}
exports.compileBundleOptions = compileBundleOptions;
/**
* Usage: In `spack.config.js` / `spack.config.ts`, you can utilize type annotations (to get autocompletions) like
*
* ```ts
* import { config } from '@swc/core/spack';
*
* export default config({
* name: 'web',
* });
* ```
*
*
*
*/
function config(c) {
return c;
}
exports.config = config;

View File

@@ -0,0 +1 @@
export declare function wrapNativeSuper(Class: any): never;

104
webGl/my-threejs-test/node_modules/@swc/core/util.js generated vendored Normal file
View File

@@ -0,0 +1,104 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapNativeSuper = void 0;
//@ts-ignore
function wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
//@ts-ignore
exports.wrapNativeSuper = wrapNativeSuper = function wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class))
return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class))
return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
//@ts-ignore
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return wrapNativeSuper(Class);
}
exports.wrapNativeSuper = wrapNativeSuper;
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
//@ts-ignore
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () { }));
return true;
}
catch (e) {
return false;
}
}
//@ts-ignore
function _construct(Parent, args, Class) {
if (isNativeReflectConstruct()) {
//@ts-ignore
_construct = Reflect.construct;
}
else {
//@ts-ignore
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
//@ts-ignore
var Constructor = Function.bind.apply(Parent, a);
//@ts-ignore
var instance = new Constructor();
if (Class)
_setPrototypeOf(instance, Class.prototype);
return instance;
};
}
//@ts-ignore
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
//@ts-ignore
function _setPrototypeOf(o, p) {
//@ts-ignore
_setPrototypeOf =
Object.setPrototypeOf ||
//@ts-ignore
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
//@ts-ignore
function _getPrototypeOf(o) {
//@ts-ignore
_getPrototypeOf = Object.setPrototypeOf
? Object.getPrototypeOf
: function _getPrototypeOf(
//@ts-ignore
o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
module.exports = {
wrapNativeSuper
};