File tree Expand file tree Collapse file tree 5 files changed +638
-7
lines changed
compiler/fixtures/runtime-compat/lib Expand file tree Collapse file tree 5 files changed +638
-7
lines changed Original file line number Diff line number Diff line change
1
+ const plugins = [
2
+ [
3
+ 'babel-plugin-react-compiler' ,
4
+ {
5
+ target : '18' ,
6
+ } ,
7
+ ] ,
8
+ ] ;
9
+
10
+ module . exports = { plugins} ;
Original file line number Diff line number Diff line change 1
- throw new Error ( 'Not implemented yet' ) ;
1
+ import { useState , useEffect } from 'react' ;
2
+
3
+ export function useTime ( ) {
4
+ const [ time , setTime ] = useState ( ( ) => new Date ( ) ) ;
5
+ useEffect ( ( ) => {
6
+ const id = setInterval ( ( ) => {
7
+ setTime ( new Date ( ) ) ;
8
+ } , 1000 ) ;
9
+ return ( ) => clearInterval ( id ) ;
10
+ } , [ ] ) ;
11
+
12
+ return time ;
13
+ }
Original file line number Diff line number Diff line change 2
2
"name" : " runtime-compat-lib" ,
3
3
"version" : " 0.0.0" ,
4
4
"description" : " Testing ground for libraries compiled with React Compiler" ,
5
- "main" : " index.js" ,
5
+ "main" : " dist/ index.js" ,
6
6
"scripts" : {
7
+ "build" : " rimraf dist && rollup --config --bundleConfigAsCjs" ,
7
8
"test" : " echo 'no tests'"
8
9
},
9
10
"license" : " MIT" ,
10
11
"devDependencies" : {
11
12
"@babel/cli" : " ^7.25.7" ,
12
13
"@babel/core" : " ^7.25.7" ,
13
14
"@babel/preset-env" : " ^7.25.7" ,
14
- "babel-plugin-react-compiler" : " 0.0.0-experimental-58c2b1c-20241009"
15
+ "@rollup/plugin-babel" : " ^6.0.4" ,
16
+ "@rollup/plugin-json" : " ^6.1.0" ,
17
+ "babel-plugin-react-compiler" : " 0.0.0-experimental-58c2b1c-20241009" ,
18
+ "@rollup/plugin-terser" : " ^0.4.4" ,
19
+ "react" : " 19.0.0-beta-26f2496093-20240514" ,
20
+ "react-dom" : " 19.0.0-beta-26f2496093-20240514" ,
21
+ "rimraf" : " 5" ,
22
+ "rollup" : " ^4.22.4" ,
23
+ "rollup-plugin-banner2" : " ^1.2.3" ,
24
+ "rollup-plugin-prettier" : " ^4.1.1"
15
25
},
16
26
"dependencies" : {
17
27
"react-compiler-runtime" : " 0.0.0-experimental-8d8e73f-20241009"
28
+ },
29
+ "peerDependencies" : {
30
+ "react" : " ^18 || ^19"
18
31
}
19
32
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import json from '@rollup/plugin-json' ;
9
+ import terser from '@rollup/plugin-terser' ;
10
+ import prettier from 'rollup-plugin-prettier' ;
11
+ import banner2 from 'rollup-plugin-banner2' ;
12
+ import babel from '@rollup/plugin-babel' ;
13
+
14
+ const ROLLUP_CONFIG = {
15
+ input : 'index.js' ,
16
+ output : {
17
+ file : 'dist/index.js' ,
18
+ format : 'esm' ,
19
+ sourcemap : false ,
20
+ exports : 'named' ,
21
+ } ,
22
+ plugins : [
23
+ json ( ) ,
24
+ babel ( { babelHelpers : 'bundled' } ) ,
25
+ terser ( {
26
+ format : {
27
+ comments : false ,
28
+ } ,
29
+ compress : false ,
30
+ mangle : false ,
31
+ } ) ,
32
+ prettier ( ) ,
33
+ banner2 (
34
+ ( ) => `/**
35
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ *
40
+ * @lightSyntaxTransform
41
+ * @noflow
42
+ * @nolint
43
+ * @preventMunge
44
+ * @preserve-invariant-messages
45
+ */
46
+ `
47
+ ) ,
48
+ ] ,
49
+ } ;
50
+
51
+ export default ROLLUP_CONFIG ;
You can’t perform that action at this time.
0 commit comments