diff --git a/packages/astro/src/compiler/codegen/index.ts b/packages/astro/src/compiler/codegen/index.ts index 372cc5124..e61d0ee08 100644 --- a/packages/astro/src/compiler/codegen/index.ts +++ b/packages/astro/src/compiler/codegen/index.ts @@ -201,7 +201,7 @@ async function compileExpression(node: Expression, state: CodegenState, compileO } } const location = { start: node.start, end: node.end }; - let code = transpileExpressionSafe(raw, { state, compileOptions, location }); + let code = transpileExpressionSafe("(" + raw + ")", { state, compileOptions, location }); if (code === null) throw new Error(`Unable to compile expression`); code = code.trim().replace(/\;$/, ''); return code; @@ -212,8 +212,6 @@ function transpileExpressionSafe( raw: string, { state, compileOptions, location }: { state: CodegenState; compileOptions: CompileOptions; location: { start: number; end: number } } ): string | null { - // We have to wrap `raw` with parens to support primitives (objects, arrays)! - raw = `(${raw})`; try { let { code } = transformSync(raw, { loader: 'tsx', @@ -457,7 +455,7 @@ const { ${props.join(', ')} } = Astro.props;\n`) script = propsStatement + contentCode + babelGenerator(program).code; const location = { start: module.start, end: module.end }; - let transpiledScript = compileExpressionSafe(script, { state, compileOptions, location }); + let transpiledScript = transpileExpressionSafe(script, { state, compileOptions, location }); if (transpiledScript === null) throw new Error(`Unable to compile script`); script = transpiledScript; } diff --git a/packages/astro/test/helpers.js b/packages/astro/test/helpers.js index ea7a470f1..9638be2ec 100644 --- a/packages/astro/test/helpers.js +++ b/packages/astro/test/helpers.js @@ -6,7 +6,7 @@ import { loadConfig } from '#astro/config'; import execa from 'execa'; import del from 'del'; -const MAX_STARTUP_TIME = 7000; // max time startup may take +const MAX_STARTUP_TIME = 14000; // max time startup may take const MAX_TEST_TIME = 10000; // max time an individual test may take const MAX_SHUTDOWN_TIME = 3000; // max time shutdown() may take diff --git a/packages/renderers/renderer-react/index.js b/packages/renderers/renderer-react/index.js index e47cf5d7d..ca9f35ff7 100644 --- a/packages/renderers/renderer-react/index.js +++ b/packages/renderers/renderer-react/index.js @@ -2,5 +2,5 @@ export default { name: '@astrojs/renderer-react', client: './client', server: './server', - knownEntrypoints: ['react', 'react-dom/server'], + knownEntrypoints: ['react', 'react-dom', 'react-dom/server'], };