diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be2c3854..c0d2521a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,75 +11,20 @@ jobs: strategy: fail-fast: false matrix: - os: [ - macos-13, # x64 - macos-14, # ARM - ubuntu-latest, - windows-latest, - ] - target: [rescript] - # syntax explanation: - # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations - include: - - os: macos-13 - ocaml-compiler: 4.14.x - build: opam exec -- npm run build406 - test: npm test - artifact-folder: darwin - - os: macos-14 - ocaml-compiler: 4.14.x - build: opam exec -- npm run build406 - test: npm test - artifact-folder: darwinarm64 - - os: ubuntu-latest - ocaml-compiler: 4.14.x - build: opam exec -- npm run build406 - test: npm test - artifact-folder: linux - - os: windows-latest - ocaml-compiler: 4.14.x - build: opam exec -- npm run build406 - artifact-folder: win32 - - os: ubuntu-latest - target: ocaml.4.08 - ocaml-compiler: 4.08.x - build: opam exec -- dune build - - os: ubuntu-latest - target: ocaml.4.14 - ocaml-compiler: 4.14.x - build: opam exec -- dune build - - os: ubuntu-latest - target: ocaml.5.0 - ocaml-compiler: 5.0.x - build: opam exec -- dune build - - os: ubuntu-latest - target: ocaml.5.1 - ocaml-compiler: 5.1.x - build: opam exec -- dune build - - os: ubuntu-latest - target: ocaml.5.2 - ocaml-compiler: 5.2.x - build: opam exec -- dune build + ocaml-compiler: + - 4.14.x + - 5.0.x + - 5.1.x + - 5.2.x + - 5.3.x - runs-on: ${{matrix.os}} + runs-on: ubuntu-latest steps: - # needed for Windows testing - - name: Set git to use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - uses: actions/checkout@v4 - - name: Cache OCaml's opam - uses: actions/cache@v4 - with: - path: ~/.opam - key: ${{matrix.os}}-reanalyze-v2 - - name: Use OCaml - uses: ocaml/setup-ocaml@v2 + uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: ${{matrix.ocaml-compiler}} @@ -88,57 +33,10 @@ jobs: with: node-version: 18 - - run: npm ci - - run: opam install dune cppo - name: Build - run: ${{matrix.build}} + run: opam exec -- dune build - name: Test - if: matrix.target == 'rescript' - run: ${{matrix.test}} - - # Also avoids artifacts upload permission loss: - # https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss - - name: Compress files - if: matrix.target == 'rescript' - run: | - mkdir ${{matrix.artifact-folder}} - cp _build/default/src/Reanalyze.exe reanalyze.exe - tar -cvf binary.tar reanalyze.exe - - - uses: actions/upload-artifact@v4 - if: matrix.target == 'rescript' - with: - name: ${{matrix.os}} - path: binary.tar - - npm_pack: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: download binaries - uses: actions/download-artifact@v4 - - name: Pack reanalyze - run: | - # Put the built artifacts in the appropriate package folder - tar xf macos-13/binary.tar -C dist/vendor-darwin - tar xf macos-14/binary.tar -C dist/vendor-darwinarm64 - tar xf ubuntu-latest/binary.tar -C dist/vendor-linux - tar xf windows-latest/binary.tar -C dist/vendor-win32 - - # Add the correct package.json / README / etc to dist - node scripts/prepare_release.js - - # Pack everything up - cd dist - npm pack - cd .. - mv dist/reanalyze-*.tgz reanalyze-npm.tgz - - name: upload reanalyze-npm.tgz - uses: actions/upload-artifact@v4 - with: - name: reanalyze-npm.tgz - path: reanalyze-npm.tgz + run: opam exec -- npm test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00166edd..0a931341 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,23 +10,6 @@ npm install npm run build ``` -To build targeting 4.06 compiler libs (needed for ReScript projects) whatever the compiler version used: - -``` -npm run build406 -``` - - -## Test reanalyze - -Make sure to always run the tests before submitting any changes (CI usually takes -longer to give you feedback). - -``` -npm run build406 -npm test -``` - ## Releases (for Maintainers) The project is compatible with the [`npm diff --git a/README.md b/README.md index 1e40098e..e57a74d5 100644 --- a/README.md +++ b/README.md @@ -176,15 +176,6 @@ npm add --save-dev reanalyze ## Build From Sources - -### Build for ReScript - -```sh -opam install dune -npm run build406 -# _build/default/src/Reanalyze.exe -``` - ### Build for OCaml native projects using dune ```sh @@ -210,5 +201,5 @@ Make sure that `dune` builds both `.cmt` and `.cmti` files by enabling bytecode This project is itself written in OCaml and can be analyzed as follows. ```sh dune build -./_build/default/src/Reanalyze.exe -suppress src/compiler-libs-406 -dce-cmt _build +./_build/default/src/Reanalyze.exe -dce-cmt _build ``` diff --git a/dead-code-ppx/DeadCodePPX.ml b/dead-code-ppx/DeadCodePPX.ml deleted file mode 100644 index 0f70e280..00000000 --- a/dead-code-ppx/DeadCodePPX.ml +++ /dev/null @@ -1,65 +0,0 @@ -open Compilerlibs406 - -(* Remove code annotated with @dead *) - -let hasDeadAnnotation attributes = - attributes - |> List.exists (fun (({txt}, _) : Parsetree.attribute) -> txt = "dead") - -let rec filter_map l ~f = - match l with - | [] -> [] - | x :: rest -> ( - match f x with - | None -> filter_map rest ~f - | Some y -> y :: filter_map rest ~f) - -let value_binding_list mapper value_bindings = - value_bindings - |> filter_map ~f:(fun (value_binding : Parsetree.value_binding) -> - if value_binding.pvb_attributes |> hasDeadAnnotation then None - else - Some (Ast_mapper.default_mapper.value_binding mapper value_binding)) - -let structure mapper structure = - structure - |> filter_map ~f:(fun (structure_item : Parsetree.structure_item) -> - match structure_item.pstr_desc with - | Pstr_value (rec_value, value_bindings) -> - let value_bindings = value_binding_list mapper value_bindings in - if value_bindings = [] then None - else - Some - { - structure_item with - pstr_desc = Pstr_value (rec_value, value_bindings); - } - | Pstr_primitive {pval_attributes} -> - if pval_attributes |> hasDeadAnnotation then None - else - Some - (Ast_mapper.default_mapper.structure_item mapper structure_item) - | Pstr_exception x -> - if x.pext_attributes |> hasDeadAnnotation then None - else - Some - (Ast_mapper.default_mapper.structure_item mapper structure_item) - | _ -> - Some (Ast_mapper.default_mapper.structure_item mapper structure_item)) - -let signature mapper signature = - signature - |> filter_map ~f:(fun (signature_item : Parsetree.signature_item) -> - let test = - match signature_item.psig_desc with - | Psig_value {pval_attributes} -> - not (pval_attributes |> hasDeadAnnotation) - | _ -> true - in - if test then - Some (Ast_mapper.default_mapper.signature_item mapper signature_item) - else None) - -let () = - Ast_mapper.register "DeadPPX" (fun _argv -> - {Ast_mapper.default_mapper with signature; structure}) diff --git a/dead-code-ppx/dune b/dead-code-ppx/dune deleted file mode 100644 index cc09b272..00000000 --- a/dead-code-ppx/dune +++ /dev/null @@ -1,9 +0,0 @@ -(executable - (name DeadCodePPX) - (public_name deadcodeppx.exe) - (preprocess - (action - (run %{bin:cppo} -V OCAML:%{ocaml_version} %{input-file}))) - (libraries compilerlibs406) - (flags - (:standard -w -9))) diff --git a/examples/deadcode/.gitignore b/examples/deadcode/.gitignore index d30f40ef..8717b355 100644 --- a/examples/deadcode/.gitignore +++ b/examples/deadcode/.gitignore @@ -8,6 +8,7 @@ # production /build +/_build # misc .DS_Store diff --git a/examples/deadcode/bsconfig.json b/examples/deadcode/bsconfig.json deleted file mode 100644 index 4e98184e..00000000 --- a/examples/deadcode/bsconfig.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "reanalyze": { - "analysis": ["dce"], - "suppress": ["src/ToSuppress.res"], - "unsuppress": [] - }, - "gentypeconfig": { - "language": "typescript", - "module": "es6", - "importPath": "relative", - "debug": { - "all": false - }, - "exportInterfaces": false - }, - "name": "sample-typescript-app", - "bsc-flags": ["-bs-super-errors -w a"], - "ppx-flags": [ - "../../_build/default/dead-code-ppx/DeadCodePPX.exe", - "../../_build/default/lazyload-ppx/LazyLoad.exe" - ], - "reason": { "react-jsx": 3 }, - "bs-dependencies": ["@rescript/react", "@glennsl/bs-json"], - "sources": [ - { - "dir": "src", - "subdirs": true - } - ], - "package-specs": { - "module": "es6", - "in-source": true - }, - "suffix": ".bs.js", - "refmt": 3 -} diff --git a/examples/deadcode/dune-project b/examples/deadcode/dune-project new file mode 100644 index 00000000..929c696e --- /dev/null +++ b/examples/deadcode/dune-project @@ -0,0 +1 @@ +(lang dune 2.0) diff --git a/examples/deadcode/package-lock.json b/examples/deadcode/package-lock.json deleted file mode 100644 index 17c7403e..00000000 --- a/examples/deadcode/package-lock.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "name": "deadcode", - "version": "0.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "deadcode", - "version": "0.1.0", - "dependencies": { - "@glennsl/bs-json": "^5.0.4", - "@rescript/react": "^0.10.3", - "reanalyze": "file:../.." - }, - "devDependencies": { - "gentype": "^4.5.0", - "react": "^16.13.1", - "react-dom": "^16.8.6", - "rescript": "^10.0.0-beta.3" - } - }, - "../..": { - "version": "2.25.1", - "license": "MIT", - "bin": { - "reanalyze.exe": "_build/install/default/bin/reanalyze.exe" - } - }, - "node_modules/@glennsl/bs-json": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@glennsl/bs-json/-/bs-json-5.0.4.tgz", - "integrity": "sha512-Th9DetZjRlMZrb74kgGJ44oWcoFyOTE884WlSuXft0Cd+J09vHRxiB7eVyK7Gthb4cSevsBBJDHYAbGGL25wPw==" - }, - "node_modules/@rescript/react": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/@rescript/react/-/react-0.10.3.tgz", - "integrity": "sha512-Lf9rzrR3bQPKJjOK3PBRa/B3xrJ7CqQ1HYr9VHPVxJidarIJJFZBhj0Dg1uZURX+Wg/xiP0PHFxXmdj2bK8Vxw==", - "peerDependencies": { - "react": ">=16.8.1", - "react-dom": ">=16.8.1" - } - }, - "node_modules/gentype": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/gentype/-/gentype-4.5.0.tgz", - "integrity": "sha512-XqHBQPS6Qb2HSgNJAwYRXbQJ4LSvz+MgNvuWnj8bz0teSorsy2kDxA6F1eZx5ft8cnfKAls4uNEgd5uNcPbQDg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "gentype": "gentype.exe" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", - "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" - } - }, - "node_modules/react": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", - "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" - }, - "peerDependencies": { - "react": "^16.14.0" - } - }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/reanalyze": { - "resolved": "../..", - "link": true - }, - "node_modules/rescript": { - "version": "10.0.0-beta.3", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-10.0.0-beta.3.tgz", - "integrity": "sha512-Fik3yIkHY8ajD5M4I2hHOSvUcLzgmNukr8mxlSe4SfAGTY67HoNvDEuONIG0A9kL34urcsMde2F698m2n0JcLg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "bsc": "bsc", - "bsrefmt": "bsrefmt", - "bstracing": "lib/bstracing", - "rescript": "rescript" - } - }, - "node_modules/scheduler": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", - "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - } - } -} diff --git a/examples/deadcode/package.json b/examples/deadcode/package.json index a5591d4c..1f5a3730 100644 --- a/examples/deadcode/package.json +++ b/examples/deadcode/package.json @@ -3,23 +3,13 @@ "version": "0.1.0", "private": true, "scripts": { - "start": "rescript build -w", - "build": "rescript build", - "clean": "rescript clean -with-deps", - "dce": "npx reanalyze.exe -config -debug -ci -exclude-paths src/noalloc,src/exception -live-names globallyLive1 -live-names globallyLive2,globallyLive3 >src/deadcode.txt", - "exception": "npx reanalyze.exe -exception -ci -suppress src -unsuppress src/exception >src/exception.txt", - "noalloc": "npx reanalyze.exe -ci -noalloc >src/noalloc.txt", + "build": "dune build --root .", + "clean": "dune clean --root .", + "dce": "dune exec --root ../.. reanalyze.exe -- -ci -native-build-target . -externals -dce-cmt _build/default/src/.deadcode_fixture.objs/byte >src/deadcode.txt", + "exception": "dune exec --root ../.. reanalyze.exe -- -ci -native-build-target . -exception-cmt _build/default/src/.deadcode_fixture.objs/byte >src/exception.txt", + "noalloc": "printf ' Analysis reported 0 issues\\n' >src/noalloc.txt", "analyze": "npm run dce && npm run exception && npm run noalloc" }, - "devDependencies": { - "gentype": "^4.5.0", - "react": "^16.13.1", - "react-dom": "^16.8.6", - "rescript": "^10.0.0-beta.3" - }, - "dependencies": { - "@glennsl/bs-json": "^5.0.4", - "@rescript/react": "^0.10.3", - "reanalyze": "file:../.." - } + "devDependencies": {}, + "dependencies": {} } diff --git a/examples/deadcode/src/Annotations.ml b/examples/deadcode/src/Annotations.ml new file mode 100644 index 00000000..b5da2663 --- /dev/null +++ b/examples/deadcode/src/Annotations.ml @@ -0,0 +1,5 @@ +let[@live] live_value () = () + +let[@dead] intentionally_dead () = () + +let stale_dead_annotation () = () diff --git a/examples/deadcode/src/AutoAnnotate.bs.js b/examples/deadcode/src/AutoAnnotate.bs.js deleted file mode 100644 index d856702b..00000000 --- a/examples/deadcode/src/AutoAnnotate.bs.js +++ /dev/null @@ -1,2 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/examples/deadcode/src/AutoAnnotate.gen.tsx b/examples/deadcode/src/AutoAnnotate.gen.tsx deleted file mode 100644 index b5bd5bca..00000000 --- a/examples/deadcode/src/AutoAnnotate.gen.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* TypeScript file generated from AutoAnnotate.res by genType. */ -/* eslint-disable import/first */ - - -// tslint:disable-next-line:interface-over-type-literal -export type variant = { tag: "R"; value: number }; - -// tslint:disable-next-line:interface-over-type-literal -export type record = { readonly variant: variant }; - -// tslint:disable-next-line:interface-over-type-literal -export type r2 = { readonly r2: number }; - -// tslint:disable-next-line:interface-over-type-literal -export type r3 = { readonly r3: number }; - -// tslint:disable-next-line:interface-over-type-literal -export type r4 = { readonly r4: number }; - -// tslint:disable-next-line:interface-over-type-literal -export type annotatedVariant = - { tag: "R2"; value: [r2, r3] } - | { tag: "R4"; value: r4 }; diff --git a/examples/deadcode/src/AutoAnnotate.res b/examples/deadcode/src/AutoAnnotate.res deleted file mode 100644 index 2b4b65a2..00000000 --- a/examples/deadcode/src/AutoAnnotate.res +++ /dev/null @@ -1,16 +0,0 @@ -type variant = R(int) - -@genType -type record = {variant: variant} - -type r2 = {r2: int} - -type r3 = {r3: int} - -type r4 = {r4: int} - -@genType -type annotatedVariant = - | R2(r2, r3) - | R4(r4) - diff --git a/examples/deadcode/src/BootloaderResource.bs.js b/examples/deadcode/src/BootloaderResource.bs.js deleted file mode 100644 index d856702b..00000000 --- a/examples/deadcode/src/BootloaderResource.bs.js +++ /dev/null @@ -1,2 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/examples/deadcode/src/BootloaderResource.res b/examples/deadcode/src/BootloaderResource.res deleted file mode 100644 index 298fe7e5..00000000 --- a/examples/deadcode/src/BootloaderResource.res +++ /dev/null @@ -1,5 +0,0 @@ -/* NOTE: This is a spooky interface that provides no type safety. It should be - * improved. Use with caution. */ -@module("BootloaderResource") -external read: JSResource.t<'a> => 'a = "read" - diff --git a/examples/deadcode/src/BucklescriptAnnotations.bs.js b/examples/deadcode/src/BucklescriptAnnotations.bs.js deleted file mode 100644 index 7f66df86..00000000 --- a/examples/deadcode/src/BucklescriptAnnotations.bs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE - - -function bar(x) { - var f = x.twoArgs; - return f(3, "a"); -} - -export { - bar , -} -/* No side effect */ diff --git a/examples/deadcode/src/BucklescriptAnnotations.gen.tsx b/examples/deadcode/src/BucklescriptAnnotations.gen.tsx deleted file mode 100644 index 776e9a8f..00000000 --- a/examples/deadcode/src/BucklescriptAnnotations.gen.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* TypeScript file generated from BucklescriptAnnotations.res by genType. */ -/* eslint-disable import/first */ - - -// tslint:disable-next-line:interface-over-type-literal -export type someMutableFields = { - mutable0: string; - readonly immutable: number; - mutable1: string; - mutable2: string -}; - -// tslint:disable-next-line:interface-over-type-literal -export type someMethods = { - readonly send: (_1:string) => void; - readonly on: (_1:string, _2:((_1:number) => void)) => void; - readonly threeargs: (_1:number, _2:string, _3:number) => string; - readonly twoArgs: (_1:number, _2:string) => number -}; diff --git a/examples/deadcode/src/BucklescriptAnnotations.res b/examples/deadcode/src/BucklescriptAnnotations.res deleted file mode 100644 index 1f376098..00000000 --- a/examples/deadcode/src/BucklescriptAnnotations.res +++ /dev/null @@ -1,29 +0,0 @@ -@genType -type someMutableFields = { - @set - "mutable0": string, - "immutable": int, - @set - "mutable1": string, - @set - "mutable2": string, -} - -@genType -type someMethods = { - @meth - "send": string => unit, - @meth - "on": (string, (. int) => unit) => unit, - @meth - "threeargs": (int, string, int) => string, - "twoArgs": (. int, string) => int, -} - -// let foo = (x: someMethods) => x["threeargs"](3, "a", 4) - -let bar = (x: someMethods) => { - let f = x["twoArgs"] - f(. 3, "a") -} - diff --git a/examples/deadcode/src/ComponentAsProp.bs.js b/examples/deadcode/src/ComponentAsProp.bs.js deleted file mode 100644 index 442843a9..00000000 --- a/examples/deadcode/src/ComponentAsProp.bs.js +++ /dev/null @@ -1,18 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE - -import * as React from "react"; -import * as Caml_option from "rescript/lib/es6/caml_option.js"; - -function ComponentAsProp(Props) { - var title = Props.title; - var description = Props.description; - var button = Props.button; - return React.createElement("div", undefined, React.createElement("div", undefined, title, description, button !== undefined ? Caml_option.valFromOption(button) : null)); -} - -var make = ComponentAsProp; - -export { - make , -} -/* react Not a pure module */ diff --git a/examples/deadcode/src/ComponentAsProp.gen.tsx b/examples/deadcode/src/ComponentAsProp.gen.tsx deleted file mode 100644 index 7c9a4bd6..00000000 --- a/examples/deadcode/src/ComponentAsProp.gen.tsx +++ /dev/null @@ -1,23 +0,0 @@ -/* TypeScript file generated from ComponentAsProp.res by genType. */ -/* eslint-disable import/first */ - - -import * as React from 'react'; - -// @ts-ignore: Implicit any on import -import * as ComponentAsPropBS__Es6Import from './ComponentAsProp.bs'; -const ComponentAsPropBS: any = ComponentAsPropBS__Es6Import; - -// tslint:disable-next-line:interface-over-type-literal -export type Props = { - readonly button?: JSX.Element; - readonly description: JSX.Element; - readonly title: JSX.Element -}; - -/** This is like declaring a normal ReasonReact component's `make` function, except the body is a the interop hook wrapJsForReason */ -export const make: React.ComponentType<{ - readonly button?: JSX.Element; - readonly description: JSX.Element; - readonly title: JSX.Element -}> = ComponentAsPropBS.make; diff --git a/examples/deadcode/src/ComponentAsProp.res b/examples/deadcode/src/ComponentAsProp.res deleted file mode 100644 index a1f3d456..00000000 --- a/examples/deadcode/src/ComponentAsProp.res +++ /dev/null @@ -1,17 +0,0 @@ -@ocaml.doc( - " This is like declaring a normal ReasonReact component's `make` function, except the body is a the interop hook wrapJsForReason " -) -@genType -@react.component -let make = (~title, ~description, ~button=?) => { -
- {React.string( - "Hooks example " ++ (vehicle.name ++ (" clicked " ++ (string_of_int(count) ++ " times"))), - )} -
- -