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": {
"build": "tsc && npm run copy-js",
"lint": "eslint 'src/**/*.{js,ts}'",
"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:watch": "nodemon -w src --ext js --exec 'npm run copy-js'"
},
@ -45,12 +47,18 @@
},
"devDependencies": {
"@types/yargs-parser": "^20.2.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"concurrently": "^6.0.0",
"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",
"nodemon": "^2.0.7",
"preact": "^10.5.12",
"preact-render-to-string": "^5.1.14",
"prettier": "^2.2.1",
"typescript": "^4.2.3"
}
}

View file

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

View file

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

View file

@ -8,123 +8,131 @@ import Slot from './nodes/Slot';
import { Node, ImportDeclaration, Identifier } from 'estree';
import Element from './nodes/Element';
interface ComponentOptions {
namespace?: string;
tag?: string;
immutable?: boolean;
accessors?: boolean;
preserveWhitespace?: boolean;
namespace?: string;
tag?: string;
immutable?: boolean;
accessors?: boolean;
preserveWhitespace?: boolean;
}
export default class Component {
stats: Stats;
warnings: Warning[];
ignores: Set<string>;
ignore_stack: Array<Set<string>>;
stats: Stats;
warnings: Warning[];
ignores: 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;
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;
warnings: Warning[];
vars: {
name: string;
export_name: string;
injected: boolean;
module: boolean;
mutated: boolean;
reassigned: boolean;
referenced: boolean;
writable: boolean;
referenced_from_script: boolean;
}[];
stats: {
timings: {
total: 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;
warnings: Warning[];
vars: {
name: string;
export_name: string;
injected: boolean;
module: boolean;
mutated: boolean;
reassigned: boolean;
referenced: boolean;
writable: boolean;
referenced_from_script: boolean;
}[];
stats: {
timings: {
total: number;
};
};
};
get_unique_name(name: string, scope?: Scope): Identifier;
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;
};
get_unique_name(name: string, scope?: Scope): Identifier;
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 {};

View file

@ -1,14 +1,24 @@
import { ModuleFormat } from '../interfaces';
import { Identifier, ImportDeclaration } from 'estree';
interface Export {
name: string;
as: string;
name: 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;
alias: Identifier;
}>, globals: Array<{
}>,
globals: Array<{
name: string;
alias: Identifier;
}>, imports: ImportDeclaration[], module_exports: Export[]): void;
}>,
imports: ImportDeclaration[],
module_exports: Export[]
): void;
export {};

View file

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

View file

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

View file

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

View file

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

View file

