Skip to content

Commit

Permalink
ESM module fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wisekaa03 committed Aug 21, 2022
1 parent c4c1f20 commit f780d02
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import pMap from 'p-map';
import { parse, stringify } from 'json5';
import assert from 'assert';

import editly from '.';
import editly from './index';

// See also readme
const cli = meow(`
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ declare namespace Editly {
/**
* Output path (`.mp4` or `.mkv`, can also be a `.gif`).
*/
outPath: string;
outPath: string | undefined;

/**
* List of clip objects that will be played in sequence.
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Audio from './audio';

const channels = 4;

const Editly = async (config = {}) => {
export const Editly = async (config = {}) => {
const {
// Testing options:
enableFfmpegLog = false,
Expand Down Expand Up @@ -398,7 +398,7 @@ const Editly = async (config = {}) => {

// Pure function to get a frame at a certain time
// TODO I think this does not respect transition durations
async function renderSingleFrame({
export async function renderSingleFrame({
time = 0,
defaults,
width = 800,
Expand Down
15 changes: 12 additions & 3 deletions sources/frameSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ import {
createFabricCanvas,
renderFabricCanvas,
} from './fabric';

import { customFabricFrameSource, subtitleFrameSource, titleFrameSource, newsTitleFrameSource, fillColorFrameSource, radialGradientFrameSource, linearGradientFrameSource, imageFrameSource, imageOverlayFrameSource, slideInTextFrameSource } from './fabric/fabricFrameSources';

import {
customFabricFrameSource,
subtitleFrameSource,
titleFrameSource,
newsTitleFrameSource,
fillColorFrameSource,
radialGradientFrameSource,
linearGradientFrameSource,
imageFrameSource,
imageOverlayFrameSource,
slideInTextFrameSource,
} from './fabric/fabricFrameSources';
import createVideoFrameSource from './videoFrameSource';
import { createGlFrameSource } from './glFrameSource';

Expand Down
12 changes: 3 additions & 9 deletions transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ function getRandomTransition() {

// https://easings.net/

function easeOutExpo(x) {
export function easeOutExpo(x) {
return x === 1 ? 1 : 1 - (2 ** (-10 * x));
}

function easeInOutCubic(x) {
export function easeInOutCubic(x) {
return x < 0.5 ? 4 * x * x * x : 1 - ((-2 * x + 2) ** 3) / 2;
}

Expand All @@ -24,7 +24,7 @@ function getTransitionEasingFunction(easing, transitionName) {
return (progress) => progress;
}

function calcTransition(defaults, transition, isLastClip) {
export function calcTransition(defaults, transition, isLastClip) {
if (transition === null || isLastClip) return { duration: 0 };

const getTransitionDefault = (key) => (defaults.transition ? defaults.transition[key] : undefined);
Expand Down Expand Up @@ -60,9 +60,3 @@ function calcTransition(defaults, transition, isLastClip) {
easingFunction: getTransitionEasingFunction(transitionOrDefault.easing, transitionOrDefault.name),
};
}

export default {
calcTransition,
easeInOutCubic,
easeOutExpo,
};

0 comments on commit f780d02

Please sign in to comment.