mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-02-06 05:51:47 +01:00
Replace browserify/uglify-js with webpack, shrink markdownlint-browser.js (fixes #362).
This commit is contained in:
parent
202b50060b
commit
369b0b5934
10 changed files with 844 additions and 3271 deletions
|
|
@ -35,6 +35,7 @@
|
|||
</div>
|
||||
<script src="markdown-it.min.js"></script>
|
||||
<script src="markdownlint-browser.min.js"></script>
|
||||
<script src="markdownlint-rule-helpers-browser.min.js"></script>
|
||||
<script src="default.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@
|
|||
case "#fix":
|
||||
var error = JSON.parse(decodeURIComponent(e.target.target));
|
||||
var errors = [ error ];
|
||||
var fixed = window.helpers.applyFixes(markdown.value, errors);
|
||||
var fixed =
|
||||
window.markdownlintRuleHelpers.applyFixes(markdown.value, errors);
|
||||
markdown.value = fixed;
|
||||
onMarkdownInput();
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
/* markdownlint - https://github.com/DavidAnson/markdownlint - @license MIT */
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
// Alias "markdown-it" (expected) to "markdownit" (exported)
|
||||
module.exports = window.markdownit;
|
||||
if (!module.exports) {
|
||||
console.error("markdown-it must be loaded before markdownlint.");
|
||||
}
|
||||
|
||||
// Stub missing implementation of util.promisify (unused here)
|
||||
// eslint-disable-next-line unicorn/import-style
|
||||
var util = require("util");
|
||||
if (!util.promisify) {
|
||||
util.promisify = function promisify(fn) {
|
||||
return fn;
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
67
demo/webpack.config.js
Normal file
67
demo/webpack.config.js
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const webpack = require("webpack");
|
||||
|
||||
function config(options) {
|
||||
const { entry, filename, mode, packageJson } = options;
|
||||
const { name, version, homepage, license } = packageJson;
|
||||
return {
|
||||
"devtool": false,
|
||||
"entry": entry,
|
||||
"externals": {
|
||||
"markdown-it": "markdownit"
|
||||
},
|
||||
"mode": mode,
|
||||
"name": name,
|
||||
"output": {
|
||||
"filename": filename,
|
||||
"library": name.replace(/(-\w)/g, (m) => m.slice(1).toUpperCase()),
|
||||
"path": __dirname
|
||||
},
|
||||
"plugins": [
|
||||
new webpack.BannerPlugin({
|
||||
"banner": `${name} ${version} ${homepage} @license ${license}`
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
"process.env.NODE_DEBUG": false
|
||||
})
|
||||
],
|
||||
"resolve": {
|
||||
"fallback": {
|
||||
"fs": false,
|
||||
"os": false,
|
||||
"path": false,
|
||||
"util": false
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
config({
|
||||
"entry": "../lib-es3/lib/markdownlint.js",
|
||||
"filename": "markdownlint-browser.js",
|
||||
"mode": "development",
|
||||
"packageJson": require("../package.json")
|
||||
}),
|
||||
config({
|
||||
"entry": "../lib-es3/lib/markdownlint.js",
|
||||
"filename": "markdownlint-browser.min.js",
|
||||
"mode": "production",
|
||||
"packageJson": require("../package.json")
|
||||
}),
|
||||
config({
|
||||
"entry": "../lib-es3/helpers/helpers.js",
|
||||
"filename": "markdownlint-rule-helpers-browser.js",
|
||||
"mode": "development",
|
||||
"packageJson": require("../helpers/package.json")
|
||||
}),
|
||||
config({
|
||||
"entry": "../lib-es3/helpers/helpers.js",
|
||||
"filename": "markdownlint-rule-helpers-browser.min.js",
|
||||
"mode": "production",
|
||||
"packageJson": require("../helpers/package.json")
|
||||
})
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue