stencil.d.ts 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { Compiler, CompilerBuildResults, CompilerSystem, CompilerWatcher, CompileScriptMinifyOptions, Config, Diagnostic, LoadConfigInit, LoadConfigResults, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, PlatformPath, PrerenderResults, PrerenderStartOptions, TranspileOptions, TranspileResults } from '../internal/index';
  2. export { transpile, transpileSync } from './transpile';
  3. /**
  4. * The compiler is the utility that brings together many tools to build optimized components,
  5. * such as a transpiler, bundler, and minifier, along with many internal optimizations to
  6. * create small efficient components. When using the CLI, the `stencil build` command uses
  7. * the compiler for the various builds, such as a production build, or watch mode during
  8. * development. If only one file should be transformed then the `transpile()` function
  9. * should be used instead.
  10. *
  11. * Given a Stencil config, this method asynchronously returns a `Compiler` instance. The
  12. * config provided should already be created using the `loadConfig({...})` method.
  13. */
  14. export declare const createCompiler: (config: Config) => Promise<Compiler>;
  15. export declare const createPrerenderer: (config: Config) => Promise<{
  16. start: (opts: PrerenderStartOptions) => Promise<PrerenderResults>;
  17. }>;
  18. /**
  19. * The compiler uses a `CompilerSystem` instance to access any file system reads and writes.
  20. * When used from the CLI, the CLI will provide its own system based on NodeJS. This method
  21. * provide a compiler system is in-memory only and independent of any platform.
  22. */
  23. export declare const createSystem: () => CompilerSystem;
  24. /**
  25. * The `dependencies` array is only informational and provided to state which versions of
  26. * dependencies the compiler was built and works with. For example, the version of TypeScript,
  27. * Rollup and Terser used for this version of Stencil are listed here.
  28. */
  29. export declare const dependencies: CompilerDependency[];
  30. export interface CompilerDependency {
  31. name: string;
  32. version: string;
  33. main: string;
  34. resources?: string[];
  35. }
  36. /**
  37. * The `loadConfig(init)` method is used to take raw config information and transform it into a
  38. * usable config object for the compiler and dev-server. The `init` argument should be given
  39. * an already created system and logger which can also be used by the compiler.
  40. */
  41. export declare const loadConfig: (init?: LoadConfigInit) => Promise<LoadConfigResults>;
  42. /**
  43. * Utility function used by the compiler to optimize CSS.
  44. */
  45. export declare const optimizeCss: (cssInput?: OptimizeCssInput) => Promise<OptimizeCssOutput>;
  46. /**
  47. * Utility function used by the compiler to optimize JavaScript. Knowing the JavaScript target
  48. * will further apply minification optimizations beyond usual minification.
  49. */
  50. export declare const optimizeJs: (jsInput?: OptimizeJsInput) => Promise<OptimizeJsOutput>;
  51. /**
  52. * Utility of the `path` API provided by NodeJS, but capable of running in any environment.
  53. */
  54. export declare const path: PlatformPath;
  55. /**
  56. * Current version of `@stencil/core`.
  57. */
  58. export declare const version: string;
  59. export declare const versions: {
  60. stencil: string;
  61. typescript: string;
  62. rollup: string;
  63. terser: string;
  64. };
  65. /**
  66. * Current version's emoji :)
  67. */
  68. export declare const vermoji: string;
  69. /**
  70. * Compiler's unique build ID.
  71. */
  72. export declare const buildId: string;
  73. export { Compiler, CompilerBuildResults, CompilerSystem, CompilerWatcher, CompileScriptMinifyOptions, Config, Diagnostic, LoadConfigInit, LoadConfigResults, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, TranspileOptions, TranspileResults, };