1- import type { DistPathConfig , RsbuildPlugin , SourceMap } from "@rsbuild/core" ;
2- import type { RslibConfig } from "@rslib/core" ;
1+ import type { Rsbuild , RslibConfig } from "@rslib/core" ;
32import { test , vi } from "vitest" ;
43import type { RslibConfigTransformer } from "../src/applyTransformers.ts" ;
54import { defineBuildConfig } from "../src/build.ts" ;
@@ -83,16 +82,16 @@ test.concurrent("when a dist path is provided, the output.distPath option is the
8382 tsconfigPath : "./build.json"
8483 } ) ;
8584
86- expect ( ( result . output ?. distPath as DistPathConfig ) . js ) . toBe ( "./dist-path" ) ;
85+ expect ( ( result . output ?. distPath as Rsbuild . DistPathConfig ) . js ) . toBe ( "./dist-path" ) ;
8786} ) ;
8887
8988test . concurrent ( "when additional plugins are provided, append the provided plugins at the end of the plugins array" , ( { expect } ) => {
90- const plugin1 : RsbuildPlugin = {
89+ const plugin1 : Rsbuild . RsbuildPlugin = {
9190 name : "plugin-1" ,
9291 setup : ( ) => { }
9392 } ;
9493
95- const plugin2 : RsbuildPlugin = {
94+ const plugin2 : Rsbuild . RsbuildPlugin = {
9695 name : "plugin-2" ,
9796 setup : ( ) => { }
9897 } ;
@@ -121,7 +120,7 @@ test.concurrent("when sourceMap is false, the output.sourceMap option is false",
121120} ) ;
122121
123122test . concurrent ( "when sourceMap is an object, the output.sourceMap option is the object" , ( { expect } ) => {
124- const sourceMap : SourceMap = {
123+ const sourceMap : Rsbuild . SourceMap = {
125124 js : false ,
126125 css : false
127126 } ;
@@ -139,7 +138,7 @@ test.concurrent("when react is false, the react plugin is not included", ({ expe
139138 tsconfigPath : "./build.json"
140139 } ) ;
141140
142- const plugin = result . plugins ?. find ( x => ( x as RsbuildPlugin ) . name === "rsbuild:react" ) ;
141+ const plugin = result . plugins ?. find ( x => ( x as Rsbuild . RsbuildPlugin ) . name === "rsbuild:react" ) ;
143142
144143 expect ( plugin ) . toBeUndefined ( ) ;
145144} ) ;
@@ -150,7 +149,7 @@ test.concurrent("when react is true, the react plugin is included", ({ expect })
150149 tsconfigPath : "./build.json"
151150 } ) ;
152151
153- const plugin = result . plugins ?. find ( x => ( x as RsbuildPlugin ) . name === "rsbuild:react" ) ;
152+ const plugin = result . plugins ?. find ( x => ( x as Rsbuild . RsbuildPlugin ) . name === "rsbuild:react" ) ;
154153
155154 expect ( plugin ) . toBeDefined ( ) ;
156155} ) ;
@@ -171,7 +170,7 @@ test.concurrent("when svgr is false, the svgr plugin is not included", ({ expect
171170 tsconfigPath : "./build.json"
172171 } ) ;
173172
174- const plugin = result . plugins ?. find ( x => ( x as RsbuildPlugin ) . name === "rsbuild:svgr" ) ;
173+ const plugin = result . plugins ?. find ( x => ( x as Rsbuild . RsbuildPlugin ) . name === "rsbuild:svgr" ) ;
175174
176175 expect ( plugin ) . toBeUndefined ( ) ;
177176} ) ;
@@ -182,7 +181,7 @@ test.concurrent("when svgr is true, the svgr plugin is included", ({ expect }) =
182181 tsconfigPath : "./build.json"
183182 } ) ;
184183
185- const plugin = result . plugins ?. find ( x => ( x as RsbuildPlugin ) . name === "rsbuild:svgr" ) ;
184+ const plugin = result . plugins ?. find ( x => ( x as Rsbuild . RsbuildPlugin ) . name === "rsbuild:svgr" ) ;
186185
187186 expect ( plugin ) . toBeDefined ( ) ;
188187} ) ;
@@ -249,7 +248,7 @@ test.concurrent("when multiple transformers are provided, all the transformers a
249248 const distPathTransformer : RslibConfigTransformer = ( config : RslibConfig ) => {
250249 config . output = config . output ?? { } ;
251250 config . output . distPath = config . output . distPath ?? { } ;
252- ( config . output . distPath as DistPathConfig ) . js = "a-custom-dist-path-in-a-tranformer" ;
251+ ( config . output . distPath as Rsbuild . DistPathConfig ) . js = "a-custom-dist-path-in-a-tranformer" ;
253252
254253 return config ;
255254 } ;
@@ -260,7 +259,7 @@ test.concurrent("when multiple transformers are provided, all the transformers a
260259 } ) ;
261260
262261 expect ( result . source ! . entry ! . index ) . toBe ( "a-custom-value-in-a-transformer" ) ;
263- expect ( ( result . output ! . distPath as DistPathConfig ) . js ) . toBe ( "a-custom-dist-path-in-a-tranformer" ) ;
262+ expect ( ( result . output ! . distPath as Rsbuild . DistPathConfig ) . js ) . toBe ( "a-custom-dist-path-in-a-tranformer" ) ;
264263} ) ;
265264
266265test . concurrent ( "transformers context environment is \"build\"" , ( { expect } ) => {
0 commit comments