site-config-stack 1.0.11 → 1.0.12

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.
@@ -0,0 +1,72 @@
1
+ interface SiteConfig {
2
+ /**
3
+ * The canonical Site URL.
4
+ *
5
+ * - Build / Prerender: Inferred from CI environment (Netlify, Vercel)
6
+ * - SSR: Inferred from request headers
7
+ * - SPA: Inferred from `window.location`
8
+ *
9
+ * Used by: nuxt-simple-sitemap, nuxt-simple-robots, nuxt-schema-org, nuxt-og-image, etc.
10
+ */
11
+ url?: string;
12
+ /**
13
+ * The name of the site.
14
+ *
15
+ * - Build / Prerender: Inferred from CI environment (Netlify) or `package.json`
16
+ * - SSR:
17
+ *
18
+ * Used by: nuxt-schema-org, nuxt-seo-kit
19
+ */
20
+ name: string;
21
+ /**
22
+ * The title separator of the site.
23
+ */
24
+ titleSeparator: string;
25
+ /**
26
+ * Whether the site is indexable by search engines.
27
+ */
28
+ indexable: boolean;
29
+ /**
30
+ * Whether the site uses trailing slash.
31
+ */
32
+ trailingSlash: boolean;
33
+ /**
34
+ * The default locale of the site.
35
+ */
36
+ defaultLocale: string;
37
+ /**
38
+ * The description of the site.
39
+ *
40
+ * @default `process.env.NUXT_PUBLIC_SITE_DESCRIPTION`
41
+ *
42
+ * Used by: nuxt-schema-org, nuxt-seo-kit
43
+ */
44
+ description?: string;
45
+ /**
46
+ * The mapping of the context of each site config value being set.
47
+ */
48
+ _context: Partial<Record<Exclude<keyof SiteConfig, '_meta'>, string>>;
49
+ [key: string]: any;
50
+ }
51
+ type SiteConfigInput = Partial<Omit<SiteConfig, '_context'>> & {
52
+ _context?: string;
53
+ };
54
+ interface SiteConfigStack {
55
+ stack: Partial<SiteConfigInput>[];
56
+ push: (config: SiteConfigInput) => void;
57
+ get: () => SiteConfig;
58
+ }
59
+
60
+ declare function createSiteConfigStack(): SiteConfigStack;
61
+
62
+ declare function normalizeSiteConfig(config: SiteConfig): SiteConfig;
63
+ declare function resolveSitePath(pathOrUrl: string, options: {
64
+ siteUrl: string;
65
+ trailingSlash: boolean;
66
+ base: string;
67
+ absolute?: boolean;
68
+ withBase?: boolean;
69
+ }): string;
70
+ declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
71
+
72
+ export { type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
@@ -0,0 +1,72 @@
1
+ interface SiteConfig {
2
+ /**
3
+ * The canonical Site URL.
4
+ *
5
+ * - Build / Prerender: Inferred from CI environment (Netlify, Vercel)
6
+ * - SSR: Inferred from request headers
7
+ * - SPA: Inferred from `window.location`
8
+ *
9
+ * Used by: nuxt-simple-sitemap, nuxt-simple-robots, nuxt-schema-org, nuxt-og-image, etc.
10
+ */
11
+ url?: string;
12
+ /**
13
+ * The name of the site.
14
+ *
15
+ * - Build / Prerender: Inferred from CI environment (Netlify) or `package.json`
16
+ * - SSR:
17
+ *
18
+ * Used by: nuxt-schema-org, nuxt-seo-kit
19
+ */
20
+ name: string;
21
+ /**
22
+ * The title separator of the site.
23
+ */
24
+ titleSeparator: string;
25
+ /**
26
+ * Whether the site is indexable by search engines.
27
+ */
28
+ indexable: boolean;
29
+ /**
30
+ * Whether the site uses trailing slash.
31
+ */
32
+ trailingSlash: boolean;
33
+ /**
34
+ * The default locale of the site.
35
+ */
36
+ defaultLocale: string;
37
+ /**
38
+ * The description of the site.
39
+ *
40
+ * @default `process.env.NUXT_PUBLIC_SITE_DESCRIPTION`
41
+ *
42
+ * Used by: nuxt-schema-org, nuxt-seo-kit
43
+ */
44
+ description?: string;
45
+ /**
46
+ * The mapping of the context of each site config value being set.
47
+ */
48
+ _context: Partial<Record<Exclude<keyof SiteConfig, '_meta'>, string>>;
49
+ [key: string]: any;
50
+ }
51
+ type SiteConfigInput = Partial<Omit<SiteConfig, '_context'>> & {
52
+ _context?: string;
53
+ };
54
+ interface SiteConfigStack {
55
+ stack: Partial<SiteConfigInput>[];
56
+ push: (config: SiteConfigInput) => void;
57
+ get: () => SiteConfig;
58
+ }
59
+
60
+ declare function createSiteConfigStack(): SiteConfigStack;
61
+
62
+ declare function normalizeSiteConfig(config: SiteConfig): SiteConfig;
63
+ declare function resolveSitePath(pathOrUrl: string, options: {
64
+ siteUrl: string;
65
+ trailingSlash: boolean;
66
+ base: string;
67
+ absolute?: boolean;
68
+ withBase?: boolean;
69
+ }): string;
70
+ declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
71
+
72
+ export { type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
package/dist/index.d.ts CHANGED
@@ -69,4 +69,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
69
69
  }): string;
70
70
  declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
71
71
 
72
- export { SiteConfig, SiteConfigInput, SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
72
+ export { type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "site-config-stack",
3
3
  "type": "module",
4
- "version": "1.0.11",
4
+ "version": "1.0.12",
5
5
  "description": "Shared site configuration utilities.",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",