@poveste/plugin-nuxt 0.19.1 → 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 CHANGED
@@ -19,5 +19,7 @@ export default defineConfig({
19
19
  })
20
20
  ```
21
21
 
22
+ Your Vue components get a props, slots and events table on each story's **Docs** tab, through `@poveste/plugin-vue`. It needs `typescript` 6 or earlier in the project (`npm i -D typescript@6`), which npm doesn't install with Nuxt; without it, or with 7, it turns itself off and says so once.
23
+
22
24
  [Nuxt guide](https://poveste.dev/guide/nuxt/getting-started) ·
23
25
  [Documentation](https://poveste.dev)
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
3
3
  import replace from '@rollup/plugin-replace';
4
4
  import { onPovesteCleanup } from 'poveste';
5
5
  import { ignorePlugins, withoutIgnoredPlugins } from './ignored-plugins.js';
6
+ import { NUXT_INLINE_DEPS } from './inline-deps.js';
6
7
  // Some Nuxt modules register client plugins that assume a full Nuxt runtime the
7
8
  // headless story sandbox can't provide. The general net is `wrapPluginsForTolerantBoot`
8
9
  // below, which skips one that throws rather than 500-ing the iframe; this list drops
@@ -136,9 +137,7 @@ export async function setupVue3 () {
136
137
  }`,
137
138
  ],
138
139
  viteNodeInlineDeps: [
139
- /\/(nuxt|nuxt3)\//,
140
- /^#/,
141
- /\.nuxt/,
140
+ ...NUXT_INLINE_DEPS,
142
141
  ...nuxt.options.build.transpile.filter(r => typeof r === 'string' || r instanceof RegExp),
143
142
  ],
144
143
  build: {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * What collection inlines for a Nuxt book: the `nuxt` package, its `#` aliases, and
3
+ * what Nuxt generates into `.nuxt`. Each is anchored to a whole path segment: the
4
+ * package pattern matched any directory named `nuxt`, so a book installed under one
5
+ * inlined every dependency it has (#1371). Collection's module ids are POSIX paths
6
+ * on every platform.
7
+ */
8
+ export declare const NUXT_INLINE_DEPS: RegExp[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * What collection inlines for a Nuxt book: the `nuxt` package, its `#` aliases, and
3
+ * what Nuxt generates into `.nuxt`. Each is anchored to a whole path segment: the
4
+ * package pattern matched any directory named `nuxt`, so a book installed under one
5
+ * inlined every dependency it has (#1371). Collection's module ids are POSIX paths
6
+ * on every platform.
7
+ */
8
+ export const NUXT_INLINE_DEPS = [
9
+ /\/node_modules\/(?:nuxt|nuxt3)\//,
10
+ /^#/,
11
+ /\/\.nuxt\//,
12
+ ];
@@ -1,5 +1,10 @@
1
1
  import { createApp } from 'h3';
2
2
  import { createFetch } from 'ofetch';
3
+ // Per pass: collection drops its module graph between passes, so this module and
4
+ // Nuxt's are evaluated again. `unctx`, which holds Nuxt's current app, is external
5
+ // and is not, so the previous pass's app was still current when the new one was set,
6
+ // and Nuxt threw "Context conflict" in every worker on every re-collection (#1283).
7
+ let clearedPreviousApp = false;
3
8
  export async function setupNuxtApp(publicConfig) {
4
9
  const win = window;
5
10
  win.__NUXT__ = {
@@ -37,6 +42,12 @@ export async function setupNuxtApp(publicConfig) {
37
42
  win.$fetch = createFetch({ fetch: win.fetch, Headers: win.Headers });
38
43
  win.__registry = registry;
39
44
  win.__app = h3App;
45
+ if (__HST_COLLECT__ && !clearedPreviousApp) {
46
+ clearedPreviousApp = true;
47
+ // @ts-expect-error no types
48
+ const { getNuxtAppCtx } = await import('#app/nuxt');
49
+ getNuxtAppCtx().unset();
50
+ }
40
51
  // @ts-expect-error no types
41
52
  const result = await import('#app/entry');
42
53
  await result.default();
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@poveste/plugin-nuxt",
3
3
  "type": "module",
4
- "version": "0.19.1",
5
- "description": "Poveste plugin to integrate with Nuxt 4",
4
+ "version": "0.21.0",
5
+ "description": "Poveste plugin to integrate with Nuxt 4, including the props tables @poveste/plugin-vue reads from your components' types",
6
6
  "author": {
7
7
  "name": "Sorin Gitlan",
8
8
  "url": "https://x.com/50rayn"
@@ -49,23 +49,23 @@
49
49
  "node": ">=22.22.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "@poveste/plugin-vue": "^0.19.1",
52
+ "@poveste/plugin-vue": "^0.21.0",
53
53
  "nuxt": "^4.5.0",
54
- "poveste": "^0.19.1"
54
+ "poveste": "^0.21.0"
55
55
  },
56
56
  "dependencies": {
57
- "@nuxt/kit": "^4.5.2",
57
+ "@nuxt/kit": "^4.6.2",
58
58
  "@rollup/plugin-replace": "^6.0.1",
59
59
  "h3": "^1.13.0",
60
60
  "ofetch": "^1.4.1"
61
61
  },
62
62
  "devDependencies": {
63
- "@nuxt/schema": "^4.5.2",
64
- "@types/node": "^26.6.3",
65
- "poveste": "0.19.1",
63
+ "@nuxt/schema": "^4.6.2",
64
+ "@types/node": "^26.6.5",
65
+ "poveste": "0.21.0",
66
66
  "typescript": "6.0.3",
67
- "vite": "^8.3.1",
68
- "vitest": "^5.0.2"
67
+ "vite": "^8.3.4",
68
+ "vitest": "^5.0.5"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "rimraf dist && tsc -d",