Annoying Lint PR™ (#3)

* Add Prettier + ESLint

* Format files
This commit is contained in:
Drew Powers 2021-03-16 12:37:45 -06:00 committed by GitHub
parent 1f5c7c791f
commit 8c45c4a856
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
113 changed files with 21295 additions and 21068 deletions

13
.eslintrc.cjs Normal file
View file

@ -0,0 +1,13 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off',
'prettier/prettier': 'error',
'prefer-const': 'off',
},
};

7
.prettierrc.json Normal file
View file

@ -0,0 +1,7 @@
{
"printWidth": 180,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}

917
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,9 @@
}, },
"scripts": { "scripts": {
"build": "tsc && npm run copy-js", "build": "tsc && npm run copy-js",
"lint": "eslint 'src/**/*.{js,ts}'",
"dev": "concurrently 'tsc --watch' 'npm run copy-js:watch'", "dev": "concurrently 'tsc --watch' 'npm run copy-js:watch'",
"format": "prettier -w 'src/**/*.{js,ts}'",
"copy-js": "copyfiles -u 1 src/*.js lib/", "copy-js": "copyfiles -u 1 src/*.js lib/",
"copy-js:watch": "nodemon -w src --ext js --exec 'npm run copy-js'" "copy-js:watch": "nodemon -w src --ext js --exec 'npm run copy-js'"
}, },
@ -45,12 +47,18 @@
}, },
"devDependencies": { "devDependencies": {
"@types/yargs-parser": "^20.2.0", "@types/yargs-parser": "^20.2.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"concurrently": "^6.0.0", "concurrently": "^6.0.0",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"estree-walker": "^3.0.0", "estree-walker": "^3.0.0",
"nodemon": "^2.0.7", "nodemon": "^2.0.7",
"preact": "^10.5.12", "preact": "^10.5.12",
"preact-render-to-string": "^5.1.14", "preact-render-to-string": "^5.1.14",
"prettier": "^2.2.1",
"typescript": "^4.2.3" "typescript": "^4.2.3"
} }
} }

View file

