@remotion/studio-server 4.0.481 → 4.0.482
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.
- package/dist/codemods/duplicate-composition.js +14 -0
- package/dist/codemods/recast-mods.js +100 -0
- package/dist/helpers/resolve-composition-component.js +20 -9
- package/dist/preview-server/handler.js +2 -0
- package/dist/preview-server/routes/apply-codemod.js +80 -14
- package/dist/preview-server/start-server.js +1 -1
- package/dist/preview-server/undo-stack.d.ts +5 -3
- package/dist/preview-server/undo-stack.js +12 -3
- package/dist/routes.js +1 -1
- package/package.json +6 -6
|
@@ -80,6 +80,20 @@ const parseAndApplyCodemod = ({ input, codeMod, }) => {
|
|
|
80
80
|
localName: codeMod.tag,
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
+
if (codeMod.type === 'new-composition') {
|
|
84
|
+
(0, imports_1.ensureNamedImport)({
|
|
85
|
+
ast: newAst,
|
|
86
|
+
importedName: 'Composition',
|
|
87
|
+
sourcePath: 'remotion',
|
|
88
|
+
localName: 'Composition',
|
|
89
|
+
});
|
|
90
|
+
(0, imports_1.ensureNamedImport)({
|
|
91
|
+
ast: newAst,
|
|
92
|
+
importedName: codeMod.componentName,
|
|
93
|
+
sourcePath: codeMod.componentImportPath,
|
|
94
|
+
localName: codeMod.componentName,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
83
97
|
const output = (0, parse_ast_1.serializeAst)(newAst);
|
|
84
98
|
return { changesMade, newContents: output };
|
|
85
99
|
};
|
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.applyCodemod = void 0;
|
|
37
|
+
const recast = __importStar(require("recast"));
|
|
4
38
|
const apply_visual_control_1 = require("./apply-visual-control");
|
|
39
|
+
const b = recast.types.builders;
|
|
5
40
|
const applyCodemod = ({ file, codeMod, }) => {
|
|
6
41
|
const changesMade = [];
|
|
7
42
|
if (codeMod.type === 'apply-visual-control') {
|
|
@@ -60,6 +95,14 @@ const mapReturnStatement = (statement, transformation, changesMade, parentFolder
|
|
|
60
95
|
if (!statement.argument) {
|
|
61
96
|
return statement;
|
|
62
97
|
}
|
|
98
|
+
if (transformation.type === 'new-composition' &&
|
|
99
|
+
(statement.argument.type === 'JSXElement' ||
|
|
100
|
+
statement.argument.type === 'JSXFragment')) {
|
|
101
|
+
return {
|
|
102
|
+
...statement,
|
|
103
|
+
argument: addNewCompositionToRootJsx(statement.argument, transformation, changesMade),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
63
106
|
const replacement = transformLoneJsxElement(statement.argument, transformation, changesMade, parentFolderName);
|
|
64
107
|
if (replacement !== null) {
|
|
65
108
|
return { ...statement, argument: replacement };
|
|
@@ -99,6 +142,55 @@ const isJsxExpression = (child) => {
|
|
|
99
142
|
const isMeaningfulJsxChild = (child) => {
|
|
100
143
|
return child.type !== 'JSXText' || child.value.trim() !== '';
|
|
101
144
|
};
|
|
145
|
+
const jsxId = (name) => ({ type: 'JSXIdentifier', name });
|
|
146
|
+
const jsxAttributeWithString = (name, value) => ({
|
|
147
|
+
type: 'JSXAttribute',
|
|
148
|
+
name: jsxId(name),
|
|
149
|
+
value: { type: 'StringLiteral', value },
|
|
150
|
+
});
|
|
151
|
+
const jsxAttributeWithExpression = (name, expression) => ({
|
|
152
|
+
type: 'JSXAttribute',
|
|
153
|
+
name: jsxId(name),
|
|
154
|
+
value: {
|
|
155
|
+
type: 'JSXExpressionContainer',
|
|
156
|
+
expression,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const newCompositionElement = (transformation) => {
|
|
160
|
+
return {
|
|
161
|
+
type: 'JSXElement',
|
|
162
|
+
openingElement: {
|
|
163
|
+
type: 'JSXOpeningElement',
|
|
164
|
+
name: jsxId('Composition'),
|
|
165
|
+
attributes: [
|
|
166
|
+
jsxAttributeWithString('id', transformation.newId),
|
|
167
|
+
jsxAttributeWithExpression('component', b.identifier(transformation.componentName)),
|
|
168
|
+
jsxAttributeWithExpression('durationInFrames', b.numericLiteral(transformation.newDurationInFrames)),
|
|
169
|
+
jsxAttributeWithExpression('fps', b.numericLiteral(transformation.newFps)),
|
|
170
|
+
jsxAttributeWithExpression('width', b.numericLiteral(transformation.newWidth)),
|
|
171
|
+
jsxAttributeWithExpression('height', b.numericLiteral(transformation.newHeight)),
|
|
172
|
+
],
|
|
173
|
+
selfClosing: true,
|
|
174
|
+
},
|
|
175
|
+
closingElement: null,
|
|
176
|
+
children: [],
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const addNewCompositionToRootJsx = (root, transformation, changesMade) => {
|
|
180
|
+
if (changesMade.length > 0) {
|
|
181
|
+
return root;
|
|
182
|
+
}
|
|
183
|
+
changesMade.push({
|
|
184
|
+
description: 'Added new composition',
|
|
185
|
+
});
|
|
186
|
+
if (root.type === 'JSXFragment') {
|
|
187
|
+
return {
|
|
188
|
+
...root,
|
|
189
|
+
children: [...root.children, newCompositionElement(transformation)],
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return wrapInJsxFragment([root, newCompositionElement(transformation)]);
|
|
193
|
+
};
|
|
102
194
|
// When a <Composition> JSX element appears in a position where it cannot
|
|
103
195
|
// simply be removed from a parent's children list (e.g. as the sole return
|
|
104
196
|
// value of a wrapper component or as the concise body of an arrow function),
|
|
@@ -237,6 +329,14 @@ const mapRecognizedType = (expression, transformation, changesMade, parentFolder
|
|
|
237
329
|
}
|
|
238
330
|
if (expression.type === 'ArrowFunctionExpression' ||
|
|
239
331
|
expression.type === 'FunctionExpression') {
|
|
332
|
+
if (transformation.type === 'new-composition' &&
|
|
333
|
+
(expression.body.type === 'JSXElement' ||
|
|
334
|
+
expression.body.type === 'JSXFragment')) {
|
|
335
|
+
return {
|
|
336
|
+
...expression,
|
|
337
|
+
body: addNewCompositionToRootJsx(expression.body, transformation, changesMade),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
240
340
|
if (expression.type === 'ArrowFunctionExpression' &&
|
|
241
341
|
expression.body.type === 'JSXElement') {
|
|
242
342
|
const replacement = transformLoneJsxElement(expression.body, transformation, changesMade, parentFolderName);
|
|
@@ -522,14 +522,31 @@ const roundTranslateCoordinate = (value) => {
|
|
|
522
522
|
return Object.is(rounded, -0) ? 0 : rounded;
|
|
523
523
|
};
|
|
524
524
|
const formatTranslateValue = ({ x, y }) => `${roundTranslateCoordinate(x)}px ${roundTranslateCoordinate(y)}px`;
|
|
525
|
-
const
|
|
525
|
+
const createStyleAttribute = (properties) => {
|
|
526
|
+
return recast.types.builders.jsxAttribute(recast.types.builders.jsxIdentifier('style'), recast.types.builders.jsxExpressionContainer(recast.types.builders.objectExpression(properties)));
|
|
527
|
+
};
|
|
528
|
+
const getPositionStyleProperties = (position) => {
|
|
526
529
|
const properties = [
|
|
527
530
|
recast.types.builders.objectProperty(recast.types.builders.identifier('position'), recast.types.builders.stringLiteral('absolute')),
|
|
528
531
|
];
|
|
529
532
|
if (position) {
|
|
530
533
|
properties.push(recast.types.builders.objectProperty(recast.types.builders.identifier('translate'), recast.types.builders.stringLiteral(formatTranslateValue(position))));
|
|
531
534
|
}
|
|
532
|
-
return
|
|
535
|
+
return properties;
|
|
536
|
+
};
|
|
537
|
+
const createPositionAbsoluteStyleAttribute = (position) => {
|
|
538
|
+
return createStyleAttribute(getPositionStyleProperties(position));
|
|
539
|
+
};
|
|
540
|
+
const createAssetStyleAttribute = ({ dimensions, position, }) => {
|
|
541
|
+
return createStyleAttribute([
|
|
542
|
+
...getPositionStyleProperties(position),
|
|
543
|
+
...(dimensions
|
|
544
|
+
? [
|
|
545
|
+
recast.types.builders.objectProperty(recast.types.builders.identifier('width'), recast.types.builders.numericLiteral(dimensions.width)),
|
|
546
|
+
recast.types.builders.objectProperty(recast.types.builders.identifier('height'), recast.types.builders.numericLiteral(dimensions.height)),
|
|
547
|
+
]
|
|
548
|
+
: []),
|
|
549
|
+
]);
|
|
533
550
|
};
|
|
534
551
|
const createStaticFileSrcAttribute = ({ staticFileLocalName, src, }) => {
|
|
535
552
|
return recast.types.builders.jsxAttribute(recast.types.builders.jsxIdentifier('src'), recast.types.builders.jsxExpressionContainer(recast.types.builders.callExpression(recast.types.builders.identifier(staticFileLocalName), [recast.types.builders.stringLiteral(src)])));
|
|
@@ -565,13 +582,7 @@ const createAssetElement = ({ addPositionStyle, localName, staticFileLocalName,
|
|
|
565
582
|
? createStringSrcAttribute(src)
|
|
566
583
|
: createStaticFileSrcAttribute({ staticFileLocalName, src }),
|
|
567
584
|
...(addPositionStyle
|
|
568
|
-
? [
|
|
569
|
-
: []),
|
|
570
|
-
...(dimensions
|
|
571
|
-
? [
|
|
572
|
-
createNumberAttribute('width', dimensions.width),
|
|
573
|
-
createNumberAttribute('height', dimensions.height),
|
|
574
|
-
]
|
|
585
|
+
? [createAssetStyleAttribute({ dimensions, position })]
|
|
575
586
|
: []),
|
|
576
587
|
], true), null, []);
|
|
577
588
|
};
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleRequest = void 0;
|
|
4
4
|
const parse_body_1 = require("./parse-body");
|
|
5
|
+
const validate_same_origin_1 = require("./validate-same-origin");
|
|
5
6
|
const handleRequest = async ({ remotionRoot, request, response, entryPoint, handler, logLevel, methods, binariesDirectory, publicDir, }) => {
|
|
6
7
|
if (request.method === 'OPTIONS') {
|
|
7
8
|
response.statusCode = 200;
|
|
8
9
|
response.end();
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
12
|
+
(0, validate_same_origin_1.validateSameOrigin)(request);
|
|
11
13
|
response.setHeader('content-type', 'application/json');
|
|
12
14
|
response.writeHead(200);
|
|
13
15
|
try {
|
|
@@ -8,11 +8,20 @@ const node_fs_1 = require("node:fs");
|
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const renderer_1 = require("@remotion/renderer");
|
|
10
10
|
const apply_codemod_to_file_1 = require("../../codemods/apply-codemod-to-file");
|
|
11
|
+
const duplicate_composition_1 = require("../../codemods/duplicate-composition");
|
|
11
12
|
const simple_diff_1 = require("../../codemods/simple-diff");
|
|
12
13
|
const file_watcher_1 = require("../../file-watcher");
|
|
13
14
|
const project_info_1 = require("../project-info");
|
|
14
15
|
const undo_stack_1 = require("../undo-stack");
|
|
15
16
|
const can_update_default_props_1 = require("./can-update-default-props");
|
|
17
|
+
const formatNewCompositionFile = (componentName) => {
|
|
18
|
+
return (0, duplicate_composition_1.formatOutput)(`import React from 'react';
|
|
19
|
+
|
|
20
|
+
export const ${componentName}: React.FC = () => {
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
`);
|
|
24
|
+
};
|
|
16
25
|
const getCodemodUndoDescription = (codemod) => {
|
|
17
26
|
if (codemod.type === 'delete-composition') {
|
|
18
27
|
return {
|
|
@@ -37,6 +46,13 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
37
46
|
entryType: codemod.type,
|
|
38
47
|
};
|
|
39
48
|
}
|
|
49
|
+
if (codemod.type === 'new-composition') {
|
|
50
|
+
return {
|
|
51
|
+
undoMessage: `↩️ Creation of composition "${codemod.newId}"`,
|
|
52
|
+
redoMessage: `↪️ Creation of composition "${codemod.newId}"`,
|
|
53
|
+
entryType: codemod.type,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
40
56
|
if (codemod.type === 'delete-folder') {
|
|
41
57
|
const label = `folder "${codemod.parentName ? `${codemod.parentName}/` : ''}${codemod.folderName}"`;
|
|
42
58
|
return {
|
|
@@ -62,7 +78,7 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
62
78
|
};
|
|
63
79
|
};
|
|
64
80
|
const applyCodemodHandler = async ({ input: { codemod, dryRun, symbolicatedStack }, logLevel, remotionRoot, entryPoint, }) => {
|
|
65
|
-
var _a;
|
|
81
|
+
var _a, _b;
|
|
66
82
|
try {
|
|
67
83
|
const time = Date.now();
|
|
68
84
|
const filePath = symbolicatedStack
|
|
@@ -72,6 +88,14 @@ const applyCodemodHandler = async ({ input: { codemod, dryRun, symbolicatedStack
|
|
|
72
88
|
throw new Error('Cannot find file for composition in project');
|
|
73
89
|
}
|
|
74
90
|
(0, can_update_default_props_1.checkIfTypeScriptFile)(filePath);
|
|
91
|
+
const newCompositionComponentFilePath = codemod.type === 'new-composition'
|
|
92
|
+
? node_path_1.default.join(node_path_1.default.dirname(filePath), `${codemod.componentName}.tsx`)
|
|
93
|
+
: null;
|
|
94
|
+
if (codemod.type === 'new-composition' &&
|
|
95
|
+
newCompositionComponentFilePath &&
|
|
96
|
+
(0, node_fs_1.existsSync)(newCompositionComponentFilePath)) {
|
|
97
|
+
throw new Error(`Cannot create ${node_path_1.default.relative(remotionRoot, newCompositionComponentFilePath)} because it already exists`);
|
|
98
|
+
}
|
|
75
99
|
const input = (0, node_fs_1.readFileSync)(filePath, 'utf-8');
|
|
76
100
|
const formatted = await (0, apply_codemod_to_file_1.applyCodemodToFile)({
|
|
77
101
|
filePath,
|
|
@@ -83,22 +107,64 @@ const applyCodemodHandler = async ({ input: { codemod, dryRun, symbolicatedStack
|
|
|
83
107
|
});
|
|
84
108
|
if (!dryRun) {
|
|
85
109
|
const { entryType, undoMessage, redoMessage } = getCodemodUndoDescription(codemod);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
logLine: (_a = symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalLineNumber) !== null && _a !== void 0 ? _a : 1,
|
|
93
|
-
description: {
|
|
94
|
-
undoMessage,
|
|
95
|
-
redoMessage,
|
|
110
|
+
const snapshots = [
|
|
111
|
+
{
|
|
112
|
+
filePath,
|
|
113
|
+
oldContents: input,
|
|
114
|
+
newContents: null,
|
|
115
|
+
logLine: (_a = symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalLineNumber) !== null && _a !== void 0 ? _a : 1,
|
|
96
116
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
];
|
|
118
|
+
let componentFilePath = null;
|
|
119
|
+
let componentFileContents = null;
|
|
120
|
+
if (codemod.type === 'new-composition') {
|
|
121
|
+
componentFilePath = newCompositionComponentFilePath;
|
|
122
|
+
if (componentFilePath === null) {
|
|
123
|
+
throw new Error('Could not determine the new component file path');
|
|
124
|
+
}
|
|
125
|
+
componentFileContents = await formatNewCompositionFile(codemod.componentName);
|
|
126
|
+
snapshots.push({
|
|
127
|
+
filePath: componentFilePath,
|
|
128
|
+
oldContents: null,
|
|
129
|
+
newContents: componentFileContents,
|
|
130
|
+
logLine: 1,
|
|
131
|
+
});
|
|
132
|
+
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
133
|
+
snapshots,
|
|
134
|
+
logLevel,
|
|
135
|
+
remotionRoot,
|
|
136
|
+
description: {
|
|
137
|
+
undoMessage,
|
|
138
|
+
redoMessage,
|
|
139
|
+
},
|
|
140
|
+
entryType,
|
|
141
|
+
suppressHmrOnFileRestore: false,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
146
|
+
filePath,
|
|
147
|
+
oldContents: input,
|
|
148
|
+
newContents: null,
|
|
149
|
+
logLevel,
|
|
150
|
+
remotionRoot,
|
|
151
|
+
logLine: (_b = symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalLineNumber) !== null && _b !== void 0 ? _b : 1,
|
|
152
|
+
description: {
|
|
153
|
+
undoMessage,
|
|
154
|
+
redoMessage,
|
|
155
|
+
},
|
|
156
|
+
entryType,
|
|
157
|
+
suppressHmrOnFileRestore: false,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
100
160
|
(0, undo_stack_1.suppressUndoStackInvalidation)(filePath);
|
|
161
|
+
if (componentFilePath) {
|
|
162
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(componentFilePath);
|
|
163
|
+
}
|
|
101
164
|
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(filePath, formatted, undefined);
|
|
165
|
+
if (componentFilePath && componentFileContents !== null) {
|
|
166
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(componentFilePath, componentFileContents, undefined);
|
|
167
|
+
}
|
|
102
168
|
const end = Date.now() - time;
|
|
103
169
|
const relativePath = node_path_1.default.relative(remotionRoot, filePath);
|
|
104
170
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.blue(`Edited ${relativePath} in ${end}ms`));
|
|
@@ -73,7 +73,7 @@ const startServer = async (options) => {
|
|
|
73
73
|
const server = node_http_1.default.createServer((request, response) => {
|
|
74
74
|
if (options.enableCrossSiteIsolation) {
|
|
75
75
|
response.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
|
|
76
|
-
response.setHeader('Cross-Origin-Embedder-Policy', '
|
|
76
|
+
response.setHeader('Cross-Origin-Embedder-Policy', 'credentialless');
|
|
77
77
|
}
|
|
78
78
|
new Promise((resolve) => {
|
|
79
79
|
wdmMiddleware(request, response, () => {
|
|
@@ -3,10 +3,10 @@ export interface UndoEntryDescription {
|
|
|
3
3
|
undoMessage: string;
|
|
4
4
|
redoMessage: string;
|
|
5
5
|
}
|
|
6
|
-
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-add' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'duplicate-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-jsx-node' | 'duplicate-jsx-node' | 'insert-jsx-element' | 'delete-composition' | 'rename-composition' | 'duplicate-composition' | 'delete-folder' | 'rename-folder';
|
|
6
|
+
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-add' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'duplicate-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-jsx-node' | 'duplicate-jsx-node' | 'insert-jsx-element' | 'delete-composition' | 'rename-composition' | 'new-composition' | 'duplicate-composition' | 'delete-folder' | 'rename-folder';
|
|
7
7
|
type UndoEntrySnapshot = {
|
|
8
8
|
filePath: string;
|
|
9
|
-
oldContents: string;
|
|
9
|
+
oldContents: string | null;
|
|
10
10
|
newContents: string | null;
|
|
11
11
|
/** 1-based source line for terminal/IDE file links (e.g. path:line). */
|
|
12
12
|
logLine: number;
|
|
@@ -53,6 +53,8 @@ type UndoEntry = {
|
|
|
53
53
|
entryType: 'delete-composition';
|
|
54
54
|
} | {
|
|
55
55
|
entryType: 'rename-composition';
|
|
56
|
+
} | {
|
|
57
|
+
entryType: 'new-composition';
|
|
56
58
|
} | {
|
|
57
59
|
entryType: 'duplicate-composition';
|
|
58
60
|
} | {
|
|
@@ -74,7 +76,7 @@ export declare function pushToUndoStack({ filePath, oldContents, newContents, lo
|
|
|
74
76
|
export declare function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore }: {
|
|
75
77
|
snapshots: Array<{
|
|
76
78
|
filePath: string;
|
|
77
|
-
oldContents: string;
|
|
79
|
+
oldContents: string | null;
|
|
78
80
|
newContents: string | null;
|
|
79
81
|
logLine: number;
|
|
80
82
|
}>;
|
|
@@ -233,7 +233,9 @@ function popUndo() {
|
|
|
233
233
|
var _a;
|
|
234
234
|
return {
|
|
235
235
|
...snapshot,
|
|
236
|
-
newContents: (_a = snapshot.newContents) !== null && _a !== void 0 ? _a : (0, node_fs_1.
|
|
236
|
+
newContents: (_a = snapshot.newContents) !== null && _a !== void 0 ? _a : ((0, node_fs_1.existsSync)(snapshot.filePath)
|
|
237
|
+
? (0, node_fs_1.readFileSync)(snapshot.filePath, 'utf-8')
|
|
238
|
+
: null),
|
|
237
239
|
};
|
|
238
240
|
});
|
|
239
241
|
redoStack.push(makeUndoEntry({
|
|
@@ -250,13 +252,20 @@ function popUndo() {
|
|
|
250
252
|
if (entry.suppressHmrOnFileRestore) {
|
|
251
253
|
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
|
|
252
254
|
}
|
|
253
|
-
|
|
255
|
+
if (snapshot.oldContents === null) {
|
|
256
|
+
(0, node_fs_1.rmSync)(snapshot.filePath, { force: true });
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(snapshot.filePath, snapshot.oldContents, undefined);
|
|
260
|
+
}
|
|
254
261
|
}
|
|
255
262
|
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Undo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
|
|
256
263
|
logFileAction(entry.description.undoMessage, entry.filePath, entry.logLine);
|
|
257
264
|
if (entry.entryType === 'visual-control') {
|
|
258
265
|
for (const snapshot of entry.snapshots) {
|
|
259
|
-
|
|
266
|
+
if (snapshot.oldContents !== null) {
|
|
267
|
+
emitVisualControlChanges(snapshot.oldContents);
|
|
268
|
+
}
|
|
260
269
|
}
|
|
261
270
|
}
|
|
262
271
|
for (const filePath of getEntryFilePaths(entry)) {
|
package/dist/routes.js
CHANGED
|
@@ -105,7 +105,7 @@ const handleFallback = async ({ remotionRoot, hash, response, request, getCurren
|
|
|
105
105
|
response.setHeader('content-type', 'text/html');
|
|
106
106
|
if (enableCrossSiteIsolation) {
|
|
107
107
|
response.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
|
|
108
|
-
response.setHeader('Cross-Origin-Embedder-Policy', '
|
|
108
|
+
response.setHeader('Cross-Origin-Embedder-Policy', 'credentialless');
|
|
109
109
|
}
|
|
110
110
|
const packageManager = (0, get_package_manager_1.getPackageManager)({
|
|
111
111
|
remotionRoot,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio-server",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.482",
|
|
7
7
|
"description": "Run a Remotion Studio with a server backend",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"scripts": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"@babel/parser": "7.24.1",
|
|
28
28
|
"semver": "7.5.3",
|
|
29
29
|
"prettier": "3.8.1",
|
|
30
|
-
"remotion": "4.0.
|
|
30
|
+
"remotion": "4.0.482",
|
|
31
31
|
"recast": "0.23.11",
|
|
32
|
-
"@remotion/bundler": "4.0.
|
|
33
|
-
"@remotion/renderer": "4.0.
|
|
34
|
-
"@remotion/studio-shared": "4.0.
|
|
32
|
+
"@remotion/bundler": "4.0.482",
|
|
33
|
+
"@remotion/renderer": "4.0.482",
|
|
34
|
+
"@remotion/studio-shared": "4.0.482",
|
|
35
35
|
"memfs": "3.4.3",
|
|
36
36
|
"open": "8.4.2"
|
|
37
37
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ast-types": "0.16.1",
|
|
40
40
|
"react": "19.2.3",
|
|
41
41
|
"@types/semver": "7.5.3",
|
|
42
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
42
|
+
"@remotion/eslint-config-internal": "4.0.482",
|
|
43
43
|
"eslint": "9.19.0",
|
|
44
44
|
"@types/node": "20.12.14",
|
|
45
45
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|