{"id":16739354,"url":"https://github.com/ariperkkio/rollup-plugin-local-import","last_synced_at":"2025-03-17T01:32:07.104Z","repository":{"id":59654748,"uuid":"529912718","full_name":"AriPerkkio/rollup-plugin-local-import","owner":"AriPerkkio","description":"Rollup plugin for manipulating local import/export statements | 🦀","archived":false,"fork":false,"pushed_at":"2024-05-27T05:19:43.000Z","size":1362,"stargazers_count":17,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-11T17:35:28.887Z","etag":null,"topics":["napi-rs","rollup-plugin"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/AriPerkkio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2022-08-28T16:11:45.000Z","updated_at":"2024-07-05T13:23:11.009Z","dependencies_parsed_at":"2023-10-02T04:32:33.035Z","dependency_job_id":"c0791dd7-924a-4d3d-919e-3dc7b3af9c30","html_url":"https://github.com/AriPerkkio/rollup-plugin-local-import","commit_stats":{"total_commits":164,"total_committers":2,"mean_commits":82.0,"dds":0.4085365853658537,"last_synced_commit":"f06038f2a29b2b224c777df659c1289ee33a3702"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":"napi-rs/package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AriPerkkio%2Frollup-plugin-local-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AriPerkkio%2Frollup-plugin-local-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AriPerkkio%2Frollup-plugin-local-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AriPerkkio%2Frollup-plugin-local-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AriPerkkio","download_url":"https://codeload.github.com/AriPerkkio/rollup-plugin-local-import/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221670315,"owners_count":16861052,"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":["napi-rs","rollup-plugin"],"created_at":"2024-10-13T00:50:28.754Z","updated_at":"2024-10-27T11:43:40.435Z","avatar_url":"https://github.com/AriPerkkio.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-local-import\n\n[![Version][version-badge]][version-url]\n\n[Installation](#installation) | [Configuration](#configuration) | [Examples](#examples)\n\n---\n\n\u003e [Rollup](https://rollupjs.org/) plugin for manipulating local `import`/`export` statements\n\n[version-badge]: https://img.shields.io/npm/v/rollup-plugin-local-import\n[version-url]: https://www.npmjs.com/package/rollup-plugin-local-import\n\n## Installation\n\n`rollup-plugin-local-import` should be included in development dependencies.\n\n```\nyarn add --dev rollup-plugin-local-import\n```\n\n### Supported Operating Systems\n\nThis plugin is built as native addon and supports following operating systems.\n\n|                | node14 | node16 | node18 |\n| -------------- | ------ | ------ | ------ |\n| Windows x64    | ✓      | ✓      | ✓      |\n| Windows x32    | ✓      | ✓      | ✓      |\n| macOS x64      | ✓      | ✓      | ✓      |\n| macOS arm64    | ✓      | ✓      | ✓      |\n| Linux x64 gnu  | ✓      | ✓      | ✓      |\n| Linux x64 musl | ✓      | ✓      | ✓      |\n\nSupport can be extended to cover more systems if needed.\n\n## Configuration\n\nAdd plugin in your rollup configuration:\n\n```js\nimport { defineConfig } from \"rollup\";\nimport { localImport } from \"rollup-plugin-local-import\";\n\nexport default defineConfig({\n  // ...\n  plugins: [localImport((path) =\u003e `${path}.js`)],\n});\n```\n\n### Options\n\n```ts\nfunction localImport(callback: Callback): RollupPlugin;\n```\n\n- `callback`, `(path: string) =\u003e string`, required\n\nCallback called with each identified local import. Must return `string`.\n\n```js\nfunction transformLocalImports(path: string): string {\n  console.log(`Path is \"${path}\"`);\n  console.log(`Returning \"${path}.js\"`);\n\n  return `${path}.js`;\n}\n\nexport default defineConfig({\n  // ...\n  plugins: [localImport(transformLocalImports)],\n});\n```\n\n```sh\n\u003e Path is \"./Header\"\n\u003e Returning \"./Header.js\"\n```\n\n```diff\n- export { default } from './Header';\n+ export { default } from './Header.js';\n```\n\n## Examples\n\nWith `localImport(path =\u003e path + '.js')`:\n\nInput:\n\n```js\nexport * from \"./local-file\";\nexport * from \"../file-from-parent-directory\";\nexport * from \"some-dependency\";\n\nexport { a } from \"./local-file\";\nexport { b } from \"../file-from-parent-directory\";\nexport { c } from \"some-dependency\";\n```\n\nOutput:\n\n```js\nexport * from \"./local-file.js\";\nexport * from \"../file-from-parent-directory.js\";\nexport * from \"some-dependency\"; // Not changed\n\nexport { a } from \"./local-file.js\";\nexport { b } from \"../file-from-parent-directory.js\";\nexport { c } from \"some-dependency\"; // Not changed\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariperkkio%2Frollup-plugin-local-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariperkkio%2Frollup-plugin-local-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariperkkio%2Frollup-plugin-local-import/lists"}