{"id":26893372,"url":"https://github.com/refirst11/rscute","last_synced_at":"2026-04-19T11:05:49.056Z","repository":{"id":285048614,"uuid":"955998105","full_name":"refirst11/rscute","owner":"refirst11","description":"⚡️ Rust Execute: TypeScript ESM \u0026 CJS faster execution in memory with SWC","archived":false,"fork":false,"pushed_at":"2025-05-08T11:16:54.000Z","size":68,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T08:34:57.431Z","etag":null,"topics":["cli","commonjs","esm","node","runtime","swc","typescript"],"latest_commit_sha":null,"homepage":"https://www.deepwiki.com/refirst11/rscute","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/refirst11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-03-27T14:34:01.000Z","updated_at":"2025-05-08T11:16:58.000Z","dependencies_parsed_at":"2025-04-13T09:34:34.731Z","dependency_job_id":null,"html_url":"https://github.com/refirst11/rscute","commit_stats":null,"previous_names":["refirst11/rscute"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refirst11%2Frscute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refirst11%2Frscute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refirst11%2Frscute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refirst11%2Frscute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/refirst11","download_url":"https://codeload.github.com/refirst11/rscute/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253540673,"owners_count":21924523,"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":["cli","commonjs","esm","node","runtime","swc","typescript"],"created_at":"2025-03-31T23:46:57.020Z","updated_at":"2026-04-19T11:05:49.048Z","avatar_url":"https://github.com/refirst11.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rscute \u0026middot; [![powered by SWC](https://img.shields.io/badge/powered%20by-swc-skyblue)](https://swc.rs/)\n\nFaster Executor for **TypeScript** using [**@swc/core**](https://swc.rs/docs/usage/core)\n\nIntercepts `require` calls for TypeScript files, recursively resolves dependencies, and evaluates them as a single flat bundle — all in-memory, with automatic symbol mangling to prevent collisions.\n\n## Installation\n\n```sh\nnpm i -D rscute\n```\n\n\u003e When using pnpm, use `pnpm exec` instead of `npx` for running commands.\n\n## Usage\n\n### CLI\n\n```sh\nnpx rscute script.ts\n```\n\n### Register\n\n**Node.js `-r` flag:**\n\n```sh\nnode -r rscute script.ts\n```\n\n**Hook:**\n\n```js\nconst { register } = require('rscute/register');\n\nregister();\n\nrequire('./filename.ts');\n```\n\n\u003e **Supported entry extensions:** `.ts`, `.tsx`, `.cts`\n\n### Programmatic API\n\n#### `execute(code, options)` — `rscute/vm`\n\nCompiles and executes a TypeScript code string in a sandboxed `vm.Context`, returning its module exports.\n\n```js\nimport { execute } from 'rscute/vm';\n\nconst code = `export function greet() { return 'hello'; }`;\nconst result = execute(code);\n\nconsole.log(result.greet()); // hello\n```\n\n| Parameter | Type                    | Description                                        |\n| --------- | ----------------------- | -------------------------------------------------- |\n| `code`    | `string`                | TypeScript or JavaScript code string               |\n| `options` | `{ filePath?: string }` | Optional. Base path for relative import resolution |\n\n#### `bundle(filePath)` — `rscute/bundle`\n\nResolves an entry file and all its dependencies into a single flat JavaScript string, without executing it.\n\n```js\nimport { bundle } from 'rscute/bundle';\nimport path from 'path';\n\nconst code = bundle(path.resolve(__dirname, './script.ts'));\n```\n\n| Parameter  | Type     | Description                     |\n| ---------- | -------- | ------------------------------- |\n| `filePath` | `string` | Absolute path to the entry file |\n\n## How It Works\n\nrscute resolves and bundles imported modules recursively at runtime using SWC, without writing to disk.\n\nWhen the same symbol name appears in multiple bundled files, rscute mangles conflicting names automatically before evaluation to prevent collisions in the flat bundle scope.\n\n| Entry Point    | Behavior                                             |\n| -------------- | ---------------------------------------------------- |\n| CLI / register | Compiles and evaluates via module loader             |\n| rscute/bundle  | Returns compiled bundle string in-memory             |\n| rscute/vm      | Compiles and evaluates inside an isolated vm sandbox |\n\n**Supported extensions:** `.js`, `.ts`, `.mjs`, `.mts`, `.cjs`, `.cts`, `.jsx`, `.tsx`\n\n## License\n\nrscute is [MIT licensed](https://github.com/refirst11/rscute/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefirst11%2Frscute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefirst11%2Frscute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefirst11%2Frscute/lists"}