site-config-stack 3.2.21 → 4.0.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 +13 -1
- package/dist/index.d.cts +18 -7
- package/dist/index.d.mts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.mjs +13 -2
- package/dist/urls.cjs +3 -2
- package/dist/urls.d.cts +1 -1
- package/dist/urls.d.mts +1 -1
- package/dist/urls.d.ts +1 -1
- package/dist/urls.mjs +3 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
const ufo = require('ufo');
|
|
4
4
|
const vue = require('vue');
|
|
5
5
|
|
|
6
|
+
const SiteConfigPriority = {
|
|
7
|
+
system: -15,
|
|
8
|
+
vendor: -5,
|
|
9
|
+
nitro: -4,
|
|
10
|
+
config: -3,
|
|
11
|
+
i18n: -2,
|
|
12
|
+
build: -1,
|
|
13
|
+
runtime: 0
|
|
14
|
+
};
|
|
15
|
+
|
|
6
16
|
function normalizeSiteConfig(config) {
|
|
7
17
|
if (typeof config.indexable !== "undefined")
|
|
8
18
|
config.indexable = String(config.indexable) !== "false";
|
|
@@ -99,13 +109,15 @@ function createSiteConfigStack(options) {
|
|
|
99
109
|
};
|
|
100
110
|
}
|
|
101
111
|
|
|
112
|
+
const NUXT_SITE_ENV_RE = /^NUXT_(PUBLIC_)?SITE_/;
|
|
102
113
|
function envSiteConfig(env = {}) {
|
|
103
114
|
return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith("NUXT_SITE_") || k.startsWith("NUXT_PUBLIC_SITE_")).map(([k, v]) => [
|
|
104
|
-
k.replace(
|
|
115
|
+
k.replace(NUXT_SITE_ENV_RE, "").split("_").map((s, i) => i === 0 ? s.toLowerCase() : s[0]?.toUpperCase() + s.slice(1).toLowerCase()).join(""),
|
|
105
116
|
v
|
|
106
117
|
]));
|
|
107
118
|
}
|
|
108
119
|
|
|
120
|
+
exports.SiteConfigPriority = SiteConfigPriority;
|
|
109
121
|
exports.createSiteConfigStack = createSiteConfigStack;
|
|
110
122
|
exports.envSiteConfig = envSiteConfig;
|
|
111
123
|
exports.normalizeSiteConfig = normalizeSiteConfig;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
2
|
|
|
3
|
+
declare const SiteConfigPriority: {
|
|
4
|
+
readonly system: -15;
|
|
5
|
+
readonly vendor: -5;
|
|
6
|
+
readonly nitro: -4;
|
|
7
|
+
readonly config: -3;
|
|
8
|
+
readonly i18n: -2;
|
|
9
|
+
readonly build: -1;
|
|
10
|
+
readonly runtime: 0;
|
|
11
|
+
};
|
|
12
|
+
|
|
3
13
|
interface SiteConfigResolved {
|
|
4
14
|
/**
|
|
5
15
|
* The canonical Site URL.
|
|
@@ -14,8 +24,7 @@ interface SiteConfigResolved {
|
|
|
14
24
|
/**
|
|
15
25
|
* The name of the site.
|
|
16
26
|
*
|
|
17
|
-
* - Build / Prerender: Inferred from CI environment (Netlify)
|
|
18
|
-
* - SSR:
|
|
27
|
+
* - Build / Prerender: Inferred from CI environment (Netlify)
|
|
19
28
|
*
|
|
20
29
|
* Used by: nuxt-schema-org, nuxt-seo-kit
|
|
21
30
|
*/
|
|
@@ -73,11 +82,13 @@ declare function validateSiteConfigStack(stack: SiteConfigStack, options?: {
|
|
|
73
82
|
}): string[];
|
|
74
83
|
declare function createSiteConfigStack(options?: {
|
|
75
84
|
debug: boolean;
|
|
76
|
-
}):
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
}): {
|
|
86
|
+
stack: Partial<SiteConfigInput>[];
|
|
87
|
+
push: (input: SiteConfigInput | SiteConfigResolved) => () => void;
|
|
88
|
+
get: (options?: GetSiteConfigOptions) => SiteConfigResolved;
|
|
80
89
|
};
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
declare function envSiteConfig(env?: Record<string, any>): Record<string, any>;
|
|
92
|
+
|
|
93
|
+
export { SiteConfigPriority, createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack };
|
|
83
94
|
export type { GetSiteConfigOptions, MaybeComputedRef, MaybeComputedRefEntries, SiteConfig, SiteConfigInput, SiteConfigResolved, SiteConfigStack };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
2
|
|
|
3
|
+
declare const SiteConfigPriority: {
|
|
4
|
+
readonly system: -15;
|
|
5
|
+
readonly vendor: -5;
|
|
6
|
+
readonly nitro: -4;
|
|
7
|
+
readonly config: -3;
|
|
8
|
+
readonly i18n: -2;
|
|
9
|
+
readonly build: -1;
|
|
10
|
+
readonly runtime: 0;
|
|
11
|
+
};
|
|
12
|
+
|
|
3
13
|
interface SiteConfigResolved {
|
|
4
14
|
/**
|
|
5
15
|
* The canonical Site URL.
|
|
@@ -14,8 +24,7 @@ interface SiteConfigResolved {
|
|
|
14
24
|
/**
|
|
15
25
|
* The name of the site.
|
|
16
26
|
*
|
|
17
|
-
* - Build / Prerender: Inferred from CI environment (Netlify)
|
|
18
|
-
* - SSR:
|
|
27
|
+
* - Build / Prerender: Inferred from CI environment (Netlify)
|
|
19
28
|
*
|
|
20
29
|
* Used by: nuxt-schema-org, nuxt-seo-kit
|
|
21
30
|
*/
|
|
@@ -73,11 +82,13 @@ declare function validateSiteConfigStack(stack: SiteConfigStack, options?: {
|
|
|
73
82
|
}): string[];
|
|
74
83
|
declare function createSiteConfigStack(options?: {
|
|
75
84
|
debug: boolean;
|
|
76
|
-
}):
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
}): {
|
|
86
|
+
stack: Partial<SiteConfigInput>[];
|
|
87
|
+
push: (input: SiteConfigInput | SiteConfigResolved) => () => void;
|
|
88
|
+
get: (options?: GetSiteConfigOptions) => SiteConfigResolved;
|
|
80
89
|
};
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
declare function envSiteConfig(env?: Record<string, any>): Record<string, any>;
|
|
92
|
+
|
|
93
|
+
export { SiteConfigPriority, createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack };
|
|
83
94
|
export type { GetSiteConfigOptions, MaybeComputedRef, MaybeComputedRefEntries, SiteConfig, SiteConfigInput, SiteConfigResolved, SiteConfigStack };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
2
|
|
|
3
|
+
declare const SiteConfigPriority: {
|
|
4
|
+
readonly system: -15;
|
|
5
|
+
readonly vendor: -5;
|
|
6
|
+
readonly nitro: -4;
|
|
7
|
+
readonly config: -3;
|
|
8
|
+
readonly i18n: -2;
|
|
9
|
+
readonly build: -1;
|
|
10
|
+
readonly runtime: 0;
|
|
11
|
+
};
|
|
12
|
+
|
|
3
13
|
interface SiteConfigResolved {
|
|
4
14
|
/**
|
|
5
15
|
* The canonical Site URL.
|
|
@@ -14,8 +24,7 @@ interface SiteConfigResolved {
|
|
|
14
24
|
/**
|
|
15
25
|
* The name of the site.
|
|
16
26
|
*
|
|
17
|
-
* - Build / Prerender: Inferred from CI environment (Netlify)
|
|
18
|
-
* - SSR:
|
|
27
|
+
* - Build / Prerender: Inferred from CI environment (Netlify)
|
|
19
28
|
*
|
|
20
29
|
* Used by: nuxt-schema-org, nuxt-seo-kit
|
|
21
30
|
*/
|
|
@@ -73,11 +82,13 @@ declare function validateSiteConfigStack(stack: SiteConfigStack, options?: {
|
|
|
73
82
|
}): string[];
|
|
74
83
|
declare function createSiteConfigStack(options?: {
|
|
75
84
|
debug: boolean;
|
|
76
|
-
}):
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
}): {
|
|
86
|
+
stack: Partial<SiteConfigInput>[];
|
|
87
|
+
push: (input: SiteConfigInput | SiteConfigResolved) => () => void;
|
|
88
|
+
get: (options?: GetSiteConfigOptions) => SiteConfigResolved;
|
|
80
89
|
};
|
|
81
90
|
|
|
82
|
-
|
|
91
|
+
declare function envSiteConfig(env?: Record<string, any>): Record<string, any>;
|
|
92
|
+
|
|
93
|
+
export { SiteConfigPriority, createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack };
|
|
83
94
|
export type { GetSiteConfigOptions, MaybeComputedRef, MaybeComputedRefEntries, SiteConfig, SiteConfigInput, SiteConfigResolved, SiteConfigStack };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { hasProtocol, withHttps, parseURL, parseHost, getQuery } from 'ufo';
|
|
2
2
|
import { toValue } from 'vue';
|
|
3
3
|
|
|
4
|
+
const SiteConfigPriority = {
|
|
5
|
+
system: -15,
|
|
6
|
+
vendor: -5,
|
|
7
|
+
nitro: -4,
|
|
8
|
+
config: -3,
|
|
9
|
+
i18n: -2,
|
|
10
|
+
build: -1,
|
|
11
|
+
runtime: 0
|
|
12
|
+
};
|
|
13
|
+
|
|
4
14
|
function normalizeSiteConfig(config) {
|
|
5
15
|
if (typeof config.indexable !== "undefined")
|
|
6
16
|
config.indexable = String(config.indexable) !== "false";
|
|
@@ -97,11 +107,12 @@ function createSiteConfigStack(options) {
|
|
|
97
107
|
};
|
|
98
108
|
}
|
|
99
109
|
|
|
110
|
+
const NUXT_SITE_ENV_RE = /^NUXT_(PUBLIC_)?SITE_/;
|
|
100
111
|
function envSiteConfig(env = {}) {
|
|
101
112
|
return Object.fromEntries(Object.entries(env).filter(([k]) => k.startsWith("NUXT_SITE_") || k.startsWith("NUXT_PUBLIC_SITE_")).map(([k, v]) => [
|
|
102
|
-
k.replace(
|
|
113
|
+
k.replace(NUXT_SITE_ENV_RE, "").split("_").map((s, i) => i === 0 ? s.toLowerCase() : s[0]?.toUpperCase() + s.slice(1).toLowerCase()).join(""),
|
|
103
114
|
v
|
|
104
115
|
]));
|
|
105
116
|
}
|
|
106
117
|
|
|
107
|
-
export { createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack };
|
|
118
|
+
export { SiteConfigPriority, createSiteConfigStack, envSiteConfig, normalizeSiteConfig, validateSiteConfigStack };
|
package/dist/urls.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const ufo = require('ufo');
|
|
4
4
|
|
|
5
|
+
const FILE_EXT_RE = /\.[0-9a-z]+$/i;
|
|
5
6
|
function resolveSitePath(pathOrUrl, options) {
|
|
6
7
|
let path = pathOrUrl;
|
|
7
8
|
if (ufo.hasProtocol(pathOrUrl, { strict: false, acceptRelative: true })) {
|
|
@@ -134,8 +135,8 @@ const fileExtensions = [
|
|
|
134
135
|
];
|
|
135
136
|
function isPathFile(path) {
|
|
136
137
|
const lastSegment = path.split("/").pop();
|
|
137
|
-
const ext = (lastSegment || path).match(
|
|
138
|
-
return ext && fileExtensions.includes(ext.replace(".", ""));
|
|
138
|
+
const ext = (lastSegment || path).match(FILE_EXT_RE)?.[0];
|
|
139
|
+
return !!(ext && fileExtensions.includes(ext.replace(".", "")));
|
|
139
140
|
}
|
|
140
141
|
function fixSlashes(trailingSlash, pathOrUrl) {
|
|
141
142
|
const $url = ufo.parseURL(pathOrUrl);
|
package/dist/urls.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ declare function resolveSitePath(pathOrUrl: string, options: {
|
|
|
5
5
|
absolute?: boolean;
|
|
6
6
|
withBase?: boolean;
|
|
7
7
|
}): string;
|
|
8
|
-
declare function isPathFile(path: string): boolean
|
|
8
|
+
declare function isPathFile(path: string): boolean;
|
|
9
9
|
declare function fixSlashes(trailingSlash: boolean | undefined, pathOrUrl: string): string;
|
|
10
10
|
|
|
11
11
|
export { fixSlashes, isPathFile, resolveSitePath };
|
package/dist/urls.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ declare function resolveSitePath(pathOrUrl: string, options: {
|
|
|
5
5
|
absolute?: boolean;
|
|
6
6
|
withBase?: boolean;
|
|
7
7
|
}): string;
|
|
8
|
-
declare function isPathFile(path: string): boolean
|
|
8
|
+
declare function isPathFile(path: string): boolean;
|
|
9
9
|
declare function fixSlashes(trailingSlash: boolean | undefined, pathOrUrl: string): string;
|
|
10
10
|
|
|
11
11
|
export { fixSlashes, isPathFile, resolveSitePath };
|
package/dist/urls.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare function resolveSitePath(pathOrUrl: string, options: {
|
|
|
5
5
|
absolute?: boolean;
|
|
6
6
|
withBase?: boolean;
|
|
7
7
|
}): string;
|
|
8
|
-
declare function isPathFile(path: string): boolean
|
|
8
|
+
declare function isPathFile(path: string): boolean;
|
|
9
9
|
declare function fixSlashes(trailingSlash: boolean | undefined, pathOrUrl: string): string;
|
|
10
10
|
|
|
11
11
|
export { fixSlashes, isPathFile, resolveSitePath };
|
package/dist/urls.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseURL, withTrailingSlash, withoutTrailingSlash, hasProtocol, withLeadingSlash, withBase } from 'ufo';
|
|
2
2
|
|
|
3
|
+
const FILE_EXT_RE = /\.[0-9a-z]+$/i;
|
|
3
4
|
function resolveSitePath(pathOrUrl, options) {
|
|
4
5
|
let path = pathOrUrl;
|
|
5
6
|
if (hasProtocol(pathOrUrl, { strict: false, acceptRelative: true })) {
|
|
@@ -132,8 +133,8 @@ const fileExtensions = [
|
|
|
132
133
|
];
|
|
133
134
|
function isPathFile(path) {
|
|
134
135
|
const lastSegment = path.split("/").pop();
|
|
135
|
-
const ext = (lastSegment || path).match(
|
|
136
|
-
return ext && fileExtensions.includes(ext.replace(".", ""));
|
|
136
|
+
const ext = (lastSegment || path).match(FILE_EXT_RE)?.[0];
|
|
137
|
+
return !!(ext && fileExtensions.includes(ext.replace(".", "")));
|
|
137
138
|
}
|
|
138
139
|
function fixSlashes(trailingSlash, pathOrUrl) {
|
|
139
140
|
const $url = parseURL(pathOrUrl);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "site-config-stack",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.1",
|
|
5
5
|
"description": "Shared site configuration utilities.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"urls.d.ts"
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"vue": "^3"
|
|
40
|
+
"vue": "^3.5.30"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"ufo": "^1.6.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"vue": "^3.5.
|
|
46
|
+
"vue": "^3.5.30"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"lint": "eslint . --fix",
|