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