@bino0216/nitro-cloudflare-dev 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,23 +48,29 @@ async function _getPlatformProxy() {
48
48
  }
49
49
  const proxy = await getPlatformProxy(proxyOptions);
50
50
  if (remoteBindings.length > 0 && remoteCredentials.accountId && remoteCredentials.apiToken) {
51
- const { getBindings } = await import("openwrangler");
52
- const openBindings = getBindings({
51
+ const { createR2Binding, createKVBinding, createD1Binding } = await import("openwrangler");
52
+ const bindingsConfig = {
53
53
  accountId: remoteCredentials.accountId,
54
54
  apiToken: remoteCredentials.apiToken
55
- });
55
+ };
56
56
  for (const binding of remoteBindings) {
57
57
  switch (binding.type) {
58
58
  case "r2": {
59
- proxy.env[binding.name] = openBindings.r2;
59
+ if (binding.bucketName) {
60
+ proxy.env[binding.name] = createR2Binding(bindingsConfig, binding.bucketName);
61
+ }
60
62
  break;
61
63
  }
62
64
  case "kv": {
63
- proxy.env[binding.name] = openBindings.kv;
65
+ if (binding.namespaceId) {
66
+ proxy.env[binding.name] = createKVBinding(bindingsConfig, binding.namespaceId);
67
+ }
64
68
  break;
65
69
  }
66
70
  case "d1": {
67
- proxy.env[binding.name] = openBindings.d1;
71
+ if (binding.databaseId) {
72
+ proxy.env[binding.name] = createD1Binding(bindingsConfig, binding.databaseId);
73
+ }
68
74
  break;
69
75
  }
70
76
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bino0216/nitro-cloudflare-dev",
3
3
  "private": false,
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "description": "POC module to enable access to the Cloudflare runtime bindings in development server of Nitro and Nuxt",
6
6
  "repository": "pi0/nitro-cloudflare-dev",
7
7
  "license": "MIT",