🎥 Make videos programmatically with React
Merge main and resolve wrap JSX conflicts
copilot-swe-agent[bot]6552fd8bd28a
diff --cc packages/browser-studio/src/browser-studio-operations.tsindex 32700c07a0,06f2c93185..03e19cf661--- a/packages/browser-studio/src/browser-studio-operations.ts+++ b/packages/browser-studio/src/browser-studio-operations.ts@@@ -1488,14 -1488,9 +1488,17 @@@ export const createBrowserStudioOperaticonst result = wrapJsxNodeCodemod({project,node: {filePath, nodePath},- wrapper,- width: width ?? 0,- height: height ?? 0,+ wrapper: createElement({+ component: wrapper,- importPath: 'remotion',++ importPath:++ wrapper === 'HtmlInCanvasMotionBlur'++ ? '@remotion/motion-blur'++ : 'remotion',+ props:- wrapper === 'HtmlInCanvas'++ wrapper === 'HtmlInCanvas' || wrapper === 'HtmlInCanvasMotionBlur'+ ? {width: width ?? 0, height: height ?? 0}+ : {},+ }),});const nodePathMutation = controller.applyMutation({undoRedoNavigation: null,diff --cc packages/codemods/src/wrap-jsx-node.tsindex 36fa794a84,547e371a0b..e98110e49e--- a/packages/codemods/src/wrap-jsx-node.ts+++ b/packages/codemods/src/wrap-jsx-node.ts@@@ -23,14 -21,11 +23,29 @@@ importimport {getEndOfLine, getIndentationUnit, getLineIndent} from './source-style';import {stripParenthesizedExtra} from './strip-parenthesized-extra';-type JsxWrapper =- | 'AbsoluteFill'- | 'Sequence'- | 'HtmlInCanvas'- | 'HtmlInCanvasMotionBlur';+export type WrapJsxNodeOptions<Project extends CodemodProject> = {+ project: Project;+ node: JsxNodeReference;+ wrapper: CodemodElement;+};+- const isHtmlInCanvasWrapper = (wrapper: CodemodElement) =>- wrapper.importPath === 'remotion' && wrapper.component === 'HtmlInCanvas';++const getHtmlInCanvasWrapperName = (wrapper: CodemodElement) => {++ if (++ wrapper.importPath === 'remotion' &&++ wrapper.component === 'HtmlInCanvas'++ ) {++ return 'HtmlInCanvas';++ }++++ if (++ wrapper.importPath === '@remotion/motion-blur' &&++ wrapper.component === 'HtmlInCanvasMotionBlur'++ ) {++ return 'HtmlInCanvasMotionBlur';++ }++++ return null;++};export const canWrapJsxNode = ({input,@@@ -115,24 -112,23 +134,26 @@@ export const wrapJsxNode = <Project extconst filePath = findProjectFile({project, filePath: node.filePath});const input = project.files[filePath];const eligibility = canWrapJsxNode({input, nodePath: node.nodePath});- const htmlInCanvas = isHtmlInCanvasWrapper(wrapper);- const requiresHtmlInCanvas =- wrapper === 'HtmlInCanvas' || wrapper === 'HtmlInCanvasMotionBlur';++ const htmlInCanvasWrapper = getHtmlInCanvasWrapperName(wrapper);if (!eligibility.canWrap ||- (htmlInCanvas && !eligibility.canWrapHtmlInCanvas)- (requiresHtmlInCanvas && !eligibility.canWrapHtmlInCanvas)++ (htmlInCanvasWrapper !== null && !eligibility.canWrapHtmlInCanvas)) {throw new Error('This JSX element cannot be wrapped');}if (- htmlInCanvas &&- requiresHtmlInCanvas &&- (!Number.isInteger(width) ||- width <= 0 ||- !Number.isInteger(height) ||- height <= 0)++ htmlInCanvasWrapper !== null &&+ [wrapper.props.width, wrapper.props.height].some(+ (dimension) =>+ typeof dimension !== 'number' ||+ !Number.isInteger(dimension) ||+ dimension <= 0,+ )) {- throw new Error('HtmlInCanvas requires positive integer dimensions');- throw new Error(`${wrapper} requires positive integer dimensions`);++ throw new Error(++ `${htmlInCanvasWrapper} requires positive integer dimensions`,++ );}const ast = parseAst(input);diff --cc packages/studio-server/src/preview-server/routes/wrap-jsx-node.tsindex 102b9203ce,846ca2fc72..cdff964540--- a/packages/studio-server/src/preview-server/routes/wrap-jsx-node.ts+++ b/packages/studio-server/src/preview-server/routes/wrap-jsx-node.ts@@@ -55,14 -56,9 +56,17 @@@ export const wrapJsxNodeHandler: ApiHanconst result = wrapJsxNode({project: {files: {[absolutePath]: fileContents}, rootDir: remotionRoot},node: {filePath: absolutePath, nodePath},- wrapper,- width: width ?? 0,- height: height ?? 0,+ wrapper: createElement({+ component: wrapper,- importPath: 'remotion',++ importPath:++ wrapper === 'HtmlInCanvasMotionBlur'++ ? '@remotion/motion-blur'++ : 'remotion',+ props:- wrapper === 'HtmlInCanvas'++ wrapper === 'HtmlInCanvas' || wrapper === 'HtmlInCanvasMotionBlur'+ ? {width: width ?? 0, height: height ?? 0}+ : {},+ }),});const change = result.changes.find(({filePath}) => filePath === absolutePath,