mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
优化插件类型生成
This commit is contained in:
parent
dba0331e44
commit
dfcfbb0cba
@ -60,7 +60,7 @@ export class PluginTypesService extends BaseService {
|
|||||||
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames,
|
||||||
writeFile: (fileName, content) => {
|
writeFile: (fileName, content) => {
|
||||||
if (fileName.includes('file.d.ts')) {
|
if (fileName.includes('file.d.ts')) {
|
||||||
output = content;
|
output = content || output;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -69,11 +69,23 @@ export class PluginTypesService extends BaseService {
|
|||||||
declaration: true,
|
declaration: true,
|
||||||
emitDeclarationOnly: true,
|
emitDeclarationOnly: true,
|
||||||
outDir: './',
|
outDir: './',
|
||||||
|
skipLibCheck: true,
|
||||||
|
skipDefaultLibCheck: true,
|
||||||
|
noEmitOnError: false,
|
||||||
|
target: ts.ScriptTarget.ES2018,
|
||||||
|
strict: false,
|
||||||
|
module: ts.ModuleKind.Node16,
|
||||||
|
moduleResolution: ts.ModuleResolutionKind.Node16,
|
||||||
|
types: ['node'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const program = ts.createProgram(['file.ts'], options, compilerHost);
|
const program = ts.createProgram(['file.ts'], options, compilerHost);
|
||||||
program.emit();
|
const emitResult = program.emit();
|
||||||
|
|
||||||
|
if (!output) {
|
||||||
|
// Provide a default value if the output is still empty
|
||||||
|
output = '/* No declaration content generated */';
|
||||||
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"inlineSourceMap": false,
|
"inlineSourceMap": true,
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
"noUnusedLocals": false,
|
"noUnusedLocals": false,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user