nuxt-site-config 4.0.0 → 4.0.2

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.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.9.0"
5
5
  },
6
6
  "configKey": "site",
7
- "version": "4.0.0",
7
+ "version": "4.0.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,50 +1,10 @@
1
- import { useNuxt, defineNuxtModule, createResolver, useLogger, addTypeTemplate, addImportsDir, addServerImportsDir, addPlugin, hasNuxtModule, hasNuxtModuleCompatibility, addTemplate, addServerHandler, addPrerenderRoutes, addServerPlugin } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, useLogger, addTypeTemplate, addImportsDir, addServerImportsDir, addPlugin, hasNuxtModule, hasNuxtModuleCompatibility, addTemplate, addServerHandler, addPrerenderRoutes, addServerPlugin } from '@nuxt/kit';
2
2
  import { initSiteConfig, updateSiteConfig, getSiteConfigStack } from 'nuxt-site-config-kit';
3
+ import { setupDevToolsUI } from 'nuxtseo-shared/devtools';
3
4
  import { relative } from 'pathe';
4
5
  import { readPackageJSON } from 'pkg-types';
5
6
  import { SiteConfigPriority, validateSiteConfigStack } from 'site-config-stack';
6
7
  import { parseURL } from 'ufo';
7
- import { existsSync } from 'node:fs';
8
- import { addCustomTab } from '@nuxt/devtools-kit';
9
-
10
- const DEVTOOLS_UI_ROUTE = "/__nuxt-site-config";
11
- const DEVTOOLS_UI_LOCAL_PORT = 3030;
12
- function setupDevToolsUI(resolve, nuxt = useNuxt()) {
13
- const clientPath = resolve("./client");
14
- const isProductionBuild = existsSync(clientPath);
15
- if (isProductionBuild) {
16
- nuxt.hook("vite:serverCreated", async (server) => {
17
- const sirv = await import('sirv').then((r) => r.default || r);
18
- server.middlewares.use(
19
- DEVTOOLS_UI_ROUTE,
20
- sirv(clientPath, { dev: true, single: true })
21
- );
22
- });
23
- } else {
24
- nuxt.hook("vite:extendConfig", (config) => {
25
- config.server = { ...config.server, proxy: { ...config.server?.proxy } };
26
- config.server.proxy[DEVTOOLS_UI_ROUTE] = {
27
- target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
28
- changeOrigin: true,
29
- followRedirects: true,
30
- rewrite: (path) => path.replace(DEVTOOLS_UI_ROUTE, "")
31
- };
32
- });
33
- }
34
- addCustomTab({
35
- // unique identifier
36
- name: "nuxt-site-config",
37
- // title to display in the tab
38
- title: "Site Config",
39
- // any icon from Iconify, or a URL to an image
40
- icon: "carbon:settings-check",
41
- // iframe view
42
- view: {
43
- type: "iframe",
44
- src: DEVTOOLS_UI_ROUTE
45
- }
46
- });
47
- }
48
8
 
49
9
  const PORT_SUFFIX_RE = /:\d+$/;
50
10
  const module$1 = defineNuxtModule({
@@ -225,8 +185,14 @@ export {}
225
185
  if (nuxt.options._generate)
226
186
  addPrerenderRoutes("/__site-config__/debug.json");
227
187
  }
228
- if (nuxt.options.dev)
229
- setupDevToolsUI(resolve);
188
+ if (nuxt.options.dev) {
189
+ setupDevToolsUI({
190
+ route: "/__nuxt-site-config",
191
+ name: "nuxt-site-config",
192
+ title: "Site Config",
193
+ icon: "carbon:settings-check"
194
+ }, resolve);
195
+ }
230
196
  addServerPlugin(resolve("./runtime/server/plugins/injectState"));
231
197
  }
232
198
  });
@@ -49,11 +49,11 @@ export default defineNuxtPlugin({
49
49
  stack.push({
50
50
  _priority: SiteConfigPriority.i18n,
51
51
  _context: "@nuxtjs/i18n",
52
- url: resolveI18nUrl(i18n),
53
- defaultLocale: resolveDefaultLocale(i18n),
54
- currentLocale: resolveCurrentLocale(i18n),
55
- description: resolveDescription(i18n),
56
- name: resolveName(i18n)
52
+ url: () => resolveI18nUrl(i18n),
53
+ defaultLocale: () => resolveDefaultLocale(i18n),
54
+ currentLocale: () => resolveCurrentLocale(i18n),
55
+ description: () => resolveDescription(i18n),
56
+ name: () => resolveName(i18n)
57
57
  });
58
58
  return;
59
59
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-site-config",
3
3
  "type": "module",
4
- "version": "4.0.0",
4
+ "version": "4.0.2",
5
5
  "description": "Shared site configuration for Nuxt 3 modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -49,15 +49,14 @@
49
49
  "dist"
50
50
  ],
51
51
  "dependencies": {
52
- "@nuxt/devtools-kit": "^3.2.4",
53
52
  "@nuxt/kit": "^4.4.2",
54
53
  "h3": "^1.15.10",
54
+ "nuxtseo-shared": "^0.7.1",
55
55
  "pathe": "^2.0.3",
56
56
  "pkg-types": "^2.3.0",
57
- "sirv": "^3.0.2",
58
57
  "ufo": "^1.6.3",
59
- "site-config-stack": "4.0.0",
60
- "nuxt-site-config-kit": "4.0.0"
58
+ "nuxt-site-config-kit": "4.0.2",
59
+ "site-config-stack": "4.0.2"
61
60
  },
62
61
  "devDependencies": {
63
62
  "@nuxt/schema": "^4.4.2"
@@ -68,9 +67,7 @@
68
67
  ]
69
68
  },
70
69
  "scripts": {
71
- "client:build": "nuxi generate ../../client",
72
- "client:dev": "nuxi dev ../../client --port 3030",
73
- "build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && pnpm run client:build",
70
+ "build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build",
74
71
  "dev:build": "nuxi build playground",
75
72
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare",
76
73
  "release": "bumpp package.json --commit --push --tag",
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-site-config/_nuxt/entry.BRjKVPrI.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-site-config/_nuxt/By8QJM0D.js"><script type="module" src="/__nuxt-site-config/_nuxt/By8QJM0D.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT_SITE_CONFIG__={_priority:{env:-15},env:"production"}</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-site-config",buildId:"adb848cf-c134-4dd7-9ba7-49309de15945",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1774189613107,false]</script></body></html>
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-site-config/_nuxt/entry.BRjKVPrI.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-site-config/_nuxt/By8QJM0D.js"><script type="module" src="/__nuxt-site-config/_nuxt/By8QJM0D.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT_SITE_CONFIG__={_priority:{env:-15},env:"production"}</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-site-config",buildId:"adb848cf-c134-4dd7-9ba7-49309de15945",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1774189613108,false]</script></body></html>