Skip to content

feat(unplugin): move parsing steps to unplugin #43

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 23 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
91cd737
feat(unplugin): move parsing steps to unplugin ; unblocking HMR suppo…
Tahul Sep 13, 2022
a4065d4
feat(hmr): hmr working nitro/nuxt; useComponentMeta
Tahul Sep 17, 2022
363513f
feat(up): up
Tahul Sep 17, 2022
6bf42d7
chore(bump): bump to 0.3.0 (contains breaking changes)
Tahul Sep 17, 2022
1d40ad7
chore(build): fix build; prepare beta release
Tahul Sep 17, 2022
e42dbf5
feat(up): improve implementation; fix builds
Tahul Sep 18, 2022
51efc82
chore(0.3.1-beta): release beta tag
Tahul Sep 18, 2022
dd64c7e
chore(ci): update ci
Tahul Sep 18, 2022
10d669e
chore(ci): update ci
Tahul Sep 18, 2022
9226977
chore(playground): fix playground
Tahul Sep 18, 2022
ba3676b
chore(deps): fix dependencies
Tahul Sep 18, 2022
bcd4ac2
chore(cleanup): cleanup
Tahul Sep 18, 2022
d42170c
chore(tests): update test suite
Tahul Sep 18, 2022
99b9b48
chore(package): workspaces are already installed
Tahul Sep 18, 2022
2ed3b05
chore(release): release 0.3.2-beta
Tahul Sep 18, 2022
b428c53
chore: name is optional for composable
atinux Sep 19, 2022
228db63
chore(up): upgrade to latest vue-component-meta
Tahul Oct 11, 2022
b3442df
Merge branch 'main' into feat/unplugin
Tahul Oct 11, 2022
bfe1cfd
feat(hmr): support HMR on useComponentMeta
Tahul Oct 12, 2022
83b0a7f
feat(hmr): update implementation ; update useComponentMeta
Tahul Oct 18, 2022
a528ddb
feat(transformers): add support for component transformers
Tahul Oct 18, 2022
c2d9e4b
fix(lint): fix linting
Tahul Oct 18, 2022
584fccb
fix(ci): fix tests
Tahul Oct 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
- run: yarn install
- run: yarn dev:prepare
- run: yarn lint
- run: yarn prepack
- run: yarn dev:generate
- run: yarn test
- uses: pnpm/action-setup@v2.2.2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- run: pnpm install
- run: pnpm dev:prepare
- run: pnpm lint
- run: pnpm prepack
- run: pnpm dev:generate
- run: pnpm test
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ node_modules
.tmp
.cache

