@icebreakers/eslint-config 1.1.0 → 1.1.2
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-CLGPHZON.js → chunk-Q36VO4VV.js} +1 -1
- package/dist/index.cjs +386 -273
- package/dist/index.js +5 -4
- package/dist/{lib-VPHJZ6NS.js → lib-DBKCIEYZ.js} +304 -219
- package/package.json +6 -6
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
__dirname,
|
|
3
3
|
__export,
|
|
4
4
|
__require
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Q36VO4VV.js";
|
|
6
6
|
|
|
7
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
7
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/index.js
|
|
8
8
|
var lib_exports2 = {};
|
|
9
9
|
__export(lib_exports2, {
|
|
10
10
|
DEFAULT_LANGUAGE_MAPPER: () => DEFAULT_LANGUAGE_MAPPER,
|
|
@@ -26,7 +26,7 @@ __export(lib_exports2, {
|
|
|
26
26
|
rules: () => rules
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
29
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/configs/base.js
|
|
30
30
|
var base = {
|
|
31
31
|
parser: "eslint-mdx",
|
|
32
32
|
parserOptions: {
|
|
@@ -41,7 +41,7 @@ var base = {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
44
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/configs/code-blocks.js
|
|
45
45
|
var codeBlocks = {
|
|
46
46
|
parserOptions: {
|
|
47
47
|
ecmaFeatures: {
|
|
@@ -60,7 +60,7 @@ var codeBlocks = {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
// ../../node_modules/.pnpm/eslint-mdx@3.
|
|
63
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-mdx/lib/index.js
|
|
64
64
|
var lib_exports = {};
|
|
65
65
|
__export(lib_exports, {
|
|
66
66
|
DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
|
|
@@ -70,8 +70,6 @@ __export(lib_exports, {
|
|
|
70
70
|
cjsRequire: () => cjsRequire,
|
|
71
71
|
getPhysicalFilename: () => getPhysicalFilename,
|
|
72
72
|
getPositionAtFactory: () => getPositionAtFactory,
|
|
73
|
-
last: () => last,
|
|
74
|
-
loadEsmModule: () => loadEsmModule,
|
|
75
73
|
meta: () => meta,
|
|
76
74
|
nextCharOffsetFactory: () => nextCharOffsetFactory,
|
|
77
75
|
normalizePosition: () => normalizePosition,
|
|
@@ -82,11 +80,10 @@ __export(lib_exports, {
|
|
|
82
80
|
prevCharOffsetFactory: () => prevCharOffsetFactory
|
|
83
81
|
});
|
|
84
82
|
|
|
85
|
-
// ../../node_modules/.pnpm/eslint-mdx@3.
|
|
83
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-mdx/lib/helpers.js
|
|
86
84
|
import fs from "node:fs";
|
|
87
85
|
import { createRequire } from "node:module";
|
|
88
86
|
import path from "node:path";
|
|
89
|
-
var last = (items) => items && items[items.length - 1];
|
|
90
87
|
var arrayify = (...args) => args.reduce((arr, curr) => {
|
|
91
88
|
arr.push(...Array.isArray(curr) ? curr : curr == null ? [] : [curr]);
|
|
92
89
|
return arr;
|
|
@@ -104,9 +101,8 @@ var getPhysicalFilename = (filename, child) => {
|
|
|
104
101
|
}
|
|
105
102
|
return filename;
|
|
106
103
|
};
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
const lines = text.split("\n");
|
|
104
|
+
var getPositionAtFactory = (code) => {
|
|
105
|
+
const lines = code.split("\n");
|
|
110
106
|
return (offset) => {
|
|
111
107
|
let currOffset = 0;
|
|
112
108
|
for (const [index, line_] of lines.entries()) {
|
|
@@ -122,11 +118,11 @@ var getPositionAtFactory = (text) => {
|
|
|
122
118
|
}
|
|
123
119
|
};
|
|
124
120
|
};
|
|
125
|
-
var normalizePosition = ({ start, end,
|
|
121
|
+
var normalizePosition = ({ start, end, code }) => {
|
|
126
122
|
const startOffset = start.offset;
|
|
127
123
|
const endOffset = end.offset;
|
|
128
124
|
const range = [startOffset, endOffset];
|
|
129
|
-
const getPositionAt =
|
|
125
|
+
const getPositionAt = code == null ? null : getPositionAtFactory(code);
|
|
130
126
|
return {
|
|
131
127
|
start: startOffset,
|
|
132
128
|
end: endOffset,
|
|
@@ -137,9 +133,9 @@ var normalizePosition = ({ start, end, text }) => {
|
|
|
137
133
|
range
|
|
138
134
|
};
|
|
139
135
|
};
|
|
140
|
-
var prevCharOffsetFactory = (
|
|
136
|
+
var prevCharOffsetFactory = (code) => (offset) => {
|
|
141
137
|
for (let i = offset; i >= 0; i--) {
|
|
142
|
-
const char =
|
|
138
|
+
const char = code[i];
|
|
143
139
|
if (/^\S$/.test(char)) {
|
|
144
140
|
return i;
|
|
145
141
|
}
|
|
@@ -156,14 +152,14 @@ var nextCharOffsetFactory = (text) => {
|
|
|
156
152
|
}
|
|
157
153
|
};
|
|
158
154
|
};
|
|
159
|
-
var cjsRequire =
|
|
155
|
+
var cjsRequire = import.meta.url ? createRequire(import.meta.url) : __require;
|
|
160
156
|
|
|
161
|
-
// ../../node_modules/.pnpm/eslint-mdx@3.
|
|
157
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-mdx/lib/meta.js
|
|
162
158
|
var pkg = cjsRequire("../package.json");
|
|
163
159
|
var meta = { name: pkg.name, version: pkg.version };
|
|
164
160
|
|
|
165
|
-
// ../../node_modules/.pnpm/eslint-mdx@3.
|
|
166
|
-
import
|
|
161
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-mdx/lib/parser.js
|
|
162
|
+
import path5 from "node:path";
|
|
167
163
|
|
|
168
164
|
// ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
169
165
|
function __rest(s, e) {
|
|
@@ -178,26 +174,103 @@ function __rest(s, e) {
|
|
|
178
174
|
return t;
|
|
179
175
|
}
|
|
180
176
|
|
|
181
|
-
// ../../node_modules/.pnpm/synckit@0.
|
|
177
|
+
// ../../node_modules/.pnpm/synckit@0.11.4/node_modules/synckit/lib/index.js
|
|
178
|
+
import path4 from "node:path";
|
|
179
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
180
|
+
|
|
181
|
+
// ../../node_modules/.pnpm/synckit@0.11.4/node_modules/synckit/lib/common.js
|
|
182
|
+
var _a;
|
|
183
|
+
var NODE_OPTIONS = (_a = process.env.NODE_OPTIONS) === null || _a === void 0 ? void 0 : _a.split(/\s+/);
|
|
184
|
+
var hasFlag = (flag) => (NODE_OPTIONS === null || NODE_OPTIONS === void 0 ? void 0 : NODE_OPTIONS.includes(flag)) || process.argv.includes(flag);
|
|
185
|
+
var parseVersion = (version) => version.split(".").map(Number.parseFloat);
|
|
186
|
+
var compareVersion = (version1, version2) => {
|
|
187
|
+
const versions1 = parseVersion(version1);
|
|
188
|
+
const versions2 = parseVersion(version2);
|
|
189
|
+
const length = Math.max(versions1.length, versions2.length);
|
|
190
|
+
for (let i = 0; i < length; i++) {
|
|
191
|
+
const v1 = versions1[i] || 0;
|
|
192
|
+
const v2 = versions2[i] || 0;
|
|
193
|
+
if (v1 > v2) {
|
|
194
|
+
return 1;
|
|
195
|
+
}
|
|
196
|
+
if (v1 < v2) {
|
|
197
|
+
return -1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
};
|
|
202
|
+
var NODE_VERSION = process.versions.node;
|
|
203
|
+
var compareNodeVersion = (version) => compareVersion(NODE_VERSION, version);
|
|
204
|
+
|
|
205
|
+
// ../../node_modules/.pnpm/synckit@0.11.4/node_modules/synckit/lib/constants.js
|
|
206
|
+
var TsRunner = {
|
|
207
|
+
Node: "node",
|
|
208
|
+
Bun: "bun",
|
|
209
|
+
TsNode: "ts-node",
|
|
210
|
+
EsbuildRegister: "esbuild-register",
|
|
211
|
+
EsbuildRunner: "esbuild-runner",
|
|
212
|
+
OXC: "oxc",
|
|
213
|
+
SWC: "swc",
|
|
214
|
+
TSX: "tsx"
|
|
215
|
+
};
|
|
216
|
+
var { NODE_OPTIONS: NODE_OPTIONS_ = "", SYNCKIT_EXEC_ARGV = "", SYNCKIT_GLOBAL_SHIMS, SYNCKIT_TIMEOUT, SYNCKIT_TS_RUNNER } = process.env;
|
|
217
|
+
var TS_ESM_PARTIAL_SUPPORTED = compareNodeVersion("16") >= 0 && compareNodeVersion("18.19") < 0;
|
|
218
|
+
var MTS_SUPPORTED = compareNodeVersion("20.8") >= 0;
|
|
219
|
+
var MODULE_REGISTER_SUPPORTED = MTS_SUPPORTED || compareNodeVersion("18.19") >= 0;
|
|
220
|
+
var STRIP_TYPES_NODE_VERSION = "22.6";
|
|
221
|
+
var TRANSFORM_TYPES_NODE_VERSION = "22.7";
|
|
222
|
+
var FEATURE_TYPESCRIPT_NODE_VERSION = "22.10";
|
|
223
|
+
var DEFAULT_TYPES_NODE_VERSION = "23.6";
|
|
224
|
+
var STRIP_TYPES_FLAG = "--experimental-strip-types";
|
|
225
|
+
var TRANSFORM_TYPES_FLAG = "--experimental-transform-types";
|
|
226
|
+
var NO_STRIP_TYPES_FLAG = "--no-experimental-strip-types";
|
|
227
|
+
var NODE_OPTIONS2 = NODE_OPTIONS_.split(/\s+/);
|
|
228
|
+
var NO_STRIP_TYPES = hasFlag(NO_STRIP_TYPES_FLAG) && (compareNodeVersion(FEATURE_TYPESCRIPT_NODE_VERSION) >= 0 ? process.features.typescript === false : !hasFlag(STRIP_TYPES_FLAG) && !hasFlag(TRANSFORM_TYPES_FLAG));
|
|
229
|
+
var DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : void 0;
|
|
230
|
+
var DEFAULT_EXEC_ARGV = SYNCKIT_EXEC_ARGV.split(",");
|
|
231
|
+
var DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER;
|
|
232
|
+
var DEFAULT_GLOBAL_SHIMS = ["1", "true"].includes(SYNCKIT_GLOBAL_SHIMS);
|
|
233
|
+
var DEFAULT_GLOBAL_SHIMS_PRESET = [
|
|
234
|
+
{
|
|
235
|
+
moduleName: "node-fetch",
|
|
236
|
+
globalName: "fetch"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
moduleName: "node:perf_hooks",
|
|
240
|
+
globalName: "performance",
|
|
241
|
+
named: "performance"
|
|
242
|
+
}
|
|
243
|
+
];
|
|
244
|
+
var IMPORT_FLAG = "--import";
|
|
245
|
+
var REQUIRE_FLAG = "--require";
|
|
246
|
+
var REQUIRE_ABBR_FLAG = "-r";
|
|
247
|
+
var REQUIRE_FLAGS = /* @__PURE__ */ new Set([REQUIRE_FLAG, REQUIRE_ABBR_FLAG]);
|
|
248
|
+
var LOADER_FLAG = "--loader";
|
|
249
|
+
var EXPERIMENTAL_LOADER_FLAG = "--experimental-loader";
|
|
250
|
+
var LOADER_FLAGS = /* @__PURE__ */ new Set([LOADER_FLAG, EXPERIMENTAL_LOADER_FLAG]);
|
|
251
|
+
var IMPORT_FLAG_SUPPORTED = compareNodeVersion("20.6") >= 0;
|
|
252
|
+
var INT32_BYTES = 4;
|
|
253
|
+
|
|
254
|
+
// ../../node_modules/.pnpm/synckit@0.11.4/node_modules/synckit/lib/helpers.js
|
|
182
255
|
import { createHash } from "node:crypto";
|
|
183
256
|
import fs3 from "node:fs";
|
|
184
257
|
import path3 from "node:path";
|
|
185
258
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
186
|
-
import { MessageChannel, Worker,
|
|
259
|
+
import { MessageChannel, Worker, receiveMessageOnPort } from "node:worker_threads";
|
|
187
260
|
|
|
188
|
-
// ../../node_modules/.pnpm/@pkgr+core@0.2.
|
|
261
|
+
// ../../node_modules/.pnpm/@pkgr+core@0.2.4/node_modules/@pkgr/core/lib/constants.js
|
|
189
262
|
import { createRequire as createRequire2 } from "node:module";
|
|
190
263
|
var CWD = process.cwd();
|
|
191
264
|
var cjsRequire2 = typeof __require === "undefined" ? createRequire2(import.meta.url) : __require;
|
|
192
265
|
var EXTENSIONS = [".ts", ".tsx", ...Object.keys(cjsRequire2.extensions)];
|
|
193
266
|
|
|
194
|
-
// ../../node_modules/.pnpm/@pkgr+core@0.2.
|
|
267
|
+
// ../../node_modules/.pnpm/@pkgr+core@0.2.4/node_modules/@pkgr/core/lib/helpers.js
|
|
195
268
|
import fs2 from "node:fs";
|
|
196
269
|
import path2 from "node:path";
|
|
197
270
|
var tryPkg = (pkg3) => {
|
|
198
271
|
try {
|
|
199
272
|
return cjsRequire2.resolve(pkg3);
|
|
200
|
-
} catch
|
|
273
|
+
} catch {
|
|
201
274
|
}
|
|
202
275
|
};
|
|
203
276
|
var isPkgAvailable = (pkg3) => !!tryPkg(pkg3);
|
|
@@ -206,7 +279,7 @@ var tryFile = (filename, includeDir = false, base2 = CWD) => {
|
|
|
206
279
|
const filepath = path2.resolve(base2, filename);
|
|
207
280
|
return fs2.existsSync(filepath) && (includeDir || fs2.statSync(filepath).isFile()) ? filepath : "";
|
|
208
281
|
}
|
|
209
|
-
for (const file of filename
|
|
282
|
+
for (const file of filename ?? []) {
|
|
210
283
|
const filepath = tryFile(file, includeDir, base2);
|
|
211
284
|
if (filepath) {
|
|
212
285
|
return filepath;
|
|
@@ -236,90 +309,20 @@ var findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => {
|
|
|
236
309
|
return "";
|
|
237
310
|
};
|
|
238
311
|
|
|
239
|
-
// ../../node_modules/.pnpm/synckit@0.
|
|
240
|
-
var
|
|
241
|
-
var
|
|
242
|
-
Node: "node",
|
|
243
|
-
Bun: "bun",
|
|
244
|
-
TsNode: "ts-node",
|
|
245
|
-
EsbuildRegister: "esbuild-register",
|
|
246
|
-
EsbuildRunner: "esbuild-runner",
|
|
247
|
-
SWC: "swc",
|
|
248
|
-
TSX: "tsx"
|
|
249
|
-
};
|
|
250
|
-
var { NODE_OPTIONS: NODE_OPTIONS_ = "", SYNCKIT_EXEC_ARGV = "", SYNCKIT_GLOBAL_SHIMS, SYNCKIT_TIMEOUT, SYNCKIT_TS_RUNNER } = process.env;
|
|
251
|
-
var MTS_SUPPORTED_NODE_VERSION = "16";
|
|
252
|
-
var LOADER_SUPPORTED_NODE_VERSION = "20";
|
|
253
|
-
var STRIP_TYPES_NODE_VERSION = "22.6";
|
|
254
|
-
var TRANSFORM_TYPES_NODE_VERSION = "22.7";
|
|
255
|
-
var FEATURE_TYPESCRIPT_NODE_VERSION = "22.10";
|
|
256
|
-
var DEFAULT_TYPES_NODE_VERSION = "23.6";
|
|
257
|
-
var STRIP_TYPES_FLAG = "--experimental-strip-types";
|
|
258
|
-
var TRANSFORM_TYPES_FLAG = "--experimental-transform-types";
|
|
259
|
-
var NO_STRIP_TYPES_FLAG = "--no-experimental-strip-types";
|
|
260
|
-
var NODE_OPTIONS = NODE_OPTIONS_.split(/\s+/);
|
|
261
|
-
var hasFlag = (flag) => NODE_OPTIONS.includes(flag) || process.argv.includes(flag);
|
|
262
|
-
var parseVersion = (version) => version.split(".").map(Number.parseFloat);
|
|
263
|
-
var compareVersion = (version1, version2) => {
|
|
264
|
-
const versions1 = parseVersion(version1);
|
|
265
|
-
const versions2 = parseVersion(version2);
|
|
266
|
-
const length = Math.max(versions1.length, versions2.length);
|
|
267
|
-
for (let i = 0; i < length; i++) {
|
|
268
|
-
const v1 = versions1[i] || 0;
|
|
269
|
-
const v2 = versions2[i] || 0;
|
|
270
|
-
if (v1 > v2) {
|
|
271
|
-
return 1;
|
|
272
|
-
}
|
|
273
|
-
if (v1 < v2) {
|
|
274
|
-
return -1;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return 0;
|
|
278
|
-
};
|
|
279
|
-
var NODE_VERSION = process.versions.node;
|
|
280
|
-
var NO_STRIP_TYPES = compareVersion(NODE_VERSION, FEATURE_TYPESCRIPT_NODE_VERSION) >= 0 ? process.features.typescript === false : hasFlag(NO_STRIP_TYPES_FLAG) && !hasFlag(STRIP_TYPES_FLAG) && !hasFlag(TRANSFORM_TYPES_FLAG);
|
|
281
|
-
var DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : void 0;
|
|
282
|
-
var DEFAULT_EXEC_ARGV = SYNCKIT_EXEC_ARGV.split(",");
|
|
283
|
-
var DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER;
|
|
284
|
-
var DEFAULT_GLOBAL_SHIMS = ["1", "true"].includes(SYNCKIT_GLOBAL_SHIMS);
|
|
285
|
-
var DEFAULT_GLOBAL_SHIMS_PRESET = [
|
|
286
|
-
{
|
|
287
|
-
moduleName: "node-fetch",
|
|
288
|
-
globalName: "fetch"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
moduleName: "node:perf_hooks",
|
|
292
|
-
globalName: "performance",
|
|
293
|
-
named: "performance"
|
|
294
|
-
}
|
|
295
|
-
];
|
|
296
|
-
var syncFnCache;
|
|
297
|
-
function createSyncFn(workerPath, timeoutOrOptions) {
|
|
298
|
-
syncFnCache !== null && syncFnCache !== void 0 ? syncFnCache : syncFnCache = /* @__PURE__ */ new Map();
|
|
299
|
-
if (typeof workerPath !== "string" || workerPath.startsWith("file://")) {
|
|
300
|
-
workerPath = fileURLToPath(workerPath);
|
|
301
|
-
}
|
|
302
|
-
const cachedSyncFn = syncFnCache.get(workerPath);
|
|
303
|
-
if (cachedSyncFn) {
|
|
304
|
-
return cachedSyncFn;
|
|
305
|
-
}
|
|
306
|
-
if (!path3.isAbsolute(workerPath)) {
|
|
307
|
-
throw new Error("`workerPath` must be absolute");
|
|
308
|
-
}
|
|
309
|
-
const syncFn = startWorkerThread(workerPath, typeof timeoutOrOptions === "number" ? { timeout: timeoutOrOptions } : timeoutOrOptions);
|
|
310
|
-
syncFnCache.set(workerPath, syncFn);
|
|
311
|
-
return syncFn;
|
|
312
|
-
}
|
|
313
|
-
var dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`);
|
|
314
|
-
var isFile = (path6) => {
|
|
315
|
-
var _a;
|
|
312
|
+
// ../../node_modules/.pnpm/synckit@0.11.4/node_modules/synckit/lib/helpers.js
|
|
313
|
+
var isFile = (path7) => {
|
|
314
|
+
var _a2;
|
|
316
315
|
try {
|
|
317
|
-
return !!((
|
|
316
|
+
return !!((_a2 = fs3.statSync(path7, { throwIfNoEntry: false })) === null || _a2 === void 0 ? void 0 : _a2.isFile());
|
|
318
317
|
} catch (_b) {
|
|
319
318
|
return false;
|
|
320
319
|
}
|
|
321
320
|
};
|
|
322
|
-
var
|
|
321
|
+
var dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`);
|
|
322
|
+
var hasRequireFlag = (execArgv) => execArgv.some((execArg) => REQUIRE_FLAGS.has(execArg));
|
|
323
|
+
var hasImportFlag = (execArgv) => execArgv.includes(IMPORT_FLAG);
|
|
324
|
+
var hasLoaderFlag = (execArgv) => execArgv.some((execArg) => LOADER_FLAGS.has(execArg));
|
|
325
|
+
var setupTsRunner = (workerPath, { execArgv = DEFAULT_EXEC_ARGV, tsRunner } = {}) => {
|
|
323
326
|
let ext = path3.extname(workerPath);
|
|
324
327
|
if (!/([/\\])node_modules\1/.test(workerPath) && (!ext || /^\.[cm]?js$/.test(ext))) {
|
|
325
328
|
const workPathWithoutExt = ext ? workerPath.slice(0, -ext.length) : workerPath;
|
|
@@ -348,10 +351,10 @@ var setupTsRunner = (workerPath, { execArgv, tsRunner }) => {
|
|
|
348
351
|
}
|
|
349
352
|
}
|
|
350
353
|
const isTs = /\.[cm]?ts$/.test(workerPath);
|
|
351
|
-
let jsUseEsm =
|
|
352
|
-
let tsUseEsm =
|
|
354
|
+
let jsUseEsm = ext === ".mjs";
|
|
355
|
+
let tsUseEsm = ext === ".mts";
|
|
353
356
|
if (isTs) {
|
|
354
|
-
if (!tsUseEsm) {
|
|
357
|
+
if (!tsUseEsm && ext !== ".cts") {
|
|
355
358
|
const pkg3 = findUp(workerPath);
|
|
356
359
|
if (pkg3) {
|
|
357
360
|
tsUseEsm = cjsRequire2(pkg3).type === "module";
|
|
@@ -365,7 +368,7 @@ var setupTsRunner = (workerPath, { execArgv, tsRunner }) => {
|
|
|
365
368
|
if (tsRunner == null) {
|
|
366
369
|
if (process.versions.bun) {
|
|
367
370
|
tsRunner = TsRunner.Bun;
|
|
368
|
-
} else if (!noStripTypes &&
|
|
371
|
+
} else if (!noStripTypes && compareNodeVersion(STRIP_TYPES_NODE_VERSION) >= 0) {
|
|
369
372
|
tsRunner = TsRunner.Node;
|
|
370
373
|
} else if (isPkgAvailable(TsRunner.TsNode)) {
|
|
371
374
|
tsRunner = TsRunner.TsNode;
|
|
@@ -376,53 +379,103 @@ var setupTsRunner = (workerPath, { execArgv, tsRunner }) => {
|
|
|
376
379
|
break;
|
|
377
380
|
}
|
|
378
381
|
case TsRunner.Node: {
|
|
379
|
-
if (
|
|
382
|
+
if (compareNodeVersion(STRIP_TYPES_NODE_VERSION) < 0) {
|
|
380
383
|
throw new Error("type stripping is not supported in this node version");
|
|
381
384
|
}
|
|
382
385
|
if (noStripTypes) {
|
|
383
386
|
throw new Error("type stripping is disabled explicitly");
|
|
384
387
|
}
|
|
385
|
-
if (
|
|
388
|
+
if (compareNodeVersion(DEFAULT_TYPES_NODE_VERSION) >= 0) {
|
|
386
389
|
break;
|
|
387
390
|
}
|
|
388
|
-
if (
|
|
391
|
+
if (compareNodeVersion(TRANSFORM_TYPES_NODE_VERSION) >= 0 && !execArgv.includes(TRANSFORM_TYPES_FLAG)) {
|
|
389
392
|
execArgv = [TRANSFORM_TYPES_FLAG, ...execArgv];
|
|
390
|
-
} else if (
|
|
393
|
+
} else if (compareNodeVersion(STRIP_TYPES_NODE_VERSION) >= 0 && !execArgv.includes(STRIP_TYPES_FLAG)) {
|
|
391
394
|
execArgv = [STRIP_TYPES_FLAG, ...execArgv];
|
|
392
395
|
}
|
|
393
396
|
break;
|
|
394
397
|
}
|
|
395
398
|
case TsRunner.TsNode: {
|
|
396
399
|
if (tsUseEsm) {
|
|
397
|
-
if (!execArgv.includes(
|
|
398
|
-
execArgv = [
|
|
400
|
+
if (!execArgv.includes(LOADER_FLAG)) {
|
|
401
|
+
execArgv = [LOADER_FLAG, `${TsRunner.TsNode}/esm`, ...execArgv];
|
|
399
402
|
}
|
|
400
|
-
} else if (!execArgv
|
|
401
|
-
execArgv = [
|
|
403
|
+
} else if (!hasRequireFlag(execArgv)) {
|
|
404
|
+
execArgv = [
|
|
405
|
+
REQUIRE_ABBR_FLAG,
|
|
406
|
+
`${TsRunner.TsNode}/register`,
|
|
407
|
+
...execArgv
|
|
408
|
+
];
|
|
402
409
|
}
|
|
403
410
|
break;
|
|
404
411
|
}
|
|
405
412
|
case TsRunner.EsbuildRegister: {
|
|
406
|
-
if (
|
|
407
|
-
execArgv
|
|
413
|
+
if (tsUseEsm) {
|
|
414
|
+
if (!hasLoaderFlag(execArgv)) {
|
|
415
|
+
execArgv = [
|
|
416
|
+
LOADER_FLAG,
|
|
417
|
+
`${TsRunner.EsbuildRegister}/loader`,
|
|
418
|
+
...execArgv
|
|
419
|
+
];
|
|
420
|
+
}
|
|
421
|
+
} else if (!hasRequireFlag(execArgv)) {
|
|
422
|
+
execArgv = [REQUIRE_ABBR_FLAG, TsRunner.EsbuildRegister, ...execArgv];
|
|
408
423
|
}
|
|
409
424
|
break;
|
|
410
425
|
}
|
|
411
426
|
case TsRunner.EsbuildRunner: {
|
|
412
|
-
if (!execArgv
|
|
413
|
-
execArgv = [
|
|
427
|
+
if (!hasRequireFlag(execArgv)) {
|
|
428
|
+
execArgv = [
|
|
429
|
+
REQUIRE_ABBR_FLAG,
|
|
430
|
+
`${TsRunner.EsbuildRunner}/register`,
|
|
431
|
+
...execArgv
|
|
432
|
+
];
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
case TsRunner.OXC: {
|
|
437
|
+
if (!execArgv.includes(IMPORT_FLAG)) {
|
|
438
|
+
execArgv = [
|
|
439
|
+
IMPORT_FLAG,
|
|
440
|
+
`@${TsRunner.OXC}-node/core/register`,
|
|
441
|
+
...execArgv
|
|
442
|
+
];
|
|
414
443
|
}
|
|
415
444
|
break;
|
|
416
445
|
}
|
|
417
446
|
case TsRunner.SWC: {
|
|
418
|
-
if (
|
|
419
|
-
|
|
447
|
+
if (tsUseEsm) {
|
|
448
|
+
if (IMPORT_FLAG_SUPPORTED) {
|
|
449
|
+
if (!hasImportFlag(execArgv)) {
|
|
450
|
+
execArgv = [
|
|
451
|
+
IMPORT_FLAG,
|
|
452
|
+
`@${TsRunner.SWC}-node/register/esm-register`,
|
|
453
|
+
...execArgv
|
|
454
|
+
];
|
|
455
|
+
}
|
|
456
|
+
} else if (!hasLoaderFlag(execArgv)) {
|
|
457
|
+
execArgv = [
|
|
458
|
+
LOADER_FLAG,
|
|
459
|
+
`@${TsRunner.SWC}-node/register/esm`,
|
|
460
|
+
...execArgv
|
|
461
|
+
];
|
|
462
|
+
}
|
|
463
|
+
} else if (!hasRequireFlag(execArgv)) {
|
|
464
|
+
execArgv = [
|
|
465
|
+
REQUIRE_ABBR_FLAG,
|
|
466
|
+
`@${TsRunner.SWC}-node/register`,
|
|
467
|
+
...execArgv
|
|
468
|
+
];
|
|
420
469
|
}
|
|
421
470
|
break;
|
|
422
471
|
}
|
|
423
472
|
case TsRunner.TSX: {
|
|
424
|
-
if (
|
|
425
|
-
execArgv
|
|
473
|
+
if (IMPORT_FLAG_SUPPORTED) {
|
|
474
|
+
if (!execArgv.includes(IMPORT_FLAG)) {
|
|
475
|
+
execArgv = [IMPORT_FLAG, TsRunner.TSX, ...execArgv];
|
|
476
|
+
}
|
|
477
|
+
} else if (!execArgv.includes(LOADER_FLAG)) {
|
|
478
|
+
execArgv = [LOADER_FLAG, TsRunner.TSX, ...execArgv];
|
|
426
479
|
}
|
|
427
480
|
break;
|
|
428
481
|
}
|
|
@@ -430,7 +483,7 @@ var setupTsRunner = (workerPath, { execArgv, tsRunner }) => {
|
|
|
430
483
|
throw new Error(`Unknown ts runner: ${String(tsRunner)}`);
|
|
431
484
|
}
|
|
432
485
|
}
|
|
433
|
-
} else if (!jsUseEsm) {
|
|
486
|
+
} else if (!jsUseEsm && ext !== ".cjs") {
|
|
434
487
|
const pkg3 = findUp(workerPath);
|
|
435
488
|
if (pkg3) {
|
|
436
489
|
jsUseEsm = cjsRequire2(pkg3).type === "module";
|
|
@@ -441,19 +494,15 @@ var setupTsRunner = (workerPath, { execArgv, tsRunner }) => {
|
|
|
441
494
|
let pnpApiPath;
|
|
442
495
|
try {
|
|
443
496
|
pnpApiPath = cjsRequire2.resolve("pnpapi");
|
|
444
|
-
} catch (
|
|
497
|
+
} catch (_a2) {
|
|
445
498
|
}
|
|
446
|
-
if (pnpApiPath && !
|
|
447
|
-
execArgv = [
|
|
499
|
+
if (pnpApiPath && !NODE_OPTIONS2.some((option, index) => REQUIRE_FLAGS.has(option) && pnpApiPath === cjsRequire2.resolve(NODE_OPTIONS2[index + 1])) && !execArgv.includes(pnpApiPath)) {
|
|
500
|
+
execArgv = [REQUIRE_ABBR_FLAG, pnpApiPath, ...execArgv];
|
|
448
501
|
const pnpLoaderPath = path3.resolve(pnpApiPath, "../.pnp.loader.mjs");
|
|
449
502
|
if (isFile(pnpLoaderPath)) {
|
|
450
|
-
resolvedPnpLoaderPath = pathToFileURL(pnpLoaderPath).
|
|
451
|
-
if (
|
|
452
|
-
execArgv = [
|
|
453
|
-
"--experimental-loader",
|
|
454
|
-
resolvedPnpLoaderPath,
|
|
455
|
-
...execArgv
|
|
456
|
-
];
|
|
503
|
+
resolvedPnpLoaderPath = pathToFileURL(pnpLoaderPath).href;
|
|
504
|
+
if (!MODULE_REGISTER_SUPPORTED) {
|
|
505
|
+
execArgv = [LOADER_FLAG, resolvedPnpLoaderPath, ...execArgv];
|
|
457
506
|
}
|
|
458
507
|
}
|
|
459
508
|
}
|
|
@@ -483,8 +532,6 @@ var _generateGlobals = (globalShims, type) => globalShims.reduce((acc, shim) =>
|
|
|
483
532
|
var globalsCache;
|
|
484
533
|
var tmpdir;
|
|
485
534
|
var _dirname = typeof __dirname === "undefined" ? path3.dirname(fileURLToPath(import.meta.url)) : __dirname;
|
|
486
|
-
var sharedBuffer;
|
|
487
|
-
var sharedBufferView;
|
|
488
535
|
var generateGlobals = (workerPath, globalShims, type = "import") => {
|
|
489
536
|
if (globalShims.length === 0) {
|
|
490
537
|
return "";
|
|
@@ -512,21 +559,26 @@ var generateGlobals = (workerPath, globalShims, type = "import") => {
|
|
|
512
559
|
globalsCache.set(workerPath, [content, filepath]);
|
|
513
560
|
return content;
|
|
514
561
|
};
|
|
562
|
+
var sharedBuffer;
|
|
563
|
+
var sharedBufferView;
|
|
515
564
|
function startWorkerThread(workerPath, { timeout = DEFAULT_TIMEOUT, execArgv = DEFAULT_EXEC_ARGV, tsRunner = DEFAULT_TS_RUNNER, transferList = [], globalShims = DEFAULT_GLOBAL_SHIMS } = {}) {
|
|
516
565
|
const { port1: mainPort, port2: workerPort } = new MessageChannel();
|
|
517
566
|
const { isTs, ext, jsUseEsm, tsUseEsm, tsRunner: finalTsRunner, workerPath: finalWorkerPath, pnpLoaderPath, execArgv: finalExecArgv } = setupTsRunner(workerPath, { execArgv, tsRunner });
|
|
518
567
|
const workerPathUrl = pathToFileURL(finalWorkerPath);
|
|
519
568
|
if (/\.[cm]ts$/.test(finalWorkerPath)) {
|
|
520
|
-
const isTsxSupported = !tsUseEsm ||
|
|
569
|
+
const isTsxSupported = !tsUseEsm || TS_ESM_PARTIAL_SUPPORTED;
|
|
521
570
|
if (!finalTsRunner) {
|
|
522
571
|
throw new Error("No ts runner specified, ts worker path is not supported");
|
|
523
572
|
} else if ([
|
|
524
573
|
TsRunner.EsbuildRegister,
|
|
525
574
|
TsRunner.EsbuildRunner,
|
|
526
|
-
|
|
575
|
+
...TS_ESM_PARTIAL_SUPPORTED ? [
|
|
576
|
+
TsRunner.OXC,
|
|
577
|
+
TsRunner.SWC
|
|
578
|
+
] : [],
|
|
527
579
|
...isTsxSupported ? [] : [TsRunner.TSX]
|
|
528
580
|
].includes(finalTsRunner)) {
|
|
529
|
-
throw new Error(`${finalTsRunner} is not supported for ${ext} files yet` + (isTsxSupported ? ", you can try [tsx](https://github.com/esbuild-kit/tsx) instead" : ""));
|
|
581
|
+
throw new Error(`${finalTsRunner} is not supported for ${ext} files yet` + (isTsxSupported ? ", you can try [tsx](https://github.com/esbuild-kit/tsx) instead" : MTS_SUPPORTED ? ", you can try [oxc](https://github.com/oxc-project/oxc-node) or [swc](https://github.com/swc-project/swc-node/tree/master/packages/register) instead" : ""));
|
|
530
582
|
}
|
|
531
583
|
}
|
|
532
584
|
const finalGlobalShims = (globalShims === true ? DEFAULT_GLOBAL_SHIMS_PRESET : Array.isArray(globalShims) ? globalShims : []).filter(({ moduleName }) => isPkgAvailable(moduleName));
|
|
@@ -552,7 +604,7 @@ function startWorkerThread(workerPath, { timeout = DEFAULT_TIMEOUT, execArgv = D
|
|
|
552
604
|
port.postMessage(abortMsg);
|
|
553
605
|
throw new Error("Internal error: Atomics.wait() failed: " + status);
|
|
554
606
|
}
|
|
555
|
-
const
|
|
607
|
+
const _a2 = receiveMessageOnPort(mainPort).message, { id } = _a2, message = __rest(_a2, ["id"]);
|
|
556
608
|
if (id < expectedId) {
|
|
557
609
|
const waitingTime = Date.now() - start;
|
|
558
610
|
return receiveMessageWithId(port, expectedId, waitingTimeout ? waitingTimeout - waitingTime : void 0);
|
|
@@ -579,10 +631,29 @@ function startWorkerThread(workerPath, { timeout = DEFAULT_TIMEOUT, execArgv = D
|
|
|
579
631
|
return syncFn;
|
|
580
632
|
}
|
|
581
633
|
|
|
582
|
-
// ../../node_modules/.pnpm/
|
|
634
|
+
// ../../node_modules/.pnpm/synckit@0.11.4/node_modules/synckit/lib/index.js
|
|
635
|
+
var syncFnCache;
|
|
636
|
+
function createSyncFn(workerPath, timeoutOrOptions) {
|
|
637
|
+
syncFnCache !== null && syncFnCache !== void 0 ? syncFnCache : syncFnCache = /* @__PURE__ */ new Map();
|
|
638
|
+
if (typeof workerPath !== "string" || workerPath.startsWith("file://")) {
|
|
639
|
+
workerPath = fileURLToPath2(workerPath);
|
|
640
|
+
}
|
|
641
|
+
const cachedSyncFn = syncFnCache.get(workerPath);
|
|
642
|
+
if (cachedSyncFn) {
|
|
643
|
+
return cachedSyncFn;
|
|
644
|
+
}
|
|
645
|
+
if (!path4.isAbsolute(workerPath)) {
|
|
646
|
+
throw new Error("`workerPath` must be absolute");
|
|
647
|
+
}
|
|
648
|
+
const syncFn = startWorkerThread(workerPath, typeof timeoutOrOptions === "number" ? { timeout: timeoutOrOptions } : timeoutOrOptions);
|
|
649
|
+
syncFnCache.set(workerPath, syncFn);
|
|
650
|
+
return syncFn;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-mdx/lib/sync.js
|
|
583
654
|
var performSyncWork = createSyncFn(cjsRequire.resolve("./worker.js"));
|
|
584
655
|
|
|
585
|
-
// ../../node_modules/.pnpm/eslint-mdx@3.
|
|
656
|
+
// ../../node_modules/.pnpm/eslint-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-mdx/lib/parser.js
|
|
586
657
|
var DEFAULT_EXTENSIONS = [".mdx"];
|
|
587
658
|
var MARKDOWN_EXTENSIONS = [".md"];
|
|
588
659
|
var Parser = class {
|
|
@@ -594,7 +665,7 @@ var Parser = class {
|
|
|
594
665
|
return this.parseForESLint(code, options).ast;
|
|
595
666
|
}
|
|
596
667
|
parseForESLint(code, { filePath, sourceType, ignoreRemarkConfig, extensions, markdownExtensions }) {
|
|
597
|
-
const extname =
|
|
668
|
+
const extname = path5.extname(filePath);
|
|
598
669
|
const isMdx = [...DEFAULT_EXTENSIONS, ...arrayify(extensions)].includes(extname);
|
|
599
670
|
const isMarkdown = [
|
|
600
671
|
...MARKDOWN_EXTENSIONS,
|
|
@@ -603,15 +674,11 @@ var Parser = class {
|
|
|
603
674
|
if (!isMdx && !isMarkdown) {
|
|
604
675
|
throw new Error("Unsupported file extension, make sure setting the `extensions` or `markdownExtensions` option correctly.");
|
|
605
676
|
}
|
|
606
|
-
const physicalFilename = getPhysicalFilename(filePath);
|
|
607
677
|
let result;
|
|
608
678
|
try {
|
|
609
679
|
result = performSyncWork({
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
value: code
|
|
613
|
-
},
|
|
614
|
-
physicalFilename,
|
|
680
|
+
filePath: getPhysicalFilename(filePath),
|
|
681
|
+
code,
|
|
615
682
|
isMdx,
|
|
616
683
|
ignoreRemarkConfig
|
|
617
684
|
});
|
|
@@ -645,7 +712,7 @@ var Parser = class {
|
|
|
645
712
|
var parser = new Parser();
|
|
646
713
|
var { parse, parseForESLint } = parser;
|
|
647
714
|
|
|
648
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
715
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/configs/flat.js
|
|
649
716
|
var flat = {
|
|
650
717
|
files: ["**/*.{md,mdx}"],
|
|
651
718
|
languageOptions: {
|
|
@@ -674,14 +741,14 @@ var flatCodeBlocks = {
|
|
|
674
741
|
...restConfig
|
|
675
742
|
};
|
|
676
743
|
|
|
677
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
744
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/helpers.js
|
|
678
745
|
import { createRequire as createRequire3 } from "node:module";
|
|
679
746
|
var getGlobals = (sources, initialGlobals = {}) => (Array.isArray(sources) ? sources : Object.keys(sources)).reduce((globals, source) => Object.assign(globals, {
|
|
680
747
|
[source]: false
|
|
681
748
|
}), initialGlobals);
|
|
682
|
-
var cjsRequire3 =
|
|
749
|
+
var cjsRequire3 = import.meta.url ? createRequire3(import.meta.url) : __require;
|
|
683
750
|
|
|
684
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
751
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/configs/overrides.js
|
|
685
752
|
var isReactPluginAvailable = false;
|
|
686
753
|
try {
|
|
687
754
|
cjsRequire3.resolve("eslint-plugin-react");
|
|
@@ -705,7 +772,7 @@ var overrides = {
|
|
|
705
772
|
}
|
|
706
773
|
};
|
|
707
774
|
|
|
708
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
775
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/configs/recommended.js
|
|
709
776
|
var overrides2 = [
|
|
710
777
|
{
|
|
711
778
|
files: ["*.md", "*.mdx"],
|
|
@@ -755,7 +822,7 @@ var addPrettierRules = () => {
|
|
|
755
822
|
};
|
|
756
823
|
addPrettierRules();
|
|
757
824
|
|
|
758
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
825
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/configs/index.js
|
|
759
826
|
var configs = {
|
|
760
827
|
base,
|
|
761
828
|
"code-blocks": codeBlocks,
|
|
@@ -766,34 +833,41 @@ var configs = {
|
|
|
766
833
|
recommended
|
|
767
834
|
};
|
|
768
835
|
|
|
769
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
836
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/meta.js
|
|
770
837
|
var pkg2 = cjsRequire3("../package.json");
|
|
771
838
|
var meta2 = { name: pkg2.name, version: pkg2.version };
|
|
772
839
|
|
|
773
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
840
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/processors/helpers.js
|
|
774
841
|
var DEFAULT_LANGUAGE_MAPPER = {
|
|
842
|
+
ecmascript: "js",
|
|
775
843
|
javascript: "js",
|
|
776
844
|
javascriptreact: "jsx",
|
|
777
845
|
typescript: "ts",
|
|
778
846
|
typescriptreact: "tsx",
|
|
779
847
|
markdown: "md",
|
|
848
|
+
markdownjsx: "mdx",
|
|
849
|
+
markdownreact: "mdx",
|
|
780
850
|
mdown: "md",
|
|
781
851
|
mkdn: "md"
|
|
782
852
|
};
|
|
783
853
|
function getShortLang(filename, languageMapper) {
|
|
784
|
-
const language =
|
|
854
|
+
const language = filename.split(".").at(-1);
|
|
785
855
|
if (languageMapper === false) {
|
|
786
856
|
return language;
|
|
787
857
|
}
|
|
788
|
-
languageMapper = { ...DEFAULT_LANGUAGE_MAPPER, ...languageMapper };
|
|
858
|
+
languageMapper = languageMapper ? { ...DEFAULT_LANGUAGE_MAPPER, ...languageMapper } : DEFAULT_LANGUAGE_MAPPER;
|
|
859
|
+
const mapped = languageMapper[language];
|
|
860
|
+
if (mapped) {
|
|
861
|
+
return mapped;
|
|
862
|
+
}
|
|
789
863
|
const lang = language.toLowerCase();
|
|
790
|
-
return languageMapper[
|
|
864
|
+
return languageMapper[lang] || lang;
|
|
791
865
|
}
|
|
792
866
|
|
|
793
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
867
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/from-markdown.js
|
|
794
868
|
var fromMarkdown = createSyncFn(cjsRequire3.resolve("./worker.js"));
|
|
795
869
|
|
|
796
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
870
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/processors/markdown.js
|
|
797
871
|
var UNSATISFIABLE_RULES = /* @__PURE__ */ new Set([
|
|
798
872
|
"eol-last",
|
|
799
873
|
"unicode-bom"
|
|
@@ -814,15 +888,26 @@ function traverse(node, callbacks) {
|
|
|
814
888
|
}
|
|
815
889
|
}
|
|
816
890
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
891
|
+
var COMMENTS = [
|
|
892
|
+
[
|
|
893
|
+
/^<!-{2,}/,
|
|
894
|
+
/-{2,}>$/
|
|
895
|
+
],
|
|
896
|
+
[
|
|
897
|
+
/^\/\*+/,
|
|
898
|
+
/\*+\/$/
|
|
899
|
+
]
|
|
900
|
+
];
|
|
901
|
+
var eslintCommentRegex = /^(?:eslint\b|global\s)/u;
|
|
902
|
+
function getComment(value, isMdx = false) {
|
|
903
|
+
const [commentStart, commentEnd] = COMMENTS[+isMdx];
|
|
904
|
+
const commentStartMatched = commentStart.exec(value);
|
|
905
|
+
const commentEndMatched = commentEnd.exec(value);
|
|
906
|
+
if (commentStartMatched == null || commentEndMatched == null) {
|
|
822
907
|
return "";
|
|
823
908
|
}
|
|
824
|
-
const comment =
|
|
825
|
-
if (!
|
|
909
|
+
const comment = value.slice(commentStartMatched[0].length, -commentEndMatched[0].length).trim();
|
|
910
|
+
if (!eslintCommentRegex.test(comment)) {
|
|
826
911
|
return "";
|
|
827
912
|
}
|
|
828
913
|
return comment;
|
|
@@ -863,59 +948,63 @@ function getBlockRangeMap(text, node, comments) {
|
|
|
863
948
|
}
|
|
864
949
|
return rangeMap;
|
|
865
950
|
}
|
|
866
|
-
var codeBlockFileNameRegex = /filename=(["'])
|
|
951
|
+
var codeBlockFileNameRegex = /filename=(?<quote>["'])(?<filename>.*?)\k<quote>/u;
|
|
867
952
|
function fileNameFromMeta(block) {
|
|
868
953
|
return codeBlockFileNameRegex.exec(block.meta)?.groups.filename.replaceAll(/\s+/gu, "_");
|
|
869
954
|
}
|
|
870
|
-
var languageToFileExtension = {
|
|
871
|
-
javascript: "js",
|
|
872
|
-
ecmascript: "js",
|
|
873
|
-
typescript: "ts",
|
|
874
|
-
markdown: "md"
|
|
875
|
-
};
|
|
876
955
|
function preprocess(sourceText, filename) {
|
|
877
956
|
const text = sourceText.startsWith(BOM) ? sourceText.slice(1) : sourceText;
|
|
878
|
-
const ast = fromMarkdown(text);
|
|
957
|
+
const ast = fromMarkdown(text, filename.endsWith(".mdx"));
|
|
879
958
|
const blocks = [];
|
|
880
959
|
blocksCache.set(filename, blocks);
|
|
881
|
-
let
|
|
960
|
+
let allComments = [];
|
|
961
|
+
function mdxExpression(node) {
|
|
962
|
+
const comment = getComment(node.value, true);
|
|
963
|
+
if (comment) {
|
|
964
|
+
allComments.push(comment);
|
|
965
|
+
} else {
|
|
966
|
+
allComments = [];
|
|
967
|
+
}
|
|
968
|
+
}
|
|
882
969
|
traverse(ast, {
|
|
883
970
|
"*"() {
|
|
884
|
-
|
|
971
|
+
allComments = [];
|
|
885
972
|
},
|
|
886
973
|
code(node) {
|
|
887
|
-
if (node.lang) {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
974
|
+
if (!node.lang) {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
const comments = [];
|
|
978
|
+
for (const comment of allComments) {
|
|
979
|
+
if (comment === "eslint-skip") {
|
|
980
|
+
allComments = [];
|
|
981
|
+
return;
|
|
895
982
|
}
|
|
896
|
-
|
|
897
|
-
blocks.push({
|
|
898
|
-
...node,
|
|
899
|
-
baseIndentText: getIndentText(text, node),
|
|
900
|
-
comments,
|
|
901
|
-
rangeMap: getBlockRangeMap(text, node, comments)
|
|
902
|
-
});
|
|
983
|
+
comments.push(`/* ${comment} */`);
|
|
903
984
|
}
|
|
985
|
+
allComments = [];
|
|
986
|
+
blocks.push({
|
|
987
|
+
...node,
|
|
988
|
+
baseIndentText: getIndentText(text, node),
|
|
989
|
+
comments,
|
|
990
|
+
rangeMap: getBlockRangeMap(text, node, comments)
|
|
991
|
+
});
|
|
904
992
|
},
|
|
905
993
|
html(node) {
|
|
906
994
|
const comment = getComment(node.value);
|
|
907
995
|
if (comment) {
|
|
908
|
-
|
|
996
|
+
allComments.push(comment);
|
|
909
997
|
} else {
|
|
910
|
-
|
|
998
|
+
allComments = [];
|
|
911
999
|
}
|
|
912
|
-
}
|
|
1000
|
+
},
|
|
1001
|
+
mdxFlowExpression: mdxExpression,
|
|
1002
|
+
mdxTextExpression: mdxExpression
|
|
913
1003
|
});
|
|
914
1004
|
return blocks.map((block, index) => {
|
|
915
1005
|
const [language] = block.lang.trim().split(" ");
|
|
916
|
-
const fileExtension = Object.hasOwn(languageToFileExtension, language) ? languageToFileExtension[language] : language;
|
|
917
1006
|
return {
|
|
918
|
-
filename: fileNameFromMeta(block) ?? `${index}.${
|
|
1007
|
+
filename: fileNameFromMeta(block) ?? `${index}.${language}`,
|
|
919
1008
|
text: [...block.comments, block.value, ""].join("\n")
|
|
920
1009
|
};
|
|
921
1010
|
});
|
|
@@ -981,17 +1070,17 @@ function postprocess(messages, filename) {
|
|
|
981
1070
|
}
|
|
982
1071
|
var markdownProcessor = {
|
|
983
1072
|
meta: {
|
|
984
|
-
name: "
|
|
985
|
-
version:
|
|
1073
|
+
name: "mdx/markdown",
|
|
1074
|
+
version: meta2.version
|
|
986
1075
|
},
|
|
987
1076
|
preprocess,
|
|
988
1077
|
postprocess,
|
|
989
1078
|
supportsAutofix: SUPPORTS_AUTOFIX
|
|
990
1079
|
};
|
|
991
1080
|
|
|
992
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
1081
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/processors/options.js
|
|
993
1082
|
var processorOptions = {};
|
|
994
|
-
var linterPath = Object.keys(cjsRequire3.cache).find((
|
|
1083
|
+
var linterPath = Object.keys(cjsRequire3.cache).find((path7) => /([/\\])eslint\1lib(?:\1linter){2}\.js$/.test(path7));
|
|
995
1084
|
if (!linterPath) {
|
|
996
1085
|
throw new Error("Could not find ESLint Linter in require cache");
|
|
997
1086
|
}
|
|
@@ -1004,7 +1093,7 @@ ESLinter.prototype.verify = function(code, config, options) {
|
|
|
1004
1093
|
return verify.call(this, code, config, options);
|
|
1005
1094
|
};
|
|
1006
1095
|
|
|
1007
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
1096
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/processors/remark.js
|
|
1008
1097
|
var createRemarkProcessor = (processorOptions2 = processorOptions) => ({
|
|
1009
1098
|
meta: {
|
|
1010
1099
|
name: "mdx/remark",
|
|
@@ -1044,11 +1133,11 @@ var createRemarkProcessor = (processorOptions2 = processorOptions) => ({
|
|
|
1044
1133
|
});
|
|
1045
1134
|
var remark = createRemarkProcessor();
|
|
1046
1135
|
|
|
1047
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
1136
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/processors/index.js
|
|
1048
1137
|
var processors = { remark };
|
|
1049
1138
|
|
|
1050
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
1051
|
-
import
|
|
1139
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/rules/remark.js
|
|
1140
|
+
import path6 from "node:path";
|
|
1052
1141
|
var remark2 = {
|
|
1053
1142
|
meta: {
|
|
1054
1143
|
type: "layout",
|
|
@@ -1061,7 +1150,7 @@ var remark2 = {
|
|
|
1061
1150
|
},
|
|
1062
1151
|
create(context) {
|
|
1063
1152
|
const filename = context.getFilename();
|
|
1064
|
-
const extname =
|
|
1153
|
+
const extname = path6.extname(filename);
|
|
1065
1154
|
const sourceCode = context.getSourceCode();
|
|
1066
1155
|
const options = context.parserOptions;
|
|
1067
1156
|
const isMdx = [
|
|
@@ -1078,15 +1167,11 @@ var remark2 = {
|
|
|
1078
1167
|
return;
|
|
1079
1168
|
}
|
|
1080
1169
|
const ignoreRemarkConfig = Boolean(options.ignoreRemarkConfig);
|
|
1081
|
-
const physicalFilename = getPhysicalFilename(filename);
|
|
1082
1170
|
const sourceText = sourceCode.getText(node);
|
|
1083
1171
|
const { messages, content: fixedText } = performSyncWork({
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
cwd: context.getCwd()
|
|
1088
|
-
},
|
|
1089
|
-
physicalFilename,
|
|
1172
|
+
filePath: getPhysicalFilename(filename),
|
|
1173
|
+
code: sourceText,
|
|
1174
|
+
cwd: context.getCwd(),
|
|
1090
1175
|
isMdx,
|
|
1091
1176
|
process: true,
|
|
1092
1177
|
ignoreRemarkConfig
|
|
@@ -1115,7 +1200,7 @@ var remark2 = {
|
|
|
1115
1200
|
end: { ...place.end, column: place.end.column - 1 }
|
|
1116
1201
|
} : point,
|
|
1117
1202
|
node,
|
|
1118
|
-
fix: fixedText === sourceText ? null : () => fixed++ ? null : {
|
|
1203
|
+
fix: fixedText == null || fixedText === sourceText ? null : () => fixed++ ? null : {
|
|
1119
1204
|
range: [0, sourceText.length],
|
|
1120
1205
|
text: fixedText
|
|
1121
1206
|
}
|
|
@@ -1126,7 +1211,7 @@ var remark2 = {
|
|
|
1126
1211
|
}
|
|
1127
1212
|
};
|
|
1128
1213
|
|
|
1129
|
-
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.
|
|
1214
|
+
// ../../node_modules/.pnpm/eslint-plugin-mdx@3.4.1_eslint@9.25.1_jiti@2.4.2_/node_modules/eslint-plugin-mdx/lib/rules/index.js
|
|
1130
1215
|
var rules = { remark: remark2 };
|
|
1131
1216
|
export {
|
|
1132
1217
|
DEFAULT_LANGUAGE_MAPPER,
|