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

[WIP]: ignore this PR #7929

Closed
wants to merge 1 commit into from
Closed
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
24 changes: 22 additions & 2 deletions packages/dev/test-utils/src/ssrWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,32 @@ ignoreStyles.default(undefined, (module) => {
module.exports = identityObjectProxy;
});

require('@babel/register')({
extensions: ['.js', '.ts', '.tsx']
const {register} = require('@swc-node/register/register');
register({
extensions: ['.js', '.ts', '.tsx'],
module: {
type: ''
},

jsc: {
parser: {
syntax: 'typescript',
tsx: true,
importAssertions: true
},

transform: {
react: {
runtime: 'automatic'
}
}
}
});

let {evaluate} = require('./ssrUtils');
let {SSRProvider} = require('@react-aria/ssr');


http.createServer((req, res) => {
let body = '';
req.on('data', chunk => {
Expand All @@ -45,6 +64,7 @@ http.createServer((req, res) => {

let html;
try {
console.log(parsed.source);
// Evaluate the code, and render the resulting JSX element to HTML.
let element = evaluate(parsed.source, parsed.filename);
html = ReactDOMServer.renderToString(React.createElement(SSRProvider, undefined, element));
Expand Down
1 change: 1 addition & 0 deletions packages/dev/test-utils/src/testSSR.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export async function testSSR(filename, source, runAfterServer) {
headers: {
'Content-Type': 'application/json'
}

}, res => {
let body = '';
res.setEncoding('utf8');
Expand Down