-
Notifications
You must be signed in to change notification settings - Fork 2
v3.1.0 #150
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
base: main
Are you sure you want to change the base?
v3.1.0 #150
Conversation
@@ -21,6 +21,10 @@ let DEFAULTS = { | |||
bucket: "static", | |||
plugin: "faucet-pipeline-static" | |||
}, | |||
assets: { |
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.
I think this file is also the place where we would mark the old name as deprecated.
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.
I'm not currently sure how exactly we'd do that, especially because plugins can override these defaults? I guess we'll have to put on our hazmat suits and wade into the implementation eventually...
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.
Seems reasonable to me, though I've kinda run out of brainspace for the moment; let's conclude faucet-pipeline/faucet-pipeline-static#71 first.
} | ||
|
||
// exported for testing | ||
exports.generateFingerprint = generateFingerprint; |
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.
exports.generateFingerprint = generateFingerprint; | |
exports._generateFingerprint = generateFingerprint; |
That makes it explicit; cf. _determinePlugins
.
|
||
function generateFingerprint(filepath, data) { | ||
let filename = path.basename(filepath); | ||
let ext = filename.indexOf(".") === -1 ? "" : "." + filename.split(".").pop(); |
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.
Why are we not using path.extname
here? (See potentially related discussion for faucet-static
/static-images
.)
(Though we might reasonably opt not to risk changing the implementation here, due to backwards-compatibility concerns.)
exports.generateFingerprint = generateFingerprint; | ||
|
||
function generateHash(str) { | ||
let hash = crypto.createHash("md5"); |
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.
Should we perhaps change this to SHA-256? I realize that might be a backwards-compatibility concern though...
My results suggest that you should probably not be using MD5. MD5 is slower than SHA-256 and not as safe.
let fs = require("fs"); | ||
let path = require("path"); |
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.
Might as well do this while we're at it:
let fs = require("fs"); | |
let path = require("path"); | |
let fs = require("node:fs"); | |
let path = require("node:path"); |
let crypto = require("crypto"); | ||
|
||
exports.abort = abort; | ||
exports.repr = repr; |
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.
FWIW, I had intentionally moved exports to the top (yay hoisting) so you don't have to go searching for them in the middle of random implementation details. 🤷
@@ -21,6 +21,10 @@ let DEFAULTS = { | |||
bucket: "static", | |||
plugin: "faucet-pipeline-static" | |||
}, | |||
assets: { |
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.
I'm not currently sure how exactly we'd do that, especially because plugins can override these defaults? I guess we'll have to put on our hazmat suits and wade into the implementation eventually...
This moves the responsibility to the plugin, where it makes more sense. This also removes the need for browserslist as a dependency in core.
Thanks for the feedback! I plan to incorporate that this week. I worked on two things we discussed in a chat:
|
Clean up utils
Looking into static, I noticed that we use the
utils
less than I thought.This is a breaking change, but I could imagine putting it into core 3 as it is currently not used yet.
Remove remaining runtime dependencies
Alternative name for static
To solve faucet-pipeline/faucet-pipeline-static#72 this allows users to use static as "assets".
Doc changes: faucet-pipeline/docs#105
Expose baseURI in manifest
This is needed in aiur, and removes some akward workarounds there.
Types
Add the types necessary to build a plugin. This does not run any TS on this project itself.
Remove
--liveserve
The dependency has not been updated in over three years, and has severe security issues.