Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@astrojs/react

Package Overview
Dependencies
Maintainers
3
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/react - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

dist/version.d.ts

2

dist/index.d.ts

@@ -6,3 +6,3 @@ import { type Options as ViteReactPluginOptions } from '@vitejs/plugin-react';

};
export default function ({ include, exclude, babel, experimentalReactChildren, }?: ReactIntegrationOptions): AstroIntegration;
export declare function getContainerRenderer(): ContainerRenderer;
export default function ({ include, exclude, babel, experimentalReactChildren, }?: ReactIntegrationOptions): AstroIntegration;
import react, {} from "@vitejs/plugin-react";
import { version as ReactVersion } from "react-dom";
import {
getReactMajorVersion,
isUnsupportedVersion,
versionsConfig
} from "./version.js";
const FAST_REFRESH_PREAMBLE = react.preambleCode;
const versionsConfig = {
17: {
server: "@astrojs/react/server-v17.js",
client: "@astrojs/react/client-v17.js",
externals: ["react-dom/server.js", "react-dom/client.js"]
},
18: {
server: "@astrojs/react/server.js",
client: "@astrojs/react/client.js",
externals: ["react-dom/server", "react-dom/client"]
},
19: {
server: "@astrojs/react/server.js",
client: "@astrojs/react/client.js",
externals: ["react-dom/server", "react-dom/client"]
}
};
function getReactMajorVersion() {
const matches = /\d+\./.exec(ReactVersion);
if (!matches) {
return NaN;
}
return Number(matches[0]);
}
function isUnsupportedVersion(majorVersion) {
return majorVersion < 17 || majorVersion > 19 || Number.isNaN(majorVersion);
}
function getRenderer(reactConfig) {

@@ -38,13 +15,2 @@ return {

}
function getContainerRenderer() {
const majorVersion = getReactMajorVersion();
if (isUnsupportedVersion(majorVersion)) {
throw new Error(`Unsupported React version: ${majorVersion}.`);
}
const versionConfig = versionsConfig[majorVersion];
return {
name: "@astrojs/react",
serverEntrypoint: versionConfig.server
};
}
function optionsPlugin(experimentalReactChildren) {

@@ -130,2 +96,13 @@ const virtualModule = "astro:react:opts";

}
function getContainerRenderer() {
const majorVersion = getReactMajorVersion();
if (isUnsupportedVersion(majorVersion)) {
throw new Error(`Unsupported React version: ${majorVersion}.`);
}
const versionConfig = versionsConfig[majorVersion];
return {
name: "@astrojs/react",
serverEntrypoint: versionConfig.server
};
}
export {

@@ -132,0 +109,0 @@ src_default as default,

{
"name": "@astrojs/react",
"description": "Use React components within Astro",
"version": "3.5.0",
"version": "3.6.0",
"type": "module",

@@ -27,4 +27,10 @@ "types": "./dist/index.d.ts",

"./client-v17.js": "./client-v17.js",
"./server.js": "./server.js",
"./server-v17.js": "./server-v17.js",
"./server.js": {
"default": "./server.js",
"types": "./server.d.ts"
},
"./server-v17.js": {
"default": "./server-v17.js",
"types": "./server-v17.d.ts"
},
"./package.json": "./package.json",

@@ -40,3 +46,5 @@ "./jsx-runtime": "./jsx-runtime.js"

"server.js",
"server.d.ts",
"server-v17.js",
"server-v17.d.ts",
"static-html.js",

@@ -46,3 +54,3 @@ "vnode-children.js"

"dependencies": {
"@vitejs/plugin-react": "^4.3.0",
"@vitejs/plugin-react": "^4.3.1",
"ultrahtml": "^1.5.3"

@@ -56,4 +64,4 @@ },

"react-dom": "^18.3.1",
"vite": "^5.2.12",
"astro": "4.10.0",
"vite": "^5.3.1",
"astro": "4.10.3",
"astro-scripts": "0.0.14"

@@ -60,0 +68,0 @@ },

@@ -85,2 +85,3 @@ import React from 'react';

export default {
name: '@astrojs/react',
check,

@@ -87,0 +88,0 @@ renderToStaticMarkup,

@@ -229,2 +229,3 @@ import opts from 'astro:react:opts';

export default {
name: '@astrojs/react',
check,

@@ -231,0 +232,0 @@ renderToStaticMarkup,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc