From c9f3ae6bfd24fe721eb5dab00277c92c0f93ee43 Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Thu, 28 Jul 2016 21:35:42 -0400 Subject: [PATCH] chore(all): prepare release 1.0.1 --- dist/build-resources.js | 2 +- dist/index.js | 62 ++++++++++++++++++++++++----------------- doc/CHANGELOG.md | 17 +++++++++++ package.json | 2 +- 4 files changed, 55 insertions(+), 28 deletions(-) diff --git a/dist/build-resources.js b/dist/build-resources.js index 6648350..a483e00 100644 --- a/dist/build-resources.js +++ b/dist/build-resources.js @@ -577,7 +577,7 @@ function getResourcesOfPackage() { function fixRelativeFromPath(fromPath, realSrcPath, realParentPath, externalModule) { var fromPathSplit = fromPath.split('/'); - if (moduleNames.indexOf(fromPathSplit[0]) !== -1 || moduleNames.indexOf(path.join(fromPathSplit[0], fromPathSplit[1])) !== -1) { + if (moduleNames.indexOf(fromPathSplit[0]) !== -1 || fromPathSplit.length > 1 && moduleNames.indexOf(path.join(fromPathSplit[0], fromPathSplit[1])) !== -1) { return fromPath; } else { if (fromPath.indexOf('.') == 0) { diff --git a/dist/index.js b/dist/index.js index 7dbe504..8318646 100644 --- a/dist/index.js +++ b/dist/index.js @@ -41,6 +41,8 @@ var AureliaWebpackPlugin = function () { options.root = options.root ? path.normalizeSafe(options.root) : path.dirname(module.parent.filename); options.src = options.src ? path.normalizeSafe(options.src) : path.resolve(options.root, 'src'); + options.nameExternalModules = options.nameExternalModules == undefined || options.nameExternalModules == true; + options.nameLocalModules = options.nameLocalModules == undefined || options.nameLocalModules == true; options.resourceRegExp = options.resourceRegExp || /aurelia-loader-context/; options.customViewLoaders = (0, _assign2.default)({ '.css': ['css'], @@ -255,35 +257,43 @@ var AureliaWebpackPlugin = function () { } if (typeof module.resource == 'string') { - var moduleId = void 0; - - if (module.resource.startsWith(options.src)) { - var relativeToSrc = path.relative(options.src, module.resource); - moduleId = relativeToSrc; - } - if (!moduleId && typeof module.userRequest == 'string') { - var matchingModuleIds = paths.filter(function (originPath) { - return contextElements[originPath].source === module.userRequest; - }).map(function (originPath) { - return path.normalize(originPath); - }); + (function () { + var moduleId = void 0; - if (matchingModuleIds.length) { - matchingModuleIds.sort(function (a, b) { - return b.length - a.length; - }); - moduleId = matchingModuleIds[0]; + if (options.nameLocalModules) { + if (module.resource.startsWith(options.src)) { + var relativeToSrc = path.relative(options.src, module.resource); + moduleId = relativeToSrc; + } + } + if (options.nameExternalModules) { + if (!moduleId && typeof module.userRequest == 'string') { + var matchingModuleIds = paths.filter(function (originPath) { + return contextElements[originPath].source === module.userRequest; + }).map(function (originPath) { + return path.normalize(originPath); + }); + + if (matchingModuleIds.length) { + matchingModuleIds.sort(function (a, b) { + return b.length - a.length; + }); + moduleId = matchingModuleIds[0]; + } + } + if (!moduleId && typeof module.rawRequest == 'string' && module.rawRequest.indexOf('.') !== 0) { + var index = paths.indexOf(module.rawRequest); + if (index >= 0) { + moduleId = module.rawRequest; + } + } } - } - if (!moduleId && typeof module.rawRequest == 'string' && module.rawRequest.indexOf('.') !== 0) { - var index = paths.indexOf(module.rawRequest); - if (index >= 0) { - moduleId = module.rawRequest; + if (moduleId && !modules.find(function (m) { + return m.id === moduleId; + })) { + module.id = moduleId; } - } - if (moduleId) { - module.id = moduleId; - } + })(); } }); }); diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index ae5610a..f71ef15 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,20 @@ + +## [1.0.1](https://github.com/aurelia/webpack-plugin/compare/1.0.0...v1.0.1) (2016-07-29) + + +### Bug Fixes + +* **build-resources:** fix a regression caused by scoping support ([d7dec55](https://github.com/aurelia/webpack-plugin/commit/d7dec55)) +* **index:** do not reassign moduleId when one with the same name exists already ([fddd9e1](https://github.com/aurelia/webpack-plugin/commit/fddd9e1)) + + +### Features + +* **index:** add the option 'nameLocalModules' for manually disabling moduleId remapping ([2f9c89a](https://github.com/aurelia/webpack-plugin/commit/2f9c89a)) +* **index:** make naming external modules optional ([af1a745](https://github.com/aurelia/webpack-plugin/commit/af1a745)) + + + # [1.0.0](https://github.com/aurelia/webpack-plugin/compare/1.0.0-beta.4.0.1...v1.0.0) (2016-07-27) diff --git a/package.json b/package.json index 7812e7e..0cab647 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-webpack-plugin", - "version": "1.0.0", + "version": "1.0.1", "description": "A plugin for webpack that enables bundling Aurelia applications.", "keywords": [ "aurelia",