rwsdk 0.2.0-alpha.8 → 0.2.0

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.
Files changed (48) hide show
  1. package/dist/runtime/client/client.d.ts +10 -0
  2. package/dist/runtime/{client.js → client/client.js} +13 -10
  3. package/dist/runtime/client/navigation.d.ts +9 -0
  4. package/dist/runtime/client/navigation.js +88 -0
  5. package/dist/runtime/{clientNavigation.test.js → client/navigation.test.js} +1 -1
  6. package/dist/runtime/client/setWebpackRequire.d.ts +1 -0
  7. package/dist/runtime/client/setWebpackRequire.js +2 -0
  8. package/dist/runtime/{client.d.ts → client/types.d.ts} +4 -10
  9. package/dist/runtime/client/types.js +1 -0
  10. package/dist/runtime/entries/client.d.ts +2 -2
  11. package/dist/runtime/entries/client.js +2 -2
  12. package/dist/runtime/imports/client.d.ts +3 -3
  13. package/dist/runtime/imports/client.js +7 -6
  14. package/dist/runtime/imports/ssr.d.ts +3 -3
  15. package/dist/runtime/imports/ssr.js +3 -3
  16. package/dist/runtime/imports/worker.d.ts +3 -3
  17. package/dist/runtime/imports/worker.js +3 -3
  18. package/dist/runtime/lib/manifest.d.ts +11 -2
  19. package/dist/runtime/lib/manifest.js +1 -1
  20. package/dist/runtime/lib/memoizeOnId.d.ts +1 -0
  21. package/dist/runtime/lib/memoizeOnId.js +11 -0
  22. package/dist/runtime/lib/realtime/client.d.ts +1 -1
  23. package/dist/runtime/lib/realtime/client.js +1 -1
  24. package/dist/runtime/lib/router.d.ts +3 -3
  25. package/dist/runtime/lib/router.js +77 -33
  26. package/dist/runtime/register/ssr.d.ts +1 -1
  27. package/dist/runtime/register/ssr.js +2 -2
  28. package/dist/runtime/render/preloads.d.ts +6 -0
  29. package/dist/runtime/render/preloads.js +40 -0
  30. package/dist/runtime/render/renderRscThenableToHtmlStream.js +2 -1
  31. package/dist/runtime/render/stylesheets.js +1 -1
  32. package/dist/runtime/requestInfo/types.d.ts +3 -1
  33. package/dist/runtime/worker.js +1 -1
  34. package/dist/scripts/debug-sync.mjs +159 -33
  35. package/dist/scripts/worker-run.mjs +8 -3
  36. package/dist/vite/hasOwnReactVitePlugin.d.mts +3 -0
  37. package/dist/vite/hasOwnReactVitePlugin.mjs +14 -0
  38. package/dist/vite/miniflareHMRPlugin.mjs +17 -2
  39. package/dist/vite/reactConditionsResolverPlugin.d.mts +3 -4
  40. package/dist/vite/reactConditionsResolverPlugin.mjs +71 -48
  41. package/dist/vite/redwoodPlugin.d.mts +1 -0
  42. package/dist/vite/redwoodPlugin.mjs +9 -3
  43. package/dist/vite/transformJsxScriptTagsPlugin.mjs +106 -91
  44. package/dist/vite/transformJsxScriptTagsPlugin.test.mjs +341 -110
  45. package/package.json +22 -4
  46. /package/dist/runtime/{imports → client}/ClientOnly.d.ts +0 -0
  47. /package/dist/runtime/{imports → client}/ClientOnly.js +0 -0
  48. /package/dist/runtime/{clientNavigation.test.d.ts → client/navigation.test.d.ts} +0 -0
@@ -1,5 +1,10 @@
1
1
  import { describe, it, expect } from "vitest";
2
2
  import { transformJsxScriptTagsCode } from "./transformJsxScriptTagsPlugin.mjs";
