@frontic/nuxt 0.1.7 → 0.1.9

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/dist/module.mjs +18 -1
  2. package/package.json +5 -3
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readdirSync } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
- import { defineNuxtModule, createResolver, addServerHandler, addImports, addComponentsDir, addComponentExports } from '@nuxt/kit';
4
+ import { defineNuxtModule, createResolver, addServerHandler, hasNuxtModule, installModule, addImports, addComponentsDir, addComponentExports } from '@nuxt/kit';
5
5
 
6
6
  const _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
7
7
  const ALL_COMPOSABLES = ["block", "listing", "search", "page", "context", "client"];
@@ -86,11 +86,28 @@ frontic: { composables: false }
86
86
  );
87
87
  }
88
88
  const clientDirName = fronticClientDir === fronticDir ? ".frontic" : ".frontstack";
89
+ const clientDirPath = join(ROOT_DIR_PATH, clientDirName);
90
+ nuxt.options.vite ||= {};
91
+ nuxt.options.vite.resolve ||= {};
92
+ nuxt.options.vite.resolve.alias ||= {};
93
+ nuxt.options.vite.resolve.alias["@frontic/stack"] = clientDirPath;
94
+ nuxt.hook("nitro:config", (nitroConfig) => {
95
+ nitroConfig.alias ||= {};
96
+ nitroConfig.alias["@frontic/stack"] = clientDirPath;
97
+ });
89
98
  nuxt.hook("prepare:types", ({ tsConfig }) => {
90
99
  tsConfig.compilerOptions ||= {};
91
100
  tsConfig.compilerOptions.paths ||= {};
92
101
  tsConfig.compilerOptions.paths["@frontic/stack/*"] = [`../${clientDirName}/*`];
93
102
  });
103
+ if (anyComposableEnabled) {
104
+ if (!hasNuxtModule("@pinia/nuxt", nuxt)) {
105
+ await installModule("@pinia/nuxt", {}, nuxt);
106
+ }
107
+ if (!hasNuxtModule("@pinia/colada-nuxt", nuxt)) {
108
+ await installModule("@pinia/colada-nuxt", {}, nuxt);
109
+ }
110
+ }
94
111
  if (anyComposableEnabled) {
95
112
  const composablesDir = resolve(runtimeDir, "composables");
96
113
  const utilsDir = resolve(runtimeDir, "utils");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontic/nuxt",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Nuxt module for Frontstack headless commerce - zero config data fetching composables with smart caching, page routing, and context management",
5
5
  "license": "MIT",
6
6
  "author": "Frontic",
@@ -41,9 +41,11 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@nuxt/kit": "^3.17.0",
44
- "@pinia/colada": "^0.14.0",
44
+ "@pinia/colada": "^0.21.0",
45
+ "@pinia/colada-nuxt": "^0.3.0",
46
+ "@pinia/nuxt": "^0.11.0",
45
47
  "@vueuse/core": "^12.0.0",
46
- "pinia": "^2.2.6"
48
+ "pinia": "^3.0.0"
47
49
  },
48
50
  "devDependencies": {
49
51
  "@nuxt/module-builder": "^1.0.2",