@vite-hub/env 0.0.3 → 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.
Files changed (50) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +243 -28
  3. package/dist/access-B3qzBHye.js +54 -0
  4. package/dist/auth.d.ts +32 -0
  5. package/dist/auth.js +44 -0
  6. package/dist/bridge-CdNdTN1V.d.ts +374 -0
  7. package/dist/bridge-error-CFuU5zIz.js +65 -0
  8. package/dist/bridge.d.ts +2 -0
  9. package/dist/bridge.js +192 -0
  10. package/dist/cli-CMQPQbii.js +487 -0
  11. package/dist/cli-DEwcUIe0.d.ts +81 -0
  12. package/dist/cli.d.ts +41 -0
  13. package/dist/cli.js +2 -0
  14. package/dist/database.d.ts +21 -0
  15. package/dist/database.js +183 -0
  16. package/dist/declarations-CiRdb1qP.d.ts +32 -0
  17. package/dist/declarations-DAVgctKD.js +236 -0
  18. package/dist/error-diagnostics-CrxjYNYr.js +43 -0
  19. package/dist/http.d.ts +2 -0
  20. package/dist/http.js +122 -0
  21. package/dist/index.d.ts +13 -8
  22. package/dist/index.js +5 -4
  23. package/dist/internal/agent.d.ts +5 -0
  24. package/dist/internal/agent.js +22 -0
  25. package/dist/internal/connections.d.ts +18 -0
  26. package/dist/internal/connections.js +31 -0
  27. package/dist/presets.d.ts +15 -6
  28. package/dist/presets.js +21 -2
  29. package/dist/provider.d.ts +5 -0
  30. package/dist/provider.js +8 -0
  31. package/dist/schema.d.ts +5 -6
  32. package/dist/schema.js +26 -8
  33. package/dist/seal.d.ts +14 -0
  34. package/dist/seal.js +49 -0
  35. package/dist/secret-C2191nAa.d.ts +11 -0
  36. package/dist/secret.d.ts +1 -10
  37. package/dist/server-DufVswRJ.js +670 -0
  38. package/dist/server.d.ts +23 -4
  39. package/dist/server.js +2 -3
  40. package/dist/values-D_r6V774.js +148 -0
  41. package/dist/virtual-module.d.ts +34 -0
  42. package/dist/virtual.d.ts +2 -15
  43. package/dist/vite.d.ts +37 -14
  44. package/dist/vite.js +1058 -292
  45. package/package.json +84 -16
  46. package/dist/declarations-BIBfEwer.d.ts +0 -23
  47. package/dist/declarations-Cy5XamUA.js +0 -144
  48. package/dist/errors-RUmAFDJn.js +0 -112
  49. package/dist/server-B2Dp8Nc0.js +0 -59
  50. package/dist/types-FcnPKias.d.ts +0 -153
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@vite-hub/env",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "description": "Safe build and runtime environment variables for ViteHub.",
5
5
  "keywords": [
6
6
  "env",
7
7
  "environment-variables",
8
8
  "runtime-config",
9
+ "secrets",
10
+ "typescript",
9
11
  "vite",
10
12
  "vitehub"
11
13
  ],
12
- "homepage": "https://github.com/vite-hub/vitehub#readme",
14
+ "homepage": "https://vitehub.dev",
13
15
  "bugs": "https://github.com/vite-hub/vitehub/issues",
14
16
  "license": "Apache-2.0",
15
17
  "author": "onmax <maximogarciamtnez@gmail.com>",
