From a585896446ccab36ed61134118685009c9913cfc Mon Sep 17 00:00:00 2001 From: Dmitry Sharabin Date: Wed, 10 Jun 2026 19:28:58 +0200 Subject: [PATCH] Load markdown-it as a local dependency instead of from a CDN The markdown plugin imported markdown-it from esm.sh at runtime, which kept timing out. Add it as a dependency and import it by bare specifier so it resolves through the import map / bundler. Relies on the static plugin loaders (base branch) so tooling traces markdown-it into the import map. Co-Authored-By: Claude Opus 4.8 (1M context) --- markdown/plugin.js | 3 +- package-lock.json | 120 ++++++++++++++++++++++++++++++++++++++++++++- package.json | 3 ++ 3 files changed, 123 insertions(+), 3 deletions(-) diff --git a/markdown/plugin.js b/markdown/plugin.js index bd92700..c81b8a5 100644 --- a/markdown/plugin.js +++ b/markdown/plugin.js @@ -1,4 +1,5 @@ import { $$ } from "@inspirejs/core/util"; +import markdownit from "markdown-it"; export const hasCSS = false; @@ -13,8 +14,6 @@ if (elements.length === 0) { }); } -let { default: markdownit } = await import("https://esm.sh/markdown-it@14"); - let md = new markdownit("commonmark", { html: true, typographer: true, diff --git a/package-lock.json b/package-lock.json index 981d470..a698b88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "@inspirejs/plugins", "version": "3.0.2", "license": "MIT", + "dependencies": { + "markdown-it": "^14" + }, "devDependencies": { "prettier": "^3.8.3", "prettier-plugin-brace-style": "^0.10.1", @@ -363,6 +366,26 @@ } } }, + "node_modules/@inspirejs/core": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@inspirejs/core/-/core-3.0.2.tgz", + "integrity": "sha512-6cqydWAV1yGlNgRewsPmzAK8Ot8c+kJdRMPSGKBh4P+5DwQ18ULJLGYMT/7rdTpVw3eVw6HgXW+pvZp9SwP/8A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/LeaVerou" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/leaverou" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "blissful-hooks": "^0.0" + } + }, "node_modules/@octokit/auth-token": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz", @@ -379,6 +402,7 @@ "integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.3", @@ -574,6 +598,12 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, "node_modules/ast-types": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", @@ -614,6 +644,12 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/blissful-hooks": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/blissful-hooks/-/blissful-hooks-0.0.2.tgz", + "integrity": "sha512-kQ0Ixlf79zdOS8X2hmvtvjYB4EM55tS6leM6MM0CcLZ3wmYKPsSjmnQgrXSOt3nVCjpeIcZWxouYmcn/8jxVnw==", + "license": "MIT" + }, "node_modules/bundle-name": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", @@ -917,6 +953,18 @@ "url": "https://dotenvx.com" } }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/escodegen": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", @@ -1294,6 +1342,25 @@ "dev": true, "license": "MIT" }, + "node_modules/linkify-it": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.1.tgz", + "integrity": "sha512-wVoTjP4Q6R0NW5hiZkVJaFZPWgtXfoGF+6LucL3/FtiNjmcHhYjEr5f1Kqjirc1nBW07J/ZuRFumqr2oqccEWg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, "node_modules/lodash.capitalize": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", @@ -1376,6 +1443,39 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/markdown-it": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.2.0.tgz", + "integrity": "sha512-1TGiQiJVRQ3NPmZH6sx5Cfnmg6GQm9jvC1ch4TK511NjSJvjzKLzn5pPfZRNZkRPZP0HqCioSndqH8v2nRaWVQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.1", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "license": "MIT" + }, "node_modules/mime-db": { "version": "1.54.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", @@ -1656,6 +1756,7 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -1694,6 +1795,7 @@ "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -1794,12 +1896,22 @@ "dev": true, "license": "MIT" }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/quickjs-wasi": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/quickjs-wasi/-/quickjs-wasi-0.0.1.tgz", "integrity": "sha512-fBWNLTBkxkLAhe1AzF1hyXEvuA+N+vV1WMP2D6iiMUblvmOt8Pp5t8zUcgvz7aYA1ldUdxDlgUse15dmcKjkNg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/rc9": { "version": "2.1.2", @@ -2092,6 +2204,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "license": "MIT" + }, "node_modules/undici": { "version": "7.24.5", "resolved": "https://registry.npmjs.org/undici/-/undici-7.24.5.tgz", diff --git a/package.json b/package.json index 8ab6287..bdfc0d7 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,9 @@ "url": "https://github.com/inspire-js/plugins/issues" }, "homepage": "https://inspirejs.org", + "dependencies": { + "markdown-it": "^14" + }, "peerDependencies": { "@inspirejs/core": "^3" },