library for inspecting and renaming various js module formats. This is still WIP but in a usable state.
npm install petal --save
var m = new Petal('vendor/htmlbars-runtime.amd.js', sourceOrAst);
m.hasDefine // => true
m.isAnonymous // => true
m.exports === {
'htmlbars-runtime': [
'domHelpers',
'Morph'
],
'htmlbars-runtime/dom_helpers': [
'domHelpers'
],
'htmlbars-runtime/hooks': [
'content',
'webComponent',
'webComponentFallback',
'element',
'attribute',
'concat',
'subexpr',
'lookupHelper',
'simple',
'hydrationHooks'
],
'htmlbars-runtime/utils': [
'merge'
]
});
// now, lets remap the current module to another name
newM = m.remap('[email protected]');
newM.ast // => ast remapped regarldess of module format.
newM.exports === {
'[email protected]': [
'domHelpers',
'Morph'
],
'[email protected]/dom_helpers': [
'domHelpers'
],
'[email protected]/hooks': [
'content',
'webComponent',
'webComponentFallback',
'element',
'attribute',
'concat',
'subexpr',
'lookupHelper',
'simple',
'hydrationHooks'
],
'[email protected]/utils': [
'merge'
]
});