From 918b2bce7147612c17797b2f2b1d08204ba3203c Mon Sep 17 00:00:00 2001 From: Luma Date: Mon, 29 Jan 2024 03:54:21 +0900 Subject: [PATCH] patch: fix tsconfig.json again for esm --- scripts/debug-render-example.ts | 20 +++++++++---------- scripts/debug-term.ts | 4 ++-- src/lib/__tests__/to-slug.spec.ts | 2 +- src/lib/term/__tests__/detect.spec.ts | 2 +- src/luma-counter/from-markdown-extension.ts | 2 +- src/luma-save/from-markdown-extension.ts | 2 +- src/luma-term/from-markdown-extension.ts | 4 ++-- src/rehype-add-slug.ts | 8 ++++---- src/rehype-clean-internal.ts | 2 +- src/rehype-counter.ts | 10 +++++----- src/rehype-debug.ts | 2 +- src/rehype-katex.ts | 16 +++++++-------- src/rehype-replace-text.ts | 4 ++-- src/rehype-save.ts | 8 ++++---- src/rehype-wrap.ts | 6 +++--- src/remark-debug.ts | 2 +- src/remark-meta.ts | 4 ++-- src/remark-term.ts | 16 +++++++-------- src/util/estree-json-parse-of.ts | 2 +- src/util/rehype-katex/estree-ctx-delete.ts | 2 +- .../rehype-katex/estree-ctx-push-const.ts | 2 +- src/util/rehype-katex/estree-ctx-push.ts | 2 +- src/util/rehype-katex/estree-ctx-reset.ts | 2 +- src/util/rehype-katex/estree-ctx-value.ts | 2 +- .../rehype-katex/estree-declare-symbol.ts | 2 +- src/util/rehype-katex/estree-var.ts | 2 +- src/util/util-mdast-meta.ts | 2 +- tsconfig.json | 4 ++-- 28 files changed, 68 insertions(+), 68 deletions(-) diff --git a/scripts/debug-render-example.ts b/scripts/debug-render-example.ts index d1dabca..736dca1 100644 --- a/scripts/debug-render-example.ts +++ b/scripts/debug-render-example.ts @@ -5,20 +5,20 @@ import * as path from "node:path"; import remarkFrontmatter from "remark-frontmatter"; -import rehypeAddSlug from "../src/rehype-add-slug"; -import rehypeReplaceText from "../src/rehype-replace-text"; -import rehypeKatex from "../src/rehype-katex"; -import rehypeWrap from "../src/rehype-wrap"; -import rehypeCounter from "../src/rehype-counter"; -import rehypeCleanInternal from "../src/rehype-clean-internal"; +import rehypeAddSlug from "../src/rehype-add-slug.js"; +import rehypeReplaceText from "../src/rehype-replace-text.js"; +import rehypeKatex from "../src/rehype-katex.js"; +import rehypeWrap from "../src/rehype-wrap.js"; +import rehypeCounter from "../src/rehype-counter.js"; +import rehypeCleanInternal from "../src/rehype-clean-internal.js"; // import rehypeDebug from "../src/rehype-debug"; // import remarkDebug from "../src/remark-debug"; -import remarkTerm from "../src/remark-term"; -import remarkMeta from "../src/remark-meta"; -import rehypeSave from "../src/rehype-save"; +import remarkTerm from "../src/remark-term.js"; +import remarkMeta from "../src/remark-meta.js"; +import rehypeSave from "../src/rehype-save.js"; import remarkMath from "remark-math"; -import * as prompt from "prompt"; +import prompt from "prompt"; const projectRoot = path.resolve(__dirname, ".."); const exampleDir = path.resolve(projectRoot, "examples/render/input"); diff --git a/scripts/debug-term.ts b/scripts/debug-term.ts index 9901efa..0819028 100644 --- a/scripts/debug-term.ts +++ b/scripts/debug-term.ts @@ -1,7 +1,7 @@ import { fromMarkdown } from "mdast-util-from-markdown"; import { inspect } from "node:util"; -import { lumaTerm } from "../src/luma-term/micromark-extension"; -import { lumaTermFromMarkdown } from "../src/luma-term/from-markdown-extension"; +import { lumaTerm } from "../src/luma-term/micromark-extension.js"; +import { lumaTermFromMarkdown } from "../src/luma-term/from-markdown-extension.js"; const buf = ` # Hello diff --git a/src/lib/__tests__/to-slug.spec.ts b/src/lib/__tests__/to-slug.spec.ts index 35aec36..455dc54 100644 --- a/src/lib/__tests__/to-slug.spec.ts +++ b/src/lib/__tests__/to-slug.spec.ts @@ -1,4 +1,4 @@ -import { toSlug } from "../to-slug"; +import { toSlug } from "../to-slug.js"; import { describe, expect, it } from "vitest"; describe("toSlug", () => { diff --git a/src/lib/term/__tests__/detect.spec.ts b/src/lib/term/__tests__/detect.spec.ts index 584a30f..eda1994 100644 --- a/src/lib/term/__tests__/detect.spec.ts +++ b/src/lib/term/__tests__/detect.spec.ts @@ -1,4 +1,4 @@ -import { extractTerms } from "../detect"; +import { extractTerms } from "../detect.js"; import { describe, expect, it } from "vitest"; describe("extractTerms", () => { diff --git a/src/luma-counter/from-markdown-extension.ts b/src/luma-counter/from-markdown-extension.ts index ae87f5b..9599082 100644 --- a/src/luma-counter/from-markdown-extension.ts +++ b/src/luma-counter/from-markdown-extension.ts @@ -1,4 +1,4 @@ -import { type Extension as FromMarkdownExtension } from "mdast-util-from-markdown"; +import type { Extension as FromMarkdownExtension } from "mdast-util-from-markdown"; export const lumaCounterFromMarkdown: FromMarkdownExtension = { enter: { diff --git a/src/luma-save/from-markdown-extension.ts b/src/luma-save/from-markdown-extension.ts index 3c1c973..bd77d73 100644 --- a/src/luma-save/from-markdown-extension.ts +++ b/src/luma-save/from-markdown-extension.ts @@ -1,4 +1,4 @@ -import { type Extension as FromMarkdownExtension } from "mdast-util-from-markdown"; +import type { Extension as FromMarkdownExtension } from "mdast-util-from-markdown"; export const lumaSaveFromMarkdown: FromMarkdownExtension = { enter: { diff --git a/src/luma-term/from-markdown-extension.ts b/src/luma-term/from-markdown-extension.ts index 642bcbe..7ef1432 100644 --- a/src/luma-term/from-markdown-extension.ts +++ b/src/luma-term/from-markdown-extension.ts @@ -1,5 +1,5 @@ -import { type Extension as FromMarkdownExtension } from "mdast-util-from-markdown"; -import { lumaTermAttributes } from "./constants"; +import type { Extension as FromMarkdownExtension } from "mdast-util-from-markdown"; +import { lumaTermAttributes } from "./constants.js"; export const lumaTermFromMarkdown: FromMarkdownExtension = { enter: { diff --git a/src/rehype-add-slug.ts b/src/rehype-add-slug.ts index 97a9641..115927e 100644 --- a/src/rehype-add-slug.ts +++ b/src/rehype-add-slug.ts @@ -1,8 +1,8 @@ import { toText } from "hast-util-to-text"; -import { toSlug } from "./lib/to-slug"; -import { STEP_OVER, visit } from "./util/visit"; -import { estreeJsonParseOf } from "./util/estree-json-parse-of"; -import { Toc, TocHeading } from "./types"; +import { toSlug } from "./lib/to-slug.js"; +import { STEP_OVER, visit } from "./util/visit.js"; +import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; +import type { Toc, TocHeading } from "./types.js"; import type { ElementContent } from "hast"; type Root = import("hast").Root; diff --git a/src/rehype-clean-internal.ts b/src/rehype-clean-internal.ts index 3f4b30a..7d253fc 100644 --- a/src/rehype-clean-internal.ts +++ b/src/rehype-clean-internal.ts @@ -1,4 +1,4 @@ -import { DELETE, visit } from "./util/visit"; +import { DELETE, visit } from "./util/visit.js"; type Root = import("hast").Root; diff --git a/src/rehype-counter.ts b/src/rehype-counter.ts index db74a67..844c335 100644 --- a/src/rehype-counter.ts +++ b/src/rehype-counter.ts @@ -1,9 +1,9 @@ import { MdxJsxFlowElementHast } from "mdast-util-mdx-jsx"; -import { visit } from "./util/visit"; -import { getAttrByName } from "./util/util-mdast"; -import { estreeJsonParseOf } from "./util/estree-json-parse-of"; -import { lumaCounter } from "./luma-counter/micromark-extension"; -import { lumaCounterFromMarkdown } from "./luma-counter/from-markdown-extension"; +import { visit } from "./util/visit.js"; +import { getAttrByName } from "./util/util-mdast.js"; +import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; +import { lumaCounter } from "./luma-counter/micromark-extension.js"; +import { lumaCounterFromMarkdown } from "./luma-counter/from-markdown-extension.js"; type Root = import("hast").Root; diff --git a/src/rehype-debug.ts b/src/rehype-debug.ts index b7c6346..0c87e74 100644 --- a/src/rehype-debug.ts +++ b/src/rehype-debug.ts @@ -1,4 +1,4 @@ -import { visit, STEP_OVER } from "./util/visit"; +import { visit, STEP_OVER } from "./util/visit.js"; import { inspect } from "node:util"; type Root = import("hast").Root; diff --git a/src/rehype-katex.ts b/src/rehype-katex.ts index a3da225..6fb04dd 100644 --- a/src/rehype-katex.ts +++ b/src/rehype-katex.ts @@ -4,16 +4,16 @@ import type { } from "mdast-util-mdx-jsx"; import type { MdxFlowExpressionHast } from "mdast-util-mdx-expression"; import type { Expression } from "estree"; -import { DELETE, REPLACE, STEP_OVER, visit } from "./util/visit"; +import { DELETE, REPLACE, STEP_OVER, visit } from "./util/visit.js"; import { toText } from "hast-util-to-text"; -import { getAttrByName } from "./util/util-mdast"; -import { estreeDeclareSymbol } from "./util/rehype-katex/estree-declare-symbol"; -import { estreeResetCtx } from "./util/rehype-katex/estree-ctx-reset"; -import { estreeDeleteCtx } from "./util/rehype-katex/estree-ctx-delete"; -import { estreePushCtx } from "./util/rehype-katex/estree-ctx-push"; -import { estreeCtxValue } from "./util/rehype-katex/estree-ctx-value"; +import { getAttrByName } from "./util/util-mdast.js"; +import { estreeDeclareSymbol } from "./util/rehype-katex/estree-declare-symbol.js"; +import { estreeResetCtx } from "./util/rehype-katex/estree-ctx-reset.js"; +import { estreeDeleteCtx } from "./util/rehype-katex/estree-ctx-delete.js"; +import { estreePushCtx } from "./util/rehype-katex/estree-ctx-push.js"; +import { estreeCtxValue } from "./util/rehype-katex/estree-ctx-value.js"; import type { Element } from "hast"; -import { getClasses } from "./util/get-classes"; +import { getClasses } from "./util/get-classes.js"; type Root = import("hast").Root; diff --git a/src/rehype-replace-text.ts b/src/rehype-replace-text.ts index 74f57ca..9e86263 100644 --- a/src/rehype-replace-text.ts +++ b/src/rehype-replace-text.ts @@ -1,5 +1,5 @@ -import { replaceJapanesePunctuation } from "./lib/replace-japanese-punctuation"; -import { visit, STEP_OVER } from "./util/visit"; +import { replaceJapanesePunctuation } from "./lib/replace-japanese-punctuation.js"; +import { visit, STEP_OVER } from "./util/visit.js"; type Root = import("hast").Root; diff --git a/src/rehype-save.ts b/src/rehype-save.ts index d2ca3cb..e6e1a64 100644 --- a/src/rehype-save.ts +++ b/src/rehype-save.ts @@ -1,11 +1,11 @@ -import { lumaSave } from "./luma-save/micromark-extension"; +import { lumaSave } from "./luma-save/micromark-extension.js"; import type { MdxJsxFlowElement, MdxJsxFlowElementHast, } from "mdast-util-mdx-jsx"; -import { lumaSaveFromMarkdown } from "./luma-save/from-markdown-extension"; -import { DELETE, REPLACE, STEP_OVER, visit } from "./util/visit"; -import { estreeJsonParseOf } from "./util/estree-json-parse-of"; +import { lumaSaveFromMarkdown } from "./luma-save/from-markdown-extension.js"; +import { DELETE, REPLACE, STEP_OVER, visit } from "./util/visit.js"; +import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; type Root = import("hast").Root; diff --git a/src/rehype-wrap.ts b/src/rehype-wrap.ts index 68ae638..97ab8c9 100644 --- a/src/rehype-wrap.ts +++ b/src/rehype-wrap.ts @@ -1,7 +1,7 @@ -import { EXIT, visit } from "./util/visit"; +import { EXIT, visit } from "./util/visit.js"; import type { MdxJsxFlowElement } from "mdast-util-mdx-jsx"; -import { getAttrByName } from "./util/util-mdast"; -import { estreeJsonParseOf } from "./util/estree-json-parse-of"; +import { getAttrByName } from "./util/util-mdast.js"; +import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; type Root = import("hast").Root; diff --git a/src/remark-debug.ts b/src/remark-debug.ts index 0d83448..ae5e8e2 100644 --- a/src/remark-debug.ts +++ b/src/remark-debug.ts @@ -1,4 +1,4 @@ -import { visit, STEP_OVER } from "./util/visit"; +import { visit, STEP_OVER } from "./util/visit.js"; import { inspect } from "node:util"; type Root = import("mdast").Root; diff --git a/src/remark-meta.ts b/src/remark-meta.ts index 9b575fc..a0cbfc5 100644 --- a/src/remark-meta.ts +++ b/src/remark-meta.ts @@ -1,5 +1,5 @@ -import { getMdastMeta } from "./util/util-mdast-meta"; -import { estreeJsonParseOf } from "./util/estree-json-parse-of"; +import { getMdastMeta } from "./util/util-mdast-meta.js"; +import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; type Root = import("mdast").Root; diff --git a/src/remark-term.ts b/src/remark-term.ts index 73e1150..5dc5be0 100644 --- a/src/remark-term.ts +++ b/src/remark-term.ts @@ -1,13 +1,13 @@ import type { MdxJsxFlowElement } from "mdast-util-mdx-jsx"; -import { lumaTerm } from "./luma-term/micromark-extension"; -import { lumaTermFromMarkdown } from "./luma-term/from-markdown-extension"; -import { getMdastMeta } from "./util/util-mdast-meta"; -import { mapIntersection } from "./lib/map-util"; -import { setAttr, getAttrByName } from "./util/util-mdast"; -import { lumaTermAttributes } from "./luma-term/constants"; -import { STEP_OVER, visit } from "./util/visit"; -import { estreeJsonParseOf } from "./util/estree-json-parse-of"; +import { lumaTerm } from "./luma-term/micromark-extension.js"; +import { lumaTermFromMarkdown } from "./luma-term/from-markdown-extension.js"; +import { getMdastMeta } from "./util/util-mdast-meta.js"; +import { mapIntersection } from "./lib/map-util.js"; +import { setAttr, getAttrByName } from "./util/util-mdast.js"; +import { lumaTermAttributes } from "./luma-term/constants.js"; +import { STEP_OVER, visit } from "./util/visit.js"; +import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; type Root = import("mdast").Root; diff --git a/src/util/estree-json-parse-of.ts b/src/util/estree-json-parse-of.ts index 79aa157..d24a56d 100644 --- a/src/util/estree-json-parse-of.ts +++ b/src/util/estree-json-parse-of.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreeJsonParseOf = (value: unknown): Program => { return { diff --git a/src/util/rehype-katex/estree-ctx-delete.ts b/src/util/rehype-katex/estree-ctx-delete.ts index 395c0e2..574ab5d 100644 --- a/src/util/rehype-katex/estree-ctx-delete.ts +++ b/src/util/rehype-katex/estree-ctx-delete.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreeDeleteCtx = (varName: string): Program => { return { diff --git a/src/util/rehype-katex/estree-ctx-push-const.ts b/src/util/rehype-katex/estree-ctx-push-const.ts index 484747d..130088e 100644 --- a/src/util/rehype-katex/estree-ctx-push-const.ts +++ b/src/util/rehype-katex/estree-ctx-push-const.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreePushCtxConst = (varName: string, v: string): Program => { return { diff --git a/src/util/rehype-katex/estree-ctx-push.ts b/src/util/rehype-katex/estree-ctx-push.ts index c856971..4ff0c58 100644 --- a/src/util/rehype-katex/estree-ctx-push.ts +++ b/src/util/rehype-katex/estree-ctx-push.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; import type { Expression } from "estree"; export const estreePushCtx = (varName: string, expr: Expression): Program => { diff --git a/src/util/rehype-katex/estree-ctx-reset.ts b/src/util/rehype-katex/estree-ctx-reset.ts index 81a4362..1467091 100644 --- a/src/util/rehype-katex/estree-ctx-reset.ts +++ b/src/util/rehype-katex/estree-ctx-reset.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreeResetCtx = (varName: string): Program => { return { diff --git a/src/util/rehype-katex/estree-ctx-value.ts b/src/util/rehype-katex/estree-ctx-value.ts index fca1620..9d89048 100644 --- a/src/util/rehype-katex/estree-ctx-value.ts +++ b/src/util/rehype-katex/estree-ctx-value.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreeCtxValue = (varName: string): Program => { return { diff --git a/src/util/rehype-katex/estree-declare-symbol.ts b/src/util/rehype-katex/estree-declare-symbol.ts index 0d57685..5db9d26 100644 --- a/src/util/rehype-katex/estree-declare-symbol.ts +++ b/src/util/rehype-katex/estree-declare-symbol.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreeDeclareSymbol = (varName: string): Program => { return { diff --git a/src/util/rehype-katex/estree-var.ts b/src/util/rehype-katex/estree-var.ts index 29cae21..5bc2a11 100644 --- a/src/util/rehype-katex/estree-var.ts +++ b/src/util/rehype-katex/estree-var.ts @@ -1,4 +1,4 @@ -import type { Program } from "@mdx-js/mdx/lib/core"; +import type { Program } from "estree"; export const estreeVar = (varName: string): Program => { return { diff --git a/src/util/util-mdast-meta.ts b/src/util/util-mdast-meta.ts index 2443ebb..18f1f1b 100644 --- a/src/util/util-mdast-meta.ts +++ b/src/util/util-mdast-meta.ts @@ -1,4 +1,4 @@ -import { visit, STEP_OVER } from "./visit"; +import { visit, STEP_OVER } from "./visit.js"; import type { Node } from "unist"; import * as YAML from "yaml"; diff --git a/tsconfig.json b/tsconfig.json index d327041..046854f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "strict": true, - "module": "ESNext", - "moduleResolution": "Node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "skipLibCheck": true, "target": "ES2022", "outDir": "dist",