site-config-stack 1.4.0 → 1.5.1
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/index.cjs +6 -5
- package/dist/index.d.cts +9 -2
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.mjs +6 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,17 +23,18 @@ function createSiteConfigStack(options) {
|
|
|
23
23
|
if (Object.keys(entry).filter((k) => !k.startsWith("_")).length > 0)
|
|
24
24
|
stack.push(entry);
|
|
25
25
|
}
|
|
26
|
-
function get() {
|
|
27
|
-
const siteConfig = {
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
function get(options2) {
|
|
27
|
+
const siteConfig = {};
|
|
28
|
+
if (options2?.debug)
|
|
29
|
+
siteConfig._context = {};
|
|
30
30
|
for (const o in stack.sort((a, b) => (a._priority || 0) - (b._priority || 0))) {
|
|
31
31
|
for (const k in stack[o]) {
|
|
32
32
|
const key = k;
|
|
33
33
|
const val = stack[o][k];
|
|
34
34
|
if (!k.startsWith("_")) {
|
|
35
35
|
siteConfig[k] = val;
|
|
36
|
-
|
|
36
|
+
if (options2?.debug)
|
|
37
|
+
siteConfig._context[key] = stack[o]._context?.[key] || stack[o]._context || "anonymous";
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -24,6 +24,10 @@ interface SiteConfig {
|
|
|
24
24
|
* Whether the site is indexable by search engines.
|
|
25
25
|
*/
|
|
26
26
|
indexable: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The environment of the site. Comparable to `process.env.NODE_ENV`.
|
|
29
|
+
*/
|
|
30
|
+
env: 'production' | 'staging' | 'development' | string;
|
|
27
31
|
/**
|
|
28
32
|
* Whether the site uses trailing slash.
|
|
29
33
|
*/
|
|
@@ -79,10 +83,13 @@ type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_cont
|
|
|
79
83
|
_priority?: number;
|
|
80
84
|
indexable?: MaybeComputedRef<string | boolean>;
|
|
81
85
|
};
|
|
86
|
+
interface GetSiteConfigOptions {
|
|
87
|
+
debug?: boolean;
|
|
88
|
+
}
|
|
82
89
|
interface SiteConfigStack {
|
|
83
90
|
stack: Partial<SiteConfigInput>[];
|
|
84
91
|
push: (config: SiteConfigInput) => void;
|
|
85
|
-
get: () => SiteConfig;
|
|
92
|
+
get: (options?: GetSiteConfigOptions) => SiteConfig;
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
declare function createSiteConfigStack(options?: {
|
|
@@ -99,4 +106,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
|
|
|
99
106
|
}): string;
|
|
100
107
|
declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
|
|
101
108
|
|
|
102
|
-
export { type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
|
|
109
|
+
export { type GetSiteConfigOptions, type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
|
package/dist/index.d.mts
CHANGED
|
@@ -24,6 +24,10 @@ interface SiteConfig {
|
|
|
24
24
|
* Whether the site is indexable by search engines.
|
|
25
25
|
*/
|
|
26
26
|
indexable: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The environment of the site. Comparable to `process.env.NODE_ENV`.
|
|
29
|
+
*/
|
|
30
|
+
env: 'production' | 'staging' | 'development' | string;
|
|
27
31
|
/**
|
|
28
32
|
* Whether the site uses trailing slash.
|
|
29
33
|
*/
|
|
@@ -79,10 +83,13 @@ type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_cont
|
|
|
79
83
|
_priority?: number;
|
|
80
84
|
indexable?: MaybeComputedRef<string | boolean>;
|
|
81
85
|
};
|
|
86
|
+
interface GetSiteConfigOptions {
|
|
87
|
+
debug?: boolean;
|
|
88
|
+
}
|
|
82
89
|
interface SiteConfigStack {
|
|
83
90
|
stack: Partial<SiteConfigInput>[];
|
|
84
91
|
push: (config: SiteConfigInput) => void;
|
|
85
|
-
get: () => SiteConfig;
|
|
92
|
+
get: (options?: GetSiteConfigOptions) => SiteConfig;
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
declare function createSiteConfigStack(options?: {
|
|
@@ -99,4 +106,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
|
|
|
99
106
|
}): string;
|
|
100
107
|
declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
|
|
101
108
|
|
|
102
|
-
export { type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
|
|
109
|
+
export { type GetSiteConfigOptions, type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,10 @@ interface SiteConfig {
|
|
|
24
24
|
* Whether the site is indexable by search engines.
|
|
25
25
|
*/
|
|
26
26
|
indexable: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The environment of the site. Comparable to `process.env.NODE_ENV`.
|
|
29
|
+
*/
|
|
30
|
+
env: 'production' | 'staging' | 'development' | string;
|
|
27
31
|
/**
|
|
28
32
|
* Whether the site uses trailing slash.
|
|
29
33
|
*/
|
|
@@ -79,10 +83,13 @@ type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_cont
|
|
|
79
83
|
_priority?: number;
|
|
80
84
|
indexable?: MaybeComputedRef<string | boolean>;
|
|
81
85
|
};
|
|
86
|
+
interface GetSiteConfigOptions {
|
|
87
|
+
debug?: boolean;
|
|
88
|
+
}
|
|
82
89
|
interface SiteConfigStack {
|
|
83
90
|
stack: Partial<SiteConfigInput>[];
|
|
84
91
|
push: (config: SiteConfigInput) => void;
|
|
85
|
-
get: () => SiteConfig;
|
|
92
|
+
get: (options?: GetSiteConfigOptions) => SiteConfig;
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
declare function createSiteConfigStack(options?: {
|
|
@@ -99,4 +106,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
|
|
|
99
106
|
}): string;
|
|
100
107
|
declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
|
|
101
108
|
|
|
102
|
-
export { type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
|
|
109
|
+
export { type GetSiteConfigOptions, type MaybeComputedRef, type MaybeComputedRefEntries, type SiteConfig, type SiteConfigInput, type SiteConfigStack, createSiteConfigStack, fixSlashes, normalizeSiteConfig, resolveSitePath };
|
package/dist/index.mjs
CHANGED
|
@@ -21,17 +21,18 @@ function createSiteConfigStack(options) {
|
|
|
21
21
|
if (Object.keys(entry).filter((k) => !k.startsWith("_")).length > 0)
|
|
22
22
|
stack.push(entry);
|
|
23
23
|
}
|
|
24
|
-
function get() {
|
|
25
|
-
const siteConfig = {
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
function get(options2) {
|
|
25
|
+
const siteConfig = {};
|
|
26
|
+
if (options2?.debug)
|
|
27
|
+
siteConfig._context = {};
|
|
28
28
|
for (const o in stack.sort((a, b) => (a._priority || 0) - (b._priority || 0))) {
|
|
29
29
|
for (const k in stack[o]) {
|
|
30
30
|
const key = k;
|
|
31
31
|
const val = stack[o][k];
|
|
32
32
|
if (!k.startsWith("_")) {
|
|
33
33
|
siteConfig[k] = val;
|
|
34
|
-
|
|
34
|
+
if (options2?.debug)
|
|
35
|
+
siteConfig._context[key] = stack[o]._context?.[key] || stack[o]._context || "anonymous";
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|