Skip to content

Commit cc81af1

Browse files
refactor: stuff (#903)
1 parent e9ce745 commit cc81af1

13 files changed

+28
-36
lines changed

src/index.js

-8
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,6 @@ export default function loader(content, map, meta) {
151151
.warnings()
152152
.forEach((warning) => this.emitWarning(new Warning(warning)));
153153

154-
if (result.map) {
155-
const newMap = result.map.toJSON();
156-
157-
console.log(newMap.file);
158-
console.log(newMap.sourceRoot);
159-
console.log(newMap.sources);
160-
}
161-
162154
const messages = result.messages || [];
163155

164156
// Run other loader (`postcss-loader`, `sass-loader` and etc) for importing CSS

test/camelCase-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { webpack, evaluated } = require('./helpers');
1+
import { webpack, evaluated } from './helpers';
22

33
describe('camelCase option', () => {
44
it('true', async () => {

test/errors.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const loader = require('../src/cjs');
1+
import loader from '../src/cjs';
22

33
it('validation', () => {
44
const validate = (options) =>

test/getLocalIdent-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const path = require('path');
1+
import path from 'path';
22

33
const { webpack, evaluated } = require('./helpers');
44

test/helpers.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const vm = require('vm');
2-
const path = require('path');
1+
import vm from 'vm';
2+
import path from 'path';
33

4-
const del = require('del');
5-
const webpack = require('webpack');
6-
const MemoryFS = require('memory-fs');
7-
const stripAnsi = require('strip-ansi');
8-
const normalizePath = require('normalize-path');
4+
import del from 'del';
5+
import webpack from 'webpack';
6+
import MemoryFS from 'memory-fs';
7+
import stripAnsi from 'strip-ansi';
8+
import normalizePath from 'normalize-path';
99

1010
function evaluated(output, modules, moduleId = 1) {
1111
let m;

test/icss.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const path = require('path');
2-
const fs = require('fs');
1+
import path from 'path';
2+
import fs from 'fs';
33

4-
const { webpack, evaluated } = require('./helpers');
4+
import { webpack, evaluated } from './helpers';
55

66
const testCasesPath = path.join(__dirname, 'fixtures/icss/tests-cases');
77
const testCases = fs.readdirSync(testCasesPath);

test/import-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { webpack, evaluated, normalizeErrors } = require('./helpers');
1+
import { webpack, evaluated, normalizeErrors } from './helpers';
22

33
describe('import option', () => {
44
it('true', async () => {

test/importLoaders-option.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const postcssPresetEnv = require('postcss-preset-env');
1+
import postcssPresetEnv from 'postcss-preset-env';
22

3-
const { webpack, evaluated } = require('./helpers');
3+
import { webpack, evaluated } from './helpers';
44

55
describe('importLoaders option', () => {
66
it('not specify (no loader before)', async () => {

test/loader.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const path = require('path');
1+
import path from 'path';
22

3-
const postcssPresetEnv = require('postcss-preset-env');
3+
import postcssPresetEnv from 'postcss-preset-env';
44

5-
const { webpack, evaluated, normalizeErrors } = require('./helpers');
5+
import { webpack, evaluated, normalizeErrors } from './helpers';
66

77
describe('loader', () => {
88
it('should compile with `js` entry point', async () => {

test/localIdentName-option.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const path = require('path');
1+
import path from 'path';
22

3-
const { webpack, evaluated } = require('./helpers');
3+
import { webpack, evaluated } from './helpers';
44

55
describe('localIdentName option', () => {
66
it('basic', async () => {

test/modules-option.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const path = require('path');
2-
const fs = require('fs');
1+
import path from 'path';
2+
import fs from 'fs';
33

4-
const { webpack, evaluated } = require('./helpers');
4+
import { webpack, evaluated } from './helpers';
55

66
const testCasesPath = path.join(__dirname, 'fixtures/modules/tests-cases');
77
const testCases = fs.readdirSync(testCasesPath);

test/sourceMap-option.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
const path = require('path');
1+
import path from 'path';
22

3-
const postcssPresetEnv = require('postcss-preset-env');
3+
import postcssPresetEnv from 'postcss-preset-env';
44

5-
const { webpack, evaluated, normalizeSourceMap } = require('./helpers');
5+
import { webpack, evaluated, normalizeSourceMap } from './helpers';
66

77
describe('sourceMap option', () => {
88
describe('true', () => {

test/url-option.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { webpack, evaluated, normalizeErrors } = require('./helpers');
1+
import { webpack, evaluated, normalizeErrors } from './helpers';
22

33
describe('url option', () => {
44
it('true', async () => {

0 commit comments

Comments
 (0)