@astrojs/react
Advanced tools
Comparing version 2.2.1 to 3.0.0-beta.0
@@ -9,5 +9,4 @@ import { version as ReactVersion } from "react-dom"; | ||
jsxTransformOptions: async () => { | ||
var _a; | ||
const babelPluginTransformReactJsxModule = await import("@babel/plugin-transform-react-jsx"); | ||
const jsx = ((_a = babelPluginTransformReactJsxModule == null ? void 0 : babelPluginTransformReactJsxModule.default) == null ? void 0 : _a.default) ?? (babelPluginTransformReactJsxModule == null ? void 0 : babelPluginTransformReactJsxModule.default); | ||
const jsx = babelPluginTransformReactJsxModule?.default?.default ?? babelPluginTransformReactJsxModule?.default; | ||
return { | ||
@@ -14,0 +13,0 @@ plugins: [ |
{ | ||
"name": "@astrojs/react", | ||
"description": "Use React components within Astro", | ||
"version": "2.2.1", | ||
"version": "3.0.0-beta.0", | ||
"type": "module", | ||
@@ -42,21 +42,21 @@ "types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@babel/core": ">=7.0.0-0 <8.0.0", | ||
"@babel/plugin-transform-react-jsx": "^7.17.12" | ||
"@babel/core": "^7.22.5", | ||
"@babel/plugin-transform-react-jsx": "^7.22.5" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^17.0.45", | ||
"@types/react-dom": "^17.0.17", | ||
"@types/react": "^17.0.62", | ||
"@types/react-dom": "^17.0.20", | ||
"react": "^18.1.0", | ||
"react-dom": "^18.1.0", | ||
"astro": "2.5.6", | ||
"astro": "3.0.0-beta.0", | ||
"astro-scripts": "0.0.14" | ||
}, | ||
"peerDependencies": { | ||
"@types/react": "^17.0.50 || ^18.0.21", | ||
"@types/react-dom": "^17.0.17 || ^18.0.6", | ||
"react": "^17.0.2 || ^18.0.0", | ||
"react-dom": "^17.0.2 || ^18.0.0", | ||
"@types/react": "^17.0.50 || ^18.0.21", | ||
"@types/react-dom": "^17.0.17 || ^18.0.6" | ||
"react-dom": "^17.0.2 || ^18.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=16.12.0" | ||
"node": ">=18.14.1" | ||
}, | ||
@@ -63,0 +63,0 @@ "scripts": { |
@@ -12,2 +12,3 @@ # @astrojs/react ⚛️ | ||
Astro includes a CLI tool for adding first party integrations: `astro add`. This command will: | ||
1. (Optionally) Install all necessary dependencies and peer dependencies | ||
@@ -45,5 +46,4 @@ 2. (Also optionally) Update your `astro.config.*` file to apply this integration | ||
__`astro.config.mjs`__ | ||
```js ins={2} "react()" | ||
```js ins={3} "react()" | ||
// astro.config.mjs | ||
import { defineConfig } from 'astro/config'; | ||
@@ -61,2 +61,3 @@ import react from '@astrojs/react'; | ||
To use your first React component in Astro, head to our [UI framework documentation][astro-ui-frameworks]. You'll explore: | ||
- 📦 how framework components are loaded, | ||
@@ -63,0 +64,0 @@ - 💧 client-side hydration options, and |
@@ -20,4 +20,3 @@ import React from 'react'; | ||
if (typeof Component === 'object') { | ||
const $$typeof = Component['$$typeof']; | ||
return $$typeof && $$typeof.toString().slice('Symbol('.length).startsWith('react'); | ||
return Component['$$typeof']?.toString().slice('Symbol('.length).startsWith('react'); | ||
} | ||
@@ -77,3 +76,3 @@ if (typeof Component !== 'function') return false; | ||
let html; | ||
if (metadata && metadata.hydrate) { | ||
if (metadata?.hydrate) { | ||
html = ReactDOM.renderToString(vnode); | ||
@@ -80,0 +79,0 @@ } else { |
@@ -21,4 +21,3 @@ import React from 'react'; | ||
if (typeof Component === 'object') { | ||
const $$typeof = Component['$$typeof']; | ||
return $$typeof && $$typeof.toString().slice('Symbol('.length).startsWith('react'); | ||
return Component['$$typeof'].toString().slice('Symbol('.length).startsWith('react'); | ||
} | ||
@@ -101,3 +100,3 @@ if (typeof Component !== 'function') return false; | ||
let html; | ||
if (metadata && metadata.hydrate) { | ||
if (metadata?.hydrate) { | ||
if ('renderToReadableStream' in ReactDOM) { | ||
@@ -104,0 +103,0 @@ html = await renderToReadableStreamAsync(vnode, renderOptions); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76
21561
440
1