11import { features , proposals } from './entries-definitions.mjs' ;
2- import { $namespace , $path , $proposal , $typeDummy } from './templates.mjs' ;
2+ import { $functionWithCustomType , $path , $proposal , $typeDummy } from './templates.mjs' ;
33import { modules as AllModules } from '@core-js/compat/src/data.mjs' ;
44import { getModulesMetadata } from './get-dependencies.mjs' ;
55import { expandModules , modulesToStage } from './helpers.mjs' ;
@@ -42,7 +42,9 @@ function addType(tsVersion, subset, template, options) {
4242
4343function addEntryTypes ( tsVersion , template , options ) {
4444 addType ( tsVersion , 'index' , template , { ...options , packageName : PACKAGE_NAME } ) ;
45- addType ( tsVersion , 'pure' , template , { ...options , packageName : PACKAGE_NAME_PURE , prefix : TYPE_PREFIX } ) ;
45+ if ( ! options . noPure ) {
46+ addType ( tsVersion , 'pure' , template , { ...options , packageName : PACKAGE_NAME_PURE , prefix : TYPE_PREFIX } ) ;
47+ }
4648 if ( options . exportForSubset ) {
4749 addType ( tsVersion , options . subset , template , { ...options , packageName : PACKAGE_NAME } ) ;
4850 }
@@ -54,6 +56,7 @@ async function buildType(entry, options) {
5456 subset = entryFromNamespace ?? 'full' ,
5557 typeDummy = false ,
5658 globalType = true ,
59+ noPure = false ,
5760 template, templateStable, templateActual, templateFull, filter, modules, enforceEntryCreation,
5861 customType, tsVersion, proposal, types, ownEntryPoint,
5962 } = options ;
@@ -84,10 +87,13 @@ async function buildType(entry, options) {
8487 const level = entry . split ( '/' ) . length - 1 ;
8588
8689 if ( ! types ) {
87- if ( ! enforceEntryCreation && ! expandModules ( modules [ 0 ] , filter , AllModules ) . length ) return ;
88- modules = expandModules ( modules , filter , AllModules ) ;
89- const { types : typePaths } = await getModulesMetadata ( modules ) ;
90- types = typePaths ;
90+ types = [ ] ;
91+ if ( ! customType ) {
92+ if ( ! enforceEntryCreation && ! expandModules ( modules [ 0 ] , filter , AllModules ) . length ) return ;
93+ modules = expandModules ( modules , filter , AllModules ) ;
94+ const { types : typePaths } = await getModulesMetadata ( modules ) ;
95+ types = typePaths ;
96+ }
9197 }
9298
9399 if ( typesFilter ) {
@@ -99,17 +105,17 @@ async function buildType(entry, options) {
99105 imports . index . add ( type ) ;
100106 imports [ subset ] . add ( type ) ;
101107 }
102- imports . pure . add ( path . join ( 'pure' , type ) ) ;
108+ if ( ! noPure ) imports . pure . add ( path . join ( 'pure' , type ) ) ;
103109 } ) ;
104110
105111 if ( customType ) {
106112 if ( globalType ) {
107113 imports . index . add ( customType ) ;
108114 imports [ subset ] . add ( customType ) ;
109115 }
110- imports . pure . add ( path . join ( 'pure' , customType ) ) ;
116+ if ( ! noPure ) imports . pure . add ( path . join ( 'pure' , customType ) ) ;
111117 }
112- options = { ...options , modules, level, entry, types, subset } ;
118+ options = { ...options , modules, level, entry, types, subset, noPure } ;
113119
114120 addEntryTypes ( tsVersion , template , options ) ;
115121 if ( ! entry . endsWith ( '/' ) ) { // add alias with .js ending
@@ -231,13 +237,14 @@ async function buildTypesForTSVersion(tsVersion) {
231237 await buildType ( 'index' , { template : $path , modules : ActualModules , tsVersion } ) ;
232238
233239 await buildType ( 'configurator' , {
240+ customType : 'configurator-custom' ,
234241 entryFromNamespace : 'configurator' ,
235- template : $namespace ,
242+ template : $functionWithCustomType ,
236243 modules : [ 'configurator' ] ,
237244 name : 'configurator' ,
238245 tsVersion,
239- types : [ 'configurator' ] ,
240246 exportForSubset : true ,
247+ noPure : true ,
241248 } ) ;
242249
243250 await prependImports ( tsVersion ) ;
0 commit comments