Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
run: npm i -g npm

- name: Install dependencies
run: npm ci
run: npm ci --force

- name: Install webpack ${{ matrix.webpack-version }}
run: npm i webpack@${{ matrix.webpack-version }}
Expand Down
25,758 changes: 21,253 additions & 4,505 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"pretest": "npm run lint",
"test": "npm run test:coverage",
"prepare": "npm run build",
"release": "standard-version",
"defaults": "webpack-defaults"
"release": "standard-version"
},
"files": [
"dist"
Expand All @@ -53,7 +52,6 @@
"@babel/preset-env": "^7.12.1",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^26.6.1",
"babel-loader": "^8.1.0",
Expand All @@ -69,16 +67,17 @@
"lint-staged": "^10.5.0",
"lodash": "^4.17.20",
"memfs": "^3.2.0",
"mini-css-extract-plugin": "^1.2.1",
"mini-css-extract-plugin": "^1.6.0",
"nodemon": "^2.0.6",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.14",
"postcss-font-magician": "^3.0.0",
"postcss-loader": "^5.2.0",
"prettier": "^2.1.2",
"sass": "^1.27.0",
"sass-loader": "^11.0.1",
"standard-version": "^9.0.0",
"webpack": "^5.3.0",
"webpack-cli": "^4.1.0",
"webpack-defaults": "^4.0.0"
"webpack": "^5.3.0"
},
"keywords": [
"webpack"
Expand Down
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ function pitch() {
},
(err, r) => {
if (r) {
r.buildDependencies.forEach((d) => this.addBuildDependency(d));
r.fileDependencies.forEach((d) => this.addDependency(d));
r.contextDependencies.forEach((d) => this.addContextDependency(d));
r.missingDependencies.forEach((d) => this.addMissingDependency(d));
r.buildDependencies.forEach((d) =>
// Compatibility with webpack v4
this.addBuildDependency
? this.addBuildDependency(d)
: this.addDependency(d)
);
}

if (err) {
Expand Down
6 changes: 5 additions & 1 deletion src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
});
nextQuestionId += 1;
};

const buildDependencies = [];

loaderRunner.runLoaders(
{
loaders: data.loaders,
Expand Down Expand Up @@ -252,6 +254,7 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
cacheable,
fileDependencies,
contextDependencies,
missingDependencies,
} = lrResult;
const buffersToSend = [];
const convertedResult =
Expand Down Expand Up @@ -283,9 +286,10 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
result: {
result: convertedResult,
cacheable,
buildDependencies,
fileDependencies,
contextDependencies,
missingDependencies,
buildDependencies,
},
data: buffersToSend.map((buffer) => buffer.length),
});
Expand Down
1 change: 1 addition & 0 deletions test/pitch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const runGetPoolMock = (error) => {
run: jest.fn((opts, cb) => {
cb(error, {
buildDependencies: [],
missingDependencies: [],
fileDependencies: [],
contextDependencies: [],
result: {},
Expand Down
72 changes: 71 additions & 1 deletion test/sass-loader-example/package-lock.json

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

3 changes: 3 additions & 0 deletions test/sass-loader-example/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: ['postcss-font-magician'],
};
14 changes: 13 additions & 1 deletion test/sass-loader-example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = (env) => {
};
if (+env.threads > 0) {
threadLoader.warmup(workerPool, ['babel-loader', 'babel-preset-env']);
threadLoader.warmup(workerPoolSass, ['sass-loader', 'css-loader']);
threadLoader.warmup(workerPoolSass, [
'sass-loader',
'postcss-loader',
'css-loader',
]);
}
return {
mode: 'none',
Expand Down Expand Up @@ -53,6 +57,14 @@ module.exports = (env) => {
options: workerPoolSass,
},
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
config: path.resolve(__dirname, './postcss.config.js'),
},
},
},
{ loader: 'sass-loader', options: sassLoaderOptions },
].filter(Boolean),
},
Expand Down