feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

85
node_modules/rc9/dist/_chunks/libs/flat.mjs generated vendored Normal file
View File

@@ -0,0 +1,85 @@
//#region node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
function isBuffer(obj) {
return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
}
function keyIdentity(key) {
return key;
}
function flatten(target, opts) {
opts = opts || {};
const delimiter = opts.delimiter || ".";
const maxDepth = opts.maxDepth;
const transformKey = opts.transformKey || keyIdentity;
const output = {};
function step(object, prev, currentDepth) {
currentDepth = currentDepth || 1;
Object.keys(object).forEach(function(key) {
const value = object[key];
const isarray = opts.safe && Array.isArray(value);
const type = Object.prototype.toString.call(value);
const isbuffer = isBuffer(value);
const isobject = type === "[object Object]" || type === "[object Array]";
const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
output[newKey] = value;
});
}
step(target);
return output;
}
function unflatten(target, opts) {
opts = opts || {};
const delimiter = opts.delimiter || ".";
const overwrite = opts.overwrite || false;
const transformKey = opts.transformKey || keyIdentity;
const result = {};
if (isBuffer(target) || Object.prototype.toString.call(target) !== "[object Object]") return target;
function getkey(key) {
const parsedKey = Number(key);
return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
}
function addKeys(keyPrefix, recipient, target) {
return Object.keys(target).reduce(function(result, key) {
result[keyPrefix + delimiter + key] = target[key];
return result;
}, recipient);
}
function isEmpty(val) {
const type = Object.prototype.toString.call(val);
const isArray = type === "[object Array]";
const isObject = type === "[object Object]";
if (!val) return true;
else if (isArray) return !val.length;
else if (isObject) return !Object.keys(val).length;
}
target = Object.keys(target).reduce(function(result, key) {
const type = Object.prototype.toString.call(target[key]);
if (!(type === "[object Object]" || type === "[object Array]") || isEmpty(target[key])) {
result[key] = target[key];
return result;
} else return addKeys(key, result, flatten(target[key], opts));
}, {});
Object.keys(target).forEach(function(key) {
const split = key.split(delimiter).map(transformKey);
let key1 = getkey(split.shift());
let key2 = getkey(split[0]);
let recipient = result;
while (key2 !== void 0) {
if (key1 === "__proto__") return;
const type = Object.prototype.toString.call(recipient[key1]);
const isobject = type === "[object Object]" || type === "[object Array]";
if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") return;
if (overwrite && !isobject || !overwrite && recipient[key1] == null) recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
recipient = recipient[key1];
if (split.length > 0) {
key1 = getkey(split.shift());
key2 = getkey(split[0]);
}
}
recipient[key1] = unflatten(target[key], opts);
});
return result;
}
//#endregion
export { unflatten as n, flatten as t };

19
node_modules/rc9/dist/index.d.mts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
//#region src/index.d.ts
type RC = Record<string, any>;
interface RCOptions {
name?: string;
dir?: string;
flat?: boolean;
}
declare const defaults: RCOptions;
declare function parse<T extends RC = RC>(contents: string, options?: RCOptions): T;
declare function parseFile<T extends RC = RC>(path: string, options?: RCOptions): T;
declare function read<T extends RC = RC>(options?: RCOptions | string): T;
declare function readUser<T extends RC = RC>(options?: RCOptions | string): T;
declare function serialize<T extends RC = RC>(config: T): string;
declare function write<T extends RC = RC>(config: T, options?: RCOptions | string): void;
declare function writeUser<T extends RC = RC>(config: T, options?: RCOptions | string): void;
declare function update<T extends RC = RC>(config: T, options?: RCOptions | string): T;
declare function updateUser<T extends RC = RC>(config: T, options?: RCOptions | string): T;
//#endregion
export { defaults, parse, parseFile, read, readUser, serialize, update, updateUser, write, writeUser };

80
node_modules/rc9/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,80 @@
import { n as unflatten, t as flatten } from "./_chunks/libs/flat.mjs";
import { existsSync, readFileSync, writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { homedir } from "node:os";
import destr from "destr";
import { defu } from "defu";
//#region src/index.ts
const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
const RE_LINES = /\n|\r|\r\n/;
const defaults = {
name: ".conf",
dir: process.cwd(),
flat: false
};
function withDefaults(options) {
if (typeof options === "string") options = { name: options };
return {
...defaults,
...options
};
}
function parse(contents, options = {}) {
const config = {};
const lines = contents.split(RE_LINES);
for (const line of lines) {
const match = line.match(RE_KEY_VAL);
if (!match) continue;
const key = match[1];
if (!key || key === "__proto__" || key === "constructor") continue;
const value = destr((match[2] || "").trim());
if (key.endsWith("[]")) {
const nkey = key.slice(0, Math.max(0, key.length - 2));
config[nkey] = (config[nkey] || []).concat(value);
continue;
}
config[key] = value;
}
return options.flat ? config : unflatten(config, { overwrite: true });
}
function parseFile(path, options) {
if (!existsSync(path)) return {};
return parse(readFileSync(path, "utf8"), options);
}
function read(options) {
options = withDefaults(options);
return parseFile(resolve(options.dir, options.name), options);
}
function readUser(options) {
options = withDefaults(options);
options.dir = process.env.XDG_CONFIG_HOME || homedir();
return read(options);
}
function serialize(config) {
return Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
}
function write(config, options) {
options = withDefaults(options);
writeFileSync(resolve(options.dir, options.name), serialize(config), { encoding: "utf8" });
}
function writeUser(config, options) {
options = withDefaults(options);
options.dir = process.env.XDG_CONFIG_HOME || homedir();
write(config, options);
}
function update(config, options) {
options = withDefaults(options);
if (!options.flat) config = unflatten(config, { overwrite: true });
const newConfig = defu(config, read(options));
write(newConfig, options);
return newConfig;
}
function updateUser(config, options) {
options = withDefaults(options);
options.dir = process.env.XDG_CONFIG_HOME || homedir();
return update(config, options);
}
//#endregion
export { defaults, parse, parseFile, read, readUser, serialize, update, updateUser, write, writeUser };