{"id":15043281,"url":"https://github.com/geopjr/vite-plugin-dart","last_synced_at":"2025-04-14T20:46:19.747Z","repository":{"id":38082271,"uuid":"411050281","full_name":"GeopJr/vite-plugin-dart","owner":"GeopJr","description":"⚡ + 🎯 = 💖","archived":false,"fork":false,"pushed_at":"2023-06-14T04:15:32.000Z","size":201,"stargazers_count":31,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T09:03:43.409Z","etag":null,"topics":["dart","plugin","vite","vitejs"],"latest_commit_sha":null,"homepage":"https://vite-plugin-dart.vercel.app","language":"JavaScript","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/GeopJr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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-09-27T21:37:57.000Z","updated_at":"2024-11-25T14:38:00.000Z","dependencies_parsed_at":"2024-09-25T01:58:09.518Z","dependency_job_id":null,"html_url":"https://github.com/GeopJr/vite-plugin-dart","commit_stats":{"total_commits":159,"total_committers":3,"mean_commits":53.0,"dds":0.06289308176100628,"last_synced_commit":"d097a2541cb9439fad8563584df32b01b9b98330"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeopJr%2Fvite-plugin-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeopJr%2Fvite-plugin-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeopJr%2Fvite-plugin-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeopJr%2Fvite-plugin-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeopJr","download_url":"https://codeload.github.com/GeopJr/vite-plugin-dart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248960739,"owners_count":21189987,"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":["dart","plugin","vite","vitejs"],"created_at":"2024-09-24T20:48:48.091Z","updated_at":"2025-04-14T20:46:19.729Z","avatar_url":"https://github.com/GeopJr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"256\" alt=\"vite plugin dart logo\" src=\"./example/favicon.svg\" /\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003evite-plugin-dart\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003eImport .dart files effortlessly.\u003c/h4\u003e\n\u003cp align=\"center\"\u003e\n  \u003cbr /\u003e\n    \u003ca href=\"https://github.com/GeopJr/vite-plugin-dart/blob/main/CODE_OF_CONDUCT.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/Contributor%20Covenant-v2.1-3fc5ff.svg?style=for-the-badge\u0026labelColor=00579c\" alt=\"Code Of Conduct\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n#\n\n## Install\n\n- Install the plugin:\n\n```bash\npnpm i -D vite-plugin-dart # npm, yarn\n```\n\n- Install [Dart](https://dart.dev/get-dart)\n\n- Add `vite-plugin-dart` to your `vite.config.mjs`:\n\n```js\n// vite.config.mjs (or .ts)\nimport Dart from \"vite-plugin-dart\";\n\nexport default {\n  plugins: [Dart()],\n};\n```\n\n#\n\n## Importing\n\nIt's as simple as:\n\n```js\nimport \"./index.dart\";\n```\n\nAll your Pub packages should work as expected! For an example take a look at the [example](./example) folder.\n\n#\n\n## Options\n\nHere's the default options:\n\n```js\nconst defaultConfig = {\n  dart: \"dart\",\n  minify: false,\n  \"enable-asserts\": false,\n  verbose: false,\n  define: [],\n  packages: \"\",\n  \"suppress-warnings\": false,\n  \"fatal-warnings\": false,\n  \"suppress-hints\": false,\n  \"enable-diagnostic-colors\": false,\n  terse: false,\n  \"show-package-warnings\": false,\n  csp: false,\n  \"no-source-maps\": false,\n  \"omit-late-names\": false,\n  O: 1,\n  \"omit-implicit-checks\": false,\n  \"trust-primitives\": false,\n  \"lax-runtime-type-to-string\": false,\n  verbosity: \"warning\",\n  stdio: true,\n};\n```\n\nFor most, you can read their description by running `dart compile js -h -v`.\n\nThe ones that are not there are:\n\n```\ndart: Dart binary location\nverbosity: Verbosity level (all, info, warning, error)\nstdio: Whether or not to pass the dart stdio to parent\n```\n\nIt uses JSDoc, so make sure to follow your IDE's annotations.\n\n#\n\n## Example\n\nSee the [example](./example) folder.\n\nAll tools used there are Dart packages!\n\n#\n\n## How does it work?\n\nDart can compile to JS using `dart2js`. This plugin compiles your Dart files using that at your OS' tmp folder and then after cleaning the generated sourcemaps, returns it to Vite which imports it.\n\n#\n\n## Deploying\n\nMost platforms do not provide `dart` pre-installed so you need to install it.\n\nThe general workflow is: `Install Dart =\u003e npm i =\u003e dart pub get =\u003e npm run build`.\n\nFor example, here's the Vercel config for this repo:\n\n```bash\nBuild Command: cd example \u0026\u0026 npm run build\n\nOutput Dir: ./example/dist\n\nInstall Command: yum install unzip -y \u0026\u0026 cd example \u0026\u0026 if [ ! -d \"./dart-sdk/\" ]; then curl -L  https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-linux-x64-release.zip \u003e dart.zip; fi \u0026\u0026 unzip -qq dart.zip \u0026\u0026 npm i \u0026\u0026 ./dart-sdk/bin/dart pub get\n```\n\nAt the same time, [vite.config.mjs](./example/vite.config.mjs) has some options for this plugin based on the current environment:\n\n```js\nDart({\n  // Optimizations set to 2 on prod\n  O: mode === \"development\" ? 1 : 2,\n  // Dart location when on Vercel (This is a custom env var on Vercel, set to true)\n  dart: process.env.VERCEL ? \"./dart-sdk/bin/dart\" : \"dart\",\n}),\n```\n\n#\n\n## Contributing\n\n1. Read the [Code of Conduct](https://github.com/GeopJr/vite-plugin-dart/blob/main/CODE_OF_CONDUCT.md)\n2. Fork it ( https://github.com/GeopJr/vite-plugin-dart/fork )\n3. Create your feature branch (git checkout -b my-new-feature)\n4. Commit your changes (git commit -am 'Add some feature')\n5. Push to the branch (git push origin my-new-feature)\n6. Create a new Pull Request\n\n\u003e Dart and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeopjr%2Fvite-plugin-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeopjr%2Fvite-plugin-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeopjr%2Fvite-plugin-dart/lists"}