Unverified Commit 33e17642 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Bump swc to 48 (#86240)

Upgrade swc from 45 to 48

Based on #85540

- In the AST, strings now contain a `Wtf8Atom` (= not utf8), while `Ident`s keep using the utf8 `Atom`.
- swc's comment printing logic also changed slighted, moving some comments around
- ~~Some comments are getting lost along the way and/or attached to the wrong line. This also broke server actions which rely on a `__next_internal_client_entry_do_not_use__` at the very top~~
parent 10e0828f
This diff is collapsed.
......@@ -337,25 +337,25 @@ turbopack-trace-utils = { path = "turbopack/crates/turbopack-trace-utils" }
turbopack-wasm = { path = "turbopack/crates/turbopack-wasm" }
# SWC crates
swc_core = { version = "45.0.1", features = [
swc_core = { version = "48.0.1", features = [
"ecma_loader_lru",
"ecma_loader_parking_lot",
"parallel_rayon",
] }
swc_plugin_backend_wasmer = { version = "3.0.0" }
testing = "16.0.0"
swc_plugin_backend_wasmer = { version = "5.0.0" }
testing = "18.0.0"
# Keep consistent with preset_env_base through swc_core
browserslist-rs = "0.19.0"
mdxjs = "1.0.3"
modularize_imports = "0.99.0"
styled_components = "0.127.0"
styled_jsx = "0.103.0"
swc_emotion = "0.103.0"
swc_relay = "0.73.0"
react_remove_properties = "0.53.0"
remove_console = "0.54.0"
preset_env_base = "5.0.0"
modularize_imports = "0.102.0"
styled_components = "0.130.0"
styled_jsx = "0.105.1"
swc_emotion = "0.106.0"
swc_relay = "0.76.0"
react_remove_properties = "0.56.0"
remove_console = "0.57.0"
preset_env_base = "6.0.0"
# General Deps
......
......@@ -49,9 +49,9 @@ impl Visit for Finder {
fn visit_export_named_specifier(&mut self, node: &swc_core::ecma::ast::ExportNamedSpecifier) {
let named_export = if let Some(exported) = &node.exported {
exported.atom().clone()
exported.atom().into_owned()
} else {
node.orig.atom().clone()
node.orig.atom().into_owned()
};
self.named_exports.push(named_export);
}
......@@ -60,7 +60,7 @@ impl Visit for Finder {
&mut self,
node: &swc_core::ecma::ast::ExportNamespaceSpecifier,
) {
self.named_exports.push(node.name.atom().clone());
self.named_exports.push(node.name.atom().into_owned());
}
}
......
......@@ -369,14 +369,14 @@ fn all_export_names(program: &Program) -> Vec<Atom> {
.as_ref()
.unwrap_or(&named.orig)
.atom()
.clone(),
.into_owned(),
);
}
ExportSpecifier::Default(_) => {
exports.push(atom!("default"));
}
ExportSpecifier::Namespace(e) => {
exports.push(e.name.atom().clone());
exports.push(e.name.atom().into_owned());
}
}
}
......
......@@ -2,8 +2,8 @@ use anyhow::Result;
use async_trait::async_trait;
use next_custom_transforms::transforms::fonts::*;
use swc_core::{
atoms::atom,
ecma::{ast::Program, atoms::Atom, visit::VisitMutWith},
atoms::{Wtf8Atom, atom},
ecma::{ast::Program, visit::VisitMutWith},
};
use turbo_tasks::ResolvedVc;
use turbopack::module_options::{ModuleRule, ModuleRuleEffect};
......@@ -14,10 +14,10 @@ use super::module_rule_match_js_no_url;
/// Returns a rule which applies the Next.js font transform.
pub fn get_next_font_transform_rule(enable_mdx_rs: bool) -> ModuleRule {
let font_loaders = vec![
atom!("next/font/google"),
atom!("@next/font/google"),
atom!("next/font/local"),
atom!("@next/font/local"),
atom!("next/font/google").into(),
atom!("@next/font/google").into(),
atom!("next/font/local").into(),
atom!("@next/font/local").into(),
];
let transformer =
......@@ -37,7 +37,7 @@ pub fn get_next_font_transform_rule(enable_mdx_rs: bool) -> ModuleRule {
#[derive(Debug)]
struct NextJsFont {
font_loaders: Vec<Atom>,
font_loaders: Vec<Wtf8Atom>,
}
#[async_trait]
......
......@@ -417,7 +417,7 @@ pub async fn parse_segment_config_from_source(
ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(decl)) => match &decl.decl {
Decl::Class(decl) => {
parse(
&decl.ident.sym,
Cow::Borrowed(decl.ident.sym.as_str()),
Some(Cow::Owned(Expr::Class(ClassExpr {
ident: None,
class: decl.class.clone(),
......@@ -428,7 +428,7 @@ pub async fn parse_segment_config_from_source(
}
Decl::Fn(decl) => {
parse(
&decl.ident.sym,
Cow::Borrowed(decl.ident.sym.as_str()),
Some(Cow::Owned(Expr::Fn(FnExpr {
ident: None,
function: decl.function.clone(),
......@@ -446,7 +446,7 @@ pub async fn parse_segment_config_from_source(
let key = &ident.id.sym;
parse(
key,
Cow::Borrowed(key.as_str()),
Some(
decl.init.as_deref().map(Cow::Borrowed).unwrap_or_else(
|| Cow::Owned(*Expr::undefined(DUMMY_SP)),
......@@ -470,8 +470,10 @@ pub async fn parse_segment_config_from_source(
if let ExportSpecifier::Named(named) = specifier {
parse(
match named.exported.as_ref().unwrap_or(&named.orig) {
ModuleExportName::Ident(ident) => &ident.sym,
ModuleExportName::Str(s) => &*s.value,
ModuleExportName::Ident(ident) => {
Cow::Borrowed(ident.sym.as_str())
}
ModuleExportName::Str(s) => s.value.to_string_lossy(),
},
None,
specifier.span(),
......@@ -560,7 +562,7 @@ async fn parse_config_value(
mode: ParseSegmentMode,
config: &mut NextSegmentConfig,
eval_context: &EvalContext,
key: &str,
key: Cow<'_, str>,
init: Option<Cow<'_, Expr>>,
span: Span,
) -> Result<()> {
......@@ -586,7 +588,7 @@ async fn parse_config_value(
})
};
match key {
match &*key {
"config" => {
let Some(value) = get_value() else {
return invalid_config(
......
use rustc_hash::{FxHashMap, FxHashSet};
use serde::Deserialize;
use swc_core::{
atoms::atom,
atoms::{atom, Wtf8Atom},
common::{util::take::Take, SyntaxContext, DUMMY_SP},
ecma::{
ast::{
......@@ -47,7 +47,7 @@ struct State {
imports: FxHashMap<Id, ImportRecord>,
/// `(module_specifier, property): (identifier)`
replaced: FxHashMap<(Atom, Atom), Id>,
replaced: FxHashMap<(Wtf8Atom, Atom), Id>,
extra_stmts: Vec<Stmt>,
......@@ -61,11 +61,11 @@ struct State {
#[derive(Debug)]
struct ImportRecord {
module_specifier: Atom,
module_specifier: Wtf8Atom,
}
impl CjsOptimizer {
fn should_rewrite(&self, module_specifier: &Atom) -> Option<&FxHashMap<Atom, Atom>> {
fn should_rewrite(&self, module_specifier: &Wtf8Atom) -> Option<&FxHashMap<Atom, Atom>> {
self.packages.get(module_specifier).map(|v| &v.transforms)
}
}
......
......@@ -5,7 +5,7 @@ use std::{
use pathdiff::diff_paths;
use swc_core::{
atoms::{atom, Atom},
atoms::{atom, Atom, Wtf8Atom},
common::{errors::HANDLER, FileName, Span, DUMMY_SP},
ecma::{
ast::{
......@@ -91,7 +91,7 @@ struct NextDynamicPatcher {
filename: Arc<FileName>,
dynamic_bindings: Vec<Id>,
is_next_dynamic_first_arg: bool,
dynamically_imported_specifier: Option<(Atom, Span)>,
dynamically_imported_specifier: Option<(Wtf8Atom, Span)>,
state: NextDynamicPatcherState,
}
......@@ -111,7 +111,10 @@ enum NextDynamicPatcherState {
#[derive(Debug, Clone, Eq, PartialEq)]
enum TurbopackImport {
// TODO do we need more variants? server vs client vs dev vs prod?
Import { id_ident: Ident, specifier: Atom },
Import {
id_ident: Ident,
specifier: Wtf8Atom,
},
}
impl Fold for NextDynamicPatcher {
......@@ -149,7 +152,7 @@ impl Fold for NextDynamicPatcher {
}
Expr::Tpl(Tpl { exprs, quasis, .. }) if exprs.is_empty() => {
self.dynamically_imported_specifier =
Some((quasis[0].raw.clone(), quasis[0].span));
Some((quasis[0].raw.clone().into(), quasis[0].span));
}
_ => {}
}
......@@ -541,7 +544,7 @@ impl NextDynamicPatcher {
fn exec_expr_when_resolve_weak_available(expr: &Expr) -> Expr {
let undefined_str_literal = Expr::Lit(Lit::Str(Str {
span: DUMMY_SP,
value: atom!("undefined"),
value: atom!("undefined").into(),
raw: None,
}));
......
use swc_core::{
atoms::Wtf8Atom,
common::errors::HANDLER,
ecma::{
ast::*,
atoms::Atom,
visit::{noop_visit_type, Visit},
},
};
pub struct FontFunctionsCollector<'a> {
pub font_loaders: &'a [Atom],
pub font_loaders: &'a [Wtf8Atom],
pub state: &'a mut super::State,
}
......
use serde_json::Value;
use swc_core::{
atoms::Wtf8Atom,
common::{errors::HANDLER, Spanned, DUMMY_SP},
ecma::{
ast::*,
atoms::Atom,
visit::{noop_visit_type, Visit},
},
};
......@@ -66,9 +66,10 @@ impl FontImportsGenerator<'_> {
return Some(ImportDecl {
src: Box::new(Str {
value: Atom::from(format!(
value: Wtf8Atom::from(format!(
"{}/target.css?{}",
font_function.loader, query_json
font_function.loader.to_string_lossy(),
query_json
)),
raw: None,
span: DUMMY_SP,
......@@ -223,7 +224,7 @@ fn object_lit_to_json(object_lit: &ObjectLit) -> Value {
fn expr_to_json(expr: &Expr) -> Result<Value, ()> {
match expr {
Expr::Lit(Lit::Str(str)) => Ok(Value::String(String::from(&*str.value))),
Expr::Lit(Lit::Str(str)) => Ok(Value::String(str.value.to_string_lossy().into_owned())),
Expr::Lit(Lit::Bool(Bool { value, .. })) => Ok(Value::Bool(*value)),
Expr::Lit(Lit::Num(Number { value, .. })) => {
Ok(Value::Number(serde_json::Number::from_f64(*value).unwrap()))
......
use rustc_hash::{FxHashMap, FxHashSet};
use serde::Deserialize;
use swc_core::{
atoms::Wtf8Atom,
common::{BytePos, Spanned},
ecma::{
ast::{Id, ModuleItem, Pass},
......@@ -16,7 +17,7 @@ mod font_imports_generator;
#[derive(Clone, Debug, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct Config {
pub font_loaders: Vec<Atom>,
pub font_loaders: Vec<Wtf8Atom>,
pub relative_file_path_from_root: Atom,
}
......@@ -31,7 +32,7 @@ pub fn next_font_loaders(config: Config) -> impl Pass + VisitMut {
#[derive(Debug)]
pub struct FontFunction {
loader: Atom,
loader: Wtf8Atom,
function_name: Option<Atom>,
}
#[derive(Debug, Default)]
......
use rustc_hash::{FxHashMap, FxHashSet};
use swc_core::{
atoms::{atom, Atom},
atoms::{atom, Atom, Wtf8Atom},
ecma::{
ast::{
Expr, Id, ImportDecl, ImportNamedSpecifier, ImportSpecifier, MemberExpr, MemberProp,
Module, ModuleExportName,
Module,
},
visit::{noop_visit_type, Visit, VisitWith},
},
......@@ -13,16 +13,16 @@ use swc_core::{
#[derive(Debug, Default)]
pub(crate) struct ImportMap {
/// Map from module name to (module path, exported symbol)
imports: FxHashMap<Id, (Atom, Atom)>,
imports: FxHashMap<Id, (Wtf8Atom, Atom)>,
namespace_imports: FxHashMap<Id, Atom>,
namespace_imports: FxHashMap<Id, Wtf8Atom>,
imported_modules: FxHashSet<Atom>,
imported_modules: FxHashSet<Wtf8Atom>,
}
#[allow(unused)]
impl ImportMap {
pub fn is_module_imported(&mut self, module: &Atom) -> bool {
pub fn is_module_imported(&mut self, module: &Wtf8Atom) -> bool {
self.imported_modules.contains(module)
}
......@@ -77,7 +77,7 @@ impl Visit for Analyzer<'_> {
ImportSpecifier::Named(ImportNamedSpecifier {
local, imported, ..
}) => match imported {
Some(imported) => (local.to_id(), orig_name(imported)),
Some(imported) => (local.to_id(), imported.atom().into_owned()),
_ => (local.to_id(), local.sym.clone()),
},
ImportSpecifier::Default(s) => (s.local.to_id(), atom!("default")),
......@@ -95,10 +95,3 @@ impl Visit for Analyzer<'_> {
}
}
}
fn orig_name(n: &ModuleExportName) -> Atom {
match n {
ModuleExportName::Ident(v) => v.sym.clone(),
ModuleExportName::Str(v) => v.value.clone(),
}
}
......@@ -29,9 +29,13 @@ struct NamedImportTransform {
impl Fold for NamedImportTransform {
fn fold_import_decl(&mut self, decl: ImportDecl) -> ImportDecl {
// Match named imports and check if it's included in the packages
let src_value = decl.src.value.clone();
let src_value = &decl.src.value;
if self.packages.iter().any(|p| src_value == *p) {
if self
.packages
.iter()
.any(|p| src_value.as_str() == Some(&**p))
{
let mut specifier_names = HashSet::new();
// Skip the transform if the default or namespace import is present
......@@ -41,18 +45,10 @@ impl Fold for NamedImportTransform {
match specifier {
ImportSpecifier::Named(specifier) => {
// Add the import name as string to the set
if let Some(imported) = &specifier.imported {
match imported {
ModuleExportName::Ident(ident) => {
specifier_names.insert(ident.sym.to_string());
}
ModuleExportName::Str(str_) => {
specifier_names.insert(str_.value.to_string());
}
}
} else {
specifier_names.insert(specifier.local.sym.to_string());
}
specifier_names.insert(specifier.imported.as_ref().map_or_else(
|| specifier.local.sym.clone(),
|i| i.atom().into_owned(),
));
}
ImportSpecifier::Default(_) => {
skip_transform = true;
......@@ -66,14 +62,17 @@ impl Fold for NamedImportTransform {
}
if !skip_transform {
let mut names = specifier_names.into_iter().collect::<Vec<_>>();
let mut names = specifier_names
.iter()
.map(|n| n.as_str())
.collect::<Vec<_>>();
// Sort the names to make sure the order is consistent
names.sort();
let new_src = format!(
"__barrel_optimize__?names={}!=!{}",
names.join(","),
src_value
src_value.to_string_lossy()
);
// Create a new import declaration, keep everything the same except the source
......
......@@ -383,12 +383,12 @@ impl Fold for NextSsg {
if self.state.is_server_props
// filter out non-packages import
// third part packages must start with `a-z` or `@`
&& import_src.starts_with(|c: char| c.is_ascii_lowercase() || c == '@')
&& import_src.as_str().unwrap_or_default().starts_with(|c: char| c.is_ascii_lowercase() || c == '@')
{
self.state
.eliminated_packages
.borrow_mut()
.insert(import_src.clone());
.insert(import_src.clone().to_atom_lossy().into_owned());
}
tracing::trace!(
"Dropping import `{}{:?}` because it should be removed",
......
......@@ -2,7 +2,7 @@ use std::collections::HashMap;
use serde::Deserialize;
use swc_core::{
atoms::{atom, Atom},
atoms::{atom, Atom, Wtf8Atom},
common::DUMMY_SP,
ecma::{
ast::*,
......@@ -45,10 +45,7 @@ impl Fold for OptimizeBarrel {
(
src.clone(),
match &s.imported {
Some(n) => match &n {
ModuleExportName::Ident(n) => n.sym.clone(),
ModuleExportName::Str(n) => n.value.clone(),
},
Some(n) => n.atom().into_owned(),
None => s.local.sym.clone(),
},
),
......@@ -92,10 +89,7 @@ impl Fold for OptimizeBarrel {
for spec in &export_named.specifiers {
match spec {
ExportSpecifier::Namespace(s) => {
let name_str = match &s.name {
ModuleExportName::Ident(n) => n.sym.clone(),
ModuleExportName::Str(n) => n.value.clone(),
};
let name_str = s.name.atom().into_owned();
if let Some(src) = &export_named.src {
export_map.push((
name_str.clone(),
......@@ -105,7 +99,7 @@ impl Fold for OptimizeBarrel {
} else if self.wildcard {
export_map.push((
name_str.clone(),
Atom::default(),
Wtf8Atom::default(),
atom!("*"),
));
} else {
......@@ -114,17 +108,11 @@ impl Fold for OptimizeBarrel {
}
}
ExportSpecifier::Named(s) => {
let orig_str = match &s.orig {
ModuleExportName::Ident(n) => n.sym.clone(),
ModuleExportName::Str(n) => n.value.clone(),
};
let name_str = match &s.exported {
Some(n) => match &n {
ModuleExportName::Ident(n) => n.sym.clone(),
ModuleExportName::Str(n) => n.value.clone(),
},
None => orig_str.clone(),
};
let orig_str = s.orig.atom().into_owned();
let name_str = s.exported.as_ref().map_or_else(
|| orig_str.clone(),
|i| i.atom().into_owned(),
);
if let Some(src) = &export_named.src {
export_map.push((
......@@ -143,7 +131,7 @@ impl Fold for OptimizeBarrel {
} else if self.wildcard {
export_map.push((
name_str.clone(),
Atom::default(),
Wtf8Atom::default(),
orig_str.clone(),
));
} else {
......@@ -161,7 +149,8 @@ impl Fold for OptimizeBarrel {
}
}
ModuleDecl::ExportAll(export_all) => {
export_wildcards.push(export_all.src.value.to_string());
export_wildcards
.push(export_all.src.value.to_string_lossy().into_owned());
}
ModuleDecl::ExportDecl(export_decl) => {
// Export declarations are not allowed in barrel files.
......@@ -174,21 +163,21 @@ impl Fold for OptimizeBarrel {
Decl::Class(class) => {
export_map.push((
class.ident.sym.clone(),
Atom::default(),
Wtf8Atom::default(),
Atom::default(),
));
}
Decl::Fn(func) => {
export_map.push((
func.ident.sym.clone(),
Atom::default(),
Wtf8Atom::default(),
Atom::default(),
));
}
Decl::Var(var) => {
let ids = collect_idents_in_var_decls(&var.decls);
for id in ids {
export_map.push((id, Atom::default(), Atom::default()));
export_map.push((id, Wtf8Atom::default(), Atom::default()));
}
}
_ => {}
......@@ -208,7 +197,7 @@ impl Fold for OptimizeBarrel {
Expr::Lit(l) => {
if let Lit::Str(s) = l {
if allowed_directives && s.value.starts_with("use ") {
directives.push(s.value.to_string());
directives.push(&s.value);
}
} else {
allowed_directives = false;
......
......@@ -2,6 +2,8 @@
// - Removes `useEffect` and `useLayoutEffect` calls
// - Refactors `useState` calls (under the `optimize_use_state` flag)
use std::borrow::Cow;
use serde::Deserialize;
use swc_core::{
atoms::atom,
......@@ -106,20 +108,22 @@ impl Fold for OptimizeServerReact {
}
for specifier in &import_decl.specifiers {
if let ImportSpecifier::Named(named_import) = specifier {
let name = match &named_import.imported {
Some(n) => match &n {
ModuleExportName::Ident(n) => n.sym.to_string(),
ModuleExportName::Str(n) => n.value.to_string(),
},
None => named_import.local.sym.to_string(),
};
if name == "useState" {
self.use_state_ident = Some(named_import.local.to_id());
} else if name == "useEffect" {
self.use_effect_ident = Some(named_import.local.to_id());
} else if name == "useLayoutEffect" {
self.use_layout_effect_ident = Some(named_import.local.to_id());
let name = named_import
.imported
.as_ref()
.map_or_else(|| Cow::Borrowed(&named_import.local.sym), |i| i.atom());
match &**name {
"useState" => {
self.use_state_ident = Some(named_import.local.to_id());
}
"useEffect" => {
self.use_effect_ident = Some(named_import.local.to_id());
}
"useLayoutEffect" => {
self.use_layout_effect_ident = Some(named_import.local.to_id());
}
_ => {}
}
} else if let ImportSpecifier::Default(default_import) = specifier {
self.react_ident = Some(default_import.local.to_id());
......
......@@ -729,12 +729,12 @@ impl Fold for NextSsg {
&& matches!(self.state.filter, ExportFilter::StripDataExports)
// filter out non-packages import
// third part packages must start with `a-z` or `@`
&& import_src.starts_with(|c: char| c.is_ascii_lowercase() || c == '@')
&& import_src.as_str().unwrap_or_default().starts_with(|c: char| c.is_ascii_lowercase() || c == '@')
{
self.state
.ssr_removed_packages
.borrow_mut()
.insert(import_src.clone());
.insert(import_src.clone().to_atom_lossy().into_owned());
}
tracing::trace!(
"Dropping import `{}{:?}` because it should be removed",
......@@ -789,7 +789,7 @@ impl Fold for NextSsg {
match &i {
ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(e)) if e.specifiers.is_empty() => {
return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }))
return ModuleItem::Stmt(Stmt::Empty(EmptyStmt { span: DUMMY_SP }));
}
ModuleItem::ModuleDecl(ModuleDecl::ExportDecl(e)) => match &e.decl {
Decl::Fn(f) => {
......
use std::sync::Arc;
use swc_core::{
atoms::Atom,
atoms::{Atom, Wtf8Atom},
common::{errors::HANDLER, SourceMap, Span},
ecma::{
ast::{
......@@ -187,18 +187,20 @@ where
EmitWarn: Fn(Span, String),
EmitError: Fn(Span, String),
{
fn warn_if_nodejs_module(&self, span: Span, module_specifier: &str) -> Option<()> {
fn warn_if_nodejs_module(&self, span: Span, module_specifier: &Wtf8Atom) -> Option<()> {
let module_specifier_str = module_specifier.as_str()?;
if self.guarded_runtime {
return None;
}
// Node.js modules can be loaded with `node:` prefix or directly
if module_specifier.starts_with("node:") || NODEJS_MODULE_NAMES.contains(&module_specifier)
if module_specifier.starts_with("node:")
|| NODEJS_MODULE_NAMES.contains(&module_specifier_str)
{
let loc = self.cm.lookup_line(span.lo).ok()?;
let msg = format!(
"A Node.js module is loaded ('{module_specifier}' at line {}) which is not \
"A Node.js module is loaded ('{module_specifier_str}' at line {}) which is not \
supported in the Edge Runtime.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime",
loc.line + 1
......
......@@ -136,7 +136,10 @@ fn next_font_loaders_errors(input: PathBuf) {
&|_tr| {
next_font_loaders(FontLoaderConfig {
relative_file_path_from_root: atom!("pages/test.tsx"),
font_loaders: vec![atom!("@next/font/google"), atom!("cool-fonts")],
font_loaders: vec![
atom!("@next/font/google").into(),
atom!("cool-fonts").into(),
],
})
},
&input,
......
/* __next_internal_action_entry_do_not_use__ {"00ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ import { registerServerReference } from "private-next-rsc-server-reference";
'use strict';
import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"00ac840dcaf5e8197cb02b7f3a43c119b7a770b272":"bar"} */ 'use strict';
export function bar() {}
import { ensureServerEntryExports } from "private-next-rsc-action-validate";
ensureServerEntryExports([
......
/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
export const $$RSC_SERVER_ACTION_0 = async function foo() {
'use strict';
};
registerServerReference($$RSC_SERVER_ACTION_0, "006a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null);
const foo = $$RSC_SERVER_ACTION_0;
/* __next_internal_action_entry_do_not_use__ {"006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ const foo = $$RSC_SERVER_ACTION_0;
const bar = async ()=>{
const x = 1;
// prettier-ignore
......
// De-optimize this file
\ No newline at end of file
// De-optimize this file
......@@ -2,4 +2,4 @@
'use server'
*/ // This should be kept
export const __next_private_export_map__ = '[["x","foo","a"],["y","1","y"],["b","foo","b"],["default","foo","default"],["z","bar","default"]]';
export const __next_private_directive_list__ = '["use client"]';
\ No newline at end of file
export const __next_private_directive_list__ = '["use client"]';
/* __next_internal_client_entry_do_not_use__ cjs */ const { createProxy } = require("private-next-rsc-mod-ref-proxy");
/* __next_internal_client_entry_do_not_use__ cjs */ const { createProxy } = require("private-next-rsc-mod-ref-proxy");
module.exports = createProxy("/some-project/src/some-file.js");
// This is a comment.
/* __next_internal_client_entry_do_not_use__ default,a,b,c,*,f auto */ const { createProxy } = require("private-next-rsc-mod-ref-proxy");
/* __next_internal_client_entry_do_not_use__ default,a,b,c,*,f auto */ const { createProxy } = require("private-next-rsc-mod-ref-proxy");
module.exports = createProxy("/some-project/src/some-file.js");
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { Button } from 'components';
import deleteFromDb from 'db';
export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7f1c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","7f90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { Button } from 'components';
import deleteFromDb from 'db';
const v1 = 'v1';
export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { Button } from 'components';
import deleteFromDb from 'db';
const v1 = 'v1';
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) {
......
/* __next_internal_action_entry_do_not_use__ {"606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { Button } from 'components';
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND, value2) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("606a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
return $$ACTION_ARG_0 * value2;
......
/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { validator } from 'auth';
import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { validator } from 'auth';
import { Button } from 'components';
export const $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) {
console.log('a');
......
/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { validator, another } from 'auth';
/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { validator, another } from 'auth';
import { Button } from 'components';
const x = 1;
export const $$RSC_SERVER_ACTION_0 = async function($$ACTION_CLOSURE_BOUND, z) {
......
/* __next_internal_action_entry_do_not_use__ {"7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7c90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND, a, b, c, d) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......@@ -10,7 +10,7 @@ export const $$RSC_SERVER_ACTION_1 = async function action2($$ACTION_CLOSURE_BOU
console.log(a, b, $$ACTION_ARG_0, c, d);
};
registerServerReference($$RSC_SERVER_ACTION_1, "7c90b5db271335765a4b0eab01f044b381b5ebd5cd", null);
export default function Page({ foo, x, y }) {
/* __next_internal_action_entry_do_not_use__ {"7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","7c90b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ export default function Page({ foo, x, y }) {
var action = $$RSC_SERVER_ACTION_0.bind(null, encryptActionBoundArgs("7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", x));
action.bind(null, foo[0], foo[1], foo.x, foo[y]);
const action2 = $$RSC_SERVER_ACTION_1.bind(null, encryptActionBoundArgs("7c90b5db271335765a4b0eab01f044b381b5ebd5cd", x));
......
/* __next_internal_action_entry_do_not_use__ {"7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND, a, b, c, { d }) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
console.log(a, b, $$ACTION_ARG_0, d);
};
registerServerReference($$RSC_SERVER_ACTION_0, "7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null);
export default function Page({ foo, x, y }) {
/* __next_internal_action_entry_do_not_use__ {"7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ export default function Page({ foo, x, y }) {
var action = $$RSC_SERVER_ACTION_0.bind(null, encryptActionBoundArgs("7c6a88810ecce4a4e8b59d53b8327d7e98bbf251d7", foo));
}
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { Button } from 'components';
import deleteFromDb from 'db';
export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
const noop = (action)=>action;
import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ const noop = (action)=>action;
export const $$RSC_SERVER_ACTION_0 = async function(data) {
console.log(data);
};
......
/* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
let a, f;
/* __next_internal_action_entry_do_not_use__ {"601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","606a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ let a, f;
export const // FIXME: invalid transformation of hoisted functions (https://github.com/vercel/next.js/issues/57392)
// (remove output.js from `tsconfig.json#exclude` to see the error)
$$RSC_SERVER_ACTION_0 = async function action2($$ACTION_CLOSURE_BOUND, e) {
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......@@ -6,7 +6,7 @@ export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUN
console.log($$ACTION_ARG_2.push.call($$ACTION_ARG_2, 5));
};
registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null);
export function Component() {
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ export function Component() {
const data = [
1,
2,
......
/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
const v = 'world';
/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ const v = 'world';
const $$RSC_SERVER_CACHE_0_INNER = async function fn() {
return 'hello, ' + v;
};
......
/* __next_internal_action_entry_do_not_use__ {"6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
import { Form } from 'components';
/* __next_internal_action_entry_do_not_use__ {"6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { Form } from 'components';
const $$RSC_SERVER_CACHE_0_INNER = async function cache([$$ACTION_ARG_0, $$ACTION_ARG_1], e) {
const f = $$ACTION_ARG_0 + e;
return [
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","e0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","e0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1"} */ import { Button } from 'components';
const secret = 'my password is qwerty123';
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......
/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","009ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","00a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { Form } from 'components';
import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"001c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","006a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","009ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","00a9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4"} */ import { Form } from 'components';
export const $$RSC_SERVER_ACTION_0 = async function foo() {
return 'declarator arrow function expression';
};
......
// This is for testing the "information byte" of Server Action / Cache IDs.
// Should be 1 110000 0, which is "e0" in hex.
/* __next_internal_action_entry_do_not_use__ {"6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7ea9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","ff471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","ff69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
const $$RSC_SERVER_CACHE_0_INNER = async function f1(a, b) {
// This is for testing the "information byte" of Server Action / Cache IDs.
// Should be 1 110000 0, which is "e0" in hex.
/* __next_internal_action_entry_do_not_use__ {"6090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","7c9ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","7ea9b2939c1f39073a6bed227fd20233064c8b7869":"$$RSC_SERVER_ACTION_4","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0","ff471a5eb0be1c31686dd4ba938a80328b80b1615d":"$$RSC_SERVER_CACHE_5","ff69348c79fce073bae2f70f139565a2fda1c74c74":"$$RSC_SERVER_CACHE_2"} */ const $$RSC_SERVER_CACHE_0_INNER = async function f1(a, b) {
return [
a,
b
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { redirect } from 'navigation';
import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { redirect } from 'navigation';
export const $$RSC_SERVER_ACTION_0 = async function action(formData) {
redirect('/header?name=' + formData.get('name') + '&hidden-info=' + formData.get('hidden-info'));
};
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { Button } from 'components';
import deleteFromDb from 'db';
const v1 = 'v1';
export const $$RSC_SERVER_ACTION_0 = async function deleteItem($$ACTION_CLOSURE_BOUND) {
......
/* __next_internal_action_entry_do_not_use__ {"409ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","c0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
import { Client } from 'components';
/* __next_internal_action_entry_do_not_use__ {"409ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3","601c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","c0951c375b4a6a6e89d67b743ec5808127cfde405d":"$$RSC_SERVER_CACHE_1","e03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { Client } from 'components';
const $$RSC_SERVER_CACHE_0_INNER = async function // Should be 1 110000 0, which is "e0" in hex (counts as two params,
// because of the encrypted bound args param)
fn1([$$ACTION_ARG_0, $$ACTION_ARG_1], c) {
......
/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
const $$RSC_SERVER_CACHE_0_INNER = async function foo() {};
......@@ -11,7 +11,7 @@ Object["defineProperty"]($$RSC_SERVER_CACHE_0, "name", {
});
export const $$RSC_SERVER_ACTION_1 = async function bar() {};
registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null);
export const obj = {
/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ export const obj = {
foo: $$RSC_SERVER_CACHE_0,
bar: $$RSC_SERVER_ACTION_1
};
/* __next_internal_action_entry_do_not_use__ {"4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","c03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
......@@ -17,7 +17,7 @@ export const $$RSC_SERVER_ACTION_1 = async function bar($$ACTION_CLOSURE_BOUND)
console.log($$ACTION_ARG_0);
};
registerServerReference($$RSC_SERVER_ACTION_1, "4090b5db271335765a4b0eab01f044b381b5ebd5cd", null);
function createObj(n) {
/* __next_internal_action_entry_do_not_use__ {"4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","c03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ function createObj(n) {
const m = n + 1;
return {
foo: $$RSC_SERVER_CACHE_0.bind(null, encryptActionBoundArgs("c03128060c414d59f8552e4788b846c0d2b7f74743", n, m)),
......
/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
const $$RSC_SERVER_CACHE_0_INNER = async function fetch1() {
......@@ -11,7 +11,7 @@ registerServerReference($$RSC_SERVER_CACHE_0, "803128060c414d59f8552e4788b846c0d
Object["defineProperty"]($$RSC_SERVER_CACHE_0, "name", {
value: "fetch"
});
export const api = {
/* __next_internal_action_entry_do_not_use__ {"803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ export const api = {
product: {
fetch: $$RSC_SERVER_CACHE_0
}
......
/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
const $$RSC_SERVER_CACHE_0_INNER = async function foo() {
......@@ -15,7 +15,7 @@ export const $$RSC_SERVER_ACTION_1 = async function bar() {
console.log(42);
};
registerServerReference($$RSC_SERVER_ACTION_1, "0090b5db271335765a4b0eab01f044b381b5ebd5cd", null);
export class MyClass {
/* __next_internal_action_entry_do_not_use__ {"0090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","803128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ export class MyClass {
static foo = $$RSC_SERVER_CACHE_0;
static bar = $$RSC_SERVER_ACTION_1;
}
/* __next_internal_action_entry_do_not_use__ {"4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","c03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { cache as $$cache__ } from "private-next-rsc-cache-wrapper";
import { cache as $$reactCache__ } from "react";
......@@ -12,7 +12,7 @@ export var $$RSC_SERVER_CACHE_0 = $$reactCache__(function() {
return $$cache__("default", "c03128060c414d59f8552e4788b846c0d2b7f74743", 1, $$RSC_SERVER_CACHE_0_INNER, arguments);
});
registerServerReference($$RSC_SERVER_CACHE_0, "c03128060c414d59f8552e4788b846c0d2b7f74743", null);
function createCachedFn(start) {
/* __next_internal_action_entry_do_not_use__ {"4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","c03128060c414d59f8552e4788b846c0d2b7f74743":"$$RSC_SERVER_CACHE_0"} */ function createCachedFn(start) {
function fn() {
return start + Math.random();
}
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import ANYTHING from 'anything';
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import ANYTHING from 'anything';
import f, { f1, f2 } from 'foo';
import { Button } from 'components';
const f3 = 1;
......
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
export const $$RSC_SERVER_ACTION_0 = async function action($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
console.log($$ACTION_ARG_0.find((x)=>x === $$ACTION_ARG_1));
};
registerServerReference($$RSC_SERVER_ACTION_0, "406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", null);
export function ComponentA({ list, y }) {
/* __next_internal_action_entry_do_not_use__ {"406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1"} */ export function ComponentA({ list, y }) {
return <form action={$$RSC_SERVER_ACTION_0.bind(null, encryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", list, y))}>
<button>submit</button>
</form>;
......
/* __next_internal_action_entry_do_not_use__ {"401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","409ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { registerServerReference } from "private-next-rsc-server-reference";
import { encryptActionBoundArgs, decryptActionBoundArgs } from "private-next-rsc-action-encryption";
import { Button } from 'components';
/* __next_internal_action_entry_do_not_use__ {"401c36b06e398c97abe5d5d7ae8c672bfddf4e1b91":"$$RSC_SERVER_ACTION_2","406a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0","4090b5db271335765a4b0eab01f044b381b5ebd5cd":"$$RSC_SERVER_ACTION_1","409ed0cc47abc4e1c64320cf42b74ae60b58c40f00":"$$RSC_SERVER_ACTION_3"} */ import { Button } from 'components';
import deleteFromDb from 'db';
export const $$RSC_SERVER_ACTION_0 = async function deleteItem1($$ACTION_CLOSURE_BOUND) {
var [$$ACTION_ARG_0, $$ACTION_ARG_1, $$ACTION_ARG_2] = await decryptActionBoundArgs("406a88810ecce4a4e8b59d53b8327d7e98bbf251d7", $$ACTION_CLOSURE_BOUND);
......
/* __next_internal_action_entry_do_not_use__ {"706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { registerServerReference } from "private-next-rsc-server-reference";
import { Button } from 'components';
import { registerServerReference } from "private-next-rsc-server-reference";
/* __next_internal_action_entry_do_not_use__ {"706a88810ecce4a4e8b59d53b8327d7e98bbf251d7":"$$RSC_SERVER_ACTION_0"} */ import { Button } from 'components';
export const $$RSC_SERVER_ACTION_0 = async function myAction(a, b, c) {
// comment
'use strict';
......
// This file should not import helpers using ESM syntax
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _class_call_check = require("@swc/helpers/_/_class_call_check");
// This file should not import helpers using ESM syntax
var E = function Foo() {
"use strict";
_class_call_check._(this, Foo);
......
......@@ -6,7 +6,7 @@ describe('swcPlugins', () => {
files: __dirname,
skipDeployment: true,
dependencies: {
'@swc/plugin-react-remove-properties': '7.0.2',
'@swc/plugin-react-remove-properties': '11.1.0',
},
})
if (skipped) return
......
use anyhow::Result;
use async_trait::async_trait;
use swc_core::{
common::comments::NoopComments,
ecma::{ast::Program, atoms::Atom},
};
use swc_core::{atoms::Wtf8Atom, common::comments::NoopComments, ecma::ast::Program};
use turbo_tasks::{ValueDefault, Vc};
use turbopack_ecmascript::{CustomTransformer, TransformContext};
......@@ -71,7 +68,7 @@ impl StyledComponentsTransformer {
if !top_level_import_paths.is_empty() {
options.top_level_import_paths = top_level_import_paths
.iter()
.map(|s| Atom::from(s.clone()))
.map(|s| Wtf8Atom::from(s.clone()))
.collect();
}
let meaningless_file_names = &config.meaningless_file_names;
......
......@@ -404,7 +404,7 @@ impl EvalContext {
fn eval_prop_name(&self, prop: &PropName) -> JsValue {
match prop {
PropName::Ident(ident) => ident.sym.clone().into(),
PropName::Str(str) => str.value.clone().into(),
PropName::Str(str) => str.value.clone().to_atom_lossy().into_owned().into(),
PropName::Num(num) => num.value.into(),
PropName::Computed(ComputedPropName { expr, .. }) => self.eval(expr),
PropName::BigInt(bigint) => (*bigint.value.clone()).into(),
......@@ -438,7 +438,7 @@ impl EvalContext {
match &e.cooked {
Some(v) => {
if !v.is_empty() {
values.push(JsValue::from(v.clone()));
values.push(JsValue::from(v.clone().to_atom_lossy().into_owned()));
}
}
// This is actually unreachable
......
use std::{collections::BTreeMap, fmt::Display};
use std::{borrow::Cow, collections::BTreeMap, fmt::Display};
use once_cell::sync::Lazy;
use rustc_hash::{FxHashMap, FxHashSet};
use swc_core::{
atoms::Wtf8Atom,
common::{BytePos, Span, Spanned, SyntaxContext, comments::Comments, source_map::SmallPos},
ecma::{
ast::*,
......@@ -28,19 +29,19 @@ use crate::{
pub struct ImportAnnotations {
// TODO store this in more structured way
#[turbo_tasks(trace_ignore)]
map: BTreeMap<Atom, Atom>,
map: BTreeMap<Wtf8Atom, Wtf8Atom>,
}
/// Enables a specified transition for the annotated import
static ANNOTATION_TRANSITION: Lazy<Atom> =
static ANNOTATION_TRANSITION: Lazy<Wtf8Atom> =
Lazy::new(|| crate::annotations::ANNOTATION_TRANSITION.into());
/// Changes the chunking type for the annotated import
static ANNOTATION_CHUNKING_TYPE: Lazy<Atom> =
static ANNOTATION_CHUNKING_TYPE: Lazy<Wtf8Atom> =
Lazy::new(|| crate::annotations::ANNOTATION_CHUNKING_TYPE.into());
/// Changes the type of the resolved module (only "json" is supported currently)
static ATTRIBUTE_MODULE_TYPE: Lazy<Atom> = Lazy::new(|| atom!("type"));
static ATTRIBUTE_MODULE_TYPE: Lazy<Wtf8Atom> = Lazy::new(|| atom!("type").into());
impl ImportAnnotations {
pub fn parse(with: Option<&ObjectLit>) -> ImportAnnotations {
......@@ -63,13 +64,13 @@ impl ImportAnnotations {
Some((&kv.key, str))
}) {
let key = match key {
PropName::Ident(ident) => ident.sym.as_str(),
PropName::Str(str) => str.value.as_str(),
PropName::Ident(ident) => ident.sym.clone().into(),
PropName::Str(str) => str.value.clone(),
// the rest are invalid, ignore for now till SWC ast is correct
_ => continue,
};
map.insert(key.into(), value.value.as_str().into());
map.insert(key, value.value.clone());
}
ImportAnnotations { map }
......@@ -94,29 +95,33 @@ impl ImportAnnotations {
continue;
};
map.insert(key.as_str().into(), value.as_str().into());
map.insert(
key.as_atom().into_owned().into(),
value.as_atom().into_owned().into(),
);
}
Some(ImportAnnotations { map })
}
/// Returns the content on the transition annotation
pub fn transition(&self) -> Option<&str> {
pub fn transition(&self) -> Option<Cow<'_, str>> {
self.get(&ANNOTATION_TRANSITION)
.map(|v| v.to_string_lossy())
}
/// Returns the content on the chunking-type annotation
pub fn chunking_type(&self) -> Option<&str> {
pub fn chunking_type(&self) -> Option<&Wtf8Atom> {
self.get(&ANNOTATION_CHUNKING_TYPE)
}
/// Returns the content on the type attribute
pub fn module_type(&self) -> Option<&str> {
pub fn module_type(&self) -> Option<&Wtf8Atom> {
self.get(&ATTRIBUTE_MODULE_TYPE)
}
pub fn get(&self, key: &Atom) -> Option<&str> {
self.map.get(key).map(|w| w.as_str())
pub fn get(&self, key: &Wtf8Atom) -> Option<&Wtf8Atom> {
self.map.get(key)
}
}
......@@ -124,12 +129,12 @@ impl Display for ImportAnnotations {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut it = self.map.iter();
if let Some((k, v)) = it.next() {
write!(f, "{{ {k}: {v}")?
write!(f, "{{ {}: {}", k.to_string_lossy(), v.to_string_lossy())?
} else {
return f.write_str("{}");
};
for (k, v) in it {
write!(f, ", {k}: {v}")?
write!(f, ", {}: {}", k.to_string_lossy(), v.to_string_lossy())?
}
f.write_str(" }")
}
......@@ -182,7 +187,7 @@ pub(crate) struct ImportMap {
/// The module specifiers of star imports that are accessed dynamically and should be imported
/// as a whole.
full_star_imports: FxHashSet<Atom>,
full_star_imports: FxHashSet<Wtf8Atom>,
pub(crate) exports: FxHashMap<RcStr, Id>,
}
......@@ -241,7 +246,7 @@ pub(crate) enum ImportedSymbol {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub(crate) struct ImportMapReference {
pub module_path: Atom,
pub module_path: Wtf8Atom,
pub imported_symbol: ImportedSymbol,
pub annotations: ImportAnnotations,
pub issue_source: Option<IssueSource>,
......@@ -360,8 +365,8 @@ impl ImportMap {
struct StarImportAnalyzer<'a> {
/// The local identifiers of the star imports
candidates: FxIndexMap<Id, Atom>,
full_star_imports: &'a mut FxHashSet<Atom>,
candidates: FxIndexMap<Id, Wtf8Atom>,
full_star_imports: &'a mut FxHashSet<Wtf8Atom>,
}
impl Visit for StarImportAnalyzer<'_> {
......@@ -427,7 +432,7 @@ impl Analyzer<'_> {
fn ensure_reference(
&mut self,
span: Span,
module_path: Atom,
module_path: Wtf8Atom,
imported_symbol: ImportedSymbol,
annotations: ImportAnnotations,
) -> Option<usize> {
......@@ -451,13 +456,6 @@ impl Analyzer<'_> {
}
}
fn export_as_atom(name: &ModuleExportName) -> &Atom {
match name {
ModuleExportName::Ident(ident) => &ident.sym,
ModuleExportName::Str(s) => &s.value,
}
}
impl Visit for Analyzer<'_> {
fn visit_import_decl(&mut self, import: &ImportDecl) {
self.data.has_imports = true;
......@@ -494,7 +492,7 @@ impl Visit for Analyzer<'_> {
ImportSpecifier::Named(ImportNamedSpecifier {
local, imported, ..
}) => match imported {
Some(imported) => (local.to_id(), orig_name(imported)),
Some(imported) => (local.to_id(), imported.atom().into_owned()),
_ => (local.to_id(), local.sym.clone()),
},
ImportSpecifier::Default(s) => (s.local.to_id(), atom!("default")),
......@@ -580,7 +578,7 @@ impl Visit for Analyzer<'_> {
self.data.reexports.push((
i,
Reexport::Namespace {
exported: export_as_atom(&n.name).clone(),
exported: n.name.atom().into_owned(),
},
));
}
......@@ -597,9 +595,8 @@ impl Visit for Analyzer<'_> {
self.data.reexports.push((
i,
Reexport::Named {
imported: export_as_atom(&n.orig).clone(),
exported: export_as_atom(n.exported.as_ref().unwrap_or(&n.orig))
.clone(),
imported: n.orig.atom().into_owned(),
exported: n.exported.as_ref().unwrap_or(&n.orig).atom().into_owned(),
},
));
}
......@@ -697,7 +694,7 @@ impl Visit for Analyzer<'_> {
let exported = n.exported.as_ref().unwrap_or(&n.orig);
self.data
.exports
.insert(export_as_atom(exported).as_str().into(), local.to_id());
.insert(exported.atom().as_str().into(), local.to_id());
}
fn visit_export_default_specifier(&mut self, n: &ExportDefaultSpecifier) {
......@@ -810,13 +807,6 @@ fn parse_ignore_directive(comments: &dyn Comments, value: Option<&ExprOrSpread>)
.next()
}
pub(crate) fn orig_name(n: &ModuleExportName) -> Atom {
match n {
ModuleExportName::Ident(v) => v.sym.clone(),
ModuleExportName::Str(v) => v.value.clone(),
}
}
fn parse_with(with: Option<&ObjectLit>) -> Option<ImportedSymbol> {
find_turbopack_part_id_in_asserts(with?).map(|v| match v {
PartId::Internal(index, true) => ImportedSymbol::PartEvaluation(index),
......@@ -832,7 +822,7 @@ fn get_import_symbol_from_import(specifier: &ImportSpecifier) -> ImportedSymbol
ImportSpecifier::Named(ImportNamedSpecifier {
local, imported, ..
}) => ImportedSymbol::Symbol(match imported {
Some(imported) => orig_name(imported),
Some(imported) => imported.atom().into_owned(),
_ => local.sym.clone(),
}),
ImportSpecifier::Default(..) => ImportedSymbol::Symbol(atom!("default")),
......@@ -843,7 +833,7 @@ fn get_import_symbol_from_import(specifier: &ImportSpecifier) -> ImportedSymbol
fn get_import_symbol_from_export(specifier: &ExportSpecifier) -> ImportedSymbol {
match specifier {
ExportSpecifier::Named(ExportNamedSpecifier { orig, .. }) => {
ImportedSymbol::Symbol(orig_name(orig))
ImportedSymbol::Symbol(orig.atom().into_owned())
}
ExportSpecifier::Default(..) => ImportedSymbol::Symbol(atom!("default")),
ExportSpecifier::Namespace(..) => ImportedSymbol::Exports,
......
......@@ -16,6 +16,7 @@ use num_traits::identities::Zero;
use once_cell::sync::Lazy;
use rustc_hash::FxHasher;
use swc_core::{
atoms::Wtf8Atom,
common::Mark,
ecma::{
ast::{Id, Ident, Lit},
......@@ -251,7 +252,9 @@ impl From<&'_ str> for ConstantValue {
impl From<Lit> for ConstantValue {
fn from(v: Lit) -> Self {
match v {
Lit::Str(v) => ConstantValue::Str(ConstantString::Atom(v.value)),
Lit::Str(v) => {
ConstantValue::Str(ConstantString::Atom(v.value.to_atom_lossy().into_owned()))
}
Lit::Bool(v) => {
if v.value {
ConstantValue::True
......@@ -285,7 +288,7 @@ impl Display for ConstantValue {
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct ModuleValue {
pub module: Atom,
pub module: Wtf8Atom,
pub annotations: ImportAnnotations,
}
......@@ -567,7 +570,7 @@ impl From<String> for JsValue {
impl From<swc_core::ecma::ast::Str> for JsValue {
fn from(v: swc_core::ecma::ast::Str) -> Self {
ConstantValue::Str(v.value.into()).into()
ConstantValue::Str(ConstantString::Atom(v.value.to_atom_lossy().into_owned())).into()
}
}
......@@ -787,7 +790,7 @@ impl Display for JsValue {
module: name,
annotations,
}) => {
write!(f, "Module({name}, {annotations})")
write!(f, "Module({}, {annotations})", name.to_string_lossy())
}
JsValue::Unknown { .. } => write!(f, "???"),
JsValue::WellKnownObject(obj) => write!(f, "WellKnownObject({obj:?})"),
......@@ -1713,7 +1716,7 @@ impl JsValue {
module: name,
annotations,
}) => {
format!("module<{name}, {annotations}>")
format!("module<{}, {annotations}>", name.to_string_lossy())
}
JsValue::Unknown {
original_value: inner,
......@@ -2117,7 +2120,7 @@ impl JsValue {
let first_str: &str = first_str;
if var_graph
.free_var_ids
.get(&first_str.into())
.get(&Atom::from(first_str))
.is_some_and(|id| var_graph.values.contains_key(id))
{
// `typeof foo...` but `foo` was reassigned
......@@ -3702,7 +3705,7 @@ pub mod test_utils {
) => match &args[0] {
JsValue::Constant(ConstantValue::Str(v)) => {
JsValue::promise(JsValue::Module(ModuleValue {
module: v.as_atom().into_owned(),
module: v.as_atom().into_owned().into(),
annotations: ImportAnnotations::default(),
}))
}
......
......@@ -347,7 +347,7 @@ pub fn import(args: Vec<JsValue>) -> JsValue {
match &args[..] {
[JsValue::Constant(ConstantValue::Str(v))] => {
JsValue::promise(JsValue::Module(ModuleValue {
module: v.as_atom().into_owned(),
module: v.as_atom().into_owned().into(),
annotations: ImportAnnotations::default(),
}))
}
......
......@@ -199,7 +199,7 @@ mod tests {
impl AstModifier for StrReplacer<'_> {
fn visit_mut_str(&self, s: &mut Str) {
s.value = s.value.replace(self.from, self.to).into();
s.value = s.value.to_string_lossy().replace(self.from, self.to).into();
s.raw = None;
}
}
......
......@@ -391,9 +391,9 @@ impl EsmAssetReference {
impl ModuleReference for EsmAssetReference {
#[turbo_tasks::function]
async fn resolve_reference(&self) -> Result<Vc<ModuleResolveResult>> {
let ty = if matches!(self.annotations.module_type(), Some("json")) {
let ty = if self.annotations.module_type().is_some_and(|v| v == "json") {
EcmaScriptModulesReferenceSubType::ImportWithType(ImportWithType::Json)
} else if matches!(self.annotations.module_type(), Some("bytes")) {
} else if self.annotations.module_type().is_some_and(|v| v == "bytes") {
EcmaScriptModulesReferenceSubType::ImportWithType(ImportWithType::Bytes)
} else if let Some(part) = &self.export_name {
EcmaScriptModulesReferenceSubType::ImportPart(part.clone())
......@@ -489,13 +489,18 @@ impl ChunkableModuleReference for EsmAssetReference {
fn chunking_type(&self) -> Result<Vc<ChunkingTypeOption>> {
Ok(Vc::cell(
if let Some(chunking_type) = self.annotations.chunking_type() {
match chunking_type {
"parallel" => Some(ChunkingType::Parallel {
if chunking_type == "parallel" {
Some(ChunkingType::Parallel {
inherit_async: true,
hoisted: true,
}),
"none" => None,
_ => return Err(anyhow!("unknown chunking_type: {}", chunking_type)),
})
} else if chunking_type == "none" {
None
} else {
return Err(anyhow!(
"unknown chunking_type: {}",
chunking_type.to_string_lossy()
));
}
} else {
Some(ChunkingType::Parallel {
......@@ -525,7 +530,7 @@ impl EsmAssetReference {
let this = &*self.await?;
// only chunked references can be imported
if this.annotations.chunking_type() != Some("none") {
if this.annotations.chunking_type().is_none_or(|v| v != "none") {
let import_externals = this.import_externals;
let referenced_asset = self.get_referenced_asset().await?;
......
......@@ -41,7 +41,7 @@ use regex::Regex;
use rustc_hash::{FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize};
use swc_core::{
atoms::{Atom, atom},
atoms::{Atom, Wtf8Atom, atom},
common::{
GLOBALS, Globals, Span, Spanned,
comments::{CommentKind, Comments},
......@@ -755,7 +755,7 @@ async fn analyze_ecmascript_module_internal(
let mut should_add_evaluation = false;
let reference = EsmAssetReference::new(
origin,
RcStr::from(&*r.module_path),
RcStr::from(&*r.module_path.to_string_lossy()),
r.issue_source
.unwrap_or_else(|| IssueSource::from_source_only(source)),
r.annotations.clone(),
......@@ -774,7 +774,7 @@ async fn analyze_ecmascript_module_internal(
"Internal imports only exist in reexports only mode when \
importing {:?} from {}",
r.imported_symbol,
r.module_path
r.module_path.to_string_lossy()
);
}
if matches!(&r.imported_symbol, ImportedSymbol::PartEvaluation(_)) {
......@@ -3454,7 +3454,9 @@ impl StaticAnalyser {
fn evaluate_expr(&self, expr: &Expr) -> StaticExpr {
match expr {
Expr::Lit(Lit::Str(str)) => StaticExpr::String(str.value.to_string()),
Expr::Lit(Lit::Str(str)) => {
StaticExpr::String(str.value.to_string_lossy().into_owned())
}
Expr::Ident(ident) => {
let str = ident.sym.to_string();
match self.imports.get(&str) {
......@@ -3761,7 +3763,7 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
ast_path: &mut AstNodePath<AstParentNodeRef<'r>>,
) {
let path = as_parent_path(ast_path).into();
let src = import.src.value.to_string();
let src = import.src.value.to_string_lossy().into_owned();
import.visit_children_with_ast_path(self, ast_path);
if import.type_only {
return;
......@@ -3776,7 +3778,9 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
src.clone(),
vec![match &named.imported {
Some(ModuleExportName::Ident(ident)) => ident.sym.to_string(),
Some(ModuleExportName::Str(str)) => str.value.to_string(),
Some(ModuleExportName::Str(str)) => {
str.value.to_string_lossy().into_owned()
}
None => named.local.sym.to_string(),
}],
),
......@@ -3816,7 +3820,8 @@ impl VisitAstPath for ModuleReferencesVisitor<'_> {
&& let [ExprOrSpread { spread: None, expr }] = &call.args[..]
&& let Some(Lit::Str(str)) = expr.as_lit()
{
self.webpack_runtime = Some((str.value.as_str().into(), call.span));
self.webpack_runtime =
Some((str.value.to_string_lossy().into_owned().into(), call.span));
return;
}
decl.visit_children_with_ast_path(self, ast_path);
......@@ -3915,11 +3920,13 @@ impl From<Vec<AstParentKind>> for AstPath {
}
pub static TURBOPACK_HELPER: Lazy<Atom> = Lazy::new(|| atom!("__turbopack-helper__"));
pub static TURBOPACK_HELPER_WTF8: Lazy<Wtf8Atom> =
Lazy::new(|| atom!("__turbopack-helper__").into());
pub fn is_turbopack_helper_import(import: &ImportDecl) -> bool {
let annotations = ImportAnnotations::parse(import.with.as_deref());
annotations.get(&TURBOPACK_HELPER).is_some()
annotations.get(&TURBOPACK_HELPER_WTF8).is_some()
}
pub fn is_swc_helper_import(import: &ImportDecl) -> bool {
......
......@@ -54,7 +54,7 @@ impl AstModifier for UnreachableModifier {
*node = Expr::Lit(Lit::Str(Str {
span,
value: unreachable_atom(),
value: unreachable_atom().into(),
raw: None,
}));
}
......
......@@ -954,7 +954,7 @@ impl DepGraph {
local = local.into_private();
}
exports.push((local.to_id(), exported.atom().clone()));
exports.push((local.to_id(), exported.atom().into_owned()));
if let Some(src) = &item.src {
let id = ItemId::Item {
......@@ -1688,10 +1688,12 @@ pub(crate) fn find_turbopack_part_id_in_asserts(asserts: &ObjectLit) -> Option<P
PropOrSpread::Prop(box Prop::KeyValue(KeyValueProp {
key: PropName::Ident(key),
value: box Expr::Lit(Lit::Str(s)),
})) if &*key.sym == ASSERT_CHUNK_KEY => match &*s.value {
})) if &*key.sym == ASSERT_CHUNK_KEY => match s.value.as_str()? {
"module evaluation" => Some(PartId::ModuleEvaluation),
"exports" => Some(PartId::Exports),
_ if s.value.starts_with("export ") => Some(PartId::Export(s.value[7..].into())),
_ if s.value.starts_with("export ") => {
Some(PartId::Export(s.value.as_str()?[7..].into()))
}
_ => None,
},
_ => None,
......
use anyhow::Error;
use rustc_hash::FxHashSet;
use swc_core::ecma::{
ast::{Module, ModuleDecl, ModuleItem},
atoms::Atom,
use swc_core::{
atoms::Wtf8Atom,
ecma::ast::{Module, ModuleDecl, ModuleItem},
};
use super::{PartId, graph::find_turbopack_part_id_in_asserts};
......@@ -10,7 +10,7 @@ use super::{PartId, graph::find_turbopack_part_id_in_asserts};
/// A loader used to merge module items after splitting.
pub trait Load {
/// Loads a module while returning [None] if the module is already loaded.
fn load(&mut self, uri: &str, part_id: u32) -> Result<Option<Module>, Error>;
fn load(&mut self, uri: &Wtf8Atom, part_id: u32) -> Result<Option<Module>, Error>;
}
/// A module merger.
......@@ -22,7 +22,7 @@ where
{
loader: L,
done: FxHashSet<(Atom, u32)>,
done: FxHashSet<(Wtf8Atom, u32)>,
}
impl<L> Merger<L>
......
......@@ -3,7 +3,7 @@ use std::{collections::BTreeMap, fmt::Write, hash::Hash, path::PathBuf, sync::Ar
use anyhow::Error;
use serde::Deserialize;
use swc_core::{
atoms::atom,
atoms::{Wtf8Atom, atom},
common::{Mark, SourceMap, SyntaxContext, comments::SingleThreadedComments, util::take::Take},
ecma::{
ast::{EsVersion, Id, Module},
......@@ -175,7 +175,7 @@ fn run(input: PathBuf) {
)
.unwrap();
let uri_of_module = atom!("entry.js");
let uri_of_module = atom!("entry.js").into();
let mut describe =
|is_debug: bool, title: &str, entries: Vec<ItemIdGroupKind>, skip_parts: bool| {
......@@ -263,12 +263,12 @@ fn run(input: PathBuf) {
}
struct SingleModuleLoader<'a> {
entry_module_uri: &'a str,
entry_module_uri: &'a Wtf8Atom,
modules: &'a [Module],
}
impl super::merge::Load for SingleModuleLoader<'_> {
fn load(&mut self, uri: &str, chunk_id: u32) -> Result<Option<Module>, Error> {
fn load(&mut self, uri: &Wtf8Atom, chunk_id: u32) -> Result<Option<Module>, Error> {
if self.entry_module_uri == uri {
return Ok(Some(self.modules[chunk_id as usize].clone()));
}
......
......@@ -190,38 +190,38 @@ pub enum AstPathRange {
/// Converts a module value (ie an import) to a well known object,
/// which we specifically handle.
pub fn module_value_to_well_known_object(module_value: &ModuleValue) -> Option<JsValue> {
Some(match &*module_value.module {
"node:path" | "path" => JsValue::WellKnownObject(WellKnownObjectKind::PathModule),
"node:fs/promises" | "fs/promises" => {
Some(match module_value.module.as_bytes() {
b"node:path" | b"path" => JsValue::WellKnownObject(WellKnownObjectKind::PathModule),
b"node:fs/promises" | b"fs/promises" => {
JsValue::WellKnownObject(WellKnownObjectKind::FsModule)
}
"node:fs" | "fs" => JsValue::WellKnownObject(WellKnownObjectKind::FsModule),
"node:child_process" | "child_process" => {
b"node:fs" | b"fs" => JsValue::WellKnownObject(WellKnownObjectKind::FsModule),
b"node:child_process" | b"child_process" => {
JsValue::WellKnownObject(WellKnownObjectKind::ChildProcessModule)
}
"node:os" | "os" => JsValue::WellKnownObject(WellKnownObjectKind::OsModule),
"node:process" | "process" => {
b"node:os" | b"os" => JsValue::WellKnownObject(WellKnownObjectKind::OsModule),
b"node:process" | b"process" => {
JsValue::WellKnownObject(WellKnownObjectKind::NodeProcessModule)
}
"node:url" | "url" => JsValue::WellKnownObject(WellKnownObjectKind::UrlModule),
"node:module" | "module" => JsValue::WellKnownObject(WellKnownObjectKind::ModuleModule),
"node:worker_threads" | "worker_threads" => {
b"node:url" | b"url" => JsValue::WellKnownObject(WellKnownObjectKind::UrlModule),
b"node:module" | b"module" => JsValue::WellKnownObject(WellKnownObjectKind::ModuleModule),
b"node:worker_threads" | b"worker_threads" => {
JsValue::WellKnownObject(WellKnownObjectKind::WorkerThreadsModule)
}
"node-pre-gyp" | "@mapbox/node-pre-gyp" => {
b"node-pre-gyp" | b"@mapbox/node-pre-gyp" => {
JsValue::WellKnownObject(WellKnownObjectKind::NodePreGyp)
}
"node-gyp-build" => JsValue::WellKnownFunction(WellKnownFunctionKind::NodeGypBuild),
"node:bindings" | "bindings" => {
b"node-gyp-build" => JsValue::WellKnownFunction(WellKnownFunctionKind::NodeGypBuild),
b"node:bindings" | b"bindings" => {
JsValue::WellKnownFunction(WellKnownFunctionKind::NodeBindings)
}
"express" => JsValue::WellKnownFunction(WellKnownFunctionKind::NodeExpress),
"strong-globalize" => {
b"express" => JsValue::WellKnownFunction(WellKnownFunctionKind::NodeExpress),
b"strong-globalize" => {
JsValue::WellKnownFunction(WellKnownFunctionKind::NodeStrongGlobalize)
}
"resolve-from" => JsValue::WellKnownFunction(WellKnownFunctionKind::NodeResolveFrom),
"@grpc/proto-loader" => JsValue::WellKnownObject(WellKnownObjectKind::NodeProtobufLoader),
"fs-extra" => JsValue::WellKnownObject(WellKnownObjectKind::FsExtraModule),
b"resolve-from" => JsValue::WellKnownFunction(WellKnownFunctionKind::NodeResolveFrom),
b"@grpc/proto-loader" => JsValue::WellKnownObject(WellKnownObjectKind::NodeProtobufLoader),
b"fs-extra" => JsValue::WellKnownObject(WellKnownObjectKind::FsExtraModule),
_ => return None,
})
}
......
......@@ -85,7 +85,7 @@ impl ModuleReference for WebpackChunkAssetReference {
} => {
// TODO determine filename from chunk_request_expr
let chunk_id = match &self.chunk_id {
Lit::Str(str) => str.value.to_string(),
Lit::Str(str) => str.value.to_string_lossy().into_owned(),
Lit::Num(num) => format!("{num}"),
_ => todo!(),
};
......@@ -108,7 +108,7 @@ impl ValueToString for WebpackChunkAssetReference {
#[turbo_tasks::function]
fn to_string(&self) -> Vc<RcStr> {
let chunk_id = match &self.chunk_id {
Lit::Str(str) => str.value.to_string(),
Lit::Str(str) => str.value.to_string_lossy().into_owned(),
Lit::Num(num) => format!("{num}"),
_ => todo!(),
};
......
......@@ -2,13 +2,13 @@
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/Actions.js [test] (ecmascript)", ((__turbopack_context__) => {
"use strict";
// import() doesn't care about whether a module is an async module or not
__turbopack_context__.s([
"AlternativeCreateUserAction",
()=>AlternativeCreateUserAction,
"CreateUserAction",
()=>CreateUserAction
]);
// import() doesn't care about whether a module is an async module or not
const UserApi = __turbopack_context__.A("[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/UserAPI.js [test] (ecmascript, async loader)");
const CreateUserAction = async (name)=>{
console.log('Creating user', name);
......
......@@ -2,6 +2,6 @@
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/Actions.js"],"sourcesContent":["// import() doesn't care about whether a module is an async module or not\nconst UserApi = import('./UserAPI.js')\n\nexport const CreateUserAction = async (name) => {\n console.log('Creating user', name)\n // These are normal awaits, because they are in an async function\n const { createUser } = await UserApi\n await createUser(name)\n}\n\n// You can place import() where you like\n// Placing it at top-level will start loading and evaluating on\n// module evaluation.\n// see CreateUserAction above\n// Here: Connecting to the DB starts when the application starts\n// Placing it inside of an (async) function will start loading\n// and evaluating when the function is called for the first time\n// which basically makes it lazy-loaded.\n// see AlternativeCreateUserAction below\n// Here: Connecting to the DB starts when AlternativeCreateUserAction\n// is called\nexport const AlternativeCreateUserAction = async (name) => {\n const { createUser } = await import('./UserAPI.js')\n await createUser(name)\n}\n\n// Note: Using await import() at top-level doesn't make much sense\n// except in rare cases. It will import modules sequentially.\n"],"names":[],"mappings":"AAAA,yEAAyE;;;;;;;AACzE,MAAM;AAEC,MAAM,mBAAmB,OAAO;IACrC,QAAQ,GAAG,CAAC,iBAAiB;IAC7B,iEAAiE;IACjE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM;IAC7B,MAAM,WAAW;AACnB;AAaO,MAAM,8BAA8B,OAAO;IAChD,MAAM,EAAE,UAAU,EAAE,GAAG;IACvB,MAAM,WAAW;AACnB,EAEA,kEAAkE;CAClE,mEAAmE"}},
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/Actions.js"],"sourcesContent":["// import() doesn't care about whether a module is an async module or not\nconst UserApi = import('./UserAPI.js')\n\nexport const CreateUserAction = async (name) => {\n console.log('Creating user', name)\n // These are normal awaits, because they are in an async function\n const { createUser } = await UserApi\n await createUser(name)\n}\n\n// You can place import() where you like\n// Placing it at top-level will start loading and evaluating on\n// module evaluation.\n// see CreateUserAction above\n// Here: Connecting to the DB starts when the application starts\n// Placing it inside of an (async) function will start loading\n// and evaluating when the function is called for the first time\n// which basically makes it lazy-loaded.\n// see AlternativeCreateUserAction below\n// Here: Connecting to the DB starts when AlternativeCreateUserAction\n// is called\nexport const AlternativeCreateUserAction = async (name) => {\n const { createUser } = await import('./UserAPI.js')\n await createUser(name)\n}\n\n// Note: Using await import() at top-level doesn't make much sense\n// except in rare cases. It will import modules sequentially.\n"],"names":[],"mappings":";;;;;;AAAA,yEAAyE;AACzE,MAAM;AAEC,MAAM,mBAAmB,OAAO;IACrC,QAAQ,GAAG,CAAC,iBAAiB;IAC7B,iEAAiE;IACjE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM;IAC7B,MAAM,WAAW;AACnB;AAaO,MAAM,8BAA8B,OAAO;IAChD,MAAM,EAAE,UAAU,EAAE,GAAG;IACvB,MAAM,WAAW;AACnB,EAEA,kEAAkE;CAClE,mEAAmE"}},
{"offset": {"line": 28, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/basic/top-level-await/input/index.js"],"sourcesContent":["import { CreateUserAction } from './Actions.js'\n;(async () => {\n await CreateUserAction('John')\n console.log('created user John')\n})()\n"],"names":[],"mappings":";AAAA;;AACC,CAAC;IACA,MAAM,IAAA,kOAAgB,EAAC;IACvB,QAAQ,GAAG,CAAC;AACd,CAAC"}}]
}
\ No newline at end of file
......@@ -767,4 +767,4 @@ module.exports = (sourcePath)=>({
});
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
\ No newline at end of file
......@@ -2,15 +2,15 @@
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/input/index.js [test] (ecmascript)", ((__turbopack_context__) => {
"use strict";
/** @jsxImportSource @emotion/react */ __turbopack_context__.s([]);
__turbopack_context__.s([]);
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$react$2f$jsx$2d$dev$2d$runtime$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js [test] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$react$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js [test] (ecmascript)");
/** @jsxImportSource @emotion/react */ var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$react$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js [test] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$styled$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/styled/index.js [test] (ecmascript)");
;
;
;
const StyledButton = (0, /*#__PURE__*/ __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$styled$2f$index$2e$js__$5b$test$5d$__$28$ecmascript$29$__["default"])("button", {
target: "e6tdad40"
target: "egm8rku0"
})("background:blue;");
function ClassNameButton({ children }) {
return /*#__PURE__*/ (0, __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$node_modules$2f40$emotion$2f$react$2f$jsx$2d$dev$2d$runtime$2e$js__$5b$test$5d$__$28$ecmascript$29$__["jsxDEV"])("button", {
......
......@@ -2,7 +2,7 @@
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/input/index.js"],"sourcesContent":["/** @jsxImportSource @emotion/react */\n\nimport { jsx } from '@emotion/react'\nimport styled from '@emotion/styled'\n\nconst StyledButton = styled.button`\n background: blue;\n`\n\nfunction ClassNameButton({ children }) {\n return (\n <button\n className={css`\n background: blue;\n `}\n >\n {children}\n </button>\n )\n}\n\nconsole.log(StyledButton, ClassNameButton)\n"],"names":[],"mappings":"AAAA,oCAAoC;;AAEpC;AACA;;;;AAEA,MAAM,iCAAe,mNAAM;;;AAI3B,SAAS,gBAAgB,EAAE,QAAQ,EAAE;IACnC,qBACE,uOAAC;QACC,WAAW,GAAG,CAAC;;MAEf,CAAC;kBAEA;;;;;;AAGP;AAEA,QAAQ,GAAG,CAAC,cAAc"}},
{"offset": {"line": 4, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/emotion/emotion/input/index.js"],"sourcesContent":["/** @jsxImportSource @emotion/react */\n\nimport { jsx } from '@emotion/react'\nimport styled from '@emotion/styled'\n\nconst StyledButton = styled.button`\n background: blue;\n`\n\nfunction ClassNameButton({ children }) {\n return (\n <button\n className={css`\n background: blue;\n `}\n >\n {children}\n </button>\n )\n}\n\nconsole.log(StyledButton, ClassNameButton)\n"],"names":[],"mappings":";;AAAA,oCAAoC,GAEpC;AACA;;;;AAEA,MAAM,iCAAe,mNAAM;;;AAI3B,SAAS,gBAAgB,EAAE,QAAQ,EAAE;IACnC,qBACE,uOAAC;QACC,WAAW,GAAG,CAAC;;MAEf,CAAC;kBAEA;;;;;;AAGP;AAEA,QAAQ,GAAG,CAAC,cAAc"}},
{"offset": {"line": 31, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/jsx-dev-runtime.js"],"sourcesContent":["export function jsxDEV() {\n return 'purposefully empty stub for @emotion/react/jsx-dev-runtime.js'\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS;IACd,OAAO;AACT","ignoreList":[0]}},
{"offset": {"line": 42, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/react/index.js"],"sourcesContent":["export function jsx() {\n return 'purposefully empty stub for @emotion/react/index.js'\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS;IACd,OAAO;AACT","ignoreList":[0]}},
{"offset": {"line": 52, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node_modules/@emotion/styled/index.js"],"sourcesContent":["\"purposefully empty stub\";\n\"@emtion/styled/index.js\";\n"],"names":[],"mappings":"AAAA;AACA","ignoreList":[0]}}]
......
......@@ -7,8 +7,8 @@ exports.hello = 'World';
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/c.js [test] (ecmascript)", ((__turbopack_context__) => {
"use strict";
// c.js
__turbopack_context__.s([]);
// c.js
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$export$2d$alls$2f$cjs$2d$2$2f$input$2f$commonjs$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/commonjs.js [test] (ecmascript)"); // This would be handled by existing logic
__turbopack_context__.j(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$export$2d$alls$2f$cjs$2d$2$2f$input$2f$commonjs$2e$js__$5b$test$5d$__$28$ecmascript$29$__);
;
......@@ -16,8 +16,8 @@ __turbopack_context__.j(__TURBOPACK__imported__module__$5b$project$5d2f$turbopac
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/b.js [test] (ecmascript)", ((__turbopack_context__) => {
"use strict";
// b.js
__turbopack_context__.s([]);
// b.js
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$export$2d$alls$2f$cjs$2d$2$2f$input$2f$c$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/c.js [test] (ecmascript)"); // This would not be handled, but still need __turbopack__cjs__
// as there are properties dynamically added by __turbopack__cjs__ in c.js
__turbopack_context__.j(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$export$2d$alls$2f$cjs$2d$2$2f$input$2f$c$2e$js__$5b$test$5d$__$28$ecmascript$29$__);
......@@ -26,8 +26,8 @@ __turbopack_context__.j(__TURBOPACK__imported__module__$5b$project$5d2f$turbopac
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/index.js [test] (ecmascript)", ((__turbopack_context__) => {
"use strict";
// a.js
__turbopack_context__.s([]);
// a.js
var __TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$export$2d$alls$2f$cjs$2d$2$2f$input$2f$b$2e$js__$5b$test$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/b.js [test] (ecmascript)");
;
console.log(__TURBOPACK__imported__module__$5b$project$5d2f$turbopack$2f$crates$2f$turbopack$2d$tests$2f$tests$2f$snapshot$2f$export$2d$alls$2f$cjs$2d$2$2f$input$2f$b$2e$js__$5b$test$5d$__$28$ecmascript$29$__);
......
......@@ -3,7 +3,7 @@
"sources": [],
"sections": [
{"offset": {"line": 3, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/commonjs.js"],"sourcesContent":["// commonjs.js\nexports.hello = 'World'\n"],"names":[],"mappings":"AAAA,cAAc;AACd,QAAQ,KAAK,GAAG"}},
{"offset": {"line": 9, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/c.js"],"sourcesContent":["// c.js\nexport * from './commonjs.js'\n// This would be handled by existing logic\n"],"names":[],"mappings":"AAAA,OAAO;;AACP,gWACA,0CAA0C"}},
{"offset": {"line": 18, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/b.js"],"sourcesContent":["// b.js\nexport * from './c'\n// This would not be handled, but still need __turbopack__cjs__\n// as there are properties dynamically added by __turbopack__cjs__ in c.js\n"],"names":[],"mappings":"AAAA,OAAO;;AACP,kVACA,+DAA+D;CAC/D,0EAA0E"}},
{"offset": {"line": 28, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/index.js"],"sourcesContent":["// a.js\nimport * as B from './b'\nconsole.log(B)\n"],"names":[],"mappings":"AAAA,OAAO;;AACP;;AACA,QAAQ,GAAG,CAAC"}}]
{"offset": {"line": 9, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/c.js"],"sourcesContent":["// c.js\nexport * from './commonjs.js'\n// This would be handled by existing logic\n"],"names":[],"mappings":";AAAA,OAAO;AACP,gWACA,0CAA0C"}},
{"offset": {"line": 18, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/b.js"],"sourcesContent":["// b.js\nexport * from './c'\n// This would not be handled, but still need __turbopack__cjs__\n// as there are properties dynamically added by __turbopack__cjs__ in c.js\n"],"names":[],"mappings":";AAAA,OAAO;AACP,kVACA,+DAA+D;CAC/D,0EAA0E"}},
{"offset": {"line": 28, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/input/index.js"],"sourcesContent":["// a.js\nimport * as B from './b'\nconsole.log(B)\n"],"names":[],"mappings":";AAAA,OAAO;AACP;;AACA,QAAQ,GAAG,CAAC"}}]
}
\ No newline at end of file
......@@ -38,8 +38,8 @@ module.exports = mod;
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/node/bun_protocol_external/input/index.js [test] (ecmascript)", ((__turbopack_context__) => {
"use strict";
// Test that Bun builtins are treated as external
__turbopack_context__.s([]);
// Test that Bun builtins are treated as external
var __TURBOPACK__imported__module__$5b$externals$5d2f$bun$3a$ffi__$5b$external$5d$__$28$bun$3a$ffi$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/bun:ffi [external] (bun:ffi, cjs)");
var __TURBOPACK__imported__module__$5b$externals$5d2f$bun$3a$jsc__$5b$external$5d$__$28$bun$3a$jsc$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/bun:jsc [external] (bun:jsc, cjs)");
var __TURBOPACK__imported__module__$5b$externals$5d2f$bun$3a$sqlite__$5b$external$5d$__$28$bun$3a$sqlite$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/bun:sqlite [external] (bun:sqlite, cjs)");
......
......@@ -2,5 +2,5 @@
"version": 3,
"sources": [],
"sections": [
{"offset": {"line": 40, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node/bun_protocol_external/input/index.js"],"sourcesContent":["// Test that Bun builtins are treated as external\nimport bunFfi from 'bun:ffi'\nimport bunJsc from 'bun:jsc'\nimport bunSqlite from 'bun:sqlite'\nimport bunTest from 'bun:test'\nimport bunWrap from 'bun:wrap'\nimport bun from 'bun'\n\nconsole.log('bun:ffi:', bunFfi)\nconsole.log('bun:jsc:', bunJsc)\nconsole.log('bun:sqlite:', bunSqlite)\nconsole.log('bun:test:', bunTest)\nconsole.log('bun:wrap:', bunWrap)\nconsole.log('bun:', bun)\n"],"names":[],"mappings":"AAAA,iDAAiD;;AACjD;AACA;AACA;AACA;AACA;AACA;;;;;;;AAEA,QAAQ,GAAG,CAAC,YAAY,wHAAM;AAC9B,QAAQ,GAAG,CAAC,YAAY,wHAAM;AAC9B,QAAQ,GAAG,CAAC,eAAe,8HAAS;AACpC,QAAQ,GAAG,CAAC,aAAa,0HAAO;AAChC,QAAQ,GAAG,CAAC,aAAa,0HAAO;AAChC,QAAQ,GAAG,CAAC,QAAQ,0GAAG"}}]
{"offset": {"line": 40, "column": 0}, "map": {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/node/bun_protocol_external/input/index.js"],"sourcesContent":["// Test that Bun builtins are treated as external\nimport bunFfi from 'bun:ffi'\nimport bunJsc from 'bun:jsc'\nimport bunSqlite from 'bun:sqlite'\nimport bunTest from 'bun:test'\nimport bunWrap from 'bun:wrap'\nimport bun from 'bun'\n\nconsole.log('bun:ffi:', bunFfi)\nconsole.log('bun:jsc:', bunJsc)\nconsole.log('bun:sqlite:', bunSqlite)\nconsole.log('bun:test:', bunTest)\nconsole.log('bun:wrap:', bunWrap)\nconsole.log('bun:', bun)\n"],"names":[],"mappings":";AAAA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;;;;;;;AAEA,QAAQ,GAAG,CAAC,YAAY,wHAAM;AAC9B,QAAQ,GAAG,CAAC,YAAY,wHAAM;AAC9B,QAAQ,GAAG,CAAC,eAAe,8HAAS;AACpC,QAAQ,GAAG,CAAC,aAAa,0HAAO;AAChC,QAAQ,GAAG,CAAC,aAAa,0HAAO;AAChC,QAAQ,GAAG,CAAC,QAAQ,0GAAG"}}]
}
\ No newline at end of file
......@@ -767,4 +767,4 @@ module.exports = (sourcePath)=>({
});
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
//# sourceMappingURL=%5Bturbopack%5D_runtime.js.map
\ No newline at end of file
......@@ -1833,4 +1833,4 @@ chunkListsToRegister.forEach(registerChunkList);
})();
//# sourceMappingURL=780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map
//# sourceMappingURL=780ce_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_c0f7e0b0.js.map
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment