diff options
author | 2021-09-27 01:34:12 -0700 | |
---|---|---|
committer | 2021-09-27 01:34:12 -0700 | |
commit | 9e0511995ab516cc73bfb54d4b6a9721de2ce823 (patch) | |
tree | 24653d460492fbff8afe90cbfa0566042cef6b04 /examples/macros/components | |
parent | a113603f1009e6ee8bf64ea4453e9513b72b4350 (diff) | |
parent | 62d51f7d2e636099f03abcb879475d1193c4022d (diff) | |
download | bun-9e0511995ab516cc73bfb54d4b6a9721de2ce823.tar.gz bun-9e0511995ab516cc73bfb54d4b6a9721de2ce823.tar.zst bun-9e0511995ab516cc73bfb54d4b6a9721de2ce823.zip |
Merge branch 'jarred/ast-again'bun-v0.0.25
Diffstat (limited to 'examples/macros/components')
-rw-r--r-- | examples/macros/components/example.jsx | 17 | ||||
-rw-r--r-- | examples/macros/components/index.tsx | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/examples/macros/components/example.jsx b/examples/macros/components/example.jsx new file mode 100644 index 000000000..ad80ce9e1 --- /dev/null +++ b/examples/macros/components/example.jsx @@ -0,0 +1,17 @@ +// source code +import { matchInFile } from "macro:matchInFile"; + +export const IPAddresses = () => ( + <div> + <h2>recent ip addresses</h2> + <div className="Lines"> + {matchInFile("access.log", /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/).map( + (ipAddress, index) => ( + <div className="Line" key={index}> + {ipAddress} + </div> + ) + )} + </div> + </div> +); diff --git a/examples/macros/components/index.tsx b/examples/macros/components/index.tsx new file mode 100644 index 000000000..6c3e39be7 --- /dev/null +++ b/examples/macros/components/index.tsx @@ -0,0 +1,11 @@ +import * as ReactDOM from "react-dom"; +import * as React from "react"; +import { IPAddresses } from "./example"; + +const Start = function () { + const root = document.createElement("div"); + document.body.appendChild(root); + ReactDOM.render(<IPAddresses />, root); +}; + +Start(); |