Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Dec 14, 2024
1 parent c9d32c3 commit 3524514
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 5 deletions.
48 changes: 44 additions & 4 deletions lib/types.d.mts
Original file line number Diff line number Diff line change
@@ -1,13 +1,53 @@

export {};

declare module "markdownlint" {
export * from "./exports.mjs";

export type Configuration = import("./markdownlint.mjs").Configuration;
export type ConfigurationParser = import("./markdownlint.mjs").ConfigurationParser;
export type ConfigurationStrict = import("./markdownlint.mjs").ConfigurationStrict;
export type FixInfo = import("./markdownlint.mjs").FixInfo;
export type LintCallback = import("./markdownlint.mjs").LintCallback;
export type LintContentCallback = import("./markdownlint.mjs").LintContentCallback;
export type LintError = import("./markdownlint.mjs").LintError;
export type LintResults = import("./markdownlint.mjs").LintResults;
export type MarkdownItToken = import("./markdownlint.mjs").MarkdownItToken;
export type MarkdownParsers = import("./markdownlint.mjs").MarkdownParsers;
export type MicromarkToken = import("./markdownlint.mjs").MicromarkToken;
export type MicromarkTokenType = import("./markdownlint.mjs").MicromarkTokenType;
export type Options = import("./markdownlint.mjs").Options;
export type ParserMarkdownIt = import("./markdownlint.mjs").ParserMarkdownIt;
export type ParserMicromark = import("./markdownlint.mjs").ParserMicromark;
export type Plugin = import("./markdownlint.mjs").Plugin;
export type ReadConfigCallback = import("./markdownlint.mjs").ReadConfigCallback;
export type ResolveConfigExtendsCallback = import("./markdownlint.mjs").ResolveConfigExtendsCallback;
export type Rule = import("./markdownlint.mjs").Rule;
export type RuleConfiguration = import("./markdownlint.mjs").RuleConfiguration;
export type RuleFunction = import("./markdownlint.mjs").RuleFunction;
export type RuleOnError = import("./markdownlint.mjs").RuleOnError;
export type RuleOnErrorFixInfo = import("./markdownlint.mjs").RuleOnErrorFixInfo;
export type RuleOnErrorFixInfoNormalized = import("./markdownlint.mjs").RuleOnErrorFixInfoNormalized;
export type RuleOnErrorInfo = import("./markdownlint.mjs").RuleOnErrorInfo;
export type RuleParams = import("./markdownlint.mjs").RuleParams;
export type ToStringCallback = import("./markdownlint.mjs").ToStringCallback;
export { applyFix, applyFixes, getVersion } from "./markdownlint.mjs";

}

declare module "markdownlint/async" {
export * from "./exports-async.mjs";

export { lintAsync as lint, readConfigAsync as readConfig } from "./markdownlint.mjs";

}

declare module "markdownlint/promise" {
export * from "./exports-promise.mjs";

export { extendConfigPromise as extendConfig, lintPromise as lint, readConfigPromise as readConfig } from "./markdownlint.mjs";

}

declare module "markdownlint/sync" {
export * from "./exports-sync.mjs";

export { lintSync as lint, readConfigSync as readConfig } from "./markdownlint.mjs";

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"build-config": "npm run build-config-schema && npm run build-config-example",
"build-config-example": "node schema/build-config-example.mjs",
"build-config-schema": "node schema/build-config-schema.mjs",
"build-declaration": "tsc --allowJs --checkJs --declaration --emitDeclarationOnly --module nodenext --outDir dts --rootDir . --target es2015 lib/exports.mjs lib/exports-async.mjs lib/exports-promise.mjs lib/exports-sync.mjs lib/markdownlint.mjs && node scripts/index.mjs copy dts/lib/exports.d.mts lib/exports.d.mts && node scripts/index.mjs copy dts/lib/exports-async.d.mts lib/exports-async.d.mts && node scripts/index.mjs copy dts/lib/exports-promise.d.mts lib/exports-promise.d.mts && node scripts/index.mjs copy dts/lib/exports-sync.d.mts lib/exports-sync.d.mts && node scripts/index.mjs copy dts/lib/markdownlint.d.mts lib/markdownlint.d.mts && node scripts/index.mjs remove dts",
"build-declaration": "tsc --allowJs --checkJs --declaration --emitDeclarationOnly --module nodenext --outDir dts --rootDir . --target es2015 lib/exports.mjs lib/exports-async.mjs lib/exports-promise.mjs lib/exports-sync.mjs lib/markdownlint.mjs && node scripts/index.mjs copy dts/lib/exports.d.mts lib/exports.d.mts && node scripts/index.mjs copy dts/lib/exports-async.d.mts lib/exports-async.d.mts && node scripts/index.mjs copy dts/lib/exports-promise.d.mts lib/exports-promise.d.mts && node scripts/index.mjs copy dts/lib/exports-sync.d.mts lib/exports-sync.d.mts && node scripts/index.mjs copy dts/lib/markdownlint.d.mts lib/markdownlint.d.mts && node scripts/index.mjs remove dts && node scripts/build-declaration.mjs",
"build-demo": "node scripts/index.mjs copy node_modules/markdown-it/dist/markdown-it.min.js demo/markdown-it.min.js && cd demo && webpack --no-stats",
"build-docs": "node doc-build/build-rules.mjs",
"build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2",
Expand Down
29 changes: 29 additions & 0 deletions scripts/build-declaration.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// @ts-check

import fs from "node:fs/promises";

const typesDTS = `
export {};
declare module "markdownlint" {
${await fs.readFile("./lib/exports.d.mts", "utf8")}
}
declare module "markdownlint/async" {
${await fs.readFile("./lib/exports-async.d.mts", "utf8")}
}
declare module "markdownlint/promise" {
${await fs.readFile("./lib/exports-promise.d.mts", "utf8")}
}
declare module "markdownlint/sync" {
${await fs.readFile("./lib/exports-sync.d.mts", "utf8")}
}
`;

await fs.writeFile("./lib/types.d.mts", typesDTS, "utf8");

0 comments on commit 3524514

Please sign in to comment.