@vizejs/nuxt 0.805.0 → 0.807.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/index.mjs +21 -7
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -512,7 +512,10 @@ const closeBundleByScope = /* @__PURE__ */ new WeakMap();
|
|
|
512
512
|
/**
|
|
513
513
|
* Nuxt's Environment API client-manifest plugin consumes and then removes the
|
|
514
514
|
* Vite client manifest. Rolldown/Vite can invoke the SSR closeBundle path more
|
|
515
|
-
* than once for a single build, so make that teardown idempotent per build
|
|
515
|
+
* than once for a single build, so make that teardown idempotent per build and
|
|
516
|
+
* environment. The hook runs once for every environment it applies to and only
|
|
517
|
+
* the SSR call finalizes the manifest, so an earlier client call must not
|
|
518
|
+
* satisfy the SSR one.
|
|
516
519
|
*/
|
|
517
520
|
function patchNuxtClientManifestCloseBundlePlugin(plugin, buildScope) {
|
|
518
521
|
if (!plugin || plugin.name !== "nuxt:client-manifest") return;
|
|
@@ -520,7 +523,7 @@ function patchNuxtClientManifestCloseBundlePlugin(plugin, buildScope) {
|
|
|
520
523
|
if (typeof plugin.closeBundle === "function") {
|
|
521
524
|
const original = plugin.closeBundle;
|
|
522
525
|
plugin.closeBundle = function(...args) {
|
|
523
|
-
return
|
|
526
|
+
return runOnceForEnvironment(buildScope, environmentName(this), () => original.call(this, ...args));
|
|
524
527
|
};
|
|
525
528
|
plugin[VIZE_NUXT_CLIENT_MANIFEST_PATCHED] = true;
|
|
526
529
|
return;
|
|
@@ -529,12 +532,23 @@ function patchNuxtClientManifestCloseBundlePlugin(plugin, buildScope) {
|
|
|
529
532
|
if (!closeBundle || typeof closeBundle.handler !== "function") return;
|
|
530
533
|
const original = closeBundle.handler;
|
|
531
534
|
closeBundle.handler = function(...args) {
|
|
532
|
-
return
|
|
535
|
+
return runOnceForEnvironment(buildScope, environmentName(this), () => original.call(this, ...args));
|
|
533
536
|
};
|
|
534
537
|
plugin[VIZE_NUXT_CLIENT_MANIFEST_PATCHED] = true;
|
|
535
538
|
}
|
|
536
|
-
function
|
|
537
|
-
|
|
539
|
+
function environmentName(context) {
|
|
540
|
+
if (!context || typeof context !== "object" || !("environment" in context)) return void 0;
|
|
541
|
+
const environment = context.environment;
|
|
542
|
+
if (!environment || typeof environment !== "object" || !("name" in environment)) return;
|
|
543
|
+
return typeof environment.name === "string" ? environment.name : void 0;
|
|
544
|
+
}
|
|
545
|
+
function runOnceForEnvironment(buildScope, environment, run) {
|
|
546
|
+
let runs = closeBundleByScope.get(buildScope);
|
|
547
|
+
if (!runs) {
|
|
548
|
+
runs = /* @__PURE__ */ new Map();
|
|
549
|
+
closeBundleByScope.set(buildScope, runs);
|
|
550
|
+
}
|
|
551
|
+
const pending = runs.get(environment);
|
|
538
552
|
if (pending) return pending;
|
|
539
553
|
let next;
|
|
540
554
|
try {
|
|
@@ -543,10 +557,10 @@ function runOnceForScope(buildScope, run) {
|
|
|
543
557
|
next = Promise.reject(error);
|
|
544
558
|
}
|
|
545
559
|
const tracked = next.catch((error) => {
|
|
546
|
-
if (
|
|
560
|
+
if (runs.get(environment) === tracked) runs.delete(environment);
|
|
547
561
|
throw error;
|
|
548
562
|
});
|
|
549
|
-
|
|
563
|
+
runs.set(environment, tracked);
|
|
550
564
|
return tracked;
|
|
551
565
|
}
|
|
552
566
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.807.0",
|
|
4
4
|
"description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@nuxt/kit": "3.21.8",
|
|
53
|
-
"@vizejs/native": "0.
|
|
54
|
-
"@vizejs/nuxt-lint-config": "0.
|
|
55
|
-
"@vizejs/vite-plugin": "0.
|
|
56
|
-
"@vizejs/vite-plugin-musea": "0.
|
|
57
|
-
"vize": "0.
|
|
53
|
+
"@vizejs/native": "0.807.0",
|
|
54
|
+
"@vizejs/nuxt-lint-config": "0.807.0",
|
|
55
|
+
"@vizejs/vite-plugin": "0.807.0",
|
|
56
|
+
"@vizejs/vite-plugin-musea": "0.807.0",
|
|
57
|
+
"vize": "0.807.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|
|
61
61
|
"oxlint": "1.78.0",
|
|
62
|
-
"oxlint-plugin-vize": "0.
|
|
62
|
+
"oxlint-plugin-vize": "0.807.0",
|
|
63
63
|
"typescript": "6.0.3",
|
|
64
64
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.0",
|
|
65
65
|
"vite-plus": "1.5.0",
|