@magento/directive-parser
Advanced tools
+1
-1
@@ -6,3 +6,3 @@ { | ||
| }, | ||
| "version": "0.1.6", | ||
| "version": "0.1.7", | ||
| "description": "Parses Magento PWA Studio directives", | ||
@@ -9,0 +9,0 @@ "main": "src/index.js", |
@@ -10,6 +10,32 @@ const parseDirective = require('..'); | ||
| `); | ||
| expect(errors.length).toBe(0); | ||
| expect(errors[0]).toBeFalsy(); | ||
| expect(directives.length).toBe(1); | ||
| }); | ||
| test('Can parse a single directive in a file with single-line comments', () => { | ||
| const { errors, directives } = parseDirective(` | ||
| /** | ||
| * @RootComponent | ||
| * pageTypes = foo, bizz | ||
| */ | ||
| module.exports = () => {}; | ||
| // a single line comment | ||
| `); | ||
| expect(errors[0]).toBeFalsy(); | ||
| expect(directives.length).toBe(1); | ||
| }); | ||
| test('Can parse a single directive in a file with source map annotations', () => { | ||
| const { errors, directives } = parseDirective(` | ||
| /** | ||
| * @RootComponent | ||
| * pageTypes = foo, bizz | ||
| */ | ||
| module.exports = () => {}; | ||
| //# sourceMappingURL=index.js.map | ||
| `); | ||
| expect(errors[0]).toBeFalsy(); | ||
| expect(directives.length).toBe(1); | ||
| }); | ||
| test('Can parse a single directive in a file, and report error below it', () => { | ||
@@ -16,0 +42,0 @@ const { errors, directives } = parseDirective(` |
+1
-1
| const reWhitespace = /\s/; | ||
| const reIdentifierChar = /[\w-]/; | ||
| const reIdentifierChar = /[^'"@=,\*\/\s]/; | ||
| const reNewLine = /\n/; | ||
@@ -4,0 +4,0 @@ |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
26681
2.94%439
5.78%2
Infinity%