Socket
Socket
Sign inDemoInstall

@sveltejs/adapter-cloudflare

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/adapter-cloudflare - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

37

files/worker.js

@@ -5,16 +5,18 @@ // src/worker.js

// ../../node_modules/.pnpm/worktop@0.8.0-next.14/node_modules/worktop/cache/index.mjs
// ../../node_modules/.pnpm/worktop@0.8.0-next.15/node_modules/worktop/cache/index.mjs
async function e(e3, t2) {
let n2 = "string" != typeof t2 && "HEAD" === t2.method;
n2 && (t2 = new Request(t2, { method: "GET" }));
let a2 = await e3.match(t2);
return n2 && a2 && (a2 = new Response(null, a2)), a2;
let r3 = await e3.match(t2);
return n2 && r3 && (r3 = new Response(null, r3)), r3;
}
function t(e3, t2, n2, o2) {
return ("string" == typeof t2 || "GET" === t2.method) && a(n2) && (n2.headers.has("Set-Cookie") && (n2 = new Response(n2.body, n2)).headers.append("Cache-Control", "private=Set-Cookie"), o2.waitUntil(e3.put(t2, n2.clone()))), n2;
return ("string" == typeof t2 || "GET" === t2.method) && r(n2) && (n2.headers.has("Set-Cookie") && (n2 = new Response(n2.body, n2)).headers.append("Cache-Control", "private=Set-Cookie"), o2.waitUntil(e3.put(t2, n2.clone()))), n2;
}
var n = /* @__PURE__ */ new Set([200, 203, 204, 300, 301, 404, 405, 410, 414, 501]);
function a(e3) {
if (!n.has(e3.status) || ~(e3.headers.get("Vary") || "").indexOf("*"))
function r(e3) {
if (!n.has(e3.status))
return false;
if (~(e3.headers.get("Vary") || "").indexOf("*"))
return false;
let t2 = e3.headers.get("Cache-Control") || "";

@@ -24,8 +26,8 @@ return !/(private|no-cache|no-store)/i.test(t2);

function o(n2) {
return async function(a2, o2) {
let r2 = await e(n2, a2);
if (r2)
return r2;
return async function(r3, o2) {
let a = await e(n2, r3);
if (a)
return a;
o2.defer((e3) => {
t(n2, a2, e3, o2);
t(n2, r3, e3, o2);
});

@@ -35,7 +37,7 @@ };

// ../../node_modules/.pnpm/worktop@0.8.0-next.14/node_modules/worktop/cfw.cache/index.mjs
// ../../node_modules/.pnpm/worktop@0.8.0-next.15/node_modules/worktop/cfw.cache/index.mjs
var s = caches.default;
var e2 = t.bind(0, s);
var c = e.bind(0, s);
var r = o.bind(0, s);
var c = t.bind(0, s);
var r2 = e.bind(0, s);
var e2 = o.bind(0, s);

@@ -48,3 +50,3 @@ // src/worker.js

let pragma = req.headers.get("cache-control") || "";
let res = !pragma.includes("no-cache") && await c(req);
let res = !pragma.includes("no-cache") && await r2(req);
if (res)

@@ -75,2 +77,3 @@ return res;

res = await server.respond(req, {
// @ts-ignore
platform: { env, context, caches },

@@ -83,3 +86,3 @@ getClientAddress() {

pragma = res.headers.get("cache-control");
return pragma && res.ok ? e2(req, res, context) : res;
return pragma && res.ok ? c(req, res, context) : res;
}

@@ -86,0 +89,0 @@ };

{
"name": "@sveltejs/adapter-cloudflare",
"version": "2.2.0",
"version": "2.2.1",
"description": "Adapter for building SvelteKit applications on Cloudflare Pages with Workers integration",
"repository": {

@@ -27,5 +28,5 @@ "type": "git",

"dependencies": {
"@cloudflare/workers-types": "^4.20221111.1",
"esbuild": "^0.16.3",
"worktop": "0.8.0-next.14"
"@cloudflare/workers-types": "^4.20230404.0",
"esbuild": "^0.17.18",
"worktop": "0.8.0-next.15"
},

@@ -32,0 +33,0 @@ "devDependencies": {

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