From ce62be12edb637effd99412c1e6f07529a53116f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 18 Nov 2020 18:49:18 +0100 Subject: [PATCH] feat: add initial modules --- .eslintignore | 1 + .gitignore | 1 + README.md | 57 +++++++++++++++++- package.json | 6 +- src/mock/empty.ts | 1 + src/mock/generic.ts | 25 ++++++++ src/mock/noop.ts | 1 + src/node/http/consts.ts | 80 ++++++++++++++++++++++++++ src/node/http/index.ts | 3 + src/node/http/request.ts | 42 ++++++++++++++ src/node/http/response.ts | 111 ++++++++++++++++++++++++++++++++++++ src/node/index.ts | 3 + src/node/net/index.ts | 1 + src/node/net/socket.ts | 87 ++++++++++++++++++++++++++++ src/node/stream/index.ts | 2 + src/node/stream/readable.ts | 77 +++++++++++++++++++++++++ src/node/stream/writable.ts | 77 +++++++++++++++++++++++++ src/npm/depd.ts | 8 +++ src/npm/mime-db.ts | 25 ++++++++ src/npm/mime.ts | 18 ++++++ src/shims/fetch.ts | 0 src/shims/process.ts | 4 ++ src/types.ts | 3 + src/utils.ts | 23 ++++++++ tsconfig.json | 2 +- yarn.lock | 5 ++ 26 files changed, 658 insertions(+), 5 deletions(-) create mode 100644 src/mock/empty.ts create mode 100644 src/mock/generic.ts create mode 100644 src/mock/noop.ts create mode 100644 src/node/http/consts.ts create mode 100644 src/node/http/index.ts create mode 100644 src/node/http/request.ts create mode 100644 src/node/http/response.ts create mode 100644 src/node/index.ts create mode 100644 src/node/net/index.ts create mode 100644 src/node/net/socket.ts create mode 100644 src/node/stream/index.ts create mode 100644 src/node/stream/readable.ts create mode 100644 src/node/stream/writable.ts create mode 100644 src/npm/depd.ts create mode 100644 src/npm/mime-db.ts create mode 100644 src/npm/mime.ts create mode 100644 src/shims/fetch.ts create mode 100644 src/shims/process.ts create mode 100644 src/types.ts create mode 100644 src/utils.ts diff --git a/.eslintignore b/.eslintignore index 1521c8b7..f2213879 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ dist +lib diff --git a/.gitignore b/.gitignore index 61ef153c..cc3a1862 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules *.log* dist +lib diff --git a/README.md b/README.md index a9dae871..95dc1b1c 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,68 @@ And then SSR2 moved browser code to server And then Workers3 moved browser/server code to workers -Workers are neither NodeJS with `process` or browser with `window` yet expected to run code that had to work both of them :} +Workers are neither NodeJS with `process` or browser with `window` + +Yet expected to run code that had to work both of them :} **[1]** Single Page Applications **[2]** Server Side Rendering **[3]** https://workers.cloudflare.com - ## What is un? -Un is a preset of polyfills and small utilities to make it easier doing SSR and serving API inside workers. +un is a framework of modules, shims and presets that work perfectly with any Javascript environemnt +including Browsers, Workers, NodeJS or pure JavaScript. + +You still need a bundler like [rollup.js](https://rollupjs.org) and un will disapear as soon as is bundled. + +The goal is that final bundle works consistent regardless of running context yet not adding excessive polyfills. + +## Install + +Install un as `devDependen: + +```bash +yarn add --dev un +# or +npm i -D @nuxt/un +``` + +You can import modules from `un/lib/` + +## Shims + +- [process](./src/shims/process.ts) + +## NodeJS + +### `http` + +- [IncomingMessage](./src/node/http/request.ts) +- [ServerResponse](./src/node/http/request.ts) +- [METHODS](./src/node/http/consts.ts) +- [STATUS_CODES](./src/node/http/consts.ts) + +### `net` + +- [Socket](./src/node/net/socket.ts) + +### `stream` + +- [Readable](./src/node/stream/readable.ts) +- [Writable](./src/node/stream/writable.ts) + +## Mocks + +- [generic](./src/mock/empty.ts): Exports a proxy that can act as a recursive function, calss, object or array +- [empty](./src/mock/empty.ts): Exports `{}` +- [noop](./src/mock/noop.ts): Exports `() => {}` + +## Packages +- [depd](./src/npm/depd.ts) +- [mime-db](./src/npm/mime-db.ts) +- [mime](./src/npm/mime.ts) ## License diff --git a/package.json b/package.json index f9feb306..9716112a 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,12 @@ "repository": "nuxt-contrib/un", "license": "MIT", "sideEffects": false, + "types": "lib/*.d.ts", "files": [ "dist" ], "scripts": { - "build": "true", + "build": "tsc src", "lint": "eslint --ext ts .", "release": "yarn build && standard-version && npm publish && git push --follow-tags" }, @@ -19,5 +20,8 @@ "eslint": "latest", "standard-version": "latest", "typescript": "latest" + }, + "dependencies": { + "mime": "^2.4.6" } } diff --git a/src/mock/empty.ts b/src/mock/empty.ts new file mode 100644 index 00000000..b1c6ea43 --- /dev/null +++ b/src/mock/empty.ts @@ -0,0 +1 @@ +export default {} diff --git a/src/mock/generic.ts b/src/mock/generic.ts new file mode 100644 index 00000000..fab96b92 --- /dev/null +++ b/src/mock/generic.ts @@ -0,0 +1,25 @@ +function getProxy (name: string, overrides: any = {}): any { + const fn = function () { } + fn.prototype.name = name + const props: any = {} + return new Proxy(fn, { + get (_target, prop) { + if (prop === 'caller') { return null } + if (prop === '__createMock__') { return getProxy } + if (prop in overrides) { return overrides[prop] } + // @ts-ignore + return (props[prop] = props[prop] || getProxy(`${name}.${prop.toString()}`)) + }, + apply (_target, _this, _args) { + return getProxy(`${name}()`) + }, + construct (_target, _args, _newT) { + return getProxy(`[${name}]`) as Object + }, + enumerate (_target) { + return [] + } + }) +} + +export default getProxy('mock') diff --git a/src/mock/noop.ts b/src/mock/noop.ts new file mode 100644 index 00000000..ead516c9 --- /dev/null +++ b/src/mock/noop.ts @@ -0,0 +1 @@ +export default () => {} diff --git a/src/node/http/consts.ts b/src/node/http/consts.ts new file mode 100644 index 00000000..2df45852 --- /dev/null +++ b/src/node/http/consts.ts @@ -0,0 +1,80 @@ +export const METHODS = [ + 'ACL', 'BIND', 'CHECKOUT', + 'CONNECT', 'COPY', 'DELETE', + 'GET', 'HEAD', 'LINK', + 'LOCK', 'M-SEARCH', 'MERGE', + 'MKACTIVITY', 'MKCALENDAR', 'MKCOL', + 'MOVE', 'NOTIFY', 'OPTIONS', + 'PATCH', 'POST', 'PRI', + 'PROPFIND', 'PROPPATCH', 'PURGE', + 'PUT', 'REBIND', 'REPORT', + 'SEARCH', 'SOURCE', 'SUBSCRIBE', + 'TRACE', 'UNBIND', 'UNLINK', + 'UNLOCK', 'UNSUBSCRIBE' +] + +export const STATUS_CODES = { + 100: 'Continue', + 101: 'Switching Protocols', + 102: 'Processing', + 103: 'Early Hints', + 200: 'OK', + 201: 'Created', + 202: 'Accepted', + 203: 'Non-Authoritative Information', + 204: 'No Content', + 205: 'Reset Content', + 206: 'Partial Content', + 207: 'Multi-Status', + 208: 'Already Reported', + 226: 'IM Used', + 300: 'Multiple Choices', + 301: 'Moved Permanently', + 302: 'Found', + 303: 'See Other', + 304: 'Not Modified', + 305: 'Use Proxy', + 307: 'Temporary Redirect', + 308: 'Permanent Redirect', + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Payload Too Large', + 414: 'URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Range Not Satisfiable', + 417: 'Expectation Failed', + 418: "I'm a Teapot", + 421: 'Misdirected Request', + 422: 'Unprocessable Entity', + 423: 'Locked', + 424: 'Failed Dependency', + 425: 'Too Early', + 426: 'Upgrade Required', + 428: 'Precondition Required', + 429: 'Too Many Requests', + 431: 'Request Header Fields Too Large', + 451: 'Unavailable For Legal Reasons', + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 506: 'Variant Also Negotiates', + 507: 'Insufficient Storage', + 508: 'Loop Detected', + 509: 'Bandwidth Limit Exceeded', + 510: 'Not Extended', + 511: 'Network Authentication Required' +} diff --git a/src/node/http/index.ts b/src/node/http/index.ts new file mode 100644 index 00000000..d456161f --- /dev/null +++ b/src/node/http/index.ts @@ -0,0 +1,3 @@ +export * from './consts' +export * from './request' +export * from './response' diff --git a/src/node/http/request.ts b/src/node/http/request.ts new file mode 100644 index 00000000..db984f6a --- /dev/null +++ b/src/node/http/request.ts @@ -0,0 +1,42 @@ +import type http from 'http' +import { Socket } from 'src/node/net/socket' +import { Readable } from 'src/node/stream/readable' +import { rawHeaders } from 'src/utils' + +// Docs: https://nodejs.org/api/http.html#http_class_http_incomingmessage +// Implementation: https://github.com/nodejs/node/blob/master/lib/_http_incoming.js + +export class IncomingMessage extends Readable implements http.IncomingMessage { + public aborted: boolean = false; + public httpVersion: string = '1.1' + public httpVersionMajor: number = 1 + public httpVersionMinor: number = 1 + public complete: boolean = true + public connection: Socket + public socket: Socket + public headers: http.IncomingHttpHeaders = {} + public trailers = {} + public method: string = 'GET' + public url: string = '/' + public statusCode: number = 200 + public statusMessage: string = '' + + readable: boolean = false + + constructor (socket?: Socket) { + super() + this.socket = this.connection = socket || new Socket() + } + + get rawHeaders () { + return rawHeaders(this.headers) + } + + get rawTrailers () { + return [] + } + + setTimeout (_msecs: number, _callback?: () => void) { + return this + } +} diff --git a/src/node/http/response.ts b/src/node/http/response.ts new file mode 100644 index 00000000..66a3c5a5 --- /dev/null +++ b/src/node/http/response.ts @@ -0,0 +1,111 @@ +import type http from 'http' +import type { Socket } from 'net' +import { Callback, HeadersObject } from 'src/types' +import { Writable } from 'src/node/stream/writable' + +// Docs: https://nodejs.org/api/http.html#http_class_http_serverresponse +// Implementation: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js + +export class ServerResponse extends Writable implements http.ServerResponse { + statusCode: number = 200; + statusMessage: string = ''; + upgrading: boolean = false; + chunkedEncoding: boolean = false; + shouldKeepAlive: boolean = false; + useChunkedEncodingByDefault: boolean = false; + sendDate: boolean = false; + finished: boolean = false; + headersSent: boolean = false; + connection: Socket | null = null; + socket: Socket | null = null; + req: http.IncomingMessage + + _headers: HeadersObject = {} + + constructor (req: http.IncomingMessage) { + super() + this.req = req + } + + assignSocket (socket: Socket): void { + // @ts-ignore + socket._httpMessage = this + // socket.on('close', onServerResponseClose) + this.socket = socket + this.connection = socket + this.emit('socket', socket) + this._flush() + } + + _flush () { + this.flushHeaders() + } + + detachSocket (_socket: Socket): void { + } + + writeContinue (_callback?: Callback): void { + } + + writeHead (statusCode: number, + arg1?: string | http.OutgoingHttpHeaders | http.OutgoingHttpHeader[], + arg2?: http.OutgoingHttpHeaders | http.OutgoingHttpHeader[]) { + if (statusCode) { + this.statusCode = statusCode + } + if (typeof arg1 === 'string') { + this.statusMessage = arg1 + arg1 = undefined + } + const headers = arg2 || arg1 + if (headers) { + if (Array.isArray(headers)) { + // TODO: OutgoingHttpHeader[] + } else { + for (const key in headers) { + // @ts-ignore + this.setHeader(key, headers[key]) + } + } + } + this.headersSent = true + return this + } + + writeProcessing (): void { + } + + setTimeout (_msecs: number, _callback?: Callback): this { + return this + } + + setHeader (name: string, value: number | string | ReadonlyArray): void { + this._headers[name.toLowerCase()] = value + '' + } + + getHeader (name: string): number | string | string[] | undefined { + return this._headers[name.toLowerCase()] + } + + getHeaders (): http.OutgoingHttpHeaders { + return this._headers + } + + getHeaderNames (): string[] { + return Object.keys(this._headers) + } + + hasHeader (name: string): boolean { + return name.toLowerCase() in this._headers + } + + removeHeader (name: string): void { + delete this._headers[name.toLowerCase()] + } + + addTrailers (_headers: http.OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void { + } + + flushHeaders (): void { + } +} diff --git a/src/node/index.ts b/src/node/index.ts new file mode 100644 index 00000000..6eb78dc1 --- /dev/null +++ b/src/node/index.ts @@ -0,0 +1,3 @@ +export * from './http' +export * from './net' +export * from './stream' diff --git a/src/node/net/index.ts b/src/node/net/index.ts new file mode 100644 index 00000000..5ce4d71f --- /dev/null +++ b/src/node/net/index.ts @@ -0,0 +1 @@ +export * from './socket' diff --git a/src/node/net/socket.ts b/src/node/net/socket.ts new file mode 100644 index 00000000..8c9f8217 --- /dev/null +++ b/src/node/net/socket.ts @@ -0,0 +1,87 @@ +import type * as net from 'net' +import { Callback, BufferEncoding } from 'src/types' +import { Readable } from 'src/node/stream/readable' +import { Writable } from 'src/node/stream/writable' +import { mergeFns } from 'src/utils' + +type ReadableAndWritableT = Readable & Writable +type ReadableAndWritableC = new () => ReadableAndWritableT +const ReadableAndWritable: ReadableAndWritableC = class { + constructor (readable = new Readable(), writable = new Writable()) { + Object.assign(this, readable) + Object.assign(this, writable) + // @ts-ignore + this._destroy = mergeFns(readable._destroy, writable._destroy) + } +} as any +Object.assign(ReadableAndWritable.prototype, Readable.prototype) +Object.assign(ReadableAndWritable.prototype, Writable.prototype) + +// Docs: https://nodejs.org/api/net.html#net_class_net_socket +export class Socket extends ReadableAndWritable implements net.Socket { + readonly bufferSize: number = 0 + readonly bytesRead: number = 0 + readonly bytesWritten: number = 0 + readonly connecting: boolean = false + readonly destroyed: boolean = false + readonly localAddress: string = '' + readonly localPort: number = 0 + readonly remoteAddress?: string = '' + readonly remoteFamily?: string = '' + readonly remotePort?: number = 0 + + constructor (_options?: net.SocketConstructorOpts) { + super() + } + + write (_buffer: Uint8Array | string, + _arg1?: BufferEncoding | Callback, + _arg2?: Callback): boolean { + return false + } + + connect (_arg1: number | string | net.SocketConnectOpts, + _arg2?: string | Callback, _arg3?: Callback) { + return this + } + + end (_arg1?: Callback | Uint8Array | string, + _arg2?: BufferEncoding | Callback, _arg3?: Callback): void { + } + + setEncoding (_encoding?: BufferEncoding): this { + return this + } + + pause () { + return this + } + + resume () { + return this + } + + setTimeout (_timeout: number, _callback?: Callback): this { + return this + } + + setNoDelay (_noDelay?: boolean): this { + return this + } + + setKeepAlive (_enable?: boolean, _initialDelay?: number): this { + return this + } + + address () { + return {} + } + + unref () { + return this + } + + ref () { + return this + } +} diff --git a/src/node/stream/index.ts b/src/node/stream/index.ts new file mode 100644 index 00000000..92fe7db5 --- /dev/null +++ b/src/node/stream/index.ts @@ -0,0 +1,2 @@ +export * from './readable' +export * from './writable' diff --git a/src/node/stream/readable.ts b/src/node/stream/readable.ts new file mode 100644 index 00000000..27733dcd --- /dev/null +++ b/src/node/stream/readable.ts @@ -0,0 +1,77 @@ +import { EventEmitter } from 'events' +import type * as stream from 'stream' +import type { BufferEncoding, Callback } from 'src/types' + +// Docs: https://nodejs.org/api/stream.html#stream_readable_streams +// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/readable.js + +export class Readable extends EventEmitter implements stream.Readable { + readonly readableEncoding: BufferEncoding | null = null + readonly readableEnded: boolean = true + readonly readableFlowing: boolean | null = false + readonly readableHighWaterMark: number = 0 + readonly readableLength: number = 0 + readonly readableObjectMode: boolean = false + + readable: boolean = false + destroyed: boolean = false + + static from (_iterable: Iterable | AsyncIterable, options?: stream.ReadableOptions) { + return new Readable(options) + } + + constructor (_opts?: stream.ReadableOptions) { + super() + } + + _read (_size: number) { + } + + read (_size?: number) { + } + + setEncoding (_encoding: BufferEncoding) { + return this + } + + pause () { + return this + } + + resume () { + return this + } + + isPaused () { + return true + } + + unpipe (_destination?: any) { + return this + } + + unshift (_chunk: any, _encoding?: BufferEncoding) { + } + + wrap (_oldStream: any) { + return this + } + + push (_chunk: any, _encoding?: BufferEncoding) { + return false + } + + _destroy (_error?: any, _callback?: Callback) { + } + + destroy (error?: Error) { + return this._destroy(error) + } + + pipe (_destenition: T, _options?: { end?: boolean }): T { + return {} as T + } + + async *[Symbol.asyncIterator] (): AsyncIterableIterator { + } +} diff --git a/src/node/stream/writable.ts b/src/node/stream/writable.ts new file mode 100644 index 00000000..0de145bb --- /dev/null +++ b/src/node/stream/writable.ts @@ -0,0 +1,77 @@ +import { EventEmitter } from 'events' +import type * as stream from 'stream' +import type { BufferEncoding, Callback } from 'src/types' + +// Docs: https://nodejs.org/api/stream.html#stream_writable_streams +// Implementation: https://github.com/nodejs/node/blob/master/lib/internal/streams/writable.js + +export class Writable extends EventEmitter implements stream.Writable { + readonly writable: boolean = true + writableEnded: boolean =false + writableFinished: boolean = false + readonly writableHighWaterMark: number = 0 + readonly writableLength: number = 0 + readonly writableObjectMode: boolean = false + readonly writableCorked: number = 0 + + destroyed: boolean = false + + _data: any + _encoding: BufferEncoding = 'utf-8' + + constructor (_opts?: stream.WritableOptions) { + super() + } + + pipe (_destenition: T, _options?: { end?: boolean }): T { + return {} as T + } + + _write (chunk: any, encoding: BufferEncoding, callback?: Callback): void { + this._data = chunk // TODO: append + this._encoding = encoding + if (callback) { + callback() + } + } + + _writev? (_chunks: Array<{ chunk: any, encoding: BufferEncoding }>, _callback: (error?: Error | null) => void): void { + } + + _destroy (_error: any, _callback: Callback): void { + } + + _final (_callback: Callback) { + } + + write (chunk: any, arg2?: BufferEncoding | Callback, arg3?: Callback): boolean { + const encoding = typeof arg2 === 'string' ? this._encoding : 'utf-8' + const cb = typeof arg2 === 'function' ? arg2 : (typeof arg3 === 'function' ? arg3 : undefined) + this._write(chunk, encoding, cb) + return true + } + + setDefaultEncoding (_encoding: BufferEncoding): this { + return this + } + + end (arg1: Callback | any, arg2?: Callback | BufferEncoding, arg3?: Callback): void { + const cb = (typeof arg1 === 'function') ? arg1 : (typeof arg2 === 'function' ? arg2 : (typeof arg3 === 'function' ? arg3 : undefined)) + const data = arg1 !== cb ? arg1 : undefined + if (data) { + const encoding = arg2 !== cb ? arg2 : undefined + this.write(data, encoding, cb) + } + this.writableEnded = true + this.writableFinished = true + } + + cork (): void { + } + + uncork (): void { + } + + destroy (_error?: Error): void { + } +} diff --git a/src/npm/depd.ts b/src/npm/depd.ts new file mode 100644 index 00000000..e56909ba --- /dev/null +++ b/src/npm/depd.ts @@ -0,0 +1,8 @@ +// https://www.npmjs.com/package/depd + +export default function depd (_namespace: string) { + function deprecate () { } + deprecate.function = (fn: any) => fn + deprecate.property = () => {} + return deprecate +} diff --git a/src/npm/mime-db.ts b/src/npm/mime-db.ts new file mode 100644 index 00000000..6120e6f8 --- /dev/null +++ b/src/npm/mime-db.ts @@ -0,0 +1,25 @@ +// https://www.npmjs.com/package/mime-db + +export default { + 'text/html': { + source: 'iana', + compressible: true, + extensions: ['html', 'htm', 'shtml'] + }, + 'application/javascript': { + source: 'iana', + charset: 'UTF-8', + compressible: true, + extensions: ['js', 'mjs'] + }, + 'text/javascript': { + source: 'iana', + compressible: true + }, + 'application/json': { + source: 'iana', + charset: 'UTF-8', + compressible: true, + extensions: ['json', 'map'] + } +} diff --git a/src/npm/mime.ts b/src/npm/mime.ts new file mode 100644 index 00000000..644ef02e --- /dev/null +++ b/src/npm/mime.ts @@ -0,0 +1,18 @@ +// https://www.npmjs.com/package/mime + +// @ts-ignore +import mimeLite from 'mime/lite' + +const mime = { ...mimeLite } + +// Adding v1 compat since rollup mocks flatten dependencies +// https://www.npmjs.com/package/mime/v/1.6.0 +mime.lookup = mime.getType +mime.extension = mime.getExtension +const noop = () => {} +mime.define = noop +mime.load = noop +mime.default_type = 'application/octet-stream' +mime.charsets = { lookup: () => 'UTF-8' } + +export default mime diff --git a/src/shims/fetch.ts b/src/shims/fetch.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/shims/process.ts b/src/shims/process.ts new file mode 100644 index 00000000..bcf3902b --- /dev/null +++ b/src/shims/process.ts @@ -0,0 +1,4 @@ +// https://github.com/defunctzombie/node-process/ +global.process = global.process || {} +Object.assign(global.process, require('node-process')) +export default global.process diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 00000000..0fbdc239 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,3 @@ +export type Callback = (error?: E) => void +export type HeadersObject = { [key: string]: string | string[] | undefined } +export type BufferEncoding = any // TODO diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 00000000..06517ea9 --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,23 @@ +import type { HeadersObject } from 'src/types' + +export function rawHeaders (headers: HeadersObject) { + const rawHeaders = [] + for (const key in headers) { + if (Array.isArray(headers[key])) { + for (const h of headers[key] as any) { + rawHeaders.push(key, h) + } + } else { + rawHeaders.push(key, headers[key]) + } + } + return rawHeaders +} + +export function mergeFns (...functions: Function[]) { + return function (...args: any[]) { + for (const fn of functions) { + fn(...args) + } + } +} diff --git a/tsconfig.json b/tsconfig.json index 924438b1..fa200f04 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,9 +7,9 @@ "esModuleInterop": true, "strict": true, "declaration": true, + "outDir": "lib", "types": [ "node", - "jest" ] }, "include": [ diff --git a/yarn.lock b/yarn.lock index 46a985cd..1b3c6450 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1889,6 +1889,11 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" +mime@^2.4.6: + version "2.4.6" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.6.tgz#e5b407c90db442f2beb5b162373d07b69affa4d1" + integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA== + min-indent@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"