mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-11 04:19:59 +03:00
29 lines
466 B
JavaScript
29 lines
466 B
JavaScript
const fs = require('fs');
|
|
|
|
function getCustomize() {
|
|
const customed = fs.existsSync('./module-resolve.cjs');
|
|
if (!customed) {
|
|
return null;
|
|
}
|
|
const script = require('./module-resolve.cjs');
|
|
return script && script.resolve;
|
|
}
|
|
|
|
const customize = getCustomize();
|
|
|
|
function readPackage(pkg) {
|
|
if (!customize) {
|
|
return pkg;
|
|
}
|
|
|
|
const customizedPkg = customize(pkg);
|
|
|
|
return customizedPkg;
|
|
}
|
|
|
|
module.exports = {
|
|
hooks: {
|
|
readPackage,
|
|
},
|
|
};
|