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

fix(es/lexer): Fix lexing of \r\n in JSX #9112

Merged
merged 9 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update test refs
  • Loading branch information
kdy1 committed Jun 29, 2024
commit d1769beaeda37cac38e3133e5075cc16bfe9ccc9
2 changes: 0 additions & 2 deletions crates/swc_ecma_codegen/tests/fixture/next-36251/output.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ type ü = {
};
export const SomeComponent = ({ name, value }: ü)=>{
return (<div>

{name} {value}

</div>);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ const D = import('D');
import E = require('E');
export default function App() {
return <div>

<A/>

<B/>

<C/>

<D/>

<E/>

</div>;
}
_c = App;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import ReactDOM from "react-dom";
import { _Component } from "./Component";
const App = <div>

<_Component></_Component>

<p>Hello World</p>

</div>;
ReactDOM.render(App, window.document.getElementById("react_root"));
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { dirname } from "node:path";
export default function IndexPage(props) {
return <div>

abc: {props.abc}

<svg viewBox="0 -85 600 600"></svg>

</div>;
}
export function getServerSideProps() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { dirname } from "node:path";
export default function IndexPage(props) {
return <div>

abc: {props.abc}

<svg viewBox="0 -85 600 600">

<path fillRule="evenodd" d="M513 256.5C513 398.161 398.161 513 256.5 513C114.839 513 0 398.161 0 256.5C0 114.839 114.839 0 256.5 0C398.161 0 513 114.839 513 256.5ZM211.146 305.243L369.885 145L412 185.878L253.26 346.122L211.146 387L101 275.811L143.115 234.932L211.146 305.243Z" fill="#fff"/>

</svg>

</div>;
}
export function getServerSideProps() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
defaultLocale: renderOpts.defaultLocale,
AppTree: (props)=>{
return <AppContainer>

<App {...props} Component={Component} router={router}/>

</AppContainer>;
},
defaultGetInitialProps: async (docCtx)=>{
Expand Down Expand Up @@ -265,9 +263,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
let scriptLoader = {};
const nextExport = !isSSG && (renderOpts.nextExport || dev && (isAutoExport || isFallback));
const AppContainer = ({ children })=><RouterContext.Provider value={router}>

<AmpStateContext.Provider value={ampState}>

<HeadManagerContext.Provider value={{
updateHead: (state)=>{
head = state;
Expand All @@ -278,21 +274,13 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
scripts: {},
mountedInstances: new Set()
}}>

<LoadableContext.Provider value={(moduleName)=>reactLoadableModules.push(moduleName)}>

<StyleRegistry registry={jsxStyleRegistry}>

{children}

</StyleRegistry>

</LoadableContext.Provider>

</HeadManagerContext.Provider>

</AmpStateContext.Provider>

</RouterContext.Provider>;
props = await loadGetInitialProps(App, {
AppTree: ctx.AppTree,
Expand Down Expand Up @@ -553,9 +541,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
}
const { App: EnhancedApp, Component: EnhancedComponent } = enhanceComponents(options, App, Component);
const html = ReactDOMServer.renderToString(<AppContainer>

<EnhancedApp Component={EnhancedComponent} router={router} {...props}/>

</AppContainer>);
return {
html,
Expand Down Expand Up @@ -584,9 +570,7 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
};
} else {
const content = ctx.err && ErrorDebug ? <ErrorDebug error={ctx.err}/> : <AppContainer>

<App {...props} Component={Component} router={router}/>

</AppContainer>;
const bodyResult = concurrentFeatures ? await renderToStream(content, generateStaticHTML) : piperFromArray([
ReactDOMServer.renderToString(content)
Expand Down Expand Up @@ -665,13 +649,9 @@ export async function renderToHTML(req, res, pathname, query, renderOpts) {
useMaybeDeferContent
};
const documentHTML = ReactDOMServer.renderToStaticMarkup(<AmpStateContext.Provider value={ampState}>

<HtmlContext.Provider value={htmlProps}>

{documentResult.documentElement(htmlProps)}

</HtmlContext.Provider>

</AmpStateContext.Provider>);
if (process.env.NODE_ENV !== "production") {
const nonRenderedComponents = [];
Expand Down
Loading