Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

melody-extension-core

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

melody-extension-core - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

4

package.json
{
"name": "melody-extension-core",
"version": "1.4.0",
"version": "1.5.0",
"description": "",

@@ -25,3 +25,3 @@ "main": "./lib/index.js",

},
"gitHead": "c79e2d50e132626af6b043d1fb8df067cae9743a"
"gitHead": "6730ddfaafc4f3a69de46806f8a2d050821c5bb0"
}

@@ -16,3 +16,9 @@ /**

*/
import { Types, setStartFromToken, setEndFromToken } from 'melody-parser';
import {
Types,
setStartFromToken,
setEndFromToken,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';
import { AutoescapeBlock } from './../types';

@@ -26,4 +32,7 @@

let escapeType = null,
stringStartToken;
stringStartToken,
openingTagEndToken,
closingTagStartToken;
if (tokens.nextIf(Types.TAG_END)) {
openingTagEndToken = tokens.la(-1);
escapeType = null;

@@ -44,6 +53,9 @@ } else if ((stringStartToken = tokens.nextIf(Types.STRING_START))) {

}
openingTagEndToken = tokens.la(0);
} else if (tokens.nextIf(Types.FALSE)) {
escapeType = false;
openingTagEndToken = tokens.la(0);
} else if (tokens.nextIf(Types.TRUE)) {
escapeType = true;
openingTagEndToken = tokens.la(0);
} else {

@@ -67,2 +79,3 @@ parser.error({

) {
closingTagStartToken = token;
tagEndToken = tokens.expect(Types.TAG_END);

@@ -75,4 +88,11 @@ return true;

autoescape.trimRightAutoescape = hasTagEndTokenTrimRight(
openingTagEndToken
);
autoescape.trimLeftEndautoescape = hasTagStartTokenTrimLeft(
closingTagStartToken
);
return autoescape;
},
};

@@ -22,2 +22,4 @@ /**

createNode,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';

@@ -32,11 +34,15 @@ import { BlockStatement } from './../types';

let blockStatement;
if (tokens.nextIf(Types.TAG_END)) {
let blockStatement, openingTagEndToken, closingTagStartToken;
if ((openingTagEndToken = tokens.nextIf(Types.TAG_END))) {
blockStatement = new BlockStatement(
createNode(Identifier, nameToken, nameToken.text),
parser.parse((tokenText, token, tokens) => {
return !!(
const result = !!(
token.type === Types.TAG_START &&
tokens.nextIf(Types.SYMBOL, 'endblock')
);
if (result) {
closingTagStartToken = token;
}
return result;
}).expressions

@@ -74,4 +80,11 @@ );

blockStatement.trimRightBlock =
openingTagEndToken && hasTagEndTokenTrimRight(openingTagEndToken);
blockStatement.trimLeftEndblock = !!(
closingTagStartToken &&
hasTagStartTokenTrimLeft(closingTagStartToken)
);
return blockStatement;
},
};

@@ -17,3 +17,9 @@ /**

import { Node } from 'melody-types';
import { Types, setStartFromToken, setEndFromToken } from 'melody-parser';
import {
Types,
setStartFromToken,
setEndFromToken,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';
import { filter } from 'lodash';

@@ -43,9 +49,15 @@ import { EmbedStatement } from './../types';

tokens.expect(Types.TAG_END);
const openingTagEndToken = tokens.la(-1);
let closingTagStartToken;
embedStatement.blocks = filter(
parser.parse((tokenText, token, tokens) => {
return !!(
const result = !!(
token.type === Types.TAG_START &&
tokens.nextIf(Types.SYMBOL, 'endembed')
);
if (result) {
closingTagStartToken = token;
}
return result;
}).expressions,

@@ -58,4 +70,11 @@ Node.isBlockStatement

embedStatement.trimRightEmbed = hasTagEndTokenTrimRight(
openingTagEndToken
);
embedStatement.trimLeftEndembed =
closingTagStartToken &&
hasTagStartTokenTrimLeft(closingTagStartToken);
return embedStatement;
},
};

@@ -22,2 +22,4 @@ /**

createNode,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';

@@ -33,7 +35,14 @@ import { FilterBlockStatement } from './../types';

tokens.expect(Types.TAG_END);
const openingTagEndToken = tokens.la(-1);
let closingTagStartToken;
const body = parser.parse((text, token, tokens) => {
return (
const result =
token.type === Types.TAG_START &&
tokens.nextIf(Types.SYMBOL, 'endfilter')
);
tokens.nextIf(Types.SYMBOL, 'endfilter');
if (result) {
closingTagStartToken = token;
}
return result;
}).expressions;

@@ -47,4 +56,12 @@

setEndFromToken(filterBlockStatement, tokens.expect(Types.TAG_END));
filterBlockStatement.trimRightFilter = hasTagEndTokenTrimRight(
openingTagEndToken
);
filterBlockStatement.trimLeftEndfilter =
closingTagStartToken &&
hasTagStartTokenTrimLeft(closingTagStartToken);
return filterBlockStatement;
},
};

@@ -22,2 +22,4 @@ /**

createNode,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';

@@ -64,8 +66,14 @@ import { ForStatement } from './../types';

const openingTagEndToken = tokens.la(-1);
let elseTagStartToken, elseTagEndToken;
forStatement.body = parser.parse((tokenText, token, tokens) => {
return (
const result =
token.type === Types.TAG_START &&
(tokens.test(Types.SYMBOL, 'else') ||
tokens.test(Types.SYMBOL, 'endfor'))
);
tokens.test(Types.SYMBOL, 'endfor'));
if (result && tokens.test(Types.SYMBOL, 'else')) {
elseTagStartToken = token;
}
return result;
});

@@ -75,2 +83,3 @@

tokens.expect(Types.TAG_END);
elseTagEndToken = tokens.la(-1);
forStatement.otherwise = parser.parse(

@@ -85,2 +94,3 @@ (tokenText, token, tokens) => {

}
const endforTagStartToken = tokens.la(-1);
tokens.expect(Types.SYMBOL, 'endfor');

@@ -91,4 +101,15 @@

forStatement.trimRightFor = hasTagEndTokenTrimRight(openingTagEndToken);
forStatement.trimLeftElse = !!(
elseTagStartToken && hasTagStartTokenTrimLeft(elseTagStartToken)
);
forStatement.trimRightElse = !!(
elseTagEndToken && hasTagEndTokenTrimRight(elseTagEndToken)
);
forStatement.trimLeftEndfor = hasTagStartTokenTrimLeft(
endforTagStartToken
);
return forStatement;
},
};

@@ -16,3 +16,9 @@ /**

*/
import { Types, setStartFromToken, setEndFromToken } from 'melody-parser';
import {
Types,
setStartFromToken,
setEndFromToken,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';
import { IfStatement } from './../types';

@@ -28,2 +34,3 @@

tokens.expect(Types.TAG_END);
const ifTagEndToken = tokens.la(-1);

@@ -35,5 +42,12 @@ const ifStatement = new IfStatement(

let elseTagStartToken,
elseTagEndToken,
elseifTagStartToken,
elseifTagEndToken;
do {
if (tokens.nextIf(Types.SYMBOL, 'else')) {
elseTagStartToken = tokens.la(-2);
tokens.expect(Types.TAG_END);
elseTagEndToken = tokens.la(-1);
(alternate || ifStatement).alternate = parser.parse(

@@ -43,4 +57,6 @@ matchAlternate

} else if (tokens.nextIf(Types.SYMBOL, 'elseif')) {
elseifTagStartToken = tokens.la(-2);
test = parser.matchExpression();
tokens.expect(Types.TAG_END);
elseifTagEndToken = tokens.la(-1);
const consequent = parser.parse(matchConsequent).expressions;

@@ -50,2 +66,8 @@ alternate = (

).alternate = new IfStatement(test, consequent);
alternate.trimLeft = hasTagStartTokenTrimLeft(
elseifTagStartToken
);
alternate.trimRightIf = hasTagEndTokenTrimRight(
elseifTagEndToken
);
}

@@ -58,5 +80,18 @@

const endifTagStartToken = tokens.la(-2);
setStartFromToken(ifStatement, token);
setEndFromToken(ifStatement, tokens.expect(Types.TAG_END));
ifStatement.trimRightIf = hasTagEndTokenTrimRight(ifTagEndToken);
ifStatement.trimLeftElse = !!(
elseTagStartToken && hasTagStartTokenTrimLeft(elseTagStartToken)
);
ifStatement.trimRightElse = !!(
elseTagEndToken && hasTagEndTokenTrimRight(elseTagEndToken)
);
ifStatement.trimLeftEndif = hasTagStartTokenTrimLeft(
endifTagStartToken
);
return ifStatement;

@@ -63,0 +98,0 @@ },

@@ -22,2 +22,4 @@ /**

createNode,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';

@@ -51,7 +53,14 @@ import { MacroDeclarationStatement } from './../types';

const openingTagEndToken = tokens.la(0);
let closingTagStartToken;
const body = parser.parse((tokenText, token, tokens) => {
return !!(
const result = !!(
token.type === Types.TAG_START &&
tokens.nextIf(Types.SYMBOL, 'endmacro')
);
if (result) {
closingTagStartToken = token;
}
return result;
});

@@ -83,4 +92,11 @@

macroDeclarationStatement.trimRightMacro = hasTagEndTokenTrimRight(
openingTagEndToken
);
macroDeclarationStatement.trimLeftEndmacro = hasTagStartTokenTrimLeft(
closingTagStartToken
);
return macroDeclarationStatement;
},
};

@@ -23,2 +23,4 @@ /**

createNode,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';

@@ -87,4 +89,10 @@

let openingTagEndToken,
catchTagStartToken,
catchTagEndToken,
endmountTagStartToken;
if (async) {
tokens.expect(Types.TAG_END);
openingTagEndToken = tokens.la(-1);

@@ -100,2 +108,3 @@ mountStatement.body = parser.parse((tokenText, token, tokens) => {

if (tokens.nextIf(Types.SYMBOL, 'catch')) {
catchTagStartToken = tokens.la(-2);
const errorVariableName = tokens.expect(Types.SYMBOL);

@@ -108,2 +117,3 @@ mountStatement.errorVariableName = createNode(

tokens.expect(Types.TAG_END);
catchTagEndToken = tokens.la(-1);
mountStatement.otherwise = parser.parse(

@@ -119,2 +129,3 @@ (tokenText, token, tokens) => {

tokens.expect(Types.SYMBOL, 'endmount');
endmountTagStartToken = tokens.la(-2);
}

@@ -125,4 +136,18 @@

mountStatement.trimRightMount = !!(
openingTagEndToken && hasTagEndTokenTrimRight(openingTagEndToken)
);
mountStatement.trimLeftCatch = !!(
catchTagStartToken && hasTagStartTokenTrimLeft(catchTagStartToken)
);
mountStatement.trimRightCatch = !!(
catchTagEndToken && hasTagEndTokenTrimRight(catchTagEndToken)
);
mountStatement.trimLeftEndmount = !!(
endmountTagStartToken &&
hasTagStartTokenTrimLeft(endmountTagStartToken)
);
return mountStatement;
},
};

@@ -22,2 +22,4 @@ /**

createNode,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';

@@ -33,2 +35,4 @@ import { VariableDeclarationStatement, SetStatement } from './../types';

let openingTagEndToken, closingTagStartToken;
do {

@@ -53,8 +57,13 @@ const name = tokens.expect(Types.SYMBOL);

tokens.expect(Types.TAG_END);
openingTagEndToken = tokens.la(-1);
values[0] = parser.parse((tokenText, token, tokens) => {
return !!(
const result = !!(
token.type === Types.TAG_START &&
tokens.nextIf(Types.SYMBOL, 'endset')
);
if (result) {
closingTagStartToken = token;
}
return result;
}).expressions;

@@ -87,4 +96,12 @@ }

setStatement.trimRightSet = !!(
openingTagEndToken && hasTagEndTokenTrimRight(openingTagEndToken)
);
setStatement.trimLeftEndset = !!(
closingTagStartToken &&
hasTagStartTokenTrimLeft(closingTagStartToken)
);
return setStatement;
},
};

@@ -16,3 +16,9 @@ /**

*/
import { Types, setStartFromToken, setEndFromToken } from 'melody-parser';
import {
Types,
setStartFromToken,
setEndFromToken,
hasTagStartTokenTrimLeft,
hasTagEndTokenTrimRight,
} from 'melody-parser';
import { SpacelessBlock } from './../types';

@@ -26,8 +32,12 @@

tokens.expect(Types.TAG_END);
const openingTagEndToken = tokens.la(-1);
let closingTagStartToken;
const body = parser.parse((tokenText, token, tokens) => {
return !!(
const result = !!(
token.type === Types.TAG_START &&
tokens.nextIf(Types.SYMBOL, 'endspaceless')
);
closingTagStartToken = token;
return result;
}).expressions;

@@ -39,4 +49,12 @@

spacelessBlock.trimRightSpaceless = hasTagEndTokenTrimRight(
openingTagEndToken
);
spacelessBlock.trimLeftEndspaceless = !!(
closingTagStartToken &&
hasTagStartTokenTrimLeft(closingTagStartToken)
);
return spacelessBlock;
},
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc