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

@lwc/ssr-compiler

Package Overview
Dependencies
Maintainers
0
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwc/ssr-compiler - npm Package Compare versions

Comparing version 8.2.0 to 8.3.0

dist/compile-template/transformers/comment.d.ts

4

dist/compile-template/index.d.ts

@@ -1,4 +0,4 @@

import type { TransformOptions } from '../shared';
export default function compileTemplate(src: string, filename: string, options: TransformOptions): {
import { type Config as TemplateCompilerConfig } from '@lwc/template-compiler';
export default function compileTemplate(src: string, filename: string, options: TemplateCompilerConfig): {
code: string;
};
import type { ImportDeclaration as EsImportDeclaration, Statement as EsStatement } from 'estree';
export declare const bImportHtmlEscape: (...replacementNodes: (import("estree").Node | import("estree").Node[] | null)[]) => EsImportDeclaration;
export declare const bImportHtmlEscape: () => EsImportDeclaration;
export declare const importHtmlEscapeKey = "import:htmlEscape";
export declare const isValidIdentifier: (str: string) => boolean;
export declare function optimizeAdjacentYieldStmts(statements: EsStatement[]): EsStatement[];
import type { Node as EsNode } from 'estree';
export declare const placeholder = false;
type ReplacementNode = EsNode | EsNode[] | null;
type ReturnsBool = (node: EsNode | null) => boolean;
export type Validator = ReturnsBool | typeof placeholder;
export declare function esTemplate<RetType = EsNode, ArgTypes extends ReplacementNode[] = ReplacementNode[]>(javascriptSegments: TemplateStringsArray, ...validatorFns: Validator[]): (...replacementNodes: ArgTypes) => RetType;
export declare function esTemplateWithYield<RetType = EsNode, ArgTypes extends ReplacementNode[] = ReplacementNode[]>(javascriptSegments: TemplateStringsArray, ...validatorFns: Validator[]): (...replacementNodes: ArgTypes) => RetType;
import type { Checker } from 'estree-toolkit/dist/generated/is-type';
/** Placeholder value to use to opt out of validation. */
declare const NO_VALIDATION = false;
/** A function that accepts a node and checks that it is a particular type of node. */
type Validator<T extends EsNode | null = EsNode | null> = (node: EsNode | null | undefined) => node is T;
/**
* A pointer to a previous value in the template literal, indicating that the value should be re-used.
* @see {@linkcode esTemplate}
*/
type ValidatorReference = number;
/** A validator, validation opt-out, or reference to previously-used validator. */
type ValidatorPlaceholder<T extends EsNode | null> = Validator<T> | ValidatorReference | typeof NO_VALIDATION;
/** Extracts the type being validated from the validator function. */
type ValidatedType<T> = T extends Validator<infer V> ? T extends Checker<infer C> ? // estree validator
C | C[] : // custom validator
V | Array<NonNullable<V>> : T extends typeof NO_VALIDATION ? // no validation = broadest type possible
EsNode | EsNode[] | null : never;
/**
* Converts the validators and refs used in the template to the list of parameters required by the
* created template function. Removes back references to previous slots from the list.
*/
type ToReplacementParameters<Arr extends unknown[]> = Arr extends [infer Head, ...infer Rest] ? Head extends number ? ToReplacementParameters<Rest> : [
ValidatedType<Head>,
...ToReplacementParameters<Rest>
] : [];
/**
* Template literal tag that generates a builder function. Like estree's `builders`, but for more
* complex structures. The template values should be estree `is` validators or a back reference to
* a previous slot (to re-use the referenced value).
*
* To have the generated function return a particular node type, the generic comes _after_ the
* template literal. Kinda weird, but it's necessary to infer the types of the template values.
* (If it were at the start, we'd need to explicitly provide _all_ type params. Tedious!)
* @example
* const bSum = esTemplate`(${is.identifier}, ${is.identifier}) => ${0} + ${1}`<EsArrowFunctionExpression>
* const sumFuncNode = bSum(b.identifier('a'), b.identifier('b'))
* // `sumFuncNode` is an AST node representing `(a, b) => a + b`
*/
export declare function esTemplate<Validators extends ValidatorPlaceholder<EsNode | null>[]>(javascriptSegments: TemplateStringsArray, ...Validators: Validators): <RetType>(...replacementNodes: ToReplacementParameters<Validators>) => RetType;
/** Similar to {@linkcode esTemplate}, but supports `yield` expressions. */
export declare function esTemplateWithYield<Validators extends ValidatorPlaceholder<EsNode | null>[]>(javascriptSegments: TemplateStringsArray, ...validators: Validators): <RetType>(...replacementNodes: ToReplacementParameters<Validators>) => RetType;
export {};
import type { ImportDeclaration } from 'estree';
export declare const bImportDeclaration: (...replacementNodes: (import("estree").Node | import("estree").Node[] | null)[]) => ImportDeclaration;
export declare const bImportDeclaration: (replacementNodes_0: import("estree").Identifier | import("estree").Identifier[], replacementNodes_1: (import("estree").SimpleLiteral & {
value: string;
}) | NonNullable<import("estree").SimpleLiteral & {
value: string;
}>[]) => ImportDeclaration;

@@ -1,5 +0,27 @@

import type { Node } from 'estree';
import type { Validator } from '../estemplate';
export declare const isStringLiteral: (node: Node | null) => boolean;
export declare const isIdentOrRenderCall: (node: Node | null) => boolean;
export declare function isNullableOf(validator: Validator): (node: Node | null) => boolean;
import type { CallExpression, Identifier, MemberExpression, SimpleLiteral } from 'estree';
import type { Checker } from 'estree-toolkit/dist/generated/is-type';
import type { Node } from 'estree-toolkit/dist/helpers';
/** Node representing a string literal. */
type StringLiteral = SimpleLiteral & {
value: string;
};
export declare const isStringLiteral: (node: Node | null | undefined) => node is StringLiteral;
/** Node representing an identifier named "render". */
type RenderIdentifier = Identifier & {
name: 'render';
};
/** Node representing a member expression `<something>.render`. */
type RenderMemberExpression = MemberExpression & {
property: RenderIdentifier;
};
/** Node representing a method call `<something>.render()`. */
type RenderCall = CallExpression & {
callee: RenderMemberExpression;
};
/** Returns `true` if the node is an identifier or `<something>.render()`. */
export declare const isIdentOrRenderCall: (node: Node | null | undefined) => node is Identifier | RenderCall;
/** A validator that returns `true` if the node is `null`. */
type NullableChecker<T extends Node> = (node: Node | null | undefined) => node is T | null;
/** Extends a validator to return `true` if the node is `null`. */
export declare function isNullableOf<T extends Node>(validator: Checker<T>): NullableChecker<T>;
export {};

@@ -0,1 +1,2 @@

import { Config as TemplateCompilerConfig } from '@lwc/template-compiler';
export type Expression = string;

@@ -32,5 +33,2 @@ export type Instruction = IEmitTagName | IEmitStaticString | IEmitExpression | IStartConditional | IEndConditional | IInvokeConnectedCallback | IRenderChild | IHoistImport | IHoistInstantiation;

}
export interface TransformOptions {
name?: string;
namespace?: string;
}
export type TransformOptions = Pick<TemplateCompilerConfig, 'name' | 'namespace'>;

@@ -7,3 +7,3 @@ {

"name": "@lwc/ssr-compiler",
"version": "8.2.0",
"version": "8.3.0",
"description": "Compile component for use during server-side rendering",

@@ -48,5 +48,5 @@ "keywords": [

"dependencies": {
"@lwc/shared": "8.2.0",
"@lwc/template-compiler": "8.2.0",
"acorn": "8.12.1",
"@lwc/shared": "8.3.0",
"@lwc/template-compiler": "8.3.0",
"acorn": "8.13.0",
"astring": "^1.9.0",

@@ -53,0 +53,0 @@ "estree-toolkit": "^1.7.8",

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

Sorry, the diff of this file is not supported yet

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

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