site-config-stack 1.0.11 → 1.1.0

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,92 @@
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
+ * Whether the site is indexable by search engines.
23
+ */
24
+ indexable: boolean;
25
+ /**
26
+ * Whether the site uses trailing slash.
27
+ */
28
+ trailingSlash: boolean;
29
+ /**
30
+ * Current locale, set with @nuxt/i18n.
31
+ *
32
+ * Falls back to the defaultLocale.
33
+ */
34
+ currentLocale?: string;
35
+ /**
36
+ * The default locale of the site.
37
+ */
38
+ defaultLocale: string;
39
+ /**
40
+ * The description of the site.
41
+ *
42
+ * @default `process.env.NUXT_PUBLIC_SITE_DESCRIPTION`
43
+ *
44
+ * Used by: nuxt-schema-org, nuxt-seo-kit
45
+ */
46
+ description?: string;
47
+ /**
48
+ * Configure the identity of the site.
49
+ */
50
+ identity?: {
51
+ /**
52
+ * Use Organization for when the site is a company, business, etc.
53
+ * Use Person for when the site is a personal blog, portfolio, etc.
54
+ */
55
+ type: 'Organization' | 'Person';
56
+ };
57
+ /**
58
+ * Twitter (X) profile ID.
59
+ *
60
+ * Used for Schema.org sameAs and <meta profile>.
61
+ *
62
+ * @example @harlan_zw
63
+ */
64
+ twitter?: string;
65
+ /**
66
+ * The mapping of the context of each site config value being set.
67
+ */
68
+ _context: Partial<Record<Exclude<keyof SiteConfig, '_meta'>, string>>;
69
+ [key: string]: any;
70
+ }
71
+ type SiteConfigInput = Partial<Omit<SiteConfig, '_context'>> & {
72
+ _context?: string;
73
+ };
74
+ interface SiteConfigStack {
75
+ stack: Partial<SiteConfigInput>[];
76
+ push: (config: SiteConfigInput) => void;
77
+ get: () => SiteConfig;
78
+ }
79
+
80
+ declare function createSiteConfigStack(): SiteConfigStack;
81
+
82
+ declare function normalizeSiteConfig(config: SiteConfig): SiteConfig;
83
+ declare function resolveSitePath(pathOrUrl: string, options: {
84
+ siteUrl: string;
85
+ trailingSlash: boolean;
86
+ base: string;
87
+ absolute?: boolean;
88
+ withBase?: boolean;
89
+ }): string;
90
+ declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
91
+
92
+ export { type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
@@ -0,0 +1,92 @@
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
+ * Whether the site is indexable by search engines.
23
+ */
24
+ indexable: boolean;
25
+ /**
26
+ * Whether the site uses trailing slash.
27
+ */
28
+ trailingSlash: boolean;
29
+ /**
30
+ * Current locale, set with @nuxt/i18n.
31
+ *
32
+ * Falls back to the defaultLocale.
33
+ */
34
+ currentLocale?: string;
35
+ /**
36
+ * The default locale of the site.
37
+ */
38
+ defaultLocale: string;
39
+ /**
40
+ * The description of the site.
41
+ *
42
+ * @default `process.env.NUXT_PUBLIC_SITE_DESCRIPTION`
43
+ *
44
+ * Used by: nuxt-schema-org, nuxt-seo-kit
45
+ */
46
+ description?: string;
47
+ /**
48
+ * Configure the identity of the site.
49
+ */
50
+ identity?: {
51
+ /**
52
+ * Use Organization for when the site is a company, business, etc.
53
+ * Use Person for when the site is a personal blog, portfolio, etc.
54
+ */
55
+ type: 'Organization' | 'Person';
56
+ };
57
+ /**
58
+ * Twitter (X) profile ID.
59
+ *
60
+ * Used for Schema.org sameAs and <meta profile>.
61
+ *
62
+ * @example @harlan_zw
63
+ */
64
+ twitter?: string;
65
+ /**
66
+ * The mapping of the context of each site config value being set.
67
+ */
68
+ _context: Partial<Record<Exclude<keyof SiteConfig, '_meta'>, string>>;
69
+ [key: string]: any;
70
+ }
71
+ type SiteConfigInput = Partial<Omit<SiteConfig, '_context'>> & {
72
+ _context?: string;
73
+ };
74
+ interface SiteConfigStack {
75
+ stack: Partial<SiteConfigInput>[];
76
+ push: (config: SiteConfigInput) => void;
77
+ get: () => SiteConfig;
78
+ }
79
+
80
+ declare function createSiteConfigStack(): SiteConfigStack;
81
+
82
+ declare function normalizeSiteConfig(config: SiteConfig): SiteConfig;
83
+ declare function resolveSitePath(pathOrUrl: string, options: {
84
+ siteUrl: string;
85
+ trailingSlash: boolean;
86
+ base: string;
87
+ absolute?: boolean;
88
+ withBase?: boolean;
89
+ }): string;
90
+ declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
91
+
92
+ export { type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
package/dist/index.d.ts CHANGED
@@ -18,10 +18,6 @@ interface SiteConfig {
18
18
  * Used by: nuxt-schema-org, nuxt-seo-kit
19
19
  */
20
20
  name: string;
21
- /**
22
- * The title separator of the site.
23
- */
24
- titleSeparator: string;
25
21
  /**
26
22
  * Whether the site is indexable by search engines.
27
23
  */
@@ -30,6 +26,12 @@ interface SiteConfig {
30
26
  * Whether the site uses trailing slash.
31
27
  */
32
28
  trailingSlash: boolean;
29
+ /**
30
+ * Current locale, set with @nuxt/i18n.
31
+ *
32
+ * Falls back to the defaultLocale.
33
+ */
34
+ currentLocale?: string;
33
35
  /**
34
36
  * The default locale of the site.
35
37
  */
@@ -42,6 +44,24 @@ interface SiteConfig {
42
44
  * Used by: nuxt-schema-org, nuxt-seo-kit
43
45
  */
44
46
  description?: string;
47
+ /**
48
+ * Configure the identity of the site.
49
+ */
50
+ identity?: {
51
+ /**
52
+ * Use Organization for when the site is a company, business, etc.
53
+ * Use Person for when the site is a personal blog, portfolio, etc.
54
+ */
55
+ type: 'Organization' | 'Person';
56
+ };
57
+ /**
58
+ * Twitter (X) profile ID.
59
+ *
60
+ * Used for Schema.org sameAs and <meta profile>.
61
+ *
62
+ * @example @harlan_zw
63
+ */
64
+ twitter?: string;
45
65
  /**
46
66
  * The mapping of the context of each site config value being set.
47
67
  */
@@ -69,4 +89,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
69
89
  }): string;
70
90
  declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
71
91
 
72
- export { SiteConfig, SiteConfigInput, SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
92
+ 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.1.0",
5
5
  "description": "Shared site configuration utilities.",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -17,8 +17,8 @@
17
17
  "exports": {
18
18
  ".": {
19
19
  "types": "./dist/index.d.ts",
20
- "require": "./dist/index.cjs",
21
- "import": "./dist/index.mjs"
20
+ "import": "./dist/index.mjs",
21
+ "require": "./dist/index.cjs"
22
22
  }
23
23
  },
24
24
  "main": "./dist/index.cjs",