site-config-stack
Advanced tools
Comparing version 1.6.7 to 2.0.0
import { ComputedRef, Ref } from 'vue'; | ||
interface SiteConfig { | ||
interface SiteConfigResolved { | ||
/** | ||
@@ -22,57 +22,30 @@ * The canonical Site URL. | ||
*/ | ||
name: string; | ||
name?: string; | ||
/** | ||
* Whether the site is indexable by search engines. | ||
* | ||
* @deprecated we should only rely on `env` | ||
*/ | ||
indexable: boolean; | ||
indexable?: boolean; | ||
/** | ||
* The environment of the site. Comparable to `process.env.NODE_ENV`. | ||
*/ | ||
env: 'production' | 'staging' | 'development' | string; | ||
env?: 'production' | 'staging' | 'development' | 'preview' | 'uat' | string; | ||
/** | ||
* Whether the site uses trailing slash. | ||
*/ | ||
trailingSlash: boolean; | ||
trailingSlash?: boolean; | ||
/** | ||
* Current locale, set with `@nuxt/i18n`. | ||
* | ||
* Falls back to the defaultLocale. | ||
* The mapping of the context of each site config value being set. | ||
*/ | ||
currentLocale?: string; | ||
_context?: Record<string, string>; | ||
/** | ||
* The default locale of the site. | ||
* Support any keys as site config. | ||
*/ | ||
defaultLocale: string; | ||
/** | ||
* The description of the site. | ||
* | ||
* @default `process.env.NUXT_PUBLIC_SITE_DESCRIPTION` | ||
* | ||
* Used by: nuxt-schema-org, nuxt-seo-kit | ||
*/ | ||
description?: string; | ||
/** | ||
* Configure the identity of the site. | ||
*/ | ||
identity?: { | ||
/** | ||
* Use Organization for when the site is a company, business, etc. | ||
* Use Person for when the site is a personal blog, portfolio, etc. | ||
*/ | ||
type: 'Organization' | 'Person'; | ||
}; | ||
/** | ||
* Twitter (X) profile ID. | ||
* | ||
* Used for Schema.org sameAs and `<meta profile>`. | ||
* | ||
* @example `@harlan_zw` | ||
*/ | ||
twitter?: string; | ||
/** | ||
* The mapping of the context of each site config value being set. | ||
*/ | ||
_context: Partial<Record<Exclude<keyof SiteConfig, '_meta'>, string>>; | ||
[key: (string & Record<never, never>)]: any; | ||
[key: string]: any; | ||
} | ||
/** | ||
* @deprecated use SiteConfigResolved | ||
*/ | ||
type SiteConfig = SiteConfigResolved; | ||
type MaybeComputedRef<T> = T | (() => T) | ComputedRef<T> | Ref<T>; | ||
@@ -82,3 +55,3 @@ type MaybeComputedRefEntries<T> = { | ||
}; | ||
type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_context' | 'indexable'> & { | ||
type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfigResolved>>, '_context' | 'indexable'> & { | ||
_context?: string; | ||
@@ -90,2 +63,4 @@ _priority?: number; | ||
debug?: boolean; | ||
skipNormalize?: boolean; | ||
resolveRefs?: boolean; | ||
} | ||
@@ -95,5 +70,7 @@ interface SiteConfigStack { | ||
push: (config: SiteConfigInput) => void; | ||
get: (options?: GetSiteConfigOptions) => SiteConfig; | ||
get: (options?: GetSiteConfigOptions) => SiteConfigResolved; | ||
} | ||
declare function normalizeSiteConfig(config: SiteConfigResolved): SiteConfigResolved; | ||
declare function validateSiteConfigStack(stack: SiteConfigStack): string[]; | ||
declare function createSiteConfigStack(options?: { | ||
@@ -103,12 +80,6 @@ debug: boolean; | ||
declare function normalizeSiteConfig(config: SiteConfig): SiteConfig; | ||
declare function resolveSitePath(pathOrUrl: string, options: { | ||
siteUrl: string; | ||
trailingSlash: boolean; | ||
base?: string; | ||
absolute?: boolean; | ||
withBase?: boolean; | ||
}): string; | ||
declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string; | ||
declare function envSiteConfig(env: Record<string, any>): { | ||
[k: string]: any; | ||
}; | ||
export { type GetSiteConfigOptions, type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath }; | ||
export { type GetSiteConfigOptions, type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigResolved, type SiteConfigStack, createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack }; |
{ | ||
"name": "site-config-stack", | ||
"type": "module", | ||
"version": "1.6.7", | ||
"version": "2.0.0", | ||
"description": "Shared site configuration utilities.", | ||
@@ -22,2 +22,12 @@ "license": "MIT", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"./urls": { | ||
"types": "./dist/urls.d.ts", | ||
"import": "./dist/urls.mjs", | ||
"require": "./dist/urls.cjs" | ||
}, | ||
"./dist/urls": { | ||
"types": "./dist/urls.d.ts", | ||
"import": "./dist/urls.mjs", | ||
"require": "./dist/urls.cjs" | ||
} | ||
@@ -42,4 +52,5 @@ }, | ||
"build": "unbuild", | ||
"stub": "unbuild --stub" | ||
"stub": "unbuild --stub", | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19512
11
319