BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-03-31 01:20:01 +02:00
parent 01f4a53b5b
commit e562e8f099
12 changed files with 17580 additions and 1076 deletions

View File

@ -1,10 +1,10 @@
import * as plugins from './smartstream.plugins';
import * as plugins from './smartstream.plugins.js';
// interfaces
import { Transform } from 'stream';
export interface IErrorFunction {
(err): any;
(err: Error): any;
}
export interface ICustomEventFunction {
@ -20,7 +20,7 @@ export interface ICustomEventObject {
* class Smartstream handles
*/
export class Smartstream {
private streamArray = [];
private streamArray: Array<plugins.stream.Duplex> = [];
private customEventObjectArray: ICustomEventObject[] = [];
private streamStartedDeferred = plugins.smartpromise.defer();
@ -44,7 +44,7 @@ export class Smartstream {
onCustomEvent(eventNameArg: string, eventFunctionArg: ICustomEventFunction) {
this.customEventObjectArray.push({
eventName: eventNameArg,
eventFunction: eventFunctionArg
eventFunction: eventFunctionArg,
});
}
@ -56,7 +56,7 @@ export class Smartstream {
const done = plugins.smartpromise.defer<void>();
// clone Array
const streamExecutionArray = [];
const streamExecutionArray: Array<plugins.stream.Duplex> = [];
for (const streamItem of this.streamArray) {
streamExecutionArray.push(streamItem);
}
@ -68,7 +68,7 @@ export class Smartstream {
if (firstIteration === true) {
finalStream = stream;
}
stream.on('error', err => {
stream.on('error', (err) => {
done.reject(err);
});
for (const customEventObject of this.customEventObjectArray) {
@ -100,7 +100,7 @@ export let cleanPipe = () => {
(file, enc, cb) => {
cb();
},
cb => {
(cb) => {
cb();
}
);

View File

@ -1,4 +1,12 @@
import * as stream from 'stream';
export { stream };
// pushrocks scope
import * as smartpromise from '@pushrocks/smartpromise';
export { smartpromise };
// thirdparty
import * as through2 from 'through2';
export { smartpromise, through2 };
export { through2 };