@rsbuild/plugin-svelte 0.2.17 → 0.2.18

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.d.ts CHANGED
@@ -1,13 +1,35 @@
1
1
  import { RsbuildPlugin } from '@rsbuild/core';
2
+ import { CompileOptions } from 'svelte/compiler';
3
+ import { AutoPreprocessOptions } from 'svelte-preprocess/dist/types';
4
+ export { AutoPreprocessOptions, Transformer } from 'svelte-preprocess/dist/types';
2
5
 
6
+ interface SvelteLoaderOptions {
7
+ compilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;
8
+ /**
9
+ * Extra HMR options, the defaults are completely fine\
10
+ * You can safely omit hotOptions altogether
11
+ */
12
+ hotOptions?: {
13
+ /** Preserve local component state */
14
+ preserveLocalState?: boolean;
15
+ [key: string]: any;
16
+ };
17
+ [key: string]: any;
18
+ }
3
19
  type PluginSvelteOptions = {
4
20
  /**
5
21
  * The options of svelte-loader
6
22
  *
7
23
  * See https://github.com/sveltejs/svelte-loader
8
24
  */
9
- svelteLoaderOptions?: Record<string, any>;
25
+ svelteLoaderOptions?: SvelteLoaderOptions;
26
+ /**
27
+ * The options of svelte-preprocess
28
+ *
29
+ * See https://github.com/sveltejs/svelte-preprocess
30
+ */
31
+ preprocessOptions?: AutoPreprocessOptions;
10
32
  };
11
33
  declare function pluginSvelte(options?: PluginSvelteOptions): RsbuildPlugin;
12
34
 
13
- export { PluginSvelteOptions, pluginSvelte };
35
+ export { PluginSvelteOptions, SvelteLoaderOptions, pluginSvelte };
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ function pluginSvelte(options = {}) {
75
75
  compilerOptions: {
76
76
  dev: !isProd
77
77
  },
78
- preprocess: sveltePreprocess(),
78
+ preprocess: sveltePreprocess(options.preprocessOptions),
79
79
  emitCss: !rsbuildConfig.output.injectStyles,
80
80
  hotReload: !isProd && rsbuildConfig.dev.hmr
81
81
  },
package/dist/index.mjs CHANGED
@@ -57,7 +57,7 @@ function pluginSvelte(options = {}) {
57
57
  compilerOptions: {
58
58
  dev: !isProd
59
59
  },
60
- preprocess: sveltePreprocess(),
60
+ preprocess: sveltePreprocess(options.preprocessOptions),
61
61
  emitCss: !rsbuildConfig.output.injectStyles,
62
62
  hotReload: !isProd && rsbuildConfig.dev.hmr
63
63
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-svelte",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "Svelte plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,13 +24,14 @@
24
24
  "dependencies": {
25
25
  "svelte-loader": "3.1.9",
26
26
  "svelte-preprocess": "^5.0.4",
27
- "@rsbuild/shared": "0.2.17"
27
+ "@rsbuild/shared": "0.2.18"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "16.x",
31
+ "svelte": "^4.2.2",
31
32
  "typescript": "^5.3.0",
32
- "@rsbuild/core": "0.2.17",
33
- "@rsbuild/test-helper": "0.2.17"
33
+ "@rsbuild/core": "0.2.18",
34
+ "@rsbuild/test-helper": "0.2.18"
34
35
  },
35
36
  "publishConfig": {
36
37
  "access": "public",