3
+ import jsBeautify from "js-beautify";
4
+ // Helper function to normalize code formatting for test comparisons
5
+ function normalizeCode(code) {
6
+ return jsBeautify(code, { indent_size: 2 });
7
+ }
3
8
  describe("transformJsxScriptTagsCode", () => {
4
9
  const mockManifest = {
5
10
  "src/client.tsx": { file: "assets/client-a1b2c3d4.js" },
@@ -14,17 +19,17 @@ describe("transformJsxScriptTagsCode", () => {
14
19
  })
15
20
  `;
16
21
  const result = await transformJsxScriptTagsCode(code, mockManifest);
17
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
22
+ const expected = `import { requestInfo } from "rwsdk/worker";
18
23
 
19
- (
20
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
21
- jsx("script", {
22
- src: "/assets/client-a1b2c3d4.js",
23
- type: "module",
24
- nonce: requestInfo.rw.nonce
25
- })
26
- )
27
- `);
24
+ (
25
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
26
+ jsx("script", {
27
+ src: "/assets/client-a1b2c3d4.js",
28
+ type: "module",
29
+ nonce: requestInfo.rw.nonce
30
+ })
31
+ )`;
32
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
28
33
  });
29
34
  it("transforms inline scripts with dynamic imports", async () => {
30
35
  const code = `
@@ -34,32 +39,32 @@ describe("transformJsxScriptTagsCode", () => {
34
39
  })
35
40
  `;
36
41
  const result = await transformJsxScriptTagsCode(code, mockManifest);
37
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
42
+ const expected = `import { requestInfo } from "rwsdk/worker";
38
43
 
39
- (
40
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
41
- jsx("script", {
42
- type: "module",
43
- children: "import('/assets/client-a1b2c3d4.js').then(module => { console.log(module); })",
44
- nonce: requestInfo.rw.nonce
45
- })
46
- )
47
- `);
44
+ (
45
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
46
+ jsx("script", {
47
+ type: "module",
48
+ children: "import('/assets/client-a1b2c3d4.js').then(module => { console.log(module); })",
49
+ nonce: requestInfo.rw.nonce
50
+ })
51
+ )`;
52
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
48
53
  });
49
54
  it("transforms inline scripts with type=module", async () => {
50
55
  const code = `
51
56
  jsx("script", { type: "module", children: "import('/src/client.tsx')" })
52
57
  `;
53
58
  const result = await transformJsxScriptTagsCode(code, mockManifest);
54
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
59
+ const expected = `import { requestInfo } from "rwsdk/worker";
55
60
 
56
- (
57
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
58
- jsx("script", { type: "module", children: "import('/assets/client-a1b2c3d4.js')",
59
- nonce: requestInfo.rw.nonce
60
- })
61
- )
62
- `);
61
+ (
62
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
63
+ jsx("script", { type: "module", children: "import('/assets/client-a1b2c3d4.js')",
64
+ nonce: requestInfo.rw.nonce
65
+ })
66
+ )`;
67
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
63
68
  });
64
69
  it("transforms inline scripts with multiline content", async () => {
65
70
  const code = `
@@ -76,13 +81,13 @@ describe("transformJsxScriptTagsCode", () => {
76
81
  })
77
82
  `;
78
83
  const result = await transformJsxScriptTagsCode(code, mockManifest);
79
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
84
+ const expected = `import { requestInfo } from "rwsdk/worker";
80
85
 
81
- (
82
- (requestInfo.rw.scriptsToBeLoaded.add("/src/entry.js")),
83
- jsx("script", {
84
- type: "module",
85
- children: \`
86
+ (
87
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/entry.js")),
88
+ jsx("script", {
89
+ type: "module",
90
+ children: \`
86
91
  // Some comments here
87
92
  const init = async () => {
88
93
  await import('/assets/entry-e5f6g7h8.js');
@@ -90,37 +95,37 @@ describe("transformJsxScriptTagsCode", () => {
90
95
  };
91
96
  init();
92
97
  \`,
93
- nonce: requestInfo.rw.nonce
94
- })
95
- )
96
- `);
98
+ nonce: requestInfo.rw.nonce
99
+ })
100
+ )`;
101
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
97
102
  });
98
103
  it("transforms multiple imports in the same inline script", async () => {
99
104
  const code = `
