Skip to content
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.

Commit

Permalink
fix: Updated TypeScript to version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
roman.vasilev committed Feb 12, 2019
1 parent 0b8f307 commit 155cdbc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
6 changes: 2 additions & 4 deletions package.json
Expand Up @@ -26,14 +26,13 @@
"build": "sh Taskfile build",
"prebuild": "npm run clean",
"clean": "rimraf dist",
"commit": "git-cz",
"benchmark": "node -r ts-node/register/transpile-only node_modules/benchmarko/lib/bin.js -f benchmarks/parse-module-node"
"commit": "git-cz"
},
"dependencies": {
"object-values": "^2.0.0",
"resolve": "^1.10.0",
"tslib": "^1.9.3",
"typescript": "^2.9.2"
"typescript": "^3.3.3"
},
"devDependencies": {
"@semantic-release/changelog": "^3.0.2",
Expand All @@ -45,7 +44,6 @@
"@types/resolve": "0.0.8",
"@typescript-eslint/eslint-plugin-tslint": "^1.3.0",
"@typescript-eslint/parser": "^1.3.0",
"benchmarko": "0.0.2",
"eslint": "^5.13.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.16.0",
Expand Down
27 changes: 19 additions & 8 deletions src/module.ts
Expand Up @@ -107,14 +107,25 @@ export function module(id: string, options: ModuleOptions = {}): Promise<Entry[]
done([]);
}
items.forEach(item => {
stat(resolvePath(dirpath, item, 'package.json'), (err, stats) => {
if (stats && stats.isFile()) {
submodules.push(`${id}/${item}`);
}
if (--count === 0) {
done(submodules);
}
});
// TODO: Fix me, remove isTypes
if (isTypes && item.slice(-5) === '.d.ts') {
const itemFile = resolvePath(dirpath, item);
return file(itemFile, options).then(items => {
entries.push(...items);
if (--count === 0) {
done(submodules);
}
});
} else {
stat(resolvePath(dirpath, item, 'package.json'), (err, stats) => {
if (stats && stats.isFile()) {
submodules.push(`${id}/${item}`);
}
if (--count === 0) {
done(submodules);
}
});
}
});
});
}).then(submodules => {
Expand Down
5 changes: 4 additions & 1 deletion src/parse.spec.ts
Expand Up @@ -186,7 +186,7 @@ declare module "preact" {
assert(result[1].name === 'AnyComponent');
});

it.skip('react definitions', () => {
it('react definitions', () => {
const source = `
export = React;
export as namespace React;
Expand All @@ -198,6 +198,9 @@ declare namespace React {
`;
const result = parse(source);
assert(result.length > 0);
assert(result.find(e => e.name === 'ReactType'));
assert(result.find(e => e.name === 'Component'));
assert(result.find(e => e.name === 'PureComponent'));
});

it('webpack', () => {
Expand Down

0 comments on commit 155cdbc

Please sign in to comment.