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

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e8b48934b25fc73c93eadc46d1fb4386a9289f40d1441be9a4a3f3cdb1cfb5d
4
- data.tar.gz: 284e9e9ec4e81e4659f2a34385b3e7ab0df67ef258b60359da0b1a01e88eea1c
3
+ metadata.gz: c1d7d3cf2e6a1a031361b2cc056e9aef369c2f26eda0463fa9f40158a1e21301
4
+ data.tar.gz: aa3a97e407e6fe6bbacbe4c4b312c13ee7214190daac3459e388513ab0e28ffd
5
5
  SHA512:
6
- metadata.gz: 422e20effaf3f3b830a7f68fb771e8b61a7f42450cc80a4d491533be07995be85c4f11e4c37fea7643aaea7da857136e6909d725a5bf53d4dfe308a5a8bc42a4
7
- data.tar.gz: 2487723877f13ea41e3652fb38355935f237ea9b59f4285a7c8583485e1eb933e622c19b0a54863472a7bb39d704e2c015558539e4719f2a4c607071f9233269
6
+ metadata.gz: 5e45d02f71d0a19ded76e7e77e507a765e843d5f1055b5c77b663d7207d215248b2c46c64e5b435cc2d1ed86a3286d8142469b26eb041fc5624f0cf1722bf7c3
7
+ data.tar.gz: 6e24bece53a89c2a077024e559d511b7cddf9285cf503d1ce111ae93caaa9555ac5070dd725273ed54bb738926b8285e95fc109178db0f7b012f0b4252215c64
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.beta4)
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.4"
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.4",
4
4
  "homepage": "https://github.com/renchap/react-components-rails",
5
5
  "repository": "renchap/react-components-rails",
6
6
  "author": {
@@ -8,37 +8,38 @@
8
8
  "email": "renchap@gmail.com"
9
9
  },
10
10
  "license": "MIT",
11
- "type": "module",
12
11
  "source": "src/index.ts",
13
12
  "exports": {
14
- "require": "./dist/react-components-rails.cjs",
15
- "default": "./dist/react-components-rails.modern.js"
13
+ "import": "./dist/index.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
+ "type": "module",
18
+ "main": "./dist/index.cjs",
19
+ "types": "dist/index.d.ts",
20
+ "files": [
21
+ "dist/",
22
+ "src/"
23
+ ],
20
24
  "scripts": {
21
- "build": "microbundle",
22
- "dev": "microbundle watch"
23
- },
24
- "dependencies": {
25
- "@types/lodash": "^4.14.179",
26
- "lodash": "^4.17.21"
25
+ "build": "tsup src/index.ts --dts --sourcemap --format esm --target es6 --minify && tsup src/index.ts --sourcemap --format cjs --target es5 --minify",
26
+ "dev": "tsup watch"
27
27
  },
28
+ "dependencies": {},
28
29
  "peerDependencies": {
29
30
  "react": ">= 0.14",
30
31
  "react-dom": ">= 0.14"
31
32
  },
32
33
  "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"
34
+ "@swc/core": "^1.2.231",
35
+ "@types/react": "^18.0.17",
36
+ "@types/react-dom": "^18.0.6",
37
+ "prettier": "^2.7.1",
38
+ "react": "^18.2.0",
39
+ "react-dom": "^18.2.0",
40
+ "tsup": "^6.2.2",
41
+ "typescript": "^4.7.4"
40
42
  },
41
- "packageManager": "yarn@3.2.0",
42
43
  "prettier": {
43
44
  "semi": false
44
45
  }