From 4ba0134e7cb7c75ee4a030050684377cfef6a829 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Mon, 23 Aug 2021 16:30:24 -0400 Subject: [PATCH] Rework build process to use TypeScript source files. --- .npmignore | 3 +- module.d.ts | 1 - module.js | 576 ----------------------------- package-lock.json | 54 ++- package.json | 11 +- rollup.config.js | 5 +- rollup.test.config.js | 6 +- src/module.js | 1 - index.d.ts => src/module.ts | 3 +- {tests => src/tests}/Observable.ts | 10 +- {tests => src/tests}/index.ts | 2 +- tests/tsconfig.json | 21 -- tsconfig.json | 15 + 13 files changed, 60 insertions(+), 648 deletions(-) delete mode 100644 module.d.ts delete mode 100644 module.js delete mode 100644 src/module.js rename index.d.ts => src/module.ts (70%) rename {tests => src/tests}/Observable.ts (86%) rename {tests => src/tests}/index.ts (83%) delete mode 100644 tests/tsconfig.json create mode 100644 tsconfig.json diff --git a/.npmignore b/.npmignore index 4f68404..afa5733 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,4 @@ tests/ -rollup.config.js +dist/tests/ +rollup.*.js *.tgz diff --git a/module.d.ts b/module.d.ts deleted file mode 100644 index 6d1e0ee..0000000 --- a/module.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./index"; diff --git a/module.js b/module.js deleted file mode 100644 index 1837254..0000000 --- a/module.js +++ /dev/null @@ -1,576 +0,0 @@ -function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -// === Symbol Support === -var hasSymbols = function () { - return typeof Symbol === 'function'; -}; - -var hasSymbol = function (name) { - return hasSymbols() && Boolean(Symbol[name]); -}; - -var getSymbol = function (name) { - return hasSymbol(name) ? Symbol[name] : '@@' + name; -}; - -if (hasSymbols() && !hasSymbol('observable')) { - Symbol.observable = Symbol('observable'); -} - -var SymbolIterator = getSymbol('iterator'); -var SymbolObservable = getSymbol('observable'); -var SymbolSpecies = getSymbol('species'); // === Abstract Operations === - -function getMethod(obj, key) { - var value = obj[key]; - if (value == null) return undefined; - if (typeof value !== 'function') throw new TypeError(value + ' is not a function'); - return value; -} - -function getSpecies(obj) { - var ctor = obj.constructor; - - if (ctor !== undefined) { - ctor = ctor[SymbolSpecies]; - - if (ctor === null) { - ctor = undefined; - } - } - - return ctor !== undefined ? ctor : Observable; -} - -function isObservable(x) { - return x instanceof Observable; // SPEC: Brand check -} - -function hostReportError(e) { - if (hostReportError.log) { - hostReportError.log(e); - } else { - setTimeout(function () { - throw e; - }); - } -} - -function enqueue(fn) { - Promise.resolve().then(function () { - try { - fn(); - } catch (e) { - hostReportError(e); - } - }); -} - -function cleanupSubscription(subscription) { - var cleanup = subscription._cleanup; - if (cleanup === undefined) return; - subscription._cleanup = undefined; - - if (!cleanup) { - return; - } - - try { - if (typeof cleanup === 'function') { - cleanup(); - } else { - var unsubscribe = getMethod(cleanup, 'unsubscribe'); - - if (unsubscribe) { - unsubscribe.call(cleanup); - } - } - } catch (e) { - hostReportError(e); - } -} - -function closeSubscription(subscription) { - subscription._observer = undefined; - subscription._queue = undefined; - subscription._state = 'closed'; -} - -function flushSubscription(subscription) { - var queue = subscription._queue; - - if (!queue) { - return; - } - - subscription._queue = undefined; - subscription._state = 'ready'; - - for (var i = 0; i < queue.length; ++i) { - notifySubscription(subscription, queue[i].type, queue[i].value); - if (subscription._state === 'closed') break; - } -} - -function notifySubscription(subscription, type, value) { - subscription._state = 'running'; - var observer = subscription._observer; - - try { - var m = getMethod(observer, type); - - switch (type) { - case 'next': - if (m) m.call(observer, value); - break; - - case 'error': - closeSubscription(subscription); - if (m) m.call(observer, value);else throw value; - break; - - case 'complete': - closeSubscription(subscription); - if (m) m.call(observer); - break; - } - } catch (e) { - hostReportError(e); - } - - if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready'; -} - -function onNotify(subscription, type, value) { - if (subscription._state === 'closed') return; - - if (subscription._state === 'buffering') { - subscription._queue.push({ - type: type, - value: value - }); - - return; - } - - if (subscription._state !== 'ready') { - subscription._state = 'buffering'; - subscription._queue = [{ - type: type, - value: value - }]; - enqueue(function () { - return flushSubscription(subscription); - }); - return; - } - - notifySubscription(subscription, type, value); -} - -var Subscription = /*#__PURE__*/function () { - function Subscription(observer, subscriber) { - // ASSERT: observer is an object - // ASSERT: subscriber is callable - this._cleanup = undefined; - this._observer = observer; - this._queue = undefined; - this._state = 'initializing'; - var subscriptionObserver = new SubscriptionObserver(this); - - try { - this._cleanup = subscriber.call(undefined, subscriptionObserver); - } catch (e) { - subscriptionObserver.error(e); - } - - if (this._state === 'initializing') this._state = 'ready'; - } - - var _proto = Subscription.prototype; - - _proto.unsubscribe = function unsubscribe() { - if (this._state !== 'closed') { - closeSubscription(this); - cleanupSubscription(this); - } - }; - - _createClass(Subscription, [{ - key: "closed", - get: function () { - return this._state === 'closed'; - } - }]); - - return Subscription; -}(); - -var SubscriptionObserver = /*#__PURE__*/function () { - function SubscriptionObserver(subscription) { - this._subscription = subscription; - } - - var _proto2 = SubscriptionObserver.prototype; - - _proto2.next = function next(value) { - onNotify(this._subscription, 'next', value); - }; - - _proto2.error = function error(value) { - onNotify(this._subscription, 'error', value); - }; - - _proto2.complete = function complete() { - onNotify(this._subscription, 'complete'); - }; - - _createClass(SubscriptionObserver, [{ - key: "closed", - get: function () { - return this._subscription._state === 'closed'; - } - }]); - - return SubscriptionObserver; -}(); - -var Observable = /*#__PURE__*/function () { - function Observable(subscriber) { - if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function'); - if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function'); - this._subscriber = subscriber; - } - - var _proto3 = Observable.prototype; - - _proto3.subscribe = function subscribe(observer) { - if (typeof observer !== 'object' || observer === null) { - observer = { - next: observer, - error: arguments[1], - complete: arguments[2] - }; - } - - return new Subscription(observer, this._subscriber); - }; - - _proto3.forEach = function forEach(fn) { - var _this = this; - - return new Promise(function (resolve, reject) { - if (typeof fn !== 'function') { - reject(new TypeError(fn + ' is not a function')); - return; - } - - function done() { - subscription.unsubscribe(); - resolve(); - } - - var subscription = _this.subscribe({ - next: function (value) { - try { - fn(value, done); - } catch (e) { - reject(e); - subscription.unsubscribe(); - } - }, - error: reject, - complete: resolve - }); - }); - }; - - _proto3.map = function map(fn) { - var _this2 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - var C = getSpecies(this); - return new C(function (observer) { - return _this2.subscribe({ - next: function (value) { - try { - value = fn(value); - } catch (e) { - return observer.error(e); - } - - observer.next(value); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - observer.complete(); - } - }); - }); - }; - - _proto3.filter = function filter(fn) { - var _this3 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - var C = getSpecies(this); - return new C(function (observer) { - return _this3.subscribe({ - next: function (value) { - try { - if (!fn(value)) return; - } catch (e) { - return observer.error(e); - } - - observer.next(value); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - observer.complete(); - } - }); - }); - }; - - _proto3.reduce = function reduce(fn) { - var _this4 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - var C = getSpecies(this); - var hasSeed = arguments.length > 1; - var hasValue = false; - var seed = arguments[1]; - var acc = seed; - return new C(function (observer) { - return _this4.subscribe({ - next: function (value) { - var first = !hasValue; - hasValue = true; - - if (!first || hasSeed) { - try { - acc = fn(acc, value); - } catch (e) { - return observer.error(e); - } - } else { - acc = value; - } - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence')); - observer.next(acc); - observer.complete(); - } - }); - }); - }; - - _proto3.concat = function concat() { - var _this5 = this; - - for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - var C = getSpecies(this); - return new C(function (observer) { - var subscription; - var index = 0; - - function startNext(next) { - subscription = next.subscribe({ - next: function (v) { - observer.next(v); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - if (index === sources.length) { - subscription = undefined; - observer.complete(); - } else { - startNext(C.from(sources[index++])); - } - } - }); - } - - startNext(_this5); - return function () { - if (subscription) { - subscription.unsubscribe(); - subscription = undefined; - } - }; - }); - }; - - _proto3.flatMap = function flatMap(fn) { - var _this6 = this; - - if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function'); - var C = getSpecies(this); - return new C(function (observer) { - var subscriptions = []; - - var outer = _this6.subscribe({ - next: function (value) { - if (fn) { - try { - value = fn(value); - } catch (e) { - return observer.error(e); - } - } - - var inner = C.from(value).subscribe({ - next: function (value) { - observer.next(value); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - var i = subscriptions.indexOf(inner); - if (i >= 0) subscriptions.splice(i, 1); - completeIfDone(); - } - }); - subscriptions.push(inner); - }, - error: function (e) { - observer.error(e); - }, - complete: function () { - completeIfDone(); - } - }); - - function completeIfDone() { - if (outer.closed && subscriptions.length === 0) observer.complete(); - } - - return function () { - subscriptions.forEach(function (s) { - return s.unsubscribe(); - }); - outer.unsubscribe(); - }; - }); - }; - - _proto3[SymbolObservable] = function () { - return this; - }; - - Observable.from = function from(x) { - var C = typeof this === 'function' ? this : Observable; - if (x == null) throw new TypeError(x + ' is not an object'); - var method = getMethod(x, SymbolObservable); - - if (method) { - var observable = method.call(x); - if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object'); - if (isObservable(observable) && observable.constructor === C) return observable; - return new C(function (observer) { - return observable.subscribe(observer); - }); - } - - if (hasSymbol('iterator')) { - method = getMethod(x, SymbolIterator); - - if (method) { - return new C(function (observer) { - enqueue(function () { - if (observer.closed) return; - - for (var _iterator = _createForOfIteratorHelperLoose(method.call(x)), _step; !(_step = _iterator()).done;) { - var item = _step.value; - observer.next(item); - if (observer.closed) return; - } - - observer.complete(); - }); - }); - } - } - - if (Array.isArray(x)) { - return new C(function (observer) { - enqueue(function () { - if (observer.closed) return; - - for (var i = 0; i < x.length; ++i) { - observer.next(x[i]); - if (observer.closed) return; - } - - observer.complete(); - }); - }); - } - - throw new TypeError(x + ' is not observable'); - }; - - Observable.of = function of() { - for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - items[_key2] = arguments[_key2]; - } - - var C = typeof this === 'function' ? this : Observable; - return new C(function (observer) { - enqueue(function () { - if (observer.closed) return; - - for (var i = 0; i < items.length; ++i) { - observer.next(items[i]); - if (observer.closed) return; - } - - observer.complete(); - }); - }); - }; - - _createClass(Observable, null, [{ - key: SymbolSpecies, - get: function () { - return this; - } - }]); - - return Observable; -}(); - -if (hasSymbols()) { - Object.defineProperty(Observable, Symbol('extensions'), { - value: { - symbol: SymbolObservable, - hostReportError: hostReportError - }, - configurable: true - }); -} - -export { Observable }; diff --git a/package-lock.json b/package-lock.json index f3e11c4..2c4938b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,12 +16,12 @@ "@babel/preset-env": "^7.14.7", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-node-resolve": "^13.0.0", - "@rollup/plugin-typescript": "^8.2.1", "@types/chai": "^4.2.14", "@types/mocha": "^9.0.0", "@types/node": "^16.0.1", "chai": "^4.2.0", "mocha": "^9.0.2", + "rimraf": "^3.0.2", "rollup": "^2.38.4", "tslib": "^2.1.0", "typescript": "^4.1.3" @@ -1664,24 +1664,6 @@ "rollup": "^2.42.0" } }, - "node_modules/@rollup/plugin-typescript": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.2.1.tgz", - "integrity": "sha512-Qd2E1pleDR4bwyFxqbjt4eJf+wB0UKVMLc7/BAFDGVdAXQMCsD4DUv5/7/ww47BZCYxWtJqe1Lo0KVNswBJlRw==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "resolve": "^1.17.0" - }, - "engines": { - "node": ">=8.0.0" - }, - "peerDependencies": { - "rollup": "^2.14.0", - "tslib": "*", - "typescript": ">=3.7.0" - } - }, "node_modules/@rollup/pluginutils": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", @@ -3004,6 +2986,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/rollup": { "version": "2.56.3", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz", @@ -4557,16 +4554,6 @@ "resolve": "^1.19.0" } }, - "@rollup/plugin-typescript": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.2.1.tgz", - "integrity": "sha512-Qd2E1pleDR4bwyFxqbjt4eJf+wB0UKVMLc7/BAFDGVdAXQMCsD4DUv5/7/ww47BZCYxWtJqe1Lo0KVNswBJlRw==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "resolve": "^1.17.0" - } - }, "@rollup/pluginutils": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", @@ -5558,6 +5545,15 @@ "path-parse": "^1.0.6" } }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "rollup": { "version": "2.56.3", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz", diff --git a/package.json b/package.json index f881520..646dace 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "Thin wrapper around zen-observable and @types/zen-observable, to support ESM exports as well as CommonJS exports", "license": "MIT", "main": "index.js", - "module": "module.js", - "types": "index.d.ts", + "module": "dist/module.js", + "types": "dist/module.d.ts", "repository": { "type": "git", "url": "git+https://github.com/apollographql/zen-observable-ts.git" @@ -14,10 +14,11 @@ "url": "https://github.com/apollographql/zen-observable-ts/issues" }, "scripts": { - "build": "rollup -c rollup.config.js", + "clean": "rimraf dist", + "build": "npm run clean && tsc && rollup -c rollup.config.js", "prepare": "npm run build", "pretest": "npm run build && rollup -c rollup.test.config.js", - "test": "mocha tests/bundle.js" + "test": "mocha dist/tests/bundle.cjs" }, "dependencies": { "@types/zen-observable": "0.8.3", @@ -28,12 +29,12 @@ "@babel/preset-env": "^7.14.7", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-node-resolve": "^13.0.0", - "@rollup/plugin-typescript": "^8.2.1", "@types/chai": "^4.2.14", "@types/mocha": "^9.0.0", "@types/node": "^16.0.1", "chai": "^4.2.0", "mocha": "^9.0.2", + "rimraf": "^3.0.2", "rollup": "^2.38.4", "tslib": "^2.1.0", "typescript": "^4.1.3" diff --git a/rollup.config.js b/rollup.config.js index 2a7b22f..9fdee52 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -18,7 +18,7 @@ const babelPlugins = zenBabelPlugins export default [ { - input: ["./src/module.js"], + input: ["./dist/module.js"], plugins: [ nodeResolve(), babel({ @@ -27,8 +27,9 @@ export default [ }), ], output: { - file: "module.js", + file: "dist/module.js", format: "esm", + sourcemap: true, }, }, ]; diff --git a/rollup.test.config.js b/rollup.test.config.js index f8b4f6d..1852664 100644 --- a/rollup.test.config.js +++ b/rollup.test.config.js @@ -1,14 +1,12 @@ import nodeResolve from "@rollup/plugin-node-resolve"; -import typescript from "@rollup/plugin-typescript"; export default { - input: "./tests/index.ts", + input: "./dist/tests/index.js", output: { - file: "./tests/bundle.js", + file: "./dist/tests/bundle.cjs", format: "cjs", }, plugins: [ nodeResolve(), - typescript(), ], }; diff --git a/src/module.js b/src/module.js deleted file mode 100644 index a4e5ccf..0000000 --- a/src/module.js +++ /dev/null @@ -1 +0,0 @@ -export { Observable } from "zen-observable/esm.js"; diff --git a/index.d.ts b/src/module.ts similarity index 70% rename from index.d.ts rename to src/module.ts index 2f31856..c775c1a 100644 --- a/index.d.ts +++ b/src/module.ts @@ -1,5 +1,4 @@ -import Observable = require("zen-observable"); -export { Observable }; +export { Observable } from "zen-observable/esm.js"; export type Observer = ZenObservable.Observer; export type Subscription = ZenObservable.Subscription; export type Subscriber = ZenObservable.Subscriber; diff --git a/tests/Observable.ts b/src/tests/Observable.ts similarity index 86% rename from tests/Observable.ts rename to src/tests/Observable.ts index da8f99c..ecbf712 100644 --- a/tests/Observable.ts +++ b/src/tests/Observable.ts @@ -3,9 +3,9 @@ const { expect } = require("chai") as typeof import("chai"); import type { Observable, Subscriber, -} from ".."; +} from "../module"; -export default function (Observable: typeof import("..").Observable) { +export default function (Observable: typeof import("../module").Observable) { describe("Observable", () => { it("Should be a constructor function", () => { expect(typeof Observable).to.equal("function"); @@ -50,7 +50,7 @@ export default function (Observable: typeof import("..").Observable) { } it('simulating super(sub) with Observable.call(this, sub)', () => { - function SubclassWithSuperCall(sub: Subscriber) { + function SubclassWithSuperCall(this: any, sub: Subscriber) { const self = Observable.call(this, sub) || this; self.sub = sub; return self; @@ -59,7 +59,7 @@ export default function (Observable: typeof import("..").Observable) { }); it('simulating super(sub) with Observable.apply(this, arguments)', () => { - function SubclassWithSuperApplyArgs(_sub: Subscriber) { + function SubclassWithSuperApplyArgs(this: any, _sub: Subscriber) { const self = Observable.apply(this, arguments) || this; self.sub = _sub; return self; @@ -68,7 +68,7 @@ export default function (Observable: typeof import("..").Observable) { }); it('simulating super(sub) with Observable.apply(this, [sub])', () => { - function SubclassWithSuperApplyArray(...args: [Subscriber]) { + function SubclassWithSuperApplyArray(this: any, ...args: [Subscriber]) { const self = Observable.apply(this, args) || this; self.sub = args[0]; return self; diff --git a/tests/index.ts b/src/tests/index.ts similarity index 83% rename from tests/index.ts rename to src/tests/index.ts index 7aa5625..9378631 100644 --- a/tests/index.ts +++ b/src/tests/index.ts @@ -1,6 +1,6 @@ import test from "./Observable"; -const cjs = require("../index"); +const cjs = require("../../index"); describe("CommonJS modules", () => test(cjs.Observable)); import * as esm from "../module"; diff --git a/tests/tsconfig.json b/tests/tsconfig.json deleted file mode 100644 index e4a19ab..0000000 --- a/tests/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "include": [ - "./**/*.ts", - ], - "compilerOptions": { - "noEmit": true, - "noImplicitAny": true, - "strictNullChecks": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "skipLibCheck": true, - "moduleResolution": "node", - "module": "commonjs", - "esModuleInterop": true, - "importHelpers": true, - "removeComments": true, - "allowJs": true, - "lib": ["esnext", "dom"], - "types": ["node", "mocha", "chai"] - } -} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..71bc79c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "es2020", + "declaration": true, + "sourceMap": true, + "outDir": "./dist", + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "src/**/*.ts" + ] +}