From 98b330e2503f22206d47aebc751d735ffd9c8319 Mon Sep 17 00:00:00 2001 From: Maxim Tolochko Date: Mon, 5 Nov 2018 16:19:42 +0300 Subject: [PATCH] Bump version --- CHANGELOG.md | 6 ++++++ index.js | 19 ++++++++----------- package-lock.json | 2 +- package.json | 5 ++++- 4 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4275b3c --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/index.js b/index.js index bd261b5..82c6799 100644 --- a/index.js +++ b/index.js @@ -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}`); }; diff --git a/package-lock.json b/package-lock.json index 32d2928..e5c3084 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "angular-template-url-loader", - "version": "1.0.2", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a6502db..0da9b5a 100644 --- a/package.json +++ b/package.json @@ -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": {}, @@ -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" } }