Skip to content

🎥 Make videos programmatically with React

more packages support skia

Jonny Burgerbf5c31f0198d
diff --git a/packages/astro-example/package.json b/packages/astro-example/package.json
index 0c39b790b0..f8b7f2ba3b 100644
--- a/packages/astro-example/package.json
+++ b/packages/astro-example/package.json
@@ -21,6 +21,8 @@
"react-dom": "^18.1.0",
"remotion": "3.3.62",
"@remotion/lottie": "3.3.62",
- "@remotion/gif": "3.3.62"
+ "@remotion/motion-blur": "3.3.62",
+ "@remotion/gif": "3.3.62",
+ "@remotion/skia": "3.3.62"
}
}
diff --git a/packages/astro-example/test.cjs b/packages/astro-example/test.cjs
index 30e6754451..c9d2726b1d 100644
--- a/packages/astro-example/test.cjs
+++ b/packages/astro-example/test.cjs
@@ -2,11 +2,19 @@ const assert = require("assert");
const { interpolate } = require("remotion");
const { Player } = require("@remotion/player");
const { VERSION } = require("remotion/version");
+const { enableSkia } = require("@remotion/skia/enable");
+const { Lottie } = require("@remotion/lottie");
+const { Gif } = require("@remotion/gif");
+const { CameraMotionBlur } = require("@remotion/motion-blur");
const val = interpolate(1, [0, 1], [0, 100]);
assert(val === 100);
assert(Boolean(Player));
assert(typeof VERSION === "string");
+assert(Boolean(enableSkia));
+assert(Boolean(Lottie));
+assert(Boolean(Gif));
+assert(Boolean(CameraMotionBlur));
console.log("CommonJS works!");
diff --git a/packages/astro-example/test.js b/packages/astro-example/test.js
index 5b20f1a548..72eb2d10d7 100644
--- a/packages/astro-example/test.js
+++ b/packages/astro-example/test.js
@@ -2,11 +2,19 @@ const assert = require("assert");
const { interpolate } = require("remotion");
const { Player } = require("@remotion/player");
const { VERSION } = require("remotion/version");
+const { enableSkia } = require("@remotion/skia/enable");
+const { Lottie } = require("@remotion/lottie");
+const { Gif } = require("@remotion/gif");
+const { CameraMotionBlur } = require("@remotion/motion-blur");
const val = interpolate(1, [0, 1], [0, 100]);
assert(val === 100);
assert(Boolean(Player));
assert(typeof VERSION === "string");
+assert(Boolean(enableSkia));
+assert(Boolean(Lottie));
+assert(Boolean(Gif));
+assert(Boolean(CameraMotionBlur));
console.log("ESM Wallaby works!");
diff --git a/packages/astro-example/test.mjs b/packages/astro-example/test.mjs
index 4f25a2f169..bdd8fef6e2 100644
--- a/packages/astro-example/test.mjs
+++ b/packages/astro-example/test.mjs
@@ -2,11 +2,18 @@ import assert from "assert";
import { interpolate } from "remotion";
import { Player } from "@remotion/player";
import { VERSION } from "remotion/version";
+import { enableSkia } from "@remotion/skia/enable";
+import { Lottie } from "@remotion/lottie";
+import { MotionBlur } from "@remotion/motion-blur";
+import { Gif } from "@remotion/gif";
const val = interpolate(1, [0, 1], [0, 100]);
assert(val === 100);
assert(Boolean(Player));
assert(typeof VERSION === "string");
+assert(Boolean(enableSkia));
+assert(Boolean(Lottie));
+assert(Boolean(Gif));
console.log("ESM works!");
diff --git a/packages/core/rollup-version.config.js b/packages/core/rollup-version.config.js
index ae3c77ceb6..e8db508ddd 100644
--- a/packages/core/rollup-version.config.js
+++ b/packages/core/rollup-version.config.js
@@ -13,7 +13,7 @@ export default [
],
plugins: [
typescript({
- tsconfig: 'tsconfig.json',
+ tsconfig: 'tsconfig-esm.json',
sourceMap: false,
outputToFilesystem: true,
}),
diff --git a/packages/example/package.json b/packages/example/package.json
index 76f308c210..97f0ee12df 100644
--- a/packages/example/package.json
+++ b/packages/example/package.json
@@ -41,6 +41,7 @@
"@remotion/renderer": "3.3.62",
"@remotion/shapes": "3.3.62",
"@remotion/three": "3.3.62",
+ "@remotion/skia": "3.3.62",
"@types/express": "^4.17.11",
"@types/node": "^16.7.5",
"@types/opentype.js": "^1.3.4",
diff --git a/packages/example/src/Skia/index.tsx b/packages/example/src/Skia/index.tsx
new file mode 100644
index 0000000000..deaf5ae5b9
--- /dev/null
+++ b/packages/example/src/Skia/index.tsx
@@ -0,0 +1,10 @@
+import {SkiaCanvas} from '@remotion/skia';
+import React from 'react';
+
+export const SkiaDemo: React.FC = () => {
+ return (
+ <SkiaCanvas width={1090} height={1090}>
+ hi
+ </SkiaCanvas>
+ );
+};
diff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsx
index 7f165de04d..d765f2127c 100644
--- a/packages/example/src/Video.tsx
+++ b/packages/example/src/Video.tsx
@@ -26,6 +26,7 @@ import EllipseTest from './Shapes/EllipseTest';
import RectTest from './Shapes/RectTest';
import StarTest from './Shapes/StarTest';
import TriangleTest from './Shapes/TriangleTest';
+import {SkiaDemo} from './Skia';
import {SkipZeroFrame} from './SkipZeroFrame';
import {BaseSpring, SpringWithDuration} from './Spring/base-spring';
import {SeriesTesting} from './StaggerTesting';
@@ -656,6 +657,16 @@ export const Index: React.FC = () => {
durationInFrames={150}
/>
</Folder>
+ <Folder name="skia">
+ <Composition
+ id="SkiaDemo"
+ component={SkiaDemo}
+ width={1920}
+ height={1080}
+ fps={30}
+ durationInFrames={180}
+ />
+ </Folder>
</>
);
};
diff --git a/packages/example/src/index.mjs b/packages/example/src/index.mjs
new file mode 100644
index 0000000000..fbd95411ac
--- /dev/null
+++ b/packages/example/src/index.mjs
@@ -0,0 +1,2 @@
+import {enableSkia} from '@remotion/skia/enable';
+console.log(enableSkia);
diff --git a/packages/example/src/webpack-override.ts b/packages/example/src/webpack-override.ts
index bab48ce7a7..2c39323de3 100644
--- a/packages/example/src/webpack-override.ts
+++ b/packages/example/src/webpack-override.ts
@@ -2,6 +2,8 @@ import {WebpackOverrideFn} from '@remotion/bundler';
import path from 'path';
type Bundler = 'webpack' | 'esbuild';
+console.log(require.resolve('@remotion/skia/enable'));
+
const WEBPACK_OR_ESBUILD = 'esbuild' as Bundler;
export const webpackOverride: WebpackOverrideFn = (currentConfiguration) => {
@@ -20,6 +22,7 @@ export const webpackOverride: WebpackOverrideFn = (currentConfiguration) => {
return currentConfiguration;
})();
+
return {
...replaced,
module: {
diff --git a/packages/motion-blur/package.json b/packages/motion-blur/package.json
index a6993e6cf5..4117192e69 100644
--- a/packages/motion-blur/package.json
+++ b/packages/motion-blur/package.json
@@ -2,8 +2,9 @@
"name": "@remotion/motion-blur",
"version": "3.3.62",
"description": "Motion blur effect for Remotion",
- "main": "dist/esm/index.mjs",
+ "main": "dist/cjs/index.js",
"types": "dist/cjs/index.d.ts",
+ "module": "dist/esm/index.mjs",
"sideEffects": false,
"scripts": {
"lint": "eslint src --ext ts,tsx",
diff --git a/packages/skia/enable.d.ts b/packages/skia/enable.d.ts
index 965625cb19..7462d73f54 100644
--- a/packages/skia/enable.d.ts
+++ b/packages/skia/enable.d.ts
@@ -1 +1 @@
-export * from './dist/enable-skia';
+export * from './dist/cjs/enable';
diff --git a/packages/skia/enable.js b/packages/skia/enable.js
index bf18fd3ee6..150b348c01 100644
--- a/packages/skia/enable.js
+++ b/packages/skia/enable.js
@@ -1 +1 @@
-module.exports = require('./dist/enable-skia');
+module.exports = require('./dist/cjs/enable');
diff --git a/packages/skia/package.json b/packages/skia/package.json
index 9f80b3a14e..c916021807 100644
--- a/packages/skia/package.json
+++ b/packages/skia/package.json
@@ -2,13 +2,14 @@
"name": "@remotion/skia",
"version": "3.3.62",
"description": "Utilities for using react-native-skia in Remotion",
- "main": "dist/index.js",
- "types": "dist/index.d.ts",
+ "main": "dist/cjs/index.js",
+ "types": "dist/cjs/index.d.ts",
+ "module": "dist/esm/index.mjs",
"sideEffects": false,
"scripts": {
"lint": "eslint src --ext ts,tsx",
"watch": "tsc -w",
- "build": "tsc -d"
+ "build": "rollup --config rollup-enable.config.js && rollup --config rollup.config.js && tsc -d"
},
"author": "Jonny Burger <[email protected]>, William Candillon <[email protected]>",
"contributors": [],
@@ -41,6 +42,8 @@
"react": "18.0.0",
"react-dom": "18.0.0",
"remotion": "3.3.58",
+ "rollup": "^2.70.1",
+ "@rollup/plugin-typescript": "^8.2.0",
"typescript": "^4.7.0"
},
"keywords": [
@@ -49,5 +52,27 @@
],
"publishConfig": {
"access": "public"
+ },
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "types": "./dist/cjs/index.d.ts",
+ "module": "./dist/esm/index.mjs",
+ "import": "./dist/esm/index.mjs",
+ "require": "./dist/cjs/index.js"
+ },
+ "./enable": {
+ "types": "./dist/cjs/enable.d.ts",
+ "module": "./dist/esm/enable.mjs",
+ "import": "./dist/esm/enable.mjs",
+ "require": "./dist/cjs/enable.js"
+ }
+ },
+ "typesVersions": {
+ ">=1.0": {
+ "enable": [
+ "dist/esm/enable.d.ts"
+ ]
+ }
}
}
diff --git a/packages/skia/rollup-enable.config.js b/packages/skia/rollup-enable.config.js
new file mode 100644
index 0000000000..a2381b75c3
--- /dev/null
+++ b/packages/skia/rollup-enable.config.js
@@ -0,0 +1,23 @@
+// rollup.config.js
+import typescript from '@rollup/plugin-typescript';
+
+export default [
+ {
+ input: 'src/enable.ts',
+ output: [
+ {
+ file: 'dist/esm/enable.mjs',
+ format: 'es',
+ sourcemap: false,
+ },
+ ],
+ external: ['react', 'copy-webpack-plugin'],
+ plugins: [
+ typescript({
+ tsconfig: 'tsconfig-esm.json',
+ sourceMap: false,
+ outputToFilesystem: true,
+ }),
+ ],
+ },
+];
diff --git a/packages/skia/rollup.config.js b/packages/skia/rollup.config.js
new file mode 100644
index 0000000000..1862a3de46
--- /dev/null
+++ b/packages/skia/rollup.config.js
@@ -0,0 +1,28 @@
+// rollup.config.js
+import typescript from '@rollup/plugin-typescript';
+
+export default [
+ {
+ input: 'src/index.ts',
+ output: [
+ {
+ file: 'dist/esm/index.mjs',
+ format: 'es',
+ sourcemap: false,
+ },
+ ],
+ external: [
+ 'react',
+ 'remotion',
+ 'react/jsx-runtime',
+ '@shopify/react-native-skia',
+ ],
+ plugins: [
+ typescript({
+ tsconfig: 'tsconfig-esm.json',
+ sourceMap: false,
+ outputToFilesystem: true,
+ }),
+ ],
+ },
+];
diff --git a/packages/skia/src/enable-skia.ts b/packages/skia/src/enable.ts
similarity index 100%
rename from packages/skia/src/enable-skia.ts
rename to packages/skia/src/enable.ts
diff --git a/packages/skia/src/index.tsx b/packages/skia/src/index.ts
similarity index 100%
rename from packages/skia/src/index.tsx
rename to packages/skia/src/index.ts
diff --git a/packages/skia/tsconfig-esm.json b/packages/skia/tsconfig-esm.json
new file mode 100644
index 0000000000..93ac160761
--- /dev/null
+++ b/packages/skia/tsconfig-esm.json
@@ -0,0 +1,13 @@
+{
+ "extends": "../tsconfig-esm.settings.json",
+ "compilerOptions": {
+ "composite": true,
+ "rootDir": "./src",
+ "outDir": "./dist/esm",
+ "skipLibCheck": true,
+ "jsx": "react-jsx",
+ "moduleResolution": "node"
+ },
+ "references": [{"path": "../core"}],
+ "include": ["./src"]
+}
diff --git a/packages/skia/tsconfig.json b/packages/skia/tsconfig.json
index 402f70f469..ef4a6eda17 100644
--- a/packages/skia/tsconfig.json
+++ b/packages/skia/tsconfig.json
@@ -2,8 +2,8 @@
"extends": "../tsconfig.settings.json",
"compilerOptions": {
"composite": true,
- "rootDir": "src",
- "outDir": "dist",
+ "rootDir": "./src",
+ "outDir": "dist/cjs",
"skipLibCheck": true
},
"include": ["src"],
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5d138606e9..9becf81369 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -18,7 +18,9 @@ importers:
'@astrojs/react': ^2.0.2
'@remotion/gif': 3.3.62
'@remotion/lottie': 3.3.62
+ '@remotion/motion-blur': 3.3.62
'@remotion/player': 3.3.62
+ '@remotion/skia': 3.3.62
'@types/react': ^18.0.10
'@types/react-dom': ^18.0.5
astro: ^2.0.14
@@ -30,7 +32,9 @@ importers:
'@astrojs/react': 2.0.2_ie75ejlwqy5zh3tldgt7pftwcu
'@remotion/gif': link:../gif
'@remotion/lottie': link:../lottie
+ '@remotion/motion-blur': link:../motion-blur
'@remotion/player': link:../player
+ '@remotion/skia': link:../skia
'@types/react': 18.0.26
'@types/react-dom': 18.0.10
astro: 2.0.14
@@ -485,6 +489,7 @@ importers:
'@remotion/paths': 3.3.62
'@remotion/renderer': 3.3.62
'@remotion/shapes': 3.3.62
+ '@remotion/skia': 3.3.62
'@remotion/three': 3.3.62
'@types/babel__core': ^7.1.12
'@types/babel__template': ^7.4.0
@@ -533,6 +538,7 @@ importers:
'@remotion/paths': link:../paths
'@remotion/renderer': link:../renderer
'@remotion/shapes': link:../shapes
+ '@remotion/skia': link:../skia
'@remotion/three': link:../three
'@types/express': 4.17.13
'@types/node': 16.10.2
@@ -1029,6 +1035,7 @@ importers:
specifiers:
'@jonny/eslint-config': 3.0.266
'@remotion/bundler': 3.3.62
+ '@rollup/plugin-typescript': ^8.2.0
'@shopify/react-native-skia': ^0.1.139
'@types/react': 18.0.26
'@types/react-native': ^0.69.2
@@ -1039,6 +1046,7 @@ importers:
react: 18.0.0
react-dom: 18.0.0
remotion: 3.3.62
+ rollup: ^2.70.1
typescript: ^4.7.0
dependencies:
copy-webpack-plugin: [email protected]
@@ -1046,6 +1054,7 @@ importers:
devDependencies:
'@jonny/eslint-config': 3.0.266_t54va6jeo5lf3vtqih5uiyrm5e
'@remotion/bundler': link:../bundler
+ '@rollup/plugin-typescript': 8.5.0_2s5nfqwcf62746iqzotp3mpuy4
'@shopify/react-native-skia': 0.1.139_rlxvagb2l2jceoxbyljoesn5oa
'@types/react': 18.0.26
'@types/react-native': 0.69.2
@@ -1054,6 +1063,7 @@ importers:
prettier-plugin-organize-imports: 2.3.4_j2odc4yr77iddtreafyicbq5hi
react: 18.0.0
react-dom: [email protected]
+ rollup: 2.76.0
typescript: 4.7.2
packages/three: