File tree Expand file tree Collapse file tree 6 files changed +31
-1
lines changed Expand file tree Collapse file tree 6 files changed +31
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @modern-js/plugin-bff ' : patch
3
+ ---
4
+
5
+ fix: corss BFF type prompt
6
+ fix: 修复 跨项目 BFF 类型提示问题
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ export const bffPlugin = (): CliPlugin<AppTools> => ({
70
70
distDir,
71
71
tsconfigPath,
72
72
moduleType,
73
+ throwErrorInsteadOfExit : true ,
73
74
} ,
74
75
) ;
75
76
}
Original file line number Diff line number Diff line change @@ -157,6 +157,9 @@ async function setPackage(
157
157
} ;
158
158
} ,
159
159
{
160
+ [ `${ API_DIR } /*` ] : [
161
+ toPosixPath ( `./${ relativeDistPath } /${ CLIENT_DIR } /*.d.ts` ) ,
162
+ ] ,
160
163
[ RUNTIME_DIR ] : [
161
164
toPosixPath ( `./${ relativeDistPath } /${ RUNTIME_DIR } /index.d.ts` ) ,
162
165
] ,
@@ -181,12 +184,18 @@ async function setPackage(
181
184
} ;
182
185
} ,
183
186
{
187
+ [ toPosixPath ( `./${ API_DIR } /*` ) ] : {
188
+ import : toPosixPath ( `./${ relativeDistPath } /${ CLIENT_DIR } /*.js` ) ,
189
+ types : toPosixPath ( `./${ relativeDistPath } /${ CLIENT_DIR } /*.d.ts` ) ,
190
+ } ,
184
191
[ toPosixPath ( `./${ PLUGIN_DIR } ` ) ] : {
192
+ import : toPosixPath ( `./${ relativeDistPath } /${ PLUGIN_DIR } /index.js` ) ,
185
193
require : toPosixPath ( `./${ relativeDistPath } /${ PLUGIN_DIR } /index.js` ) ,
186
194
types : toPosixPath ( `./${ relativeDistPath } /${ PLUGIN_DIR } /index.d.ts` ) ,
187
195
} ,
188
196
[ toPosixPath ( `./${ RUNTIME_DIR } ` ) ] : {
189
197
import : toPosixPath ( `./${ relativeDistPath } /${ RUNTIME_DIR } /index.js` ) ,
198
+ require : toPosixPath ( `./${ relativeDistPath } /${ RUNTIME_DIR } /index.js` ) ,
190
199
types : toPosixPath ( `./${ relativeDistPath } /${ RUNTIME_DIR } /index.d.ts` ) ,
191
200
} ,
192
201
} ,
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface CompileOptions {
24
24
distDir : string ;
25
25
tsconfigPath ?: string ;
26
26
moduleType ?: 'module' | 'commonjs' ;
27
+ throwErrorInsteadOfExit ?: boolean ;
27
28
}
28
29
29
30
export type CompileFunc = (
Original file line number Diff line number Diff line change @@ -103,7 +103,11 @@ export const compileByTs: CompileFunc = async (
103
103
) ,
104
104
) ;
105
105
if ( typeof noEmitOnError === 'undefined' || noEmitOnError === true ) {
106
- process . exit ( 1 ) ;
106
+ if ( compileOptions . throwErrorInsteadOfExit ) {
107
+ logger . error ( 'TypeScript compilation failed' ) ;
108
+ } else {
109
+ process . exit ( 1 ) ;
110
+ }
107
111
}
108
112
}
109
113
Original file line number Diff line number Diff line change 35
35
},
36
36
"exports" : {
37
37
"./plugin" : {
38
+ "import" : " ./dist-1/plugin/index.js" ,
38
39
"require" : " ./dist-1/plugin/index.js" ,
39
40
"types" : " ./dist-1/plugin/index.d.ts"
40
41
},
41
42
"./runtime" : {
42
43
"import" : " ./dist-1/runtime/index.js" ,
44
+ "require" : " ./dist-1/runtime/index.js" ,
43
45
"types" : " ./dist-1/runtime/index.d.ts"
44
46
},
47
+ "./api/*" : {
48
+ "import" : " ./dist-1/client/*.js" ,
49
+ "types" : " ./dist-1/client/*.d.ts"
50
+ },
45
51
"./api/context/index" : {
46
52
"import" : " ./dist-1/client/context/index.js" ,
47
53
"types" : " ./dist-1/client/context/index.d.ts"
71
77
"plugin" : [
72
78
" ./dist-1/plugin/index.d.ts"
73
79
],
80
+ "api/*" : [
81
+ " ./dist-1/client/*.d.ts"
82
+ ],
74
83
"api/context/index" : [
75
84
" ./dist-1/client/context/index.d.ts"
76
85
],
You can’t perform that action at this time.
0 commit comments