Skip to content

Commit 29e0e27

Browse files
committed
use this.getOptions instead of the one loader-utils provides
this commit deprecates webpack 4
1 parent b0e97e8 commit 29e0e27

File tree

5 files changed

+12
-112
lines changed

5 files changed

+12
-112
lines changed

example/package-lock.json

Lines changed: 0 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const loaderUtils = require('loader-utils')
21
const frontmatter = require('front-matter')
32
const Mode = require('./mode')
43
const markdownIt = require('markdown-it');
@@ -36,7 +35,7 @@ function getNormalizedMarkdownCompiler (options, isReactEnabled) {
3635
module.exports = function (source) {
3736
if (this.cacheable) this.cacheable();
3837

39-
const options = loaderUtils.getOptions(this);
38+
const options = this.getOptions();
4039
const requestedMode = Array.isArray(options.mode) ? options.mode : [Mode.HTML];
4140
const enabled = (mode) => requestedMode.includes(mode);
4241

package-lock.json

Lines changed: 3 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"homepage": "https://github.com/hmsk/frontmatter-markdown-loader#readme",
3434
"dependencies": {
3535
"front-matter": "^4.0.0",
36-
"loader-utils": "^2.0.0",
3736
"markdown-it": "^12.0.0"
3837
},
3938
"devDependencies": {

test/frontmatter-markdown-loader.test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
import { mount, createLocalVue } from "@vue/test-utils";
2-
import reactRenderer from 'react-test-renderer';
3-
import React from 'react';
1+
import { createLocalVue, mount } from "@vue/test-utils";
42
import fs from "fs";
5-
import path from "path";
6-
73
import markdownIt from "markdown-it";
84
import nodeEval from "node-eval";
9-
5+
import path from "path";
6+
import React from 'react';
7+
import reactRenderer from 'react-test-renderer';
108
import Loader from "../index";
119
import Mode from "../mode";
1210
import ChildComponent from "./child-component";
1311
import CodeConfusing from "./code-confusing";
1412

13+
14+
1515
let loaded;
1616

1717
const defaultContext = {
1818
cachable: false,
19-
resourcePath: "/somewhere/frontmatter.md"
19+
resourcePath: "/somewhere/frontmatter.md",
20+
getOptions() { return this.query || {} }
2021
};
2122

2223
const load = (source, context = defaultContext) => {

0 commit comments

Comments
 (0)