@ -1,4 +1,3 @@
export interface AstroConfigRaw { export interface AstroConfigRaw {
dist: string; dist: string;
projectRoot: string; projectRoot: string;
@ -9,4 +8,4 @@ export interface AstroConfig {
dist: string; dist: string;
projectRoot: URL; projectRoot: URL;
hmxRoot: URL; hmxRoot: URL;
} }

View file

@ -1,22 +1,22 @@
interface Timing { interface Timing {
label: string; label: string;
start: number; start: number;
end: number; end: number;
children: Timing[]; children: Timing[];
} }
export default class Stats { export default class Stats {
start_time: number; start_time: number;
current_timing: Timing; current_timing: Timing;
current_children: Timing[]; current_children: Timing[];
timings: Timing[]; timings: Timing[];
stack: Timing[]; stack: Timing[];
constructor(); constructor();
start(label: any): void; start(label: any): void;
stop(label: any): void; stop(label: any): void;
render(): { render(): {
timings: { timings: {
total: number; total: number;
};
}; };
};
} }
export {}; export {};

View file

@ -8,123 +8,131 @@ import Slot from './nodes/Slot';
import { Node, ImportDeclaration, Identifier } from 'estree'; import { Node, ImportDeclaration, Identifier } from 'estree';
import Element from './nodes/Element'; import Element from './nodes/Element';
interface ComponentOptions { interface ComponentOptions {
namespace?: string; namespace?: string;
tag?: string; tag?: string;
immutable?: boolean; immutable?: boolean;
accessors?: boolean; accessors?: boolean;
preserveWhitespace?: boolean; preserveWhitespace?: boolean;
} }
export default class Component { export default class Component {
stats: Stats; stats: Stats;
warnings: Warning[]; warnings: Warning[];
ignores: Set<string>; ignores: Set<string>;
ignore_stack: Array<Set<string>>; ignore_stack: Array<Set<string>>;
ast: Ast;
original_ast: Ast;
source: string;
name: Identifier;
compile_options: CompileOptions;
fragment: Fragment;
module_scope: Scope;
instance_scope: Scope;
instance_scope_map: WeakMap<Node, Scope>;
component_options: ComponentOptions;
namespace: string;
tag: string;
accessors: boolean;
vars: Var[];
var_lookup: Map<string, Var>;
imports: ImportDeclaration[];
hoistable_nodes: Set<Node>;
node_for_declaration: Map<string, Node>;
partly_hoisted: Array<Node | Node[]>;
fully_hoisted: Array<Node | Node[]>;
reactive_declarations: Array<{
assignees: Set<string>;
dependencies: Set<string>;
node: Node;
declaration: Node;
}>;
reactive_declaration_nodes: Set<Node>;
has_reactive_assignments: boolean;
injected_reactive_declaration_vars: Set<string>;
helpers: Map<string, Identifier>;
globals: Map<string, Identifier>;
indirect_dependencies: Map<string, Set<string>>;
file: string;
locate: (
c: number
) => {
line: number;
column: number;
};
elements: Element[];
stylesheet: Stylesheet;
aliases: Map<string, Identifier>;
used_names: Set<string>;
globally_used_names: Set<string>;
slots: Map<string, Slot>;
slot_outlets: Set<string>;
constructor(ast: Ast, source: string, name: string, compile_options: CompileOptions, stats: Stats, warnings: Warning[]);
add_var(variable: Var): void;
add_reference(name: string): void;
alias(name: string): Identifier;
apply_stylesheet(element: Element): void;
global(name: string): Identifier;
generate(result?: {
js: Node[];
css: CssResult;
}): {
js: any;
css: any;
ast: Ast; ast: Ast;
original_ast: Ast; warnings: Warning[];
source: string; vars: {
name: Identifier; name: string;
compile_options: CompileOptions; export_name: string;
fragment: Fragment; injected: boolean;
module_scope: Scope; module: boolean;
instance_scope: Scope; mutated: boolean;
instance_scope_map: WeakMap<Node, Scope>; reassigned: boolean;
component_options: ComponentOptions; referenced: boolean;
namespace: string; writable: boolean;
tag: string; referenced_from_script: boolean;
accessors: boolean; }[];
vars: Var[]; stats: {
var_lookup: Map<string, Var>; timings: {
imports: ImportDeclaration[]; total: number;
hoistable_nodes: Set<Node>; };
node_for_declaration: Map<string, Node>;
partly_hoisted: Array<(Node | Node[])>;
fully_hoisted: Array<(Node | Node[])>;
reactive_declarations: Array<{
assignees: Set<string>;
dependencies: Set<string>;
node: Node;
declaration: Node;
}>;
reactive_declaration_nodes: Set<Node>;
has_reactive_assignments: boolean;
injected_reactive_declaration_vars: Set<string>;
helpers: Map<string, Identifier>;
globals: Map<string, Identifier>;
indirect_dependencies: Map<string, Set<string>>;
file: string;
locate: (c: number) => {
line: number;
column: number;
}; };
elements: Element[]; };
stylesheet: Stylesheet; get_unique_name(name: string, scope?: Scope): Identifier;
aliases: Map<string, Identifier>; get_unique_name_maker(): (name: string) => Identifier;
used_names: Set<string>; error(
globally_used_names: Set<string>; pos: {
slots: Map<string, Slot>; start: number;
slot_outlets: Set<string>; end: number;
constructor(ast: Ast, source: string, name: string, compile_options: CompileOptions, stats: Stats, warnings: Warning[]); },
add_var(variable: Var): void; e: {
add_reference(name: string): void; code: string;
alias(name: string): Identifier; message: string;
apply_stylesheet(element: Element): void; }
global(name: string): Identifier; ): void;
generate(result?: { warn(
js: Node[]; pos: {
css: CssResult; start: number;
}): { end: number;
js: any; },
css: any; warning: {
ast: Ast; code: string;
warnings: Warning[]; message: string;
vars: { }
name: string; ): void;
export_name: string; extract_imports(node: any): void;
injected: boolean; extract_exports(node: any): any;
module: boolean; extract_javascript(script: any): any;
mutated: boolean; walk_module_js(): void;
reassigned: boolean; walk_instance_js_pre_template(): void;
referenced: boolean; walk_instance_js_post_template(): void;
writable: boolean; post_template_walk(): void;
referenced_from_script: boolean; track_references_and_mutations(): void;
}[]; warn_on_undefined_store_value_references(node: Node, parent: Node, prop: string, scope: Scope): void;
stats: { loop_protect(node: any, scope: Scope, timeout: number): Node | null;
timings: { rewrite_props(get_insert: (variable: Var) => Node[]): void;
total: number; hoist_instance_declarations(): void;
}; extract_reactive_declarations(): void;
}; warn_if_undefined(name: string, node: any, template_scope: TemplateScope): void;
}; push_ignores(ignores: any): void;
get_unique_name(name: string, scope?: Scope): Identifier; pop_ignores(): void;
get_unique_name_maker(): (name: string) => Identifier;
error(pos: {
start: number;
end: number;
}, e: {
code: string;
message: string;
}): void;
warn(pos: {
start: number;
end: number;
}, warning: {
code: string;
message: string;
}): void;
extract_imports(node: any): void;
extract_exports(node: any): any;
extract_javascript(script: any): any;
walk_module_js(): void;
walk_instance_js_pre_template(): void;
walk_instance_js_post_template(): void;
post_template_walk(): void;
track_references_and_mutations(): void;
warn_on_undefined_store_value_references(node: Node, parent: Node, prop: string, scope: Scope): void;
loop_protect(node: any, scope: Scope, timeout: number): Node | null;
rewrite_props(get_insert: (variable: Var) => Node[]): void;
hoist_instance_declarations(): void;
extract_reactive_declarations(): void;
warn_if_undefined(name: string, node: any, template_scope: TemplateScope): void;
push_ignores(ignores: any): void;
pop_ignores(): void;
} }
export {}; export {};

View file

@ -1,14 +1,24 @@
import { ModuleFormat } from '../interfaces'; import { ModuleFormat } from '../interfaces';
import { Identifier, ImportDeclaration } from 'estree'; import { Identifier, ImportDeclaration } from 'estree';
interface Export { interface Export {
name: string; name: string;
as: string; as: string;
} }
export default function create_module(program: any, format: ModuleFormat, name: Identifier, banner: string, sveltePath: string, helpers: Array<{ export default function create_module(
program: any,
format: ModuleFormat,
name: Identifier,
banner: string,
sveltePath: string,
helpers: Array<{
name: string; name: string;
alias: Identifier; alias: Identifier;
}>, globals: Array<{ }>,
globals: Array<{
name: string; name: string;
alias: Identifier; alias: Identifier;
}>, imports: ImportDeclaration[], module_exports: Export[]): void; }>,
imports: ImportDeclaration[],
module_exports: Export[]
): void;
export {}; export {};

View file

@ -4,27 +4,27 @@ import { CssNode } from './interfaces';
import Component from '../Component'; import Component from '../Component';
import Element from '../nodes/Element'; import Element from '../nodes/Element';
export default class Selector { export default class Selector {
node: CssNode; node: CssNode;
stylesheet: Stylesheet; stylesheet: Stylesheet;
blocks: Block[]; blocks: Block[];
local_blocks: Block[]; local_blocks: Block[];
used: boolean; used: boolean;
constructor(node: CssNode, stylesheet: Stylesheet); constructor(node: CssNode, stylesheet: Stylesheet);
apply(node: Element): void; apply(node: Element): void;
minify(code: MagicString): void; minify(code: MagicString): void;
transform(code: MagicString, attr: string, max_amount_class_specificity_increased: number): void; transform(code: MagicString, attr: string, max_amount_class_specificity_increased: number): void;
validate(component: Component): void; validate(component: Component): void;
get_amount_class_specificity_increased(): number; get_amount_class_specificity_increased(): number;
} }
declare class Block { declare class Block {
global: boolean; global: boolean;
host: boolean; host: boolean;
combinator: CssNode; combinator: CssNode;
selectors: CssNode[]; selectors: CssNode[];
start: number; start: number;
end: number; end: number;
should_encapsulate: boolean; should_encapsulate: boolean;
constructor(combinator: CssNode); constructor(combinator: CssNode);
add(selector: CssNode): void; add(selector: CssNode): void;
} }
export {}; export {};

View file

@ -5,63 +5,73 @@ import { Ast, CssHashGetter } from '../../interfaces';
import Component from '../Component'; import Component from '../Component';
import { CssNode } from './interfaces'; import { CssNode } from './interfaces';
declare class Rule { declare class Rule {
selectors: Selector[]; selectors: Selector[];
declarations: Declaration[]; declarations: Declaration[];
node: CssNode; node: CssNode;
parent: Atrule; parent: Atrule;
constructor(node: CssNode, stylesheet: any, parent?: Atrule); constructor(node: CssNode, stylesheet: any, parent?: Atrule);
apply(node: Element): void; apply(node: Element): void;
is_used(dev: boolean): boolean; is_used(dev: boolean): boolean;
minify(code: MagicString, _dev: boolean): void; minify(code: MagicString, _dev: boolean): void;
transform(code: MagicString, id: string, keyframes: Map<string, string>, max_amount_class_specificity_increased: number): boolean; transform(code: MagicString, id: string, keyframes: Map<string, string>, max_amount_class_specificity_increased: number): boolean;
validate(component: Component): void; validate(component: Component): void;
warn_on_unused_selector(handler: (selector: Selector) => void): void; warn_on_unused_selector(handler: (selector: Selector) => void): void;
get_max_amount_class_specificity_increased(): number; get_max_amount_class_specificity_increased(): number;
} }
declare class Declaration { declare class Declaration {
node: CssNode; node: CssNode;
constructor(node: CssNode); constructor(node: CssNode);
transform(code: MagicString, keyframes: Map<string, string>): void; transform(code: MagicString, keyframes: Map<string, string>): void;
minify(code: MagicString): void; minify(code: MagicString): void;
} }
declare class Atrule { declare class Atrule {
node: CssNode; node: CssNode;
children: Array<Atrule | Rule>; children: Array<Atrule | Rule>;
declarations: Declaration[]; declarations: Declaration[];
constructor(node: CssNode); constructor(node: CssNode);
apply(node: Element): void; apply(node: Element): void;
is_used(_dev: boolean): boolean; is_used(_dev: boolean): boolean;
minify(code: MagicString, dev: boolean): void; minify(code: MagicString, dev: boolean): void;
transform(code: MagicString, id: string, keyframes: Map<string, string>, max_amount_class_specificity_increased: number): void; transform(code: MagicString, id: string, keyframes: Map<string, string>, max_amount_class_specificity_increased: number): void;
validate(component: Component): void; validate(component: Component): void;
warn_on_unused_selector(handler: (selector: Selector) => void): void; warn_on_unused_selector(handler: (selector: Selector) => void): void;
get_max_amount_class_specificity_increased(): any; get_max_amount_class_specificity_increased(): any;
} }
export default class Stylesheet { export default class Stylesheet {
source: string;
ast: Ast;
filename: string;
dev: boolean;
has_styles: boolean;
id: string;
children: Array<Rule | Atrule>;
keyframes: Map<string, string>;
nodes_with_css_class: Set<CssNode>;
constructor({
source,
ast,
component_name,
filename,
dev,
get_css_hash,
}: {
source: string; source: string;
ast: Ast; ast: Ast;
filename: string; filename: string | undefined;
component_name: string | undefined;
dev: boolean; dev: boolean;
has_styles: boolean; get_css_hash: CssHashGetter;
id: string; });
children: Array<Rule | Atrule>; apply(node: Element): void;
keyframes: Map<string, string>; reify(): void;
nodes_with_css_class: Set<CssNode>; render(
constructor({ source, ast, component_name, filename, dev, get_css_hash }: { file: string,
source: string; should_transform_selectors: boolean
ast: Ast; ): {
filename: string | undefined; code: string;
component_name: string | undefined; map: import('magic-string').SourceMap;
dev: boolean; };
get_css_hash: CssHashGetter; validate(component: Component): void;
}); warn_on_unused_selectors(component: Component): void;
apply(node: Element): void;
reify(): void;
render(file: string, should_transform_selectors: boolean): {
code: string;
map: import("magic-string").SourceMap;
};
validate(component: Component): void;
warn_on_unused_selectors(component: Component): void;
} }
export {}; export {};

View file

@ -1,6 +1,6 @@
export interface CssNode { export interface CssNode {
type: string; type: string;
start: number; start: number;
end: number; end: number;
[prop_name: string]: any; [prop_name: string]: any;
} }

View file

@ -1,23 +1,26 @@
import { CompileOptions, Warning } from '../interfaces'; import { CompileOptions, Warning } from '../interfaces';
export default function compile(source: string, options?: CompileOptions): { export default function compile(
js: any; source: string,
css: any; options?: CompileOptions
ast: import("../interfaces").Ast; ): {
warnings: Warning[]; js: any;
vars: { css: any;
name: string; ast: import('../interfaces').Ast;
export_name: string; warnings: Warning[];
injected: boolean; vars: {
module: boolean; name: string;
mutated: boolean; export_name: string;
reassigned: boolean; injected: boolean;
referenced: boolean; module: boolean;
writable: boolean; mutated: boolean;
referenced_from_script: boolean; reassigned: boolean;
}[]; referenced: boolean;
stats: { writable: boolean;
timings: { referenced_from_script: boolean;
total: number; }[];
}; stats: {
timings: {
total: number;
}; };
};
}; };

View file

@ -4,10 +4,10 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { Directive } from '../../interfaces'; import { Directive } from '../../interfaces';
export default class Action extends Node { export default class Action extends Node {
type: 'Action'; type: 'Action';
name: string; name: string;
expression: Expression; expression: Expression;
uses_context: boolean; uses_context: boolean;
template_scope: TemplateScope; template_scope: TemplateScope;
constructor(component: Component, parent: Node, scope: TemplateScope, info: Directive); constructor(component: Component, parent: Node, scope: TemplateScope, info: Directive);
} }

View file

@ -5,8 +5,8 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import Element from './Element'; import Element from './Element';
export default class Animation extends Node { export default class Animation extends Node {
type: 'Animation'; type: 'Animation';
name: string; name: string;
expression: Expression; expression: Expression;
constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -6,25 +6,97 @@ import Expression from './shared/Expression';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Attribute extends Node { export default class Attribute extends Node {
type: 'Attribute' | 'Spread'; type: 'Attribute' | 'Spread';
start: number; start: number;
end: number; end: number;
scope: TemplateScope; scope: TemplateScope;
component: Component; component: Component;
parent: Element; parent: Element;
name: string; name: string;
is_spread: boolean; is_spread: boolean;
is_true: boolean; is_true: boolean;
is_static: boolean; is_static: boolean;
expression?: Expression; expression?: Expression;
chunks: Array<Text | Expression>; chunks: Array<Text | Expression>;
dependencies: Set<string>; dependencies: Set<string>;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
get_dependencies(): string[]; get_dependencies(): string[];
get_value(block: any): import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | { get_value(
block: any
):
| import('estree').Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier
| {
type: string; type: string;
value: string; value: string;
}; };
get_static_value(): string | true; get_static_value(): string | true;
should_cache(): boolean; should_cache(): boolean;
} }

View file

@ -9,14 +9,14 @@ import { TemplateNode } from '../../interfaces';
import { Context } from './shared/Context'; import { Context } from './shared/Context';
import { Node as ESTreeNode } from 'estree'; import { Node as ESTreeNode } from 'estree';
export default class AwaitBlock extends Node { export default class AwaitBlock extends Node {
type: 'AwaitBlock'; type: 'AwaitBlock';
expression: Expression; expression: Expression;
then_contexts: Context[]; then_contexts: Context[];
catch_contexts: Context[]; catch_contexts: Context[];
then_node: ESTreeNode | null; then_node: ESTreeNode | null;
catch_node: ESTreeNode | null; catch_node: ESTreeNode | null;
pending: PendingBlock; pending: PendingBlock;
then: ThenBlock; then: ThenBlock;
catch: CatchBlock; catch: CatchBlock;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -8,12 +8,12 @@ import Element from './Element';
import InlineComponent from './InlineComponent'; import InlineComponent from './InlineComponent';
import Window from './Window'; import Window from './Window';
export default class Binding extends Node { export default class Binding extends Node {
type: 'Binding'; type: 'Binding';
name: string; name: string;
expression: Expression; expression: Expression;
raw_expression: ESTreeNode; raw_expression: ESTreeNode;
is_contextual: boolean; is_contextual: boolean;
is_readonly: boolean; is_readonly: boolean;
constructor(component: Component, parent: Element | InlineComponent | Window, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Element | InlineComponent | Window, scope: TemplateScope, info: TemplateNode);
is_readonly_media_attribute(): boolean; is_readonly_media_attribute(): boolean;
} }

View file

@ -4,7 +4,7 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Body extends Node { export default class Body extends Node {
type: 'Body'; type: 'Body';
handlers: EventHandler[]; handlers: EventHandler[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -4,7 +4,7 @@ import AwaitBlock from './AwaitBlock';
import Component from '../Component'; import Component from '../Component';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class CatchBlock extends AbstractBlock { export default class CatchBlock extends AbstractBlock {
type: 'CatchBlock'; type: 'CatchBlock';
scope: TemplateScope; scope: TemplateScope;
constructor(component: Component, parent: AwaitBlock, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: AwaitBlock, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -4,8 +4,8 @@ import { TemplateNode } from '../../interfaces';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import Component from '../Component'; import Component from '../Component';
export default class Class extends Node { export default class Class extends Node {
type: 'Class'; type: 'Class';
name: string; name: string;
expression: Expression; expression: Expression;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -3,8 +3,8 @@ import Component from '../Component';
import Node from './shared/Node'; import Node from './shared/Node';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
export default class Comment extends Node { export default class Comment extends Node {
type: 'Comment'; type: 'Comment';
data: string; data: string;
ignores: string[]; ignores: string[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -5,7 +5,7 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import { INode } from './interfaces'; import { INode } from './interfaces';
export default class DebugTag extends Node { export default class DebugTag extends Node {
type: 'DebugTag'; type: 'DebugTag';
expressions: Expression[]; expressions: Expression[];
constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -4,10 +4,10 @@ import Node from './shared/Node';
import Let from './Let'; import Let from './Let';
import { INode } from './interfaces'; import { INode } from './interfaces';
export default class DefaultSlotTemplate extends Node { export default class DefaultSlotTemplate extends Node {
type: 'SlotTemplate'; type: 'SlotTemplate';
scope: TemplateScope; scope: TemplateScope;
children: INode[]; children: INode[];
lets: Let[]; lets: Let[];
slot_template_name: string; slot_template_name: string;
constructor(component: Component, parent: INode, scope: TemplateScope, info: any, lets: Let[], children: INode[]); constructor(component: Component, parent: INode, scope: TemplateScope, info: any, lets: Let[], children: INode[]);
} }

View file

@ -7,18 +7,18 @@ import { Node } from 'estree';
import Component from '../Component'; import Component from '../Component';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class EachBlock extends AbstractBlock { export default class EachBlock extends AbstractBlock {
type: 'EachBlock'; type: 'EachBlock';
expression: Expression; expression: Expression;
context_node: Node; context_node: Node;
iterations: string; iterations: string;
index: string; index: string;
context: string; context: string;
key: Expression; key: Expression;
scope: TemplateScope; scope: TemplateScope;
contexts: Context[]; contexts: Context[];
has_animation: boolean; has_animation: boolean;
has_binding: boolean; has_binding: boolean;
has_index_binding: boolean; has_index_binding: boolean;
else?: ElseBlock; else?: ElseBlock;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -11,31 +11,31 @@ import TemplateScope from './shared/TemplateScope';
import { INode } from './interfaces'; import { INode } from './interfaces';
import Component from '../Component'; import Component from '../Component';
export default class Element extends Node { export default class Element extends Node {
type: 'Element'; type: 'Element';
name: string; name: string;
scope: TemplateScope; scope: TemplateScope;
attributes: Attribute[]; attributes: Attribute[];
actions: Action[]; actions: Action[];
bindings: Binding[]; bindings: Binding[];
classes: Class[]; classes: Class[];
handlers: EventHandler[]; handlers: EventHandler[];
lets: Let[]; lets: Let[];
intro?: Transition; intro?: Transition;
outro?: Transition; outro?: Transition;
animation?: Animation; animation?: Animation;
children: INode[]; children: INode[];
namespace: string; namespace: string;
needs_manual_style_scoping: boolean; needs_manual_style_scoping: boolean;
constructor(component: Component, parent: Node, scope: TemplateScope, info: any); constructor(component: Component, parent: Node, scope: TemplateScope, info: any);
validate(): void; validate(): void;
validate_attributes(): void; validate_attributes(): void;
validate_attributes_a11y(): void; validate_attributes_a11y(): void;
validate_special_cases(): void; validate_special_cases(): void;
validate_bindings_foreign(): void; validate_bindings_foreign(): void;
validate_bindings(): void; validate_bindings(): void;
validate_content(): void; validate_content(): void;
validate_event_handlers(): void; validate_event_handlers(): void;
is_media_node(): boolean; is_media_node(): boolean;
add_css_class(): void; add_css_class(): void;
get slot_template_name(): string; get slot_template_name(): string;
} }

View file

@ -4,6 +4,6 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import Node from './shared/Node'; import Node from './shared/Node';
export default class ElseBlock extends AbstractBlock { export default class ElseBlock extends AbstractBlock {
type: 'ElseBlock'; type: 'ElseBlock';
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -5,13 +5,13 @@ import { Identifier } from 'estree';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class EventHandler extends Node { export default class EventHandler extends Node {
type: 'EventHandler'; type: 'EventHandler';
name: string; name: string;
modifiers: Set<string>; modifiers: Set<string>;
expression: Expression; expression: Expression;
handler_name: Identifier; handler_name: Identifier;
uses_context: boolean; uses_context: boolean;
can_make_passive: boolean; can_make_passive: boolean;
constructor(component: Component, parent: Node, template_scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, template_scope: TemplateScope, info: TemplateNode);
get reassigned(): boolean; get reassigned(): boolean;
} }

View file

@ -5,9 +5,9 @@ import TemplateScope from './shared/TemplateScope';
import { INode } from './interfaces'; import { INode } from './interfaces';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Fragment extends Node { export default class Fragment extends Node {
type: 'Fragment'; type: 'Fragment';
block: Block; block: Block;
children: INode[]; children: INode[];
scope: TemplateScope; scope: TemplateScope;
constructor(component: Component, info: TemplateNode); constructor(component: Component, info: TemplateNode);
} }

View file

@ -3,8 +3,8 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Head extends Node { export default class Head extends Node {
type: 'Head'; type: 'Head';
children: any[]; children: any[];
id: string; id: string;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -6,8 +6,8 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import Node from './shared/Node'; import Node from './shared/Node';
export default class IfBlock extends AbstractBlock { export default class IfBlock extends AbstractBlock {
type: 'IfBlock'; type: 'IfBlock';
expression: Expression; expression: Expression;
else: ElseBlock; else: ElseBlock;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -9,15 +9,15 @@ import TemplateScope from './shared/TemplateScope';
import { INode } from './interfaces'; import { INode } from './interfaces';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class InlineComponent extends Node { export default class InlineComponent extends Node {
type: 'InlineComponent'; type: 'InlineComponent';
name: string; name: string;
expression: Expression; expression: Expression;
attributes: Attribute[]; attributes: Attribute[];
bindings: Binding[]; bindings: Binding[];
handlers: EventHandler[]; handlers: EventHandler[];
lets: Let[]; lets: Let[];
children: INode[]; children: INode[];
scope: TemplateScope; scope: TemplateScope;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
get slot_template_name(): string; get slot_template_name(): string;
} }

View file

@ -5,7 +5,7 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import Node from './shared/Node'; import Node from './shared/Node';
export default class KeyBlock extends AbstractBlock { export default class KeyBlock extends AbstractBlock {
type: 'KeyBlock'; type: 'KeyBlock';
expression: Expression; expression: Expression;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -4,9 +4,9 @@ import { Identifier } from 'estree';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Let extends Node { export default class Let extends Node {
type: 'Let'; type: 'Let';
name: Identifier; name: Identifier;
value: Identifier; value: Identifier;
names: string[]; names: string[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -1,4 +1,4 @@
import Tag from './shared/Tag'; import Tag from './shared/Tag';
export default class MustacheTag extends Tag { export default class MustacheTag extends Tag {
type: 'MustacheTag'; type: 'MustacheTag';
} }

View file

@ -1,4 +1,4 @@
import Node from './shared/Node'; import Node from './shared/Node';
export default class Options extends Node { export default class Options extends Node {
type: 'Options'; type: 'Options';
} }

View file

@ -4,6 +4,6 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import Node from './shared/Node'; import Node from './shared/Node';
export default class PendingBlock extends AbstractBlock { export default class PendingBlock extends AbstractBlock {
type: 'PendingBlock'; type: 'PendingBlock';
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -1,4 +1,4 @@
import Tag from './shared/Tag'; import Tag from './shared/Tag';
export default class RawMustacheTag extends Tag { export default class RawMustacheTag extends Tag {
type: 'RawMustacheTag'; type: 'RawMustacheTag';
} }

View file

@ -5,10 +5,10 @@ import TemplateScope from './shared/TemplateScope';
import { INode } from './interfaces'; import { INode } from './interfaces';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Slot extends Element { export default class Slot extends Element {
type: 'Element'; type: 'Element';
name: string; name: string;
children: INode[]; children: INode[];
slot_name: string; slot_name: string;
values: Map<string, Attribute>; values: Map<string, Attribute>;
constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -5,12 +5,12 @@ import Let from './Let';
import Attribute from './Attribute'; import Attribute from './Attribute';
import { INode } from './interfaces'; import { INode } from './interfaces';
export default class SlotTemplate extends Node { export default class SlotTemplate extends Node {
type: 'SlotTemplate'; type: 'SlotTemplate';
scope: TemplateScope; scope: TemplateScope;
children: INode[]; children: INode[];
lets: Let[]; lets: Let[];
slot_attribute: Attribute; slot_attribute: Attribute;
slot_template_name: string; slot_template_name: string;
constructor(component: Component, parent: INode, scope: TemplateScope, info: any); constructor(component: Component, parent: INode, scope: TemplateScope, info: any);
validate_slot_template_placement(): void; validate_slot_template_placement(): void;
} }

View file

@ -4,9 +4,9 @@ import TemplateScope from './shared/TemplateScope';
import { INode } from './interfaces'; import { INode } from './interfaces';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Text extends Node { export default class Text extends Node {
type: 'Text'; type: 'Text';
data: string; data: string;
synthetic: boolean; synthetic: boolean;
constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode);
should_skip(): any; should_skip(): any;
} }

View file

@ -4,7 +4,7 @@ import AwaitBlock from './AwaitBlock';
import Component from '../Component'; import Component from '../Component';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class ThenBlock extends AbstractBlock { export default class ThenBlock extends AbstractBlock {
type: 'ThenBlock'; type: 'ThenBlock';
scope: TemplateScope; scope: TemplateScope;
constructor(component: Component, parent: AwaitBlock, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: AwaitBlock, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -4,8 +4,8 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Title extends Node { export default class Title extends Node {
type: 'Title'; type: 'Title';
children: Children; children: Children;
should_cache: boolean; should_cache: boolean;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -5,10 +5,10 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
import Element from './Element'; import Element from './Element';
export default class Transition extends Node { export default class Transition extends Node {
type: 'Transition'; type: 'Transition';
name: string; name: string;
directive: string; directive: string;
expression: Expression; expression: Expression;
is_local: boolean; is_local: boolean;
constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -6,9 +6,9 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope'; import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces'; import { TemplateNode } from '../../interfaces';
export default class Window extends Node { export default class Window extends Node {
type: 'Window'; type: 'Window';
handlers: EventHandler[]; handlers: EventHandler[];
bindings: Binding[]; bindings: Binding[];
actions: Action[]; actions: Action[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode); constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
} }

View file

@ -31,4 +31,37 @@ import ThenBlock from './ThenBlock';
import Title from './Title'; import Title from './Title';
import Transition from './Transition'; import Transition from './Transition';
import Window from './Window'; import Window from './Window';
export declare type INode = Action | Animation | Attribute | AwaitBlock | Binding | Body | CatchBlock | Class | Comment | DebugTag | EachBlock | Element | ElseBlock | EventHandler | Fragment | Head | IfBlock | InlineComponent | KeyBlock | Let | MustacheTag | Options | PendingBlock | RawMustacheTag | Slot | SlotTemplate | DefaultSlotTemplate | Tag | Text | ThenBlock | Title | Transition | Window; export declare type INode =
| Action
| Animation
| Attribute
| AwaitBlock
| Binding
| Body
| CatchBlock
| Class
| Comment
| DebugTag
| EachBlock
| Element
| ElseBlock
| EventHandler
| Fragment
| Head
| IfBlock
| InlineComponent
| KeyBlock
| Let
| MustacheTag
| Options
| PendingBlock
| RawMustacheTag
| Slot
| SlotTemplate
| DefaultSlotTemplate
| Tag
| Text
| ThenBlock
| Title
| Transition
| Window;

View file

@ -3,8 +3,8 @@ import Component from '../../Component';
import Node from './Node'; import Node from './Node';
import { INode } from '../interfaces'; import { INode } from '../interfaces';
export default class AbstractBlock extends Node { export default class AbstractBlock extends Node {
block: Block; block: Block;
children: INode[]; children: INode[];
constructor(component: Component, parent: any, scope: any, info: any); constructor(component: Component, parent: any, scope: any, info: any);
warn_if_empty_block(): void; warn_if_empty_block(): void;
} }

View file

@ -1,8 +1,8 @@
import { Node, Identifier } from 'estree'; import { Node, Identifier } from 'estree';
export interface Context { export interface Context {
key: Identifier; key: Identifier;
name?: string; name?: string;
modifier: (node: Node) => Node; modifier: (node: Node) => Node;
default_modifier: (node: Node, to_ctx: (name: string) => Node) => Node; default_modifier: (node: Node, to_ctx: (name: string) => Node) => Node;
} }
export declare function unpack_destructuring(contexts: Context[], node: Node, modifier?: Context['modifier'], default_modifier?: Context['default_modifier']): void; export declare function unpack_destructuring(contexts: Context[], node: Node, modifier?: Context['modifier'], default_modifier?: Context['default_modifier']): void;

View file

@ -6,21 +6,21 @@ import { Node } from 'estree';
import { INode } from '../interfaces'; import { INode } from '../interfaces';
declare type Owner = INode; declare type Owner = INode;
export default class Expression { export default class Expression {
type: 'Expression'; type: 'Expression';
component: Component; component: Component;
owner: Owner; owner: Owner;
node: Node; node: Node;
references: Set<string>; references: Set<string>;
dependencies: Set<string>; dependencies: Set<string>;
contextual_dependencies: Set<string>; contextual_dependencies: Set<string>;
template_scope: TemplateScope; template_scope: TemplateScope;
scope: Scope; scope: Scope;
scope_map: WeakMap<Node, Scope>; scope_map: WeakMap<Node, Scope>;
declarations: Array<(Node | Node[])>; declarations: Array<Node | Node[]>;
uses_context: boolean; uses_context: boolean;
manipulated: Node; manipulated: Node;
constructor(component: Component, owner: Owner, template_scope: TemplateScope, info: Node, lazy?: boolean); constructor(component: Component, owner: Owner, template_scope: TemplateScope, info: Node, lazy?: boolean);
dynamic_dependencies(): string[]; dynamic_dependencies(): string[];
manipulate(block?: Block): Node; manipulate(block?: Block): Node;
} }
export {}; export {};

View file

@ -3,19 +3,19 @@ import Component from '../../Component';
import { INode } from '../interfaces'; import { INode } from '../interfaces';
import { TemplateNode } from '../../../interfaces'; import { TemplateNode } from '../../../interfaces';
export default class Node { export default class Node {
readonly start: number; readonly start: number;
readonly end: number; readonly end: number;
readonly component: Component; readonly component: Component;
readonly parent: INode; readonly parent: INode;
readonly type: string; readonly type: string;
prev?: INode; prev?: INode;
next?: INode; next?: INode;
can_use_innerhtml: boolean; can_use_innerhtml: boolean;
var: string; var: string;
attributes: Attribute[]; attributes: Attribute[];
constructor(component: Component, parent: Node, _scope: any, info: TemplateNode); constructor(component: Component, parent: Node, _scope: any, info: TemplateNode);
cannot_use_innerhtml(): void; cannot_use_innerhtml(): void;
find_nearest(selector: RegExp): any; find_nearest(selector: RegExp): any;
get_static_attribute_value(name: string): string | true; get_static_attribute_value(name: string): string | true;
has_ancestor(type: string): any; has_ancestor(type: string): any;
} }

View file

@ -1,8 +1,8 @@
import Node from './Node'; import Node from './Node';
import Expression from './Expression'; import Expression from './Expression';
export default class Tag extends Node { export default class Tag extends Node {
type: 'MustacheTag' | 'RawMustacheTag'; type: 'MustacheTag' | 'RawMustacheTag';
expression: Expression; expression: Expression;
should_cache: boolean; should_cache: boolean;
constructor(component: any, parent: any, scope: any, info: any); constructor(component: any, parent: any, scope: any, info: any);
} }

View file

@ -6,16 +6,16 @@ import Element from '../Element';
import SlotTemplate from '../SlotTemplate'; import SlotTemplate from '../SlotTemplate';
declare type NodeWithScope = EachBlock | ThenBlock | CatchBlock | InlineComponent | Element | SlotTemplate; declare type NodeWithScope = EachBlock | ThenBlock | CatchBlock | InlineComponent | Element | SlotTemplate;
export default class TemplateScope { export default class TemplateScope {
names: Set<string>; names: Set<string>;
dependencies_for_name: Map<string, Set<string>>; dependencies_for_name: Map<string, Set<string>>;
owners: Map<string, NodeWithScope>; owners: Map<string, NodeWithScope>;
parent?: TemplateScope; parent?: TemplateScope;
constructor(parent?: TemplateScope); constructor(parent?: TemplateScope);
add(name: any, dependencies: Set<string>, owner: any): this; add(name: any, dependencies: Set<string>, owner: any): this;
child(): TemplateScope; child(): TemplateScope;
is_top_level(name: string): any; is_top_level(name: string): any;
get_owner(name: string): NodeWithScope; get_owner(name: string): NodeWithScope;
is_let(name: string): boolean; is_let(name: string): boolean;
is_await(name: string): boolean; is_await(name: string): boolean;
} }
export {}; export {};

View file

@ -17,4 +17,27 @@ import Title from '../Title';
import Window from '../Window'; import Window from '../Window';
import { TemplateNode } from '../../../interfaces'; import { TemplateNode } from '../../../interfaces';
export declare type Children = ReturnType<typeof map_children>; export declare type Children = ReturnType<typeof map_children>;
export default function map_children(component: any, parent: any, scope: any, children: TemplateNode[]): (AwaitBlock | Body | Comment | DebugTag | EachBlock | Element | Head | IfBlock | InlineComponent | KeyBlock | MustacheTag | Options | RawMustacheTag | SlotTemplate | Text | Title | Window)[]; export default function map_children(
component: any,
parent: any,
scope: any,
children: TemplateNode[]
): (
| AwaitBlock
| Body
| Comment
| DebugTag
| EachBlock
| Element
| Head
| IfBlock
| InlineComponent
| KeyBlock
| MustacheTag
| Options
| RawMustacheTag
| SlotTemplate
| Text
| Title
| Window
)[];

View file

@ -2,77 +2,80 @@ import Renderer from './Renderer';
import Wrapper from './wrappers/shared/Wrapper'; import Wrapper from './wrappers/shared/Wrapper';
import { Node, Identifier } from 'estree'; import { Node, Identifier } from 'estree';
export interface Bindings { export interface Bindings {
object: Identifier; object: Identifier;
property: Identifier; property: Identifier;
snippet: Node; snippet: Node;
store: string; store: string;
modifier: (node: Node) => Node; modifier: (node: Node) => Node;
} }
export interface BlockOptions { export interface BlockOptions {
parent?: Block; parent?: Block;
name: Identifier; name: Identifier;
type: string; type: string;
renderer?: Renderer; renderer?: Renderer;
comment?: string; comment?: string;
key?: Identifier; key?: Identifier;
bindings?: Map<string, Bindings>; bindings?: Map<string, Bindings>;
dependencies?: Set<string>; dependencies?: Set<string>;
} }
export default class Block { export default class Block {
parent?: Block; parent?: Block;
renderer: Renderer; renderer: Renderer;
name: Identifier; name: Identifier;
type: string; type: string;
comment?: string; comment?: string;
wrappers: Wrapper[]; wrappers: Wrapper[];
key: Identifier; key: Identifier;
first: Identifier; first: Identifier;
dependencies: Set<string>; dependencies: Set<string>;
bindings: Map<string, Bindings>; bindings: Map<string, Bindings>;
binding_group_initialised: Set<string>; binding_group_initialised: Set<string>;
chunks: { chunks: {
declarations: Array<Node | Node[]>; declarations: Array<Node | Node[]>;
init: Array<Node | Node[]>; init: Array<Node | Node[]>;
create: Array<Node | Node[]>; create: Array<Node | Node[]>;
claim: Array<Node | Node[]>; claim: Array<Node | Node[]>;
hydrate: Array<Node | Node[]>; hydrate: Array<Node | Node[]>;
mount: Array<Node | Node[]>; mount: Array<Node | Node[]>;
measure: Array<Node | Node[]>; measure: Array<Node | Node[]>;
fix: Array<Node | Node[]>; fix: Array<Node | Node[]>;
animate: Array<Node | Node[]>; animate: Array<Node | Node[]>;
intro: Array<Node | Node[]>; intro: Array<Node | Node[]>;
update: Array<Node | Node[]>; update: Array<Node | Node[]>;
outro: Array<Node | Node[]>; outro: Array<Node | Node[]>;
destroy: Array<Node | Node[]>; destroy: Array<Node | Node[]>;
}; };
event_listeners: Node[]; event_listeners: Node[];
maintain_context: boolean; maintain_context: boolean;
has_animation: boolean; has_animation: boolean;
has_intros: boolean; has_intros: boolean;
has_outros: boolean; has_outros: boolean;
has_intro_method: boolean; has_intro_method: boolean;
has_outro_method: boolean; has_outro_method: boolean;
outros: number; outros: number;
aliases: Map<string, Identifier>; aliases: Map<string, Identifier>;
variables: Map<string, { variables: Map<
id: Identifier; string,
init?: Node; {
}>; id: Identifier;
get_unique_name: (name: string) => Identifier; init?: Node;
has_update_method: boolean; }
autofocus: string; >;
constructor(options: BlockOptions); get_unique_name: (name: string) => Identifier;
assign_variable_names(): void; has_update_method: boolean;
add_dependencies(dependencies: Set<string>): void; autofocus: string;
add_element(id: Identifier, render_statement: Node, claim_statement: Node, parent_node: Node, no_detach?: boolean): void; constructor(options: BlockOptions);
add_intro(local?: boolean): void; assign_variable_names(): void;
add_outro(local?: boolean): void; add_dependencies(dependencies: Set<string>): void;
add_animation(): void; add_element(id: Identifier, render_statement: Node, claim_statement: Node, parent_node: Node, no_detach?: boolean): void;
add_variable(id: Identifier, init?: Node): void; add_intro(local?: boolean): void;
alias(name: string): Identifier; add_outro(local?: boolean): void;
child(options: BlockOptions): Block; add_animation(): void;
get_contents(key?: any): Node[]; add_variable(id: Identifier, init?: Node): void;
has_content(): boolean; alias(name: string): Identifier;
render(): Node[]; child(options: BlockOptions): Block;
render_listeners(chunk?: string): void; get_contents(key?: any): Node[];
has_content(): boolean;
render(): Node[];
render_listeners(chunk?: string): void;
} }

View file

@ -4,42 +4,47 @@ import Component from '../Component';
import FragmentWrapper from './wrappers/Fragment'; import FragmentWrapper from './wrappers/Fragment';
import { Node, Identifier, MemberExpression, Literal, Expression } from 'estree'; import { Node, Identifier, MemberExpression, Literal, Expression } from 'estree';
interface ContextMember { interface ContextMember {
name: string; name: string;
index: Literal; index: Literal;
is_contextual: boolean; is_contextual: boolean;
is_non_contextual: boolean; is_non_contextual: boolean;
variable: Var; variable: Var;
priority: number; priority: number;
} }
export default class Renderer { export default class Renderer {
component: Component; component: Component;
options: CompileOptions; options: CompileOptions;
context: ContextMember[]; context: ContextMember[];
initial_context: ContextMember[]; initial_context: ContextMember[];
context_lookup: Map<string, ContextMember>; context_lookup: Map<string, ContextMember>;
context_overflow: boolean; context_overflow: boolean;
blocks: Array<Block | Node | Node[]>; blocks: Array<Block | Node | Node[]>;
readonly: Set<string>; readonly: Set<string>;
meta_bindings: Array<Node | Node[]>; meta_bindings: Array<Node | Node[]>;
binding_groups: Map<string, { binding_groups: Map<
binding_group: (to_reference?: boolean) => Node; string,
is_context: boolean; {
contexts: string[]; binding_group: (to_reference?: boolean) => Node;
index: number; is_context: boolean;
keypath: string; contexts: string[];
}>; index: number;
block: Block; keypath: string;
fragment: FragmentWrapper; }
file_var: Identifier; >;
locate: (c: number) => { block: Block;
line: number; fragment: FragmentWrapper;
column: number; file_var: Identifier;
}; locate: (
constructor(component: Component, options: CompileOptions); c: number
add_to_context(name: string, contextual?: boolean): ContextMember; ) => {
invalidate(name: string, value?: any, main_execution_context?: boolean): any; line: number;
dirty(names: string[], is_reactive_declaration?: boolean): Expression; column: number;
reference(node: string | Identifier | MemberExpression): any; };
remove_block(block: Block | Node | Node[]): void; constructor(component: Component, options: CompileOptions);
add_to_context(name: string, contextual?: boolean): ContextMember;
invalidate(name: string, value?: any, main_execution_context?: boolean): any;
dirty(names: string[], is_reactive_declaration?: boolean): Expression;
reference(node: string | Identifier | MemberExpression): any;
remove_block(block: Block | Node | Node[]): void;
} }
export {}; export {};

View file

@ -1,7 +1,10 @@
import Component from '../Component'; import Component from '../Component';
import { CompileOptions, CssResult } from '../../interfaces'; import { CompileOptions, CssResult } from '../../interfaces';
import { Node } from 'estree'; import { Node } from 'estree';
export default function dom(component: Component, options: CompileOptions): { export default function dom(
js: Node[]; component: Component,
css: CssResult; options: CompileOptions
): {
js: Node[];
css: CssResult;
}; };

View file

@ -10,29 +10,37 @@ import { Context } from '../../nodes/shared/Context';
import { Identifier, Literal, Node } from 'estree'; import { Identifier, Literal, Node } from 'estree';
declare type Status = 'pending' | 'then' | 'catch'; declare type Status = 'pending' | 'then' | 'catch';
declare class AwaitBlockBranch extends Wrapper { declare class AwaitBlockBranch extends Wrapper {
parent: AwaitBlockWrapper; parent: AwaitBlockWrapper;
node: PendingBlock | ThenBlock | CatchBlock; node: PendingBlock | ThenBlock | CatchBlock;
block: Block; block: Block;
fragment: FragmentWrapper; fragment: FragmentWrapper;
is_dynamic: boolean; is_dynamic: boolean;
var: any; var: any;
status: Status; status: Status;
value: string; value: string;
value_index: Literal; value_index: Literal;
value_contexts: Context[]; value_contexts: Context[];
is_destructured: boolean; is_destructured: boolean;
constructor(status: Status, renderer: Renderer, block: Block, parent: AwaitBlockWrapper, node: PendingBlock | ThenBlock | CatchBlock, strip_whitespace: boolean, next_sibling: Wrapper); constructor(
add_context(node: Node | null, contexts: Context[]): void; status: Status,
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; renderer: Renderer,
render_destructure(): void; block: Block,
parent: AwaitBlockWrapper,
node: PendingBlock | ThenBlock | CatchBlock,
strip_whitespace: boolean,
next_sibling: Wrapper
);
add_context(node: Node | null, contexts: Context[]): void;
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
render_destructure(): void;
} }
export default class AwaitBlockWrapper extends Wrapper { export default class AwaitBlockWrapper extends Wrapper {
node: AwaitBlock; node: AwaitBlock;
pending: AwaitBlockBranch; pending: AwaitBlockBranch;
then: AwaitBlockBranch; then: AwaitBlockBranch;
catch: AwaitBlockBranch; catch: AwaitBlockBranch;
var: Identifier; var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: AwaitBlock, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: AwaitBlock, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
} }
export {}; export {};

View file

@ -6,8 +6,8 @@ import EventHandler from './Element/EventHandler';
import { TemplateNode } from '../../../interfaces'; import { TemplateNode } from '../../../interfaces';
import Renderer from '../Renderer'; import Renderer from '../Renderer';
export default class BodyWrapper extends Wrapper { export default class BodyWrapper extends Wrapper {
node: Body; node: Body;
handlers: EventHandler[]; handlers: EventHandler[];
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void; render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -4,7 +4,7 @@ import Block from '../Block';
import DebugTag from '../../nodes/DebugTag'; import DebugTag from '../../nodes/DebugTag';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class DebugTagWrapper extends Wrapper { export default class DebugTagWrapper extends Wrapper {
node: DebugTag; node: DebugTag;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: DebugTag, _strip_whitespace: boolean, _next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: DebugTag, _strip_whitespace: boolean, _next_sibling: Wrapper);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void; render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -6,51 +6,68 @@ import FragmentWrapper from './Fragment';
import ElseBlock from '../../nodes/ElseBlock'; import ElseBlock from '../../nodes/ElseBlock';
import { Identifier, Node } from 'estree'; import { Identifier, Node } from 'estree';
export declare class ElseBlockWrapper extends Wrapper { export declare class ElseBlockWrapper extends Wrapper {
node: ElseBlock; node: ElseBlock;
block: Block; block: Block;
fragment: FragmentWrapper; fragment: FragmentWrapper;
is_dynamic: boolean; is_dynamic: boolean;
var: any; var: any;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper);
} }
export default class EachBlockWrapper extends Wrapper { export default class EachBlockWrapper extends Wrapper {
block: Block;
node: EachBlock;
fragment: FragmentWrapper;
else?: ElseBlockWrapper;
vars: {
create_each_block: Identifier;
each_block_value: Identifier;
get_each_context: Identifier;
iterations: Identifier;
fixed_length: number;
data_length: Node | number;
view_length: Node | number;
};
context_props: Array<Node | Node[]>;
index_name: Identifier;
updates: Array<Node | Node[]>;
dependencies: Set<string>;
var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: EachBlock, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
render_keyed({
block,
parent_node,
parent_nodes,
snippet,
initial_anchor_node,
initial_mount_node,
update_anchor_node,
update_mount_node,
}: {
block: Block; block: Block;
node: EachBlock; parent_node: Identifier;
fragment: FragmentWrapper; parent_nodes: Identifier;
else?: ElseBlockWrapper; snippet: Node;
vars: { initial_anchor_node: Identifier;
create_each_block: Identifier; initial_mount_node: Identifier;
each_block_value: Identifier; update_anchor_node: Identifier;
get_each_context: Identifier; update_mount_node: Identifier;
iterations: Identifier; }): void;
fixed_length: number; render_unkeyed({
data_length: Node | number; block,
view_length: Node | number; parent_nodes,
}; snippet,
context_props: Array<Node | Node[]>; initial_anchor_node,
index_name: Identifier; initial_mount_node,
updates: Array<Node | Node[]>; update_anchor_node,
dependencies: Set<string>; update_mount_node,
var: Identifier; }: {
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: EachBlock, strip_whitespace: boolean, next_sibling: Wrapper); block: Block;
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; parent_nodes: Identifier;
render_keyed({ block, parent_node, parent_nodes, snippet, initial_anchor_node, initial_mount_node, update_anchor_node, update_mount_node }: { snippet: Node;
block: Block; initial_anchor_node: Identifier;
parent_node: Identifier; initial_mount_node: Identifier;
parent_nodes: Identifier; update_anchor_node: Identifier;
snippet: Node; update_mount_node: Identifier;
initial_anchor_node: Identifier; }): void;
initial_mount_node: Identifier;
update_anchor_node: Identifier;
update_mount_node: Identifier;
}): void;
render_unkeyed({ block, parent_nodes, snippet, initial_anchor_node, initial_mount_node, update_anchor_node, update_mount_node }: {
block: Block;
parent_nodes: Identifier;
snippet: Node;
initial_anchor_node: Identifier;
initial_mount_node: Identifier;
update_anchor_node: Identifier;
update_mount_node: Identifier;
}): void;
} }

View file

@ -3,40 +3,257 @@ import Block from '../../Block';
import ElementWrapper from './index'; import ElementWrapper from './index';
import { Identifier, Node } from 'estree'; import { Identifier, Node } from 'estree';
export declare class BaseAttributeWrapper { export declare class BaseAttributeWrapper {
node: Attribute; node: Attribute;
parent: ElementWrapper; parent: ElementWrapper;
constructor(parent: ElementWrapper, block: Block, node: Attribute); constructor(parent: ElementWrapper, block: Block, node: Attribute);
render(_block: Block): void; render(_block: Block): void;
} }
export default class AttributeWrapper extends BaseAttributeWrapper { export default class AttributeWrapper extends BaseAttributeWrapper {
node: Attribute; node: Attribute;
parent: ElementWrapper; parent: ElementWrapper;
metadata: any; metadata: any;
name: string; name: string;
property_name: string; property_name: string;
is_indirectly_bound_value: boolean; is_indirectly_bound_value: boolean;
is_src: boolean; is_src: boolean;
is_select_value_attribute: boolean; is_select_value_attribute: boolean;
is_input_value: boolean; is_input_value: boolean;
should_cache: boolean; should_cache: boolean;
last: Identifier; last: Identifier;
constructor(parent: ElementWrapper, block: Block, node: Attribute); constructor(parent: ElementWrapper, block: Block, node: Attribute);
render(block: Block): void; render(block: Block): void;
get_init(block: Block, value: any): any; get_init(block: Block, value: any): any;
get_dom_update_conditions(block: Block, dependency_condition: Node): Node; get_dom_update_conditions(block: Block, dependency_condition: Node): Node;
get_dependencies(): string[]; get_dependencies(): string[];
get_metadata(): any; get_metadata(): any;
get_value(block: any): Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | { get_value(
block: any
):
| Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier
| {
type: string; type: string;
value: string; value: string;
}; };
get_class_name_text(block: any): Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | { get_class_name_text(
block: any
):
| Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier
| {
type: string; type: string;
value: string; value: string;
}; };
render_chunks(block: Block): (Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier | { render_chunks(
block: Block
): (
| Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier
| {
type: string; type: string;
value: string; value: string;
})[]; }
stringify(): string; )[];
stringify(): string;
} }

View file

@ -4,20 +4,20 @@ import InlineComponentWrapper from '../InlineComponent';
import Block from '../../Block'; import Block from '../../Block';
import { Node, Identifier } from 'estree'; import { Node, Identifier } from 'estree';
export default class BindingWrapper { export default class BindingWrapper {
node: Binding; node: Binding;
parent: ElementWrapper | InlineComponentWrapper; parent: ElementWrapper | InlineComponentWrapper;
object: string; object: string;
handler: { handler: {
uses_context: boolean; uses_context: boolean;
mutation: (Node | Node[]); mutation: Node | Node[];
contextual_dependencies: Set<string>; contextual_dependencies: Set<string>;
lhs?: Node; lhs?: Node;
}; };
snippet: Node; snippet: Node;
is_readonly: boolean; is_readonly: boolean;
needs_lock: boolean; needs_lock: boolean;
constructor(block: Block, node: Binding, parent: ElementWrapper | InlineComponentWrapper); constructor(block: Block, node: Binding, parent: ElementWrapper | InlineComponentWrapper);
get_dependencies(): Set<string>; get_dependencies(): Set<string>;
is_readonly_media_attribute(): boolean; is_readonly_media_attribute(): boolean;
render(block: Block, lock: Identifier): void; render(block: Block, lock: Identifier): void;
} }

View file

@ -3,9 +3,9 @@ import Wrapper from '../shared/Wrapper';
import Block from '../../Block'; import Block from '../../Block';
import { Expression } from 'estree'; import { Expression } from 'estree';
export default class EventHandlerWrapper { export default class EventHandlerWrapper {
node: EventHandler; node: EventHandler;
parent: Wrapper; parent: Wrapper;
constructor(node: EventHandler, parent: Wrapper); constructor(node: EventHandler, parent: Wrapper);
get_snippet(block: any): any; get_snippet(block: any): any;
render(block: Block, target: string | Expression): void; render(block: Block, target: string | Expression): void;
} }

View file

@ -1,3 +1,2 @@
import { BaseAttributeWrapper } from './Attribute'; import { BaseAttributeWrapper } from './Attribute';
export default class SpreadAttributeWrapper extends BaseAttributeWrapper { export default class SpreadAttributeWrapper extends BaseAttributeWrapper {}
}

View file

@ -5,12 +5,12 @@ import ElementWrapper from '../Element';
import Expression from '../../../nodes/shared/Expression'; import Expression from '../../../nodes/shared/Expression';
import Text from '../../../nodes/Text'; import Text from '../../../nodes/Text';
export interface StyleProp { export interface StyleProp {
key: string; key: string;
value: Array<Text | Expression>; value: Array<Text | Expression>;
important: boolean; important: boolean;
} }
export default class StyleAttributeWrapper extends AttributeWrapper { export default class StyleAttributeWrapper extends AttributeWrapper {
node: Attribute; node: Attribute;
parent: ElementWrapper; parent: ElementWrapper;
render(block: Block): void; render(block: Block): void;
} }

View file

@ -10,32 +10,32 @@ import Binding from './Binding';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
import EventHandler from './EventHandler'; import EventHandler from './EventHandler';
interface BindingGroup { interface BindingGroup {
events: string[]; events: string[];
bindings: Binding[]; bindings: Binding[];
} }
export default class ElementWrapper extends Wrapper { export default class ElementWrapper extends Wrapper {
node: Element; node: Element;
fragment: FragmentWrapper; fragment: FragmentWrapper;
attributes: Array<AttributeWrapper | StyleAttributeWrapper | SpreadAttributeWrapper>; attributes: Array<AttributeWrapper | StyleAttributeWrapper | SpreadAttributeWrapper>;
bindings: Binding[]; bindings: Binding[];
event_handlers: EventHandler[]; event_handlers: EventHandler[];
class_dependencies: string[]; class_dependencies: string[];
select_binding_dependencies?: Set<string>; select_binding_dependencies?: Set<string>;
var: any; var: any;
void: boolean; void: boolean;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Element, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Element, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
can_use_textcontent(): boolean; can_use_textcontent(): boolean;
get_render_statement(block: Block): import("estree").Expression; get_render_statement(block: Block): import('estree').Expression;
get_claim_statement(nodes: Identifier): import("estree").Expression; get_claim_statement(nodes: Identifier): import('estree').Expression;
add_directives_in_order(block: Block): void; add_directives_in_order(block: Block): void;
add_bindings(block: Block, binding_group: BindingGroup): void; add_bindings(block: Block, binding_group: BindingGroup): void;
add_this_binding(block: Block, this_binding: Binding): void; add_this_binding(block: Block, this_binding: Binding): void;
add_attributes(block: Block): void; add_attributes(block: Block): void;
add_spread_attributes(block: Block): void; add_spread_attributes(block: Block): void;
add_transitions(block: Block): void; add_transitions(block: Block): void;
add_animation(block: Block): void; add_animation(block: Block): void;
add_classes(block: Block): void; add_classes(block: Block): void;
add_manual_style_scoping(block: any): void; add_manual_style_scoping(block: any): void;
} }
export {}; export {};

View file

@ -4,7 +4,7 @@ import Renderer from '../Renderer';
import Block from '../Block'; import Block from '../Block';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class FragmentWrapper { export default class FragmentWrapper {
nodes: Wrapper[]; nodes: Wrapper[];
constructor(renderer: Renderer, block: Block, nodes: INode[], parent: Wrapper, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, nodes: INode[], parent: Wrapper, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
} }

View file

@ -5,8 +5,8 @@ import Head from '../../nodes/Head';
import FragmentWrapper from './Fragment'; import FragmentWrapper from './Fragment';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class HeadWrapper extends Wrapper { export default class HeadWrapper extends Wrapper {
fragment: FragmentWrapper; fragment: FragmentWrapper;
node: Head; node: Head;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Head, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Head, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void; render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -7,48 +7,86 @@ import ElseBlock from '../../nodes/ElseBlock';
import FragmentWrapper from './Fragment'; import FragmentWrapper from './Fragment';
import { Identifier, Node, UnaryExpression } from 'estree'; import { Identifier, Node, UnaryExpression } from 'estree';
declare class IfBlockBranch extends Wrapper { declare class IfBlockBranch extends Wrapper {
block: Block; block: Block;
fragment: FragmentWrapper; fragment: FragmentWrapper;
dependencies?: string[]; dependencies?: string[];
condition?: any; condition?: any;
snippet?: Node; snippet?: Node;
is_dynamic: boolean; is_dynamic: boolean;
var: any; var: any;
constructor(renderer: Renderer, block: Block, parent: IfBlockWrapper, node: IfBlock | ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: IfBlockWrapper, node: IfBlock | ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper);
} }
export default class IfBlockWrapper extends Wrapper { export default class IfBlockWrapper extends Wrapper {
node: IfBlock; node: IfBlock;
branches: IfBlockBranch[]; branches: IfBlockBranch[];
needs_update: boolean; needs_update: boolean;
var: Identifier; var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: EachBlock, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: EachBlock, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
render_compound(block: Block, parent_node: Identifier, _parent_nodes: Identifier, dynamic: any, { name, anchor, has_else, if_exists_condition, has_transitions }: { render_compound(
name: any; block: Block,
anchor: any; parent_node: Identifier,
has_else: any; _parent_nodes: Identifier,
if_exists_condition: any; dynamic: any,
has_transitions: any; {
}, detaching: any): void; name,
render_compound_with_outros(block: Block, parent_node: Identifier, _parent_nodes: Identifier, dynamic: any, { name, anchor, has_else, has_transitions, if_exists_condition }: { anchor,
name: any; has_else,
anchor: any; if_exists_condition,
has_else: any; has_transitions,
has_transitions: any; }: {
if_exists_condition: any; name: any;
}, detaching: any): void; anchor: any;
render_simple(block: Block, parent_node: Identifier, _parent_nodes: Identifier, dynamic: any, { name, anchor, if_exists_condition, has_transitions }: { has_else: any;
name: any; if_exists_condition: any;
anchor: any; has_transitions: any;
if_exists_condition: any; },
has_transitions: any; detaching: any
}, detaching: any): void; ): void;
get_initial_dirty_bit(): { render_compound_with_outros(
readonly type: "ArrayExpression" | "UnaryExpression"; block: Block,
elements: UnaryExpression[]; parent_node: Identifier,
operator: import("estree").UnaryOperator; _parent_nodes: Identifier,
prefix: true; dynamic: any,
argument: import("estree").Expression; {
}; name,
anchor,
has_else,
has_transitions,
if_exists_condition,
}: {
name: any;
anchor: any;
has_else: any;
has_transitions: any;
if_exists_condition: any;
},
detaching: any
): void;
render_simple(
block: Block,
parent_node: Identifier,
_parent_nodes: Identifier,
dynamic: any,
{
name,
anchor,
if_exists_condition,
has_transitions,
}: {
name: any;
anchor: any;
if_exists_condition: any;
has_transitions: any;
},
detaching: any
): void;
get_initial_dirty_bit(): {
readonly type: 'ArrayExpression' | 'UnaryExpression';
elements: UnaryExpression[];
operator: import('estree').UnaryOperator;
prefix: true;
argument: import('estree').Expression;
};
} }
export {}; export {};

View file

@ -6,20 +6,20 @@ import FragmentWrapper from '../Fragment';
import TemplateScope from '../../../nodes/shared/TemplateScope'; import TemplateScope from '../../../nodes/shared/TemplateScope';
import { Node, Identifier } from 'estree'; import { Node, Identifier } from 'estree';
declare type SlotDefinition = { declare type SlotDefinition = {
block: Block; block: Block;
scope: TemplateScope; scope: TemplateScope;
get_context?: Node; get_context?: Node;
get_changes?: Node; get_changes?: Node;
}; };
export default class InlineComponentWrapper extends Wrapper { export default class InlineComponentWrapper extends Wrapper {
var: Identifier; var: Identifier;
slots: Map<string, SlotDefinition>; slots: Map<string, SlotDefinition>;
node: InlineComponent; node: InlineComponent;
fragment: FragmentWrapper; fragment: FragmentWrapper;
children: Array<Wrapper | FragmentWrapper>; children: Array<Wrapper | FragmentWrapper>;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: InlineComponent, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: InlineComponent, strip_whitespace: boolean, next_sibling: Wrapper);
set_slot(name: string, slot_definition: SlotDefinition): void; set_slot(name: string, slot_definition: SlotDefinition): void;
warn_if_reactive(): void; warn_if_reactive(): void;
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
} }
export {}; export {};

View file

@ -6,13 +6,13 @@ import KeyBlock from '../../nodes/KeyBlock';
import FragmentWrapper from './Fragment'; import FragmentWrapper from './Fragment';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class KeyBlockWrapper extends Wrapper { export default class KeyBlockWrapper extends Wrapper {
node: KeyBlock; node: KeyBlock;
fragment: FragmentWrapper; fragment: FragmentWrapper;
block: Block; block: Block;
dependencies: string[]; dependencies: string[];
var: Identifier; var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: EachBlock, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: EachBlock, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
render_static_key(_block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render_static_key(_block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
render_dynamic_key(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render_dynamic_key(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
} }

View file

@ -6,7 +6,7 @@ import MustacheTag from '../../nodes/MustacheTag';
import RawMustacheTag from '../../nodes/RawMustacheTag'; import RawMustacheTag from '../../nodes/RawMustacheTag';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class MustacheTagWrapper extends Tag { export default class MustacheTagWrapper extends Tag {
var: Identifier; var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
} }

View file

@ -6,7 +6,7 @@ import MustacheTag from '../../nodes/MustacheTag';
import RawMustacheTag from '../../nodes/RawMustacheTag'; import RawMustacheTag from '../../nodes/RawMustacheTag';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class RawMustacheTagWrapper extends Tag { export default class RawMustacheTagWrapper extends Tag {
var: Identifier; var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
render(block: Block, parent_node: Identifier, _parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -5,13 +5,13 @@ import Slot from '../../nodes/Slot';
import FragmentWrapper from './Fragment'; import FragmentWrapper from './Fragment';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class SlotWrapper extends Wrapper { export default class SlotWrapper extends Wrapper {
node: Slot; node: Slot;
fragment: FragmentWrapper; fragment: FragmentWrapper;
fallback: Block | null; fallback: Block | null;
slot_block: Block; slot_block: Block;
var: Identifier; var: Identifier;
dependencies: Set<string>; dependencies: Set<string>;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Slot, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Slot, strip_whitespace: boolean, next_sibling: Wrapper);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
is_dependency_dynamic(name: string): boolean; is_dependency_dynamic(name: string): boolean;
} }

View file

@ -7,16 +7,16 @@ import { INode } from '../../nodes/interfaces';
import Let from '../../nodes/Let'; import Let from '../../nodes/Let';
import TemplateScope from '../../nodes/shared/TemplateScope'; import TemplateScope from '../../nodes/shared/TemplateScope';
declare type NodeWithLets = INode & { declare type NodeWithLets = INode & {
scope: TemplateScope; scope: TemplateScope;
lets: Let[]; lets: Let[];
slot_template_name: string; slot_template_name: string;
}; };
export default class SlotTemplateWrapper extends Wrapper { export default class SlotTemplateWrapper extends Wrapper {
node: NodeWithLets; node: NodeWithLets;
fragment: FragmentWrapper; fragment: FragmentWrapper;
block: Block; block: Block;
parent: InlineComponentWrapper; parent: InlineComponentWrapper;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: NodeWithLets, strip_whitespace: boolean, next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: NodeWithLets, strip_whitespace: boolean, next_sibling: Wrapper);
render(): void; render(): void;
} }
export {}; export {};

View file

@ -4,11 +4,11 @@ import Text from '../../nodes/Text';
import Wrapper from './shared/Wrapper'; import Wrapper from './shared/Wrapper';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class TextWrapper extends Wrapper { export default class TextWrapper extends Wrapper {
node: Text; node: Text;
data: string; data: string;
skip: boolean; skip: boolean;
var: Identifier; var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Text, data: string); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Text, data: string);
use_space(): boolean; use_space(): boolean;
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void; render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
} }

View file

@ -4,7 +4,7 @@ import Block from '../Block';
import Title from '../../nodes/Title'; import Title from '../../nodes/Title';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class TitleWrapper extends Wrapper { export default class TitleWrapper extends Wrapper {
node: Title; node: Title;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Title, _strip_whitespace: boolean, _next_sibling: Wrapper); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: Title, _strip_whitespace: boolean, _next_sibling: Wrapper);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void; render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -6,8 +6,8 @@ import { Identifier } from 'estree';
import { TemplateNode } from '../../../interfaces'; import { TemplateNode } from '../../../interfaces';
import EventHandler from './Element/EventHandler'; import EventHandler from './Element/EventHandler';
export default class WindowWrapper extends Wrapper { export default class WindowWrapper extends Wrapper {
node: Window; node: Window;
handlers: EventHandler[]; handlers: EventHandler[];
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void; render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -5,10 +5,82 @@ import MustacheTag from '../../../nodes/MustacheTag';
import RawMustacheTag from '../../../nodes/RawMustacheTag'; import RawMustacheTag from '../../../nodes/RawMustacheTag';
import { Node } from 'estree'; import { Node } from 'estree';
export default class Tag extends Wrapper { export default class Tag extends Wrapper {
node: MustacheTag | RawMustacheTag; node: MustacheTag | RawMustacheTag;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
is_dependencies_static(): boolean; is_dependencies_static(): boolean;
rename_this_method(block: Block, update: ((value: Node) => (Node | Node[]))): { rename_this_method(
init: import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier; block: Block,
}; update: (value: Node) => Node | Node[]
): {
init:
| import('estree').Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier;
};
} }

View file

@ -3,19 +3,19 @@ import Block from '../../Block';
import { TemplateNode } from '../../../../interfaces'; import { TemplateNode } from '../../../../interfaces';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default class Wrapper { export default class Wrapper {
renderer: Renderer; renderer: Renderer;
parent: Wrapper; parent: Wrapper;
node: TemplateNode; node: TemplateNode;
prev: Wrapper | null; prev: Wrapper | null;
next: Wrapper | null; next: Wrapper | null;
var: Identifier; var: Identifier;
can_use_innerhtml: boolean; can_use_innerhtml: boolean;
is_static_content: boolean; is_static_content: boolean;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode); constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
cannot_use_innerhtml(): void; cannot_use_innerhtml(): void;
not_static_content(): void; not_static_content(): void;
get_or_create_anchor(block: Block, parent_node: Identifier, parent_nodes: Identifier): Identifier; get_or_create_anchor(block: Block, parent_node: Identifier, parent_nodes: Identifier): Identifier;
get_update_mount_node(anchor: Identifier): Identifier; get_update_mount_node(anchor: Identifier): Identifier;
is_dom_node(): boolean; is_dom_node(): boolean;
render(_block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void; render(_block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
} }

View file

@ -2,4 +2,4 @@ import Component from '../../../Component';
import Block from '../../Block'; import Block from '../../Block';
import BindingWrapper from '../Element/Binding'; import BindingWrapper from '../Element/Binding';
import { Identifier } from 'estree'; import { Identifier } from 'estree';
export default function bind_this(component: Component, block: Block, binding: BindingWrapper, variable: Identifier): import("estree").Node[]; export default function bind_this(component: Component, block: Block, binding: BindingWrapper, variable: Identifier): import('estree').Node[];

View file

@ -1,14 +1,20 @@
import Let from '../../../nodes/Let'; import Let from '../../../nodes/Let';
import Block from '../../Block'; import Block from '../../Block';
import TemplateScope from '../../../nodes/shared/TemplateScope'; import TemplateScope from '../../../nodes/shared/TemplateScope';
export declare function get_slot_definition(block: Block, scope: TemplateScope, lets: Let[]): { export declare function get_slot_definition(
block: Block; block: Block,
scope: TemplateScope; scope: TemplateScope,
get_context?: undefined; lets: Let[]
get_changes?: undefined; ):
} | { | {
block: Block; block: Block;
scope: TemplateScope; scope: TemplateScope;
get_context: import("estree").Expression; get_context?: undefined;
get_changes: import("estree").Expression; get_changes?: undefined;
}; }
| {
block: Block;
scope: TemplateScope;
get_context: import('estree').Expression;
get_changes: import('estree').Expression;
};

View file

@ -2,32 +2,32 @@ import { AppendTarget, CompileOptions } from '../../interfaces';
import { INode } from '../nodes/interfaces'; import { INode } from '../nodes/interfaces';
import { Expression, TemplateLiteral, Identifier } from 'estree'; import { Expression, TemplateLiteral, Identifier } from 'estree';
export interface RenderOptions extends CompileOptions { export interface RenderOptions extends CompileOptions {
locate: (c: number) => { locate: (
line: number; c: number
column: number; ) => {
}; line: number;
head_id?: string; column: number;
};
head_id?: string;
} }
export default class Renderer { export default class Renderer {
has_bindings: boolean; has_bindings: boolean;
name: Identifier; name: Identifier;
stack: Array<{ stack: Array<{
current: {
value: string;
};
literal: TemplateLiteral;
}>;
current: { current: {
value: string; value: string;
}; };
literal: TemplateLiteral; literal: TemplateLiteral;
targets: AppendTarget[]; }>;
constructor({ name }: { current: {
name: any; value: string;
}); };
add_string(str: string): void; literal: TemplateLiteral;
add_expression(node: Expression): void; targets: AppendTarget[];
push(): void; constructor({ name }: { name: any });
pop(): TemplateLiteral; add_string(str: string): void;
render(nodes: INode[], options: RenderOptions): void; add_expression(node: Expression): void;
push(): void;
pop(): TemplateLiteral;
render(nodes: INode[], options: RenderOptions): void;
} }

View file

@ -1,5 +1,9 @@
import Renderer, { RenderOptions } from '../Renderer'; import Renderer, { RenderOptions } from '../Renderer';
import Slot from '../../nodes/Slot'; import Slot from '../../nodes/Slot';
export default function (node: Slot, renderer: Renderer, options: RenderOptions & { export default function (
node: Slot,
renderer: Renderer,
options: RenderOptions & {
slot_scopes: Map<any, any>; slot_scopes: Map<any, any>;
}): void; }
): void;

View file

@ -2,6 +2,10 @@ import Renderer, { RenderOptions } from '../Renderer';
import SlotTemplate from '../../nodes/SlotTemplate'; import SlotTemplate from '../../nodes/SlotTemplate';
import InlineComponent from '../../nodes/InlineComponent'; import InlineComponent from '../../nodes/InlineComponent';
import Element from '../../nodes/Element'; import Element from '../../nodes/Element';
export default function (node: SlotTemplate | Element | InlineComponent, renderer: Renderer, options: RenderOptions & { export default function (
node: SlotTemplate | Element | InlineComponent,
renderer: Renderer,
options: RenderOptions & {
slot_scopes: Map<any, any>; slot_scopes: Map<any, any>;
}): void; }
): void;

View file

@ -1,7 +1,10 @@
import Component from '../Component'; import Component from '../Component';
import { CompileOptions, CssResult } from '../../interfaces'; import { CompileOptions, CssResult } from '../../interfaces';
import { Node } from 'estree'; import { Node } from 'estree';
export default function ssr(component: Component, options: CompileOptions): { export default function ssr(
js: Node[]; component: Component,
css: CssResult; options: CompileOptions
): {
js: Node[];
css: CssResult;
}; };

View file

@ -1,6 +1,8 @@
import { Node } from 'estree'; import { Node } from 'estree';
export default function flatten_reference(node: Node): { export default function flatten_reference(
name: string; node: Node
nodes: any[]; ): {
parts: any[]; name: string;
nodes: any[];
parts: any[];
}; };

View file

@ -1,9 +1,85 @@
import Attribute from '../nodes/Attribute'; import Attribute from '../nodes/Attribute';
import Block from '../render_dom/Block'; import Block from '../render_dom/Block';
export default function get_slot_data(values: Map<string, Attribute>, block?: Block): { export default function get_slot_data(
type: string; values: Map<string, Attribute>,
properties: (import("estree").Property | import("estree").SpreadElement | { block?: Block
): {
type: string;
properties: (
| import('estree').Property
| import('estree').SpreadElement
| {
type: string; type: string;
argument: import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier; argument:
})[]; | import('estree').Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier;
}
)[];
}; };

View file

@ -1,2 +1,74 @@
import { Node } from 'estree'; import { Node } from 'estree';
export default function replace_object(node: Node, replacement: Node): import("estree").Identifier | import("estree").SimpleLiteral | import("estree").RegExpLiteral | import("estree").Program | import("estree").FunctionDeclaration | import("estree").FunctionExpression | import("estree").ArrowFunctionExpression | import("estree").SwitchCase | import("estree").CatchClause | import("estree").VariableDeclarator | import("estree").ExpressionStatement | import("estree").BlockStatement | import("estree").EmptyStatement | import("estree").DebuggerStatement | import("estree").WithStatement | import("estree").ReturnStatement | import("estree").LabeledStatement | import("estree").BreakStatement | import("estree").ContinueStatement | import("estree").IfStatement | import("estree").SwitchStatement | import("estree").ThrowStatement | import("estree").TryStatement | import("estree").WhileStatement | import("estree").DoWhileStatement | import("estree").ForStatement | import("estree").ForInStatement | import("estree").ForOfStatement | import("estree").VariableDeclaration | import("estree").ClassDeclaration | import("estree").ThisExpression | import("estree").ArrayExpression | import("estree").ObjectExpression | import("estree").YieldExpression | import("estree").UnaryExpression | import("estree").UpdateExpression | import("estree").BinaryExpression | import("estree").AssignmentExpression | import("estree").LogicalExpression | import("estree").MemberExpression | import("estree").ConditionalExpression | import("estree").SimpleCallExpression | import("estree").NewExpression | import("estree").SequenceExpression | import("estree").TemplateLiteral | import("estree").TaggedTemplateExpression | import("estree").ClassExpression | import("estree").MetaProperty | import("estree").AwaitExpression | import("estree").ImportExpression | import("estree").ChainExpression | import("estree").Property | import("estree").Super | import("estree").TemplateElement | import("estree").SpreadElement | import("estree").ObjectPattern | import("estree").ArrayPattern | import("estree").RestElement | import("estree").AssignmentPattern | import("estree").ClassBody | import("estree").MethodDefinition | import("estree").ImportDeclaration | import("estree").ExportNamedDeclaration | import("estree").ExportDefaultDeclaration | import("estree").ExportAllDeclaration | import("estree").ImportSpecifier | import("estree").ImportDefaultSpecifier | import("estree").ImportNamespaceSpecifier | import("estree").ExportSpecifier; export default function replace_object(
node: Node,
replacement: Node
):
| import('estree').Identifier
| import('estree').SimpleLiteral
| import('estree').RegExpLiteral
| import('estree').Program
| import('estree').FunctionDeclaration
| import('estree').FunctionExpression
| import('estree').ArrowFunctionExpression
| import('estree').SwitchCase
| import('estree').CatchClause
| import('estree').VariableDeclarator
| import('estree').ExpressionStatement
| import('estree').BlockStatement
| import('estree').EmptyStatement
| import('estree').DebuggerStatement
| import('estree').WithStatement
| import('estree').ReturnStatement
| import('estree').LabeledStatement
| import('estree').BreakStatement
| import('estree').ContinueStatement
| import('estree').IfStatement
| import('estree').SwitchStatement
| import('estree').ThrowStatement
| import('estree').TryStatement
| import('estree').WhileStatement
| import('estree').DoWhileStatement
| import('estree').ForStatement
| import('estree').ForInStatement
| import('estree').ForOfStatement
| import('estree').VariableDeclaration
| import('estree').ClassDeclaration
| import('estree').ThisExpression
| import('estree').ArrayExpression
| import('estree').ObjectExpression
| import('estree').YieldExpression
| import('estree').UnaryExpression
| import('estree').UpdateExpression
| import('estree').BinaryExpression
| import('estree').AssignmentExpression
| import('estree').LogicalExpression
| import('estree').MemberExpression
| import('estree').ConditionalExpression
| import('estree').SimpleCallExpression
| import('estree').NewExpression
| import('estree').SequenceExpression
| import('estree').TemplateLiteral
| import('estree').TaggedTemplateExpression
| import('estree').ClassExpression
| import('estree').MetaProperty
| import('estree').AwaitExpression
| import('estree').ImportExpression
| import('estree').ChainExpression
| import('estree').Property
| import('estree').Super
| import('estree').TemplateElement
| import('estree').SpreadElement
| import('estree').ObjectPattern
| import('estree').ArrayPattern
| import('estree').RestElement
| import('estree').AssignmentPattern
| import('estree').ClassBody
| import('estree').MethodDefinition
| import('estree').ImportDeclaration
| import('estree').ExportNamedDeclaration
| import('estree').ExportDefaultDeclaration
| import('estree').ExportAllDeclaration
| import('estree').ImportSpecifier
| import('estree').ImportDefaultSpecifier
| import('estree').ImportNamespaceSpecifier
| import('estree').ExportSpecifier;

View file

@ -1,8 +1,10 @@
import { Node } from 'estree'; import { Node } from 'estree';
import { Scope, extract_names, extract_identifiers } from 'periscopic'; import { Scope, extract_names, extract_identifiers } from 'periscopic';
export declare function create_scopes(expression: Node): { export declare function create_scopes(
map: WeakMap<Node, Scope>; expression: Node
scope: Scope; ): {
globals: Map<string, Node>; map: WeakMap<Node, Scope>;
scope: Scope;
globals: Map<string, Node>;
}; };
export { Scope, extract_names, extract_identifiers }; export { Scope, extract_names, extract_identifiers };

View file

@ -1,9 +1,16 @@
export declare function string_literal(data: string): { export declare function string_literal(
type: string; data: string
value: string; ): {
type: string;
value: string;
}; };
export declare function escape(data: string, { only_escape_at_symbol }?: { export declare function escape(
data: string,
{
only_escape_at_symbol,
}?: {
only_escape_at_symbol?: boolean; only_escape_at_symbol?: boolean;
}): string; }
): string;
export declare function escape_html(html: any): string; export declare function escape_html(html: any): string;
export declare function escape_template(str: any): any; export declare function escape_template(str: any): any;

View file

@ -2,4 +2,4 @@ export { default as compile } from './compile/index';
export { default as parse } from './parse/index'; export { default as parse } from './parse/index';
export { default as preprocess } from './preprocess/index'; export { default as preprocess } from './preprocess/index';
export { walk } from 'estree-walker'; export { walk } from 'estree-walker';
export declare const VERSION = "__VERSION__"; export declare const VERSION = '__VERSION__';

View file

@ -1,148 +1,143 @@
import { Node, Program } from 'estree'; import { Node, Program } from 'estree';
import { SourceMap } from 'magic-string'; import { SourceMap } from 'magic-string';
interface BaseNode { interface BaseNode {
start: number; start: number;
end: number; end: number;
type: string; type: string;
children?: TemplateNode[]; children?: TemplateNode[];
[prop_name: string]: any; [prop_name: string]: any;
} }
export interface Fragment extends BaseNode { export interface Fragment extends BaseNode {
type: 'Fragment'; type: 'Fragment';
children: TemplateNode[]; children: TemplateNode[];
} }
export interface Text extends BaseNode { export interface Text extends BaseNode {
type: 'Text'; type: 'Text';
data: string; data: string;
} }
export interface MustacheTag extends BaseNode { export interface MustacheTag extends BaseNode {
type: 'MustacheTag'; type: 'MustacheTag';
expression: string; expression: string;
} }
export declare type DirectiveType = 'Action' | 'Animation' | 'Binding' | 'Class' | 'EventHandler' | 'Let' | 'Ref' | 'Transition'; export declare type DirectiveType = 'Action' | 'Animation' | 'Binding' | 'Class' | 'EventHandler' | 'Let' | 'Ref' | 'Transition';
interface BaseDirective extends BaseNode { interface BaseDirective extends BaseNode {
type: DirectiveType; type: DirectiveType;
expression: null | Node; expression: null | Node;
name: string; name: string;
modifiers: string[]; modifiers: string[];
} }
export interface Transition extends BaseDirective { export interface Transition extends BaseDirective {
type: 'Transition'; type: 'Transition';
intro: boolean; intro: boolean;
outro: boolean; outro: boolean;
} }
export declare type Directive = BaseDirective | Transition; export declare type Directive = BaseDirective | Transition;
export declare type TemplateNode = Text | MustacheTag | BaseNode | Directive | Transition; export declare type TemplateNode = Text | MustacheTag | BaseNode | Directive | Transition;
export interface Parser { export interface Parser {
readonly template: string; readonly template: string;
readonly filename?: string; readonly filename?: string;
index: number; index: number;
stack: Node[]; stack: Node[];
html: Node; html: Node;
css: Node; css: Node;
js: Node; js: Node;
meta_tags: {}; meta_tags: {};
} }
export interface Script extends BaseNode { export interface Script extends BaseNode {
type: 'Script'; type: 'Script';
context: string; context: string;
content: Program; content: Program;
} }
export interface Style extends BaseNode { export interface Style extends BaseNode {
type: 'Style'; type: 'Style';
attributes: any[]; attributes: any[];
children: any[]; children: any[];
content: { content: {
start: number; start: number;
end: number; end: number;
styles: string; styles: string;
}; };
} }
export interface Ast { export interface Ast {
html: TemplateNode; html: TemplateNode;
css: Style; css: Style;
instance: Script; instance: Script;
module: Script; module: Script;
} }
export interface Warning { export interface Warning {
start?: { start?: {
line: number; line: number;
column: number; column: number;
pos?: number;
};
end?: {
line: number;
column: number;
};
pos?: number; pos?: number;
code: string; };
message: string; end?: {
filename?: string; line: number;
frame?: string; column: number;
toString: () => string; };
pos?: number;
code: string;
message: string;
filename?: string;
frame?: string;
toString: () => string;
} }
export declare type ModuleFormat = 'esm' | 'cjs'; export declare type ModuleFormat = 'esm' | 'cjs';
export declare type CssHashGetter = (args: { export declare type CssHashGetter = (args: { name: string; filename: string | undefined; css: string; hash: (input: string) => string }) => string;
name: string;
filename: string | undefined;
css: string;
hash: (input: string) => string;
}) => string;
export interface CompileOptions { export interface CompileOptions {
format?: ModuleFormat; format?: ModuleFormat;
name?: string; name?: string;
filename?: string; filename?: string;
generate?: 'dom' | 'ssr' | false; generate?: 'dom' | 'ssr' | false;
sourcemap?: object | string; sourcemap?: object | string;
outputFilename?: string; outputFilename?: string;
cssOutputFilename?: string; cssOutputFilename?: string;
sveltePath?: string; sveltePath?: string;
dev?: boolean; dev?: boolean;
accessors?: boolean; accessors?: boolean;
immutable?: boolean; immutable?: boolean;
hydratable?: boolean; hydratable?: boolean;
legacy?: boolean; legacy?: boolean;
customElement?: boolean; customElement?: boolean;
tag?: string; tag?: string;
css?: boolean; css?: boolean;
loopGuardTimeout?: number; loopGuardTimeout?: number;
namespace?: string; namespace?: string;
cssHash?: CssHashGetter; cssHash?: CssHashGetter;
preserveComments?: boolean; preserveComments?: boolean;
preserveWhitespace?: boolean; preserveWhitespace?: boolean;
} }
export interface ParserOptions { export interface ParserOptions {
filename?: string; filename?: string;
customElement?: boolean; customElement?: boolean;
} }
export interface Visitor { export interface Visitor {
enter: (node: Node) => void; enter: (node: Node) => void;
leave?: (node: Node) => void; leave?: (node: Node) => void;
} }
export interface AppendTarget { export interface AppendTarget {
slots: Record<string, string>; slots: Record<string, string>;
slot_stack: string[]; slot_stack: string[];
} }
export interface Var { export interface Var {
name: string; name: string;
export_name?: string; export_name?: string;
injected?: boolean; injected?: boolean;
module?: boolean; module?: boolean;
mutated?: boolean; mutated?: boolean;
reassigned?: boolean; reassigned?: boolean;
referenced?: boolean; referenced?: boolean;
referenced_from_script?: boolean; referenced_from_script?: boolean;
writable?: boolean; writable?: boolean;
global?: boolean; global?: boolean;
internal?: boolean; internal?: boolean;
initialised?: boolean; initialised?: boolean;
hoistable?: boolean; hoistable?: boolean;
subscribable?: boolean; subscribable?: boolean;
is_reactive_dependency?: boolean; is_reactive_dependency?: boolean;
imported?: boolean; imported?: boolean;
} }
export interface CssResult { export interface CssResult {
code: string; code: string;
map: SourceMap; map: SourceMap;
} }
export {}; export {};

View file

@ -1,35 +1,41 @@
import { TemplateNode, Ast, ParserOptions, Fragment, Style, Script } from '../interfaces'; import { TemplateNode, Ast, ParserOptions, Fragment, Style, Script } from '../interfaces';
interface LastAutoClosedTag { interface LastAutoClosedTag {
tag: string; tag: string;
reason: string; reason: string;
depth: number; depth: number;
} }
export declare class Parser { export declare class Parser {
readonly template: string; readonly template: string;
readonly filename?: string; readonly filename?: string;
readonly customElement: boolean; readonly customElement: boolean;
index: number; index: number;
stack: TemplateNode[]; stack: TemplateNode[];
html: Fragment; html: Fragment;
css: Style[]; css: Style[];
js: Script[]; js: Script[];
meta_tags: {}; meta_tags: {};
last_auto_closed_tag?: LastAutoClosedTag; last_auto_closed_tag?: LastAutoClosedTag;
constructor(template: string, options: ParserOptions); constructor(template: string, options: ParserOptions);
current(): TemplateNode; current(): TemplateNode;
acorn_error(err: any): void; acorn_error(err: any): void;
error({ code, message }: { error(
code: string; {
message: string; code,
}, index?: number): void; message,
eat(str: string, required?: boolean, message?: string): boolean; }: {
match(str: string): boolean; code: string;
match_regex(pattern: RegExp): string; message: string;
allow_whitespace(): void; },
read(pattern: RegExp): string; index?: number
read_identifier(allow_reserved?: boolean): string; ): void;
read_until(pattern: RegExp): string; eat(str: string, required?: boolean, message?: string): boolean;
require_whitespace(): void; match(str: string): boolean;
match_regex(pattern: RegExp): string;
allow_whitespace(): void;
read(pattern: RegExp): string;
read_identifier(allow_reserved?: boolean): string;
read_until(pattern: RegExp): string;
require_whitespace(): void;
} }
export default function parse(template: string, options?: ParserOptions): Ast; export default function parse(template: string, options?: ParserOptions): Ast;
export {}; export {};

View file

@ -1,6 +1,8 @@
import { Parser } from '../index'; import { Parser } from '../index';
import { Pattern } from 'estree'; import { Pattern } from 'estree';
export default function read_context(parser: Parser): Pattern & { export default function read_context(
start: number; parser: Parser
end: number; ): Pattern & {
start: number;
end: number;
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,8 @@
import { PreprocessorGroup, Processed } from './types'; import { PreprocessorGroup, Processed } from './types';
export default function preprocess(source: string, preprocessor: PreprocessorGroup | PreprocessorGroup[], options?: { export default function preprocess(
source: string,
preprocessor: PreprocessorGroup | PreprocessorGroup[],
options?: {
filename?: string; filename?: string;
}): Promise<Processed>; }
): Promise<Processed>;

View file

@ -1,27 +1,20 @@
import { Location } from 'locate-character'; import { Location } from 'locate-character';
export interface Source { export interface Source {
source: string; source: string;
get_location: (search: number) => Location; get_location: (search: number) => Location;
file_basename: string; file_basename: string;
filename: string; filename: string;
} }
export interface Processed { export interface Processed {
code: string; code: string;
map?: string | object; map?: string | object;
dependencies?: string[]; dependencies?: string[];
toString?: () => string; toString?: () => string;
} }
export declare type MarkupPreprocessor = (options: { export declare type MarkupPreprocessor = (options: { content: string; filename: string }) => Processed | Promise<Processed>;
content: string; export declare type Preprocessor = (options: { content: string; attributes: Record<string, string | boolean>; filename?: string }) => Processed | Promise<Processed>;
filename: string;
}) => Processed | Promise<Processed>;
export declare type Preprocessor = (options: {
content: string;
attributes: Record<string, string | boolean>;
filename?: string;
}) => Processed | Promise<Processed>;
export interface PreprocessorGroup { export interface PreprocessorGroup {
markup?: MarkupPreprocessor; markup?: MarkupPreprocessor;
style?: Preprocessor; style?: Preprocessor;
script?: Preprocessor; script?: Preprocessor;
} }

View file

@ -1,8 +1,11 @@
export default function error(message: string, props: { export default function error(
message: string,
props: {
name: string; name: string;
code: string; code: string;
source: string; source: string;
filename: string; filename: string;
start: number; start: number;
end?: number; end?: number;
}): never; }
): never;

View file

@ -1,4 +1,6 @@
export declare function link<T extends { export declare function link<
T extends {
next?: T; next?: T;
prev?: T; prev?: T;
}>(next: T, prev: T): void; }
>(next: T, prev: T): void;

View file

@ -2,21 +2,21 @@ import { DecodedSourceMap, RawSourceMap } from '@ampproject/remapping/dist/types
import { SourceMap } from 'magic-string'; import { SourceMap } from 'magic-string';
import { Source, Processed } from '../preprocess/types'; import { Source, Processed } from '../preprocess/types';
export declare type SourceLocation = { export declare type SourceLocation = {
line: number; line: number;
column: number; column: number;
}; };
export declare function sourcemap_add_offset(map: DecodedSourceMap, offset: SourceLocation, source_index: number): void; export declare function sourcemap_add_offset(map: DecodedSourceMap, offset: SourceLocation, source_index: number): void;
export declare class MappedCode { export declare class MappedCode {
string: string; string: string;
map: DecodedSourceMap; map: DecodedSourceMap;
constructor(string?: string, map?: DecodedSourceMap); constructor(string?: string, map?: DecodedSourceMap);
/** /**
* concat in-place (mutable), return this (chainable) * concat in-place (mutable), return this (chainable)
* will also mutate the `other` object * will also mutate the `other` object
*/ */
concat(other: MappedCode): MappedCode; concat(other: MappedCode): MappedCode;
static from_processed(string: string, map?: DecodedSourceMap): MappedCode; static from_processed(string: string, map?: DecodedSourceMap): MappedCode;
static from_source({ source, file_basename, get_location }: Source): MappedCode; static from_source({ source, file_basename, get_location }: Source): MappedCode;
} }
export declare function combine_sourcemaps(filename: string, sourcemap_list: Array<DecodedSourceMap | RawSourceMap>): RawSourceMap; export declare function combine_sourcemaps(filename: string, sourcemap_list: Array<DecodedSourceMap | RawSourceMap>): RawSourceMap;
export declare function apply_preprocessor_sourcemap(filename: string, svelte_map: SourceMap, preprocessor_map_input: string | DecodedSourceMap | RawSourceMap): SourceMap; export declare function apply_preprocessor_sourcemap(filename: string, svelte_map: SourceMap, preprocessor_map_input: string | DecodedSourceMap | RawSourceMap): SourceMap;

Some files were not shown because too many files have changed in this diff Show more