site-config-stack 3.2.17 → 3.2.19

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
@@ -60,13 +60,15 @@ function createSiteConfigStack(options) {
60
60
  if (typeof val !== "undefined" && val !== "")
61
61
  entry[k] = val;
62
62
  }
63
- let idx;
64
- if (Object.keys(entry).filter((k) => !k.startsWith("_")).length > 0)
65
- idx = stack.push(entry);
63
+ if (Object.keys(entry).filter((k) => !k.startsWith("_")).length === 0) {
64
+ return () => {
65
+ };
66
+ }
67
+ stack.push(entry);
66
68
  return () => {
67
- if (typeof idx !== "undefined") {
68
- stack.splice(idx - 1, 1);
69
- }
69
+ const idx = stack.indexOf(entry);
70
+ if (idx !== -1)
71
+ stack.splice(idx, 1);
70
72
  };
71
73
  }
72
74
  function get(options2) {
@@ -97,7 +99,7 @@ function createSiteConfigStack(options) {
97
99
  };
98
100
  }
99
101
 
100
- function envSiteConfig(env) {
102
+ function envSiteConfig(env = {}) {
101
103
  return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith("NUXT_SITE_") || k.startsWith("NUXT_PUBLIC_SITE_")).map(([k, v]) => [
102
104
  k.replace(/^NUXT_(PUBLIC_)?SITE_/, "").split("_").map((s, i) => i === 0 ? s.toLowerCase() : s[0]?.toUpperCase() + s.slice(1).toLowerCase()).join(""),
103
105
  v
package/dist/index.d.cts CHANGED
@@ -75,7 +75,7 @@ declare function createSiteConfigStack(options?: {
75
75
  debug: boolean;
76
76
  }): SiteConfigStack;
77
77
 
78
- declare function envSiteConfig(env: Record<string, any>): {
78
+ declare function envSiteConfig(env?: Record<string, any>): {
79
79
  [k: string]: any;
80
80
  };
81
81
 
package/dist/index.d.mts CHANGED
@@ -75,7 +75,7 @@ declare function createSiteConfigStack(options?: {
75
75
  debug: boolean;
76
76
  }): SiteConfigStack;
77
77
 
78
- declare function envSiteConfig(env: Record<string, any>): {
78
+ declare function envSiteConfig(env?: Record<string, any>): {
79
79
  [k: string]: any;
80
80
  };
81
81
 
package/dist/index.d.ts CHANGED
@@ -75,7 +75,7 @@ declare function createSiteConfigStack(options?: {
75
75
  debug: boolean;
76
76
  }): SiteConfigStack;
77
77
 
78
- declare function envSiteConfig(env: Record<string, any>): {
78
+ declare function envSiteConfig(env?: Record<string, any>): {
79
79
  [k: string]: any;
80
80
  };
81
81
 
package/dist/index.mjs CHANGED
@@ -58,13 +58,15 @@ function createSiteConfigStack(options) {
58
58
  if (typeof val !== "undefined" && val !== "")
59
59
  entry[k] = val;
60
60
  }
61
- let idx;
62
- if (Object.keys(entry).filter((k) => !k.startsWith("_")).length > 0)
63
- idx = stack.push(entry);
61
+ if (Object.keys(entry).filter((k) => !k.startsWith("_")).length === 0) {
62
+ return () => {
63
+ };
64
+ }
65
+ stack.push(entry);
64
66
  return () => {
65
- if (typeof idx !== "undefined") {
66
- stack.splice(idx - 1, 1);
67
- }
67
+ const idx = stack.indexOf(entry);
68
+ if (idx !== -1)
69
+ stack.splice(idx, 1);
68
70
  };
69
71
  }
70
72
  function get(options2) {
@@ -95,7 +97,7 @@ function createSiteConfigStack(options) {
95
97
  };
96
98
  }
97
99
 
98
- function envSiteConfig(env) {
100
+ function envSiteConfig(env = {}) {
99
101
  return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith("NUXT_SITE_") || k.startsWith("NUXT_PUBLIC_SITE_")).map(([k, v]) => [
100
102
  k.replace(/^NUXT_(PUBLIC_)?SITE_/, "").split("_").map((s, i) => i === 0 ? s.toLowerCase() : s[0]?.toUpperCase() + s.slice(1).toLowerCase()).join(""),
101
103
  v
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "site-config-stack",
3
3
  "type": "module",
4
- "version": "3.2.17",
4
+ "version": "3.2.19",
5
5
  "description": "Shared site configuration utilities.",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -40,10 +40,10 @@
40
40
  "vue": "^3"
41
41
  },
42
42
  "dependencies": {
43
- "ufo": "^1.6.2"
43
+ "ufo": "^1.6.3"
44
44
  },
45
45
  "devDependencies": {
46
- "vue": "^3.5.26"
46
+ "vue": "^3.5.27"
47
47
  },
48
48
  "scripts": {
49
49
  "lint": "eslint . --fix",