Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
24
node_modules/micro/lib/handler.js
generated
vendored
Normal file
24
node_modules/micro/lib/handler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Utilities
|
||||
const logError = require('./error');
|
||||
|
||||
module.exports = async file => {
|
||||
let mod;
|
||||
|
||||
try {
|
||||
mod = await require(file); // Await to support exporting Promises
|
||||
|
||||
if (mod && typeof mod === 'object') {
|
||||
mod = await mod.default; // Await to support es6 module's default export
|
||||
}
|
||||
} catch (err) {
|
||||
logError(`Error when importing ${file}: ${err.stack}`, 'invalid-entry');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (typeof mod !== 'function') {
|
||||
logError(`The file "${file}" does not export a function.`, 'no-export');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return mod;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue