Pretty/lint ignore generated files

This commit is contained in:
Franck Royer 2022-04-20 10:39:15 +10:00
parent 42547b9abf
commit 6ce04ef6a9
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
4 changed files with 5558 additions and 7220 deletions

4
.eslintignore Normal file
View File

@ -0,0 +1,4 @@
.pnp.cjs
.pnp.loader.mjs
.yarnrc.yml
.yarn

12649
.pnp.cjs generated

File diff suppressed because one or more lines are too long

121
.pnp.loader.mjs generated
View File

@ -1,13 +1,13 @@
import { URL, fileURLToPath, pathToFileURL } from "url"; import { URL, fileURLToPath, pathToFileURL } from 'url';
import fs from "fs"; import fs from 'fs';
import path from "path"; import path from 'path';
import moduleExports, { Module } from "module"; import moduleExports, { Module } from 'module';
var PathType; var PathType;
(function (PathType2) { (function(PathType2) {
PathType2[(PathType2["File"] = 0)] = "File"; PathType2[PathType2["File"] = 0] = "File";
PathType2[(PathType2["Portable"] = 1)] = "Portable"; PathType2[PathType2["Portable"] = 1] = "Portable";
PathType2[(PathType2["Native"] = 2)] = "Native"; PathType2[PathType2["Native"] = 2] = "Native";
})(PathType || (PathType = {})); })(PathType || (PathType = {}));
const npath = Object.create(path); const npath = Object.create(path);
const ppath = Object.create(path.posix); const ppath = Object.create(path.posix);
@ -20,11 +20,13 @@ ppath.resolve = (...segments) => {
return path.posix.resolve(ppath.cwd(), ...segments); return path.posix.resolve(ppath.cwd(), ...segments);
} }
}; };
const contains = function (pathUtils, from, to) { const contains = function(pathUtils, from, to) {
from = pathUtils.normalize(from); from = pathUtils.normalize(from);
to = pathUtils.normalize(to); to = pathUtils.normalize(to);
if (from === to) return `.`; if (from === to)
if (!from.endsWith(pathUtils.sep)) from = from + pathUtils.sep; return `.`;
if (!from.endsWith(pathUtils.sep))
from = from + pathUtils.sep;
if (to.startsWith(from)) { if (to.startsWith(from)) {
return to.slice(from.length); return to.slice(from.length);
} else { } else {
@ -40,45 +42,44 @@ const UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
const PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/; const PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
const UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/; const UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/;
function fromPortablePath(p) { function fromPortablePath(p) {
if (process.platform !== `win32`) return p; if (process.platform !== `win32`)
return p;
let portablePathMatch, uncPortablePathMatch; let portablePathMatch, uncPortablePathMatch;
if ((portablePathMatch = p.match(PORTABLE_PATH_REGEXP))) if (portablePathMatch = p.match(PORTABLE_PATH_REGEXP))
p = portablePathMatch[1]; 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]}`; p = `\\\\${uncPortablePathMatch[1] ? `.\\` : ``}${uncPortablePathMatch[2]}`;
else return p; else
return p;
return p.replace(/\//g, `\\`); return p.replace(/\//g, `\\`);
} }
function toPortablePath(p) { function toPortablePath(p) {
if (process.platform !== `win32`) return p; if (process.platform !== `win32`)
return p;
p = p.replace(/\\/g, `/`); p = p.replace(/\\/g, `/`);
let windowsPathMatch, uncWindowsPathMatch; let windowsPathMatch, uncWindowsPathMatch;
if ((windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))) if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))
p = `/${windowsPathMatch[1]}`; p = `/${windowsPathMatch[1]}`;
else if ((uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP))) else if (uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP))
p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${ p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`;
uncWindowsPathMatch[2]
}`;
return p; return p;
} }
const builtinModules = new Set( const builtinModules = new Set(Module.builtinModules || Object.keys(process.binding(`natives`)));
Module.builtinModules || Object.keys(process.binding(`natives`)) const isBuiltinModule = (request) => request.startsWith(`node:`) || builtinModules.has(request);
);
const isBuiltinModule = (request) =>
request.startsWith(`node:`) || builtinModules.has(request);
function readPackageScope(checkPath) { function readPackageScope(checkPath) {
const rootSeparatorIndex = checkPath.indexOf(npath.sep); const rootSeparatorIndex = checkPath.indexOf(npath.sep);
let separatorIndex; let separatorIndex;
do { do {
separatorIndex = checkPath.lastIndexOf(npath.sep); separatorIndex = checkPath.lastIndexOf(npath.sep);
checkPath = checkPath.slice(0, separatorIndex); 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); const pjson = readPackage(checkPath + npath.sep);
if (pjson) { if (pjson) {
return { return {
data: pjson, data: pjson,
path: checkPath, path: checkPath
}; };
} }
} while (separatorIndex > rootSeparatorIndex); } while (separatorIndex > rootSeparatorIndex);
@ -86,7 +87,8 @@ function readPackageScope(checkPath) {
} }
function readPackage(requestPath) { function readPackage(requestPath) {
const jsonPath = npath.resolve(requestPath, `package.json`); 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`)); return JSON.parse(fs.readFileSync(jsonPath, `utf8`));
} }
@ -94,7 +96,8 @@ async function tryReadFile(path2) {
try { try {
return await fs.promises.readFile(path2, `utf8`); return await fs.promises.readFile(path2, `utf8`);
} catch (error) { } catch (error) {
if (error.code === `ENOENT`) return null; if (error.code === `ENOENT`)
return null;
throw error; throw error;
} }
} }
@ -123,15 +126,19 @@ function getFileFormat(filepath) {
} }
case `.js`: { case `.js`: {
const pkg = readPackageScope(filepath); const pkg = readPackageScope(filepath);
if (!pkg) return `commonjs`; if (!pkg)
return `commonjs`;
return (_a = pkg.data.type) != null ? _a : `commonjs`; return (_a = pkg.data.type) != null ? _a : `commonjs`;
} }
default: { default: {
const isMain = process.argv[1] === filepath; const isMain = process.argv[1] === filepath;
if (!isMain) return null; if (!isMain)
return null;
const pkg = readPackageScope(filepath); const pkg = readPackageScope(filepath);
if (!pkg) return `commonjs`; if (!pkg)
if (pkg.data.type === `module`) return null; return `commonjs`;
if (pkg.data.type === `module`)
return null;
return (_b = pkg.data.type) != null ? _b : `commonjs`; return (_b = pkg.data.type) != null ? _b : `commonjs`;
} }
} }
@ -144,7 +151,7 @@ async function getFormat$1(resolved, context, defaultGetFormat) {
const format = getFileFormat(fileURLToPath(url)); const format = getFileFormat(fileURLToPath(url));
if (format) { if (format) {
return { return {
format, format
}; };
} }
return defaultGetFormat(resolved, context, defaultGetFormat); return defaultGetFormat(resolved, context, defaultGetFormat);
@ -155,7 +162,7 @@ async function getSource$1(urlString, context, defaultGetSource) {
if ((url == null ? void 0 : url.protocol) !== `file:`) if ((url == null ? void 0 : url.protocol) !== `file:`)
return defaultGetSource(urlString, context, defaultGetSource); return defaultGetSource(urlString, context, defaultGetSource);
return { return {
source: await fs.promises.readFile(fileURLToPath(url), `utf8`), source: await fs.promises.readFile(fileURLToPath(url), `utf8`)
}; };
} }
@ -165,35 +172,31 @@ async function load$1(urlString, context, defaultLoad) {
return defaultLoad(urlString, context, defaultLoad); return defaultLoad(urlString, context, defaultLoad);
const filePath = fileURLToPath(url); const filePath = fileURLToPath(url);
const format = getFileFormat(filePath); const format = getFileFormat(filePath);
if (!format) return defaultLoad(urlString, context, defaultLoad); if (!format)
return defaultLoad(urlString, context, defaultLoad);
return { return {
format, format,
source: await fs.promises.readFile(filePath, `utf8`), source: await fs.promises.readFile(filePath, `utf8`)
}; };
} }
const pathRegExp = const pathRegExp = /^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/;
/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/;
const isRelativeRegexp = /^\.{0,2}\//; const isRelativeRegexp = /^\.{0,2}\//;
async function resolve$1(originalSpecifier, context, defaultResolver) { async function resolve$1(originalSpecifier, context, defaultResolver) {
var _a; var _a;
const { findPnpApi } = moduleExports; const {findPnpApi} = moduleExports;
if (!findPnpApi || isBuiltinModule(originalSpecifier)) if (!findPnpApi || isBuiltinModule(originalSpecifier))
return defaultResolver(originalSpecifier, context, defaultResolver); return defaultResolver(originalSpecifier, context, defaultResolver);
let specifier = originalSpecifier; let specifier = originalSpecifier;
const url = tryParseURL( const url = tryParseURL(specifier, isRelativeRegexp.test(specifier) ? context.parentURL : void 0);
specifier,
isRelativeRegexp.test(specifier) ? context.parentURL : void 0
);
if (url) { if (url) {
if (url.protocol !== `file:`) if (url.protocol !== `file:`)
return defaultResolver(originalSpecifier, context, defaultResolver); return defaultResolver(originalSpecifier, context, defaultResolver);
specifier = fileURLToPath(url); specifier = fileURLToPath(url);
} }
const { parentURL, conditions = [] } = context; const {parentURL, conditions = []} = context;
const issuer = parentURL ? fileURLToPath(parentURL) : process.cwd(); const issuer = parentURL ? fileURLToPath(parentURL) : process.cwd();
const pnpapi = const pnpapi = (_a = findPnpApi(issuer)) != null ? _a : url ? findPnpApi(specifier) : null;
(_a = findPnpApi(issuer)) != null ? _a : url ? findPnpApi(specifier) : null;
if (!pnpapi) if (!pnpapi)
return defaultResolver(originalSpecifier, context, defaultResolver); return defaultResolver(originalSpecifier, context, defaultResolver);
const dependencyNameMatch = specifier.match(pathRegExp); const dependencyNameMatch = specifier.match(pathRegExp);
@ -201,10 +204,7 @@ async function resolve$1(originalSpecifier, context, defaultResolver) {
if (dependencyNameMatch) { if (dependencyNameMatch) {
const [, dependencyName, subPath] = dependencyNameMatch; const [, dependencyName, subPath] = dependencyNameMatch;
if (subPath === ``) { if (subPath === ``) {
const resolved = pnpapi.resolveToUnqualified( const resolved = pnpapi.resolveToUnqualified(`${dependencyName}/package.json`, issuer);
`${dependencyName}/package.json`,
issuer
);
if (resolved) { if (resolved) {
const content = await tryReadFile(resolved); const content = await tryReadFile(resolved);
if (content) { if (content) {
@ -216,7 +216,7 @@ async function resolve$1(originalSpecifier, context, defaultResolver) {
} }
const result = pnpapi.resolveRequest(specifier, issuer, { const result = pnpapi.resolveRequest(specifier, issuer, {
conditions: new Set(conditions), conditions: new Set(conditions),
extensions: allowLegacyResolve ? void 0 : [], extensions: allowLegacyResolve ? void 0 : []
}); });
if (!result) if (!result)
throw new Error(`Resolving '${specifier}' from '${issuer}' failed`); throw new Error(`Resolving '${specifier}' from '${issuer}' failed`);
@ -226,14 +226,14 @@ async function resolve$1(originalSpecifier, context, defaultResolver) {
resultURL.hash = url.hash; resultURL.hash = url.hash;
} }
return { return {
url: resultURL.href, url: resultURL.href
}; };
} }
const binding = process.binding(`fs`); const binding = process.binding(`fs`);
const originalfstat = binding.fstat; const originalfstat = binding.fstat;
const ZIP_FD = 2147483648; const ZIP_FD = 2147483648;
binding.fstat = function (...args) { binding.fstat = function(...args) {
const [fd, useBigint, req] = args; const [fd, useBigint, req] = args;
if ((fd & ZIP_FD) !== 0 && useBigint === false && req === void 0) { if ((fd & ZIP_FD) !== 0 && useBigint === false && req === void 0) {
try { try {
@ -248,17 +248,16 @@ binding.fstat = function (...args) {
stats.blksize, stats.blksize,
stats.ino, stats.ino,
stats.size, stats.size,
stats.blocks, stats.blocks
]); ]);
} catch {} } catch {
}
} }
return originalfstat.apply(this, args); return originalfstat.apply(this, args);
}; };
const [major, minor] = process.versions.node const [major, minor] = process.versions.node.split(`.`).map((value) => parseInt(value, 10));
.split(`.`) const hasConsolidatedHooks = major > 16 || major === 16 && minor >= 12;
.map((value) => parseInt(value, 10));
const hasConsolidatedHooks = major > 16 || (major === 16 && minor >= 12);
const resolve = resolve$1; const resolve = resolve$1;
const getFormat = hasConsolidatedHooks ? void 0 : getFormat$1; const getFormat = hasConsolidatedHooks ? void 0 : getFormat$1;
const getSource = hasConsolidatedHooks ? void 0 : getSource$1; const getSource = hasConsolidatedHooks ? void 0 : getSource$1;

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
.pnp.cjs
.pnp.loader.mjs
.yarnrc.yml
.yarn