Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
maksim-tolo committed Nov 5, 2018
1 parent cb96733 commit 98b330e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## 2.0.0 Monday November 5 2018

- [#6](https://github.com/maksim-tolo/angular-template-url-loader/pull/6) Upgrade loader-utils
- Breaking: target Node 6 and newer
19 changes: 8 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
var { getOptions, stringifyRequest } = require('loader-utils');
var path = require('path');

var templateUrlRegex = /templateUrl\s*:\s*['"`](.*?)['"`]\s*([,}\n])/gm;
const { getOptions, stringifyRequest } = require('loader-utils');
const path = require('path');

const templateUrlRegex = /templateUrl\s*:\s*['"`](.*?)['"`]\s*([,}\n])/gm;
const DEFAULTS = {
basePath: ''
};

module.exports = function(source) {
var context = this;
const options = Object.assign(
{},
DEFAULTS,
getOptions(context),
getOptions(this),
);

if (context.cacheable) {
context.cacheable();
if (this.cacheable) {
this.cacheable();
}

return source.replace(templateUrlRegex, function(match, url, ending) {
return 'template: require(' + stringifyRequest(context, path.join(options.basePath, url)) + ')' + ending;
});
return source.replace(templateUrlRegex, (match, url, ending) =>
`template: require(${stringifyRequest(this, path.join(options.basePath, url))})${ending}`);
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-template-url-loader",
"version": "1.0.2",
"version": "2.0.0",
"description": "AngularJS webpack loader that inlines your templates into angular directives and components.",
"main": "index.js",
"scripts": {},
Expand All @@ -23,5 +23,8 @@
"homepage": "https://github.com/maksim-tolo/angular-template-url-loader#readme",
"dependencies": {
"loader-utils": "^1.1.0"
},
"engines": {
"node": ">=6.0.0"
}
}

0 comments on commit 98b330e

Please sign in to comment.