From f8e793786aec3a0758fd2b31e334254eacf0457b Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 7 Feb 2023 21:46:21 -0800 Subject: [PATCH] Update markdownlint-micromark to build scripts for web in addition to Node. --- .eslintrc.json | 2 ++ .gitignore | 2 ++ micromark/webpack.config.js | 62 +++++++++++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b58f6b8e..40d711f0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,8 @@ "example/typescript/type-check.js", "micromark/micromark.cjs", "micromark/micromark.dev.cjs", + "micromark/micromark-browser.js", + "micromark/micromark-browser.dev.js", "test-repos/" ], "overrides": [ diff --git a/.gitignore b/.gitignore index 1870076b..5300aba2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ demo/markdown-it.min.js demo/markdownlint-browser.min.js micromark/micromark.cjs micromark/micromark.dev.cjs +micromark/micromark-browser.js +micromark/micromark-browser.dev.js node_modules !test/node_modules npm-debug.log diff --git a/micromark/webpack.config.js b/micromark/webpack.config.js index 4acbdd98..22138fb9 100644 --- a/micromark/webpack.config.js +++ b/micromark/webpack.config.js @@ -2,33 +2,75 @@ "use strict"; -const shared = { +const base = { "entry": "./exports.mjs", "output": { + "path": __dirname + } +}; + +const commonjs = { + ...base, + "output": { + ...base.output, "library": { "type": "commonjs" - }, - "path": __dirname + } }, "target": "node" }; +const web = { + ...base, + "output": { + ...base.output, + "library": { + "type": "var" + } + }, + "target": "web" +}; + +const production = { + "mode": "production" +}; + +const development = { + "devtool": false, + "mode": "development" +}; + module.exports = [ { - ...shared, - "mode": "production", + ...commonjs, + ...production, "output": { - ...shared.output, + ...commonjs.output, "filename": "micromark.cjs" } }, { - ...shared, - "devtool": false, - "mode": "development", + ...commonjs, + ...development, "output": { - ...shared.output, + ...commonjs.output, "filename": "micromark.dev.cjs" } + }, + { + ...web, + ...production, + "output": { + ...commonjs.output, + "filename": "micromark-browser.js" + } + }, + { + ...web, + ...development, + "output": { + ...commonjs.output, + "filename": "micromark-browser.dev.js" + } } ];