Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(build): buildNgMaterialDefinition RegExp updated
Browse files Browse the repository at this point in the history
update buildNgMaterialDefinition() regExp to search for module definitions of 'material.*'.

excludes any extraneous, demo-related module definitions.
use `material.layout` to match `material.animate`

Fixes #4305.
  • Loading branch information
ThomasBurleson committed Aug 24, 2015
1 parent d5c3edb commit 391cff5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/ngModuleData.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Regex adapted from https://github.com/ceymard/gulp-ngcompile

module.exports = function processContent(fileContent) {
var NG_MODULE_REGEX = /\.module\(('[^']*'|"[^"]*")\s*,(?:\s*\[([^\]]+)\])?/g;
var NG_MODULE_REGEX = /\.module\((['|"]\material\..*'|"[^"]*")\s*,?\s*\[(([^\]]+)\])?/g;

This comment has been minimized.

Copy link
@ngraef

ngraef Aug 24, 2015

Contributor

Changing the non-capturing group breaks the dependency parsing below. The closing bracket ] is now part of the capturing group.
I think the change you were going for is

/\.module\(('material\.[^']*'|"material\.[^"]*")\s*,(?:\s*\[([^\]]+)\])?/g

This comment has been minimized.

Copy link
@ThomasBurleson

ThomasBurleson Aug 24, 2015

Author Contributor

@ngraef - thx for review and good catch.

note: currently we do not actually use the dependencies list.

var match = NG_MODULE_REGEX.exec(fileContent || '');
var module = match && match[1] && match[1].slice(1, -1); //remove quotes
var depsMatch = match && match[2] && match[2].trim();
Expand Down
2 changes: 1 addition & 1 deletion gulp/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function readModuleArg() {

function filterNonCodeFiles() {
return filter(function(file) {
return !/demo|module\.json|\.spec.js|README/.test(file.path);
return !/demo|module\.json|script\.js|\.spec.js|README/.test(file.path);
});
}

Expand Down
6 changes: 0 additions & 6 deletions src/components/icon/js/iconDirective.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* @ngdoc directive
* @name material.components.icon
* @description
* Icon
*/
angular
.module('material.components.icon')
.directive('mdIcon', ['$mdIcon', '$mdTheming', '$mdAria', mdIconDirective]);
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ angular
.module('material.core', [
'ngAnimate',
'material.animate',
'material.layout',
'material.core.gestures',
'material.core.layout',
'material.core.theming'
])
.directive('mdTemplate', MdTemplateDirective)
Expand Down
2 changes: 1 addition & 1 deletion src/core/services/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* }
* ```
*/
angular.module('material.core.layout', [ ])
angular.module('material.layout', [ ])

// Attribute directives with optional value(s)

Expand Down
2 changes: 1 addition & 1 deletion src/core/services/layout/layout.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('layout directives', function() {

beforeEach(module('material.core'));
beforeEach(module('material.core', 'material.layout'));

describe('expecting layout classes', function() {

Expand Down

0 comments on commit 391cff5

Please sign in to comment.