react-on-rails-rsc 19.2.0 → 19.2.1-rc.1

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 (65) hide show
  1. package/CHANGELOG.md +52 -2
  2. package/README.md +17 -15
  3. package/dist/RSCReferenceDiscoveryPlugin.d.ts.map +1 -1
  4. package/dist/RSCReferenceDiscoveryPlugin.js +2 -2
  5. package/dist/RSCReferenceDiscoveryPlugin.js.map +1 -1
  6. package/dist/WebpackPlugin.d.ts +2 -0
  7. package/dist/WebpackPlugin.d.ts.map +1 -1
  8. package/dist/WebpackPlugin.js.map +1 -1
  9. package/dist/clientReferences.d.ts +21 -0
  10. package/dist/clientReferences.d.ts.map +1 -1
  11. package/dist/clientReferences.js +22 -0
  12. package/dist/clientReferences.js.map +1 -1
  13. package/dist/entryClientReferences.d.ts +115 -0
  14. package/dist/entryClientReferences.d.ts.map +1 -0
  15. package/dist/entryClientReferences.js +184 -0
  16. package/dist/entryClientReferences.js.map +1 -0
  17. package/dist/flight-server.browser.d.ts +2 -1
  18. package/dist/flight-server.browser.d.ts.map +1 -1
  19. package/dist/flight-server.browser.js +11 -1
  20. package/dist/flight-server.browser.js.map +1 -1
  21. package/dist/flight-server.d.ts +11 -1
  22. package/dist/flight-server.d.ts.map +1 -1
  23. package/dist/flight-server.edge.d.ts +2 -1
  24. package/dist/flight-server.edge.d.ts.map +1 -1
  25. package/dist/flight-server.edge.js +11 -1
  26. package/dist/flight-server.edge.js.map +1 -1
  27. package/dist/flight-server.js +10 -1
  28. package/dist/flight-server.js.map +1 -1
  29. package/dist/flight-server.node.d.ts +2 -1
  30. package/dist/flight-server.node.d.ts.map +1 -1
  31. package/dist/flight-server.node.js +11 -1
  32. package/dist/flight-server.node.js.map +1 -1
  33. package/dist/flight-server.node.unbundled.d.ts +2 -1
  34. package/dist/flight-server.node.unbundled.d.ts.map +1 -1
  35. package/dist/flight-server.node.unbundled.js +11 -1
  36. package/dist/flight-server.node.unbundled.js.map +1 -1
  37. package/dist/flight-stylesheet-hints.d.ts +1 -0
  38. package/dist/flight-stylesheet-hints.d.ts.map +1 -1
  39. package/dist/flight-stylesheet-hints.js +3 -3
  40. package/dist/flight-stylesheet-hints.js.map +1 -1
  41. package/dist/react-server-dom-rspack/injection-loader.d.ts +13 -3
  42. package/dist/react-server-dom-rspack/injection-loader.d.ts.map +1 -1
  43. package/dist/react-server-dom-rspack/injection-loader.js +90 -9
  44. package/dist/react-server-dom-rspack/injection-loader.js.map +1 -1
  45. package/dist/react-server-dom-rspack/loader.d.ts +3 -14
  46. package/dist/react-server-dom-rspack/loader.d.ts.map +1 -1
  47. package/dist/react-server-dom-rspack/loader.js +3 -53
  48. package/dist/react-server-dom-rspack/loader.js.map +1 -1
  49. package/dist/react-server-dom-rspack/plugin.d.ts +56 -18
  50. package/dist/react-server-dom-rspack/plugin.d.ts.map +1 -1
  51. package/dist/react-server-dom-rspack/plugin.js +473 -99
  52. package/dist/react-server-dom-rspack/plugin.js.map +1 -1
  53. package/dist/react-server-dom-rspack/shared.d.ts +1 -12
  54. package/dist/react-server-dom-rspack/shared.d.ts.map +1 -1
  55. package/dist/react-server-dom-rspack/shared.js +6 -14
  56. package/dist/react-server-dom-rspack/shared.js.map +1 -1
  57. package/dist/resource-hints.d.ts +22 -0
  58. package/dist/resource-hints.d.ts.map +1 -0
  59. package/dist/resource-hints.js +50 -0
  60. package/dist/resource-hints.js.map +1 -0
  61. package/dist/webpack/RSCWebpackPlugin.d.ts +21 -2
  62. package/dist/webpack/RSCWebpackPlugin.d.ts.map +1 -1
  63. package/dist/webpack/RSCWebpackPlugin.js +337 -55
  64. package/dist/webpack/RSCWebpackPlugin.js.map +1 -1
  65. package/package.json +10 -4
package/CHANGELOG.md CHANGED
@@ -2,7 +2,39 @@
2
2
 
3
3
  All notable changes to this package will be documented in this file.
4
4
 