@ -4,10 +4,10 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
import { Directive } from '../../interfaces';
export default class Action extends Node {
type: 'Action';
name: string;
expression: Expression;
uses_context: boolean;
template_scope: TemplateScope;
constructor(component: Component, parent: Node, scope: TemplateScope, info: Directive);
type: 'Action';
name: string;
expression: Expression;
uses_context: boolean;
template_scope: TemplateScope;
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 Element from './Element';
export default class Animation extends Node {
type: 'Animation';
name: string;
expression: Expression;
constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode);
type: 'Animation';
name: string;
expression: Expression;
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 { TemplateNode } from '../../interfaces';
export default class Attribute extends Node {
type: 'Attribute' | 'Spread';
start: number;
end: number;
scope: TemplateScope;
component: Component;
parent: Element;
name: string;
is_spread: boolean;
is_true: boolean;
is_static: boolean;
expression?: Expression;
chunks: Array<Text | Expression>;
dependencies: Set<string>;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
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 | {
type: 'Attribute' | 'Spread';
start: number;
end: number;
scope: TemplateScope;
component: Component;
parent: Element;
name: string;
is_spread: boolean;
is_true: boolean;
is_static: boolean;
expression?: Expression;
chunks: Array<Text | Expression>;
dependencies: Set<string>;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
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
| {
type: string;
value: string;
};
get_static_value(): string | true;
should_cache(): boolean;
};
get_static_value(): string | true;
should_cache(): boolean;
}

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ import AwaitBlock from './AwaitBlock';
import Component from '../Component';
import { TemplateNode } from '../../interfaces';
export default class CatchBlock extends AbstractBlock {
type: 'CatchBlock';
scope: TemplateScope;
constructor(component: Component, parent: AwaitBlock, scope: TemplateScope, info: TemplateNode);
type: 'CatchBlock';
scope: TemplateScope;
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 Component from '../Component';
export default class Class extends Node {
type: 'Class';
name: string;
expression: Expression;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'Class';
name: string;
expression: Expression;
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 TemplateScope from './shared/TemplateScope';
export default class Comment extends Node {
type: 'Comment';
data: string;
ignores: string[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'Comment';
data: string;
ignores: string[];
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 { INode } from './interfaces';
export default class DebugTag extends Node {
type: 'DebugTag';
expressions: Expression[];
constructor(component: Component, parent: INode, scope: TemplateScope, info: TemplateNode);
type: 'DebugTag';
expressions: Expression[];
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 { INode } from './interfaces';
export default class DefaultSlotTemplate extends Node {
type: 'SlotTemplate';
scope: TemplateScope;
children: INode[];
lets: Let[];
slot_template_name: string;
constructor(component: Component, parent: INode, scope: TemplateScope, info: any, lets: Let[], children: INode[]);
type: 'SlotTemplate';
scope: TemplateScope;
children: INode[];
lets: Let[];
slot_template_name: string;
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 { TemplateNode } from '../../interfaces';
export default class EachBlock extends AbstractBlock {
type: 'EachBlock';
expression: Expression;
context_node: Node;
iterations: string;
index: string;
context: string;
key: Expression;
scope: TemplateScope;
contexts: Context[];
has_animation: boolean;
has_binding: boolean;
has_index_binding: boolean;
else?: ElseBlock;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'EachBlock';
expression: Expression;
context_node: Node;
iterations: string;
index: string;
context: string;
key: Expression;
scope: TemplateScope;
contexts: Context[];
has_animation: boolean;
has_binding: boolean;
has_index_binding: boolean;
else?: ElseBlock;
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 Component from '../Component';
export default class Element extends Node {
type: 'Element';
name: string;
scope: TemplateScope;
attributes: Attribute[];
actions: Action[];
bindings: Binding[];
classes: Class[];
handlers: EventHandler[];
lets: Let[];
intro?: Transition;
outro?: Transition;
animation?: Animation;
children: INode[];
namespace: string;
needs_manual_style_scoping: boolean;
constructor(component: Component, parent: Node, scope: TemplateScope, info: any);
validate(): void;
validate_attributes(): void;
validate_attributes_a11y(): void;
validate_special_cases(): void;
validate_bindings_foreign(): void;
validate_bindings(): void;
validate_content(): void;
validate_event_handlers(): void;
is_media_node(): boolean;
add_css_class(): void;
get slot_template_name(): string;
type: 'Element';
name: string;
scope: TemplateScope;
attributes: Attribute[];
actions: Action[];
bindings: Binding[];
classes: Class[];
handlers: EventHandler[];
lets: Let[];
intro?: Transition;
outro?: Transition;
animation?: Animation;
children: INode[];
namespace: string;
needs_manual_style_scoping: boolean;
constructor(component: Component, parent: Node, scope: TemplateScope, info: any);
validate(): void;
validate_attributes(): void;
validate_attributes_a11y(): void;
validate_special_cases(): void;
validate_bindings_foreign(): void;
validate_bindings(): void;
validate_content(): void;
validate_event_handlers(): void;
is_media_node(): boolean;
add_css_class(): void;
get slot_template_name(): string;
}

View file

@ -4,6 +4,6 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces';
import Node from './shared/Node';
export default class ElseBlock extends AbstractBlock {
type: 'ElseBlock';
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'ElseBlock';
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 { TemplateNode } from '../../interfaces';
export default class EventHandler extends Node {
type: 'EventHandler';
name: string;
modifiers: Set<string>;
expression: Expression;
handler_name: Identifier;
uses_context: boolean;
can_make_passive: boolean;
constructor(component: Component, parent: Node, template_scope: TemplateScope, info: TemplateNode);
get reassigned(): boolean;
type: 'EventHandler';
name: string;
modifiers: Set<string>;
expression: Expression;
handler_name: Identifier;
uses_context: boolean;
can_make_passive: boolean;
constructor(component: Component, parent: Node, template_scope: TemplateScope, info: TemplateNode);
get reassigned(): boolean;
}

View file

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

View file

@ -3,8 +3,8 @@ import Component from '../Component';
import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces';
export default class Head extends Node {
type: 'Head';
children: any[];
id: string;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'Head';
children: any[];
id: string;
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 Node from './shared/Node';
export default class IfBlock extends AbstractBlock {
type: 'IfBlock';
expression: Expression;
else: ElseBlock;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'IfBlock';
expression: Expression;
else: ElseBlock;
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 { TemplateNode } from '../../interfaces';
export default class InlineComponent extends Node {
type: 'InlineComponent';
name: string;
expression: Expression;
attributes: Attribute[];
bindings: Binding[];
handlers: EventHandler[];
lets: Let[];
children: INode[];
scope: TemplateScope;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
get slot_template_name(): string;
type: 'InlineComponent';
name: string;
expression: Expression;
attributes: Attribute[];
bindings: Binding[];
handlers: EventHandler[];
lets: Let[];
children: INode[];
scope: TemplateScope;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
get slot_template_name(): string;
}

View file

@ -5,7 +5,7 @@ import TemplateScope from './shared/TemplateScope';
import { TemplateNode } from '../../interfaces';
import Node from './shared/Node';
export default class KeyBlock extends AbstractBlock {
type: 'KeyBlock';
expression: Expression;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'KeyBlock';
expression: Expression;
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 { TemplateNode } from '../../interfaces';
export default class Let extends Node {
type: 'Let';
name: Identifier;
value: Identifier;
names: string[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'Let';
name: Identifier;
value: Identifier;
names: string[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
}

View file

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

View file

@ -1,4 +1,4 @@
import Node from './shared/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 Node from './shared/Node';
export default class PendingBlock extends AbstractBlock {
type: 'PendingBlock';
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'PendingBlock';
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
}

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ import AwaitBlock from './AwaitBlock';
import Component from '../Component';
import { TemplateNode } from '../../interfaces';
export default class ThenBlock extends AbstractBlock {
type: 'ThenBlock';
scope: TemplateScope;
constructor(component: Component, parent: AwaitBlock, scope: TemplateScope, info: TemplateNode);
type: 'ThenBlock';
scope: TemplateScope;
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 { TemplateNode } from '../../interfaces';
export default class Title extends Node {
type: 'Title';
children: Children;
should_cache: boolean;
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'Title';
children: Children;
should_cache: boolean;
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 Element from './Element';
export default class Transition extends Node {
type: 'Transition';
name: string;
directive: string;
expression: Expression;
is_local: boolean;
constructor(component: Component, parent: Element, scope: TemplateScope, info: TemplateNode);
type: 'Transition';
name: string;
directive: string;
expression: Expression;
is_local: boolean;
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 { TemplateNode } from '../../interfaces';
export default class Window extends Node {
type: 'Window';
handlers: EventHandler[];
bindings: Binding[];
actions: Action[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
type: 'Window';
handlers: EventHandler[];
bindings: Binding[];
actions: Action[];
constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode);
}

View file

@ -31,4 +31,37 @@ import ThenBlock from './ThenBlock';
import Title from './Title';
import Transition from './Transition';
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 { INode } from '../interfaces';
export default class AbstractBlock extends Node {
block: Block;
children: INode[];
constructor(component: Component, parent: any, scope: any, info: any);
warn_if_empty_block(): void;
block: Block;
children: INode[];
constructor(component: Component, parent: any, scope: any, info: any);
warn_if_empty_block(): void;
}

View file

@ -1,8 +1,8 @@
import { Node, Identifier } from 'estree';
export interface Context {
key: Identifier;
name?: string;
modifier: (node: Node) => Node;
default_modifier: (node: Node, to_ctx: (name: string) => Node) => Node;
key: Identifier;
name?: string;
modifier: (node: 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;

View file

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

View file

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

View file

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

View file

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

View file

@ -17,4 +17,27 @@ import Title from '../Title';
import Window from '../Window';
import { TemplateNode } from '../../../interfaces';
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 { Node, Identifier } from 'estree';
export interface Bindings {
object: Identifier;
property: Identifier;
snippet: Node;
store: string;
modifier: (node: Node) => Node;
object: Identifier;
property: Identifier;
snippet: Node;
store: string;
modifier: (node: Node) => Node;
}
export interface BlockOptions {
parent?: Block;
name: Identifier;
type: string;
renderer?: Renderer;
comment?: string;
key?: Identifier;
bindings?: Map<string, Bindings>;
dependencies?: Set<string>;
parent?: Block;
name: Identifier;
type: string;
renderer?: Renderer;
comment?: string;
key?: Identifier;
bindings?: Map<string, Bindings>;
dependencies?: Set<string>;
}
export default class Block {
parent?: Block;
renderer: Renderer;
name: Identifier;
type: string;
comment?: string;
wrappers: Wrapper[];
key: Identifier;
first: Identifier;
dependencies: Set<string>;
bindings: Map<string, Bindings>;
binding_group_initialised: Set<string>;
chunks: {
declarations: Array<Node | Node[]>;
init: Array<Node | Node[]>;
create: Array<Node | Node[]>;
claim: Array<Node | Node[]>;
hydrate: Array<Node | Node[]>;
mount: Array<Node | Node[]>;
measure: Array<Node | Node[]>;
fix: Array<Node | Node[]>;
animate: Array<Node | Node[]>;
intro: Array<Node | Node[]>;
update: Array<Node | Node[]>;
outro: Array<Node | Node[]>;
destroy: Array<Node | Node[]>;
};
event_listeners: Node[];
maintain_context: boolean;
has_animation: boolean;
has_intros: boolean;
has_outros: boolean;
has_intro_method: boolean;
has_outro_method: boolean;
outros: number;
aliases: Map<string, Identifier>;
variables: Map<string, {
id: Identifier;
init?: Node;
}>;
get_unique_name: (name: string) => Identifier;
has_update_method: boolean;
autofocus: string;
constructor(options: BlockOptions);
assign_variable_names(): void;
add_dependencies(dependencies: Set<string>): void;
add_element(id: Identifier, render_statement: Node, claim_statement: Node, parent_node: Node, no_detach?: boolean): void;
add_intro(local?: boolean): void;
add_outro(local?: boolean): void;
add_animation(): void;
add_variable(id: Identifier, init?: Node): void;
alias(name: string): Identifier;
child(options: BlockOptions): Block;
get_contents(key?: any): Node[];
has_content(): boolean;
render(): Node[];
render_listeners(chunk?: string): void;
parent?: Block;
renderer: Renderer;
name: Identifier;
type: string;
comment?: string;
wrappers: Wrapper[];
key: Identifier;
first: Identifier;
dependencies: Set<string>;
bindings: Map<string, Bindings>;
binding_group_initialised: Set<string>;
chunks: {
declarations: Array<Node | Node[]>;
init: Array<Node | Node[]>;
create: Array<Node | Node[]>;
claim: Array<Node | Node[]>;
hydrate: Array<Node | Node[]>;
mount: Array<Node | Node[]>;
measure: Array<Node | Node[]>;
fix: Array<Node | Node[]>;
animate: Array<Node | Node[]>;
intro: Array<Node | Node[]>;
update: Array<Node | Node[]>;
outro: Array<Node | Node[]>;
destroy: Array<Node | Node[]>;
};
event_listeners: Node[];
maintain_context: boolean;
has_animation: boolean;
has_intros: boolean;
has_outros: boolean;
has_intro_method: boolean;
has_outro_method: boolean;
outros: number;
aliases: Map<string, Identifier>;
variables: Map<
string,
{
id: Identifier;
init?: Node;
}
>;
get_unique_name: (name: string) => Identifier;
has_update_method: boolean;
autofocus: string;
constructor(options: BlockOptions);
assign_variable_names(): void;
add_dependencies(dependencies: Set<string>): void;
add_element(id: Identifier, render_statement: Node, claim_statement: Node, parent_node: Node, no_detach?: boolean): void;
add_intro(local?: boolean): void;
add_outro(local?: boolean): void;
add_animation(): void;
add_variable(id: Identifier, init?: Node): void;
alias(name: string): Identifier;
child(options: BlockOptions): Block;
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 { Node, Identifier, MemberExpression, Literal, Expression } from 'estree';
interface ContextMember {
name: string;
index: Literal;
is_contextual: boolean;
is_non_contextual: boolean;
variable: Var;
priority: number;
name: string;
index: Literal;
is_contextual: boolean;
is_non_contextual: boolean;
variable: Var;
priority: number;
}
export default class Renderer {
component: Component;
options: CompileOptions;
context: ContextMember[];
initial_context: ContextMember[];
context_lookup: Map<string, ContextMember>;
context_overflow: boolean;
blocks: Array<Block | Node | Node[]>;
readonly: Set<string>;
meta_bindings: Array<Node | Node[]>;
binding_groups: Map<string, {
binding_group: (to_reference?: boolean) => Node;
is_context: boolean;
contexts: string[];
index: number;
keypath: string;
}>;
block: Block;
fragment: FragmentWrapper;
file_var: Identifier;
locate: (c: number) => {
line: number;
column: number;
};
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;
component: Component;
options: CompileOptions;
context: ContextMember[];
initial_context: ContextMember[];
context_lookup: Map<string, ContextMember>;
context_overflow: boolean;
blocks: Array<Block | Node | Node[]>;
readonly: Set<string>;
meta_bindings: Array<Node | Node[]>;
binding_groups: Map<
string,
{
binding_group: (to_reference?: boolean) => Node;
is_context: boolean;
contexts: string[];
index: number;
keypath: string;
}
>;
block: Block;
fragment: FragmentWrapper;
file_var: Identifier;
locate: (
c: number
) => {
line: number;
column: number;
};
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 {};

View file

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

View file

@ -10,29 +10,37 @@ import { Context } from '../../nodes/shared/Context';
import { Identifier, Literal, Node } from 'estree';
declare type Status = 'pending' | 'then' | 'catch';
declare class AwaitBlockBranch extends Wrapper {
parent: AwaitBlockWrapper;
node: PendingBlock | ThenBlock | CatchBlock;
block: Block;
fragment: FragmentWrapper;
is_dynamic: boolean;
var: any;
status: Status;
value: string;
value_index: Literal;
value_contexts: Context[];
is_destructured: boolean;
constructor(status: Status, renderer: Renderer, 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;
parent: AwaitBlockWrapper;
node: PendingBlock | ThenBlock | CatchBlock;
block: Block;
fragment: FragmentWrapper;
is_dynamic: boolean;
var: any;
status: Status;
value: string;
value_index: Literal;
value_contexts: Context[];
is_destructured: boolean;
constructor(
status: Status,
renderer: Renderer,
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 {
node: AwaitBlock;
pending: AwaitBlockBranch;
then: AwaitBlockBranch;
catch: AwaitBlockBranch;
var: Identifier;
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;
node: AwaitBlock;
pending: AwaitBlockBranch;
then: AwaitBlockBranch;
catch: AwaitBlockBranch;
var: Identifier;
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;
}
export {};

View file

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

View file

@ -6,51 +6,68 @@ import FragmentWrapper from './Fragment';
import ElseBlock from '../../nodes/ElseBlock';
import { Identifier, Node } from 'estree';
export declare class ElseBlockWrapper extends Wrapper {
node: ElseBlock;
block: Block;
fragment: FragmentWrapper;
is_dynamic: boolean;
var: any;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper);
node: ElseBlock;
block: Block;
fragment: FragmentWrapper;
is_dynamic: boolean;
var: any;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: ElseBlock, strip_whitespace: boolean, next_sibling: 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;
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;
parent_node: Identifier;
parent_nodes: Identifier;
snippet: Node;
initial_anchor_node: Identifier;
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;
parent_node: Identifier;
parent_nodes: Identifier;
snippet: Node;
initial_anchor_node: Identifier;
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 { Identifier, Node } from 'estree';
export declare class BaseAttributeWrapper {
node: Attribute;
parent: ElementWrapper;
constructor(parent: ElementWrapper, block: Block, node: Attribute);
render(_block: Block): void;
node: Attribute;
parent: ElementWrapper;
constructor(parent: ElementWrapper, block: Block, node: Attribute);
render(_block: Block): void;
}
export default class AttributeWrapper extends BaseAttributeWrapper {
node: Attribute;
parent: ElementWrapper;
metadata: any;
name: string;
property_name: string;
is_indirectly_bound_value: boolean;
is_src: boolean;
is_select_value_attribute: boolean;
is_input_value: boolean;
should_cache: boolean;
last: Identifier;
constructor(parent: ElementWrapper, block: Block, node: Attribute);
render(block: Block): void;
get_init(block: Block, value: any): any;
get_dom_update_conditions(block: Block, dependency_condition: Node): Node;
get_dependencies(): string[];
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 | {
node: Attribute;
parent: ElementWrapper;
metadata: any;
name: string;
property_name: string;
is_indirectly_bound_value: boolean;
is_src: boolean;
is_select_value_attribute: boolean;
is_input_value: boolean;
should_cache: boolean;
last: Identifier;
constructor(parent: ElementWrapper, block: Block, node: Attribute);
render(block: Block): void;
get_init(block: Block, value: any): any;
get_dom_update_conditions(block: Block, dependency_condition: Node): Node;
get_dependencies(): string[];
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
| {
type: 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;
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;
value: string;
})[];
stringify(): string;
}
)[];
stringify(): string;
}

View file

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

View file

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

View file

@ -1,3 +1,2 @@
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 Text from '../../../nodes/Text';
export interface StyleProp {
key: string;
value: Array<Text | Expression>;
important: boolean;
key: string;
value: Array<Text | Expression>;
important: boolean;
}
export default class StyleAttributeWrapper extends AttributeWrapper {
node: Attribute;
parent: ElementWrapper;
render(block: Block): void;
node: Attribute;
parent: ElementWrapper;
render(block: Block): void;
}

View file

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

View file

@ -4,7 +4,7 @@ import Renderer from '../Renderer';
import Block from '../Block';
import { Identifier } from 'estree';
export default class FragmentWrapper {
nodes: 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;
nodes: 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;
}

View file

@ -5,8 +5,8 @@ import Head from '../../nodes/Head';
import FragmentWrapper from './Fragment';
import { Identifier } from 'estree';
export default class HeadWrapper extends Wrapper {
fragment: FragmentWrapper;
node: Head;
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;
fragment: FragmentWrapper;
node: Head;
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;
}

View file

@ -7,48 +7,86 @@ import ElseBlock from '../../nodes/ElseBlock';
import FragmentWrapper from './Fragment';
import { Identifier, Node, UnaryExpression } from 'estree';
declare class IfBlockBranch extends Wrapper {
block: Block;
fragment: FragmentWrapper;
dependencies?: string[];
condition?: any;
snippet?: Node;
is_dynamic: boolean;
var: any;
constructor(renderer: Renderer, block: Block, parent: IfBlockWrapper, node: IfBlock | ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper);
block: Block;
fragment: FragmentWrapper;
dependencies?: string[];
condition?: any;
snippet?: Node;
is_dynamic: boolean;
var: any;
constructor(renderer: Renderer, block: Block, parent: IfBlockWrapper, node: IfBlock | ElseBlock, strip_whitespace: boolean, next_sibling: Wrapper);
}
export default class IfBlockWrapper extends Wrapper {
node: IfBlock;
branches: IfBlockBranch[];
needs_update: boolean;
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_compound(block: Block, parent_node: Identifier, _parent_nodes: Identifier, dynamic: any, { name, anchor, has_else, if_exists_condition, has_transitions }: {
name: any;
anchor: any;
has_else: any;
if_exists_condition: any;
has_transitions: any;
}, detaching: any): void;
render_compound_with_outros(block: Block, parent_node: Identifier, _parent_nodes: Identifier, dynamic: any, { 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;
};
node: IfBlock;
branches: IfBlockBranch[];
needs_update: boolean;
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_compound(
block: Block,
parent_node: Identifier,
_parent_nodes: Identifier,
dynamic: any,
{
name,
anchor,
has_else,
if_exists_condition,
has_transitions,
}: {
name: any;
anchor: any;
has_else: any;
if_exists_condition: any;
has_transitions: any;
},
detaching: any
): void;
render_compound_with_outros(
block: Block,
parent_node: Identifier,
_parent_nodes: Identifier,
dynamic: any,
{
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 {};

View file

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

View file

@ -6,13 +6,13 @@ import KeyBlock from '../../nodes/KeyBlock';
import FragmentWrapper from './Fragment';
import { Identifier } from 'estree';
export default class KeyBlockWrapper extends Wrapper {
node: KeyBlock;
fragment: FragmentWrapper;
block: Block;
dependencies: 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_static_key(_block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
render_dynamic_key(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
node: KeyBlock;
fragment: FragmentWrapper;
block: Block;
dependencies: 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_static_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 { Identifier } from 'estree';
export default class MustacheTagWrapper extends Tag {
var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
render(block: Block, parent_node: Identifier, parent_nodes: Identifier): void;
var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
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 { Identifier } from 'estree';
export default class RawMustacheTagWrapper extends Tag {
var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
render(block: Block, parent_node: Identifier, _parent_nodes: Identifier): void;
var: Identifier;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
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 { Identifier } from 'estree';
export default class SlotWrapper extends Wrapper {
node: Slot;
fragment: FragmentWrapper;
fallback: Block | null;
slot_block: Block;
var: Identifier;
dependencies: Set<string>;
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;
is_dependency_dynamic(name: string): boolean;
node: Slot;
fragment: FragmentWrapper;
fallback: Block | null;
slot_block: Block;
var: Identifier;
dependencies: Set<string>;
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;
is_dependency_dynamic(name: string): boolean;
}

View file

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

View file

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

View file

@ -6,8 +6,8 @@ import { Identifier } from 'estree';
import { TemplateNode } from '../../../interfaces';
import EventHandler from './Element/EventHandler';
export default class WindowWrapper extends Wrapper {
node: Window;
handlers: EventHandler[];
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
render(block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
node: Window;
handlers: EventHandler[];
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
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 { Node } from 'estree';
export default class Tag extends Wrapper {
node: MustacheTag | RawMustacheTag;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
is_dependencies_static(): boolean;
rename_this_method(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;
};
node: MustacheTag | RawMustacheTag;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: MustacheTag | RawMustacheTag);
is_dependencies_static(): boolean;
rename_this_method(
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 { Identifier } from 'estree';
export default class Wrapper {
renderer: Renderer;
parent: Wrapper;
node: TemplateNode;
prev: Wrapper | null;
next: Wrapper | null;
var: Identifier;
can_use_innerhtml: boolean;
is_static_content: boolean;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
cannot_use_innerhtml(): void;
not_static_content(): void;
get_or_create_anchor(block: Block, parent_node: Identifier, parent_nodes: Identifier): Identifier;
get_update_mount_node(anchor: Identifier): Identifier;
is_dom_node(): boolean;
render(_block: Block, _parent_node: Identifier, _parent_nodes: Identifier): void;
renderer: Renderer;
parent: Wrapper;
node: TemplateNode;
prev: Wrapper | null;
next: Wrapper | null;
var: Identifier;
can_use_innerhtml: boolean;
is_static_content: boolean;
constructor(renderer: Renderer, block: Block, parent: Wrapper, node: TemplateNode);
cannot_use_innerhtml(): void;
not_static_content(): void;
get_or_create_anchor(block: Block, parent_node: Identifier, parent_nodes: Identifier): Identifier;
get_update_mount_node(anchor: Identifier): Identifier;
is_dom_node(): boolean;
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 BindingWrapper from '../Element/Binding';
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 Block from '../../Block';
import TemplateScope from '../../../nodes/shared/TemplateScope';
export declare function get_slot_definition(block: Block, scope: TemplateScope, lets: Let[]): {
block: Block;
scope: TemplateScope;
get_context?: undefined;
get_changes?: undefined;
} | {
block: Block;
scope: TemplateScope;
get_context: import("estree").Expression;
get_changes: import("estree").Expression;
};
export declare function get_slot_definition(
block: Block,
scope: TemplateScope,
lets: Let[]
):
| {
block: Block;
scope: TemplateScope;
get_context?: undefined;
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 { Expression, TemplateLiteral, Identifier } from 'estree';
export interface RenderOptions extends CompileOptions {
locate: (c: number) => {
line: number;
column: number;
};
head_id?: string;
locate: (
c: number
) => {
line: number;
column: number;
};
head_id?: string;
}
export default class Renderer {
has_bindings: boolean;
name: Identifier;
stack: Array<{
current: {
value: string;
};
literal: TemplateLiteral;
}>;
has_bindings: boolean;
name: Identifier;
stack: Array<{
current: {
value: string;
value: string;
};
literal: TemplateLiteral;
targets: AppendTarget[];
constructor({ name }: {
name: any;
});
add_string(str: string): void;
add_expression(node: Expression): void;
push(): void;
pop(): TemplateLiteral;
render(nodes: INode[], options: RenderOptions): void;
}>;
current: {
value: string;
};
literal: TemplateLiteral;
targets: AppendTarget[];
constructor({ name }: { name: any });
add_string(str: string): 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 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>;
}): void;
}
): void;

View file

@ -2,6 +2,10 @@ import Renderer, { RenderOptions } from '../Renderer';
import SlotTemplate from '../../nodes/SlotTemplate';
import InlineComponent from '../../nodes/InlineComponent';
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>;
}): void;
}
): void;

View file

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

View file

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

View file

@ -1,9 +1,85 @@
import Attribute from '../nodes/Attribute';
import Block from '../render_dom/Block';
export default function get_slot_data(values: Map<string, Attribute>, block?: Block): {
type: string;
properties: (import("estree").Property | import("estree").SpreadElement | {
export default function get_slot_data(
values: Map<string, Attribute>,
block?: Block
): {
type: string;
properties: (
| import('estree').Property
| import('estree').SpreadElement
| {
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';
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 { Scope, extract_names, extract_identifiers } from 'periscopic';
export declare function create_scopes(expression: Node): {
map: WeakMap<Node, Scope>;
scope: Scope;
globals: Map<string, Node>;
export declare function create_scopes(
expression: Node
): {
map: WeakMap<Node, Scope>;
scope: Scope;
globals: Map<string, Node>;
};
export { Scope, extract_names, extract_identifiers };

View file

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

View file

@ -1,35 +1,41 @@
import { TemplateNode, Ast, ParserOptions, Fragment, Style, Script } from '../interfaces';
interface LastAutoClosedTag {
tag: string;
reason: string;
depth: number;
tag: string;
reason: string;
depth: number;
}
export declare class Parser {
readonly template: string;
readonly filename?: string;
readonly customElement: boolean;
index: number;
stack: TemplateNode[];
html: Fragment;
css: Style[];
js: Script[];
meta_tags: {};
last_auto_closed_tag?: LastAutoClosedTag;
constructor(template: string, options: ParserOptions);
current(): TemplateNode;
acorn_error(err: any): void;
error({ code, message }: {
code: string;
message: string;
}, index?: number): void;
eat(str: string, required?: boolean, message?: string): boolean;
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;
readonly template: string;
readonly filename?: string;
readonly customElement: boolean;
index: number;
stack: TemplateNode[];
html: Fragment;
css: Style[];
js: Script[];
meta_tags: {};
last_auto_closed_tag?: LastAutoClosedTag;
constructor(template: string, options: ParserOptions);
current(): TemplateNode;
acorn_error(err: any): void;
error(
{
code,
message,
}: {
code: string;
message: string;
},
index?: number
): void;
eat(str: string, required?: boolean, message?: string): boolean;
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 {};

View file

@ -1,6 +1,8 @@
import { Parser } from '../index';
import { Pattern } from 'estree';
export default function read_context(parser: Parser): Pattern & {
start: number;
end: number;
export default function read_context(
parser: Parser
): 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';
export default function preprocess(source: string, preprocessor: PreprocessorGroup | PreprocessorGroup[], options?: {
export default function preprocess(
source: string,
preprocessor: PreprocessorGroup | PreprocessorGroup[],
options?: {
filename?: string;
}): Promise<Processed>;
}
): Promise<Processed>;

View file

@ -1,27 +1,20 @@
import { Location } from 'locate-character';
export interface Source {
source: string;
get_location: (search: number) => Location;
file_basename: string;
filename: string;
source: string;
get_location: (search: number) => Location;
file_basename: string;
filename: string;
}
export interface Processed {
code: string;
map?: string | object;
dependencies?: string[];
toString?: () => string;
code: string;
map?: string | object;
dependencies?: string[];
toString?: () => string;
}
export declare type MarkupPreprocessor = (options: {
content: string;
filename: string;
}) => Processed | Promise<Processed>;
export declare type Preprocessor = (options: {
content: string;
attributes: Record<string, string | boolean>;
filename?: string;
}) => Processed | Promise<Processed>;
export declare type MarkupPreprocessor = (options: { content: string; 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 {
markup?: MarkupPreprocessor;
style?: Preprocessor;
script?: Preprocessor;
markup?: MarkupPreprocessor;
style?: 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;
code: string;
source: string;
filename: string;
start: 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;
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 { Source, Processed } from '../preprocess/types';
export declare type SourceLocation = {
line: number;
column: number;
line: number;
column: number;
};
export declare function sourcemap_add_offset(map: DecodedSourceMap, offset: SourceLocation, source_index: number): void;
export declare class MappedCode {
string: string;
map: DecodedSourceMap;
constructor(string?: string, map?: DecodedSourceMap);
/**
* concat in-place (mutable), return this (chainable)
* will also mutate the `other` object
*/
concat(other: MappedCode): MappedCode;
static from_processed(string: string, map?: DecodedSourceMap): MappedCode;
static from_source({ source, file_basename, get_location }: Source): MappedCode;
string: string;
map: DecodedSourceMap;
constructor(string?: string, map?: DecodedSourceMap);
/**
* concat in-place (mutable), return this (chainable)
* will also mutate the `other` object
*/
concat(other: MappedCode): MappedCode;
static from_processed(string: string, map?: DecodedSourceMap): 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 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