@theholocron/holocron-config 8.4.7 → 8.4.8

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.
@@ -1,919 +0,0 @@
1
- import { createRequire } from "node:module";
2
- import { execFile } from "node:child_process";
3
- import { promisify } from "node:util";
4
- //#region \0rolldown/runtime.js
5
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
6
- var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
7
- //#endregion
8
- //#region ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/package.json
9
- var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10
- module.exports = {
11
- "name": "dotenv",
12
- "version": "16.6.1",
13
- "description": "Loads environment variables from .env file",
14
- "main": "lib/main.js",
15
- "types": "lib/main.d.ts",
16
- "exports": {
17
- ".": {
18
- "types": "./lib/main.d.ts",
19
- "require": "./lib/main.js",
20
- "default": "./lib/main.js"
21
- },
22
- "./config": "./config.js",
23
- "./config.js": "./config.js",
24
- "./lib/env-options": "./lib/env-options.js",
25
- "./lib/env-options.js": "./lib/env-options.js",
26
- "./lib/cli-options": "./lib/cli-options.js",
27
- "./lib/cli-options.js": "./lib/cli-options.js",
28
- "./package.json": "./package.json"
29
- },
30
- "scripts": {
31
- "dts-check": "tsc --project tests/types/tsconfig.json",
32
- "lint": "standard",
33
- "pretest": "npm run lint && npm run dts-check",
34
- "test": "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
35
- "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
36
- "prerelease": "npm test",
37
- "release": "standard-version"
38
- },
39
- "repository": {
40
- "type": "git",
41
- "url": "git://github.com/motdotla/dotenv.git"
42
- },
43
- "homepage": "https://github.com/motdotla/dotenv#readme",
44
- "funding": "https://dotenvx.com",
45
- "keywords": [
46
- "dotenv",
47
- "env",
48
- ".env",
49
- "environment",
50
- "variables",
51
- "config",
52
- "settings"
53
- ],
54
- "readmeFilename": "README.md",
55
- "license": "BSD-2-Clause",
56
- "devDependencies": {
57
- "@types/node": "^18.11.3",
58
- "decache": "^4.6.2",
59
- "sinon": "^14.0.1",
60
- "standard": "^17.0.0",
61
- "standard-version": "^9.5.0",
62
- "tap": "^19.2.0",
63
- "typescript": "^4.8.4"
64
- },
65
- "engines": { "node": ">=12" },
66
- "browser": { "fs": false }
67
- };
68
- }));
69
- //#endregion
70
- //#region ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js
71
- var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
72
- const fs = __require("fs");
73
- const path = __require("path");
74
- const os = __require("os");
75
- const crypto = __require("crypto");
76
- const version = require_package$1().version;
77
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
78
- function parse(src) {
79
- const obj = {};
80
- let lines = src.toString();
81
- lines = lines.replace(/\r\n?/gm, "\n");
82
- let match;
83
- while ((match = LINE.exec(lines)) != null) {
84
- const key = match[1];
85
- let value = match[2] || "";
86
- value = value.trim();
87
- const maybeQuote = value[0];
88
- value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
89
- if (maybeQuote === "\"") {
90
- value = value.replace(/\\n/g, "\n");
91
- value = value.replace(/\\r/g, "\r");
92
- }
93
- obj[key] = value;
94
- }
95
- return obj;
96
- }
97
- function _parseVault(options) {
98
- options = options || {};
99
- const vaultPath = _vaultPath(options);
100
- options.path = vaultPath;
101
- const result = DotenvModule.configDotenv(options);
102
- if (!result.parsed) {
103
- const err = /* @__PURE__ */ new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
104
- err.code = "MISSING_DATA";
105
- throw err;
106
- }
107
- const keys = _dotenvKey(options).split(",");
108
- const length = keys.length;
109
- let decrypted;
110
- for (let i = 0; i < length; i++) try {
111
- const attrs = _instructions(result, keys[i].trim());
112
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
113
- break;
114
- } catch (error) {
115
- if (i + 1 >= length) throw error;
116
- }
117
- return DotenvModule.parse(decrypted);
118
- }
119
- function _warn(message) {
120
- console.log(`[dotenv@${version}][WARN] ${message}`);
121
- }
122
- function _debug(message) {
123
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
124
- }
125
- function _log(message) {
126
- console.log(`[dotenv@${version}] ${message}`);
127
- }
128
- function _dotenvKey(options) {
129
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
130
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
131
- return "";
132
- }
133
- function _instructions(result, dotenvKey) {
134
- let uri;
135
- try {
136
- uri = new URL(dotenvKey);
137
- } catch (error) {
138
- if (error.code === "ERR_INVALID_URL") {
139
- 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");
140
- err.code = "INVALID_DOTENV_KEY";
141
- throw err;
142
- }
143
- throw error;
144
- }
145
- const key = uri.password;
146
- if (!key) {
147
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing key part");
148
- err.code = "INVALID_DOTENV_KEY";
149
- throw err;
150
- }
151
- const environment = uri.searchParams.get("environment");
152
- if (!environment) {
153
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing environment part");
154
- err.code = "INVALID_DOTENV_KEY";
155
- throw err;
156
- }
157
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
158
- const ciphertext = result.parsed[environmentKey];
159
- if (!ciphertext) {
160
- const err = /* @__PURE__ */ new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
161
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
162
- throw err;
163
- }
164
- return {
165
- ciphertext,
166
- key
167
- };
168
- }
169
- function _vaultPath(options) {
170
- let possibleVaultPath = null;
171
- if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
172
- for (const filepath of options.path) if (fs.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
173
- } else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
174
- else possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
175
- if (fs.existsSync(possibleVaultPath)) return possibleVaultPath;
176
- return null;
177
- }
178
- function _resolveHome(envPath) {
179
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
180
- }
181
- function _configVault(options) {
182
- const debug = Boolean(options && options.debug);
183
- const quiet = options && "quiet" in options ? options.quiet : true;
184
- if (debug || !quiet) _log("Loading env from encrypted .env.vault");
185
- const parsed = DotenvModule._parseVault(options);
186
- let processEnv = process.env;
187
- if (options && options.processEnv != null) processEnv = options.processEnv;
188
- DotenvModule.populate(processEnv, parsed, options);
189
- return { parsed };
190
- }
191
- function configDotenv(options) {
192
- const dotenvPath = path.resolve(process.cwd(), ".env");
193
- let encoding = "utf8";
194
- const debug = Boolean(options && options.debug);
195
- const quiet = options && "quiet" in options ? options.quiet : true;
196
- if (options && options.encoding) encoding = options.encoding;
197
- else if (debug) _debug("No encoding is specified. UTF-8 is used by default");
198
- let optionPaths = [dotenvPath];
199
- if (options && options.path) if (!Array.isArray(options.path)) optionPaths = [_resolveHome(options.path)];
200
- else {
201
- optionPaths = [];
202
- for (const filepath of options.path) optionPaths.push(_resolveHome(filepath));
203
- }
204
- let lastError;
205
- const parsedAll = {};
206
- for (const path of optionPaths) try {
207
- const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
208
- DotenvModule.populate(parsedAll, parsed, options);
209
- } catch (e) {
210
- if (debug) _debug(`Failed to load ${path} ${e.message}`);
211
- lastError = e;
212
- }
213
- let processEnv = process.env;
214
- if (options && options.processEnv != null) processEnv = options.processEnv;
215
- DotenvModule.populate(processEnv, parsedAll, options);
216
- if (debug || !quiet) {
217
- const keysCount = Object.keys(parsedAll).length;
218
- const shortPaths = [];
219
- for (const filePath of optionPaths) try {
220
- const relative = path.relative(process.cwd(), filePath);
221
- shortPaths.push(relative);
222
- } catch (e) {
223
- if (debug) _debug(`Failed to load ${filePath} ${e.message}`);
224
- lastError = e;
225
- }
226
- _log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
227
- }
228
- if (lastError) return {
229
- parsed: parsedAll,
230
- error: lastError
231
- };
232
- else return { parsed: parsedAll };
233
- }
234
- function config(options) {
235
- if (_dotenvKey(options).length === 0) return DotenvModule.configDotenv(options);
236
- const vaultPath = _vaultPath(options);
237
- if (!vaultPath) {
238
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
239
- return DotenvModule.configDotenv(options);
240
- }
241
- return DotenvModule._configVault(options);
242
- }
243
- function decrypt(encrypted, keyStr) {
244
- const key = Buffer.from(keyStr.slice(-64), "hex");
245
- let ciphertext = Buffer.from(encrypted, "base64");
246
- const nonce = ciphertext.subarray(0, 12);
247
- const authTag = ciphertext.subarray(-16);
248
- ciphertext = ciphertext.subarray(12, -16);
249
- try {
250
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
251
- aesgcm.setAuthTag(authTag);
252
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
253
- } catch (error) {
254
- const isRange = error instanceof RangeError;
255
- const invalidKeyLength = error.message === "Invalid key length";
256
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
257
- if (isRange || invalidKeyLength) {
258
- const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
259
- err.code = "INVALID_DOTENV_KEY";
260
- throw err;
261
- } else if (decryptionFailed) {
262
- const err = /* @__PURE__ */ new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
263
- err.code = "DECRYPTION_FAILED";
264
- throw err;
265
- } else throw error;
266
- }
267
- }
268
- function populate(processEnv, parsed, options = {}) {
269
- const debug = Boolean(options && options.debug);
270
- const override = Boolean(options && options.override);
271
- if (typeof parsed !== "object") {
272
- const err = /* @__PURE__ */ new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
273
- err.code = "OBJECT_REQUIRED";
274
- throw err;
275
- }
276
- for (const key of Object.keys(parsed)) if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
277
- if (override === true) processEnv[key] = parsed[key];
278
- if (debug) if (override === true) _debug(`"${key}" is already defined and WAS overwritten`);
279
- else _debug(`"${key}" is already defined and was NOT overwritten`);
280
- } else processEnv[key] = parsed[key];
281
- }
282
- const DotenvModule = {
283
- configDotenv,
284
- _configVault,
285
- _parseVault,
286
- config,
287
- decrypt,
288
- parse,
289
- populate
290
- };
291
- module.exports.configDotenv = DotenvModule.configDotenv;
292
- module.exports._configVault = DotenvModule._configVault;
293
- module.exports._parseVault = DotenvModule._parseVault;
294
- module.exports.config = DotenvModule.config;
295
- module.exports.decrypt = DotenvModule.decrypt;
296
- module.exports.parse = DotenvModule.parse;
297
- module.exports.populate = DotenvModule.populate;
298
- module.exports = DotenvModule;
299
- }));
300
- //#endregion
301
- //#region ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/env-options.js
302
- var require_env_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
303
- const options = {};
304
- if (process.env.DOTENV_CONFIG_ENCODING != null) options.encoding = process.env.DOTENV_CONFIG_ENCODING;
305
- if (process.env.DOTENV_CONFIG_PATH != null) options.path = process.env.DOTENV_CONFIG_PATH;
306
- if (process.env.DOTENV_CONFIG_QUIET != null) options.quiet = process.env.DOTENV_CONFIG_QUIET;
307
- if (process.env.DOTENV_CONFIG_DEBUG != null) options.debug = process.env.DOTENV_CONFIG_DEBUG;
308
- if (process.env.DOTENV_CONFIG_OVERRIDE != null) options.override = process.env.DOTENV_CONFIG_OVERRIDE;
309
- if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
310
- module.exports = options;
311
- }));
312
- //#endregion
313
- //#region ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/cli-options.js
314
- var require_cli_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
315
- const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
316
- module.exports = function optionMatcher(args) {
317
- const options = args.reduce(function(acc, cur) {
318
- const matches = cur.match(re);
319
- if (matches) acc[matches[1]] = matches[2];
320
- return acc;
321
- }, {});
322
- if (!("quiet" in options)) options.quiet = "true";
323
- return options;
324
- };
325
- }));
326
- //#endregion
327
- //#region ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/config.js
328
- (function() {
329
- require_main().config(Object.assign({}, require_env_options(), require_cli_options()(process.argv)));
330
- })();
331
- //#endregion
332
- //#region ../../node_modules/.pnpm/@napi-rs+keyring-linux-x64-gnu@1.3.0/node_modules/@napi-rs/keyring-linux-x64-gnu/package.json
333
- var require_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
334
- module.exports = {
335
- "name": "@napi-rs/keyring-linux-x64-gnu",
336
- "version": "1.3.0",
337
- "cpu": ["x64"],
338
- "main": "keyring.linux-x64-gnu.node",
339
- "files": ["keyring.linux-x64-gnu.node"],
340
- "description": "https://github.com/hwchen/keyring-rs Node.js binding via https://napi.rs",
341
- "keywords": [
342
- "napi-rs",
343
- "NAPI",
344
- "N-API",
345
- "Rust",
346
- "node-addon",
347
- "node-addon-api"
348
- ],
349
- "license": "MIT",
350
- "engines": { "node": ">= 10" },
351
- "repository": "https://github.com/Brooooooklyn/keyring-node",
352
- "publishConfig": {
353
- "registry": "https://registry.npmjs.org/",
354
- "access": "public"
355
- },
356
- "os": ["linux"],
357
- "libc": ["glibc"]
358
- };
359
- }));
360
- (/* @__PURE__ */ __commonJSMin(((exports, module) => {
361
- const { createRequire: createRequire$1 } = __require("node:module");
362
- require = createRequire$1(__filename);
363
- const { readFileSync } = __require("node:fs");
364
- let nativeBinding = null;
365
- const loadErrors = [];
366
- const isMusl = () => {
367
- let musl = false;
368
- if (process.platform === "linux") {
369
- musl = isMuslFromFilesystem();
370
- if (musl === null) musl = isMuslFromReport();
371
- if (musl === null) musl = isMuslFromChildProcess();
372
- }
373
- return musl;
374
- };
375
- const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
376
- const isMuslFromFilesystem = () => {
377
- try {
378
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
379
- } catch {
380
- return null;
381
- }
382
- };
383
- const isMuslFromReport = () => {
384
- let report = null;
385
- if (typeof process.report?.getReport === "function") {
386
- process.report.excludeNetwork = true;
387
- report = process.report.getReport();
388
- }
389
- if (!report) return null;
390
- if (report.header && report.header.glibcVersionRuntime) return false;
391
- if (Array.isArray(report.sharedObjects)) {
392
- if (report.sharedObjects.some(isFileMusl)) return true;
393
- }
394
- return false;
395
- };
396
- const isMuslFromChildProcess = () => {
397
- try {
398
- return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
399
- } catch (e) {
400
- return false;
401
- }
402
- };
403
- function requireNative() {
404
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
405
- nativeBinding = __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
406
- } catch (err) {
407
- loadErrors.push(err);
408
- }
409
- else if (process.platform === "android") if (process.arch === "arm64") {
410
- try {
411
- return __require("./keyring.android-arm64.node");
412
- } catch (e) {
413
- loadErrors.push(e);
414
- }
415
- try {
416
- const binding = __require("@napi-rs/keyring-android-arm64");
417
- const bindingPackageVersion = __require("@napi-rs/keyring-android-arm64/package.json").version;
418
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
419
- return binding;
420
- } catch (e) {
421
- loadErrors.push(e);
422
- }
423
- } else if (process.arch === "arm") {
424
- try {
425
- return __require("./keyring.android-arm-eabi.node");
426
- } catch (e) {
427
- loadErrors.push(e);
428
- }
429
- try {
430
- const binding = __require("@napi-rs/keyring-android-arm-eabi");
431
- const bindingPackageVersion = __require("@napi-rs/keyring-android-arm-eabi/package.json").version;
432
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
433
- return binding;
434
- } catch (e) {
435
- loadErrors.push(e);
436
- }
437
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
438
- else if (process.platform === "win32") if (process.arch === "x64") {
439
- try {
440
- return __require("./keyring.win32-x64-msvc.node");
441
- } catch (e) {
442
- loadErrors.push(e);
443
- }
444
- try {
445
- const binding = __require("@napi-rs/keyring-win32-x64-msvc");
446
- const bindingPackageVersion = __require("@napi-rs/keyring-win32-x64-msvc/package.json").version;
447
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
448
- return binding;
449
- } catch (e) {
450
- loadErrors.push(e);
451
- }
452
- } else if (process.arch === "ia32") {
453
- try {
454
- return __require("./keyring.win32-ia32-msvc.node");
455
- } catch (e) {
456
- loadErrors.push(e);
457
- }
458
- try {
459
- const binding = __require("@napi-rs/keyring-win32-ia32-msvc");
460
- const bindingPackageVersion = __require("@napi-rs/keyring-win32-ia32-msvc/package.json").version;
461
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
462
- return binding;
463
- } catch (e) {
464
- loadErrors.push(e);
465
- }
466
- } else if (process.arch === "arm64") {
467
- try {
468
- return __require("./keyring.win32-arm64-msvc.node");
469
- } catch (e) {
470
- loadErrors.push(e);
471
- }
472
- try {
473
- const binding = __require("@napi-rs/keyring-win32-arm64-msvc");
474
- const bindingPackageVersion = __require("@napi-rs/keyring-win32-arm64-msvc/package.json").version;
475
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
476
- return binding;
477
- } catch (e) {
478
- loadErrors.push(e);
479
- }
480
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
481
- else if (process.platform === "darwin") {
482
- try {
483
- return __require("./keyring.darwin-universal.node");
484
- } catch (e) {
485
- loadErrors.push(e);
486
- }
487
- try {
488
- const binding = __require("@napi-rs/keyring-darwin-universal");
489
- const bindingPackageVersion = __require("@napi-rs/keyring-darwin-universal/package.json").version;
490
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
491
- return binding;
492
- } catch (e) {
493
- loadErrors.push(e);
494
- }
495
- if (process.arch === "x64") {
496
- try {
497
- return __require("./keyring.darwin-x64.node");
498
- } catch (e) {
499
- loadErrors.push(e);
500
- }
501
- try {
502
- const binding = __require("@napi-rs/keyring-darwin-x64");
503
- const bindingPackageVersion = __require("@napi-rs/keyring-darwin-x64/package.json").version;
504
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
505
- return binding;
506
- } catch (e) {
507
- loadErrors.push(e);
508
- }
509
- } else if (process.arch === "arm64") {
510
- try {
511
- return __require("./keyring.darwin-arm64.node");
512
- } catch (e) {
513
- loadErrors.push(e);
514
- }
515
- try {
516
- const binding = __require("@napi-rs/keyring-darwin-arm64");
517
- const bindingPackageVersion = __require("@napi-rs/keyring-darwin-arm64/package.json").version;
518
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
519
- return binding;
520
- } catch (e) {
521
- loadErrors.push(e);
522
- }
523
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
524
- } else if (process.platform === "freebsd") if (process.arch === "x64") {
525
- try {
526
- return __require("./keyring.freebsd-x64.node");
527
- } catch (e) {
528
- loadErrors.push(e);
529
- }
530
- try {
531
- const binding = __require("@napi-rs/keyring-freebsd-x64");
532
- const bindingPackageVersion = __require("@napi-rs/keyring-freebsd-x64/package.json").version;
533
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
534
- return binding;
535
- } catch (e) {
536
- loadErrors.push(e);
537
- }
538
- } else if (process.arch === "arm64") {
539
- try {
540
- return __require("./keyring.freebsd-arm64.node");
541
- } catch (e) {
542
- loadErrors.push(e);
543
- }
544
- try {
545
- const binding = __require("@napi-rs/keyring-freebsd-arm64");
546
- const bindingPackageVersion = __require("@napi-rs/keyring-freebsd-arm64/package.json").version;
547
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
548
- return binding;
549
- } catch (e) {
550
- loadErrors.push(e);
551
- }
552
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
553
- else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
554
- try {
555
- return __require("./keyring.linux-x64-musl.node");
556
- } catch (e) {
557
- loadErrors.push(e);
558
- }
559
- try {
560
- const binding = __require("@napi-rs/keyring-linux-x64-musl");
561
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-x64-musl/package.json").version;
562
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
563
- return binding;
564
- } catch (e) {
565
- loadErrors.push(e);
566
- }
567
- } else {
568
- try {
569
- return __require("./keyring.linux-x64-gnu.node");
570
- } catch (e) {
571
- loadErrors.push(e);
572
- }
573
- try {
574
- const binding = __require("./assets/keyring.linux-x64-gnu-DGLgDGdk.node");
575
- const bindingPackageVersion = require_package().version;
576
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
577
- return binding;
578
- } catch (e) {
579
- loadErrors.push(e);
580
- }
581
- }
582
- else if (process.arch === "arm64") if (isMusl()) {
583
- try {
584
- return __require("./keyring.linux-arm64-musl.node");
585
- } catch (e) {
586
- loadErrors.push(e);
587
- }
588
- try {
589
- const binding = __require("@napi-rs/keyring-linux-arm64-musl");
590
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-arm64-musl/package.json").version;
591
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
592
- return binding;
593
- } catch (e) {
594
- loadErrors.push(e);
595
- }
596
- } else {
597
- try {
598
- return __require("./keyring.linux-arm64-gnu.node");
599
- } catch (e) {
600
- loadErrors.push(e);
601
- }
602
- try {
603
- const binding = __require("@napi-rs/keyring-linux-arm64-gnu");
604
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-arm64-gnu/package.json").version;
605
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
606
- return binding;
607
- } catch (e) {
608
- loadErrors.push(e);
609
- }
610
- }
611
- else if (process.arch === "arm") if (isMusl()) {
612
- try {
613
- return __require("./keyring.linux-arm-musleabihf.node");
614
- } catch (e) {
615
- loadErrors.push(e);
616
- }
617
- try {
618
- const binding = __require("@napi-rs/keyring-linux-arm-musleabihf");
619
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-arm-musleabihf/package.json").version;
620
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
621
- return binding;
622
- } catch (e) {
623
- loadErrors.push(e);
624
- }
625
- } else {
626
- try {
627
- return __require("./keyring.linux-arm-gnueabihf.node");
628
- } catch (e) {
629
- loadErrors.push(e);
630
- }
631
- try {
632
- const binding = __require("@napi-rs/keyring-linux-arm-gnueabihf");
633
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-arm-gnueabihf/package.json").version;
634
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
635
- return binding;
636
- } catch (e) {
637
- loadErrors.push(e);
638
- }
639
- }
640
- else if (process.arch === "riscv64") if (isMusl()) {
641
- try {
642
- return __require("./keyring.linux-riscv64-musl.node");
643
- } catch (e) {
644
- loadErrors.push(e);
645
- }
646
- try {
647
- const binding = __require("@napi-rs/keyring-linux-riscv64-musl");
648
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-riscv64-musl/package.json").version;
649
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
650
- return binding;
651
- } catch (e) {
652
- loadErrors.push(e);
653
- }
654
- } else {
655
- try {
656
- return __require("./keyring.linux-riscv64-gnu.node");
657
- } catch (e) {
658
- loadErrors.push(e);
659
- }
660
- try {
661
- const binding = __require("@napi-rs/keyring-linux-riscv64-gnu");
662
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-riscv64-gnu/package.json").version;
663
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
664
- return binding;
665
- } catch (e) {
666
- loadErrors.push(e);
667
- }
668
- }
669
- else if (process.arch === "ppc64") {
670
- try {
671
- return __require("./keyring.linux-ppc64-gnu.node");
672
- } catch (e) {
673
- loadErrors.push(e);
674
- }
675
- try {
676
- const binding = __require("@napi-rs/keyring-linux-ppc64-gnu");
677
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-ppc64-gnu/package.json").version;
678
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
679
- return binding;
680
- } catch (e) {
681
- loadErrors.push(e);
682
- }
683
- } else if (process.arch === "s390x") {
684
- try {
685
- return __require("./keyring.linux-s390x-gnu.node");
686
- } catch (e) {
687
- loadErrors.push(e);
688
- }
689
- try {
690
- const binding = __require("@napi-rs/keyring-linux-s390x-gnu");
691
- const bindingPackageVersion = __require("@napi-rs/keyring-linux-s390x-gnu/package.json").version;
692
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
693
- return binding;
694
- } catch (e) {
695
- loadErrors.push(e);
696
- }
697
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
698
- else if (process.platform === "openharmony") if (process.arch === "arm64") {
699
- try {
700
- return __require("./keyring.openharmony-arm64.node");
701
- } catch (e) {
702
- loadErrors.push(e);
703
- }
704
- try {
705
- const binding = __require("@napi-rs/keyring-openharmony-arm64");
706
- const bindingPackageVersion = __require("@napi-rs/keyring-openharmony-arm64/package.json").version;
707
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
708
- return binding;
709
- } catch (e) {
710
- loadErrors.push(e);
711
- }
712
- } else if (process.arch === "x64") {
713
- try {
714
- return __require("./keyring.openharmony-x64.node");
715
- } catch (e) {
716
- loadErrors.push(e);
717
- }
718
- try {
719
- const binding = __require("@napi-rs/keyring-openharmony-x64");
720
- const bindingPackageVersion = __require("@napi-rs/keyring-openharmony-x64/package.json").version;
721
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
722
- return binding;
723
- } catch (e) {
724
- loadErrors.push(e);
725
- }
726
- } else if (process.arch === "arm") {
727
- try {
728
- return __require("./keyring.openharmony-arm.node");
729
- } catch (e) {
730
- loadErrors.push(e);
731
- }
732
- try {
733
- const binding = __require("@napi-rs/keyring-openharmony-arm");
734
- const bindingPackageVersion = __require("@napi-rs/keyring-openharmony-arm/package.json").version;
735
- if (bindingPackageVersion !== "1.3.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
736
- return binding;
737
- } catch (e) {
738
- loadErrors.push(e);
739
- }
740
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
741
- else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
742
- }
743
- nativeBinding = requireNative();
744
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
745
- try {
746
- nativeBinding = __require("./keyring.wasi.cjs");
747
- } catch (err) {
748
- if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
749
- }
750
- if (!nativeBinding) try {
751
- nativeBinding = __require("@napi-rs/keyring-wasm32-wasi");
752
- } catch (err) {
753
- if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
754
- }
755
- }
756
- if (!nativeBinding) {
757
- if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors });
758
- throw new Error(`Failed to load native binding`);
759
- }
760
- module.exports = nativeBinding;
761
- module.exports.AsyncEntry = nativeBinding.AsyncEntry;
762
- module.exports.Entry = nativeBinding.Entry;
763
- module.exports.findCredentials = nativeBinding.findCredentials;
764
- module.exports.findCredentialsAsync = nativeBinding.findCredentialsAsync;
765
- })))();
766
- var ConfigError = class extends Error {
767
- name = "ConfigError";
768
- };
769
- function taskName(e) {
770
- return typeof e === "string" ? e : e.name;
771
- }
772
- /**
773
- * Merge any number of capability fragments into a single preset object that
774
- * spreads directly into `defineConfig()`.
775
- *
776
- * - Accepts individual capabilities or nested arrays (for bundle presets).
777
- * - Deduplicates by `id` — when the same ID appears more than once, the last
778
- * occurrence wins. This lets callers override bundle defaults by listing an
779
- * explicit capability after the bundle.
780
- * - Validates all `requires` at call time and throws `ConfigError` if any are
781
- * unmet, listing every missing dependency in a single message.
782
- *
783
- * @example
784
- * // docs-only site — no typecheck
785
- * const preset = compose(node(), docs());
786
- *
787
- * // library with docs
788
- * const preset = compose(node(), typecheck(), docs());
789
- *
790
- * // nextjs() is a bundle that returns Capability[]
791
- * const preset = compose(node(), nextjs());
792
- */
793
- function compose(...args) {
794
- const flat = args.flat();
795
- const byId = /* @__PURE__ */ new Map();
796
- for (const cap of flat) byId.set(cap.id, cap);
797
- const caps = [...byId.values()];
798
- const available = new Set(caps.map((c) => c.id));
799
- const errors = [];
800
- for (const cap of caps) for (const req of cap.requires ?? []) if (!available.has(req)) errors.push(`"${cap.id}" requires "${req}"`);
801
- if (errors.length > 0) throw new ConfigError(`compose(): unmet dependencies — ${errors.join(", ")}`);
802
- const taskMap = /* @__PURE__ */ new Map();
803
- for (const cap of caps) for (const entry of cap.tasks ?? []) taskMap.set(taskName(entry), entry);
804
- let providers = {};
805
- for (const cap of caps) if (cap.providers) providers = {
806
- ...providers,
807
- ...cap.providers
808
- };
809
- const checksSeen = /* @__PURE__ */ new Set();
810
- const extraRequiredChecks = [];
811
- for (const cap of caps) for (const check of cap.extraRequiredChecks ?? []) if (!checksSeen.has(check)) {
812
- checksSeen.add(check);
813
- extraRequiredChecks.push(check);
814
- }
815
- let repo = {};
816
- for (const cap of caps) {
817
- if (!cap.repo) continue;
818
- const { properties, topics, teams, ...scalars } = cap.repo;
819
- repo = {
820
- ...repo,
821
- ...scalars
822
- };
823
- if (properties) repo.properties = {
824
- ...repo.properties,
825
- ...properties
826
- };
827
- if (topics) {
828
- const merged = /* @__PURE__ */ new Set([...repo.topics ?? [], ...topics]);
829
- repo.topics = [...merged];
830
- }
831
- if (teams) {
832
- const teamMap = new Map((repo.teams ?? []).map((t) => [typeof t === "string" ? t : t.slug, t]));
833
- for (const t of teams) teamMap.set(typeof t === "string" ? t : t.slug, t);
834
- repo.teams = [...teamMap.values()];
835
- }
836
- }
837
- let org;
838
- let domain;
839
- let docs;
840
- for (const cap of caps) {
841
- if (cap.org !== void 0) org = cap.org;
842
- if (cap.domain !== void 0) domain = cap.domain;
843
- if (cap.docs !== void 0) docs = cap.docs;
844
- }
845
- return {
846
- tasks: [...taskMap.values()],
847
- providers,
848
- repo,
849
- extraRequiredChecks,
850
- ...org !== void 0 ? { org } : {},
851
- ...domain !== void 0 ? { domain } : {},
852
- ...docs !== void 0 ? { docs } : {}
853
- };
854
- }
855
- promisify(execFile);
856
- //#endregion
857
- //#region capabilities/node.ts
858
- /** The org-standard linter set — drives both CI super-linter and `holocron run lint`. */
859
- const ORG_LINTERS = [
860
- "eslint",
861
- "prettier",
862
- "yamllint",
863
- "actionlint",
864
- "gitleaks",
865
- "editorconfig",
866
- "commitlint",
867
- "git-merge-conflict-markers"
868
- ];
869
- /**
870
- * Base capability for all theholocron Node.js repositories.
871
- * Contributes: GitHub source/CI/issues providers, strict branch protection,
872
- * and the standard workflow set (lint, test, security, review, stale, greetings,
873
- * dependencies, bookkeeping). Does NOT include typecheck — add that separately.
874
- * The `lint` task carries the org linter list explicitly so every repo runs the
875
- * same set (a repo can override with its own `{ name: "lint", linters: [...] }`).
876
- * `lint` and `test` are marked `required` — `holocron setup` derives their
877
- * `… / Conclusion` branch-protection check contexts from the manifest.
878
- */
879
- function node() {
880
- return {
881
- id: "node",
882
- providers: {
883
- source: "github",
884
- ci: "github",
885
- issues: ["github", { labels: {
886
- inProgress: "status:in-progress",
887
- inReview: "status:in-review"
888
- } }]
889
- },
890
- repo: {
891
- protection: "strict",
892
- properties: {
893
- lifecycle: "active",
894
- open_source: true,
895
- runtime_environment: "node",
896
- uses_external_packages: true
897
- }
898
- },
899
- tasks: [
900
- {
901
- name: "lint",
902
- required: true,
903
- linters: ORG_LINTERS
904
- },
905
- {
906
- name: "test",
907
- required: true
908
- },
909
- "security",
910
- "review",
911
- "stale",
912
- "greetings",
913
- "dependencies",
914
- "bookkeeping"
915
- ]
916
- };
917
- }
918
- //#endregion
919
- export { compose as n, node as t };