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

22
Frontend-Learner/node_modules/oxc-minify/LICENSE generated vendored Normal file
View file

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2024-present VoidZero Inc. & Contributors
Copyright (c) 2023 Boshen
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.

76
Frontend-Learner/node_modules/oxc-minify/README.md generated vendored Normal file
View file

@ -0,0 +1,76 @@
# Oxc Minify
This is alpha software and may yield incorrect results, feel free to [submit a bug report](https://github.com/oxc-project/oxc/issues/new?assignees=&labels=C-bug&projects=&template=bug_report.md).
### Performance and Compression Size
See [minification-benchmarks](https://github.com/privatenumber/minification-benchmarks) for details.
The current version already outperforms `esbuild`,
but it still lacks a few key minification techniques
such as constant inlining and dead code removal,
which we plan to implement next.
## Caveats
To maximize performance, `oxc-minify` assumes the input code is semantically correct.
It uses `oxc-parser`'s fast mode to parse the input code,
which does not check for semantic errors related to symbols and scopes.
## API
### Functions
```typescript
// Synchronous minification
minifySync(
filename: string,
sourceText: string,
options?: MinifyOptions,
): MinifyResult
// Asynchronous minification
minify(
filename: string,
sourceText: string,
options?: MinifyOptions,
): Promise<MinifyResult>
```
Use `minifySync` for synchronous minification. Use `minify` for asynchronous minification, which can be beneficial in I/O-bound or concurrent scenarios, though it adds async overhead.
### Example
```javascript
import { minifySync } from 'oxc-minify';
const filename = 'test.js';
const code = "const x = 'a' + 'b'; console.log(x);";
const options = {
compress: {
target: 'esnext',
},
mangle: {
toplevel: false,
},
codegen: {
removeWhitespace: true,
},
sourcemap: true,
};
const result = minifySync(filename, code, options);
// Or use async version: const result = await minify(filename, code, options);
console.log(result.code);
console.log(result.map);
```
## Assumptions
`oxc-minify` makes some assumptions about the source code.
See https://github.com/oxc-project/oxc/blob/main/crates/oxc_minifier/README.md#assumptions for details.
### Supports WASM
See https://stackblitz.com/edit/oxc-minify for usage example.

1
Frontend-Learner/node_modules/oxc-minify/browser.js generated vendored Normal file
View file

@ -0,0 +1 @@
export * from '@oxc-minify/binding-wasm32-wasi'

221
Frontend-Learner/node_modules/oxc-minify/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,221 @@
/* auto-generated by NAPI-RS */
/* eslint-disable */
export interface CodegenOptions {
/**
* Remove whitespace.
*
* @default true
*/
removeWhitespace?: boolean
}
export interface CompressOptions {
/**
* Set desired EcmaScript standard version for output.
*
* Set `esnext` to enable all target highering.
*
* Example:
*
* * `'es2015'`
* * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
*
* @default 'esnext'
*
* @see [esbuild#target](https://esbuild.github.io/api/#target)
*/
target?: string | Array<string>
/**
* Pass true to discard calls to `console.*`.
*
* @default false
*/
dropConsole?: boolean
/**
* Remove `debugger;` statements.
*
* @default true
*/
dropDebugger?: boolean
/**
* Pass `true` to drop unreferenced functions and variables.
*
* Simple direct variable assignments do not count as references unless set to `keep_assign`.
* @default true
*/
unused?: boolean | 'keep_assign'
/** Keep function / class names. */
keepNames?: CompressOptionsKeepNames
/**
* Join consecutive var, let and const statements.
*
* @default true
*/
joinVars?: boolean
/**
* Join consecutive simple statements using the comma operator.
*
* `a; b` -> `a, b`
*
* @default true
*/
sequences?: boolean
/**
* Set of label names to drop from the code.
*
* Labeled statements matching these names will be removed during minification.
*
* @default []
*/
dropLabels?: Array<string>
/** Limit the maximum number of iterations for debugging purpose. */
maxIterations?: number
/** Treeshake options. */
treeshake?: TreeShakeOptions
}
export interface CompressOptionsKeepNames {
/**
* Keep function names so that `Function.prototype.name` is preserved.
*
* This does not guarantee that the `undefined` name is preserved.
*
* @default false
*/
function: boolean
/**
* Keep class names so that `Class.prototype.name` is preserved.
*
* This does not guarantee that the `undefined` name is preserved.
*
* @default false
*/
class: boolean
}
export interface MangleOptions {
/**
* Pass `true` to mangle names declared in the top level scope.
*
* @default false
*/
toplevel?: boolean
/**
* Preserve `name` property for functions and classes.
*
* @default false
*/
keepNames?: boolean | MangleOptionsKeepNames
/** Debug mangled names. */
debug?: boolean
}
export interface MangleOptionsKeepNames {
/**
* Preserve `name` property for functions.
*
* @default false
*/
function: boolean
/**
* Preserve `name` property for classes.
*
* @default false
*/
class: boolean
}
/**
* Minify asynchronously.
*
* Note: This function can be slower than `minifySync` due to the overhead of spawning a thread.
*/
export declare function minify(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): Promise<MinifyResult>
export interface MinifyOptions {
/** Use when minifying an ES module. */
module?: boolean
compress?: boolean | CompressOptions
mangle?: boolean | MangleOptions
codegen?: boolean | CodegenOptions
sourcemap?: boolean
}
export interface MinifyResult {
code: string
map?: SourceMap
errors: Array<OxcError>
}
/** Minify synchronously. */
export declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions | undefined | null): MinifyResult
export interface TreeShakeOptions {
/**
* Whether to respect the pure annotations.
*
* Pure annotations are comments that mark an expression as pure.
* For example: @__PURE__ or #__NO_SIDE_EFFECTS__.
*
* @default true
*/
annotations?: boolean
/**
* Whether to treat this function call as pure.
*
* This function is called for normal function calls, new calls, and
* tagged template calls.
*/
manualPureFunctions?: Array<string>
/**
* Whether property read accesses have side effects.
*
* @default 'always'
*/
propertyReadSideEffects?: boolean | 'always'
/**
* Whether accessing a global variable has side effects.
*
* Accessing a non-existing global variable will throw an error.
* Global variable may be a getter that has side effects.
*
* @default true
*/
unknownGlobalSideEffects?: boolean
}
export interface Comment {
type: 'Line' | 'Block'
value: string
start: number
end: number
}
export interface ErrorLabel {
message: string | null
start: number
end: number
}
export interface OxcError {
severity: Severity
message: string
labels: Array<ErrorLabel>
helpMessage: string | null
codeframe: string | null
}
export declare const enum Severity {
Error = 'Error',
Warning = 'Warning',
Advice = 'Advice'
}
export interface SourceMap {
file?: string
mappings: string
names: Array<string>
sourceRoot?: string
sources: Array<string>
sourcesContent?: Array<string>
version: number
x_google_ignoreList?: Array<number>
}

589
Frontend-Learner/node_modules/oxc-minify/index.js generated vendored Normal file
View file

@ -0,0 +1,589 @@
// prettier-ignore
/* eslint-disable */
// @ts-nocheck
/* auto-generated by NAPI-RS */
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const __dirname = new URL('.', import.meta.url).pathname
const { readFileSync } = require('node:fs')
let nativeBinding = null
const loadErrors = []
const isMusl = () => {
let musl = false
if (process.platform === 'linux') {
musl = isMuslFromFilesystem()
if (musl === null) {
musl = isMuslFromReport()
}
if (musl === null) {
musl = isMuslFromChildProcess()
}
}
return musl
}
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
const isMuslFromFilesystem = () => {
try {
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
} catch {
return null
}
}
const isMuslFromReport = () => {
let report = null
if (typeof process.report?.getReport === 'function') {
process.report.excludeNetwork = true
report = process.report.getReport()
}
if (!report) {
return null
}
if (report.header && report.header.glibcVersionRuntime) {
return false
}
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) {
return true
}
}
return false
}
const isMuslFromChildProcess = () => {
try {
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
} catch (e) {
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
return false
}
}
function requireNative() {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
try {
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err)
}
} else if (process.platform === 'android') {
if (process.arch === 'arm64') {
try {
return require('./minify.android-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-android-arm64')
const bindingPackageVersion = require('@oxc-minify/binding-android-arm64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm') {
try {
return require('./minify.android-arm-eabi.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-android-arm-eabi')
const bindingPackageVersion = require('@oxc-minify/binding-android-arm-eabi/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
}
} else if (process.platform === 'win32') {
if (process.arch === 'x64') {
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
try {
return require('./minify.win32-x64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-win32-x64-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-win32-x64-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./minify.win32-x64-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-win32-x64-msvc')
const bindingPackageVersion = require('@oxc-minify/binding-win32-x64-msvc/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'ia32') {
try {
return require('./minify.win32-ia32-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-win32-ia32-msvc')
const bindingPackageVersion = require('@oxc-minify/binding-win32-ia32-msvc/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./minify.win32-arm64-msvc.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-win32-arm64-msvc')
const bindingPackageVersion = require('@oxc-minify/binding-win32-arm64-msvc/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
}
} else if (process.platform === 'darwin') {
try {
return require('./minify.darwin-universal.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-darwin-universal')
const bindingPackageVersion = require('@oxc-minify/binding-darwin-universal/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
if (process.arch === 'x64') {
try {
return require('./minify.darwin-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-darwin-x64')
const bindingPackageVersion = require('@oxc-minify/binding-darwin-x64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./minify.darwin-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-darwin-arm64')
const bindingPackageVersion = require('@oxc-minify/binding-darwin-arm64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
}
} else if (process.platform === 'freebsd') {
if (process.arch === 'x64') {
try {
return require('./minify.freebsd-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-freebsd-x64')
const bindingPackageVersion = require('@oxc-minify/binding-freebsd-x64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm64') {
try {
return require('./minify.freebsd-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-freebsd-arm64')
const bindingPackageVersion = require('@oxc-minify/binding-freebsd-arm64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
}
} else if (process.platform === 'linux') {
if (process.arch === 'x64') {
if (isMusl()) {
try {
return require('./minify.linux-x64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-x64-musl')
const bindingPackageVersion = require('@oxc-minify/binding-linux-x64-musl/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./minify.linux-x64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-x64-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-linux-x64-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'arm64') {
if (isMusl()) {
try {
return require('./minify.linux-arm64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-arm64-musl')
const bindingPackageVersion = require('@oxc-minify/binding-linux-arm64-musl/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./minify.linux-arm64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-arm64-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-linux-arm64-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'arm') {
if (isMusl()) {
try {
return require('./minify.linux-arm-musleabihf.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-arm-musleabihf')
const bindingPackageVersion = require('@oxc-minify/binding-linux-arm-musleabihf/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./minify.linux-arm-gnueabihf.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-arm-gnueabihf')
const bindingPackageVersion = require('@oxc-minify/binding-linux-arm-gnueabihf/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'loong64') {
if (isMusl()) {
try {
return require('./minify.linux-loong64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-loong64-musl')
const bindingPackageVersion = require('@oxc-minify/binding-linux-loong64-musl/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./minify.linux-loong64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-loong64-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-linux-loong64-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'riscv64') {
if (isMusl()) {
try {
return require('./minify.linux-riscv64-musl.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-riscv64-musl')
const bindingPackageVersion = require('@oxc-minify/binding-linux-riscv64-musl/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
try {
return require('./minify.linux-riscv64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-riscv64-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-linux-riscv64-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
}
} else if (process.arch === 'ppc64') {
try {
return require('./minify.linux-ppc64-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-ppc64-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-linux-ppc64-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 's390x') {
try {
return require('./minify.linux-s390x-gnu.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-linux-s390x-gnu')
const bindingPackageVersion = require('@oxc-minify/binding-linux-s390x-gnu/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
}
} else if (process.platform === 'openharmony') {
if (process.arch === 'arm64') {
try {
return require('./minify.openharmony-arm64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-openharmony-arm64')
const bindingPackageVersion = require('@oxc-minify/binding-openharmony-arm64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'x64') {
try {
return require('./minify.openharmony-x64.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-openharmony-x64')
const bindingPackageVersion = require('@oxc-minify/binding-openharmony-x64/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else if (process.arch === 'arm') {
try {
return require('./minify.openharmony-arm.node')
} catch (e) {
loadErrors.push(e)
}
try {
const binding = require('@oxc-minify/binding-openharmony-arm')
const bindingPackageVersion = require('@oxc-minify/binding-openharmony-arm/package.json').version
if (bindingPackageVersion !== '0.102.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 0.102.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
}
return binding
} catch (e) {
loadErrors.push(e)
}
} else {
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
}
} else {
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
}
}
nativeBinding = requireNative()
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
let wasiBinding = null
let wasiBindingError = null
try {
wasiBinding = require('./minify.wasi.cjs')
nativeBinding = wasiBinding
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
wasiBindingError = err
}
}
if (!nativeBinding) {
try {
wasiBinding = require('@oxc-minify/binding-wasm32-wasi')
nativeBinding = wasiBinding
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
wasiBindingError.cause = err
loadErrors.push(err)
}
}
}
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
error.cause = wasiBindingError
throw error
}
}
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
try {
nativeBinding = require('./webcontainer-fallback.cjs');
} catch (err) {
loadErrors.push(err)
}
}
if (!nativeBinding) {
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.reduce((err, cur) => {
cur.cause = err
return cur
}),
},
)
}
throw new Error(`Failed to load native binding`)
}
const { minify, minifySync, Severity } = nativeBinding
export { minify }
export { minifySync }
export { Severity }

93
Frontend-Learner/node_modules/oxc-minify/package.json generated vendored Normal file
View file

@ -0,0 +1,93 @@
{
"name": "oxc-minify",
"version": "0.102.0",
"type": "module",
"main": "index.js",
"browser": "browser.js",
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"description": "Oxc Minifier Node API",
"keywords": [
"oxc",
"minify"
],
"author": "Boshen and oxc contributors",
"license": "MIT",
"homepage": "https://oxc.rs",
"bugs": "https://github.com/oxc-project/oxc/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/oxc-project/oxc.git",
"directory": "napi/minify"
},
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"files": [
"index.d.ts",
"index.js",
"browser.js",
"webcontainer-fallback.cjs"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"devDependencies": {
"@types/node": "^24.0.0",
"typescript": "5.9.3",
"vitest": "4.0.10"
},
"napi": {
"binaryName": "minify",
"packageName": "@oxc-minify/binding",
"targets": [
"aarch64-apple-darwin",
"aarch64-linux-android",
"aarch64-pc-windows-msvc",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-unknown-linux-ohos",
"armv7-unknown-linux-gnueabihf",
"riscv64gc-unknown-linux-gnu",
"s390x-unknown-linux-gnu",
"wasm32-wasip1-threads",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-freebsd",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl"
],
"wasm": {
"browser": {
"fs": false
}
}
},
"optionalDependencies": {
"@oxc-minify/binding-darwin-arm64": "0.102.0",
"@oxc-minify/binding-android-arm64": "0.102.0",
"@oxc-minify/binding-win32-arm64-msvc": "0.102.0",
"@oxc-minify/binding-linux-arm64-gnu": "0.102.0",
"@oxc-minify/binding-linux-arm64-musl": "0.102.0",
"@oxc-minify/binding-openharmony-arm64": "0.102.0",
"@oxc-minify/binding-linux-arm-gnueabihf": "0.102.0",
"@oxc-minify/binding-linux-riscv64-gnu": "0.102.0",
"@oxc-minify/binding-linux-s390x-gnu": "0.102.0",
"@oxc-minify/binding-wasm32-wasi": "0.102.0",
"@oxc-minify/binding-darwin-x64": "0.102.0",
"@oxc-minify/binding-win32-x64-msvc": "0.102.0",
"@oxc-minify/binding-freebsd-x64": "0.102.0",
"@oxc-minify/binding-linux-x64-gnu": "0.102.0",
"@oxc-minify/binding-linux-x64-musl": "0.102.0"
},
"scripts": {
"build-dev": "napi build --esm --platform",
"build-test": "pnpm run build-dev",
"build": "pnpm run build-dev --features allocator --release",
"postbuild": "publint",
"postbuild-dev": "node scripts/patch.js",
"test": "tsc && vitest run --dir ./test"
}
}

View file

@ -0,0 +1,21 @@
const fs = require("node:fs");
const childProcess = require("node:child_process");
const pkg = JSON.parse(fs.readFileSync(require.resolve("oxc-minify/package.json"), "utf-8"));
const { version } = pkg;
const baseDir = `/tmp/oxc-minify-${version}`;
const bindingEntry = `${baseDir}/node_modules/@oxc-minify/binding-wasm32-wasi/minify.wasi.cjs`;
if (!fs.existsSync(bindingEntry)) {
fs.rmSync(baseDir, { recursive: true, force: true });
fs.mkdirSync(baseDir, { recursive: true });
const bindingPkg = `@oxc-minify/binding-wasm32-wasi@${version}`;
// oxlint-disable-next-line no-console
console.log(`[oxc-minify] Downloading ${bindingPkg} on WebContainer...`);
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
cwd: baseDir,
stdio: "inherit",
});
}
module.exports = require(bindingEntry);