nuxt-site-config-kit 3.2.20 → 4.0.0
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 +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -3
- package/dist/shared/{nuxt-site-config-kit.Bk-djAYB.mjs → nuxt-site-config-kit.B3lHsM_-.mjs} +4 -28
- package/dist/shared/{nuxt-site-config-kit.C9rm3WhC.cjs → nuxt-site-config-kit.CNhfnq5e.cjs} +3 -27
- package/dist/urls.cjs +1 -2
- package/dist/urls.mjs +1 -2
- package/dist/util.cjs +22 -14
- package/dist/util.mjs +23 -15
- package/package.json +5 -6
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const urls = require('./shared/nuxt-site-config-kit.
|
|
3
|
+
const urls = require('./shared/nuxt-site-config-kit.CNhfnq5e.cjs');
|
|
4
4
|
const util = require('./util.cjs');
|
|
5
|
+
const siteConfigStack = require('site-config-stack');
|
|
5
6
|
require('@nuxt/kit');
|
|
6
7
|
require('site-config-stack/urls');
|
|
7
8
|
require('std-env');
|
|
8
|
-
require('pkg-types');
|
|
9
|
-
require('site-config-stack');
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
|
|
@@ -20,3 +19,4 @@ exports.withSiteTrailingSlash = urls.withSiteTrailingSlash;
|
|
|
20
19
|
exports.withSiteUrl = urls.withSiteUrl;
|
|
21
20
|
exports.getNitroOrigin = util.getNitroOrigin;
|
|
22
21
|
exports.useNitroOrigin = util.useNitroOrigin;
|
|
22
|
+
exports.SiteConfigPriority = siteConfigStack.SiteConfigPriority;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Nuxt } from '@nuxt/schema';
|
|
2
2
|
import { SiteConfigStack, SiteConfigInput, SiteConfigResolved } from 'site-config-stack';
|
|
3
|
-
export
|
|
3
|
+
export { GetSiteConfigOptions, MaybeComputedRef, MaybeComputedRefEntries, SiteConfig, SiteConfigInput, SiteConfigPriority, SiteConfigResolved, SiteConfigStack } from 'site-config-stack';
|
|
4
4
|
export { createSitePathResolver, withSiteTrailingSlash, withSiteUrl } from './urls.cjs';
|
|
5
5
|
export { NitroOriginContext, getNitroOrigin, useNitroOrigin } from './util.cjs';
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Nuxt } from '@nuxt/schema';
|
|
2
2
|
import { SiteConfigStack, SiteConfigInput, SiteConfigResolved } from 'site-config-stack';
|
|
3
|
-
export
|
|
3
|
+
export { GetSiteConfigOptions, MaybeComputedRef, MaybeComputedRefEntries, SiteConfig, SiteConfigInput, SiteConfigPriority, SiteConfigResolved, SiteConfigStack } from 'site-config-stack';
|
|
4
4
|
export { createSitePathResolver, withSiteTrailingSlash, withSiteUrl } from './urls.mjs';
|
|
5
5
|
export { NitroOriginContext, getNitroOrigin, useNitroOrigin } from './util.mjs';
|
|
6
6
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Nuxt } from '@nuxt/schema';
|
|
2
2
|
import { SiteConfigStack, SiteConfigInput, SiteConfigResolved } from 'site-config-stack';
|
|
3
|
-
export
|
|
3
|
+
export { GetSiteConfigOptions, MaybeComputedRef, MaybeComputedRefEntries, SiteConfig, SiteConfigInput, SiteConfigPriority, SiteConfigResolved, SiteConfigStack } from 'site-config-stack';
|
|
4
4
|
export { createSitePathResolver, withSiteTrailingSlash, withSiteUrl } from './urls.js';
|
|
5
5
|
export { NitroOriginContext, getNitroOrigin, useNitroOrigin } from './util.js';
|
|
6
6
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { c as createSitePathResolver, g as getSiteConfigStack, i as initSiteConfig, a as installNuxtSiteConfig, u as updateSiteConfig, b as useSiteConfig, w as withSiteTrailingSlash, d as withSiteUrl } from './shared/nuxt-site-config-kit.
|
|
1
|
+
export { c as createSitePathResolver, g as getSiteConfigStack, i as initSiteConfig, a as installNuxtSiteConfig, u as updateSiteConfig, b as useSiteConfig, w as withSiteTrailingSlash, d as withSiteUrl } from './shared/nuxt-site-config-kit.B3lHsM_-.mjs';
|
|
2
2
|
export { getNitroOrigin, useNitroOrigin } from './util.mjs';
|
|
3
|
+
export { SiteConfigPriority } from 'site-config-stack';
|
|
3
4
|
import '@nuxt/kit';
|
|
4
5
|
import 'site-config-stack/urls';
|
|
5
6
|
import 'std-env';
|
|
6
|
-
import 'pkg-types';
|
|
7
|
-
import 'site-config-stack';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { tryUseNuxt, installModule, resolvePath, useNuxt } from '@nuxt/kit';
|
|
2
2
|
import { resolveSitePath, fixSlashes } from 'site-config-stack/urls';
|
|
3
3
|
import { env } from 'std-env';
|
|
4
|
-
import {
|
|
5
|
-
import { createSiteConfigStack, envSiteConfig } from 'site-config-stack';
|
|
4
|
+
import { createSiteConfigStack, SiteConfigPriority, envSiteConfig } from 'site-config-stack';
|
|
6
5
|
import { getNitroOrigin } from '../util.mjs';
|
|
7
6
|
|
|
8
7
|
async function initSiteConfig(nuxt = tryUseNuxt()) {
|
|
@@ -12,27 +11,14 @@ async function initSiteConfig(nuxt = tryUseNuxt()) {
|
|
|
12
11
|
if (siteConfig)
|
|
13
12
|
return siteConfig;
|
|
14
13
|
siteConfig = createSiteConfigStack();
|
|
15
|
-
const rootDir = nuxt?.options.rootDir || process.cwd?.() || false;
|
|
16
14
|
siteConfig.push({
|
|
17
15
|
_context: "system",
|
|
18
|
-
_priority:
|
|
19
|
-
name: rootDir ? rootDir.split("/").pop() : void 0,
|
|
16
|
+
_priority: SiteConfigPriority.system,
|
|
20
17
|
env: process.env.NODE_ENV
|
|
21
18
|
});
|
|
22
|
-
if (rootDir) {
|
|
23
|
-
const pkgJson = await readPackageJSON(rootDir);
|
|
24
|
-
if (pkgJson) {
|
|
25
|
-
siteConfig.push({
|
|
26
|
-
_context: "package.json",
|
|
27
|
-
_priority: -10,
|
|
28
|
-
name: pkgJson.name,
|
|
29
|
-
description: pkgJson.description
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
19
|
siteConfig.push({
|
|
34
20
|
_context: "vendorEnv",
|
|
35
|
-
_priority:
|
|
21
|
+
_priority: SiteConfigPriority.vendor,
|
|
36
22
|
url: [
|
|
37
23
|
// vercel
|
|
38
24
|
process.env.VERCEL_URL,
|
|
@@ -49,19 +35,9 @@ async function initSiteConfig(nuxt = tryUseNuxt()) {
|
|
|
49
35
|
process.env.SITE_NAME
|
|
50
36
|
].find((k) => Boolean(k))
|
|
51
37
|
});
|
|
52
|
-
const runtimeConfig = nuxt.options.runtimeConfig;
|
|
53
|
-
const runtimeConfigEnvKeys = [
|
|
54
|
-
...Object.entries(runtimeConfig.site || {}).filter(([k]) => k.startsWith("site")).map(([k, v]) => [k.replace(/^site/, ""), v]),
|
|
55
|
-
...Object.entries([...Object.entries(runtimeConfig), ...Object.entries(runtimeConfig.public)]).filter(([k]) => k.startsWith("site")).map(([k, v]) => [k.replace(/^site/, ""), v])
|
|
56
|
-
];
|
|
57
|
-
siteConfig.push({
|
|
58
|
-
_priority: -2,
|
|
59
|
-
_context: "legacyRuntimeConfig",
|
|
60
|
-
...Object.fromEntries(runtimeConfigEnvKeys)
|
|
61
|
-
});
|
|
62
38
|
siteConfig.push({
|
|
63
39
|
_context: "buildEnv",
|
|
64
|
-
_priority:
|
|
40
|
+
_priority: SiteConfigPriority.build,
|
|
65
41
|
...envSiteConfig(process.env || {})
|
|
66
42
|
});
|
|
67
43
|
nuxt._siteConfig = siteConfig;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const kit = require('@nuxt/kit');
|
|
4
4
|
const urls = require('site-config-stack/urls');
|
|
5
5
|
const stdEnv = require('std-env');
|
|
6
|
-
const pkgTypes = require('pkg-types');
|
|
7
6
|
const siteConfigStack = require('site-config-stack');
|
|
8
7
|
const util = require('../util.cjs');
|
|
9
8
|
|
|
@@ -14,27 +13,14 @@ async function initSiteConfig(nuxt = kit.tryUseNuxt()) {
|
|
|
14
13
|
if (siteConfig)
|
|
15
14
|
return siteConfig;
|
|
16
15
|
siteConfig = siteConfigStack.createSiteConfigStack();
|
|
17
|
-
const rootDir = nuxt?.options.rootDir || process.cwd?.() || false;
|
|
18
16
|
siteConfig.push({
|
|
19
17
|
_context: "system",
|
|
20
|
-
_priority:
|
|
21
|
-
name: rootDir ? rootDir.split("/").pop() : void 0,
|
|
18
|
+
_priority: siteConfigStack.SiteConfigPriority.system,
|
|
22
19
|
env: process.env.NODE_ENV
|
|
23
20
|
});
|
|
24
|
-
if (rootDir) {
|
|
25
|
-
const pkgJson = await pkgTypes.readPackageJSON(rootDir);
|
|
26
|
-
if (pkgJson) {
|
|
27
|
-
siteConfig.push({
|
|
28
|
-
_context: "package.json",
|
|
29
|
-
_priority: -10,
|
|
30
|
-
name: pkgJson.name,
|
|
31
|
-
description: pkgJson.description
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
21
|
siteConfig.push({
|
|
36
22
|
_context: "vendorEnv",
|
|
37
|
-
_priority:
|
|
23
|
+
_priority: siteConfigStack.SiteConfigPriority.vendor,
|
|
38
24
|
url: [
|
|
39
25
|
// vercel
|
|
40
26
|
process.env.VERCEL_URL,
|
|
@@ -51,19 +37,9 @@ async function initSiteConfig(nuxt = kit.tryUseNuxt()) {
|
|
|
51
37
|
process.env.SITE_NAME
|
|
52
38
|
].find((k) => Boolean(k))
|
|
53
39
|
});
|
|
54
|
-
const runtimeConfig = nuxt.options.runtimeConfig;
|
|
55
|
-
const runtimeConfigEnvKeys = [
|
|
56
|
-
...Object.entries(runtimeConfig.site || {}).filter(([k]) => k.startsWith("site")).map(([k, v]) => [k.replace(/^site/, ""), v]),
|
|
57
|
-
...Object.entries([...Object.entries(runtimeConfig), ...Object.entries(runtimeConfig.public)]).filter(([k]) => k.startsWith("site")).map(([k, v]) => [k.replace(/^site/, ""), v])
|
|
58
|
-
];
|
|
59
|
-
siteConfig.push({
|
|
60
|
-
_priority: -2,
|
|
61
|
-
_context: "legacyRuntimeConfig",
|
|
62
|
-
...Object.fromEntries(runtimeConfigEnvKeys)
|
|
63
|
-
});
|
|
64
40
|
siteConfig.push({
|
|
65
41
|
_context: "buildEnv",
|
|
66
|
-
_priority:
|
|
42
|
+
_priority: siteConfigStack.SiteConfigPriority.build,
|
|
67
43
|
...siteConfigStack.envSiteConfig(process.env || {})
|
|
68
44
|
});
|
|
69
45
|
nuxt._siteConfig = siteConfig;
|
package/dist/urls.cjs
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
require('@nuxt/kit');
|
|
4
4
|
require('site-config-stack/urls');
|
|
5
5
|
require('std-env');
|
|
6
|
-
const urls = require('./shared/nuxt-site-config-kit.
|
|
6
|
+
const urls = require('./shared/nuxt-site-config-kit.CNhfnq5e.cjs');
|
|
7
7
|
require('./util.cjs');
|
|
8
|
-
require('pkg-types');
|
|
9
8
|
require('site-config-stack');
|
|
10
9
|
|
|
11
10
|
|
package/dist/urls.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import '@nuxt/kit';
|
|
2
2
|
import 'site-config-stack/urls';
|
|
3
3
|
import 'std-env';
|
|
4
|
-
export { c as createSitePathResolver, w as withSiteTrailingSlash, d as withSiteUrl } from './shared/nuxt-site-config-kit.
|
|
4
|
+
export { c as createSitePathResolver, w as withSiteTrailingSlash, d as withSiteUrl } from './shared/nuxt-site-config-kit.B3lHsM_-.mjs';
|
|
5
5
|
import './util.mjs';
|
|
6
|
-
import 'pkg-types';
|
|
7
6
|
import 'site-config-stack';
|
package/dist/util.cjs
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const stdEnv = require('std-env');
|
|
4
4
|
|
|
5
|
+
const PROTOCOL_RE = /^https?:\/\//;
|
|
6
|
+
const TRAILING_SLASH_RE = /\/$/;
|
|
5
7
|
function isLocalhostHost(host) {
|
|
6
|
-
if (!host || host.startsWith("localhost") || host.startsWith("127."))
|
|
8
|
+
if (!host || host.startsWith("localhost") || host.startsWith("127.") || host.startsWith("0.0.0.0"))
|
|
7
9
|
return true;
|
|
8
10
|
const hostname = host.startsWith("[") ? host.slice(0, host.indexOf("]") + 1) : host;
|
|
9
|
-
return hostname === "[::1]" || hostname === "::1";
|
|
11
|
+
return hostname === "[::1]" || hostname === "::1" || hostname === "[::]" || hostname === "::";
|
|
10
12
|
}
|
|
11
13
|
function extractHostname(host) {
|
|
12
14
|
if (host.startsWith("[")) {
|
|
@@ -21,7 +23,12 @@ function splitHostPort(host) {
|
|
|
21
23
|
const close = host.indexOf("]");
|
|
22
24
|
const hostname = close !== -1 ? host.slice(0, close + 1) : host;
|
|
23
25
|
const port = close !== -1 && host[close + 1] === ":" ? host.slice(close + 2) : "";
|
|
24
|
-
|
|
26
|
+
const normalized = hostname === "[::1]" || hostname === "[::]" ? "localhost" : hostname;
|
|
27
|
+
return { host: normalized, port };
|
|
28
|
+
}
|
|
29
|
+
if (host === "0.0.0.0" || host.startsWith("0.0.0.0:")) {
|
|
30
|
+
const i = host.indexOf(":");
|
|
31
|
+
return { host: "localhost", port: i !== -1 ? host.slice(i + 1) : "" };
|
|
25
32
|
}
|
|
26
33
|
const colonCount = host.split(":").length - 1;
|
|
27
34
|
if (colonCount === 1) {
|
|
@@ -29,22 +36,23 @@ function splitHostPort(host) {
|
|
|
29
36
|
return { host: host.slice(0, i), port: host.slice(i + 1) };
|
|
30
37
|
}
|
|
31
38
|
if (colonCount > 1) {
|
|
32
|
-
|
|
39
|
+
const normalized = host === "::1" || host === "::" ? "localhost" : `[${host}]`;
|
|
40
|
+
return { host: normalized, port: "" };
|
|
33
41
|
}
|
|
34
42
|
return { host, port: "" };
|
|
35
43
|
}
|
|
36
44
|
function getNitroOrigin(ctx = {}) {
|
|
37
45
|
const isDev = ctx.isDev ?? stdEnv.isDevelopment;
|
|
38
|
-
const isPrerender = ctx.isPrerender ?? !!
|
|
46
|
+
const isPrerender = ctx.isPrerender ?? !!process.env.prerender;
|
|
39
47
|
let host = "";
|
|
40
48
|
let port = "";
|
|
41
|
-
let protocol =
|
|
49
|
+
let protocol = process.env.NITRO_SSL_CERT && process.env.NITRO_SSL_KEY ? "https" : "http";
|
|
42
50
|
if (isDev || isPrerender) {
|
|
43
|
-
const devEnv =
|
|
51
|
+
const devEnv = process.env.__NUXT_DEV__ || process.env.NUXT_VITE_NODE_OPTIONS;
|
|
44
52
|
if (devEnv) {
|
|
45
53
|
const parsed = JSON.parse(devEnv);
|
|
46
54
|
const origin = parsed.proxy?.url || parsed.baseURL?.replace("/__nuxt_vite_node__", "");
|
|
47
|
-
host = origin.replace(
|
|
55
|
+
host = origin.replace(PROTOCOL_RE, "").replace(TRAILING_SLASH_RE, "");
|
|
48
56
|
protocol = origin.startsWith("https") ? "https" : "http";
|
|
49
57
|
}
|
|
50
58
|
}
|
|
@@ -60,20 +68,20 @@ function getNitroOrigin(ctx = {}) {
|
|
|
60
68
|
protocol = ctx.requestProtocol || protocol;
|
|
61
69
|
}
|
|
62
70
|
if (!host) {
|
|
63
|
-
host =
|
|
71
|
+
host = process.env.NITRO_HOST || process.env.HOST || "";
|
|
64
72
|
if (isDev)
|
|
65
|
-
port =
|
|
73
|
+
port = process.env.NITRO_PORT || process.env.PORT || "3000";
|
|
66
74
|
}
|
|
67
75
|
const split = splitHostPort(host);
|
|
68
76
|
host = split.host;
|
|
69
77
|
if (split.port)
|
|
70
78
|
port = split.port;
|
|
71
|
-
host =
|
|
72
|
-
port =
|
|
79
|
+
host = process.env.NUXT_SITE_HOST_OVERRIDE || host;
|
|
80
|
+
port = process.env.NUXT_SITE_PORT_OVERRIDE || port;
|
|
73
81
|
if (host.startsWith("http://") || host.startsWith("https://")) {
|
|
74
82
|
protocol = host.startsWith("https://") ? "https" : "http";
|
|
75
|
-
host = host.replace(
|
|
76
|
-
} else if (!host || !isLocalhostHost(host)) {
|
|
83
|
+
host = host.replace(PROTOCOL_RE, "");
|
|
84
|
+
} else if (!isDev && (!host || !isLocalhostHost(host))) {
|
|
77
85
|
protocol = "https";
|
|
78
86
|
}
|
|
79
87
|
return `${protocol}://${host}${port ? `:${port}` : ""}/`;
|
package/dist/util.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { isDevelopment
|
|
1
|
+
import { isDevelopment } from 'std-env';
|
|
2
2
|
|
|
3
|
+
const PROTOCOL_RE = /^https?:\/\//;
|
|
4
|
+
const TRAILING_SLASH_RE = /\/$/;
|
|
3
5
|
function isLocalhostHost(host) {
|
|
4
|
-
if (!host || host.startsWith("localhost") || host.startsWith("127."))
|
|
6
|
+
if (!host || host.startsWith("localhost") || host.startsWith("127.") || host.startsWith("0.0.0.0"))
|
|
5
7
|
return true;
|
|
6
8
|
const hostname = host.startsWith("[") ? host.slice(0, host.indexOf("]") + 1) : host;
|
|
7
|
-
return hostname === "[::1]" || hostname === "::1";
|
|
9
|
+
return hostname === "[::1]" || hostname === "::1" || hostname === "[::]" || hostname === "::";
|
|
8
10
|
}
|
|
9
11
|
function extractHostname(host) {
|
|
10
12
|
if (host.startsWith("[")) {
|
|
@@ -19,7 +21,12 @@ function splitHostPort(host) {
|
|
|
19
21
|
const close = host.indexOf("]");
|
|
20
22
|
const hostname = close !== -1 ? host.slice(0, close + 1) : host;
|
|
21
23
|
const port = close !== -1 && host[close + 1] === ":" ? host.slice(close + 2) : "";
|
|
22
|
-
|
|
24
|
+
const normalized = hostname === "[::1]" || hostname === "[::]" ? "localhost" : hostname;
|
|
25
|
+
return { host: normalized, port };
|
|
26
|
+
}
|
|
27
|
+
if (host === "0.0.0.0" || host.startsWith("0.0.0.0:")) {
|
|
28
|
+
const i = host.indexOf(":");
|
|
29
|
+
return { host: "localhost", port: i !== -1 ? host.slice(i + 1) : "" };
|
|
23
30
|
}
|
|
24
31
|
const colonCount = host.split(":").length - 1;
|
|
25
32
|
if (colonCount === 1) {
|
|
@@ -27,22 +34,23 @@ function splitHostPort(host) {
|
|
|
27
34
|
return { host: host.slice(0, i), port: host.slice(i + 1) };
|
|
28
35
|
}
|
|
29
36
|
if (colonCount > 1) {
|
|
30
|
-
|
|
37
|
+
const normalized = host === "::1" || host === "::" ? "localhost" : `[${host}]`;
|
|
38
|
+
return { host: normalized, port: "" };
|
|
31
39
|
}
|
|
32
40
|
return { host, port: "" };
|
|
33
41
|
}
|
|
34
42
|
function getNitroOrigin(ctx = {}) {
|
|
35
43
|
const isDev = ctx.isDev ?? isDevelopment;
|
|
36
|
-
const isPrerender = ctx.isPrerender ?? !!env.prerender;
|
|
44
|
+
const isPrerender = ctx.isPrerender ?? !!process.env.prerender;
|
|
37
45
|
let host = "";
|
|
38
46
|
let port = "";
|
|
39
|
-
let protocol = env.NITRO_SSL_CERT && env.NITRO_SSL_KEY ? "https" : "http";
|
|
47
|
+
let protocol = process.env.NITRO_SSL_CERT && process.env.NITRO_SSL_KEY ? "https" : "http";
|
|
40
48
|
if (isDev || isPrerender) {
|
|
41
|
-
const devEnv = env.__NUXT_DEV__ || env.NUXT_VITE_NODE_OPTIONS;
|
|
49
|
+
const devEnv = process.env.__NUXT_DEV__ || process.env.NUXT_VITE_NODE_OPTIONS;
|
|
42
50
|
if (devEnv) {
|
|
43
51
|
const parsed = JSON.parse(devEnv);
|
|
44
52
|
const origin = parsed.proxy?.url || parsed.baseURL?.replace("/__nuxt_vite_node__", "");
|
|
45
|
-
host = origin.replace(
|
|
53
|
+
host = origin.replace(PROTOCOL_RE, "").replace(TRAILING_SLASH_RE, "");
|
|
46
54
|
protocol = origin.startsWith("https") ? "https" : "http";
|
|
47
55
|
}
|
|
48
56
|
}
|
|
@@ -58,20 +66,20 @@ function getNitroOrigin(ctx = {}) {
|
|
|
58
66
|
protocol = ctx.requestProtocol || protocol;
|
|
59
67
|
}
|
|
60
68
|
if (!host) {
|
|
61
|
-
host = env.NITRO_HOST || env.HOST || "";
|
|
69
|
+
host = process.env.NITRO_HOST || process.env.HOST || "";
|
|
62
70
|
if (isDev)
|
|
63
|
-
port = env.NITRO_PORT || env.PORT || "3000";
|
|
71
|
+
port = process.env.NITRO_PORT || process.env.PORT || "3000";
|
|
64
72
|
}
|
|
65
73
|
const split = splitHostPort(host);
|
|
66
74
|
host = split.host;
|
|
67
75
|
if (split.port)
|
|
68
76
|
port = split.port;
|
|
69
|
-
host = env.NUXT_SITE_HOST_OVERRIDE || host;
|
|
70
|
-
port = env.NUXT_SITE_PORT_OVERRIDE || port;
|
|
77
|
+
host = process.env.NUXT_SITE_HOST_OVERRIDE || host;
|
|
78
|
+
port = process.env.NUXT_SITE_PORT_OVERRIDE || port;
|
|
71
79
|
if (host.startsWith("http://") || host.startsWith("https://")) {
|
|
72
80
|
protocol = host.startsWith("https://") ? "https" : "http";
|
|
73
|
-
host = host.replace(
|
|
74
|
-
} else if (!host || !isLocalhostHost(host)) {
|
|
81
|
+
host = host.replace(PROTOCOL_RE, "");
|
|
82
|
+
} else if (!isDev && (!host || !isLocalhostHost(host))) {
|
|
75
83
|
protocol = "https";
|
|
76
84
|
}
|
|
77
85
|
return `${protocol}://${host}${port ? `:${port}` : ""}/`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-site-config-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"description": "Shared site configuration build-time utilities for Nuxt 3 modules.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -42,14 +42,13 @@
|
|
|
42
42
|
"util.d.ts"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@nuxt/kit": "^4.
|
|
46
|
-
"
|
|
47
|
-
"std-env": "^3.10.0",
|
|
45
|
+
"@nuxt/kit": "^4.4.2",
|
|
46
|
+
"std-env": "^4.0.0",
|
|
48
47
|
"ufo": "^1.6.3",
|
|
49
|
-
"site-config-stack": "
|
|
48
|
+
"site-config-stack": "4.0.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"@nuxt/schema": "^4.
|
|
51
|
+
"@nuxt/schema": "^4.4.2"
|
|
53
52
|
},
|
|
54
53
|
"scripts": {
|
|
55
54
|
"lint": "eslint . --fix",
|