site-config-stack 1.5.0 → 1.5.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/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
- _context: {}
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
- siteConfig._context[key] = stack[o]._context?.[key] || stack[o]._context || "anonymous";
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
@@ -83,10 +83,13 @@ type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_cont
83
83
  _priority?: number;
84
84
  indexable?: MaybeComputedRef<string | boolean>;
85
85
  };
86
+ interface GetSiteConfigOptions {
87
+ debug?: boolean;
88
+ }
86
89
  interface SiteConfigStack {
87
90
  stack: Partial<SiteConfigInput>[];
88
91
  push: (config: SiteConfigInput) => void;
89
- get: () => SiteConfig;
92
+ get: (options?: GetSiteConfigOptions) => SiteConfig;
90
93
  }
91
94
 
92
95
  declare function createSiteConfigStack(options?: {
@@ -103,4 +106,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
103
106
  }): string;
104
107
  declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
105
108
 
106
- 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
@@ -83,10 +83,13 @@ type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_cont
83
83
  _priority?: number;
84
84
  indexable?: MaybeComputedRef<string | boolean>;
85
85
  };
86
+ interface GetSiteConfigOptions {
87
+ debug?: boolean;
88
+ }
86
89
  interface SiteConfigStack {
87
90
  stack: Partial<SiteConfigInput>[];
88
91
  push: (config: SiteConfigInput) => void;
89
- get: () => SiteConfig;
92
+ get: (options?: GetSiteConfigOptions) => SiteConfig;
90
93
  }
91
94
 
92
95
  declare function createSiteConfigStack(options?: {
@@ -103,4 +106,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
103
106
  }): string;
104
107
  declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
105
108
 
106
- 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
@@ -83,10 +83,13 @@ type SiteConfigInput = Omit<MaybeComputedRefEntries<Partial<SiteConfig>>, '_cont
83
83
  _priority?: number;
84
84
  indexable?: MaybeComputedRef<string | boolean>;
85
85
  };
86
+ interface GetSiteConfigOptions {
87
+ debug?: boolean;
88
+ }
86
89
  interface SiteConfigStack {
87
90
  stack: Partial<SiteConfigInput>[];
88
91
  push: (config: SiteConfigInput) => void;
89
- get: () => SiteConfig;
92
+ get: (options?: GetSiteConfigOptions) => SiteConfig;
90
93
  }
91
94
 
92
95
  declare function createSiteConfigStack(options?: {
@@ -103,4 +106,4 @@ declare function resolveSitePath(pathOrUrl: string, options: {
103
106
  }): string;
104
107
  declare function fixSlashes(trailingSlash: boolean, pathOrUrl: string): string;
105
108
 
106
- 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
- _context: {}
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
- siteConfig._context[key] = stack[o]._context?.[key] || stack[o]._context || "anonymous";
34
+ if (options2?.debug)
35
+ siteConfig._context[key] = stack[o]._context?.[key] || stack[o]._context || "anonymous";
35
36
  }
36
37
  }
37
38
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "site-config-stack",
3
3
  "type": "module",
4
- "version": "1.5.0",
4
+ "version": "1.5.2",
5
5
  "description": "Shared site configuration utilities.",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",