@sveltejs/adapter-netlify
Advanced tools
Comparing version 3.0.2 to 4.0.0
import './shims.js'; | ||
import { Server } from '0SERVER'; | ||
import { createReadStream } from 'node:fs'; | ||
import { Readable } from 'node:stream'; | ||
import 'node:buffer'; | ||
@@ -264,2 +266,12 @@ import 'node:crypto'; | ||
/** | ||
* Converts a file on disk to a readable stream | ||
* @param {string} file | ||
* @returns {ReadableStream} | ||
* @since 2.4.0 | ||
*/ | ||
function createReadableStream(file) { | ||
return /** @type {ReadableStream} */ (Readable.toWeb(createReadStream(file))); | ||
} | ||
/** | ||
* @param {import('@sveltejs/kit').SSRManifest} manifest | ||
@@ -272,3 +284,4 @@ * @returns {import('@netlify/functions').Handler} | ||
let init_promise = server.init({ | ||
env: process.env | ||
env: process.env, | ||
read: (file) => createReadableStream(`.netlify/server/${file}`) | ||
}); | ||
@@ -275,0 +288,0 @@ |
16
index.js
@@ -30,2 +30,3 @@ import { appendFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; | ||
const name = '@sveltejs/adapter-netlify'; | ||
const files = fileURLToPath(new URL('./files', import.meta.url).href); | ||
@@ -42,3 +43,3 @@ | ||
return { | ||
name: '@sveltejs/adapter-netlify', | ||
name, | ||
@@ -97,2 +98,15 @@ async adapt(builder) { | ||
} | ||
}, | ||
supports: { | ||
// reading from the filesystem only works in serverless functions | ||
read: ({ route }) => { | ||
if (edge) { | ||
throw new Error( | ||
`${name}: Cannot use \`read\` from \`$app/server\` in route \`${route.id}\` when using edge functions` | ||
); | ||
} | ||
return true; | ||
} | ||
} | ||
@@ -99,0 +113,0 @@ }; |
{ | ||
"name": "@sveltejs/adapter-netlify", | ||
"version": "3.0.2", | ||
"version": "4.0.0", | ||
"description": "A SvelteKit adapter that creates a Netlify app", | ||
@@ -42,6 +42,6 @@ "repository": { | ||
"vitest": "^1.2.0", | ||
"@sveltejs/kit": "^2.3.3" | ||
"@sveltejs/kit": "^2.4.0" | ||
}, | ||
"peerDependencies": { | ||
"@sveltejs/kit": "^2.0.0" | ||
"@sveltejs/kit": "^2.4.0" | ||
}, | ||
@@ -48,0 +48,0 @@ "scripts": { |
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
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
25177
681