veryfront 0.1.486 → 0.1.487

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 (30) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/deps/jsr.io/@std/dotenv/0.225.6/mod.d.ts +164 -0
  3. package/esm/deps/jsr.io/@std/dotenv/0.225.6/mod.d.ts.map +1 -0
  4. package/esm/deps/jsr.io/@std/dotenv/0.225.6/mod.js +212 -0
  5. package/esm/deps/jsr.io/@std/dotenv/0.225.6/parse.d.ts +19 -0
  6. package/esm/deps/jsr.io/@std/dotenv/0.225.6/parse.d.ts.map +1 -0
  7. package/esm/deps/jsr.io/@std/dotenv/0.225.6/parse.js +69 -0
  8. package/esm/deps/jsr.io/@std/dotenv/0.225.6/stringify.d.ts +17 -0
  9. package/esm/deps/jsr.io/@std/dotenv/0.225.6/stringify.d.ts.map +1 -0
  10. package/esm/deps/jsr.io/@std/dotenv/0.225.6/stringify.js +45 -0
  11. package/esm/src/agent/hosted-agent-service-env-files.d.ts +10 -0
  12. package/esm/src/agent/hosted-agent-service-env-files.d.ts.map +1 -0
  13. package/esm/src/agent/hosted-agent-service-env-files.js +33 -0
  14. package/esm/src/agent/index.d.ts +1 -0
  15. package/esm/src/agent/index.d.ts.map +1 -1
  16. package/esm/src/agent/index.js +1 -0
  17. package/esm/src/platform/compat/std/dotenv.d.ts +18 -0
  18. package/esm/src/platform/compat/std/dotenv.d.ts.map +1 -0
  19. package/esm/src/platform/compat/std/dotenv.js +70 -0
  20. package/esm/src/utils/version-constant.d.ts +1 -1
  21. package/esm/src/utils/version-constant.js +1 -1
  22. package/package.json +1 -1
  23. package/src/deno.js +1 -1
  24. package/src/deps/jsr.io/@std/dotenv/0.225.6/mod.ts +251 -0
  25. package/src/deps/jsr.io/@std/dotenv/0.225.6/parse.ts +110 -0
  26. package/src/deps/jsr.io/@std/dotenv/0.225.6/stringify.ts +48 -0
  27. package/src/src/agent/hosted-agent-service-env-files.ts +55 -0
  28. package/src/src/agent/index.ts +5 -0
  29. package/src/src/platform/compat/std/dotenv.ts +87 -0
  30. package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.486",
