nuxt-site-config 1.0.4 → 1.0.6

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/module.d.ts CHANGED
@@ -4,6 +4,12 @@ import { SiteConfigInput, SiteConfig } from 'nuxt-site-config-kit';
4
4
  declare const processShim: NodeJS.Process;
5
5
  declare const envShim: NodeJS.ProcessEnv;
6
6
  interface ModuleOptions extends SiteConfigInput {
7
+ /**
8
+ * Enable debug mode.
9
+ *
10
+ * @default false
11
+ */
12
+ debug: boolean;
7
13
  }
8
14
  interface ModulePublicRuntimeConfig {
9
15
  site: SiteConfigInput;
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "site",
8
- "version": "1.0.4"
8
+ "version": "1.0.6"
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { useNuxt, addTemplate, defineNuxtModule, createResolver, addImports, addComponent, addPlugin, addServerHandler } from '@nuxt/kit';
1
+ import { useNuxt, addTemplate, defineNuxtModule, useLogger, createResolver, addImports, addComponent, addPlugin, addServerHandler, addPrerenderRoutes } from '@nuxt/kit';
2
2
  import { initSiteConfig, updateSiteConfig, useSiteConfig } from 'nuxt-site-config-kit';
3
3
  import { resolve } from 'pathe';
4
4
 
@@ -30,7 +30,14 @@ const module = defineNuxtModule({
30
30
  },
31
31
  configKey: "site"
32
32
  },
33
+ defaults(nuxt) {
34
+ return {
35
+ debug: nuxt.options.debug || false
36
+ };
37
+ },
33
38
  async setup(config, nuxt) {
39
+ const logger = useLogger("nuxt-site-config");
40
+ logger.level = config.debug ? 4 : 3;
34
41
  const { resolve } = createResolver(import.meta.url);
35
42
  await initSiteConfig();
36
43
  nuxt.hook("modules:done", async () => {
@@ -169,6 +176,13 @@ declare module '@nuxt/schema' {
169
176
  middleware: true,
170
177
  handler: resolve("./runtime/nitro/middleware/init")
171
178
  });
179
+ if (config.debug) {
180
+ addServerHandler({
181
+ route: "/api/__site-config__/debug",
182
+ handler: resolve("./runtime/nitro/routes/debug")
183
+ });
184
+ addPrerenderRoutes("/api/__site-config__/debug");
185
+ }
172
186
  }
173
187
  });
174
188
 
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { defineEventHandler, useNitroOrigin, useSiteConfig } from "#imports";
2
+ export default defineEventHandler(async (e) => {
3
+ const siteConfig = useSiteConfig(e);
4
+ const nitroOrigin = useNitroOrigin(e);
5
+ return {
6
+ ...siteConfig,
7
+ nitroOrigin
8
+ };
9
+ });
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-site-config",
3
3
  "type": "module",
4
- "version": "1.0.4",
5
- "packageManager": "pnpm@8.6.6",
4
+ "version": "1.0.6",
6
5
  "description": "Shared site configuration for Nuxt 3 modules.",
7
6
  "license": "MIT",
8
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -27,12 +26,12 @@
27
26
  "dist"
28
27
  ],
29
28
  "dependencies": {
30
- "@nuxt/kit": "^3.6.2",
31
- "@nuxt/schema": "^3.6.2",
29
+ "@nuxt/kit": "^3.6.3",
30
+ "@nuxt/schema": "^3.6.3",
32
31
  "pathe": "^1.1.1",
33
32
  "ufo": "^1.1.2",
34
- "nuxt-site-config-kit": "1.0.4",
35
- "site-config-stack": "1.0.4"
33
+ "nuxt-site-config-kit": "1.0.6",
34
+ "site-config-stack": "1.0.6"
36
35
  },
37
36
  "build": {
38
37
  "externals": [