-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat: add unplugin-vue-components
and unimport
integration
#20536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a46d7d8
feat: add `unplugin-vue-components` and `unimport` integration
userquin 17e86b3
chore: add missing composables aliases
userquin 89ee24f
chore: remove styles
userquin c8c1221
chore: cleanup components
userquin 7af30b9
chore: remove Vuetify One composables from unimport
userquin c190d1b
chore: add directives prefix to `unplugin-vue-components`
userquin 7db0495
chore: remove `vueDirectives` in docs
userquin b082e14
chore: review directive types and logic
userquin a3a253f
chore: move unimport package exports
userquin 4a8cd5d
chore: use `unplugin-vue-components` in playground
userquin 278634a
chore: move `unplugin` build to rollup
userquin 6100dde
chore: remove dts from unplugin modules build
userquin a79970e
chore: fix import on rollup types conf. module
userquin a305093
chore: move node package exports after `./*`
userquin fe7b7b0
chore: revert playground conf. changes to fix CI
userquin b453948
Merge branch 'dev' into userquin/feat-add-unimport-resolver
KaelWD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
/lib/ | ||
/lib-temp/ | ||
/dist/ | ||
/unimport/ | ||
/unplugin-vue-components/ | ||
/cypress/ | ||
*.spec.cy.ts | ||
*.spec.cy.tsx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
/types-temp/ | ||
/dist/ | ||
/dev/dist/ | ||
/unplugin-vue-components/ | ||
/unimport/ | ||
|
||
# local env files | ||
.env.local | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import packageJson from '../package.json' with { type: 'json' } | ||
import path from 'upath' | ||
import { fileURLToPath } from 'url' | ||
|
||
export const banner = `/*! | ||
* Vuetify v${packageJson.version} | ||
* Forged by John Leider | ||
* Released under the MIT License. | ||
*/\n` | ||
|
||
export const root = path.resolve(fileURLToPath(import.meta.url), '../..') | ||
export const srcDir = path.resolve(root, 'src') | ||
export const libDir = path.resolve(root, 'lib') | ||
export const unpluginLibDistDir = path.resolve(libDir, 'unplugin') | ||
export const labsDir = path.resolve(srcDir, 'labs') | ||
|
||
export const externals = Array.from(Object.keys(packageJson.devDependencies)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import { banner, externals, root, unpluginLibDistDir } from './constants.mjs' | ||
import { nodeResolve } from "@rollup/plugin-node-resolve" | ||
import { babel } from '@rollup/plugin-babel' | ||
import { rm } from 'fs/promises' | ||
import dts from 'rollup-plugin-dts' | ||
|
||
const extensions = ['.ts'] | ||
|
||
export function unpluginModules() { | ||
return [ | ||
unpluginModule('components'), | ||
unpluginModule('unimport'), | ||
] | ||
} | ||
|
||
export function unpluginTypes() { | ||
return [ | ||
unpluginDts('components'), | ||
unpluginDts('unimport'), | ||
] | ||
} | ||
|
||
/** | ||
* @param name {'components' | 'unimport'} | ||
* @returns {import("rollup").RollupOptions} | ||
*/ | ||
function unpluginModule(name) { | ||
const input = `src/unplugin/${name}.ts` | ||
const file = `${name === 'components' ? 'unplugin-vue-components' : name}/index` | ||
/** @type {import("rollup").RollupOptions} */ | ||
const config = { | ||
input, | ||
external: ['vuetify', 'unplugin-vue-components/types', ...externals], | ||
output: [{ | ||
file: `${file}.mjs`, | ||
format: 'esm', | ||
exports: "named", | ||
generatedCode: { constBindings: true }, | ||
externalLiveBindings: false, | ||
freeze: false, | ||
banner, | ||
}, { | ||
file: `${file}.cjs`, | ||
format: 'cjs', | ||
exports: "named", | ||
generatedCode: { constBindings: true }, | ||
externalLiveBindings: false, | ||
freeze: false, | ||
banner, | ||
}], | ||
onwarn(warning, rollupWarn) { | ||
if (!warning.code || !["CIRCULAR_DEPENDENCY"].includes(warning.code)) { | ||
rollupWarn(warning); | ||
} | ||
}, | ||
plugins: [ | ||
nodeResolve({ extensions, browser: false, modulesOnly: true }), | ||
babel({ | ||
extensions, | ||
}), | ||
dts({ | ||
respectExternal: true, | ||
compilerOptions: { | ||
rootDir: root, | ||
}, | ||
}), | ||
{ | ||
async buildEnd() { | ||
// cleanup lib/unplugin | ||
await rm(unpluginLibDistDir, { force: true, recursive: true }) | ||
}, | ||
}, | ||
], | ||
} | ||
return config | ||
} | ||
|
||
/** | ||
* @param name {'components' | 'unimport'} | ||
* @returns {import("rollup").RollupOptions} | ||
*/ | ||
function unpluginDts(name) { | ||
const dir = `${root}/${name === 'components' ? 'unplugin-vue-components' : 'unimport'}` | ||
/** @type {import("rollup").RollupOptions} */ | ||
const config = { | ||
input: `src/unplugin/${name}.ts`, | ||
external: ['vuetify', 'unplugin-vue-components/types', ...externals], | ||
output: [{ | ||
dir, | ||
entryFileNames: 'index.d.mts', | ||
format: 'esm', | ||
banner, | ||
}, { | ||
dir, | ||
entryFileNames: 'index.d.ts', | ||
format: 'esm', | ||
banner, | ||
}, { | ||
dir, | ||
entryFileNames: 'index.d.cts', | ||
format: 'cjs', | ||
banner, | ||
}], | ||
plugins: [ | ||
dts({ | ||
dir: `${root}/${name === 'components' ? 'unplugin-vue-components' : 'unimport'}`, | ||
respectExternal: true, | ||
compilerOptions: { | ||
rootDir: root, | ||
}, | ||
}), | ||
], | ||
} | ||
return config | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.