Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import pc from "picocolors";
import tmp from "tmp";
import which from "which";

if (process.platform === "win32") {
process.chdir(fs.realpathSync.native(process.cwd()));
}

const __filename = url.fileURLToPath(new URL(import.meta.url));
const __dirname = path.dirname(__filename);

Expand Down
1 change: 0 additions & 1 deletion _packages/api/src/node/encoder.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export function getNodeCommonData(node: Node): number {
case SyntaxKind.HeritageClause:
return ((node as HeritageClause).token === SyntaxKind.ImplementsKeyword ? 1 : 0) << 24;
case SyntaxKind.ExportAssignment:
case SyntaxKind.JSExportAssignment:
return ((node as ExportAssignment).isExportEquals ? 1 : 0) << 24;
case SyntaxKind.ExportSpecifier:
return ((node as ExportSpecifier).isTypeOnly ? 1 : 0) << 24;
Expand Down
2 changes: 0 additions & 2 deletions _packages/api/src/node/protocol.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export const childProperties: Readonly<Partial<Record<SyntaxKind, readonly (stri
[SyntaxKind.NamespaceImport]: ["name"],
[SyntaxKind.NamedImports]: ["elements"],
[SyntaxKind.ExportAssignment]: ["modifiers", "type", "expression"],
[SyntaxKind.JSExportAssignment]: ["modifiers", "type", "expression"],
[SyntaxKind.CommonJSExport]: ["modifiers", "name", "type", "initializer"],
[SyntaxKind.NamespaceExportDeclaration]: ["modifiers", "name"],
[SyntaxKind.NamespaceExport]: ["name"],
[SyntaxKind.NamedExports]: ["elements"],
Expand Down
6 changes: 0 additions & 6 deletions _packages/ast/src/ast.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,6 @@ export interface ExportAssignment extends DeclarationBase, StatementBase, Modifi
readonly type: TypeNode;
readonly expression: Expression;
}
export interface CommonJSExport extends StatementBase, DeclarationBase, ModifiersBase {
readonly kind: SyntaxKind.CommonJSExport;
readonly name: Identifier;
readonly type: TypeNode;
readonly initializer: Expression;
}
export interface NamespaceExportDeclaration extends DeclarationBase, StatementBase, ModifiersBase {
readonly kind: SyntaxKind.NamespaceExportDeclaration;
readonly name: Identifier;
Expand Down
14 changes: 6 additions & 8 deletions _packages/ast/src/enums/syntaxKind.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,12 @@ export enum SyntaxKind {
JSDocImportTag = 343,
SyntaxList = 344,
JSTypeAliasDeclaration = 345,
JSExportAssignment = 346,
CommonJSExport = 347,
JSImportDeclaration = 348,
NotEmittedStatement = 349,
PartiallyEmittedExpression = 350,
SyntheticReferenceExpression = 351,
NotEmittedTypeElement = 352,
Count = 353,
JSImportDeclaration = 346,
NotEmittedStatement = 347,
PartiallyEmittedExpression = 348,
SyntheticReferenceExpression = 349,
NotEmittedTypeElement = 350,
Count = 351,
FirstAssignment = EqualsToken,
LastAssignment = CaretEqualsToken,
FirstCompoundAssignment = PlusEqualsToken,
Expand Down
14 changes: 6 additions & 8 deletions _packages/ast/src/enums/syntaxKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,12 @@ export var SyntaxKind: any;
SyntaxKind[SyntaxKind["JSDocImportTag"] = 343] = "JSDocImportTag";
SyntaxKind[SyntaxKind["SyntaxList"] = 344] = "SyntaxList";
SyntaxKind[SyntaxKind["JSTypeAliasDeclaration"] = 345] = "JSTypeAliasDeclaration";
SyntaxKind[SyntaxKind["JSExportAssignment"] = 346] = "JSExportAssignment";
SyntaxKind[SyntaxKind["CommonJSExport"] = 347] = "CommonJSExport";
SyntaxKind[SyntaxKind["JSImportDeclaration"] = 348] = "JSImportDeclaration";
SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement";
SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression";
SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 351] = "SyntheticReferenceExpression";
SyntaxKind[SyntaxKind["NotEmittedTypeElement"] = 352] = "NotEmittedTypeElement";
SyntaxKind[SyntaxKind["Count"] = 353] = "Count";
SyntaxKind[SyntaxKind["JSImportDeclaration"] = 346] = "JSImportDeclaration";
SyntaxKind[SyntaxKind["NotEmittedStatement"] = 347] = "NotEmittedStatement";
SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 348] = "PartiallyEmittedExpression";
SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 349] = "SyntheticReferenceExpression";
SyntaxKind[SyntaxKind["NotEmittedTypeElement"] = 350] = "NotEmittedTypeElement";
SyntaxKind[SyntaxKind["Count"] = 351] = "Count";
SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment";
SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment";
SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 64] = "FirstCompoundAssignment";
Expand Down
26 changes: 0 additions & 26 deletions _packages/ast/src/factory.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import type {
ClassExpression,
ClassStaticBlockDeclaration,
ColonToken,
CommonJSExport,
ComputedPropertyName,
ConciseBody,
ConditionalExpression,
Expand Down Expand Up @@ -779,10 +778,7 @@ function cloneNodeData(node: Node): any {
case SyntaxKind.NamedImports:
return { elements: n.elements };
case SyntaxKind.ExportAssignment:
case SyntaxKind.JSExportAssignment:
return { modifiers: n.modifiers, isExportEquals: n.isExportEquals, type: n.type, expression: n.expression };
case SyntaxKind.CommonJSExport:
return { modifiers: n.modifiers, name: n.name, type: n.type, initializer: n.initializer };
case SyntaxKind.NamespaceExportDeclaration:
return { modifiers: n.modifiers, name: n.name };
case SyntaxKind.NamespaceExport:
Expand Down Expand Up @@ -1202,15 +1198,6 @@ const forEachChildTable: Record<number, ForEachChildFunction> = {
visitNodes(cbNode, cbNodes, data.modifiers) ||
visitNode(cbNode, data.type) ||
visitNode(cbNode, data.expression),
[SyntaxKind.JSExportAssignment]: (data, cbNode, cbNodes) =>
visitNodes(cbNode, cbNodes, data.modifiers) ||
visitNode(cbNode, data.type) ||
visitNode(cbNode, data.expression),
[SyntaxKind.CommonJSExport]: (data, cbNode, cbNodes) =>
visitNodes(cbNode, cbNodes, data.modifiers) ||
visitNode(cbNode, data.name) ||
visitNode(cbNode, data.type) ||
visitNode(cbNode, data.initializer),
[SyntaxKind.NamespaceExportDeclaration]: (data, cbNode, cbNodes) =>
visitNodes(cbNode, cbNodes, data.modifiers) ||
visitNode(cbNode, data.name),
Expand Down Expand Up @@ -1962,15 +1949,6 @@ export function createExportAssignment(modifiers: readonly ModifierLike[] | unde
}) as unknown as ExportAssignment;
}

export function createCommonJSExport(modifiers: readonly ModifierLike[] | undefined, name: Identifier, type: TypeNode, initializer: Expression): CommonJSExport {
return new NodeObject(SyntaxKind.CommonJSExport, {
modifiers,
name,
type,
initializer,
}) as unknown as CommonJSExport;
}

export function createNamespaceExportDeclaration(modifiers: readonly ModifierLike[] | undefined, name: Identifier): NamespaceExportDeclaration {
return new NodeObject(SyntaxKind.NamespaceExportDeclaration, {
modifiers,
Expand Down Expand Up @@ -3249,10 +3227,6 @@ export function updateExportAssignment(node: ExportAssignment, modifiers: readon
return node.modifiers !== modifiers || node.type !== type || node.expression !== expression ? createExportAssignment(modifiers, node.isExportEquals, type, expression) : node;
}

export function updateCommonJSExport(node: CommonJSExport, modifiers: readonly ModifierLike[] | undefined, name: Identifier, type: TypeNode, initializer: Expression): CommonJSExport {
return node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer ? createCommonJSExport(modifiers, name, type, initializer) : node;
}

export function updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, modifiers: readonly ModifierLike[] | undefined, name: Identifier): NamespaceExportDeclaration {
return node.modifiers !== modifiers || node.name !== name ? createNamespaceExportDeclaration(modifiers, name) : node;
}
Expand Down
13 changes: 1 addition & 12 deletions _packages/ast/src/is.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import type {
ClassLikeDeclaration,
ClassStaticBlockDeclaration,
ColonToken,
CommonJSExport,
CompoundAssignmentOperator,
ComputedPropertyName,
ConditionalExpression,
Expand Down Expand Up @@ -519,17 +518,7 @@ export function isNamedImports(node: Node): node is NamedImports {
}

export function isExportAssignment(node: Node): node is ExportAssignment {
switch (node.kind) {
case SyntaxKind.ExportAssignment:
case SyntaxKind.JSExportAssignment:
return true;
default:
return false;
}
}

export function isCommonJSExport(node: Node): node is CommonJSExport {
return node.kind === SyntaxKind.CommonJSExport;
return node.kind === SyntaxKind.ExportAssignment;
}

export function isNamespaceExportDeclaration(node: Node): node is NamespaceExportDeclaration {
Expand Down
9 changes: 0 additions & 9 deletions _packages/ast/src/visitor.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type {
ClassDeclaration,
ClassExpression,
ClassStaticBlockDeclaration,
CommonJSExport,
ComputedPropertyName,
ConditionalExpression,
ConditionalTypeNode,
Expand Down Expand Up @@ -197,7 +196,6 @@ import {
updateClassDeclaration,
updateClassExpression,
updateClassStaticBlockDeclaration,
updateCommonJSExport,
updateComputedPropertyName,
updateConditionalExpression,
updateConditionalTypeNode,
Expand Down Expand Up @@ -725,13 +723,6 @@ const visitEachChildTable: Record<number, VisitEachChildFunction> = {
const _expression = visitNode(node.expression, visitor, isExpression);
return updateExportAssignment(node, _modifiers, _type, _expression);
},
[SyntaxKind.CommonJSExport]: (node: CommonJSExport, visitor: Visitor): CommonJSExport => {
const _modifiers = visitNodes(node.modifiers, visitor);
const _name = visitNode(node.name, visitor, isIdentifier);
const _type = visitNode(node.type, visitor, isTypeNode);
const _initializer = visitNode(node.initializer, visitor, isExpression);
return updateCommonJSExport(node, _modifiers, _name, _type, _initializer);
},
[SyntaxKind.NamespaceExportDeclaration]: (node: NamespaceExportDeclaration, visitor: Visitor): NamespaceExportDeclaration => {
const _modifiers = visitNodes(node.modifiers, visitor);
const _name = visitNode(node.name, visitor, isIdentifier);
Expand Down
33 changes: 0 additions & 33 deletions _scripts/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,6 @@
"comment": "Reparsed JS nodes"
},
"JSTypeAliasDeclaration",
"JSExportAssignment",
"CommonJSExport",
"JSImportDeclaration",
{
"comment": "Transformation nodes"
Expand Down Expand Up @@ -2175,10 +2173,6 @@
]
},
"ExportAssignment": {
"kind": [
"ExportAssignment",
"JSExportAssignment"
],
"extends": [
"DeclarationBase",
"StatementBase",
Expand All @@ -2204,33 +2198,6 @@
}
]
},
"CommonJSExport": {
"extends": [
"StatementBase",
"DeclarationBase",
"ExportableBase",
"ModifiersBase"
],
"members": [
{
"name": "modifiers",
"inherited": true
},
{
"name": "name",
"type": "Identifier",
"private": true
},
{
"name": "Type",
"type": "TypeNode"
},
{
"name": "Initializer",
"type": "Expression"
}
]
},
"NamespaceExportDeclaration": {
"extends": [
"DeclarationBase",
Expand Down
12 changes: 1 addition & 11 deletions internal/api/encoder/decoder_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions internal/api/encoder/encoder_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 7 additions & 15 deletions internal/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func (n *Node) Expression() *Node {
return n.AsThrowStatement().Expression
case KindExternalModuleReference:
return n.AsExternalModuleReference().Expression
case KindExportAssignment, KindJSExportAssignment:
case KindExportAssignment:
return n.AsExportAssignment().Expression
case KindDecorator:
return n.AsDecorator().Expression
Expand Down Expand Up @@ -449,7 +449,7 @@ func (m *MutableNode) SetExpression(expr *Node) {
n.AsThrowStatement().Expression = expr
case KindExternalModuleReference:
n.AsExternalModuleReference().Expression = expr
case KindExportAssignment, KindJSExportAssignment:
case KindExportAssignment:
n.AsExportAssignment().Expression = expr
case KindDecorator:
n.AsDecorator().Expression = expr
Expand Down Expand Up @@ -662,10 +662,8 @@ func (n *Node) Type() *Node {
return n.AsJSDocNonNullableType().Type
case KindJSDocOptionalType:
return n.AsJSDocOptionalType().Type
case KindExportAssignment, KindJSExportAssignment:
case KindExportAssignment:
return n.AsExportAssignment().Type
case KindCommonJSExport:
return n.AsCommonJSExport().Type
case KindBinaryExpression:
return n.AsBinaryExpression().Type
default:
Expand Down Expand Up @@ -725,10 +723,8 @@ func (m *MutableNode) SetType(t *Node) {
n.AsJSDocNonNullableType().Type = t
case KindJSDocOptionalType:
n.AsJSDocOptionalType().Type = t
case KindExportAssignment, KindJSExportAssignment:
case KindExportAssignment:
n.AsExportAssignment().Type = t
case KindCommonJSExport:
n.AsCommonJSExport().Type = t
case KindBinaryExpression:
n.AsBinaryExpression().Type = t
default:
Expand Down Expand Up @@ -762,8 +758,6 @@ func (n *Node) Initializer() *Node {
return n.AsForInOrOfStatement().Initializer
case KindJsxAttribute:
return n.AsJsxAttribute().Initializer
case KindCommonJSExport:
return n.AsCommonJSExport().Initializer
}
panic("Unhandled case in Node.Initializer")
}
Expand Down Expand Up @@ -791,8 +785,6 @@ func (m *MutableNode) SetInitializer(initializer *Node) {
n.AsForInOrOfStatement().Initializer = initializer
case KindJsxAttribute:
n.AsJsxAttribute().Initializer = initializer
case KindCommonJSExport:
n.AsCommonJSExport().Initializer = initializer
default:
panic("Unhandled case in mutableNode.SetInitializer")
}
Expand Down Expand Up @@ -1905,7 +1897,7 @@ func (node *ExportAssignment) computeSubtreeFacts() SubtreeFacts {
}

func IsAnyExportAssignment(node *Node) bool {
return node.Kind == KindExportAssignment || node.Kind == KindJSExportAssignment
return node.Kind == KindExportAssignment
}

func (node *ExportDeclaration) computeSubtreeFacts() SubtreeFacts {
Expand Down Expand Up @@ -2845,7 +2837,7 @@ func (node *SourceFile) computeDeclarationMap() map[string][]*Node {
break
}
fallthrough
case KindVariableDeclaration, KindBindingElement, KindCommonJSExport:
case KindVariableDeclaration, KindBindingElement:
name := node.Name()
if name != nil {
if IsBindingPattern(name) {
Expand Down Expand Up @@ -2896,7 +2888,7 @@ func (node *SourceFile) computeDeclarationMap() map[string][]*Node {
}
case KindBinaryExpression:
switch GetAssignmentDeclarationKind(node) {
case JSDeclarationKindThisProperty, JSDeclarationKindProperty:
case JSDeclarationKindExportsProperty, JSDeclarationKindThisProperty, JSDeclarationKindProperty:
addDeclaration(node)
}
node.ForEachChild(visit)
Expand Down
Loading
Loading