@icebreakers/eslint-config 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-4JACZTJG.js +37 -0
- package/dist/index.cjs +475 -7882
- package/dist/index.es2015-XG66TMMA.js +1347 -0
- package/dist/index.js +4 -20
- package/package.json +6 -6
- package/dist/chunk-2X2MYRRL.js +0 -62
- package/dist/index.es2015-FBV34CV4.js +0 -8772
|
@@ -0,0 +1,1347 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__dirname,
|
|
3
|
+
__export,
|
|
4
|
+
__require
|
|
5
|
+
} from "./chunk-4JACZTJG.js";
|
|
6
|
+
|
|
7
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.2.0_eslint@9.22.0_jiti@2.4.2_/node_modules/eslint-mdx/lib/index.es2015.mjs
|
|
8
|
+
var index_es2015_exports = {};
|
|
9
|
+
__export(index_es2015_exports, {
|
|
10
|
+
DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
|
|
11
|
+
MARKDOWN_EXTENSIONS: () => MARKDOWN_EXTENSIONS,
|
|
12
|
+
Parser: () => Parser,
|
|
13
|
+
arrayify: () => arrayify,
|
|
14
|
+
getPhysicalFilename: () => getPhysicalFilename,
|
|
15
|
+
getPositionAtFactory: () => getPositionAtFactory,
|
|
16
|
+
last: () => last,
|
|
17
|
+
loadEsmModule: () => loadEsmModule,
|
|
18
|
+
meta: () => meta,
|
|
19
|
+
nextCharOffsetFactory: () => nextCharOffsetFactory,
|
|
20
|
+
normalizePosition: () => normalizePosition,
|
|
21
|
+
parse: () => parse,
|
|
22
|
+
parseForESLint: () => parseForESLint,
|
|
23
|
+
parser: () => parser,
|
|
24
|
+
performSyncWork: () => performSyncWork,
|
|
25
|
+
prevCharOffsetFactory: () => prevCharOffsetFactory
|
|
26
|
+
});
|
|
27
|
+
import fs3 from "node:fs";
|
|
28
|
+
import path3 from "node:path";
|
|
29
|
+
|
|
30
|
+
// ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
31
|
+
function __rest(s, e) {
|
|
32
|
+
var t = {};
|
|
33
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
34
|
+
t[p] = s[p];
|
|
35
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
36
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
37
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
38
|
+
t[p[i]] = s[p[i]];
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ../../node_modules/.pnpm/synckit@0.9.2/node_modules/synckit/lib/index.js
|
|
44
|
+
import { createHash } from "node:crypto";
|
|
45
|
+
import fs2 from "node:fs";
|
|
46
|
+
import module from "node:module";
|
|
47
|
+
import path2 from "node:path";
|
|
48
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
49
|
+
import { MessageChannel, Worker, parentPort, receiveMessageOnPort, workerData } from "node:worker_threads";
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/.pnpm/@pkgr+core@0.1.1/node_modules/@pkgr/core/lib/constants.js
|
|
52
|
+
import { createRequire } from "node:module";
|
|
53
|
+
var CWD = process.cwd();
|
|
54
|
+
var cjsRequire = typeof __require === "undefined" ? createRequire(import.meta.url) : __require;
|
|
55
|
+
var EXTENSIONS = [".ts", ".tsx", ...Object.keys(cjsRequire.extensions)];
|
|
56
|
+
|
|
57
|
+
// ../../node_modules/.pnpm/@pkgr+core@0.1.1/node_modules/@pkgr/core/lib/helpers.js
|
|
58
|
+
import fs from "node:fs";
|
|
59
|
+
import path from "node:path";
|
|
60
|
+
var tryPkg = (pkg) => {
|
|
61
|
+
try {
|
|
62
|
+
return cjsRequire.resolve(pkg);
|
|
63
|
+
} catch (_a2) {
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var isPkgAvailable = (pkg) => !!tryPkg(pkg);
|
|
67
|
+
var tryFile = (filePath, includeDir = false) => {
|
|
68
|
+
if (typeof filePath === "string") {
|
|
69
|
+
return fs.existsSync(filePath) && (includeDir || fs.statSync(filePath).isFile()) ? filePath : "";
|
|
70
|
+
}
|
|
71
|
+
for (const file of filePath !== null && filePath !== void 0 ? filePath : []) {
|
|
72
|
+
if (tryFile(file, includeDir)) {
|
|
73
|
+
return file;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return "";
|
|
77
|
+
};
|
|
78
|
+
var tryExtensions = (filepath, extensions = EXTENSIONS) => {
|
|
79
|
+
const ext = [...extensions, ""].find((ext2) => tryFile(filepath + ext2));
|
|
80
|
+
return ext == null ? "" : filepath + ext;
|
|
81
|
+
};
|
|
82
|
+
var findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => {
|
|
83
|
+
console.assert(path.isAbsolute(searchEntry));
|
|
84
|
+
if (!tryFile(searchEntry, true) || searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep)) {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
searchEntry = path.resolve(fs.statSync(searchEntry).isDirectory() ? searchEntry : path.resolve(searchEntry, ".."));
|
|
88
|
+
const isSearchFile = typeof searchFileOrIncludeDir === "string";
|
|
89
|
+
const searchFile = isSearchFile ? searchFileOrIncludeDir : "package.json";
|
|
90
|
+
do {
|
|
91
|
+
const searched = tryFile(path.resolve(searchEntry, searchFile), isSearchFile && includeDir);
|
|
92
|
+
if (searched) {
|
|
93
|
+
return searched;
|
|
94
|
+
}
|
|
95
|
+
searchEntry = path.resolve(searchEntry, "..");
|
|
96
|
+
} while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep));
|
|
97
|
+
return "";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// ../../node_modules/.pnpm/synckit@0.9.2/node_modules/synckit/lib/index.js
|
|
101
|
+
var INT32_BYTES = 4;
|
|
102
|
+
var TsRunner = {
|
|
103
|
+
TsNode: "ts-node",
|
|
104
|
+
EsbuildRegister: "esbuild-register",
|
|
105
|
+
EsbuildRunner: "esbuild-runner",
|
|
106
|
+
SWC: "swc",
|
|
107
|
+
TSX: "tsx"
|
|
108
|
+
};
|
|
109
|
+
var { NODE_OPTIONS, SYNCKIT_EXEC_ARGV, SYNCKIT_GLOBAL_SHIMS, SYNCKIT_TIMEOUT, SYNCKIT_TS_RUNNER } = process.env;
|
|
110
|
+
var IS_NODE_20 = Number(process.versions.node.split(".")[0]) >= 20;
|
|
111
|
+
var DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : void 0;
|
|
112
|
+
var DEFAULT_EXEC_ARGV = (SYNCKIT_EXEC_ARGV === null || SYNCKIT_EXEC_ARGV === void 0 ? void 0 : SYNCKIT_EXEC_ARGV.split(",")) || [];
|
|
113
|
+
var DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER;
|
|
114
|
+
var DEFAULT_GLOBAL_SHIMS = ["1", "true"].includes(SYNCKIT_GLOBAL_SHIMS);
|
|
115
|
+
var DEFAULT_GLOBAL_SHIMS_PRESET = [
|
|
116
|
+
{
|
|
117
|
+
moduleName: "node-fetch",
|
|
118
|
+
globalName: "fetch"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
moduleName: "node:perf_hooks",
|
|
122
|
+
globalName: "performance",
|
|
123
|
+
named: "performance"
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
var MTS_SUPPORTED_NODE_VERSION = 16;
|
|
127
|
+
var syncFnCache;
|
|
128
|
+
function createSyncFn(workerPath2, timeoutOrOptions) {
|
|
129
|
+
syncFnCache !== null && syncFnCache !== void 0 ? syncFnCache : syncFnCache = /* @__PURE__ */ new Map();
|
|
130
|
+
const cachedSyncFn = syncFnCache.get(workerPath2);
|
|
131
|
+
if (cachedSyncFn) {
|
|
132
|
+
return cachedSyncFn;
|
|
133
|
+
}
|
|
134
|
+
if (!path2.isAbsolute(workerPath2)) {
|
|
135
|
+
throw new Error("`workerPath` must be absolute");
|
|
136
|
+
}
|
|
137
|
+
const syncFn = startWorkerThread(workerPath2, typeof timeoutOrOptions === "number" ? { timeout: timeoutOrOptions } : timeoutOrOptions);
|
|
138
|
+
syncFnCache.set(workerPath2, syncFn);
|
|
139
|
+
return syncFn;
|
|
140
|
+
}
|
|
141
|
+
var cjsRequire2 = typeof __require === "undefined" ? module.createRequire(import.meta.url) : __require;
|
|
142
|
+
var dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`);
|
|
143
|
+
var isFile = (path5) => {
|
|
144
|
+
var _a2;
|
|
145
|
+
try {
|
|
146
|
+
return !!((_a2 = fs2.statSync(path5, { throwIfNoEntry: false })) === null || _a2 === void 0 ? void 0 : _a2.isFile());
|
|
147
|
+
} catch (_b) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var setupTsRunner = (workerPath2, { execArgv, tsRunner }) => {
|
|
152
|
+
let ext = path2.extname(workerPath2);
|
|
153
|
+
if (!/[/\\]node_modules[/\\]/.test(workerPath2) && (!ext || /^\.[cm]?js$/.test(ext))) {
|
|
154
|
+
const workPathWithoutExt = ext ? workerPath2.slice(0, -ext.length) : workerPath2;
|
|
155
|
+
let extensions;
|
|
156
|
+
switch (ext) {
|
|
157
|
+
case ".cjs": {
|
|
158
|
+
extensions = [".cts", ".cjs"];
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case ".mjs": {
|
|
162
|
+
extensions = [".mts", ".mjs"];
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
default: {
|
|
166
|
+
extensions = [".ts", ".js"];
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const found = tryExtensions(workPathWithoutExt, extensions);
|
|
171
|
+
let differentExt;
|
|
172
|
+
if (found && (!ext || (differentExt = found !== workPathWithoutExt))) {
|
|
173
|
+
workerPath2 = found;
|
|
174
|
+
if (differentExt) {
|
|
175
|
+
ext = path2.extname(workerPath2);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const isTs = /\.[cm]?ts$/.test(workerPath2);
|
|
180
|
+
let jsUseEsm = workerPath2.endsWith(".mjs");
|
|
181
|
+
let tsUseEsm = workerPath2.endsWith(".mts");
|
|
182
|
+
if (isTs) {
|
|
183
|
+
if (!tsUseEsm) {
|
|
184
|
+
const pkg = findUp(workerPath2);
|
|
185
|
+
if (pkg) {
|
|
186
|
+
tsUseEsm = cjsRequire2(pkg).type === "module";
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (tsRunner == null && isPkgAvailable(TsRunner.TsNode)) {
|
|
190
|
+
tsRunner = TsRunner.TsNode;
|
|
191
|
+
}
|
|
192
|
+
switch (tsRunner) {
|
|
193
|
+
case TsRunner.TsNode: {
|
|
194
|
+
if (tsUseEsm) {
|
|
195
|
+
if (!execArgv.includes("--loader")) {
|
|
196
|
+
execArgv = ["--loader", `${TsRunner.TsNode}/esm`, ...execArgv];
|
|
197
|
+
}
|
|
198
|
+
} else if (!execArgv.includes("-r")) {
|
|
199
|
+
execArgv = ["-r", `${TsRunner.TsNode}/register`, ...execArgv];
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case TsRunner.EsbuildRegister: {
|
|
204
|
+
if (!execArgv.includes("-r")) {
|
|
205
|
+
execArgv = ["-r", TsRunner.EsbuildRegister, ...execArgv];
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case TsRunner.EsbuildRunner: {
|
|
210
|
+
if (!execArgv.includes("-r")) {
|
|
211
|
+
execArgv = ["-r", `${TsRunner.EsbuildRunner}/register`, ...execArgv];
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
case TsRunner.SWC: {
|
|
216
|
+
if (!execArgv.includes("-r")) {
|
|
217
|
+
execArgv = ["-r", `@${TsRunner.SWC}-node/register`, ...execArgv];
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case TsRunner.TSX: {
|
|
222
|
+
if (!execArgv.includes("--loader")) {
|
|
223
|
+
execArgv = ["--loader", TsRunner.TSX, ...execArgv];
|
|
224
|
+
}
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
default: {
|
|
228
|
+
throw new Error(`Unknown ts runner: ${String(tsRunner)}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
} else if (!jsUseEsm) {
|
|
232
|
+
const pkg = findUp(workerPath2);
|
|
233
|
+
if (pkg) {
|
|
234
|
+
jsUseEsm = cjsRequire2(pkg).type === "module";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
let resolvedPnpLoaderPath;
|
|
238
|
+
if (process.versions.pnp) {
|
|
239
|
+
const nodeOptions = NODE_OPTIONS === null || NODE_OPTIONS === void 0 ? void 0 : NODE_OPTIONS.split(/\s+/);
|
|
240
|
+
let pnpApiPath;
|
|
241
|
+
try {
|
|
242
|
+
pnpApiPath = cjsRequire2.resolve("pnpapi");
|
|
243
|
+
} catch (_a2) {
|
|
244
|
+
}
|
|
245
|
+
if (pnpApiPath && !(nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.some((option, index) => ["-r", "--require"].includes(option) && pnpApiPath === cjsRequire2.resolve(nodeOptions[index + 1]))) && !execArgv.includes(pnpApiPath)) {
|
|
246
|
+
execArgv = ["-r", pnpApiPath, ...execArgv];
|
|
247
|
+
const pnpLoaderPath = path2.resolve(pnpApiPath, "../.pnp.loader.mjs");
|
|
248
|
+
if (isFile(pnpLoaderPath)) {
|
|
249
|
+
resolvedPnpLoaderPath = pathToFileURL(pnpLoaderPath).toString();
|
|
250
|
+
if (!IS_NODE_20) {
|
|
251
|
+
execArgv = [
|
|
252
|
+
"--experimental-loader",
|
|
253
|
+
resolvedPnpLoaderPath,
|
|
254
|
+
...execArgv
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
ext,
|
|
262
|
+
isTs,
|
|
263
|
+
jsUseEsm,
|
|
264
|
+
tsRunner,
|
|
265
|
+
tsUseEsm,
|
|
266
|
+
workerPath: workerPath2,
|
|
267
|
+
pnpLoaderPath: resolvedPnpLoaderPath,
|
|
268
|
+
execArgv
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
var md5Hash = (text) => createHash("md5").update(text).digest("hex");
|
|
272
|
+
var encodeImportModule = (moduleNameOrGlobalShim, type = "import") => {
|
|
273
|
+
const { moduleName, globalName, named, conditional } = typeof moduleNameOrGlobalShim === "string" ? { moduleName: moduleNameOrGlobalShim } : moduleNameOrGlobalShim;
|
|
274
|
+
const importStatement = type === "import" ? `import${globalName ? " " + (named === null ? "* as " + globalName : (named === null || named === void 0 ? void 0 : named.trim()) ? `{${named}}` : globalName) + " from" : ""} '${path2.isAbsolute(moduleName) ? String(pathToFileURL(moduleName)) : moduleName}'` : `${globalName ? "const " + ((named === null || named === void 0 ? void 0 : named.trim()) ? `{${named}}` : globalName) + "=" : ""}require('${moduleName.replace(/\\/g, "\\\\")}')`;
|
|
275
|
+
if (!globalName) {
|
|
276
|
+
return importStatement;
|
|
277
|
+
}
|
|
278
|
+
const overrideStatement = `globalThis.${globalName}=${(named === null || named === void 0 ? void 0 : named.trim()) ? named : globalName}`;
|
|
279
|
+
return importStatement + (conditional === false ? `;${overrideStatement}` : `;if(!globalThis.${globalName})${overrideStatement}`);
|
|
280
|
+
};
|
|
281
|
+
var _generateGlobals = (globalShims, type) => globalShims.reduce((acc, shim) => `${acc}${acc ? ";" : ""}${encodeImportModule(shim, type)}`, "");
|
|
282
|
+
var globalsCache;
|
|
283
|
+
var tmpdir;
|
|
284
|
+
var _dirname = typeof __dirname === "undefined" ? path2.dirname(fileURLToPath(import.meta.url)) : __dirname;
|
|
285
|
+
var sharedBuffer;
|
|
286
|
+
var sharedBufferView;
|
|
287
|
+
var generateGlobals = (workerPath2, globalShims, type = "import") => {
|
|
288
|
+
globalsCache !== null && globalsCache !== void 0 ? globalsCache : globalsCache = /* @__PURE__ */ new Map();
|
|
289
|
+
const cached = globalsCache.get(workerPath2);
|
|
290
|
+
if (cached) {
|
|
291
|
+
const [content2, filepath2] = cached;
|
|
292
|
+
if (type === "require" && !filepath2 || type === "import" && filepath2 && isFile(filepath2)) {
|
|
293
|
+
return content2;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const globals = _generateGlobals(globalShims, type);
|
|
297
|
+
let content = globals;
|
|
298
|
+
let filepath;
|
|
299
|
+
if (type === "import") {
|
|
300
|
+
if (!tmpdir) {
|
|
301
|
+
tmpdir = path2.resolve(findUp(_dirname), "../node_modules/.synckit");
|
|
302
|
+
}
|
|
303
|
+
fs2.mkdirSync(tmpdir, { recursive: true });
|
|
304
|
+
filepath = path2.resolve(tmpdir, md5Hash(workerPath2) + ".mjs");
|
|
305
|
+
content = encodeImportModule(filepath);
|
|
306
|
+
fs2.writeFileSync(filepath, globals);
|
|
307
|
+
}
|
|
308
|
+
globalsCache.set(workerPath2, [content, filepath]);
|
|
309
|
+
return content;
|
|
310
|
+
};
|
|
311
|
+
function startWorkerThread(workerPath2, { timeout = DEFAULT_TIMEOUT, execArgv = DEFAULT_EXEC_ARGV, tsRunner = DEFAULT_TS_RUNNER, transferList = [], globalShims = DEFAULT_GLOBAL_SHIMS } = {}) {
|
|
312
|
+
const { port1: mainPort, port2: workerPort } = new MessageChannel();
|
|
313
|
+
const { isTs, ext, jsUseEsm, tsUseEsm, tsRunner: finalTsRunner, workerPath: finalWorkerPath, pnpLoaderPath, execArgv: finalExecArgv } = setupTsRunner(workerPath2, { execArgv, tsRunner });
|
|
314
|
+
const workerPathUrl = pathToFileURL(finalWorkerPath);
|
|
315
|
+
if (/\.[cm]ts$/.test(finalWorkerPath)) {
|
|
316
|
+
const isTsxSupported = !tsUseEsm || Number.parseFloat(process.versions.node) >= MTS_SUPPORTED_NODE_VERSION;
|
|
317
|
+
if (!finalTsRunner) {
|
|
318
|
+
throw new Error("No ts runner specified, ts worker path is not supported");
|
|
319
|
+
} else if ([
|
|
320
|
+
TsRunner.EsbuildRegister,
|
|
321
|
+
TsRunner.EsbuildRunner,
|
|
322
|
+
TsRunner.SWC,
|
|
323
|
+
...isTsxSupported ? [] : [TsRunner.TSX]
|
|
324
|
+
].includes(finalTsRunner)) {
|
|
325
|
+
throw new Error(`${finalTsRunner} is not supported for ${ext} files yet` + (isTsxSupported ? ", you can try [tsx](https://github.com/esbuild-kit/tsx) instead" : ""));
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const finalGlobalShims = (globalShims === true ? DEFAULT_GLOBAL_SHIMS_PRESET : Array.isArray(globalShims) ? globalShims : []).filter(({ moduleName }) => isPkgAvailable(moduleName));
|
|
329
|
+
sharedBufferView !== null && sharedBufferView !== void 0 ? sharedBufferView : sharedBufferView = new Int32Array(sharedBuffer !== null && sharedBuffer !== void 0 ? sharedBuffer : sharedBuffer = new SharedArrayBuffer(INT32_BYTES), 0, 1);
|
|
330
|
+
const useGlobals = finalGlobalShims.length > 0;
|
|
331
|
+
const useEval = isTs ? !tsUseEsm : !jsUseEsm && useGlobals;
|
|
332
|
+
const worker = new Worker(jsUseEsm && useGlobals || tsUseEsm && finalTsRunner === TsRunner.TsNode ? dataUrl(`${generateGlobals(finalWorkerPath, finalGlobalShims)};import '${String(workerPathUrl)}'`) : useEval ? `${generateGlobals(finalWorkerPath, finalGlobalShims, "require")};${encodeImportModule(finalWorkerPath, "require")}` : workerPathUrl, {
|
|
333
|
+
eval: useEval,
|
|
334
|
+
workerData: { sharedBuffer, workerPort, pnpLoaderPath },
|
|
335
|
+
transferList: [workerPort, ...transferList],
|
|
336
|
+
execArgv: finalExecArgv
|
|
337
|
+
});
|
|
338
|
+
let nextID = 0;
|
|
339
|
+
const receiveMessageWithId = (port, expectedId, waitingTimeout) => {
|
|
340
|
+
const start = Date.now();
|
|
341
|
+
const status = Atomics.wait(sharedBufferView, 0, 0, waitingTimeout);
|
|
342
|
+
Atomics.store(sharedBufferView, 0, 0);
|
|
343
|
+
if (!["ok", "not-equal"].includes(status)) {
|
|
344
|
+
const abortMsg = {
|
|
345
|
+
id: expectedId,
|
|
346
|
+
cmd: "abort"
|
|
347
|
+
};
|
|
348
|
+
port.postMessage(abortMsg);
|
|
349
|
+
throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
350
|
+
}
|
|
351
|
+
const _a2 = receiveMessageOnPort(mainPort).message, { id } = _a2, message = __rest(_a2, ["id"]);
|
|
352
|
+
if (id < expectedId) {
|
|
353
|
+
const waitingTime = Date.now() - start;
|
|
354
|
+
return receiveMessageWithId(port, expectedId, waitingTimeout ? waitingTimeout - waitingTime : void 0);
|
|
355
|
+
}
|
|
356
|
+
if (expectedId !== id) {
|
|
357
|
+
throw new Error(`Internal error: Expected id ${expectedId} but got id ${id}`);
|
|
358
|
+
}
|
|
359
|
+
return Object.assign({ id }, message);
|
|
360
|
+
};
|
|
361
|
+
const syncFn = (...args) => {
|
|
362
|
+
const id = nextID++;
|
|
363
|
+
const msg = { id, args };
|
|
364
|
+
worker.postMessage(msg);
|
|
365
|
+
const { result, error, properties } = receiveMessageWithId(mainPort, id, timeout);
|
|
366
|
+
if (error) {
|
|
367
|
+
throw Object.assign(error, properties);
|
|
368
|
+
}
|
|
369
|
+
return result;
|
|
370
|
+
};
|
|
371
|
+
worker.unref();
|
|
372
|
+
return syncFn;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.2.0_eslint@9.22.0_jiti@2.4.2_/node_modules/eslint-mdx/lib/index.es2015.mjs
|
|
376
|
+
var last = (items) => (
|
|
377
|
+
// eslint-disable-next-line unicorn/prefer-at -- FIXME: Node 16.6+ required
|
|
378
|
+
items && items[items.length - 1]
|
|
379
|
+
);
|
|
380
|
+
var arrayify = (...args) => args.reduce((arr, curr) => {
|
|
381
|
+
arr.push(...Array.isArray(curr) ? curr : curr == null ? [] : [curr]);
|
|
382
|
+
return arr;
|
|
383
|
+
}, []);
|
|
384
|
+
var getPhysicalFilename = (filename, child) => {
|
|
385
|
+
try {
|
|
386
|
+
if (fs3.statSync(filename).isDirectory()) {
|
|
387
|
+
return child || filename;
|
|
388
|
+
}
|
|
389
|
+
} catch (err) {
|
|
390
|
+
const { code } = err;
|
|
391
|
+
if (code === "ENOTDIR" || code === "ENOENT") {
|
|
392
|
+
return getPhysicalFilename(path3.dirname(filename), filename);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return filename;
|
|
396
|
+
};
|
|
397
|
+
var loadEsmModule = (modulePath) => (
|
|
398
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
|
|
399
|
+
new Function("modulePath", `return import(modulePath);`)(
|
|
400
|
+
modulePath
|
|
401
|
+
)
|
|
402
|
+
);
|
|
403
|
+
var getPositionAtFactory = (text) => {
|
|
404
|
+
const lines = text.split("\n");
|
|
405
|
+
return (offset) => {
|
|
406
|
+
let currOffset = 0;
|
|
407
|
+
for (const [index, line_] of lines.entries()) {
|
|
408
|
+
const line = index + 1;
|
|
409
|
+
const nextOffset = currOffset + line_.length;
|
|
410
|
+
if (nextOffset >= offset) {
|
|
411
|
+
return {
|
|
412
|
+
line,
|
|
413
|
+
column: offset - currOffset
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
currOffset = nextOffset + 1;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
var normalizePosition = ({
|
|
421
|
+
start,
|
|
422
|
+
end,
|
|
423
|
+
text
|
|
424
|
+
}) => {
|
|
425
|
+
const startOffset = start.offset;
|
|
426
|
+
const endOffset = end.offset;
|
|
427
|
+
const range = [startOffset, endOffset];
|
|
428
|
+
const getPositionAt = text == null ? null : (
|
|
429
|
+
/* istanbul ignore next -- used in worker */
|
|
430
|
+
getPositionAtFactory(text)
|
|
431
|
+
);
|
|
432
|
+
return {
|
|
433
|
+
start: startOffset,
|
|
434
|
+
end: endOffset,
|
|
435
|
+
loc: {
|
|
436
|
+
start: (
|
|
437
|
+
/* istanbul ignore next -- used in worker */
|
|
438
|
+
"line" in start ? start : getPositionAt(startOffset)
|
|
439
|
+
),
|
|
440
|
+
end: (
|
|
441
|
+
/* istanbul ignore next -- used in worker */
|
|
442
|
+
"line" in end ? end : getPositionAt(endOffset)
|
|
443
|
+
)
|
|
444
|
+
},
|
|
445
|
+
range
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
var prevCharOffsetFactory = (text) => (offset) => {
|
|
449
|
+
for (let i = offset; i >= 0; i--) {
|
|
450
|
+
const char = text[i];
|
|
451
|
+
if (/^\S$/.test(char)) {
|
|
452
|
+
return i;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
var nextCharOffsetFactory = (text) => {
|
|
457
|
+
const total = text.length;
|
|
458
|
+
return (offset) => {
|
|
459
|
+
for (let i = offset; i <= total; i++) {
|
|
460
|
+
const char = text[i];
|
|
461
|
+
if (/^\S$/.test(char)) {
|
|
462
|
+
return i;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
var name = "eslint-mdx";
|
|
468
|
+
var version = "3.2.0";
|
|
469
|
+
var meta = { name, version };
|
|
470
|
+
var workerPath = __require.resolve("./worker");
|
|
471
|
+
var performSyncWork = createSyncFn(workerPath);
|
|
472
|
+
var __defProp = Object.defineProperty;
|
|
473
|
+
var __defProps = Object.defineProperties;
|
|
474
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
475
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
476
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
477
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
478
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
479
|
+
var __spreadValues = (a, b) => {
|
|
480
|
+
for (var prop in b || (b = {}))
|
|
481
|
+
if (__hasOwnProp.call(b, prop))
|
|
482
|
+
__defNormalProp(a, prop, b[prop]);
|
|
483
|
+
if (__getOwnPropSymbols)
|
|
484
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
485
|
+
if (__propIsEnum.call(b, prop))
|
|
486
|
+
__defNormalProp(a, prop, b[prop]);
|
|
487
|
+
}
|
|
488
|
+
return a;
|
|
489
|
+
};
|
|
490
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
491
|
+
var DEFAULT_EXTENSIONS = [".mdx"];
|
|
492
|
+
var MARKDOWN_EXTENSIONS = [".md"];
|
|
493
|
+
var Parser = class {
|
|
494
|
+
constructor() {
|
|
495
|
+
this.parse = this.parse.bind(this);
|
|
496
|
+
this.parseForESLint = this.parseForESLint.bind(this);
|
|
497
|
+
}
|
|
498
|
+
parse(code, options) {
|
|
499
|
+
return this.parseForESLint(code, options).ast;
|
|
500
|
+
}
|
|
501
|
+
parseForESLint(code, {
|
|
502
|
+
filePath,
|
|
503
|
+
sourceType,
|
|
504
|
+
ignoreRemarkConfig,
|
|
505
|
+
extensions,
|
|
506
|
+
markdownExtensions
|
|
507
|
+
}) {
|
|
508
|
+
const extname = path3.extname(filePath);
|
|
509
|
+
const isMdx = [...DEFAULT_EXTENSIONS, ...arrayify(extensions)].includes(
|
|
510
|
+
extname
|
|
511
|
+
);
|
|
512
|
+
const isMarkdown = [
|
|
513
|
+
...MARKDOWN_EXTENSIONS,
|
|
514
|
+
...arrayify(markdownExtensions)
|
|
515
|
+
].includes(extname);
|
|
516
|
+
if (!isMdx && !isMarkdown) {
|
|
517
|
+
throw new Error(
|
|
518
|
+
"Unsupported file extension, make sure setting the `extensions` or `markdownExtensions` option correctly."
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
const physicalFilename = getPhysicalFilename(filePath);
|
|
522
|
+
let result;
|
|
523
|
+
try {
|
|
524
|
+
result = performSyncWork({
|
|
525
|
+
fileOptions: {
|
|
526
|
+
path: physicalFilename,
|
|
527
|
+
value: code
|
|
528
|
+
},
|
|
529
|
+
physicalFilename,
|
|
530
|
+
isMdx,
|
|
531
|
+
ignoreRemarkConfig
|
|
532
|
+
});
|
|
533
|
+
} catch (err) {
|
|
534
|
+
if (process.argv.includes("--debug")) {
|
|
535
|
+
console.error(err);
|
|
536
|
+
}
|
|
537
|
+
const { message, line, column, place } = err;
|
|
538
|
+
const point = place && ("start" in place ? place.start : place);
|
|
539
|
+
throw Object.assign(
|
|
540
|
+
new SyntaxError(message, {
|
|
541
|
+
cause: err
|
|
542
|
+
}),
|
|
543
|
+
{
|
|
544
|
+
lineNumber: line,
|
|
545
|
+
column,
|
|
546
|
+
index: (
|
|
547
|
+
/* istanbul ignore next */
|
|
548
|
+
point == null ? void 0 : point.offset
|
|
549
|
+
)
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
const { root, body, comments, tokens } = result;
|
|
554
|
+
return {
|
|
555
|
+
ast: __spreadProps(__spreadValues({}, normalizePosition(root.position)), {
|
|
556
|
+
type: "Program",
|
|
557
|
+
sourceType,
|
|
558
|
+
body,
|
|
559
|
+
comments,
|
|
560
|
+
tokens
|
|
561
|
+
})
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
var parser = new Parser();
|
|
566
|
+
var { parse, parseForESLint } = parser;
|
|
567
|
+
|
|
568
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.2.0_eslint@9.22.0_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/index.es2015.mjs
|
|
569
|
+
import path4 from "node:path";
|
|
570
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
571
|
+
var mdx = /* @__PURE__ */ Object.freeze({
|
|
572
|
+
__proto__: null,
|
|
573
|
+
get DEFAULT_LANGUAGE_MAPPER() {
|
|
574
|
+
return DEFAULT_LANGUAGE_MAPPER;
|
|
575
|
+
},
|
|
576
|
+
get base() {
|
|
577
|
+
return base;
|
|
578
|
+
},
|
|
579
|
+
get codeBlocks() {
|
|
580
|
+
return codeBlocks;
|
|
581
|
+
},
|
|
582
|
+
get configs() {
|
|
583
|
+
return configs;
|
|
584
|
+
},
|
|
585
|
+
get createRemarkProcessor() {
|
|
586
|
+
return createRemarkProcessor;
|
|
587
|
+
},
|
|
588
|
+
get flat() {
|
|
589
|
+
return flat;
|
|
590
|
+
},
|
|
591
|
+
get flatCodeBlocks() {
|
|
592
|
+
return flatCodeBlocks;
|
|
593
|
+
},
|
|
594
|
+
get getGlobals() {
|
|
595
|
+
return getGlobals;
|
|
596
|
+
},
|
|
597
|
+
get getShortLang() {
|
|
598
|
+
return getShortLang;
|
|
599
|
+
},
|
|
600
|
+
get meta() {
|
|
601
|
+
return meta2;
|
|
602
|
+
},
|
|
603
|
+
get overrides() {
|
|
604
|
+
return overrides$1;
|
|
605
|
+
},
|
|
606
|
+
get processorOptions() {
|
|
607
|
+
return processorOptions;
|
|
608
|
+
},
|
|
609
|
+
get processors() {
|
|
610
|
+
return processors;
|
|
611
|
+
},
|
|
612
|
+
get recommended() {
|
|
613
|
+
return recommended;
|
|
614
|
+
},
|
|
615
|
+
get remark() {
|
|
616
|
+
return remark;
|
|
617
|
+
},
|
|
618
|
+
get rules() {
|
|
619
|
+
return rules;
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
var base = {
|
|
623
|
+
parser: "eslint-mdx",
|
|
624
|
+
parserOptions: {
|
|
625
|
+
sourceType: "module",
|
|
626
|
+
ecmaVersion: "latest"
|
|
627
|
+
},
|
|
628
|
+
plugins: ["mdx"],
|
|
629
|
+
processor: "mdx/remark",
|
|
630
|
+
rules: {
|
|
631
|
+
"mdx/remark": "warn",
|
|
632
|
+
"no-unused-expressions": "error"
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
var codeBlocks = {
|
|
636
|
+
parserOptions: {
|
|
637
|
+
ecmaFeatures: {
|
|
638
|
+
// Adding a "use strict" directive at the top of
|
|
639
|
+
// every code block is tedious and distracting, so
|
|
640
|
+
// opt into strict mode parsing without the
|
|
641
|
+
// directive.
|
|
642
|
+
impliedStrict: true
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
rules: {
|
|
646
|
+
// The Markdown parser automatically trims trailing
|
|
647
|
+
// newlines from code blocks.
|
|
648
|
+
"eol-last": "off",
|
|
649
|
+
// In code snippets and examples, these rules are often
|
|
650
|
+
// counterproductive to clarity and brevity.
|
|
651
|
+
"no-undef": "off",
|
|
652
|
+
"no-unused-expressions": "off",
|
|
653
|
+
"no-unused-vars": "off",
|
|
654
|
+
"padded-blocks": "off",
|
|
655
|
+
// Adding a "use strict" directive at the top of every
|
|
656
|
+
// code block is tedious and distracting. The config
|
|
657
|
+
// opts into strict mode parsing without the directive.
|
|
658
|
+
strict: "off",
|
|
659
|
+
// The processor will not receive a Unicode Byte Order
|
|
660
|
+
// Mark from the Markdown parser.
|
|
661
|
+
"unicode-bom": "off"
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
var __defProp$6 = Object.defineProperty;
|
|
665
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
666
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
667
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
668
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
669
|
+
var __spreadValues$6 = (a, b) => {
|
|
670
|
+
for (var prop in b || (b = {}))
|
|
671
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
672
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
673
|
+
if (__getOwnPropSymbols$6)
|
|
674
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
675
|
+
if (__propIsEnum$6.call(b, prop))
|
|
676
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
677
|
+
}
|
|
678
|
+
return a;
|
|
679
|
+
};
|
|
680
|
+
var __objRest = (source, exclude) => {
|
|
681
|
+
var target = {};
|
|
682
|
+
for (var prop in source)
|
|
683
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
684
|
+
target[prop] = source[prop];
|
|
685
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
686
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
687
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
688
|
+
target[prop] = source[prop];
|
|
689
|
+
}
|
|
690
|
+
return target;
|
|
691
|
+
};
|
|
692
|
+
var flat = {
|
|
693
|
+
files: ["**/*.{md,mdx}"],
|
|
694
|
+
languageOptions: {
|
|
695
|
+
sourceType: "module",
|
|
696
|
+
ecmaVersion: "latest",
|
|
697
|
+
parser: index_es2015_exports,
|
|
698
|
+
globals: {
|
|
699
|
+
React: false
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
plugins: {
|
|
703
|
+
mdx
|
|
704
|
+
},
|
|
705
|
+
rules: {
|
|
706
|
+
"mdx/remark": "warn",
|
|
707
|
+
"no-unused-expressions": "error",
|
|
708
|
+
"react/react-in-jsx-scope": 0
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
var _a = codeBlocks;
|
|
712
|
+
var { parserOptions } = _a;
|
|
713
|
+
var restConfig = __objRest(_a, ["parserOptions"]);
|
|
714
|
+
var flatCodeBlocks = __spreadValues$6({
|
|
715
|
+
files: ["**/*.{md,mdx}/*"],
|
|
716
|
+
languageOptions: {
|
|
717
|
+
parserOptions
|
|
718
|
+
}
|
|
719
|
+
}, restConfig);
|
|
720
|
+
var __defProp$5 = Object.defineProperty;
|
|
721
|
+
var __defProps$3 = Object.defineProperties;
|
|
722
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
723
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
724
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
725
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
726
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
727
|
+
var __spreadValues$5 = (a, b) => {
|
|
728
|
+
for (var prop in b || (b = {}))
|
|
729
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
730
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
731
|
+
if (__getOwnPropSymbols$5)
|
|
732
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
733
|
+
if (__propIsEnum$5.call(b, prop))
|
|
734
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
735
|
+
}
|
|
736
|
+
return a;
|
|
737
|
+
};
|
|
738
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
739
|
+
var isReactPluginAvailable = false;
|
|
740
|
+
try {
|
|
741
|
+
__require.resolve("eslint-plugin-react");
|
|
742
|
+
isReactPluginAvailable = true;
|
|
743
|
+
} catch (e) {
|
|
744
|
+
}
|
|
745
|
+
var overrides$1 = __spreadProps$3(__spreadValues$5({}, base), {
|
|
746
|
+
globals: {
|
|
747
|
+
React: false
|
|
748
|
+
},
|
|
749
|
+
plugins: arrayify(
|
|
750
|
+
base.plugins,
|
|
751
|
+
/* istanbul ignore next */
|
|
752
|
+
isReactPluginAvailable ? "react" : null
|
|
753
|
+
),
|
|
754
|
+
rules: {
|
|
755
|
+
"react/jsx-no-undef": (
|
|
756
|
+
/* istanbul ignore next */
|
|
757
|
+
isReactPluginAvailable ? [
|
|
758
|
+
2,
|
|
759
|
+
{
|
|
760
|
+
allowGlobals: true
|
|
761
|
+
}
|
|
762
|
+
] : 0
|
|
763
|
+
),
|
|
764
|
+
"react/react-in-jsx-scope": 0
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
var __defProp$4 = Object.defineProperty;
|
|
768
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
769
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
770
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
771
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
772
|
+
var __spreadValues$4 = (a, b) => {
|
|
773
|
+
for (var prop in b || (b = {}))
|
|
774
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
775
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
776
|
+
if (__getOwnPropSymbols$4)
|
|
777
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
778
|
+
if (__propIsEnum$4.call(b, prop))
|
|
779
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
780
|
+
}
|
|
781
|
+
return a;
|
|
782
|
+
};
|
|
783
|
+
var overrides = [
|
|
784
|
+
__spreadValues$4({
|
|
785
|
+
files: ["*.md", "*.mdx"],
|
|
786
|
+
extends: "plugin:mdx/overrides"
|
|
787
|
+
}, base),
|
|
788
|
+
{
|
|
789
|
+
files: "**/*.{md,mdx}/**",
|
|
790
|
+
extends: "plugin:mdx/code-blocks"
|
|
791
|
+
}
|
|
792
|
+
];
|
|
793
|
+
var recommended = {
|
|
794
|
+
overrides
|
|
795
|
+
};
|
|
796
|
+
var getImportMetaUrl = () => {
|
|
797
|
+
try {
|
|
798
|
+
return new Function("return import.meta.url")();
|
|
799
|
+
} catch (e) {
|
|
800
|
+
return path4.resolve(process.cwd(), "__test__.js");
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
var cjsRequire3 = typeof __require === "undefined" ? createRequire2(getImportMetaUrl()) : __require;
|
|
804
|
+
var addPrettierRules = () => {
|
|
805
|
+
try {
|
|
806
|
+
cjsRequire3.resolve("prettier");
|
|
807
|
+
const { meta: meta3 } = cjsRequire3("eslint-plugin-prettier");
|
|
808
|
+
const version3 = (meta3 == null ? void 0 : meta3.version) || "";
|
|
809
|
+
const [major, minor, patch] = version3.split(".");
|
|
810
|
+
if (
|
|
811
|
+
/* istanbul ignore next */
|
|
812
|
+
+major > 5 || +major === 5 && (+minor > 1 || +minor === 1 && Number.parseInt(patch) >= 2)
|
|
813
|
+
) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
overrides.push(
|
|
817
|
+
{
|
|
818
|
+
files: "*.md",
|
|
819
|
+
rules: {
|
|
820
|
+
"prettier/prettier": [
|
|
821
|
+
"error",
|
|
822
|
+
{
|
|
823
|
+
parser: "markdown"
|
|
824
|
+
}
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
files: "*.mdx",
|
|
830
|
+
rules: {
|
|
831
|
+
"prettier/prettier": [
|
|
832
|
+
"error",
|
|
833
|
+
{
|
|
834
|
+
parser: "mdx"
|
|
835
|
+
}
|
|
836
|
+
]
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
);
|
|
840
|
+
} catch (e) {
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
addPrettierRules();
|
|
844
|
+
var configs = {
|
|
845
|
+
base,
|
|
846
|
+
"code-blocks": codeBlocks,
|
|
847
|
+
codeBlocks,
|
|
848
|
+
flat,
|
|
849
|
+
flatCodeBlocks,
|
|
850
|
+
overrides: overrides$1,
|
|
851
|
+
recommended
|
|
852
|
+
};
|
|
853
|
+
var getGlobals = (sources, initialGlobals = {}) => (Array.isArray(sources) ? (
|
|
854
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
855
|
+
sources
|
|
856
|
+
) : Object.keys(sources)).reduce(
|
|
857
|
+
(globals, source) => Object.assign(globals, {
|
|
858
|
+
[source]: false
|
|
859
|
+
}),
|
|
860
|
+
// eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter
|
|
861
|
+
initialGlobals
|
|
862
|
+
);
|
|
863
|
+
var name2 = "eslint-plugin-mdx";
|
|
864
|
+
var version2 = "3.2.0";
|
|
865
|
+
var meta2 = { name: name2, version: version2 };
|
|
866
|
+
var __defProp$3 = Object.defineProperty;
|
|
867
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
868
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
869
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
870
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
871
|
+
var __spreadValues$3 = (a, b) => {
|
|
872
|
+
for (var prop in b || (b = {}))
|
|
873
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
874
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
875
|
+
if (__getOwnPropSymbols$3)
|
|
876
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
877
|
+
if (__propIsEnum$3.call(b, prop))
|
|
878
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
879
|
+
}
|
|
880
|
+
return a;
|
|
881
|
+
};
|
|
882
|
+
var DEFAULT_LANGUAGE_MAPPER = {
|
|
883
|
+
javascript: "js",
|
|
884
|
+
javascriptreact: "jsx",
|
|
885
|
+
typescript: "ts",
|
|
886
|
+
typescriptreact: "tsx",
|
|
887
|
+
markdown: "md",
|
|
888
|
+
mdown: "md",
|
|
889
|
+
mkdn: "md"
|
|
890
|
+
};
|
|
891
|
+
function getShortLang(filename, languageMapper) {
|
|
892
|
+
const language = last(filename.split("."));
|
|
893
|
+
if (languageMapper === false) {
|
|
894
|
+
return language;
|
|
895
|
+
}
|
|
896
|
+
languageMapper = __spreadValues$3(__spreadValues$3({}, DEFAULT_LANGUAGE_MAPPER), languageMapper);
|
|
897
|
+
const lang = language.toLowerCase();
|
|
898
|
+
return languageMapper[language] || languageMapper[lang] || lang;
|
|
899
|
+
}
|
|
900
|
+
var fromMarkdown = createSyncFn(
|
|
901
|
+
__require.resolve("./worker")
|
|
902
|
+
);
|
|
903
|
+
var __defProp$2 = Object.defineProperty;
|
|
904
|
+
var __defProps$2 = Object.defineProperties;
|
|
905
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
906
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
907
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
908
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
909
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
910
|
+
var __spreadValues$2 = (a, b) => {
|
|
911
|
+
for (var prop in b || (b = {}))
|
|
912
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
913
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
914
|
+
if (__getOwnPropSymbols$2)
|
|
915
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
916
|
+
if (__propIsEnum$2.call(b, prop))
|
|
917
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
918
|
+
}
|
|
919
|
+
return a;
|
|
920
|
+
};
|
|
921
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
922
|
+
var UNSATISFIABLE_RULES = /* @__PURE__ */ new Set([
|
|
923
|
+
"eol-last",
|
|
924
|
+
// The Markdown parser strips trailing newlines in code fences
|
|
925
|
+
"unicode-bom"
|
|
926
|
+
// Code blocks will begin in the middle of Markdown files
|
|
927
|
+
]);
|
|
928
|
+
var SUPPORTS_AUTOFIX = true;
|
|
929
|
+
var BOM = "\uFEFF";
|
|
930
|
+
var blocksCache = /* @__PURE__ */ new Map();
|
|
931
|
+
function traverse(node, callbacks) {
|
|
932
|
+
if (callbacks[node.type]) {
|
|
933
|
+
callbacks[node.type](node);
|
|
934
|
+
} else {
|
|
935
|
+
callbacks["*"]();
|
|
936
|
+
}
|
|
937
|
+
const parent = node;
|
|
938
|
+
if ("children" in parent) {
|
|
939
|
+
for (const child of parent.children) {
|
|
940
|
+
traverse(child, callbacks);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
function getComment(html) {
|
|
945
|
+
const commentStart = "<!--";
|
|
946
|
+
const commentEnd = "-->";
|
|
947
|
+
const regex = /^(?:eslint\b|global\s)/u;
|
|
948
|
+
if (!html.startsWith(commentStart) || !html.endsWith(commentEnd)) {
|
|
949
|
+
return "";
|
|
950
|
+
}
|
|
951
|
+
const comment = html.slice(commentStart.length, -commentEnd.length);
|
|
952
|
+
if (!regex.test(comment.trim())) {
|
|
953
|
+
return "";
|
|
954
|
+
}
|
|
955
|
+
return comment;
|
|
956
|
+
}
|
|
957
|
+
var leadingWhitespaceRegex = /^[>\s]*/u;
|
|
958
|
+
function getBeginningOfLineOffset(node) {
|
|
959
|
+
return node.position.start.offset - node.position.start.column + 1;
|
|
960
|
+
}
|
|
961
|
+
function getIndentText(text, node) {
|
|
962
|
+
return leadingWhitespaceRegex.exec(
|
|
963
|
+
text.slice(getBeginningOfLineOffset(node))
|
|
964
|
+
)[0];
|
|
965
|
+
}
|
|
966
|
+
function getBlockRangeMap(text, node, comments) {
|
|
967
|
+
const startOffset = getBeginningOfLineOffset(node);
|
|
968
|
+
const code = text.slice(startOffset, node.position.end.offset);
|
|
969
|
+
const lines = code.split("\n");
|
|
970
|
+
const baseIndent = getIndentText(text, node).length;
|
|
971
|
+
const commentLength = comments.reduce(
|
|
972
|
+
(len, comment) => len + comment.length + 1,
|
|
973
|
+
0
|
|
974
|
+
);
|
|
975
|
+
const rangeMap = [
|
|
976
|
+
{
|
|
977
|
+
indent: baseIndent,
|
|
978
|
+
js: 0,
|
|
979
|
+
md: 0
|
|
980
|
+
}
|
|
981
|
+
];
|
|
982
|
+
let jsOffset = commentLength;
|
|
983
|
+
let mdOffset = startOffset + lines[0].length + 1;
|
|
984
|
+
for (let i = 0; i + 1 < lines.length; i++) {
|
|
985
|
+
const line = lines[i + 1];
|
|
986
|
+
const leadingWhitespaceLength = leadingWhitespaceRegex.exec(line)[0].length;
|
|
987
|
+
const trimLength = Math.min(baseIndent, leadingWhitespaceLength);
|
|
988
|
+
rangeMap.push({
|
|
989
|
+
indent: trimLength,
|
|
990
|
+
js: jsOffset,
|
|
991
|
+
// Advance `trimLength` character from the beginning of the Markdown
|
|
992
|
+
// line to the beginning of the equivalent JS line, then compute the
|
|
993
|
+
// delta.
|
|
994
|
+
md: mdOffset + trimLength - jsOffset
|
|
995
|
+
});
|
|
996
|
+
mdOffset += line.length + 1;
|
|
997
|
+
jsOffset += line.length - trimLength + 1;
|
|
998
|
+
}
|
|
999
|
+
return rangeMap;
|
|
1000
|
+
}
|
|
1001
|
+
var codeBlockFileNameRegex = /filename=(["']).*?\1/u;
|
|
1002
|
+
function fileNameFromMeta(block) {
|
|
1003
|
+
var _a2, _b;
|
|
1004
|
+
return (_b = (_a2 = block.meta) == null ? void 0 : _a2.match(codeBlockFileNameRegex)) == null ? void 0 : _b.groups.filename.replaceAll(/\s+/gu, "_");
|
|
1005
|
+
}
|
|
1006
|
+
var languageToFileExtension = {
|
|
1007
|
+
javascript: "js",
|
|
1008
|
+
ecmascript: "js",
|
|
1009
|
+
typescript: "ts",
|
|
1010
|
+
markdown: "md"
|
|
1011
|
+
};
|
|
1012
|
+
function preprocess(sourceText, filename) {
|
|
1013
|
+
const text = sourceText.startsWith(BOM) ? sourceText.slice(1) : sourceText;
|
|
1014
|
+
const ast = fromMarkdown(text);
|
|
1015
|
+
const blocks = [];
|
|
1016
|
+
blocksCache.set(filename, blocks);
|
|
1017
|
+
let htmlComments = [];
|
|
1018
|
+
traverse(ast, {
|
|
1019
|
+
"*"() {
|
|
1020
|
+
htmlComments = [];
|
|
1021
|
+
},
|
|
1022
|
+
/**
|
|
1023
|
+
* Visit a code node.
|
|
1024
|
+
* @param {CodeNode} node The visited node.
|
|
1025
|
+
* @returns {void}
|
|
1026
|
+
*/
|
|
1027
|
+
code(node) {
|
|
1028
|
+
if (node.lang) {
|
|
1029
|
+
const comments = [];
|
|
1030
|
+
for (const comment of htmlComments) {
|
|
1031
|
+
if (comment.trim() === "eslint-skip") {
|
|
1032
|
+
htmlComments = [];
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
comments.push(`/*${comment}*/`);
|
|
1036
|
+
}
|
|
1037
|
+
htmlComments = [];
|
|
1038
|
+
blocks.push(__spreadProps$2(__spreadValues$2({}, node), {
|
|
1039
|
+
baseIndentText: getIndentText(text, node),
|
|
1040
|
+
comments,
|
|
1041
|
+
rangeMap: getBlockRangeMap(text, node, comments)
|
|
1042
|
+
}));
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
/**
|
|
1046
|
+
* Visit an HTML node.
|
|
1047
|
+
* @param {HtmlNode} node The visited node.
|
|
1048
|
+
* @returns {void}
|
|
1049
|
+
*/
|
|
1050
|
+
html(node) {
|
|
1051
|
+
const comment = getComment(node.value);
|
|
1052
|
+
if (comment) {
|
|
1053
|
+
htmlComments.push(comment);
|
|
1054
|
+
} else {
|
|
1055
|
+
htmlComments = [];
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
return blocks.map((block, index) => {
|
|
1060
|
+
var _a2;
|
|
1061
|
+
const [language] = block.lang.trim().split(" ");
|
|
1062
|
+
const fileExtension = Object.hasOwn(languageToFileExtension, language) ? languageToFileExtension[language] : language;
|
|
1063
|
+
return {
|
|
1064
|
+
filename: (_a2 = fileNameFromMeta(block)) != null ? _a2 : `${index}.${fileExtension}`,
|
|
1065
|
+
text: [...block.comments, block.value, ""].join("\n")
|
|
1066
|
+
};
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
function adjustFix(block, fix) {
|
|
1070
|
+
return {
|
|
1071
|
+
range: fix.range.map((range) => {
|
|
1072
|
+
let i = 1;
|
|
1073
|
+
while (i < block.rangeMap.length && block.rangeMap[i].js <= range) {
|
|
1074
|
+
i++;
|
|
1075
|
+
}
|
|
1076
|
+
return range + block.rangeMap[i - 1].md;
|
|
1077
|
+
}),
|
|
1078
|
+
text: fix.text.replaceAll("\n", `
|
|
1079
|
+
${block.baseIndentText}`)
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
function adjustBlock(block) {
|
|
1083
|
+
const leadingCommentLines = block.comments.reduce(
|
|
1084
|
+
(count, comment) => count + comment.split("\n").length,
|
|
1085
|
+
0
|
|
1086
|
+
);
|
|
1087
|
+
const blockStart = block.position.start.line;
|
|
1088
|
+
return function adjustMessage(message) {
|
|
1089
|
+
if (!Number.isInteger(message.line)) {
|
|
1090
|
+
return __spreadProps$2(__spreadValues$2({}, message), {
|
|
1091
|
+
line: blockStart,
|
|
1092
|
+
column: block.position.start.column
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
const lineInCode = message.line - leadingCommentLines;
|
|
1096
|
+
if (lineInCode < 1 || lineInCode >= block.rangeMap.length) {
|
|
1097
|
+
return null;
|
|
1098
|
+
}
|
|
1099
|
+
const out = {
|
|
1100
|
+
line: lineInCode + blockStart,
|
|
1101
|
+
column: message.column + block.rangeMap[lineInCode].indent
|
|
1102
|
+
};
|
|
1103
|
+
if (Number.isInteger(message.endLine)) {
|
|
1104
|
+
out.endLine = message.endLine - leadingCommentLines + blockStart;
|
|
1105
|
+
}
|
|
1106
|
+
if (Array.isArray(message.suggestions)) {
|
|
1107
|
+
out.suggestions = message.suggestions.map((suggestion) => __spreadProps$2(__spreadValues$2({}, suggestion), {
|
|
1108
|
+
fix: adjustFix(block, suggestion.fix)
|
|
1109
|
+
}));
|
|
1110
|
+
}
|
|
1111
|
+
const adjustedFix = {};
|
|
1112
|
+
if (message.fix) {
|
|
1113
|
+
adjustedFix.fix = adjustFix(block, message.fix);
|
|
1114
|
+
}
|
|
1115
|
+
return __spreadValues$2(__spreadValues$2(__spreadValues$2({}, message), out), adjustedFix);
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
function excludeUnsatisfiableRules(message) {
|
|
1119
|
+
return message && !UNSATISFIABLE_RULES.has(message.ruleId);
|
|
1120
|
+
}
|
|
1121
|
+
function postprocess(messages, filename) {
|
|
1122
|
+
const blocks = blocksCache.get(filename);
|
|
1123
|
+
blocksCache.delete(filename);
|
|
1124
|
+
return messages.flatMap((group, i) => {
|
|
1125
|
+
const adjust = adjustBlock(blocks[i]);
|
|
1126
|
+
return group.map(adjust).filter(excludeUnsatisfiableRules);
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
var markdownProcessor = {
|
|
1130
|
+
meta: {
|
|
1131
|
+
name: "@eslint/markdown/markdown",
|
|
1132
|
+
version: "6.3.0"
|
|
1133
|
+
},
|
|
1134
|
+
preprocess,
|
|
1135
|
+
postprocess,
|
|
1136
|
+
supportsAutofix: SUPPORTS_AUTOFIX
|
|
1137
|
+
};
|
|
1138
|
+
var processorOptions = {};
|
|
1139
|
+
var linterPath = Object.keys(__require.cache).find(
|
|
1140
|
+
(path5) => /([/\\])eslint\1lib(?:\1linter){2}\.js$/.test(path5)
|
|
1141
|
+
);
|
|
1142
|
+
if (!linterPath) {
|
|
1143
|
+
throw new Error("Could not find ESLint Linter in require cache");
|
|
1144
|
+
}
|
|
1145
|
+
var ESLinter = __require(linterPath).Linter;
|
|
1146
|
+
var { verify } = ESLinter.prototype;
|
|
1147
|
+
ESLinter.prototype.verify = function(code, config, options) {
|
|
1148
|
+
const settings = config && (typeof config.extractConfig === "function" ? config.extractConfig(
|
|
1149
|
+
/* istanbul ignore next */
|
|
1150
|
+
// eslint-disable-next-line unicorn/no-typeof-undefined
|
|
1151
|
+
typeof options === "undefined" || typeof options === "string" ? options : options.filename
|
|
1152
|
+
) : config).settings || {};
|
|
1153
|
+
processorOptions.lintCodeBlocks = settings["mdx/code-blocks"] === true;
|
|
1154
|
+
processorOptions.languageMapper = settings["mdx/language-mapper"];
|
|
1155
|
+
return verify.call(this, code, config, options);
|
|
1156
|
+
};
|
|
1157
|
+
var __defProp$1 = Object.defineProperty;
|
|
1158
|
+
var __defProps$1 = Object.defineProperties;
|
|
1159
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1160
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1161
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1162
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1163
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1164
|
+
var __spreadValues$1 = (a, b) => {
|
|
1165
|
+
for (var prop in b || (b = {}))
|
|
1166
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
1167
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
1168
|
+
if (__getOwnPropSymbols$1)
|
|
1169
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
1170
|
+
if (__propIsEnum$1.call(b, prop))
|
|
1171
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
1172
|
+
}
|
|
1173
|
+
return a;
|
|
1174
|
+
};
|
|
1175
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1176
|
+
var createRemarkProcessor = (processorOptions$1 = processorOptions) => ({
|
|
1177
|
+
meta: {
|
|
1178
|
+
name: "mdx/remark",
|
|
1179
|
+
version: meta2.version
|
|
1180
|
+
},
|
|
1181
|
+
supportsAutofix: true,
|
|
1182
|
+
preprocess(text, filename) {
|
|
1183
|
+
if (!processorOptions$1.lintCodeBlocks) {
|
|
1184
|
+
return [text];
|
|
1185
|
+
}
|
|
1186
|
+
return [
|
|
1187
|
+
text,
|
|
1188
|
+
...markdownProcessor.preprocess(text, filename).map(({ text: text2, filename: filename2 }) => ({
|
|
1189
|
+
text: text2,
|
|
1190
|
+
filename: filename2.slice(0, filename2.lastIndexOf(".")) + "." + getShortLang(filename2, processorOptions$1.languageMapper)
|
|
1191
|
+
}))
|
|
1192
|
+
];
|
|
1193
|
+
},
|
|
1194
|
+
postprocess([mdxMessages, ...markdownMessages], filename) {
|
|
1195
|
+
return [
|
|
1196
|
+
...mdxMessages,
|
|
1197
|
+
...markdownProcessor.postprocess(markdownMessages, filename)
|
|
1198
|
+
].sort((a, b) => a.line - b.line || a.column - b.column).map((lintMessage) => {
|
|
1199
|
+
const {
|
|
1200
|
+
message,
|
|
1201
|
+
ruleId: eslintRuleId,
|
|
1202
|
+
severity: eslintSeverity
|
|
1203
|
+
} = lintMessage;
|
|
1204
|
+
if (eslintRuleId !== "mdx/remark") {
|
|
1205
|
+
return lintMessage;
|
|
1206
|
+
}
|
|
1207
|
+
const { source, ruleId, reason, severity } = JSON.parse(
|
|
1208
|
+
message
|
|
1209
|
+
);
|
|
1210
|
+
return __spreadProps$1(__spreadValues$1({}, lintMessage), {
|
|
1211
|
+
ruleId: `${source}-${ruleId}`,
|
|
1212
|
+
message: reason,
|
|
1213
|
+
severity: Math.max(eslintSeverity, severity)
|
|
1214
|
+
});
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
var remark$1 = createRemarkProcessor();
|
|
1219
|
+
var processors = { remark: remark$1 };
|
|
1220
|
+
var __defProp2 = Object.defineProperty;
|
|
1221
|
+
var __defProps2 = Object.defineProperties;
|
|
1222
|
+
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
1223
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
1224
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1225
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
1226
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1227
|
+
var __spreadValues2 = (a, b) => {
|
|
1228
|
+
for (var prop in b || (b = {}))
|
|
1229
|
+
if (__hasOwnProp2.call(b, prop))
|
|
1230
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
1231
|
+
if (__getOwnPropSymbols2)
|
|
1232
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
1233
|
+
if (__propIsEnum2.call(b, prop))
|
|
1234
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
1235
|
+
}
|
|
1236
|
+
return a;
|
|
1237
|
+
};
|
|
1238
|
+
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
1239
|
+
var remark = {
|
|
1240
|
+
meta: {
|
|
1241
|
+
type: "layout",
|
|
1242
|
+
docs: {
|
|
1243
|
+
description: "Linter integration with remark plugins",
|
|
1244
|
+
category: "Stylistic Issues",
|
|
1245
|
+
recommended: true
|
|
1246
|
+
},
|
|
1247
|
+
fixable: "code"
|
|
1248
|
+
},
|
|
1249
|
+
create(context) {
|
|
1250
|
+
const filename = context.getFilename();
|
|
1251
|
+
const extname = path4.extname(filename);
|
|
1252
|
+
const sourceCode = context.getSourceCode();
|
|
1253
|
+
const options = context.parserOptions;
|
|
1254
|
+
const isMdx = [
|
|
1255
|
+
...DEFAULT_EXTENSIONS,
|
|
1256
|
+
...options.extensions || []
|
|
1257
|
+
].includes(extname);
|
|
1258
|
+
const isMarkdown = [
|
|
1259
|
+
...MARKDOWN_EXTENSIONS,
|
|
1260
|
+
...options.markdownExtensions || []
|
|
1261
|
+
].includes(extname);
|
|
1262
|
+
return {
|
|
1263
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
1264
|
+
Program(node) {
|
|
1265
|
+
if (!isMdx && !isMarkdown) {
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
const ignoreRemarkConfig = Boolean(options.ignoreRemarkConfig);
|
|
1269
|
+
const physicalFilename = getPhysicalFilename(filename);
|
|
1270
|
+
const sourceText = sourceCode.getText(node);
|
|
1271
|
+
const { messages, content: fixedText } = performSyncWork({
|
|
1272
|
+
fileOptions: {
|
|
1273
|
+
path: physicalFilename,
|
|
1274
|
+
value: sourceText,
|
|
1275
|
+
// eslint-disable-next-line sonar/deprecation -- FIXME: ESLint 8.40+ required
|
|
1276
|
+
cwd: context.getCwd()
|
|
1277
|
+
},
|
|
1278
|
+
physicalFilename,
|
|
1279
|
+
isMdx,
|
|
1280
|
+
process: true,
|
|
1281
|
+
ignoreRemarkConfig
|
|
1282
|
+
});
|
|
1283
|
+
let fixed = 0;
|
|
1284
|
+
for (const {
|
|
1285
|
+
source,
|
|
1286
|
+
reason,
|
|
1287
|
+
ruleId,
|
|
1288
|
+
fatal,
|
|
1289
|
+
line,
|
|
1290
|
+
column,
|
|
1291
|
+
place
|
|
1292
|
+
} of messages) {
|
|
1293
|
+
const severity = fatal ? 2 : fatal == null ? 0 : 1;
|
|
1294
|
+
if (!severity) {
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
const message = {
|
|
1298
|
+
reason,
|
|
1299
|
+
source,
|
|
1300
|
+
ruleId,
|
|
1301
|
+
severity
|
|
1302
|
+
};
|
|
1303
|
+
const point = {
|
|
1304
|
+
line,
|
|
1305
|
+
// ! eslint ast column is 0-indexed, but unified is 1-indexed
|
|
1306
|
+
column: column - 1
|
|
1307
|
+
};
|
|
1308
|
+
context.report({
|
|
1309
|
+
// related to https://github.com/eslint/eslint/issues/14198
|
|
1310
|
+
message: JSON.stringify(message),
|
|
1311
|
+
loc: (
|
|
1312
|
+
/* istanbul ignore next */
|
|
1313
|
+
place && "start" in place ? __spreadProps2(__spreadValues2({}, point), {
|
|
1314
|
+
start: __spreadProps2(__spreadValues2({}, place.start), { column: place.start.column - 1 }),
|
|
1315
|
+
end: __spreadProps2(__spreadValues2({}, place.end), { column: place.end.column - 1 })
|
|
1316
|
+
}) : point
|
|
1317
|
+
),
|
|
1318
|
+
node,
|
|
1319
|
+
fix: fixedText === sourceText ? null : () => fixed++ ? null : {
|
|
1320
|
+
range: [0, sourceText.length],
|
|
1321
|
+
text: fixedText
|
|
1322
|
+
}
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
var rules = { remark };
|
|
1330
|
+
export {
|
|
1331
|
+
DEFAULT_LANGUAGE_MAPPER,
|
|
1332
|
+
base,
|
|
1333
|
+
codeBlocks,
|
|
1334
|
+
configs,
|
|
1335
|
+
createRemarkProcessor,
|
|
1336
|
+
flat,
|
|
1337
|
+
flatCodeBlocks,
|
|
1338
|
+
getGlobals,
|
|
1339
|
+
getShortLang,
|
|
1340
|
+
meta2 as meta,
|
|
1341
|
+
overrides$1 as overrides,
|
|
1342
|
+
processorOptions,
|
|
1343
|
+
processors,
|
|
1344
|
+
recommended,
|
|
1345
|
+
remark,
|
|
1346
|
+
rules
|
|
1347
|
+
};
|