react-on-rails 16.2.0-beta.12 → 16.2.0-beta.16
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/LICENSE.md +83 -0
- package/lib/ClientRenderer.js +0 -1
- package/lib/base/full.d.ts +3 -1
- package/lib/buildConsoleReplay.d.ts +2 -2
- package/lib/reactApis.cjs +21 -8
- package/lib/serverRenderReactComponent.js +1 -0
- package/lib/types/index.d.ts +3 -3
- package/package.json +14 -23
package/LICENSE.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Licensing
|
|
2
|
+
|
|
3
|
+
This repository contains code under two different licenses:
|
|
4
|
+
|
|
5
|
+
- **Core**: MIT License (applies to most files)
|
|
6
|
+
- **Pro**: React on Rails Pro License (applies to specific directories)
|
|
7
|
+
|
|
8
|
+
## License Scope
|
|
9
|
+
|
|
10
|
+
### MIT Licensed Code
|
|
11
|
+
|
|
12
|
+
The following directories and all their contents are licensed under the **MIT License** (see full text below):
|
|
13
|
+
|
|
14
|
+
- `react_on_rails/` (entire directory, including lib/, spec/, sig/)
|
|
15
|
+
- `packages/react-on-rails/` (entire package)
|
|
16
|
+
- All other directories in this repository not explicitly listed as Pro-licensed
|
|
17
|
+
|
|
18
|
+
### Pro Licensed Code
|
|
19
|
+
|
|
20
|
+
The following directories and all their contents are licensed under the **React on Rails Pro License**:
|
|
21
|
+
|
|
22
|
+
- `packages/react-on-rails-pro/` (entire package)
|
|
23
|
+
- `packages/react-on-rails-pro-node-renderer/` (entire package)
|
|
24
|
+
- `react_on_rails_pro/` (entire directory)
|
|
25
|
+
|
|
26
|
+
See [REACT-ON-RAILS-PRO-LICENSE.md](./REACT-ON-RAILS-PRO-LICENSE.md) for complete Pro license terms.
|
|
27
|
+
|
|
28
|
+
**Important:** Pro-licensed code is included in this package but requires a valid React on Rails Pro subscription to use. Using Pro features without a valid license violates the React on Rails Pro License.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## MIT License
|
|
33
|
+
|
|
34
|
+
This license applies to all MIT-licensed code as defined above.
|
|
35
|
+
|
|
36
|
+
Copyright (c) 2017, 2018 Justin Gordon and ShakaCode
|
|
37
|
+
Copyright (c) 2015–2025 ShakaCode, LLC
|
|
38
|
+
|
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
41
|
+
in the Software without restriction, including without limitation the rights
|
|
42
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
43
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
44
|
+
furnished to do so, subject to the following conditions:
|
|
45
|
+
|
|
46
|
+
The above copyright notice and this permission notice shall be included in
|
|
47
|
+
all copies or substantial portions of the Software.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Disclaimer
|
|
52
|
+
|
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
54
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
55
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
56
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
57
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
58
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
59
|
+
SOFTWARE.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## React on Rails Pro License
|
|
64
|
+
|
|
65
|
+
For Pro-licensed code (as defined in the "License Scope" section above), see:
|
|
66
|
+
[REACT-ON-RAILS-PRO-LICENSE.md](./REACT-ON-RAILS-PRO-LICENSE.md)
|
|
67
|
+
|
|
68
|
+
**Key Points:**
|
|
69
|
+
|
|
70
|
+
- Pro features require a valid React on Rails Pro subscription for production use
|
|
71
|
+
- Free use is permitted for educational, personal, and non-production purposes
|
|
72
|
+
- Modifying MIT-licensed interface files is permitted under MIT terms
|
|
73
|
+
- However, using those modifications to access Pro features without a valid license violates the Pro License
|
|
74
|
+
|
|
75
|
+
### License Validation Mechanisms
|
|
76
|
+
|
|
77
|
+
**License validation mechanisms** include but are not limited to:
|
|
78
|
+
|
|
79
|
+
- Runtime checks for valid Pro subscriptions
|
|
80
|
+
- Authentication systems in `react_on_rails/lib/react_on_rails/utils.rb` and Pro TypeScript modules
|
|
81
|
+
- The `react_on_rails_pro?` method and `rorPro` field generation
|
|
82
|
+
|
|
83
|
+
While MIT-licensed code may be modified under MIT terms, using such modifications to access Pro features without a valid license violates the React on Rails Pro License.
|
package/lib/ClientRenderer.js
CHANGED
package/lib/base/full.d.ts
CHANGED
|
@@ -8,8 +8,10 @@ export type ReactOnRailsFullSpecificFunctions = Pick<ReactOnRailsInternal, 'hand
|
|
|
8
8
|
/**
|
|
9
9
|
* Full object type that includes all base methods plus real SSR implementations.
|
|
10
10
|
* Derived from ReactOnRailsInternal by picking base methods and SSR methods.
|
|
11
|
+
* Note: BaseClientObjectType already includes serverRenderReactComponent and handleError,
|
|
12
|
+
* so ReactOnRailsFullSpecificFunctions is a subset.
|
|
11
13
|
* @public
|
|
12
14
|
*/
|
|
13
|
-
export type BaseFullObjectType = Pick<ReactOnRailsInternal, keyof BaseClientObjectType
|
|
15
|
+
export type BaseFullObjectType = Pick<ReactOnRailsInternal, keyof BaseClientObjectType>;
|
|
14
16
|
export declare function createBaseFullObject(registries: Parameters<typeof createBaseClientObject>[0], currentObject?: BaseClientObjectType | null): BaseFullObjectType;
|
|
15
17
|
//# sourceMappingURL=full.d.ts.map
|
|
@@ -11,6 +11,6 @@ declare global {
|
|
|
11
11
|
* This is useful when you want to wrap the code in script tags yourself (e.g., with a CSP nonce).
|
|
12
12
|
* @internal Exported for tests and for Ruby helper to wrap with nonce
|
|
13
13
|
*/
|
|
14
|
-
export declare function consoleReplay(customConsoleHistory?: (typeof console)['history']
|
|
15
|
-
export default function buildConsoleReplay(customConsoleHistory?: (typeof console)['history']
|
|
14
|
+
export declare function consoleReplay(customConsoleHistory?: (typeof console)['history'], numberOfMessagesToSkip?: number): string;
|
|
15
|
+
export default function buildConsoleReplay(customConsoleHistory?: (typeof console)['history'], numberOfMessagesToSkip?: number, nonce?: string): string;
|
|
16
16
|
//# sourceMappingURL=buildConsoleReplay.d.ts.map
|
package/lib/reactApis.cjs
CHANGED
|
@@ -25,25 +25,38 @@ if (exports.supportsRootApi) {
|
|
|
25
25
|
reactDomClient = ReactDOM;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// Cast ReactDOM to include legacy APIs for React 16/17 compatibility
|
|
29
|
+
// These methods exist at runtime but are removed from @types/react-dom@19
|
|
30
|
+
const legacyReactDOM = ReactDOM;
|
|
31
|
+
// Validate legacy APIs exist at runtime when needed (React < 18)
|
|
32
|
+
if (!exports.supportsRootApi) {
|
|
33
|
+
if (typeof legacyReactDOM.hydrate !== 'function') {
|
|
34
|
+
throw new Error('React legacy hydrate API not available. Expected React 16/17.');
|
|
35
|
+
}
|
|
36
|
+
if (typeof legacyReactDOM.render !== 'function') {
|
|
37
|
+
throw new Error('React legacy render API not available. Expected React 16/17.');
|
|
38
|
+
}
|
|
39
|
+
if (typeof legacyReactDOM.unmountComponentAtNode !== 'function') {
|
|
40
|
+
throw new Error('React legacy unmountComponentAtNode API not available. Expected React 16/17.');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion -- reactDomClient is always defined when supportsRootApi is true */
|
|
31
44
|
exports.reactHydrate = exports.supportsRootApi
|
|
32
45
|
? reactDomClient.hydrateRoot
|
|
33
|
-
: (domNode, reactElement) =>
|
|
46
|
+
: (domNode, reactElement) => legacyReactDOM.hydrate(reactElement, domNode);
|
|
34
47
|
function reactRender(domNode, reactElement) {
|
|
35
48
|
if (exports.supportsRootApi) {
|
|
36
49
|
const root = reactDomClient.createRoot(domNode);
|
|
37
50
|
root.render(reactElement);
|
|
38
51
|
return root;
|
|
39
52
|
}
|
|
40
|
-
|
|
41
|
-
return ReactDOM.render(reactElement, domNode);
|
|
53
|
+
return legacyReactDOM.render(reactElement, domNode);
|
|
42
54
|
}
|
|
43
55
|
exports.unmountComponentAtNode = exports.supportsRootApi
|
|
44
56
|
? // not used if we use root API
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
+
(_container) => false
|
|
59
|
+
: (container) => legacyReactDOM.unmountComponentAtNode(container);
|
|
47
60
|
const ensureReactUseAvailable = () => {
|
|
48
61
|
if (!('use' in React) || typeof React.use !== 'function') {
|
|
49
62
|
throw new Error('React.use is not defined. Please ensure you are using React 19 to use server components.');
|
|
@@ -49,6 +49,7 @@ function processPromise(result, renderingReturnsPromises) {
|
|
|
49
49
|
if (isValidElement(promiseResult)) {
|
|
50
50
|
return processReactElement(promiseResult);
|
|
51
51
|
}
|
|
52
|
+
// promiseResult is string | ServerRenderHashRenderedHtml (both are FinalHtmlResult)
|
|
52
53
|
return promiseResult;
|
|
53
54
|
});
|
|
54
55
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ interface ServerRenderResult {
|
|
|
68
68
|
routeError?: Error;
|
|
69
69
|
error?: Error;
|
|
70
70
|
}
|
|
71
|
-
type CreateReactOutputSyncResult = ServerRenderResult | ReactElement
|
|
72
|
-
type CreateReactOutputAsyncResult = Promise<string | ServerRenderHashRenderedHtml | ReactElement
|
|
71
|
+
type CreateReactOutputSyncResult = ServerRenderResult | ReactElement;
|
|
72
|
+
type CreateReactOutputAsyncResult = Promise<string | ServerRenderHashRenderedHtml | ReactElement>;
|
|
73
73
|
type CreateReactOutputResult = CreateReactOutputSyncResult | CreateReactOutputAsyncResult;
|
|
74
74
|
type RenderFunctionSyncResult = ReactComponent | ServerRenderResult;
|
|
75
75
|
type RenderFunctionAsyncResult = Promise<string | ServerRenderHashRenderedHtml | ReactComponent>;
|
|
@@ -249,7 +249,7 @@ export interface ReactOnRailsInternal extends ReactOnRails {
|
|
|
249
249
|
* @param key
|
|
250
250
|
* @returns option value
|
|
251
251
|
*/
|
|
252
|
-
option<K extends keyof ReactOnRailsOptions>(key: K): ReactOnRailsOptions[K]
|
|
252
|
+
option<K extends keyof ReactOnRailsOptions>(key: K): ReactOnRailsOptions[K];
|
|
253
253
|
/**
|
|
254
254
|
* Allows retrieval of the store generator by name. This is used internally by ReactOnRails after
|
|
255
255
|
* a Rails form loads to prepare stores.
|
package/package.json
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-on-rails",
|
|
3
|
-
"version": "16.2.0-beta.
|
|
3
|
+
"version": "16.2.0-beta.16",
|
|
4
4
|
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
|
|
5
5
|
"main": "lib/ReactOnRails.full.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "yarn run clean && yarn run tsc",
|
|
9
|
-
"build-watch": "yarn run clean && yarn run tsc --watch",
|
|
10
|
-
"clean": "rm -rf ./lib",
|
|
11
|
-
"test": "jest tests",
|
|
12
|
-
"type-check": "yarn run tsc --noEmit --noErrorTruncation",
|
|
13
|
-
"prepack": "nps build.prepack",
|
|
14
|
-
"prepare": "nps build.prepack",
|
|
15
|
-
"prepublishOnly": "yarn run build",
|
|
16
|
-
"yalc:publish": "yalc publish",
|
|
17
|
-
"yalc": "yalc"
|
|
18
|
-
},
|
|
19
7
|
"repository": {
|
|
20
8
|
"type": "git",
|
|
21
9
|
"url": "git+https://github.com/shakacode/react_on_rails.git"
|
|
@@ -28,7 +16,7 @@
|
|
|
28
16
|
"on",
|
|
29
17
|
"Rails"
|
|
30
18
|
],
|
|
31
|
-
"author": "justin
|
|
19
|
+
"author": "justin@shakacode.com",
|
|
32
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
33
21
|
"exports": {
|
|
34
22
|
".": {
|
|
@@ -60,13 +48,7 @@
|
|
|
60
48
|
},
|
|
61
49
|
"peerDependencies": {
|
|
62
50
|
"react": ">= 16",
|
|
63
|
-
"react-dom": ">= 16"
|
|
64
|
-
"react-on-rails-rsc": "19.0.2"
|
|
65
|
-
},
|
|
66
|
-
"peerDependenciesMeta": {
|
|
67
|
-
"react-on-rails-rsc": {
|
|
68
|
-
"optional": true
|
|
69
|
-
}
|
|
51
|
+
"react-dom": ">= 16"
|
|
70
52
|
},
|
|
71
53
|
"files": [
|
|
72
54
|
"lib/**/*.js",
|
|
@@ -77,5 +59,14 @@
|
|
|
77
59
|
"bugs": {
|
|
78
60
|
"url": "https://github.com/shakacode/react_on_rails/issues"
|
|
79
61
|
},
|
|
80
|
-
"homepage": "https://github.com/shakacode/react_on_rails#readme"
|
|
81
|
-
|
|
62
|
+
"homepage": "https://github.com/shakacode/react_on_rails#readme",
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "pnpm run clean && tsc",
|
|
65
|
+
"build-watch": "pnpm run clean && tsc --watch",
|
|
66
|
+
"clean": "rm -rf ./lib",
|
|
67
|
+
"test": "jest tests",
|
|
68
|
+
"type-check": "tsc --noEmit --noErrorTruncation",
|
|
69
|
+
"yalc:publish": "yalc publish",
|
|
70
|
+
"yalc": "yalc"
|
|
71
|
+
}
|
|
72
|
+
}
|