You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@angularclass/conventions-loader

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angularclass/conventions-loader - npm Package Compare versions

Comparing version

to
1.0.3

41

index.js

@@ -39,12 +39,12 @@ /*

// using: regex, capture groups, and capture group variables.
const componentRegex = /@(Component|Directive)\({([\s\S]*?)}\)$/gm;
const checkComponentRegex = /(@Component\({[\s\S]*?}\))$/gm;
var componentRegex = /@(Component|Directive)\({([\s\S]*?)}\)$/gm;
var checkComponentRegex = /(@Component\({[\s\S]*?}\))$/gm;
// TODO(gdi2290): become a regexp master to fix this
const componentClassRegex = /@(Component)\({([\s\S]*?)}\)\s*export\s*class\s*([\s\S]+)\s*(extends|implements|{)$/gm;
const templateUrlRegex = /templateUrl\s*:(.*)/g;
const templateRegex = /template\s*:(.*)/g;
const styleUrlsRegex = /styleUrls\s*:(\s*\[[\s\S]*?\])/g;
const styleRegex = /styles\s*:(\s*\[[\s\S]*?\])/g;
const stringRegex = /(['"])((?:[^\\]\\\1|.)*?)\1/g;
const selectorRegex = /selector\s*:\s*('|")(.*)('|"),?/;
var componentClassRegex = /@(Component)\({([\s\S]*?)}\)\s*export\s*class\s*([\s\S]+)\s*(extends|implements|{)$/gm;
var templateUrlRegex = /templateUrl\s*:(.*)/g;
var templateRegex = /template\s*:(.*)/g;
var styleUrlsRegex = /styleUrls\s*:(\s*\[[\s\S]*?\])/g;
var styleRegex = /styles\s*:(\s*\[[\s\S]*?\])/g;
var stringRegex = /(['"])((?:[^\\]\\\1|.)*?)\1/g;
var selectorRegex = /selector\s*:\s*('|")(.*)('|"),?/;

@@ -69,4 +69,14 @@ function replaceStringsWithRequires(string) {

self.cacheable && self.cacheable();
var query = loaderUtils.parseQuery(this.query);
var cssExtension = '.css';
var htmlExtension = '.html';
if (query.cssExtension && typeof query.cssExtension === 'string') {
cssExtension = query.cssExtension;
}
if (query.htmlExtension && typeof query.htmlExtension === 'string') {
htmlExtension = query.htmlExtension;
}
// TODO(gdi2290): reuse component regexp

@@ -78,3 +88,2 @@ // var defaultComponent = /@Component\(\)$/gm

// console.log('', checkComponentRegex, componentRegex, source)
// debugger

@@ -126,3 +135,3 @@

debugger
_hasHtmlFile = fs.statSync(path.join(self.context, lastFileName + '.css'));
_hasHtmlFile = fs.statSync(path.join(self.context, lastFileName + htmlExtension));
} catch(e) {}

@@ -132,3 +141,3 @@ } else {

debugger
_hasHtmlFile = fs.statSync(path.join(self.context, './'+ __selector + '.css'));
_hasHtmlFile = fs.statSync(path.join(self.context, './'+ __selector + htmlExtension));
} catch(e) {

@@ -139,3 +148,3 @@ metadata = 'template: "",' + metadata;

if (_hasHtmlFile) {
metadata = 'template: require(".' + lastFileName + '.html"),\n' + metadata;
metadata = 'template: require(".' + lastFileName + htmlExtension + '"),\n' + metadata;
}

@@ -147,7 +156,7 @@ }

try {
_hasCssFile = fs.statSync(path.join(self.context, lastFileName + '.css'));
_hasCssFile = fs.statSync(path.join(self.context, lastFileName + cssExtension));
} catch(e) {}
} else {
try {
_hasCssFile = fs.statSync(path.join(self.context, './'+ __selector + '.css'));
_hasCssFile = fs.statSync(path.join(self.context, './'+ __selector + cssExtension));
} catch(e) {}

@@ -157,3 +166,3 @@ }

if (_hasCssFile) {
metadata = 'styles: [require(".' + lastFileName + '.css")],\n' + metadata;
metadata = 'styles: [require(".' + lastFileName + cssExtension + '")],\n' + metadata;
}

@@ -160,0 +169,0 @@ }

{
"name": "@angularclass/conventions-loader",
"version": "1.0.2",
"version": "1.0.3",
"description": "Allow default for @Component metadata for Angular 2",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -10,3 +10,3 @@ <p align="center">

# Angular 2 Conventions Loader
Allow default for `@Component` metadata for Angular 2
Allow defaults for `@Component` metadata for Angular 2

@@ -45,5 +45,8 @@ `npm install @angularclass/conventions-loader --save-dev`

```
this is assuming you have coresponding files next to the component. You may overwrite the selector at anytime by providing one. If the selector and the component file name does not match then the coresponding css/template file with the selector will be injected.
this is assuming you have corresponding files next to the component. You may overwrite the selector at anytime by providing one. If the selector and the component file name does not match then the corresponding css/template file with the selector will be injected.
## Credits
[Sean Larkin](https://github.com/TheLarkInn) from the Webpack team [TheLarkInn/angular2-template-loader](https://github.com/TheLarkInn/angular2-template-loader)
___

@@ -50,0 +53,0 @@