@rsbuild/plugin-svelte 0.0.15 → 0.0.16
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 +8 -1
- package/dist/index.js +13 -7
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { RsbuildPlugin, RsbuildPluginAPI } from '@rsbuild/core';
|
|
2
|
-
export type PluginSvelteOptions = {
|
|
2
|
+
export type PluginSvelteOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* The options of svelte-loader
|
|
5
|
+
*
|
|
6
|
+
* See https://github.com/sveltejs/svelte-loader
|
|
7
|
+
*/
|
|
8
|
+
svelteLoaderOptions?: Record<string, any>;
|
|
9
|
+
};
|
|
3
10
|
export declare function pluginSvelte(options?: PluginSvelteOptions): RsbuildPlugin<RsbuildPluginAPI>;
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(src_exports);
|
|
34
34
|
var import_path = __toESM(require("path"));
|
|
35
35
|
var import_shared = require("@rsbuild/shared");
|
|
36
|
+
var import_deepmerge = require("@rsbuild/shared/deepmerge");
|
|
36
37
|
function pluginSvelte(options = {}) {
|
|
37
38
|
return {
|
|
38
39
|
name: "plugin-svelte",
|
|
@@ -53,6 +54,7 @@ function pluginSvelte(options = {}) {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd }) => {
|
|
57
|
+
var _a;
|
|
56
58
|
const { default: sveltePreprocess } = await Promise.resolve().then(() => __toESM(require("svelte-preprocess")));
|
|
57
59
|
const rsbuildConfig = api.getNormalizedConfig();
|
|
58
60
|
chain.resolve.alias.set("svelte", import_path.default.join(sveltePath, "src/runtime")).end().extensions.add(".svelte").end().mainFields.prepend("svelte").end().set("conditionNames", ["svelte", "browser", "import"]);
|
|
@@ -64,14 +66,18 @@ function pluginSvelte(options = {}) {
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
const svelteLoaderOptions = (0, import_deepmerge.deepmerge)(
|
|
70
|
+
{
|
|
71
|
+
compilerOptions: {
|
|
72
|
+
dev: !isProd
|
|
73
|
+
},
|
|
74
|
+
preprocess: sveltePreprocess(),
|
|
75
|
+
emitCss: !rsbuildConfig.output.disableCssExtract,
|
|
76
|
+
hotReload: !isProd && rsbuildConfig.dev.hmr
|
|
70
77
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
78
|
+
(_a = options.svelteLoaderOptions) != null ? _a : {}
|
|
79
|
+
);
|
|
80
|
+
chain.module.rule(CHAIN_ID.RULE.SVELTE).test(/\.svelte$/).use(CHAIN_ID.USE.SVELTE).loader(loaderPath).options(svelteLoaderOptions);
|
|
75
81
|
});
|
|
76
82
|
}
|
|
77
83
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Svelte plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"svelte-loader": "3.1.9",
|
|
24
24
|
"svelte-preprocess": "^5.0.4",
|
|
25
|
-
"@rsbuild/shared": "0.0.
|
|
25
|
+
"@rsbuild/shared": "0.0.16"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^16",
|
|
29
29
|
"typescript": "^5.2.2",
|
|
30
|
-
"@rsbuild/core": "0.0.
|
|
31
|
-
"@rsbuild/test-helper": "0.0.
|
|
30
|
+
"@rsbuild/core": "0.0.16",
|
|
31
|
+
"@rsbuild/test-helper": "0.0.16"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public",
|