pull/15538/head
Rich Harris 4 months ago
parent 22cf914aad
commit a9f2d6f6d0

@ -1,7 +1,7 @@
/** /**
* @import { ComponentContext, TemplateOperations, ComponentClientTransformState } from "../types.js" * @import { ComponentContext, ComponentClientTransformState } from "../types.js"
* @import { Identifier, Expression } from "estree" * @import { Identifier, Expression } from "estree"
* @import { AST, Namespace } from '#compiler' * @import { Namespace } from '#compiler'
* @import { SourceLocation } from '#shared' * @import { SourceLocation } from '#shared'
*/ */
import { dev } from '../../../../state.js'; import { dev } from '../../../../state.js';

@ -1,13 +1,11 @@
/** /** @import { TemplateOperation } from '../types.js' */
* @import { TemplateOperations } from "../types.js" /** @import { ObjectExpression, Identifier, ArrayExpression, Property, Expression, Literal } from 'estree' */
* @import { ObjectExpression, Identifier, ArrayExpression, Property, Expression, Literal } from "estree"
*/
import * as b from '../../../../utils/builders.js'; import * as b from '../../../../utils/builders.js';
import { regex_is_valid_identifier } from '../../../patterns.js'; import { regex_is_valid_identifier } from '../../../patterns.js';
import fix_attribute_casing from './fix-attribute-casing.js'; import fix_attribute_casing from './fix-attribute-casing.js';
/** /**
* @param {TemplateOperations} items * @param {TemplateOperation[]} items
*/ */
export function template_to_functions(items) { export function template_to_functions(items) {
let elements = b.array([]); let elements = b.array([]);

@ -1,11 +1,9 @@
/** /** @import { TemplateOperation } from '../types.js' */
* @import { TemplateOperations } from "../types.js"
*/
import { escape_html } from '../../../../../escaping.js'; import { escape_html } from '../../../../../escaping.js';
import { is_void } from '../../../../../utils.js'; import { is_void } from '../../../../../utils.js';
/** /**
* @param {TemplateOperations} items * @param {TemplateOperation[]} items
*/ */
export function template_to_string(items) { export function template_to_string(items) {
/** /**

@ -36,7 +36,7 @@ export interface ClientTransformState extends TransformState {
>; >;
} }
type TemplateOperations = Array< type TemplateOperation =
| { | {
kind: 'create_element'; kind: 'create_element';
name: string; name: string;
@ -59,8 +59,7 @@ type TemplateOperations = Array<
} }
| { | {
kind: 'pop_element'; kind: 'pop_element';
} };
>;
export interface ComponentClientTransformState extends ClientTransformState { export interface ComponentClientTransformState extends ClientTransformState {
readonly analysis: ComponentAnalysis; readonly analysis: ComponentAnalysis;
@ -79,7 +78,7 @@ export interface ComponentClientTransformState extends ClientTransformState {
/** Expressions used inside the render effect */ /** Expressions used inside the render effect */
readonly expressions: Expression[]; readonly expressions: Expression[];
/** The HTML template string */ /** The HTML template string */
readonly template: TemplateOperations; readonly template: TemplateOperation[];
readonly locations: SourceLocation[]; readonly locations: SourceLocation[];
readonly metadata: { readonly metadata: {
namespace: Namespace; namespace: Namespace;

Loading…
Cancel
Save