nitro-nightly 3.0.1-20260106-202835-5325b208 → 3.0.1-20260106-205209-b085a480

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 (86) hide show
  1. package/dist/_build/common.mjs +24899 -0
  2. package/dist/_build/rolldown.mjs +6 -9
  3. package/dist/_build/rollup.mjs +6 -8
  4. package/dist/_build/vite.build.mjs +1 -1
  5. package/dist/{_dev.mjs → _chunks/dev.mjs} +4 -7
  6. package/dist/{_nitro.mjs → _chunks/nitro.mjs} +16 -195
  7. package/dist/_chunks/nitro2.mjs +101 -0
  8. package/dist/_chunks/utils.mjs +278 -0
  9. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +32 -4
  10. package/dist/_libs/@jridgewell/gen-mapping.mjs +304 -2
  11. package/dist/_libs/@jridgewell/remapping.mjs +1 -2
  12. package/dist/_libs/@rollup/plugin-commonjs.mjs +75 -31
  13. package/dist/_libs/@rollup/plugin-inject.mjs +1 -3
  14. package/dist/_libs/@rollup/plugin-json.mjs +1 -1
  15. package/dist/_libs/@rollup/plugin-node-resolve.mjs +1111 -7
  16. package/dist/_libs/c12.mjs +597 -41
  17. package/dist/_libs/chokidar.mjs +235 -2
  18. package/dist/_libs/confbox.mjs +454 -1476
  19. package/dist/_libs/estree-walker.mjs +1 -144
  20. package/dist/_libs/giget.mjs +2235 -1377
  21. package/dist/_libs/httpxy.mjs +1 -1
  22. package/dist/_libs/unimport.mjs +1547 -1772
  23. package/dist/_presets.mjs +3 -9
  24. package/dist/builder.mjs +7 -12
  25. package/dist/cli/_chunks/{build2.mjs → build.mjs} +1 -1
  26. package/dist/cli/_chunks/dev.mjs +3 -5
  27. package/dist/cli/_chunks/list.mjs +1 -1
  28. package/dist/cli/_chunks/prepare.mjs +1 -1
  29. package/dist/cli/_chunks/run.mjs +1 -1
  30. package/dist/cli/index.mjs +1 -1
  31. package/dist/vite.mjs +14 -1128
  32. package/package.json +1 -1
  33. package/dist/_build/rollup2.mjs +0 -56
  34. package/dist/_build/shared.mjs +0 -60
  35. package/dist/_build/shared2.mjs +0 -40
  36. package/dist/_build/shared3.mjs +0 -68
  37. package/dist/_libs/@jridgewell/resolve-uri.mjs +0 -166
  38. package/dist/_libs/@jridgewell/sourcemap-codec.mjs +0 -167
  39. package/dist/_libs/@jridgewell/trace-mapping.mjs +0 -141
  40. package/dist/_libs/@rolldown/pluginutils.mjs +0 -31
  41. package/dist/_libs/@rollup/plugin-replace.mjs +0 -104
  42. package/dist/_libs/@rollup/pluginutils.mjs +0 -241
  43. package/dist/_libs/acorn.mjs +0 -5034
  44. package/dist/_libs/commondir.mjs +0 -22
  45. package/dist/_libs/deepmerge.mjs +0 -86
  46. package/dist/_libs/dot-prop.mjs +0 -138
  47. package/dist/_libs/dotenv.mjs +0 -345
  48. package/dist/_libs/duplexer.mjs +0 -71
  49. package/dist/_libs/etag.mjs +0 -80
  50. package/dist/_libs/exsolve.mjs +0 -1007
  51. package/dist/_libs/fdir.mjs +0 -514
  52. package/dist/_libs/function-bind.mjs +0 -63
  53. package/dist/_libs/gzip-size.mjs +0 -21
  54. package/dist/_libs/hasown.mjs +0 -14
  55. package/dist/_libs/is-core-module.mjs +0 -220
  56. package/dist/_libs/is-module.mjs +0 -13
  57. package/dist/_libs/is-reference.mjs +0 -33
  58. package/dist/_libs/js-tokens.mjs +0 -382
  59. package/dist/_libs/knitwork.mjs +0 -124
  60. package/dist/_libs/local-pkg.mjs +0 -125
  61. package/dist/_libs/magic-string.mjs +0 -939
  62. package/dist/_libs/mime.mjs +0 -1391
  63. package/dist/_libs/mlly.mjs +0 -1415
  64. package/dist/_libs/node-fetch-native.mjs +0 -7
  65. package/dist/_libs/nypm.mjs +0 -239
  66. package/dist/_libs/path-parse.mjs +0 -47
  67. package/dist/_libs/pathe.mjs +0 -202
  68. package/dist/_libs/perfect-debounce.mjs +0 -89
  69. package/dist/_libs/picomatch.mjs +0 -1673
  70. package/dist/_libs/pkg-types.mjs +0 -197
  71. package/dist/_libs/pretty-bytes.mjs +0 -116
  72. package/dist/_libs/quansync.mjs +0 -90
  73. package/dist/_libs/rc9.mjs +0 -136
  74. package/dist/_libs/readdirp.mjs +0 -237
  75. package/dist/_libs/resolve.mjs +0 -689
  76. package/dist/_libs/std-env.mjs +0 -158
  77. package/dist/_libs/strip-literal.mjs +0 -51
  78. package/dist/_libs/tinyexec.mjs +0 -627
  79. package/dist/_libs/tinyglobby.mjs +0 -292
  80. package/dist/_libs/unplugin-utils.mjs +0 -61
  81. package/dist/_libs/unplugin.mjs +0 -1225
  82. package/dist/_libs/untyped.mjs +0 -271
  83. package/dist/_libs/unwasm.mjs +0 -5895
  84. package/dist/_libs/webpack-virtual-modules.mjs +0 -272
  85. package/dist/_nitro2.mjs +0 -303
  86. /package/dist/{_rolldown.mjs → _common.mjs} +0 -0
