1 | import { result } from './utils';
|
2 | import type { InMemoryFileSystem } from '../compiler/sys/in-memory-fs';
|
3 | import type { BuildEvents, BuildLog, BuildResultsComponentGraph, CompilerBuildResults, CompilerFsStats, CompilerRequestResponse, CompilerSystem, Config, CopyResults, DevServerConfig, DevServerEditor, Diagnostic, Logger, LoggerLineUpdater, LoggerTimeSpan, OptimizeCssInput, OptimizeCssOutput, OutputTarget, OutputTargetWww, PageReloadStrategy, PrerenderConfig, StyleDoc, TaskCommand } from './stencil-public-compiler';
|
4 | import type { ComponentInterface, ListenTargetOptions, VNode } from './stencil-public-runtime';
|
5 | export interface SourceMap {
|
6 | file: string;
|
7 | mappings: string;
|
8 | names: string[];
|
9 | sourceRoot?: string;
|
10 | sources: string[];
|
11 | sourcesContent?: string[];
|
12 | version: number;
|
13 | }
|
14 | export interface PrintLine {
|
15 | lineIndex: number;
|
16 | lineNumber: number;
|
17 | text?: string;
|
18 | errorCharStart: number;
|
19 | errorLength?: number;
|
20 | }
|
21 | export interface AssetsMeta {
|
22 | absolutePath: string;
|
23 | cmpRelativePath: string;
|
24 | originalComponentPath: string;
|
25 | }
|
26 | export interface ParsedImport {
|
27 | importPath: string;
|
28 | basename: string;
|
29 | ext: string;
|
30 | data: ImportData;
|
31 | }
|
32 | export interface ImportData {
|
33 | tag?: string;
|
34 | encapsulation?: string;
|
35 | mode?: string;
|
36 | }
|
37 | export interface SerializeImportData extends ImportData {
|
38 | importeePath: string;
|
39 | importerPath?: string;
|
40 | }
|
41 | export interface BuildFeatures {
|
42 | style: boolean;
|
43 | mode: boolean;
|
44 | shadowDom: boolean;
|
45 | shadowDelegatesFocus: boolean;
|
46 | scoped: boolean;
|
47 | |
48 |
|
49 |
|
50 | allRenderFn: boolean;
|
51 | |
52 |
|
53 |
|
54 | hasRenderFn: boolean;
|
55 | vdomRender: boolean;
|
56 | vdomAttribute: boolean;
|
57 | vdomClass: boolean;
|
58 | vdomFunctional: boolean;
|
59 | vdomKey: boolean;
|
60 | vdomListener: boolean;
|
61 | vdomPropOrAttr: boolean;
|
62 | vdomRef: boolean;
|
63 | vdomStyle: boolean;
|
64 | vdomText: boolean;
|
65 | vdomXlink: boolean;
|
66 | slotRelocation: boolean;
|
67 | slot: boolean;
|
68 | svg: boolean;
|
69 | element: boolean;
|
70 | event: boolean;
|
71 | hostListener: boolean;
|
72 | hostListenerTargetWindow: boolean;
|
73 | hostListenerTargetDocument: boolean;
|
74 | hostListenerTargetBody: boolean;
|
75 | |
76 |
|
77 |
|
78 | hostListenerTargetParent: boolean;
|
79 | hostListenerTarget: boolean;
|
80 | method: boolean;
|
81 | prop: boolean;
|
82 | propMutable: boolean;
|
83 | state: boolean;
|
84 | watchCallback: boolean;
|
85 | member: boolean;
|
86 | updatable: boolean;
|
87 | propBoolean: boolean;
|
88 | propNumber: boolean;
|
89 | propString: boolean;
|
90 | lifecycle: boolean;
|
91 | cmpDidLoad: boolean;
|
92 | cmpShouldUpdate: boolean;
|
93 | cmpWillLoad: boolean;
|
94 | cmpDidUpdate: boolean;
|
95 | cmpWillUpdate: boolean;
|
96 | cmpWillRender: boolean;
|
97 | cmpDidRender: boolean;
|
98 | cmpDidUnload: boolean;
|
99 | connectedCallback: boolean;
|
100 | disconnectedCallback: boolean;
|
101 | asyncLoading: boolean;
|
102 | observeAttribute: boolean;
|
103 | reflect: boolean;
|
104 | taskQueue: boolean;
|
105 | }
|
106 | export interface BuildConditionals extends Partial<BuildFeatures> {
|
107 | hotModuleReplacement?: boolean;
|
108 | isDebug?: boolean;
|
109 | isTesting?: boolean;
|
110 | isDev?: boolean;
|
111 | devTools?: boolean;
|
112 | invisiblePrehydration?: boolean;
|
113 | hydrateServerSide?: boolean;
|
114 | hydrateClientSide?: boolean;
|
115 | lifecycleDOMEvents?: boolean;
|
116 | cssAnnotations?: boolean;
|
117 | lazyLoad?: boolean;
|
118 | profile?: boolean;
|
119 | constructableCSS?: boolean;
|
120 | appendChildSlotFix?: boolean;
|
121 | slotChildNodesFix?: boolean;
|
122 | scopedSlotTextContentFix?: boolean;
|
123 | cloneNodeFix?: boolean;
|
124 | hydratedAttribute?: boolean;
|
125 | hydratedClass?: boolean;
|
126 | initializeNextTick?: boolean;
|
127 | scriptDataOpts?: boolean;
|
128 | shadowDomShim?: boolean;
|
129 | asyncQueue?: boolean;
|
130 | transformTagName?: boolean;
|
131 | attachStyles?: boolean;
|
132 | patchPseudoShadowDom?: boolean;
|
133 | }
|
134 | export type ModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd' | 'commonjs' | 'esm' | 'module' | 'systemjs';
|
135 | export interface RollupResultModule {
|
136 | id: string;
|
137 | }
|
138 | export interface RollupResults {
|
139 | modules: RollupResultModule[];
|
140 | }
|
141 | export interface UpdatedLazyBuildCtx {
|
142 | name: 'esm-browser' | 'esm' | 'cjs' | 'system';
|
143 | buildCtx: BuildCtx;
|
144 | }
|
145 | export interface BuildCtx {
|
146 | buildId: number;
|
147 | buildResults: CompilerBuildResults;
|
148 | buildStats?: result.Result<CompilerBuildStats, {
|
149 | diagnostics: Diagnostic[];
|
150 | }>;
|
151 | buildMessages: string[];
|
152 | bundleBuildCount: number;
|
153 | collections: Collection[];
|
154 | compilerCtx: CompilerCtx;
|
155 | esmBrowserComponentBundle: ReadonlyArray<BundleModule>;
|
156 | esmComponentBundle: ReadonlyArray<BundleModule>;
|
157 | es5ComponentBundle: ReadonlyArray<BundleModule>;
|
158 | systemComponentBundle: ReadonlyArray<BundleModule>;
|
159 | commonJsComponentBundle: ReadonlyArray<BundleModule>;
|
160 | components: ComponentCompilerMeta[];
|
161 | componentGraph: Map<string, string[]>;
|
162 | config: Config;
|
163 | createTimeSpan(msg: string, debug?: boolean): LoggerTimeSpan;
|
164 | data: any;
|
165 | debug: (msg: string) => void;
|
166 | diagnostics: Diagnostic[];
|
167 | dirsAdded: string[];
|
168 | dirsDeleted: string[];
|
169 | entryModules: EntryModule[];
|
170 | filesAdded: string[];
|
171 | filesChanged: string[];
|
172 | filesDeleted: string[];
|
173 | filesUpdated: string[];
|
174 | filesWritten: string[];
|
175 | globalStyle: string | undefined;
|
176 | hasConfigChanges: boolean;
|
177 | hasError: boolean;
|
178 | hasFinished: boolean;
|
179 | hasHtmlChanges: boolean;
|
180 | hasPrintedResults: boolean;
|
181 | hasServiceWorkerChanges: boolean;
|
182 | hasScriptChanges: boolean;
|
183 | hasStyleChanges: boolean;
|
184 | hasWarning: boolean;
|
185 | hydrateAppFilePath: string;
|
186 | indexBuildCount: number;
|
187 | indexDoc: Document;
|
188 | isRebuild: boolean;
|
189 | |
190 |
|
191 |
|
192 | moduleFiles: Module[];
|
193 | packageJson: PackageJsonData;
|
194 | pendingCopyTasks: Promise<CopyResults>[];
|
195 | progress(task: BuildTask): void;
|
196 | requiresFullBuild: boolean;
|
197 | rollupResults?: RollupResults;
|
198 | scriptsAdded: string[];
|
199 | scriptsDeleted: string[];
|
200 | startTime: number;
|
201 | styleBuildCount: number;
|
202 | stylesPromise: Promise<void>;
|
203 | stylesUpdated: BuildStyleUpdate[];
|
204 | timeSpan: LoggerTimeSpan;
|
205 | timestamp: string;
|
206 | transpileBuildCount: number;
|
207 | validateTypesBuild?(): Promise<void>;
|
208 | validateTypesHandler?: (results: any) => Promise<void>;
|
209 | validateTypesPromise?: Promise<any>;
|
210 | }
|
211 | export interface BuildStyleUpdate {
|
212 | styleTag: string;
|
213 | styleText: string;
|
214 | styleMode: string;
|
215 | }
|
216 | export type BuildTask = any;
|
217 | export interface CompilerBuildStats {
|
218 | timestamp: string;
|
219 | compiler: {
|
220 | name: string;
|
221 | version: string;
|
222 | };
|
223 | app: {
|
224 | namespace: string;
|
225 | fsNamespace: string;
|
226 | components: number;
|
227 | entries: number;
|
228 | bundles: number;
|
229 | outputs: any;
|
230 | };
|
231 | options: {
|
232 | minifyJs: boolean;
|
233 | minifyCss: boolean;
|
234 | hashFileNames: boolean;
|
235 | hashedFileNameLength: number;
|
236 | buildEs5: boolean | 'prod';
|
237 | };
|
238 | formats: {
|
239 | esmBrowser: ReadonlyArray<CompilerBuildStatBundle>;
|
240 | esm: ReadonlyArray<CompilerBuildStatBundle>;
|
241 | es5: ReadonlyArray<CompilerBuildStatBundle>;
|
242 | system: ReadonlyArray<CompilerBuildStatBundle>;
|
243 | commonjs: ReadonlyArray<CompilerBuildStatBundle>;
|
244 | };
|
245 | components: BuildComponent[];
|
246 | entries: EntryModule[];
|
247 | rollupResults: RollupResults;
|
248 | sourceGraph?: BuildSourceGraph;
|
249 | componentGraph: BuildResultsComponentGraph;
|
250 | collections: {
|
251 | name: string;
|
252 | source: string;
|
253 | tags: string[];
|
254 | }[];
|
255 | }
|
256 | export interface CompilerBuildStatBundle {
|
257 | key: string;
|
258 | components: string[];
|
259 | bundleId: string;
|
260 | fileName: string;
|
261 | imports: string[];
|
262 | originalByteSize: number;
|
263 | }
|
264 | export interface BuildSourceGraph {
|
265 | [filePath: string]: string[];
|
266 | }
|
267 | export interface BuildComponent {
|
268 | tag: string;
|
269 | dependencyOf?: string[];
|
270 | dependencies?: string[];
|
271 | }
|
272 | export type SourceTarget = 'es5' | 'es2017' | 'latest';
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | export type RollupResult = RollupChunkResult | RollupAssetResult;
|
280 | export interface RollupAssetResult {
|
281 | type: 'asset';
|
282 | fileName: string;
|
283 | content: string;
|
284 | }
|
285 | export interface RollupChunkResult {
|
286 | type: 'chunk';
|
287 | entryKey: string;
|
288 | fileName: string;
|
289 | code: string;
|
290 | isEntry: boolean;
|
291 | isComponent: boolean;
|
292 | isCore: boolean;
|
293 | isIndex: boolean;
|
294 | isBrowserLoader: boolean;
|
295 | imports: string[];
|
296 | moduleFormat: ModuleFormat;
|
297 | map?: RollupSourceMap;
|
298 | }
|
299 | export interface RollupSourceMap {
|
300 | file: string;
|
301 | mappings: string;
|
302 | names: string[];
|
303 | sources: string[];
|
304 | sourcesContent: string[];
|
305 | version: number;
|
306 | toString(): string;
|
307 | toUrl(): string;
|
308 | }
|
309 |
|
310 |
|
311 |
|
312 | export type OptimizeJsResult = {
|
313 | output: string;
|
314 | diagnostics: Diagnostic[];
|
315 | sourceMap?: SourceMap;
|
316 | };
|
317 | export interface BundleModule {
|
318 | entryKey: string;
|
319 | rollupResult: RollupChunkResult;
|
320 | cmps: ComponentCompilerMeta[];
|
321 | output: BundleModuleOutput;
|
322 | }
|
323 | export interface BundleModuleOutput {
|
324 | bundleId: string;
|
325 | fileName: string;
|
326 | code: string;
|
327 | }
|
328 | export interface Cache {
|
329 | get(key: string): Promise<string | null>;
|
330 | put(key: string, value: string): Promise<boolean>;
|
331 | has(key: string): Promise<boolean>;
|
332 | createKey(domain: string, ...args: any[]): Promise<string>;
|
333 | commit(): Promise<void>;
|
334 | clear(): void;
|
335 | clearDiskCache(): Promise<void>;
|
336 | getMemoryStats(): string;
|
337 | initCacheDir(): Promise<void>;
|
338 | }
|
339 | export interface CollectionCompilerMeta {
|
340 | collectionName?: string;
|
341 | moduleId?: string;
|
342 | moduleDir?: string;
|
343 | moduleFiles?: Module[];
|
344 | global?: Module;
|
345 | compiler?: CollectionCompilerVersion;
|
346 | isInitialized?: boolean;
|
347 | hasExports?: boolean;
|
348 | dependencies?: string[];
|
349 | bundles?: {
|
350 | components: string[];
|
351 | }[];
|
352 | }
|
353 | export interface CollectionCompilerVersion {
|
354 | name: string;
|
355 | version: string;
|
356 | typescriptVersion?: string;
|
357 | }
|
358 | export interface CollectionManifest {
|
359 | entries?: CollectionComponentEntryPath[];
|
360 | collections?: CollectionDependencyManifest[];
|
361 | global?: string;
|
362 | compiler?: CollectionCompilerVersion;
|
363 | bundles?: CollectionBundleManifest[];
|
364 | }
|
365 | export type CollectionComponentEntryPath = string;
|
366 | export interface CollectionBundleManifest {
|
367 | components: string[];
|
368 | }
|
369 | export interface CollectionDependencyManifest {
|
370 | name: string;
|
371 | tags: string[];
|
372 | }
|
373 |
|
374 | export interface Collection {
|
375 | collectionName?: string;
|
376 | moduleDir?: string;
|
377 | moduleFiles?: any[];
|
378 | global?: any;
|
379 | compiler?: CollectionCompiler;
|
380 | isInitialized?: boolean;
|
381 | hasExports?: boolean;
|
382 | dependencies?: string[];
|
383 | bundles?: {
|
384 | components: string[];
|
385 | }[];
|
386 | }
|
387 | export interface CollectionCompiler {
|
388 | name: string;
|
389 | version: string;
|
390 | typescriptVersion?: string;
|
391 | }
|
392 | export interface CollectionDependencyData {
|
393 | name: string;
|
394 | tags: string[];
|
395 | }
|
396 | export interface CompilerCtx {
|
397 | version: number;
|
398 | activeBuildId: number;
|
399 | activeDirsAdded: string[];
|
400 | activeDirsDeleted: string[];
|
401 | activeFilesAdded: string[];
|
402 | activeFilesDeleted: string[];
|
403 | activeFilesUpdated: string[];
|
404 | addWatchDir: (path: string, recursive: boolean) => void;
|
405 | addWatchFile: (path: string) => void;
|
406 | cache: Cache;
|
407 | cssModuleImports: Map<string, string[]>;
|
408 | cachedGlobalStyle: string;
|
409 | collections: CollectionCompilerMeta[];
|
410 | compilerOptions: any;
|
411 | events: BuildEvents;
|
412 | fs: InMemoryFileSystem;
|
413 | hasSuccessfulBuild: boolean;
|
414 | isActivelyBuilding: boolean;
|
415 | lastBuildResults: CompilerBuildResults;
|
416 | |
417 |
|
418 |
|
419 | moduleMap: ModuleMap;
|
420 | nodeMap: NodeMap;
|
421 | resolvedCollections: Set<string>;
|
422 | rollupCacheHydrate: any;
|
423 | rollupCacheLazy: any;
|
424 | rollupCacheNative: any;
|
425 | styleModeNames: Set<string>;
|
426 | changedModules: Set<string>;
|
427 | changedFiles: Set<string>;
|
428 | worker?: CompilerWorkerContext;
|
429 | rollupCache: Map<string, any>;
|
430 | reset(): void;
|
431 | }
|
432 | export type NodeMap = WeakMap<any, ComponentCompilerMeta>;
|
433 |
|
434 | export interface ComponentCompilerFeatures {
|
435 | hasAttribute: boolean;
|
436 | hasAttributeChangedCallbackFn: boolean;
|
437 | hasComponentWillLoadFn: boolean;
|
438 | hasComponentDidLoadFn: boolean;
|
439 | hasComponentShouldUpdateFn: boolean;
|
440 | hasComponentWillUpdateFn: boolean;
|
441 | hasComponentDidUpdateFn: boolean;
|
442 | hasComponentWillRenderFn: boolean;
|
443 | hasComponentDidRenderFn: boolean;
|
444 | hasComponentDidUnloadFn: boolean;
|
445 | hasConnectedCallbackFn: boolean;
|
446 | hasDisconnectedCallbackFn: boolean;
|
447 | hasElement: boolean;
|
448 | hasEvent: boolean;
|
449 | hasLifecycle: boolean;
|
450 | hasListener: boolean;
|
451 | hasListenerTarget: boolean;
|
452 | hasListenerTargetWindow: boolean;
|
453 | hasListenerTargetDocument: boolean;
|
454 | hasListenerTargetBody: boolean;
|
455 | |
456 |
|
457 |
|
458 | hasListenerTargetParent: boolean;
|
459 | hasMember: boolean;
|
460 | hasMethod: boolean;
|
461 | hasMode: boolean;
|
462 | hasProp: boolean;
|
463 | hasPropBoolean: boolean;
|
464 | hasPropNumber: boolean;
|
465 | hasPropString: boolean;
|
466 | hasPropMutable: boolean;
|
467 | hasReflect: boolean;
|
468 | hasRenderFn: boolean;
|
469 | hasState: boolean;
|
470 | hasStyle: boolean;
|
471 | hasVdomAttribute: boolean;
|
472 | hasVdomClass: boolean;
|
473 | hasVdomFunctional: boolean;
|
474 | hasVdomKey: boolean;
|
475 | hasVdomListener: boolean;
|
476 | hasVdomPropOrAttr: boolean;
|
477 | hasVdomRef: boolean;
|
478 | hasVdomRender: boolean;
|
479 | hasVdomStyle: boolean;
|
480 | hasVdomText: boolean;
|
481 | hasVdomXlink: boolean;
|
482 | hasWatchCallback: boolean;
|
483 | htmlAttrNames: string[];
|
484 | htmlTagNames: string[];
|
485 | htmlParts: string[];
|
486 | isUpdateable: boolean;
|
487 | |
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 | isPlain: boolean;
|
495 | |
496 |
|
497 |
|
498 | potentialCmpRefs: string[];
|
499 | }
|
500 |
|
501 | export interface ComponentCompilerMeta extends ComponentCompilerFeatures {
|
502 | assetsDirs: CompilerAssetDir[];
|
503 | componentClassName: string;
|
504 | elementRef: string;
|
505 | encapsulation: Encapsulation;
|
506 | shadowDelegatesFocus: boolean;
|
507 | excludeFromCollection: boolean;
|
508 | isCollectionDependency: boolean;
|
509 | docs: CompilerJsDoc;
|
510 | jsFilePath: string;
|
511 | sourceMapPath: string;
|
512 | listeners: ComponentCompilerListener[];
|
513 | events: ComponentCompilerEvent[];
|
514 | methods: ComponentCompilerMethod[];
|
515 | virtualProperties: ComponentCompilerVirtualProperty[];
|
516 | properties: ComponentCompilerProperty[];
|
517 | watchers: ComponentCompilerWatch[];
|
518 | sourceFilePath: string;
|
519 | states: ComponentCompilerState[];
|
520 | styleDocs: CompilerStyleDoc[];
|
521 | styles: StyleCompiler[];
|
522 | tagName: string;
|
523 | internal: boolean;
|
524 | |
525 |
|
526 |
|
527 |
|
528 |
|
529 | dependencies?: string[];
|
530 | |
531 |
|
532 |
|
533 |
|
534 |
|
535 | dependents?: string[];
|
536 | |
537 |
|
538 |
|
539 | directDependencies?: string[];
|
540 | |
541 |
|
542 |
|
543 | directDependents?: string[];
|
544 | }
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 | export type Encapsulation = 'shadow' | 'scoped' | 'none';
|
552 |
|
553 |
|
554 |
|
555 | export interface ComponentCompilerStaticProperty {
|
556 | mutable: boolean;
|
557 | optional: boolean;
|
558 | required: boolean;
|
559 | type: ComponentCompilerPropertyType;
|
560 | complexType: ComponentCompilerPropertyComplexType;
|
561 | attribute?: string;
|
562 | reflect?: boolean;
|
563 | docs: CompilerJsDoc;
|
564 | defaultValue?: string;
|
565 | }
|
566 |
|
567 |
|
568 |
|
569 | export interface ComponentCompilerProperty extends ComponentCompilerStaticProperty {
|
570 | name: string;
|
571 | internal: boolean;
|
572 | }
|
573 | export interface ComponentCompilerVirtualProperty {
|
574 | name: string;
|
575 | type: string;
|
576 | docs: string;
|
577 | }
|
578 | export type ComponentCompilerPropertyType = 'any' | 'string' | 'boolean' | 'number' | 'unknown';
|
579 |
|
580 |
|
581 |
|
582 |
|
583 | export interface ComponentCompilerPropertyComplexType {
|
584 | |
585 |
|
586 |
|
587 | original: string;
|
588 | |
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 | resolved: string;
|
595 | |
596 |
|
597 |
|
598 |
|
599 | references: ComponentCompilerTypeReferences;
|
600 | }
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 | export type ComponentCompilerTypeReferences = Record<string, ComponentCompilerTypeReference>;
|
610 |
|
611 |
|
612 |
|
613 | export interface ComponentCompilerTypeReference {
|
614 | |
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 | location: 'local' | 'global' | 'import';
|
621 | |
622 |
|
623 |
|
624 | path?: string;
|
625 | |
626 |
|
627 |
|
628 | id: string;
|
629 | }
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 | export interface ComponentCompilerReferencedType {
|
636 | |
637 |
|
638 |
|
639 | path: string;
|
640 | |
641 |
|
642 |
|
643 | declaration: string;
|
644 | |
645 |
|
646 |
|
647 | docstring: string;
|
648 | }
|
649 | export interface ComponentCompilerStaticEvent {
|
650 | name: string;
|
651 | method: string;
|
652 | bubbles: boolean;
|
653 | cancelable: boolean;
|
654 | composed: boolean;
|
655 | docs: CompilerJsDoc;
|
656 | complexType: ComponentCompilerEventComplexType;
|
657 | }
|
658 | export interface ComponentCompilerEvent extends ComponentCompilerStaticEvent {
|
659 | internal: boolean;
|
660 | }
|
661 | export interface ComponentCompilerEventComplexType {
|
662 | original: string;
|
663 | resolved: string;
|
664 | references: ComponentCompilerTypeReferences;
|
665 | }
|
666 | export interface ComponentCompilerListener {
|
667 | name: string;
|
668 | method: string;
|
669 | capture: boolean;
|
670 | passive: boolean;
|
671 | target: ListenTargetOptions | undefined;
|
672 | }
|
673 | export interface ComponentCompilerStaticMethod {
|
674 | docs: CompilerJsDoc;
|
675 | complexType: ComponentCompilerMethodComplexType;
|
676 | }
|
677 | export interface ComponentCompilerMethodComplexType {
|
678 | signature: string;
|
679 | parameters: CompilerJsDoc[];
|
680 | references: ComponentCompilerTypeReferences;
|
681 | return: string;
|
682 | }
|
683 | export interface ComponentCompilerWatch {
|
684 | propName: string;
|
685 | methodName: string;
|
686 | }
|
687 | export interface ComponentCompilerMethod extends ComponentCompilerStaticMethod {
|
688 | name: string;
|
689 | internal: boolean;
|
690 | }
|
691 | export interface ComponentCompilerState {
|
692 | name: string;
|
693 | }
|
694 |
|
695 |
|
696 |
|
697 | export interface CompilerJsDoc {
|
698 | |
699 |
|
700 |
|
701 | text: string;
|
702 | |
703 |
|
704 |
|
705 | tags: CompilerJsDocTagInfo[];
|
706 | }
|
707 |
|
708 |
|
709 |
|
710 | export interface CompilerJsDocTagInfo {
|
711 | |
712 |
|
713 |
|
714 | name: string;
|
715 | |
716 |
|
717 |
|
718 | text?: string;
|
719 | }
|
720 | export interface CompilerStyleDoc {
|
721 | name: string;
|
722 | docs: string;
|
723 | annotation: 'prop';
|
724 | }
|
725 | export interface CompilerAssetDir {
|
726 | absolutePath?: string;
|
727 | cmpRelativePath?: string;
|
728 | originalComponentPath?: string;
|
729 | }
|
730 | export interface ComponentCompilerData {
|
731 | exportLine: string;
|
732 | filePath: string;
|
733 | cmp: ComponentCompilerMeta;
|
734 | uniqueComponentClassName?: string;
|
735 | importLine?: string;
|
736 | }
|
737 | export interface ComponentConstructor {
|
738 | is?: string;
|
739 | properties?: ComponentConstructorProperties;
|
740 | watchers?: ComponentConstructorWatchers;
|
741 | events?: ComponentConstructorEvent[];
|
742 | listeners?: ComponentConstructorListener[];
|
743 | style?: string;
|
744 | styleId?: string;
|
745 | encapsulation?: ComponentConstructorEncapsulation;
|
746 | observedAttributes?: string[];
|
747 | cmpMeta?: ComponentRuntimeMeta;
|
748 | isProxied?: boolean;
|
749 | isStyleRegistered?: boolean;
|
750 | }
|
751 |
|
752 |
|
753 |
|
754 |
|
755 | export interface ComponentConstructorWatchers {
|
756 | [propName: string]: string[];
|
757 | }
|
758 | export interface ComponentTestingConstructor extends ComponentConstructor {
|
759 | COMPILER_META: ComponentCompilerMeta;
|
760 | prototype?: {
|
761 | componentWillLoad?: Function;
|
762 | componentWillUpdate?: Function;
|
763 | componentWillRender?: Function;
|
764 | __componentWillLoad?: Function | null;
|
765 | __componentWillUpdate?: Function | null;
|
766 | __componentWillRender?: Function | null;
|
767 | };
|
768 | }
|
769 | export interface ComponentNativeConstructor extends ComponentConstructor {
|
770 | cmpMeta: ComponentRuntimeMeta;
|
771 | }
|
772 | export type ComponentConstructorEncapsulation = 'shadow' | 'scoped' | 'none';
|
773 | export interface ComponentConstructorProperties {
|
774 | [propName: string]: ComponentConstructorProperty;
|
775 | }
|
776 | export interface ComponentConstructorProperty {
|
777 | attribute?: string;
|
778 | elementRef?: boolean;
|
779 | method?: boolean;
|
780 | mutable?: boolean;
|
781 | reflect?: boolean;
|
782 | state?: boolean;
|
783 | type?: ComponentConstructorPropertyType;
|
784 | watchCallbacks?: string[];
|
785 | }
|
786 | export type ComponentConstructorPropertyType = StringConstructor | BooleanConstructor | NumberConstructor | 'string' | 'boolean' | 'number';
|
787 | export interface ComponentConstructorEvent {
|
788 | name: string;
|
789 | method: string;
|
790 | bubbles: boolean;
|
791 | cancelable: boolean;
|
792 | composed: boolean;
|
793 | }
|
794 | export interface ComponentConstructorListener {
|
795 | name: string;
|
796 | method: string;
|
797 | capture?: boolean;
|
798 | passive?: boolean;
|
799 | }
|
800 | export interface DevClientWindow extends Window {
|
801 | ['s-dev-server']: boolean;
|
802 | ['s-initial-load']: boolean;
|
803 | ['s-build-id']: number;
|
804 | WebSocket: new (socketUrl: string, protos: string[]) => WebSocket;
|
805 | devServerConfig?: DevClientConfig;
|
806 | }
|
807 | export interface DevClientConfig {
|
808 | basePath: string;
|
809 | editors: DevServerEditor[];
|
810 | reloadStrategy: PageReloadStrategy;
|
811 | socketUrl?: string;
|
812 | }
|
813 | export interface HttpRequest {
|
814 | method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
815 | acceptHeader: string;
|
816 | url: URL;
|
817 | searchParams: URLSearchParams;
|
818 | pathname?: string;
|
819 | filePath?: string;
|
820 | stats?: CompilerFsStats;
|
821 | headers?: {
|
822 | [name: string]: string;
|
823 | };
|
824 | host?: string;
|
825 | }
|
826 | export interface DevServerMessage {
|
827 | startServer?: DevServerConfig;
|
828 | closeServer?: boolean;
|
829 | serverStarted?: DevServerConfig;
|
830 | serverClosed?: boolean;
|
831 | buildStart?: boolean;
|
832 | buildLog?: BuildLog;
|
833 | buildResults?: CompilerBuildResults;
|
834 | requestBuildResults?: boolean;
|
835 | error?: {
|
836 | message?: string;
|
837 | type?: string;
|
838 | stack?: any;
|
839 | };
|
840 | isActivelyBuilding?: boolean;
|
841 | compilerRequestPath?: string;
|
842 | compilerRequestResults?: CompilerRequestResponse;
|
843 | requestLog?: {
|
844 | method: string;
|
845 | url: string;
|
846 | status: number;
|
847 | };
|
848 | }
|
849 | export type DevServerSendMessage = (msg: DevServerMessage) => void;
|
850 | export interface DevServerContext {
|
851 | connectorHtml: string;
|
852 | dirTemplate: string;
|
853 | getBuildResults: () => Promise<CompilerBuildResults>;
|
854 | getCompilerRequest: (path: string) => Promise<CompilerRequestResponse>;
|
855 | isServerListening: boolean;
|
856 | logRequest: (req: HttpRequest, status: number) => void;
|
857 | prerenderConfig: PrerenderConfig;
|
858 | serve302: (req: any, res: any, pathname?: string) => void;
|
859 | serve404: (req: any, res: any, xSource: string, content?: string) => void;
|
860 | serve500: (req: any, res: any, error: any, xSource: string) => void;
|
861 | sys: CompilerSystem;
|
862 | }
|
863 | export type InitServerProcess = (sendMsg: (msg: DevServerMessage) => void) => (msg: DevServerMessage) => void;
|
864 | export interface DevResponseHeaders {
|
865 | 'cache-control'?: string;
|
866 | expires?: string;
|
867 | 'content-type'?: string;
|
868 | 'content-length'?: number;
|
869 | date?: string;
|
870 | 'access-control-allow-origin'?: string;
|
871 | 'access-control-expose-headers'?: string;
|
872 | 'content-encoding'?: 'gzip';
|
873 | vary?: 'Accept-Encoding';
|
874 | server?: string;
|
875 | 'x-directory-index'?: string;
|
876 | 'x-source'?: string;
|
877 | }
|
878 | export interface OpenInEditorData {
|
879 | file?: string;
|
880 | line?: number;
|
881 | column?: number;
|
882 | open?: string;
|
883 | editor?: string;
|
884 | exists?: boolean;
|
885 | error?: string;
|
886 | }
|
887 | export interface EntryModule {
|
888 | entryKey: string;
|
889 | cmps: ComponentCompilerMeta[];
|
890 | }
|
891 |
|
892 |
|
893 |
|
894 |
|
895 | export interface HostElement extends HTMLElement {
|
896 | connectedCallback?: () => void;
|
897 | attributeChangedCallback?: (attribName: string, oldVal: string, newVal: string, namespace: string) => void;
|
898 | disconnectedCallback?: () => void;
|
899 | host?: Element;
|
900 | forceUpdate?: () => void;
|
901 | |
902 |
|
903 |
|
904 | ['s-id']?: string;
|
905 | |
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 | ['s-cr']?: RenderNode;
|
912 | |
913 |
|
914 |
|
915 | ['s-lr']?: boolean;
|
916 | |
917 |
|
918 |
|
919 |
|
920 | ['s-rc']?: (() => void)[];
|
921 | /**
|
922 | * Scope Id
|
923 | * The scope id of this component when using scoped css encapsulation
|
924 | * or using shadow dom but the browser doesn't support it
|
925 | */
|
926 | ['s-sc']?: string;
|
927 | /**
|
928 | * Hot Module Replacement, dev mode only
|
929 | */
|
930 | ['s-hmr']?: (versionId: string) => void;
|
931 | |
932 |
|
933 |
|
934 | ['s-hmr-load']?: () => void;
|
935 | ['s-p']?: Promise<void>[];
|
936 | componentOnReady?: () => Promise<this>;
|
937 | }
|
938 | export interface HydrateResults {
|
939 | buildId: string;
|
940 | diagnostics: Diagnostic[];
|
941 | url: string;
|
942 | host: string;
|
943 | hostname: string;
|
944 | href: string;
|
945 | port: string;
|
946 | pathname: string;
|
947 | search: string;
|
948 | hash: string;
|
949 | html: string;
|
950 | components: HydrateComponent[];
|
951 | anchors: HydrateAnchorElement[];
|
952 | imgs: HydrateImgElement[];
|
953 | scripts: HydrateScriptElement[];
|
954 | styles: HydrateStyleElement[];
|
955 | staticData: HydrateStaticData[];
|
956 | title: string;
|
957 | hydratedCount: number;
|
958 | httpStatus: number;
|
959 | }
|
960 | export interface HydrateComponent {
|
961 | tag: string;
|
962 | mode: string;
|
963 | count: number;
|
964 | depth: number;
|
965 | }
|
966 | export interface HydrateElement {
|
967 | [attrName: string]: string | undefined;
|
968 | }
|
969 | export interface HydrateAnchorElement extends HydrateElement {
|
970 | href?: string;
|
971 | target?: string;
|
972 | }
|
973 | export interface HydrateImgElement extends HydrateElement {
|
974 | src?: string;
|
975 | }
|
976 | export interface HydrateScriptElement extends HydrateElement {
|
977 | src?: string;
|
978 | type?: string;
|
979 | }
|
980 | export interface HydrateStyleElement extends HydrateElement {
|
981 | href?: string;
|
982 | }
|
983 | export interface HydrateStaticData {
|
984 | id: string;
|
985 | type: string;
|
986 | content: string;
|
987 | }
|
988 | export interface JsDoc {
|
989 | name: string;
|
990 | documentation: string;
|
991 | type: string;
|
992 | tags: JSDocTagInfo[];
|
993 | default?: string;
|
994 | parameters?: JsDoc[];
|
995 | returns?: {
|
996 | type: string;
|
997 | documentation: string;
|
998 | };
|
999 | }
|
1000 | export interface JSDocTagInfo {
|
1001 | name: string;
|
1002 | text?: string;
|
1003 | }
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 | export type ModuleMap = Map<string, Module>;
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 | export interface Module {
|
1020 | cmps: ComponentCompilerMeta[];
|
1021 | |
1022 |
|
1023 |
|
1024 |
|
1025 | coreRuntimeApis: string[];
|
1026 | |
1027 |
|
1028 |
|
1029 |
|
1030 | outputTargetCoreRuntimeApis: Partial<Record<OutputTarget['type'], string[]>>;
|
1031 | collectionName: string;
|
1032 | dtsFilePath: string;
|
1033 | excludeFromCollection: boolean;
|
1034 | externalImports: string[];
|
1035 | htmlAttrNames: string[];
|
1036 | htmlTagNames: string[];
|
1037 | htmlParts: string[];
|
1038 | isCollectionDependency: boolean;
|
1039 | isLegacy: boolean;
|
1040 | jsFilePath: string;
|
1041 | localImports: string[];
|
1042 | originalImports: string[];
|
1043 | originalCollectionComponentPath: string;
|
1044 | potentialCmpRefs: string[];
|
1045 | sourceFilePath: string;
|
1046 | staticSourceFile: any;
|
1047 | staticSourceFileText: string;
|
1048 | sourceMapPath: string;
|
1049 | sourceMapFileText: string;
|
1050 | hasVdomAttribute: boolean;
|
1051 | hasVdomClass: boolean;
|
1052 | hasVdomFunctional: boolean;
|
1053 | hasVdomKey: boolean;
|
1054 | hasVdomListener: boolean;
|
1055 | hasVdomPropOrAttr: boolean;
|
1056 | hasVdomRef: boolean;
|
1057 | hasVdomRender: boolean;
|
1058 | hasVdomStyle: boolean;
|
1059 | hasVdomText: boolean;
|
1060 | hasVdomXlink: boolean;
|
1061 | }
|
1062 | export interface Plugin {
|
1063 | name?: string;
|
1064 | pluginType?: string;
|
1065 | load?: (id: string, context: PluginCtx) => Promise<string> | string;
|
1066 | resolveId?: (importee: string, importer: string, context: PluginCtx) => Promise<string> | string;
|
1067 | transform?: (sourceText: string, id: string, context: PluginCtx) => Promise<PluginTransformResults> | PluginTransformResults | string;
|
1068 | }
|
1069 | export interface PluginTransformResults {
|
1070 | code?: string;
|
1071 | map?: string;
|
1072 | id?: string;
|
1073 | diagnostics?: Diagnostic[];
|
1074 | dependencies?: string[];
|
1075 | }
|
1076 | export interface PluginCtx {
|
1077 | config: Config;
|
1078 | sys: CompilerSystem;
|
1079 | fs: InMemoryFileSystem;
|
1080 | cache: Cache;
|
1081 | diagnostics: Diagnostic[];
|
1082 | }
|
1083 | export interface PrerenderUrlResults {
|
1084 | anchorUrls: string[];
|
1085 | diagnostics: Diagnostic[];
|
1086 | filePath: string;
|
1087 | }
|
1088 | export interface PrerenderUrlRequest {
|
1089 | appDir: string;
|
1090 | buildId: string;
|
1091 | baseUrl: string;
|
1092 | componentGraphPath: string;
|
1093 | devServerHostUrl: string;
|
1094 | hydrateAppFilePath: string;
|
1095 | isDebug: boolean;
|
1096 | prerenderConfigPath: string;
|
1097 | staticSite: boolean;
|
1098 | templateId: string;
|
1099 | url: string;
|
1100 | writeToFilePath: string;
|
1101 | }
|
1102 | export interface PrerenderManager {
|
1103 | config: Config;
|
1104 | prerenderUrlWorker: (prerenderRequest: PrerenderUrlRequest) => Promise<PrerenderUrlResults>;
|
1105 | devServerHostUrl: string;
|
1106 | diagnostics: Diagnostic[];
|
1107 | hydrateAppFilePath: string;
|
1108 | isDebug: boolean;
|
1109 | logCount: number;
|
1110 | outputTarget: OutputTargetWww;
|
1111 | prerenderConfig: PrerenderConfig;
|
1112 | prerenderConfigPath: string;
|
1113 | progressLogger?: LoggerLineUpdater;
|
1114 | resolve: Function;
|
1115 | staticSite: boolean;
|
1116 | templateId: string;
|
1117 | componentGraphPath: string;
|
1118 | urlsProcessing: Set<string>;
|
1119 | urlsPending: Set<string>;
|
1120 | urlsCompleted: Set<string>;
|
1121 | maxConcurrency: number;
|
1122 | }
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 | export interface RenderNode extends HostElement {
|
1128 | |
1129 |
|
1130 |
|
1131 | host?: Element;
|
1132 | |
1133 |
|
1134 |
|
1135 |
|
1136 | ['s-cn']?: boolean;
|
1137 | |
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 | ['s-sr']?: boolean;
|
1143 | |
1144 |
|
1145 |
|
1146 | ['s-sn']?: string;
|
1147 | |
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 | ['s-hn']?: string;
|
1153 | |
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 | ['s-ol']?: RenderNode;
|
1160 | |
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 | ['s-nr']?: RenderNode;
|
1166 | |
1167 |
|
1168 |
|
1169 | ['s-si']?: string;
|
1170 | |
1171 |
|
1172 |
|
1173 | ['s-host-id']?: number;
|
1174 | |
1175 |
|
1176 |
|
1177 | ['s-node-id']?: number;
|
1178 | |
1179 |
|
1180 |
|
1181 |
|
1182 | ['s-en']?: '' | 'c';
|
1183 | }
|
1184 | export type LazyBundlesRuntimeData = LazyBundleRuntimeData[];
|
1185 | export type LazyBundleRuntimeData = [
|
1186 |
|
1187 | string,
|
1188 | ComponentRuntimeMetaCompact[]
|
1189 | ];
|
1190 | export type ComponentRuntimeMetaCompact = [
|
1191 |
|
1192 | number,
|
1193 |
|
1194 | string,
|
1195 |
|
1196 | {
|
1197 | [memberName: string]: ComponentRuntimeMember;
|
1198 | }?,
|
1199 |
|
1200 | ComponentRuntimeHostListener[]?,
|
1201 |
|
1202 | ComponentConstructorWatchers?
|
1203 | ];
|
1204 |
|
1205 |
|
1206 |
|
1207 | export interface ComponentRuntimeMeta {
|
1208 | |
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 | $flags$: number;
|
1214 | |
1215 |
|
1216 |
|
1217 |
|
1218 | $tagName$: string;
|
1219 | |
1220 |
|
1221 |
|
1222 |
|
1223 | $members$?: ComponentRuntimeMembers;
|
1224 | |
1225 |
|
1226 |
|
1227 | $listeners$?: ComponentRuntimeHostListener[];
|
1228 | |
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 | $attrsToReflect$?: ComponentRuntimeReflectingAttr[];
|
1234 | |
1235 |
|
1236 |
|
1237 | $watchers$?: ComponentConstructorWatchers;
|
1238 | |
1239 |
|
1240 |
|
1241 | $lazyBundleId$?: string;
|
1242 | }
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 | export interface ComponentRuntimeMembers {
|
1248 | [memberName: string]: ComponentRuntimeMember;
|
1249 | }
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 | export type ComponentRuntimeMember = [number, string?];
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 | export type ComponentRuntimeHostListener = [number, string, string];
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 | export type ComponentRuntimeReflectingAttr = [string, string | undefined];
|
1280 | export type RuntimeRef = HostElement | {};
|
1281 |
|
1282 |
|
1283 |
|
1284 | export interface HostRef {
|
1285 | $ancestorComponent$?: HostElement;
|
1286 | $flags$: number;
|
1287 | $cmpMeta$: ComponentRuntimeMeta;
|
1288 | $hostElement$: HostElement;
|
1289 | $instanceValues$?: Map<string, any>;
|
1290 | $lazyInstance$?: ComponentInterface;
|
1291 | $onReadyPromise$?: Promise<any>;
|
1292 | $onReadyResolve$?: (elm: any) => void;
|
1293 | $onInstancePromise$?: Promise<any>;
|
1294 | $onInstanceResolve$?: (elm: any) => void;
|
1295 | $onRenderResolve$?: () => void;
|
1296 | $vnode$?: VNode;
|
1297 | $queuedListeners$?: [string, any][];
|
1298 | $rmListeners$?: (() => void)[];
|
1299 | $modeName$?: string;
|
1300 | $renderCount$?: number;
|
1301 | }
|
1302 | export interface PlatformRuntime {
|
1303 | $flags$: number;
|
1304 | $orgLocNodes$?: Map<string, RenderNode>;
|
1305 | $resourcesUrl$: string;
|
1306 | /**
|
1307 | * The nonce value to be applied to all script/style tags at runtime.
|
1308 | * If `null`, the nonce attribute will not be applied.
|
1309 | */
|
1310 | $nonce$?: string | null;
|
1311 | jmp: (c: Function) => any;
|
1312 | raf: (c: FrameRequestCallback) => number;
|
1313 | |
1314 |
|
1315 |
|
1316 | ael: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
1317 | |
1318 |
|
1319 |
|
1320 | rel: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
1321 | ce: (eventName: string, opts?: any) => CustomEvent;
|
1322 | }
|
1323 | export type StyleMap = Map<string, CSSStyleSheet | string>;
|
1324 | export type RootAppliedStyleMap = WeakMap<Element, Set<string>>;
|
1325 | export interface ScreenshotConnector {
|
1326 | initBuild(opts: ScreenshotConnectorOptions): Promise<void>;
|
1327 | completeBuild(masterBuild: ScreenshotBuild): Promise<ScreenshotBuildResults>;
|
1328 | getMasterBuild(): Promise<ScreenshotBuild>;
|
1329 | pullMasterBuild(): Promise<void>;
|
1330 | publishBuild(buildResults: ScreenshotBuildResults): Promise<ScreenshotBuildResults>;
|
1331 | getScreenshotCache(): Promise<ScreenshotCache>;
|
1332 | updateScreenshotCache(screenshotCache: ScreenshotCache, buildResults: ScreenshotBuildResults): Promise<ScreenshotCache>;
|
1333 | generateJsonpDataUris(build: ScreenshotBuild): Promise<void>;
|
1334 | sortScreenshots(screenshots: Screenshot[]): Screenshot[];
|
1335 | toJson(masterBuild: ScreenshotBuild, screenshotCache: ScreenshotCache): string;
|
1336 | }
|
1337 | export interface ScreenshotBuildResults {
|
1338 | appNamespace: string;
|
1339 | masterBuild: ScreenshotBuild;
|
1340 | currentBuild: ScreenshotBuild;
|
1341 | compare: ScreenshotCompareResults;
|
1342 | }
|
1343 | export interface ScreenshotCompareResults {
|
1344 | id: string;
|
1345 | a: {
|
1346 | id: string;
|
1347 | message: string;
|
1348 | author: string;
|
1349 | url: string;
|
1350 | previewUrl: string;
|
1351 | };
|
1352 | b: {
|
1353 | id: string;
|
1354 | message: string;
|
1355 | author: string;
|
1356 | url: string;
|
1357 | previewUrl: string;
|
1358 | };
|
1359 | timestamp: number;
|
1360 | url: string;
|
1361 | appNamespace: string;
|
1362 | diffs: ScreenshotDiff[];
|
1363 | }
|
1364 | export interface ScreenshotConnectorOptions {
|
1365 | buildId: string;
|
1366 | buildMessage: string;
|
1367 | buildAuthor?: string;
|
1368 | buildUrl?: string;
|
1369 | previewUrl?: string;
|
1370 | appNamespace: string;
|
1371 | buildTimestamp: number;
|
1372 | logger: Logger;
|
1373 | rootDir: string;
|
1374 | cacheDir: string;
|
1375 | packageDir: string;
|
1376 | screenshotDirName?: string;
|
1377 | imagesDirName?: string;
|
1378 | buildsDirName?: string;
|
1379 | currentBuildDir?: string;
|
1380 | updateMaster?: boolean;
|
1381 | allowableMismatchedPixels?: number;
|
1382 | allowableMismatchedRatio?: number;
|
1383 | pixelmatchThreshold?: number;
|
1384 | waitBeforeScreenshot?: number;
|
1385 | pixelmatchModulePath?: string;
|
1386 | }
|
1387 | export interface ScreenshotBuildData {
|
1388 | buildId: string;
|
1389 | rootDir: string;
|
1390 | screenshotDir: string;
|
1391 | imagesDir: string;
|
1392 | buildsDir: string;
|
1393 | currentBuildDir: string;
|
1394 | updateMaster: boolean;
|
1395 | allowableMismatchedPixels: number;
|
1396 | allowableMismatchedRatio: number;
|
1397 | pixelmatchThreshold: number;
|
1398 | masterScreenshots: {
|
1399 | [screenshotId: string]: string;
|
1400 | };
|
1401 | cache: {
|
1402 | [cacheKey: string]: number;
|
1403 | };
|
1404 | timeoutBeforeScreenshot: number;
|
1405 | pixelmatchModulePath: string;
|
1406 | }
|
1407 | export interface PixelMatchInput {
|
1408 | imageAPath: string;
|
1409 | imageBPath: string;
|
1410 | width: number;
|
1411 | height: number;
|
1412 | pixelmatchThreshold: number;
|
1413 | }
|
1414 | export interface ScreenshotBuild {
|
1415 | id: string;
|
1416 | message: string;
|
1417 | author?: string;
|
1418 | url?: string;
|
1419 | previewUrl?: string;
|
1420 | appNamespace: string;
|
1421 | timestamp: number;
|
1422 | screenshots: Screenshot[];
|
1423 | }
|
1424 | export interface ScreenshotCache {
|
1425 | timestamp?: number;
|
1426 | lastBuildId?: string;
|
1427 | size?: number;
|
1428 | items?: {
|
1429 | |
1430 |
|
1431 |
|
1432 | key: string;
|
1433 | |
1434 |
|
1435 |
|
1436 | ts: number;
|
1437 | |
1438 |
|
1439 |
|
1440 | mp: number;
|
1441 | }[];
|
1442 | }
|
1443 | export interface Screenshot {
|
1444 | id: string;
|
1445 | desc?: string;
|
1446 | image: string;
|
1447 | device?: string;
|
1448 | userAgent?: string;
|
1449 | width: number;
|
1450 | height: number;
|
1451 | deviceScaleFactor?: number;
|
1452 | hasTouch?: boolean;
|
1453 | isLandscape?: boolean;
|
1454 | isMobile?: boolean;
|
1455 | testPath?: string;
|
1456 | diff?: ScreenshotDiff;
|
1457 | }
|
1458 | export interface ScreenshotDiff {
|
1459 | mismatchedPixels: number;
|
1460 | id: string;
|
1461 | desc?: string;
|
1462 | imageA?: string;
|
1463 | imageB?: string;
|
1464 | device?: string;
|
1465 | userAgent?: string;
|
1466 | width: number;
|
1467 | height: number;
|
1468 | deviceScaleFactor?: number;
|
1469 | hasTouch?: boolean;
|
1470 | isLandscape?: boolean;
|
1471 | isMobile?: boolean;
|
1472 | allowableMismatchedPixels: number;
|
1473 | allowableMismatchedRatio: number;
|
1474 | testPath?: string;
|
1475 | cacheKey?: string;
|
1476 | }
|
1477 | export interface ScreenshotOptions {
|
1478 | |
1479 |
|
1480 |
|
1481 |
|
1482 | fullPage?: boolean;
|
1483 | |
1484 |
|
1485 |
|
1486 | clip?: ScreenshotBoundingBox;
|
1487 | |
1488 |
|
1489 |
|
1490 |
|
1491 | omitBackground?: boolean;
|
1492 | |
1493 |
|
1494 |
|
1495 |
|
1496 | pixelmatchThreshold?: number;
|
1497 | }
|
1498 | export interface ScreenshotBoundingBox {
|
1499 | |
1500 |
|
1501 |
|
1502 | x: number;
|
1503 | |
1504 |
|
1505 |
|
1506 | y: number;
|
1507 | |
1508 |
|
1509 |
|
1510 | width: number;
|
1511 | |
1512 |
|
1513 |
|
1514 | height: number;
|
1515 | }
|
1516 | export interface StyleCompiler {
|
1517 | modeName: string;
|
1518 | styleId: string;
|
1519 | styleStr: string;
|
1520 | styleIdentifier: string;
|
1521 | externalStyles: ExternalStyleCompiler[];
|
1522 | }
|
1523 | export interface ExternalStyleCompiler {
|
1524 | absolutePath: string;
|
1525 | relativePath: string;
|
1526 | originalComponentPath: string;
|
1527 | }
|
1528 | export interface CompilerModeStyles {
|
1529 | [modeName: string]: string[];
|
1530 | }
|
1531 | export interface CssImportData {
|
1532 | srcImport: string;
|
1533 | updatedImport?: string;
|
1534 | url: string;
|
1535 | filePath: string;
|
1536 | altFilePath?: string;
|
1537 | styleText?: string | null;
|
1538 | }
|
1539 | export interface CssToEsmImportData {
|
1540 | srcImportText: string;
|
1541 | varName: string;
|
1542 | url: string;
|
1543 | filePath: string;
|
1544 | }
|
1545 |
|
1546 |
|
1547 |
|
1548 | export interface TransformCssToEsmInput {
|
1549 | input: string;
|
1550 | module?: 'cjs' | 'esm' | string;
|
1551 | file?: string;
|
1552 | tag?: string;
|
1553 | encapsulation?: string;
|
1554 | mode?: string;
|
1555 | commentOriginalSelector?: boolean;
|
1556 | sourceMap?: boolean;
|
1557 | minify?: boolean;
|
1558 | docs?: boolean;
|
1559 | autoprefixer?: any;
|
1560 | styleImportData?: string;
|
1561 | }
|
1562 | export interface TransformCssToEsmOutput {
|
1563 | styleText: string;
|
1564 | output: string;
|
1565 | map: any;
|
1566 | diagnostics: Diagnostic[];
|
1567 | defaultVarName: string;
|
1568 | styleDocs: StyleDoc[];
|
1569 | imports: {
|
1570 | varName: string;
|
1571 | importPath: string;
|
1572 | }[];
|
1573 | }
|
1574 | export interface PackageJsonData {
|
1575 | name?: string;
|
1576 | version?: string;
|
1577 | main?: string;
|
1578 | description?: string;
|
1579 | bin?: {
|
1580 | [key: string]: string;
|
1581 | };
|
1582 | browser?: string;
|
1583 | module?: string;
|
1584 | 'jsnext:main'?: string;
|
1585 | 'collection:main'?: string;
|
1586 | unpkg?: string;
|
1587 | collection?: string;
|
1588 | types?: string;
|
1589 | files?: string[];
|
1590 | ['dist-tags']?: {
|
1591 | latest: string;
|
1592 | };
|
1593 | dependencies?: {
|
1594 | [moduleId: string]: string;
|
1595 | };
|
1596 | devDependencies?: {
|
1597 | [moduleId: string]: string;
|
1598 | };
|
1599 | repository?: {
|
1600 | type?: string;
|
1601 | url?: string;
|
1602 | };
|
1603 | private?: boolean;
|
1604 | scripts?: {
|
1605 | [runName: string]: string;
|
1606 | };
|
1607 | license?: string;
|
1608 | keywords?: string[];
|
1609 | }
|
1610 | export interface Workbox {
|
1611 | generateSW(swConfig: any): Promise<any>;
|
1612 | generateFileManifest(): Promise<any>;
|
1613 | getFileManifestEntries(): Promise<any>;
|
1614 | injectManifest(swConfig: any): Promise<any>;
|
1615 | copyWorkboxLibraries(wwwDir: string): Promise<any>;
|
1616 | }
|
1617 | declare global {
|
1618 | namespace jest {
|
1619 | interface Matchers<R, T> {
|
1620 | |
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 | toEqualHtml(expectHtml: string): void;
|
1629 | |
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 | toEqualLightHtml(expectLightHtml: string): void;
|
1638 | |
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 | toEqualText(expectTextContent: string): void;
|
1644 | |
1645 |
|
1646 |
|
1647 |
|
1648 | toHaveAttribute(expectAttrName: string): void;
|
1649 | |
1650 |
|
1651 |
|
1652 | toEqualAttribute(expectAttrName: string, expectAttrValue: any): void;
|
1653 | |
1654 |
|
1655 |
|
1656 |
|
1657 | toEqualAttributes(expectAttrs: {
|
1658 | [attrName: string]: any;
|
1659 | }): void;
|
1660 | |
1661 |
|
1662 |
|
1663 | toHaveClass(expectClassName: string): void;
|
1664 | |
1665 |
|
1666 |
|
1667 |
|
1668 | toHaveClasses(expectClassNames: string[]): void;
|
1669 | |
1670 |
|
1671 |
|
1672 |
|
1673 | toMatchClasses(expectClassNames: string[]): void;
|
1674 | |
1675 |
|
1676 |
|
1677 |
|
1678 | toHaveReceivedEvent(): void;
|
1679 | |
1680 |
|
1681 |
|
1682 |
|
1683 | toHaveReceivedEventTimes(count: number): void;
|
1684 | |
1685 |
|
1686 |
|
1687 |
|
1688 | toHaveReceivedEventDetail(eventDetail: any): void;
|
1689 | |
1690 |
|
1691 |
|
1692 |
|
1693 | toHaveFirstReceivedEventDetail(eventDetail: any): void;
|
1694 | |
1695 |
|
1696 |
|
1697 |
|
1698 | toHaveNthReceivedEventDetail(index: number, eventDetail: any): void;
|
1699 | |
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 | toMatchScreenshot(opts?: MatchScreenshotOptions): void;
|
1706 | }
|
1707 | }
|
1708 | }
|
1709 | export interface MatchScreenshotOptions {
|
1710 | |
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 | allowableMismatchedPixels?: number;
|
1718 | |
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 | allowableMismatchedRatio?: number;
|
1732 | }
|
1733 | export interface EventSpy {
|
1734 | events: SerializedEvent[];
|
1735 | eventName: string;
|
1736 | firstEvent: SerializedEvent;
|
1737 | lastEvent: SerializedEvent;
|
1738 | length: number;
|
1739 | next(): Promise<{
|
1740 | done: boolean;
|
1741 | value: SerializedEvent;
|
1742 | }>;
|
1743 | }
|
1744 | export interface SerializedEvent {
|
1745 | bubbles: boolean;
|
1746 | cancelBubble: boolean;
|
1747 | cancelable: boolean;
|
1748 | composed: boolean;
|
1749 | currentTarget: any;
|
1750 | defaultPrevented: boolean;
|
1751 | detail: any;
|
1752 | eventPhase: any;
|
1753 | isTrusted: boolean;
|
1754 | returnValue: any;
|
1755 | srcElement: any;
|
1756 | target: any;
|
1757 | timeStamp: number;
|
1758 | type: string;
|
1759 | isSerializedEvent: boolean;
|
1760 | }
|
1761 | export interface EventInitDict {
|
1762 | bubbles?: boolean;
|
1763 | cancelable?: boolean;
|
1764 | composed?: boolean;
|
1765 | detail?: any;
|
1766 | }
|
1767 | export interface JestEnvironmentGlobal {
|
1768 | __NEW_TEST_PAGE__: () => Promise<any>;
|
1769 | __CLOSE_OPEN_PAGES__: () => Promise<any>;
|
1770 | loadTestWindow: (testWindow: any) => Promise<void>;
|
1771 | h: any;
|
1772 | resourcesUrl: string;
|
1773 | currentSpec?: {
|
1774 | id: string;
|
1775 | description: string;
|
1776 | fullName: string;
|
1777 | testPath: string;
|
1778 | };
|
1779 | env: {
|
1780 | [prop: string]: string;
|
1781 | };
|
1782 | screenshotDescriptions: Set<string>;
|
1783 | }
|
1784 | export interface E2EProcessEnv {
|
1785 | STENCIL_COMMIT_ID?: string;
|
1786 | STENCIL_COMMIT_MESSAGE?: string;
|
1787 | STENCIL_REPO_URL?: string;
|
1788 | STENCIL_SCREENSHOT_CONNECTOR?: string;
|
1789 | STENCIL_SCREENSHOT_SERVER?: string;
|
1790 | __STENCIL_EMULATE_CONFIGS__?: string;
|
1791 | __STENCIL_ENV__?: string;
|
1792 | __STENCIL_EMULATE__?: string;
|
1793 | __STENCIL_BROWSER_URL__?: string;
|
1794 | __STENCIL_APP_SCRIPT_URL__?: string;
|
1795 | __STENCIL_APP_STYLE_URL__?: string;
|
1796 | __STENCIL_BROWSER_WS_ENDPOINT__?: string;
|
1797 | __STENCIL_BROWSER_WAIT_UNTIL?: string;
|
1798 | __STENCIL_SCREENSHOT__?: 'true';
|
1799 | __STENCIL_SCREENSHOT_BUILD__?: string;
|
1800 | __STENCIL_E2E_TESTS__?: 'true';
|
1801 | __STENCIL_E2E_DEVTOOLS__?: 'true';
|
1802 | __STENCIL_SPEC_TESTS__?: 'true';
|
1803 | __STENCIL_PUPPETEER_MODULE__?: string;
|
1804 | __STENCIL_PUPPETEER_VERSION__?: number;
|
1805 | __STENCIL_DEFAULT_TIMEOUT__?: string;
|
1806 | |
1807 |
|
1808 |
|
1809 | __STENCIL_TRANSPILE_PATHS__?: 'true' | 'false';
|
1810 | }
|
1811 | export interface AnyHTMLElement extends HTMLElement {
|
1812 | [key: string]: any;
|
1813 | }
|
1814 | export interface SpecPage {
|
1815 | |
1816 |
|
1817 |
|
1818 | body: HTMLBodyElement;
|
1819 | |
1820 |
|
1821 |
|
1822 | doc: HTMLDocument;
|
1823 | |
1824 |
|
1825 |
|
1826 | root?: AnyHTMLElement;
|
1827 | |
1828 |
|
1829 |
|
1830 | rootInstance?: any;
|
1831 | |
1832 |
|
1833 |
|
1834 | setContent: (html: string) => Promise<any>;
|
1835 | |
1836 |
|
1837 |
|
1838 | waitForChanges: () => Promise<any>;
|
1839 | |
1840 |
|
1841 |
|
1842 | win: Window;
|
1843 | build: BuildConditionals;
|
1844 | flushLoadModule: (bundleId?: string) => Promise<any>;
|
1845 | flushQueue: () => Promise<any>;
|
1846 | styles: Map<string, string>;
|
1847 | }
|
1848 |
|
1849 |
|
1850 |
|
1851 | export interface NewSpecPageOptions {
|
1852 | |
1853 |
|
1854 |
|
1855 | components: any[];
|
1856 | |
1857 |
|
1858 |
|
1859 | cookie?: string;
|
1860 | |
1861 |
|
1862 |
|
1863 | direction?: string;
|
1864 | |
1865 |
|
1866 |
|
1867 | flushQueue?: boolean;
|
1868 | |
1869 |
|
1870 |
|
1871 | html?: string;
|
1872 | |
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 | template?: () => any;
|
1878 | |
1879 |
|
1880 |
|
1881 | language?: string;
|
1882 | |
1883 |
|
1884 |
|
1885 | hydrateClientSide?: boolean;
|
1886 | |
1887 |
|
1888 |
|
1889 | hydrateServerSide?: boolean;
|
1890 | |
1891 |
|
1892 |
|
1893 | referrer?: string;
|
1894 | |
1895 |
|
1896 |
|
1897 | supportsShadowDom?: boolean;
|
1898 | |
1899 |
|
1900 |
|
1901 | includeAnnotations?: boolean;
|
1902 | |
1903 |
|
1904 |
|
1905 | url?: string;
|
1906 | |
1907 |
|
1908 |
|
1909 | userAgent?: string;
|
1910 | |
1911 |
|
1912 |
|
1913 | autoApplyChanges?: boolean;
|
1914 | |
1915 |
|
1916 |
|
1917 |
|
1918 | attachStyles?: boolean;
|
1919 | |
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 | strictBuild?: boolean;
|
1925 | |
1926 |
|
1927 |
|
1928 |
|
1929 | platform?: Partial<PlatformRuntime>;
|
1930 | }
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 | export interface TypesImportData {
|
1939 | [key: string]: TypesMemberNameData[];
|
1940 | }
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 | export interface TypesMemberNameData {
|
1946 | |
1947 |
|
1948 |
|
1949 | localName: string;
|
1950 | |
1951 |
|
1952 |
|
1953 |
|
1954 | importName?: string;
|
1955 | }
|
1956 | export interface TypesModule {
|
1957 | isDep: boolean;
|
1958 | tagName: string;
|
1959 | tagNameAsPascal: string;
|
1960 | htmlElementName: string;
|
1961 | component: string;
|
1962 | jsx: string;
|
1963 | element: string;
|
1964 | }
|
1965 | export type TypeInfo = {
|
1966 | name: string;
|
1967 | type: string;
|
1968 | optional: boolean;
|
1969 | required: boolean;
|
1970 | internal: boolean;
|
1971 | jsdoc?: string;
|
1972 | }[];
|
1973 | export type ChildType = VNode | number | string;
|
1974 | export type PropsType = VNodeProdData | number | string | null;
|
1975 | export interface VNodeProdData {
|
1976 | key?: string | number;
|
1977 | class?: {
|
1978 | [className: string]: boolean;
|
1979 | } | string;
|
1980 | className?: {
|
1981 | [className: string]: boolean;
|
1982 | } | string;
|
1983 | style?: any;
|
1984 | [key: string]: any;
|
1985 | }
|
1986 | export interface CompilerWorkerContext {
|
1987 | optimizeCss(inputOpts: OptimizeCssInput): Promise<OptimizeCssOutput>;
|
1988 | prepareModule(input: string, minifyOpts: any, transpile: boolean, inlineHelpers: boolean): Promise<{
|
1989 | output: string;
|
1990 | diagnostics: Diagnostic[];
|
1991 | sourceMap?: SourceMap;
|
1992 | }>;
|
1993 | prerenderWorker(prerenderRequest: PrerenderUrlRequest): Promise<PrerenderUrlResults>;
|
1994 | transformCssToEsm(input: TransformCssToEsmInput): Promise<TransformCssToEsmOutput>;
|
1995 | }
|
1996 | export interface MsgToWorker {
|
1997 | stencilId: number;
|
1998 | args: any[];
|
1999 | }
|
2000 | export interface MsgFromWorker {
|
2001 | stencilId?: number;
|
2002 | stencilRtnValue: any;
|
2003 | stencilRtnError: string;
|
2004 | }
|
2005 | export interface CompilerWorkerTask {
|
2006 | stencilId?: number;
|
2007 | inputArgs?: any[];
|
2008 | resolve: (val: any) => any;
|
2009 | reject: (msg: string) => any;
|
2010 | retries?: number;
|
2011 | }
|
2012 | export type WorkerMsgHandler = (msgToWorker: MsgToWorker) => Promise<any>;
|
2013 | export interface TranspileModuleResults {
|
2014 | sourceFilePath: string;
|
2015 | code: string;
|
2016 | map: any;
|
2017 | diagnostics: Diagnostic[];
|
2018 | moduleFile: Module;
|
2019 | }
|
2020 | export interface ValidateTypesResults {
|
2021 | diagnostics: Diagnostic[];
|
2022 | dirPaths: string[];
|
2023 | filePaths: string[];
|
2024 | }
|
2025 | export interface TerminalInfo {
|
2026 | |
2027 |
|
2028 |
|
2029 | readonly ci: boolean;
|
2030 | |
2031 |
|
2032 |
|
2033 | readonly tty: boolean;
|
2034 | }
|
2035 |
|
2036 |
|
2037 |
|
2038 | export type TelemetryCallback = (...args: any[]) => void | Promise<void>;
|
2039 |
|
2040 |
|
2041 |
|
2042 | export interface TrackableData {
|
2043 | arguments: string[];
|
2044 | build: string;
|
2045 | component_count?: number;
|
2046 | config: Config;
|
2047 | cpu_model: string | undefined;
|
2048 | duration_ms: number | undefined;
|
2049 | has_app_pwa_config: boolean;
|
2050 | os_name: string | undefined;
|
2051 | os_version: string | undefined;
|
2052 | packages: string[];
|
2053 | packages_no_versions?: string[];
|
2054 | rollup: string;
|
2055 | stencil: string;
|
2056 | system: string;
|
2057 | system_major?: string;
|
2058 | targets: string[];
|
2059 | task: TaskCommand | null;
|
2060 | typescript: string;
|
2061 | yarn: boolean;
|
2062 | }
|
2063 |
|
2064 |
|
2065 |
|
2066 | export interface Metric {
|
2067 | name: string;
|
2068 | timestamp: string;
|
2069 | source: 'stencil_cli';
|
2070 | value: TrackableData;
|
2071 | session_id: string;
|
2072 | }
|
2073 | export interface TelemetryConfig {
|
2074 | 'telemetry.stencil'?: boolean;
|
2075 | 'tokens.telemetry'?: string;
|
2076 | }
|