bonsai-analyzer
Version:
Trim your dependency tree.
104 lines (98 loc) • 1.87 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.defaultModule = defaultModule;
exports.defaultExtendedModule = defaultExtendedModule;
exports.defaultReason = defaultReason;
exports.reasonFromModule = reasonFromModule;
exports.defaultChunk = defaultChunk;
function defaultModule(fields) {
return {
identifier: '',
name: '',
index: 0,
index2: 0,
size: 0,
cacheable: false,
built: false,
optional: false,
prefetched: false,
chunks: [],
assets: [],
issuer: '',
issuerId: '',
failed: false,
errors: 0,
warnings: 0,
reasons: [],
usedExports: true,
providedExports: null,
...fields
};
}
function defaultExtendedModule(fields) {
return {
identifier: '',
name: '',
index: 0,
index2: 0,
size: 0,
cacheable: false,
built: false,
optional: false,
prefetched: false,
chunks: [],
assets: [],
issuer: '',
issuerId: '',
failed: false,
errors: 0,
warnings: 0,
reasons: [],
usedExports: true,
providedExports: null,
requiredBy: [],
requiredByCount: 0,
requirements: [],
requirementsCount: 0,
cumulativeSize: 0,
loops: [],
...fields
};
}
function defaultReason(fields) {
return {
moduleIdentifier: '',
module: '',
moduleName: '',
type: '',
userRequest: '',
loc: '',
...fields
};
}
function reasonFromModule(module) {
return defaultReason({
moduleId: module.id,
moduleIdentifier: module.identifier,
module: module.name,
moduleName: module.name
});
}
function defaultChunk(fields) {
return {
rendered: false,
initial: false,
entry: false,
extraAsync: false,
size: 0,
name: '',
names: [],
files: [],
hash: '',
parents: [],
origins: [],
...fields
};
}