rwsdk 0.1.6-test.20250702132719 → 0.1.6-test.20250702140059

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.
@@ -101,14 +101,11 @@ export class RealtimeDurableObject extends DurableObject {
101
101
  }
102
102
  }
103
103
  async handleAction(ws, id, args, clientInfo, requestId, clientUrl) {
104
- const url = new URL(clientInfo.url);
105
- url.searchParams.set("__rsc", "true");
106
- url.searchParams.set("__rsc_action_id", id);
107
- //const url = new URL(clientUrl);
108
- //url.searchParams.set("__rsc", "");
109
- //if (id != null) {
110
- // url.searchParams.set("__rsc_action_id", id);
111
- //}
104
+ const url = new URL(clientUrl);
105
+ url.searchParams.set("__rsc", "");
106
+ if (id != null) {
107
+ url.searchParams.set("__rsc_action_id", id);
108
+ }
112
109
  const response = await fetch(url.toString(), {
113
110
  method: "POST",
114
111
  body: args,
@@ -1,5 +1,6 @@
1
1
  export interface DebugSyncOptions {
2
2
  targetDir: string;
3
+ sdkDir?: string;
3
4
  dev?: boolean;
4
5
  watch?: boolean;
5
6
  build?: boolean;
@@ -1,11 +1,14 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
1
3
  import { $ } from "../lib/$.mjs";
4
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
2
5
  export const debugSync = async (opts) => {
3
- const { targetDir, dev, watch, build } = opts;
6
+ const { targetDir, sdkDir = process.cwd(), dev, watch, build } = opts;
4
7
  if (!targetDir) {
5
8
  console.error("❌ Please provide a target directory as an argument.");
6
9
  process.exit(1);
7
10
  }
8
- const syncCommand = `echo 🏗️ rebuilding... && pnpm build && rm -rf ${targetDir}/node_modules/rwsdk/dist ${targetDir}/node_modules/rwsdk/package.json && echo 📁 syncing sdk from ${process.cwd()} to ${targetDir}/node_modules/rwsdk/... && cp -r package.json dist ${targetDir}/node_modules/rwsdk/ && echo ✅ done syncing`;
11
+ const syncCommand = `echo 🏗️ rebuilding... && pnpm build && rm -rf ${targetDir}/node_modules/rwsdk/dist ${targetDir}/node_modules/rwsdk/package.json && echo 📁 syncing sdk from ${sdkDir} to ${targetDir}/node_modules/rwsdk/... && cp -r package.json dist ${targetDir}/node_modules/rwsdk/ && echo ✅ done syncing`;
9
12
  // Run initial sync
10
13
  await $({ stdio: "inherit", shell: true }) `${syncCommand}`;
11
14
  if (!process.env.NO_CLEAN_VITE) {
@@ -40,10 +43,13 @@ export const debugSync = async (opts) => {
40
43
  };
41
44
  if (import.meta.url === new URL(process.argv[1], import.meta.url).href) {
42
45
  const args = process.argv.slice(2);
43
- const targetDir = args[0];
46
+ const targetDir = args[0] ?? ".";
44
47
  const flags = new Set(args.slice(1));
45
48
  debugSync({
46
49
  targetDir,
50
+ sdkDir: process.env.SDK_REPO
51
+ ? path.resolve(__dirname, process.env.SDK_REPO, "sdk")
52
+ : path.resolve(__dirname, "..", ".."),
47
53
  dev: flags.has("--dev"),
48
54
  watch: flags.has("--watch"),
49
55
  build: flags.has("--build"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "0.1.6-test.20250702132719",
3
+ "version": "0.1.6-test.20250702140059",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {