Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jun 24, 2016
1 parent 64161c2 commit f04f62b
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 48 deletions.
96 changes: 64 additions & 32 deletions dist/build-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,26 @@ var processAll = exports.processAll = function () {
debugDetail('starting resolution: ' + options.root);

if (!(modulePaths.length === 0)) {
_context.next = 11;
_context.next = 12;
break;
}

_context.next = 9;
return installedLocalModulePaths();

case 9:
modulePaths = _context.sent;
_context.t0 = function (line) {
return path.normalize(line);
};

modulePaths = _context.sent.map(_context.t0);

moduleNames = modulePaths.map(function (line) {
var split = line.split('/node_modules/');
return split[split.length - 1];
});

case 11:
case 12:

debugDetail(moduleNames);
debugDetail(modulePaths);
Expand All @@ -68,13 +72,13 @@ var processAll = exports.processAll = function () {
} catch (_) {}

getResourcesOfPackage(dependencies, options.root, path.relative(options.root, options.src));
_context.next = 17;
_context.next = 18;
return autoresolveTemplates(dependencies, options.root, options.src);

case 17:
case 18:
return _context.abrupt('return', dependencies);

case 18:
case 19:
case 'end':
return _context.stop();
}
Expand All @@ -88,7 +92,7 @@ var processAll = exports.processAll = function () {

var autoresolveTemplates = function () {
var ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(resources, packagePath, srcPath) {
var templates, srcRelativeToRoot, _iterator5, _isArray5, _i5, _ref5, htmlFilePath, templateResources, _iterator6, _isArray6, _i6, _ref6, resource;
var templates, srcRelativeToRoot, _iterator6, _isArray6, _i6, _ref6, htmlFilePath, templateResources, _iterator7, _isArray7, _i7, _ref7, resource;

return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
Expand All @@ -100,77 +104,77 @@ var autoresolveTemplates = function () {
case 2:
templates = _context2.sent;
srcRelativeToRoot = path.relative(packagePath, srcPath);
_iterator5 = templates, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);
_iterator6 = templates, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);

case 5:
if (!_isArray5) {
if (!_isArray6) {
_context2.next = 11;
break;
}

if (!(_i5 >= _iterator5.length)) {
if (!(_i6 >= _iterator6.length)) {
_context2.next = 8;
break;
}

return _context2.abrupt('break', 34);

case 8:
_ref5 = _iterator5[_i5++];
_ref6 = _iterator6[_i6++];
_context2.next = 15;
break;

case 11:
_i5 = _iterator5.next();
_i6 = _iterator6.next();

if (!_i5.done) {
if (!_i6.done) {
_context2.next = 14;
break;
}

return _context2.abrupt('break', 34);

case 14:
_ref5 = _i5.value;
_ref6 = _i6.value;

case 15:
htmlFilePath = _ref5;
htmlFilePath = _ref6;
templateResources = resolveTemplateResources(htmlFilePath, srcPath);
_iterator6 = templateResources, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);
_iterator7 = templateResources, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);

case 18:
if (!_isArray6) {
if (!_isArray7) {
_context2.next = 24;
break;
}

if (!(_i6 >= _iterator6.length)) {
if (!(_i7 >= _iterator7.length)) {
_context2.next = 21;
break;
}

return _context2.abrupt('break', 32);

case 21:
_ref6 = _iterator6[_i6++];
_ref7 = _iterator7[_i7++];
_context2.next = 28;
break;

case 24:
_i6 = _iterator6.next();
_i7 = _iterator7.next();

if (!_i6.done) {
if (!_i7.done) {
_context2.next = 27;
break;
}

return _context2.abrupt('break', 32);

case 27:
_ref6 = _i6.value;
_ref7 = _i7.value;

case 28:
resource = _ref6;
resource = _ref7;

processFromPath(resources, resource.path, resource, packagePath, srcRelativeToRoot);

Expand Down Expand Up @@ -217,11 +221,11 @@ var moduleNames = [];
function installedLocalModulePaths() {
return execa('npm', ['ls', '--parseable'], { cwd: optionsGlobal.root }).then(function (res) {
return res.stdout.split('\n').filter(function (line, i) {
return i !== 0;
return i !== 0 && !!line;
});
}).catch(function (res) {
return res.stdout.split('\n').filter(function (line, i) {
return i !== 0;
return i !== 0 && !!line;
});
});
}
Expand All @@ -231,7 +235,9 @@ function getFilesRecursively(targetDir, extension) {
return readdir(targetDir, [function (file, stats) {
return path.extname(file) !== extension && !stats.isDirectory();
}], function (error, files) {
return error ? reject(error) : resolve(files);
return error ? reject(error) : resolve(files.map(function (file) {
return path.normalize(file);
}));
});
});
}
Expand Down Expand Up @@ -276,7 +282,7 @@ function getPackageAureliaResources(packageJson) {

function getPackageMainDir(packagePath) {
var packageJson = getPackageJson(packagePath);
var packageMain = packageJson.main || packageJson.browser;
var packageMain = packageJson.aurelia && packageJson.aurelia.main && packageJson.aurelia.main['native-modules'] || packageJson.main || packageJson.browser;
return packageMain ? path.dirname(path.join(packagePath, packageMain)) : null;
}

Expand Down Expand Up @@ -490,12 +496,38 @@ function getResourcesOfPackage() {
_ref4 = _i4.value;
}

var moduleName = _ref4;
var _moduleName = _ref4;

var _modulePathIndex = moduleNames.indexOf(_moduleName);
if (_modulePathIndex !== -1) {
var _modulePath = modulePaths[_modulePathIndex];
getResourcesOfPackage(resources, _modulePath, undefined, undefined, _moduleName);
}
}

if (!externalModule) {
for (var _iterator5 = (0, _getOwnPropertyNames2.default)(packageJson.dependencies), _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
var _ref5;

if (_isArray5) {
if (_i5 >= _iterator5.length) break;
_ref5 = _iterator5[_i5++];
} else {
_i5 = _iterator5.next();
if (_i5.done) break;
_ref5 = _i5.value;
}

var moduleName = _ref5;

var modulePathIndex = moduleNames.indexOf(moduleName);
if (modulePathIndex !== -1) {
var modulePath = modulePaths[modulePathIndex];

var modulePathIndex = moduleNames.indexOf(moduleName);
if (modulePathIndex !== -1) {
var modulePath = modulePaths[modulePathIndex];
getResourcesOfPackage(resources, modulePath, undefined, undefined, moduleName);
if (!resources[moduleName] && getPackageMainDir(modulePath)) {
resources[moduleName] = { path: moduleName, source: moduleName, moduleName: moduleName, modulePath: modulePath };
}
}
}
}
}
Expand Down
40 changes: 25 additions & 15 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ function getPath(resolvedResource) {
return '' + output + input;
}

function handleError(error) {
console.error('Error processing templates', error.message);
console.error('-----------------------');
console.error(error);
console.error('-----------------------');
}

var AureliaWebpackPlugin = function () {
function AureliaWebpackPlugin() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
Expand Down Expand Up @@ -122,16 +129,22 @@ var AureliaWebpackPlugin = function () {

var requireRequestPath = _ref2;

var resource = contextElements[requireRequestPath];
var newDependency = new ContextElementDependency(getPath(resource), path.joinSafe('./', requireRequestPath));
if (resource.hasOwnProperty('optional')) newDependency.optional = !!resource.optional;else newDependency.optional = true;
var previouslyAdded = dependencies.findIndex(function (dependency) {
return dependency.userRequest === requireRequestPath;
});
if (previouslyAdded > -1) {
dependencies[previouslyAdded] = newDependency;
} else {
dependencies.push(newDependency);
try {
var _resource = contextElements[requireRequestPath];

requireRequestPath = path.joinSafe('./', requireRequestPath);
var newDependency = new ContextElementDependency(getPath(_resource), requireRequestPath);
if (_resource.hasOwnProperty('optional')) newDependency.optional = !!_resource.optional;else newDependency.optional = true;
var previouslyAdded = dependencies.findIndex(function (dependency) {
return dependency.userRequest === requireRequestPath;
});
if (previouslyAdded > -1) {
dependencies[previouslyAdded] = newDependency;
} else {
dependencies.push(newDependency);
}
} catch (e) {
handleError(e);
}
};

Expand All @@ -144,11 +157,8 @@ var AureliaWebpackPlugin = function () {
}

return callback(null, dependencies);
}, function (error) {
console.error('Error processing templates', error.message);
console.error('-----------------------');
console.error(error);
console.error('-----------------------');
}, function (e) {
handleError(e);
return callback(error);
});
});
Expand Down
18 changes: 18 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
<a name="1.0.0-beta.4.0.0"></a>
# [1.0.0-beta.4.0.0](https://github.com/aurelia/webpack-plugin/compare/1.0.0-beta.3.0.0...v1.0.0-beta.4.0.0) (2016-06-24)


### Bug Fixes

* **build-resources:** normalize paths for Windows support ([168c3b5](https://github.com/aurelia/webpack-plugin/commit/168c3b5))
* **build-resources:** remove empty path between modules list ([4cd67d5](https://github.com/aurelia/webpack-plugin/commit/4cd67d5))
* **index:** ensure we have './' at the beginning of the request path ([eded984](https://github.com/aurelia/webpack-plugin/commit/eded984))
* **index:** fix a fatal error; better error handling ([64161c2](https://github.com/aurelia/webpack-plugin/commit/64161c2))


### Features

* **build-resources:** add all dependencies as build resources by default ([30eb24f](https://github.com/aurelia/webpack-plugin/commit/30eb24f))



<a name="1.0.0-beta.2.0.4"></a>
# [1.0.0-beta.2.0.4](https://github.com/aurelia/webpack-plugin/compare/1.0.0-beta.2.0.3...v1.0.0-beta.2.0.4) (2016-06-22)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-webpack-plugin",
"version": "1.0.0-beta.3.0.0",
"version": "1.0.0-beta.4.0.0",
"description": "A plugin for webpack that enables bundling Aurelia applications.",
"keywords": [
"aurelia",
Expand Down

0 comments on commit f04f62b

Please sign in to comment.