react-rails 2.6.1 → 2.7.0.rc.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 +4 -4
- data/CHANGELOG.md +54 -11
- data/README.md +154 -54
- data/lib/assets/javascripts/react_ujs.js +111 -67
- data/lib/assets/react-source/development/react-server.js +3145 -2864
- data/lib/assets/react-source/development/react.js +24586 -23940
- data/lib/assets/react-source/production/react-server.js +4 -4
- data/lib/assets/react-source/production/react.js +8 -8
- data/lib/generators/react/install_generator.rb +18 -0
- data/lib/react/rails/version.rb +1 -1
- data/lib/react/server_rendering/webpacker_manifest_container.rb +3 -3
- data/lib/react.rb +6 -8
- metadata +22 -8
@@ -1,13 +1,13 @@
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
-
module.exports = factory(require("react"), require("react
|
3
|
+
module.exports = factory(require("react-dom"), require("react"), require("react-dom/server"));
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
5
|
-
define(["react", "react
|
5
|
+
define(["react-dom", "react", "react-dom/server"], factory);
|
6
6
|
else if(typeof exports === 'object')
|
7
|
-
exports["ReactRailsUJS"] = factory(require("react"), require("react
|
7
|
+
exports["ReactRailsUJS"] = factory(require("react-dom"), require("react"), require("react-dom/server"));
|
8
8
|
else
|
9
|
-
root["ReactRailsUJS"] = factory(root["
|
10
|
-
})(this, function(
|
9
|
+
root["ReactRailsUJS"] = factory(root["ReactDOM"], root["React"], root["ReactDOMServer"]);
|
10
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_7__) {
|
11
11
|
return /******/ (function(modules) { // webpackBootstrap
|
12
12
|
/******/ // The module cache
|
13
13
|
/******/ var installedModules = {};
|
@@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
73
73
|
/******/ __webpack_require__.p = "";
|
74
74
|
/******/
|
75
75
|
/******/ // Load entry module and return exports
|
76
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
76
|
+
/******/ return __webpack_require__(__webpack_require__.s = 8);
|
77
77
|
/******/ })
|
78
78
|
/************************************************************************/
|
79
79
|
/******/ ([
|
@@ -106,13 +106,49 @@ module.exports = function(className) {
|
|
106
106
|
|
107
107
|
/***/ }),
|
108
108
|
/* 1 */
|
109
|
+
/***/ (function(module, exports) {
|
110
|
+
|
111
|
+
// Load React components by requiring them from "components/", for example:
|
112
|
+
//
|
113
|
+
// - "pages/index" -> `require("components/pages/index")`
|
114
|
+
// - "pages/show.Header" -> `require("components/pages/show").Header`
|
115
|
+
// - "pages/show.Body.Content" -> `require("components/pages/show").Body.Content`
|
116
|
+
//
|
117
|
+
module.exports = function(reqctx) {
|
118
|
+
return function(className) {
|
119
|
+
var parts = className.split(".")
|
120
|
+
var filename = parts.shift()
|
121
|
+
var keys = parts
|
122
|
+
// Load the module:
|
123
|
+
var component = reqctx("./" + filename)
|
124
|
+
// Then access each key:
|
125
|
+
keys.forEach(function(k) {
|
126
|
+
component = component[k]
|
127
|
+
})
|
128
|
+
// support `export default`
|
129
|
+
if (component.__esModule) {
|
130
|
+
component = component["default"]
|
131
|
+
}
|
132
|
+
return component
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
|
137
|
+
/***/ }),
|
138
|
+
/* 2 */
|
139
|
+
/***/ (function(module, exports) {
|
140
|
+
|
141
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
|
142
|
+
|
143
|
+
/***/ }),
|
144
|
+
/* 3 */
|
109
145
|
/***/ (function(module, exports, __webpack_require__) {
|
110
146
|
|
111
|
-
var nativeEvents = __webpack_require__(
|
112
|
-
var pjaxEvents = __webpack_require__(
|
113
|
-
var turbolinksEvents = __webpack_require__(
|
114
|
-
var turbolinksClassicDeprecatedEvents = __webpack_require__(
|
115
|
-
var turbolinksClassicEvents = __webpack_require__(
|
147
|
+
var nativeEvents = __webpack_require__(9)
|
148
|
+
var pjaxEvents = __webpack_require__(10)
|
149
|
+
var turbolinksEvents = __webpack_require__(11)
|
150
|
+
var turbolinksClassicDeprecatedEvents = __webpack_require__(13)
|
151
|
+
var turbolinksClassicEvents = __webpack_require__(12)
|
116
152
|
|
117
153
|
// see what things are globally available
|
118
154
|
// and setup event handlers to those things
|
@@ -164,14 +200,14 @@ module.exports = function(ujs) {
|
|
164
200
|
|
165
201
|
|
166
202
|
/***/ }),
|
167
|
-
/*
|
203
|
+
/* 4 */
|
168
204
|
/***/ (function(module, exports, __webpack_require__) {
|
169
205
|
|
170
206
|
// Make a function which:
|
171
207
|
// - First tries to require the name
|
172
208
|
// - Then falls back to global lookup
|
173
209
|
var fromGlobal = __webpack_require__(0)
|
174
|
-
var fromRequireContext = __webpack_require__(
|
210
|
+
var fromRequireContext = __webpack_require__(1)
|
175
211
|
|
176
212
|
module.exports = function(reqctx) {
|
177
213
|
var fromCtx = fromRequireContext(reqctx)
|
@@ -195,34 +231,67 @@ module.exports = function(reqctx) {
|
|
195
231
|
|
196
232
|
|
197
233
|
/***/ }),
|
198
|
-
/*
|
199
|
-
/***/ (function(module,
|
234
|
+
/* 5 */
|
235
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
236
|
+
|
237
|
+
"use strict";
|
238
|
+
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
239
|
+
/* harmony export (immutable) */ __webpack_exports__["supportsHydration"] = supportsHydration;
|
240
|
+
/* harmony export (immutable) */ __webpack_exports__["reactHydrate"] = reactHydrate;
|
241
|
+
/* harmony export (immutable) */ __webpack_exports__["createReactRootLike"] = createReactRootLike;
|
242
|
+
const ReactDOM = __webpack_require__(2)
|
243
|
+
|
244
|
+
function supportsHydration() {
|
245
|
+
return typeof ReactDOM.hydrate === "function" || typeof ReactDOM.hydrateRoot === "function"
|
246
|
+
}
|
247
|
+
|
248
|
+
function reactHydrate(node, component) {
|
249
|
+
if (typeof ReactDOM.hydrateRoot === "function") {
|
250
|
+
return ReactDOM.hydrateRoot(node, component)
|
251
|
+
} else {
|
252
|
+
return ReactDOM.hydrate(component, node)
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
function createReactRootLike(node) {
|
257
|
+
return ReactDOM.createRoot ? ReactDOM.createRoot(node) : legacyReactRootLike(node)
|
258
|
+
}
|
259
|
+
|
260
|
+
function legacyReactRootLike(node) {
|
261
|
+
const root = {
|
262
|
+
render(component) {
|
263
|
+
return ReactDOM.render(component, node)
|
264
|
+
}
|
265
|
+
}
|
266
|
+
return root
|
267
|
+
}
|
200
268
|
|
201
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
|
202
269
|
|
203
270
|
/***/ }),
|
204
|
-
/*
|
271
|
+
/* 6 */
|
205
272
|
/***/ (function(module, exports) {
|
206
273
|
|
207
|
-
module.exports =
|
274
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
|
208
275
|
|
209
276
|
/***/ }),
|
210
|
-
/*
|
277
|
+
/* 7 */
|
211
278
|
/***/ (function(module, exports) {
|
212
279
|
|
213
|
-
module.exports =
|
280
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_7__;
|
214
281
|
|
215
282
|
/***/ }),
|
216
|
-
/*
|
283
|
+
/* 8 */
|
217
284
|
/***/ (function(module, exports, __webpack_require__) {
|
218
285
|
|
219
|
-
var React = __webpack_require__(
|
220
|
-
var ReactDOM = __webpack_require__(
|
221
|
-
var ReactDOMServer = __webpack_require__(
|
286
|
+
var React = __webpack_require__(6)
|
287
|
+
var ReactDOM = __webpack_require__(2)
|
288
|
+
var ReactDOMServer = __webpack_require__(7)
|
222
289
|
|
223
|
-
var detectEvents = __webpack_require__(
|
290
|
+
var detectEvents = __webpack_require__(3)
|
224
291
|
var constructorFromGlobal = __webpack_require__(0)
|
225
|
-
var
|
292
|
+
var constructorFromRequireContext = __webpack_require__(1)
|
293
|
+
var constructorFromRequireContextWithGlobalFallback = __webpack_require__(4)
|
294
|
+
const { supportsHydration, reactHydrate, createReactRootLike } = __webpack_require__(5)
|
226
295
|
|
227
296
|
var ReactRailsUJS = {
|
228
297
|
// This attribute holds the name of component which should be mounted
|
@@ -283,6 +352,11 @@ var ReactRailsUJS = {
|
|
283
352
|
// the default is ReactRailsUJS.ComponentGlobal
|
284
353
|
getConstructor: constructorFromGlobal,
|
285
354
|
|
355
|
+
// Available for customizing `getConstructor`
|
356
|
+
constructorFromGlobal: constructorFromGlobal,
|
357
|
+
constructorFromRequireContext: constructorFromRequireContext,
|
358
|
+
constructorFromRequireContextWithGlobalFallback: constructorFromRequireContextWithGlobalFallback,
|
359
|
+
|
286
360
|
// Given a Webpack `require.context`,
|
287
361
|
// try finding components with `require`,
|
288
362
|
// then falling back to global lookup.
|
@@ -329,13 +403,14 @@ var ReactRailsUJS = {
|
|
329
403
|
}
|
330
404
|
}
|
331
405
|
|
332
|
-
if (hydrate &&
|
333
|
-
component =
|
406
|
+
if (hydrate && supportsHydration()) {
|
407
|
+
component = reactHydrate(node, component);
|
334
408
|
} else {
|
335
|
-
|
409
|
+
const root = createReactRootLike(node)
|
410
|
+
component = root.render(component);
|
336
411
|
}
|
337
412
|
}
|
338
|
-
}
|
413
|
+
}
|
339
414
|
},
|
340
415
|
|
341
416
|
// Within `searchSelector`, find nodes which have React components
|
@@ -356,6 +431,7 @@ var ReactRailsUJS = {
|
|
356
431
|
detectEvents: function() {
|
357
432
|
detectEvents(this)
|
358
433
|
},
|
434
|
+
|
359
435
|
}
|
360
436
|
|
361
437
|
// These stable references are so that handlers can be added and removed:
|
@@ -390,7 +466,7 @@ module.exports = ReactRailsUJS
|
|
390
466
|
|
391
467
|
|
392
468
|
/***/ }),
|
393
|
-
/*
|
469
|
+
/* 9 */
|
394
470
|
/***/ (function(module, exports) {
|
395
471
|
|
396
472
|
module.exports = {
|
@@ -413,7 +489,7 @@ module.exports = {
|
|
413
489
|
|
414
490
|
|
415
491
|
/***/ }),
|
416
|
-
/*
|
492
|
+
/* 10 */
|
417
493
|
/***/ (function(module, exports) {
|
418
494
|
|
419
495
|
module.exports = {
|
@@ -433,25 +509,23 @@ module.exports = {
|
|
433
509
|
|
434
510
|
|
435
511
|
/***/ }),
|
436
|
-
/*
|
512
|
+
/* 11 */
|
437
513
|
/***/ (function(module, exports) {
|
438
514
|
|
439
515
|
module.exports = {
|
440
516
|
// Turbolinks 5+ got rid of named events (?!)
|
441
517
|
setup: function(ujs) {
|
442
518
|
ujs.handleEvent('turbolinks:load', ujs.handleMount);
|
443
|
-
ujs.handleEvent('turbolinks:before-render', ujs.handleUnmount);
|
444
519
|
},
|
445
520
|
|
446
521
|
teardown: function(ujs) {
|
447
522
|
ujs.removeEvent('turbolinks:load', ujs.handleMount);
|
448
|
-
ujs.removeEvent('turbolinks:before-render', ujs.handleUnmount);
|
449
523
|
},
|
450
524
|
}
|
451
525
|
|
452
526
|
|
453
527
|
/***/ }),
|
454
|
-
/*
|
528
|
+
/* 12 */
|
455
529
|
/***/ (function(module, exports) {
|
456
530
|
|
457
531
|
module.exports = {
|
@@ -469,7 +543,7 @@ module.exports = {
|
|
469
543
|
|
470
544
|
|
471
545
|
/***/ }),
|
472
|
-
/*
|
546
|
+
/* 13 */
|
473
547
|
/***/ (function(module, exports) {
|
474
548
|
|
475
549
|
module.exports = {
|
@@ -489,36 +563,6 @@ module.exports = {
|
|
489
563
|
}
|
490
564
|
|
491
565
|
|
492
|
-
/***/ }),
|
493
|
-
/* 12 */
|
494
|
-
/***/ (function(module, exports) {
|
495
|
-
|
496
|
-
// Load React components by requiring them from "components/", for example:
|
497
|
-
//
|
498
|
-
// - "pages/index" -> `require("components/pages/index")`
|
499
|
-
// - "pages/show.Header" -> `require("components/pages/show").Header`
|
500
|
-
// - "pages/show.Body.Content" -> `require("components/pages/show").Body.Content`
|
501
|
-
//
|
502
|
-
module.exports = function(reqctx) {
|
503
|
-
return function(className) {
|
504
|
-
var parts = className.split(".")
|
505
|
-
var filename = parts.shift()
|
506
|
-
var keys = parts
|
507
|
-
// Load the module:
|
508
|
-
var component = reqctx("./" + filename)
|
509
|
-
// Then access each key:
|
510
|
-
keys.forEach(function(k) {
|
511
|
-
component = component[k]
|
512
|
-
})
|
513
|
-
// support `export default`
|
514
|
-
if (component.__esModule) {
|
515
|
-
component = component["default"]
|
516
|
-
}
|
517
|
-
return component
|
518
|
-
}
|
519
|
-
}
|
520
|
-
|
521
|
-
|
522
566
|
/***/ })
|
523
567
|
/******/ ]);
|
524
568
|
});
|