Support for hidden files
Closed this issue · 1 comments
Boldewyn commented
Hi and thank you for this cool project!
One possible file name in some projects is .namespace.js
with a leading dot to mark the file as hidden on UNIX-y OSes.
How would a proload plugin for this syntax look like? From peeking at the RC plugin I assume something like this?
module.exports = {
name: 'proload-plugin-hidden', // or @proload/plugin-hidden for an official plugin
extensions: [''],
fileNames: ['.[name]'], // will the dot be interpreted literally or as regexp wildcard?
}
natemoo-re commented
Hello, thanks for opening an issue! I just published @proload/plugin-dotfile
to handle this use case!
The following code would enable loading a .namespace.js
file with the leading dot (in addition to the default namespace.config.js
files.)
import load from '@proload/core';
import dotfile from '@proload/plugin-dotfile';
load.use([dotfile]);
load('namespace');
Since plugins only add behavior on top of the defaults, to allow only .namespace.js
files you could use a custom accept
handler.
import load from '@proload/core';
import dotfile from '@proload/plugin-dotfile';
load.use([dotfile]);
load('namespace', {
accept(name) {
return name.startsWith('.');
}
});