remark-loader
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = loader; | ||
var _frontMatter = _interopRequireDefault(require("front-matter")); | ||
var _options = _interopRequireDefault(require("./options.json")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
async function loader(content) { | ||
@@ -20,3 +16,2 @@ const options = this.getOptions(_options.default); | ||
let remark; | ||
try { | ||
@@ -30,5 +25,3 @@ ({ | ||
} | ||
const processor = remark(); | ||
if (typeof remarkOptions.plugins !== "undefined") { | ||
@@ -44,3 +37,2 @@ for (const item of remarkOptions.plugins) { | ||
} | ||
if (typeof remarkOptions.settings !== "undefined") { | ||
@@ -51,19 +43,14 @@ processor.use({ | ||
} | ||
if (typeof remarkOptions.data !== "undefined") { | ||
processor.data(remarkOptions.data); | ||
} | ||
const removeFrontMatter = typeof options.removeFrontMatter !== "undefined" ? options.removeFrontMatter : true; | ||
let file; | ||
try { | ||
file = await processor.process(removeFrontMatter ? (0, _frontMatter.default)(content).body : content); | ||
} catch (error) { | ||
const Report = (await import("vfile-reporter")).default; | ||
callback(Report(error)); | ||
callback(error); | ||
return; | ||
} | ||
callback(null, String(file)); | ||
} |
{ | ||
"name": "remark-loader", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Load markdown through remark with some react-specific features.", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 14.15.0" | ||
"node": ">= 18.12.0" | ||
}, | ||
@@ -26,5 +26,9 @@ "scripts": { | ||
"security": "npm audit --production", | ||
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different", | ||
"lint:prettier": "prettier --cache --list-different .", | ||
"lint:js": "eslint --cache .", | ||
"lint:spelling": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", | ||
"lint": "npm-run-all -l -p \"lint:**\"", | ||
"fix:js": "npm run lint:js -- --fix", | ||
"fix:prettier": "npm run lint:prettier -- --write", | ||
"fix": "npm-run-all -l fix:js fix:prettier", | ||
"test:only": "cross-env NODE_OPTIONS='--loader ./node_modules/ts-node/esm.mjs' jest", | ||
@@ -46,36 +50,36 @@ "test:watch": "npm run test:only -- --watch", | ||
"dependencies": { | ||
"front-matter": "^4.0.2", | ||
"vfile-reporter": "^7.0.2" | ||
"front-matter": "^4.0.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.14.5", | ||
"@babel/core": "^7.14.6", | ||
"@babel/eslint-parser": "^7.15.8", | ||
"@babel/preset-env": "^7.14.7", | ||
"@commitlint/cli": "^17.0.2", | ||
"@commitlint/config-conventional": "^17.0.2", | ||
"@babel/cli": "^7.23.4", | ||
"@babel/core": "^7.23.7", | ||
"@babel/eslint-parser": "^7.23.3", | ||
"@babel/preset-env": "^7.23.8", | ||
"@commitlint/cli": "^18.4.4", | ||
"@commitlint/config-conventional": "^18.4.4", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-jest": "^28.1.0", | ||
"babel-jest": "^29.7.0", | ||
"cross-env": "^7.0.3", | ||
"del": "^6.0.0", | ||
"del-cli": "^4.0.1", | ||
"eslint": "^8.0.1", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.23.4", | ||
"html-loader": "^3.0.0", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.0", | ||
"jest-light-runner": "^0.2.1", | ||
"lint-staged": "^13.0.0", | ||
"memfs": "^3.2.2", | ||
"cspell": "^8.3.2", | ||
"del": "^7.1.0", | ||
"del-cli": "^5.1.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"html-loader": "^5.0.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"jest-light-runner": "^0.6.0", | ||
"lint-staged": "^15.2.0", | ||
"memfs": "^4.6.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.3.2", | ||
"remark": "^14.0.1", | ||
"prettier": "^3.2.4", | ||
"remark": "^15.0.1", | ||
"remark-bookmarks": "^3.0.0", | ||
"remark-frontmatter": "^4.0.0", | ||
"remark-gfm": "^3.0.0", | ||
"remark-html": "^15.0.0", | ||
"remark-frontmatter": "^5.0.0", | ||
"remark-gfm": "^4.0.0", | ||
"remark-html": "^16.0.1", | ||
"standard-version": "^9.3.1", | ||
"ts-node": "^10.8.0", | ||
"webpack": "^5.45.1" | ||
"ts-node": "^10.9.2", | ||
"webpack": "^5.89.0" | ||
}, | ||
@@ -82,0 +86,0 @@ "keywords": [ |
@@ -11,3 +11,3 @@ <div align="center"> | ||
[![cover][cover]][cover-url] | ||
[![chat][chat]][chat-url] | ||
[![discussion][discussion]][discussion-url] | ||
[![size][size]][size-url] | ||
@@ -398,5 +398,5 @@ | ||
[cover-url]: https://codecov.io/gh/webpack-contrib/remark-loader | ||
[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg | ||
[chat-url]: https://gitter.im/webpack/webpack | ||
[discussion]: https://img.shields.io/github/discussions/webpack/webpack | ||
[discussion-url]: https://github.com/webpack/webpack/discussions | ||
[size]: https://packagephobia.now.sh/badge?p=remark-loader | ||
[size-url]: https://packagephobia.now.sh/result?p=remark-loader |
14774
3
31
87
- Removedvfile-reporter@^7.0.2
- Removed@types/supports-color@8.1.3(transitive)
- Removedansi-regex@6.1.0(transitive)
- Removedeastasianwidth@0.2.0(transitive)
- Removedemoji-regex@9.2.2(transitive)
- Removedstring-width@5.1.2(transitive)
- Removedstrip-ansi@7.1.0(transitive)
- Removedsupports-color@9.4.0(transitive)
- Removedvfile-reporter@7.0.5(transitive)
- Removedvfile-sort@3.0.1(transitive)
- Removedvfile-statistics@2.0.1(transitive)