UNPKG

1.94 kBTypeScriptView Raw
1import { ComponentCompilerEvent, Config } from '@stencil/core/internal';
2import type { PackageJSON } from './types';
3export declare const toLowerCase: (str: string) => string;
4export declare const dashToPascalCase: (str: string) => string;
5export declare function sortBy<T>(array: T[], prop: (item: T) => string): T[];
6export declare function normalizePath(str: string): string;
7export declare function relativeImport(pathFrom: string, pathTo: string, ext?: string): string;
8export declare function isRelativePath(path: string): boolean | "";
9export declare function readPackageJson(config: Config, rootDir: string): Promise<PackageJSON>;
10/**
11 * Formats an array of strings to a string of quoted, comma separated values.
12 * @param list The list of unformatted strings to format
13 * @returns The formatted array of strings. (e.g. ['foo', 'bar']) => `'foo', 'bar'`
14 */
15export declare const formatToQuotedList: (list: readonly string[]) => string;
16/**
17 * Creates an import statement for a list of named imports from a module.
18 * @param imports The list of named imports.
19 * @param module The module to import from.
20 *
21 * @returns The import statement as a string.
22 */
23export declare const createImportStatement: (imports: string[], module: string) => string;
24/**
25 * Creates the collection of import statements for a component based on the component's events type dependencies.
26 * @param componentTagName The tag name of the component (pascal case).
27 * @param events The events compiler metadata.
28 * @param options The options for generating the import statements (e.g. whether to import from the custom elements directory).
29 * @returns The import statements as an array of strings.
30 */
31export declare const createComponentEventTypeImports: (componentTagName: string, events: readonly ComponentCompilerEvent[], options: {
32 componentCorePackage: string;
33 includeImportCustomElements?: boolean;
34 customElementsDir?: string;
35}) => string;