Projekt

Obecné

Profil

Stáhnout (18.8 KB) Statistiky
| Větev: | Revize:
1
/// <reference lib="es2015" />
2

    
3
import { RawSourceMap } from 'source-map';
4

    
5
/** @deprecated since this versions basically do not exist */
6
type ECMA_UNOFFICIAL = 6 | 7 | 8 | 9;
7

    
8
export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | ECMA_UNOFFICIAL;
9

    
10
export interface ParseOptions {
11
    bare_returns?: boolean;
12
    ecma?: ECMA;
13
    html5_comments?: boolean;
14
    shebang?: boolean;
15
}
16

    
17
export interface CompressOptions {
18
    arguments?: boolean;
19
    arrows?: boolean;
20
    booleans_as_integers?: boolean;
21
    booleans?: boolean;
22
    collapse_vars?: boolean;
23
    comparisons?: boolean;
24
    computed_props?: boolean;
25
    conditionals?: boolean;
26
    dead_code?: boolean;
27
    defaults?: boolean;
28
    directives?: boolean;
29
    drop_console?: boolean;
30
    drop_debugger?: boolean;
31
    ecma?: ECMA;
32
    evaluate?: boolean;
33
    expression?: boolean;
34
    global_defs?: object;
35
    hoist_funs?: boolean;
36
    hoist_props?: boolean;
37
    hoist_vars?: boolean;
38
    ie8?: boolean;
39
    if_return?: boolean;
40
    inline?: boolean | InlineFunctions;
41
    join_vars?: boolean;
42
    keep_classnames?: boolean | RegExp;
43
    keep_fargs?: boolean;
44
    keep_fnames?: boolean | RegExp;
45
    keep_infinity?: boolean;
46
    loops?: boolean;
47
    module?: boolean;
48
    negate_iife?: boolean;
49
    passes?: number;
50
    properties?: boolean;
51
    pure_funcs?: string[];
52
    pure_getters?: boolean | 'strict';
53
    reduce_funcs?: boolean;
54
    reduce_vars?: boolean;
55
    sequences?: boolean | number;
56
    side_effects?: boolean;
57
    switches?: boolean;
58
    toplevel?: boolean;
59
    top_retain?: null | string | string[] | RegExp;
60
    typeofs?: boolean;
61
    unsafe_arrows?: boolean;
62
    unsafe?: boolean;
63
    unsafe_comps?: boolean;
64
    unsafe_Function?: boolean;
65
    unsafe_math?: boolean;
66
    unsafe_symbols?: boolean;
67
    unsafe_methods?: boolean;
68
    unsafe_proto?: boolean;
69
    unsafe_regexp?: boolean;
70
    unsafe_undefined?: boolean;
71
    unused?: boolean;
72
    warnings?: boolean;
73
}
74

    
75
export enum InlineFunctions {
76
    Disabled = 0,
77
    SimpleFunctions = 1,
78
    WithArguments = 2,
79
    WithArgumentsAndVariables = 3
80
}
81

    
82
export interface MangleOptions {
83
    eval?: boolean;
84
    keep_classnames?: boolean | RegExp;
85
    keep_fnames?: boolean | RegExp;
86
    module?: boolean;
87
    properties?: boolean | ManglePropertiesOptions;
88
    reserved?: string[];
89
    safari10?: boolean;
90
    toplevel?: boolean;
91
}
92

    
93
export interface ManglePropertiesOptions {
94
    builtins?: boolean;
95
    debug?: boolean;
96
    keep_quoted?: boolean | 'strict';
97
    regex?: RegExp | string;
98
    reserved?: string[];
99
}
100

    
101
export interface OutputOptions {
102
    ascii_only?: boolean;
103
    beautify?: boolean;
104
    braces?: boolean;
105
    comments?: boolean | 'all' | 'some' | RegExp | ( (node: AST_Node, comment: {
106
        value: string,
107
        type: 'comment1' | 'comment2' | 'comment3' | 'comment4',
108
        pos: number,
109
        line: number,
110
        col: number,
111
    }) => boolean );
112
    ecma?: ECMA;
113
    ie8?: boolean;
114
    indent_level?: number;
115
    indent_start?: number;
116
    inline_script?: boolean;
117
    keep_quoted_props?: boolean;
118
    max_line_len?: number | false;
119
    preamble?: string;
120
    preserve_annotations?: boolean;
121
    quote_keys?: boolean;
122
    quote_style?: OutputQuoteStyle;
123
    safari10?: boolean;
124
    semicolons?: boolean;
125
    shebang?: boolean;
126
    shorthand?: boolean;
127
    source_map?: SourceMapOptions;
128
    webkit?: boolean;
129
    width?: number;
130
    wrap_iife?: boolean;
131
    wrap_func_args?: boolean;
132
}
133

    
134
export enum OutputQuoteStyle {
135
    PreferDouble = 0,
136
    AlwaysSingle = 1,
137
    AlwaysDouble = 2,
138
    AlwaysOriginal = 3
139
}
140

    
141
export interface MinifyOptions {
142
    compress?: boolean | CompressOptions;
143
    ecma?: ECMA;
144
    ie8?: boolean;
145
    keep_classnames?: boolean | RegExp;
146
    keep_fnames?: boolean | RegExp;
147
    mangle?: boolean | MangleOptions;
148
    module?: boolean;
149
    nameCache?: object;
150
    output?: OutputOptions;
151
    parse?: ParseOptions;
152
    safari10?: boolean;
153
    sourceMap?: boolean | SourceMapOptions;
154
    toplevel?: boolean;
155
    warnings?: boolean | 'verbose';
156
}
157

    
158
export interface MinifyOutput {
159
    ast?: AST_Node;
160
    code?: string;
161
    error?: Error;
162
    map?: RawSourceMap | string;
163
    warnings?: string[];
164
}
165

    
166
export interface SourceMapOptions {
167
    /** Source map object, 'inline' or source map file content */
168
    content?: RawSourceMap | string;
169
    includeSources?: boolean;
170
    filename?: string;
171
    root?: string;
172
    url?: string | 'inline';
173
}
174

    
175
declare function parse(text: string, options?: ParseOptions): AST_Node;
176

    
177
export class TreeWalker {
178
    constructor(callback: (node: AST_Node, descend?: (node: AST_Node) => void) => boolean | undefined);
179
    directives: object;
180
    find_parent(type: AST_Node): AST_Node | undefined;
181
    has_directive(type: string): boolean;
182
    loopcontrol_target(node: AST_Node): AST_Node | undefined;
183
    parent(n: number): AST_Node | undefined;
184
    pop(): void;
185
    push(node: AST_Node): void;
186
    self(): AST_Node | undefined;
187
    stack: AST_Node[];
188
    visit: (node: AST_Node, descend: boolean) => any;
189
}
190

    
191
export class TreeTransformer extends TreeWalker {
192
    constructor(
193
        before: (node: AST_Node, descend?: (node: AST_Node, tw: TreeWalker) => void, in_list?: boolean) => AST_Node | undefined,
194
        after?: (node: AST_Node, in_list?: boolean) => AST_Node | undefined
195
    );
196
    before: (node: AST_Node) => AST_Node;
197
    after?: (node: AST_Node) => AST_Node;
198
}
199

    
200
export function push_uniq<T>(array: T[], el: T): void;
201

    
202
export function minify(files: string | string[] | { [file: string]: string } | AST_Node, options?: MinifyOptions): MinifyOutput;
203

    
204
export class AST_Node {
205
    constructor(props?: object);
206
    static BASE?: AST_Node;
207
    static PROPS: string[];
208
    static SELF_PROPS: string[];
209
    static SUBCLASSES: AST_Node[];
210
    static documentation: string;
211
    static propdoc?: Record<string, string>;
212
    static expressions?: AST_Node[];
213
    static warn?: (text: string, props: any) => void;
214
    static from_mozilla_ast?: (node: AST_Node) => any;
215
    walk: (visitor: TreeWalker) => void;
216
    print_to_string: (options?: OutputOptions) => string;
217
    transform: (tt: TreeTransformer, in_list?: boolean) => AST_Node;
218
    TYPE: string;
219
    CTOR: typeof AST_Node;
220
}
221

    
222
declare class SymbolDef {
223
    constructor(scope?: AST_Scope, orig?: object, init?: object);
224
    name: string;
225
    orig: AST_SymbolRef[];
226
    init: AST_SymbolRef;
227
    eliminated: number;
228
    scope: AST_Scope;
229
    references: AST_SymbolRef[];
230
    replaced: number;
231
    global: boolean;
232
    export: boolean;
233
    mangled_name: null | string;
234
    undeclared: boolean;
235
    id: number;
236
}
237

    
238
type ArgType = AST_SymbolFunarg | AST_DefaultAssign | AST_Destructuring | AST_Expansion;
239

    
240
declare class AST_Statement extends AST_Node {
241
    constructor(props?: object);
242
}
243

    
244
declare class AST_Debugger extends AST_Statement {
245
    constructor(props?: object);
246
}
247

    
248
declare class AST_Directive extends AST_Statement {
249
    constructor(props?: object);
250
    value: string;
251
    quote: string;
252
}
253

    
254
declare class AST_SimpleStatement extends AST_Statement {
255
    constructor(props?: object);
256
    body: AST_Node[];
257
}
258

    
259
declare class AST_Block extends AST_Statement {
260
    constructor(props?: object);
261
    body: AST_Node[];
262
    block_scope: AST_Scope | null;
263
}
264

    
265
declare class AST_BlockStatement extends AST_Block {
266
    constructor(props?: object);
267
}
268

    
269
declare class AST_Scope extends AST_Block {
270
    constructor(props?: object);
271
    variables: any;
272
    functions: any;
273
    uses_with: boolean;
274
    uses_eval: boolean;
275
    parent_scope: AST_Scope | null;
276
    enclosed: any;
277
    cname: any;
278
}
279

    
280
declare class AST_Toplevel extends AST_Scope {
281
    constructor(props?: object);
282
    globals: any;
283
}
284

    
285
declare class AST_Lambda extends AST_Scope {
286
    constructor(props?: object);
287
    name: AST_SymbolDeclaration | null;
288
    argnames: ArgType[];
289
    uses_arguments: boolean;
290
    is_generator: boolean;
291
    async: boolean;
292
}
293

    
294
declare class AST_Accessor extends AST_Lambda {
295
    constructor(props?: object);
296
}
297

    
298
declare class AST_Function extends AST_Lambda {
299
    constructor(props?: object);
300
}
301

    
302
declare class AST_Arrow extends AST_Lambda {
303
    constructor(props?: object);
304
}
305

    
306
declare class AST_Defun extends AST_Lambda {
307
    constructor(props?: object);
308
}
309

    
310
declare class AST_Class extends AST_Scope {
311
    constructor(props?: object);
312
    name: AST_SymbolClass | AST_SymbolDefClass | null;
313
    extends: AST_Node | null;
314
    properties: AST_ObjectProperty[];
315
}
316

    
317
declare class AST_DefClass extends AST_Class {
318
    constructor(props?: object);
319
}
320

    
321
declare class AST_ClassExpression extends AST_Class {
322
    constructor(props?: object);
323
}
324

    
325
declare class AST_Switch extends AST_Block {
326
    constructor(props?: object);
327
    expression: AST_Node;
328
}
329

    
330
declare class AST_SwitchBranch extends AST_Block {
331
    constructor(props?: object);
332
}
333

    
334
declare class AST_Default extends AST_SwitchBranch {
335
    constructor(props?: object);
336
}
337

    
338
declare class AST_Case extends AST_SwitchBranch {
339
    constructor(props?: object);
340
    expression: AST_Node;
341
}
342

    
343
declare class AST_Try extends AST_Block {
344
    constructor(props?: object);
345
    bcatch: AST_Catch;
346
    bfinally: null | AST_Finally;
347
}
348

    
349
declare class AST_Catch extends AST_Block {
350
    constructor(props?: object);
351
    argname: ArgType;
352
}
353

    
354
declare class AST_Finally extends AST_Block {
355
    constructor(props?: object);
356
}
357

    
358
declare class AST_EmptyStatement extends AST_Statement {
359
    constructor(props?: object);
360
}
361

    
362
declare class AST_StatementWithBody extends AST_Statement {
363
    constructor(props?: object);
364
    body: AST_Node[];
365
}
366

    
367
declare class AST_LabeledStatement extends AST_StatementWithBody {
368
    constructor(props?: object);
369
    label: AST_Label;
370
}
371

    
372
declare class AST_IterationStatement extends AST_StatementWithBody {
373
    constructor(props?: object);
374
    block_scope: AST_Scope | null;
375
}
376

    
377
declare class AST_DWLoop extends AST_IterationStatement {
378
    constructor(props?: object);
379
    condition: AST_Node;
380
}
381

    
382
declare class AST_Do extends AST_DWLoop {
383
    constructor(props?: object);
384
}
385

    
386
declare class AST_While extends AST_DWLoop {
387
    constructor(props?: object);
388
}
389

    
390
declare class AST_For extends AST_IterationStatement {
391
    constructor(props?: object);
392
    init: AST_Node | null;
393
    condition: AST_Node | null;
394
    step: AST_Node | null;
395
}
396

    
397
declare class AST_ForIn extends AST_IterationStatement {
398
    constructor(props?: object);
399
    init: AST_Node | null;
400
    object: AST_Node;
401
}
402

    
403
declare class AST_ForOf extends AST_ForIn {
404
    constructor(props?: object);
405
    await: boolean;
406
}
407

    
408
declare class AST_With extends AST_StatementWithBody {
409
    constructor(props?: object);
410
    expression: AST_Node;
411
}
412

    
413
declare class AST_If extends AST_StatementWithBody {
414
    constructor(props?: object);
415
    condition: AST_Node;
416
    alternative: AST_Node | null;
417
}
418

    
419
declare class AST_Jump extends AST_Statement {
420
    constructor(props?: object);
421
}
422

    
423
declare class AST_Exit extends AST_Jump {
424
    constructor(props?: object);
425
    value: AST_Node | null;
426
}
427

    
428
declare class AST_Return extends AST_Exit {
429
    constructor(props?: object);
430
}
431

    
432
declare class AST_Throw extends AST_Exit {
433
    constructor(props?: object);
434
}
435

    
436
declare class AST_LoopControl extends AST_Jump {
437
    constructor(props?: object);
438
    label: null | AST_LabelRef;
439
}
440

    
441
declare class AST_Break extends AST_LoopControl {
442
    constructor(props?: object);
443
}
444

    
445
declare class AST_Continue extends AST_LoopControl {
446
    constructor(props?: object);
447
}
448

    
449
declare class AST_Definitions extends AST_Statement {
450
    constructor(props?: object);
451
    definitions: AST_VarDef[];
452
}
453

    
454
declare class AST_Var extends AST_Definitions {
455
    constructor(props?: object);
456
}
457

    
458
declare class AST_Let extends AST_Definitions {
459
    constructor(props?: object);
460
}
461

    
462
declare class AST_Const extends AST_Definitions {
463
    constructor(props?: object);
464
}
465

    
466
declare class AST_Export extends AST_Statement {
467
    constructor(props?: object);
468
    exported_definition: AST_Definitions | AST_Lambda | AST_DefClass | null;
469
    exported_value: AST_Node | null;
470
    is_default: boolean;
471
    exported_names: AST_NameMapping[];
472
    module_name: AST_String;
473
}
474

    
475
declare class AST_Expansion extends AST_Node {
476
    constructor(props?: object);
477
    expression: AST_Node;
478
}
479

    
480
declare class AST_Destructuring extends AST_Node {
481
    constructor(props?: object);
482
    names: AST_Node[];
483
    is_array: boolean;
484
}
485

    
486
declare class AST_PrefixedTemplateString extends AST_Node {
487
    constructor(props?: object);
488
    template_string: AST_TemplateString;
489
    prefix: AST_Node;
490
}
491

    
492
declare class AST_TemplateString extends AST_Node {
493
    constructor(props?: object);
494
    segments: AST_Node[];
495
}
496

    
497
declare class AST_TemplateSegment extends AST_Node {
498
    constructor(props?: object);
499
    value: string;
500
    raw: string;
501
}
502

    
503
declare class AST_NameMapping extends AST_Node {
504
    constructor(props?: object);
505
    foreign_name: AST_Symbol;
506
    name: AST_SymbolExport | AST_SymbolImport;
507
}
508

    
509
declare class AST_Import extends AST_Node {
510
    constructor(props?: object);
511
    imported_name: null | AST_SymbolImport;
512
    imported_names: AST_NameMapping[];
513
    module_name: AST_String;
514
}
515

    
516
declare class AST_VarDef extends AST_Node {
517
    constructor(props?: object);
518
    name: AST_Destructuring | AST_SymbolConst | AST_SymbolLet | AST_SymbolVar;
519
    value: AST_Node | null;
520
}
521

    
522
declare class AST_Call extends AST_Node {
523
    constructor(props?: object);
524
    expression: AST_Node;
525
    args: AST_Node[];
526
}
527

    
528
declare class AST_New extends AST_Call {
529
    constructor(props?: object);
530
}
531

    
532
declare class AST_Sequence extends AST_Node {
533
    constructor(props?: object);
534
    expressions: AST_Node[];
535
}
536

    
537
declare class AST_PropAccess extends AST_Node {
538
    constructor(props?: object);
539
    expression: AST_Node;
540
    property: AST_Node | string;
541
}
542

    
543
declare class AST_Dot extends AST_PropAccess {
544
    constructor(props?: object);
545
}
546

    
547
declare class AST_Sub extends AST_PropAccess {
548
    constructor(props?: object);
549
}
550

    
551
declare class AST_Unary extends AST_Node {
552
    constructor(props?: object);
553
    operator: string;
554
    expression: AST_Node;
555
}
556

    
557
declare class AST_UnaryPrefix extends AST_Unary {
558
    constructor(props?: object);
559
}
560

    
561
declare class AST_UnaryPostfix extends AST_Unary {
562
    constructor(props?: object);
563
}
564

    
565
declare class AST_Binary extends AST_Node {
566
    constructor(props?: object);
567
    operator: string;
568
    left: AST_Node;
569
    right: AST_Node;
570
}
571

    
572
declare class AST_Assign extends AST_Binary {
573
    constructor(props?: object);
574
}
575

    
576
declare class AST_DefaultAssign extends AST_Binary {
577
    constructor(props?: object);
578
}
579

    
580
declare class AST_Conditional extends AST_Node {
581
    constructor(props?: object);
582
    condition: AST_Node;
583
    consequent: AST_Node;
584
    alternative: AST_Node;
585
}
586

    
587
declare class AST_Array extends AST_Node {
588
    constructor(props?: object);
589
    elements: AST_Node[];
590
}
591

    
592
declare class AST_Object extends AST_Node {
593
    constructor(props?: object);
594
    properties: AST_ObjectProperty[];
595
}
596

    
597
declare class AST_ObjectProperty extends AST_Node {
598
    constructor(props?: object);
599
    key: string | number | AST_Node;
600
    value: AST_Node;
601
}
602

    
603
declare class AST_ObjectKeyVal extends AST_ObjectProperty {
604
    constructor(props?: object);
605
    quote: string;
606
}
607

    
608
declare class AST_ObjectSetter extends AST_ObjectProperty {
609
    constructor(props?: object);
610
    quote: string;
611
    static: boolean;
612
}
613

    
614
declare class AST_ObjectGetter extends AST_ObjectProperty {
615
    constructor(props?: object);
616
    quote: string;
617
    static: boolean;
618
}
619

    
620
declare class AST_ConciseMethod extends AST_ObjectProperty {
621
    constructor(props?: object);
622
    quote: string;
623
    static: boolean;
624
    is_generator: boolean;
625
    async: boolean;
626
}
627

    
628
declare class AST_Symbol extends AST_Node {
629
    constructor(props?: object);
630
    scope: AST_Scope;
631
    name: string;
632
    thedef: SymbolDef;
633
}
634

    
635
declare class AST_SymbolDeclaration extends AST_Symbol {
636
    constructor(props?: object);
637
    init: AST_Node | null;
638
}
639

    
640
declare class AST_SymbolVar extends AST_SymbolDeclaration {
641
    constructor(props?: object);
642
}
643

    
644
declare class AST_SymbolFunarg extends AST_SymbolVar {
645
    constructor(props?: object);
646
}
647

    
648
declare class AST_SymbolBlockDeclaration extends AST_SymbolDeclaration {
649
    constructor(props?: object);
650
}
651

    
652
declare class AST_SymbolConst extends AST_SymbolBlockDeclaration {
653
    constructor(props?: object);
654
}
655

    
656
declare class AST_SymbolLet extends AST_SymbolBlockDeclaration {
657
    constructor(props?: object);
658
}
659

    
660
declare class AST_SymbolDefClass extends AST_SymbolBlockDeclaration {
661
    constructor(props?: object);
662
}
663

    
664
declare class AST_SymbolCatch extends AST_SymbolBlockDeclaration {
665
    constructor(props?: object);
666
}
667

    
668
declare class AST_SymbolImport extends AST_SymbolBlockDeclaration {
669
    constructor(props?: object);
670
}
671

    
672
declare class AST_SymbolDefun extends AST_SymbolDeclaration {
673
    constructor(props?: object);
674
}
675

    
676
declare class AST_SymbolLambda extends AST_SymbolDeclaration {
677
    constructor(props?: object);
678
}
679

    
680
declare class AST_SymbolClass extends AST_SymbolDeclaration {
681
    constructor(props?: object);
682
}
683

    
684
declare class AST_SymbolMethod extends AST_Symbol {
685
    constructor(props?: object);
686
}
687

    
688
declare class AST_SymbolImportForeign extends AST_Symbol {
689
    constructor(props?: object);
690
}
691

    
692
declare class AST_Label extends AST_Symbol {
693
    constructor(props?: object);
694
    references: AST_LoopControl | null;
695
}
696

    
697
declare class AST_SymbolRef extends AST_Symbol {
698
    constructor(props?: object);
699
}
700

    
701
declare class AST_SymbolExport extends AST_SymbolRef {
702
    constructor(props?: object);
703
}
704

    
705
declare class AST_SymbolExportForeign extends AST_Symbol {
706
    constructor(props?: object);
707
}
708

    
709
declare class AST_LabelRef extends AST_Symbol {
710
    constructor(props?: object);
711
}
712

    
713
declare class AST_This extends AST_Symbol {
714
    constructor(props?: object);
715
}
716

    
717
declare class AST_Super extends AST_This {
718
    constructor(props?: object);
719
}
720

    
721
declare class AST_NewTarget extends AST_Node {
722
    constructor(props?: object);
723
}
724

    
725
declare class AST_Constant extends AST_Node {
726
    constructor(props?: object);
727
}
728

    
729
declare class AST_String extends AST_Constant {
730
    constructor(props?: object);
731
    value: string;
732
    quote: string;
733
}
734

    
735
declare class AST_Number extends AST_Constant {
736
    constructor(props?: object);
737
    value: number;
738
    literal: string;
739
}
740

    
741
declare class AST_RegExp extends AST_Constant {
742
    constructor(props?: object);
743
    value: {
744
        source: string,
745
        flags: string
746
    };
747
}
748

    
749
declare class AST_Atom extends AST_Constant {
750
    constructor(props?: object);
751
}
752

    
753
declare class AST_Null extends AST_Atom {
754
    constructor(props?: object);
755
}
756

    
757
declare class AST_NaN extends AST_Atom {
758
    constructor(props?: object);
759
}
760

    
761
declare class AST_Undefined extends AST_Atom {
762
    constructor(props?: object);
763
}
764

    
765
declare class AST_Hole extends AST_Atom {
766
    constructor(props?: object);
767
}
768

    
769
declare class AST_Infinity extends AST_Atom {
770
    constructor(props?: object);
771
}
772

    
773
declare class AST_Boolean extends AST_Atom {
774
    constructor(props?: object);
775
}
776

    
777
declare class AST_False extends AST_Boolean {
778
    constructor(props?: object);
779
}
780

    
781
declare class AST_True extends AST_Boolean {
782
    constructor(props?: object);
783
}
784

    
785
declare class AST_Await extends AST_Node {
786
    constructor(props?: object);
787
    expression: AST_Node;
788
}
789

    
790
declare class AST_Yield extends AST_Node {
791
    constructor(props?: object);
792
    expression: AST_Node;
793
    is_star: boolean;
794
}
(7-7/7)