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

@astrojs/node

Package Overview
Dependencies
Maintainers
3
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/node - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0

2

dist/nodeMiddleware.d.ts
import type { NodeApp } from 'astro/app/node';
import type { IncomingMessage, ServerResponse } from 'http';
import type { Options } from './types';
export default function (app: NodeApp, mode: Options['mode']): (req: IncomingMessage, res: ServerResponse, next?: ((err?: unknown) => void) | undefined) => Promise<void>;
export default function (app: NodeApp, mode: Options['mode']): (req: IncomingMessage, res: ServerResponse, next?: ((err?: unknown) => void) | undefined, locals?: object) => Promise<void>;
import { createOutgoingHttpHeaders } from "./createOutgoingHttpHeaders";
import { responseIterator } from "./response-iterator";
function nodeMiddleware_default(app, mode) {
return async function(req, res, next) {
return async function(req, res, next, locals) {
try {

@@ -9,3 +9,3 @@ const route = mode === "standalone" ? app.match(req, { matchNotFound: true }) : app.match(req);

try {
const response = await app.render(req);
const response = await app.render(req, route, locals);
await writeWebResponse(app, res, response);

@@ -12,0 +12,0 @@ } catch (err) {

@@ -6,3 +6,3 @@ /// <reference types="node" />

export declare function createExports(manifest: SSRManifest, options: Options): {
handler: (req: import("http").IncomingMessage, res: import("http").ServerResponse<import("http").IncomingMessage>, next?: ((err?: unknown) => void) | undefined) => Promise<void>;
handler: (req: import("http").IncomingMessage, res: import("http").ServerResponse<import("http").IncomingMessage>, next?: ((err?: unknown) => void) | undefined, locals?: object | undefined) => Promise<void>;
startServer: () => {

@@ -9,0 +9,0 @@ server: {

{
"name": "@astrojs/node",
"description": "Deploy your site to a Node.js server",
"version": "5.2.0",
"version": "5.3.0",
"type": "module",

@@ -35,14 +35,14 @@ "types": "./dist/index.d.ts",

"peerDependencies": {
"astro": "^2.6.0"
"astro": "^2.7.0"
},
"devDependencies": {
"@types/node": "^18.7.21",
"@types/node": "^18.16.18",
"@types/send": "^0.17.1",
"@types/server-destroy": "^1.0.1",
"chai": "^4.3.6",
"cheerio": "^1.0.0-rc.11",
"chai": "^4.3.7",
"cheerio": "1.0.0-rc.12",
"mocha": "^9.2.2",
"node-mocks-http": "^1.11.0",
"undici": "^5.22.0",
"astro": "2.6.0",
"node-mocks-http": "^1.12.2",
"undici": "^5.22.1",
"astro": "2.7.0",
"astro-scripts": "0.0.14"

@@ -49,0 +49,0 @@ },

@@ -95,3 +95,6 @@ # @astrojs/node

const app = express();
app.use(express.static('dist/client/'))
// Change this based on your astro.config.mjs, `base` option.
// They should match. The default value is "/".
const base = "/";
app.use(base, express.static('dist/client/'))
app.use(ssrHandler);

@@ -123,2 +126,21 @@

Additionally, you can also pass in an object to be accessed with `Astro.locals` or in Astro middleware:
```js
import express from 'express';
import { handler as ssrHandler } from './dist/server/entry.mjs';
const app = express();
app.use(express.static('dist/client/'))
app.use((req, res, next) => {
const locals = {
title: 'New title'
};
ssrHandler(req, res, next, locals);
);
app.listen(8080);
```
Note that middleware mode does not do file serving. You'll need to configure your HTTP framework to do that for you. By default the client assets are written to `./dist/client/`.

@@ -125,0 +147,0 @@

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