@sveltejs/vite-plugin-svelte 1.0.0-next.42 → 1.0.0-next.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +295 -157
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +49 -4
- package/dist/index.js +294 -156
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/src/index.ts +162 -135
- package/src/ui/inspector/Inspector.svelte +245 -0
- package/src/ui/inspector/load-inspector.js +15 -0
- package/src/ui/inspector/plugin.ts +106 -0
- package/src/utils/__tests__/dependencies.spec.ts +7 -4
- package/src/utils/__tests__/sourcemap.spec.ts +1 -0
- package/src/utils/compile.ts +6 -1
- package/src/utils/options.ts +103 -32
- package/src/utils/watch.ts +22 -18
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface Options {
|
|
|
8
8
|
/**
|
|
9
9
|
* Path to a svelte config file, either absolute or relative to Vite root
|
|
10
10
|
*
|
|
11
|
-
* set to `false` to
|
|
11
|
+
* set to `false` to ignore the svelte config file
|
|
12
12
|
*
|
|
13
13
|
* @see https://vitejs.dev/config/#root
|
|
14
14
|
*/
|
|
@@ -46,11 +46,13 @@ interface Options {
|
|
|
46
46
|
*/
|
|
47
47
|
emitCss?: boolean;
|
|
48
48
|
/**
|
|
49
|
-
* The options to be passed to the Svelte compiler
|
|
49
|
+
* The options to be passed to the Svelte compiler. A few options are set by default,
|
|
50
|
+
* including `dev` and `css`. However, some options are non-configurable, like
|
|
51
|
+
* `filename`, `format`, `generate`, and `cssHash` (in dev).
|
|
50
52
|
*
|
|
51
53
|
* @see https://svelte.dev/docs#svelte_compile
|
|
52
54
|
*/
|
|
53
|
-
compilerOptions?: CompileOptions
|
|
55
|
+
compilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;
|
|
54
56
|
/**
|
|
55
57
|
* Handles warning emitted from the Svelte compiler
|
|
56
58
|
*/
|
|
@@ -150,11 +152,54 @@ interface ExperimentalOptions {
|
|
|
150
152
|
code: string;
|
|
151
153
|
compileOptions: Partial<CompileOptions>;
|
|
152
154
|
}) => Promise<Partial<CompileOptions> | void> | Partial<CompileOptions> | void;
|
|
155
|
+
/**
|
|
156
|
+
* enable svelte inspector
|
|
157
|
+
*/
|
|
158
|
+
inspector?: InspectorOptions | boolean;
|
|
159
|
+
}
|
|
160
|
+
interface InspectorOptions {
|
|
161
|
+
/**
|
|
162
|
+
* define a key combo to toggle inspector,
|
|
163
|
+
* @default 'control-shift' on windows, 'meta-shift' on other os
|
|
164
|
+
*
|
|
165
|
+
* any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by -
|
|
166
|
+
* examples: control-shift, control-o, control-alt-s meta-x control-meta
|
|
167
|
+
* Some keys have native behavior (e.g. alt-s opens history menu on firefox).
|
|
168
|
+
* To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended.
|
|
169
|
+
*/
|
|
170
|
+
toggleKeyCombo?: string;
|
|
171
|
+
/**
|
|
172
|
+
* inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
holdMode?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* when to show the toggle button
|
|
178
|
+
* @default 'active'
|
|
179
|
+
*/
|
|
180
|
+
showToggleButton?: 'always' | 'active' | 'never';
|
|
181
|
+
/**
|
|
182
|
+
* where to display the toggle button
|
|
183
|
+
* @default top-right
|
|
184
|
+
*/
|
|
185
|
+
toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
186
|
+
/**
|
|
187
|
+
* inject custom styles when inspector is active
|
|
188
|
+
*/
|
|
189
|
+
customStyles?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* append an import to the module id ending with `appendTo` instead of adding a script into body
|
|
192
|
+
* useful for frameworks that do not support trannsformIndexHtml hook
|
|
193
|
+
*
|
|
194
|
+
* WARNING: only set this if you know exactly what it does.
|
|
195
|
+
* Regular users of vite-plugin-svelte or SvelteKit do not need it
|
|
196
|
+
*/
|
|
197
|
+
appendTo?: string;
|
|
153
198
|
}
|
|
154
199
|
declare type ModuleFormat = NonNullable<CompileOptions['format']>;
|
|
155
200
|
declare type CssHashGetter = NonNullable<CompileOptions['cssHash']>;
|
|
156
201
|
declare type Arrayable<T> = T | T[];
|
|
157
202
|
|
|
158
|
-
declare function svelte(inlineOptions?: Partial<Options>): Plugin;
|
|
203
|
+
declare function svelte(inlineOptions?: Partial<Options>): Plugin[];
|
|
159
204
|
|
|
160
205
|
export { Arrayable, CssHashGetter, ModuleFormat, Options, svelte };
|