{"id":18069050,"url":"https://github.com/irekrog/use-node","last_synced_at":"2025-04-05T16:17:47.555Z","repository":{"id":144082229,"uuid":"613583147","full_name":"irekrog/use-node","owner":"irekrog","description":"useNode React hook server","archived":false,"fork":false,"pushed_at":"2023-03-13T22:13:26.000Z","size":21,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T12:52:46.720Z","etag":null,"topics":["next","nextjs","react","react-server-components","reactjs"],"latest_commit_sha":null,"homepage":"https://rsc-server-data-example.vercel.app/use-node","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irekrog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-13T21:22:56.000Z","updated_at":"2024-01-27T00:11:07.000Z","dependencies_parsed_at":"2023-05-26T08:31:01.658Z","dependency_job_id":null,"html_url":"https://github.com/irekrog/use-node","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irekrog%2Fuse-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irekrog%2Fuse-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irekrog%2Fuse-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irekrog%2Fuse-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irekrog","download_url":"https://codeload.github.com/irekrog/use-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361704,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["next","nextjs","react","react-server-components","reactjs"],"created_at":"2024-10-31T08:08:46.029Z","updated_at":"2025-04-05T16:17:47.549Z","avatar_url":"https://github.com/irekrog.png","language":"TypeScript","readme":"# use-node\n\n\nhttps://user-images.githubusercontent.com/11172548/224843666-61eb2555-c6ba-4e9b-829e-5d8a31a54e12.mov\n\n\n----\n`useNode` React server hook\n\nThis is a hook working with [React Server Component (RSC)](https://beta.nextjs.org/docs/rendering/server-and-client-components#server-components) and [Next.js with App Router](https://beta.nextjs.org/docs/app-directory-roadmap).\n\n## Getting Started\n\n```bash\nnpm install use-node\n```\n\nor\n\n```bash\nyarn add use-node\n```\n\nor\n\n```bash\npnpm add use-node\n```\n\n## Usage\n\n```tsx\nimport { useNode } from \"use-node\";\nimport { ClientComponent } from \"./ClientComponent\";\n\nexport default async function App() {\n  const process = await useNode(\"node:process\");\n  console.log(\"env\", process.env.NODE_ENV); // server log\n\n  // pass this to the Client Component\n  return \u003cClientComponent data={process.env.NODE_ENV} /\u003e;\n}\n```\n\n## Docs\n\n### `useNode`\n\n```ts\nconst data = await useNode(module: Modules)\n```\n\n#### Possible modules\n\n```ts\ntype Modules =\n  | \"node:async_hooks\"\n  | \"node:buffer\"\n  | \"node:child_process\"\n  | \"node:cluster\"\n  | \"node:console\"\n  | \"node:constants\"\n  | \"node:dgram\"\n  | \"node:diagnostics_channel\"\n  | \"node:dns\"\n  | \"node:dns/promises\"\n  | \"node:fs\"\n  | \"node:fs/promises\"\n  | \"node:http\"\n  | \"node:http2\"\n  | \"node:https\"\n  | \"node:inspector\"\n  | \"node:net\"\n  | \"node:os\"\n  | \"node:path\"\n  | \"node:perf_hooks\"\n  | \"node:process\"\n  | \"node:querystring\"\n  | \"node:readline\"\n  | \"node:repl\"\n  | \"node:stream/promises\"\n  | \"node:stream/web\"\n  | \"node:string_decoder\"\n  | \"node:timers\"\n  | \"node:timers/promises\"\n  | \"node:tls\"\n  | \"node:trace_events\"\n  | \"node:tty\"\n  | \"node:url\"\n  | \"node:util\"\n  | \"node:v8\"\n  | \"node:vm\"\n  | \"node:wasi\"\n  | \"node:worker_threads\"\n  | \"node:zlib\";\n```\n\n## Example\nhttps://github.com/irekrog/rsc-server-data-example/blob/master/src/app/use-node/page.tsx\n\nhttps://rsc-server-data-example.vercel.app/use-node\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firekrog%2Fuse-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firekrog%2Fuse-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firekrog%2Fuse-node/lists"}