1 | import { ValidatorResult } from 'jsonschema';
|
2 | import type HttpProxy from 'http-proxy';
|
3 | import { Plugin as RollupPlugin } from 'rollup';
|
4 | declare type ScriptType = 'mount' | 'run' | 'build' | 'bundle';
|
5 | export declare type EnvVarReplacements = Record<string, string | number | true>;
|
6 |
|
7 | export declare type SnowpackBuildMap = {
|
8 | [outputLoc: string]: SnowpackSourceFile;
|
9 | };
|
10 |
|
11 | export interface SnowpackSourceFile {
|
12 |
|
13 | baseExt: string;
|
14 |
|
15 | code: string;
|
16 |
|
17 | expandedExt: string;
|
18 |
|
19 | locOnDisk?: string;
|
20 | }
|
21 | export declare type SnowpackPluginBuildArgs = {
|
22 | contents: string;
|
23 | filePath: string;
|
24 | isDev: boolean;
|
25 | };
|
26 | export declare type SnowpackPluginTransformArgs = {
|
27 | contents: string;
|
28 | urlPath: string;
|
29 | isDev: boolean;
|
30 | };
|
31 | export declare type SnowpackPluginBuildResult = {
|
32 | result: string;
|
33 | resources?: {
|
34 | css?: string;
|
35 | };
|
36 | };
|
37 | export declare type SnowpackPluginTransformResult = {
|
38 | result: string;
|
39 | resources?: {
|
40 | css?: string;
|
41 | };
|
42 | };
|
43 | export declare type SnowpackPlugin = {
|
44 | defaultBuildScript?: string;
|
45 | knownEntrypoints?: string[];
|
46 | build?: (args: SnowpackPluginBuildArgs) => null | SnowpackPluginBuildResult | Promise<null | SnowpackPluginBuildResult>;
|
47 | transform?: (args: SnowpackPluginTransformArgs) => null | SnowpackPluginTransformResult | Promise<null | SnowpackPluginTransformResult>;
|
48 | bundle?(args: {
|
49 | srcDirectory: string;
|
50 | destDirectory: string;
|
51 | jsFilePaths: Set<string>;
|
52 | log: (msg: any) => void;
|
53 | }): Promise<void>;
|
54 | };
|
55 | export declare type BuildScript = {
|
56 | id: string;
|
57 | match: string[];
|
58 | type: ScriptType;
|
59 | cmd: string;
|
60 | watch?: string;
|
61 | plugin?: SnowpackPlugin;
|
62 | args?: any;
|
63 | };
|
64 | export declare type ProxyOptions = HttpProxy.ServerOptions & {
|
65 | on: Record<string, Function>;
|
66 | };
|
67 | export declare type Proxy = [string, ProxyOptions];
|
68 | export interface SnowpackConfig {
|
69 | install: string[];
|
70 | extends?: string;
|
71 | exclude: string[];
|
72 | knownEntrypoints: string[];
|
73 | webDependencies?: {
|
74 | [packageName: string]: string;
|
75 | };
|
76 | scripts: BuildScript[];
|
77 | plugins: SnowpackPlugin[];
|
78 | devOptions: {
|
79 | secure: boolean;
|
80 | port: number;
|
81 | out: string;
|
82 | fallback: string;
|
83 | open: string;
|
84 | bundle: boolean | undefined;
|
85 | hmr: boolean;
|
86 | };
|
87 | installOptions: {
|
88 | dest: string;
|
89 | env: EnvVarReplacements;
|
90 | treeshake?: boolean;
|
91 | installTypes: boolean;
|
92 | sourceMap?: boolean | 'inline';
|
93 | externalPackage: string[];
|
94 | alias: {
|
95 | [key: string]: string;
|
96 | };
|
97 | namedExports: string[];
|
98 | rollup: {
|
99 | plugins: RollupPlugin[];
|
100 | dedupe?: string[];
|
101 | };
|
102 | };
|
103 | buildOptions: {
|
104 | baseUrl: string;
|
105 | metaDir: string;
|
106 | };
|
107 | proxy: Proxy[];
|
108 | }
|
109 | export interface CLIFlags extends Omit<Partial<SnowpackConfig['installOptions']>, 'env'> {
|
110 | help?: boolean;
|
111 | version?: boolean;
|
112 | reload?: boolean;
|
113 | config?: string;
|
114 | env?: string[];
|
115 | open?: string[];
|
116 | secure?: boolean;
|
117 | }
|
118 | export declare function createConfiguration(config: Partial<SnowpackConfig>): [ValidatorResult['errors'], undefined] | [null, SnowpackConfig];
|
119 | export declare function loadAndValidateConfig(flags: CLIFlags, pkgManifest: any): SnowpackConfig;
|
120 | export {};
|