@poveste/plugin-nuxt 0.18.0 → 0.18.1
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/index.d.ts +4 -0
- package/dist/index.js +18 -10
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,8 @@ export interface HstNuxtOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function isPluginExcluded(src: string, patterns: (string | RegExp)[]): boolean;
|
|
11
11
|
export declare function wrapPluginsForTolerantBoot(source: string): string;
|
|
12
|
+
export declare function wrapPluginTemplates(templates: {
|
|
13
|
+
filename?: string;
|
|
14
|
+
getContents?: (ctx: any) => string | Promise<string>;
|
|
15
|
+
}[]): void;
|
|
12
16
|
export declare function HstNuxt(options?: HstNuxtOptions): Plugin;
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,23 @@ export function wrapPluginsForTolerantBoot(source) {
|
|
|
35
35
|
}
|
|
36
36
|
return `import { __povesteTolerant } from '#build/poveste/tolerant-plugins.mjs'\n${wrapped}`;
|
|
37
37
|
}
|
|
38
|
+
// Nuxt runs `app:templates` again on every regeneration, with the same template
|
|
39
|
+
// objects, and a second wrap imported `__povesteTolerant` twice: the preview threw
|
|
40
|
+
// "has already been declared" after any story edit until a restart (#1177).
|
|
41
|
+
const wrappedTemplates = new WeakSet();
|
|
42
|
+
export function wrapPluginTemplates(templates) {
|
|
43
|
+
for (const template of templates) {
|
|
44
|
+
if (template.filename !== 'plugins.client.mjs' && template.filename !== 'plugins.server.mjs') {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const original = template.getContents;
|
|
48
|
+
if (!original || wrappedTemplates.has(template)) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
wrappedTemplates.add(template);
|
|
52
|
+
template.getContents = async (ctx) => wrapPluginsForTolerantBoot(await original(ctx));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
38
55
|
export function HstNuxt(options = {}) {
|
|
39
56
|
let nuxt;
|
|
40
57
|
let closed = false;
|
|
@@ -188,16 +205,7 @@ async function useNuxtViteConfig(excludePlugins, isBuild) {
|
|
|
188
205
|
// while setting up in the sandbox is logged and skipped, not fatal to the
|
|
189
206
|
// whole iframe. `excludePlugins` drops what we know can't run; this catches
|
|
190
207
|
// the rest.
|
|
191
|
-
|
|
192
|
-
if (template.filename !== 'plugins.client.mjs' && template.filename !== 'plugins.server.mjs') {
|
|
193
|
-
continue;
|
|
194
|
-
}
|
|
195
|
-
const original = template.getContents;
|
|
196
|
-
if (!original) {
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
template.getContents = async (ctx) => wrapPluginsForTolerantBoot(await original(ctx));
|
|
200
|
-
}
|
|
208
|
+
wrapPluginTemplates(app.templates);
|
|
201
209
|
});
|
|
202
210
|
// `useNuxtApp` was stubbed here until #439, which cost every story the real
|
|
203
211
|
// one: `$config` read as undefined and a value a plugin provided was
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poveste/plugin-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.1",
|
|
5
5
|
"description": "Poveste plugin to integrate with Nuxt 4",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Sorin Gitlan",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"runtime"
|
|
47
47
|
],
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
49
|
+
"node": ">=22.22.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@poveste/plugin-vue": "^0.18.
|
|
52
|
+
"@poveste/plugin-vue": "^0.18.1",
|
|
53
53
|
"nuxt": "^4.5.0",
|
|
54
|
-
"poveste": "^0.18.
|
|
54
|
+
"poveste": "^0.18.1"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@nuxt/kit": "^4.5.2",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@nuxt/schema": "^4.5.2",
|
|
64
64
|
"@types/node": "^26.6.3",
|
|
65
|
-
"poveste": "0.18.
|
|
65
|
+
"poveste": "0.18.1",
|
|
66
66
|
"typescript": "6.0.3",
|
|
67
67
|
"vite": "^8.3.1",
|
|
68
68
|
"vitest": "^5.0.2"
|