Skip to content

Commit

Permalink
Remove loader-utils, schema-utils dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ogonkov committed Oct 30, 2020
1 parent 4009457 commit fb8d19d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"version": "2.3.0",
"description": "Webpack loader for fest",
"main": "es/loader.js",
"dependencies": {
"loader-utils": "^2.0.0",
"schema-utils": "^3.0.0"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.11.5",
"@babel/core": "^7.11.5",
Expand Down
9 changes: 2 additions & 7 deletions src/loader.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {getOptions} from 'loader-utils';
import {validate as validateOptions} from 'schema-utils';
import fest from 'fest';

import {getDependencies} from './get-dependencies';

const schema = {
title: 'Fest Loader options',
type: 'object',
properties: {
beautify: {
Expand Down Expand Up @@ -64,11 +63,7 @@ export default function festLoader(source) {

let options;
try {
options = getOptions(this);
validateOptions(schema, options, {
name: 'Fest Loader',
baseDataPath: 'options'
});
options = this.getOptions(schema);
} catch (e) {
callback(e);

Expand Down
7 changes: 2 additions & 5 deletions test/get-loader-context.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
export function getLoaderContext(resourcePath, options = {}) {
const callback = jest.fn().mockName('loaderContext.callback');
const query = Object.entries(options).map(([key, value]) => {
return `${key}=${value}`;
}, '').join('&');
const context = {
query: `?${query}`,
resourcePath,
async: jest.fn().mockReturnValue(callback),
addDependency: jest.fn().mockName('loaderContext.addDependency'),
emitWarning: jest.fn().mockName('loaderContext.emitWarning')
emitWarning: jest.fn().mockName('loaderContext.emitWarning'),
getOptions: jest.fn().mockName('loaderContext.getOptions').mockReturnValue(options)
};
const result = new Promise(function(resolve, reject) {
callback.mockImplementation(function(error, result) {
Expand Down

0 comments on commit fb8d19d

Please sign in to comment.