@vite-hub/env 0.0.4 → 0.1.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/README.md +125 -5
- package/dist/access-B3qzBHye.js +54 -0
- package/dist/auth.d.ts +32 -0
- package/dist/auth.js +44 -0
- package/dist/bridge-CdNdTN1V.d.ts +374 -0
- package/dist/bridge-error-CFuU5zIz.js +65 -0
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +192 -0
- package/dist/cli-CMQPQbii.js +487 -0
- package/dist/cli-DEwcUIe0.d.ts +81 -0
- package/dist/cli.d.ts +41 -0
- package/dist/cli.js +2 -0
- package/dist/database.d.ts +21 -0
- package/dist/database.js +183 -0
- package/dist/declarations-CiRdb1qP.d.ts +32 -0
- package/dist/declarations-DAVgctKD.js +236 -0
- package/dist/error-diagnostics-CrxjYNYr.js +43 -0
- package/dist/http.d.ts +2 -0
- package/dist/http.js +122 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/internal/agent.d.ts +5 -0
- package/dist/internal/agent.js +22 -0
- package/dist/internal/connections.d.ts +18 -0
- package/dist/internal/connections.js +31 -0
- package/dist/presets.d.ts +15 -6
- package/dist/presets.js +21 -2
- package/dist/provider.d.ts +3 -4
- package/dist/provider.js +2 -1
- package/dist/schema.d.ts +5 -6
- package/dist/schema.js +26 -8
- package/dist/seal.d.ts +14 -0
- package/dist/seal.js +49 -0
- package/dist/server-DufVswRJ.js +670 -0
- package/dist/server.d.ts +23 -6
- package/dist/server.js +2 -3
- package/dist/values-D_r6V774.js +148 -0
- package/dist/virtual-module.d.ts +7 -3
- package/dist/virtual.d.ts +1 -1
- package/dist/vite.d.ts +27 -14
- package/dist/vite.js +840 -273
- package/package.json +81 -17
- package/dist/declarations-CoMmvRqH.js +0 -159
- package/dist/declarations-U6P3rvxC.d.ts +0 -24
- package/dist/errors-C4Xcs6Fi.js +0 -121
- package/dist/server-C16sFc1E.js +0 -303
- package/dist/types-CsB6DTGE.d.ts +0 -190
package/dist/server-C16sFc1E.js
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { SecretEnv } from "./secret.js";
|
|
2
|
-
import { i as invalidRuntimeEnvValue, n as envSourceFailed, o as missingRequiredEnv, t as asyncServerEnvRequired } from "./errors-C4Xcs6Fi.js";
|
|
3
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
-
import { isViteHubError } from "@vite-hub/runtime";
|
|
5
|
-
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
6
|
-
const runtimeGlobal = globalThis;
|
|
7
|
-
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
8
|
-
function getActiveCloudflareEnv() {
|
|
9
|
-
const scoped = activeEnvStorage.getStore();
|
|
10
|
-
return scoped ? scoped.env : globalThis.__env__;
|
|
11
|
-
}
|
|
12
|
-
function getCloudflareEnv(event) {
|
|
13
|
-
const target = event;
|
|
14
|
-
return target?.env || target?.context?.cloudflare?.env || target?.context?._platform?.cloudflare?.env || target?.req?.runtime?.cloudflare?.env || target?.node?.req?.runtime?.cloudflare?.env || getActiveCloudflareEnv();
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/server.ts
|
|
18
|
-
function isRecord(value) {
|
|
19
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
|
-
}
|
|
21
|
-
function isRuntimeLiteralEntry(value) {
|
|
22
|
-
return isRecord(value) && value.kind === "literal";
|
|
23
|
-
}
|
|
24
|
-
function isRuntimeEnvEntry(value) {
|
|
25
|
-
return isRecord(value) && isRecord(value.source) && value.source.kind === "env" && typeof value.source.name === "string" && typeof value.required === "boolean" && typeof value.secret === "boolean";
|
|
26
|
-
}
|
|
27
|
-
function isRuntimeProviderEntry(value) {
|
|
28
|
-
return isRecord(value) && isRecord(value.source) && value.source.kind === "provider" && typeof value.source.key === "string" && typeof value.source.provider === "string" && typeof value.required === "boolean" && typeof value.secret === "boolean";
|
|
29
|
-
}
|
|
30
|
-
function processEnv() {
|
|
31
|
-
return typeof process === "object" && process && process.env ? process.env : {};
|
|
32
|
-
}
|
|
33
|
-
function runtimeEnv(event) {
|
|
34
|
-
return {
|
|
35
|
-
...processEnv(),
|
|
36
|
-
...getCloudflareEnv(event)
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function readRuntimeSource(entry, env) {
|
|
40
|
-
for (const name of entry.source.names || [entry.source.name]) if (Object.hasOwn(env, name) && typeof env[name] !== "undefined") return {
|
|
41
|
-
found: true,
|
|
42
|
-
value: env[name]
|
|
43
|
-
};
|
|
44
|
-
return { found: false };
|
|
45
|
-
}
|
|
46
|
-
function resolvedRuntimeValue(entry, value, found) {
|
|
47
|
-
const resolved = found ? value : entry.default;
|
|
48
|
-
if (typeof resolved === "undefined") {
|
|
49
|
-
if (entry.required) throw missingRequiredEnv(entry.source.kind, `Missing Runtime Env from ${entry.source.kind}.`);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (typeof resolved !== "string") throw invalidRuntimeEnvValue(entry.source.kind, `Runtime Env from ${entry.source.kind} must resolve to a string.`);
|
|
53
|
-
return entry.secret ? new SecretEnv(resolved) : resolved;
|
|
54
|
-
}
|
|
55
|
-
function resolveRegistryValue(value, env, path) {
|
|
56
|
-
if (isRuntimeLiteralEntry(value)) return value.value;
|
|
57
|
-
if (isRuntimeEnvEntry(value)) {
|
|
58
|
-
const source = readRuntimeSource(value, env);
|
|
59
|
-
return resolvedRuntimeValue(value, source.value, source.found);
|
|
60
|
-
}
|
|
61
|
-
if (isRuntimeProviderEntry(value)) throw asyncServerEnvRequired(path);
|
|
62
|
-
if (!isRecord(value)) return void 0;
|
|
63
|
-
const output = Object.create(null);
|
|
64
|
-
for (const [key, child] of Object.entries(value)) {
|
|
65
|
-
const childPath = `${path}.${key}`;
|
|
66
|
-
if (isRuntimeProviderEntry(child)) Object.defineProperty(output, key, {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get() {
|
|
69
|
-
throw asyncServerEnvRequired(childPath);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
else output[key] = resolveRegistryValue(child, env, childPath);
|
|
73
|
-
}
|
|
74
|
-
return output;
|
|
75
|
-
}
|
|
76
|
-
function providerFor(name, providers) {
|
|
77
|
-
let provider;
|
|
78
|
-
try {
|
|
79
|
-
const configured = providers && Object.hasOwn(providers, name) ? providers[name] : void 0;
|
|
80
|
-
if (configured && typeof configured === "object" && typeof configured.read === "function") {
|
|
81
|
-
const read = configured.read;
|
|
82
|
-
provider = { read: (input) => read.call(configured, input) };
|
|
83
|
-
}
|
|
84
|
-
} catch (cause) {
|
|
85
|
-
throw envSourceFailed("provider", cause);
|
|
86
|
-
}
|
|
87
|
-
if (!provider) throw new TypeError("The configured Server Env provider is unavailable or invalid.");
|
|
88
|
-
return provider;
|
|
89
|
-
}
|
|
90
|
-
function abortReason(signal) {
|
|
91
|
-
return signal.reason === void 0 ? Object.assign(/* @__PURE__ */ new Error("Server Env loading was aborted."), { name: "AbortError" }) : signal.reason;
|
|
92
|
-
}
|
|
93
|
-
async function withAbort(operation, signal) {
|
|
94
|
-
if (!signal) return await operation();
|
|
95
|
-
if (signal.aborted) throw abortReason(signal);
|
|
96
|
-
return await new Promise((resolve, reject) => {
|
|
97
|
-
const abort = () => reject(abortReason(signal));
|
|
98
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
99
|
-
Promise.resolve().then(() => {
|
|
100
|
-
if (signal.aborted) throw abortReason(signal);
|
|
101
|
-
return operation();
|
|
102
|
-
}).then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function isCancellation(error, signal) {
|
|
106
|
-
return Boolean(signal?.aborted && error === abortReason(signal));
|
|
107
|
-
}
|
|
108
|
-
async function readProvider(provider, input, signal) {
|
|
109
|
-
try {
|
|
110
|
-
return await withAbort(() => provider.read(input), signal);
|
|
111
|
-
} catch (cause) {
|
|
112
|
-
if (isCancellation(cause, signal)) throw cause;
|
|
113
|
-
throw envSourceFailed("provider", cause);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function collectProviderKeys(value, requests = /* @__PURE__ */ new Map()) {
|
|
117
|
-
if (isRuntimeProviderEntry(value)) {
|
|
118
|
-
let keys = requests.get(value.source.provider);
|
|
119
|
-
if (!keys) {
|
|
120
|
-
keys = /* @__PURE__ */ new Set();
|
|
121
|
-
requests.set(value.source.provider, keys);
|
|
122
|
-
}
|
|
123
|
-
keys.add(value.source.key);
|
|
124
|
-
return requests;
|
|
125
|
-
}
|
|
126
|
-
if (isRuntimeEnvEntry(value) || isRuntimeLiteralEntry(value) || !isRecord(value)) return requests;
|
|
127
|
-
for (const child of Object.values(value)) collectProviderKeys(child, requests);
|
|
128
|
-
return requests;
|
|
129
|
-
}
|
|
130
|
-
function normalizeProviderValues(value, keys) {
|
|
131
|
-
let record;
|
|
132
|
-
try {
|
|
133
|
-
if (isRecord(value)) record = value;
|
|
134
|
-
} catch (cause) {
|
|
135
|
-
throw envSourceFailed("provider", cause);
|
|
136
|
-
}
|
|
137
|
-
if (!record) throw invalidRuntimeEnvValue("provider", "A Server Env provider must return a plain record.");
|
|
138
|
-
let prototype;
|
|
139
|
-
try {
|
|
140
|
-
prototype = Object.getPrototypeOf(record);
|
|
141
|
-
} catch (cause) {
|
|
142
|
-
throw envSourceFailed("provider", cause);
|
|
143
|
-
}
|
|
144
|
-
if (prototype !== null && prototype !== Object.prototype) throw invalidRuntimeEnvValue("provider", "A Server Env provider must return a plain record.");
|
|
145
|
-
const output = /* @__PURE__ */ new Map();
|
|
146
|
-
for (const key of keys) {
|
|
147
|
-
let descriptor;
|
|
148
|
-
try {
|
|
149
|
-
descriptor = Object.getOwnPropertyDescriptor(record, key);
|
|
150
|
-
} catch (cause) {
|
|
151
|
-
throw envSourceFailed("provider", cause);
|
|
152
|
-
}
|
|
153
|
-
if (!descriptor) {
|
|
154
|
-
output.set(key, void 0);
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
if (!("value" in descriptor)) throw invalidRuntimeEnvValue("provider", "A Server Env provider returned an accessor instead of a value.");
|
|
158
|
-
output.set(key, descriptor.value);
|
|
159
|
-
}
|
|
160
|
-
return output;
|
|
161
|
-
}
|
|
162
|
-
function createProviderLoads(registry, localEnv, options) {
|
|
163
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
164
|
-
const loads = /* @__PURE__ */ new Map();
|
|
165
|
-
for (const [name, requested] of collectProviderKeys(registry)) {
|
|
166
|
-
const keys = Object.freeze([...requested]);
|
|
167
|
-
const load = Promise.resolve().then(() => providerFor(name, options.providers)).then((provider) => readProvider(provider, {
|
|
168
|
-
env: localEnv,
|
|
169
|
-
keys,
|
|
170
|
-
signal: options.signal
|
|
171
|
-
}, options.signal)).then((value) => normalizeProviderValues(value, keys)).catch((cause) => {
|
|
172
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
173
|
-
if (isCancellation(cause, options.signal) || isViteHubError(cause)) throw cause;
|
|
174
|
-
throw envSourceFailed("provider", cause);
|
|
175
|
-
});
|
|
176
|
-
loads.set(name, load);
|
|
177
|
-
}
|
|
178
|
-
return loads;
|
|
179
|
-
}
|
|
180
|
-
async function providerValue(entry, loads) {
|
|
181
|
-
const load = loads.get(entry.source.provider);
|
|
182
|
-
if (!load) throw envSourceFailed("provider", /* @__PURE__ */ new TypeError("The Server Env provider was not loaded."));
|
|
183
|
-
return (await load).get(entry.source.key);
|
|
184
|
-
}
|
|
185
|
-
const skipProviderValue = Symbol("vitehub.env.skip-provider");
|
|
186
|
-
function localRegistryValue(value, env, tolerateInvalid) {
|
|
187
|
-
if (isRuntimeLiteralEntry(value)) return snapshotValue(value.value);
|
|
188
|
-
if (isRuntimeProviderEntry(value)) return skipProviderValue;
|
|
189
|
-
if (isRuntimeEnvEntry(value)) try {
|
|
190
|
-
const source = readRuntimeSource(value, env);
|
|
191
|
-
return resolvedRuntimeValue(value, source.value, source.found);
|
|
192
|
-
} catch (error) {
|
|
193
|
-
if (!tolerateInvalid) throw error;
|
|
194
|
-
return skipProviderValue;
|
|
195
|
-
}
|
|
196
|
-
if (!isRecord(value)) return skipProviderValue;
|
|
197
|
-
const output = Object.create(null);
|
|
198
|
-
for (const [key, child] of Object.entries(value)) {
|
|
199
|
-
const resolved = localRegistryValue(child, env, tolerateInvalid);
|
|
200
|
-
if (resolved !== skipProviderValue) output[key] = resolved;
|
|
201
|
-
}
|
|
202
|
-
return Object.freeze(output);
|
|
203
|
-
}
|
|
204
|
-
function createLocalEnv(registry, env, tolerateInvalid) {
|
|
205
|
-
return localRegistryValue(registry, env, tolerateInvalid);
|
|
206
|
-
}
|
|
207
|
-
async function loadRegistryValue(value, env, loads) {
|
|
208
|
-
if (isRuntimeLiteralEntry(value)) return snapshotValue(value.value);
|
|
209
|
-
if (isRuntimeEnvEntry(value)) {
|
|
210
|
-
const source = readRuntimeSource(value, env);
|
|
211
|
-
return resolvedRuntimeValue(value, source.value, source.found);
|
|
212
|
-
}
|
|
213
|
-
if (isRuntimeProviderEntry(value)) {
|
|
214
|
-
const resolved = await providerValue(value, loads);
|
|
215
|
-
return resolvedRuntimeValue(value, resolved, typeof resolved !== "undefined");
|
|
216
|
-
}
|
|
217
|
-
if (!isRecord(value)) return void 0;
|
|
218
|
-
const output = Object.create(null);
|
|
219
|
-
for (const [key, child] of Object.entries(value)) output[key] = await loadRegistryValue(child, env, loads);
|
|
220
|
-
return Object.freeze(output);
|
|
221
|
-
}
|
|
222
|
-
function snapshotValue(value) {
|
|
223
|
-
if (!Array.isArray(value)) return value;
|
|
224
|
-
return Object.freeze(value.map(snapshotValue));
|
|
225
|
-
}
|
|
226
|
-
function inspectionStatus(entry, value, found) {
|
|
227
|
-
if (!found && typeof entry.default !== "undefined") return "defaulted";
|
|
228
|
-
if (!found || typeof value === "undefined") return "missing";
|
|
229
|
-
return typeof value === "string" ? "available" : "invalid";
|
|
230
|
-
}
|
|
231
|
-
function inspectionPath(path) {
|
|
232
|
-
if (path.length > 256) return {};
|
|
233
|
-
return /^(?:env|runtime)(?:\.[A-Za-z_$][A-Za-z0-9_$-]{0,63}){0,8}$/.test(path) ? { path } : {};
|
|
234
|
-
}
|
|
235
|
-
async function inspectRegistryValue(value, env, options, loads, path, entries) {
|
|
236
|
-
if (isRuntimeLiteralEntry(value)) {
|
|
237
|
-
entries.push({
|
|
238
|
-
masked: false,
|
|
239
|
-
...inspectionPath(path),
|
|
240
|
-
source: "literal",
|
|
241
|
-
status: "available"
|
|
242
|
-
});
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
if (isRuntimeEnvEntry(value)) {
|
|
246
|
-
const source = readRuntimeSource(value, env);
|
|
247
|
-
entries.push({
|
|
248
|
-
masked: value.secret,
|
|
249
|
-
...inspectionPath(path),
|
|
250
|
-
source: "env",
|
|
251
|
-
status: inspectionStatus(value, source.value, source.found)
|
|
252
|
-
});
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (isRuntimeProviderEntry(value)) {
|
|
256
|
-
try {
|
|
257
|
-
const resolved = await providerValue(value, loads);
|
|
258
|
-
entries.push({
|
|
259
|
-
masked: value.secret,
|
|
260
|
-
...inspectionPath(path),
|
|
261
|
-
source: "provider",
|
|
262
|
-
status: inspectionStatus(value, resolved, typeof resolved !== "undefined")
|
|
263
|
-
});
|
|
264
|
-
} catch (error) {
|
|
265
|
-
if (isCancellation(error, options.signal)) throw error;
|
|
266
|
-
entries.push({
|
|
267
|
-
masked: value.secret,
|
|
268
|
-
...inspectionPath(path),
|
|
269
|
-
source: "provider",
|
|
270
|
-
status: "error"
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
if (!isRecord(value)) return;
|
|
276
|
-
for (const [key, child] of Object.entries(value)) await inspectRegistryValue(child, env, options, loads, `${path}.${key}`, entries);
|
|
277
|
-
}
|
|
278
|
-
function resolveServerEnv(registry, event) {
|
|
279
|
-
return resolveRegistryValue(registry, runtimeEnv(event), "env.server");
|
|
280
|
-
}
|
|
281
|
-
async function loadServerEnv(registry, event, options = {}) {
|
|
282
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
283
|
-
const env = runtimeEnv(event);
|
|
284
|
-
const loads = createProviderLoads(registry, createLocalEnv(registry, env, false), options);
|
|
285
|
-
await Promise.all(loads.values());
|
|
286
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
287
|
-
const value = await loadRegistryValue(registry, env, loads);
|
|
288
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
289
|
-
return value;
|
|
290
|
-
}
|
|
291
|
-
async function inspectServerEnv(registry, event, options = {}) {
|
|
292
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
293
|
-
const env = runtimeEnv(event);
|
|
294
|
-
const loads = createProviderLoads(registry, createLocalEnv(registry, env, true), options);
|
|
295
|
-
await Promise.allSettled(loads.values());
|
|
296
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
297
|
-
const entries = [];
|
|
298
|
-
await inspectRegistryValue(registry, env, options, loads, "env.server", entries);
|
|
299
|
-
if (options.signal?.aborted) throw abortReason(options.signal);
|
|
300
|
-
return Object.freeze({ entries: Object.freeze(entries.map((entry) => Object.freeze(entry))) });
|
|
301
|
-
}
|
|
302
|
-
//#endregion
|
|
303
|
-
export { loadServerEnv as n, resolveServerEnv as r, inspectServerEnv as t };
|
package/dist/types-CsB6DTGE.d.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { t as SecretEnv } from "./secret-C2191nAa.js";
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type EnvDiagnostics = "off" | "summary" | "trace";
|
|
5
|
-
type EnvMode = "build" | "runtime";
|
|
6
|
-
interface EnvIntegrationOptions {
|
|
7
|
-
diagnostics?: EnvDiagnostics;
|
|
8
|
-
prefix?: string;
|
|
9
|
-
projectRoot?: string;
|
|
10
|
-
providers?: Record<string, string>;
|
|
11
|
-
runtimeImports?: EnvRuntimeImportSpecifiers;
|
|
12
|
-
}
|
|
13
|
-
interface EnvRuntimeImportSpecifiers {
|
|
14
|
-
secret?: string;
|
|
15
|
-
server?: string;
|
|
16
|
-
}
|
|
17
|
-
interface EnvSourceContext {
|
|
18
|
-
build: {
|
|
19
|
-
timestamp: () => string;
|
|
20
|
-
};
|
|
21
|
-
env: Record<string, string | undefined>;
|
|
22
|
-
git: {
|
|
23
|
-
branch: () => Promise<string>;
|
|
24
|
-
commit: (options?: {
|
|
25
|
-
short?: boolean;
|
|
26
|
-
}) => Promise<string>;
|
|
27
|
-
ref: () => Promise<string>;
|
|
28
|
-
sha: (options?: {
|
|
29
|
-
short?: boolean;
|
|
30
|
-
}) => Promise<string>;
|
|
31
|
-
tag: () => Promise<string | undefined>;
|
|
32
|
-
};
|
|
33
|
-
mode: EnvMode;
|
|
34
|
-
packageJson: () => Promise<Record<string, unknown>>;
|
|
35
|
-
rootDir: string;
|
|
36
|
-
}
|
|
37
|
-
type EnvSourceResolver = (context: EnvSourceContext) => unknown | Promise<unknown>;
|
|
38
|
-
type EnvSource = {
|
|
39
|
-
kind: "custom";
|
|
40
|
-
label: string;
|
|
41
|
-
resolver: EnvSourceResolver;
|
|
42
|
-
serializable: false;
|
|
43
|
-
} | {
|
|
44
|
-
kind: "env";
|
|
45
|
-
label: string;
|
|
46
|
-
name: string;
|
|
47
|
-
names?: string[];
|
|
48
|
-
serializable: true;
|
|
49
|
-
} | {
|
|
50
|
-
kind: "git-branch";
|
|
51
|
-
label: "git:branch";
|
|
52
|
-
serializable: true;
|
|
53
|
-
} | {
|
|
54
|
-
kind: "git-commit";
|
|
55
|
-
label: "git:commit";
|
|
56
|
-
serializable: true;
|
|
57
|
-
short?: boolean;
|
|
58
|
-
} | {
|
|
59
|
-
kind: "git-ref";
|
|
60
|
-
label: "git:ref";
|
|
61
|
-
serializable: true;
|
|
62
|
-
} | {
|
|
63
|
-
kind: "git-sha";
|
|
64
|
-
label: "git:sha";
|
|
65
|
-
serializable: true;
|
|
66
|
-
short?: boolean;
|
|
67
|
-
} | {
|
|
68
|
-
kind: "git-tag";
|
|
69
|
-
label: "git:tag";
|
|
70
|
-
serializable: true;
|
|
71
|
-
} | {
|
|
72
|
-
kind: "build-timestamp";
|
|
73
|
-
label: "build:timestamp";
|
|
74
|
-
serializable: true;
|
|
75
|
-
} | {
|
|
76
|
-
kind: "package-json";
|
|
77
|
-
label: string;
|
|
78
|
-
path: string;
|
|
79
|
-
serializable: true;
|
|
80
|
-
} | {
|
|
81
|
-
key: string;
|
|
82
|
-
kind: "provider";
|
|
83
|
-
label: "provider";
|
|
84
|
-
provider: string;
|
|
85
|
-
serializable: true;
|
|
86
|
-
};
|
|
87
|
-
interface EnvVariableDeclaration {
|
|
88
|
-
default?: unknown;
|
|
89
|
-
kind: "env-variable";
|
|
90
|
-
mode: EnvMode;
|
|
91
|
-
required: boolean;
|
|
92
|
-
schema: unknown;
|
|
93
|
-
secret: boolean;
|
|
94
|
-
source?: EnvSource;
|
|
95
|
-
type?: string;
|
|
96
|
-
}
|
|
97
|
-
interface EnvVariableOptions {
|
|
98
|
-
default?: unknown;
|
|
99
|
-
mode?: EnvMode;
|
|
100
|
-
optional?: boolean;
|
|
101
|
-
required?: boolean;
|
|
102
|
-
schema?: unknown;
|
|
103
|
-
secret?: boolean;
|
|
104
|
-
source?: EnvSource | EnvSourceResolver;
|
|
105
|
-
type?: string;
|
|
106
|
-
}
|
|
107
|
-
type EnvBuildStaticValue = null | string | number | boolean | EnvBuildStaticValue[];
|
|
108
|
-
type EnvBuildConfigValue = EnvBuildConfigOptions | EnvBuildStaticValue | EnvVariableDeclaration;
|
|
109
|
-
interface EnvBuildConfigOptions {
|
|
110
|
-
[key: string]: EnvBuildConfigValue;
|
|
111
|
-
}
|
|
112
|
-
interface EnvViteConfigOptions {
|
|
113
|
-
define?: Record<string, EnvBuildConfigValue>;
|
|
114
|
-
public?: Record<string, EnvVariableDeclaration>;
|
|
115
|
-
server?: EnvRuntimeConfigOptions;
|
|
116
|
-
}
|
|
117
|
-
type EnvRuntimeStaticValue = null | string | number | boolean | EnvRuntimeStaticValue[];
|
|
118
|
-
type EnvRuntimeConfigValue = EnvRuntimeConfigOptions | EnvRuntimeStaticValue | EnvVariableDeclaration;
|
|
119
|
-
interface EnvRuntimeConfigOptions {
|
|
120
|
-
[key: string]: EnvRuntimeConfigValue;
|
|
121
|
-
}
|
|
122
|
-
type EnvConfigOptions = EnvViteConfigOptions;
|
|
123
|
-
interface EnvViteUserConfig {
|
|
124
|
-
env?: EnvViteConfigOptions;
|
|
125
|
-
}
|
|
126
|
-
interface EnvDiagnosticEntry {
|
|
127
|
-
exposed: string;
|
|
128
|
-
key: string;
|
|
129
|
-
masked: boolean;
|
|
130
|
-
mode: EnvMode;
|
|
131
|
-
source: string;
|
|
132
|
-
status: "defaulted" | "missing" | "valid";
|
|
133
|
-
timing: string;
|
|
134
|
-
type?: string;
|
|
135
|
-
}
|
|
136
|
-
interface EnvRegistryEntry {
|
|
137
|
-
default?: unknown;
|
|
138
|
-
required: boolean;
|
|
139
|
-
schema?: EnvRuntimeSchema;
|
|
140
|
-
secret: boolean;
|
|
141
|
-
source: Extract<EnvSource, {
|
|
142
|
-
kind: "env" | "provider";
|
|
143
|
-
}>;
|
|
144
|
-
type?: string;
|
|
145
|
-
}
|
|
146
|
-
interface EnvRuntimeSchema {
|
|
147
|
-
kind: "string";
|
|
148
|
-
}
|
|
149
|
-
interface EnvRuntimeLiteralEntry {
|
|
150
|
-
kind: "literal";
|
|
151
|
-
value: EnvRuntimeStaticValue;
|
|
152
|
-
}
|
|
153
|
-
type EnvRuntimeRegistryValue = EnvRegistryEntry | EnvRuntimeLiteralEntry | EnvRuntimeRegistry;
|
|
154
|
-
declare const serverEnvType: unique symbol;
|
|
155
|
-
interface EnvRuntimeRegistry<TServerEnv extends Record<string, unknown> = Record<string, unknown>> {
|
|
156
|
-
[key: string]: EnvRuntimeRegistryValue;
|
|
157
|
-
readonly [serverEnvType]?: (value: TServerEnv) => void;
|
|
158
|
-
}
|
|
159
|
-
interface ServerEnv {
|
|
160
|
-
[key: string]: unknown;
|
|
161
|
-
}
|
|
162
|
-
type PublicEnv = Record<string, unknown>;
|
|
163
|
-
interface EnvProviderContext<TEnv extends Record<string, unknown> = Record<string, unknown>> {
|
|
164
|
-
env: DeepReadonly<TEnv>;
|
|
165
|
-
signal?: AbortSignal;
|
|
166
|
-
}
|
|
167
|
-
type EnvProviderValues = Readonly<Record<string, string | undefined>>;
|
|
168
|
-
interface EnvProvider<TEnv extends Record<string, unknown> = Record<string, unknown>> {
|
|
169
|
-
read(input: EnvProviderContext<TEnv> & {
|
|
170
|
-
keys: readonly string[];
|
|
171
|
-
}): EnvProviderValues | Promise<EnvProviderValues>;
|
|
172
|
-
}
|
|
173
|
-
type EnvProviders = Record<string, EnvProvider>;
|
|
174
|
-
interface LoadServerEnvOptions {
|
|
175
|
-
providers?: EnvProviders;
|
|
176
|
-
signal?: AbortSignal;
|
|
177
|
-
}
|
|
178
|
-
type DeepReadonly<T> = T extends SecretEnv<unknown> ? T : T extends ((...args: infer TArguments) => infer TResult) ? (...args: TArguments) => TResult : T extends object ? { readonly [TKey in keyof T]: DeepReadonly<T[TKey]> } : T;
|
|
179
|
-
type ServerEnvInspectionStatus = "available" | "defaulted" | "error" | "invalid" | "missing";
|
|
180
|
-
interface ServerEnvInspectionEntry {
|
|
181
|
-
masked: boolean;
|
|
182
|
-
path?: string;
|
|
183
|
-
source: "env" | "literal" | "provider";
|
|
184
|
-
status: ServerEnvInspectionStatus;
|
|
185
|
-
}
|
|
186
|
-
interface ServerEnvInspection {
|
|
187
|
-
entries: readonly ServerEnvInspectionEntry[];
|
|
188
|
-
}
|
|
189
|
-
//#endregion
|
|
190
|
-
export { ServerEnvInspection as C, ServerEnv as S, ServerEnvInspectionStatus as T, EnvVariableOptions as _, EnvIntegrationOptions as a, LoadServerEnvOptions as b, EnvProviderContext as c, EnvRuntimeConfigOptions as d, EnvRuntimeRegistry as f, EnvVariableDeclaration as g, EnvSourceResolver as h, EnvDiagnostics as i, EnvProviderValues as l, EnvSourceContext as m, EnvConfigOptions as n, EnvMode as o, EnvSource as p, EnvDiagnosticEntry as r, EnvProvider as s, DeepReadonly as t, EnvProviders as u, EnvViteConfigOptions as v, ServerEnvInspectionEntry as w, PublicEnv as x, EnvViteUserConfig as y };
|