@poveste/plugin-vue 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES.md +3 -0
- package/dist/bundled/client/app/host.js +11 -10
- package/dist/commands/generate-story.client.js +3 -1
- package/dist/index.node.js +27 -0
- package/dist/util/vapor.d.ts +30 -0
- package/dist/util/vapor.js +59 -0
- package/package.json +10 -7
- package/src/client/app/host.ts +9 -0
- package/src/commands/generate-story.client.ts +3 -1
- package/src/index.node.ts +29 -0
- package/src/util/vapor.ts +65 -0
- package/dist/util/list-components.spec.d.ts +0 -1
- package/dist/util/list-components.spec.js +0 -46
- package/src/client/__tests__/codegen-attrs.spec.ts +0 -149
- package/src/client/__tests__/context.spec.ts +0 -50
- package/src/client/app/__tests__/auto-props.spec.ts +0 -49
- package/src/client/app/__tests__/preview-variants.spec.ts +0 -76
- package/src/client/app/__tests__/state-sync.spec.ts +0 -498
- package/src/client/app/__tests__/writable-binding.spec.ts +0 -39
- package/src/client/server/__tests__/nesting-errors.spec.ts +0 -48
- package/src/util/list-components.spec.ts +0 -54
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { describe, expect, it } from 'vitest'
|
|
3
|
-
import { createApp, h } from 'vue'
|
|
4
|
-
import Story from '../Story.js'
|
|
5
|
-
import Variant from '../Variant.js'
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* What a story author gets for a nesting mistake in collect mode, where the
|
|
9
|
-
* stack has nothing in it about stories (#981).
|
|
10
|
-
*
|
|
11
|
-
* Mounted the way `run.ts` mounts them — a bare `createApp` — rather than
|
|
12
|
-
* through a test-utils wrapper, because the missing provider is the whole
|
|
13
|
-
* subject and a harness that supplies one would prove nothing.
|
|
14
|
-
*/
|
|
15
|
-
function mountAlone(component: any, props: Record<string, unknown> = {}) {
|
|
16
|
-
const app = createApp({ render: () => h(component, props) })
|
|
17
|
-
const el = document.createElement('div')
|
|
18
|
-
try {
|
|
19
|
-
app.mount(el)
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
app.unmount()
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
describe('a <Variant> outside a <Story>', () => {
|
|
27
|
-
it('says which component it needed, when it carries an id', () => {
|
|
28
|
-
// The branch that generates an id already threw a good error, so an
|
|
29
|
-
// explicit id was the case that reached `undefined(variant)` and said
|
|
30
|
-
// `addVariant is not a function`.
|
|
31
|
-
expect(() => mountAlone(Variant, { id: 'mine', title: 'Solo' })).toThrow(/<Variant>.*<Story>/)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('says the same thing when it does not', () => {
|
|
35
|
-
expect(() => mountAlone(Variant, { title: 'Solo' })).toThrow(/<Variant>.*<Story>/)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
it('never reports that a function is not a function', () => {
|
|
39
|
-
expect(() => mountAlone(Variant, { id: 'mine', title: 'Solo' })).not.toThrow(/is not a function/)
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
describe('a <Story> outside the collect runner', () => {
|
|
44
|
-
it('says which provider it needed', () => {
|
|
45
|
-
// `hstStoryFile` comes from `run.ts`, the only thing that mounts these.
|
|
46
|
-
expect(() => mountAlone(Story, { title: 'Solo' })).toThrow(/<Story>/)
|
|
47
|
-
})
|
|
48
|
-
})
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { tmpdir } from 'node:os'
|
|
3
|
-
import { dirname, join } from 'node:path'
|
|
4
|
-
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
|
-
import { listComponentFiles } from './list-components.js'
|
|
6
|
-
|
|
7
|
-
const roots: string[] = []
|
|
8
|
-
|
|
9
|
-
function tree(files: Record<string, string>): string {
|
|
10
|
-
const root = mkdtempSync(join(tmpdir(), 'list-components-'))
|
|
11
|
-
roots.push(root)
|
|
12
|
-
for (const [path, content] of Object.entries(files)) {
|
|
13
|
-
mkdirSync(dirname(join(root, path)), { recursive: true })
|
|
14
|
-
writeFileSync(join(root, path), content)
|
|
15
|
-
}
|
|
16
|
-
return root
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
for (const root of roots.splice(0)) {
|
|
21
|
-
rmSync(root, { recursive: true, force: true })
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
// Listing honoured .gitignore through globby's `gitignore: true`, and tinyglobby
|
|
26
|
-
// has no such option, so the filtering is ours now (#839).
|
|
27
|
-
describe('listComponentFiles', () => {
|
|
28
|
-
it('leaves out components git ignores, from the root .gitignore and a nested one', async () => {
|
|
29
|
-
const root = tree({
|
|
30
|
-
'.git/HEAD': 'ref: refs/heads/main\n',
|
|
31
|
-
'.gitignore': 'generated/\n',
|
|
32
|
-
'app/.gitignore': 'scratch/*\n!scratch/Kept.vue\n',
|
|
33
|
-
'app/src/Button.vue': '',
|
|
34
|
-
'app/src/generated/Output.vue': '',
|
|
35
|
-
'app/scratch/Draft.vue': '',
|
|
36
|
-
'app/scratch/Kept.vue': '',
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const files = await listComponentFiles('', [], 10, join(root, 'app'))
|
|
40
|
-
|
|
41
|
-
expect(files.sort()).toEqual(['scratch/Kept.vue', 'src/Button.vue'])
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('still skips node_modules and the patterns it is given', async () => {
|
|
45
|
-
const root = tree({
|
|
46
|
-
'.git/HEAD': 'ref: refs/heads/main\n',
|
|
47
|
-
'src/Button.vue': '',
|
|
48
|
-
'src/Button.story.vue': '',
|
|
49
|
-
'node_modules/pkg/Dep.vue': '',
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
expect(await listComponentFiles('', ['**/*.story.vue'], 10, root)).toEqual(['src/Button.vue'])
|
|
53
|
-
})
|
|
54
|
-
})
|