@remotion/skia 3.3.93 → 3.3.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,18 +11,20 @@ const remotion_1 = require("remotion");
11
11
  */
12
12
  const SkiaCanvas = ({ children, height, width, style, ...otherProps }) => {
13
13
  const contexts = remotion_1.Internals.useRemotionContexts();
14
+ const mergedStyles = (0, react_1.useMemo)(() => {
15
+ var _a;
16
+ return {
17
+ width,
18
+ height,
19
+ ...((_a = style) !== null && _a !== void 0 ? _a : {}),
20
+ };
21
+ }, [height, style, width]);
14
22
  const props = (0, react_1.useMemo)(() => {
15
23
  return {
16
- style: [
17
- {
18
- width,
19
- height,
20
- },
21
- style,
22
- ],
24
+ style: mergedStyles,
23
25
  ...otherProps,
24
26
  };
25
- }, [height, otherProps, style, width]);
27
+ }, [mergedStyles, otherProps]);
26
28
  return ((0, jsx_runtime_1.jsx)(react_native_skia_1.Canvas, { ...props, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.RemotionContextProvider, { contexts: contexts, children: children }) }));
27
29
  };
28
30
  exports.SkiaCanvas = SkiaCanvas;
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.enableSkia = void 0;
7
- const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
7
+ const bundler_1 = require("@remotion/bundler");
8
+ const fs_1 = __importDefault(require("fs"));
8
9
  /**
9
10
  * @description A function that modifies the default Webpack configuration to make the necessary changes to support Skia.
10
11
  * @see [Documentation](https://www.remotion.dev/docs/skia/enable-skia)
@@ -15,11 +16,23 @@ const enableSkia = (currentConfiguration) => {
15
16
  ...currentConfiguration,
16
17
  plugins: [
17
18
  ...((_a = currentConfiguration.plugins) !== null && _a !== void 0 ? _a : []),
18
- new copy_webpack_plugin_1.default({
19
- patterns: [
20
- { from: 'node_modules/canvaskit-wasm/bin/full/canvaskit.wasm' },
21
- ],
22
- }),
19
+ new (class CopySkiaPlugin {
20
+ apply(compiler) {
21
+ compiler.hooks.thisCompilation.tap('AddSkiaPlugin', (compilation) => {
22
+ compilation.hooks.processAssets.tapPromise({
23
+ name: 'copy-skia',
24
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
25
+ }, async () => {
26
+ const src = require.resolve('canvaskit-wasm/bin/full/canvaskit.wasm');
27
+ if (compilation.getAsset(src)) {
28
+ // Skip emitting the asset again because it's immutable
29
+ return;
30
+ }
31
+ compilation.emitAsset('/canvaskit.wasm', new bundler_1.webpack.sources.RawSource(await fs_1.default.promises.readFile(src)));
32
+ });
33
+ });
34
+ }
35
+ })(),
23
36
  ],
24
37
  resolve: {
25
38
  ...currentConfiguration.resolve,
@@ -1,4 +1,5 @@
1
- import CopyPlugin from 'copy-webpack-plugin';
1
+ import { webpack } from '@remotion/bundler';
2
+ import fs from 'fs';
2
3
 
3
4
  /**
4
5
  * @description A function that modifies the default Webpack configuration to make the necessary changes to support Skia.
@@ -10,11 +11,23 @@ const enableSkia = (currentConfiguration) => {
10
11
  ...currentConfiguration,
11
12
  plugins: [
12
13
  ...((_a = currentConfiguration.plugins) !== null && _a !== void 0 ? _a : []),
13
- new CopyPlugin({
14
- patterns: [
15
- { from: 'node_modules/canvaskit-wasm/bin/full/canvaskit.wasm' },
16
- ],
17
- }),
14
+ new (class CopySkiaPlugin {
15
+ apply(compiler) {
16
+ compiler.hooks.thisCompilation.tap('AddSkiaPlugin', (compilation) => {
17
+ compilation.hooks.processAssets.tapPromise({
18
+ name: 'copy-skia',
19
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
20
+ }, async () => {
21
+ const src = require.resolve('canvaskit-wasm/bin/full/canvaskit.wasm');
22
+ if (compilation.getAsset(src)) {
23
+ // Skip emitting the asset again because it's immutable
24
+ return;
25
+ }
26
+ compilation.emitAsset('/canvaskit.wasm', new webpack.sources.RawSource(await fs.promises.readFile(src)));
27
+ });
28
+ });
29
+ }
30
+ })(),
18
31
  ],
19
32
  resolve: {
20
33
  ...currentConfiguration.resolve,
@@ -9,18 +9,20 @@ import { Internals } from 'remotion';
9
9
  */
10
10
  const SkiaCanvas = ({ children, height, width, style, ...otherProps }) => {
11
11
  const contexts = Internals.useRemotionContexts();
12
+ const mergedStyles = useMemo(() => {
13
+ var _a;
14
+ return {
15
+ width,
16
+ height,
17
+ ...((_a = style) !== null && _a !== void 0 ? _a : {}),
18
+ };
19
+ }, [height, style, width]);
12
20
  const props = useMemo(() => {
13
21
  return {
14
- style: [
15
- {
16
- width,
17
- height,
18
- },
19
- style,
20
- ],
22
+ style: mergedStyles,
21
23
  ...otherProps,
22
24
  };
23
- }, [height, otherProps, style, width]);
25
+ }, [mergedStyles, otherProps]);
24
26
  return (jsx(Canvas, { ...props, children: jsx(Internals.RemotionContextProvider, { contexts: contexts, children: children }) }));
25
27
  };
26
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/skia",
3
- "version": "3.3.93",
3
+ "version": "3.3.95",
4
4
  "description": "Utilities for using react-native-skia in Remotion",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/cjs/index.d.ts",
@@ -16,20 +16,18 @@
16
16
  "url": "https://github.com/remotion-dev/remotion/issues"
17
17
  },
18
18
  "dependencies": {
19
- "copy-webpack-plugin": "11",
20
- "remotion": "3.3.93"
19
+ "remotion": "3.3.95"
21
20
  },
22
21
  "peerDependencies": {
23
- "@remotion/bundler": "3.3.93",
24
- "@shopify/react-native-skia": "^0.1.190",
22
+ "@shopify/react-native-skia": "^0.1.191",
25
23
  "react": ">=16.8.0",
26
24
  "react-dom": ">=16.8.0"
27
25
  },
28
26
  "devDependencies": {
29
27
  "@jonny/eslint-config": "3.0.266",
30
- "@remotion/bundler": "3.3.93",
28
+ "@remotion/bundler": "3.3.95",
31
29
  "@rollup/plugin-typescript": "^8.2.0",
32
- "@shopify/react-native-skia": "^0.1.190",
30
+ "@shopify/react-native-skia": "^0.1.191",
33
31
  "@types/react": "18.0.26",
34
32
  "@types/react-native": "^0.69.2",
35
33
  "eslint": "8.25.0",
@@ -37,7 +35,7 @@
37
35
  "prettier-plugin-organize-imports": "^2.3.4",
38
36
  "react": "18.0.0",
39
37
  "react-dom": "18.0.0",
40
- "remotion": "3.3.93",
38
+ "remotion": "3.3.95",
41
39
  "rollup": "^2.70.1",
42
40
  "typescript": "^4.7.0"
43
41
  },