Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Revert "Revert "Update vendored React"" #46881

Merged
merged 2 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-next-41110021f-20230301",
"react-builtin": "npm:react@18.3.0-next-49f741046-20230305",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-next-41110021f-20230301",
"react-server-dom-webpack": "18.3.0-next-41110021f-20230301",
"react-dom-builtin": "npm:react-dom@18.3.0-next-49f741046-20230305",
"react-server-dom-webpack": "18.3.0-next-49f741046-20230305",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand Down
15 changes: 14 additions & 1 deletion packages/next-swc/Cargo.lock

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

2 changes: 2 additions & 0 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ chrono = "0.4"
easy-error = "1.0.0"
either = "1"
fxhash = "0.2.1"
hex = "0.4.3"
once_cell = "1.13.0"
pathdiff = "0.2.0"
regex = "1.5"
serde = "1"
serde_json = "1"
sha1 = "0.10.1"
tracing = { version = "0.1.37", features = ["release_max_level_info"] }

next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230302.2", features = [
Expand Down
19 changes: 11 additions & 8 deletions packages/next-swc/crates/core/src/server_actions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::convert::{TryFrom, TryInto};

use hex::encode as hex_encode;
use next_binding::swc::core::{
common::{
comments::{Comment, CommentKind, Comments},
Expand All @@ -15,6 +16,7 @@ use next_binding::swc::core::{
},
};
use serde::Deserialize;
use sha1::{Digest, Sha1};

#[derive(Clone, Debug, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
Expand Down Expand Up @@ -156,16 +158,17 @@ impl<C: Comments> ServerActions<C> {
.into(),
));

// myAction.$$filepath = '/app/page.tsx';
self.annotations.push(annotate(
ident,
"$$filepath",
self.file_name.to_string().into(),
));
// Attach a checksum to the action using sha1:
// myAction.$$id = sha1('file_name' + ':' + 'export_name');
let mut hasher = Sha1::new();
hasher.update(self.file_name.to_string().as_bytes());
hasher.update(b":");
hasher.update(export_name.as_bytes());
let result = hasher.finalize();

// myAction.$$name = '$ACTION_myAction';
// Convert result to hex string
self.annotations
.push(annotate(ident, "$$name", export_name.into()));
.push(annotate(ident, "$$id", hex_encode(result).into()));