# Yarn
**/.yarn/cache
**/.yarn/*state*

# Generated dirs
dist

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
1. Add `nuxt-component-meta` dependency to your project:

```bash
# Using Yarn
yarn add --dev nuxt-component-meta
# Using PNPM
pnpm add -D nuxt-component-meta

# Using NPM
npm install --save-dev nuxt-component-meta
```
Expand Down Expand Up @@ -43,5 +44,5 @@ const { data: meta } = await useAsyncData('my-component', () => $fetch('/api/com
## Development

1. Clone this repository
2. Install dependencies using `yarn install`
3. Start dev server using `yarn dev`
2. Install dependencies using `pnpm install`
3. Start dev server using `pnpm dev`
36 changes: 27 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-component-meta",
"version": "0.2.3",
"version": "0.3.2",
"license": "MIT",
"type": "module",
"exports": {
Expand All @@ -19,25 +19,43 @@
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:generate": "nuxi generate playground",
"dev:prepare": "nuxt-module-build --stub && yarn install --cwd ./playground && nuxi prepare playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
"lint": "eslint --ext .js,.ts,.vue .",
"test": "vitest",
"release": "yarn test && standard-version && git push --follow-tags && npm publish"
"release": "pnpm test && standard-version && git push --follow-tags && npm publish"
},
"dependencies": {
"@nuxt/kit": "^3.0.0-rc.10",
"@nuxt/kit": "^3.0.0-rc.12",
"scule": "^0.3.2",
"vue-component-meta": "^0.40.13"
"vue-component-meta": "^1.0.8"
},
"devDependencies": {
"@iconify/vue": "^4.0.0",
"@nuxt/content": "^2.1.1",
"@nuxt/module-builder": "latest",
"@nuxt/test-utils": "^3.0.0-rc.10",
"@nuxt/test-utils": "^3.0.0-rc.12",
"@nuxtjs/eslint-config-typescript": "latest",
"@nuxt/content": "npm:@nuxt/content-edge@latest",
"eslint": "latest",
"nuxt": "^3.0.0-rc.10",
"nuxt": "^3.0.0-rc.12",
"standard-version": "^9.5.0",
"vitest": "^0.23.4"
"typescript": "^4.8.4",
"vitest": "^0.24.3",
"vue": "^3.2.41"
},
"build": {
"externals": [
"#nuxt-component-meta",
"ufo",
"pathe",
"defu",
"unplugin"
]
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"postcss*"
]
}
}
}
33 changes: 25 additions & 8 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
<template>
<div>
<h2>Components from <code>/api/component-meta</code> nitro route</h2>
<pre>{{ data }}</pre>
<hr />
<h2>Components from <code>#nuxt-component-meta</code> virtual module</h2>
<pre>{{ components }}</pre>
<div>
<TestComponent foo="test" />
<TestGlobalComponent />
<TestTyped :hello="`test`" />
</div>

<h2>Components from <code>useComponentMeta('{{ specificComponentName }}')</code></h2>

<pre>{{ specificComponentMeta }}</pre>

<h2>Components from <code>useComponentMeta</code></h2>

<pre>{{ composableData }}</pre>

<hr>
</div>
</template>

<script setup>
import components from '#nuxt-component-meta'
const { data } = await useAsyncData('metas', () => $fetch('/api/component-meta'))
<script lang="ts" setup>
import TestComponent from './components/TestComponent.vue'
import TestTyped from './components/testTyped.vue'
import { NuxtComponentMetaNames } from '#nuxt-component-meta/types'

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

const specificComponentMeta = await useComponentMeta(specificComponentName)

const composableData = await useComponentMeta()
</script>
12 changes: 10 additions & 2 deletions playground/components/TestComponent.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<template>
<div>
<slot />
<hr>
TestComponent
<hr>
<slot />
<slot name="nuxt" />
</div>
</template>

<script setup>
defineProps({
/**
* The foo property.
*
* @since v1.0.0
*/
foo: {
type: String,
required: true
default: 'Hello'
},
/**
* The hello property.
Expand All @@ -30,5 +37,6 @@ defineProps({
default: 1.3
}
})

const emit = defineEmits(['change', 'delete'])
</script>
5 changes: 5 additions & 0 deletions playground/components/content/TestContent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<ContentSlot :use="$slots.default" />
</div>
</template>
6 changes: 5 additions & 1 deletion playground/components/global/TestGlobalComponent.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<template>
<div>I am global</div>
<div>
<hr>
I am global
<hr>
</div>
</template>
26 changes: 26 additions & 0 deletions playground/components/pinceau/TestPinceau.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<div :class="$pinceau">
Hello World!
</div>
</template>

<script setup lang="ts">
defineProps({
...$variantsProps
})
</script>

<style scoped lang="ts">
css({
variants: {
background: {
red: {
background: 'red',
},
blue: {
background: 'blue',
}
}
}
})
</style>
3 changes: 3 additions & 0 deletions playground/components/testTyped.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div>
<hr>
TestTyped
<hr>
<slot />
<hr>
<slot name="nuxt" />
Expand Down
12 changes: 11 additions & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ export default defineNuxtConfig({
dirs: [
{
path: '~/components/global',
prefix: '',
global: true
},
{
path: '~/components/pinceau',
prefix: '',
global: true
},
'~/components'
]
},
modules: [
'@nuxt/content',
'pinceau/nuxt',
nuxtMetaModule
]
],
pinceau: {
followSymbolicLinks: false
}
})
15 changes: 15 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"private": true,
"name": "nuxt-component-meta-playground",
"devDependencies": {
"@nuxt/content": "npm:@nuxt/content-edge@latest",
"nuxt": "^3.0.0-rc.12",
"nuxt-component-meta": "*",
"pinceau": "latest"
},
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
}
}
3 changes: 3 additions & 0 deletions playground/pinceau.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineTheme } from 'pinceau'

export default defineTheme({})
Loading