1 | import { Compiler, CompilerBuildResults, CompilerSystem, CompilerWatcher, CompileScriptMinifyOptions, Config, Diagnostic, LoadConfigInit, LoadConfigResults, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, PlatformPath, PrerenderResults, PrerenderStartOptions, TranspileOptions, TranspileResults } from '../internal/index';
|
2 | /**
|
3 | * The `transpile()` function inputs source code as a string, with various options
|
4 | * within the second argument. The function is stateless and returns a `Promise` of the
|
5 | * results, including diagnostics and the transpiled code. The `transpile()` function
|
6 | * does not handle any bundling, minifying, or precompiling any CSS preprocessing like
|
7 | * Sass or Less. The `transpileSync()` equivalent is available so the same function
|
8 | * it can be called synchronously. However, TypeScript must be already loaded within
|
9 | * the global for it to work, where as the async `transpile()` function will load
|
10 | * TypeScript automatically.
|
11 | *
|
12 | * Since TypeScript is used, the source code will transpile from TypeScript to JavaScript,
|
13 | * and does not require Babel presets. Additionally, the results includes an `imports`
|
14 | * array of all the import paths found in the source file. The transpile options can be
|
15 | * used to set the `module` format, such as `cjs`, and JavaScript `target` version, such
|
16 | * as `es2017`.
|
17 | */
|
18 | export declare const transpile: (code: string, opts?: TranspileOptions) => Promise<TranspileResults>;
|
19 | /**
|
20 | * Synchronous equivalent of the `transpile()` function. When used in a browser
|
21 | * environment, TypeScript must already be available globally, where as the async
|
22 | * `transpile()` function will load TypeScript automatically.
|
23 | */
|
24 | export declare const transpileSync: (code: string, opts?: TranspileOptions) => TranspileResults;
|
25 | /**
|
26 | * The compiler is the utility that brings together many tools to build optimized components,
|
27 | * such as a transpiler, bundler, and minifier, along with many internal optimizations to
|
28 | * create small efficient compoennts. When using the CLI, the `stencil build` command uses
|
29 | * the compiler for the various builds, such as a production build, or watch mode during
|
30 | * development. If only one file should be transformed then the `transpile()` function
|
31 | * should be used instead.
|
32 | *
|
33 | * Given a Stencil config, this method asynchronously returns a `Compiler` instance. The
|
34 | * config provided should already be created using the `loadConfig({...})` method.
|
35 | */
|
36 | export declare const createCompiler: (config: Config) => Promise<Compiler>;
|
37 | export declare const createPrerenderer: (config: Config) => Promise<{
|
38 | start: (opts: PrerenderStartOptions) => Promise<PrerenderResults>;
|
39 | }>;
|
40 | /**
|
41 | * The compiler uses a `CompilerSystem` instance to access any file system reads and writes.
|
42 | * When used from the CLI, the CLI will provide its own system based on NodeJS. This method
|
43 | * provide a compiler system is in-memory only and independent of any platform.
|
44 | */
|
45 | export declare const createSystem: () => CompilerSystem;
|
46 | /**
|
47 | * The `dependencies` array is only informational and provided to state which versions of
|
48 | * dependencies the compiler was built and works with. For example, the version of TypeScript,
|
49 | * Rollup and Terser used for this version of Stencil are listed here.
|
50 | */
|
51 | export declare const dependencies: CompilerDependency[];
|
52 | export interface CompilerDependency {
|
53 | name: string;
|
54 | version: string;
|
55 | main: string;
|
56 | resources?: string[];
|
57 | }
|
58 | /**
|
59 | * The `loadConfig(init)` method is used to take raw config information and transform it into a
|
60 | * usable config object for the compiler and dev-server. The `init` argument should be given
|
61 | * an already created system and logger which can also be used by the compiler.
|
62 | */
|
63 | export declare const loadConfig: (init?: LoadConfigInit) => Promise<LoadConfigResults>;
|
64 | /**
|
65 | * Utility function used by the compiler to optimize CSS.
|
66 | */
|
67 | export declare const optimizeCss: (cssInput?: OptimizeCssInput) => Promise<OptimizeCssOutput>;
|
68 | /**
|
69 | * Utility function used by the compiler to optimize JavaScript. Knowing the JavaScript target
|
70 | * will further apply minification optimizations beyond usual minification.
|
71 | */
|
72 | export declare const optimizeJs: (jsInput?: OptimizeJsInput) => Promise<OptimizeJsOutput>;
|
73 | /**
|
74 | * Utility of the `path` API providied by NodeJS, but capable of running in any environment.
|
75 | */
|
76 | export declare const path: PlatformPath;
|
77 | /**
|
78 | * Current version of `@stencil/core`.
|
79 | */
|
80 | export declare const version: string;
|
81 | export declare const versions: {
|
82 | stencil: string;
|
83 | typescript: string;
|
84 | rollup: string;
|
85 | terser: string;
|
86 | };
|
87 | /**
|
88 | * Current version's emoji :)
|
89 | */
|
90 | export declare const vermoji: string;
|
91 | /**
|
92 | * Compiler's unique build ID.
|
93 | */
|
94 | export declare const buildId: string;
|
95 | export { Compiler, CompilerBuildResults, CompilerSystem, CompilerWatcher, CompileScriptMinifyOptions, Config, Diagnostic, LoadConfigInit, LoadConfigResults, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, TranspileOptions, TranspileResults, };
|