Skip to content
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

feat: add sources option to allow loading external component definition #60

Merged
merged 9 commits into from
Dec 5, 2023
5 changes: 5 additions & 0 deletions bin/nuxt-component-meta.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { runGenerate } from '../dist/cli.mjs'

runGenerate()
28 changes: 20 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.5.4",
"license": "MIT",
"type": "module",
"bin": {
"nuxt-component-meta": "./bin/nuxt-component-meta.mjs"
},
"exports": {
".": {
"import": "./dist/module.mjs",
Expand All @@ -15,7 +18,7 @@
"dist"
],
"scripts": {
"prepack": "nuxt-module-build",
"prepack": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:generate": "nuxi generate playground",
Expand All @@ -26,29 +29,34 @@
},
"dependencies": {
"@nuxt/kit": "^3.8.0",
"citty": "^0.1.4",
"scule": "^1.0.0",
"typescript": "^5.2.2",
"vue-component-meta": "^1.8.22"
},
"devDependencies": {
"@iconify/vue": "^4.1.1",
"@nuxt/content": "^2.9.0",
"@nuxt/module-builder": "latest",
"@nuxt/test-utils": "^3.8.0",
"@nuxtjs/eslint-config-typescript": "latest",
"@nuxt/module-builder": "^0.5.4",
"@nuxt/test-utils": "^3.8.1",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"changelogen": "^0.5.5",
"eslint": "latest",
"eslint": "^8.53.0",
"jiti": "^1.21.0",
"nuxt": "^3.8.0",
"nuxt": "^3.8.1",
"release-it": "^16.2.1",
"vitest": "^0.34.6",
"vue": "^3.3.7"
"vue": "^3.3.8"
},
"build": {
"entries": [
{
"input": "./src/parser.ts",
"name": "parser"
},
{
"input": "./src/cli/index.ts",
"name": "cli"
}
],
"externals": [
Expand All @@ -57,7 +65,11 @@
"pathe",
"defu",
"unplugin",
"consola"
"consola",
"mlly",
"acorn",
"pkg-types",
"jsonc-parser"
]
},
"pnpm": {
Expand Down
2 changes: 1 addition & 1 deletion playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script lang="ts" setup>
import TestComponent from './components/TestComponent.vue'
import TestTyped from './components/testTyped.vue'
import { NuxtComponentMetaNames } from '#nuxt-component-meta/types'
import type { NuxtComponentMetaNames } from '#nuxt-component-meta/types'

const specificComponentName = ref<NuxtComponentMetaNames>('TestContent')

Expand Down
24 changes: 21 additions & 3 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,27 @@ export default defineNuxtConfig({

componentMeta: {
debug: 2,
exclude: [/test/i, (component: any) => {
return component.global
}]
exclude: [/node_modules/i],
metaSources: [
{
TestExternalMeta: {
pascalName: 'TestExternalMeta',
kebabName: 'test-external-meta',
chunkName: 'components/test-external-meta',
export: 'default',
priority: 1,
prefetch: false,
preload: false,
meta: {
type: 0,
props: [],
slots: [],
events: [],
exposed: []
}
}
}
]
},

pinceau: {
Expand Down