@mundogamernetwork/shared-ui 1.2.0 → 1.2.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.
Files changed (2) hide show
  1. package/nuxt.config.ts +42 -4
  2. package/package.json +1 -1
package/nuxt.config.ts CHANGED
@@ -1,7 +1,45 @@
1
+ import { addComponentsDir, createResolver, defineNuxtModule } from "@nuxt/kit";
2
+
3
+ // Nuxt's built-in `components` module resolves cross-layer name collisions by
4
+ // picking the highest `priority` directory (see `scanComponents` in
5
+ // nuxt/dist/index.mjs: `if (newPriority > existingPriority) { ...replace... }`).
6
+ // Before Nuxt 3.20.2, layer priority was binary (root app = 1, every extended
7
+ // layer = 0), so shared-ui's components happened to win ties via array order.
8
+ // Nuxt 3.20.2+ (nuxt/nuxt#33654) computes `priority = layerCount - i` from each
9
+ // layer's position in `_layers`, which is NOT reversible via config and no
10
+ // longer guarantees shared-ui wins — depending on how many layers a consuming
11
+ // app extends, shared-ui's implicit priority can end up lower than the
12
+ // consuming app's own `~/components` priority, causing its components
13
+ // (MgBanners, MgLoginModal, MgAppInstallBanner, Playtest components, etc.) to
14
+ // silently fail to resolve.
15
+ //
16
+ // Fix: register shared-ui's own component directory explicitly via
17
+ // `addComponentsDir`, with an explicit `priority` far above anything
18
+ // `layerCount - i` could ever produce (realistic layer counts are single
19
+ // digits), so shared-ui always wins regardless of the consuming app's layer
20
+ // ordering/count.
21
+ const SHARED_UI_COMPONENT_PRIORITY = 1000;
22
+
23
+ const registerSharedUiComponents = defineNuxtModule({
24
+ meta: {
25
+ name: "shared-ui-components",
26
+ },
27
+ setup() {
28
+ // Resolve relative to this file (shared-ui's package root), not the
29
+ // consuming app's `srcDir`/`~` alias — this is the standard Nuxt Kit
30
+ // pattern (`createResolver(import.meta.url)`) and keeps registration
31
+ // correct no matter which app extends this layer.
32
+ const resolver = createResolver(import.meta.url);
33
+ addComponentsDir({
34
+ path: resolver.resolve("./components"),
35
+ pathPrefix: false,
36
+ priority: SHARED_UI_COMPONENT_PRIORITY,
37
+ });
38
+ },
39
+ });
40
+
1
41
  export default defineNuxtConfig({
2
- components: [
3
- { path: "~/components", pathPrefix: false },
4
- ],
42
+ modules: [registerSharedUiComponents],
5
43
  css: [
6
44
  "@mundogamernetwork/shared-ui/assets/kit/kit-base.css",
7
45
  "@mundogamernetwork/shared-ui/assets/kit/kit-theme.css",
@@ -13,7 +51,7 @@ export default defineNuxtConfig({
13
51
  systemId: "", // VITE_SYSTEM_ID for notification filtering
14
52
  apiBaseURL: "", // VITE_API_BASE_URL
15
53
  pressKitApiUrl: "", // VITE_PRESS_KIT_API_URL — override per-service; falls back to apiBaseURL
16
- agencyBaseUrl: "", // VITE_BASE_URL_AGENCY — used for "create your press kit" CTA link
54
+ agencyBaseUrl: "", // VITE_BASE_URL_AGENCY — used for "create your press kit" CTA link
17
55
  accountsBaseUrl: "", // VITE_BASE_ACCOUNTS_URL
18
56
  networkBaseUrl: "", // VITE_BASE_URL_NETWORK (institutional APIs)
19
57
  features: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mundogamernetwork/shared-ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",