routie dev init since i didn't adhere to any proper guidance up until now

This commit is contained in:
2026-04-29 22:27:29 -06:00
commit e1dabb71e2
15301 changed files with 3562618 additions and 0 deletions
+318
View File
@@ -0,0 +1,318 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
### [2.1.3](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.1.2...vite-plugin-vuetify@2.1.3) (2026-01-19)
### Bug Fixes
* allow vuetify plugin to work with unplugin-vue ([0136201](https://github.com/vuetifyjs/vuetify-loader/commit/013620115691b6d6af2f98917bc44e6e28b458d5))
* support vuetify 4 ([6dc37ce](https://github.com/vuetifyjs/vuetify-loader/commit/6dc37ce2ee9a3feed333a65baae827119dc84133))
### [2.1.2](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.1.1...vite-plugin-vuetify@2.1.2) (2025-07-31)
### Bug Fixes
* correct `styles: 'sass'` path resolution ([d57e3c7](https://github.com/vuetifyjs/vuetify-loader/commit/d57e3c779fc3f7755853e68a5e055201d4b5d011))
### [2.1.1](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.1.0...vite-plugin-vuetify@2.1.1) (2025-04-03)
### Bug Fixes
* **styles:** resolve new scss component styles ([#345](https://github.com/vuetifyjs/vuetify-loader/issues/345)) ([98ef110](https://github.com/vuetifyjs/vuetify-loader/commit/98ef1106fb3875a5079d309986de61e12cd5683d))
## [2.1.0](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.0.4...vite-plugin-vuetify@2.1.0) (2025-02-04)
**Note:** Version bump only for package vite-plugin-vuetify
### [2.0.4](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.0.3...vite-plugin-vuetify@2.0.4) (2024-08-04)
### Bug Fixes
* respect vue's include and exclude options ([557713a](https://github.com/vuetifyjs/vuetify-loader/commit/557713aa2c32bfdf2a6465d8a5c6eeabe0613491))
### [2.0.3](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.0.2...vite-plugin-vuetify@2.0.3) (2024-03-10)
**Note:** Version bump only for package vite-plugin-vuetify
### [2.0.2](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.0.1...vite-plugin-vuetify@2.0.2) (2024-02-28)
### Bug Fixes
* correct cjs types export ([4512234](https://github.com/vuetifyjs/vuetify-loader/commit/4512234a1192895d59db8180fa949597f2894025)), closes [#327](https://github.com/vuetifyjs/vuetify-loader/issues/327)
* don't parse file paths as urls ([50c2dc0](https://github.com/vuetifyjs/vuetify-loader/commit/50c2dc0e1a739039763e32c591dcd68981f99f18)), closes [#324](https://github.com/vuetifyjs/vuetify-loader/issues/324)
### [2.0.1](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@2.0.0...vite-plugin-vuetify@2.0.1) (2023-12-12)
### Bug Fixes
* support node 18 ([9683bf5](https://github.com/vuetifyjs/vuetify-loader/commit/9683bf54ad3b26a6553574a1be6a6c3c95fc3afd)), closes [#325](https://github.com/vuetifyjs/vuetify-loader/issues/325)
## [2.0.0](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.2...vite-plugin-vuetify@2.0.0) (2023-12-12)
### ⚠ BREAKING CHANGES
* Requires node >18
* Removed `styles: 'expose'` option
### Features
* add autoImport ignore option ([#323](https://github.com/vuetifyjs/vuetify-loader/issues/323)) ([1328d49](https://github.com/vuetifyjs/vuetify-loader/commit/1328d492abcf4612f336b6ad1d014f1ed250793c))
* add esm build ([34a03c1](https://github.com/vuetifyjs/vuetify-loader/commit/34a03c152e04e16694ca43c255a08edf3a2bd382)), closes [#319](https://github.com/vuetifyjs/vuetify-loader/issues/319)
* allow labs auto-import ([55ead16](https://github.com/vuetifyjs/vuetify-loader/commit/55ead1692cd857a15e7595d14e97766c57651f0b)), closes [#315](https://github.com/vuetifyjs/vuetify-loader/issues/315)
* remove `styles: 'expose'` ([c43dc80](https://github.com/vuetifyjs/vuetify-loader/commit/c43dc804811bf22be920ac72a38e7b4c193bca3b))
### Bug Fixes
* add explicit vue peer dependency ([6634db3](https://github.com/vuetifyjs/vuetify-loader/commit/6634db3218dcc706db1c5c9e90f338ce76e9fff3)), closes [#292](https://github.com/vuetifyjs/vuetify-loader/issues/292)
### [1.0.2](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.1...vite-plugin-vuetify@1.0.2) (2023-01-28)
### Bug Fixes
* add leading slash to absolute paths on windows ([3ecd8e2](https://github.com/vuetifyjs/vuetify-loader/commit/3ecd8e2d8034137ca47ad8325df960dfb0efc08e)), closes [#274](https://github.com/vuetifyjs/vuetify-loader/issues/274)
### [1.0.1](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0...vite-plugin-vuetify@1.0.1) (2022-12-11)
### Bug Fixes
* support vite 4 ([b7d6661](https://github.com/vuetifyjs/vuetify-loader/commit/b7d6661a8b6fe3b87c95a3c5e3961cc6cb2e661d)), closes [#279](https://github.com/vuetifyjs/vuetify-loader/issues/279)
## [1.0.0](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.17...vite-plugin-vuetify@1.0.0) (2022-10-13)
### Features
* add transformAssetUrls ([c2e525b](https://github.com/vuetifyjs/vuetify-loader/commit/c2e525b3a3ad5582ffc50216a94c47b94f1c8fc9)), closes [#237](https://github.com/vuetifyjs/vuetify-loader/issues/237)
### Bug Fixes
* ignore non-standard query parameters ([183f9dc](https://github.com/vuetifyjs/vuetify-loader/commit/183f9dcc4db15afe9f5f4c46624301696c097750)), closes [#271](https://github.com/vuetifyjs/vuetify-loader/issues/271)
## [1.0.0-alpha.17](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.16...vite-plugin-vuetify@1.0.0-alpha.17) (2022-09-12)
### Bug Fixes
* resolve stylesheets when using configFile with optimizeDeps.exclude ([79f51cf](https://github.com/vuetifyjs/vuetify-loader/commit/79f51cff6907fce85f83d252baf70b91238e4b9c)), closes [#268](https://github.com/vuetifyjs/vuetify-loader/issues/268)
## [1.0.0-alpha.16](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.15...vite-plugin-vuetify@1.0.0-alpha.16) (2022-09-06)
### Bug Fixes
* support vite 3.1 ([51f13de](https://github.com/vuetifyjs/vuetify-loader/commit/51f13de891f1cdc329b3014067f8dfa7e77d85a3)), closes [#267](https://github.com/vuetifyjs/vuetify-loader/issues/267)
## [1.0.0-alpha.15](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.14...vite-plugin-vuetify@1.0.0-alpha.15) (2022-08-31)
### Features
* add styles.configFile option ([9142e9d](https://github.com/vuetifyjs/vuetify-loader/commit/9142e9d644ba1e4f86486440c29a318704090636)), closes [#263](https://github.com/vuetifyjs/vuetify-loader/issues/263) [#245](https://github.com/vuetifyjs/vuetify-loader/issues/245) [#221](https://github.com/vuetifyjs/vuetify-loader/issues/221)
* support "[@use](https://github.com/use) 'vuetify'" ([e578193](https://github.com/vuetifyjs/vuetify-loader/commit/e578193a685dd581f6f15ff6e5e99f1a6eebbf1c))
## [1.0.0-alpha.14](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.13...vite-plugin-vuetify@1.0.0-alpha.14) (2022-07-25)
### Bug Fixes
* transform imports in script setup lang="ts" ([322f6ba](https://github.com/vuetifyjs/vuetify-loader/commit/322f6ba511c0da4ffbb90e49bd7d467d993b8ac6))
## [1.0.0-alpha.13](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.12...vite-plugin-vuetify@1.0.0-alpha.13) (2022-07-23)
### Bug Fixes
* add vue and upath to dependencies ([ac5af82](https://github.com/vuetifyjs/vuetify-loader/commit/ac5af823f1bfd8bc79dc3eb353eed64adef34421)), closes [#242](https://github.com/vuetifyjs/vuetify-loader/issues/242)
* allow vite 3 ([a64f0c1](https://github.com/vuetifyjs/vuetify-loader/commit/a64f0c15ba71dbd5a323091328be50f70133724a)), closes [#256](https://github.com/vuetifyjs/vuetify-loader/issues/256)
* cache importers invalidation on Windows ([#255](https://github.com/vuetifyjs/vuetify-loader/issues/255)) ([ab0c22d](https://github.com/vuetifyjs/vuetify-loader/commit/ab0c22d1fb5d560686b8533e825290a413178b7c))
* load virtual requests with `?v=` query string ([#252](https://github.com/vuetifyjs/vuetify-loader/issues/252)) ([21bca2f](https://github.com/vuetifyjs/vuetify-loader/commit/21bca2f3c658168c371e850a8b6b1acc9757a0cf))
* passthrough sourcemaps ([dfdc815](https://github.com/vuetifyjs/vuetify-loader/commit/dfdc815ad175df9ffd8be5c4847d8fe29e442f39)), closes [#233](https://github.com/vuetifyjs/vuetify-loader/issues/233)
* resolve vuetify relative to cwd ([9bf71d4](https://github.com/vuetifyjs/vuetify-loader/commit/9bf71d4fd8596cf8333e3041f4307a851c7aba6a)), closes [#248](https://github.com/vuetifyjs/vuetify-loader/issues/248)
* skip certain files in pendingModules, timeout per file ([1543182](https://github.com/vuetifyjs/vuetify-loader/commit/15431824d3c7ee0bf6314822476c57d1be0448ee)), closes [#249](https://github.com/vuetifyjs/vuetify-loader/issues/249)
* use default export ([c5e01f5](https://github.com/vuetifyjs/vuetify-loader/commit/c5e01f5b0b1f018800be9b4e1a0cd2501a6f2a57)), closes [#227](https://github.com/vuetifyjs/vuetify-loader/issues/227)
## [1.0.0-alpha.12](https://github.com/vuetifyjs/vuetify-loader/compare/vite-plugin-vuetify@1.0.0-alpha.11...vite-plugin-vuetify@1.0.0-alpha.12) (2022-06-16)
### Features
* support meta.load-css() ([29039f3](https://github.com/vuetifyjs/vuetify-loader/commit/29039f37eca66c8c46744fd87c6d181af9e9d64b))
* support vuetify beta.4 ([f1a0976](https://github.com/vuetifyjs/vuetify-loader/commit/f1a09765e568c7ee5481dd576765939ffc1fe534))
## 1.0.0-alpha.11 (2022-05-21)
### Features
* rename packages ([c64493d](https://github.com/vuetifyjs/vuetify-loader/commit/c64493d2d9d68338b23d302a3467c1058cd055f1)), closes [#236](https://github.com/vuetifyjs/vuetify-loader/issues/236)
* **styles:** add sass option ([ddd68d9](https://github.com/vuetifyjs/vuetify-loader/commit/ddd68d99aedaa0088c5d89740d1a9b9c1bb74808))
### Bug Fixes
* add plugin order warning ([1957398](https://github.com/vuetifyjs/vuetify-loader/commit/1957398cd199bfde3bf1debb4f3abd6e474b0389))
## [1.0.0-alpha.10](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.9...@vuetify/vite-plugin@1.0.0-alpha.10) (2021-12-10)
### Features
* add stylesTimeout option ([93e830d](https://github.com/vuetifyjs/vuetify-loader/commit/93e830dd728610bfa83c5a93f85fcca6acb4f59d))
### Bug Fixes
* disable esModuleInterop ([b3ae4d1](https://github.com/vuetifyjs/vuetify-loader/commit/b3ae4d17e4319ab1b8c550d50b0cc2737a8d0719)), closes [#222](https://github.com/vuetifyjs/vuetify-loader/issues/222)
* wait for all other modules to resolve before writing styles ([274ce9c](https://github.com/vuetifyjs/vuetify-loader/commit/274ce9ced8da65107b7544f9cdb2d82d463be313)), closes [#225](https://github.com/vuetifyjs/vuetify-loader/issues/225)
## [1.0.0-alpha.9](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.8...@vuetify/vite-plugin@1.0.0-alpha.9) (2021-11-17)
**Note:** Version bump only for package @vuetify/vite-plugin
## [1.0.0-alpha.8](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.7...@vuetify/vite-plugin@1.0.0-alpha.8) (2021-11-15)
**Note:** Version bump only for package @vuetify/vite-plugin
## [1.0.0-alpha.7](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.6...@vuetify/vite-plugin@1.0.0-alpha.7) (2021-11-11)
### Bug Fixes
* ignore non-url ids ([774f264](https://github.com/vuetifyjs/vuetify-loader/commit/774f264e22b8df6933fbcff1f51a4e4b50a1cb2d))
## [1.0.0-alpha.6](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.5...@vuetify/vite-plugin@1.0.0-alpha.6) (2021-11-11)
### Features
* support external templates ([8b7fc70](https://github.com/vuetifyjs/vuetify-loader/commit/8b7fc7082cf177e122d83b97ec0521092c044a77)), closes [#215](https://github.com/vuetifyjs/vuetify-loader/issues/215)
### Bug Fixes
* support node 12 ([9ddf99b](https://github.com/vuetifyjs/vuetify-loader/commit/9ddf99b3a3222d86cf9dc5b8a7561bc0131d6832)), closes [#212](https://github.com/vuetifyjs/vuetify-loader/issues/212)
* support production mode ([1cfaf2e](https://github.com/vuetifyjs/vuetify-loader/commit/1cfaf2efb64b8b65c54c1948a00bd81508db9a13)), closes [#213](https://github.com/vuetifyjs/vuetify-loader/issues/213)
## [1.0.0-alpha.5](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.4...@vuetify/vite-plugin@1.0.0-alpha.5) (2021-10-03)
### Bug Fixes
* normalise windows paths ([706913d](https://github.com/vuetifyjs/vuetify-loader/commit/706913da0a865643019db9b2ee627c0400d9cbaa)), closes [#205](https://github.com/vuetifyjs/vuetify-loader/issues/205)
* resolve absolute style imports ([199a5bf](https://github.com/vuetifyjs/vuetify-loader/commit/199a5bf6fd75dc5f1be21a88ca300bf403eac397)), closes [#206](https://github.com/vuetifyjs/vuetify-loader/issues/206)
## [1.0.0-alpha.4](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.3...@vuetify/vite-plugin@1.0.0-alpha.4) (2021-09-17)
### Bug Fixes
* use find-cache-dir, normalise dos paths ([990ee15](https://github.com/vuetifyjs/vuetify-loader/commit/990ee15ae49f331ff2d59b5cf00829ac32eb4ecd)), closes [#202](https://github.com/vuetifyjs/vuetify-loader/issues/202)
## [1.0.0-alpha.3](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.2...@vuetify/vite-plugin@1.0.0-alpha.3) (2021-09-11)
### Bug Fixes
* always use posix paths ([7393eef](https://github.com/vuetifyjs/vuetify-loader/commit/7393eefbb6a8a79de3b265c335ab5d238d4fe95e))
* support more import paths ([4253e7b](https://github.com/vuetifyjs/vuetify-loader/commit/4253e7b7224393adae8a5bccec650d70fb8a9cde))
* trigger HMR when adding new style imports ([ad1637b](https://github.com/vuetifyjs/vuetify-loader/commit/ad1637b516a6d873927098f973d339710092582b)), closes [#196](https://github.com/vuetifyjs/vuetify-loader/issues/196)
* update style import regexp ([a6b5e26](https://github.com/vuetifyjs/vuetify-loader/commit/a6b5e269225c4a0577b30f59b208629d30fc934f))
## [1.0.0-alpha.2](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.1...@vuetify/vite-plugin@1.0.0-alpha.2) (2021-08-31)
**Note:** Version bump only for package @vuetify/vite-plugin
## [1.0.0-alpha.1](https://github.com/vuetifyjs/vuetify-loader/compare/@vuetify/vite-plugin@1.0.0-alpha.0...@vuetify/vite-plugin@1.0.0-alpha.1) (2021-08-30)
### Features
* support HMR ([39baa9d](https://github.com/vuetifyjs/vuetify-loader/commit/39baa9dd70a52656af8f7508a1e095a468483d19))
# [1.0.0-alpha.0](https://github.com/vuetifyjs/vuetify-loader/compare/v1.7.3...v1.0.0-alpha.0) (2021-08-28)
### Features
* add vite plugin ([b75f1d4](https://github.com/vuetifyjs/vuetify-loader/commit/b75f1d495079ba317b6abc87615f6d662ddb11de))
+9
View File
@@ -0,0 +1,9 @@
The MIT License (MIT)
Copyright (c) 2016-2019 John Jeremy Leider
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+125
View File
@@ -0,0 +1,125 @@
# vite-plugin-vuetify
<div align="center">
<a href="https://www.patreon.com/kaelwd">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron" />
</a>
<br>
<a href="https://opencollective.com/vuetify">
<img src="https://opencollective.com/static/images/become_sponsor.svg" alt="Donate to OpenCollective">
</a>
</div>
## Automatic imports
```js
// vite.config.js
plugins: [
vue(),
vuetify({ autoImport: true }), // Enabled by default
]
```
```js
// plugins/vuetify.js
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
export default createVuetify()
```
### Include labs components
```js
// vite.config.js
plugins: [
vue(),
vuetify({
autoImport: { labs: true }
}),
]
```
### Ignoring components or directives
```js
// vite.config.js
plugins: [
vue(),
vuetify({
autoImport: {
ignore: [
'VAlert', // Component name
'Ripple', // Directive name
]
}
}),
]
```
Note `ignore` values are case-sensitive
## Style loading
### Customising variables
```js
// vite.config.js
plugins: [
vue(),
vuetify({ styles: { configFile: 'src/settings.scss' } }),
]
```
```js
// plugins/vuetify.js
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
export default createVuetify()
```
```scss
// settings.scss
@forward 'vuetify/settings' with (
$color-pack: false,
$utilities: false,
);
```
`settings.scss` can be used in your own components to access vuetify's variables.
### Remove all style imports
```js
// vite.config.js
plugins: [
vue(),
vuetify({ styles: 'none' }),
]
```
```js
// plugins/vuetify.js
import { createVuetify } from 'vuetify'
export default createVuetify()
```
### Import sass from source
Vuetify 3 uses precompiled css by default, these imports can optionally be modified to point to sass files instead:
```js
// vite.config.js
plugins: [
vue(),
vuetify({ styles: 'sass' }),
]
```
## Image loading
https://github.com/vitejs/vite-plugin-vue/blob/main/packages/plugin-vue/README.md#asset-url-handling
```js
// vite.config.js
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
export default {
plugins: [
vue({
template: { transformAssetUrls }
}),
vuetify(),
],
}
```
+153
View File
@@ -0,0 +1,153 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const loaderShared = require('@vuetify/loader-shared');
const vite = require('vite');
const url = require('url');
const path = require('upath');
const fs = require('node:fs/promises');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
function parseId(id) {
const [pathname, query] = id.split("?");
return {
query: query ? Object.fromEntries(new url.URLSearchParams(query)) : null,
path: pathname ?? id
};
}
function importPlugin(options) {
let filter;
return {
name: "vuetify:import",
configResolved(config) {
const vuetifyIdx = config.plugins.findIndex((plugin) => plugin.name === "vuetify:import");
const vueIdx = config.plugins.findIndex((plugin) => ["vite:vue", "unplugin-vue"].includes(plugin.name));
if (vuetifyIdx < vueIdx) {
throw new Error("Vuetify plugin must be loaded after the vue plugin");
}
const vueOptions = config.plugins[vueIdx].api.options;
filter = vite.createFilter(vueOptions.include, vueOptions.exclude);
},
async transform(code, id) {
const { query, path } = parseId(id);
const isVueVirtual = query && "vue" in query;
const isVueFile = !isVueVirtual && filter(path) && !/^import { render as _sfc_render } from ".*"$/m.test(code);
const isVueTemplate = isVueVirtual && (query.type === "template" || query.type === "script" && query.setup === "true");
if (isVueFile || isVueTemplate) {
const { code: imports, source } = loaderShared.generateImports(code, options);
return {
code: source + imports,
map: null
};
}
return null;
}
};
}
function isSubdir(root, test) {
const relative = path__default.relative(root, test);
return relative && !relative.startsWith("..") && !path__default.isAbsolute(relative);
}
const PLUGIN_VIRTUAL_PREFIX = "virtual:";
const PLUGIN_VIRTUAL_NAME = "plugin-vuetify";
const VIRTUAL_MODULE_ID = `${PLUGIN_VIRTUAL_PREFIX}${PLUGIN_VIRTUAL_NAME}`;
function stylesPlugin(options) {
const vuetifyBase = loaderShared.resolveVuetifyBase();
let configFile;
const tempFiles = /* @__PURE__ */ new Map();
const mappings = /* @__PURE__ */ new Map();
async function resolveCss(target) {
let mapping = mappings.get(target);
if (!mapping) {
try {
mapping = target.replace(/\.css$/, ".sass");
await fs__default.access(mapping, fs__default.constants.R_OK);
} catch (err) {
if (!(err instanceof Error && "code" in err && err.code === "ENOENT"))
throw err;
mapping = target.replace(/\.css$/, ".scss");
}
mappings.set(target, mapping);
}
return mapping;
}
return {
name: "vuetify:styles",
enforce: "pre",
configResolved(config) {
if (loaderShared.isObject(options.styles)) {
if (path__default.isAbsolute(options.styles.configFile)) {
configFile = options.styles.configFile;
} else {
configFile = path__default.join(config.root || process.cwd(), options.styles.configFile);
}
}
},
async resolveId(source, importer, { custom }) {
if (source === "vuetify/styles" || importer && source.endsWith(".css") && isSubdir(vuetifyBase, path__default.isAbsolute(source) ? source : importer)) {
if (options.styles === "none") {
return `${PLUGIN_VIRTUAL_PREFIX}__void__`;
} else if (options.styles === "sass") {
const resolution = await this.resolve(source, importer, { skipSelf: true, custom });
if (!resolution)
return null;
return resolveCss(resolution.id);
} else if (loaderShared.isObject(options.styles)) {
const resolution = await this.resolve(source, importer, { skipSelf: true, custom });
if (!resolution)
return null;
const target = await resolveCss(resolution.id);
const file = path__default.relative(path__default.join(vuetifyBase, "lib"), target);
const suffix = target.match(/\.scss/) ? ";\n" : "\n";
const contents = `@use "${loaderShared.normalizePath(configFile)}"${suffix}@use "${loaderShared.normalizePath(target)}"${suffix}`;
tempFiles.set(file, contents);
return `${VIRTUAL_MODULE_ID}:${file}`;
}
} else if (source.startsWith(`/${PLUGIN_VIRTUAL_NAME}:`)) {
return PLUGIN_VIRTUAL_PREFIX + source.slice(1);
} else if (source.startsWith(`/@id/__x00__${PLUGIN_VIRTUAL_NAME}:`)) {
return PLUGIN_VIRTUAL_PREFIX + source.slice(12);
} else if (source.startsWith(`/${VIRTUAL_MODULE_ID}:`)) {
return source.slice(1);
}
return null;
},
load(id) {
if (new RegExp(`^${PLUGIN_VIRTUAL_PREFIX}__void__(\\?.*)?$`).test(id)) {
return "";
}
if (id.startsWith(`${VIRTUAL_MODULE_ID}`)) {
const file = new RegExp(`^${VIRTUAL_MODULE_ID}:(.*?)(\\?.*)?$`).exec(id)[1];
return tempFiles.get(file);
}
return null;
}
};
}
function vuetify(_options = {}) {
const options = {
autoImport: true,
styles: true,
..._options
};
const plugins = [];
if (options.autoImport) {
plugins.push(importPlugin(options));
}
if (loaderShared.includes(["none", "sass"], options.styles) || loaderShared.isObject(options.styles)) {
plugins.push(stylesPlugin(options));
}
return plugins;
}
vuetify.transformAssetUrls = loaderShared.transformAssetUrls;
module.exports = vuetify;
module.exports.transformAssetUrls = loaderShared.transformAssetUrls;
module.exports.default = vuetify;
+11
View File
@@ -0,0 +1,11 @@
import { Plugin } from 'vite';
import { Options } from '@vuetify/loader-shared';
export { transformAssetUrls } from '@vuetify/loader-shared';
declare function vuetify(_options?: Options): Plugin[];
declare namespace vuetify {
var transformAssetUrls: Record<string, string[]>;
}
export = vuetify;
export { vuetify as default };
+10
View File
@@ -0,0 +1,10 @@
import { Plugin } from 'vite';
import { Options } from '@vuetify/loader-shared';
export { transformAssetUrls } from '@vuetify/loader-shared';
declare function vuetify(_options?: Options): Plugin[];
declare namespace vuetify {
var transformAssetUrls: Record<string, string[]>;
}
export { vuetify as default };
+11
View File
@@ -0,0 +1,11 @@
import { Plugin } from 'vite';
import { Options } from '@vuetify/loader-shared';
export { transformAssetUrls } from '@vuetify/loader-shared';
declare function vuetify(_options?: Options): Plugin[];
declare namespace vuetify {
var transformAssetUrls: Record<string, string[]>;
}
export = vuetify;
export { vuetify as default };
+143
View File
@@ -0,0 +1,143 @@
import { generateImports, resolveVuetifyBase, isObject, normalizePath, includes, transformAssetUrls } from '@vuetify/loader-shared';
export { transformAssetUrls } from '@vuetify/loader-shared';
import { createFilter } from 'vite';
import { URLSearchParams } from 'url';
import path from 'upath';
import fs from 'node:fs/promises';
function parseId(id) {
const [pathname, query] = id.split("?");
return {
query: query ? Object.fromEntries(new URLSearchParams(query)) : null,
path: pathname ?? id
};
}
function importPlugin(options) {
let filter;
return {
name: "vuetify:import",
configResolved(config) {
const vuetifyIdx = config.plugins.findIndex((plugin) => plugin.name === "vuetify:import");
const vueIdx = config.plugins.findIndex((plugin) => ["vite:vue", "unplugin-vue"].includes(plugin.name));
if (vuetifyIdx < vueIdx) {
throw new Error("Vuetify plugin must be loaded after the vue plugin");
}
const vueOptions = config.plugins[vueIdx].api.options;
filter = createFilter(vueOptions.include, vueOptions.exclude);
},
async transform(code, id) {
const { query, path } = parseId(id);
const isVueVirtual = query && "vue" in query;
const isVueFile = !isVueVirtual && filter(path) && !/^import { render as _sfc_render } from ".*"$/m.test(code);
const isVueTemplate = isVueVirtual && (query.type === "template" || query.type === "script" && query.setup === "true");
if (isVueFile || isVueTemplate) {
const { code: imports, source } = generateImports(code, options);
return {
code: source + imports,
map: null
};
}
return null;
}
};
}
function isSubdir(root, test) {
const relative = path.relative(root, test);
return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
}
const PLUGIN_VIRTUAL_PREFIX = "virtual:";
const PLUGIN_VIRTUAL_NAME = "plugin-vuetify";
const VIRTUAL_MODULE_ID = `${PLUGIN_VIRTUAL_PREFIX}${PLUGIN_VIRTUAL_NAME}`;
function stylesPlugin(options) {
const vuetifyBase = resolveVuetifyBase();
let configFile;
const tempFiles = /* @__PURE__ */ new Map();
const mappings = /* @__PURE__ */ new Map();
async function resolveCss(target) {
let mapping = mappings.get(target);
if (!mapping) {
try {
mapping = target.replace(/\.css$/, ".sass");
await fs.access(mapping, fs.constants.R_OK);
} catch (err) {
if (!(err instanceof Error && "code" in err && err.code === "ENOENT"))
throw err;
mapping = target.replace(/\.css$/, ".scss");
}
mappings.set(target, mapping);
}
return mapping;
}
return {
name: "vuetify:styles",
enforce: "pre",
configResolved(config) {
if (isObject(options.styles)) {
if (path.isAbsolute(options.styles.configFile)) {
configFile = options.styles.configFile;
} else {
configFile = path.join(config.root || process.cwd(), options.styles.configFile);
}
}
},
async resolveId(source, importer, { custom }) {
if (source === "vuetify/styles" || importer && source.endsWith(".css") && isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)) {
if (options.styles === "none") {
return `${PLUGIN_VIRTUAL_PREFIX}__void__`;
} else if (options.styles === "sass") {
const resolution = await this.resolve(source, importer, { skipSelf: true, custom });
if (!resolution)
return null;
return resolveCss(resolution.id);
} else if (isObject(options.styles)) {
const resolution = await this.resolve(source, importer, { skipSelf: true, custom });
if (!resolution)
return null;
const target = await resolveCss(resolution.id);
const file = path.relative(path.join(vuetifyBase, "lib"), target);
const suffix = target.match(/\.scss/) ? ";\n" : "\n";
const contents = `@use "${normalizePath(configFile)}"${suffix}@use "${normalizePath(target)}"${suffix}`;
tempFiles.set(file, contents);
return `${VIRTUAL_MODULE_ID}:${file}`;
}
} else if (source.startsWith(`/${PLUGIN_VIRTUAL_NAME}:`)) {
return PLUGIN_VIRTUAL_PREFIX + source.slice(1);
} else if (source.startsWith(`/@id/__x00__${PLUGIN_VIRTUAL_NAME}:`)) {
return PLUGIN_VIRTUAL_PREFIX + source.slice(12);
} else if (source.startsWith(`/${VIRTUAL_MODULE_ID}:`)) {
return source.slice(1);
}
return null;
},
load(id) {
if (new RegExp(`^${PLUGIN_VIRTUAL_PREFIX}__void__(\\?.*)?$`).test(id)) {
return "";
}
if (id.startsWith(`${VIRTUAL_MODULE_ID}`)) {
const file = new RegExp(`^${VIRTUAL_MODULE_ID}:(.*?)(\\?.*)?$`).exec(id)[1];
return tempFiles.get(file);
}
return null;
}
};
}
function vuetify(_options = {}) {
const options = {
autoImport: true,
styles: true,
..._options
};
const plugins = [];
if (options.autoImport) {
plugins.push(importPlugin(options));
}
if (includes(["none", "sass"], options.styles) || isObject(options.styles)) {
plugins.push(stylesPlugin(options));
}
return plugins;
}
vuetify.transformAssetUrls = transformAssetUrls;
export { vuetify as default };
+48
View File
@@ -0,0 +1,48 @@
{
"name": "vite-plugin-vuetify",
"version": "2.1.3",
"description": "A Vite plugin for treeshaking Vuetify components and more",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuetifyjs/vuetify-loader.git"
},
"scripts": {
"build": "unbuild && node ../../scripts/patchCJS.mjs && node ../../scripts/patch.d.CJS.mjs",
"dev": "unbuild --stub"
},
"author": "Kael Watts-Deuchar",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuetifyjs/vuetify-loader/issues"
},
"homepage": "https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin",
"dependencies": {
"@vuetify/loader-shared": "^2.1.2",
"debug": "^4.3.3",
"upath": "^2.0.1"
},
"peerDependencies": {
"vite": ">=5",
"vue": "^3.0.0",
"vuetify": ">=3"
},
"engines": {
"node": "^18.0.0 || >=20.0.0"
},
"files": [
"dist/"
],
"publishConfig": {
"access": "public"
},
"gitHead": "d6467d08a851a91ceb686a36a054f286d66ff5e6"
}