react-on-rails-rsc 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/WebpackLoader.d.ts +4 -0
- package/dist/WebpackLoader.d.ts.map +1 -0
- package/dist/WebpackLoader.js +15 -0
- package/dist/WebpackLoader.js.map +1 -0
- package/dist/WebpackPlugin.d.ts +22 -0
- package/dist/WebpackPlugin.d.ts.map +1 -0
- package/dist/WebpackPlugin.js +16 -0
- package/dist/WebpackPlugin.js.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -0
- package/dist/server.node.d.ts +14 -0
- package/dist/server.node.d.ts.map +1 -0
- package/dist/server.node.js +7 -0
- package/dist/server.node.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @shakacode-tools/react-on-rails-rsc
|
|
2
|
+
|
|
3
|
+
This package provides React Server Components (RSC) support for the [`react-on-rails-pro`](https://github.com/shakacode/react_on_rails_pro) Ruby gem.
|
|
4
|
+
|
|
5
|
+
⚠️ **IMPORTANT: This package is for internal use only** ⚠️
|
|
6
|
+
|
|
7
|
+
This package is not intended to be used directly by end users. It is designed to be used internally by [`react-on-rails-pro`](https://github.com/shakacode/react_on_rails_pro) npm package and ruby gem.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
## Package Contents
|
|
14
|
+
|
|
15
|
+
This package provides internal tooling for React Server Components integration:
|
|
16
|
+
- Webpack plugin for manifesting client components
|
|
17
|
+
- Webpack loader for bundling server components
|
|
18
|
+
- Client/server utilities for RSC rendering
|
|
19
|
+
|
|
20
|
+
## Support
|
|
21
|
+
|
|
22
|
+
For questions about React Server Components:
|
|
23
|
+
- Visit [React on Rails Pro documentation](https://www.shakacode.com/react-on-rails-pro/docs/)
|
|
24
|
+
- Visit [React on Rails documentation](https://www.shakacode.com/react-on-rails/docs/)
|
|
25
|
+
- Open issues in the [`react-on-rails-pro`](https://github.com/shakacode/react_on_rails_pro/issues) repository
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackLoader.d.ts","sourceRoot":"","sources":["../src/WebpackLoader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,QAAA,MAAM,gBAAgB,EAAE,gBAUvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const url_1 = require("url");
|
|
4
|
+
const RSCWebpackLoader = async function RSCWebpackLoader(source) {
|
|
5
|
+
// Convert file path to URL format
|
|
6
|
+
const fileUrl = (0, url_1.pathToFileURL)(this.resourcePath).href;
|
|
7
|
+
const { load } = await import('react-server-dom-webpack/node-loader');
|
|
8
|
+
const result = await load(fileUrl, null, async () => ({
|
|
9
|
+
format: 'module',
|
|
10
|
+
source,
|
|
11
|
+
}));
|
|
12
|
+
return result.source;
|
|
13
|
+
};
|
|
14
|
+
exports.default = RSCWebpackLoader;
|
|
15
|
+
//# sourceMappingURL=WebpackLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackLoader.js","sourceRoot":"","sources":["../src/WebpackLoader.ts"],"names":[],"mappings":";;AAAA,6BAAoC;AAGpC,MAAM,gBAAgB,GAAqB,KAAK,UAAU,gBAAgB,CAAC,MAAM;IAC/E,kCAAkC;IAClC,MAAM,OAAO,GAAG,IAAA,mBAAa,EAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;IAEtD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,EAAE,QAAQ;QAChB,MAAM;KACP,CAAC,CAAC,CAAC;IACJ,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Compiler } from "webpack";
|
|
2
|
+
type ClientReferenceSearchPath = {
|
|
3
|
+
directory: string;
|
|
4
|
+
recursive?: boolean;
|
|
5
|
+
include: RegExp;
|
|
6
|
+
exclude?: RegExp;
|
|
7
|
+
};
|
|
8
|
+
type ClientReferencePath = string | ClientReferenceSearchPath;
|
|
9
|
+
export type Options = {
|
|
10
|
+
isServer: boolean;
|
|
11
|
+
clientReferences?: ClientReferencePath | ReadonlyArray<ClientReferencePath>;
|
|
12
|
+
chunkName?: string;
|
|
13
|
+
clientManifestFilename?: string;
|
|
14
|
+
serverConsumerManifestFilename?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare class RSCWebpackPlugin {
|
|
17
|
+
private plugin?;
|
|
18
|
+
constructor(options: Options);
|
|
19
|
+
apply(compiler: Compiler): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=WebpackPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackPlugin.d.ts","sourceRoot":"","sources":["../src/WebpackPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,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,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,8BAA8B,CAAC,EAAE,MAAM,CAAC;CACzC,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAsB;gBAEzB,OAAO,EAAE,OAAO;IAM5B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAGzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RSCWebpackPlugin = void 0;
|
|
4
|
+
const RSCWebpackPluginLib = require("react-server-dom-webpack/plugin");
|
|
5
|
+
class RSCWebpackPlugin {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
if (!options.isServer) {
|
|
8
|
+
this.plugin = new RSCWebpackPluginLib(options);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
apply(compiler) {
|
|
12
|
+
this.plugin?.apply(compiler);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.RSCWebpackPlugin = RSCWebpackPlugin;
|
|
16
|
+
//# sourceMappingURL=WebpackPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpackPlugin.js","sourceRoot":"","sources":["../src/WebpackPlugin.ts"],"names":[],"mappings":";;;AACA,uEAAwE;AAmBxE,MAAa,gBAAgB;IAG3B,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;CACF;AAZD,4CAYC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAC3D,CAAC;AAE1B,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,OAAO,CAAC,CAAC,CAC3D,CAAC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFromReadableStream = exports.createFromFetch = void 0;
|
|
4
|
+
const client_1 = require("react-server-dom-webpack/client");
|
|
5
|
+
// we don't care about options, so don't specify the type here
|
|
6
|
+
exports.createFromFetch = client_1.createFromFetch;
|
|
7
|
+
exports.createFromReadableStream = client_1.createFromReadableStream;
|
|
8
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,4DAIyC;AAEzC,8DAA8D;AACjD,QAAA,eAAe,GAC1B,wBAAuB,CAAC;AAEb,QAAA,wBAAwB,GACnC,iCAAgC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
environmentName?: string;
|
|
3
|
+
onError?: (error: unknown) => void;
|
|
4
|
+
onPostpone?: (reason: string) => void;
|
|
5
|
+
identifierPrefix?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PipeableStream {
|
|
8
|
+
abort(reason: unknown): void;
|
|
9
|
+
pipe<Writable extends NodeJS.WritableStream>(destination: Writable): Writable;
|
|
10
|
+
}
|
|
11
|
+
export declare const renderToPipeableStream: (model: unknown, webpackMap: {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}, options?: Options) => PipeableStream;
|
|
14
|
+
//# sourceMappingURL=server.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.node.d.ts","sourceRoot":"","sources":["../src/server.node.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,QAAQ,SAAS,MAAM,CAAC,cAAc,EAAE,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC/E;AAED,eAAO,MAAM,sBAAsB,EAAE,CAInC,KAAK,EAAE,OAAO,EACd,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EACtC,OAAO,CAAC,EAAE,OAAO,KACd,cAC2B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderToPipeableStream = void 0;
|
|
4
|
+
// @ts-expect-error Untyped module
|
|
5
|
+
const server_node_1 = require("react-server-dom-webpack/server.node");
|
|
6
|
+
exports.renderToPipeableStream = server_node_1.renderToPipeableStream;
|
|
7
|
+
//# sourceMappingURL=server.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.node.js","sourceRoot":"","sources":["../src/server.node.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,sEAAgH;AAcnG,QAAA,sBAAsB,GAQjC,oCAA8B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-on-rails-rsc",
|
|
3
|
+
"version": "19.0.0",
|
|
4
|
+
"description": "React Server Components support for react_on_rails Ruby gem",
|
|
5
|
+
"exports": {
|
|
6
|
+
"./client": {
|
|
7
|
+
"types": "./dist/client.d.ts",
|
|
8
|
+
"default": "./dist/client.js"
|
|
9
|
+
},
|
|
10
|
+
"./server.node": {
|
|
11
|
+
"types": "./dist/server.node.d.ts",
|
|
12
|
+
"default": "./dist/server.node.js"
|
|
13
|
+
},
|
|
14
|
+
"./WebpackPlugin": {
|
|
15
|
+
"types": "./dist/WebpackPlugin.d.ts",
|
|
16
|
+
"default": "./dist/WebpackPlugin.js"
|
|
17
|
+
},
|
|
18
|
+
"./WebpackLoader": "./dist/WebpackLoader.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo && yarn run tsc",
|
|
26
|
+
"prepublishOnly": "yarn run build",
|
|
27
|
+
"build-if-needed": "[ -f dist/client.js ] || (yarn run build >/dev/null 2>&1 || true) && [ -f dist/client.js ] || { echo 'Build failed'; }",
|
|
28
|
+
"prepack": "yarn run build-if-needed",
|
|
29
|
+
"prepare": "yarn run build-if-needed"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"react-server-dom-webpack": "19.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@tsconfig/node14": "^14.1.2",
|
|
36
|
+
"typescript": "^5.4.3",
|
|
37
|
+
"webpack": "^5.98.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "19.0.0",
|
|
41
|
+
"react-dom": "19.0.0"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/shakacode-tools/react-on-rails-rsc.git"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"server components",
|
|
49
|
+
"rsc",
|
|
50
|
+
"ruby on rails",
|
|
51
|
+
"react-on-rails"
|
|
52
|
+
],
|
|
53
|
+
"author": "ShakaCode",
|
|
54
|
+
"license": "MIT"
|
|
55
|
+
}
|