react-webpacker 1.1.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.
- checksums.yaml +7 -0
- data/.babelrc +3 -0
- data/.eslintignore +2 -0
- data/.eslintrc.js +40 -0
- data/.gitattributes +1 -0
- data/.gitignore +5 -0
- data/.prettierignore +2 -0
- data/.prettierrc +4 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +129 -0
- data/LICENSE +21 -0
- data/README.md +46 -0
- data/Rakefile +11 -0
- data/lib/react-webpacker.rb +4 -0
- data/lib/react-webpacker/render_component.rb +11 -0
- data/lib/react-webpacker/use_components.rb +7 -0
- data/lib/react-webpacker/version.rb +3 -0
- data/package.json +39 -0
- data/react-webpacker.gemspec +18 -0
- data/src/react-webpacker.js +22 -0
- data/test/dummy/components/MyComponent.jsx +16 -0
- data/test/dummy/react-webpacker.js +2 -0
- data/test/react-webpacker_test.js +61 -0
- data/test/react-webpacker_test.rb +44 -0
- data/test/render-component_expected.html +1 -0
- data/test/use-components_expected.html +1 -0
- data/webpack.config.js +24 -0
- data/yarn.lock +0 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a67759f981ad12f126e07ed80d2023669a5206a594c97d155b4f9d0e5454bd9d
|
4
|
+
data.tar.gz: 86d69472fa9c7ea222b41f265df482e0ea8038a9bf74b04230d0b08f490fc881
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ba22aa7991fa1ca36911622aa97c0e94a5dc53b1be275752ae7e4e9de8a65d43f98056a2ffbe9bf81ea56e43d882ab4c9f1504be7fc89f4854402375b1c34b6
|
7
|
+
data.tar.gz: 9f588d5239cd5065a8ef064bc8443dd81443a7533194c6274d6ce58a89062326916f0ebddbd7ad7f78b098fd1a50cf7c039f0d86c159d07d659799ca96643f01
|
data/.babelrc
ADDED
data/.eslintignore
ADDED
data/.eslintrc.js
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module.exports = {
|
2
|
+
parser: 'babel-eslint',
|
3
|
+
parserOptions: {
|
4
|
+
ecmaVersion: 7,
|
5
|
+
sourceType: 'module',
|
6
|
+
ecmaFeatures: { implicitStrict: true, jsx: true }
|
7
|
+
},
|
8
|
+
plugins: ['standard', 'jest', 'prettier', 'react'],
|
9
|
+
extends: [
|
10
|
+
'standard',
|
11
|
+
'prettier',
|
12
|
+
'prettier/react',
|
13
|
+
'plugin:import/errors',
|
14
|
+
'plugin:jest/recommended',
|
15
|
+
'plugin:react/recommended'
|
16
|
+
],
|
17
|
+
rules: {
|
18
|
+
'prettier/prettier': [
|
19
|
+
2,
|
20
|
+
{
|
21
|
+
parser: 'flow',
|
22
|
+
semi: false,
|
23
|
+
singleQuote: true,
|
24
|
+
trailingComma: 'none'
|
25
|
+
}
|
26
|
+
],
|
27
|
+
'no-process-env': 0,
|
28
|
+
'no-unused-vars': [
|
29
|
+
2,
|
30
|
+
{
|
31
|
+
argsIgnorePattern: '^_',
|
32
|
+
varsIgnorePattern: '^_'
|
33
|
+
}
|
34
|
+
],
|
35
|
+
'prefer-arrow-callback': 2,
|
36
|
+
'prefer-const': 2,
|
37
|
+
'react/jsx-uses-vars': 2,
|
38
|
+
'standard/computed-property-even-spacing': 0
|
39
|
+
}
|
40
|
+
}
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
yarn.lock binary
|
data/.gitignore
ADDED
data/.prettierignore
ADDED
data/.prettierrc
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
react-webpacker (1.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actioncable (5.1.4)
|
10
|
+
actionpack (= 5.1.4)
|
11
|
+
nio4r (~> 2.0)
|
12
|
+
websocket-driver (~> 0.6.1)
|
13
|
+
actionmailer (5.1.4)
|
14
|
+
actionpack (= 5.1.4)
|
15
|
+
actionview (= 5.1.4)
|
16
|
+
activejob (= 5.1.4)
|
17
|
+
mail (~> 2.5, >= 2.5.4)
|
18
|
+
rails-dom-testing (~> 2.0)
|
19
|
+
actionpack (5.1.4)
|
20
|
+
actionview (= 5.1.4)
|
21
|
+
activesupport (= 5.1.4)
|
22
|
+
rack (~> 2.0)
|
23
|
+
rack-test (>= 0.6.3)
|
24
|
+
rails-dom-testing (~> 2.0)
|
25
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
26
|
+
actionview (5.1.4)
|
27
|
+
activesupport (= 5.1.4)
|
28
|
+
builder (~> 3.1)
|
29
|
+
erubi (~> 1.4)
|
30
|
+
rails-dom-testing (~> 2.0)
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
32
|
+
activejob (5.1.4)
|
33
|
+
activesupport (= 5.1.4)
|
34
|
+
globalid (>= 0.3.6)
|
35
|
+
activemodel (5.1.4)
|
36
|
+
activesupport (= 5.1.4)
|
37
|
+
activerecord (5.1.4)
|
38
|
+
activemodel (= 5.1.4)
|
39
|
+
activesupport (= 5.1.4)
|
40
|
+
arel (~> 8.0)
|
41
|
+
activesupport (5.1.4)
|
42
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
43
|
+
i18n (~> 0.7)
|
44
|
+
minitest (~> 5.1)
|
45
|
+
tzinfo (~> 1.1)
|
46
|
+
arel (8.0.0)
|
47
|
+
builder (3.2.3)
|
48
|
+
byebug (10.0.0)
|
49
|
+
concurrent-ruby (1.0.5)
|
50
|
+
crass (1.0.3)
|
51
|
+
erubi (1.7.0)
|
52
|
+
globalid (0.4.1)
|
53
|
+
activesupport (>= 4.2.0)
|
54
|
+
i18n (0.9.3)
|
55
|
+
concurrent-ruby (~> 1.0)
|
56
|
+
loofah (2.1.1)
|
57
|
+
crass (~> 1.0.2)
|
58
|
+
nokogiri (>= 1.5.9)
|
59
|
+
mail (2.7.0)
|
60
|
+
mini_mime (>= 0.1.1)
|
61
|
+
method_source (0.9.0)
|
62
|
+
mini_mime (1.0.0)
|
63
|
+
mini_portile2 (2.3.0)
|
64
|
+
minitest (5.11.3)
|
65
|
+
nio4r (2.2.0)
|
66
|
+
nokogiri (1.8.2)
|
67
|
+
mini_portile2 (~> 2.3.0)
|
68
|
+
rack (2.0.4)
|
69
|
+
rack-proxy (0.6.3)
|
70
|
+
rack
|
71
|
+
rack-test (0.8.2)
|
72
|
+
rack (>= 1.0, < 3)
|
73
|
+
rails (5.1.4)
|
74
|
+
actioncable (= 5.1.4)
|
75
|
+
actionmailer (= 5.1.4)
|
76
|
+
actionpack (= 5.1.4)
|
77
|
+
actionview (= 5.1.4)
|
78
|
+
activejob (= 5.1.4)
|
79
|
+
activemodel (= 5.1.4)
|
80
|
+
activerecord (= 5.1.4)
|
81
|
+
activesupport (= 5.1.4)
|
82
|
+
bundler (>= 1.3.0)
|
83
|
+
railties (= 5.1.4)
|
84
|
+
sprockets-rails (>= 2.0.0)
|
85
|
+
rails-dom-testing (2.0.3)
|
86
|
+
activesupport (>= 4.2.0)
|
87
|
+
nokogiri (>= 1.6)
|
88
|
+
rails-html-sanitizer (1.0.3)
|
89
|
+
loofah (~> 2.0)
|
90
|
+
railties (5.1.4)
|
91
|
+
actionpack (= 5.1.4)
|
92
|
+
activesupport (= 5.1.4)
|
93
|
+
method_source
|
94
|
+
rake (>= 0.8.7)
|
95
|
+
thor (>= 0.18.1, < 2.0)
|
96
|
+
rake (12.3.0)
|
97
|
+
sprockets (3.7.1)
|
98
|
+
concurrent-ruby (~> 1.0)
|
99
|
+
rack (> 1, < 3)
|
100
|
+
sprockets-rails (3.2.1)
|
101
|
+
actionpack (>= 4.0)
|
102
|
+
activesupport (>= 4.0)
|
103
|
+
sprockets (>= 3.0.0)
|
104
|
+
thor (0.20.0)
|
105
|
+
thread_safe (0.3.6)
|
106
|
+
tzinfo (1.2.5)
|
107
|
+
thread_safe (~> 0.1)
|
108
|
+
webpacker (3.2.1)
|
109
|
+
activesupport (>= 4.2)
|
110
|
+
rack-proxy (>= 0.6.1)
|
111
|
+
railties (>= 4.2)
|
112
|
+
websocket-driver (0.6.5)
|
113
|
+
websocket-extensions (>= 0.1.0)
|
114
|
+
websocket-extensions (0.1.3)
|
115
|
+
|
116
|
+
PLATFORMS
|
117
|
+
ruby
|
118
|
+
|
119
|
+
DEPENDENCIES
|
120
|
+
activesupport
|
121
|
+
byebug
|
122
|
+
minitest
|
123
|
+
rails
|
124
|
+
rake
|
125
|
+
react-webpacker!
|
126
|
+
webpacker
|
127
|
+
|
128
|
+
BUNDLED WITH
|
129
|
+
1.16.1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 euxn23
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# React-Webpacker
|
2
|
+
|
3
|
+
React-Webpacker is the smallest, enoughly-tested library for react with webpacker.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
- View Helper to render react component. (using Custom Data Attributes)
|
7
|
+
- JavaScript library to render react components, loading only used components.
|
8
|
+
- Enoughly view testing.
|
9
|
+
- **NOT Provide** Server-Side Rendering.
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
- Add component to `window` scope.
|
13
|
+
```js
|
14
|
+
window.YourCoolComponent = YourCoolComponent
|
15
|
+
```
|
16
|
+
|
17
|
+
- Create JavaScript file to render components into webpacker target directory.
|
18
|
+
```js:react-webpacker.js
|
19
|
+
import ReactWebpacker from 'react-webpacker'
|
20
|
+
|
21
|
+
ReactWebpacker.render()
|
22
|
+
```
|
23
|
+
|
24
|
+
- Add View Helper and JavaScript tag.
|
25
|
+
- From Ruby to JS, `snake_case` in props will be transformed to `camelCase` **AUTOMATICALLY**.
|
26
|
+
- `react-webpacker` script should be called **ONCE** per rendered html page, **DON'T** call in looped views.
|
27
|
+
- DOM is rendered in order from the top, so you should call `react-webpacker` script after `use_components` and `render_component`
|
28
|
+
```slim
|
29
|
+
= use_components(['YourCoolComponent'])
|
30
|
+
= render_component('YourCoolComponent', {props_object: :value})
|
31
|
+
|
32
|
+
= javascript_pack_tag 'react-webpacker'
|
33
|
+
```
|
34
|
+
|
35
|
+
## Compared with `React-Rails` and `React on Rails`
|
36
|
+
- They provide JavaScript library to load **ALL COMPONENTS**, too heavy and harmful for browser performance.
|
37
|
+
- They provide Server-Side Rendering, so library is too large.
|
38
|
+
- They don't test JavaScript library about rendering by E2E testing.
|
39
|
+
|
40
|
+
## Supports
|
41
|
+
- Ruby 2.3.x+
|
42
|
+
- Webpacker 1.1+
|
43
|
+
- Node.js 8.x+
|
44
|
+
|
45
|
+
## License
|
46
|
+
MIT
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module ReactWebpacker
|
2
|
+
# @param [String] component_name
|
3
|
+
# @param [Hash] props
|
4
|
+
def render_component(component_name, props = {})
|
5
|
+
html_options = {
|
6
|
+
'data-component-name' => component_name,
|
7
|
+
'data-props' => props.map { |k, v| [k.to_s.camelize(:lower), v] }.to_h.to_json
|
8
|
+
}
|
9
|
+
content_tag('div', '', html_options).html_safe
|
10
|
+
end
|
11
|
+
end
|
data/package.json
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-webpacker",
|
3
|
+
"version": "1.1.0",
|
4
|
+
"description": "The smallest, enoughly-tested library for react with webpacker.",
|
5
|
+
"main": "src/react-webpacker.js",
|
6
|
+
"scripts": {
|
7
|
+
"fmt": "prettier --write \"{src,test}/**/*.js{,x}\"",
|
8
|
+
"lint": "eslint \"{src,test}/**/*.js{,x}\"",
|
9
|
+
"test": "jest test/react-webpacker_test.js"
|
10
|
+
},
|
11
|
+
"author": "euxn23",
|
12
|
+
"license": "MIT",
|
13
|
+
"devDependencies": {
|
14
|
+
"babel": "^6.23.0",
|
15
|
+
"babel-core": "^6.26.0",
|
16
|
+
"babel-eslint": "^8.2.1",
|
17
|
+
"babel-loader": "^7.1.2",
|
18
|
+
"babel-preset-env": "^1.6.1",
|
19
|
+
"babel-preset-react": "^6.24.1",
|
20
|
+
"eslint": "^4.17.0",
|
21
|
+
"eslint-config-prettier": "^2.9.0",
|
22
|
+
"eslint-config-standard": "^11.0.0-beta.0",
|
23
|
+
"eslint-plugin-import": "^2.8.0",
|
24
|
+
"eslint-plugin-jest": "^21.12.1",
|
25
|
+
"eslint-plugin-node": "^6.0.0",
|
26
|
+
"eslint-plugin-prettier": "^2.6.0",
|
27
|
+
"eslint-plugin-promise": "^3.6.0",
|
28
|
+
"eslint-plugin-react": "^7.6.1",
|
29
|
+
"eslint-plugin-standard": "^3.0.1",
|
30
|
+
"express": "^4.16.2",
|
31
|
+
"jest": "^22.2.2",
|
32
|
+
"prettier": "^1.10.2",
|
33
|
+
"prettier-cli": "^0.1.0",
|
34
|
+
"puppeteer": "^1.0.0",
|
35
|
+
"react": "^16.2.0",
|
36
|
+
"react-dom": "^16.2.0",
|
37
|
+
"webpack": "^3.11.0"
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'react-webpacker/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'react-webpacker'
|
6
|
+
s.version = ReactWebpacker::VERSION
|
7
|
+
s.authors = ['euxn23']
|
8
|
+
s.email = 'euxn23@gmail.com'
|
9
|
+
s.homepage = 'https://github.com/euxn23/webpacker-react'
|
10
|
+
s.summary = 'The smallest, enoughly-tested library for react with webpacker.'
|
11
|
+
s.license = 'MIT'
|
12
|
+
s.required_ruby_version = '>= 2.3.0'
|
13
|
+
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import ReactDOM from 'react-dom'
|
3
|
+
|
4
|
+
export default {
|
5
|
+
render() {
|
6
|
+
document.querySelectorAll('div[data-component-name]').forEach(dom => {
|
7
|
+
const componentName = dom.getAttribute('data-component-name')
|
8
|
+
const component = window[componentName]
|
9
|
+
if (!component)
|
10
|
+
return console.error(
|
11
|
+
`Component ${componentName} is not defined in window scope`
|
12
|
+
)
|
13
|
+
ReactDOM.render(
|
14
|
+
React.createElement(
|
15
|
+
component,
|
16
|
+
JSON.parse(dom.getAttribute('data-props') || {})
|
17
|
+
),
|
18
|
+
dom
|
19
|
+
)
|
20
|
+
})
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
const MyComponent = ({ myName, value }) => (
|
5
|
+
<h1>
|
6
|
+
{myName}: {value}
|
7
|
+
</h1>
|
8
|
+
)
|
9
|
+
|
10
|
+
MyComponent.propTypes = {
|
11
|
+
myName: PropTypes.string.isRequired,
|
12
|
+
value: PropTypes.number.isRequired
|
13
|
+
}
|
14
|
+
|
15
|
+
export default MyComponent
|
16
|
+
window.MyComponent = MyComponent
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import fs from 'fs'
|
2
|
+
import path from 'path'
|
3
|
+
|
4
|
+
import express from 'express'
|
5
|
+
import puppeteer from 'puppeteer'
|
6
|
+
import webpack from 'webpack'
|
7
|
+
|
8
|
+
import webpackConfig from '../webpack.config.js'
|
9
|
+
|
10
|
+
const compiler = webpack(webpackConfig)
|
11
|
+
compiler.run((err, stats) => {
|
12
|
+
if (err) console.error(err)
|
13
|
+
else if (stats.hasErrors())
|
14
|
+
console.error('Error is occured while webpack compiling.')
|
15
|
+
})
|
16
|
+
|
17
|
+
const useComponentsHtml = fs.readFileSync(
|
18
|
+
'test/use-components_expected.html',
|
19
|
+
'utf8'
|
20
|
+
)
|
21
|
+
const renderComponentHtml = fs.readFileSync(
|
22
|
+
'test/render-component_expected.html',
|
23
|
+
'utf8'
|
24
|
+
)
|
25
|
+
|
26
|
+
const html = `
|
27
|
+
<html>
|
28
|
+
<body>
|
29
|
+
${renderComponentHtml}
|
30
|
+
${useComponentsHtml}
|
31
|
+
<script src="/packs/react-webpacker.js"></script>
|
32
|
+
</body>
|
33
|
+
</html>
|
34
|
+
`
|
35
|
+
|
36
|
+
const app = express()
|
37
|
+
app.get('/', (req, res) => res.status(200).send(html))
|
38
|
+
app.use(express.static(path.resolve(__dirname, '__build__')))
|
39
|
+
|
40
|
+
let browser
|
41
|
+
let page
|
42
|
+
let server
|
43
|
+
|
44
|
+
beforeAll(async () => {
|
45
|
+
server = await app.listen(8888)
|
46
|
+
browser = await puppeteer.launch({ headless: true })
|
47
|
+
page = await browser.newPage()
|
48
|
+
})
|
49
|
+
|
50
|
+
describe('tagged javascript', async () => {
|
51
|
+
it('is worked properly.', async () => {
|
52
|
+
await page.goto('http://localhost:8888/')
|
53
|
+
const element = await page.$eval('body > div > h1', e => e.textContent)
|
54
|
+
expect(element).toBe('test: 1')
|
55
|
+
})
|
56
|
+
})
|
57
|
+
|
58
|
+
afterAll(async () => {
|
59
|
+
await browser.close()
|
60
|
+
await server.close()
|
61
|
+
})
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'byebug'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'rails'
|
4
|
+
require 'rails/test_help'
|
5
|
+
require 'react-webpacker'
|
6
|
+
require 'webpacker'
|
7
|
+
require 'active_support/core_ext/string'
|
8
|
+
|
9
|
+
class ReactWebpackerTest < ActionView::TestCase
|
10
|
+
tests ReactWebpacker
|
11
|
+
include Webpacker::Helper
|
12
|
+
|
13
|
+
def test_use_components
|
14
|
+
pack_tag_stub = Proc.new do |arg|
|
15
|
+
"<script src=\"/packs/#{arg}.js\"></script>"
|
16
|
+
end
|
17
|
+
File.open 'test/use-components_expected.html' do |f|
|
18
|
+
stub('javascript_pack_tag', pack_tag_stub) do
|
19
|
+
components = ['components/MyComponent']
|
20
|
+
expect_tags = f.read.chomp
|
21
|
+
assert_equal expect_tags, use_components(components)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_render_component
|
27
|
+
File.open 'test/render-component_expected.html' do |f|
|
28
|
+
component_name = 'MyComponent'
|
29
|
+
props = {my_name: :test, value: 1}
|
30
|
+
expect_tags = f.read.chomp
|
31
|
+
assert_equal expect_tags, render_component(component_name, props)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_version
|
36
|
+
File.open('package.json') do |f|
|
37
|
+
js_version = JSON.load(f)['version']
|
38
|
+
ruby_version = ReactWebpacker::VERSION
|
39
|
+
|
40
|
+
assert_equal js_version, ruby_version
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<div data-component-name="MyComponent" data-props="{"myName":"test","value":1}"></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<script src="/packs/components/MyComponent.js"></script>
|
data/webpack.config.js
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
const path = require('path')
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
entry: {
|
5
|
+
'react-webpacker': './test/dummy/react-webpacker.js',
|
6
|
+
'components/MyComponent': './test/dummy/components/MyComponent.jsx'
|
7
|
+
},
|
8
|
+
output: {
|
9
|
+
path: path.resolve(__dirname, 'test', '__build__', 'packs'),
|
10
|
+
filename: '[name].js'
|
11
|
+
},
|
12
|
+
module: {
|
13
|
+
loaders: [
|
14
|
+
{
|
15
|
+
test: /\.jsx?/,
|
16
|
+
exclude: /node_modules/,
|
17
|
+
use: [{ loader: 'babel-loader' }]
|
18
|
+
}
|
19
|
+
]
|
20
|
+
},
|
21
|
+
resolve: {
|
22
|
+
extensions: ['.js', '.jsx']
|
23
|
+
}
|
24
|
+
}
|
data/yarn.lock
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: react-webpacker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- euxn23
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: euxn23@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- ".babelrc"
|
20
|
+
- ".eslintignore"
|
21
|
+
- ".eslintrc.js"
|
22
|
+
- ".gitattributes"
|
23
|
+
- ".gitignore"
|
24
|
+
- ".prettierignore"
|
25
|
+
- ".prettierrc"
|
26
|
+
- Gemfile
|
27
|
+
- Gemfile.lock
|
28
|
+
- LICENSE
|
29
|
+
- README.md
|
30
|
+
- Rakefile
|
31
|
+
- lib/react-webpacker.rb
|
32
|
+
- lib/react-webpacker/render_component.rb
|
33
|
+
- lib/react-webpacker/use_components.rb
|
34
|
+
- lib/react-webpacker/version.rb
|
35
|
+
- package.json
|
36
|
+
- react-webpacker.gemspec
|
37
|
+
- src/react-webpacker.js
|
38
|
+
- test/__build__/packs/components/MyComponent.js
|
39
|
+
- test/__build__/packs/react-webpacker.js
|
40
|
+
- test/dummy/components/MyComponent.jsx
|
41
|
+
- test/dummy/react-webpacker.js
|
42
|
+
- test/react-webpacker_test.js
|
43
|
+
- test/react-webpacker_test.rb
|
44
|
+
- test/render-component_expected.html
|
45
|
+
- test/use-components_expected.html
|
46
|
+
- webpack.config.js
|
47
|
+
- yarn.lock
|
48
|
+
homepage: https://github.com/euxn23/webpacker-react
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.3.0
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.7.3
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: The smallest, enoughly-tested library for react with webpacker.
|
72
|
+
test_files: []
|