Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    petalpublic

    petal

    Build Status

    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('htmlbars-runtime@2.0.0');
     
    newM.ast // => ast remapped regarldess of module format.
     
    newM.exports === {
      'htmlbars-runtime@2.0.0': [
        'domHelpers',
        'Morph'
      ],
      'htmlbars-runtime@2.0.0/dom_helpers': [
        'domHelpers'
      ],
      'htmlbars-runtime@2.0.0/hooks': [
        'content',
        'webComponent',
        'webComponentFallback',
        'element',
        'attribute',
        'concat',
        'subexpr',
        'lookupHelper',
        'simple',
        'hydrationHooks'
      ],
      'htmlbars-runtime@2.0.0/utils': [
        'merge'
      ]
    });

    Keywords

    none

    install

    npm i petal

    Downloadsweekly downloads

    15

    version

    0.1.4

    license

    ISC

    last publish

    collaborators

    • avatar
    • avatar
    • avatar