edge-parser
Advanced tools
Comparing version 5.4.0 to 6.0.0
@@ -23,1 +23,2 @@ import { TagToken, LexerTagDefinitionContract } from 'edge-lexer'; | ||
}; | ||
export declare type TagTransformer = (tag: TagToken) => void; |
@@ -1,2 +0,2 @@ | ||
import { Token } from 'edge-lexer'; | ||
import { Token, LexerTagDefinitionContract } from 'edge-lexer'; | ||
import { Stack } from '../Stack'; | ||
@@ -8,4 +8,4 @@ import { stringify } from './stringify'; | ||
import { makeCtxCallable } from './makeCtxCallable'; | ||
import { ParserTagDefinitionContract } from '../Contracts'; | ||
import { makeStatePropertyAccessor } from './makeStatePropertyAccessor'; | ||
import { ParserTagDefinitionContract, TagTransformer } from '../Contracts'; | ||
import { collectObjectExpressionProperties } from './collectObjectExpressionProperties'; | ||
@@ -75,7 +75,11 @@ /** | ||
*/ | ||
tokenize(template: string, filename: string, onLine?: (line: string) => string): Token[]; | ||
tokenize(template: string, options: { | ||
filename: string; | ||
onLine?: (line: string) => string; | ||
claimTag?: (name: string) => LexerTagDefinitionContract | null; | ||
}): Token[]; | ||
/** | ||
* Process a lexer token. The output gets written to the buffer | ||
*/ | ||
processToken(token: Token, buffer: EdgeBuffer): void; | ||
processToken(token: Token, buffer: EdgeBuffer, onTag?: TagTransformer): void; | ||
} |
@@ -124,4 +124,4 @@ "use strict"; | ||
*/ | ||
tokenize(template, filename, onLine) { | ||
const tokenizer = new edge_lexer_1.Tokenizer(template, this.tags, { filename: filename, onLine }); | ||
tokenize(template, options) { | ||
const tokenizer = new edge_lexer_1.Tokenizer(template, this.tags, options); | ||
tokenizer.parse(); | ||
@@ -133,3 +133,3 @@ return tokenizer.tokens; | ||
*/ | ||
processToken(token, buffer) { | ||
processToken(token, buffer, onTag) { | ||
switch (token.type) { | ||
@@ -143,2 +143,5 @@ case 'raw': | ||
case edge_lexer_1.TagTypes.TAG: | ||
if (typeof onTag === 'function') { | ||
onTag(token); | ||
} | ||
this.tags[token.properties.name].compile(this, buffer, token); | ||
@@ -145,0 +148,0 @@ break; |
{ | ||
"name": "edge-parser", | ||
"version": "5.4.0", | ||
"version": "6.0.0", | ||
"description": "Parser for edge template engine", | ||
@@ -38,3 +38,3 @@ "main": "build/index.js", | ||
"edge-error": "^1.0.5", | ||
"edge-lexer": "^3.2.0", | ||
"edge-lexer": "^3.2.1", | ||
"js-stringify": "^1.0.2" | ||
@@ -44,6 +44,6 @@ }, | ||
"@adonisjs/mrm-preset": "^2.4.0", | ||
"@adonisjs/require-ts": "^1.1.0", | ||
"@adonisjs/require-ts": "^1.1.1", | ||
"@types/acorn": "^4.0.5", | ||
"@types/astring": "^1.3.0", | ||
"@types/node": "^14.14.7", | ||
"@types/node": "^14.14.10", | ||
"commitizen": "^4.2.2", | ||
@@ -54,3 +54,3 @@ "cz-conventional-changelog": "^3.3.0", | ||
"doctoc": "^1.4.0", | ||
"eslint": "^7.13.0", | ||
"eslint": "^7.14.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
@@ -63,9 +63,9 @@ "eslint-plugin-adonis": "^1.0.15", | ||
"japa-cli": "^1.0.1", | ||
"mrm": "^2.5.12", | ||
"mrm": "^2.5.13", | ||
"np": "^7.0.0", | ||
"npm-audit-html": "^1.5.0", | ||
"prettier": "^2.1.2", | ||
"prettier": "^2.2.1", | ||
"typedoc": "^0.19.2", | ||
"typedoc-plugin-markdown": "^3.0.11", | ||
"typescript": "^4.0.5", | ||
"typescript": "^4.1.2", | ||
"youch": "^2.1.1" | ||
@@ -72,0 +72,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71490
1582
Updatededge-lexer@^3.2.1