Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __TESTS_BUNDLE_SIZE__/bundleSizeTestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function bundleSizeTestRunner():Promise<void> {
const ACTUAL_SIZE_IN_KB = Math.round(bundleInfo.size / 1024);


if (ACTUAL_SIZE_IN_KB <= EXPECTED_SIZE_IN_KB && ACTUAL_SIZE_IN_KB > ALLOWED_MIN_SIZE_IN_KB) {
if (ACTUAL_SIZE_IN_KB <= EXPECTED_SIZE_IN_KB && ACTUAL_SIZE_IN_KB >= ALLOWED_MIN_SIZE_IN_KB) {
handleTestSuccess(testCases[i], ACTUAL_SIZE_IN_KB);
} else {
handleTestError(TEST_NAME, EXPECTED_SIZE_IN_KB, ACTUAL_SIZE_IN_KB, ALLOWED_MIN_SIZE_IN_KB);
Expand Down
4 changes: 1 addition & 3 deletions __TESTS__/TestUtils/createEntryMockedFS.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TEST_FILE_STRUCTURE = {
export const TEST_FILE_STRUCTURE = {
'package.json': '{"fieldA":"foobar"}',
dist: {
bundles: {
Expand All @@ -8,5 +8,3 @@ const TEST_FILE_STRUCTURE = {
}
}
};

export default TEST_FILE_STRUCTURE;
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,42 @@ describe('it works?', () => {
const t = generateTransformationString(options);
expect(t).toEqual("r_max");
});
it("should support start_offset", function () {
const t = generateTransformationString({
start_offset: "1"
});

expect(t).toBe('so_1');
});
it("should support end_offset", function () {
const t = generateTransformationString({
end_offset: "0"
});

expect(t).toBe('eo_0');
});
it("should support start_offset & end_offset", function () {
const t = generateTransformationString({
start_offset: "0",
end_offset: 1
});

expect(t).toBe('eo_1,so_0');
});
it("should support offset", function () {
const t = generateTransformationString({
offset: '0..1'
});

expect(t).toBe('eo_1,so_0');
});
it("should prefer start_offset & end_offset over offset", function () {
const t = generateTransformationString({
offset: '0..1',
start_offset: 2,
end_offset: 3
});

expect(t).toBe('eo_3,so_2');
});
});
11 changes: 5 additions & 6 deletions __TESTS__/unit/scripts/createEntryPoints.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/* eslint @typescript-eslint/no-var-requires: 0 */

import TEST_FILE_STRUCTURE from "../../TestUtils/createEntryMockedFS";
const { TEST_FILE_STRUCTURE } = require('../../TestUtils/createEntryMockedFS');

const createEntryPoints = require('../../../scripts/lib/entryPointsLib');
const mock = require('mock-fs');
const mockFs = require('mock-fs');
const fs = require('fs');


describe('Tests for createEntryPoints', () => {
beforeEach(() => {
mock.restore();
mock(TEST_FILE_STRUCTURE);
mockFs.restore();
mockFs(TEST_FILE_STRUCTURE);
});

it ('Creates the main entrypoint to the project', () => {
Expand Down Expand Up @@ -38,7 +37,7 @@ describe('Tests for createEntryPoints', () => {
});

afterAll(() => {
mock.restore();
mockFs.restore();
});
});

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "npm run test:types && npm run build && jest --coverage --reporters default && npm run test:size",
"test:size": "ts-node -O '{\"module\":\"CommonJS\"}' __TESTS_BUNDLE_SIZE__/bin/bin.ts",
"test:comp": "node ./scripts/updateCompliationTests.js && jest __TESTS__/compilationsOutput.test.ts --coverage",
"test:comp:service": "ts-node devTools/sanity/index.ts && jest __TESTS__/compilation.test.ts",
"test:comp:service": "ts-node -O '{\"module\":\"CommonJS\"}' devTools/sanity/index.ts && jest __TESTS__/compilation.test.ts",
"test:unit": "jest --reporters default",
"test:unit:watch": "jest --watch --reporters default",
"test:types": "tsc --project tsconfig.test.json",
Expand All @@ -16,9 +16,9 @@
"build:ESM": "tsc --project tsconfig.json --outDir dist --declaration true",
"build:rollup": "rollup -c",
"build:docs": "bash ./scripts/buildDocs.sh",
"build:entryPoints": "ts-node ./scripts/createEntrypoints.ts",
"build:injectPackageVersion": "ts-node ./scripts/injectPackageVersionToDistFiles.ts",
"build:updatePackageExports": "ts-node scripts/updatePackageJsonExports.ts",
"build:entryPoints": "ts-node -O '{\"module\":\"CommonJS\"}' ./scripts/createEntrypoints.ts",
"build:injectPackageVersion": "ts-node -O '{\"module\":\"CommonJS\"}' ./scripts/injectPackageVersionToDistFiles.ts",
"build:updatePackageExports": "ts-node -O '{\"module\":\"CommonJS\"}' scripts/updatePackageJsonExports.ts",
"lint": "npm run lint:src && npm run lint:test",
"lint:src": "eslint src --color --ext .ts",
"lint:test": "eslint __TESTS__ __TESTS_BUNDLE_SIZE__ --rule 'import/extensions: [0, \"never\"]' --color --ext .ts",
Expand Down Expand Up @@ -87,7 +87,7 @@
"ts-node": "^8.10.2",
"tslib": "^2.0.0",
"typedoc": "^0.17.8",
"typescript": "^3.9.3",
"typescript": "^4.2.0",
"webpack": "^4.44.1"
},
"exports": {
Expand Down
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default [
resolve(),
replace({
'PACKAGE_VERSION_INJECTED_DURING_BUILD': version,
preventAssignment: true
}),
typescript({ target: 'es5' }),
commonjs(),
Expand All @@ -41,6 +42,7 @@ export default [
resolve(),
replace({
'PACKAGE_VERSION_INJECTED_DURING_BUILD': version,
preventAssignment: true
}),
typescript({ target: "es5" }),
commonjs()
Expand Down
3 changes: 2 additions & 1 deletion rollup.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default {
}),
resolve(),
replace({
'PACKAGE_VERSION_INJECTED_DURING_BUILD': version
'PACKAGE_VERSION_INJECTED_DURING_BUILD': version,
preventAssignment: true
}),
babel({
exclude: 'node_modules/**' // only transpile our source code
Expand Down
5 changes: 3 additions & 2 deletions src/backwards/generateTransformationString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {normRangeValues} from "./utils/norm_range_values.js";
import {processVideoParams} from "./transformationProcessing/processVideoParams.js";
import Transformation from "./transformation.js";
import {processDpr} from "./transformationProcessing/processDpr.js";
import {isNumberLike} from "./utils/isNumberLike";



Expand Down Expand Up @@ -171,12 +172,12 @@ export function generateTransformationString(transformationOptions: LegacyITrans
dl: transformationOptions.delay,
dn: transformationOptions.density,
du: normRangeValues(transformationOptions.duration),
eo: normRangeValues(splitRange(transformationOptions.offset)[1]),
eo: normRangeValues(transformationOptions.end_offset || isNumberLike(transformationOptions.end_offset) ? transformationOptions.end_offset : splitRange(transformationOptions.offset)[1]),
f: transformationOptions.fetch_format,
g: transformationOptions.gravity,
pg: transformationOptions.page,
p: transformationOptions.prefix,
so: normRangeValues(splitRange(transformationOptions.offset)[0]),
so: normRangeValues(transformationOptions.start_offset || isNumberLike(transformationOptions.start_offset) ? transformationOptions.start_offset : splitRange(transformationOptions.offset)[0]),
sp: transformationOptions.streaming_profile,
vc: processVideoParams(transformationOptions.video_codec),
vs: transformationOptions.video_sampling
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"compilerOptions": {
"noImplicitAny": true,
"target": "ES2015",
"module": "ES2015",
"module": "ES2022",
"moduleResolution": "node",
"baseUrl": "src",
"esModuleInterop": true,
"resolveJsonModule": true,
"allowJs": true
"allowJs": true,
},
"include": [
"src"
]
}
}