diff --git a/next.config.js b/next.config.js index f6bcbefb..dec8d443 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,6 @@ const bsconfig = require('./bsconfig.json'); -const transpileModules = ["bs-platform"].concat(bsconfig["bs-dependencies"]); +const transpileModules = ["bs-platform", "mdast-util-to-string"].concat(bsconfig["bs-dependencies"]); const withTM = require("next-transpile-modules")(transpileModules); const config = { @@ -13,6 +13,9 @@ const config = { fs: false } } + config.experiments = { + topLevelAwait: true, + } return config }, // Might need to move this to nginx or other config, diff --git a/package.json b/package.json index 3e5db627..ed563f9f 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "gray-matter": "^4.0.3", "http-server": "^0.12.3", "js-yaml": "^4.1.0", - "mdast-util-to-string": "^2.0.0", + "mdast-util-to-string": "^3.1.0", "next-transpile-modules": "^7.1.0", "rehype-highlight": "^4.1.0", "rehype-stringify": "^8.0.0", diff --git a/src/Unified.res b/src/Unified.res index 8bb3d341..f95f08ea 100644 --- a/src/Unified.res +++ b/src/Unified.res @@ -1,3 +1,7 @@ +%%raw(` +const MdastUtilToStringInternal = (await import('mdast-util-to-string')).toString +`) + module MarkdownTableOfContents = { type rec toc = { label: string, @@ -46,5 +50,5 @@ type attacher = unit => transformer @module("rehype-highlight") external rehypeHighlight: attacher = "default" module MdastUtilToString = { - @module("mdast-util-to-string") external toString: headingnode => string = "default" + @val external toString: headingnode => string = "MdastUtilToStringInternal" } diff --git a/yarn.lock b/yarn.lock index 9ec92156..dd95b14e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1838,6 +1838,11 @@ mdast-util-to-string@^2.0.0: resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-2.0.0.tgz#b8cfe6a713e1091cb5b728fc48885a4767f8b97b" integrity sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w== +mdast-util-to-string@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-3.1.0.tgz#56c506d065fbf769515235e577b5a261552d56e9" + integrity sha512-n4Vypz/DZgwo0iMHLQL49dJzlp7YtAJP+N07MZHpjPf/5XJuHUWstviF4Mn2jEiR/GNmtnRRqnwsXExk3igfFA== + mdurl@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"