From 77b974c2cedcfc5837e04a02060aed342812d9e3 Mon Sep 17 00:00:00 2001 From: Eugene Zolenko Date: Fri, 23 Jun 2017 17:36:29 -0600 Subject: [PATCH] - testing ts-node --- dist/index.d.ts | 2 +- dist/rollup-plugin-typescript2.cjs.js | 4 ++- dist/rollup-plugin-typescript2.es.js | 2 +- package.json | 4 ++- rollup.config.ts | 41 +++++++++++++++++++++++++++ src/index.ts | 2 +- tsconfig.json | 2 +- 7 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 rollup.config.ts diff --git a/dist/index.d.ts b/dist/index.d.ts index 17449c3..3a62209 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -11,7 +11,7 @@ export interface IOptions { rollupCommonJSResolveHack?: boolean; tsconfig?: string; } -export default function typescript(options?: IOptions): { +export declare function typescript(options?: IOptions): { options(config: any): void; resolveId(importee: string, importer: string): string | null; load(id: string): string | undefined; diff --git a/dist/rollup-plugin-typescript2.cjs.js b/dist/rollup-plugin-typescript2.cjs.js index d3dfebf..c668239 100644 --- a/dist/rollup-plugin-typescript2.cjs.js +++ b/dist/rollup-plugin-typescript2.cjs.js @@ -1,6 +1,8 @@ /* eslint-disable */ 'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); + var _ = require('lodash'); var fs = require('fs-extra'); var ts = require('typescript'); @@ -607,4 +609,4 @@ function typescript(options) { }; } -module.exports = typescript; +exports.typescript = typescript; diff --git a/dist/rollup-plugin-typescript2.es.js b/dist/rollup-plugin-typescript2.es.js index f2582af..3bbaba8 100644 --- a/dist/rollup-plugin-typescript2.es.js +++ b/dist/rollup-plugin-typescript2.es.js @@ -613,4 +613,4 @@ function typescript(options) { }; } -export default typescript; +export { typescript }; diff --git a/package.json b/package.json index b8d2910..02ab18d 100644 --- a/package.json +++ b/package.json @@ -49,11 +49,13 @@ "@types/node": "^8.0.1", "@types/object-hash": "^0.5.28", "@types/resolve": "^0.0.4", + "@types/rollup": "^0.0.4", "rimraf": "^2.6.1", "rollup": "^0.43.0", "rollup-plugin-typescript2": "^0.4.4", "rollup-watch": "^4.0.0", - "tslint": "^5.4.3" + "tslint": "^5.4.3", + "ts-node": "^3.1.0" }, "repository": { "type": "git", diff --git a/rollup.config.ts b/rollup.config.ts new file mode 100644 index 0000000..87e594c --- /dev/null +++ b/rollup.config.ts @@ -0,0 +1,41 @@ +import { typescript } from "."; +import * as rollup from "rollup"; + +// tslint:disable-next-line:no-var-requires +const pkg = require("./package.json"); + +export const options = { + entry: "src/index.ts", + + external: [ + "path", + "fs-extra", + "object-assign", + "rollup-pluginutils", + "typescript", + "lodash", + "graphlib", + "object-hash", + "colors/safe", + "resolve", + ], + + plugins: [ + typescript({ verbosity: 3 }), + ], + + banner: "/* eslint-disable */", + + targets: [ + { + format: "cjs", + dest: pkg.main, + }, + { + format: "es", + dest: pkg.module, + }, + ], +}; + +rollup.rollup(options); diff --git a/src/index.ts b/src/index.ts index 2a6c5a6..2802cf7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -107,7 +107,7 @@ export interface IOptions tsconfig?: string; } -export default function typescript(options?: IOptions) +export function typescript(options?: IOptions) { options = { ... options }; diff --git a/tsconfig.json b/tsconfig.json index a91d638..e0cc8f5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "es6", + "module": "commonjs", "target": "es5", "noImplicitAny": true, "sourceMap": true,