Modules§
Structs§
- Comment
Container - Comments
Iterator - Emit
Options - Emitted
Source Text - Source emitted based on the emit options.
- Globals
- Lexed
Item - Marks
- Module
Exports AndRe Exports - Multi
Threaded Comments - An implementation of swc’s
Comments
that implementsSync
to support being used in multi-threaded code. This implementation is immutable and should you need mutability you may create a copy by converting it to an swcSingleThreadedComments
. - Parse
Diagnostic - Parsing diagnostic.
- Parse
Diagnostics Error - Parse
Params - Parameters for parsing.
- Parsed
Source - A parsed source containing an AST, comments, and possibly tokens.
- Scope
- Source
Map - Source
MapConfig - Implements a configuration trait for source maps that reflects the logic to embed sources in the source map or not.
- Source
Pos - Swc unfortunately uses
BytePos(0)
as a magic value. This means that we can’t have byte positions of nodes line up with the text. To get around this, we have created our ownSourcePos
wrapper that hides the underlying swc byte position so it can’t be used incorrectly. - Source
Range - Source
Text Info - Stores the source text along with other data such as where all the lines occur in the text.
- Start
Source Pos - A special source pos that indicates the source start which functions can use as a parameter type in order to ensure someone doesn’t provide the wrong position.
- SwcFold
Diagnostics Error - Text
Change - Text
Lines - Token
Container - Transpile
Module Options - Transpile options specific to the module being transpiled.
- Transpile
Options - Options which can be adjusted when transpiling a module.
- Var
Enums§
- Binding
Kind - Emit
Error - Fold
Program Error - Imports
NotUsed AsValues - Media
Type - Module
Item Ref - Reference to a ModuleDecl or Stmt in a Program.
- Module
Kind - If the module is an Es module or CommonJs module.
- Program
Ref - A reference to a Program.
- Scope
Kind - Source
MapOption - Token
OrComment - Transpile
Error - Transpile
Result - Holds whether the
ParsedSource
was cloned or consumed (owned) during transpilation. This is useful for logging in the CLI when transpilation occurs when aParsedSource
is cloned, as it’s a performance issue.
Constants§
- ES_
VERSION - Ecmascript version used for lexing and parsing.
- VERSION
- Version of this crate, which may be useful for emit caches.
Traits§
- Into
SwcFile Name - Root
Node - A Module or Script node.
- Source
Ranged - Source
Ranged ForSpanned - Adds source position helper methods for swc types that implement
swc_common::Spanned
. - Source
Text Info Provider - Source
Text Provider
Functions§
- apply_
text_ changes - Applies the text changes to the given source text.
- emit
- Emits the program as a string of JavaScript code, possibly with the passed comments, and optionally also a source map.
- fold_
program - Low level function for transpiling a program.
- get_
syntax - Gets the default
Syntax
used bydeno_ast
for the provided media type. - lex
- Given the source text and media type, tokenizes the provided text to a collection of tokens and comments.
- parse_
module - Parses the provided information to a module.
- parse_
module_ with_ post_ process - Parses a module with post processing (see docs on
parse_program_with_post_process
). - parse_
program - Parses the provided information attempting to figure out if the provided text is for a script or a module.
- parse_
program_ with_ post_ process - Parses the provided information as a program with the option of providing some post-processing to the result.
- parse_
script - Parses the provided information to a script.
- parse_
script_ with_ post_ process - Parses a script with post processing (see docs on
parse_program_with_post_process
). - resolve_
media_ type_ and_ charset_ from_ content_ type - Resolve a media type and optionally the charset from a module specifier and the value of a content type header.
- strip_
bom - swc_
codegen_ config
Type Aliases§
- CjsAnalysis
- Line
AndColumn Display - A 1-indexed line and column type which should be used for display purposes only (ex. in diagnostics).
- Line
AndColumn Index - A 0-indexed line and column type.
- Module
Specifier