5
- ## [Unreleased]
5
+ ## [19.2.1-rc.1] - 2026-07-11
6
+
7
+ ### Added
8
+ - Added an opt-in `entryClientReferencesFilename` option to `RSCWebpackPlugin` and `RSCRspackPlugin` that emits, for each entrypoint, the client references statically reachable from its module graph, keyed by the same `file://` hrefs as the client manifests. The client manifests themselves are unchanged; a downstream consumer can join the asset against the client manifest to scope per-route client-reference metadata, so static RSC pages stop needing a global `clientReferences: []` workaround. ([#176])
9
+
10
+ ### Changed
11
+ - Declared the optional `@rspack/core` peer range as Rspack 1.x or 2.x and added explicit Rspack 2.x compatibility coverage. ([#183])
12
+
13
+ ### Fixed
14
+ - Recovered RSC stylesheet hints for a plain (non-`"use client"`) child component's CSS when the child is shared by two or more client references and SplitChunks hoists it into a shared async chunk. The manifest now attaches the shared chunk's CSS to every referencing client reference instead of dropping it, fixing a flash of unstyled content on the shared component; initial (entry-loaded) chunks stay excluded to preserve the #108 render-blocking fix. ([#190])
15
+ - Fixed Webpack parity for function-valued `output.publicPath` warnings and symlinked string `clientReferences` realpath matching. ([#185])
16
+ - Recovered RSC stylesheet hints for CSS imported by a client reference's child module when a CSS-merging SplitChunks cache group moves the stylesheet into a CSS-only split chunk. ([#184])
17
+ - Fixed `RSCRspackPlugin` to skip manifest and diagnostics emission when the Flight client runtime is missing, matching the Webpack plugin's misconfiguration behavior instead of writing unusable assets. ([#176])
18
+
19
+ ## [19.2.1-rc.0] - 2026-07-05
20
+
21
+ ### Added
22
+ - Added RSC server resource hint helpers for preloading assets, styles, scripts, fonts, and images, plus preconnect and DNS-prefetch support for already-resolved production asset URLs. The default `react-on-rails-rsc/server` fallback keeps failing fast at import time without the `react-server` condition while still publishing the expanded type surface. ([#143])
23
+ - Added opt-in client-reference diagnostics that emit RSC client reference JS/CSS asset files, byte sizes, and de-duplicated total byte counts for static island performance audits. ([#144])
24
+
25
+ ### Changed
26
+ - Stopped `RSCRspackPlugin` from injecting a no-op `"use client"` tagging loader into every first-party module, preserving rspack incremental caching while keeping filesystem-based client-reference discovery. ([#167])
27
+ - Skipped rspack diagnostics CSS collection when client-reference diagnostics are disabled, avoiding dead per-chunk-group CSS scans on the default build path. ([#152])
28
+
29
+ ### Fixed
30
+ - Fixed Webpack client-reference string paths to resolve relative to the compiler context and warned when `output.publicPath: "auto"` cannot be serialized into the RSC manifest. ([#171])
31
+ - Fixed Rspack client-reference manifests to emit deterministic chunk pair ordering under Rspack 2 while preserving the full sibling chunk set. ([#140])
32
+ - Fixed Rspack client manifests to emit stylesheet hints, normalize unserializable `output.publicPath: "auto"`, preserve `.mjs` chunk files, and match webpack split-runtime chunk metadata. ([#172])
33
+ - Fixed `RSCRspackPlugin` runtime injection state to be scoped by compiler, avoiding MultiCompiler and sequential-build cross-talk between rspack client/server builds with different client references or chunk names. ([#168])
34
+ - Fixed `RSCRspackPlugin` to install the generated client-reference `splitChunks` guard after Rspack applies option defaults, so default optimization configs keep generated client chunks self-contained. ([#165])
35
+ - Fixed watch rebuilds so rspack and webpack refresh client-reference runtime injections when `"use client"` files are added or removed without restarting the dev server. ([#164])
36
+ - Restored RSC stylesheet hints when a CSS-merging SplitChunks cache group, such as mini-css-extract's `styles` group, moves a client reference's own CSS into a CSS-only split chunk. ([#151])
37
+ - Scoped Rspack diagnostics CSS to the generated chunk group for the reported client reference, avoiding importer-island CSS being counted against an imported child reference. ([#166])
6
38
 
7
39
  ## [19.2.0] - 2026-06-28
8
40
 
@@ -47,11 +79,29 @@ All notable changes to this package will be documented in this file.
47
79
  ### Security
48
80
  - Updated the vendored `react-server-dom-webpack` runtime from React 19.0.3 to the React 19.0.7 security level, applying the React 19.0.4 fixes for CVE-2025-55183, CVE-2025-55184, and CVE-2025-67779 plus the React 19.0.7 reply-decoding denial-of-service fixes for CVE-2026-23869 (GHSA-479c-33wc-g2pg) and CVE-2026-23870 (GHSA-rv78-f8rc-xrxh). Note: the upstream CVE-2026-23869 fix changes the reply wire format for nested `FormData`, so client and server must both run the patched runtime shipped by this package. ([#48]) ([#86])
49
81
 
50
- [Unreleased]: https://github.com/shakacode/react_on_rails_rsc/compare/19.2.0...HEAD
82
+ [19.2.1-rc.1]: https://github.com/shakacode/react_on_rails_rsc/compare/19.2.1-rc.0...19.2.1-rc.1
83
+ [19.2.1-rc.0]: https://github.com/shakacode/react_on_rails_rsc/compare/19.2.0...19.2.1-rc.0
51
84
  [19.2.0]: https://github.com/shakacode/react_on_rails_rsc/compare/19.0.5...19.2.0
52
85
  [19.0.5]: https://github.com/shakacode/react_on_rails_rsc/compare/19.0.4...19.0.5
53
86
 
54
87
  [#120]: https://github.com/shakacode/react_on_rails_rsc/pull/120
88
+ [#140]: https://github.com/shakacode/react_on_rails_rsc/pull/140
89
+ [#143]: https://github.com/shakacode/react_on_rails_rsc/pull/143
90
+ [#144]: https://github.com/shakacode/react_on_rails_rsc/pull/144
91
+ [#167]: https://github.com/shakacode/react_on_rails_rsc/pull/167
92
+ [#168]: https://github.com/shakacode/react_on_rails_rsc/pull/168
93
+ [#172]: https://github.com/shakacode/react_on_rails_rsc/pull/172
94
+ [#176]: https://github.com/shakacode/react_on_rails_rsc/pull/176
95
+ [#183]: https://github.com/shakacode/react_on_rails_rsc/pull/183
96
+ [#184]: https://github.com/shakacode/react_on_rails_rsc/pull/184
97
+ [#185]: https://github.com/shakacode/react_on_rails_rsc/pull/185
98
+ [#190]: https://github.com/shakacode/react_on_rails_rsc/pull/190
99
+ [#165]: https://github.com/shakacode/react_on_rails_rsc/pull/165
100
+ [#164]: https://github.com/shakacode/react_on_rails_rsc/pull/164
101
+ [#151]: https://github.com/shakacode/react_on_rails_rsc/pull/151
102
+ [#152]: https://github.com/shakacode/react_on_rails_rsc/pull/152
103
+ [#166]: https://github.com/shakacode/react_on_rails_rsc/pull/166
104
+ [#171]: https://github.com/shakacode/react_on_rails_rsc/pull/171
55
105
  [#102]: https://github.com/shakacode/react_on_rails_rsc/pull/102
56
106
  [#106]: https://github.com/shakacode/react_on_rails_rsc/pull/106
57
107
  [#23]: https://github.com/shakacode/react_on_rails_rsc/pull/23
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [**npm: react-on-rails-rsc**](https://www.npmjs.com/package/react-on-rails-rsc)
8
8
 
9
- This package provides React Server Components (RSC) support for the [`react-on-rails-pro`](https://github.com/shakacode/react_on_rails_pro) Ruby gem.
9
+ This package provides React Server Components (RSC) support for the [`react-on-rails-pro`](https://github.com/shakacode/react_on_rails_pro) Ruby gem.
10
10
 
11
11
  ⚠️ **IMPORTANT: This package is for internal use only** ⚠️
12
12
 
@@ -16,12 +16,14 @@ This package is not intended to be used directly by end users. It is designed to
16
16
 
17
17
  Do not use this package's APIs directly in your application code. Instead use [`react_on_rails`](https://github.com/shakacode/react_on_rails) and [`react-on-rails-pro`](https://github.com/shakacode/react_on_rails_pro) gems and npm packages APIs to render or stream React Server Components.
18
18
 
19
- ## Testing Unreleased Builds
19
+ ## Documentation
20
20
 
21
- If a downstream app needs to test a `react-on-rails-rsc` fix before an npm
22
- release, see [`docs/consuming-unreleased-builds.md`](docs/consuming-unreleased-builds.md)
23
- for the yalc, canary publish, throwaway dist branch, and version-pairing
24
- workflows.
21
+ This repository's checked-in docs are internal maintainer notes. Public React
22
+ Server Components guidance for application developers belongs in the downstream
23
+ [`react_on_rails`](https://github.com/shakacode/react_on_rails) documentation.
24
+
25
+ Maintainers can start from [`docs/README.md`](docs/README.md) for the internal
26
+ documentation boundary and links to package-maintainer runbooks.
25
27
 
26
28
  ## Package Contents
27
29
 
@@ -33,23 +35,23 @@ This package provides internal tooling for React Server Components integration:
33
35
  ## Versioning
34
36
 
35
37
  The package `major.minor` tracks the React runtime line it ships or requires.
36
- See [`docs/versioning.md`](docs/versioning.md) for peer dependency,
37
- prerelease, dist-tag, and runtime-strategy policy.
38
+ Maintainer policy lives in [`internal/docs/versioning.md`](internal/docs/versioning.md).
38
39
 
39
40
  ## Releasing
40
41
 
41
42
  Release this package from `main` using the changelog-driven workflow in
42
- [`docs/releasing.md`](docs/releasing.md). Run `yarn release:dry-run` before
43
- `yarn release`.
43
+ [`internal/docs/releasing.md`](internal/docs/releasing.md). Run
44
+ `yarn release:dry-run` before `yarn release`.
44
45
 
45
46
  ## Compatibility Policy
46
47
 
47
48
  The package peer dependencies are the current source of truth for supported
48
- React and webpack ranges. CI also runs a focused compatibility matrix covering
49
- React 19.0.4 and 19.2.x, Node.js 20 and 22, webpack 5.59.0 and latest 5.x, and
50
- rspack latest 1.x. A weekly React canary job is signal-only and is allowed to
51
- fail while upstream canary APIs move; review its GitHub Actions summary for
52
- early warnings.
49
+ React, webpack, and rspack ranges. CI also runs a focused compatibility matrix
50
+ covering React 19.0.4 and 19.2.x, Node.js 20 and 22, webpack 5.59.0 and latest
51
+ 5.x, and rspack latest 1.x plus latest 2.x. The `@rspack/core` peer is optional
52
+ so webpack-only consumers do not need to install rspack. A weekly React canary
53
+ job is signal-only and is allowed to fail while upstream canary APIs move;
54
+ review its GitHub Actions summary for early warnings.
53
55
 
54
56
  A formal versioning policy is tracked in
55
57
  [#70](https://github.com/shakacode/react_on_rails_rsc/issues/70).
@@ -1 +1 @@
1
- {"version":3,"file":"RSCReferenceDiscoveryPlugin.d.ts","sourceRoot":"","sources":["../src/RSCReferenceDiscoveryPlugin.ts"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,KAAK,EAAE;QACL,aAAa,EAAE;YACb,GAAG,EAAE,CAAC,OAAO,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;SAC/E,CAAC;KACH,CAAC;IACF,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QACR,WAAW,EAAE;YAAE,2BAA2B,EAAE,MAAM,CAAA;SAAE,CAAC;QACrD,OAAO,EAAE;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AE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO;IAI/C,KAAK,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI;CA2BnC;AAED,eAAe,2BAA2B,CAAC"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RSCReferenceDiscoveryPlugin = void 0;
4
4
  exports.recordDiscoveredClientReferenceIfNeeded = recordDiscoveredClientReferenceIfNeeded;
5
- const path = require("path");
6
5
  const clientReferences_1 = require("./clientReferences");
6
+ const entryClientReferences_1 = require("./entryClientReferences");
7
7
  const RSC_CLIENT_REFERENCES_KEY = Symbol.for('react-on-rails-rsc.discoveredClientReferences');
8
8
  function getClientReferenceSet(compilation) {
9
9
  const existing = compilation[RSC_CLIENT_REFERENCES_KEY];
@@ -71,7 +71,7 @@ class RSCReferenceDiscoveryPlugin {
71
71
  compilerContext: compiler.context,
72
72
  count: refs.length,
73
73
  refs,
74
- relativeRefs: refs.map((file) => path.relative(compiler.context, file).replace(/\\/g, '/')),
74
+ relativeRefs: refs.map((file) => (0, entryClientReferences_1.toRelativePosixPath)(compiler.context, file)),
75
75
  };
76
76
  compilation.emitAsset(this.filename, new bundler.sources.RawSource(`${JSON.stringify(payload, null, 2)}\n`));
77
77
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RSCReferenceDiscoveryPlugin.js","sourceRoot":"","sources":["../src/RSCReferenceDiscoveryPlugin.ts"],"names":[],"mappings":";;;AA4DA,0FAwBC;AApFD,6BAA6B;AAC7B,yDAA2D;AAmC3D,MAAM,yBAAyB,GAAW,MAAM,CAAC,GAAG,CAClD,+CAA+C,CAChD,CAAC;AAEF,SAAS,qBAAqB,CAAC,WAA2B;IACxD,MAAM,QAAQ,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAC;IACxD,IAAI,QAAQ,YAAY,GAAG;QAAE,OAAO,QAAuB,CAAC;IAE5D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B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AC,CAAC;iBAC9E,CAAC;gBAEF,WAAW,CAAC,SAAS,CACnB,IAAI,CAAC,QAAQ,EACb,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CACvE,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlCD,kEAkCC;AAED,kBAAe,2BAA2B,CAAC"}
@@ -13,6 +13,8 @@ export type Options = {
13
13
  chunkGroupWarningThreshold?: number | false;
14
14
  clientManifestFilename?: string;
15
15
  serverConsumerManifestFilename?: string;
16
+ clientReferenceDiagnosticsFilename?: string | false;
17
+ entryClientReferencesFilename?: string | false;
16
18
  };
17
19
  export declare class RSCWebpackPlugin {
18
20
  private plugin;
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackPlugin.d.ts","sourceRoot":"","sources":["../src/WebpackPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAOnC,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,mBAAmB,GAAG,MAAM,GAAG,yBAAyB,CAAC;AAE9D,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAyB;gBAE3B,OAAO,EAAE,OAAO;IAkB5B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAGzB"}
1
+ {"version":3,"file":"WebpackPlugin.d.ts","sourceRoot":"","sources":["../src/WebpackPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAOnC,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,mBAAmB,GAAG,MAAM,GAAG,yBAAyB,CAAC;AAE9D,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,kCAAkC,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACpD,6BAA6B,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAChD,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAyB;gBAE3B,OAAO,EAAE,OAAO;IAkB5B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAGzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"WebpackPlugin.js","sourceRoot":"","sources":["../src/WebpackPlugin.ts"],"names":[],"mappings":";;;AACA,yDAG4B;AAC5B,iEAAwF;AAoBxF,MAAa,gBAAgB;IAG3B,YAAY,OAAgB;QAC1B,MAAM,iBAAiB,GACrB,OAAO,CAAC,gBAAgB,KAAK,SAAS;YACpC,CAAC,CAAC;gBACE,GAAG,OAAO;gBACV,gBAAgB,EAAE;oBAChB;wBACE,SAAS,EAAE,GAAG;wBACd,SAAS,EAAE,IAAI;wBACf,OAAO,EAAE,oDAAiC;wBAC1C,OAAO,EAAE,oDAAiC;qBAC3C;iBACF;aACF;YACH,CAAC,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,mCAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF;AAxBD,4CAwBC"}
1
+ {"version":3,"file":"WebpackPlugin.js","sourceRoot":"","sources":["../src/WebpackPlugin.ts"],"names":[],"mappings":";;;AACA,yDAG4B;AAC5B,iEAAwF;AAsBxF,MAAa,gBAAgB;IAG3B,YAAY,OAAgB;QAC1B,MAAM,iBAAiB,GACrB,OAAO,CAAC,gBAAgB,KAAK,SAAS;YACpC,CAAC,CAAC;gBACE,GAAG,OAAO;gBACV,gBAAgB,EAAE;oBAChB;wBACE,SAAS,EAAE,GAAG;wBACd,SAAS,EAAE,IAAI;wBACf,OAAO,EAAE,oDAAiC;wBAC1C,OAAO,EAAE,oDAAiC;qBAC3C;iBACF;aACF;YACH,CAAC,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,mCAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF;AAxBD,4CAwBC"}
@@ -14,4 +14,25 @@ export declare const DEFAULT_CLIENT_REFERENCES_EXCLUDE: RegExp;
14
14
  export declare const DEFAULT_CLIENT_REFERENCES_INCLUDE: RegExp;
15
15
  /** Check whether `source` starts with a `"use client"` directive. */
16
16
  export declare function hasUseClientDirective(source: string | Buffer): boolean;
17
+ /**
18
+ * Whether `chunk` is an initial chunk, shared by the webpack and rspack RSC
19
+ * plugins.
20
+ *
21
+ * An initial chunk is loaded render-blocking by an entrypoint's own
22
+ * script/stylesheet tags, so its CSS is already delivered to the page and must
23
+ * NOT be re-hinted per client reference (the #108 broadcast regression). An
24
+ * async chunk's CSS has no such delivery path, so it must be attached to every
25
+ * referencing client reference (#188). `canBeInitial()` is the bundler's own
26
+ * signal for this and is present on every real webpack/rspack chunk; a chunk
27
+ * that lacks it (only the unit-test mocks, which never reach this predicate
28
+ * because the CSS-recovery walk is gated off `moduleGraph`) is treated as
29
+ * non-initial.
30
+ *
31
+ * Kept here (rather than duplicated in each plugin) so the webpack and rspack
32
+ * copies cannot silently diverge on the next #108/#188-style change, matching
33
+ * the `hasUseClientDirective` sharing precedent.
34
+ */
35
+ export declare function isInitialChunk(chunk: {
36
+ canBeInitial?: () => boolean;
37
+ }): boolean;
17
38
  //# sourceMappingURL=clientReferences.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientReferences.d.ts","sourceRoot":"","sources":["../src/clientReferences.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,QAC+H,CAAC;AAE9K;;;GAGG;AACH,eAAO,MAAM,iCAAiC,QAAoB,CAAC;AAyCnE,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CA8BtE"}
1
+ {"version":3,"file":"clientReferences.d.ts","sourceRoot":"","sources":["../src/clientReferences.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,QAC+H,CAAC;AAE9K;;;GAGG;AACH,eAAO,MAAM,iCAAiC,QAAoB,CAAC;AAyCnE,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CA8BtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,OAAO,CAAA;CAAE,GAAG,OAAO,CAE/E"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_CLIENT_REFERENCES_INCLUDE = exports.DEFAULT_CLIENT_REFERENCES_EXCLUDE = void 0;
4
4
  exports.hasUseClientDirective = hasUseClientDirective;
5
+ exports.isInitialChunk = isInitialChunk;
5
6
  const acorn = require("acorn-loose");
6
7
  /**
7
8
  * Default directories skipped by client reference discovery.
@@ -75,4 +76,25 @@ function hasUseClientDirective(source) {
75
76
  }
76
77
  return false;
77
78
  }
79
+ /**
80
+ * Whether `chunk` is an initial chunk, shared by the webpack and rspack RSC
81
+ * plugins.
82
+ *
83
+ * An initial chunk is loaded render-blocking by an entrypoint's own
84
+ * script/stylesheet tags, so its CSS is already delivered to the page and must
85
+ * NOT be re-hinted per client reference (the #108 broadcast regression). An
86
+ * async chunk's CSS has no such delivery path, so it must be attached to every
87
+ * referencing client reference (#188). `canBeInitial()` is the bundler's own
88
+ * signal for this and is present on every real webpack/rspack chunk; a chunk
89
+ * that lacks it (only the unit-test mocks, which never reach this predicate
90
+ * because the CSS-recovery walk is gated off `moduleGraph`) is treated as
91
+ * non-initial.
92
+ *
93
+ * Kept here (rather than duplicated in each plugin) so the webpack and rspack
94
+ * copies cannot silently diverge on the next #108/#188-style change, matching
95
+ * the `hasUseClientDirective` sharing precedent.
96
+ */
97
+ function isInitialChunk(chunk) {
98
+ return typeof chunk.canBeInitial === 'function' ? chunk.canBeInitial() : false;
99
+ }
78
100
  //# sourceMappingURL=clientReferences.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientReferences.js","sourceRoot":"","sources":["../src/clientReferences.ts"],"names":[],"mappings":";;;AA2DA,sDA8BC;AAzFD,qCAAqC;AAErC;;;;;;;GAOG;AACU,QAAA,iCAAiC,GAC5C,2KAA2K,CA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ifests are deliberately build-wide: both plugins
5
+ * inject every filesystem-discovered `"use client"` file as an async chunk
6
+ * attached to the Flight client runtime module, so any page can resolve any
7
+ * reference at runtime. That also means chunk membership can never answer
8
+ * "which client references does THIS entry's tree actually render?" — on
9
+ * server builds especially, chunk merging folds every injected reference into
10
+ * the entry chunk.
11
+ *
12
+ * This module answers that question from the module graph instead: a
13
+ * depth-first walk from each entrypoint's entry modules over
14
+ * `moduleGraph.getOutgoingConnections`, stopping at two kinds of boundary:
15
+ *
16
+ * - a client-reference module (recorded, not descended into — its imports
17
+ * belong to the client bundle's graph, not the server tree), and
18
+ * - the Flight client runtime module (not descended into, because the
19
+ * plugin-injected references all hang off it; walking through it would
20
+ * mark every discovered reference reachable from every entry that imports
21
+ * the runtime, silently defeating the per-entry scoping).
22
+ *
23
+ * The traversal is shared by the webpack and rspack plugins, which pass their
24
+ * own client-reference sets and runtime matchers. Keep those predicates aligned
25
+ * with each plugin's manifest walker: this module owns graph reachability, but
26
+ * resource and concatenated-module semantics must classify client references
27
+ * and runtime boundaries consistently. It is written against structural types
28
+ * because the plugins run under hand-built mock compilations in unit tests; when
29
+ * a compilation does not expose the required graph APIs,
30
+ * `collectEntryClientReferences` returns `null` and the caller emits a warning
31
+ * instead of a wrong (empty) artifact.
32
+ *
33
+ * Failure direction: the walk prefers OVER-inclusion. An extra reference in
34
+ * an entry's list only costs preload bytes downstream; a missing reference
35
+ * would make a filtered manifest fail a legitimate render. Concatenated
36
+ * modules are therefore recorded through their inner modules as well, and a
37
+ * concatenated module that swallowed the runtime is skipped rather than
38
+ * walked (its outgoing connections would include every injected reference).
39
+ */
40
+ export type EntryClientReferencesModule = {
41
+ resource?: string;
42
+ /** Inner modules of a ConcatenatedModule. */
43
+ modules?: EntryClientReferencesModule[];
44
+ identifier?: () => string;
45
+ };
46
+ type EntryClientReferencesConnection = {
47
+ module?: EntryClientReferencesModule | null;
48
+ resolvedModule?: EntryClientReferencesModule | null;
49
+ };
50
+ export type EntryClientReferencesEntrypoint = {
51
+ getEntrypointChunk?: () => unknown;
52
+ };
53
+ export type EntryClientReferencesCompilation = {
54
+ entrypoints?: {
55
+ forEach(fn: (entrypoint: EntryClientReferencesEntrypoint, name: string) => void): void;
56
+ };
57
+ chunkGraph?: {
58
+ getChunkEntryModulesIterable?(chunk: unknown): Iterable<EntryClientReferencesModule>;
59
+ };
60
+ moduleGraph?: {
61
+ getOutgoingConnections?(module: EntryClientReferencesModule): Iterable<EntryClientReferencesConnection>;
62
+ };
63
+ };
64
+ export type EntryClientReferencesPayload = {
65
+ version: 1;
66
+ isServer: boolean;
67
+ compilerContext: string;
68
+ entries: Record<string, {
69
+ /** `file://` hrefs — the same keys the client manifests use. */
70
+ clientReferences: string[];
71
+ /** Compiler-context-relative paths, `/`-separated, for readability. */
72
+ relativeClientReferences: string[];
73
+ }>;
74
+ };
75
+ export type CollectedEntryClientReferences = {
76
+ entries: Map<string, string[]>;
77
+ boundaryEncountered: boolean;
78
+ clientReferenceEncountered: boolean;
79
+ };
80
+ type EmitEntryClientReferencesAssetOptions = {
81
+ compilation: EntryClientReferencesCompilation;
82
+ filename: string;
83
+ compilerContext: string;
84
+ isServer: boolean;
85
+ isClientReference(resource: string): boolean;
86
+ isTraversalBoundary(resource: string): boolean;
87
+ emitWarning(message: string): void;
88
+ emitAsset(filename: string, source: string): void;
89
+ };
90
+ export declare function toRelativePosixPath(context: string, file: string): string;
91
+ /**
92
+ * Walk each entrypoint's module graph and return the client references
93
+ * statically reachable from it, as a map of entry name to sorted absolute
94
+ * resource paths. Returns `null` when the compilation does not expose the
95
+ * required graph APIs (mock compilations, incompatible bundlers).
96
+ */
97
+ export declare function collectEntryClientReferences(options: {
98
+ compilation: EntryClientReferencesCompilation;
99
+ isClientReference(resource: string): boolean;
100
+ /** Matches the Flight client runtime module the injected references hang off. */
101
+ isTraversalBoundary(resource: string): boolean;
102
+ }): CollectedEntryClientReferences | null;
103
+ /** Serialize the per-entry reference map into the emitted JSON payload. */
104
+ export declare function buildEntryClientReferencesPayload(options: {
105
+ entries: Map<string, string[]>;
106
+ compilerContext: string;
107
+ isServer: boolean;
108
+ }): EntryClientReferencesPayload;
109
+ /**
110
+ * Shared collect/warn/emit glue for webpack and rspack entry-scoped artifacts.
111
+ * The plugins provide bundler-specific warning and Source constructors.
112
+ */
113
+ export declare function emitEntryClientReferencesAsset(options: EmitEntryClientReferencesAssetOptions): void;
114
+ export {};
115
+ //# sourceMappingURL=entryClientReferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entryClientReferences.d.ts","sourceRoot":"","sources":["../src/entryClientReferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAKH,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AAEF,KAAK,+BAA+B,GAAG;IACrC,MAAM,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,WAAW,CAAC,EAAE;QACZ,OAAO,CACL,EAAE,EAAE,CAAC,UAAU,EAAE,+BAA+B,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GACtE,IAAI,CAAC;KACT,CAAC;IACF,UAAU,CAAC,EAAE;QACX,4BAA4B,CAAC,CAC3B,KAAK,EAAE,OAAO,GACb,QAAQ,CAAC,2BAA2B,CAAC,CAAC;KAC1C,CAAC;IACF,WAAW,CAAC,EAAE;QACZ,sBAAsB,CAAC,CACrB,MAAM,EAAE,2BAA2B,GA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,EAAE,MAAM,GAAG,OAAO,CAAC;CAChD,GAAG,8BAA8B,GAAG,IAAI,CA0FxC;AAED,2EAA2E;AAC3E,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,4BAA4B,CAiB/B;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC,GAC7C,IAAI,CA6BN"}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ /**
3
+ * Entry-scoped client-reference discovery (issue #134).
4
+ *
5
+ * The client-reference manifests are deliberately build-wide: both plugins
6
+ * inject every filesystem-discovered `"use client"` file as an async chunk
7
+ * attached to the Flight client runtime module, so any page can resolve any
8
+ * reference at runtime. That also means chunk membership can never answer
9
+ * "which client references does THIS entry's tree actually render?" — on
10
+ * server builds especially, chunk merging folds every injected reference into
11
+ * the entry chunk.
12
+ *
13
+ * This module answers that question from the module graph instead: a
14
+ * depth-first walk from each entrypoint's entry modules over
15
+ * `moduleGraph.getOutgoingConnections`, stopping at two kinds of boundary:
16
+ *
17
+ * - a client-reference module (recorded, not descended into — its imports
18
+ * belong to the client bundle's graph, not the server tree), and
19
+ * - the Flight client runtime module (not descended into, because the
20
+ * plugin-injected references all hang off it; walking through it would
21
+ * mark every discovered reference reachable from every entry that imports
22
+ * the runtime, silently defeating the per-entry scoping).
23
+ *
24
+ * The traversal is shared by the webpack and rspack plugins, which pass their
25
+ * own client-reference sets and runtime matchers. Keep those predicates aligned
26
+ * with each plugin's manifest walker: this module owns graph reachability, but
27
+ * resource and concatenated-module semantics must classify client references
28
+ * and runtime boundaries consistently. It is written against structural types
29
+ * because the plugins run under hand-built mock compilations in unit tests; when
30
+ * a compilation does not expose the required graph APIs,
31
+ * `collectEntryClientReferences` returns `null` and the caller emits a warning
32
+ * instead of a wrong (empty) artifact.
33
+ *
34
+ * Failure direction: the walk prefers OVER-inclusion. An extra reference in
35
+ * an entry's list only costs preload bytes downstream; a missing reference
36
+ * would make a filtered manifest fail a legitimate render. Concatenated
37
+ * modules are therefore recorded through their inner modules as well, and a
38
+ * concatenated module that swallowed the runtime is skipped rather than
39
+ * walked (its outgoing connections would include every injected reference).
40
+ */
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.toRelativePosixPath = toRelativePosixPath;
43
+ exports.collectEntryClientReferences = collectEntryClientReferences;
44
+ exports.buildEntryClientReferencesPayload = buildEntryClientReferencesPayload;
45
+ exports.emitEntryClientReferencesAsset = emitEntryClientReferencesAsset;
46
+ const path = require("path");
47
+ const url = require("url");
48
+ function toRelativePosixPath(context, file) {
49
+ return path.relative(context, file).replace(/\\/g, '/');
50
+ }
51
+ /**
52
+ * Walk each entrypoint's module graph and return the client references
53
+ * statically reachable from it, as a map of entry name to sorted absolute
54
+ * resource paths. Returns `null` when the compilation does not expose the
55
+ * required graph APIs (mock compilations, incompatible bundlers).
56
+ */
57
+ function collectEntryClientReferences(options) {
58
+ const { compilation, isClientReference, isTraversalBoundary } = options;
59
+ const entrypoints = compilation.entrypoints;
60
+ const getChunkEntryModulesIterable = compilation.chunkGraph?.getChunkEntryModulesIterable?.bind(compilation.chunkGraph);
61
+ const getOutgoingConnections = compilation.moduleGraph?.getOutgoingConnections?.bind(compilation.moduleGraph);
62
+ if (!entrypoints ||
63
+ typeof entrypoints.forEach !== 'function' ||
64
+ !getChunkEntryModulesIterable ||
65
+ !getOutgoingConnections) {
66
+ return null;
67
+ }
68
+ const entries = new Map();
69
+ let missingEntrypointApi = false;
70
+ let boundaryEncountered = false;
71
+ let clientReferenceEncountered = false;
72
+ entrypoints.forEach((entrypoint, name) => {
73
+ if (typeof entrypoint?.getEntrypointChunk !== 'function') {
74
+ missingEntrypointApi = true;
75
+ return;
76
+ }
77
+ // Entry-scoped output is opt-in and normally has a small entry count, so
78
+ // each entry walks independently. If large multi-entry builds make this
79
+ // hot, memoize subtree client-reference sets across entrypoints.
80
+ const found = new Set();
81
+ // Keyed by identifier() or resource when available so bundlers that hand
82
+ // out fresh wrapper objects for the same module (rspack bindings) still
83
+ // terminate on graph cycles. Resource-less synthetic modules fall back to
84
+ // object identity; real webpack/rspack modules expose stable identifiers.
85
+ const visited = new Set();
86
+ const stack = [
87
+ ...getChunkEntryModulesIterable(entrypoint.getEntrypointChunk()),
88
+ ];
89
+ while (stack.length > 0) {
90
+ const module = stack.pop();
91
+ const visitKey = typeof module.identifier === 'function'
92
+ ? module.identifier()
93
+ : module.resource ?? module;
94
+ if (visited.has(visitKey))
95
+ continue;
96
+ visited.add(visitKey);
97
+ // A client reference is a boundary: record it, do not walk its imports.
98
+ if (module.resource && isClientReference(module.resource)) {
99
+ found.add(module.resource);
100
+ clientReferenceEncountered = true;
101
+ continue;
102
+ }
103
+ // Concatenated wrappers: record inner client references so an eagerly
104
+ // folded-in reference is not missed (over-inclusion is the safe
105
+ // direction), and refuse to walk a wrapper that swallowed the runtime.
106
+ const moduleIsBoundary = !!module.resource && isTraversalBoundary(module.resource);
107
+ if (moduleIsBoundary)
108
+ boundaryEncountered = true;
109
+ let containsBoundary = moduleIsBoundary;
110
+ if (module.modules) {
111
+ for (const inner of module.modules) {
112
+ if (!inner.resource)
113
+ continue;
114
+ if (isClientReference(inner.resource)) {
115
+ found.add(inner.resource);
116
+ clientReferenceEncountered = true;
117
+ }
118
+ if (isTraversalBoundary(inner.resource)) {
119
+ boundaryEncountered = true;
120
+ containsBoundary = true;
121
+ }
122
+ }
123
+ }
124
+ if (containsBoundary)
125
+ continue;
126
+ for (const connection of getOutgoingConnections(module)) {
127
+ const depModule = connection.module ?? connection.resolvedModule;
128
+ if (depModule)
129
+ stack.push(depModule);
130
+ }
131
+ }
132
+ entries.set(name, [...found].sort());
133
+ });
134
+ return missingEntrypointApi
135
+ ? null
136
+ : { entries, boundaryEncountered, clientReferenceEncountered };
137
+ }
138
+ /** Serialize the per-entry reference map into the emitted JSON payload. */
139
+ function buildEntryClientReferencesPayload(options) {
140
+ const entries = {};
141
+ for (const name of [...options.entries.keys()].sort()) {
142
+ const files = options.entries.get(name);
143
+ entries[name] = {
144
+ clientReferences: files.map((file) => url.pathToFileURL(file).href),
145
+ relativeClientReferences: files.map((file) => toRelativePosixPath(options.compilerContext, file)),
146
+ };
147
+ }
148
+ return {
149
+ version: 1,
150
+ isServer: options.isServer,
151
+ compilerContext: options.compilerContext,
152
+ entries,
153
+ };
154
+ }
155
+ /**
156
+ * Shared collect/warn/emit glue for webpack and rspack entry-scoped artifacts.
157
+ * The plugins provide bundler-specific warning and Source constructors.
158
+ */
159
+ function emitEntryClientReferencesAsset(options) {
160
+ const result = collectEntryClientReferences({
161
+ compilation: options.compilation,
162
+ isClientReference: options.isClientReference,
163
+ isTraversalBoundary: options.isTraversalBoundary,
164
+ });
165
+ if (result === null) {
166
+ options.emitWarning('React Server Components: entryClientReferencesFilename was set, but this compilation does not expose the module-graph APIs needed for entry-scoped client-reference discovery ' +
167
+ '(entrypoints, entrypoint.getEntrypointChunk, chunkGraph.getChunkEntryModulesIterable, moduleGraph.getOutgoingConnections). ' +
168
+ options.filename +
169
+ ' was not created.');
170
+ return;
171
+ }
172
+ if (!result.boundaryEncountered && result.clientReferenceEncountered) {
173
+ options.emitWarning('React Server Components: entryClientReferencesFilename was set, but the Flight client runtime boundary was not encountered while building entry-scoped client-reference discovery. ' +
174
+ options.filename +
175
+ ' was created, but it may over-report reachable client references if runtime-injected references were traversed.');
176
+ }
177
+ const payload = buildEntryClientReferencesPayload({
178
+ entries: result.entries,
179
+ compilerContext: options.compilerContext,
180
+ isServer: options.isServer,
181
+ });
182
+ options.emitAsset(options.filename, `${JSON.stringify(payload, null, 2)}\n`);
183
+ }
184
+ //# sourceMappingURL=entryClientReferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entryClientReferences.js","sourceRoot":"","sources":["../src/entryClientReferences.ts"],"names":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AAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/E,CAAC"}
@@ -1,3 +1,5 @@
1
+ export { preconnect, prefetchDNS, preinitScript, preinitStyle, preloadAsset, preloadFont, preloadImage, preloadScript, preloadStyle, } from './resource-hints';
2
+ export type { PreconnectResourceOptions, PreinitScriptOptions, PreinitStyleOptions, PreloadAssetOptions, PreloadFontOptions, PreloadImageOptions, PreloadScriptOptions, PreloadStyleOptions, ResourceHintAs, ResourceHintCrossOrigin, ResourceHintFetchPriority, } from './resource-hints';
1
3
  type ServerFunction = (...args: unknown[]) => unknown;
2
4
  type RegisterClientReference = (proxyImplementation: unknown, id: string, exportName: string) => unknown;
3
5
  type RegisterServerReference = (reference: unknown, id: string, exportName: string) => unknown;
@@ -9,5 +11,4 @@ export declare const registerServerReference: RegisterServerReference;
9
11
  export declare const registerClientReference: RegisterClientReference;
10
12
  export declare const createClientModuleProxy: (moduleId: string) => unknown;
11
13
  export declare const createTemporaryReferenceSet: () => unknown;
12
- export {};
13
14
  //# sourceMappingURL=flight-server.browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flight-server.browser.d.ts","sourceRoot":"","sources":["../src/flight-server.browser.ts"],"names":[],"mappings":"AAGA,KAAK,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AACtD,KAAK,uBAAuB,GAAG,CAC7B,mBAAmB,EAAE,OAAO,EAC5B,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,KACf,OAAO,CAAC;AACb,KAAK,uBAAuB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;AAI/F,eAAO,MAAM,sBAAsB,EAAE,cACyC,CAAC;AAC/E,eAAO,MAAM,WAAW,EAAE,cAAqD,CAAC;AAChF,eAAO,MAAM,YAAY,EAAE,cAAsD,CAAC;AAClF,eAAO,MAAM,eAAe,EAAE,cAAyD,CAAC;AACxF,eAAO,MAAM,uBAAuB,EAAE,uBACqB,CAAC;AAC5D,eAAO,MAAM,uBAAuB,EAAE,uBACqB,CAAC;AAC5D,eAAO,MAAM,uBAAuB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OACK,CAAC;AAClE,eAAO,MAAM,2BAA2B,EAAE,MAAM,OACK,CAAC"}
1
+ {"version":3,"file":"flight-server.browser.d.ts","sourceRoot":"","sources":["../src/flight-server.browser.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,KAAK,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AACtD,KAAK,uBAAuB,GAAG,CAC7B,mBAAmB,EAAE,OAAO,EAC5B,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,KACf,OAAO,CAAC;AACb,KAAK,uBAAuB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;AAI/F,eAAO,MAAM,sBAAsB,EAAE,cACyC,CAAC;AAC/E,eAAO,MAAM,WAAW,EAAE,cAAqD,CAAC;AAChF,eAAO,MAAM,YAAY,EAAE,cAAsD,CAAC;AAClF,eAAO,MAAM,eAAe,EAAE,cAAyD,CAAC;AACxF,eAAO,MAAM,uBAAuB,EAAE,uBACqB,CAAC;AAC5D,eAAO,MAAM,uBAAuB,EAAE,uBACqB,CAAC;AAC5D,eAAO,MAAM,uBAAuB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OACK,CAAC;AAClE,eAAO,MAAM,2BAA2B,EAAE,MAAM,OACK,CAAC"}