-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(package): remove node-sass
(peerDependencies
)
#533
Changes from all commits
a810cbd
2319c4e
349cda4
434f1e8
71d76be
751fc13
6621317
c874993
e72287e
0618fbd
d2dae27
9efb591
33ee227
82acdca
96d0730
1a6b8cc
2df1529
dd0d28b
288b272
2cb77d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
"use strict"; | ||
|
||
const sass = require("node-sass"); | ||
const path = require("path"); | ||
const async = require("neo-async"); | ||
const formatSassError = require("./formatSassError"); | ||
|
@@ -12,7 +11,7 @@ const pify = require("pify"); | |
// fs tasks when running the custom importer code. | ||
// This can be removed as soon as node-sass implements a fix for this. | ||
const threadPoolSize = process.env.UV_THREADPOOL_SIZE || 4; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let move this variables before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. I should've thought of this. 😝 |
||
const asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1); | ||
let asyncSassJobQueue = null; | ||
|
||
/** | ||
* The sass-loader makes node-sass available to webpack modules. | ||
|
@@ -21,6 +20,28 @@ const asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1); | |
* @param {string} content | ||
*/ | ||
function sassLoader(content) { | ||
if (asyncSassJobQueue === null) { | ||
let sass; | ||
let sassVersion; | ||
|
||
try { | ||
sass = require("node-sass"); | ||
sassVersion = /^(\d+)/.exec(require("node-sass/package.json").version).pop(); | ||
} catch (e) { | ||
throw new Error( | ||
"`sass-loader` requires `node-sass` >=4. Please install a compatible version." | ||
); | ||
} | ||
|
||
if (Number(sassVersion) < 4) { | ||
throw new Error( | ||
"The installed version of `node-sass` is not compatible (expected: >= 4, actual: " + sassVersion + ")." | ||
); | ||
} | ||
|
||
asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1); | ||
} | ||
|
||
const callback = this.async(); | ||
const isSync = typeof callback !== "function"; | ||
const self = this; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
"eslint-plugin-jsdoc": "^2.4.0", | ||
"file-loader": "^0.11.2", | ||
"mocha": "^3.0.2", | ||
"mock-require": "^3.0.1", | ||
"node-sass": "^4.5.0", | ||
"nyc": "^11.0.2", | ||
"raw-loader": "^0.5.1", | ||
|
@@ -54,7 +55,6 @@ | |
"node": ">= 6.9.0 || >= 8.9.0" | ||
}, | ||
"peerDependencies": { | ||
"node-sass": "^4.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah! Thank you. Didn't know you could use either. |
||
"webpack": "^3.0.0 || ^4.0.0" | ||
}, | ||
"keywords": [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we return old values and add more tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @Timer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, you want me to reduce target test coverage and add then add more tests?
I increased the values here, I did not decrease them -- the tests I added provided more coverage than previously available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Timer oh sorry, all looks good 👍