Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
21
Frontend-Learner/node_modules/compatx/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/compatx/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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.
|
||||
113
Frontend-Learner/node_modules/compatx/README.md
generated
vendored
Normal file
113
Frontend-Learner/node_modules/compatx/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
# `compatx`
|
||||
|
||||
<!-- automd:badges -->
|
||||
|
||||
[](https://npmjs.com/package/compatx)
|
||||
[](https://npm.chart.dev/compatx)
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
🌴 Compatibility toolkit.
|
||||
|
||||
> [!NOTE]
|
||||
> This is a WIP toolkit. See [RFC](./RFC.md) for initial motivations.
|
||||
|
||||
## Install
|
||||
|
||||
<!-- automd:pm-install dev -->
|
||||
|
||||
```sh
|
||||
# ✨ Auto-detect
|
||||
npx nypm install -D compatx
|
||||
|
||||
# npm
|
||||
npm install -D compatx
|
||||
|
||||
# yarn
|
||||
yarn add -D compatx
|
||||
|
||||
# pnpm
|
||||
pnpm install -D compatx
|
||||
|
||||
# bun
|
||||
bun install -D compatx
|
||||
|
||||
# deno
|
||||
deno install --dev compatx
|
||||
```
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
## Utils
|
||||
|
||||
<!-- automd:jsdocs src="./src/index.ts" -->
|
||||
|
||||
### `formatCompatibilityDate(input)`
|
||||
|
||||
Format compatibility date spec to a string
|
||||
|
||||
### `formatDate(date)`
|
||||
|
||||
Format a date to a `YYYY-MM-DD` string
|
||||
|
||||
**Example:**
|
||||
|
||||
```ts
|
||||
formatDateString(new Date("2021/01/01")) // "2021-01-01"
|
||||
```
|
||||
|
||||
### `getCompatibilityChanges(allUpdates, compatibilityDate1, compatibilityDate2)`
|
||||
|
||||
Get compatibility changes between two dates.
|
||||
|
||||
### `getCompatibilityUpdates(allUpdates, compatibilityDate)`
|
||||
|
||||
Get compatibility updates applicable for the user given platform and date range.
|
||||
|
||||
### `platforms`
|
||||
|
||||
- **Type**: `array`
|
||||
- **Default**: `["aws","azure","cloudflare","deno","firebase","netlify","vercel"]`
|
||||
|
||||
### `resolveCompatibilityDates(input?, defaults?)`
|
||||
|
||||
Normalize the compatibility dates from input config and defaults.
|
||||
|
||||
### `resolveCompatibilityDatesFromEnv(overridesInput?)`
|
||||
|
||||
Resolve compatibility dates with environment variables as defaults.
|
||||
|
||||
Environment variable name format is `COMPATIBILITY_DATE` for default and `COMPATIBILITY_DATE_<PLATFORM>` for specific platforms.
|
||||
|
||||
<!-- /automd -->
|
||||
|
||||
## Types
|
||||
|
||||
```js
|
||||
import type {
|
||||
// Typed date string in `YYYY-MM-DD` format
|
||||
DateString,
|
||||
// Platform names
|
||||
PlatformName,
|
||||
// Compatibility dates
|
||||
CompatibilityDateSpec,
|
||||
CompatibilityDates,
|
||||
// Compatibility updates
|
||||
CompatibilityUpdate,
|
||||
CompatibilityUpdates
|
||||
} from "./types";
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
- Clone this repository
|
||||
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
||||
- Install dependencies using `pnpm install`
|
||||
- Run interactive tests using `pnpm dev`
|
||||
|
||||
## License
|
||||
|
||||
Made with 💛
|
||||
|
||||
Published under [MIT License](./LICENSE).
|
||||
94
Frontend-Learner/node_modules/compatx/dist/index.d.mts
generated
vendored
Normal file
94
Frontend-Learner/node_modules/compatx/dist/index.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* Known platform names
|
||||
*/
|
||||
declare const platforms: readonly ["aws", "azure", "cloudflare", "deno", "firebase", "netlify", "vercel"];
|
||||
/**
|
||||
* Known platform name
|
||||
*/
|
||||
type PlatformName = (typeof platforms)[number] | (string & {});
|
||||
|
||||
/**
|
||||
* Normalize the compatibility dates from input config and defaults.
|
||||
*/
|
||||
declare function resolveCompatibilityDates(input?: CompatibilityDateSpec | undefined, defaults?: CompatibilityDateSpec): CompatibilityDates;
|
||||
/**
|
||||
* Resolve compatibility dates with environment variables as defaults.
|
||||
*
|
||||
* Environment variable name format is `COMPATIBILITY_DATE` for default and `COMPATIBILITY_DATE_<PLATFORM>` for specific platforms.
|
||||
*/
|
||||
declare function resolveCompatibilityDatesFromEnv(overridesInput?: CompatibilityDateSpec | undefined): CompatibilityDates;
|
||||
/**
|
||||
* Format compatibility date spec to a string
|
||||
*/
|
||||
declare function formatCompatibilityDate(input: CompatibilityDateSpec): string;
|
||||
/**
|
||||
* Format a date to a `YYYY-MM-DD` string
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* formatDateString(new Date("2021/01/01")) // "2021-01-01"
|
||||
* ```
|
||||
*/
|
||||
declare function formatDate(date: Date | string): DateString;
|
||||
type Year = `${number}${number}${number}${number}`;
|
||||
type Month = `${"0" | "1"}${number}`;
|
||||
type Day = `${"0" | "1" | "2" | "3"}${number}`;
|
||||
/**
|
||||
* Typed date string in `YYYY-MM-DD` format
|
||||
*
|
||||
* Empty string is used to represent an "unspecified" date.
|
||||
*
|
||||
* "latest" is used to represent the latest date available (date of today).
|
||||
*/
|
||||
type DateString = "" | "latest" | `${Year}-${Month}-${Day}`;
|
||||
/**
|
||||
* Last known compatibility dates for platforms
|
||||
*
|
||||
* @example
|
||||
* {
|
||||
* "default": "2024-01-01",
|
||||
* "cloudflare": "2024-03-01",
|
||||
* }
|
||||
*/
|
||||
type CompatibilityDates = {
|
||||
/**
|
||||
* Default compatibility date for all unspecified platforms (required)
|
||||
*/
|
||||
default: DateString;
|
||||
} & Partial<Record<PlatformName, DateString>>;
|
||||
/**
|
||||
* Last known compatibility date for the used platform
|
||||
*/
|
||||
type CompatibilityDateSpec = DateString | Partial<CompatibilityDates>;
|
||||
|
||||
/**
|
||||
* Get compatibility updates applicable for the user given platform and date range.
|
||||
*/
|
||||
declare function getCompatibilityUpdates(allUpdates: CompatibilityUpdates, compatibilityDate: CompatibilityDateSpec): CompatibilityUpdates;
|
||||
/**
|
||||
* Get compatibility changes between two dates.
|
||||
*/
|
||||
declare function getCompatibilityChanges(allUpdates: CompatibilityUpdates, compatibilityDate1: CompatibilityDateSpec, compatibilityDate2: CompatibilityDateSpec): {
|
||||
added: CompatibilityUpdates;
|
||||
removed: CompatibilityUpdates;
|
||||
};
|
||||
/**
|
||||
* Compatibility updateinformation.
|
||||
*/
|
||||
interface CompatibilityUpdate {
|
||||
/** Applicable platform name */
|
||||
platform: PlatformName;
|
||||
/** Description */
|
||||
description: string;
|
||||
/** URL for more information */
|
||||
url?: string;
|
||||
/** The starting date of updatebeing effective */
|
||||
from?: DateString;
|
||||
/** The ending date until the updateis effective */
|
||||
until?: DateString;
|
||||
}
|
||||
type CompatibilityUpdates = CompatibilityUpdate[];
|
||||
|
||||
export { formatCompatibilityDate, formatDate, getCompatibilityChanges, getCompatibilityUpdates, platforms, resolveCompatibilityDates, resolveCompatibilityDatesFromEnv };
|
||||
export type { CompatibilityDateSpec, CompatibilityDates, CompatibilityUpdate, CompatibilityUpdates, DateString, PlatformName };
|
||||
103
Frontend-Learner/node_modules/compatx/dist/index.mjs
generated
vendored
Normal file
103
Frontend-Learner/node_modules/compatx/dist/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
const platforms = [
|
||||
"aws",
|
||||
"azure",
|
||||
"cloudflare",
|
||||
"deno",
|
||||
"firebase",
|
||||
"netlify",
|
||||
"vercel"
|
||||
];
|
||||
|
||||
function resolveCompatibilityDates(input, defaults) {
|
||||
const dates = {
|
||||
default: ""
|
||||
};
|
||||
const _defaults = typeof defaults === "string" ? { default: defaults } : defaults || {};
|
||||
for (const [key, value] of Object.entries(_defaults)) {
|
||||
if (value) {
|
||||
dates[key] = formatDate(value);
|
||||
}
|
||||
}
|
||||
const _input = typeof input === "string" ? { default: input } : input || {};
|
||||
for (const [key, value] of Object.entries(_input)) {
|
||||
if (value) {
|
||||
dates[key] = formatDate(value);
|
||||
}
|
||||
}
|
||||
dates.default = formatDate(dates.default || "") || Object.values(dates).sort().pop() || "";
|
||||
return dates;
|
||||
}
|
||||
function resolveCompatibilityDatesFromEnv(overridesInput) {
|
||||
const defaults = {
|
||||
default: process.env.COMPATIBILITY_DATE ? formatDate(process.env.COMPATIBILITY_DATE) : void 0
|
||||
};
|
||||
for (const platform of platforms) {
|
||||
const envName = `COMPATIBILITY_DATE_${platform.toUpperCase()}`;
|
||||
const env = process.env[envName];
|
||||
if (env) {
|
||||
defaults[platform] = formatDate(env);
|
||||
}
|
||||
}
|
||||
return resolveCompatibilityDates(overridesInput, defaults);
|
||||
}
|
||||
function formatCompatibilityDate(input) {
|
||||
const dates = resolveCompatibilityDates(input);
|
||||
const entries = Object.entries(dates);
|
||||
if (entries.length === 0) {
|
||||
return "-";
|
||||
}
|
||||
return [
|
||||
`${dates["default"]}`,
|
||||
...Object.entries(dates).filter(
|
||||
([key, value]) => key !== "default" && value && value !== dates["default"]
|
||||
).map(([key, value]) => `${key}: ${value}`)
|
||||
].join(", ");
|
||||
}
|
||||
function formatDate(date) {
|
||||
const d = normalizeDate(date);
|
||||
if (Number.isNaN(d.getDate())) {
|
||||
return "";
|
||||
}
|
||||
const year = d.getFullYear().toString();
|
||||
const month = (d.getMonth() + 1).toString().padStart(2, "0");
|
||||
const day = d.getDate().toString().padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
function normalizeDate(date) {
|
||||
if (date instanceof Date) {
|
||||
return date;
|
||||
}
|
||||
if (date === "latest") {
|
||||
return /* @__PURE__ */ new Date();
|
||||
}
|
||||
return new Date(date);
|
||||
}
|
||||
|
||||
function getCompatibilityUpdates(allUpdates, compatibilityDate) {
|
||||
const _date = resolveCompatibilityDates(compatibilityDate);
|
||||
return allUpdates.filter((change) => {
|
||||
const _platformDate = _date[change.platform] || _date.default;
|
||||
if (!_platformDate) {
|
||||
return false;
|
||||
}
|
||||
if (change.from && _platformDate < change.from) {
|
||||
return false;
|
||||
}
|
||||
if (change.until && _platformDate > change.until) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
function getCompatibilityChanges(allUpdates, compatibilityDate1, compatibilityDate2) {
|
||||
const updates1 = getCompatibilityUpdates(allUpdates, compatibilityDate1);
|
||||
const updates2 = getCompatibilityUpdates(allUpdates, compatibilityDate2);
|
||||
const added = updates2.filter((update) => !updates1.includes(update));
|
||||
const removed = updates1.filter((update) => !updates2.includes(update));
|
||||
return {
|
||||
added,
|
||||
removed
|
||||
};
|
||||
}
|
||||
|
||||
export { formatCompatibilityDate, formatDate, getCompatibilityChanges, getCompatibilityUpdates, platforms, resolveCompatibilityDates, resolveCompatibilityDatesFromEnv };
|
||||
43
Frontend-Learner/node_modules/compatx/package.json
generated
vendored
Normal file
43
Frontend-Learner/node_modules/compatx/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "compatx",
|
||||
"version": "0.2.0",
|
||||
"description": "🌴 Gradual feature flags.",
|
||||
"repository": "unjs/compatx",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.mts",
|
||||
"default": "./dist/index.mjs"
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.mts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest dev",
|
||||
"lint": "eslint --cache . && prettier -c src test",
|
||||
"lint:fix": "automd && eslint --cache . --fix && prettier -c src test -w",
|
||||
"prepack": "pnpm build",
|
||||
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
||||
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
|
||||
"test:types": "tsc --noEmit --skipLibCheck"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.0",
|
||||
"@vitest/coverage-v8": "^3.1.1",
|
||||
"automd": "^0.4.0",
|
||||
"changelogen": "^0.6.1",
|
||||
"eslint": "^9.24.0",
|
||||
"eslint-config-unjs": "^0.4.2",
|
||||
"jiti": "^2.4.2",
|
||||
"prettier": "^3.5.3",
|
||||
"typescript": "^5.8.3",
|
||||
"unbuild": "^3.5.0",
|
||||
"vitest": "^3.1.1"
|
||||
},
|
||||
"packageManager": "pnpm@10.7.1"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue