{"id":14243217,"url":"https://github.com/effector/swc-plugin-legacy","last_synced_at":"2025-08-11T20:30:41.519Z","repository":{"id":57376015,"uuid":"437822859","full_name":"effector/swc-plugin-legacy","owner":"effector","description":"SWC plugin to efficiently work with effector","archived":true,"fork":false,"pushed_at":"2024-08-15T05:52:55.000Z","size":215,"stargazers_count":26,"open_issues_count":14,"forks_count":2,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-28T11:50:05.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/@effector/swc-plugin","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/effector.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-12-13T10:07:03.000Z","updated_at":"2025-02-23T05:54:14.000Z","dependencies_parsed_at":"2023-02-13T02:16:00.442Z","dependency_job_id":"41eadf9d-9d82-4d96-9194-b1e5cc15c5be","html_url":"https://github.com/effector/swc-plugin-legacy","commit_stats":{"total_commits":16,"total_committers":6,"mean_commits":"2.6666666666666665","dds":0.3125,"last_synced_commit":"563e6692d39a38a7774c930a13caf4b825fd456a"},"previous_names":["effector/swc-plugin-legacy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/effector/swc-plugin-legacy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effector%2Fswc-plugin-legacy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effector%2Fswc-plugin-legacy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effector%2Fswc-plugin-legacy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effector%2Fswc-plugin-legacy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/effector","download_url":"https://codeload.github.com/effector/swc-plugin-legacy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/effector%2Fswc-plugin-legacy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268682542,"owners_count":24289660,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-21T13:01:20.025Z","updated_at":"2025-08-11T20:30:41.165Z","avatar_url":"https://github.com/effector.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Effector SWC Plugin\n\n\u003e [!CAUTION]\n\u003e This project is abandoned and not maintained anymore. Please use [effector-swc-plugin](https://github.com/kireevmp/effector-swc-plugin) instead.\n\nPlugin for SWC which can be used to automatically change imports (scope/no scope), insert sids (for scope) or for debugging.\n\n## ⚠️ Please notice, that SWC Plugin API itself is not stable yet ⚠️\n\nThis means that `@effector/swc-plugin` **can and probably will be affected by breaking changes in the SWC Plugins API** in the future.\nAt the moment this plugins is seems to be stable enough. But if you need guaranteed stability - prefer `effector/babel-plugin` instead.\n\nWhen SWC Plugin API will be stabilized, we will be able to declare `@effector/swc-plugin` as stable too.\n\n# Installation\n\nYou can use any package manager that you want.\nYou also need to make sure that `@swc/core` is installed, no matter where are you calling the transforms from. Be it `unplugin-swc` or `@swc/cli`.\n\n```bash\npnpm add -D @effector/swc-plugin @swc/core\n```\n\n_or_\n\n```bash\nnpm add -D @effector/swc-plugin @swc/core\n```\n\n_or_\n\n```bash\nyarn add -D @effector/swc-plugin @swc/core\n```\n\n# Usage\n\nIn the simplest case, it can be used without any configuration.\n\n`.swcrc`\n\n```json\n{\n  \"$schema\": \"https://json.schemastore.org/swcrc\",\n  \"jsc\": {\n    \"experimental\": {\n      \"plugins\": [\"@effector/swc-plugin\"]\n    }\n  }\n}\n```\n\n## Configuration\n\n### importName\n\n- Type: `string | string[]`\n- Default: `['effector', 'effector/compat']`\n\nSpecify import name or names to process by plugin.\nImport should be used in the code as specifed.\n\n### factories\n\n- Type: `string[]`\n\nAccepts an array of module names which exports treat as custom factories therefore each function call provides unique prefix for sids of units inside them. Used to SSR(Server Side Rendering) and it's not required for client-only application (except if you want to test your app).\n\n- Factories can have any amount of arguments.\n- Factories can create any amount of units.\n- Factories can call any effector methods.\n- Factories can call another factories from others modules.\n- Modules with factories can export any amount of functions.\n- Factories should be compiled with `effector/babel-plugin` or `@effector/swc-plugin` as well as code which use them.\n\n`.swcrc`\n\n```json\n{\n  \"$schema\": \"https://json.schemastore.org/swcrc\",\n  \"jsc\": {\n    \"experimental\": {\n      \"plugins\": [\n        \"@effector/swc-plugin\",\n        {\n          \"factories\": [\"src/createEffectStatus\", \"~/createCommonPending\"]\n        }\n      ]\n    }\n  }\n}\n```\n\n`./src/createEffectStatus.js`\n\n```js\nimport { rootDomain } from './rootDomain';\n\nexport function createEffectStatus(fx) {\n  const $status = rootDomain.createStore('init').on(fx.finally, (_, { status }) =\u003e status);\n\n  return $status;\n}\n```\n\n`./src/statuses.js`\n\n```js\nimport { createEffectStatus } from './createEffectStatus';\nimport { fetchUserFx, fetchFriendsFx } from './api';\n\nexport const $fetchUserStatus = createEffectStatus(fetchUserFx);\nexport const $fetchFriendsStatus = createEffectStatus(fetchFriendsFx);\n```\n\nImport `createEffectStatus` from `./createEffectStatus` was treated as factory function so each store created by it has its own sid and will be handled by serialize independently, although without `factories` they will share the same `sid`.\n\n### bindings\n\n- Type: `{react?: {scopeReplace?: bool}, solid?: {scopeReplace?: bool}} | undefined`\n\nIf `scopeReplace` is enabled for the view library, imports will be replaced from `effector-{viewLib}` to `effector-{viewLib}/scope`.\nThis config might get additional fields (nested as well) later.\n\n### addNames\n\n- Type: `boolean`\n- Default: `true`\n\nAdd names to units factories calls. Useful for minification and obfuscation of production builds.\n\n### addLoc\n\n- Type: `boolean`\n- Default: `false`\n\nAdd location to methods' calls. Used by devtools, for example effector-logger.\n\n### debugSids\n\n- Type: `boolean`\n- Default: `false`\n\nAdd path of a file and a variable name whether a unit was defined to a sid. Useful for debugging SSR.\n\n## Bundlers\n\nVite + Solid (SSR)\n\nTo use vite + solidjs you have to do the following:\n\n1. Install dependencies\n   - ```bash\n     pnpm add -D vite vite-plugin-solid solid-js\n     pnpm add -D unplugin-swc\n     pnpm add -D effector effector-solid @effector/swc-plugin\n     ```\n2. `vite.config.ts` should look like this:\n   - ```ts\n     // vite.config.ts\n     import { defineConfig } from 'vite';\n     import solidPlugin from 'vite-plugin-solid';\n     import swc from 'unplugin-swc';\n\n     export default defineConfig({\n       plugins: [\n         solidPlugin(),\n         swc.vite({\n           jsc: {\n             experimental: {\n               plugins: ['@effector/swc-plugin'],\n             },\n           },\n         }),\n       ],\n     });\n     ```\n\nOr you can store `jsc` field in `.swcrc` instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffector%2Fswc-plugin-legacy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feffector%2Fswc-plugin-legacy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffector%2Fswc-plugin-legacy/lists"}