77 */
88
99import { defineConfig } from "@pandacss/dev" ;
10- import type { ArtifactContent , Artifact , ArtifactId } from "@pandacss/types" ;
1110import preset from "./src" ;
11+ import { dualBuildPlugin } from "./src/plugins/dualBuildPlugin" ;
1212import { forwardCssPropPlugin } from "./src/plugins/forwardCssPropPlugin" ;
1313
1414export default defineConfig ( {
@@ -24,44 +24,5 @@ export default defineConfig({
2424 outdir : "../styled-system/src" ,
2525 jsxFramework : "react" ,
2626 syntax : "object-literal" ,
27- plugins : [ forwardCssPropPlugin ( ) ] ,
28- hooks : {
29- // We need to support both esm and cjs. This allows us to transpile the esm output to cjs. TODO: Remove this once we fully transition to esm.
30- "codegen:prepare" : async ( config ) => {
31- const newArtifacts = config . artifacts . reduce < Artifact [ ] > ( ( acc , artifact ) => {
32- if ( artifact . id === "types-entry" ) {
33- const indexFile = artifact . files . find ( ( f ) => f . file === "index.d.ts" ) ;
34- if ( indexFile ?. code && ! indexFile . code . includes ( "export * from './prop-type'" ) ) {
35- indexFile . code = indexFile . code . concat ( "\nexport * from './prop-type';" ) ;
36- }
37- }
38- const [ regularFiles , typeFiles ] = artifact . files . reduce < [ ArtifactContent [ ] , ArtifactContent [ ] ] > (
39- ( acc , curr ) => {
40- if ( curr . file . endsWith ( "d.ts" ) ) acc [ 1 ] . push ( curr ) ;
41- else acc [ 0 ] . push ( curr ) ;
42-
43- return acc ;
44- } ,
45- [ [ ] , [ ] ] ,
46- ) ;
47-
48- acc . push ( {
49- ...artifact ,
50- files : regularFiles . concat ( typeFiles ) ,
51- } ) ;
52-
53- acc . push ( {
54- id : ( artifact . id + "-types" ) as ArtifactId ,
55- dir : artifact . dir ?. map ( ( path , index ) => ( index === 1 ? path . replace ( "/src" , "/lib" ) : path ) ) ,
56- files : typeFiles ,
57- } ) ;
58-
59- return acc ;
60- } , [ ] ) ;
61-
62- config . artifacts = newArtifacts ;
63-
64- return config . artifacts ;
65- } ,
66- } ,
27+ plugins : [ forwardCssPropPlugin ( ) , dualBuildPlugin ] ,
6728} ) ;
0 commit comments