@remotion/studio-server 4.0.534 → 4.0.536
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/file-watcher.js +2 -0
- package/dist/helpers/app-discovery.d.ts +9 -0
- package/dist/helpers/app-discovery.js +61 -0
- package/dist/helpers/open-in-app.d.ts +13 -0
- package/dist/helpers/open-in-app.js +72 -0
- package/dist/helpers/open-in-editor.js +7 -6
- package/dist/helpers/recently-used-apps.d.ts +9 -0
- package/dist/helpers/recently-used-apps.js +63 -0
- package/dist/helpers/resolve-composition-component.d.ts +1 -2
- package/dist/helpers/resolve-composition-component.js +1 -3
- package/dist/preview-server/api-routes.js +4 -5
- package/dist/preview-server/live-events.d.ts +1 -0
- package/dist/preview-server/live-events.js +12 -1
- package/dist/preview-server/routes/app-info.d.ts +3 -0
- package/dist/preview-server/routes/app-info.js +16 -0
- package/dist/preview-server/routes/default-coding-agent.d.ts +1 -2
- package/dist/preview-server/routes/default-coding-agent.js +10 -20
- package/dist/preview-server/routes/default-editor.js +9 -33
- package/dist/preview-server/routes/element-install-plan.js +5 -0
- package/dist/preview-server/routes/insert-basic-captions.js +2 -2
- package/dist/preview-server/routes/insert-composition-element.js +14 -6
- package/dist/preview-server/routes/insert-element.js +46 -14
- package/dist/preview-server/routes/open-in-editor.d.ts +1 -1
- package/dist/preview-server/routes/open-in-editor.js +2 -56
- package/dist/preview-server/routes/redo.js +2 -1
- package/dist/preview-server/routes/source-file-write-queue.d.ts +1 -1
- package/dist/preview-server/routes/undo.js +2 -1
- package/dist/preview-server/routes/update-config.js +12 -5
- package/dist/preview-server/studio-protocol/handle-element-library.js +14 -0
- package/dist/preview-server/studio-protocol/handle-install.js +2 -1
- package/dist/preview-server/undo-stack.js +1 -0
- package/dist/preview-server/watch-ignore-next-change.d.ts +1 -0
- package/dist/preview-server/watch-ignore-next-change.js +15 -2
- package/dist/start-studio.js +6 -3
- package/dist/studio-shortcuts.d.ts +13 -0
- package/dist/studio-shortcuts.js +257 -0
- package/package.json +8 -8
- package/dist/canvas-capture/generate-canvas-capture-composition.d.ts +0 -14
- package/dist/canvas-capture/generate-canvas-capture-composition.js +0 -239
- package/dist/codemods/add-effect.d.ts +0 -1
- package/dist/codemods/add-effect.js +0 -8
- package/dist/codemods/apply-codemod-to-file.d.ts +0 -7
- package/dist/codemods/apply-codemod-to-file.js +0 -171
- package/dist/codemods/apply-visual-control.d.ts +0 -8
- package/dist/codemods/apply-visual-control.js +0 -89
- package/dist/codemods/delete-effect.d.ts +0 -1
- package/dist/codemods/delete-effect.js +0 -6
- package/dist/codemods/delete-jsx-node.d.ts +0 -22
- package/dist/codemods/delete-jsx-node.js +0 -17
- package/dist/codemods/delete-jsx-nodes.d.ts +0 -13
- package/dist/codemods/delete-jsx-nodes.js +0 -10
- package/dist/codemods/duplicate-composition.d.ts +0 -2
- package/dist/codemods/duplicate-composition.js +0 -64
- package/dist/codemods/duplicate-effect.d.ts +0 -1
- package/dist/codemods/duplicate-effect.js +0 -6
- package/dist/codemods/duplicate-jsx-node.d.ts +0 -25
- package/dist/codemods/duplicate-jsx-node.js +0 -26
- package/dist/codemods/format-file-content.d.ts +0 -7
- package/dist/codemods/format-file-content.js +0 -80
- package/dist/codemods/format-inline-content.d.ts +0 -18
- package/dist/codemods/format-inline-content.js +0 -78
- package/dist/codemods/insert-video-layers.d.ts +0 -11
- package/dist/codemods/insert-video-layers.js +0 -5
- package/dist/codemods/recast-mods.d.ts +0 -13
- package/dist/codemods/recast-mods.js +0 -902
- package/dist/codemods/reorder-effect.d.ts +0 -1
- package/dist/codemods/reorder-effect.js +0 -5
- package/dist/codemods/reorder-sequence.d.ts +0 -1
- package/dist/codemods/reorder-sequence.js +0 -5
- package/dist/codemods/simple-diff.d.ts +0 -5
- package/dist/codemods/simple-diff.js +0 -39
- package/dist/codemods/split-jsx-sequence.d.ts +0 -27
- package/dist/codemods/split-jsx-sequence.js +0 -19
- package/dist/codemods/split-video-from-audio.d.ts +0 -1
- package/dist/codemods/split-video-from-audio.js +0 -5
- package/dist/codemods/update-default-props.d.ts +0 -1
- package/dist/codemods/update-default-props.js +0 -6
- package/dist/codemods/update-inline-caption-patches.d.ts +0 -1
- package/dist/codemods/update-inline-caption-patches.js +0 -5
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +0 -1
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +0 -7
- package/dist/open-browser-shortcut.d.ts +0 -9
- package/dist/open-browser-shortcut.js +0 -121
- package/dist/preview-server/hot-middleware/types.d.ts +0 -2
- package/dist/preview-server/hot-middleware/types.js +0 -2
- package/dist/preview-server/routes/apply-codemod.d.ts +0 -4
- package/dist/preview-server/routes/apply-codemod.js +0 -272
- package/dist/preview-server/routes/delete-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/delete-jsx-node.js +0 -126
- package/dist/preview-server/routes/delete-jsx-nodes.d.ts +0 -3
- package/dist/preview-server/routes/delete-jsx-nodes.js +0 -137
- package/dist/preview-server/routes/duplicate-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/duplicate-jsx-node.js +0 -118
- package/dist/preview-server/routes/insert-jsx-element.d.ts +0 -3
- package/dist/preview-server/routes/insert-jsx-element.js +0 -231
- package/dist/preview-server/routes/insert-video-layers.d.ts +0 -3
- package/dist/preview-server/routes/insert-video-layers.js +0 -68
- package/dist/preview-server/routes/split-jsx-sequence.d.ts +0 -3
- package/dist/preview-server/routes/split-jsx-sequence.js +0 -117
- package/dist/preview-server/routes/update-public-license.d.ts +0 -11
- package/dist/preview-server/routes/update-public-license.js +0 -97
- package/dist/preview-server/routes/wrap-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/wrap-jsx-node.js +0 -97
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertVideoLayersHandler = void 0;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
|
-
const renderer_1 = require("@remotion/renderer");
|
|
6
|
-
const insert_video_layers_1 = require("../../codemods/insert-video-layers");
|
|
7
|
-
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
-
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
-
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
-
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
|
-
const undo_stack_1 = require("../undo-stack");
|
|
12
|
-
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
-
const insertVideoLayersHandler = ({ input: { fileName, nodePath, baseSrc, foregroundSrc }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
14
|
-
var _a;
|
|
15
|
-
try {
|
|
16
|
-
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
17
|
-
remotionRoot,
|
|
18
|
-
fileName,
|
|
19
|
-
action: 'modify',
|
|
20
|
-
});
|
|
21
|
-
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
22
|
-
const { output, logLine, nodePathRemappings } = (0, insert_video_layers_1.insertVideoLayers)({
|
|
23
|
-
input: fileContents,
|
|
24
|
-
nodePath,
|
|
25
|
-
baseSrc,
|
|
26
|
-
foregroundSrc,
|
|
27
|
-
});
|
|
28
|
-
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([{ absolutePath, remappings: nodePathRemappings }], null);
|
|
29
|
-
(0, undo_stack_1.pushToUndoStack)({
|
|
30
|
-
filePath: absolutePath,
|
|
31
|
-
oldContents: fileContents,
|
|
32
|
-
newContents: null,
|
|
33
|
-
logLevel,
|
|
34
|
-
remotionRoot,
|
|
35
|
-
logLine,
|
|
36
|
-
description: {
|
|
37
|
-
undoMessage: '↩️ Insertion of separated video layers',
|
|
38
|
-
redoMessage: '↪️ Insertion of separated video layers',
|
|
39
|
-
},
|
|
40
|
-
entryType: 'insert-video-layers',
|
|
41
|
-
suppressHmrOnFileRestore: false,
|
|
42
|
-
nodePathRemappings,
|
|
43
|
-
});
|
|
44
|
-
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
45
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
46
|
-
file: absolutePath,
|
|
47
|
-
content: output,
|
|
48
|
-
originatorClientId: undefined,
|
|
49
|
-
metadata: { skipSequencePropsUpdate: true },
|
|
50
|
-
});
|
|
51
|
-
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
52
|
-
remotionRoot,
|
|
53
|
-
absolutePath,
|
|
54
|
-
line: logLine,
|
|
55
|
-
});
|
|
56
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(locationLabel)} Inserted separated video layers`);
|
|
57
|
-
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
58
|
-
return Promise.resolve({ success: true, nodePathMutation });
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
return Promise.resolve({
|
|
62
|
-
success: false,
|
|
63
|
-
reason: error.message,
|
|
64
|
-
stack: (_a = error.stack) !== null && _a !== void 0 ? _a : '',
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
exports.insertVideoLayersHandler = insertVideoLayersHandler;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitJsxSequenceHandler = void 0;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
|
-
const codemods_1 = require("@remotion/codemods");
|
|
6
|
-
const renderer_1 = require("@remotion/renderer");
|
|
7
|
-
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
-
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
-
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
-
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
|
-
const undo_stack_1 = require("../undo-stack");
|
|
12
|
-
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
-
const splitJsxSequenceHandler = ({ input: { sequences }, remotionRoot, logLevel }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
14
|
-
var _a;
|
|
15
|
-
try {
|
|
16
|
-
if (sequences.length === 0) {
|
|
17
|
-
throw new Error('No JSX sequences were specified for splitting');
|
|
18
|
-
}
|
|
19
|
-
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[split-jsx-sequence] Received request to split ${sequences.length} JSX sequence${sequences.length === 1 ? '' : 's'}`);
|
|
20
|
-
const sequencesByFileName = new Map();
|
|
21
|
-
for (const sequence of sequences) {
|
|
22
|
-
const fileSequences = (_a = sequencesByFileName.get(sequence.fileName)) !== null && _a !== void 0 ? _a : [];
|
|
23
|
-
fileSequences.push(sequence);
|
|
24
|
-
sequencesByFileName.set(sequence.fileName, fileSequences);
|
|
25
|
-
}
|
|
26
|
-
const updates = await Promise.all([...sequencesByFileName].map(async ([fileName, fileSequences]) => {
|
|
27
|
-
var _a;
|
|
28
|
-
var _b;
|
|
29
|
-
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
30
|
-
remotionRoot,
|
|
31
|
-
fileName,
|
|
32
|
-
action: 'modify',
|
|
33
|
-
});
|
|
34
|
-
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
35
|
-
const result = await (0, codemods_1.splitSequences)({
|
|
36
|
-
project: {
|
|
37
|
-
files: { [absolutePath]: fileContents },
|
|
38
|
-
rootDir: remotionRoot,
|
|
39
|
-
},
|
|
40
|
-
splits: fileSequences.map(({ nodePath, sequenceKeys, splitFrame }) => ({
|
|
41
|
-
node: { filePath: absolutePath, nodePath },
|
|
42
|
-
sequenceKeys,
|
|
43
|
-
frame: splitFrame,
|
|
44
|
-
})),
|
|
45
|
-
});
|
|
46
|
-
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : fileContents;
|
|
47
|
-
const { nodeLabels, logLines } = result.editDetails[0];
|
|
48
|
-
const nodePathRemappings = result.nodePathRemappings.map(({ oldNodePath, newNodePath }) => ({ oldNodePath, newNodePath }));
|
|
49
|
-
return {
|
|
50
|
-
absolutePath,
|
|
51
|
-
fileContents,
|
|
52
|
-
fileRelativeToRoot,
|
|
53
|
-
logLine: Math.min(...logLines),
|
|
54
|
-
nodeLabels,
|
|
55
|
-
nodePathRemappings,
|
|
56
|
-
output,
|
|
57
|
-
};
|
|
58
|
-
}));
|
|
59
|
-
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)(updates.map((update) => ({
|
|
60
|
-
absolutePath: update.absolutePath,
|
|
61
|
-
remappings: update.nodePathRemappings,
|
|
62
|
-
})), null);
|
|
63
|
-
const splitDescription = sequences.length === 1
|
|
64
|
-
? updates[0].nodeLabels[0]
|
|
65
|
-
: `${sequences.length} JSX sequences`;
|
|
66
|
-
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
67
|
-
snapshots: updates.map((update) => ({
|
|
68
|
-
filePath: update.absolutePath,
|
|
69
|
-
oldContents: update.fileContents,
|
|
70
|
-
newContents: null,
|
|
71
|
-
logLine: update.logLine,
|
|
72
|
-
nodePathRemappings: update.nodePathRemappings,
|
|
73
|
-
})),
|
|
74
|
-
logLevel,
|
|
75
|
-
remotionRoot,
|
|
76
|
-
description: {
|
|
77
|
-
undoMessage: `↩️ Split of ${splitDescription}`,
|
|
78
|
-
redoMessage: `↪️ Split of ${splitDescription}`,
|
|
79
|
-
},
|
|
80
|
-
entryType: 'split-jsx-sequence',
|
|
81
|
-
suppressHmrOnFileRestore: false,
|
|
82
|
-
undoRedoNavigation: null,
|
|
83
|
-
});
|
|
84
|
-
for (const update of updates) {
|
|
85
|
-
(0, undo_stack_1.suppressUndoStackInvalidation)(update.absolutePath);
|
|
86
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
87
|
-
file: update.absolutePath,
|
|
88
|
-
content: update.output,
|
|
89
|
-
originatorClientId: undefined,
|
|
90
|
-
metadata: { skipSequencePropsUpdate: true },
|
|
91
|
-
});
|
|
92
|
-
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
93
|
-
remotionRoot,
|
|
94
|
-
absolutePath: update.absolutePath,
|
|
95
|
-
line: update.logLine,
|
|
96
|
-
});
|
|
97
|
-
const fileDescription = update.nodeLabels.length === 1
|
|
98
|
-
? update.nodeLabels[0]
|
|
99
|
-
: `${update.nodeLabels.length} JSX sequences`;
|
|
100
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Split ${fileDescription}`);
|
|
101
|
-
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[split-jsx-sequence] Wrote ${update.fileRelativeToRoot}`);
|
|
102
|
-
}
|
|
103
|
-
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
104
|
-
return {
|
|
105
|
-
success: true,
|
|
106
|
-
nodePathMutation,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
return {
|
|
111
|
-
success: false,
|
|
112
|
-
reason: err.message,
|
|
113
|
-
stack: err.stack,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
exports.splitJsxSequenceHandler = splitJsxSequenceHandler;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { UpdatePublicLicenseRequest, UpdatePublicLicenseResponse } from '@remotion/studio-shared';
|
|
2
|
-
import type { ApiHandler } from '../api-types';
|
|
3
|
-
export declare const updatePublicLicenseInConfig: ({ configContents, publicLicenseKey, }: {
|
|
4
|
-
configContents: string;
|
|
5
|
-
publicLicenseKey: string;
|
|
6
|
-
}) => string;
|
|
7
|
-
export declare const setPublicLicenseKeyInConfigFile: ({ configFile, publicLicenseKey, }: {
|
|
8
|
-
readonly configFile: string;
|
|
9
|
-
readonly publicLicenseKey: string;
|
|
10
|
-
}) => void;
|
|
11
|
-
export declare const updatePublicLicenseHandler: ApiHandler<UpdatePublicLicenseRequest, UpdatePublicLicenseResponse>;
|
|
@@ -1,97 +0,0 @@
|
|
|
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
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.updatePublicLicenseHandler = exports.setPublicLicenseKeyInConfigFile = exports.updatePublicLicenseInConfig = void 0;
|
|
37
|
-
const node_fs_1 = require("node:fs");
|
|
38
|
-
const recast = __importStar(require("recast"));
|
|
39
|
-
const parse_ast_1 = require("../../codemods/parse-ast");
|
|
40
|
-
const file_watcher_1 = require("../../file-watcher");
|
|
41
|
-
const updatePublicLicenseInConfig = ({ configContents, publicLicenseKey, }) => {
|
|
42
|
-
const ast = (0, parse_ast_1.parseAst)(configContents);
|
|
43
|
-
recast.types.visit(ast.program, {
|
|
44
|
-
visitExpressionStatement(path) {
|
|
45
|
-
const { expression } = path.node;
|
|
46
|
-
if (expression.type === 'CallExpression' &&
|
|
47
|
-
expression.callee.type === 'MemberExpression' &&
|
|
48
|
-
!expression.callee.computed &&
|
|
49
|
-
expression.callee.object.type === 'Identifier' &&
|
|
50
|
-
expression.callee.object.name === 'Config' &&
|
|
51
|
-
expression.callee.property.type === 'Identifier' &&
|
|
52
|
-
expression.callee.property.name === 'setPublicLicenseKey') {
|
|
53
|
-
path.prune();
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
this.traverse(path);
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
const configWithoutExistingCalls = recast.print(ast, {
|
|
60
|
-
lineTerminator: '\n',
|
|
61
|
-
}).code;
|
|
62
|
-
const separator = configWithoutExistingCalls.endsWith('\n') ? '' : '\n';
|
|
63
|
-
const escapedPublicLicenseKey = publicLicenseKey
|
|
64
|
-
.replaceAll('\\', '\\\\')
|
|
65
|
-
.replaceAll("'", "\\'")
|
|
66
|
-
.replaceAll('\r', '\\r')
|
|
67
|
-
.replaceAll('\n', '\\n')
|
|
68
|
-
.replaceAll('\u2028', '\\u2028')
|
|
69
|
-
.replaceAll('\u2029', '\\u2029');
|
|
70
|
-
return `${configWithoutExistingCalls}${separator}Config.setPublicLicenseKey('${escapedPublicLicenseKey}');\n`;
|
|
71
|
-
};
|
|
72
|
-
exports.updatePublicLicenseInConfig = updatePublicLicenseInConfig;
|
|
73
|
-
const setPublicLicenseKeyInConfigFile = ({ configFile, publicLicenseKey, }) => {
|
|
74
|
-
const configContents = (0, node_fs_1.readFileSync)(configFile, 'utf8');
|
|
75
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(configFile, (0, exports.updatePublicLicenseInConfig)({ configContents, publicLicenseKey }), undefined);
|
|
76
|
-
};
|
|
77
|
-
exports.setPublicLicenseKeyInConfigFile = setPublicLicenseKeyInConfigFile;
|
|
78
|
-
const updatePublicLicenseHandler = ({ input, configFile }) => {
|
|
79
|
-
if (configFile === null || configFile === undefined) {
|
|
80
|
-
return Promise.resolve({
|
|
81
|
-
success: false,
|
|
82
|
-
reason: 'No Remotion config file was loaded.',
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (input.publicLicenseKey.length === 0) {
|
|
86
|
-
return Promise.resolve({
|
|
87
|
-
success: false,
|
|
88
|
-
reason: 'The public license key must not be empty.',
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
(0, exports.setPublicLicenseKeyInConfigFile)({
|
|
92
|
-
configFile,
|
|
93
|
-
publicLicenseKey: input.publicLicenseKey,
|
|
94
|
-
});
|
|
95
|
-
return Promise.resolve({ success: true });
|
|
96
|
-
};
|
|
97
|
-
exports.updatePublicLicenseHandler = updatePublicLicenseHandler;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapJsxNodeHandler = void 0;
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
|
-
const codemods_1 = require("@remotion/codemods");
|
|
6
|
-
const renderer_1 = require("@remotion/renderer");
|
|
7
|
-
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
-
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
-
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
-
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
|
-
const undo_stack_1 = require("../undo-stack");
|
|
12
|
-
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
|
-
const wrapJsxNodeHandler = ({ input: { fileName, nodePath, wrapper, width, height }, remotionRoot, logLevel, }) => {
|
|
14
|
-
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
15
|
-
var _a;
|
|
16
|
-
try {
|
|
17
|
-
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
18
|
-
remotionRoot,
|
|
19
|
-
fileName,
|
|
20
|
-
action: 'modify',
|
|
21
|
-
});
|
|
22
|
-
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
-
const eligibility = (0, codemods_1.canWrapJsxNode)({ input: fileContents, nodePath });
|
|
24
|
-
if (wrapper === null) {
|
|
25
|
-
return Promise.resolve({
|
|
26
|
-
success: true,
|
|
27
|
-
...eligibility,
|
|
28
|
-
nodePathMutation: null,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
if (!eligibility.canWrap ||
|
|
32
|
-
(wrapper === 'HtmlInCanvas' && !eligibility.canWrapHtmlInCanvas)) {
|
|
33
|
-
throw new Error('This JSX element cannot be wrapped');
|
|
34
|
-
}
|
|
35
|
-
const result = (0, codemods_1.wrapJsxNode)({
|
|
36
|
-
project: { files: { [absolutePath]: fileContents }, rootDir: remotionRoot },
|
|
37
|
-
node: { filePath: absolutePath, nodePath },
|
|
38
|
-
wrapper,
|
|
39
|
-
width: width !== null && width !== void 0 ? width : 0,
|
|
40
|
-
height: height !== null && height !== void 0 ? height : 0,
|
|
41
|
-
});
|
|
42
|
-
const change = result.changes.find(({ filePath }) => filePath === absolutePath);
|
|
43
|
-
if ((change === null || change === void 0 ? void 0 : change.previousContents) !== fileContents ||
|
|
44
|
-
change.nextContents === null) {
|
|
45
|
-
throw new Error('Could not wrap JSX node');
|
|
46
|
-
}
|
|
47
|
-
const output = change.nextContents;
|
|
48
|
-
const remappings = result.nodePathRemappings.map(({ oldNodePath, newNodePath }) => ({ oldNodePath, newNodePath }));
|
|
49
|
-
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([{ absolutePath, remappings }], null);
|
|
50
|
-
const line = result.logLine;
|
|
51
|
-
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
52
|
-
snapshots: [
|
|
53
|
-
{
|
|
54
|
-
filePath: absolutePath,
|
|
55
|
-
oldContents: fileContents,
|
|
56
|
-
newContents: null,
|
|
57
|
-
logLine: line,
|
|
58
|
-
nodePathRemappings: remappings,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
logLevel,
|
|
62
|
-
remotionRoot,
|
|
63
|
-
description: {
|
|
64
|
-
undoMessage: `↩️ Wrapping in ${wrapper}`,
|
|
65
|
-
redoMessage: `↪️ Wrapping in ${wrapper}`,
|
|
66
|
-
},
|
|
67
|
-
entryType: 'wrap-jsx-node',
|
|
68
|
-
suppressHmrOnFileRestore: false,
|
|
69
|
-
undoRedoNavigation: null,
|
|
70
|
-
});
|
|
71
|
-
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
72
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
73
|
-
file: absolutePath,
|
|
74
|
-
content: output,
|
|
75
|
-
originatorClientId: undefined,
|
|
76
|
-
metadata: { skipSequencePropsUpdate: true },
|
|
77
|
-
});
|
|
78
|
-
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
79
|
-
remotionRoot,
|
|
80
|
-
absolutePath,
|
|
81
|
-
line,
|
|
82
|
-
});
|
|
83
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(locationLabel)} Wrapped JSX in <${wrapper}>`);
|
|
84
|
-
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[wrap-jsx-node] Wrote ${fileRelativeToRoot}`);
|
|
85
|
-
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
86
|
-
return Promise.resolve({ success: true, ...eligibility, nodePathMutation });
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
return Promise.resolve({
|
|
90
|
-
success: false,
|
|
91
|
-
reason: err.message,
|
|
92
|
-
stack: (_a = err.stack) !== null && _a !== void 0 ? _a : '',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
exports.wrapJsxNodeHandler = wrapJsxNodeHandler;
|