Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roadmap #9162

Open
2 tasks
kdy1 opened this issue Jul 6, 2024 · 2 comments
Open
2 tasks

Roadmap #9162

kdy1 opened this issue Jul 6, 2024 · 2 comments
Milestone

Comments

@kdy1
Copy link
Member

kdy1 commented Jul 6, 2024

AST Stabilization plan

@kdy1 kdy1 added this to the Planned milestone Jul 6, 2024
@kdy1 kdy1 self-assigned this Jul 6, 2024
@kdy1 kdy1 pinned this issue Jul 6, 2024
@kdy1 kdy1 removed their assignment Jul 13, 2024
@magic-akari
Copy link
Member

A lot of information can be obtained during the lexer/parser phase.
For example,

  1. We can do things like cjs-module-lexer
  2. We can also create an es-check tool to detect whether there is any uncompiled code in the final product code.
  3. Skip some transformation passes

There are also other very useful pieces of information, such as the features described here, which we can get right after parsing is finished:

pub enum Feature {
/// `transform-template-literals`
TemplateLiterals,
/// `transform-literals`
Literals,
/// `transform-function-name`
FunctionName,
/// `transform-arrow-functions`
ArrowFunctions,
/// `transform-block-scoped-functions`
BlockScopedFunctions,
/// `transform-classes`
Classes,
/// `transform-object-super`
ObjectSuper,
/// `transform-shorthand-properties`
ShorthandProperties,
/// `transform-duplicate-keys`
DuplicateKeys,
/// `transform-computed-properties`
ComputedProperties,
/// `transform-for-of`
ForOf,
/// `transform-sticky-regex`
StickyRegex,
/// `transform-dotall-regex`
DotAllRegex,
/// `transform-unicode-regex`
UnicodeRegex,
/// `transform-spread`
Spread,
/// `transform-parameters`
Parameters,
/// `transform-destructuring`
Destructuring,
/// `transform-block-scoping`
BlockScoping,
/// `transform-typeof-symbol`
TypeOfSymbol,
/// `transform-new-target`
NewTarget,
/// `transform-regenerator`
Regenerator,
/// `transform-exponentiation-operator`
ExponentiationOperator,
/// `transform-async-to-generator`
AsyncToGenerator,
/// `transform-async-generator-functions`
#[string_enum(alias("proposal-async-generator-functions"))]
AsyncGeneratorFunctions,
/// `transform-object-rest-spread`
#[string_enum(alias("proposal-object-rest-spread"))]
ObjectRestSpread,
/// `transform-unicode-property-regex`
#[string_enum(alias("proposal-unicode-property-regex"))]
UnicodePropertyRegex,
/// `transform-json-strings`
#[string_enum(alias("proposal-json-strings"))]
JsonStrings,
/// `transform-optional-catch-binding`
#[string_enum(alias("proposal-optional-catch-binding"))]
OptionalCatchBinding,
/// `transform-named-capturing-groups-regex`
NamedCapturingGroupsRegex,
/// `transform-member-expression-literals`
MemberExpressionLiterals,
/// `transform-property-literals`
PropertyLiterals,
/// `transform-reserved-words`
ReservedWords,
/// `transform-export-namespace-from`
#[string_enum(alias("proposal-export-namespace-from"))]
ExportNamespaceFrom,
/// `transform-nullish-coalescing-operator`
#[string_enum(alias("proposal-nullish-coalescing-operator"))]
NullishCoalescing,
/// `transform-logical-assignment-operators`
#[string_enum(alias("proposal-logical-assignment-operators"))]
LogicalAssignmentOperators,
/// `transform-optional-chaining`
#[string_enum(alias("proposal-optional-chaining"))]
OptionalChaining,
/// `transform-class-properties`
#[string_enum(alias("proposal-class-properties"))]
ClassProperties,
/// `transform-numeric-separator`
#[string_enum(alias("proposal-numeric-separator"))]
NumericSeparator,
/// `transform-private-methods`
#[string_enum(alias("proposal-private-methods"))]
PrivateMethods,
/// `transform-class-static-block`
#[string_enum(alias("proposal-class-static-block"))]
ClassStaticBlock,
/// `transform-private-property-in-object`
#[string_enum(alias("proposal-private-property-in-object"))]
PrivatePropertyInObject,
/// `transform-unicode-escapes`
UnicodeEscapes,
/// `transform-unicode-sets-regex`
UnicodeSetsRegex,
/// `bugfix/transform-async-arrows-in-class`
BugfixAsyncArrowsInClass,
/// `bugfix/transform-edge-default-parameters`
BugfixEdgeDefaultParam,
/// `bugfix/transform-tagged-template-caching`
BugfixTaggedTemplateCaching,
/// `bugfix/transform-safari-id-destructuring-collision-in-function-expression`
BugfixSafariIdDestructuringCollisionInFunctionExpression,
/// `bugfix/transform-edge-function-name`
BugfixTransformEdgeFunctionName, // TODO
/// `bugfix/transform-safari-block-shadowing`
BugfixTransformSafariBlockShadowing, // TODO
/// `bugfix/transform-safari-for-shadowing`
BugfixTransformSafariForShadowing, // TODO
/// `bugfix/transform-v8-spread-parameters-in-optional-chaining`
BugfixTransformV8SpreadParametersInOptionalChaining, // TODO
/// `bugfix/transform-v8-static-class-fields-redefine-readonly`
BugfixTransformV8StaticClassFieldsRedefineReadonly, // TODO
/// `bugfix/transform-firefox-class-in-computed-class-key`
BugfixTransformFirefoxClassInComputedClassKey, // TODO
}

If we know in advance that there are no classes in the code, then all passes related to classes can be skipped.

@kdy1
Copy link
Member Author

kdy1 commented Aug 12, 2024

@magic-akari It sounds very interesting. I'll work on it after finishing the tasks in my hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants