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

@sveltejs/adapter-netlify

Package Overview
Dependencies
Maintainers
4
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/adapter-netlify - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

1

files/esm/serverless.js
import './shims.js';
import { Server } from '0SERVER';
import 'node:stream/web';
import 'node:buffer';
import 'node:crypto';

@@ -5,0 +6,0 @@ import 'assert';

72

index.js

@@ -1,9 +0,2 @@

import {
appendFileSync,
existsSync,
readFileSync,
writeFileSync,
unlinkSync,
createReadStream
} from 'fs';
import { appendFileSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'fs';
import { dirname, join, resolve, posix } from 'path';

@@ -13,3 +6,2 @@ import { fileURLToPath } from 'url';

import toml from '@iarna/toml';
import { createInterface } from 'readline';

@@ -45,2 +37,4 @@ /**

const FUNCTION_PREFIX = 'sveltekit-';
/** @type {import('.').default} */

@@ -64,36 +58,2 @@ export default function ({ split = false, edge = edge_set_in_env_var } = {}) {

const redirects_file_path = join(publish, '_redirects');
// If redirects file exists - empty any netlify generated files in functions-internal
// Without removing other files that may have been auto generated by integrations
if (existsSync(redirects_file_path)) {
// Read each line of the file
const fileStream = createReadStream(redirects_file_path);
const rl = createInterface({
input: fileStream,
crlfDelay: Infinity
});
// Create an array of lines
const lines = [];
for await (const line of rl) {
lines.push(line);
}
const functions_internal = join('.netlify', 'functions-internal');
// Loop through redirects, and delete corresponding functions-internal files
lines.forEach((line) => {
if (line) {
// example line /.netlify/functions/{function_name} 200
const path = line.split(' ')[1];
const function_name = path.split('/').pop();
const mjsFile = join(functions_internal, `${function_name}.mjs`);
const jsonFile = join(functions_internal, `${function_name}.json`);
if (existsSync(mjsFile)) unlinkSync(mjsFile);
if (existsSync(jsonFile)) unlinkSync(jsonFile);
}
});
}
// empty out existing build directories

@@ -106,2 +66,10 @@ builder.rimraf(publish);

if (existsSync('.netlify/functions-internal')) {
for (const file of readdirSync('.netlify/functions-internal')) {
if (file.startsWith(FUNCTION_PREFIX)) {
builder.rimraf(join('.netlify/functions-internal', file));
}
}
}
builder.log.minor(`Publishing to "${publish}"`);

@@ -202,3 +170,3 @@

async function generate_lambda_functions({ builder, publish, split }) {
builder.mkdirp('.netlify/functions-internal');
builder.mkdirp('.netlify/functions-internal/.svelte-kit');

@@ -244,3 +212,4 @@ /** @type {string[]} */

const pattern = `/${parts.join('/')}`;
const name = parts.join('-').replace(/[:.]/g, '_').replace('*', '__rest') || 'index';
const name =
FUNCTION_PREFIX + (parts.join('-').replace(/[:.]/g, '_').replace('*', '__rest') || 'index');

@@ -253,6 +222,7 @@ // skip routes with identical patterns, they were already folded into another function

for (let j = i + 1; j < builder.routes.length; j += 1) {
if (routes[j].prerender === true) continue;
const other = builder.routes[j];
if (other.prerender === true) continue;
if (matches(route.segments, routes[j].segments)) {
routes.push(builder.routes[j]);
if (matches(route.segments, other.segments)) {
routes.push(other);
}

@@ -281,5 +251,5 @@ }

writeFileSync(`.netlify/functions-internal/render.json`, fn_config);
writeFileSync('.netlify/functions-internal/render.mjs', fn);
redirects.push('* /.netlify/functions/render 200');
writeFileSync(`.netlify/functions-internal/${FUNCTION_PREFIX}render.json`, fn_config);
writeFileSync(`.netlify/functions-internal/${FUNCTION_PREFIX}render.mjs`, fn);
redirects.push(`* /.netlify/functions/${FUNCTION_PREFIX}render 200`);
}

@@ -286,0 +256,0 @@

{
"name": "@sveltejs/adapter-netlify",
"version": "2.0.2",
"version": "2.0.3",
"repository": {

@@ -41,3 +41,3 @@ "type": "git",

"uvu": "^0.5.6",
"@sveltejs/kit": "^1.5.1"
"@sveltejs/kit": "^1.5.3"
},

@@ -44,0 +44,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

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