@pandacss/generator 0.13.0 → 0.13.1

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.js CHANGED
@@ -555,7 +555,7 @@ function generateConditions(ctx) {
555
555
  }
556
556
  `,
557
557
  dts: import_outdent2.default`
558
- import type { AnySelector, Selectors } from './selectors'
558
+ ${ctx.file.importType("AnySelector, Selectors", "./selectors")}
559
559
 
560
560
  export type Conditions = {
561
561
  ${keys.map((key) => ` ${JSON.stringify(key)}: string`).join("\n")}
@@ -626,7 +626,7 @@ function generateCssFn(ctx) {
626
626
  const { separator, getPropShorthands } = utility;
627
627
  return {
628
628
  dts: import_outdent4.outdent`
629
- import type { SystemStyleObject } from '../types'
629
+ ${ctx.file.importType("SystemStyleObject", "../types/index")}
630
630
 
631
631
  interface CssFunction {
632
632
  (...styles: SystemStyleObject[]): string
@@ -822,12 +822,11 @@ function generateCvaFn(ctx) {
822
822
 
823
823
  `,
824
824
  dts: import_outdent6.outdent`
825
- import type { RecipeCreatorFn } from '../types/recipe'
825
+ ${ctx.file.importType("RecipeCreatorFn", "../types/recipe")}
826
826
 
827
827
  export declare const cva: RecipeCreatorFn
828
828
 
829
- export type { RecipeVariantProps } from '../types/recipe'
830
-
829
+ ${ctx.file.exportType("RecipeVariantProps", "../types/recipe")}
831
830
  `
832
831
  };
833
832
  }
@@ -957,11 +956,11 @@ function generatePattern(ctx) {
957
956
  return {
958
957
  name: dashName,
959
958
  dts: import_outdent10.outdent`
960
- import type { SystemStyleObject, ConditionalValue } from '../types'
961
- import type { Properties } from '../types/csstype'
962
- import type { PropertyValue } from '../types/prop-type'
963
- import type { DistributiveOmit } from '../types/system-types'
964
- import type { Tokens } from '../tokens'
959
+ ${ctx.file.importType("SystemStyleObject, ConditionalValue", "../types/index")}
960
+ ${ctx.file.importType("Properties", "../types/csstype")}
961
+ ${ctx.file.importType("PropertyValue", "../types/prop-type")}
962
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
963
+ ${ctx.file.importType("Tokens", "../tokens/index")}
965
964
 
966
965
  export type ${upperName}Properties = {
967
966
  ${Object.keys(properties ?? {}).map((key) => {
@@ -1128,9 +1127,9 @@ function generateRecipes(ctx) {
1128
1127
  name: dashName,
1129
1128
  js: jsCode,
1130
1129
  dts: import_outdent11.outdent`
1131
- import type { ConditionalValue } from '../types'
1132
- import type { Pretty } from '../types/helpers'
1133
- import type { DistributiveOmit } from '../types/system-types'
1130
+ ${ctx.file.importType("ConditionalValue", "../types/index")}
1131
+ ${ctx.file.importType("Pretty", "../types/helpers")}
1132
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
1134
1133
 
1135
1134
  type ${upperName}Variant = {
1136
1135
  ${Object.keys(variantKeyMap).map((key) => {
@@ -1202,7 +1201,7 @@ function generateSvaFn(ctx) {
1202
1201
  }
1203
1202
  `,
1204
1203
  dts: import_outdent12.outdent`
1205
- import type { SlotRecipeCreatorFn } from '../types/recipe'
1204
+ ${ctx.file.importType("SlotRecipeCreatorFn", "../types/recipe")}
1206
1205
 
1207
1206
  export declare const sva: SlotRecipeCreatorFn
1208
1207
  `
@@ -1235,14 +1234,14 @@ function generateTokenJs(ctx) {
1235
1234
  token.var = tokenVar
1236
1235
  `,
1237
1236
  dts: import_outdent13.default`
1238
- import type { Token } from './tokens'
1237
+ ${ctx.file.importType("Token", "./tokens")}
1239
1238
 
1240
1239
  export declare const token: {
1241
1240
  (path: Token, fallback?: string): string
1242
1241
  var: (path: Token, fallback?: string) => string
1243
1242
  }
1244
1243
 
1245
- export * from './tokens'
1244
+ ${ctx.file.exportTypeStar("./tokens")}
1246
1245
  `
1247
1246
  };
1248
1247
  }
@@ -1256,7 +1255,7 @@ function generatePreactJsxFactory(ctx) {
1256
1255
  import { h } from 'preact'
1257
1256
  import { forwardRef } from 'preact/compat'
1258
1257
  import { useMemo } from 'preact/hooks'
1259
- ${ctx.file.import("css, cx, assignCss", "../css/index")}
1258
+ ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1260
1259
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1261
1260
  ${ctx.file.import("isCssProperty", "./is-valid-prop")}
1262
1261
 
@@ -1352,9 +1351,9 @@ function generatePreactJsxPattern(ctx) {
1352
1351
  `,
1353
1352
  dts: import_outdent15.outdent`
1354
1353
  import type { FunctionComponent } from 'preact'
1355
- import type { ${upperName}Properties } from '../patterns/${dashName}'
1356
- import type { ${typeName} } from '../types/jsx'
1357
- import type { DistributiveOmit } from '../types/system-types'
1354
+ ${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
1355
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
1356
+ ${ctx.file.importType(typeName, "../types/jsx")}
1358
1357
 
1359
1358
  export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1360
1359
 
@@ -1376,8 +1375,8 @@ export declare const ${factoryName}: ${upperName}
1376
1375
  `,
1377
1376
  jsxType: import_outdent16.outdent`
1378
1377
  import type { ComponentProps, JSX } from 'preact'
1379
- import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1380
- import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1378
+ ${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
1379
+ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
1381
1380
 
1382
1381
  type ElementType = keyof JSX.IntrinsicElements
1383
1382
 
@@ -1464,7 +1463,7 @@ function generatePreactJsxStringLiteralTypes(ctx) {
1464
1463
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
1465
1464
  return {
1466
1465
  jsxFactory: import_outdent18.outdent`
1467
- import type { ${upperName} } from '../types/jsx'
1466
+ ${ctx.file.importType(upperName, "../types/jsx")}
1468
1467
  export declare const ${factoryName}: ${upperName}
1469
1468
  `,
1470
1469
  jsxType: import_outdent18.outdent`
@@ -1593,9 +1592,9 @@ function generateQwikJsxPattern(ctx) {
1593
1592
  `,
1594
1593
  dts: import_outdent20.outdent`
1595
1594
  import type { Component } from '@builder.io/qwik'
1596
- import type { ${upperName}Properties } from '../patterns/${dashName}'
1597
- import type { ${typeName} } from '../types/jsx'
1598
- import type { Assign, DistributiveOmit } from '../types/system-types'
1595
+ ${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
1596
+ ${ctx.file.importType(typeName, "../types/jsx")}
1597
+ ${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
1599
1598
 
1600
1599
  export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>>
1601
1600
 
@@ -1612,7 +1611,7 @@ function generateQwikJsxTypes(ctx) {
1612
1611
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
1613
1612
  return {
1614
1613
  jsxFactory: import_outdent21.outdent`
1615
- import { ${upperName} } from '../types/jsx'
1614
+ ${ctx.file.importType(upperName, "../types/jsx")}
1616
1615
  export declare const ${factoryName}: ${upperName}
1617
1616
  `,
1618
1617
  jsxType: import_outdent21.outdent`
@@ -1707,7 +1706,7 @@ function generateQwikJsxStringLiteralTypes(ctx) {
1707
1706
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
1708
1707
  return {
1709
1708
  jsxFactory: import_outdent23.outdent`
1710
- import { ${upperName} } from '../types/jsx'
1709
+ ${ctx.file.importType(upperName, "../types/jsx")}
1711
1710
  export declare const ${factoryName}: ${upperName}
1712
1711
  `,
1713
1712
  jsxType: import_outdent23.outdent`
@@ -1878,9 +1877,9 @@ function generateReactJsxPattern(ctx) {
1878
1877
  `,
1879
1878
  dts: import_outdent25.outdent`
1880
1879
  import type { FunctionComponent } from 'react'
1881
- import type { ${upperName}Properties } from '../patterns/${dashName}'
1882
- import type { ${typeName} } from '../types/jsx'
1883
- import type { DistributiveOmit } from '../types/system-types'
1880
+ ${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
1881
+ ${ctx.file.importType(typeName, "../types/jsx")}
1882
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
1884
1883
 
1885
1884
  export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1886
1885
 
@@ -1897,13 +1896,13 @@ function generateReactJsxTypes(ctx) {
1897
1896
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
1898
1897
  return {
1899
1898
  jsxFactory: import_outdent26.outdent`
1900
- import { ${upperName} } from '../types/jsx'
1899
+ ${ctx.file.importType(upperName, "../types/jsx")}
1901
1900
  export declare const ${factoryName}: ${upperName}
1902
1901
  `,
1903
1902
  jsxType: import_outdent26.outdent`
1904
1903
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1905
- import type { Assign, DistributiveOmit, JsxStyleProps, JsxHTMLProps } from './system-types'
1906
- import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1904
+ ${ctx.file.importType("Assign, DistributiveOmit, JsxHTMLProps, JsxStyleProps", "./system-types")}
1905
+ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
1907
1906
 
1908
1907
  type Dict = Record<string, unknown>
1909
1908
 
@@ -1992,12 +1991,12 @@ function generateReactJsxStringLiteralTypes(ctx) {
1992
1991
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
1993
1992
  return {
1994
1993
  jsxFactory: import_outdent28.outdent`
1995
- import { ${upperName} } from '../types/jsx'
1994
+ ${ctx.file.importType(upperName, "../types/jsx")}
1996
1995
  export declare const ${factoryName}: ${upperName}
1997
1996
  `,
1998
1997
  jsxType: import_outdent28.outdent`
1999
1998
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
2000
- import type { DistributiveOmit } from '../types/system-types'
1999
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
2001
2000
 
2002
2001
  type Dict = Record<string, unknown>
2003
2002
 
@@ -2137,10 +2136,10 @@ function generateSolidJsxPattern(ctx) {
2137
2136
  }
2138
2137
  `,
2139
2138
  dts: import_outdent30.outdent`
2140
- import { Component } from 'solid-js'
2141
- import { ${upperName}Properties } from '../patterns/${dashName}'
2142
- import { ${typeName} } from '../types/jsx'
2143
- import { DistributiveOmit } from '../types/system-types'
2139
+ import type { Component } from 'solid-js'
2140
+ ${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
2141
+ ${ctx.file.importType(typeName, "../types/jsx")}
2142
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
2144
2143
 
2145
2144
  export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2146
2145
 
@@ -2157,13 +2156,13 @@ function generateSolidJsxTypes(ctx) {
2157
2156
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
2158
2157
  return {
2159
2158
  jsxFactory: import_outdent31.outdent`
2160
- import type { ${upperName} } from '../types/jsx'
2159
+ ${ctx.file.importType(upperName, "../types/jsx")}
2161
2160
  export declare const ${factoryName}: ${upperName}
2162
2161
  `,
2163
2162
  jsxType: import_outdent31.outdent`
2164
2163
  import type { ComponentProps, Component, JSX } from 'solid-js'
2165
- import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
2166
- import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
2164
+ ${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
2165
+ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
2167
2166
 
2168
2167
  type Dict = Record<string, unknown>
2169
2168
 
@@ -2256,7 +2255,7 @@ function generateSolidJsxStringLiteralTypes(ctx) {
2256
2255
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
2257
2256
  return {
2258
2257
  jsxFactory: import_outdent33.outdent`
2259
- import type { ${upperName} } from '../types/jsx'
2258
+ ${ctx.file.importType(upperName, "../types/jsx")}
2260
2259
  export declare const ${factoryName}: ${upperName}
2261
2260
  `,
2262
2261
  jsxType: import_outdent33.outdent`
@@ -2445,10 +2444,10 @@ function generateVueJsxPattern(ctx) {
2445
2444
  })
2446
2445
  `,
2447
2446
  dts: import_outdent36.outdent`
2448
- import { FunctionalComponent } from 'vue'
2449
- import { ${upperName}Properties } from '../patterns/${dashName}'
2450
- import { ${typeName} } from '../types/jsx'
2451
- import { DistributiveOmit } from '../types/system-types'
2447
+ import type { FunctionalComponent } from 'vue'
2448
+ ${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
2449
+ ${ctx.file.importType(typeName, "../types/jsx")}
2450
+ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
2452
2451
 
2453
2452
  export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2454
2453
 
@@ -2465,13 +2464,15 @@ function generateVueJsxTypes(ctx) {
2465
2464
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
2466
2465
  return {
2467
2466
  jsxFactory: import_outdent37.outdent`
2468
- import { ${upperName} } from '../types/jsx'
2467
+ ${ctx.file.importType(upperName, "../types/jsx")}
2468
+
2469
2469
  export declare const ${factoryName}: ${upperName}
2470
2470
  `,
2471
2471
  jsxType: import_outdent37.outdent`
2472
2472
  import type { Component, FunctionalComponent } from 'vue'
2473
- import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
2474
- import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
2473
+
2474
+ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
2475
+ ${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
2475
2476
 
2476
2477
  type IntrinsicElement =
2477
2478
  | 'a'
@@ -2630,7 +2631,8 @@ function generateVueJsxStringLiteralTypes(ctx) {
2630
2631
  const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
2631
2632
  return {
2632
2633
  jsxFactory: import_outdent38.outdent`
2633
- import { ${upperName} } from '../types/jsx'
2634
+ ${ctx.file.importType(upperName, "../types/jsx")}
2635
+
2634
2636
  export declare const ${factoryName}: ${upperName}
2635
2637
  `,
2636
2638
  jsxType: import_outdent38.outdent`
@@ -2838,7 +2840,7 @@ function generateJsxPatterns(ctx) {
2838
2840
  // src/artifacts/pkg-json.ts
2839
2841
  function generatePackageJson(ctx) {
2840
2842
  const {
2841
- config: { outdir, outExtension: ext = "mjs" }
2843
+ config: { outdir }
2842
2844
  } = ctx;
2843
2845
  const pkg = {
2844
2846
  name: outdir,
@@ -2847,32 +2849,32 @@ function generatePackageJson(ctx) {
2847
2849
  type: "module",
2848
2850
  exports: {
2849
2851
  "./css": {
2850
- types: "./css/index.d.ts",
2851
- require: `./css/index.${ext}`,
2852
- import: `./css/index.${ext}`
2852
+ types: ctx.file.extDts("./css/index"),
2853
+ require: ctx.file.ext(`./css/index`),
2854
+ import: ctx.file.ext(`./css/index`)
2853
2855
  },
2854
2856
  "./jsx": {
2855
- types: "./jsx/index.d.ts",
2856
- require: `./jsx/index.${ext}`,
2857
- import: `./jsx/index.${ext}`
2857
+ types: ctx.file.extDts("./jsx/index"),
2858
+ require: ctx.file.ext(`./jsx/index`),
2859
+ import: ctx.file.ext(`./jsx/index`)
2858
2860
  },
2859
2861
  "./patterns": {
2860
- types: "./patterns/index.d.ts",
2861
- require: `./patterns/index.${ext}`,
2862
- import: `./patterns/index.${ext}`
2862
+ types: ctx.file.extDts("./patterns/index"),
2863
+ require: ctx.file.ext(`./patterns/index`),
2864
+ import: ctx.file.ext(`./patterns/index`)
2863
2865
  },
2864
2866
  "./recipes": {
2865
- types: "./recipes/index.d.ts",
2866
- require: `./recipes/index.${ext}`,
2867
- import: `./recipes/index.${ext}`
2867
+ types: ctx.file.extDts("./recipes/index"),
2868
+ require: ctx.file.ext(`./recipes/index`),
2869
+ import: ctx.file.ext(`./recipes/index`)
2868
2870
  },
2869
2871
  "./tokens": {
2870
- types: "./tokens/index.d.ts",
2871
- require: `./tokens/index.${ext}`,
2872
- import: `./tokens/index.${ext}`
2872
+ types: ctx.file.extDts("./tokens/index"),
2873
+ require: ctx.file.ext(`./tokens/index`),
2874
+ import: ctx.file.ext(`./tokens/index`)
2873
2875
  },
2874
2876
  "./types": {
2875
- types: "./types/index.d.ts"
2877
+ types: ctx.file.extDts("./types/index")
2876
2878
  },
2877
2879
  "./styles.css": "./styles.css"
2878
2880
  }
@@ -2919,27 +2921,31 @@ var selectors_d_ts_default = {
2919
2921
  var import_ts_pattern9 = require("ts-pattern");
2920
2922
  var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
2921
2923
  function getGeneratedTypes(ctx) {
2924
+ const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
2922
2925
  return {
2923
2926
  cssType: csstype_d_ts_default.content,
2924
- recipe: recipe_d_ts_default.content,
2925
- pattern: pattern_d_ts_default.content,
2926
- parts: parts_d_ts_default.content,
2927
- composition: composition_d_ts_default.content,
2928
- selectors: selectors_d_ts_default.content,
2929
- system: (0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with("minimal", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = WithCss")).with("none", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = {}")).exhaustive()
2927
+ recipe: rewriteImports(recipe_d_ts_default.content),
2928
+ pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
2929
+ parts: rewriteImports(parts_d_ts_default.content),
2930
+ composition: rewriteImports(composition_d_ts_default.content),
2931
+ selectors: rewriteImports(selectors_d_ts_default.content),
2932
+ system: rewriteImports(
2933
+ (0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with("minimal", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = WithCss")).with("none", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = {}")).exhaustive()
2934
+ )
2930
2935
  };
2931
2936
  }
2932
2937
 
2933
2938
  // src/artifacts/types/main.ts
2934
2939
  var import_outdent39 = require("outdent");
2935
- var generateTypesEntry = () => ({
2940
+ var generateTypesEntry = (ctx) => ({
2936
2941
  global: import_outdent39.outdent`
2942
+ // @ts-nocheck
2937
2943
  import type { TextStyles, LayerStyles } from '@pandacss/dev'
2938
- import type { RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig } from './recipe'
2939
- import type { Parts } from './parts'
2940
- import type { PatternConfig, PatternProperties } from './pattern'
2941
- import type { GlobalStyleObject, SystemStyleObject } from './system-types'
2942
- import type { CompositionStyles } from './composition'
2944
+ ${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
2945
+ ${ctx.file.importType("Parts", "./parts")}
2946
+ ${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
2947
+ ${ctx.file.importType("GlobalStyleObject, SystemStyleObject", "./system-types")}
2948
+ ${ctx.file.importType("CompositionStyles", "./composition")}
2943
2949
 
2944
2950
  declare module '@pandacss/dev' {
2945
2951
  export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
@@ -2953,9 +2959,9 @@ var generateTypesEntry = () => ({
2953
2959
  }
2954
2960
  `,
2955
2961
  index: import_outdent39.outdent`
2956
- import './global'
2957
- export type { ConditionalValue } from './conditions'
2958
- export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
2962
+ import '${ctx.file.extDts("./global")}'
2963
+ ${ctx.file.exportType("ConditionalValue", "./conditions")}
2964
+ ${ctx.file.exportType("GlobalStyleObject, JsxStyleProps, SystemStyleObject", "./system-types")}
2959
2965
 
2960
2966
  `,
2961
2967
  helpers: import_outdent39.outdent`
@@ -2973,9 +2979,9 @@ function generatePropTypes(ctx) {
2973
2979
  const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
2974
2980
  const result = [
2975
2981
  import_outdent40.outdent`
2976
- import type { ConditionalValue } from './conditions';
2977
- import type { CssProperties } from './system-types'
2978
- import type { Tokens } from '../tokens'
2982
+ ${ctx.file.importType("ConditionalValue", "./conditions")}
2983
+ ${ctx.file.importType("CssProperties", "./system-types")}
2984
+ ${ctx.file.importType("Tokens", "../tokens/index")}
2979
2985
 
2980
2986
  type PropertyValueTypes = {`
2981
2987
  ];
@@ -3012,9 +3018,9 @@ var import_outdent41 = __toESM(require("outdent"));
3012
3018
  function generateStyleProps(ctx) {
3013
3019
  const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()).filter(Boolean));
3014
3020
  return import_outdent41.default`
3015
- import type { ConditionalValue } from './conditions'
3016
- import type { PropertyValue } from './prop-type'
3017
- import type { Token } from '../tokens'
3021
+ ${ctx.file.importType("ConditionalValue", "./conditions")}
3022
+ ${ctx.file.importType("PropertyValue", "./prop-type")}
3023
+ ${ctx.file.importType("Token", "../tokens/index")}
3018
3024
 
3019
3025
  export type CssVarProperties = {
3020
3026
  [key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
@@ -3105,9 +3111,9 @@ function setupDesignTokens(ctx) {
3105
3111
  dir: ctx.paths.token,
3106
3112
  files: [
3107
3113
  { file: "index.css", code: css2 },
3108
- { file: "index.d.ts", code: code.dts },
3114
+ { file: ctx.file.extDts("index"), code: code.dts },
3109
3115
  { file: ctx.file.ext("index"), code: code.js },
3110
- { file: "tokens.d.ts", code: generateTokenTypes(ctx) }
3116
+ { file: ctx.file.extDts("tokens"), code: generateTokenTypes(ctx) }
3111
3117
  ]
3112
3118
  };
3113
3119
  }
@@ -3115,24 +3121,24 @@ function setupTypes(ctx) {
3115
3121
  const gen = getGeneratedTypes(ctx);
3116
3122
  const conditions = generateConditions(ctx);
3117
3123
  const jsx = generateJsxTypes(ctx);
3118
- const entry = generateTypesEntry();
3124
+ const entry = generateTypesEntry(ctx);
3119
3125
  return {
3120
3126
  dir: ctx.paths.types,
3121
3127
  files: [
3122
- jsx ? { file: "jsx.d.ts", code: jsx.jsxType } : null,
3123
- { file: "csstype.d.ts", code: gen.cssType },
3124
- { file: "system-types.d.ts", code: gen.system },
3125
- { file: "selectors.d.ts", code: gen.selectors },
3126
- { file: "composition.d.ts", code: gen.composition },
3127
- { file: "global.d.ts", code: entry.global },
3128
- { file: "helpers.d.ts", code: entry.helpers },
3129
- { file: "recipe.d.ts", code: gen.recipe },
3130
- { file: "pattern.d.ts", code: gen.pattern },
3131
- { file: "parts.d.ts", code: gen.parts },
3132
- { file: "index.d.ts", code: entry.index },
3133
- { file: "prop-type.d.ts", code: generatePropTypes(ctx) },
3134
- { file: "style-props.d.ts", code: generateStyleProps(ctx) },
3135
- { file: "conditions.d.ts", code: conditions.dts }
3128
+ jsx ? { file: ctx.file.extDts("jsx"), code: jsx.jsxType } : null,
3129
+ { file: ctx.file.extDts("csstype"), code: gen.cssType },
3130
+ { file: ctx.file.extDts("system-types"), code: gen.system },
3131
+ { file: ctx.file.extDts("selectors"), code: gen.selectors },
3132
+ { file: ctx.file.extDts("composition"), code: gen.composition },
3133
+ { file: ctx.file.extDts("global"), code: entry.global },
3134
+ { file: ctx.file.extDts("helpers"), code: entry.helpers },
3135
+ { file: ctx.file.extDts("recipe"), code: gen.recipe },
3136
+ { file: ctx.file.extDts("pattern"), code: gen.pattern },
3137
+ { file: ctx.file.extDts("parts"), code: gen.parts },
3138
+ { file: ctx.file.extDts("index"), code: entry.index },
3139
+ { file: ctx.file.extDts("prop-type"), code: generatePropTypes(ctx) },
3140
+ { file: ctx.file.extDts("style-props"), code: generateStyleProps(ctx) },
3141
+ { file: ctx.file.extDts("conditions"), code: conditions.dts }
3136
3142
  ].filter(Boolean)
3137
3143
  };
3138
3144
  }
@@ -3144,7 +3150,7 @@ function setupCss(ctx) {
3144
3150
  files: [
3145
3151
  { file: ctx.file.ext("conditions"), code: conditions.js },
3146
3152
  { file: ctx.file.ext("css"), code: code.js },
3147
- { file: "css.d.ts", code: code.dts }
3153
+ { file: ctx.file.extDts("css"), code: code.dts }
3148
3154
  ]
3149
3155
  };
3150
3156
  }
@@ -3156,7 +3162,7 @@ function setupCva(ctx) {
3156
3162
  dir: ctx.paths.css,
3157
3163
  files: [
3158
3164
  { file: ctx.file.ext("cva"), code: code.js },
3159
- { file: "cva.d.ts", code: code.dts }
3165
+ { file: ctx.file.extDts("cva"), code: code.dts }
3160
3166
  ]
3161
3167
  };
3162
3168
  }
@@ -3168,7 +3174,7 @@ function setupSva(ctx) {
3168
3174
  dir: ctx.paths.css,
3169
3175
  files: [
3170
3176
  { file: ctx.file.ext("sva"), code: code.js },
3171
- { file: "sva.d.ts", code: code.dts }
3177
+ { file: ctx.file.extDts("sva"), code: code.dts }
3172
3178
  ]
3173
3179
  };
3174
3180
  }
@@ -3178,7 +3184,7 @@ function setupCx(ctx) {
3178
3184
  dir: ctx.paths.css,
3179
3185
  files: [
3180
3186
  { file: ctx.file.ext("cx"), code: code.js },
3181
- { file: "cx.d.ts", code: code.dts }
3187
+ { file: ctx.file.extDts("cx"), code: code.dts }
3182
3188
  ]
3183
3189
  };
3184
3190
  }
@@ -3188,16 +3194,16 @@ function setupRecipes(ctx) {
3188
3194
  return;
3189
3195
  const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
3190
3196
  const index = {
3191
- js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
3192
- dts: import_outdent43.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
3197
+ js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
3198
+ dts: import_outdent43.default.string(indexFiles.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
3193
3199
  };
3194
3200
  return {
3195
3201
  dir: ctx.paths.recipe,
3196
3202
  files: [
3197
3203
  ...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
3198
- ...files.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
3204
+ ...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
3199
3205
  { file: ctx.file.ext("index"), code: index.js },
3200
- { file: "index.d.ts", code: index.dts }
3206
+ { file: ctx.file.extDts("index"), code: index.dts }
3201
3207
  ]
3202
3208
  };
3203
3209
  }
@@ -3208,16 +3214,16 @@ function setupPatterns(ctx) {
3208
3214
  if (!files)
3209
3215
  return;
3210
3216
  const index = {
3211
- js: import_outdent43.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
3212
- dts: import_outdent43.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
3217
+ js: import_outdent43.default.string(files.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
3218
+ dts: import_outdent43.default.string(files.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
3213
3219
  };
3214
3220
  return {
3215
3221
  dir: ctx.paths.pattern,
3216
3222
  files: [
3217
3223
  ...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
3218
- ...files.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
3224
+ ...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
3219
3225
  { file: ctx.file.ext("index"), code: index.js },
3220
- { file: "index.d.ts", code: index.dts }
3226
+ { file: ctx.file.extDts("index"), code: index.dts }
3221
3227
  ]
3222
3228
  };
3223
3229
  }
@@ -3230,51 +3236,54 @@ function setupJsx(ctx) {
3230
3236
  const patterns = generateJsxPatterns(ctx);
3231
3237
  const index = {
3232
3238
  js: import_outdent43.default`
3233
- ${ctx.file.export("./factory")}
3234
- ${isValidProp?.js ? ctx.file.export("./is-valid-prop") : ""}
3235
- ${import_outdent43.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
3239
+ ${ctx.file.exportStar("./factory")}
3240
+ ${isValidProp?.js ? ctx.file.exportStar("./is-valid-prop") : ""}
3241
+ ${import_outdent43.default.string(patterns.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n"))}
3236
3242
  `,
3237
3243
  dts: import_outdent43.default`
3238
- export * from './factory'
3239
- ${isValidProp?.dts ? `export * from './is-valid-prop'` : ""}
3240
- ${import_outdent43.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
3241
- export type { ${ctx.jsx.typeName} } from '../types/jsx'
3244
+ ${ctx.file.exportTypeStar("./factory")}
3245
+
3246
+ ${isValidProp?.dts ? ctx.file.exportTypeStar("./is-valid-prop") : ""}
3247
+
3248
+ ${import_outdent43.default.string(patterns.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))}
3249
+
3250
+ ${ctx.file.exportType(ctx.jsx.typeName, "../types/jsx")}
3242
3251
  `
3243
3252
  };
3244
3253
  return {
3245
3254
  dir: ctx.paths.jsx,
3246
3255
  files: [
3247
3256
  ...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
3248
- ...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
3257
+ ...patterns.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
3249
3258
  { file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
3250
- { file: "is-valid-prop.d.ts", code: isValidProp?.dts },
3251
- { file: "factory.d.ts", code: types.jsxFactory },
3259
+ { file: ctx.file.extDts("is-valid-prop"), code: isValidProp?.dts },
3252
3260
  { file: ctx.file.ext("factory"), code: factory?.js },
3253
- { file: "index.d.ts", code: index.dts },
3254
- { file: ctx.file.ext("index"), code: index.js }
3261
+ { file: ctx.file.extDts("factory"), code: types.jsxFactory },
3262
+ { file: ctx.file.ext("index"), code: index.js },
3263
+ { file: ctx.file.extDts("index"), code: index.dts }
3255
3264
  ]
3256
3265
  };
3257
3266
  }
3258
3267
  function setupCssIndex(ctx) {
3259
3268
  const index = {
3260
3269
  js: import_outdent43.default`
3261
- ${ctx.file.export("./css")}
3262
- ${ctx.file.export("./cx")}
3263
- ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
3264
- ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./sva")}
3270
+ ${ctx.file.exportStar("./css")}
3271
+ ${ctx.file.exportStar("./cx")}
3272
+ ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./cva")}
3273
+ ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./sva")}
3265
3274
  `,
3266
3275
  dts: import_outdent43.default`
3267
- export * from './css'
3268
- export * from './cx'
3269
- ${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
3270
- ${ctx.isTemplateLiteralSyntax ? "" : `export * from './sva'`}
3276
+ ${ctx.file.exportTypeStar("./css")}
3277
+ ${ctx.file.exportTypeStar("./cx")}
3278
+ ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./cva")}
3279
+ ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./sva")}
3271
3280
  `
3272
3281
  };
3273
3282
  return {
3274
3283
  dir: ctx.paths.css,
3275
3284
  files: [
3276
3285
  { file: ctx.file.ext("index"), code: index.js },
3277
- { file: "index.d.ts", code: index.dts }
3286
+ { file: ctx.file.extDts("index"), code: index.dts }
3278
3287
  ]
3279
3288
  };
3280
3289
  }
@@ -3325,7 +3334,7 @@ var generateArtifacts = (ctx) => () => {
3325
3334
  ].filter(Boolean).map((artifact) => {
3326
3335
  const files = artifact?.files ?? [];
3327
3336
  files.forEach((file) => {
3328
- if (file.file.endsWith(".d.ts")) {
3337
+ if (ctx.file.isTypeFile(file.file)) {
3329
3338
  file.code = `/* eslint-disable */
3330
3339
  ${file.code}`;
3331
3340
  }
@@ -3625,23 +3634,46 @@ var getPatternEngine = (config) => {
3625
3634
  };
3626
3635
 
3627
3636
  // src/engines/index.ts
3628
- var getEngine = (conf) => ({
3629
- ...getBaseEngine(conf),
3630
- patterns: getPatternEngine(conf.config),
3631
- jsx: getJsxEngine(conf.config),
3632
- paths: getPathEngine(conf.config),
3633
- file: {
3634
- ext(file) {
3635
- return `${file}.${conf.config.outExtension}`;
3636
- },
3637
- import(mod, file) {
3638
- return `import { ${mod} } from '${this.ext(file)}';`;
3639
- },
3640
- export(file) {
3641
- return `export * from '${this.ext(file)}';`;
3637
+ var getEngine = (conf) => {
3638
+ const { config } = conf;
3639
+ const { forceConsistentTypeExtension, outExtension } = config;
3640
+ return {
3641
+ ...getBaseEngine(conf),
3642
+ patterns: getPatternEngine(config),
3643
+ jsx: getJsxEngine(config),
3644
+ paths: getPathEngine(config),
3645
+ file: {
3646
+ ext(file) {
3647
+ return `${file}.${outExtension}`;
3648
+ },
3649
+ extDts(file) {
3650
+ const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
3651
+ return `${file}.${dts}`;
3652
+ },
3653
+ __extDts(file) {
3654
+ return forceConsistentTypeExtension ? this.extDts(file) : file;
3655
+ },
3656
+ import(mod, file) {
3657
+ return `import { ${mod} } from '${this.ext(file)}';`;
3658
+ },
3659
+ importType(mod, file) {
3660
+ return `import type { ${mod} } from '${this.__extDts(file)}';`;
3661
+ },
3662
+ exportType(mod, file) {
3663
+ return `export type { ${mod} } from '${this.__extDts(file)}';`;
3664
+ },
3665
+ exportStar(file) {
3666
+ return `export * from '${this.ext(file)}';`;
3667
+ },
3668
+ exportTypeStar(file) {
3669
+ return `export * from '${this.__extDts(file)}';`;
3670
+ },
3671
+ isTypeFile(file) {
3672
+ return file.endsWith(".d.ts") || file.endsWith(".d.mts");
3673
+ }
3642
3674
  }
3643
- }
3644
- });
3675
+ };
3676
+ };
3645
3677
 
3646
3678
  // src/generator.ts
3647
3679
  var defaults = (conf) => ({