@rsbuild/plugin-svelte 1.0.7 → 1.0.8

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/README.md CHANGED
@@ -1,19 +1,19 @@
1
- <p align="center">
2
- <a href="https://rsbuild.dev" target="blank"><img src="https://github.com/web-infra-dev/rsbuild/assets/7237365/84abc13e-b620-468f-a90b-dbf28e7e9427" alt="Rsbuild Logo" /></a>
3
- </p>
1
+ # @rsbuild/plugin-svelte
4
2
 
5
- # Rsbuild
3
+ An Rsbuild plugin to provide support for Svelte.
6
4
 
7
- The Rspack-based build tool. It's fast, out-of-the-box and extensible.
5
+ <p>
6
+ <a href="https://npmjs.com/package/@rsbuild/plugin-svelte">
7
+ <img src="https://img.shields.io/npm/v/@rsbuild/plugin-svelte?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
8
+ </a>
9
+ <img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
10
+ <a href="https://npmcharts.com/compare/@rsbuild/plugin-svelte?minimal=true"><img src="https://img.shields.io/npm/dm/@rsbuild/plugin-svelte.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
11
+ </p>
8
12
 
9
13
  ## Documentation
10
14
 
11
- https://rsbuild.dev/
12
-
13
- ## Contributing
14
-
15
- Please read the [Contributing Guide](https://github.com/web-infra-dev/rsbuild/blob/main/CONTRIBUTING.md).
15
+ See [Documentation](https://rsbuild.dev/plugins/list/plugin-svelte).
16
16
 
17
17
  ## License
18
18
 
19
- Rsbuild is [MIT licensed](https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE).
19
+ [MIT](https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE).
package/dist/index.cjs CHANGED
@@ -57,7 +57,7 @@ function pluginSvelte(options = {}) {
57
57
  }
58
58
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev, isProd })=>{
59
59
  let svelte5 = await isSvelte5(sveltePath), environmentConfig = environment.config;
60
- !svelte5 && chain.resolve.alias.set('svelte', external_node_path_default().join(sveltePath, 'src/runtime')), chain.resolve.extensions.add('.svelte'), chain.resolve.mainFields.add('svelte').add('...'), chain.resolve.conditionNames.add('svelte').add('...');
60
+ svelte5 || chain.resolve.alias.set('svelte', external_node_path_default().join(sveltePath, 'src/runtime')), chain.resolve.extensions.add('.svelte'), chain.resolve.mainFields.add('svelte').add('...'), chain.resolve.conditionNames.add('svelte').add('...');
61
61
  let loaderPath = src_require.resolve('svelte-loader');
62
62
  chain.merge({
63
63
  resolveLoader: {
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
2
- import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
3
- import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
4
- import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
5
- import * as __WEBPACK_EXTERNAL_MODULE_svelte_preprocess__ from "svelte-preprocess";
6
- let src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(import.meta.url), PLUGIN_SVELTE_NAME = 'rsbuild:svelte', isSvelte5 = async (sveltePath)=>{
1
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_svelte_preprocess_005f2e49__ from "svelte-preprocess";
6
+ let src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__.createRequire)(import.meta.url), PLUGIN_SVELTE_NAME = 'rsbuild:svelte', isSvelte5 = async (sveltePath)=>{
7
7
  try {
8
- let pkgPath = __WEBPACK_EXTERNAL_MODULE_node_path__.default.join(sveltePath, 'package.json'), pkgRaw = await __WEBPACK_EXTERNAL_MODULE_node_fs__.promises.readFile(pkgPath, 'utf-8');
8
+ let pkgPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(sveltePath, 'package.json'), pkgRaw = await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.promises.readFile(pkgPath, 'utf-8');
9
9
  return JSON.parse(pkgRaw).version.startsWith('5.');
10
10
  } catch (err) {
11
11
  return !1;
@@ -17,19 +17,19 @@ function pluginSvelte(options = {}) {
17
17
  setup (api) {
18
18
  let sveltePath = '';
19
19
  try {
20
- sveltePath = __WEBPACK_EXTERNAL_MODULE_node_path__.default.dirname(src_require.resolve('svelte/package.json', {
20
+ sveltePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.dirname(src_require.resolve('svelte/package.json', {
21
21
  paths: [
22
22
  api.context.rootPath
23
23
  ]
24
24
  }));
25
25
  } catch (err) {
26
- throw __WEBPACK_EXTERNAL_MODULE__rsbuild_core__.logger.error('Cannot resolve `svelte` package under the project directory, did you forget to install it?'), Error('[rsbuild:svelte] Failed to resolve `svelte` package', {
26
+ throw __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.error('Cannot resolve `svelte` package under the project directory, did you forget to install it?'), Error('[rsbuild:svelte] Failed to resolve `svelte` package', {
27
27
  cause: err
28
28
  });
29
29
  }
30
30
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev, isProd })=>{
31
31
  let svelte5 = await isSvelte5(sveltePath), environmentConfig = environment.config;
32
- !svelte5 && chain.resolve.alias.set('svelte', __WEBPACK_EXTERNAL_MODULE_node_path__.default.join(sveltePath, 'src/runtime')), chain.resolve.extensions.add('.svelte'), chain.resolve.mainFields.add('svelte').add('...'), chain.resolve.conditionNames.add('svelte').add('...');
32
+ svelte5 || chain.resolve.alias.set('svelte', __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(sveltePath, 'src/runtime')), chain.resolve.extensions.add('.svelte'), chain.resolve.mainFields.add('svelte').add('...'), chain.resolve.conditionNames.add('svelte').add('...');
33
33
  let loaderPath = src_require.resolve('svelte-loader');
34
34
  chain.merge({
35
35
  resolveLoader: {
@@ -39,7 +39,7 @@ function pluginSvelte(options = {}) {
39
39
  }
40
40
  });
41
41
  let userLoaderOptions = options.svelteLoaderOptions ?? {}, svelteLoaderOptions = {
42
- preprocess: (0, __WEBPACK_EXTERNAL_MODULE_svelte_preprocess__.sveltePreprocess)(options.preprocessOptions),
42
+ preprocess: (0, __WEBPACK_EXTERNAL_MODULE_svelte_preprocess_005f2e49__.sveltePreprocess)(options.preprocessOptions),
43
43
  emitCss: isProd && !environmentConfig.output.injectStyles,
44
44
  hotReload: isDev && environmentConfig.dev.hmr,
45
45
  ...userLoaderOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-svelte",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Svelte plugin for Rsbuild",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,11 +26,11 @@
26
26
  "svelte-preprocess": "^6.0.3"
27
27
  },
28
28
  "devDependencies": {
29
- "@rslib/core": "0.1.4",
30
- "@types/node": "^22.10.2",
31
- "svelte": "^5.14.0",
32
- "typescript": "^5.7.2",
33
- "@rsbuild/core": "1.1.11",
29
+ "@rslib/core": "0.4.1",
30
+ "@types/node": "^22.13.4",
31
+ "svelte": "^5.20.1",
32
+ "typescript": "^5.7.3",
33
+ "@rsbuild/core": "1.2.9",
34
34
  "@scripts/test-helper": "1.0.1"
35
35
  },
36
36
  "peerDependencies": {