[healthcheck] Build with rollup
ghstack-source-id: cd40da2ddce047838ed031eed1c1f8e605648a78 Pull Request resolved: https://github.com/facebook/react-forget/pull/2954
Lauren Tan committed
May 11, 2024 at 00:19 UTC
db34843c424d55da7b39a35b8043bb49a1da9515
3 files changed
+76
-4
compiler/packages/healthcheck/package.json
+2
-1
@@ -2,8 +2,9 @@
2
"name": "healthcheck",
3
"version": "0.0.0",
4
"description": "Health check script to test violations of the rules of react.",
5
+ "main": "dist/index.js",
6
"scripts": {
6
- "build": "rimraf dist && tsc --build",
7
+ "build": "rimraf dist && rollup --config --bundleConfigAsCjs",
8
"test": "echo 'no tests'"
9
},
10
"dependencies": {
compiler/packages/healthcheck/rollup.config.js
new
+70
@@ -0,0 +1,70 @@
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 typescript from "@rollup/plugin-typescript";
9
+import { nodeResolve } from "@rollup/plugin-node-resolve";
10
+import commonjs from "@rollup/plugin-commonjs";
11
+import json from "@rollup/plugin-json";
12
+import path from "path";
13
+import process from "process";
14
+import terser from "@rollup/plugin-terser";
15
+import prettier from "rollup-plugin-prettier";
16
+import banner2 from "rollup-plugin-banner2";
17
+
18
+const NO_INLINE = new Set([]);
19
+
20
+const DEV_ROLLUP_CONFIG = {
21
+ input: "src/index.ts",
22
+ output: {
23
+ file: "dist/index.js",
24
+ format: "cjs",
25
+ sourcemap: false,
26
+ exports: "named",
27
+ },
28
+ plugins: [
29
+ typescript({
30
+ tsconfig: "./tsconfig.json",
31
+ compilerOptions: {
32
+ noEmit: true,
33
+ },
34
+ }),
35
+ json(),
36
+ nodeResolve({
37
+ preferBuiltins: true,
38
+ resolveOnly: (module) => NO_INLINE.has(module) === false,
39
+ rootDir: path.join(process.cwd(), ".."),
40
+ }),
41
+ commonjs(),
42
+ terser({
43
+ format: {
44
+ comments: false,
45
+ },
46
+ compress: false,
47
+ mangle: false,
48
+ }),
49
+ prettier(),
50
+ banner2(
51
+ () => `/**
52
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ *
57
+ * @lightSyntaxTransform
58
+ * @noflow
59
+ * @nolint
60
+ * @preventMunge
61
+ * @preserve-invariant-messages
62
+ */
63
+
64
+"use no memo";
65
+`
66
+ ),
67
+ ],
68
+};
69
+
70
+export default DEV_ROLLUP_CONFIG;
compiler/packages/healthcheck/tsconfig.json
+4
-3
@@ -1,9 +1,10 @@
1
{
2
"extends": "@tsconfig/strictest/tsconfig.json",
3
"compilerOptions": {
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "outDir": "dist",
4
+ "module": "ES2015",
5
+ "moduleResolution": "Bundler",
6
+ "rootDir": "../",
7
+ "noEmit": true,
8
"jsx": "react-jsxdev",
9
"lib": ["ES2022"],
10