@@ -28,51 +30,117 @@
28
30
  "exports": {
29
31
  ".": {
30
32
  "types": "./dist/index.d.ts",
31
- "import": "./dist/index.js"
33
+ "import": "./dist/index.js",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "./auth": {
37
+ "types": "./dist/auth.d.ts",
38
+ "import": "./dist/auth.js",
39
+ "default": "./dist/auth.js"
40
+ },
41
+ "./bridge": {
42
+ "types": "./dist/bridge.d.ts",
43
+ "import": "./dist/bridge.js",
44
+ "default": "./dist/bridge.js"
45
+ },
46
+ "./cli": {
47
+ "types": "./dist/cli.d.ts",
48
+ "import": "./dist/cli.js",
49
+ "default": "./dist/cli.js"
50
+ },
51
+ "./database": {
52
+ "types": "./dist/database.d.ts",
53
+ "import": "./dist/database.js",
54
+ "default": "./dist/database.js"
55
+ },
56
+ "./http": {
57
+ "types": "./dist/http.d.ts",
58
+ "import": "./dist/http.js",
59
+ "default": "./dist/http.js"
60
+ },
61
+ "./internal/agent": {
62
+ "types": "./dist/internal/agent.d.ts",
63
+ "import": "./dist/internal/agent.js",
64
+ "default": "./dist/internal/agent.js"
65
+ },
66
+ "./internal/connections": {
67
+ "types": "./dist/internal/connections.d.ts",
68
+ "import": "./dist/internal/connections.js",
69
+ "default": "./dist/internal/connections.js"
32
70
  },
33
71
  "./presets": {
34
72
  "types": "./dist/presets.d.ts",
35
- "import": "./dist/presets.js"
73
+ "import": "./dist/presets.js",
74
+ "default": "./dist/presets.js"
75
+ },
76
+ "./provider": {
77
+ "types": "./dist/provider.d.ts",
78
+ "import": "./dist/provider.js",
79
+ "default": "./dist/provider.js"
36
80
  },
37
81
  "./schema": {
38
82
  "types": "./dist/schema.d.ts",
39
- "import": "./dist/schema.js"
83
+ "import": "./dist/schema.js",
84
+ "default": "./dist/schema.js"
85
+ },
86
+ "./seal": {
87
+ "types": "./dist/seal.d.ts",
88
+ "import": "./dist/seal.js",
89
+ "default": "./dist/seal.js"
40
90
  },
41
91
  "./secret": {
42
92
  "types": "./dist/secret.d.ts",
43
- "import": "./dist/secret.js"
93
+ "import": "./dist/secret.js",
94
+ "default": "./dist/secret.js"
44
95
  },
45
96
  "./server": {
46
97
  "types": "./dist/server.d.ts",
47
- "import": "./dist/server.js"
98
+ "import": "./dist/server.js",
99
+ "default": "./dist/server.js"
48
100
  },
49
101
  "./virtual": {
50
102
  "types": "./dist/virtual.d.ts",
51
- "import": "./dist/virtual.js"
103
+ "import": "./dist/virtual.js",
104
+ "default": "./dist/virtual.js"
52
105
  },
53
106
  "./vite": {
54
107
  "types": "./dist/vite.d.ts",
55
- "import": "./dist/vite.js"
108
+ "import": "./dist/vite.js",
109
+ "default": "./dist/vite.js"
56
110
  },
57
111
  "./package.json": "./package.json"
58
112
  },
59
113
  "dependencies": {
60
- "@vite-hub/runtime": "0.0.3"
114
+ "@env-spec/parser": "0.6.2",
115
+ "@vite-hub/runtime": "0.1.0",
116
+ "nostics": "1.3.0",
117
+ "valibot": "^1.5.0"
61
118
  },
62
119
  "devDependencies": {
63
- "publint": "^0.3.21",
120
+ "zod": "^4.6.7",
121
+ "publint": "^0.3.25",
64
122
  "typescript": "^6.0.3",
65
- "vite": "^8.0.8",
66
- "vite-plus": "^0.1.24",
67
- "vitest": "^4.1.4",
123
+ "vite": "^8.2.2",
124
+ "vite-plus": "^0.3.3",
125
+ "vitest": "^4.1.11",
126
+ "drizzle-orm": "^0.45.3",
127
+ "@libsql/client": "^0.18.0",
68
128
  "@vite-hub/internal": "0.0.1"
69
129
  },
70
130
  "peerDependencies": {
71
- "vite": ">=8.0.0"
131
+ "vite": ">=8.0.0",
132
+ "drizzle-orm": "^0.45.3",
133
+ "@vite-hub/agent": "0.1.0"
72
134
  },
73
135
  "peerDependenciesMeta": {
74
136
  "vite": {
75
137
  "optional": true
138
+ },
139
+ "drizzle-orm": {
140
+ "optional": true
141
+ },
142
+ "@vite-hub/agent": {
143
+ "optional": true
76
144
  }
77
145
  },
78
146
  "engines": {
@@ -81,7 +149,7 @@
81
149
  "scripts": {
82
150
  "build": "vp pack",
83
151
  "dev": "vp pack --watch",
84
- "typecheck": "tsc --noEmit -p ./tsconfig.json",
152
+ "typecheck": "vp run --cache -t @vite-hub/env#build && node ../../test/package-typecheck.mjs --noEmit -p ./tsconfig.json",
85
153
  "test": "vp run -t @vite-hub/env#build && vp test"
86
154
  }
87
155
  }
@@ -1,23 +0,0 @@
1
- import { c as EnvSource, d as EnvVariableDeclaration, f as EnvVariableOptions, u as EnvSourceResolver } from "./types-FcnPKias.js";
2
-
3
- //#region src/core/declarations.d.ts
4
- interface EnvNamespace {
5
- (options?: EnvVariableOptions): EnvVariableDeclaration;
6
- buildTimestamp: () => EnvSource;
7
- custom: (label: string, resolver: EnvSourceResolver) => EnvSource;
8
- gitBranch: () => EnvSource;
9
- gitCommit: (options?: {
10
- short?: boolean;
11
- }) => EnvSource;
12
- gitRef: () => EnvSource;
13
- gitSha: (options?: {
14
- short?: boolean;
15
- }) => EnvSource;
16
- gitTag: () => EnvSource;
17
- packageJson: (path: string) => EnvSource;
18
- source: (name: string | string[]) => EnvSource;
19
- variable: (options?: EnvVariableOptions) => EnvVariableDeclaration;
20
- }
21
- declare const env: EnvNamespace;
22
- //#endregion
23
- export { env as t };
@@ -1,144 +0,0 @@
1
- //#region src/core/declarations.ts
2
- const defaultStringSchema = {
3
- __vitehubDefaultRuntimeSchema: getDefaultStringSchemaToken(),
4
- safeParse(input) {
5
- return typeof input === "string" ? {
6
- data: input,
7
- success: true
8
- } : {
9
- error: /* @__PURE__ */ new Error("Expected string"),
10
- success: false
11
- };
12
- }
13
- };
14
- const defaultStringSchemaProperty = "__vitehubDefaultRuntimeSchema";
15
- const defaultStringSchemaToken = defaultStringSchema.__vitehubDefaultRuntimeSchema;
16
- const defaultStringSchemas = /* @__PURE__ */ new WeakMap();
17
- const defaultStringSchemaParsers = /* @__PURE__ */ new WeakSet();
18
- defaultStringSchemaParsers.add(defaultStringSchema.safeParse);
19
- function source(name) {
20
- const names = Array.isArray(name) ? name : [name];
21
- if (!names.length || names.some((value) => typeof value !== "string" || !value.trim())) throw new TypeError("env.source() requires one or more non-empty env variable names.");
22
- const normalized = names.map((value) => value.trim());
23
- return {
24
- kind: "env",
25
- label: `env:${normalized.join("|")}`,
26
- name: normalized[0],
27
- ...normalized.length > 1 ? { names: normalized } : {},
28
- serializable: true
29
- };
30
- }
31
- function custom(label, resolver) {
32
- return {
33
- kind: "custom",
34
- label,
35
- resolver,
36
- serializable: false
37
- };
38
- }
39
- function gitBranch() {
40
- return {
41
- kind: "git-branch",
42
- label: "git:branch",
43
- serializable: true
44
- };
45
- }
46
- function gitCommit(options = {}) {
47
- return {
48
- kind: "git-commit",
49
- label: "git:commit",
50
- serializable: true,
51
- short: options.short
52
- };
53
- }
54
- function gitRef() {
55
- return {
56
- kind: "git-ref",
57
- label: "git:ref",
58
- serializable: true
59
- };
60
- }
61
- function gitSha(options = {}) {
62
- return {
63
- kind: "git-sha",
64
- label: "git:sha",
65
- serializable: true,
66
- short: options.short
67
- };
68
- }
69
- function gitTag() {
70
- return {
71
- kind: "git-tag",
72
- label: "git:tag",
73
- serializable: true
74
- };
75
- }
76
- function buildTimestamp() {
77
- return {
78
- kind: "build-timestamp",
79
- label: "build:timestamp",
80
- serializable: true
81
- };
82
- }
83
- function packageJson(path) {
84
- return {
85
- kind: "package-json",
86
- label: `package.json:${path}`,
87
- path,
88
- serializable: true
89
- };
90
- }
91
- function variable(options = {}) {
92
- if (typeof options !== "object" || options === null || Array.isArray(options)) throw new TypeError("env() only accepts a single options object.");
93
- if (options.optional && typeof options.required !== "undefined") throw new TypeError("env() cannot use both optional and required.");
94
- const required = options.optional ? false : options.required ?? true;
95
- const source = typeof options.source === "function" ? custom("custom", options.source) : options.source;
96
- const schema = options.schema ?? defaultStringSchema;
97
- const declaration = {
98
- default: options.default,
99
- kind: "env-variable",
100
- mode: options.mode ?? "runtime",
101
- required,
102
- schema,
103
- secret: options.secret ?? false,
104
- source,
105
- type: options.type
106
- };
107
- if (typeof options.schema === "undefined") {
108
- defaultStringSchemas.set(declaration, defaultStringSchema);
109
- Object.defineProperty(declaration, defaultStringSchemaProperty, {
110
- enumerable: true,
111
- value: defaultStringSchemaToken
112
- });
113
- }
114
- return declaration;
115
- }
116
- const env = Object.assign(variable, {
117
- buildTimestamp,
118
- custom,
119
- gitBranch,
120
- gitCommit,
121
- gitRef,
122
- gitSha,
123
- gitTag,
124
- packageJson,
125
- source,
126
- variable
127
- });
128
- function isDefaultStringEnvVariable(declaration) {
129
- return defaultStringSchemas.get(declaration) === declaration.schema || declaration[defaultStringSchemaProperty] === defaultStringSchemaToken && typeof declaration.schema === "object" && declaration.schema !== null && declaration.schema[defaultStringSchemaProperty] === defaultStringSchemaToken && hasOnlyDefaultStringSchemaKeys(declaration.schema);
130
- }
131
- function getDefaultStringSchemaToken() {
132
- const tokenKey = Symbol.for("vitehub.env.defaultRuntimeSchemaToken");
133
- const globalScope = globalThis;
134
- globalScope[tokenKey] ??= `string:${Math.random().toString(36).slice(2)}`;
135
- return globalScope[tokenKey];
136
- }
137
- function hasOnlyDefaultStringSchemaKeys(schema) {
138
- if ("~standard" in schema || "parse" in schema) return false;
139
- const keys = Reflect.ownKeys(schema);
140
- const safeParse = Object.getOwnPropertyDescriptor(schema, "safeParse");
141
- return keys.length === 2 && keys.includes(defaultStringSchemaProperty) && keys.includes("safeParse") && typeof safeParse?.value === "function" && defaultStringSchemaParsers.has(safeParse.value);
142
- }
143
- //#endregion
144
- export { env as n, isDefaultStringEnvVariable as r, defaultStringSchema as t };
@@ -1,112 +0,0 @@
1
- import { ViteHubError } from "@vite-hub/runtime";
2
- //#region src/core/errors.ts
3
- const envErrorMessages = {
4
- ENV_DECLARATION_INVALID: "[vitehub] Env declaration is invalid.",
5
- ENV_REQUIRED_MISSING: "[vitehub] Required Env value is missing.",
6
- ENV_RUNTIME_VALUE_INVALID: "[vitehub] Runtime Env value is invalid.",
7
- ENV_SOURCE_FAILED: "[vitehub] Env source resolution failed."
8
- };
9
- const envSourceIdentifierSet = new Set([
10
- "custom",
11
- "env",
12
- "git:branch",
13
- "git:commit",
14
- "git:ref",
15
- "git:sha",
16
- "git:tag",
17
- "package.json"
18
- ]);
19
- function invalidOptions() {
20
- throw new TypeError("[vitehub] Invalid Env error options.");
21
- }
22
- function own(value, key) {
23
- if (typeof value !== "object" || value === null || Array.isArray(value)) invalidOptions();
24
- try {
25
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
26
- if (descriptor === void 0) return void 0;
27
- if (!("value" in descriptor)) invalidOptions();
28
- return descriptor.value;
29
- } catch {
30
- invalidOptions();
31
- }
32
- }
33
- function createEnvError(options) {
34
- const code = own(options, "code");
35
- if (typeof code !== "string" || !Object.hasOwn(envErrorMessages, code)) invalidOptions();
36
- const cause = own(options, "cause");
37
- const details = normalizeDetails(code, own(options, "details"));
38
- return new ViteHubError(code, envErrorMessages[code], {
39
- ...cause === void 0 ? {} : { cause },
40
- ...details === void 0 ? {} : { details }
41
- });
42
- }
43
- function invalidEnvDeclaration(path, diagnostic) {
44
- return createEnvError({
45
- cause: new TypeError(diagnostic),
46
- code: "ENV_DECLARATION_INVALID",
47
- details: optionalPath(path)
48
- });
49
- }
50
- function missingRequiredEnv(source, diagnostic, path) {
51
- const pathDetails = optionalPath(path);
52
- return createEnvError({
53
- cause: new Error(diagnostic),
54
- code: "ENV_REQUIRED_MISSING",
55
- details: {
56
- ...pathDetails,
57
- source: publicSourceIdentifier(source)
58
- }
59
- });
60
- }
61
- function invalidRuntimeEnvValue(source, diagnostic) {
62
- return createEnvError({
63
- cause: new TypeError(diagnostic),
64
- code: "ENV_RUNTIME_VALUE_INVALID",
65
- details: { source: publicSourceIdentifier(source) }
66
- });
67
- }
68
- function envSourceFailed(source, cause) {
69
- return createEnvError({
70
- cause,
71
- code: "ENV_SOURCE_FAILED",
72
- details: { source: publicSourceIdentifier(source) }
73
- });
74
- }
75
- function isAbortError(value) {
76
- if ((typeof value !== "object" || value === null) && typeof value !== "function") return false;
77
- try {
78
- return value.name === "AbortError";
79
- } catch {
80
- return false;
81
- }
82
- }
83
- function publicSourceIdentifier(source) {
84
- if (envSourceIdentifierSet.has(source)) return source;
85
- if (source.startsWith("env:")) return "env";
86
- if (source.startsWith("package.json:")) return "package.json";
87
- return "custom";
88
- }
89
- function normalizeDetails(code, details) {
90
- if (details === void 0) return void 0;
91
- if (typeof details !== "object" || details === null || Array.isArray(details)) invalidOptions();
92
- const normalized = {};
93
- if (code === "ENV_DECLARATION_INVALID" || code === "ENV_REQUIRED_MISSING") {
94
- const path = safePath(own(details, "path"));
95
- if (path) normalized.path = path;
96
- }
97
- if (code !== "ENV_DECLARATION_INVALID") {
98
- const source = own(details, "source");
99
- if (envSourceIdentifierSet.has(source)) normalized.source = source;
100
- }
101
- return Object.keys(normalized).length ? normalized : void 0;
102
- }
103
- function optionalPath(path) {
104
- const normalized = safePath(path);
105
- return normalized ? { path: normalized } : {};
106
- }
107
- function safePath(path) {
108
- if (typeof path !== "string" || path.length > 256) return void 0;
109
- return /^(?:env|runtime)(?:\.[A-Za-z_$][A-Za-z0-9_$-]{0,63}){0,8}$/.test(path) ? path : void 0;
110
- }
111
- //#endregion
112
- export { missingRequiredEnv as a, isAbortError as i, invalidEnvDeclaration as n, invalidRuntimeEnvValue as r, envSourceFailed as t };
@@ -1,59 +0,0 @@
1
- import { SecretEnv } from "./secret.js";
2
- import { a as missingRequiredEnv, r as invalidRuntimeEnvValue } from "./errors-RUmAFDJn.js";
3
- import { AsyncLocalStorage } from "node:async_hooks";
4
- const activeEnvStorage = new AsyncLocalStorage();
5
- function getActiveCloudflareEnv() {
6
- const scoped = activeEnvStorage.getStore();
7
- return scoped ? scoped.env : globalThis.__env__;
8
- }
9
- function getCloudflareEnv(event) {
10
- const target = event;
11
- return target?.env || target?.context?.cloudflare?.env || target?.context?._platform?.cloudflare?.env || target?.req?.runtime?.cloudflare?.env || getActiveCloudflareEnv();
12
- }
13
- //#endregion
14
- //#region src/server.ts
15
- function isRecord(value) {
16
- return typeof value === "object" && value !== null && !Array.isArray(value);
17
- }
18
- function isRuntimeLiteralEntry(value) {
19
- return isRecord(value) && value.kind === "literal";
20
- }
21
- function isRuntimeEnvEntry(value) {
22
- return isRecord(value) && isRecord(value.source) && typeof value.source.name === "string" && typeof value.required === "boolean" && typeof value.secret === "boolean";
23
- }
24
- function processEnv() {
25
- return typeof process === "object" && process && process.env ? process.env : {};
26
- }
27
- function runtimeEnv(event) {
28
- return {
29
- ...processEnv(),
30
- ...getCloudflareEnv(event)
31
- };
32
- }
33
- function readRuntimeSource(entry, env) {
34
- for (const name of entry.source.names || [entry.source.name]) if (Object.hasOwn(env, name) && typeof env[name] !== "undefined") return {
35
- found: true,
36
- value: env[name]
37
- };
38
- return { found: false };
39
- }
40
- function resolveRegistryValue(value, env) {
41
- if (isRuntimeLiteralEntry(value)) return value.value;
42
- if (isRuntimeEnvEntry(value)) {
43
- const source = readRuntimeSource(value, env);
44
- const resolved = source.found ? source.value : value.default;
45
- if (typeof resolved === "undefined") {
46
- if (value.required) throw missingRequiredEnv(value.source.label, `Missing Runtime Env from ${value.source.label}.`);
47
- return;
48
- }
49
- if (typeof resolved !== "string") throw invalidRuntimeEnvValue(value.source.label, `Runtime Env from ${value.source.label} must resolve to a string.`);
50
- return value.secret ? new SecretEnv(resolved) : resolved;
51
- }
52
- if (!isRecord(value)) return;
53
- return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, resolveRegistryValue(child, env)]));
54
- }
55
- function resolveServerEnv(registry, event) {
56
- return resolveRegistryValue(registry, runtimeEnv(event));
57
- }
58
- //#endregion
59
- export { resolveServerEnv as t };
@@ -1,153 +0,0 @@
1
- //#region src/types.d.ts
2
- type EnvDiagnostics = "off" | "summary" | "trace";
3
- type EnvMode = "build" | "runtime";
4
- interface EnvIntegrationOptions {
5
- diagnostics?: EnvDiagnostics;
6
- prefix?: string;
7
- projectRoot?: string;
8
- runtimeImports?: EnvRuntimeImportSpecifiers;
9
- }
10
- interface EnvRuntimeImportSpecifiers {
11
- secret?: string;
12
- server?: string;
13
- }
14
- interface EnvSourceContext {
15
- build: {
16
- timestamp: () => string;
17
- };
18
- env: Record<string, string | undefined>;
19
- git: {
20
- branch: () => Promise<string>;
21
- commit: (options?: {
22
- short?: boolean;
23
- }) => Promise<string>;
24
- ref: () => Promise<string>;
25
- sha: (options?: {
26
- short?: boolean;
27
- }) => Promise<string>;
28
- tag: () => Promise<string | undefined>;
29
- };
30
- mode: EnvMode;
31
- packageJson: () => Promise<Record<string, unknown>>;
32
- rootDir: string;
33
- }
34
- type EnvSourceResolver = (context: EnvSourceContext) => unknown | Promise<unknown>;
35
- type EnvSource = {
36
- kind: "custom";
37
- label: string;
38
- resolver: EnvSourceResolver;
39
- serializable: false;
40
- } | {
41
- kind: "env";
42
- label: string;
43
- name: string;
44
- names?: string[];
45
- serializable: true;
46
- } | {
47
- kind: "git-branch";
48
- label: "git:branch";
49
- serializable: true;
50
- } | {
51
- kind: "git-commit";
52
- label: "git:commit";
53
- serializable: true;
54
- short?: boolean;
55
- } | {
56
- kind: "git-ref";
57
- label: "git:ref";
58
- serializable: true;
59
- } | {
60
- kind: "git-sha";
61
- label: "git:sha";
62
- serializable: true;
63
- short?: boolean;
64
- } | {
65
- kind: "git-tag";
66
- label: "git:tag";
67
- serializable: true;
68
- } | {
69
- kind: "build-timestamp";
70
- label: "build:timestamp";
71
- serializable: true;
72
- } | {
73
- kind: "package-json";
74
- label: string;
75
- path: string;
76
- serializable: true;
77
- };
78
- interface EnvVariableDeclaration {
79
- default?: unknown;
80
- kind: "env-variable";
81
- mode: EnvMode;
82
- required: boolean;
83
- schema: unknown;
84
- secret: boolean;
85
- source?: EnvSource;
86
- type?: string;
87
- }
88
- interface EnvVariableOptions {
89
- default?: unknown;
90
- mode?: EnvMode;
91
- optional?: boolean;
92
- required?: boolean;
93
- schema?: unknown;
94
- secret?: boolean;
95
- source?: EnvSource | EnvSourceResolver;
96
- type?: string;
97
- }
98
- type EnvBuildStaticValue = null | string | number | boolean | EnvBuildStaticValue[];
99
- type EnvBuildConfigValue = EnvBuildConfigOptions | EnvBuildStaticValue | EnvVariableDeclaration;
100
- interface EnvBuildConfigOptions {
101
- [key: string]: EnvBuildConfigValue;
102
- }
103
- interface EnvViteConfigOptions {
104
- define?: Record<string, EnvBuildConfigValue>;
105
- public?: Record<string, EnvVariableDeclaration>;
106
- server?: EnvRuntimeConfigOptions;
107
- }
108
- type EnvRuntimeStaticValue = null | string | number | boolean | EnvRuntimeStaticValue[];
109
- type EnvRuntimeConfigValue = EnvRuntimeConfigOptions | EnvRuntimeStaticValue | EnvVariableDeclaration;
110
- interface EnvRuntimeConfigOptions {
111
- [key: string]: EnvRuntimeConfigValue;
112
- }
113
- type EnvConfigOptions = EnvViteConfigOptions;
114
- interface EnvViteUserConfig {
115
- env?: EnvViteConfigOptions;
116
- }
117
- interface EnvDiagnosticEntry {
118
- exposed: string;
119
- key: string;
120
- masked: boolean;
121
- mode: EnvMode;
122
- source: string;
123
- status: "defaulted" | "missing" | "valid";
124
- timing: string;
125
- type?: string;
126
- }
127
- interface EnvRegistryEntry {
128
- default?: unknown;
129
- required: boolean;
130
- schema?: EnvRuntimeSchema;
131
- secret: boolean;
132
- source: Extract<EnvSource, {
133
- kind: "env";
134
- }>;
135
- type?: string;
136
- }
137
- interface EnvRuntimeSchema {
138
- kind: "string";
139
- }
140
- interface EnvRuntimeLiteralEntry {
141
- kind: "literal";
142
- value: EnvRuntimeStaticValue;
143
- }
144
- type EnvRuntimeRegistryValue = EnvRegistryEntry | EnvRuntimeLiteralEntry | EnvRuntimeRegistry;
145
- interface EnvRuntimeRegistry {
146
- [key: string]: EnvRuntimeRegistryValue;
147
- }
148
- interface ServerEnv {
149
- [key: string]: unknown;
150
- }
151
- type PublicEnv = Record<string, unknown>;
152
- //#endregion
153
- export { EnvMode as a, EnvSource as c, EnvVariableDeclaration as d, EnvVariableOptions as f, ServerEnv as g, PublicEnv as h, EnvIntegrationOptions as i, EnvSourceContext as l, EnvViteUserConfig as m, EnvDiagnosticEntry as n, EnvRuntimeConfigOptions as o, EnvViteConfigOptions as p, EnvDiagnostics as r, EnvRuntimeRegistry as s, EnvConfigOptions as t, EnvSourceResolver as u };