@poveste/plugin-vue 0.20.0 → 0.21.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/README.md +7 -0
- package/dist/bundled/client/app/Story.js +60 -48
- package/dist/bundled/client/app/global-components.js +5 -3
- package/dist/bundled/client/app/host.js +9 -5
- package/dist/bundled/client/app/util.js +13 -4
- package/dist/bundled/client/server/Story.js +13 -0
- package/dist/bundled/client/server/collect.js +41 -0
- package/dist/bundled/client/server/run.js +10 -39
- package/dist/bundled/testing/index.js +168 -0
- package/dist/client/app/Story.d.ts +19 -1
- package/dist/client/app/Variant.d.ts +2 -2
- package/dist/client/app/global-components.d.ts +1 -0
- package/dist/client/app/host.d.ts +8 -0
- package/dist/client/app/util.d.ts +16 -0
- package/dist/client/server/Story.d.ts +21 -3
- package/dist/client/server/collect.d.ts +14 -0
- package/dist/client-dependencies.d.ts +2 -0
- package/dist/client-dependencies.js +2 -0
- package/dist/docgen/events.d.ts +9 -0
- package/dist/docgen/events.js +45 -0
- package/dist/docgen/extractor.d.ts +0 -1
- package/dist/docgen/extractor.js +28 -9
- package/dist/docgen/generic.d.ts +5 -0
- package/dist/docgen/generic.js +19 -0
- package/dist/docgen/meta.d.ts +12 -9
- package/dist/docgen/meta.js +39 -13
- package/dist/docgen/slots.d.ts +6 -0
- package/dist/docgen/slots.js +21 -0
- package/dist/index.node.d.ts +2 -0
- package/dist/index.node.js +18 -15
- package/dist/testing/index.d.ts +28 -0
- package/dist/testing/vite.d.ts +18 -0
- package/dist/testing/vite.js +171 -0
- package/dist/util/project-vue.d.ts +1 -0
- package/dist/util/project-vue.js +12 -0
- package/package.json +26 -9
- package/src/client/app/Story.ts +15 -3
- package/src/client/app/global-components.ts +4 -0
- package/src/client/app/host.ts +21 -2
- package/src/client/app/util.ts +40 -0
- package/src/client/server/Story.ts +15 -2
- package/src/client/server/collect.ts +83 -0
- package/src/client/server/run.ts +3 -63
- package/src/client-dependencies.ts +2 -0
- package/src/docgen/events.ts +55 -0
- package/src/docgen/extractor.ts +30 -10
- package/src/docgen/generic.ts +20 -0
- package/src/docgen/meta.ts +46 -21
- package/src/docgen/slots.ts +33 -0
- package/src/index.node.ts +20 -16
- package/src/testing/index.ts +286 -0
- package/src/testing/vite.ts +194 -0
- package/src/util/project-vue.ts +13 -0
- package/testing.d.ts +2 -0
- package/dist/docgen/typescript.d.ts +0 -9
- package/dist/docgen/typescript.js +0 -36
- package/src/docgen/typescript.ts +0 -41
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
|
|
5
|
+
export function projectVueVersion(root: string): string | undefined {
|
|
6
|
+
try {
|
|
7
|
+
const manifest = createRequire(join(root, 'package.json')).resolve('vue/package.json')
|
|
8
|
+
return JSON.parse(readFileSync(manifest, 'utf8')).version
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return undefined
|
|
12
|
+
}
|
|
13
|
+
}
|
package/testing.d.ts
ADDED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** The version of the first `typescript` found in `dirs`, searched in order as Node searches `node_modules`. */
|
|
2
|
-
export declare function typescriptVersionIn(dirs: string[]): string | undefined;
|
|
3
|
-
/** Why auto-docs cannot read a Vue component's types with the TypeScript in `dirs`, or nothing when it can. */
|
|
4
|
-
export declare function typescriptProblemIn(dirs: string[]): string | undefined;
|
|
5
|
-
/**
|
|
6
|
-
* The same question for the TypeScript `vue-component-meta` will load: it requires
|
|
7
|
-
* `typescript` from where it is installed, an optional peer that npm does not add.
|
|
8
|
-
*/
|
|
9
|
-
export declare function typescriptProblem(): string | undefined;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
import { join } from 'pathe';
|
|
4
|
-
// `vue-component-meta` 3.3 calls `ts.readJsonConfigFile`, which TypeScript 7 no
|
|
5
|
-
// longer has, and no release of it reads TypeScript 7 yet (#1382).
|
|
6
|
-
const NEWEST_MAJOR = 6;
|
|
7
|
-
const FIX = 'Install `typescript@6` in the book to turn it on, or set `autoDocs: false` to turn it off without this message.';
|
|
8
|
-
/** The version of the first `typescript` found in `dirs`, searched in order as Node searches `node_modules`. */
|
|
9
|
-
export function typescriptVersionIn(dirs) {
|
|
10
|
-
for (const dir of dirs) {
|
|
11
|
-
const manifest = join(dir, 'typescript', 'package.json');
|
|
12
|
-
if (existsSync(manifest)) {
|
|
13
|
-
return JSON.parse(readFileSync(manifest, 'utf8')).version;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
/** Why auto-docs cannot read a Vue component's types with the TypeScript in `dirs`, or nothing when it can. */
|
|
19
|
-
export function typescriptProblemIn(dirs) {
|
|
20
|
-
const version = typescriptVersionIn(dirs);
|
|
21
|
-
if (!version) {
|
|
22
|
-
return `Auto-docs is off: it reads component types with TypeScript, which this book does not have. ${FIX}`;
|
|
23
|
-
}
|
|
24
|
-
if (Number.parseInt(version, 10) > NEWEST_MAJOR) {
|
|
25
|
-
return `Auto-docs is off: it reads component types with TypeScript ${NEWEST_MAJOR} or earlier, and this book has TypeScript ${version}. ${FIX}`;
|
|
26
|
-
}
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* The same question for the TypeScript `vue-component-meta` will load: it requires
|
|
31
|
-
* `typescript` from where it is installed, an optional peer that npm does not add.
|
|
32
|
-
*/
|
|
33
|
-
export function typescriptProblem() {
|
|
34
|
-
const meta = createRequire(import.meta.url).resolve('vue-component-meta');
|
|
35
|
-
return typescriptProblemIn(createRequire(meta).resolve.paths('typescript') ?? []);
|
|
36
|
-
}
|
package/src/docgen/typescript.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
2
|
-
import { createRequire } from 'node:module'
|
|
3
|
-
import { join } from 'pathe'
|
|
4
|
-
|
|
5
|
-
// `vue-component-meta` 3.3 calls `ts.readJsonConfigFile`, which TypeScript 7 no
|
|
6
|
-
// longer has, and no release of it reads TypeScript 7 yet (#1382).
|
|
7
|
-
const NEWEST_MAJOR = 6
|
|
8
|
-
|
|
9
|
-
const FIX = 'Install `typescript@6` in the book to turn it on, or set `autoDocs: false` to turn it off without this message.'
|
|
10
|
-
|
|
11
|
-
/** The version of the first `typescript` found in `dirs`, searched in order as Node searches `node_modules`. */
|
|
12
|
-
export function typescriptVersionIn(dirs: string[]): string | undefined {
|
|
13
|
-
for (const dir of dirs) {
|
|
14
|
-
const manifest = join(dir, 'typescript', 'package.json')
|
|
15
|
-
if (existsSync(manifest)) {
|
|
16
|
-
return JSON.parse(readFileSync(manifest, 'utf8')).version
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return undefined
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** Why auto-docs cannot read a Vue component's types with the TypeScript in `dirs`, or nothing when it can. */
|
|
23
|
-
export function typescriptProblemIn(dirs: string[]): string | undefined {
|
|
24
|
-
const version = typescriptVersionIn(dirs)
|
|
25
|
-
if (!version) {
|
|
26
|
-
return `Auto-docs is off: it reads component types with TypeScript, which this book does not have. ${FIX}`
|
|
27
|
-
}
|
|
28
|
-
if (Number.parseInt(version, 10) > NEWEST_MAJOR) {
|
|
29
|
-
return `Auto-docs is off: it reads component types with TypeScript ${NEWEST_MAJOR} or earlier, and this book has TypeScript ${version}. ${FIX}`
|
|
30
|
-
}
|
|
31
|
-
return undefined
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The same question for the TypeScript `vue-component-meta` will load: it requires
|
|
36
|
-
* `typescript` from where it is installed, an optional peer that npm does not add.
|
|
37
|
-
*/
|
|
38
|
-
export function typescriptProblem(): string | undefined {
|
|
39
|
-
const meta = createRequire(import.meta.url).resolve('vue-component-meta')
|
|
40
|
-
return typescriptProblemIn(createRequire(meta).resolve.paths('typescript') ?? [])
|
|
41
|
-
}
|