100
105
  jsx("script", {
101
106
  type: "module",
102
107
  children: \`
103
- import('/src/client.tsx');
104
- import('/src/entry.js');
105
- \`
108
+ import('/src/client.tsx');
109
+ import('/src/entry.js');
110
+ \`
106
111
  })
107
112
  `;
108
113
  const result = await transformJsxScriptTagsCode(code, mockManifest);
109
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
114
+ const expected = `import { requestInfo } from "rwsdk/worker";
110
115
 
111
- (
112
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
116
+ (
117
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
113
118
  (requestInfo.rw.scriptsToBeLoaded.add("/src/entry.js")),
114
- jsx("script", {
115
- type: "module",
116
- children: \`
117
- import('/assets/client-a1b2c3d4.js');
118
- import('/assets/entry-e5f6g7h8.js');
119
- \`,
120
- nonce: requestInfo.rw.nonce
121
- })
122
- )
123
- `);
119
+ jsx("script", {
120
+ type: "module",
121
+ children: \`
122
+ import('/assets/client-a1b2c3d4.js');
123
+ import('/assets/entry-e5f6g7h8.js');
124
+ \`,
125
+ nonce: requestInfo.rw.nonce
126
+ })
127
+ )`;
128
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
124
129
  });
125
130
  it("transforms link href attributes with preload rel", async () => {
126
131
  const code = `
@@ -177,33 +182,33 @@ describe("transformJsxScriptTagsCode", () => {
177
182
  })
178
183
  `;
179
184
  const result = await transformJsxScriptTagsCode(code, mockManifest);
180
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
185
+ const expected = `import { requestInfo } from "rwsdk/worker";
181
186
 
182
- jsx("html", {
183
- lang: "en",
184
- children: [
185
- jsx("head", {
186
- children: [
187
- jsx("meta", { charSet: "utf-8" }),
188
- jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
189
- jsx("title", { children: "@redwoodjs/starter-standard" }),
190
- jsx("link", { rel: "modulepreload", href: "/assets/client-a1b2c3d4.js", as: "script" })
191
- ]
192
- }),
193
- jsx("body", {
194
- children: [
195
- jsx("div", { id: "root", children: props.children }),
196
- (
197
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
198
- jsx("script", { children: "import(\\"\/assets\/client-a1b2c3d4.js\\")",
199
- nonce: requestInfo.rw.nonce
200
- })
201
- )
202
- ]
203
- })
204
- ]
205
- })
206
- `);
187
+ jsx("html", {
188
+ lang: "en",
189
+ children: [
190
+ jsx("head", {
191
+ children: [
192
+ jsx("meta", { charSet: "utf-8" }),
193
+ jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }),
194
+ jsx("title", { children: "@redwoodjs/starter-standard" }),
195
+ jsx("link", { rel: "modulepreload", href: "/assets/client-a1b2c3d4.js", as: "script" })
196
+ ]
197
+ }),
198
+ jsx("body", {
199
+ children: [
200
+ jsx("div", { id: "root", children: props.children }),
201
+ (
202
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
203
+ jsx("script", { children: "import(\\"/assets/client-a1b2c3d4.js\\")",
204
+ nonce: requestInfo.rw.nonce
205
+ })
206
+ )
207
+ ]
208
+ })
209
+ ]
210
+ })`;
211
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
207
212
  });
208
213
  it("returns null when no transformations are needed", async () => {
209
214
  const code = `
@@ -220,17 +225,17 @@ describe("transformJsxScriptTagsCode", () => {
220
225
  })
221
226
  `;
222
227
  const result = await transformJsxScriptTagsCode(code, mockManifest);
223
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
228
+ const expected = `import { requestInfo } from "rwsdk/worker";
224
229
 
225
- (
226
- (requestInfo.rw.scriptsToBeLoaded.add("/src/non-existent.js")),
227
- jsx("script", {
228
- src: "/src/non-existent.js",
229
- type: "module",
230
- nonce: requestInfo.rw.nonce
231
- })
232
- )
233
- `);
230
+ (
231
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/non-existent.js")),
232
+ jsx("script", {
233
+ src: "/src/non-existent.js",
234
+ type: "module",
235
+ nonce: requestInfo.rw.nonce
236
+ })
237
+ )`;
238
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
234
239
  });
