react-components-rails 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e8b48934b25fc73c93eadc46d1fb4386a9289f40d1441be9a4a3f3cdb1cfb5d
4
- data.tar.gz: 284e9e9ec4e81e4659f2a34385b3e7ab0df67ef258b60359da0b1a01e88eea1c
3
+ metadata.gz: c8ba858d748c6f96a4537c328a9181cf4a16a4b73d951f5623993cf0c38f4998
4
+ data.tar.gz: 3c9516b00e4d060d1ab45b4cf57e8721dffdc9f683e8fd469f8960ce435b8b34
5
5
  SHA512:
6
- metadata.gz: 422e20effaf3f3b830a7f68fb771e8b61a7f42450cc80a4d491533be07995be85c4f11e4c37fea7643aaea7da857136e6909d725a5bf53d4dfe308a5a8bc42a4
7
- data.tar.gz: 2487723877f13ea41e3652fb38355935f237ea9b59f4285a7c8583485e1eb933e622c19b0a54863472a7bb39d704e2c015558539e4719f2a4c607071f9233269
6
+ metadata.gz: 52b8286cec7712a22c21fa99f7b06a3520e7e97f97afa1e655d90f44d45dd7c04470aaa37c1cf04ae4d01d6eb5facd1e42406ebe0a9571f9225f95d68c46a0c1
7
+ data.tar.gz: 69b40924f14cbef646d6b4081e24693482359b5140a860422c62bbae889095bc58e9cd2acf6255a538590012f2d3123b96f87bf81e67abde233f779fe6093d02
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- react-components-rails (1.0.0.beta1)
4
+ react-components-rails (1.0.0.beta2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,7 +11,6 @@ GEM
11
11
  parser (3.1.1.0)
12
12
  ast (~> 2.4.1)
13
13
  rainbow (3.1.1)
14
- rake (13.0.6)
15
14
  regexp_parser (2.2.1)
16
15
  rexml (3.2.5)
17
16
  rubocop (1.25.1)
@@ -29,11 +28,11 @@ GEM
29
28
  unicode-display_width (2.1.0)
30
29
 
31
30
  PLATFORMS
31
+ arm64-darwin-21
32
32
  x86_64-darwin-21
33
33
 
34
34
  DEPENDENCIES
35
35
  bundler (~> 2.3)
36
- rake (~> 13.0)
37
36
  react-components-rails!
38
37
  rubocop
39
38
 
data/README.md CHANGED
@@ -9,7 +9,7 @@ React-Components-Rails makes it easy to use [React](https://reactjs.org/) with y
9
9
  First, you need to add this gem to your Rails app Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'react-components-rails', "~> 1.0.0.beta.1"
12
+ gem 'react-components-rails', "~> 1.0.0.beta.2"
13
13
  ```
14
14
 
15
15
  Once done, run `bundle` to install the gem.
@@ -33,7 +33,7 @@ In your app entry file, import your components as well as `react-components-rail
33
33
  import Hello from "components/hello"
34
34
  import ReactComponentsRails from "react-components-rails"
35
35
 
36
- ReactComponentsRails.setup({ Hello }) // ES6 shorthand for {Hello: Hello}
36
+ ReactComponentsRails.setup({ Hello }) // ES6 shorthand for { Hello: Hello }
37
37
  ```
38
38
 
39
39
  ### Rendering from a view
@@ -73,6 +73,12 @@ You can also pass any of the usual arguments to `render` in this call: `layout`,
73
73
 
74
74
  It should be supported out of the box, if supported by your Javascript stack. Please refer to your Javascript compiler/bundler documentation to do so.
75
75
 
76
+ ## React versions
77
+
78
+ This package tries to support both the legacy React DOM interface (`ReactDOM.render`) and the new one introduced in React 18 (`ReactDOM.createRoot`).
79
+
80
+ The installed React version is tested at runtime by trying to import `react-dom/client`. If the import succeeds then the new API is used, otherwise we fallback to the legacy API.
81
+
76
82
  <!--
77
83
  ## Development
78
84
 
@@ -0,0 +1,3 @@
1
+ require "railtie" if defined?(Rails)
2
+ require "helpers"
3
+ require "component"
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-components-rails",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "homepage": "https://github.com/renchap/react-components-rails",
5
5
  "repository": "renchap/react-components-rails",
6
6
  "author": {
@@ -11,18 +11,21 @@
11
11
  "type": "module",
12
12
  "source": "src/index.ts",
13
13
  "exports": {
14
- "require": "./dist/react-components-rails.cjs",
15
- "default": "./dist/react-components-rails.modern.js"
14
+ "require": "./dist/index.cjs",
15
+ "default": "./dist/index.js"
16
16
  },
17
- "main": "./dist/react-components-rails.cjs",
18
- "module": "./dist/react-components-rails.module.js",
19
- "unpkg": "./dist/react-components-rails.umd.js",
17
+ "main": "./dist/index.cjs",
18
+ "types": "dist/index.d.ts",
19
+ "files": [
20
+ "dist/",
21
+ "src/"
22
+ ],
20
23
  "scripts": {
21
- "build": "microbundle",
22
- "dev": "microbundle watch"
24
+ "build": "tsup src/index.ts --dts --sourcemap --format esm --target es6 --minify && tsup src/index.ts --sourcemap --format cjs --target es5 --minify",
25
+ "dev": "tsup watch"
23
26
  },
24
27
  "dependencies": {
25
- "@types/lodash": "^4.14.179",
28
+ "@types/lodash": "^4.14.182",
26
29
  "lodash": "^4.17.21"
27
30
  },
28
31
  "peerDependencies": {
@@ -30,15 +33,15 @@
30
33
  "react-dom": ">= 0.14"
31
34
  },
32
35
  "devDependencies": {
33
- "@types/react": "^17.0.39",
34
- "@types/react-dom": "^17.0.11",
35
- "microbundle": "^0.14.2",
36
- "prettier": "^2.5.1",
37
- "react": "^17.0.2",
38
- "react-dom": "^17.0.2",
39
- "typescript": "^4.5.5"
36
+ "@swc/core": "^1.2.231",
37
+ "@types/react": "^18.0.17",
38
+ "@types/react-dom": "^18.0.6",
39
+ "prettier": "^2.7.1",
40
+ "react": "^18.2.0",
41
+ "react-dom": "^18.2.0",
42
+ "tsup": "^6.2.2",
43
+ "typescript": "^4.7.4"
40
44
  },
41
- "packageManager": "yarn@3.2.0",
42
45
  "prettier": {
43
46
  "semi": false
44
47
  }