diff --git a/build-tools/delete_systemapi_plugin.js b/build-tools/delete_systemapi_plugin.js index ac7a6d30ea208bd09503243753cec8b43ba50eff..ec5dbde4bd5c5e9f8a24fadff8c48cc7b9f6efc2 100644 --- a/build-tools/delete_systemapi_plugin.js +++ b/build-tools/delete_systemapi_plugin.js @@ -85,6 +85,8 @@ function writeFile(url, data, option) { }) } +const globalModules = new Set(['GlobalResource', 'StateManagement', 'SpecialEvent']); + function formatImportDeclaration(url) { return (context) => { const allIdentifierSet = new Set([]); @@ -140,9 +142,9 @@ function formatImportDeclaration(url) { }); } } - const importSpecifier = statement.moduleSpecifier.getText(); - const importSpecifierRealPath = path.resolve(url, `../${importSpecifier.replace(/[\'\"]/g, '')}.d.ts`); - if (fs.existsSync(importSpecifierRealPath) && clauseSet.size > 0) { + const importSpecifier = statement.moduleSpecifier.getText().replace(/[\'\"]/g, ''); + const importSpecifierRealPath = path.resolve(url, `../${importSpecifier}.d.ts`); + if ((fs.existsSync(importSpecifierRealPath) || globalModules.has(importSpecifier)) && clauseSet.size > 0) { const clasueCheckList = []; let exsitClauseSet = new Set([]); for (const clause of clauseSet) {