Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This is the Rollup project, a module bundler for JavaScript.
- first run either `npm run update:js` if TypeScript code was updated, or `npm run update:napi` if Rust code was updated.
- then run `npm run test:only` to only run tests against the built artifact without rebuilding.
- you can focus specific tests by adding `solo: true´ in their `\_config.js` file.
- to compile only the Rust parts, run `npm run build:napi`

## Copilot-Specific Behaviors

Expand Down
95 changes: 39 additions & 56 deletions rust/Cargo.lock

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

10 changes: 5 additions & 5 deletions rust/parse_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ edition = "2021"

[dependencies]
anyhow = "1.0.100"
swc_atoms = "7.0.0"
swc_compiler_base = "37.0.0"
swc_atoms = "9.0.0"
swc_compiler_base = "39.0.0"
swc_config = "3.1.2"
swc_common = { version = "15.0.0", features = ["parking_lot"] }
swc_ecma_ast = "16.0.0"
swc_ecma_parser = "25.0.0"
swc_common = { version = "17.0.0", features = ["parking_lot"] }
swc_ecma_ast = "18.0.0"
swc_ecma_parser = "27.0.2"
parking_lot = "0.12.5"
2 changes: 1 addition & 1 deletion rust/parse_ast/src/ast_nodes/block_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl AstConverter<'_> {
if *can_be_directive {
if let Stmt::Expr(expression) = statement {
if let Expr::Lit(Lit::Str(string)) = &*expression.expr {
ast_converter.store_directive(expression, &string.value);
ast_converter.store_directive(expression, string.value.as_atom().unwrap());
return (true, None);
}
}
Expand Down
3 changes: 1 addition & 2 deletions rust/parse_ast/src/ast_nodes/directive.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use swc_atoms::Atom;
use swc_ecma_ast::ExprStmt;

use crate::convert_ast::converter::AstConverter;
use crate::store_directive;

impl AstConverter<'_> {
pub(crate) fn store_directive(&mut self, expression_statement: &ExprStmt, directive: &Atom) {
pub(crate) fn store_directive(&mut self, expression_statement: &ExprStmt, directive: &str) {
store_directive!(
self,
span => expression_statement.span,
Expand Down
2 changes: 1 addition & 1 deletion rust/parse_ast/src/ast_nodes/literal_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ impl AstConverter<'_> {
store_literal_string!(
self,
span => &literal.span,
value => &literal.value,
value => literal.value.as_atom().map_or("", |atom| atom.as_ref()),
raw => &literal.raw
);
}
Expand Down
4 changes: 2 additions & 2 deletions rust/parse_ast/src/ast_nodes/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl AstConverter<'_> {
if *can_be_directive {
if let ModuleItem::Stmt(Stmt::Expr(expression)) = module_item {
if let Expr::Lit(Lit::Str(string)) = &*expression.expr {
ast_converter.store_directive(expression, &string.value);
ast_converter.store_directive(expression, string.value.as_atom().unwrap());
return (true, None);
}
};
Expand All @@ -43,7 +43,7 @@ impl AstConverter<'_> {
if *can_be_directive {
if let Stmt::Expr(expression) = statement {
if let Expr::Lit(Lit::Str(string)) = &*expression.expr {
ast_converter.store_directive(expression, &string.value);
ast_converter.store_directive(expression, string.value.as_atom().unwrap());
return (true, None);
}
};
Expand Down
2 changes: 1 addition & 1 deletion rust/parse_ast/src/ast_nodes/template_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl AstConverter<'_> {
self,
span => &template_element.span,
tail => template_element.tail,
cooked => template_element.cooked.as_ref(),
cooked => template_element.cooked.as_ref().unwrap().as_atom(),
raw => &template_element.raw
);
}
Expand Down
2 changes: 1 addition & 1 deletion rust/parse_ast/src/convert_ast/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ impl<'a> AstConverter<'a> {

pub(crate) fn convert_jsx_attribute_value(&mut self, jsx_attribute_value: &JSXAttrValue) {
match jsx_attribute_value {
JSXAttrValue::Lit(literal) => self.convert_literal(literal),
JSXAttrValue::Str(string_literal) => self.store_literal_string(string_literal),
JSXAttrValue::JSXExprContainer(expression_container) => {
self.store_jsx_expression_container(expression_container)
}
Expand Down
Loading