Skip to content

Commit

Permalink
use this.getOptions instead of the one loader-utils provides
Browse files Browse the repository at this point in the history
this commit deprecates webpack 4
  • Loading branch information
hmsk committed Apr 12, 2022
1 parent b0e97e8 commit 29e0e27
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 112 deletions.
51 changes: 0 additions & 51 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const loaderUtils = require('loader-utils')
const frontmatter = require('front-matter')
const Mode = require('./mode')
const markdownIt = require('markdown-it');
Expand Down Expand Up @@ -36,7 +35,7 @@ function getNormalizedMarkdownCompiler (options, isReactEnabled) {
module.exports = function (source) {
if (this.cacheable) this.cacheable();

const options = loaderUtils.getOptions(this);
const options = this.getOptions();
const requestedMode = Array.isArray(options.mode) ? options.mode : [Mode.HTML];
const enabled = (mode) => requestedMode.includes(mode);

Expand Down
54 changes: 3 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"homepage": "https://github.com/hmsk/frontmatter-markdown-loader#readme",
"dependencies": {
"front-matter": "^4.0.0",
"loader-utils": "^2.0.0",
"markdown-it": "^12.0.0"
},
"devDependencies": {
Expand Down
15 changes: 8 additions & 7 deletions test/frontmatter-markdown-loader.test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { mount, createLocalVue } from "@vue/test-utils";
import reactRenderer from 'react-test-renderer';
import React from 'react';
import { createLocalVue, mount } from "@vue/test-utils";
import fs from "fs";
import path from "path";

import markdownIt from "markdown-it";
import nodeEval from "node-eval";

import path from "path";
import React from 'react';
import reactRenderer from 'react-test-renderer';
import Loader from "../index";
import Mode from "../mode";
import ChildComponent from "./child-component";
import CodeConfusing from "./code-confusing";



let loaded;

const defaultContext = {
cachable: false,
resourcePath: "/somewhere/frontmatter.md"
resourcePath: "/somewhere/frontmatter.md",
getOptions() { return this.query || {} }
};

const load = (source, context = defaultContext) => {
Expand Down

0 comments on commit 29e0e27

Please sign in to comment.