vite-plugin-react-server 0.3.3 → 0.3.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.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ const PATCH_RECONCILER_VERSION = "19.1.0-experimental-b3a95caf-20250113";
7
+ const ALTERNATIVE_REACT_VERSION = "0.0.0-experimental-b3a95caf-20250113";
8
+ const STUB_ESM_VERSION = `0.0.1`;
9
+ const PATCH_FILE = `react-server-dom-esm+${STUB_ESM_VERSION}.patch`;
10
+ async function main() {
11
+ try {
12
+ const reactPkgPath = path.resolve(process.cwd(), "node_modules/react/package.json");
13
+ const reactPkg = JSON.parse(await fs.readFile(reactPkgPath, "utf-8"));
14
+ const installedVersion = reactPkg.version;
15
+ const ourPatchPath = path.resolve(__dirname, `../patches/${PATCH_FILE}`);
16
+ let patchContent = await fs.readFile(ourPatchPath, "utf-8");
17
+ patchContent = patchContent.replace(
18
+ new RegExp(PATCH_RECONCILER_VERSION, "g"),
19
+ installedVersion
20
+ ).replace(
21
+ new RegExp(ALTERNATIVE_REACT_VERSION, "g"),
22
+ installedVersion
23
+ );
24
+ const userPatchesDir = path.resolve(process.cwd(), "patches");
25
+ await fs.mkdir(userPatchesDir, { recursive: true });
26
+ const newFileName = `react-server-dom-esm+${STUB_ESM_VERSION}.patch`;
27
+ const newPatchPath = path.resolve(userPatchesDir, newFileName);
28
+ await fs.writeFile(newPatchPath, patchContent);
29
+ console.log(`Updated patch to match React version ${installedVersion}`);
30
+ } catch (error) {
31
+ }
32
+ }
33
+ main();
34
+ //# sourceMappingURL=check-react-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-react-version.js","sources":["../../scripts/check-react-version.mjs"],"sourcesContent":["#!/usr/bin/env node\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\n\nconst PATCH_RECONCILER_VERSION = '19.1.0-experimental-b3a95caf-20250113'\nconst ALTERNATIVE_REACT_VERSION = '0.0.0-experimental-b3a95caf-20250113'\nconst STUB_ESM_VERSION = `0.0.1`\nconst PATCH_FILE = `react-server-dom-esm+${STUB_ESM_VERSION}.patch`\n\nasync function main() {\n try {\n // Read installed React version\n const reactPkgPath = path.resolve(process.cwd(), 'node_modules/react/package.json')\n const reactPkg = JSON.parse(await fs.readFile(reactPkgPath, 'utf-8'))\n const installedVersion = reactPkg.version\n\n // Get our patch file from our package\n const ourPatchPath = path.resolve(__dirname, `../patches/${PATCH_FILE}`)\n let patchContent = await fs.readFile(ourPatchPath, 'utf-8')\n\n // Replace the version in the patch content\n patchContent = patchContent.replace(\n new RegExp(PATCH_RECONCILER_VERSION, 'g'),\n installedVersion\n ).replace(\n new RegExp(ALTERNATIVE_REACT_VERSION, 'g'),\n installedVersion\n )\n\n // Create patches dir in user's project\n const userPatchesDir = path.resolve(process.cwd(), 'patches')\n await fs.mkdir(userPatchesDir, { recursive: true })\n\n // Write the patch file - use stub version for filename\n const newFileName = `react-server-dom-esm+${STUB_ESM_VERSION}.patch`\n const newPatchPath = path.resolve(userPatchesDir, newFileName)\n await fs.writeFile(newPatchPath, patchContent)\n\n console.log(`Updated patch to match React version ${installedVersion}`)\n } catch (error) {\n \n }\n}\n\nmain() "],"names":[],"mappings":";;;;AAKA,MAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAE7D,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;AAClC,MAAM,mBAAmB;AACzB,MAAM,aAAa,wBAAwB,gBAAgB;AAE3D,eAAe,OAAO;AACpB,MAAI;AAEF,UAAM,eAAe,KAAK,QAAQ,QAAQ,IAAK,GAAE,iCAAiC;AAClF,UAAM,WAAW,KAAK,MAAM,MAAM,GAAG,SAAS,cAAc,OAAO,CAAC;AACpE,UAAM,mBAAmB,SAAS;AAGlC,UAAM,eAAe,KAAK,QAAQ,WAAW,cAAc,UAAU,EAAE;AACvE,QAAI,eAAe,MAAM,GAAG,SAAS,cAAc,OAAO;AAG1D,mBAAe,aAAa;AAAA,MAC1B,IAAI,OAAO,0BAA0B,GAAG;AAAA,MACxC;AAAA,IACN,EAAM;AAAA,MACA,IAAI,OAAO,2BAA2B,GAAG;AAAA,MACzC;AAAA,IACN;AAGI,UAAM,iBAAiB,KAAK,QAAQ,QAAQ,IAAK,GAAE,SAAS;AAC5D,UAAM,GAAG,MAAM,gBAAgB,EAAE,WAAW,KAAM,CAAA;AAGlD,UAAM,cAAc,wBAAwB,gBAAgB;AAC5D,UAAM,eAAe,KAAK,QAAQ,gBAAgB,WAAW;AAC7D,UAAM,GAAG,UAAU,cAAc,YAAY;AAE7C,YAAQ,IAAI,wCAAwC,gBAAgB,EAAE;AAAA,EACvE,SAAQ,OAAO;AAAA,EAElB;AACA;AAEA,KAAI;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-react-server",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Vite plugin for React Server Components (RSC)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,6 +10,7 @@
10
10
  "dist",
11
11
  "src",
12
12
  "patches",
13
+ "scripts",
13
14
  "README.md",
14
15
  "LICENSE",
15
16
  "tsconfig.json"
@@ -55,7 +56,7 @@
55
56
  "experimental:patch": "npx patch-package react-server-dom-esm --exclude 'nothing'",
56
57
  "experimental:setup": "npm run experimental:copy && npm run experimental:patch",
57
58
  "experimental:check": "node scripts/check-react-version.mjs",
58
- "postinstall": "npm run experimental:check && patch-package"
59
+ "postinstall": "npm run experimental:check && npx patch-package react-server-dom-esm"
59
60
  },
60
61
  "keywords": [
61
62
  "vite",
@@ -107,6 +108,6 @@
107
108
  "webpack-sources": "^3.2.0"
108
109
  },
109
110
  "bin": {
110
- "vite-react-stream-patch": "./dist/bin/patch.js"
111
+ "vite-react-stream-patch": "./dist/scripts/check-react-version.mjs"
111
112
  }
112
113
  }
@@ -38,7 +38,7 @@ index 0000000..71c61b3
38
38
  +**Use it at your own risk.**
39
39
  diff --git a/node_modules/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js b/node_modules/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js
40
40
  new file mode 100644
41
- index 0000000..67b508f
41
+ index 0000000..0e11a1e
42
42
  --- /dev/null