if self.top_level {
// myAction.$$bound = [];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* __next_internal_action_entry_do_not_use__ foo */ export function foo() {}
foo.$$typeof = Symbol.for("react.server.reference");
foo.$$filepath = "/app/item.js";
foo.$$name = "foo";
foo.$$id = "ab21efdafbe611287bc25c0462b1e0510d13e48b";
foo.$$bound = [];
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* __next_internal_action_entry_do_not_use__ bar */ 'use strict';
export function bar() {}
bar.$$typeof = Symbol.for("react.server.reference");
bar.$$filepath = "/app/item.js";
bar.$$name = "bar";
bar.$$id = "ac840dcaf5e8197cb02b7f3a43c119b7a770b272";
bar.$$bound = [];
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export function Item({ id1 , id2 }) {
return $ACTION_deleteItem(deleteItem.$$bound);
}
deleteItem.$$typeof = Symbol.for("react.server.reference");
deleteItem.$$filepath = "/app/item.js";
deleteItem.$$name = "$ACTION_deleteItem";
deleteItem.$$id = "de52fdc8536c533b05b2e525bd43b18cf019cbb3";
deleteItem.$$bound = [
id1,
id2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* __next_internal_action_entry_do_not_use__ default */ export default async function foo() {}
foo.$$typeof = Symbol.for("react.server.reference");
foo.$$filepath = "/app/item.js";
foo.$$name = "default";
foo.$$id = "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d";
foo.$$bound = [];
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* __next_internal_action_entry_do_not_use__ default */ export default async function $ACTION_default_0() {}
$ACTION_default_0.$$typeof = Symbol.for("react.server.reference");
$ACTION_default_0.$$filepath = "/app/item.js";
$ACTION_default_0.$$name = "default";
$ACTION_default_0.$$id = "c18c215a6b7cdc64bf709f3a714ffdef1bf9651d";
$ACTION_default_0.$$bound = [];
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
console.log('a');
}
myAction.$$typeof = Symbol.for("react.server.reference");
myAction.$$filepath = "/app/item.js";
myAction.$$name = "$ACTION_myAction";
myAction.$$id = "c67fa6a80e65945a14b1fac181d282d79bba49b7";
myAction.$$bound = [];
export const $ACTION_myAction = myAction;
export default function Page() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
console.log('a');
}
myAction.$$typeof = Symbol.for("react.server.reference");
myAction.$$filepath = "/app/item.js";
myAction.$$name = "myAction";
myAction.$$id = "e10665baac148856374b2789aceb970f66fec33e";
myAction.$$bound = [];
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
/* __next_internal_action_entry_do_not_use__ a,b,c,$ACTION_e */ export async function a() {}
a.$$typeof = Symbol.for("react.server.reference");
a.$$filepath = "/app/item.js";
a.$$name = "a";
a.$$id = "6e7bc104e4d6e7fda190c4a51be969cfd0be6d6d";
a.$$bound = [];
export async function b() {}
b.$$typeof = Symbol.for("react.server.reference");
b.$$filepath = "/app/item.js";
b.$$name = "b";
b.$$id = "d1f7eb64271d7c601dfef7d4d7053de1c2ca4338";
b.$$bound = [];
export async function c() {}
c.$$typeof = Symbol.for("react.server.reference");
c.$$filepath = "/app/item.js";
c.$$name = "c";
c.$$id = "1ab723c80dcca470e0410b4b2a2fc2bf21f41476";
c.$$bound = [];
function d() {}
function Foo() {
async function e() {
return $ACTION_e(e.$$bound);
}
e.$$typeof = Symbol.for("react.server.reference");
e.$$filepath = "/app/item.js";
e.$$name = "$ACTION_e";
e.$$id = "b6c8c6754aefb804cf95f444931ba7e955c0701d";
e.$$bound = [];
}
export async function $ACTION_e(closure) {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export function Item({ id1 , id2 }) {
return $ACTION_deleteItem(deleteItem.$$bound);
}
deleteItem.$$typeof = Symbol.for("react.server.reference");
deleteItem.$$filepath = "/app/item.js";
deleteItem.$$name = "$ACTION_deleteItem";
deleteItem.$$id = "de52fdc8536c533b05b2e525bd43b18cf019cbb3";
deleteItem.$$bound = [
id1,
v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export function y(p, [p1, { p2 }], ...p3) {
return $ACTION_action(action.$$bound);
}
action.$$typeof = Symbol.for("react.server.reference");
action.$$filepath = "/app/item.js";
action.$$name = "$ACTION_action";
action.$$id = "b3d2707f04906fa37fdc7bee4f53e41053034751";
action.$$bound = [
f2,
f2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export function Item(product, foo, bar) {
return $ACTION_deleteItem(deleteItem.$$bound);
}
deleteItem.$$typeof = Symbol.for("react.server.reference");
deleteItem.$$filepath = "/app/item.js";
deleteItem.$$name = "$ACTION_deleteItem";
deleteItem.$$id = "de52fdc8536c533b05b2e525bd43b18cf019cbb3";
deleteItem.$$bound = [
product.id,
product?.foo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
console.log('a');
}
myAction.$$typeof = Symbol.for("react.server.reference");
myAction.$$filepath = "/app/item.js";
myAction.$$name = "$ACTION_myAction";
myAction.$$id = "c67fa6a80e65945a14b1fac181d282d79bba49b7";
myAction.$$bound = [];
export const $ACTION_myAction = myAction;
export default function Page() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// app/send.ts
/* __next_internal_action_entry_do_not_use__ foo,bar,qux */ async function foo() {}
foo.$$typeof = Symbol.for("react.server.reference");
foo.$$filepath = "/app/item.js";
foo.$$name = "foo";
foo.$$id = "ab21efdafbe611287bc25c0462b1e0510d13e48b";
foo.$$bound = [];
export { foo };
async function bar() {}
bar.$$typeof = Symbol.for("react.server.reference");
bar.$$filepath = "/app/item.js";
bar.$$name = "bar";
bar.$$id = "ac840dcaf5e8197cb02b7f3a43c119b7a770b272";
bar.$$bound = [];
export { bar as baz };
async function qux() {}
qux.$$typeof = Symbol.for("react.server.reference");
qux.$$filepath = "/app/item.js";
qux.$$name = "qux";
qux.$$id = "3c8ed39a99caf636869d076cc7cae786a4053164";
qux.$$bound = [];
export { qux as default };
Loading