🎥 Make videos programmatically with React
source mapping back works!
Jonny Burger0121c5bb7a96
diff --git a/packages/bundler/package.json b/packages/bundler/package.jsonindex 339b372ddc..365e0fb602 100644--- a/packages/bundler/package.json+++ b/packages/bundler/package.json@@ -31,6 +31,7 @@"react-refresh": "0.9.0","remotion": "workspace:*","@remotion/studio": "workspace:*",+ "@remotion/studio-shared": "workspace:*","style-loader": "2.0.0","webpack": "5.83.1"},diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.tsindex 276d821156..d7297eae79 100644--- a/packages/bundler/src/bundle.ts+++ b/packages/bundler/src/bundle.ts@@ -1,3 +1,4 @@+import {SOURCE_MAP_ENDPOINT} from '@remotion/studio-shared';import fs, {promises} from 'node:fs';import os from 'node:os';import path from 'node:path';@@ -276,5 +277,9 @@ export async function bundle(...args: Arguments): Promise<string> {path.join(__dirname, '../favicon.ico'),path.join(outDir, 'favicon.ico'),);+ fs.copyFileSync(+ path.resolve(require.resolve('source-map'), '..', 'lib', 'mappings.wasm'),+ path.join(outDir, SOURCE_MAP_ENDPOINT.replace('/', '')),+ );return outDir;}diff --git a/packages/core/src/enable-sequence-stack-traces.ts b/packages/core/src/enable-sequence-stack-traces.tsindex 2564a402ad..03357ff786 100644--- a/packages/core/src/enable-sequence-stack-traces.ts+++ b/packages/core/src/enable-sequence-stack-traces.ts@@ -4,7 +4,13 @@ import {getRemotionEnvironment} from './get-remotion-environment';const originalCreateElement = React.createElement;const componentsToAddStacksTo: unknown[] = [];-const enableSequenceStackTraces = () => {+// Gets called when a new component is added,+// also when the Studio is mounted+export const enableSequenceStackTraces = () => {+ if (!getRemotionEnvironment().isStudio) {+ return;+ }+const proxy = new Proxy(originalCreateElement, {apply(target, thisArg, argArray) {if (componentsToAddStacksTo.includes(argArray[0])) {@@ -25,10 +31,6 @@ const enableSequenceStackTraces = () => {};export const addSequenceStackTraces = (component: unknown) => {- if (!getRemotionEnvironment().isStudio) {- return;- }-componentsToAddStacksTo.push(component);enableSequenceStackTraces();};diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.tsindex 356bfaf6b2..afcc49ab2b 100644--- a/packages/core/src/internals.ts+++ b/packages/core/src/internals.ts@@ -19,7 +19,10 @@ import type {CompositionManagerContext} from './CompositionManagerContext.js';import {CompositionManager} from './CompositionManagerContext.js';import * as CSSUtils from './default-css.js';import {EditorPropsContext, EditorPropsProvider} from './EditorProps.js';-import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';+import {+ addSequenceStackTraces,+ enableSequenceStackTraces,+} from './enable-sequence-stack-traces.js';import {getPreviewDomElement,REMOTION_STUDIO_CONTAINER_ELEMENT,@@ -142,6 +145,7 @@ export const Internals = {WATCH_REMOTION_STATIC_FILES,addSequenceStackTraces,useMediaStartsAt,+ enableSequenceStackTraces,} as const;export type {diff --git a/packages/studio/src/Studio.tsx b/packages/studio/src/Studio.tsxindex 526ed7f163..5f25e2d68c 100644--- a/packages/studio/src/Studio.tsx+++ b/packages/studio/src/Studio.tsx@@ -16,6 +16,7 @@ export const Studio: React.FC<{}> = ({rootComponent, readOnly}) => {useLayoutEffect(() => {window.remotion_isStudio = true;+ Internals.enableSequenceStackTraces();}, []);return (<Internals.RemotionRootdiff --git a/packages/studio/src/helpers/url-state.ts b/packages/studio/src/helpers/url-state.tsindex 3cac6df4d5..e372b4521c 100644--- a/packages/studio/src/helpers/url-state.ts+++ b/packages/studio/src/helpers/url-state.ts@@ -26,7 +26,7 @@ export const reloadUrl = () => {export const getPathname = () => {if (getUrlHandlingType() === 'query-string') {- return window.location.search.substring(2);+ return window.location.search.substring(1);}return window.location.pathname;diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 4cf9c1b212..421841ab42 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -124,6 +124,9 @@ importers:'@remotion/studio':specifier: workspace:*version: link:../studio+ '@remotion/studio-shared':+ specifier: workspace:*+ version: link:../studio-sharedcss-loader:specifier: 5.2.7version: 5.2.7([email protected])