Skip to content

Commit

Permalink
chore(build): add stripInternal and only emit types from node ent…
Browse files Browse the repository at this point in the history
…ry point
  • Loading branch information
alan-agius4 authored and lukastaegert committed Jan 12, 2018
1 parent 3fc7662 commit d665a43
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"main": "dist/rollup.js",
"module": "dist/rollup.es.js",
"jsnext:main": "dist/rollup.es.js",
"typings": "dist/typings/src/node-entry.d.ts",
"typings": "dist/typings/node-entry.d.ts",
"bin": {
"rollup": "./bin/rollup"
},
Expand All @@ -19,7 +19,7 @@
"test-coverage": "rm -rf coverage/* && istanbul cover --report json node_modules/.bin/_mocha -- -u exports -R spec test/test.js",
"posttest-coverage": "remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.json -b dist && remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped.lcov -t lcovonly -b dist && remap-istanbul -i coverage/coverage-final.json -o coverage/coverage-remapped -t html -b dist",
"ci": "npm run test-coverage && codecov < coverage/coverage-remapped.lcov",
"build": "git rev-parse HEAD > .commithash && rollup -c && tsc && chmod a+x bin/rollup",
"build": "git rev-parse HEAD > .commithash && rollup -c && tsc -p tsconfig-types.json && chmod a+x bin/rollup",
"watch": "rollup -cw",
"prepublishOnly": "npm run lint && npm run test:only && npm run test:leak",
"prepare": "npm run build",
Expand Down
4 changes: 3 additions & 1 deletion src/Graph.ts
Expand Up @@ -576,7 +576,9 @@ export default class Graph {
? Promise.resolve(resolvedId)
: this.resolveId(source, module.id)
).then(resolvedId => {
const externalId = resolvedId || isRelative(source) ? resolve(module.id, '..', source) : source;
// TODO types of `resolvedId` are not compatable with 'externalId'.
// `this.resolveId` returns `string`, `void`, and `boolean`
const externalId = <string>resolvedId || (isRelative(source) ? resolve(module.id, '..', source) : source);
let isExternal = this.isExternal(externalId, module.id, true);

if (!resolvedId && !isExternal) {
Expand Down
12 changes: 12 additions & 0 deletions tsconfig-types.json
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/typings",
"declaration": true,
"stripInternal": true
},
"include": [
"typings/**/*.d.ts",
"src/node-entry.ts"
]
}
4 changes: 1 addition & 3 deletions tsconfig.json
Expand Up @@ -10,9 +10,7 @@
"noImplicitThis": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"outDir": "./dist/typings",
"skipLibCheck": true,
"declaration": true
"skipLibCheck": true
},
"include": [
"typings/**/*.d.ts",
Expand Down
10 changes: 8 additions & 2 deletions typings/declerations.d.ts → typings/declarations.d.ts
@@ -1,7 +1,13 @@
// internal
declare module "rollup";
declare module 'help.md';
declare module 'package.json';
declare module 'help.md' {
const str: string;
export default str;
}

declare module 'package.json' {
const version: string;
}

// external libs
declare module "ansi-escapes";
Expand Down

0 comments on commit d665a43

Please sign in to comment.