npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-resolve-relative-template-urls-loader

v0.0.1

Published

webpack loader to convert relative paths to absolute paths in angular directives and components

Readme

npm node deps travis appveyor coverage chat

npm i -D val-loader

The module that is loaded with this loader must stick to the following interfaces

Module Interface

The loaded module must export a function as default export with the following Function Interface

module.exports = function () {...};

Modules transpiled by Babel are also supported

export default function () {...};

Function Interface

The function will be called with the loader options and must either return

{Object}

Following the Object Interface

{Promise}

Resolving to an {Object} following the Object Interface

Object Interface

|Name|Type|Default|Description| |:---|:--:|:-----:|:----------| |code|{String\|Buffer}|undefined|(Required) The code that is passed to the next loader or to webpack| |sourceMap| {Object}|undefined|(Optional) Will be passed to the next loader or to webpack| |ast|{Array<{Object}>}|undefined|(Optional) An Abstract Syntax Tree that will be passed to the next loader. Useful to speed up the build time if the next loader uses the same AST| |dependencies|{Array<{String}>}|[]|An array of absolute, native paths to file dependencies that need to be watched for changes| |contextDependencies| {Array<{String}>} |[]| An array of absolute, native paths to directory dependencies that need to be watched for changes| |cacheable|{Boolean}|false|Flag whether the code can be re-used in watch mode if none of the dependencies have changed|

val-loader itself has no options. The options are passed as they are (without cloning them) to the exported function

If you have a module like this

answer.js

function answer () {
  return {
    code: 'module.exports = 42;'
  }
};

module.exports = answer;

you can use the val-loader to generate source code on build time

webpack.config.js

module.exports = {
  ...
  module: {
    rules: [
      {
        test: require.resolve('path/to/answer.js'),
        use: [
          {
            loader: 'val-loader'
          }
        ]
      }
    ]
  }
};

Complete

A complete example of all available features looks like this

answer.js

const ask = require('./ask.js');
const generate = require('./generate.js');

function answer(options) {
  return ask(options.question)
    .then(generate)
    .then(result => ({
      ast: result.abstractSyntaxTree,
      code: result.code,
      // Mark dependencies of answer().
      // The function will be re-executed if one of these
      // dependencies has changed in watch mode.
      dependencies: [
        // Array of absolute native paths!
        require.resolve('./ask.js'),
        require.resolve('./generate.js')
      ],
      // Flag the generated code as cacheable.
      // If none of the dependencies have changed,
      // the function won't be executed again.
      cacheable: true
      sourceMap: result.sourceMap,
    })
  );
}

module.exports = answer;

webpack.config.js

module.exports = {
  ...
  module: {
    rules: [
      {
        test: require.resolve('path/to/answer.js'),
        use: [
          {
            loader: 'val-loader',
            options: {
              question: 'What is the meaning of life?'
            }
          }
        ]
      }
    ]
  }
};