diff --git a/.pnp.loader.mjs b/.pnp.loader.mjs index c1daeb5..2fbef9b 100644 --- a/.pnp.loader.mjs +++ b/.pnp.loader.mjs @@ -1,13 +1,13 @@ -import { URL, fileURLToPath, pathToFileURL } from 'url'; -import fs from 'fs'; -import path from 'path'; -import moduleExports, { Module } from 'module'; +import { URL, fileURLToPath, pathToFileURL } from "url"; +import fs from "fs"; +import path from "path"; +import moduleExports, { Module } from "module"; var PathType; -(function(PathType2) { - PathType2[PathType2["File"] = 0] = "File"; - PathType2[PathType2["Portable"] = 1] = "Portable"; - PathType2[PathType2["Native"] = 2] = "Native"; +(function (PathType2) { + PathType2[(PathType2["File"] = 0)] = "File"; + PathType2[(PathType2["Portable"] = 1)] = "Portable"; + PathType2[(PathType2["Native"] = 2)] = "Native"; })(PathType || (PathType = {})); const npath = Object.create(path); const ppath = Object.create(path.posix); @@ -20,13 +20,11 @@ ppath.resolve = (...segments) => { return path.posix.resolve(ppath.cwd(), ...segments); } }; -const contains = function(pathUtils, from, to) { +const contains = function (pathUtils, from, to) { from = pathUtils.normalize(from); to = pathUtils.normalize(to); - if (from === to) - return `.`; - if (!from.endsWith(pathUtils.sep)) - from = from + pathUtils.sep; + if (from === to) return `.`; + if (!from.endsWith(pathUtils.sep)) from = from + pathUtils.sep; if (to.startsWith(from)) { return to.slice(from.length); } else { @@ -42,44 +40,45 @@ const UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/; const PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/; const UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/; function fromPortablePath(p) { - if (process.platform !== `win32`) - return p; + if (process.platform !== `win32`) return p; let portablePathMatch, uncPortablePathMatch; - if (portablePathMatch = p.match(PORTABLE_PATH_REGEXP)) + if ((portablePathMatch = p.match(PORTABLE_PATH_REGEXP))) p = portablePathMatch[1]; - else if (uncPortablePathMatch = p.match(UNC_PORTABLE_PATH_REGEXP)) + else if ((uncPortablePathMatch = p.match(UNC_PORTABLE_PATH_REGEXP))) p = `\\\\${uncPortablePathMatch[1] ? `.\\` : ``}${uncPortablePathMatch[2]}`; - else - return p; + else return p; return p.replace(/\//g, `\\`); } function toPortablePath(p) { - if (process.platform !== `win32`) - return p; + if (process.platform !== `win32`) return p; p = p.replace(/\\/g, `/`); let windowsPathMatch, uncWindowsPathMatch; - if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP)) + if ((windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))) p = `/${windowsPathMatch[1]}`; - else if (uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP)) - p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`; + else if ((uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP))) + p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${ + uncWindowsPathMatch[2] + }`; return p; } -const builtinModules = new Set(Module.builtinModules || Object.keys(process.binding(`natives`))); -const isBuiltinModule = (request) => request.startsWith(`node:`) || builtinModules.has(request); +const builtinModules = new Set( + Module.builtinModules || Object.keys(process.binding(`natives`)) +); +const isBuiltinModule = (request) => + request.startsWith(`node:`) || builtinModules.has(request); function readPackageScope(checkPath) { const rootSeparatorIndex = checkPath.indexOf(npath.sep); let separatorIndex; do { separatorIndex = checkPath.lastIndexOf(npath.sep); checkPath = checkPath.slice(0, separatorIndex); - if (checkPath.endsWith(`${npath.sep}node_modules`)) - return false; + if (checkPath.endsWith(`${npath.sep}node_modules`)) return false; const pjson = readPackage(checkPath + npath.sep); if (pjson) { return { data: pjson, - path: checkPath + path: checkPath, }; } } while (separatorIndex > rootSeparatorIndex); @@ -87,22 +86,24 @@ function readPackageScope(checkPath) { } function readPackage(requestPath) { const jsonPath = npath.resolve(requestPath, `package.json`); - if (!fs.existsSync(jsonPath)) - return null; + if (!fs.existsSync(jsonPath)) return null; return JSON.parse(fs.readFileSync(jsonPath, `utf8`)); } -const [major, minor] = process.versions.node.split(`.`).map((value) => parseInt(value, 10)); -const HAS_CONSOLIDATED_HOOKS = major > 16 || major === 16 && minor >= 12; -const HAS_UNFLAGGED_JSON_MODULES = major > 17 || major === 17 && minor >= 5 || major === 16 && minor >= 15; -const HAS_JSON_IMPORT_ASSERTION_REQUIREMENT = major > 17 || major === 17 && minor >= 1 || major === 16 && minor > 14; +const [major, minor] = process.versions.node + .split(`.`) + .map((value) => parseInt(value, 10)); +const HAS_CONSOLIDATED_HOOKS = major > 16 || (major === 16 && minor >= 12); +const HAS_UNFLAGGED_JSON_MODULES = + major > 17 || (major === 17 && minor >= 5) || (major === 16 && minor >= 15); +const HAS_JSON_IMPORT_ASSERTION_REQUIREMENT = + major > 17 || (major === 17 && minor >= 1) || (major === 16 && minor > 14); async function tryReadFile(path2) { try { return await fs.promises.readFile(path2, `utf8`); } catch (error) { - if (error.code === `ENOENT`) - return null; + if (error.code === `ENOENT`) return null; throw error; } } @@ -131,24 +132,19 @@ function getFileFormat(filepath) { throw new Error(`Unknown file extension ".wasm" for ${filepath}`); } case `.json`: { - if (HAS_UNFLAGGED_JSON_MODULES) - return `json`; + if (HAS_UNFLAGGED_JSON_MODULES) return `json`; throw new Error(`Unknown file extension ".json" for ${filepath}`); } case `.js`: { const pkg = readPackageScope(filepath); - if (!pkg) - return `commonjs`; + if (!pkg) return `commonjs`; return (_a = pkg.data.type) != null ? _a : `commonjs`; } default: { - if (entrypointPath !== filepath) - return null; + if (entrypointPath !== filepath) return null; const pkg = readPackageScope(filepath); - if (!pkg) - return `commonjs`; - if (pkg.data.type === `module`) - return null; + if (!pkg) return `commonjs`; + if (pkg.data.type === `module`) return null; return (_b = pkg.data.type) != null ? _b : `commonjs`; } } @@ -161,7 +157,7 @@ async function getFormat$1(resolved, context, defaultGetFormat) { const format = getFileFormat(fileURLToPath(url)); if (format) { return { - format + format, }; } return defaultGetFormat(resolved, context, defaultGetFormat); @@ -172,7 +168,7 @@ async function getSource$1(urlString, context, defaultGetSource) { if ((url == null ? void 0 : url.protocol) !== `file:`) return defaultGetSource(urlString, context, defaultGetSource); return { - source: await fs.promises.readFile(fileURLToPath(url), `utf8`) + source: await fs.promises.readFile(fileURLToPath(url), `utf8`), }; } @@ -183,45 +179,57 @@ async function load$1(urlString, context, nextLoad) { return nextLoad(urlString, context, nextLoad); const filePath = fileURLToPath(url); const format = getFileFormat(filePath); - if (!format) - return nextLoad(urlString, context, nextLoad); - if (HAS_JSON_IMPORT_ASSERTION_REQUIREMENT && format === `json` && ((_a = context.importAssertions) == null ? void 0 : _a.type) !== `json`) { - const err = new TypeError(`[ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "${urlString}" needs an import assertion of type "json"`); + if (!format) return nextLoad(urlString, context, nextLoad); + if ( + HAS_JSON_IMPORT_ASSERTION_REQUIREMENT && + format === `json` && + ((_a = context.importAssertions) == null ? void 0 : _a.type) !== `json` + ) { + const err = new TypeError( + `[ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "${urlString}" needs an import assertion of type "json"` + ); err.code = `ERR_IMPORT_ASSERTION_TYPE_MISSING`; throw err; } return { format, source: await fs.promises.readFile(filePath, `utf8`), - shortCircuit: true + shortCircuit: true, }; } -const pathRegExp = /^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/; +const pathRegExp = + /^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/; const isRelativeRegexp = /^\.{0,2}\//; async function resolve$1(originalSpecifier, context, nextResolve) { var _a; - const {findPnpApi} = moduleExports; + const { findPnpApi } = moduleExports; if (!findPnpApi || isBuiltinModule(originalSpecifier)) return nextResolve(originalSpecifier, context, nextResolve); let specifier = originalSpecifier; - const url = tryParseURL(specifier, isRelativeRegexp.test(specifier) ? context.parentURL : void 0); + const url = tryParseURL( + specifier, + isRelativeRegexp.test(specifier) ? context.parentURL : void 0 + ); if (url) { if (url.protocol !== `file:`) return nextResolve(originalSpecifier, context, nextResolve); specifier = fileURLToPath(url); } - const {parentURL, conditions = []} = context; + const { parentURL, conditions = [] } = context; const issuer = parentURL ? fileURLToPath(parentURL) : process.cwd(); - const pnpapi = (_a = findPnpApi(issuer)) != null ? _a : url ? findPnpApi(specifier) : null; - if (!pnpapi) - return nextResolve(originalSpecifier, context, nextResolve); + const pnpapi = + (_a = findPnpApi(issuer)) != null ? _a : url ? findPnpApi(specifier) : null; + if (!pnpapi) return nextResolve(originalSpecifier, context, nextResolve); const dependencyNameMatch = specifier.match(pathRegExp); let allowLegacyResolve = false; if (dependencyNameMatch) { const [, dependencyName, subPath] = dependencyNameMatch; if (subPath === ``) { - const resolved = pnpapi.resolveToUnqualified(`${dependencyName}/package.json`, issuer); + const resolved = pnpapi.resolveToUnqualified( + `${dependencyName}/package.json`, + issuer + ); if (resolved) { const content = await tryReadFile(resolved); if (content) { @@ -233,7 +241,7 @@ async function resolve$1(originalSpecifier, context, nextResolve) { } const result = pnpapi.resolveRequest(specifier, issuer, { conditions: new Set(conditions), - extensions: allowLegacyResolve ? void 0 : [] + extensions: allowLegacyResolve ? void 0 : [], }); if (!result) throw new Error(`Resolving '${specifier}' from '${issuer}' failed`); @@ -242,11 +250,10 @@ async function resolve$1(originalSpecifier, context, nextResolve) { resultURL.search = url.search; resultURL.hash = url.hash; } - if (!parentURL) - setEntrypointPath(fileURLToPath(resultURL)); + if (!parentURL) setEntrypointPath(fileURLToPath(resultURL)); return { url: resultURL.href, - shortCircuit: true + shortCircuit: true, }; } @@ -254,7 +261,7 @@ const binding = process.binding(`fs`); const originalfstat = binding.fstat; const ZIP_MASK = 4278190080; const ZIP_MAGIC = 704643072; -binding.fstat = function(...args) { +binding.fstat = function (...args) { const [fd, useBigint, req] = args; if ((fd & ZIP_MASK) === ZIP_MAGIC && useBigint === false && req === void 0) { try { @@ -269,10 +276,9 @@ binding.fstat = function(...args) { stats.blksize, stats.ino, stats.size, - stats.blocks + stats.blocks, ]); - } catch { - } + } catch {} } return originalfstat.apply(this, args); }; diff --git a/vercel.json b/vercel.json index 77e94d7..891f15b 100644 --- a/vercel.json +++ b/vercel.json @@ -15,6 +15,10 @@ { "source": "/view-source", "destination": "https://github.com/kongkowitpku/soon" + }, + { + "source": "/stats", + "destination": "https://umami.kongkowitpku.xyz/share/35IxaV3M/home.kongkow" } ] }