235
240
  it("adds nonce to script tags with src attribute and imports requestInfo", async () => {
236
241
  const code = `
@@ -240,17 +245,17 @@ describe("transformJsxScriptTagsCode", () => {
240
245
  })
241
246
  `;
242
247
  const result = await transformJsxScriptTagsCode(code, mockManifest);
243
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
248
+ const expected = `import { requestInfo } from "rwsdk/worker";
244
249
 
245
- (
246
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
247
- jsx("script", {
248
- src: "/assets/client-a1b2c3d4.js",
249
- type: "module",
250
- nonce: requestInfo.rw.nonce
251
- })
252
- )
253
- `);
250
+ (
251
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
252
+ jsx("script", {
253
+ src: "/assets/client-a1b2c3d4.js",
254
+ type: "module",
255
+ nonce: requestInfo.rw.nonce
256
+ })
257
+ )`;
258
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
254
259
  });
255
260
  it("adds nonce to script tags with string literal children", async () => {
256
261
  const code = `
@@ -347,16 +352,242 @@ describe("transformJsxScriptTagsCode", () => {
347
352
  `;
348
353
  // Call without providing manifest (simulating dev mode)
349
354
  const result = await transformJsxScriptTagsCode(code);
350
- expect(result?.code).toEqual(`import { requestInfo } from "rwsdk/worker";
355
+ const expected = `import { requestInfo } from "rwsdk/worker";
351
356
 
352
- (
353
- (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
354
- jsx("script", {
355
- src: "/src/client.tsx",
356
- type: "module",
357
- nonce: requestInfo.rw.nonce
358
- })
359
- )
360
- `);
357
+ (
358
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
359
+ jsx("script", {
360
+ src: "/src/client.tsx",
361
+ type: "module",
362
+ nonce: requestInfo.rw.nonce
363
+ })
364
+ )`;
365
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
366
+ });
367
+ it("regression favicon links", async () => {
368
+ const code = `
369
+ import { jsxDEV } from "react/jsx-dev-runtime";
370
+ import styles from "./index.css?url";
371
+ export const Document = ({
372
+ children
373
+ }) => /* @__PURE__ */ jsxDEV("html", { lang: "en", children: [
374
+ /* @__PURE__ */ jsxDEV("head", { children: [
375
+ /* @__PURE__ */ jsxDEV("meta", { charSet: "utf-8" }, void 0, false, {
376
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
377
+ lineNumber: 8,
378
+ columnNumber: 4
379
+ }, this),
380
+ /* @__PURE__ */ jsxDEV("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }, void 0, false, {
381
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
382
+ lineNumber: 9,
383
+ columnNumber: 4
384
+ }, this),
385
+ /* @__PURE__ */ jsxDEV("title", { children: "rwsdk-guestbook" }, void 0, false, {
386
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
387
+ lineNumber: 10,
388
+ columnNumber: 4
389
+ }, this),
390
+ /* @__PURE__ */ jsxDEV("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }, void 0, false, {
391
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
392
+ lineNumber: 11,
393
+ columnNumber: 4
394
+ }, this),
395
+ /* @__PURE__ */ jsxDEV(
396
+ "link",
397
+ {
398
+ rel: "preconnect",
399
+ href: "https://fonts.gstatic.com",
400
+ crossOrigin: "anonymous"
401
+ },
402
+ void 0,
403
+ false,
404
+ {
405
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
406
+ lineNumber: 12,
407
+ columnNumber: 4
408
+ },
409
+ this
410
+ ),
411
+ /* @__PURE__ */ jsxDEV(
412
+ "link",
413
+ {
414
+ href: "https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap",
415
+ rel: "stylesheet"
416
+ },
417
+ void 0,
418
+ false,
419
+ {
420
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
421
+ lineNumber: 17,
422
+ columnNumber: 4
423
+ },
424
+ this
425
+ ),
426
+ /* @__PURE__ */ jsxDEV("script", { src: "/theme-script.js" }, void 0, false, {
427
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
428
+ lineNumber: 21,
429
+ columnNumber: 4
430
+ }, this),
431
+ /* @__PURE__ */ jsxDEV("link", { rel: "icon", href: "/favicon.svg" }, void 0, false, {
432
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
433
+ lineNumber: 22,
434
+ columnNumber: 4
435
+ }, this),
436
+ /* @__PURE__ */ jsxDEV("link", { rel: "modulepreload", href: "/src/client.tsx" }, void 0, false, {
437
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
438
+ lineNumber: 23,
439
+ columnNumber: 4
440
+ }, this),
441
+ /* @__PURE__ */ jsxDEV("link", { rel: "stylesheet", href: styles }, void 0, false, {
442
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
443
+ lineNumber: 24,
444
+ columnNumber: 4
445
+ }, this)
446
+ ] }, void 0, true, {
447
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
448
+ lineNumber: 7,
449
+ columnNumber: 3
450
+ }, this),
451
+ /* @__PURE__ */ jsxDEV("body", { children: [
452
+ /* @__PURE__ */ jsxDEV("div", { id: "root", children }, void 0, false, {
453
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
454
+ lineNumber: 27,
455
+ columnNumber: 4
456
+ }, this),
457
+ /* @__PURE__ */ jsxDEV("script", { children: 'import("/src/client.tsx")' }, void 0, false, {
458
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
459
+ lineNumber: 28,
460
+ columnNumber: 4
461
+ }, this)
462
+ ] }, void 0, true, {
463
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
464
+ lineNumber: 26,
465
+ columnNumber: 3
466
+ }, this)
467
+ ] }, void 0, true, {
468
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
469
+ lineNumber: 6,
470
+ columnNumber: 2
471
+ }, this);
472
+ `;
473
+ const result = await transformJsxScriptTagsCode(code, mockManifest);
474
+ // For this complex test, we'll just verify the key transformations
475
+ const expected = `
476
+ import { jsxDEV } from "react/jsx-dev-runtime";
477
+ import styles from "./index.css?url";
478
+ import { requestInfo } from "rwsdk/worker";
479
+
480
+ export const Document = ({
481
+ children
482
+ }) => /* @__PURE__ */ jsxDEV("html", { lang: "en", children: [
483
+ /* @__PURE__ */ jsxDEV("head", { children: [
484
+ /* @__PURE__ */ jsxDEV("meta", { charSet: "utf-8" }, void 0, false, {
485
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
486
+ lineNumber: 8,
487
+ columnNumber: 4
488
+ }, this),
489
+ /* @__PURE__ */ jsxDEV("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }, void 0, false, {
490
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
491
+ lineNumber: 9,
492
+ columnNumber: 4
493
+ }, this),
494
+ /* @__PURE__ */ jsxDEV("title", { children: "rwsdk-guestbook" }, void 0, false, {
495
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
496
+ lineNumber: 10,
497
+ columnNumber: 4
498
+ }, this),
499
+ /* @__PURE__ */ jsxDEV("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }, void 0, false, {
500
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
501
+ lineNumber: 11,
502
+ columnNumber: 4
503
+ }, this),
504
+ /* @__PURE__ */ jsxDEV(
505
+ "link",
506
+ {
507
+ rel: "preconnect",
508
+ href: "https://fonts.gstatic.com",
509
+ crossOrigin: "anonymous"
510
+ },
511
+ void 0,
512
+ false,
513
+ {
514
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
515
+ lineNumber: 12,
516
+ columnNumber: 4
517
+ },
518
+ this
519
+ ),
520
+ /* @__PURE__ */ jsxDEV(
521
+ "link",
522
+ {
523
+ href: "https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&display=swap",
524
+ rel: "stylesheet"
525
+ },
526
+ void 0,
527
+ false,
528
+ {
529
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
530
+ lineNumber: 17,
531
+ columnNumber: 4
532
+ },
533
+ this
534
+ ),
535
+ (
536
+ (requestInfo.rw.scriptsToBeLoaded.add("/theme-script.js")),
537
+ /* @__PURE__ */ jsxDEV("script", { src: "/theme-script.js",
538
+ nonce: requestInfo.rw.nonce
539
+ }, void 0, false, {
540
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
541
+ lineNumber: 21,
542
+ columnNumber: 4
543
+ }, this)
544
+ ),
545
+ /* @__PURE__ */ jsxDEV("link", { rel: "icon", href: "/favicon.svg" }, void 0, false, {
546
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
547
+ lineNumber: 22,
548
+ columnNumber: 4
549
+ }, this),
550
+ /* @__PURE__ */ jsxDEV("link", { rel: "modulepreload", href: "/assets/client-a1b2c3d4.js" }, void 0, false, {
551
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
552
+ lineNumber: 23,
553
+ columnNumber: 4
554
+ }, this),
555
+ /* @__PURE__ */ jsxDEV("link", { rel: "stylesheet", href: styles }, void 0, false, {
556
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
557
+ lineNumber: 24,
558
+ columnNumber: 4
559
+ }, this)
560
+ ] }, void 0, true, {
561
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
562
+ lineNumber: 7,
563
+ columnNumber: 3
564
+ }, this),
565
+ /* @__PURE__ */ jsxDEV("body", { children: [
566
+ /* @__PURE__ */ jsxDEV("div", { id: "root", children }, void 0, false, {
567
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
568
+ lineNumber: 27,
569
+ columnNumber: 4
570
+ }, this),
571
+ (
572
+ (requestInfo.rw.scriptsToBeLoaded.add("/src/client.tsx")),
573
+ /* @__PURE__ */ jsxDEV("script", { children: "import(\\"/assets/client-a1b2c3d4.js\\")",
574
+ nonce: requestInfo.rw.nonce
575
+ }, void 0, false, {
576
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
577
+ lineNumber: 28,
578
+ columnNumber: 4
579
+ }, this)
580
+ )
581
+ ] }, void 0, true, {
582
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
583
+ lineNumber: 26,
584
+ columnNumber: 3
585
+ }, this)
586
+ ] }, void 0, true, {
587
+ fileName: "/Users/justin/rw/blotter/rwsdk-guestbook/src/app/document/Document.tsx",
588
+ lineNumber: 6,
589
+ columnNumber: 2
590
+ }, this);`;
591
+ expect(normalizeCode(result?.code || "")).toEqual(normalizeCode(expected));
361
592
  });
362
593
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "0.2.0-alpha.8",
3
+ "version": "0.2.0",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {
@@ -144,10 +144,7 @@
144
144
  "picocolors": "^1.1.1",
145
145
  "proper-lockfile": "^4.1.2",
146
146
  "puppeteer-core": "^22.8.1",
147
- "react": "19.2.0-canary-39cad7af-20250411",
148
- "react-dom": "19.2.0-canary-39cad7af-20250411",
149
147
  "react-is": "^19.0.0",
150
- "react-server-dom-webpack": "19.2.0-canary-39cad7af-20250411",
151
148
  "rsc-html-stream": "^0.0.6",
152
149
  "tmp-promise": "^3.0.3",
153
150
  "ts-morph": "^25.0.1",
@@ -157,14 +154,35 @@
157
154
  "wrangler": "^4.20.5"
158
155
  },
159
156
  "peerDependencies": {
157
+ "react": ">=19.2.0-0 <20",
158
+ "react-dom": ">=19.2.0-0 <20",
159
+ "react-server-dom-webpack": ">=19.2.0-0 <20",
160
160
  "vite": "^6.2.6"
161
161
  },
162
+ "optionalDependencies": {
163
+ "react": "19.2.0-canary-39cad7af-20250411",
164
+ "react-dom": "19.2.0-canary-39cad7af-20250411",
165
+ "react-server-dom-webpack": "19.2.0-canary-39cad7af-20250411"
166
+ },
167
+ "peerDependenciesMeta": {
168
+ "react": {
169
+ "optional": true
170
+ },
171
+ "react-dom": {
172
+ "optional": true
173
+ },
174
+ "react-server-dom-webpack": {
175
+ "optional": true
176
+ }
177
+ },
162
178
  "packageManager": "pnpm@9.14.4+sha512.c8180b3fbe4e4bca02c94234717896b5529740a6cbadf19fa78254270403ea2f27d4e1d46a08a0f56c89b63dc8ebfd3ee53326da720273794e6200fcf0d184ab",
163
179
  "devDependencies": {
164
180
  "@types/debug": "^4.1.12",
181
+ "@types/js-beautify": "^1.14.3",
165
182
  "@types/lodash": "^4.17.16",
166
183
  "@types/node": "^22.14.0",
167
184
  "@types/proper-lockfile": "^4.1.4",
185
+ "js-beautify": "^1.15.4",
168
186
  "semver": "^7.7.1",
169
187
  "tsx": "^4.19.4",
170
188
  "typescript": "^5.8.3",
File without changes