Website Structure

This commit is contained in:
supalerk-ar66 2026-01-13 10:46:40 +07:00
parent 62812f2090
commit 71f0676a62
22365 changed files with 4265753 additions and 791 deletions

39
Frontend-Learner/node_modules/rc9/LICENSE generated vendored Normal file
View file

@ -0,0 +1,39 @@
MIT License
Copyright (c) Pooya Parsa <pooya@pi0.io>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-----
Bundled with https://github.com/hughsk/flat
Copyright (c) 2014, Hugh Kennedy
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

201
Frontend-Learner/node_modules/rc9/README.md generated vendored Normal file
View file

@ -0,0 +1,201 @@
# RC9
<!-- automd:badges color=yellow codecov bundlejs -->
[![npm version](https://img.shields.io/npm/v/rc9?color=yellow)](https://npmjs.com/package/rc9)
[![npm downloads](https://img.shields.io/npm/dm/rc9?color=yellow)](https://npmjs.com/package/rc9)
[![bundle size](https://img.shields.io/bundlejs/size/rc9?color=yellow)](https://bundlejs.com/?q=rc9)
[![codecov](https://img.shields.io/codecov/c/gh/unjs/rc9?color=yellow)](https://codecov.io/gh/unjs/rc9)
<!-- /automd -->
Read/Write RC configs couldn't be easier!
## Install
Install dependencies:
<!-- automd:pm-i -->
```sh
# ✨ Auto-detect
npx nypm install rc9
# npm
npm install rc9
# yarn
yarn add rc9
# pnpm
pnpm install rc9
# bun
bun install rc9
```
<!-- /automd -->
Import utils:
<!-- automd:jsimport cjs src="./src/index.ts"-->
**ESM** (Node.js, Bun)
```js
import {
defaults,
parse,
parseFile,
read,
readUser,
serialize,
write,
writeUser,
update,
updateUser,
} from "rc9";
```
**CommonJS** (Legacy Node.js)
```js
const {
defaults,
parse,
parseFile,
read,
readUser,
serialize,
write,
writeUser,
update,
updateUser,
} = require("rc9");
```
<!-- /automd -->
## Usage
`.conf`:
```ini
db.username=username
db.password=multi word password
db.enabled=true
```
**Update config:**
```ts
update({ 'db.enabled': false }) // or update(..., { name: '.conf' })
```
Push to an array:
```ts
update({ 'modules[]': 'test' })
```
**Read/Write config:**
```ts
const config = read() // or read('.conf')
// config = {
// db: {
// username: 'username',
// password: 'multi word password',
// enabled: true
// }
// }
config.enabled = false
write(config) // or write(config, '.conf')
```
**User Config:**
It is common to keep config in user home directory (MacOS: `/Users/{name}`, Linux: `/home/{name}`, Windows: `C:\users\{name}`)
you can use `readUser`/`writeuser`/`updateUser` shortcuts to quickly do this:
```js
writeUser({ token: 123 }, '.zoorc') // Will be saved in {home}/.zoorc
const conf = readUser('.zoorc') // { token: 123 }
```
## Unflatten
RC uses [flat](https://www.npmjs.com/package/flat) to automatically flat/unflat when writing and reading rcfile.
It means that you can use `.` for keys to define objects. Some examples:
- `hello.world = true` <=> `{ hello: { world: true }`
- `test.0 = A` <=> `tags: [ 'A' ]`
**Note:** If you use keys that can override like `x=` and `x.y=`, you can disable this feature by passing `flat: true` option.
**Tip:** You can use keys ending with `[]` to push to an array like `test[]=A`
## Native Values
RC uses [destr](https://www.npmjs.com/package/destr) to convert values into native javascript values.
So reading `count=123` results `{ count: 123 }` (instead of `{ count: "123" }`) if you want to preserve strings as is, can use `count="123"`.
## Exports
```ts
const defaults: RCOptions;
function parse(contents: string, options?: RCOptions): RC
function parseFile(path: string, options?: RCOptions): RC
function read(options?: RCOptions | string): RC;
function readUser(options?: RCOptions | string): RC;
function serialize(config: RC): string;
function write(config: RC, options?: RCOptions | string): void;
function writeUser(config: RC, options?: RCOptions | string): void;
function update(config: RC, options?: RCOptions | string): RC;
function updateUser(config: RC, options?: RCOptions | string): RC;
```
**Types:**
```ts
type RC = Record<string, any>;
interface RCOptions {
name?: string;
dir?: string;
flat?: boolean;
}
```
**Defaults:**
```ini
{
name: '.conf',
dir: process.cwd(),
flat: false
}
```
### Why RC9?
Be the first one to guess 🐇 <!-- Hint: do research about rc files history -->
## License
<!-- automd:contributors license=MIT -->
Published under the [MIT](https://github.com/unjs/rc9/blob/main/LICENSE) license.
Made by [community](https://github.com/unjs/rc9/graphs/contributors) 💛
<br><br>
<a href="https://github.com/unjs/rc9/graphs/contributors">
<img src="https://contrib.rocks/image?repo=unjs/rc9" />
</a>
<!-- /automd -->

262
Frontend-Learner/node_modules/rc9/dist/index.cjs generated vendored Normal file
View file

@ -0,0 +1,262 @@
'use strict';
const node_fs = require('node:fs');
const node_path = require('node:path');
const node_os = require('node:os');
const destr = require('destr');
const defu = require('defu');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
const destr__default = /*#__PURE__*/_interopDefaultCompat(destr);
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 = {};
const isbuffer = isBuffer(target);
if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {
return target
}
// safely ensure that the key is
// an integer.
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]);
const isObject = (type === '[object Object]' || type === '[object Array]');
if (!isObject || 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 !== undefined) {
if (key1 === '__proto__') {
return
}
const type = Object.prototype.toString.call(recipient[key1]);
const isobject = (
type === '[object Object]' ||
type === '[object Array]'
);
// do not write over falsey, non-undefined values if overwrite is false
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]);
}
}
// unflatten again for 'messy objects'
recipient[key1] = unflatten(target[key], opts);
});
return result
}
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__default(
(match[2] || "").trim()
/* val */
);
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 (!node_fs.existsSync(path)) {
return {};
}
return parse(node_fs.readFileSync(path, "utf8"), options);
}
function read(options) {
options = withDefaults(options);
return parseFile(node_path.resolve(options.dir, options.name), options);
}
function readUser(options) {
options = withDefaults(options);
options.dir = process.env.XDG_CONFIG_HOME || node_os.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);
node_fs.writeFileSync(node_path.resolve(options.dir, options.name), serialize(config), {
encoding: "utf8"
});
}
function writeUser(config, options) {
options = withDefaults(options);
options.dir = process.env.XDG_CONFIG_HOME || node_os.homedir();
write(config, options);
}
function update(config, options) {
options = withDefaults(options);
if (!options.flat) {
config = unflatten(config, { overwrite: true });
}
const newConfig = defu.defu(config, read(options));
write(newConfig, options);
return newConfig;
}
function updateUser(config, options) {
options = withDefaults(options);
options.dir = process.env.XDG_CONFIG_HOME || node_os.homedir();
return update(config, options);
}
exports.defaults = defaults;
exports.parse = parse;
exports.parseFile = parseFile;
exports.read = read;
exports.readUser = readUser;
exports.serialize = serialize;
exports.update = update;
exports.updateUser = updateUser;
exports.write = write;
exports.writeUser = writeUser;

18
Frontend-Learner/node_modules/rc9/dist/index.d.cts generated vendored Normal file
View file

@ -0,0 +1,18 @@
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;
export { defaults, parse, parseFile, read, readUser, serialize, update, updateUser, write, writeUser };

18
Frontend-Learner/node_modules/rc9/dist/index.d.mts generated vendored Normal file
View file

@ -0,0 +1,18 @@
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;
export { defaults, parse, parseFile, read, readUser, serialize, update, updateUser, write, writeUser };

18
Frontend-Learner/node_modules/rc9/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
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;
export { defaults, parse, parseFile, read, readUser, serialize, update, updateUser, write, writeUser };

247
Frontend-Learner/node_modules/rc9/dist/index.mjs generated vendored Normal file
View file

@ -0,0 +1,247 @@
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';
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 = {};
const isbuffer = isBuffer(target);
if (isbuffer || Object.prototype.toString.call(target) !== '[object Object]') {
return target
}
// safely ensure that the key is
// an integer.
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]);
const isObject = (type === '[object Object]' || type === '[object Array]');
if (!isObject || 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 !== undefined) {
if (key1 === '__proto__') {
return
}
const type = Object.prototype.toString.call(recipient[key1]);
const isobject = (
type === '[object Object]' ||
type === '[object Array]'
);
// do not write over falsey, non-undefined values if overwrite is false
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]);
}
}
// unflatten again for 'messy objects'
recipient[key1] = unflatten(target[key], opts);
});
return result
}
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()
/* val */
);
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);
}
export { defaults, parse, parseFile, read, readUser, serialize, update, updateUser, write, writeUser };

46
Frontend-Learner/node_modules/rc9/package.json generated vendored Normal file
View file

@ -0,0 +1,46 @@
{
"name": "rc9",
"version": "2.1.2",
"description": "Read/Write config couldn't be easier!",
"repository": "unjs/rc9",
"license": "MIT",
"sideEffects": false,
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "vitest",
"lint": "eslint . && prettier -c src test",
"lint:fix": "eslint . --fix && prettier -w src test",
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
"test": "pnpm lint && vitest run --coverage"
},
"dependencies": {
"defu": "^6.1.4",
"destr": "^2.0.3"
},
"devDependencies": {
"@types/node": "^20.12.6",
"@vitest/coverage-v8": "^1.4.0",
"automd": "^0.3.7",
"changelogen": "^0.5.5",
"eslint": "^9.0.0",
"eslint-config-unjs": "^0.3.0-rc.5",
"flat": "^6.0.1",
"prettier": "^3.2.5",
"typescript": "^5.4.4",
"unbuild": "^2.0.0",
"vitest": "^1.4.0"
},
"packageManager": "pnpm@8.15.6"
}