Skip to content

Commit

Permalink
fix: reintroduce cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
dankreiger committed Oct 1, 2021
1 parent 7496ee8 commit 6402490
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 12 deletions.
25 changes: 21 additions & 4 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
[
{
"name": "CJS",
"path": "./dist/cjs/index.js",
"limit": "205 B"
},
{
"name": "ESM: Left",
"path": "./dist/esm/index.js",
"limit": "5 B",
"limit": "4 B",
"import": "{ Left }"
},
{
"name": "ESM: Right",
"path": "./dist/esm/index.js",
"limit": "5 B",
"limit": "4 B",
"import": "{ Right }"
},
{
"name": "ESM: of",
"path": "./dist/esm/index.js",
"limit": "4 B",
"import": "{ of }"
},
{
"name": "ESM: fromNullable",
"path": "./dist/esm/index.js",
"limit": "5 B",
"limit": "4 B",
"import": "{ fromNullable }"
},
{
"name": "ESM: tryCatch",
"path": "./dist/esm/index.js",
"limit": "5 B",
"limit": "4 B",
"import": "{ tryCatch }"
},
{
"name": "ESM: inspect (dev only)",
"path": "./dist/esm/index.js",
"limit": "121 B",
"import": "{ inspect }"
}
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@
"access": "public",
"registry": "https://registry.npmjs.org"
}
}
}
6 changes: 6 additions & 0 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
Expand All @@ -9,6 +10,10 @@ const babelRuntimeVersion = pkg.devDependencies['@babel/runtime'].replace(
);

const config = [
{
file: pkg.main,
format: 'cjs',
},
{
file: pkg.module,
format: 'es',
Expand All @@ -21,6 +26,7 @@ const config = [
},
plugins: [
resolve(),
commonjs(),
typescript({
tsconfigDefaults: {
exclude: [
Expand Down
3 changes: 1 addition & 2 deletions src/Either/dev/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import type { T_EitherInspect } from './types';

/**
* @since 1.0.5
* @internal
* @description
* calls inspect on the contained value (dev only)
* attaches a dev inspect propery to the Monad
* @param {I_Either} E
*/
export function inspect(E: I_Either): T_EitherInspect {
Expand Down
2 changes: 0 additions & 2 deletions src/Either/dev/overloads/_ins.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/**
* @since 1.0.6
* @internal
*/
import type { T_InspectVal } from '../types';

/**
* @since 1.0.6
* @internal
*/
export function _ins<T extends 'Left' | 'Right', U>(
Type: T,
Expand Down
2 changes: 0 additions & 2 deletions src/Either/dev/types/T_EitherInspect.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @since 1.0.6
* @internal
*/
import type { T_InspectVal } from '.';
import type { I_Either } from '../../interfaces';
Expand All @@ -9,7 +8,6 @@ import type { I_Right } from '../../Right';

/**
* @since 1.0.6
* @internal
*/
export type T_EitherInspect = I_Either & {
Left: <T>(x: T) => I_Left<T> & { inspect: () => T_InspectVal<'Left'> };
Expand Down
1 change: 0 additions & 1 deletion src/Either/dev/types/T_InspectVal.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* @since 1.0.6
* @internal
*/
export type T_InspectVal<T extends 'Left' | 'Right'> = `${T}(${string})`;
4 changes: 4 additions & 0 deletions src/Either/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { inspect } from './dev';
import type { I_Either } from './interfaces';
import { Left } from './Left';
import { Right } from './Right';
Expand All @@ -11,4 +12,7 @@ export const Either: I_Either = {
tryCatch,
Left,
Right,
of: Right,
};

export { inspect };
1 change: 1 addition & 0 deletions src/Either/interfaces/I_Either.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export interface I_Either {
Right: typeof Right;
fromNullable: typeof fromNullable;
tryCatch: typeof tryCatch;
of: typeof Right;
}

0 comments on commit 6402490

Please sign in to comment.