43
43
  +++ b/node_modules/react-server-dom-esm/cjs/react-server-dom-esm-client.browser.development.js
44
44
  @@ -0,0 +1,2921 @@
@@ -13422,1098 +13422,3 @@ index 0000000..1ad3553
13422
13422
  + });
13423
13423
  + };
13424
13424
  + })();
13425
- diff --git a/node_modules/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js b/node_modules/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js
13426
- new file mode 100644
13427
- index 0000000..da3e97e
13428
- --- /dev/null
13429
- +++ b/node_modules/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.js
13430
- @@ -0,0 +1,2821 @@
13431
- +/**
13432
- + * @license React
13433
- + * react-server-dom-esm-server.node.production.js
13434
- + *
13435
- + * Copyright (c) Meta Platforms, Inc. and affiliates.
13436
- + *
13437
- + * This source code is licensed under the MIT license found in the
13438
- + * LICENSE file in the root directory of this source tree.
13439
- + */
13440
- +
13441
- +"use strict";
13442
- +var stream = require("stream"),
13443
- + util = require("util");
13444
- +require("crypto");
13445
- +var async_hooks = require("async_hooks"),
13446
- + ReactDOM = require("react-dom"),
13447
- + React = require("react"),
13448
- + scheduleMicrotask = queueMicrotask,
13449
- + currentView = null,
13450
- + writtenBytes = 0,
13451
- + destinationHasCapacity = !0;
13452
- +function writeToDestination(destination, view) {
13453
- + destination = destination.write(view);
13454
- + destinationHasCapacity = destinationHasCapacity && destination;
13455
- +}
13456
- +function writeChunkAndReturn(destination, chunk) {
13457
- + if ("string" === typeof chunk) {
13458
- + if (0 !== chunk.length)
13459
- + if (2048 < 3 * chunk.length)
13460
- + 0 < writtenBytes &&
13461
- + (writeToDestination(
13462
- + destination,
13463
- + currentView.subarray(0, writtenBytes)
13464
- + ),
13465
- + (currentView = new Uint8Array(2048)),
13466
- + (writtenBytes = 0)),
13467
- + writeToDestination(destination, chunk);
13468
- + else {
13469
- + var target = currentView;
13470
- + 0 < writtenBytes && (target = currentView.subarray(writtenBytes));
13471
- + target = textEncoder.encodeInto(chunk, target);
13472
- + var read = target.read;
13473
- + writtenBytes += target.written;
13474
- + read < chunk.length &&
13475
- + (writeToDestination(
13476
- + destination,
13477
- + currentView.subarray(0, writtenBytes)
13478
- + ),
13479
- + (currentView = new Uint8Array(2048)),
13480
- + (writtenBytes = textEncoder.encodeInto(
13481
- + chunk.slice(read),
13482
- + currentView
13483
- + ).written));
13484
- + 2048 === writtenBytes &&
13485
- + (writeToDestination(destination, currentView),
13486
- + (currentView = new Uint8Array(2048)),
13487
- + (writtenBytes = 0));
13488
- + }
13489
- + } else
13490
- + 0 !== chunk.byteLength &&
13491
- + (2048 < chunk.byteLength
13492
- + ? (0 < writtenBytes &&
13493
- + (writeToDestination(
13494
- + destination,
13495
- + currentView.subarray(0, writtenBytes)
13496
- + ),
13497
- + (currentView = new Uint8Array(2048)),
13498
- + (writtenBytes = 0)),
13499
- + writeToDestination(destination, chunk))
13500
- + : ((target = currentView.length - writtenBytes),
13501
- + target < chunk.byteLength &&
13502
- + (0 === target
13503
- + ? writeToDestination(destination, currentView)
13504
- + : (currentView.set(chunk.subarray(0, target), writtenBytes),
13505
- + (writtenBytes += target),
13506
- + writeToDestination(destination, currentView),
13507
- + (chunk = chunk.subarray(target))),
13508
- + (currentView = new Uint8Array(2048)),
13509
- + (writtenBytes = 0)),
13510
- + currentView.set(chunk, writtenBytes),
13511
- + (writtenBytes += chunk.byteLength),
13512
- + 2048 === writtenBytes &&
13513
- + (writeToDestination(destination, currentView),
13514
- + (currentView = new Uint8Array(2048)),
13515
- + (writtenBytes = 0))));
13516
- + return destinationHasCapacity;
13517
- +}
13518
- +var textEncoder = new util.TextEncoder();
13519
- +function byteLengthOfChunk(chunk) {
13520
- + return "string" === typeof chunk
13521
- + ? Buffer.byteLength(chunk, "utf8")
13522
- + : chunk.byteLength;
13523
- +}
13524
- +var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
13525
- + SERVER_REFERENCE_TAG = Symbol.for("react.server.reference"),
13526
- + FunctionBind = Function.prototype.bind,
13527
- + ArraySlice = Array.prototype.slice;
13528
- +function bind() {
13529
- + var newFn = FunctionBind.apply(this, arguments);
13530
- + if (this.$$typeof === SERVER_REFERENCE_TAG) {
13531
- + var args = ArraySlice.call(arguments, 1),
13532
- + $$typeof = { value: SERVER_REFERENCE_TAG },
13533
- + $$id = { value: this.$$id };
13534
- + args = { value: this.$$bound ? this.$$bound.concat(args) : args };
13535
- + return Object.defineProperties(newFn, {
13536
- + $$typeof: $$typeof,
13537
- + $$id: $$id,
13538
- + $$bound: args,
13539
- + bind: { value: bind, configurable: !0 }
13540
- + });
13541
- + }
13542
- + return newFn;
13543
- +}
13544
- +var ReactDOMSharedInternals =
13545
- + ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
13546
- + previousDispatcher = ReactDOMSharedInternals.d;
13547
- +ReactDOMSharedInternals.d = {
13548
- + f: previousDispatcher.f,
13549
- + r: previousDispatcher.r,
13550
- + D: prefetchDNS,
13551
- + C: preconnect,
13552
- + L: preload,
13553
- + m: preloadModule$1,
13554
- + X: preinitScript,
13555
- + S: preinitStyle,
13556
- + M: preinitModuleScript
13557
- +};
13558
- +function prefetchDNS(href) {
13559
- + if ("string" === typeof href && href) {
13560
- + var request = resolveRequest();
13561
- + if (request) {
13562
- + var hints = request.hints,
13563
- + key = "D|" + href;
13564
- + hints.has(key) || (hints.add(key), emitHint(request, "D", href));
13565
- + } else previousDispatcher.D(href);
13566
- + }
13567
- +}
13568
- +function preconnect(href, crossOrigin) {
13569
- + if ("string" === typeof href) {
13570
- + var request = resolveRequest();
13571
- + if (request) {
13572
- + var hints = request.hints,
13573
- + key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
13574
- + hints.has(key) ||
13575
- + (hints.add(key),
13576
- + "string" === typeof crossOrigin
13577
- + ? emitHint(request, "C", [href, crossOrigin])
13578
- + : emitHint(request, "C", href));
13579
- + } else previousDispatcher.C(href, crossOrigin);
13580
- + }
13581
- +}
13582
- +function preload(href, as, options) {
13583
- + if ("string" === typeof href) {
13584
- + var request = resolveRequest();
13585
- + if (request) {
13586
- + var hints = request.hints,
13587
- + key = "L";
13588
- + if ("image" === as && options) {
13589
- + var imageSrcSet = options.imageSrcSet,
13590
- + imageSizes = options.imageSizes,
13591
- + uniquePart = "";
13592
- + "string" === typeof imageSrcSet && "" !== imageSrcSet
13593
- + ? ((uniquePart += "[" + imageSrcSet + "]"),
13594
- + "string" === typeof imageSizes &&
13595
- + (uniquePart += "[" + imageSizes + "]"))
13596
- + : (uniquePart += "[][]" + href);
13597
- + key += "[image]" + uniquePart;
13598
- + } else key += "[" + as + "]" + href;
13599
- + hints.has(key) ||
13600
- + (hints.add(key),
13601
- + (options = trimOptions(options))
13602
- + ? emitHint(request, "L", [href, as, options])
13603
- + : emitHint(request, "L", [href, as]));
13604
- + } else previousDispatcher.L(href, as, options);
13605
- + }
13606
- +}
13607
- +function preloadModule$1(href, options) {
13608
- + if ("string" === typeof href) {
13609
- + var request = resolveRequest();
13610
- + if (request) {
13611
- + var hints = request.hints,
13612
- + key = "m|" + href;
13613
- + if (hints.has(key)) return;
13614
- + hints.add(key);
13615
- + return (options = trimOptions(options))
13616
- + ? emitHint(request, "m", [href, options])
13617
- + : emitHint(request, "m", href);
13618
- + }
13619
- + previousDispatcher.m(href, options);
13620
- + }
13621
- +}
13622
- +function preinitStyle(href, precedence, options) {
13623
- + if ("string" === typeof href) {
13624
- + var request = resolveRequest();
13625
- + if (request) {
13626
- + var hints = request.hints,
13627
- + key = "S|" + href;
13628
- + if (hints.has(key)) return;
13629
- + hints.add(key);
13630
- + return (options = trimOptions(options))
13631
- + ? emitHint(request, "S", [
13632
- + href,
13633
- + "string" === typeof precedence ? precedence : 0,
13634
- + options
13635
- + ])
13636
- + : "string" === typeof precedence
13637
- + ? emitHint(request, "S", [href, precedence])
13638
- + : emitHint(request, "S", href);
13639
- + }
13640
- + previousDispatcher.S(href, precedence, options);
13641
- + }
13642
- +}
13643
- +function preinitScript(src, options) {
13644
- + if ("string" === typeof src) {
13645
- + var request = resolveRequest();
13646
- + if (request) {
13647
- + var hints = request.hints,
13648
- + key = "X|" + src;
13649
- + if (hints.has(key)) return;
13650
- + hints.add(key);
13651
- + return (options = trimOptions(options))
13652
- + ? emitHint(request, "X", [src, options])
13653
- + : emitHint(request, "X", src);
13654
- + }
13655
- + previousDispatcher.X(src, options);
13656
- + }
13657
- +}
13658
- +function preinitModuleScript(src, options) {
13659
- + if ("string" === typeof src) {
13660
- + var request = resolveRequest();
13661
- + if (request) {
13662
- + var hints = request.hints,
13663
- + key = "M|" + src;
13664
- + if (hints.has(key)) return;
13665
- + hints.add(key);
13666
- + return (options = trimOptions(options))
13667
- + ? emitHint(request, "M", [src, options])
13668
- + : emitHint(request, "M", src);
13669
- + }
13670
- + previousDispatcher.M(src, options);
13671
- + }
13672
- +}
13673
- +function trimOptions(options) {
13674
- + if (null == options) return null;
13675
- + var hasProperties = !1,
13676
- + trimmed = {},
13677
- + key;
13678
- + for (key in options)
13679
- + null != options[key] &&
13680
- + ((hasProperties = !0), (trimmed[key] = options[key]));
13681
- + return hasProperties ? trimmed : null;
13682
- +}
13683
- +var requestStorage = new async_hooks.AsyncLocalStorage(),
13684
- + TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
13685
- + proxyHandlers = {
13686
- + get: function (target, name) {
13687
- + switch (name) {
13688
- + case "$$typeof":
13689
- + return target.$$typeof;
13690
- + case "name":
13691
- + return;
13692
- + case "displayName":
13693
- + return;
13694
- + case "defaultProps":
13695
- + return;
13696
- + case "toJSON":
13697
- + return;
13698
- + case Symbol.toPrimitive:
13699
- + return Object.prototype[Symbol.toPrimitive];
13700
- + case Symbol.toStringTag:
13701
- + return Object.prototype[Symbol.toStringTag];
13702
- + case "Provider":
13703
- + throw Error(
13704
- + "Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
13705
- + );
13706
- + }
13707
- + throw Error(
13708
- + "Cannot access " +
13709
- + String(name) +
13710
- + " on the server. You cannot dot into a temporary client reference from a server component. You can only pass the value through to the client."
13711
- + );
13712
- + },
13713
- + set: function () {
13714
- + throw Error(
13715
- + "Cannot assign to a temporary client reference from a server module."
13716
- + );
13717
- + }
13718
- + };
13719
- +function createTemporaryReference(temporaryReferences, id) {
13720
- + var reference = Object.defineProperties(
13721
- + function () {
13722
- + throw Error(
13723
- + "Attempted to call a temporary Client Reference from the server but it is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
13724
- + );
13725
- + },
13726
- + { $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
13727
- + );
13728
- + reference = new Proxy(reference, proxyHandlers);
13729
- + temporaryReferences.set(reference, id);
13730
- + return reference;
13731
- +}
13732
- +var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
13733
- + REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
13734
- + REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
13735
- + REACT_CONTEXT_TYPE = Symbol.for("react.context"),
13736
- + REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
13737
- + REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
13738
- + REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
13739
- + REACT_MEMO_TYPE = Symbol.for("react.memo"),
13740
- + REACT_LAZY_TYPE = Symbol.for("react.lazy"),
13741
- + REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
13742
- + REACT_POSTPONE_TYPE = Symbol.for("react.postpone"),
13743
- + REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
13744
- + MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
13745
- +function getIteratorFn(maybeIterable) {
13746
- + if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
13747
- + maybeIterable =
13748
- + (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
13749
- + maybeIterable["@@iterator"];
13750
- + return "function" === typeof maybeIterable ? maybeIterable : null;
13751
- +}
13752
- +var ASYNC_ITERATOR = Symbol.asyncIterator,
13753
- + SuspenseException = Error(
13754
- + "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
13755
- + );
13756
- +function noop$1() {}
13757
- +function trackUsedThenable(thenableState, thenable, index) {
13758
- + index = thenableState[index];
13759
- + void 0 === index
13760
- + ? thenableState.push(thenable)
13761
- + : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index));
13762
- + switch (thenable.status) {
13763
- + case "fulfilled":
13764
- + return thenable.value;
13765
- + case "rejected":
13766
- + throw thenable.reason;
13767
- + default:
13768
- + "string" === typeof thenable.status
13769
- + ? thenable.then(noop$1, noop$1)
13770
- + : ((thenableState = thenable),
13771
- + (thenableState.status = "pending"),
13772
- + thenableState.then(
13773
- + function (fulfilledValue) {
13774
- + if ("pending" === thenable.status) {
13775
- + var fulfilledThenable = thenable;
13776
- + fulfilledThenable.status = "fulfilled";
13777
- + fulfilledThenable.value = fulfilledValue;
13778
- + }
13779
- + },
13780
- + function (error) {
13781
- + if ("pending" === thenable.status) {
13782
- + var rejectedThenable = thenable;
13783
- + rejectedThenable.status = "rejected";
13784
- + rejectedThenable.reason = error;
13785
- + }
13786
- + }
13787
- + ));
13788
- + switch (thenable.status) {
13789
- + case "fulfilled":
13790
- + return thenable.value;
13791
- + case "rejected":
13792
- + throw thenable.reason;
13793
- + }
13794
- + suspendedThenable = thenable;
13795
- + throw SuspenseException;
13796
- + }
13797
- +}
13798
- +var suspendedThenable = null;
13799
- +function getSuspendedThenable() {
13800
- + if (null === suspendedThenable)
13801
- + throw Error(
13802
- + "Expected a suspended thenable. This is a bug in React. Please file an issue."
13803
- + );
13804
- + var thenable = suspendedThenable;
13805
- + suspendedThenable = null;
13806
- + return thenable;
13807
- +}
13808
- +var currentRequest$1 = null,
13809
- + thenableIndexCounter = 0,
13810
- + thenableState = null;
13811
- +function getThenableStateAfterSuspending() {
13812
- + var state = thenableState || [];
13813
- + thenableState = null;
13814
- + return state;
13815
- +}
13816
- +var HooksDispatcher = {
13817
- + useMemo: function (nextCreate) {
13818
- + return nextCreate();
13819
- + },
13820
- + useCallback: function (callback) {
13821
- + return callback;
13822
- + },
13823
- + useDebugValue: function () {},
13824
- + useDeferredValue: unsupportedHook,
13825
- + useTransition: unsupportedHook,
13826
- + readContext: unsupportedContext,
13827
- + useContext: unsupportedContext,
13828
- + useReducer: unsupportedHook,
13829
- + useRef: unsupportedHook,
13830
- + useState: unsupportedHook,
13831
- + useInsertionEffect: unsupportedHook,
13832
- + useLayoutEffect: unsupportedHook,
13833
- + useImperativeHandle: unsupportedHook,
13834
- + useEffect: unsupportedHook,
13835
- + useId: useId,
13836
- + useHostTransitionStatus: unsupportedHook,
13837
- + useOptimistic: unsupportedHook,
13838
- + useFormState: unsupportedHook,
13839
- + useActionState: unsupportedHook,
13840
- + useSyncExternalStore: unsupportedHook,
13841
- + useCacheRefresh: function () {
13842
- + return unsupportedRefresh;
13843
- + },
13844
- + useMemoCache: function (size) {
13845
- + for (var data = Array(size), i = 0; i < size; i++)
13846
- + data[i] = REACT_MEMO_CACHE_SENTINEL;
13847
- + return data;
13848
- + },
13849
- + use: use
13850
- +};
13851
- +function unsupportedHook() {
13852
- + throw Error("This Hook is not supported in Server Components.");
13853
- +}
13854
- +function unsupportedRefresh() {
13855
- + throw Error("Refreshing the cache is not supported in Server Components.");
13856
- +}
13857
- +function unsupportedContext() {
13858
- + throw Error("Cannot read a Client Context from a Server Component.");
13859
- +}
13860
- +function useId() {
13861
- + if (null === currentRequest$1)
13862
- + throw Error("useId can only be used while React is rendering");
13863
- + var id = currentRequest$1.identifierCount++;
13864
- + return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":";
13865
- +}
13866
- +function use(usable) {
13867
- + if (
13868
- + (null !== usable && "object" === typeof usable) ||
13869
- + "function" === typeof usable
13870
- + ) {
13871
- + if ("function" === typeof usable.then) {
13872
- + var index = thenableIndexCounter;
13873
- + thenableIndexCounter += 1;
13874
- + null === thenableState && (thenableState = []);
13875
- + return trackUsedThenable(thenableState, usable, index);
13876
- + }
13877
- + usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
13878
- + }
13879
- + if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
13880
- + if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
13881
- + throw Error("Cannot read a Client Context from a Server Component.");
13882
- + throw Error("Cannot use() an already resolved Client Reference.");
13883
- + }
13884
- + throw Error("An unsupported type was passed to use(): " + String(usable));
13885
- +}
13886
- +var DefaultAsyncDispatcher = {
13887
- + getCacheForType: function (resourceType) {
13888
- + var JSCompiler_inline_result = (JSCompiler_inline_result =
13889
- + resolveRequest())
13890
- + ? JSCompiler_inline_result.cache
13891
- + : new Map();
13892
- + var entry = JSCompiler_inline_result.get(resourceType);
13893
- + void 0 === entry &&
13894
- + ((entry = resourceType()),
13895
- + JSCompiler_inline_result.set(resourceType, entry));
13896
- + return entry;
13897
- + }
13898
- + },
13899
- + ReactSharedInternalsServer =
13900
- + React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
13901
- +if (!ReactSharedInternalsServer)
13902
- + throw Error(
13903
- + 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
13904
- + );
13905
- +var isArrayImpl = Array.isArray,
13906
- + getPrototypeOf = Object.getPrototypeOf;
13907
- +function objectName(object) {
13908
- + return Object.prototype.toString
13909
- + .call(object)
13910
- + .replace(/^\[object (.*)\]$/, function (m, p0) {
13911
- + return p0;
13912
- + });
13913
- +}
13914
- +function describeValueForErrorMessage(value) {
13915
- + switch (typeof value) {
13916
- + case "string":
13917
- + return JSON.stringify(
13918
- + 10 >= value.length ? value : value.slice(0, 10) + "..."
13919
- + );
13920
- + case "object":
13921
- + if (isArrayImpl(value)) return "[...]";
13922
- + if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
13923
- + return "client";
13924
- + value = objectName(value);
13925
- + return "Object" === value ? "{...}" : value;
13926
- + case "function":
13927
- + return value.$$typeof === CLIENT_REFERENCE_TAG
13928
- + ? "client"
13929
- + : (value = value.displayName || value.name)
13930
- + ? "function " + value
13931
- + : "function";
13932
- + default:
13933
- + return String(value);
13934
- + }
13935
- +}
13936
- +function describeElementType(type) {
13937
- + if ("string" === typeof type) return type;
13938
- + switch (type) {
13939
- + case REACT_SUSPENSE_TYPE:
13940
- + return "Suspense";
13941
- + case REACT_SUSPENSE_LIST_TYPE:
13942
- + return "SuspenseList";
13943
- + case REACT_VIEW_TRANSITION_TYPE:
13944
- + return "ViewTransition";
13945
- + }
13946
- + if ("object" === typeof type)
13947
- + switch (type.$$typeof) {
13948
- + case REACT_FORWARD_REF_TYPE:
13949
- + return describeElementType(type.render);
13950
- + case REACT_MEMO_TYPE:
13951
- + return describeElementType(type.type);
13952
- + case REACT_LAZY_TYPE:
13953
- + var payload = type._payload;
13954
- + type = type._init;
13955
- + try {
13956
- + return describeElementType(type(payload));
13957
- + } catch (x) {}
13958
- + }
13959
- + return "";
13960
- +}
13961
- +var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
13962
- +function describeObjectForErrorMessage(objectOrArray, expandedName) {
13963
- + var objKind = objectName(objectOrArray);
13964
- + if ("Object" !== objKind && "Array" !== objKind) return objKind;
13965
- + objKind = -1;
13966
- + var length = 0;
13967
- + if (isArrayImpl(objectOrArray)) {
13968
- + var str = "[";
13969
- + for (var i = 0; i < objectOrArray.length; i++) {
13970
- + 0 < i && (str += ", ");
13971
- + var value = objectOrArray[i];
13972
- + value =
13973
- + "object" === typeof value && null !== value
13974
- + ? describeObjectForErrorMessage(value)
13975
- + : describeValueForErrorMessage(value);
13976
- + "" + i === expandedName
13977
- + ? ((objKind = str.length), (length = value.length), (str += value))
13978
- + : (str =
13979
- + 10 > value.length && 40 > str.length + value.length
13980
- + ? str + value
13981
- + : str + "...");
13982
- + }
13983
- + str += "]";
13984
- + } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
13985
- + str = "<" + describeElementType(objectOrArray.type) + "/>";
13986
- + else {
13987
- + if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
13988
- + str = "{";
13989
- + i = Object.keys(objectOrArray);
13990
- + for (value = 0; value < i.length; value++) {
13991
- + 0 < value && (str += ", ");
13992
- + var name = i[value],
13993
- + encodedKey = JSON.stringify(name);
13994
- + str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
13995
- + encodedKey = objectOrArray[name];
13996
- + encodedKey =
13997
- + "object" === typeof encodedKey && null !== encodedKey
13998
- + ? describeObjectForErrorMessage(encodedKey)
13999
- + : describeValueForErrorMessage(encodedKey);
14000
- + name === expandedName
14001
- + ? ((objKind = str.length),
14002
- + (length = encodedKey.length),
14003
- + (str += encodedKey))
14004
- + : (str =
14005
- + 10 > encodedKey.length && 40 > str.length + encodedKey.length
14006
- + ? str + encodedKey
14007
- + : str + "...");
14008
- + }
14009
- + str += "}";
14010
- + }
14011
- + return void 0 === expandedName
14012
- + ? str
14013
- + : -1 < objKind && 0 < length
14014
- + ? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
14015
- + "\n " + str + "\n " + objectOrArray)
14016
- + : "\n " + str;
14017
- +}
14018
- +var ObjectPrototype = Object.prototype,
14019
- + stringify = JSON.stringify,
14020
- + TaintRegistryObjects = ReactSharedInternalsServer.TaintRegistryObjects,
14021
- + TaintRegistryValues = ReactSharedInternalsServer.TaintRegistryValues,
14022
- + TaintRegistryByteLengths =
14023
- + ReactSharedInternalsServer.TaintRegistryByteLengths,
14024
- + TaintRegistryPendingRequests =
14025
- + ReactSharedInternalsServer.TaintRegistryPendingRequests;
14026
- +function throwTaintViolation(message) {
14027
- + throw Error(message);
14028
- +}
14029
- +function cleanupTaintQueue(request) {
14030
- + request = request.taintCleanupQueue;
14031
- + TaintRegistryPendingRequests.delete(request);
14032
- + for (var i = 0; i < request.length; i++) {
14033
- + var entryValue = request[i],
14034
- + entry = TaintRegistryValues.get(entryValue);
14035
- + void 0 !== entry &&
14036
- + (1 === entry.count
14037
- + ? TaintRegistryValues.delete(entryValue)
14038
- + : entry.count--);
14039
- + }
14040
- + request.length = 0;
14041
- +}
14042
- +function defaultErrorHandler(error) {
14043
- + console.error(error);
14044
- +}
14045
- +function defaultPostponeHandler() {}
14046
- +function RequestInstance(
14047
- + type,
14048
- + model,
14049
- + bundlerConfig,
14050
- + onError,
14051
- + identifierPrefix,
14052
- + onPostpone,
14053
- + temporaryReferences,
14054
- + environmentName,
14055
- + filterStackFrame,
14056
- + onAllReady,
14057
- + onFatalError
14058
- +) {
14059
- + if (
14060
- + null !== ReactSharedInternalsServer.A &&
14061
- + ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
14062
- + )
14063
- + throw Error("Currently React only supports one RSC renderer at a time.");
14064
- + ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
14065
- + filterStackFrame = new Set();
14066
- + environmentName = [];
14067
- + var cleanupQueue = [];
14068
- + TaintRegistryPendingRequests.add(cleanupQueue);
14069
- + var hints = new Set();
14070
- + this.type = type;
14071
- + this.status = 10;
14072
- + this.flushScheduled = !1;
14073
- + this.destination = this.fatalError = null;
14074
- + this.bundlerConfig = bundlerConfig;
14075
- + this.cache = new Map();
14076
- + this.pendingChunks = this.nextChunkId = 0;
14077
- + this.hints = hints;
14078
- + this.abortListeners = new Set();
14079
- + this.abortableTasks = filterStackFrame;
14080
- + this.pingedTasks = environmentName;
14081
- + this.completedImportChunks = [];
14082
- + this.completedHintChunks = [];
14083
- + this.completedRegularChunks = [];
14084
- + this.completedErrorChunks = [];
14085
- + this.writtenSymbols = new Map();
14086
- + this.writtenClientReferences = new Map();
14087
- + this.writtenServerReferences = new Map();
14088
- + this.writtenObjects = new WeakMap();
14089
- + this.temporaryReferences = temporaryReferences;
14090
- + this.identifierPrefix = identifierPrefix || "";
14091
- + this.identifierCount = 1;
14092
- + this.taintCleanupQueue = cleanupQueue;
14093
- + this.onError = void 0 === onError ? defaultErrorHandler : onError;
14094
- + this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
14095
- + this.onAllReady = onAllReady;
14096
- + this.onFatalError = onFatalError;
14097
- + type = createTask(this, model, null, !1, filterStackFrame);
14098
- + environmentName.push(type);
14099
- +}
14100
- +function noop() {}
14101
- +var currentRequest = null;
14102
- +function resolveRequest() {
14103
- + if (currentRequest) return currentRequest;
14104
- + var store = requestStorage.getStore();
14105
- + return store ? store : null;
14106
- +}
14107
- +function serializeThenable(request, task, thenable) {
14108
- + var newTask = createTask(
14109
- + request,
14110
- + null,
14111
- + task.keyPath,
14112
- + task.implicitSlot,
14113
- + request.abortableTasks
14114
- + );
14115
- + switch (thenable.status) {
14116
- + case "fulfilled":
14117
- + return (
14118
- + (newTask.model = thenable.value), pingTask(request, newTask), newTask.id
14119
- + );
14120
- + case "rejected":
14121
- + return erroredTask(request, newTask, thenable.reason), newTask.id;
14122
- + default:
14123
- + if (12 === request.status)
14124
- + return (
14125
- + request.abortableTasks.delete(newTask),
14126
- + (newTask.status = 3),
14127
- + 21 === request.type
14128
- + ? request.pendingChunks--
14129
- + : ((task = stringify(serializeByValueID(request.fatalError))),
14130
- + emitModelChunk(request, newTask.id, task)),
14131
- + newTask.id
14132
- + );
14133
- + "string" !== typeof thenable.status &&
14134
- + ((thenable.status = "pending"),
14135
- + thenable.then(
14136
- + function (fulfilledValue) {
14137
- + "pending" === thenable.status &&
14138
- + ((thenable.status = "fulfilled"),
14139
- + (thenable.value = fulfilledValue));
14140
- + },
14141
- + function (error) {
14142
- + "pending" === thenable.status &&
14143
- + ((thenable.status = "rejected"), (thenable.reason = error));
14144
- + }
14145
- + ));
14146
- + }
14147
- + thenable.then(
14148
- + function (value) {
14149
- + newTask.model = value;
14150
- + pingTask(request, newTask);
14151
- + },
14152
- + function (reason) {
14153
- + 0 === newTask.status &&
14154
- + (erroredTask(request, newTask, reason), enqueueFlush(request));
14155
- + }
14156
- + );
14157
- + return newTask.id;
14158
- +}
14159
- +function serializeReadableStream(request, task, stream) {
14160
- + function progress(entry) {
14161
- + if (!aborted)
14162
- + if (entry.done)
14163
- + request.abortListeners.delete(abortStream),
14164
- + (entry = streamTask.id.toString(16) + ":C\n"),
14165
- + request.completedRegularChunks.push(entry),
14166
- + enqueueFlush(request),
14167
- + (aborted = !0);
14168
- + else
14169
- + try {
14170
- + (streamTask.model = entry.value),
14171
- + request.pendingChunks++,
14172
- + emitChunk(request, streamTask, streamTask.model),
14173
- + enqueueFlush(request),
14174
- + reader.read().then(progress, error);
14175
- + } catch (x$7) {
14176
- + error(x$7);
14177
- + }
14178
- + }
14179
- + function error(reason) {
14180
- + aborted ||
14181
- + ((aborted = !0),
14182
- + request.abortListeners.delete(abortStream),
14183
- + erroredTask(request, streamTask, reason),
14184
- + enqueueFlush(request),
14185
- + reader.cancel(reason).then(error, error));
14186
- + }
14187
- + function abortStream(reason) {
14188
- + aborted ||
14189
- + ((aborted = !0),
14190
- + request.abortListeners.delete(abortStream),
14191
- + 21 === request.type
14192
- + ? request.pendingChunks--
14193
- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)),
14194
- + reader.cancel(reason).then(error, error));
14195
- + }
14196
- + var supportsBYOB = stream.supportsBYOB;
14197
- + if (void 0 === supportsBYOB)
14198
- + try {
14199
- + stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
14200
- + } catch (x) {
14201
- + supportsBYOB = !1;
14202
- + }
14203
- + var reader = stream.getReader(),
14204
- + streamTask = createTask(
14205
- + request,
14206
- + task.model,
14207
- + task.keyPath,
14208
- + task.implicitSlot,
14209
- + request.abortableTasks
14210
- + );
14211
- + request.abortableTasks.delete(streamTask);
14212
- + request.pendingChunks++;
14213
- + task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
14214
- + request.completedRegularChunks.push(task);
14215
- + var aborted = !1;
14216
- + request.abortListeners.add(abortStream);
14217
- + reader.read().then(progress, error);
14218
- + return serializeByValueID(streamTask.id);
14219
- +}
14220
- +function serializeAsyncIterable(request, task, iterable, iterator) {
14221
- + function progress(entry) {
14222
- + if (!aborted)
14223
- + if (entry.done) {
14224
- + request.abortListeners.delete(abortIterable);
14225
- + if (void 0 === entry.value)
14226
- + var endStreamRow = streamTask.id.toString(16) + ":C\n";
14227
- + else
14228
- + try {
14229
- + var chunkId = outlineModel(request, entry.value);
14230
- + endStreamRow =
14231
- + streamTask.id.toString(16) +
14232
- + ":C" +
14233
- + stringify(serializeByValueID(chunkId)) +
14234
- + "\n";
14235
- + } catch (x) {
14236
- + error(x);
14237
- + return;
14238
- + }
14239
- + request.completedRegularChunks.push(endStreamRow);
14240
- + enqueueFlush(request);
14241
- + aborted = !0;
14242
- + } else
14243
- + try {
14244
- + (streamTask.model = entry.value),
14245
- + request.pendingChunks++,
14246
- + emitChunk(request, streamTask, streamTask.model),
14247
- + enqueueFlush(request),
14248
- + iterator.next().then(progress, error);
14249
- + } catch (x$8) {
14250
- + error(x$8);
14251
- + }
14252
- + }
14253
- + function error(reason) {
14254
- + aborted ||
14255
- + ((aborted = !0),
14256
- + request.abortListeners.delete(abortIterable),
14257
- + erroredTask(request, streamTask, reason),
14258
- + enqueueFlush(request),
14259
- + "function" === typeof iterator.throw &&
14260
- + iterator.throw(reason).then(error, error));
14261
- + }
14262
- + function abortIterable(reason) {
14263
- + aborted ||
14264
- + ((aborted = !0),
14265
- + request.abortListeners.delete(abortIterable),
14266
- + 21 === request.type
14267
- + ? request.pendingChunks--
14268
- + : (erroredTask(request, streamTask, reason), enqueueFlush(request)),
14269
- + "function" === typeof iterator.throw &&
14270
- + iterator.throw(reason).then(error, error));
14271
- + }
14272
- + iterable = iterable === iterator;
14273
- + var streamTask = createTask(
14274
- + request,
14275
- + task.model,
14276
- + task.keyPath,
14277
- + task.implicitSlot,
14278
- + request.abortableTasks
14279
- + );
14280
- + request.abortableTasks.delete(streamTask);
14281
- + request.pendingChunks++;
14282
- + task = streamTask.id.toString(16) + ":" + (iterable ? "x" : "X") + "\n";
14283
- + request.completedRegularChunks.push(task);
14284
- + var aborted = !1;
14285
- + request.abortListeners.add(abortIterable);
14286
- + iterator.next().then(progress, error);
14287
- + return serializeByValueID(streamTask.id);
14288
- +}
14289
- +function emitHint(request, code, model) {
14290
- + model = stringify(model);
14291
- + request.completedHintChunks.push(":H" + code + model + "\n");
14292
- + enqueueFlush(request);
14293
- +}
14294
- +function readThenable(thenable) {
14295
- + if ("fulfilled" === thenable.status) return thenable.value;
14296
- + if ("rejected" === thenable.status) throw thenable.reason;
14297
- + throw thenable;
14298
- +}
14299
- +function createLazyWrapperAroundWakeable(wakeable) {
14300
- + switch (wakeable.status) {
14301
- + case "fulfilled":
14302
- + case "rejected":
14303
- + break;
14304
- + default:
14305
- + "string" !== typeof wakeable.status &&
14306
- + ((wakeable.status = "pending"),
14307
- + wakeable.then(
14308
- + function (fulfilledValue) {
14309
- + "pending" === wakeable.status &&
14310
- + ((wakeable.status = "fulfilled"),
14311
- + (wakeable.value = fulfilledValue));
14312
- + },
14313
- + function (error) {
14314
- + "pending" === wakeable.status &&
14315
- + ((wakeable.status = "rejected"), (wakeable.reason = error));
14316
- + }
14317
- + ));
14318
- + }
14319
- + return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
14320
- +}
14321
- +function voidHandler() {}
14322
- +function processServerComponentReturnValue(request, task, Component, result) {
14323
- + if (
14324
- + "object" !== typeof result ||
14325
- + null === result ||
14326
- + result.$$typeof === CLIENT_REFERENCE_TAG$1
14327
- + )
14328
- + return result;
14329
- + if ("function" === typeof result.then)
14330
- + return "fulfilled" === result.status
14331
- + ? result.value
14332
- + : createLazyWrapperAroundWakeable(result);
14333
- + var iteratorFn = getIteratorFn(result);
14334
- + return iteratorFn
14335
- + ? ((request = {}),
14336
- + (request[Symbol.iterator] = function () {
14337
- + return iteratorFn.call(result);
14338
- + }),
14339
- + request)
14340
- + : "function" !== typeof result[ASYNC_ITERATOR] ||
14341
- + ("function" === typeof ReadableStream &&
14342
- + result instanceof ReadableStream)
14343
- + ? result
14344
- + : ((request = {}),
14345
- + (request[ASYNC_ITERATOR] = function () {
14346
- + return result[ASYNC_ITERATOR]();
14347
- + }),
14348
- + request);
14349
- +}
14350
- +function renderFunctionComponent(request, task, key, Component, props) {
14351
- + var prevThenableState = task.thenableState;
14352
- + task.thenableState = null;
14353
- + thenableIndexCounter = 0;
14354
- + thenableState = prevThenableState;
14355
- + props = Component(props, void 0);
14356
- + if (12 === request.status)
14357
- + throw (
14358
- + ("object" === typeof props &&
14359
- + null !== props &&
14360
- + "function" === typeof props.then &&
14361
- + props.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
14362
- + props.then(voidHandler, voidHandler),
14363
- + null)
14364
- + );
14365
- + props = processServerComponentReturnValue(request, task, Component, props);
14366
- + Component = task.keyPath;
14367
- + prevThenableState = task.implicitSlot;
14368
- + null !== key
14369
- + ? (task.keyPath = null === Component ? key : Component + "," + key)
14370
- + : null === Component && (task.implicitSlot = !0);
14371
- + request = renderModelDestructive(request, task, emptyRoot, "", props);
14372
- + task.keyPath = Component;
14373
- + task.implicitSlot = prevThenableState;
14374
- + return request;
14375
- +}
14376
- +function renderFragment(request, task, children) {
14377
- + return null !== task.keyPath
14378
- + ? ((request = [
14379
- + REACT_ELEMENT_TYPE,
14380
- + REACT_FRAGMENT_TYPE,
14381
- + task.keyPath,
14382
- + { children: children }
14383
- + ]),
14384
- + task.implicitSlot ? [request] : request)
14385
- + : children;
14386
- +}
14387
- +function renderElement(request, task, type, key, ref, props) {
14388
- + if (null !== ref && void 0 !== ref)
14389
- + throw Error(
14390
- + "Refs cannot be used in Server Components, nor passed to Client Components."
14391
- + );
14392
- + if (
14393
- + "function" === typeof type &&
14394
- + type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
14395
- + type.$$typeof !== TEMPORARY_REFERENCE_TAG
14396
- + )
14397
- + return renderFunctionComponent(request, task, key, type, props);
14398
- + if (type === REACT_FRAGMENT_TYPE && null === key)
14399
- + return (
14400
- + (type = task.implicitSlot),
14401
- + null === task.keyPath && (task.implicitSlot = !0),
14402
- + (props = renderModelDestructive(
14403
- + request,
14404
- + task,
14405
- + emptyRoot,
14406
- + "",
14407
- + props.children
14408
- + )),
14409
- + (task.implicitSlot = type),
14410
- + props
14411
- + );
14412
- + if (
14413
- + null != type &&
14414
- + "object" === typeof type &&
14415
- + type.$$typeof !== CLIENT_REFERENCE_TAG$1
14416
- + )
14417
- + switch (type.$$typeof) {
14418
- + case REACT_LAZY_TYPE:
14419
- + var init = type._init;
14420
- + type = init(type._payload);
14421
- + if (12 === request.status) throw null;
14422
- + return renderElement(request, task, type, key, ref, props);
14423
- + case REACT_FORWARD_REF_TYPE:
14424
- + return renderFunctionComponent(request, task, key, type.render, props);
14425
- + case REACT_MEMO_TYPE:
14426
- + return renderElement(request, task, type.type, key, ref, props);
14427
- + }
14428
- + request = key;
14429
- + key = task.keyPath;
14430
- + null === request
14431
- + ? (request = key)
14432
- + : null !== key && (request = key + "," + request);
14433
- + props = [REACT_ELEMENT_TYPE, type, request, props];
14434
- + task = task.implicitSlot && null !== request ? [props] : props;
14435
- + return task;
14436
- +}
14437
- +function pingTask(request, task) {
14438
- + var pingedTasks = request.pingedTasks;
14439
- + pingedTasks.push(task);
14440
- + 1 === pingedTasks.length &&
14441
- + ((request.flushScheduled = null !== request.destination),
14442
- + 21 === request.type || 10 === request.status
14443
- + ? scheduleMicrotask(function () {
14444
- + return performWork(request);
14445
- + })
14446
- + : setImmediate(function () {
14447
- + return performWork(request);
14448
- + }));
14449
- +}
14450
- +function createTask(request, model, keyPath, implicitSlot, abortSet) {
14451
- + request.pendingChunks++;
14452
- + var id = request.nextChunkId++;
14453
- + "object" !== typeof model ||
14454
- + null === model ||
14455
- + null !== keyPath ||
14456
- + implicitSlot ||
14457
- + request.writtenObjects.set(model, serializeByValueID(id));
14458
- + var task = {
14459
- + id: id,
14460
- + status: 0,
14461
- + model: model,
14462
- + keyPath: keyPath,
14463
- + implicitSlot: implicitSlot,
14464
- + ping: function () {
14465
- + return pingTask(request, task);
14466
- + },
14467
- + toJSON: function (parentPropertyName, value) {
14468
- + var prevKeyPath = task.keyPath,
14469
- + prevImplicitSlot = task.implicitSlot;
14470
- + try {
14471
- + var JSCompiler_inline_result = renderModelDestructive(
14472
- + request,
14473
- + task,
14474
- + this,
14475
- + parentPropertyName,
14476
- + value
14477
- + );
14478
- + } catch (thrownValue) {
14479
- + if (
14480
- + ((parentPropertyName = task.model),
14481
- + (parentPropertyName =
14482
- + "object" === typeof parentPropertyName &&
14483
- + null !== parentPropertyName &&
14484
- + (parentPropertyName.$$typeof === REACT_ELEMENT_TYPE ||
14485
- + parentPropertyName.$$typeof === REACT_LAZY_TYPE)),
14486
- + 12 === request.status)
14487
- + )
14488
- + (task.status = 3),
14489
- + 21 === request.type
14490
- + ? ((prevKeyPath = request.nextChunkId++),
14491
- + (prevKeyPath = parentPropertyName
14492
- + ? "$L" + prevKeyPath.toString(16)
14493
- + : serializeByValueID(prevKeyPath)),
14494
- + (JSCompiler_inline_result = prevKeyPath))
14495
- + : ((prevKeyPath = request.fatalError),
14496
- + (JSCompiler_inline_result = parentPropertyName
14497
- + ? "$L" + prevKeyPath.toString(16)
14498
- + : serializeByValueID(prevKeyPath)));
14499
- + else if (
14500
- + ((value =
14501
- + thrownValue === SuspenseException
14502
- + ? getSuspendedThenable()
14503
- + : thrownValue),
14504
- + "object" === typeof value &&
14505
- + null !== value &&
14506
- + "function" === typeof value.then)
14507
- + ) {
14508
- + JSCompiler_inline_result = createTask(
14509
- + request,
14510
- + task.model,
14511
- + task.keyPath,
14512
- + task.implicitSlot,
14513
- + request.abortableTasks
14514
- + );
14515
- + var ping = JSCompiler_inline_result.ping;
14516
- + value.then(ping, ping);
14517
- + JSCompiler_inline_result.thenableState =
14518
- + getThenableStateAfterSuspending();
14519
- + task.k
@@ -0,0 +1,68 @@
1
+ import fs from 'node:fs/promises'
2
+ import path from 'node:path'
3
+
4
+
5
+ /**
6
+ * Bumps the version of the package.
7
+ * @param {'major' | 'minor' | 'patch'} type - The type of version to bump.
8
+ */
9
+ async function bumpVersion(type) {
10
+ // Read package.json
11
+ const packageJson = JSON.parse(
12
+ await fs.readFile(path.resolve('package.json'), 'utf-8')
13
+ )
14
+ const packageLockJson = JSON.parse(
15
+ await fs.readFile(path.resolve('package-lock.json'), 'utf-8')
16
+ )
17
+
18
+ // Parse current version
19
+ const [major, minor, patch] = packageJson.version.split('.').map(Number)
20
+
21
+ // Calculate new version
22
+ /**
23
+ * The new version of the package.
24
+ * @type {string}
25
+ */
26
+ let newVersion
27
+ switch (type) {
28
+ case 'major':
29
+ newVersion = `${major + 1}.0.0`
30
+ break
31
+ case 'minor':
32
+ newVersion = `${major}.${minor + 1}.0`
33
+ break
34
+ case 'patch':
35
+ newVersion = `${major}.${minor}.${patch + 1}`
36
+ break
37
+ }
38
+
39
+ // Update both files
40
+ packageJson.version = newVersion
41
+ packageLockJson.version = newVersion
42
+ packageLockJson.packages[''].version = newVersion
43
+
44
+ // Write back
45
+ await fs.writeFile(
46
+ path.resolve('package.json'),
47
+ JSON.stringify(packageJson, null, 2) + '\n'
48
+ )
49
+ await fs.writeFile(
50
+ path.resolve('package-lock.json'),
51
+ JSON.stringify(packageLockJson, null, 2) + '\n'
52
+ )
53
+
54
+ console.log(`Version bumped to ${newVersion}`)
55
+ }
56
+
57
+ // Get version type from command line argument
58
+ /**
59
+ * The type of version to bump.
60
+ * @type {'major' | 'minor' | 'patch'}
61
+ */
62
+ const type = process.argv[2]
63
+ if (!type || !['major', 'minor', 'patch'].includes(type)) {
64
+ console.error('Please specify version type: major, minor, or patch')
65
+ process.exit(1)
66
+ }
67
+
68
+ bumpVersion(type).catch(console.error)
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs/promises'
3
+ import path from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
7
+
8
+ const PATCH_RECONCILER_VERSION = '19.1.0-experimental-b3a95caf-20250113'
9
+ const ALTERNATIVE_REACT_VERSION = '0.0.0-experimental-b3a95caf-20250113'
10
+ const STUB_ESM_VERSION = `0.0.1`
11
+ const PATCH_FILE = `react-server-dom-esm+${STUB_ESM_VERSION}.patch`
12
+
13
+ async function main() {
14
+ try {
15
+ // Read installed React version
16
+ const reactPkgPath = path.resolve(process.cwd(), 'node_modules/react/package.json')
17
+ const reactPkg = JSON.parse(await fs.readFile(reactPkgPath, 'utf-8'))
18
+ const installedVersion = reactPkg.version
19
+
20
+ // Get our patch file from our package
21
+ const ourPatchPath = path.resolve(__dirname, `../patches/${PATCH_FILE}`)
22
+ let patchContent = await fs.readFile(ourPatchPath, 'utf-8')
23
+
24
+ // Replace the version in the patch content
25
+ patchContent = patchContent.replace(
26
+ new RegExp(PATCH_RECONCILER_VERSION, 'g'),
27
+ installedVersion
28
+ ).replace(
29
+ new RegExp(ALTERNATIVE_REACT_VERSION, 'g'),
30
+ installedVersion
31
+ )
32
+
33
+ // Create patches dir in user's project
34
+ const userPatchesDir = path.resolve(process.cwd(), 'patches')
35
+ await fs.mkdir(userPatchesDir, { recursive: true })
36
+
37
+ // Write the patch file - use stub version for filename
38
+ const newFileName = `react-server-dom-esm+${STUB_ESM_VERSION}.patch`
39
+ const newPatchPath = path.resolve(userPatchesDir, newFileName)
40
+ await fs.writeFile(newPatchPath, patchContent)
41
+
42
+ console.log(`Updated patch to match React version ${installedVersion}`)
43
+ } catch (error) {
44
+
45
+ }
46
+ }
47
+
48
+ main()