react-on-rails 16.7.0-rc.0 → 16.7.0-rc.2
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/lib/ReactDOMServer.d.cts +2 -0
- package/lib/reactApis.cjs +3 -1
- package/lib/reactApis.d.cts +11 -0
- package/lib/webpackHelpers.cjs +29 -0
- package/lib/webpackHelpers.d.cts +25 -0
- package/package.json +4 -2
package/lib/reactApis.cjs
CHANGED
|
@@ -15,7 +15,9 @@ let reactDomClient;
|
|
|
15
15
|
if (exports.supportsRootApi) {
|
|
16
16
|
// This will never throw an exception, but it's the way to tell Webpack the dependency is optional
|
|
17
17
|
// https://github.com/webpack/webpack/issues/339#issuecomment-47739112
|
|
18
|
-
// Unfortunately, it only converts the error to a warning.
|
|
18
|
+
// Unfortunately, it only converts the error to a warning. React 16/17 consumers can suppress
|
|
19
|
+
// the warning by passing `reactDomClientWarning` from 'react-on-rails/webpackHelpers' to their
|
|
20
|
+
// webpack `ignoreWarnings` config. See #3137.
|
|
19
21
|
try {
|
|
20
22
|
reactDomClient = require('react-dom/client');
|
|
21
23
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { RenderReturnType } from './types/index.ts' with { 'resolution-mode': 'import' };
|
|
3
|
+
export declare const supportsRootApi: boolean;
|
|
4
|
+
export declare const supportsHydrate: boolean;
|
|
5
|
+
type HydrateOrRenderType = (domNode: Element, reactElement: ReactElement) => RenderReturnType;
|
|
6
|
+
export declare const reactHydrate: HydrateOrRenderType;
|
|
7
|
+
export declare function reactRender(domNode: Element, reactElement: ReactElement): RenderReturnType;
|
|
8
|
+
export declare const unmountComponentAtNode: (container: Element) => boolean;
|
|
9
|
+
export declare const ensureReactUseAvailable: () => void;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=reactApis.d.cts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reactDomClientWarning = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Suppression pattern for the "Module not found: Can't resolve 'react-dom/client'"
|
|
6
|
+
* warning that webpack emits when building React 16/17 apps with react-on-rails.
|
|
7
|
+
*
|
|
8
|
+
* The warning is harmless: react-on-rails detects the React version at runtime and
|
|
9
|
+
* only calls into react-dom/client when React 18+ is available. But webpack's static
|
|
10
|
+
* analysis still tries to resolve the conditional require at build time, so the
|
|
11
|
+
* warning shows up on React 16/17 builds even though the build is healthy.
|
|
12
|
+
*
|
|
13
|
+
* Usage in your webpack config (Webpack 5 / Shakapacker):
|
|
14
|
+
*
|
|
15
|
+
* const { reactDomClientWarning } = require('react-on-rails/webpackHelpers');
|
|
16
|
+
*
|
|
17
|
+
* module.exports = {
|
|
18
|
+
* // ...
|
|
19
|
+
* ignoreWarnings: [reactDomClientWarning],
|
|
20
|
+
* };
|
|
21
|
+
*
|
|
22
|
+
* Webpack 4 / Webpacker 5 users can pass the same regex to
|
|
23
|
+
* `stats.warningsFilter` instead, since `ignoreWarnings` is a Webpack 5 option.
|
|
24
|
+
*
|
|
25
|
+
* Tracking issue: https://github.com/shakacode/react_on_rails/issues/3137
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line import/prefer-default-export -- intentionally named so additional helpers can be added later without a breaking change
|
|
28
|
+
exports.reactDomClientWarning = /Module not found: Error: Can't resolve 'react-dom\/client'/;
|
|
29
|
+
//# sourceMappingURL=webpackHelpers.cjs.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suppression pattern for the "Module not found: Can't resolve 'react-dom/client'"
|
|
3
|
+
* warning that webpack emits when building React 16/17 apps with react-on-rails.
|
|
4
|
+
*
|
|
5
|
+
* The warning is harmless: react-on-rails detects the React version at runtime and
|
|
6
|
+
* only calls into react-dom/client when React 18+ is available. But webpack's static
|
|
7
|
+
* analysis still tries to resolve the conditional require at build time, so the
|
|
8
|
+
* warning shows up on React 16/17 builds even though the build is healthy.
|
|
9
|
+
*
|
|
10
|
+
* Usage in your webpack config (Webpack 5 / Shakapacker):
|
|
11
|
+
*
|
|
12
|
+
* const { reactDomClientWarning } = require('react-on-rails/webpackHelpers');
|
|
13
|
+
*
|
|
14
|
+
* module.exports = {
|
|
15
|
+
* // ...
|
|
16
|
+
* ignoreWarnings: [reactDomClientWarning],
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* Webpack 4 / Webpacker 5 users can pass the same regex to
|
|
20
|
+
* `stats.warningsFilter` instead, since `ignoreWarnings` is a Webpack 5 option.
|
|
21
|
+
*
|
|
22
|
+
* Tracking issue: https://github.com/shakacode/react_on_rails/issues/3137
|
|
23
|
+
*/
|
|
24
|
+
export declare const reactDomClientWarning: RegExp;
|
|
25
|
+
//# sourceMappingURL=webpackHelpers.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-on-rails",
|
|
3
|
-
"version": "16.7.0-rc.
|
|
3
|
+
"version": "16.7.0-rc.2",
|
|
4
4
|
"description": "react-on-rails JavaScript for react_on_rails Ruby gem",
|
|
5
5
|
"main": "lib/ReactOnRails.full.js",
|
|
6
6
|
"type": "module",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"./createReactOutput": "./lib/createReactOutput.js",
|
|
31
31
|
"./isServerRenderResult": "./lib/isServerRenderResult.js",
|
|
32
32
|
"./reactApis": "./lib/reactApis.cjs",
|
|
33
|
+
"./webpackHelpers": "./lib/webpackHelpers.cjs",
|
|
33
34
|
"./reactHydrateOrRender": "./lib/reactHydrateOrRender.js",
|
|
34
35
|
"./turbolinksUtils": "./lib/turbolinksUtils.js",
|
|
35
36
|
"./isRenderFunction": "./lib/isRenderFunction.js",
|
|
@@ -63,7 +64,8 @@
|
|
|
63
64
|
"lib/**/*.js",
|
|
64
65
|
"lib/**/*.cjs",
|
|
65
66
|
"lib/**/*.mjs",
|
|
66
|
-
"lib/**/*.d.ts"
|
|
67
|
+
"lib/**/*.d.ts",
|
|
68
|
+
"lib/**/*.d.cts"
|
|
67
69
|
],
|
|
68
70
|
"bugs": {
|
|
69
71
|
"url": "https://github.com/shakacode/react_on_rails/issues"
|