rwsdk 0.1.30 → 0.1.32

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.
@@ -1,5 +1,5 @@
1
1
  export declare const defineScript: (fn: ({ env }: {
2
- env: Cloudflare.Env;
2
+ env: Env;
3
3
  }) => Promise<unknown>) => {
4
4
  fetch: (request: Request, env: Env, cf: ExecutionContext) => Promise<Response>;
5
5
  };
@@ -3,7 +3,7 @@ import { env } from "cloudflare:workers";
3
3
  export const defineScript = (fn) => {
4
4
  const app = defineApp([
5
5
  async () => {
6
- await fn({ env });
6
+ await fn({ env: env });
7
7
  return new Response("Done!");
8
8
  },
9
9
  ]);
@@ -109,19 +109,19 @@ export const miniflareHMRPlugin = (givenOptions) => [
109
109
  let clientDirectiveChanged = false;
110
110
  let serverDirectiveChanged = false;
111
111
  if (!clientFiles.has(ctx.file) && hasClientDirective) {
112
- clientFiles.add(ctx.file);
112
+ clientFiles.add(normalizeModulePath(ctx.file, givenOptions.rootDir));
113
113
  clientDirectiveChanged = true;
114
114
  }
115
115
  else if (clientFiles.has(ctx.file) && !hasClientDirective) {
116
- clientFiles.delete(ctx.file);
116
+ clientFiles.delete(normalizeModulePath(ctx.file, givenOptions.rootDir));
117
117
  clientDirectiveChanged = true;
118
118
  }
119
119
  if (!serverFiles.has(ctx.file) && hasServerDirective) {
120
- serverFiles.add(ctx.file);
120
+ serverFiles.add(normalizeModulePath(ctx.file, givenOptions.rootDir));
121
121
  serverDirectiveChanged = true;
122
122
  }
123
123
  else if (serverFiles.has(ctx.file) && !hasServerDirective) {
124
- serverFiles.delete(ctx.file);
124
+ serverFiles.delete(normalizeModulePath(ctx.file, givenOptions.rootDir));
125
125
  serverDirectiveChanged = true;
126
126
  }
127
127
  if (clientDirectiveChanged) {
@@ -129,12 +129,14 @@ export const miniflareHMRPlugin = (givenOptions) => [
129
129
  invalidateModule(ctx.server, environment, "virtual:use-client-lookup.js");
130
130
  });
131
131
  invalidateModule(ctx.server, environment, VIRTUAL_SSR_PREFIX + "/@id/virtual:use-client-lookup.js");
132
+ invalidateModule(ctx.server, environment, VIRTUAL_SSR_PREFIX + "virtual:use-client-lookup.js");
132
133
  }
133
134
  if (serverDirectiveChanged) {
134
135
  ["client", "ssr", environment].forEach((environment) => {
135
136
  invalidateModule(ctx.server, environment, "virtual:use-server-lookup.js");
136
137
  });
137
138
  invalidateModule(ctx.server, environment, VIRTUAL_SSR_PREFIX + "/@id/virtual:use-server-lookup.js");
139
+ invalidateModule(ctx.server, environment, VIRTUAL_SSR_PREFIX + "virtual:use-server-lookup.js");
138
140
  }
139
141
  // todo(justinvdm, 12 Dec 2024): Skip client references
140
142
  const modules = Array.from(ctx.server.environments[environment].moduleGraph.getModulesByFile(ctx.file) ?? []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {