
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
speedcf-libs
Advanced tools
collection of optimization done in Cloudflare Workers
Edge side includes, Google font optimizations, h2 default priorities, 3rd party rewrite and serve stale-while-revalidate in a worker:
// overrides URL constructor:
// to encode % so Worker's URL parser won't throw
import "@cloudflare/patch-workers-url";
import { EdgeSideIncludesOptimization } from "@cloudflare/edge-side-includes";
import { GoogleFontOptimization } from "@cloudflare/google-fast-fonts";
import { Rewrite3rdPartyOptimization } from "@cloudflare/rewrite-3rd-party";
import { h2DefaultPrioritiesOptimization } from "@cloudflare/h2-default-priorities";
import { StaleWhileRevalidateOptimization } from "@cloudflare/stale-while-revalidate";
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event));
});
async function handleRequest(event) {
const request = event.request;
const esi = new EdgeSideIncludesOptimization(request);
const fonts = new GoogleFontOptimization(request);
const thirdParty = new Rewrite3rdPartyOptimization(request);
const h2Prio = new h2DefaultPrioritiesOptimization(request);
const swr = new StaleWhileRevalidateOptimization(request);
if (fonts.isGoogleFontRequest()) {
return fonts.serveGoogleFont();
}
if (thirdParty.isProxiedScriptRequest()) {
return thirdParty.proxyScriptRequest();
}
let res = await swr.fetchWithCache(event);
res = h2Prio.withPriority(res);
return transform(request, { thirdParty, esi, fonts }, res);
}
function transform(request, { thirdParty, esi, fonts }, response) {
const rewriter = thirdParty.withThirdPartyTransform(
fonts.withGoogleFontsTransform(
response,
esi.withESITransform(new HTMLRewriter())
)
);
return rewriter.transform(response);
}
yarn
yarn bootstrap
yarn test
FAQs
> collection of optimization done in Cloudflare Workers
We found that speedcf-libs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.