site-config-stack 4.2.1 → 4.2.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 +16 -5
- package/dist/index.mjs +16 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -109,12 +109,23 @@ function createSiteConfigStack(options) {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const
|
|
112
|
+
const NUXT_SITE_PREFIX = "NUXT_SITE_";
|
|
113
|
+
const NUXT_PUBLIC_SITE_PREFIX = "NUXT_PUBLIC_SITE_";
|
|
113
114
|
function envSiteConfig(env = {}) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
const config = {};
|
|
116
|
+
for (const key of Object.keys(env)) {
|
|
117
|
+
const prefixLength = key.startsWith(NUXT_SITE_PREFIX) ? NUXT_SITE_PREFIX.length : key.startsWith(NUXT_PUBLIC_SITE_PREFIX) ? NUXT_PUBLIC_SITE_PREFIX.length : 0;
|
|
118
|
+
if (!prefixLength)
|
|
119
|
+
continue;
|
|
120
|
+
const segments = key.slice(prefixLength).split("_");
|
|
121
|
+
let configKey = segments[0].toLowerCase();
|
|
122
|
+
for (let i = 1; i < segments.length; i++) {
|
|
123
|
+
const segment = segments[i];
|
|
124
|
+
configKey += segment[0]?.toUpperCase() + segment.slice(1).toLowerCase();
|
|
125
|
+
}
|
|
126
|
+
config[configKey] = env[key];
|
|
127
|
+
}
|
|
128
|
+
return config;
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
exports.SiteConfigPriority = SiteConfigPriority;
|
package/dist/index.mjs
CHANGED
|
@@ -107,12 +107,23 @@ function createSiteConfigStack(options) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const
|
|
110
|
+
const NUXT_SITE_PREFIX = "NUXT_SITE_";
|
|
111
|
+
const NUXT_PUBLIC_SITE_PREFIX = "NUXT_PUBLIC_SITE_";
|
|
111
112
|
function envSiteConfig(env = {}) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const config = {};
|
|
114
|
+
for (const key of Object.keys(env)) {
|
|
115
|
+
const prefixLength = key.startsWith(NUXT_SITE_PREFIX) ? NUXT_SITE_PREFIX.length : key.startsWith(NUXT_PUBLIC_SITE_PREFIX) ? NUXT_PUBLIC_SITE_PREFIX.length : 0;
|
|
116
|
+
if (!prefixLength)
|
|
117
|
+
continue;
|
|
118
|
+
const segments = key.slice(prefixLength).split("_");
|
|
119
|
+
let configKey = segments[0].toLowerCase();
|
|
120
|
+
for (let i = 1; i < segments.length; i++) {
|
|
121
|
+
const segment = segments[i];
|
|
122
|
+
configKey += segment[0]?.toUpperCase() + segment.slice(1).toLowerCase();
|
|
123
|
+
}
|
|
124
|
+
config[configKey] = env[key];
|
|
125
|
+
}
|
|
126
|
+
return config;
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
export { SiteConfigPriority, createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack };
|