@@ -1,22 +0,0 @@
1
- import { r as __require, t as __commonJSMin } from "../_rolldown.mjs";
2
-
3
- //#region node_modules/.pnpm/commondir@1.0.1/node_modules/commondir/index.js
4
- var require_commondir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- var path = __require("path");
6
- module.exports = function(basedir, relfiles) {
7
- if (relfiles) var files = relfiles.map(function(r) {
8
- return path.resolve(basedir, r);
9
- });
10
- else var files = basedir;
11
- var res = files.slice(1).reduce(function(ps, file) {
12
- if (!file.match(/^([A-Za-z]:)?\/|\\/)) throw new Error("relative path without a basedir");
13
- var xs = file.split(/\/+|\\+/);
14
- for (var i = 0; ps[i] === xs[i] && i < Math.min(ps.length, xs.length); i++);
15
- return ps.slice(0, i);
16
- }, files[0].split(/\/+|\\+/));
17
- return res.length > 1 ? res.join("/") : "/";
18
- };
19
- }));
20
-
21
- //#endregion
22
- export { require_commondir as t };
@@ -1,86 +0,0 @@
1
- import { t as __commonJSMin } from "../_rolldown.mjs";
2
-
3
- //#region node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
4
- var require_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- var isMergeableObject = function isMergeableObject(value) {
6
- return isNonNullObject(value) && !isSpecial(value);
7
- };
8
- function isNonNullObject(value) {
9
- return !!value && typeof value === "object";
10
- }
11
- function isSpecial(value) {
12
- var stringValue = Object.prototype.toString.call(value);
13
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
14
- }
15
- var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.element") : 60103;
16
- function isReactElement(value) {
17
- return value.$$typeof === REACT_ELEMENT_TYPE;
18
- }
19
- function emptyTarget(val) {
20
- return Array.isArray(val) ? [] : {};
21
- }
22
- function cloneUnlessOtherwiseSpecified(value, options) {
23
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
24
- }
25
- function defaultArrayMerge(target, source, options) {
26
- return target.concat(source).map(function(element) {
27
- return cloneUnlessOtherwiseSpecified(element, options);
28
- });
29
- }
30
- function getMergeFunction(key, options) {
31
- if (!options.customMerge) return deepmerge;
32
- var customMerge = options.customMerge(key);
33
- return typeof customMerge === "function" ? customMerge : deepmerge;
34
- }
35
- function getEnumerableOwnPropertySymbols(target) {
36
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
37
- return Object.propertyIsEnumerable.call(target, symbol);
38
- }) : [];
39
- }
40
- function getKeys(target) {
41
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
42
- }
43
- function propertyIsOnObject(object, property) {
44
- try {
45
- return property in object;
46
- } catch (_) {
47
- return false;
48
- }
49
- }
50
- function propertyIsUnsafe(target, key) {
51
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
52
- }
53
- function mergeObject(target, source, options) {
54
- var destination = {};
55
- if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) {
56
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
57
- });
58
- getKeys(source).forEach(function(key) {
59
- if (propertyIsUnsafe(target, key)) return;
60
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
61
- else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
62
- });
63
- return destination;
64
- }
65
- function deepmerge(target, source, options) {
66
- options = options || {};
67
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
68
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
69
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
70
- var sourceIsArray = Array.isArray(source);
71
- if (!(sourceIsArray === Array.isArray(target))) return cloneUnlessOtherwiseSpecified(source, options);
72
- else if (sourceIsArray) return options.arrayMerge(target, source, options);
73
- else return mergeObject(target, source, options);
74
- }
75
- deepmerge.all = function deepmergeAll(array, options) {
76
- if (!Array.isArray(array)) throw new Error("first argument should be an array");
77
- return array.reduce(function(prev, next) {
78
- return deepmerge(prev, next, options);
79
- }, {});
80
- };
81
- var deepmerge_1 = deepmerge;
82
- module.exports = deepmerge_1;
83
- }));
84
-
85
- //#endregion
86
- export { require_cjs as t };
@@ -1,138 +0,0 @@
1
- //#region node_modules/.pnpm/dot-prop@10.1.0/node_modules/dot-prop/index.js
2
- const isObject = (value) => {
3
- const type = typeof value;
4
- return value !== null && (type === "object" || type === "function");
5
- };
6
- const disallowedKeys = new Set([
7
- "__proto__",
8
- "prototype",
9
- "constructor"
10
- ]);
11
- const MAX_ARRAY_INDEX = 1e6;
12
- const isDigit = (character) => character >= "0" && character <= "9";
13
- function shouldCoerceToNumber(segment) {
14
- if (segment === "0") return true;
15
- if (/^[1-9]\d*$/.test(segment)) {
16
- const parsedNumber = Number.parseInt(segment, 10);
17
- return parsedNumber <= Number.MAX_SAFE_INTEGER && parsedNumber <= MAX_ARRAY_INDEX;
18
- }
19
- return false;
20
- }
21
- function processSegment(segment, parts) {
22
- if (disallowedKeys.has(segment)) return false;
23
- if (segment && shouldCoerceToNumber(segment)) parts.push(Number.parseInt(segment, 10));
24
- else parts.push(segment);
25
- return true;
26
- }
27
- function parsePath(path) {
28
- if (typeof path !== "string") throw new TypeError(`Expected a string, got ${typeof path}`);
29
- const parts = [];
30
- let currentSegment = "";
31
- let currentPart = "start";
32
- let isEscaping = false;
33
- let position = 0;
34
- for (const character of path) {
35
- position++;
36
- if (isEscaping) {
37
- currentSegment += character;
38
- isEscaping = false;
39
- continue;
40
- }
41
- if (character === "\\") {
42
- if (currentPart === "index") throw new Error(`Invalid character '${character}' in an index at position ${position}`);
43
- if (currentPart === "indexEnd") throw new Error(`Invalid character '${character}' after an index at position ${position}`);
44
- isEscaping = true;
45
- currentPart = currentPart === "start" ? "property" : currentPart;
46
- continue;
47
- }
48
- switch (character) {
49
- case ".":
50
- if (currentPart === "index") throw new Error(`Invalid character '${character}' in an index at position ${position}`);
51
- if (currentPart === "indexEnd") {
52
- currentPart = "property";
53
- break;
54
- }
55
- if (!processSegment(currentSegment, parts)) return [];
56
- currentSegment = "";
57
- currentPart = "property";
58
- break;
59
- case "[":
60
- if (currentPart === "index") throw new Error(`Invalid character '${character}' in an index at position ${position}`);
61
- if (currentPart === "indexEnd") {
62
- currentPart = "index";
63
- break;
64
- }
65
- if (currentPart === "property" || currentPart === "start") {
66
- if ((currentSegment || currentPart === "property") && !processSegment(currentSegment, parts)) return [];
67
- currentSegment = "";
68
- }
69
- currentPart = "index";
70
- break;
71
- case "]":
72
- if (currentPart === "index") {
73
- if (currentSegment === "") {
74
- currentSegment = (parts.pop() || "") + "[]";
75
- currentPart = "property";
76
- } else {
77
- const parsedNumber = Number.parseInt(currentSegment, 10);
78
- if (!Number.isNaN(parsedNumber) && Number.isFinite(parsedNumber) && parsedNumber >= 0 && parsedNumber <= Number.MAX_SAFE_INTEGER && parsedNumber <= MAX_ARRAY_INDEX && currentSegment === String(parsedNumber)) parts.push(parsedNumber);
79
- else parts.push(currentSegment);
80
- currentSegment = "";
81
- currentPart = "indexEnd";
82
- }
83
- break;
84
- }
85
- if (currentPart === "indexEnd") throw new Error(`Invalid character '${character}' after an index at position ${position}`);
86
- currentSegment += character;
87
- break;
88
- default:
89
- if (currentPart === "index" && !isDigit(character)) throw new Error(`Invalid character '${character}' in an index at position ${position}`);
90
- if (currentPart === "indexEnd") throw new Error(`Invalid character '${character}' after an index at position ${position}`);
91
- if (currentPart === "start") currentPart = "property";
92
- currentSegment += character;
93
- }
94
- }
95
- if (isEscaping) currentSegment += "\\";
96
- switch (currentPart) {
97
- case "property":
98
- if (!processSegment(currentSegment, parts)) return [];
99
- break;
100
- case "index": throw new Error("Index was not closed");
101
- case "start":
102
- parts.push("");
103
- break;
104
- }
105
- return parts;
106
- }
107
- function normalizePath(path) {
108
- if (typeof path === "string") return parsePath(path);
109
- if (Array.isArray(path)) {
110
- const normalized = [];
111
- for (const [index, segment] of path.entries()) {
112
- if (typeof segment !== "string" && typeof segment !== "number") throw new TypeError(`Expected a string or number for path segment at index ${index}, got ${typeof segment}`);
113
- if (typeof segment === "number" && !Number.isFinite(segment)) throw new TypeError(`Path segment at index ${index} must be a finite number, got ${segment}`);
114
- if (disallowedKeys.has(segment)) return [];
115
- if (typeof segment === "string" && shouldCoerceToNumber(segment)) normalized.push(Number.parseInt(segment, 10));
116
- else normalized.push(segment);
117
- }
118
- return normalized;
119
- }
120
- return [];
121
- }
122
- function getProperty(object, path, value) {
123
- if (!isObject(object) || typeof path !== "string" && !Array.isArray(path)) return value === void 0 ? object : value;
124
- const pathArray = normalizePath(path);
125
- if (pathArray.length === 0) return value;
126
- for (let index = 0; index < pathArray.length; index++) {
127
- const key = pathArray[index];
128
- object = object[key];
129
- if (object === void 0 || object === null) {
130
- if (index !== pathArray.length - 1) return value;
131
- break;
132
- }
133
- }
134
- return object === void 0 ? value : object;
135
- }
136
-
137
- //#endregion
138
- export { getProperty as t };
@@ -1,345 +0,0 @@
1
- import { r as __require, t as __commonJSMin } from "../_rolldown.mjs";
2
-
3
- //#region node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
4
- var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- module.exports = {
6
- "name": "dotenv",
7
- "version": "17.2.3",
8
- "description": "Loads environment variables from .env file",
9
- "main": "lib/main.js",
10
- "types": "lib/main.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./lib/main.d.ts",
14
- "require": "./lib/main.js",
15
- "default": "./lib/main.js"
16
- },
17
- "./config": "./config.js",
18
- "./config.js": "./config.js",
19
- "./lib/env-options": "./lib/env-options.js",
20
- "./lib/env-options.js": "./lib/env-options.js",
21
- "./lib/cli-options": "./lib/cli-options.js",
22
- "./lib/cli-options.js": "./lib/cli-options.js",
23
- "./package.json": "./package.json"
24
- },
25
- "scripts": {
26
- "dts-check": "tsc --project tests/types/tsconfig.json",
27
- "lint": "standard",
28
- "pretest": "npm run lint && npm run dts-check",
29
- "test": "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
30
- "test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
31
- "prerelease": "npm test",
32
- "release": "standard-version"
33
- },
34
- "repository": {
35
- "type": "git",
36
- "url": "git://github.com/motdotla/dotenv.git"
37
- },
38
- "homepage": "https://github.com/motdotla/dotenv#readme",
39
- "funding": "https://dotenvx.com",
40
- "keywords": [
41
- "dotenv",
42
- "env",
43
- ".env",
44
- "environment",
45
- "variables",
46
- "config",
47
- "settings"
48
- ],
49
- "readmeFilename": "README.md",
50
- "license": "BSD-2-Clause",
51
- "devDependencies": {
52
- "@types/node": "^18.11.3",
53
- "decache": "^4.6.2",
54
- "sinon": "^14.0.1",
55
- "standard": "^17.0.0",
56
- "standard-version": "^9.5.0",
57
- "tap": "^19.2.0",
58
- "typescript": "^4.8.4"
59
- },
60
- "engines": { "node": ">=12" },
61
- "browser": { "fs": false }
62
- };
63
- }));
64
-
65
- //#endregion
66
- //#region node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
67
- var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68
- const fs = __require("fs");
69
- const path = __require("path");
70
- const os = __require("os");
71
- const crypto = __require("crypto");
72
- const version = require_package().version;
73
- const TIPS = [
74
- "🔐 encrypt with Dotenvx: https://dotenvx.com",
75
- "🔐 prevent committing .env to code: https://dotenvx.com/precommit",
76
- "🔐 prevent building .env in docker: https://dotenvx.com/prebuild",
77
- "📡 add observability to secrets: https://dotenvx.com/ops",
78
- "👥 sync secrets across teammates & machines: https://dotenvx.com/ops",
79
- "🗂️ backup and recover secrets: https://dotenvx.com/ops",
80
- "✅ audit secrets and track compliance: https://dotenvx.com/ops",
81
- "🔄 add secrets lifecycle management: https://dotenvx.com/ops",
82
- "🔑 add access controls to secrets: https://dotenvx.com/ops",
83
- "🛠️ run anywhere with `dotenvx run -- yourcommand`",
84
- "⚙️ specify custom .env file path with { path: '/custom/path/.env' }",
85
- "⚙️ enable debug logging with { debug: true }",
86
- "⚙️ override existing env vars with { override: true }",
87
- "⚙️ suppress all logs with { quiet: true }",
88
- "⚙️ write to custom object with { processEnv: myObject }",
89
- "⚙️ load multiple .env files with { path: ['.env.local', '.env'] }"
90
- ];
91
- function _getRandomTip() {
92
- return TIPS[Math.floor(Math.random() * TIPS.length)];
93
- }
94
- function parseBoolean(value) {
95
- if (typeof value === "string") return ![
96
- "false",
97
- "0",
98
- "no",
99
- "off",
100
- ""
101
- ].includes(value.toLowerCase());
102
- return Boolean(value);
103
- }
104
- function supportsAnsi() {
105
- return process.stdout.isTTY;
106
- }
107
- function dim(text) {
108
- return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text;
109
- }
110
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
111
- function parse(src) {
112
- const obj = {};
113
- let lines = src.toString();
114
- lines = lines.replace(/\r\n?/gm, "\n");
115
- let match;
116
- while ((match = LINE.exec(lines)) != null) {
117
- const key = match[1];
118
- let value = match[2] || "";
119
- value = value.trim();
120
- const maybeQuote = value[0];
121
- value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
122
- if (maybeQuote === "\"") {
123
- value = value.replace(/\\n/g, "\n");
124
- value = value.replace(/\\r/g, "\r");
125
- }
126
- obj[key] = value;
127
- }
128
- return obj;
129
- }
130
- function _parseVault(options) {
131
- options = options || {};
132
- const vaultPath = _vaultPath(options);
133
- options.path = vaultPath;
134
- const result = DotenvModule.configDotenv(options);
135
- if (!result.parsed) {
136
- const err = /* @__PURE__ */ new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
137
- err.code = "MISSING_DATA";
138
- throw err;
139
- }
140
- const keys = _dotenvKey(options).split(",");
141
- const length = keys.length;
142
- let decrypted;
143
- for (let i = 0; i < length; i++) try {
144
- const attrs = _instructions(result, keys[i].trim());
145
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
146
- break;
147
- } catch (error) {
148
- if (i + 1 >= length) throw error;
149
- }
150
- return DotenvModule.parse(decrypted);
151
- }
152
- function _warn(message) {
153
- console.error(`[dotenv@${version}][WARN] ${message}`);
154
- }
155
- function _debug(message) {
156
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
157
- }
158
- function _log(message) {
159
- console.log(`[dotenv@${version}] ${message}`);
160
- }
161
- function _dotenvKey(options) {
162
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
163
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
164
- return "";
165
- }
166
- function _instructions(result, dotenvKey) {
167
- let uri;
168
- try {
169
- uri = new URL(dotenvKey);
170
- } catch (error) {
171
- if (error.code === "ERR_INVALID_URL") {
172
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
173
- err.code = "INVALID_DOTENV_KEY";
174
- throw err;
175
- }
176
- throw error;
177
- }
178
- const key = uri.password;
179
- if (!key) {
180
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing key part");
181
- err.code = "INVALID_DOTENV_KEY";
182
- throw err;
183
- }
184
- const environment = uri.searchParams.get("environment");
185
- if (!environment) {
186
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing environment part");
187
- err.code = "INVALID_DOTENV_KEY";
188
- throw err;
189
- }
190
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
191
- const ciphertext = result.parsed[environmentKey];
192
- if (!ciphertext) {
193
- const err = /* @__PURE__ */ new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
194
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
195
- throw err;
196
- }
197
- return {
198
- ciphertext,
199
- key
200
- };
201
- }
202
- function _vaultPath(options) {
203
- let possibleVaultPath = null;
204
- if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
205
- for (const filepath of options.path) if (fs.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
206
- } else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
207
- else possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
208
- if (fs.existsSync(possibleVaultPath)) return possibleVaultPath;
209
- return null;
210
- }
211
- function _resolveHome(envPath) {
212
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
213
- }
214
- function _configVault(options) {
215
- const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
216
- const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
217
- if (debug || !quiet) _log("Loading env from encrypted .env.vault");
218
- const parsed = DotenvModule._parseVault(options);
219
- let processEnv = process.env;
220
- if (options && options.processEnv != null) processEnv = options.processEnv;
221
- DotenvModule.populate(processEnv, parsed, options);
222
- return { parsed };
223
- }
224
- function configDotenv(options) {
225
- const dotenvPath = path.resolve(process.cwd(), ".env");
226
- let encoding = "utf8";
227
- let processEnv = process.env;
228
- if (options && options.processEnv != null) processEnv = options.processEnv;
229
- let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
230
- let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
231
- if (options && options.encoding) encoding = options.encoding;
232
- else if (debug) _debug("No encoding is specified. UTF-8 is used by default");
233
- let optionPaths = [dotenvPath];
234
- if (options && options.path) if (!Array.isArray(options.path)) optionPaths = [_resolveHome(options.path)];
235
- else {
236
- optionPaths = [];
237
- for (const filepath of options.path) optionPaths.push(_resolveHome(filepath));
238
- }
239
- let lastError;
240
- const parsedAll = {};
241
- for (const path$1 of optionPaths) try {
242
- const parsed = DotenvModule.parse(fs.readFileSync(path$1, { encoding }));
243
- DotenvModule.populate(parsedAll, parsed, options);
244
- } catch (e) {
245
- if (debug) _debug(`Failed to load ${path$1} ${e.message}`);
246
- lastError = e;
247
- }
248
- const populated = DotenvModule.populate(processEnv, parsedAll, options);
249
- debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
250
- quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
251
- if (debug || !quiet) {
252
- const keysCount = Object.keys(populated).length;
253
- const shortPaths = [];
254
- for (const filePath of optionPaths) try {
255
- const relative = path.relative(process.cwd(), filePath);
256
- shortPaths.push(relative);
257
- } catch (e) {
258
- if (debug) _debug(`Failed to load ${filePath} ${e.message}`);
259
- lastError = e;
260
- }
261
- _log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
262
- }
263
- if (lastError) return {
264
- parsed: parsedAll,
265
- error: lastError
266
- };
267
- else return { parsed: parsedAll };
268
- }
269
- function config(options) {
270
- if (_dotenvKey(options).length === 0) return DotenvModule.configDotenv(options);
271
- const vaultPath = _vaultPath(options);
272
- if (!vaultPath) {
273
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
274
- return DotenvModule.configDotenv(options);
275
- }
276
- return DotenvModule._configVault(options);
277
- }
278
- function decrypt(encrypted, keyStr) {
279
- const key = Buffer.from(keyStr.slice(-64), "hex");
280
- let ciphertext = Buffer.from(encrypted, "base64");
281
- const nonce = ciphertext.subarray(0, 12);
282
- const authTag = ciphertext.subarray(-16);
283
- ciphertext = ciphertext.subarray(12, -16);
284
- try {
285
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
286
- aesgcm.setAuthTag(authTag);
287
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
288
- } catch (error) {
289
- const isRange = error instanceof RangeError;
290
- const invalidKeyLength = error.message === "Invalid key length";
291
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
292
- if (isRange || invalidKeyLength) {
293
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
294
- err.code = "INVALID_DOTENV_KEY";
295
- throw err;
296
- } else if (decryptionFailed) {
297
- const err = /* @__PURE__ */ new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
298
- err.code = "DECRYPTION_FAILED";
299
- throw err;
300
- } else throw error;
301
- }
302
- }
303
- function populate(processEnv, parsed, options = {}) {
304
- const debug = Boolean(options && options.debug);
305
- const override = Boolean(options && options.override);
306
- const populated = {};
307
- if (typeof parsed !== "object") {
308
- const err = /* @__PURE__ */ new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
309
- err.code = "OBJECT_REQUIRED";
310
- throw err;
311
- }
312
- for (const key of Object.keys(parsed)) if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
313
- if (override === true) {
314
- processEnv[key] = parsed[key];
315
- populated[key] = parsed[key];
316
- }
317
- if (debug) if (override === true) _debug(`"${key}" is already defined and WAS overwritten`);
318
- else _debug(`"${key}" is already defined and was NOT overwritten`);
319
- } else {
320
- processEnv[key] = parsed[key];
321
- populated[key] = parsed[key];
322
- }
323
- return populated;
324
- }
325
- const DotenvModule = {
326
- configDotenv,
327
- _configVault,
328
- _parseVault,
329
- config,
330
- decrypt,
331
- parse,
332
- populate
333
- };
334
- module.exports.configDotenv = DotenvModule.configDotenv;
335
- module.exports._configVault = DotenvModule._configVault;
336
- module.exports._parseVault = DotenvModule._parseVault;
337
- module.exports.config = DotenvModule.config;
338
- module.exports.decrypt = DotenvModule.decrypt;
339
- module.exports.parse = DotenvModule.parse;
340
- module.exports.populate = DotenvModule.populate;
341
- module.exports = DotenvModule;
342
- }));
343
-
344
- //#endregion
345
- export { require_main as t };
@@ -1,71 +0,0 @@
1
- import { r as __require, t as __commonJSMin } from "../_rolldown.mjs";
2
-
3
- //#region node_modules/.pnpm/duplexer@0.1.2/node_modules/duplexer/index.js
4
- var require_duplexer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
- var Stream = __require("stream");
6
- var writeMethods = [
7
- "write",
8
- "end",
9
- "destroy"
10
- ];
11
- var readMethods = ["resume", "pause"];
12
- var readEvents = ["data", "close"];
13
- var slice = Array.prototype.slice;
14
- module.exports = duplex;
15
- function forEach(arr, fn) {
16
- if (arr.forEach) return arr.forEach(fn);
17
- for (var i = 0; i < arr.length; i++) fn(arr[i], i);
18
- }
19
- function duplex(writer, reader) {
20
- var stream = new Stream();
21
- var ended = false;
22
- forEach(writeMethods, proxyWriter);
23
- forEach(readMethods, proxyReader);
24
- forEach(readEvents, proxyStream);
25
- reader.on("end", handleEnd);
26
- writer.on("drain", function() {
27
- stream.emit("drain");
28
- });
29
- writer.on("error", reemit);
30
- reader.on("error", reemit);
31
- stream.writable = writer.writable;
32
- stream.readable = reader.readable;
33
- return stream;
34
- function proxyWriter(methodName) {
35
- stream[methodName] = method;
36
- function method() {
37
- return writer[methodName].apply(writer, arguments);
38
- }
39
- }
40
- function proxyReader(methodName) {
41
- stream[methodName] = method;
42
- function method() {
43
- stream.emit(methodName);
44
- var func = reader[methodName];
45
- if (func) return func.apply(reader, arguments);
46
- reader.emit(methodName);
47
- }
48
- }
49
- function proxyStream(methodName) {
50
- reader.on(methodName, reemit$1);
51
- function reemit$1() {
52
- var args = slice.call(arguments);
53
- args.unshift(methodName);
54
- stream.emit.apply(stream, args);
55
- }
56
- }
57
- function handleEnd() {
58
- if (ended) return;
59
- ended = true;
60
- var args = slice.call(arguments);
61
- args.unshift("end");
62
- stream.emit.apply(stream, args);
63
- }
64
- function reemit(err) {
65
- stream.emit("error", err);
66
- }
67
- }
68
- }));
69
-
70
- //#endregion
71
- export { require_duplexer as t };