@lwc/ssr-compiler 8.3.0 → 8.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,3 +13,8 @@ import type { ComponentMetaState } from './types';
13
13
  * - deferring to the template function for yielding child content
14
14
  */
15
15
  export declare function addGenerateMarkupExport(program: Program, state: ComponentMetaState, filename: string): void;
16
+ /**
17
+ * Attach the `generateMarkup` function to the Component class so that it can be found later
18
+ * during `renderComponent`.
19
+ */
20
+ export declare function assignGenerateMarkupToComponent(program: Program, state: ComponentMetaState): void;
@@ -1,3 +1,4 @@
1
- export default function compileJS(src: string, filename: string): {
1
+ import type { CompilationMode } from '../shared';
2
+ export default function compileJS(src: string, filename: string, compilationMode: CompilationMode): {
2
3
  code: string;
3
4
  };
@@ -1,7 +1,7 @@
1
1
  import type { NodePath } from 'estree-toolkit';
2
2
  import type { ImportDeclaration } from 'estree';
3
3
  import type { ComponentMetaState } from './types';
4
- export declare function catalogStyleImport(path: NodePath<ImportDeclaration>, state: ComponentMetaState): void;
4
+ export declare function catalogAndReplaceStyleImports(path: NodePath<ImportDeclaration>, state: ComponentMetaState): void;
5
5
  /**
6
6
  * This adds implicit style imports to the compiled component artifact.
7
7
  */
@@ -14,5 +14,4 @@ export interface ComponentMetaState {
14
14
  tmplExplicitImports: Map<string, string> | null;
15
15
  cssExplicitImports: Map<string, string> | null;
16
16
  staticStylesheetIds: Set<string> | null;
17
- reflectedPropsInPlay: Set<string>;
18
17
  }
@@ -1,4 +1,5 @@
1
1
  import { type Config as TemplateCompilerConfig } from '@lwc/template-compiler';
2
- export default function compileTemplate(src: string, filename: string, options: TemplateCompilerConfig): {
2
+ import type { CompilationMode } from '../shared';
3
+ export default function compileTemplate(src: string, filename: string, options: TemplateCompilerConfig, compilationMode: CompilationMode): {
3
4
  code: string;
4
5
  };
@@ -1,5 +1,16 @@
1
- import type { ImportDeclaration as EsImportDeclaration, Statement as EsStatement } from 'estree';
2
- export declare const bImportHtmlEscape: () => EsImportDeclaration;
1
+ import { Node as IrNode } from '@lwc/template-compiler';
2
+ import { TransformerContext } from './types';
3
+ import type { Statement as EsStatement, Expression as EsExpression } from 'estree';
4
+ export declare const bImportHtmlEscape: () => import("estree").ImportDeclaration;
3
5
  export declare const importHtmlEscapeKey = "import:htmlEscape";
4
6
  export declare const isValidIdentifier: (str: string) => boolean;
5
7
  export declare function optimizeAdjacentYieldStmts(statements: EsStatement[]): EsStatement[];
8
+ export declare function bAttributeValue(node: IrNode, attrName: string): EsExpression;
9
+ /**
10
+ * Given an expression in a context, return an expression that may be scoped to that context.
11
+ * For example, for the expression `foo`, it will typically be `instance.foo`, but if we're
12
+ * inside a `for:each` block then the `foo` variable may refer to the scoped `foo`,
13
+ * e.g. `<template for:each={foos} for:item="foo">`
14
+ * @param expression
15
+ */
16
+ export declare function getScopedExpression(expression: EsExpression, cxt: TransformerContext): EsExpression;
@@ -1,6 +1,10 @@
1
1
  import type { ImportDeclaration } from 'estree';
2
- export declare const bImportDeclaration: (replacementNodes_0: import("estree").Identifier | import("estree").Identifier[], replacementNodes_1: (import("estree").SimpleLiteral & {
3
- value: string;
4
- }) | NonNullable<import("estree").SimpleLiteral & {
5
- value: string;
6
- }>[]) => ImportDeclaration;
2
+ /** Creates a default import statement, e.g. `import pkg from "pkg"` */
3
+ export declare const bImportDefaultDeclaration: (name: string, source: string) => ImportDeclaration;
4
+ /**
5
+ * Creates an import statement, e.g. `import { foo, bar as $bar$ } from "pkg"`.
6
+ * Does not support default or namespace imports (`import pkg` or `import * as pkg`).
7
+ * @param imports names to be imported; values can be a string (plain import) or object (aliased)
8
+ * @param source source location to import from; defaults to @lwc/ssr-runtime
9
+ */
10
+ export declare const bImportDeclaration: (imports: (string | Record<string, string>)[], source?: string) => ImportDeclaration;
@@ -1,11 +1,6 @@
1
- import type { CallExpression, Identifier, MemberExpression, SimpleLiteral } from 'estree';
1
+ import type { CallExpression, Identifier, MemberExpression } from 'estree';
2
2
  import type { Checker } from 'estree-toolkit/dist/generated/is-type';
3
3
  import type { Node } from 'estree-toolkit/dist/helpers';
4
- /** Node representing a string literal. */
5
- type StringLiteral = SimpleLiteral & {
6
- value: string;
7
- };
8
- export declare const isStringLiteral: (node: Node | null | undefined) => node is StringLiteral;
9
4
  /** Node representing an identifier named "render". */
10
5
  type RenderIdentifier = Identifier & {
11
6
  name: 'render';