Skip to content

Commit 51dede5

Browse files
committed
add ReactPPX4Support module to relocate helper fn
1 parent cb21728 commit 51dede5

14 files changed

+137
-88
lines changed

jscomp/main/builtin_cmi_datasets.ml

+6-4
Large diffs are not rendered by default.

jscomp/main/builtin_cmj_datasets.ml

+5-3
Large diffs are not rendered by default.

jscomp/others/jsx.res

-18
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,3 @@ type component<'props> = componentLike<'props, element>
3838

3939
/* this function exists to prepare for making `component` abstract */
4040
external component: componentLike<'props, element> => component<'props> = "%identity"
41-
42-
%%private(
43-
@val
44-
external propsWithKey: (@as(json`{}`) _, 'props, {"key": string}) => 'props = "Object.assign"
45-
46-
@inline
47-
let addKeyProp = (~key: option<string>=?, p: 'props): 'props =>
48-
switch key {
49-
| Some(key) => propsWithKey(p, {"key": key})
50-
| None => p
51-
}
52-
)
53-
54-
let createElementWithKey = (~key=?, createElement, component, props) =>
55-
createElement(component, addKeyProp(~key?, props))
56-
57-
let createElementVariadicWithKey = (~key=?, createElementVariadic, component, props, elements) =>
58-
createElementVariadic(component, addKeyProp(~key?, props), elements)

jscomp/others/reactPPX4Support.res

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Copyright (C) 2022- Authors of ReScript
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU Lesser General Public License as published by
5+
* the Free Software Foundation, either version 3 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* In addition to the permissions granted to you by the LGPL, you may combine
9+
* or link a "work that uses the Library" with a publicly distributed version
10+
* of this file to produce a combined library or application, then distribute
11+
* that combined work under the terms of your choosing, with no requirement
12+
* to comply with the obligations normally placed on you by section 4 of the
13+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
14+
* should you choose to use a later version).
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Lesser General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Lesser General Public License
22+
* along with this program; if not, write to the Free Software
23+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24+
25+
%%private(
26+
@val
27+
external propsWithKey: (@as(json`{}`) _, 'props, {"key": string}) => 'props = "Object.assign"
28+
29+
@inline
30+
let addKeyProp = (~key: option<string>=?, p: 'props): 'props =>
31+
switch key {
32+
| Some(key) => propsWithKey(p, {"key": key})
33+
| None => p
34+
}
35+
)
36+
37+
let createElementWithKey = (~key=?, createElement, component, props) =>
38+
createElement(component, addKeyProp(~key?, props))
39+
40+
let createElementVariadicWithKey = (~key=?, createElementVariadic, component, props, elements) =>
41+
createElementVariadic(component, addKeyProp(~key?, props), elements)

jscomp/others/release.ninja

+2-1
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,5 @@ o others/node_module.cmi others/node_module.cmj : cc others/node_module.ml | oth
159159
o others/node_path.cmi others/node_path.cmj : cc others/node_path.ml | others/belt_internals.cmi others/js.cmi $bsc
160160
o others/node_process.cmj : cc_cmi others/node_process.ml | others/belt_internals.cmi others/js.cmi others/js_dict.cmj others/node.cmi others/node_process.cmi $bsc js_pkg
161161
o others/node_process.cmi : cc others/node_process.mli | others/belt_internals.cmi others/js.cmi others/js_dict.cmi others/node.cmi $bsc js_pkg
162-
o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj others/node_buffer.cmi others/node_buffer.cmj others/node_child_process.cmi others/node_child_process.cmj others/node_fs.cmi others/node_fs.cmj others/node_module.cmi others/node_module.cmj others/node_path.cmi others/node_path.cmj others/node_process.cmi others/node_process.cmj
162+
o others/reactPPX4Support.cmi others/reactPPX4Support.cmj : cc others/reactPPX4Support.res | others/belt_internals.cmi others/js.cmi $bsc
163+
o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj others/node_buffer.cmi others/node_buffer.cmj others/node_child_process.cmi others/node_child_process.cmj others/node_fs.cmi others/node_fs.cmj others/node_module.cmi others/node_module.cmj others/node_path.cmi others/node_path.cmj others/node_process.cmi others/node_process.cmj others/reactPPX4Support.cmi others/reactPPX4Support.cmj

lib/4.06.1/unstable/js_compiler.ml

+11-7
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_playground_compiler.ml

+11-7
Large diffs are not rendered by default.

lib/4.06.1/whole_compiler.ml

+11-7
Large diffs are not rendered by default.

lib/es6/jsx.js

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
2-
3-
import * as Curry from "./curry.js";
4-
5-
function createElementWithKey(key, createElement, component, props) {
6-
return Curry._2(createElement, component, key !== undefined ? Object.assign({}, props, {
7-
key: key
8-
}) : props);
9-
}
10-
11-
function createElementVariadicWithKey(key, createElementVariadic, component, props, elements) {
12-
return Curry._3(createElementVariadic, component, key !== undefined ? Object.assign({}, props, {
13-
key: key
14-
}) : props, elements);
15-
}
16-
17-
export {
18-
createElementWithKey ,
19-
createElementVariadicWithKey ,
20-
}
21-
/* No side effect */
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

lib/es6/reactPPX4Support.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
import * as Curry from "./curry.js";
4+
5+
function createElementWithKey(key, createElement, component, props) {
6+
return Curry._2(createElement, component, key !== undefined ? Object.assign({}, props, {
7+
key: key
8+
}) : props);
9+
}
10+
11+
function createElementVariadicWithKey(key, createElementVariadic, component, props, elements) {
12+
return Curry._3(createElementVariadic, component, key !== undefined ? Object.assign({}, props, {
13+
key: key
14+
}) : props, elements);
15+
}
16+
17+
export {
18+
createElementWithKey ,
19+
createElementVariadicWithKey ,
20+
}
21+
/* No side effect */

lib/js/jsx.js

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
'use strict';
2-
3-
var Curry = require("./curry.js");
4-
5-
function createElementWithKey(key, createElement, component, props) {
6-
return Curry._2(createElement, component, key !== undefined ? Object.assign({}, props, {
7-
key: key
8-
}) : props);
9-
}
10-
11-
function createElementVariadicWithKey(key, createElementVariadic, component, props, elements) {
12-
return Curry._3(createElementVariadic, component, key !== undefined ? Object.assign({}, props, {
13-
key: key
14-
}) : props, elements);
15-
}
16-
17-
exports.createElementWithKey = createElementWithKey;
18-
exports.createElementVariadicWithKey = createElementVariadicWithKey;
19-
/* No side effect */
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

lib/js/reactPPX4Support.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
var Curry = require("./curry.js");
4+
5+
function createElementWithKey(key, createElement, component, props) {
6+
return Curry._2(createElement, component, key !== undefined ? Object.assign({}, props, {
7+
key: key
8+
}) : props);
9+
}
10+
11+
function createElementVariadicWithKey(key, createElementVariadic, component, props, elements) {
12+
return Curry._3(createElementVariadic, component, key !== undefined ? Object.assign({}, props, {
13+
key: key
14+
}) : props, elements);
15+
}
16+
17+
exports.createElementWithKey = createElementWithKey;
18+
exports.createElementVariadicWithKey = createElementVariadicWithKey;
19+
/* No side effect */

packages/artifacts.txt

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ lib/es6/pervasives.js
180180
lib/es6/printexc.js
181181
lib/es6/queue.js
182182
lib/es6/random.js
183+
lib/es6/reactPPX4Support.js
183184
lib/es6/set.js
184185
lib/es6/setLabels.js
185186
lib/es6/sort.js
@@ -342,6 +343,7 @@ lib/js/pervasives.js
342343
lib/js/printexc.js
343344
lib/js/queue.js
344345
lib/js/random.js
346+
lib/js/reactPPX4Support.js
345347
lib/js/set.js
346348
lib/js/setLabels.js
347349
lib/js/sort.js
@@ -894,6 +896,8 @@ lib/ocaml/random.cmt
894896
lib/ocaml/random.cmti
895897
lib/ocaml/random.ml
896898
lib/ocaml/random.mli
899+
lib/ocaml/reactPPX4Support.res
900+
lib/ocaml/react_ppx_support.res
897901
lib/ocaml/set.cmi
898902
lib/ocaml/set.cmt
899903
lib/ocaml/set.cmti

scripts/ninja.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,10 @@ ${ninjaQuickBuidList([
10571057
x !== "belt.ml" &&
10581058
x !== "belt_internals.mli" &&
10591059
x !== "node.ml" &&
1060-
(x.endsWith(".ml") || x.endsWith(".mli")) &&
1060+
(x.endsWith(".ml") ||
1061+
x.endsWith(".mli") ||
1062+
x.endsWith(".res") ||
1063+
x.endsWith(".resi")) &&
10611064
!x.includes("#") &&
10621065
!x.includes(".cppo") // we have node ..
10631066
);

0 commit comments

Comments
 (0)