@rsbuild/plugin-svgr 2.0.2 → 2.0.3
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 +17 -20
- package/package.json +4 -4
- package/dist/assetLoader.d.ts +0 -13
- package/dist/loader.d.ts +0 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import type { RsbuildPlugin, Rspack } from '@rsbuild/core';
|
|
2
2
|
import type { Config as BaseSvgrOptions } from '@svgr/core';
|
|
3
3
|
import type { Config as SvgoConfig } from 'svgo';
|
|
4
|
+
// @svgr/core does not have the svgo dependency, so we need to
|
|
5
|
+
// manually specify the svgoConfig type
|
|
4
6
|
type SvgrOptions = Omit<BaseSvgrOptions, 'svgoConfig'> & {
|
|
5
7
|
svgoConfig?: SvgoConfig;
|
|
6
8
|
};
|
|
7
9
|
export type SvgDefaultExport = 'component' | 'url';
|
|
8
10
|
export type PluginSvgrOptions = {
|
|
9
11
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
svgrOptions?: SvgrOptions;
|
|
12
|
+
* Configure SVGR options.
|
|
13
|
+
* @see https://react-svgr.com/docs/options/
|
|
14
|
+
*/ svgrOptions?: SvgrOptions;
|
|
14
15
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
mixedImport?: boolean;
|
|
16
|
+
* Whether to allow the use of default import and named import at the same time.
|
|
17
|
+
* @default false
|
|
18
|
+
*/ mixedImport?: boolean;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
query?: RegExp;
|
|
20
|
+
* Custom query suffix to match SVGR transformation.
|
|
21
|
+
* @default /react/
|
|
22
|
+
*/ query?: RegExp;
|
|
24
23
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
exclude?: Rspack.RuleSetCondition;
|
|
24
|
+
* Exclude specific SVG files from SVGR transformation.
|
|
25
|
+
*/ exclude?: Rspack.RuleSetCondition;
|
|
28
26
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
excludeImporter?: Rspack.RuleSetCondition;
|
|
27
|
+
* Exclude some modules, the SVGs imported by these modules will not be transformed by SVGR.
|
|
28
|
+
*/ excludeImporter?: Rspack.RuleSetCondition;
|
|
32
29
|
};
|
|
33
|
-
export declare const PLUGIN_SVGR_NAME =
|
|
30
|
+
export declare const PLUGIN_SVGR_NAME = 'rsbuild:svgr';
|
|
34
31
|
export declare const pluginSvgr: (options?: PluginSvgrOptions) => RsbuildPlugin;
|
|
35
|
-
export {};
|
|
32
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-svgr",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "SVGR plugin for Rsbuild",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rsbuild/core-v1": "npm:@rsbuild/core@^1.7.5",
|
|
32
|
-
"@rslib/core": "0.
|
|
33
|
-
"@types/node": "^24.12.
|
|
32
|
+
"@rslib/core": "0.22.0",
|
|
33
|
+
"@types/node": "^24.12.4",
|
|
34
34
|
"svgo": "^3.3.3",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
|
-
"@rsbuild/core": "2.0.
|
|
36
|
+
"@rsbuild/core": "2.0.9",
|
|
37
37
|
"@scripts/test-helper": "1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
package/dist/assetLoader.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
|
-
import type { Rspack } from '@rsbuild/core';
|
|
3
|
-
type FilenameTemplate = string | ((resourcePath: string, resourceQuery?: string) => string);
|
|
4
|
-
export type SvgAssetLoaderOptions = {
|
|
5
|
-
limit: number;
|
|
6
|
-
name: FilenameTemplate;
|
|
7
|
-
publicPath?: string | ((url: string, resourcePath: string, context: string) => string);
|
|
8
|
-
};
|
|
9
|
-
type RawLoaderDefinition<OptionsType = {}> = ((this: Rspack.LoaderContext<OptionsType>, content: Buffer | string) => string | Buffer | void | Promise<string | Buffer | void>) & {
|
|
10
|
-
raw: true;
|
|
11
|
-
};
|
|
12
|
-
declare const assetLoader: RawLoaderDefinition<SvgAssetLoaderOptions>;
|
|
13
|
-
export default assetLoader;
|
package/dist/loader.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017, Smooth Code
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
* modified from https://github.com/gregberge/svgr/blob/7595d378b73d4826a4cead165b3f32386b07315b/packages/webpack/src/index.ts
|
|
7
|
-
*/
|
|
8
|
-
import type { Rspack } from '@rsbuild/core';
|
|
9
|
-
import { type Config } from '@svgr/core';
|
|
10
|
-
declare const svgrLoader: Rspack.LoaderDefinition<Config>;
|
|
11
|
-
export default svgrLoader;
|