@@ -3,6 +3,7 @@ import { createRequire } from 'module';
3
3
import fse from 'fs-extra' ;
4
4
import findUp from 'find-up' ;
5
5
import type { Plugin } from 'esbuild' ;
6
+ import type { Config } from '@ice/shared-config/types' ;
6
7
import { logger } from '../utils/logger.js' ;
7
8
import { CACHE_DIR } from '../constant.js' ;
8
9
import { bundleDeps , resolvePackageESEntry , getDepsCacheDir } from './preBundleDeps.js' ;
@@ -24,6 +25,7 @@ interface PreBundleOptions {
24
25
plugins ?: Plugin [ ] ;
25
26
external ?: string [ ] ;
26
27
define ?: Record < string , string > ;
28
+ taskConfig ?: Config ;
27
29
speedup ?: boolean ;
28
30
}
29
31
@@ -36,6 +38,7 @@ export class RuntimeMeta {
36
38
private cachePath : string ;
37
39
private external : string [ ] ;
38
40
private define : Record < string , string > ;
41
+ private taskConfig : Config ;
39
42
private speedup : boolean ;
40
43
41
44
constructor ( options : Omit < PreBundleOptions , 'pkgName' | 'resolveId' > ) {
@@ -47,6 +50,7 @@ export class RuntimeMeta {
47
50
this . define = options . define ;
48
51
this . speedup = options . speedup ;
49
52
this . cachePath = path . join ( getDepsCacheDir ( path . join ( this . rootDir , CACHE_DIR ) ) , 'metadata.json' ) ;
53
+ this . taskConfig = options . taskConfig ;
50
54
}
51
55
52
56
async getDepsCache ( ) {
@@ -100,6 +104,7 @@ export class RuntimeMeta {
100
104
define : this . define ,
101
105
pkgName : pkgName ,
102
106
resolveId,
107
+ taskConfig : this . taskConfig ,
103
108
speedup : this . speedup ,
104
109
} ) ;
105
110
await this . setDepsCache ( pkgName , resolveId , bundlePath ) ;
@@ -111,7 +116,7 @@ export class RuntimeMeta {
111
116
}
112
117
113
118
export default async function preBundleDeps ( options : PreBundleOptions ) : Promise < PreBundleResult > {
114
- const { rootDir, pkgName, alias, ignores, plugins, resolveId, external, define, speedup } = options ;
119
+ const { rootDir, pkgName, alias, ignores, plugins, resolveId, external, define, speedup, taskConfig } = options ;
115
120
const depsCacheDir = getDepsCacheDir ( path . join ( rootDir , CACHE_DIR ) ) ;
116
121
try {
117
122
await bundleDeps ( {
@@ -122,6 +127,7 @@ export default async function preBundleDeps(options: PreBundleOptions): Promise<
122
127
plugins : plugins || [ ] ,
123
128
external,
124
129
define,
130
+ taskConfig,
125
131
speedup,
126
132
rootDir,
127
133
} ) ;
0 commit comments