@@ -269,7 +269,7 @@ fn indent_multiline(s: &str, spaces: usize) -> String {
269269/// Merge tsdown config into vite.config.ts by importing it
270270///
271271/// This function adds an import statement for the tsdown config file
272- /// and adds `lib : tsdownConfig` to the defineConfig.
272+ /// and adds `pack : tsdownConfig` to the defineConfig.
273273///
274274/// # Arguments
275275///
@@ -291,7 +291,7 @@ pub fn merge_tsdown_config(
291291///
292292/// This adds:
293293/// 1. An import statement: `import tsdownConfig from './tsdown.config.ts'`
294- /// 2. The lib config in defineConfig: `lib : tsdownConfig`
294+ /// 2. The pack config in defineConfig: `pack : tsdownConfig`
295295///
296296/// This function is idempotent - running it multiple times will not create duplicates.
297297fn merge_tsdown_config_content (
@@ -324,9 +324,9 @@ fn merge_tsdown_config_content(
324324 let content_with_import =
325325 format ! ( "import tsdownConfig from '{import_path}';\n \n {vite_config_content}" ) ;
326326
327- // Step 2: Add lib : tsdownConfig to defineConfig
328- let lib_rule = generate_merge_rule ( "tsdownConfig" , "lib " ) ;
329- let ( final_content, _) = ast_grep:: apply_rules ( & content_with_import, & lib_rule ) ?;
327+ // Step 2: Add pack : tsdownConfig to defineConfig
328+ let pack_rule = generate_merge_rule ( "tsdownConfig" , "pack " ) ;
329+ let ( final_content, _) = ast_grep:: apply_rules ( & content_with_import, & pack_rule ) ?;
330330
331331 Ok ( MergeResult { content : final_content, updated : true , uses_function_callback } )
332332}
@@ -966,7 +966,7 @@ export default defineConfig({
966966import { defineConfig } from 'vite-plus';
967967
968968export default defineConfig({
969- lib : tsdownConfig,
969+ pack : tsdownConfig,
970970 plugins: [],
971971});"#
972972 ) ;
@@ -992,7 +992,7 @@ import { defineConfig } from 'vite-plus';
992992import react from '@vitejs/plugin-react';
993993
994994export default defineConfig({
995- lib : tsdownConfig,
995+ pack : tsdownConfig,
996996 plugins: [react()],
997997});"#
998998 ) ;
@@ -1016,7 +1016,7 @@ export default defineConfig((env) => ({
10161016import { defineConfig } from 'vite-plus';
10171017
10181018export default defineConfig((env) => ({
1019- lib : tsdownConfig,
1019+ pack : tsdownConfig,
10201020 plugins: [],
10211021}));"#
10221022 ) ;
@@ -1030,7 +1030,7 @@ export default defineConfig((env) => ({
10301030import { defineConfig } from 'vite-plus';
10311031
10321032export default defineConfig({
1033- lib : tsdownConfig,
1033+ pack : tsdownConfig,
10341034 plugins: [],
10351035});"# ;
10361036
@@ -1050,7 +1050,7 @@ export default defineConfig({
10501050import { defineConfig } from 'vite-plus';
10511051
10521052export default defineConfig({
1053- lib : tsdownConfig,
1053+ pack : tsdownConfig,
10541054 plugins: [],
10551055});"# ;
10561056
@@ -1080,15 +1080,15 @@ export default defineConfig({
10801080 r#"import tsdownConfig from './tsdown.config.js';
10811081
10821082export default {
1083- lib : tsdownConfig,
1083+ pack : tsdownConfig,
10841084 server: { port: 3000 }
10851085}"#
10861086 ) ;
10871087 }
10881088
10891089 #[ test]
10901090 fn test_merge_tsdown_config_content_no_false_positive_stdlib ( ) {
1091- // "stdlib:" should not be detected as "lib :" key
1091+ // "stdlib:" should not be detected as "pack :" key
10921092 let vite_config = r#"import { defineConfig } from 'vite-plus';
10931093
10941094export default defineConfig({
@@ -1098,7 +1098,7 @@ export default defineConfig({
10981098 let result = merge_tsdown_config_content ( vite_config, "./tsdown.config.ts" ) . unwrap ( ) ;
10991099 assert ! ( result. updated) ;
11001100 assert ! ( result. content. contains( "import tsdownConfig from './tsdown.config.js'" ) ) ;
1101- assert ! ( result. content. contains( "lib : tsdownConfig" ) ) ;
1101+ assert ! ( result. content. contains( "pack : tsdownConfig" ) ) ;
11021102 assert ! ( result. content. contains( "stdlib: 'some-value'" ) ) ;
11031103 }
11041104
0 commit comments