From e32fd063c810a65b45466b51f40a8d6b7b8816c1 Mon Sep 17 00:00:00 2001 From: Jason Caldwell Date: Sun, 3 Dec 2023 06:28:42 -0500 Subject: [PATCH] Project update. [p][robotic] --- package-lock.json | 130 +++++++++++++++++++++++----------------------- package.json | 6 +-- src/cfw.ts | 13 +++-- 3 files changed, 77 insertions(+), 72 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7e5fc9c..9bac575 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@clevercanyon/utilities.cfw", - "version": "1.0.123", + "version": "1.0.125", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@clevercanyon/utilities.cfw", - "version": "1.0.123", + "version": "1.0.125", "cpu": [ "x64", "arm64" @@ -17,7 +17,7 @@ "linux" ], "devDependencies": { - "@clevercanyon/dev-deps": "^1.0.285" + "@clevercanyon/dev-deps": "^1.0.287" }, "engines": { "node": "^20.5.0 || ^20.9.0", @@ -27,7 +27,7 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.501", + "@clevercanyon/utilities": "^1.0.503", "@cloudflare/kv-asset-handler": "0.2.0" } }, @@ -836,9 +836,9 @@ "dev": true }, "node_modules/@clevercanyon/dev-deps": { - "version": "1.0.285", - "resolved": "https://registry.npmjs.org/@clevercanyon/dev-deps/-/dev-deps-1.0.285.tgz", - "integrity": "sha512-EnXk9db3TggVNWNWbFwNdyul5V+GNTv7Su2MMl4ymnUrQCVLDrWaUqKuCcD359YUM4JvK8SlxmmjQhI6vcA5vA==", + "version": "1.0.287", + "resolved": "https://registry.npmjs.org/@clevercanyon/dev-deps/-/dev-deps-1.0.287.tgz", + "integrity": "sha512-5Ut5Be4t0msjfX6hA4uQilpfnYKEu65IKCuIYkpdV9QOMxkqHz52l7dbayQITPyM08ADCMeF82mj6mFvQgN2MA==", "cpu": [ "x64", "arm64" @@ -850,10 +850,10 @@ ], "dependencies": { "@clevercanyon/madrun": "^1.0.122", - "@clevercanyon/utilities": "^1.0.496", + "@clevercanyon/utilities": "^1.0.501", "@clevercanyon/utilities.bash": "^1.0.140", - "@clevercanyon/utilities.cfp": "^1.0.111", - "@clevercanyon/utilities.node": "^1.0.130", + "@clevercanyon/utilities.cfp": "^1.0.112", + "@clevercanyon/utilities.node": "^1.0.131", "@cloudflare/workers-types": "4.20231121.0", "@eslint/js": "8.48.0", "@iarna/toml": "2.2.5", @@ -959,9 +959,9 @@ } }, "node_modules/@clevercanyon/madrun": { - "version": "1.0.122", - "resolved": "https://registry.npmjs.org/@clevercanyon/madrun/-/madrun-1.0.122.tgz", - "integrity": "sha512-4SzbzddldtfbyHKsfBjoHtokiG95uIGJkD/HE4OspQk98ytLtfUcZmaSMgDiVcxU8GZg+o3d05b0vNvswsUCgA==", + "version": "1.0.124", + "resolved": "https://registry.npmjs.org/@clevercanyon/madrun/-/madrun-1.0.124.tgz", + "integrity": "sha512-MYx+wXvkWt7T2sepZ+0w1Eo4BqEp/ZH1+dQNdobUV1Fc0C5+H5Tg31cgFW1orc9a8gkbtNppl7aMCezFoLEQdQ==", "cpu": [ "x64", "arm64" @@ -972,8 +972,8 @@ "linux" ], "dependencies": { - "@clevercanyon/utilities": "^1.0.494", - "@clevercanyon/utilities.node": "^1.0.129" + "@clevercanyon/utilities": "^1.0.501", + "@clevercanyon/utilities.node": "^1.0.131" }, "bin": { "madrun": "dist/bin/cli.js" @@ -987,9 +987,9 @@ } }, "node_modules/@clevercanyon/split-cmd.fork": { - "version": "1.0.73", - "resolved": "https://registry.npmjs.org/@clevercanyon/split-cmd.fork/-/split-cmd.fork-1.0.73.tgz", - "integrity": "sha512-35jmSFEcaJZV3D6bo4q7Gwgpo+KF+4B6luxbLHETnD0++dwH3J9RV8aLhdGu7X2ADfwdmqv84h0IEbOsCSagJw==", + "version": "1.0.75", + "resolved": "https://registry.npmjs.org/@clevercanyon/split-cmd.fork/-/split-cmd.fork-1.0.75.tgz", + "integrity": "sha512-T2oQ269xZ17xNWfhKHXlQn5DCqdfj/79antpFumFkipJdJnkCQsMo29nopvrPJinDdbfttoQhvjlJnUKcjzUgA==", "cpu": [ "x64", "arm64" @@ -1009,9 +1009,9 @@ } }, "node_modules/@clevercanyon/utilities": { - "version": "1.0.501", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities/-/utilities-1.0.501.tgz", - "integrity": "sha512-Y/NYa8YYyVM6yoxA6D9DnNYk9R8OrnYOiq70nHd3Nl1ahk3QvdO6YETUPMJGtyYtVZi6TyF53fLtfMrgTX3fgA==", + "version": "1.0.503", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities/-/utilities-1.0.503.tgz", + "integrity": "sha512-hTfxEABAoKpi8TYHexTdgjWV1eP40OFEaRClPdE0sCFUwd+kaUu9omAXKIr3u0NBD67Pmbi2e9qgKC1peCbK4Q==", "cpu": [ "x64", "arm64" @@ -1044,9 +1044,9 @@ } }, "node_modules/@clevercanyon/utilities.bash": { - "version": "1.0.140", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.bash/-/utilities.bash-1.0.140.tgz", - "integrity": "sha512-FJe1fj+PWbi83NU71QgyE9/O3UmOMT2M1vmKSLSSfJ8X5vUcJWsB2/SJCxGIZHxND9RLkQLQht5Ai7ebifDOaQ==", + "version": "1.0.142", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.bash/-/utilities.bash-1.0.142.tgz", + "integrity": "sha512-jqNtzWmH1CmoP9FpwmIyaMICwo3mwAw0pVzcdJS6pePX7er8gnJEoNXKJTMQbbZJX2iQP1KXX9LFMif+i59VYA==", "cpu": [ "x64", "arm64" @@ -1064,14 +1064,14 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.494", - "@clevercanyon/utilities.node": "^1.0.129" + "@clevercanyon/utilities": "^1.0.501", + "@clevercanyon/utilities.node": "^1.0.131" } }, "node_modules/@clevercanyon/utilities.cfp": { - "version": "1.0.112", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfp/-/utilities.cfp-1.0.112.tgz", - "integrity": "sha512-Fql/Z2jGJlhmWyJoeHixHWlX3pMSXdegK4iq2FFP14GHxW/GIJUxWHANI6DlWxFvrEnyO5NcjocnUoSy99A0yA==", + "version": "1.0.114", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfp/-/utilities.cfp-1.0.114.tgz", + "integrity": "sha512-Kd2ly/6WuJO9yIi2l7wdgFeStHgEov3IV6Po4uE5SDWOIzyetAHqMwBbkfvq+5KojL8wOsaKH7KIi7waDZXMRw==", "cpu": [ "x64", "arm64" @@ -1095,9 +1095,9 @@ } }, "node_modules/@clevercanyon/utilities.cfw": { - "version": "1.0.123", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.123.tgz", - "integrity": "sha512-WTmMaTztWy+OBpD42zhELrJszj6zRyEJQc/JWOX9e8O7fk524chDbtp5V9CGN+F4WHCkzLpX3a5chq23lFLKPw==", + "version": "1.0.125", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.cfw/-/utilities.cfw-1.0.125.tgz", + "integrity": "sha512-/IIDR9JyshqHEwd1T2lEFJDzSsisOeQLvQAVxC5M1QNm6imCTFrELW7lR/dt3zaz8rajqVGS6Wn0G9uo59bQDg==", "cpu": [ "x64", "arm64" @@ -1121,9 +1121,9 @@ } }, "node_modules/@clevercanyon/utilities.node": { - "version": "1.0.131", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.node/-/utilities.node-1.0.131.tgz", - "integrity": "sha512-8jLgNA8DIWaheViXI463gEzhZqqmgJCAk6WbTU4xZ2HxRNI/bnNizl8RVmfU4JgL70tLWSVYFgIpAnuKRLDc6g==", + "version": "1.0.133", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.node/-/utilities.node-1.0.133.tgz", + "integrity": "sha512-zOziNYQ3UBv/mUAID0Y/Mn6zSp7UGV+azspF01v9V1MnI2The/9O6JoIcUK/7/BrkaML/qZ1oOx4PLaotSQLrw==", "cpu": [ "x64", "arm64" @@ -1160,9 +1160,9 @@ } }, "node_modules/@clevercanyon/utilities.web": { - "version": "1.0.88", - "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.web/-/utilities.web-1.0.88.tgz", - "integrity": "sha512-abf3AjKahod2iYqY1xz/NcdECYEv5gUUTmjg38OLfuavm6lvKumRCjKYorHA+cjzFwlQtBS0qfJxfHJRJSrKww==", + "version": "1.0.90", + "resolved": "https://registry.npmjs.org/@clevercanyon/utilities.web/-/utilities.web-1.0.90.tgz", + "integrity": "sha512-WFL0VSN5ydilE9cA0qaYS4UJTVPsvVjm/QXT88kO42dACpTQ9jYJe9jz3y0L/Z+1jdDTBXmeDjGQpuNgERI4cg==", "cpu": [ "x64", "arm64" @@ -1181,7 +1181,7 @@ "url": "https://github.com/sponsors/clevercanyon" }, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.494" + "@clevercanyon/utilities": "^1.0.501" } }, "node_modules/@cloudflare/kv-asset-handler": { @@ -7747,9 +7747,9 @@ }, "node_modules/braces": { "name": "@clevercanyon/braces.fork", - "version": "3.0.71", - "resolved": "https://registry.npmjs.org/@clevercanyon/braces.fork/-/braces.fork-3.0.71.tgz", - "integrity": "sha512-Y0y8dOv5JLHy/AnUW/XEt8gQJplmUK0d0W08kjQaQK6Ca0FdjshYTpN51e79GzSg5WrntXqGx4VT9CWGnpHKag==", + "version": "3.0.73", + "resolved": "https://registry.npmjs.org/@clevercanyon/braces.fork/-/braces.fork-3.0.73.tgz", + "integrity": "sha512-YnzhOn/uL8EBN5e6UvlI7zgxMmm0igFAlaXkRPP9LKbHsiX7veKvFTtBEHXlG2N5E3X5VCDhNkdaStYVGnkeaw==", "cpu": [ "x64", "arm64" @@ -7759,7 +7759,7 @@ "linux" ], "dependencies": { - "fill-range": "npm:@clevercanyon/fill-range.fork@^7.0.69" + "fill-range": "npm:@clevercanyon/fill-range.fork@^7.0.70" }, "engines": { "node": "^20.5.0 || ^20.9.0", @@ -12682,9 +12682,9 @@ }, "node_modules/fill-range": { "name": "@clevercanyon/fill-range.fork", - "version": "7.0.70", - "resolved": "https://registry.npmjs.org/@clevercanyon/fill-range.fork/-/fill-range.fork-7.0.70.tgz", - "integrity": "sha512-jJxuUuA6hhNDiGzhvj9uFTHYsPazpCjTw7dAAof1cH4wE3xc6664Lu8aazkgQCTv3gmathzOTNbKPmtdbfcByA==", + "version": "7.0.72", + "resolved": "https://registry.npmjs.org/@clevercanyon/fill-range.fork/-/fill-range.fork-7.0.72.tgz", + "integrity": "sha512-rJqWLyEVt1A5Hwm63YwHVh8+mIzEO0YeoI0a9FQGrUvg5msoenkkIPFbwBwogzhq2GzFkm1APVyiS5mMnTM4sg==", "cpu": [ "x64", "arm64" @@ -12694,7 +12694,7 @@ "linux" ], "dependencies": { - "to-regex-range": "npm:@clevercanyon/to-regex-range.fork@^5.0.69" + "to-regex-range": "npm:@clevercanyon/to-regex-range.fork@^5.0.70" }, "engines": { "node": "^20.5.0 || ^20.9.0", @@ -14274,9 +14274,9 @@ }, "node_modules/is-number": { "name": "@clevercanyon/is-number.fork", - "version": "7.0.73", - "resolved": "https://registry.npmjs.org/@clevercanyon/is-number.fork/-/is-number.fork-7.0.73.tgz", - "integrity": "sha512-dvTcWY2YI5q0TNQ9lTa2ntCmwtF1uKI5KHQV2TK6FhnkUyi29IuZglcwRBzW72Ajj//+TNnZyshrL538Ms6zYA==", + "version": "7.0.75", + "resolved": "https://registry.npmjs.org/@clevercanyon/is-number.fork/-/is-number.fork-7.0.75.tgz", + "integrity": "sha512-7XNOk7miX+E7FCrGZhQ6HQxn8vPjnStQjQKOdWTSdBZN4tUjZX4Uf2v/AHiRE5acAPQA1HR0AhnM84UGhzr+jg==", "cpu": [ "x64", "arm64" @@ -20000,9 +20000,9 @@ }, "node_modules/micromatch": { "name": "@clevercanyon/micromatch.fork", - "version": "4.0.75", - "resolved": "https://registry.npmjs.org/@clevercanyon/micromatch.fork/-/micromatch.fork-4.0.75.tgz", - "integrity": "sha512-+1ge1hDB0bR8ac073CHsTq0Y7781mpPO46+OC5oRqD9uNNz1QhGuYIrC/AzU44xglJsUpJw/DpRe/mokpg1sug==", + "version": "4.0.77", + "resolved": "https://registry.npmjs.org/@clevercanyon/micromatch.fork/-/micromatch.fork-4.0.77.tgz", + "integrity": "sha512-M0s/lHLrSIePFcBdjNqr91btuXTt9LVkA1Rs6YbDTb/ska45Z07MHtUlc0Gc6PCU6eu7dE5cNhcF4LWy+2eueQ==", "cpu": [ "x64", "arm64" @@ -20012,8 +20012,8 @@ "linux" ], "dependencies": { - "braces": "npm:@clevercanyon/braces.fork@^3.0.70", - "picomatch": "npm:@clevercanyon/picomatch.fork@^2.3.69" + "braces": "npm:@clevercanyon/braces.fork@^3.0.71", + "picomatch": "npm:@clevercanyon/picomatch.fork@^2.3.70" }, "engines": { "node": "^20.5.0 || ^20.9.0", @@ -20025,9 +20025,9 @@ }, "node_modules/micromatch/node_modules/picomatch": { "name": "@clevercanyon/picomatch.fork", - "version": "2.3.70", - "resolved": "https://registry.npmjs.org/@clevercanyon/picomatch.fork/-/picomatch.fork-2.3.70.tgz", - "integrity": "sha512-7Oif0cQ3ZSH7O0g/2r60rLDNeM6y3a9EQZEtFCiGuKpkfXU1rQpT79a4fcegWcl9vcw6V8zFggau+Dx9XJ8ImQ==", + "version": "2.3.72", + "resolved": "https://registry.npmjs.org/@clevercanyon/picomatch.fork/-/picomatch.fork-2.3.72.tgz", + "integrity": "sha512-hxuFrzaIhJYFNwV1/Qj1XJpo0lUx6kvPfkJnoHxuteMab+zHERp8DPX56sxck7X1Mv4mxdy08sssgh0UNiu81g==", "cpu": [ "x64", "arm64" @@ -27127,9 +27127,9 @@ }, "node_modules/spawn-please": { "name": "@clevercanyon/spawn-please.fork", - "version": "2.0.67", - "resolved": "https://registry.npmjs.org/@clevercanyon/spawn-please.fork/-/spawn-please.fork-2.0.67.tgz", - "integrity": "sha512-N0SLa0AUMgaxrjSMW0b6SNGuzp/d3Wu0wxO7GwFDDrh8toXQYf8czUXF7LETq3vw6NQcUNcB4REPHC0xO8iesw==", + "version": "2.0.69", + "resolved": "https://registry.npmjs.org/@clevercanyon/spawn-please.fork/-/spawn-please.fork-2.0.69.tgz", + "integrity": "sha512-34CwsIfHmsgtSeErTl491h0Eghkhnzp+IIYLQ9PZuOcT+d4Q+gD1t3f9O9MPM8R8P/6P0yHmPMCCWcHBFC5t7A==", "cpu": [ "x64", "arm64" @@ -28405,9 +28405,9 @@ }, "node_modules/to-regex-range": { "name": "@clevercanyon/to-regex-range.fork", - "version": "5.0.70", - "resolved": "https://registry.npmjs.org/@clevercanyon/to-regex-range.fork/-/to-regex-range.fork-5.0.70.tgz", - "integrity": "sha512-yp6JToRvjkDo6ZF2/YCRMjmOD0H45AWSC21Y4ffJSJBCQDvh89O8eWdepzViK8wU6NK5PJoR63VDYRPxfdAJ0Q==", + "version": "5.0.72", + "resolved": "https://registry.npmjs.org/@clevercanyon/to-regex-range.fork/-/to-regex-range.fork-5.0.72.tgz", + "integrity": "sha512-lMZ1sxlh0yYnsqZM+/Ph3Kr0/dZqaDrHoFUU2yxHthofciSQCx1DsDZHvW5ySxykrmrM+M1ICZvDxN/oi12jhw==", "cpu": [ "x64", "arm64" @@ -28417,7 +28417,7 @@ "linux" ], "dependencies": { - "is-number": "npm:@clevercanyon/is-number.fork@^7.0.72" + "is-number": "npm:@clevercanyon/is-number.fork@^7.0.73" }, "engines": { "node": "^20.5.0 || ^20.9.0", diff --git a/package.json b/package.json index 195bb55..26b07ce 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "1.0.125", + "version": "1.0.126", "license": "GPL-3.0-or-later", "name": "@clevercanyon/utilities.cfw", "description": "Utilities for JavaScript apps running in a Cloudflare Worker environment.", @@ -54,14 +54,14 @@ }, "dependencies": {}, "peerDependencies": { - "@clevercanyon/utilities": "^1.0.501", + "@clevercanyon/utilities": "^1.0.503", "@cloudflare/kv-asset-handler": "0.2.0" }, "peerDependenciesMeta": {}, "optionalDependencies": {}, "bundleDependencies": [], "devDependencies": { - "@clevercanyon/dev-deps": "^1.0.285" + "@clevercanyon/dev-deps": "^1.0.287" }, "overrides": {}, "cpu": ["x64", "arm64"], diff --git a/src/cfw.ts b/src/cfw.ts index c46f0b2..ad76634 100644 --- a/src/cfw.ts +++ b/src/cfw.ts @@ -104,10 +104,15 @@ export const handleFetchCache = async (route: Route, feData: FetchEventData): Pr } const response = await route(feData); - if ('GET' === request.method && 206 !== response.status && '*' !== response.headers.get('vary')) { - // Cloudflare will not actually cache if response headers say not to cache. - // For further details regarding `cache.put()`; {@see https://o5p.me/gMv7W2}. - ctx.waitUntil(cache.put(request, response.clone())); + if ('GET' === request.method && 206 !== response.status && '*' !== response.headers.get('vary') && !response.webSocket) { + if ($env.isCFWViaMiniflare() && 'no-store' === response.headers.get('cdn-cache-control')) { + // Miniflare doesn’t currently support `cdn-cache-control`, so we implement basic support for it here. + response.headers.set('cf-cache-status', 'miniflare.cdn-cache-control.BYPASS'); + } else { + // Cloudflare will not actually cache if response headers say not to cache. + // For further details regarding `cache.put()`; {@see https://o5p.me/gMv7W2}. + ctx.waitUntil(cache.put(request, response.clone())); + } } return response; };