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

@shopify/liquid-html-parser

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/liquid-html-parser - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

14

dist/stage-1-cst.d.ts

@@ -70,3 +70,4 @@ /**

RenderVariableExpression = "RenderVariableExpression",
ContentForNamedArgument = "ContentForNamedArgument"
ContentForNamedArgument = "ContentForNamedArgument",
LiquidDocParamNode = "LiquidDocParamNode"
}

@@ -90,2 +91,8 @@ export declare const LiquidLiteralValues: {

}
export interface ConcreteLiquidDocParamNode extends ConcreteBasicNode<ConcreteNodeTypes.LiquidDocParamNode> {
name: 'param';
paramName: ConcreteTextNode;
paramDescription: ConcreteTextNode | null;
paramType: ConcreteTextNode | null;
}
export interface ConcreteHtmlNodeBase<T> extends ConcreteBasicNode<T> {

@@ -302,6 +309,7 @@ attrList?: ConcreteAttributeNode[];

}
export type LiquidHtmlConcreteNode = ConcreteHtmlNode | ConcreteLiquidNode | ConcreteTextNode | ConcreteYamlFrontmatterNode;
export type LiquidConcreteNode = ConcreteLiquidNode | ConcreteTextNode | ConcreteYamlFrontmatterNode;
export type LiquidHtmlConcreteNode = ConcreteHtmlNode | ConcreteYamlFrontmatterNode | LiquidConcreteNode;
export type LiquidConcreteNode = ConcreteLiquidNode | ConcreteTextNode | ConcreteYamlFrontmatterNode | LiquidDocConcreteNode;
export type LiquidHtmlCST = LiquidHtmlConcreteNode[];
export type LiquidCST = LiquidConcreteNode[];
export type LiquidDocConcreteNode = ConcreteLiquidDocParamNode;
export interface CSTBuildOptions {

@@ -308,0 +316,0 @@ /**

@@ -77,2 +77,3 @@ "use strict";

ConcreteNodeTypes["ContentForNamedArgument"] = "ContentForNamedArgument";
ConcreteNodeTypes["LiquidDocParamNode"] = "LiquidDocParamNode";
})(ConcreteNodeTypes = exports.ConcreteNodeTypes || (exports.ConcreteNodeTypes = {}));

@@ -791,13 +792,32 @@ exports.LiquidLiteralValues = {

}
/**
* Reusable text node type
*/
const textNode = {
type: ConcreteNodeTypes.TextNode,
value: function () {
return this.sourceString;
},
locStart,
locEnd,
source,
};
const LiquidDocMappings = {
Node: 0,
TextNode: {
type: ConcreteNodeTypes.TextNode,
value: function () {
return this.sourceString;
},
TextNode: textNode,
paramNode: {
type: ConcreteNodeTypes.LiquidDocParamNode,
name: 'param',
locStart,
locEnd,
source,
paramType: 2,
paramName: 4,
paramDescription: 8,
},
paramType: 2,
paramTypeContent: textNode,
paramName: textNode,
paramDescription: textNode,
fallbackNode: textNode,
};

@@ -804,0 +824,0 @@ return (0, extras_1.toAST)(res, LiquidDocMappings);

@@ -38,3 +38,3 @@ /**

/** The union type of all possible node types inside a LiquidHTML AST. */
export type LiquidHtmlNode = DocumentNode | YAMLFrontmatter | LiquidNode | HtmlDoctype | HtmlNode | AttributeNode | LiquidVariable | LiquidExpression | LiquidFilter | LiquidNamedArgument | AssignMarkup | ContentForMarkup | CycleMarkup | ForMarkup | RenderMarkup | PaginateMarkup | RawMarkup | RenderVariableExpression | LiquidLogicalExpression | LiquidComparison | TextNode;
export type LiquidHtmlNode = DocumentNode | YAMLFrontmatter | LiquidNode | HtmlDoctype | HtmlNode | AttributeNode | LiquidVariable | LiquidExpression | LiquidFilter | LiquidNamedArgument | AssignMarkup | ContentForMarkup | CycleMarkup | ForMarkup | RenderMarkup | PaginateMarkup | RawMarkup | RenderVariableExpression | LiquidLogicalExpression | LiquidComparison | TextNode | LiquidDocParamNode;
/** The root node of all LiquidHTML ASTs. */

@@ -560,2 +560,12 @@ export interface DocumentNode extends ASTNode<NodeTypes.Document> {

}
/** Represents a `@param` node in a LiquidDoc comment - `@param paramName {paramType} - paramDescription` */
export interface LiquidDocParamNode extends ASTNode<NodeTypes.LiquidDocParamNode> {
name: 'param';
/** The name of the parameter (e.g. "product") */
paramName: TextNode;
/** Optional description of the parameter in a Liquid doc comment (e.g. "The product title") */
paramDescription: TextNode | null;
/** Optional type annotation for the parameter (e.g. "{string}", "{number}") */
paramType: TextNode | null;
}
export interface ASTNode<T> {

@@ -562,0 +572,0 @@ /**

@@ -439,2 +439,19 @@ "use strict";

}
case stage_1_cst_1.ConcreteNodeTypes.LiquidDocParamNode: {
builder.push({
type: types_1.NodeTypes.LiquidDocParamNode,
name: node.name,
position: position(node),
source: node.source,
paramName: {
type: types_1.NodeTypes.TextNode,
value: node.paramName.value,
position: position(node.paramName),
source: node.paramName.source,
},
paramDescription: toNullableTextNode(node.paramDescription),
paramType: toNullableTextNode(node.paramType),
});
break;
}
default: {

@@ -1021,2 +1038,7 @@ (0, utils_1.assertNever)(node);

}
function toNullableTextNode(node) {
if (!node)
return null;
return toTextNode(node);
}
function toTextNode(node) {

@@ -1023,0 +1045,0 @@ return {

@@ -43,3 +43,4 @@ export interface Position {

RenderMarkup = "RenderMarkup",
RenderVariableExpression = "RenderVariableExpression"
RenderVariableExpression = "RenderVariableExpression",
LiquidDocParamNode = "LiquidDocParamNode"
}

@@ -46,0 +47,0 @@ export declare enum NamedTags {

@@ -42,2 +42,3 @@ "use strict";

NodeTypes["RenderVariableExpression"] = "RenderVariableExpression";
NodeTypes["LiquidDocParamNode"] = "LiquidDocParamNode";
})(NodeTypes = exports.NodeTypes || (exports.NodeTypes = {}));

@@ -44,0 +45,0 @@ // These are officially supported with special node types

@@ -392,3 +392,19 @@ module.exports = String.raw`Helpers {

LiquidDoc <: Helpers {
Node := (TextNode)*
Node := (LiquidDocNode | TextNode)*
LiquidDocNode =
| paramNode
| fallbackNode
// By default, space matches new lines as well. We override it here to make writing rules easier.
strictSpace = " " | "\t"
// We use this as an escape hatch to stop matching TextNode and try again when one of these characters is encountered
openControl:= "@" | end
fallbackNode = "@" anyExceptStar<endOfParam>
paramNode = "@param" strictSpace* paramType? strictSpace* paramName (strictSpace* "-")? strictSpace* paramDescription
paramType = "{" strictSpace* paramTypeContent strictSpace* "}"
paramTypeContent = anyExceptStar<("}"| strictSpace)>
paramName = identifierCharacter+
paramDescription = anyExceptStar<endOfParam>
endOfParam = strictSpace* (newline | end)
}

@@ -395,0 +411,0 @@

{
"name": "@shopify/liquid-html-parser",
"version": "2.2.0",
"version": "2.3.0",
"description": "Liquid HTML parser by Shopify",

@@ -5,0 +5,0 @@ "author": "CP Clermont <cp.clermont@shopify.com>",

Sorry, the diff of this file is not supported yet

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