Skip to content

Commit

Permalink
fix(node-modules-utils): 修复部分包 typings 与 types 字段使用不一致的问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Aug 10, 2021
1 parent 4671210 commit 96f952d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/node-modules-utils/src/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class PackageDeclaration extends PackageInfo {
}

// load type file
const typeFile = pkg.info?.types || 'index.d.ts'
const typeFile = pkg.info?.types || pkg.info?.typings || 'index.d.ts'
const typeFilePath = path.join(pkg.rootPath, typeFile)
if (!await pkg.exists(typeFilePath)) {
return []
Expand Down Expand Up @@ -100,7 +100,7 @@ export class PackageDeclaration extends PackageInfo {
* 2. 如果未读取到,则指定 package.json#main 所在目录 下的 index.d.ts 为 typings
*/
async resolveTypingsEntryPath() {
const typings = this.info?.typings
const typings = this.info?.typings || this.info?.types

const defaultTypings = path.join(this.entryPath, 'index.d.ts')
if (!typings) {
Expand Down Expand Up @@ -249,13 +249,13 @@ export class NodePackageDeclarations {
nodeModulesRoot: string

static NODE_PACKAGES = [
'assert', 'crypto', 'child_process','path', 'process', 'readline', 'querystring', 'os',
'dns', 'domain', 'http', 'https', 'http2', 'module', 'net', 'tls', 'dgram',
'stream', 'tty', 'url', 'wasi', 'v8', 'vm', 'worker_threads', 'zlib',
'punycode', 'perf_hooks', 'fs', 'events', 'constants', 'console', 'cluster', 'buffer',
'fs/promises', 'globals'
'assert', 'crypto', 'child_process', 'path', 'process', 'readline', 'querystring', 'os',
'dns', 'domain', 'http', 'https', 'http2', 'module', 'net', 'tls', 'dgram',
'stream', 'tty', 'url', 'wasi', 'v8', 'vm', 'worker_threads', 'zlib',
'punycode', 'perf_hooks', 'fs', 'events', 'constants', 'console', 'cluster', 'buffer',
'fs/promises', 'globals'
]


typesDir: string

Expand Down

0 comments on commit 96f952d

Please sign in to comment.