Skip to content

Commit

Permalink
refactor!: remove shamefullyPatchR2Buckets option (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Oct 10, 2024
1 parent 996f57f commit a11461c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 83 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ You can configure additional options using `cloudflareDev: { }` in `nitro.config
- `persistDir`: Sets the persist dir (default `.wrangler/state/v3`).
- `configPath`: Sets a custom path for `wrangler.toml` file.
- `silent`: Hide initial banner.
- `shamefullyPatchR2Buckets`: Add workaround for https://github.com/cloudflare/workers-sdk/issues/5360
- `environment`: Sets specific environment (useful for multi-environment configurations)

## Development
Expand Down
5 changes: 1 addition & 4 deletions examples/nitro/nitro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ import nitroCloudflareBindings from "nitro-cloudflare-dev";

// https://nitro.unjs.io/config
export default defineNitroConfig({
modules: [nitroCloudflareBindings],
cloudflareDev: {
shamefullyPatchR2Buckets: true,
},
modules: [nitroCloudflareBindings]
});
3 changes: 2 additions & 1 deletion examples/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ["nitro-cloudflare-dev"],
});
compatibilityDate: "2024-10-10",
});
19 changes: 8 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ declare module "nitropack" {
environment?: string;
persistDir?: string;
silent?: boolean;
/** workaround for https://github.com/cloudflare/workers-sdk/issues/5360 */
shamefullyPatchR2Buckets?: boolean;
};
}
}
Expand Down Expand Up @@ -71,8 +69,6 @@ async function nitroModule(nitro: Nitro) {
// Share config to the runtime
nitro.options.runtimeConfig.wrangler = {
...nitro.options.runtimeConfig.wrangler,
shamefullyPatchR2Buckets:
nitro.options.cloudflareDev?.shamefullyPatchR2Buckets,
configPath,
persistDir,
environment: nitro.options.cloudflareDev?.environment,
Expand Down
11 changes: 0 additions & 11 deletions src/runtime/plugin.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ async function _getPlatformProxy() {
wrangler: {
configPath: string;
persistDir: string;
shamefullyPatchR2Buckets?: boolean;
environment?: string;
};
} = useRuntimeConfig();
Expand All @@ -78,16 +77,6 @@ async function _getPlatformProxy() {
environment: runtimeConfig.wrangler.environment,
});

if (runtimeConfig.wrangler.shamefullyPatchR2Buckets) {
const { patchR2Bucket } = await import("./r2-patch");
for (const [key, binding] of Object.entries(proxy.env) as [string, any][]) {
if (binding.createMultipartUpload) {
// console.log("Patching R2Bucket", key);
proxy.env[key] = patchR2Bucket(binding);
}
}
}

return proxy;
}

Expand Down
51 changes: 0 additions & 51 deletions src/runtime/r2-patch.ts

This file was deleted.

0 comments on commit a11461c

Please sign in to comment.