3
+ "version": "0.1.487",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -0,0 +1,164 @@
1
+ export * from "./stringify.js";
2
+ export * from "./parse.js";
3
+ /** Options for {@linkcode load} and {@linkcode loadSync}. */
4
+ export interface LoadOptions {
5
+ /**
6
+ * Optional path to `.env` file. To prevent the default value from being
7
+ * used, set to `null`.
8
+ *
9
+ * @default {"./.env"}
10
+ */
11
+ envPath?: string | URL | null;
12
+ /**
13
+ * Set to `true` to export all `.env` variables to the current processes
14
+ * environment. Variables are then accessible via `Deno.env.get(<key>)`.
15
+ *
16
+ * @default {false}
17
+ */
18
+ export?: boolean;
19
+ }
20
+ /**
21
+ * Works identically to {@linkcode load}, but synchronously.
22
+ *
23
+ * @example Usage
24
+ * ```ts ignore
25
+ * import { loadSync } from "@std/dotenv";
26
+ *
27
+ * const conf = loadSync();
28
+ * ```
29
+ *
30
+ * @param options Options for loading the environment variables.
31
+ * @returns The parsed environment variables.
32
+ */
33
+ export declare function loadSync(options?: LoadOptions): Record<string, string>;
34
+ /**
35
+ * Load environment variables from a `.env` file. Loaded variables are accessible
36
+ * in a configuration object returned by the `load()` function, as well as optionally
37
+ * exporting them to the process environment using the `export` option.
38
+ *
39
+ * Inspired by the node modules {@linkcode https://github.com/motdotla/dotenv | dotenv}
40
+ * and {@linkcode https://github.com/motdotla/dotenv-expand | dotenv-expand}.
41
+ *
42
+ * Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.
43
+ *
44
+ * ## Basic usage
45
+ * ```sh
46
+ * # .env
47
+ * GREETING=hello world
48
+ * ```
49
+ *
50
+ * Then import the environment variables using the `load` function.
51
+ *
52
+ * @example Basic usage
53
+ * ```ts ignore
54
+ * // app.ts
55
+ * import { load } from "@std/dotenv";
56
+ *
57
+ * console.log(await load({ export: true })); // { GREETING: "hello world" }
58
+ * console.log(Deno.env.get("GREETING")); // hello world
59
+ * ```
60
+ *
61
+ * Run this with `deno run --allow-read --allow-env app.ts`.
62
+ *
63
+ * .env files support blank lines, comments, multi-line values and more.
64
+ * See Parsing Rules below for more detail.
65
+ *
66
+ * ## Auto loading
67
+ * Import the `load.ts` module to auto-import from the `.env` file and into
68
+ * the process environment.
69
+ *
70
+ * @example Auto-loading
71
+ * ```ts ignore
72
+ * // app.ts
73
+ * import "@std/dotenv/load";
74
+ *
75
+ * console.log(Deno.env.get("GREETING")); // hello world
76
+ * ```
77
+ *
78
+ * Run this with `deno run --allow-read --allow-env app.ts`.
79
+ *
80
+ * ## Files
81
+ * Dotenv supports a number of different files, all of which are optional.
82
+ * File names and paths are configurable.
83
+ *
84
+ * |File|Purpose|
85
+ * |----|-------|
86
+ * |.env|primary file for storing key-value environment entries
87
+ *
88
+ * ## Configuration
89
+ *
90
+ * Loading environment files comes with a number of options passed into
91
+ * the `load()` function, all of which are optional.
92
+ *
93
+ * |Option|Default|Description
94
+ * |------|-------|-----------
95
+ * |envPath|./.env|Path and filename of the `.env` file. Use null to prevent the .env file from being loaded.
96
+ * |export|false|When true, this will export all environment variables in the `.env` file to the process environment (e.g. for use by `Deno.env.get()`) but only if they are not already set. If a variable is already in the process, the `.env` value is ignored.
97
+ *
98
+ * ### Example configuration
99
+ *
100
+ * @example Using with options
101
+ * ```ts ignore
102
+ * import { load } from "@std/dotenv";
103
+ *
104
+ * const conf = await load({
105
+ * envPath: "./.env_prod", // Uses .env_prod instead of .env
106
+ * export: true, // Exports all variables to the environment
107
+ * });
108
+ * ```
109
+ *
110
+ * ## Permissions
111
+ *
112
+ * At a minimum, loading the `.env` related files requires the `--allow-read` permission. Additionally, if
113
+ * you access the process environment, either through exporting your configuration or expanding variables
114
+ * in your `.env` file, you will need the `--allow-env` permission. E.g.
115
+ *
116
+ * ```sh
117
+ * deno run --allow-read=.env --allow-env=ENV1,ENV2 app.ts
118
+ * ```
119
+ *
120
+ * ## Parsing Rules
121
+ *
122
+ * The parsing engine currently supports the following rules:
123
+ *
124
+ * - Variables that already exist in the environment are not overridden with
125
+ * `export: true`
126
+ * - `BASIC=basic` becomes `{ BASIC: "basic" }`
127
+ * - empty lines are skipped
128
+ * - lines beginning with `#` are treated as comments
129
+ * - empty values become empty strings (`EMPTY=` becomes `{ EMPTY: "" }`)
130
+ * - single and double quoted values are escaped (`SINGLE_QUOTE='quoted'` becomes
131
+ * `{ SINGLE_QUOTE: "quoted" }`)
132
+ * - new lines are expanded in double quoted values (`MULTILINE="new\nline"`
133
+ * becomes
134
+ *
135
+ * ```
136
+ * { MULTILINE: "new\nline" }
137
+ * ```
138
+ *
139
+ * - inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes
140
+ * `{ JSON: "{\"foo\": \"bar\"}" }`)
141
+ * - whitespace is removed from both ends of unquoted values (see more on
142
+ * {@linkcode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim | trim})
143
+ * (`FOO= some value` becomes `{ FOO: "some value" }`)
144
+ * - whitespace is preserved on both ends of quoted values (`FOO=" some value "`
145
+ * becomes `{ FOO: " some value " }`)
146
+ * - dollar sign with an environment key in or without curly braces in unquoted
147
+ * values will expand the environment key (`KEY=$KEY` or `KEY=${KEY}` becomes
148
+ * `{ KEY: "<KEY_VALUE_FROM_ENV>" }`)
149
+ * - escaped dollar sign with an environment key in unquoted values will escape the
150
+ * environment key rather than expand (`KEY=\$KEY` becomes `{ KEY: "\\$KEY" }`)
151
+ * - colon and a minus sign with a default value(which can also be another expand
152
+ * value) in expanding construction in unquoted values will first attempt to
153
+ * expand the environment key. If it’s not found, then it will return the default
154
+ * value (`KEY=${KEY:-default}` If KEY exists it becomes
155
+ * `{ KEY: "<KEY_VALUE_FROM_ENV>" }` If not, then it becomes
156
+ * `{ KEY: "default" }`. Also there is possible to do this case
157
+ * `KEY=${NO_SUCH_KEY:-${EXISTING_KEY:-default}}` which becomes
158
+ * `{ KEY: "<EXISTING_KEY_VALUE_FROM_ENV>" }`)
159
+ *
160
+ * @param options The options
161
+ * @returns The parsed environment variables
162
+ */
163
+ export declare function load(options?: LoadOptions): Promise<Record<string, string>>;
164
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/dotenv/0.225.6/mod.ts"],"names":[],"mappings":"AA4BA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAE3B,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;IAE9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,OAAO,GAAE,WAAgB,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAexB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgIG;AACH,wBAAsB,IAAI,CACxB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAejC"}
@@ -0,0 +1,212 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ /**
3
+ * Parses and loads environment variables from a `.env` file into the current
4
+ * process, or stringify data into a `.env` file format.
5
+ *
6
+ * Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.
7
+ *
8
+ * ```ts ignore
9
+ * // Automatically load environment variables from a `.env` file
10
+ * import "@std/dotenv/load";
11
+ * ```
12
+ *
13
+ * ```ts
14
+ * import { parse, stringify } from "@std/dotenv";
15
+ * import { assertEquals } from "@std/assert";
16
+ *
17
+ * assertEquals(parse("GREETING=hello world"), { GREETING: "hello world" });
18
+ * assertEquals(stringify({ GREETING: "hello world" }), "GREETING='hello world'");
19
+ * ```
20
+ *
21
+ * @module
22
+ */
23
+ import * as dntShim from "../../../../../_dnt.shims.js";
24
+ import { parse } from "./parse.js";
25
+ export * from "./stringify.js";
26
+ export * from "./parse.js";
27
+ /**
28
+ * Works identically to {@linkcode load}, but synchronously.
29
+ *
30
+ * @example Usage
31
+ * ```ts ignore
32
+ * import { loadSync } from "@std/dotenv";
33
+ *
34
+ * const conf = loadSync();
35
+ * ```
36
+ *
37
+ * @param options Options for loading the environment variables.
38
+ * @returns The parsed environment variables.
39
+ */
40
+ export function loadSync(options = {}) {
41
+ const { envPath = ".env", export: _export = false, } = options;
42
+ const conf = envPath ? parseFileSync(envPath) : {};
43
+ if (_export) {
44
+ for (const [key, value] of Object.entries(conf)) {
45
+ if (dntShim.Deno.env.get(key) !== undefined)
46
+ continue;
47
+ dntShim.Deno.env.set(key, value);
48
+ }
49
+ }
50
+ return conf;
51
+ }
52
+ /**
53
+ * Load environment variables from a `.env` file. Loaded variables are accessible
54
+ * in a configuration object returned by the `load()` function, as well as optionally
55
+ * exporting them to the process environment using the `export` option.
56
+ *
57
+ * Inspired by the node modules {@linkcode https://github.com/motdotla/dotenv | dotenv}
58
+ * and {@linkcode https://github.com/motdotla/dotenv-expand | dotenv-expand}.
59
+ *
60
+ * Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.
61
+ *
62
+ * ## Basic usage
63
+ * ```sh
64
+ * # .env
65
+ * GREETING=hello world
66
+ * ```
67
+ *
68
+ * Then import the environment variables using the `load` function.
69
+ *
70
+ * @example Basic usage
71
+ * ```ts ignore
72
+ * // app.ts
73
+ * import { load } from "@std/dotenv";
74
+ *
75
+ * console.log(await load({ export: true })); // { GREETING: "hello world" }
76
+ * console.log(Deno.env.get("GREETING")); // hello world
77
+ * ```
78
+ *
79
+ * Run this with `deno run --allow-read --allow-env app.ts`.
80
+ *
81
+ * .env files support blank lines, comments, multi-line values and more.
82
+ * See Parsing Rules below for more detail.
83
+ *
84
+ * ## Auto loading
85
+ * Import the `load.ts` module to auto-import from the `.env` file and into
86
+ * the process environment.
87
+ *
88
+ * @example Auto-loading
89
+ * ```ts ignore
90
+ * // app.ts
91
+ * import "@std/dotenv/load";
92
+ *
93
+ * console.log(Deno.env.get("GREETING")); // hello world
94
+ * ```
95
+ *
96
+ * Run this with `deno run --allow-read --allow-env app.ts`.
97
+ *
98
+ * ## Files
99
+ * Dotenv supports a number of different files, all of which are optional.
100
+ * File names and paths are configurable.
101
+ *
102
+ * |File|Purpose|
103
+ * |----|-------|
104
+ * |.env|primary file for storing key-value environment entries
105
+ *
106
+ * ## Configuration
107
+ *
108
+ * Loading environment files comes with a number of options passed into
109
+ * the `load()` function, all of which are optional.
110
+ *
111
+ * |Option|Default|Description
112
+ * |------|-------|-----------
113
+ * |envPath|./.env|Path and filename of the `.env` file. Use null to prevent the .env file from being loaded.
114
+ * |export|false|When true, this will export all environment variables in the `.env` file to the process environment (e.g. for use by `Deno.env.get()`) but only if they are not already set. If a variable is already in the process, the `.env` value is ignored.
115
+ *
116
+ * ### Example configuration
117
+ *
118
+ * @example Using with options
119
+ * ```ts ignore
120
+ * import { load } from "@std/dotenv";
121
+ *
122
+ * const conf = await load({
123
+ * envPath: "./.env_prod", // Uses .env_prod instead of .env
124
+ * export: true, // Exports all variables to the environment
125
+ * });
126
+ * ```
127
+ *
128
+ * ## Permissions
129
+ *
130
+ * At a minimum, loading the `.env` related files requires the `--allow-read` permission. Additionally, if
131
+ * you access the process environment, either through exporting your configuration or expanding variables
132
+ * in your `.env` file, you will need the `--allow-env` permission. E.g.
133
+ *
134
+ * ```sh
135
+ * deno run --allow-read=.env --allow-env=ENV1,ENV2 app.ts
136
+ * ```
137
+ *
138
+ * ## Parsing Rules
139
+ *
140
+ * The parsing engine currently supports the following rules:
141
+ *
142
+ * - Variables that already exist in the environment are not overridden with
143
+ * `export: true`
144
+ * - `BASIC=basic` becomes `{ BASIC: "basic" }`
145
+ * - empty lines are skipped
146
+ * - lines beginning with `#` are treated as comments
147
+ * - empty values become empty strings (`EMPTY=` becomes `{ EMPTY: "" }`)
148
+ * - single and double quoted values are escaped (`SINGLE_QUOTE='quoted'` becomes
149
+ * `{ SINGLE_QUOTE: "quoted" }`)
150
+ * - new lines are expanded in double quoted values (`MULTILINE="new\nline"`
151
+ * becomes
152
+ *
153
+ * ```
154
+ * { MULTILINE: "new\nline" }
155
+ * ```
156
+ *
157
+ * - inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes
158
+ * `{ JSON: "{\"foo\": \"bar\"}" }`)
159
+ * - whitespace is removed from both ends of unquoted values (see more on
160
+ * {@linkcode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim | trim})
161
+ * (`FOO= some value` becomes `{ FOO: "some value" }`)
162
+ * - whitespace is preserved on both ends of quoted values (`FOO=" some value "`
163
+ * becomes `{ FOO: " some value " }`)
164
+ * - dollar sign with an environment key in or without curly braces in unquoted
165
+ * values will expand the environment key (`KEY=$KEY` or `KEY=${KEY}` becomes
166
+ * `{ KEY: "<KEY_VALUE_FROM_ENV>" }`)
167
+ * - escaped dollar sign with an environment key in unquoted values will escape the
168
+ * environment key rather than expand (`KEY=\$KEY` becomes `{ KEY: "\\$KEY" }`)
169
+ * - colon and a minus sign with a default value(which can also be another expand
170
+ * value) in expanding construction in unquoted values will first attempt to
171
+ * expand the environment key. If it’s not found, then it will return the default
172
+ * value (`KEY=${KEY:-default}` If KEY exists it becomes
173
+ * `{ KEY: "<KEY_VALUE_FROM_ENV>" }` If not, then it becomes
174
+ * `{ KEY: "default" }`. Also there is possible to do this case
175
+ * `KEY=${NO_SUCH_KEY:-${EXISTING_KEY:-default}}` which becomes
176
+ * `{ KEY: "<EXISTING_KEY_VALUE_FROM_ENV>" }`)
177
+ *
178
+ * @param options The options
179
+ * @returns The parsed environment variables
180
+ */
181
+ export async function load(options = {}) {
182
+ const { envPath = ".env", export: _export = false, } = options;
183
+ const conf = envPath ? await parseFile(envPath) : {};
184
+ if (_export) {
185
+ for (const [key, value] of Object.entries(conf)) {
186
+ if (dntShim.Deno.env.get(key) !== undefined)
187
+ continue;
188
+ dntShim.Deno.env.set(key, value);
189
+ }
190
+ }
191
+ return conf;
192
+ }
193
+ function parseFileSync(filepath) {
194
+ try {
195
+ return parse(dntShim.Deno.readTextFileSync(filepath));
196
+ }
197
+ catch (e) {
198
+ if (e instanceof dntShim.Deno.errors.NotFound)
199
+ return {};
200
+ throw e;
201
+ }
202
+ }
203
+ async function parseFile(filepath) {
204
+ try {
205
+ return parse(await dntShim.Deno.readTextFile(filepath));
206
+ }
207
+ catch (e) {
208
+ if (e instanceof dntShim.Deno.errors.NotFound)
209
+ return {};
210
+ throw e;
211
+ }
212
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Parse `.env` file output in an object.
3
+ *
4
+ * Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.
5
+ *
6
+ * @example Usage
7
+ * ```ts
8
+ * import { parse } from "@std/dotenv/parse";
9
+ * import { assertEquals } from "@std/assert";
10
+ *
11
+ * const env = parse("GREETING=hello world");
12
+ * assertEquals(env, { GREETING: "hello world" });
13
+ * ```
14
+ *
15
+ * @param text The text to parse.
16
+ * @returns The parsed object.
17
+ */
18
+ export declare function parse(text: string): Record<string, string>;
19
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/dotenv/0.225.6/parse.ts"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoC1D"}
@@ -0,0 +1,69 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ import * as dntShim from "../../../../../_dnt.shims.js";
3
+ const KEY_VALUE_REGEXP = /^\s*(?:export\s+)?(?<key>[^\s=#]+?)\s*=[\ \t]*('\r?\n?(?<notInterpolated>(.|\r\n|\n)*?)\r?\n?'|"\r?\n?(?<interpolated>(.|\r\n|\n)*?)\r?\n?"|(?<unquoted>[^\r\n#]*)) *#*.*$/gm;
4
+ const VALID_KEY_REGEXP = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
5
+ const EXPAND_VALUE_REGEXP = /(\${(?<inBrackets>.+?)(\:-(?<inBracketsDefault>.+))?}|(?<!\\)\$(?<notInBrackets>\w+)(\:-(?<notInBracketsDefault>.+))?)/g;
6
+ const CHARACTERS_MAP = {
7
+ "\\n": "\n",
8
+ "\\r": "\r",
9
+ "\\t": "\t",
10
+ };
11
+ function expandCharacters(str) {
12
+ return str.replace(/\\([nrt])/g, ($1) => CHARACTERS_MAP[$1] ?? "");
13
+ }
14
+ function expand(str, variablesMap) {
15
+ let current = str;
16
+ while (EXPAND_VALUE_REGEXP.test(current)) {
17
+ current = current.replace(EXPAND_VALUE_REGEXP, (...params) => {
18
+ const { inBrackets, inBracketsDefault, notInBrackets, notInBracketsDefault, } = params.at(-1);
19
+ const expandValue = inBrackets ?? notInBrackets;
20
+ const defaultValue = inBracketsDefault ?? notInBracketsDefault;
21
+ return (variablesMap[expandValue] ?? dntShim.Deno.env.get(expandValue) ?? defaultValue);
22
+ });
23
+ }
24
+ return current;
25
+ }
26
+ /**
27
+ * Parse `.env` file output in an object.
28
+ *
29
+ * Note: The key needs to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.
30
+ *
31
+ * @example Usage
32
+ * ```ts
33
+ * import { parse } from "@std/dotenv/parse";
34
+ * import { assertEquals } from "@std/assert";
35
+ *
36
+ * const env = parse("GREETING=hello world");
37
+ * assertEquals(env, { GREETING: "hello world" });
38
+ * ```
39
+ *
40
+ * @param text The text to parse.
41
+ * @returns The parsed object.
42
+ */
43
+ export function parse(text) {
44
+ const env = Object.create(null);
45
+ const keysForExpandCheck = [];
46
+ for (const match of text.matchAll(KEY_VALUE_REGEXP)) {
47
+ const { key, interpolated, notInterpolated, unquoted } = match
48
+ ?.groups;
49
+ if (!VALID_KEY_REGEXP.test(key)) {
50
+ // deno-lint-ignore no-console
51
+ console.warn(`Ignored the key "${key}" as it is not a valid identifier: The key need to match the pattern /^[a-zA-Z_][a-zA-Z0-9_]*$/.`);
52
+ continue;
53
+ }
54
+ if (unquoted) {
55
+ keysForExpandCheck.push(key);
56
+ }
57
+ env[key] = typeof notInterpolated === "string"
58
+ ? notInterpolated
59
+ : typeof interpolated === "string"
60
+ ? expandCharacters(interpolated)
61
+ : unquoted.trim();
62
+ }
63
+ //https://github.com/motdotla/dotenv-expand/blob/ed5fea5bf517a09fd743ce2c63150e88c8a5f6d1/lib/main.js#L23
64
+ const variablesMap = { ...env };
65
+ for (const key of keysForExpandCheck) {
66
+ env[key] = expand(env[key], variablesMap);
67
+ }
68
+ return env;
69
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Stringify an object into a valid `.env` file format.
3
+ *
4
+ * @example Usage
5
+ * ```ts
6
+ * import { stringify } from "@std/dotenv/stringify";
7
+ * import { assertEquals } from "@std/assert";
8
+ *
9
+ * const object = { GREETING: "hello world" };
10
+ * assertEquals(stringify(object), "GREETING='hello world'");
11
+ * ```
12
+ *
13
+ * @param object object to be stringified
14
+ * @returns string of object
15
+ */
16
+ export declare function stringify(object: Record<string, string>): string;
17
+ //# sourceMappingURL=stringify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/dotenv/0.225.6/stringify.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CA6BhE"}
@@ -0,0 +1,45 @@
1
+ // Copyright 2018-2025 the Deno authors. MIT license.
2
+ // This module is browser compatible.
3
+ /**
4
+ * Stringify an object into a valid `.env` file format.
5
+ *
6
+ * @example Usage
7
+ * ```ts
8
+ * import { stringify } from "@std/dotenv/stringify";
9
+ * import { assertEquals } from "@std/assert";
10
+ *
11
+ * const object = { GREETING: "hello world" };
12
+ * assertEquals(stringify(object), "GREETING='hello world'");
13
+ * ```
14
+ *
15
+ * @param object object to be stringified
16
+ * @returns string of object
17
+ */
18
+ export function stringify(object) {
19
+ const lines = [];
20
+ for (const [key, value] of Object.entries(object)) {
21
+ let quote;
22
+ let escapedValue = value ?? "";
23
+ if (key.startsWith("#")) {
24
+ // deno-lint-ignore no-console
25
+ console.warn(`key starts with a '#' indicates a comment and is ignored: '${key}'`);
26
+ continue;
27
+ }
28
+ else if (escapedValue.includes("\n") || escapedValue.includes("'")) {
29
+ // escape inner new lines
30
+ escapedValue = escapedValue.replaceAll("\n", "\\n");
31
+ quote = `"`;
32
+ }
33
+ else if (escapedValue.match(/\W/)) {
34
+ quote = "'";
35
+ }
36
+ if (quote) {
37
+ // escape inner quotes
38
+ escapedValue = escapedValue.replaceAll(quote, `\\${quote}`);
39
+ escapedValue = `${quote}${escapedValue}${quote}`;
40
+ }
41
+ const line = `${key}=${escapedValue}`;
42
+ lines.push(line);
43
+ }
44
+ return lines.join("\n");
45
+ }
@@ -0,0 +1,10 @@
1
+ export type HostedAgentServiceEnvFileLoadResult = {
2
+ loadedFiles: string[];
3
+ loadedVariables: number;
4
+ };
5
+ export type HostedAgentServiceEnvFileLoadOptions = {
6
+ cwd?: string;
7
+ files?: readonly string[];
8
+ };
9
+ export declare function loadHostedAgentServiceEnvFiles(options?: HostedAgentServiceEnvFileLoadOptions): Promise<HostedAgentServiceEnvFileLoadResult>;
10
+ //# sourceMappingURL=hosted-agent-service-env-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-agent-service-env-files.d.ts","sourceRoot":"","sources":["../../../src/src/agent/hosted-agent-service-env-files.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,mCAAmC,GAAG;IAChD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,CAAC;AAUF,wBAAsB,8BAA8B,CAClD,OAAO,GAAE,oCAAyC,GACjD,OAAO,CAAC,mCAAmC,CAAC,CA6B9C"}
@@ -0,0 +1,33 @@
1
+ import { cwd as getCwd, env as getProcessEnv, setEnv } from "../platform/compat/process.js";
2
+ import { load as loadDotenv } from "../platform/compat/std/dotenv.js";
3
+ const DEFAULT_HOSTED_AGENT_SERVICE_ENV_FILES = [".env", ".env.local"];
4
+ function joinEnvPath(cwd, file) {
5
+ if (file.startsWith("/") || file.startsWith("./") || file.startsWith("../")) {
6
+ return file;
7
+ }
8
+ return `${cwd.replace(/\/$/, "")}/${file}`;
9
+ }
10
+ export async function loadHostedAgentServiceEnvFiles(options = {}) {
11
+ const cwd = options.cwd ?? getCwd();
12
+ const files = options.files ?? DEFAULT_HOSTED_AGENT_SERVICE_ENV_FILES;
13
+ const protectedKeys = new Set(Object.keys(getProcessEnv()));
14
+ const loadedFiles = [];
15
+ let loadedVariables = 0;
16
+ for (const file of files) {
17
+ const envPath = joinEnvPath(cwd, file);
18
+ const parsed = await loadDotenv({ envPath, allowEmptyValues: true });
19
+ const entries = Object.entries(parsed);
20
+ if (entries.length === 0) {
21
+ continue;
22
+ }
23
+ loadedFiles.push(envPath);
24
+ for (const [key, value] of entries) {
25
+ if (protectedKeys.has(key)) {
26
+ continue;
27
+ }
28
+ setEnv(key, value);
29
+ loadedVariables++;
30
+ }
31
+ }
32
+ return { loadedFiles, loadedVariables };
33
+ }
@@ -100,6 +100,7 @@ export { createDefaultHostedChatRuntime, type CreateDefaultHostedChatRuntimeCont
100
100
  export { createDefaultHostedProjectSteeringRefresh, type CreateDefaultHostedProjectSteeringRefreshOptions, type DefaultHostedProjectSteeringRefreshLogger, type DefaultHostedProjectSteeringRefreshLookup, } from "./default-hosted-project-steering-refresh.js";
101
101
  export { createHostedAgentServiceRuntime, type CreateHostedAgentServiceRuntimeOptions, type HostedAgentServiceRuntimeBundle, type HostedAgentServiceRuntimeConfig, type HostedAgentServiceRuntimeLogger, type HostedAgentServiceRuntimeTrace, startNodeHostedAgentService, type StartNodeHostedAgentServiceOptions, type StartNodeHostedAgentServiceResult, } from "./hosted-agent-service-runtime.js";
102
102
  export { type HostedAgentServiceConfig, type HostedAgentServiceConfigInput, hostedAgentServiceConfigSchema, parseHostedAgentServiceConfig, } from "./hosted-agent-service-config.js";
103
+ export { type HostedAgentServiceEnvFileLoadOptions, type HostedAgentServiceEnvFileLoadResult, loadHostedAgentServiceEnvFiles, } from "./hosted-agent-service-env-files.js";
103
104
  export { type AgentServiceBootstrapExit, type AgentServiceTraceContext, type AgentServiceTraceContextGetter, bootstrapAgentService, type BootstrapAgentServiceOptions, runAgentServiceMain, type RunAgentServiceMainOptions, } from "./agent-service-bootstrap.js";
104
105
  export { type AbortRejectionEvent, type AbortRejectionEventTarget, type AbortRejectionGuardLogger, type AbortRejectionProcessTarget, installAbortRejectionGuard, type InstallAbortRejectionGuardOptions, type InstalledAbortRejectionGuard, isAbortRejectionReason, } from "./abort-rejection-guard.js";
105
106
  export { type CachedRequestAuthResult, createRequestAuthCache, type CreateRequestAuthCacheOptions, type RequestAuthCache, } from "./request-auth-cache.js";