@lwc/ssr-compiler 8.7.0 → 8.9.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.
- package/dist/compile-js/catalog-tmpls.d.ts +1 -1
- package/dist/compile-js/generate-markup.d.ts +1 -1
- package/dist/compile-js/index.d.ts +1 -1
- package/dist/compile-js/remove-decorator-import.d.ts +3 -0
- package/dist/compile-js/stylesheets.d.ts +1 -1
- package/dist/compile-js/types.d.ts +10 -0
- package/dist/compile-js/wire.d.ts +4 -0
- package/dist/compile-template/context.d.ts +2 -2
- package/dist/compile-template/ir-to-es.d.ts +2 -1
- package/dist/compile-template/shared.d.ts +4 -5
- package/dist/compile-template/transformers/lwc-component.d.ts +3 -0
- package/dist/compile-template/types.d.ts +2 -2
- package/dist/estree/builders.d.ts +2 -5
- package/dist/index.cjs.js +670 -1100
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +670 -1100
- package/dist/index.js.map +1 -1
- package/dist/shared.d.ts +2 -1
- package/package.json +3 -3
|
@@ -3,6 +3,6 @@ import type { ImportDeclaration } from 'estree';
|
|
|
3
3
|
import type { ComponentMetaState } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* While traversing the component JS, this takes note of any .html files that are
|
|
6
|
-
* explicitly imported
|
|
6
|
+
* explicitly imported.
|
|
7
7
|
*/
|
|
8
8
|
export declare function catalogTmplImport(path: NodePath<ImportDeclaration>, state: ComponentMetaState): void;
|
|
@@ -12,7 +12,7 @@ import type { ComponentMetaState } from './types';
|
|
|
12
12
|
* - yielding the tag name & attributes
|
|
13
13
|
* - deferring to the template function for yielding child content
|
|
14
14
|
*/
|
|
15
|
-
export declare function addGenerateMarkupExport(program: Program, state: ComponentMetaState, filename: string): void;
|
|
15
|
+
export declare function addGenerateMarkupExport(program: Program, state: ComponentMetaState, tagName: string, filename: string): void;
|
|
16
16
|
/**
|
|
17
17
|
* Attach the `generateMarkup` function to the Component class so that it can be found later
|
|
18
18
|
* during `renderComponent`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CompilationMode } from '../shared';
|
|
2
|
-
export default function compileJS(src: string, filename: string, compilationMode: CompilationMode): {
|
|
2
|
+
export default function compileJS(src: string, filename: string, tagName: string, compilationMode: CompilationMode): {
|
|
3
3
|
code: string;
|
|
4
4
|
};
|
|
@@ -5,5 +5,5 @@ export declare function catalogAndReplaceStyleImports(path: NodePath<ImportDecla
|
|
|
5
5
|
/**
|
|
6
6
|
* This adds implicit style imports to the compiled component artifact.
|
|
7
7
|
*/
|
|
8
|
-
export declare function getStylesheetImports(filepath: string):
|
|
8
|
+
export declare function getStylesheetImports(filepath: string): Array<[Record<string, string>, string]>;
|
|
9
9
|
export declare function catalogStaticStylesheets(ids: string[], state: ComponentMetaState): void;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { traverse } from 'estree-toolkit';
|
|
2
2
|
import type { Node } from 'estree';
|
|
3
3
|
export type Visitors = Parameters<typeof traverse<Node, ComponentMetaState>>[1];
|
|
4
|
+
export interface WireAdapter {
|
|
5
|
+
fieldName: string;
|
|
6
|
+
adapterConstructorId: string;
|
|
7
|
+
config: Array<{
|
|
8
|
+
configKey: string;
|
|
9
|
+
referencedField: string;
|
|
10
|
+
}>;
|
|
11
|
+
fieldType: 'property' | 'method';
|
|
12
|
+
}
|
|
4
13
|
export interface ComponentMetaState {
|
|
5
14
|
isLWC: boolean;
|
|
6
15
|
hasConstructor: boolean;
|
|
@@ -16,4 +25,5 @@ export interface ComponentMetaState {
|
|
|
16
25
|
staticStylesheetIds: Set<string> | null;
|
|
17
26
|
publicFields: Array<string>;
|
|
18
27
|
privateFields: Array<string>;
|
|
28
|
+
wireAdapters: WireAdapter[];
|
|
19
29
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PropertyDefinition, Statement, MethodDefinition } from 'estree';
|
|
2
|
+
import type { ComponentMetaState, WireAdapter } from './types';
|
|
3
|
+
export declare function catalogWireAdapters(state: ComponentMetaState, node: PropertyDefinition | MethodDefinition): void;
|
|
4
|
+
export declare function bWireAdaptersPlumbing(adapters: WireAdapter[]): Statement[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ImportDeclaration as EsImportDeclaration } from 'estree';
|
|
2
2
|
import type { TemplateOpts, TransformerContext } from './types';
|
|
3
3
|
export declare function createNewContext(templateOptions: TemplateOpts): {
|
|
4
|
-
|
|
4
|
+
getImports: () => EsImportDeclaration[];
|
|
5
5
|
cxt: TransformerContext;
|
|
6
6
|
};
|
|
@@ -4,6 +4,7 @@ import type { TemplateOpts, TransformerContext } from './types';
|
|
|
4
4
|
export declare function irChildrenToEs(children: IrChildNode[], cxt: TransformerContext): EsStatement[];
|
|
5
5
|
export declare function irToEs<T extends IrNode>(node: T, cxt: TransformerContext): EsStatement[];
|
|
6
6
|
export declare function templateIrToEsTree(node: IrNode, contextOpts: TemplateOpts): {
|
|
7
|
-
|
|
7
|
+
addImport: (imports: string | string[] | Record<string, string | undefined>, source?: string | undefined) => void;
|
|
8
|
+
getImports: () => import("estree").ImportDeclaration[];
|
|
8
9
|
statements: EsStatement[];
|
|
9
10
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { Node as IrNode } from '@lwc/template-compiler';
|
|
1
|
+
import { Node as IrNode, Attribute as IrAttribute, Property as IrProperty } from '@lwc/template-compiler';
|
|
2
2
|
import { TransformerContext } from './types';
|
|
3
|
-
import type { Statement as EsStatement, Expression as EsExpression } from 'estree';
|
|
4
|
-
export declare const bImportHtmlEscape: () => import("estree").ImportDeclaration;
|
|
5
|
-
export declare const importHtmlEscapeKey = "import:htmlEscape";
|
|
6
|
-
export declare const isValidIdentifier: (str: string) => boolean;
|
|
3
|
+
import type { Statement as EsStatement, Expression as EsExpression, ObjectExpression as EsObjectExpression } from 'estree';
|
|
7
4
|
export declare function optimizeAdjacentYieldStmts(statements: EsStatement[]): EsStatement[];
|
|
8
5
|
export declare function bAttributeValue(node: IrNode, attrName: string): EsExpression;
|
|
9
6
|
/**
|
|
@@ -14,3 +11,5 @@ export declare function bAttributeValue(node: IrNode, attrName: string): EsExpre
|
|
|
14
11
|
* @param expression
|
|
15
12
|
*/
|
|
16
13
|
export declare function getScopedExpression(expression: EsExpression, cxt: TransformerContext): EsExpression;
|
|
14
|
+
export declare function normalizeClassAttributeValue(value: string): string;
|
|
15
|
+
export declare function getChildAttrsOrProps(attrs: (IrAttribute | IrProperty)[], cxt: TransformerContext): EsObjectExpression;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Node as IrNode } from '@lwc/template-compiler';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Statement as EsStatement } from 'estree';
|
|
3
3
|
export type Transformer<T extends IrNode = IrNode> = (node: T, cxt: TransformerContext) => EsStatement[];
|
|
4
4
|
export interface TransformerContext {
|
|
5
|
-
hoist: (stmt: EsStatement | EsModuleDeclaration, dedupeKey: string) => void;
|
|
6
5
|
pushLocalVars: (vars: string[]) => void;
|
|
7
6
|
popLocalVars: () => void;
|
|
8
7
|
isLocalVar: (varName: string | null | undefined) => boolean;
|
|
@@ -10,6 +9,7 @@ export interface TransformerContext {
|
|
|
10
9
|
templateOptions: TemplateOpts;
|
|
11
10
|
prevSibling?: IrNode;
|
|
12
11
|
nextSibling?: IrNode;
|
|
12
|
+
import: (imports: string | string[] | Record<string, string | undefined>, source?: string) => void;
|
|
13
13
|
}
|
|
14
14
|
export interface TemplateOpts {
|
|
15
15
|
preserveComments: boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ImportDeclaration } from 'estree';
|
|
2
|
-
/** Creates a default import statement, e.g. `import pkg from "pkg"` */
|
|
3
|
-
export declare const bImportDefaultDeclaration: (name: string, source: string) => ImportDeclaration;
|
|
4
2
|
/**
|
|
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`).
|
|
3
|
+
* Creates an import statement, e.g. `import { foo, bar as $bar$ } from "pkg"`
|
|
7
4
|
* @param imports names to be imported; values can be a string (plain import) or object (aliased)
|
|
8
5
|
* @param source source location to import from; defaults to @lwc/ssr-runtime
|
|
9
6
|
*/
|
|
10
|
-
export declare const bImportDeclaration: (imports:
|
|
7
|
+
export declare const bImportDeclaration: (imports: string | string[] | Record<string, string | undefined>, source?: string) => ImportDeclaration;
|