mirror of
https://github.com/DavidAnson/markdownlint-cli2-action.git
synced 2024-12-22 12:53:32 +01:00
wip
This commit is contained in:
parent
72e1a9ae3a
commit
e028bf1ff5
2 changed files with 124 additions and 117 deletions
239
dist/index.mjs
vendored
239
dist/index.mjs
vendored
|
@ -16230,7 +16230,7 @@ const kClosedResolve = Symbol('kClosedResolve')
|
||||||
const channels = {}
|
const channels = {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const diagnosticsChannel = __nccwpck_require__(1637)
|
const diagnosticsChannel = __nccwpck_require__(4018)
|
||||||
channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders')
|
channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders')
|
||||||
channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect')
|
channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect')
|
||||||
channels.connectError = diagnosticsChannel.channel('undici:client:connectError')
|
channels.connectError = diagnosticsChannel.channel('undici:client:connectError')
|
||||||
|
@ -19890,7 +19890,7 @@ const channels = {}
|
||||||
let extractBody
|
let extractBody
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const diagnosticsChannel = __nccwpck_require__(1637)
|
const diagnosticsChannel = __nccwpck_require__(4018)
|
||||||
channels.create = diagnosticsChannel.channel('undici:request:create')
|
channels.create = diagnosticsChannel.channel('undici:request:create')
|
||||||
channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent')
|
channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent')
|
||||||
channels.headers = diagnosticsChannel.channel('undici:request:headers')
|
channels.headers = diagnosticsChannel.channel('undici:request:headers')
|
||||||
|
@ -33296,7 +33296,7 @@ module.exports = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const diagnosticsChannel = __nccwpck_require__(1637)
|
const diagnosticsChannel = __nccwpck_require__(4018)
|
||||||
const { uid, states } = __nccwpck_require__(5913)
|
const { uid, states } = __nccwpck_require__(5913)
|
||||||
const {
|
const {
|
||||||
kReadyState,
|
kReadyState,
|
||||||
|
@ -34043,7 +34043,7 @@ module.exports = {
|
||||||
|
|
||||||
|
|
||||||
const { Writable } = __nccwpck_require__(2203)
|
const { Writable } = __nccwpck_require__(2203)
|
||||||
const diagnosticsChannel = __nccwpck_require__(1637)
|
const diagnosticsChannel = __nccwpck_require__(4018)
|
||||||
const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(5913)
|
const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(5913)
|
||||||
const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(2933)
|
const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(2933)
|
||||||
const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(3574)
|
const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(3574)
|
||||||
|
@ -35304,7 +35304,7 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto");
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1637:
|
/***/ 4018:
|
||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("diagnostics_channel");
|
module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("diagnostics_channel");
|
||||||
|
@ -37107,11 +37107,11 @@ module.exports.Or = newLineRe;
|
||||||
module.exports.gi = nextLinesRe;
|
module.exports.gi = nextLinesRe;
|
||||||
|
|
||||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
||||||
/** @typedef {import("markdownlint").RuleOnError} RuleOnError */
|
/** @typedef {import("../lib/exports.mjs").RuleOnError} RuleOnError */
|
||||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
||||||
/** @typedef {import("markdownlint").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
|
/** @typedef {import("../lib/exports.mjs").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
|
||||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
||||||
/** @typedef {import("markdownlint").MicromarkToken} MicromarkToken */
|
/** @typedef {import("../lib/exports.mjs").MicromarkToken} MicromarkToken */
|
||||||
// eslint-disable-next-line jsdoc/valid-types
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
/** @typedef {import("micromark-extension-gfm-footnote", { with: { "resolution-mode": "import" } })} */
|
/** @typedef {import("micromark-extension-gfm-footnote", { with: { "resolution-mode": "import" } })} */
|
||||||
// eslint-disable-next-line jsdoc/valid-types
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
|
@ -37653,7 +37653,7 @@ const { flatTokensSymbol, htmlFlowSymbol } = __nccwpck_require__(3408);
|
||||||
// eslint-disable-next-line jsdoc/valid-types
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
/** @typedef {import("micromark-util-types", { with: { "resolution-mode": "import" } }).TokenType} TokenType */
|
/** @typedef {import("micromark-util-types", { with: { "resolution-mode": "import" } }).TokenType} TokenType */
|
||||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
||||||
/** @typedef {import("markdownlint").MicromarkToken} Token */
|
/** @typedef {import("../lib/exports.mjs").MicromarkToken} Token */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if a Micromark token is within an htmlFlow type.
|
* Determines if a Micromark token is within an htmlFlow type.
|
||||||
|
@ -37724,12 +37724,11 @@ function addRangeToSet(set, start, end) {
|
||||||
* Filter a list of Micromark tokens by predicate.
|
* Filter a list of Micromark tokens by predicate.
|
||||||
*
|
*
|
||||||
* @param {Token[]} tokens Micromark tokens.
|
* @param {Token[]} tokens Micromark tokens.
|
||||||
* @param {AllowedPredicate} [allowed] Allowed token predicate.
|
* @param {AllowedPredicate} allowed Allowed token predicate.
|
||||||
* @param {TransformPredicate} [transformChildren] Transform predicate.
|
* @param {TransformPredicate} [transformChildren] Transform predicate.
|
||||||
* @returns {Token[]} Filtered tokens.
|
* @returns {Token[]} Filtered tokens.
|
||||||
*/
|
*/
|
||||||
function filterByPredicate(tokens, allowed, transformChildren) {
|
function filterByPredicate(tokens, allowed, transformChildren) {
|
||||||
allowed = allowed || (() => true);
|
|
||||||
const result = [];
|
const result = [];
|
||||||
const queue = [
|
const queue = [
|
||||||
{
|
{
|
||||||
|
@ -37924,7 +37923,11 @@ const nonContentTokens = new Set([
|
||||||
"lineEnding",
|
"lineEnding",
|
||||||
"lineEndingBlank",
|
"lineEndingBlank",
|
||||||
"linePrefix",
|
"linePrefix",
|
||||||
"listItemIndent"
|
"listItemIndent",
|
||||||
|
"undefinedReference",
|
||||||
|
"undefinedReferenceCollapsed",
|
||||||
|
"undefinedReferenceFull",
|
||||||
|
"undefinedReferenceShortcut"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -38086,12 +38089,10 @@ __nccwpck_require__.d(constructs_namespaceObject, {
|
||||||
var core = __nccwpck_require__(7484);
|
var core = __nccwpck_require__(7484);
|
||||||
;// CONCATENATED MODULE: external "node:fs"
|
;// CONCATENATED MODULE: external "node:fs"
|
||||||
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
|
const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs");
|
||||||
var external_node_fs_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_node_fs_namespaceObject, 2);
|
|
||||||
;// CONCATENATED MODULE: external "node:module"
|
;// CONCATENATED MODULE: external "node:module"
|
||||||
const external_node_module_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:module");
|
const external_node_module_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:module");
|
||||||
;// CONCATENATED MODULE: external "node:os"
|
;// CONCATENATED MODULE: external "node:os"
|
||||||
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
|
const external_node_os_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os");
|
||||||
var external_node_os_namespaceObject_0 = /*#__PURE__*/__nccwpck_require__.t(external_node_os_namespaceObject, 2);
|
|
||||||
;// CONCATENATED MODULE: external "node:path"
|
;// CONCATENATED MODULE: external "node:path"
|
||||||
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
|
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
|
||||||
;// CONCATENATED MODULE: external "node:url"
|
;// CONCATENATED MODULE: external "node:url"
|
||||||
|
@ -38775,6 +38776,22 @@ const {convertPathToPattern} = out;
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/micromatch/index.js
|
// EXTERNAL MODULE: ./node_modules/micromatch/index.js
|
||||||
var micromatch = __nccwpck_require__(8785);
|
var micromatch = __nccwpck_require__(8785);
|
||||||
|
;// CONCATENATED MODULE: ./node_modules/markdownlint/lib/node-imports-node.mjs
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
|
||||||
|
const node_imports_node_fs = { access: external_node_fs_namespaceObject.access, accessSync: external_node_fs_namespaceObject.accessSync, readFile: external_node_fs_namespaceObject.readFile, readFileSync: external_node_fs_namespaceObject.readFileSync };
|
||||||
|
|
||||||
|
|
||||||
|
const node_imports_node_module = { createRequire: external_node_module_namespaceObject.createRequire };
|
||||||
|
|
||||||
|
|
||||||
|
const node_imports_node_os = { EOL: external_node_os_namespaceObject.EOL, homedir: external_node_os_namespaceObject.homedir };
|
||||||
|
|
||||||
|
// eslint-disable-next-line unicorn/import-style
|
||||||
|
|
||||||
|
const node_imports_node_path = { dirname: external_node_path_namespaceObject.dirname, resolve: external_node_path_namespaceObject.resolve };
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/markdownlint/helpers/helpers.cjs
|
// EXTERNAL MODULE: ./node_modules/markdownlint/helpers/helpers.cjs
|
||||||
var helpers_helpers = __nccwpck_require__(3810);
|
var helpers_helpers = __nccwpck_require__(3810);
|
||||||
// EXTERNAL MODULE: ./node_modules/markdownlint/helpers/micromark-helpers.cjs
|
// EXTERNAL MODULE: ./node_modules/markdownlint/helpers/micromark-helpers.cjs
|
||||||
|
@ -38856,7 +38873,7 @@ const fixableRuleNames = (/* unused pure expression or super */ null && ([
|
||||||
"MD058"
|
"MD058"
|
||||||
]));
|
]));
|
||||||
const homepage = "https://github.com/DavidAnson/markdownlint";
|
const homepage = "https://github.com/DavidAnson/markdownlint";
|
||||||
const version = "0.37.0";
|
const version = "0.37.2";
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/markdownlint/lib/md001.mjs
|
;// CONCATENATED MODULE: ./node_modules/markdownlint/lib/md001.mjs
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
@ -40399,13 +40416,14 @@ const isList = (token) => (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the "visual" end of the list
|
// Find the "visual" end of the list
|
||||||
|
const flattenedChildren = (0,micromark_helpers.filterByPredicate)(
|
||||||
|
list.children,
|
||||||
|
(token) => !micromark_helpers.nonContentTokens.has(token.type),
|
||||||
|
(token) => micromark_helpers.nonContentTokens.has(token.type) ? [] : token.children
|
||||||
|
);
|
||||||
let endLine = list.endLine;
|
let endLine = list.endLine;
|
||||||
const flattenedChildren = (0,micromark_helpers.filterByPredicate)(list.children);
|
if (flattenedChildren.length > 0) {
|
||||||
for (const child of flattenedChildren.reverse()) {
|
endLine = flattenedChildren[flattenedChildren.length - 1].endLine;
|
||||||
if (!micromark_helpers.nonContentTokens.has(child.type)) {
|
|
||||||
endLine = child.endLine;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a blank line below the list
|
// Look for a blank line below the list
|
||||||
|
@ -57142,11 +57160,9 @@ for (const rule of rules) {
|
||||||
;// CONCATENATED MODULE: ./node_modules/markdownlint/lib/markdownlint.mjs
|
;// CONCATENATED MODULE: ./node_modules/markdownlint/lib/markdownlint.mjs
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
|
||||||
|
const dynamicRequire = node_imports_node_module.createRequire(import.meta.url);
|
||||||
const dynamicRequire = (0,external_node_module_namespaceObject.createRequire)(import.meta.url);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -58004,7 +58020,7 @@ function lintInput(options, synchronous, callback) {
|
||||||
3 :
|
3 :
|
||||||
options.resultVersion;
|
options.resultVersion;
|
||||||
const markdownItPlugins = options.markdownItPlugins || [];
|
const markdownItPlugins = options.markdownItPlugins || [];
|
||||||
const fs = options.fs || external_node_fs_namespaceObject_0;
|
const fs = options.fs || node_imports_node_fs;
|
||||||
const aliasToRuleNames = mapAliasToRuleNames(ruleList);
|
const aliasToRuleNames = mapAliasToRuleNames(ruleList);
|
||||||
const results = newResults(ruleList);
|
const results = newResults(ruleList);
|
||||||
let done = false;
|
let done = false;
|
||||||
|
@ -58148,8 +58164,8 @@ function lintSync(options) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function resolveConfigExtends(configFile, referenceId, fs, callback) {
|
function resolveConfigExtends(configFile, referenceId, fs, callback) {
|
||||||
const configFileDirname = external_node_path_namespaceObject.dirname(configFile);
|
const configFileDirname = node_imports_node_path.dirname(configFile);
|
||||||
const resolvedExtendsFile = external_node_path_namespaceObject.resolve(configFileDirname, referenceId);
|
const resolvedExtendsFile = node_imports_node_path.resolve(configFileDirname, referenceId);
|
||||||
fs.access(resolvedExtendsFile, (err) => {
|
fs.access(resolvedExtendsFile, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
// Not a file, try require.resolve
|
// Not a file, try require.resolve
|
||||||
|
@ -58211,7 +58227,7 @@ function extendConfig(config, file, parsers, fs, callback) {
|
||||||
if (configExtends) {
|
if (configExtends) {
|
||||||
return resolveConfigExtends(
|
return resolveConfigExtends(
|
||||||
file,
|
file,
|
||||||
helpers_helpers/* expandTildePath */.ww(configExtends, external_node_os_namespaceObject_0),
|
helpers_helpers/* expandTildePath */.ww(configExtends, node_imports_node_os),
|
||||||
fs,
|
fs,
|
||||||
// eslint-disable-next-line no-use-before-define
|
// eslint-disable-next-line no-use-before-define
|
||||||
(_, resolvedExtends) => readConfigAsync(
|
(_, resolvedExtends) => readConfigAsync(
|
||||||
|
@ -58280,10 +58296,10 @@ function readConfigAsync(file, parsers, fs, callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fs) {
|
if (!fs) {
|
||||||
fs = external_node_fs_namespaceObject_0;
|
fs = node_imports_node_fs;
|
||||||
}
|
}
|
||||||
// Read file
|
// Read file
|
||||||
file = helpers_helpers/* expandTildePath */.ww(file, external_node_os_namespaceObject_0);
|
file = helpers_helpers/* expandTildePath */.ww(file, node_imports_node_os);
|
||||||
fs.readFile(file, "utf8", (err, content) => {
|
fs.readFile(file, "utf8", (err, content) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -58399,7 +58415,7 @@ function applyFix(line, fixInfo, lineEnding = "\n") {
|
||||||
* @returns {string} Fixed content.
|
* @returns {string} Fixed content.
|
||||||
*/
|
*/
|
||||||
function applyFixes(input, errors) {
|
function applyFixes(input, errors) {
|
||||||
const lineEnding = helpers_helpers/* getPreferredLineEnding */.Z_(input, external_node_os_namespaceObject_0);
|
const lineEnding = helpers_helpers/* getPreferredLineEnding */.Z_(input, node_imports_node_os);
|
||||||
const lines = input.split(helpers_helpers/* newLineRe */.Or);
|
const lines = input.split(helpers_helpers/* newLineRe */.Or);
|
||||||
// Normalize fixInfo objects
|
// Normalize fixInfo objects
|
||||||
let fixInfos = errors
|
let fixInfos = errors
|
||||||
|
@ -58834,24 +58850,23 @@ const mergeOptions = (first, second) => {
|
||||||
|
|
||||||
/* harmony default export */ const merge_options = (mergeOptions);
|
/* harmony default export */ const merge_options = (mergeOptions);
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./node_modules/markdownlint-cli2/resolve-and-require.mjs
|
;// CONCATENATED MODULE: ./node_modules/markdownlint-cli2/resolve-module.mjs
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for calling Node's require.resolve/require with an additional path.
|
* Wrapper for calling Node's require.resolve with additional paths.
|
||||||
* @param {object} req Node's require implementation (or equivalent).
|
* @param {object} require Node's require implementation (or equivalent).
|
||||||
* @param {string} id Package identifier to require.
|
* @param {string} request Module path to require.
|
||||||
* @param {string[]} dirs Directories to include when resolving paths.
|
* @param {string[]} paths Paths to resolve module location from.
|
||||||
* @returns {object} Exported module content.
|
* @returns {string} Resolved file name.
|
||||||
*/
|
*/
|
||||||
const resolveAndRequire = (req, id, dirs) => {
|
const resolveModule = (require, request, paths) => {
|
||||||
const resolvePaths = req.resolve.paths ? req.resolve.paths("") : [];
|
const resolvePaths = require.resolve.paths ? require.resolve.paths("") : [];
|
||||||
const paths = [ ...dirs, ...resolvePaths ];
|
const allPaths = [ ...paths, ...resolvePaths ];
|
||||||
const resolved = req.resolve(id, { paths });
|
return require.resolve(request, { "paths": allPaths });
|
||||||
return req(resolved);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* harmony default export */ const resolve_and_require = (resolveAndRequire);
|
/* harmony default export */ const resolve_module = (resolveModule);
|
||||||
|
|
||||||
// EXTERNAL MODULE: ./node_modules/jsonc-parser/lib/umd/main.js
|
// EXTERNAL MODULE: ./node_modules/jsonc-parser/lib/umd/main.js
|
||||||
var main = __nccwpck_require__(9547);
|
var main = __nccwpck_require__(9547);
|
||||||
|
@ -62765,7 +62780,7 @@ const parsers = [
|
||||||
;// CONCATENATED MODULE: ./node_modules/markdownlint-cli2/markdownlint-cli2.mjs
|
;// CONCATENATED MODULE: ./node_modules/markdownlint-cli2/markdownlint-cli2.mjs
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// Requires
|
// Imports
|
||||||
|
|
||||||
|
|
||||||
const markdownlint_cli2_dynamicRequire = (0,external_node_module_namespaceObject.createRequire)(import.meta.url);
|
const markdownlint_cli2_dynamicRequire = (0,external_node_module_namespaceObject.createRequire)(import.meta.url);
|
||||||
|
@ -62830,73 +62845,65 @@ const readConfigFile = (fs, dir, name, otherwise) => () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Import or resolve/require a module ID with a custom directory in the path
|
// Import a module ID with a custom directory in the path
|
||||||
const importOrRequireResolve = async (dirOrDirs, id, noRequire) => {
|
const importModule = async (dirOrDirs, id, noImport) => {
|
||||||
if (typeof id === "string") {
|
if (typeof id !== "string") {
|
||||||
if (noRequire) {
|
return id;
|
||||||
return null;
|
} else if (noImport) {
|
||||||
}
|
return null;
|
||||||
const dirs = Array.isArray(dirOrDirs) ? dirOrDirs : [ dirOrDirs ];
|
}
|
||||||
const expandId = (0,helpers_helpers/* expandTildePath */.ww)(id, external_node_os_namespaceObject);
|
const dirs = Array.isArray(dirOrDirs) ? dirOrDirs : [ dirOrDirs ];
|
||||||
const errors = [];
|
const expandId = (0,helpers_helpers/* expandTildePath */.ww)(id, external_node_os_namespaceObject);
|
||||||
// Try to load via require(...)
|
const errors = [];
|
||||||
|
let moduleName = null;
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
const isModule = /\.mjs$/iu.test(expandId);
|
moduleName = (0,external_node_url_namespaceObject.pathToFileURL)(resolve_module(markdownlint_cli2_dynamicRequire, expandId, dirs));
|
||||||
if (!isModule) {
|
|
||||||
// Try not to use require for modules due to breaking change in Node 22.12:
|
|
||||||
// https://github.com/nodejs/node/releases/tag/v22.12.0
|
|
||||||
return resolve_and_require(markdownlint_cli2_dynamicRequire, expandId, dirs);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errors.push(error);
|
errors.push(error);
|
||||||
|
moduleName =
|
||||||
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
||||||
|
(!external_node_path_namespaceObject.isAbsolute(expandId) && URL.canParse(expandId))
|
||||||
|
? new URL(expandId)
|
||||||
|
: (0,external_node_url_namespaceObject.pathToFileURL)(external_node_path_namespaceObject.resolve(dirs[0], expandId));
|
||||||
}
|
}
|
||||||
// Try to load via import(...)
|
// eslint-disable-next-line no-inline-comments
|
||||||
try {
|
const module = await import(/* webpackIgnore: true */ moduleName);
|
||||||
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
return module.default;
|
||||||
const isURL = !external_node_path_namespaceObject.isAbsolute(expandId) && URL.canParse(expandId);
|
} catch (error) {
|
||||||
const urlString = (
|
errors.push(error);
|
||||||
isURL ? new URL(expandId) : (0,external_node_url_namespaceObject.pathToFileURL)(external_node_path_namespaceObject.resolve(dirs[0], expandId))
|
|
||||||
).toString();
|
|
||||||
// eslint-disable-next-line no-inline-comments
|
|
||||||
const module = await import(/* webpackIgnore: true */ urlString);
|
|
||||||
return module.default;
|
|
||||||
} catch (error) {
|
|
||||||
errors.push(error);
|
|
||||||
}
|
|
||||||
// Give up
|
|
||||||
throw new AggregateError(
|
throw new AggregateError(
|
||||||
errors,
|
errors,
|
||||||
`Unable to require or import module '${id}'.`
|
`Unable to import module '${id}'.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Import or require an array of modules by ID
|
// Import an array of modules by ID
|
||||||
const importOrRequireIds = (dirs, ids, noRequire) => (
|
const importModuleIds = (dirs, ids, noImport) => (
|
||||||
Promise.all(
|
Promise.all(
|
||||||
ids.map(
|
ids.map(
|
||||||
(id) => importOrRequireResolve(dirs, id, noRequire)
|
(id) => importModule(dirs, id, noImport)
|
||||||
)
|
)
|
||||||
).then((results) => results.filter(Boolean))
|
).then((results) => results.filter(Boolean))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Import or require an array of modules by ID (preserving parameters)
|
// Import an array of modules by ID (preserving parameters)
|
||||||
const importOrRequireIdsAndParams = (dirs, idsAndParams, noRequire) => (
|
const importModuleIdsAndParams = (dirs, idsAndParams, noImport) => (
|
||||||
Promise.all(
|
Promise.all(
|
||||||
idsAndParams.map(
|
idsAndParams.map(
|
||||||
(idAndParams) => importOrRequireResolve(dirs, idAndParams[0], noRequire).
|
(idAndParams) => importModule(dirs, idAndParams[0], noImport).
|
||||||
then((module) => module && [ module, ...idAndParams.slice(1) ])
|
then((module) => module && [ module, ...idAndParams.slice(1) ])
|
||||||
)
|
)
|
||||||
).then((results) => results.filter(Boolean))
|
).then((results) => results.filter(Boolean))
|
||||||
);
|
);
|
||||||
|
|
||||||
// Import or require a JavaScript file and return the exported object
|
// Import a JavaScript file and return the exported object
|
||||||
const importOrRequireConfig = (fs, dir, name, noRequire, otherwise) => () => {
|
const importConfig = (fs, dir, name, noImport, otherwise) => () => {
|
||||||
const file = pathPosix.join(dir, name);
|
const file = pathPosix.join(dir, name);
|
||||||
return fs.promises.access(file).
|
return fs.promises.access(file).
|
||||||
then(
|
then(
|
||||||
() => importOrRequireResolve(dir, name, noRequire),
|
() => importModule(dir, name, noImport),
|
||||||
otherwise
|
otherwise
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -62916,7 +62923,7 @@ const getExtendedConfig = (config, configPath, fs) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Read an options or config file in any format and return the object
|
// Read an options or config file in any format and return the object
|
||||||
const readOptionsOrConfig = async (configPath, fs, noRequire) => {
|
const readOptionsOrConfig = async (configPath, fs, noImport) => {
|
||||||
const basename = pathPosix.basename(configPath);
|
const basename = pathPosix.basename(configPath);
|
||||||
const dirname = pathPosix.dirname(configPath);
|
const dirname = pathPosix.dirname(configPath);
|
||||||
let options = null;
|
let options = null;
|
||||||
|
@ -62930,7 +62937,7 @@ const readOptionsOrConfig = async (configPath, fs, noRequire) => {
|
||||||
basename.endsWith(".markdownlint-cli2.cjs") ||
|
basename.endsWith(".markdownlint-cli2.cjs") ||
|
||||||
basename.endsWith(".markdownlint-cli2.mjs")
|
basename.endsWith(".markdownlint-cli2.mjs")
|
||||||
) {
|
) {
|
||||||
options = await importOrRequireResolve(dirname, basename, noRequire);
|
options = await importModule(dirname, basename, noImport);
|
||||||
} else if (
|
} else if (
|
||||||
basename.endsWith(".markdownlint.jsonc") ||
|
basename.endsWith(".markdownlint.jsonc") ||
|
||||||
basename.endsWith(".markdownlint.json") ||
|
basename.endsWith(".markdownlint.json") ||
|
||||||
|
@ -62942,7 +62949,7 @@ const readOptionsOrConfig = async (configPath, fs, noRequire) => {
|
||||||
basename.endsWith(".markdownlint.cjs") ||
|
basename.endsWith(".markdownlint.cjs") ||
|
||||||
basename.endsWith(".markdownlint.mjs")
|
basename.endsWith(".markdownlint.mjs")
|
||||||
) {
|
) {
|
||||||
config = await importOrRequireResolve(dirname, basename, noRequire);
|
config = await importModule(dirname, basename, noImport);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"File name should be (or end with) one of the supported types " +
|
"File name should be (or end with) one of the supported types " +
|
||||||
|
@ -63053,7 +63060,7 @@ const getAndProcessDirInfo = (
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
dir,
|
dir,
|
||||||
relativeDir,
|
relativeDir,
|
||||||
noRequire,
|
noImport,
|
||||||
allowPackageJson
|
allowPackageJson
|
||||||
) => {
|
) => {
|
||||||
// Create dirInfo
|
// Create dirInfo
|
||||||
|
@ -63087,10 +63094,10 @@ const getAndProcessDirInfo = (
|
||||||
() => fs.promises.readFile(file, utf8).then(yaml_parse),
|
() => fs.promises.readFile(file, utf8).then(yaml_parse),
|
||||||
() => fs.promises.access(captureFile(markdownlintCli2Cjs)).
|
() => fs.promises.access(captureFile(markdownlintCli2Cjs)).
|
||||||
then(
|
then(
|
||||||
() => importOrRequireResolve(dir, file, noRequire),
|
() => importModule(dir, file, noImport),
|
||||||
() => fs.promises.access(captureFile(markdownlintCli2Mjs)).
|
() => fs.promises.access(captureFile(markdownlintCli2Mjs)).
|
||||||
then(
|
then(
|
||||||
() => importOrRequireResolve(dir, file, noRequire),
|
() => importModule(dir, file, noImport),
|
||||||
() => (allowPackageJson
|
() => (allowPackageJson
|
||||||
? fs.promises.access(captureFile(packageJson))
|
? fs.promises.access(captureFile(packageJson))
|
||||||
// eslint-disable-next-line prefer-promise-reject-errors
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
|
@ -63144,16 +63151,16 @@ const getAndProcessDirInfo = (
|
||||||
fs,
|
fs,
|
||||||
dir,
|
dir,
|
||||||
".markdownlint.yml",
|
".markdownlint.yml",
|
||||||
importOrRequireConfig(
|
importConfig(
|
||||||
fs,
|
fs,
|
||||||
dir,
|
dir,
|
||||||
".markdownlint.cjs",
|
".markdownlint.cjs",
|
||||||
noRequire,
|
noImport,
|
||||||
importOrRequireConfig(
|
importConfig(
|
||||||
fs,
|
fs,
|
||||||
dir,
|
dir,
|
||||||
".markdownlint.mjs",
|
".markdownlint.mjs",
|
||||||
noRequire,
|
noImport,
|
||||||
markdownlint_cli2_noop
|
markdownlint_cli2_noop
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -63182,7 +63189,7 @@ const getBaseOptions = async (
|
||||||
options,
|
options,
|
||||||
fixDefault,
|
fixDefault,
|
||||||
noGlobs,
|
noGlobs,
|
||||||
noRequire
|
noImport
|
||||||
) => {
|
) => {
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
const dirToDirInfo = {};
|
const dirToDirInfo = {};
|
||||||
|
@ -63192,7 +63199,7 @@ const getBaseOptions = async (
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
baseDir,
|
baseDir,
|
||||||
relativeDir,
|
relativeDir,
|
||||||
noRequire,
|
noImport,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
|
@ -63233,7 +63240,7 @@ const enumerateFiles = async (
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
gitignore,
|
gitignore,
|
||||||
ignoreFiles,
|
ignoreFiles,
|
||||||
noRequire
|
noImport
|
||||||
) => {
|
) => {
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
/** @type {import("globby").Options} */
|
/** @type {import("globby").Options} */
|
||||||
|
@ -63301,7 +63308,7 @@ const enumerateFiles = async (
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
dir,
|
dir,
|
||||||
null,
|
null,
|
||||||
noRequire,
|
noImport,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
dirInfo.files.push(file);
|
dirInfo.files.push(file);
|
||||||
|
@ -63314,7 +63321,7 @@ const enumerateParents = async (
|
||||||
fs,
|
fs,
|
||||||
baseDir,
|
baseDir,
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
noRequire
|
noImport
|
||||||
) => {
|
) => {
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
|
|
||||||
|
@ -63343,7 +63350,7 @@ const enumerateParents = async (
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
dir,
|
dir,
|
||||||
null,
|
null,
|
||||||
noRequire,
|
noImport,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
lastDirInfo.parent = dirInfo;
|
lastDirInfo.parent = dirInfo;
|
||||||
|
@ -63368,7 +63375,7 @@ const createDirInfos = async (
|
||||||
optionsOverride,
|
optionsOverride,
|
||||||
gitignore,
|
gitignore,
|
||||||
ignoreFiles,
|
ignoreFiles,
|
||||||
noRequire
|
noImport
|
||||||
) => {
|
) => {
|
||||||
await enumerateFiles(
|
await enumerateFiles(
|
||||||
fs,
|
fs,
|
||||||
|
@ -63378,13 +63385,13 @@ const createDirInfos = async (
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
gitignore,
|
gitignore,
|
||||||
ignoreFiles,
|
ignoreFiles,
|
||||||
noRequire
|
noImport
|
||||||
);
|
);
|
||||||
await enumerateParents(
|
await enumerateParents(
|
||||||
fs,
|
fs,
|
||||||
baseDir,
|
baseDir,
|
||||||
dirToDirInfo,
|
dirToDirInfo,
|
||||||
noRequire
|
noImport
|
||||||
);
|
);
|
||||||
|
|
||||||
// Merge file lists with identical configuration
|
// Merge file lists with identical configuration
|
||||||
|
@ -63415,10 +63422,10 @@ const createDirInfos = async (
|
||||||
);
|
);
|
||||||
if (markdownlintOptions && markdownlintOptions.customRules) {
|
if (markdownlintOptions && markdownlintOptions.customRules) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
importOrRequireIds(
|
importModuleIds(
|
||||||
[ effectiveDir, ...effectiveModulePaths ],
|
[ effectiveDir, ...effectiveModulePaths ],
|
||||||
markdownlintOptions.customRules,
|
markdownlintOptions.customRules,
|
||||||
noRequire
|
noImport
|
||||||
).then((customRules) => {
|
).then((customRules) => {
|
||||||
// Expand nested arrays (for packages that export multiple rules)
|
// Expand nested arrays (for packages that export multiple rules)
|
||||||
markdownlintOptions.customRules = customRules.flat();
|
markdownlintOptions.customRules = customRules.flat();
|
||||||
|
@ -63427,10 +63434,10 @@ const createDirInfos = async (
|
||||||
}
|
}
|
||||||
if (markdownlintOptions && markdownlintOptions.markdownItPlugins) {
|
if (markdownlintOptions && markdownlintOptions.markdownItPlugins) {
|
||||||
tasks.push(
|
tasks.push(
|
||||||
importOrRequireIdsAndParams(
|
importModuleIdsAndParams(
|
||||||
[ effectiveDir, ...effectiveModulePaths ],
|
[ effectiveDir, ...effectiveModulePaths ],
|
||||||
markdownlintOptions.markdownItPlugins,
|
markdownlintOptions.markdownItPlugins,
|
||||||
noRequire
|
noImport
|
||||||
).then((markdownItPlugins) => {
|
).then((markdownItPlugins) => {
|
||||||
markdownlintOptions.markdownItPlugins = markdownItPlugins;
|
markdownlintOptions.markdownItPlugins = markdownItPlugins;
|
||||||
})
|
})
|
||||||
|
@ -63623,7 +63630,7 @@ const outputSummary = async (
|
||||||
modulePaths,
|
modulePaths,
|
||||||
logMessage,
|
logMessage,
|
||||||
logError,
|
logError,
|
||||||
noRequire
|
noImport
|
||||||
) => {
|
) => {
|
||||||
const errorsPresent = (summary.length > 0);
|
const errorsPresent = (summary.length > 0);
|
||||||
if (errorsPresent || outputFormatters) {
|
if (errorsPresent || outputFormatters) {
|
||||||
|
@ -63636,7 +63643,7 @@ const outputSummary = async (
|
||||||
const dir = relativeDir || baseDir;
|
const dir = relativeDir || baseDir;
|
||||||
const dirs = [ dir, ...modulePaths ];
|
const dirs = [ dir, ...modulePaths ];
|
||||||
const formattersAndParams = outputFormatters
|
const formattersAndParams = outputFormatters
|
||||||
? await importOrRequireIdsAndParams(dirs, outputFormatters, noRequire)
|
? await importModuleIdsAndParams(dirs, outputFormatters, noImport)
|
||||||
// eslint-disable-next-line no-inline-comments, unicorn/no-await-expression-member
|
// eslint-disable-next-line no-inline-comments, unicorn/no-await-expression-member
|
||||||
: [ [ (await Promise.resolve(/* import() eager */).then(__nccwpck_require__.t.bind(__nccwpck_require__, 7928, 19))).default ] ];
|
: [ [ (await Promise.resolve(/* import() eager */).then(__nccwpck_require__.t.bind(__nccwpck_require__, 7928, 19))).default ] ];
|
||||||
await Promise.all(formattersAndParams.map((formatterAndParams) => {
|
await Promise.all(formattersAndParams.map((formatterAndParams) => {
|
||||||
|
@ -63656,7 +63663,7 @@ const markdownlint_cli2_main = async (params) => {
|
||||||
optionsDefault,
|
optionsDefault,
|
||||||
optionsOverride,
|
optionsOverride,
|
||||||
fileContents,
|
fileContents,
|
||||||
noRequire,
|
noImport,
|
||||||
allowStdin
|
allowStdin
|
||||||
} = params;
|
} = params;
|
||||||
let {
|
let {
|
||||||
|
@ -63713,7 +63720,7 @@ const markdownlint_cli2_main = async (params) => {
|
||||||
const resolvedConfigPath =
|
const resolvedConfigPath =
|
||||||
posixPath(external_node_path_namespaceObject.resolve(baseDirSystem, configPath));
|
posixPath(external_node_path_namespaceObject.resolve(baseDirSystem, configPath));
|
||||||
optionsArgv =
|
optionsArgv =
|
||||||
await readOptionsOrConfig(resolvedConfigPath, fs, noRequire);
|
await readOptionsOrConfig(resolvedConfigPath, fs, noImport);
|
||||||
relativeDir = pathPosix.dirname(resolvedConfigPath);
|
relativeDir = pathPosix.dirname(resolvedConfigPath);
|
||||||
}
|
}
|
||||||
// Process arguments and get base options
|
// Process arguments and get base options
|
||||||
|
@ -63726,7 +63733,7 @@ const markdownlint_cli2_main = async (params) => {
|
||||||
optionsArgv || optionsDefault,
|
optionsArgv || optionsDefault,
|
||||||
fixDefault,
|
fixDefault,
|
||||||
noGlobs,
|
noGlobs,
|
||||||
noRequire
|
noImport
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
if (!baseOptions?.baseMarkdownlintOptions.noBanner) {
|
if (!baseOptions?.baseMarkdownlintOptions.noBanner) {
|
||||||
|
@ -63785,7 +63792,7 @@ const markdownlint_cli2_main = async (params) => {
|
||||||
optionsOverride,
|
optionsOverride,
|
||||||
gitignore,
|
gitignore,
|
||||||
ignoreFiles,
|
ignoreFiles,
|
||||||
noRequire
|
noImport
|
||||||
);
|
);
|
||||||
// Output linting status
|
// Output linting status
|
||||||
if (showProgress) {
|
if (showProgress) {
|
||||||
|
@ -63823,7 +63830,7 @@ const markdownlint_cli2_main = async (params) => {
|
||||||
modulePaths,
|
modulePaths,
|
||||||
logMessage,
|
logMessage,
|
||||||
logError,
|
logError,
|
||||||
noRequire
|
noImport
|
||||||
);
|
);
|
||||||
// Return result
|
// Return result
|
||||||
return errorsPresent ? 1 : 0;
|
return errorsPresent ? 1 : 0;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.11.1",
|
"@actions/core": "1.11.1",
|
||||||
"markdownlint-cli2": "DavidAnson/markdownlint-cli2#esm"
|
"markdownlint-cli2": "DavidAnson/markdownlint-cli2#next"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "9.16.0",
|
"@eslint/js": "9.16.0",
|
||||||
|
|
Loading…
Reference in a new issue