@remotion/studio-server 4.0.461 → 4.0.463
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/update-effect-props/update-effect-props.d.ts +52 -0
- package/dist/codemods/update-effect-props/update-effect-props.js +229 -0
- package/dist/preview-server/api-routes.js +2 -0
- package/dist/preview-server/jsx-element-not-found-at-location-error.d.ts +3 -0
- package/dist/preview-server/jsx-element-not-found-at-location-error.js +10 -0
- package/dist/preview-server/project-info.js +27 -0
- package/dist/preview-server/routes/can-update-effect-props.d.ts +20 -0
- package/dist/preview-server/routes/can-update-effect-props.js +146 -0
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +21 -3
- package/dist/preview-server/routes/can-update-sequence-props.js +64 -13
- package/dist/preview-server/routes/log-updates/format-effect-prop-change.d.ts +10 -0
- package/dist/preview-server/routes/log-updates/format-effect-prop-change.js +51 -0
- package/dist/preview-server/routes/log-updates/log-effect-update.d.ts +14 -0
- package/dist/preview-server/routes/log-updates/log-effect-update.js +23 -0
- package/dist/preview-server/routes/save-effect-props.d.ts +3 -0
- package/dist/preview-server/routes/save-effect-props.js +108 -0
- package/dist/preview-server/routes/save-props-mutex.d.ts +1 -0
- package/dist/preview-server/routes/save-props-mutex.js +11 -0
- package/dist/preview-server/routes/save-sequence-props.d.ts +2 -3
- package/dist/preview-server/routes/save-sequence-props.js +10 -9
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +4 -3
- package/dist/preview-server/routes/unsubscribe-from-sequence-props.js +4 -2
- package/dist/preview-server/sequence-props-watchers.d.ts +7 -3
- package/dist/preview-server/sequence-props-watchers.js +51 -22
- package/dist/preview-server/undo-stack.d.ts +3 -1
- package/package.json +6 -7
- package/dist/codemods/get-all-schema-keys.d.ts +0 -2
- package/dist/codemods/get-all-schema-keys.js +0 -8
- package/dist/codemods/jsx-sequence-context.d.ts +0 -11
- package/dist/codemods/jsx-sequence-context.js +0 -68
- package/dist/codemods/update-sequence-props.d.ts +0 -35
- package/dist/codemods/update-sequence-props.js +0 -228
- package/dist/preview-server/routes/log-update.d.ts +0 -29
- package/dist/preview-server/routes/log-update.js +0 -109
package/package.json
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
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.463",
|
|
7
7
|
"description": "Run a Remotion Studio with a server backend",
|
|
8
8
|
"main": "dist",
|
|
9
|
-
"sideEffects": false,
|
|
10
9
|
"scripts": {
|
|
11
10
|
"lint": "eslint src",
|
|
12
11
|
"test": "bun test src",
|
|
@@ -28,11 +27,11 @@
|
|
|
28
27
|
"@babel/parser": "7.24.1",
|
|
29
28
|
"semver": "7.5.3",
|
|
30
29
|
"prettier": "3.8.1",
|
|
31
|
-
"remotion": "4.0.
|
|
30
|
+
"remotion": "4.0.463",
|
|
32
31
|
"recast": "0.23.11",
|
|
33
|
-
"@remotion/bundler": "4.0.
|
|
34
|
-
"@remotion/renderer": "4.0.
|
|
35
|
-
"@remotion/studio-shared": "4.0.
|
|
32
|
+
"@remotion/bundler": "4.0.463",
|
|
33
|
+
"@remotion/renderer": "4.0.463",
|
|
34
|
+
"@remotion/studio-shared": "4.0.463",
|
|
36
35
|
"memfs": "3.4.3",
|
|
37
36
|
"open": "8.4.2"
|
|
38
37
|
},
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
"ast-types": "0.16.1",
|
|
41
40
|
"react": "19.2.3",
|
|
42
41
|
"@types/semver": "7.5.3",
|
|
43
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
42
|
+
"@remotion/eslint-config-internal": "4.0.463",
|
|
44
43
|
"eslint": "9.19.0",
|
|
45
44
|
"@types/node": "20.12.14",
|
|
46
45
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAllSchemaKeys = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
|
-
const getAllSchemaKeys = (schema) => {
|
|
6
|
-
return Object.keys(remotion_1.Internals.getFlatSchemaWithAllKeys(schema));
|
|
7
|
-
};
|
|
8
|
-
exports.getAllSchemaKeys = getAllSchemaKeys;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Expression, File } from '@babel/types';
|
|
2
|
-
import type { SequenceNodePath } from 'remotion';
|
|
3
|
-
/**
|
|
4
|
-
* Whether the callee is a `.map(...)` member call (including optional `?.map`).
|
|
5
|
-
*/
|
|
6
|
-
export declare const isMapCallee: (callee: Expression) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* True when the JSX element at `nodePath` is defined inside a `.map()` callback
|
|
9
|
-
* (array iteration). Used to flag duplicate / edit behavior for list-driven JSX.
|
|
10
|
-
*/
|
|
11
|
-
export declare const isJsxUnderMapCallback: (ast: File, nodePath: SequenceNodePath) => boolean;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isJsxUnderMapCallback = exports.isMapCallee = void 0;
|
|
4
|
-
const delete_jsx_node_1 = require("./delete-jsx-node");
|
|
5
|
-
const unwrapExpression = (expr) => {
|
|
6
|
-
if (expr.type === 'TSAsExpression') {
|
|
7
|
-
return unwrapExpression(expr.expression);
|
|
8
|
-
}
|
|
9
|
-
if (expr.type === 'ParenthesizedExpression') {
|
|
10
|
-
return unwrapExpression(expr.expression);
|
|
11
|
-
}
|
|
12
|
-
return expr;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Whether the callee is a `.map(...)` member call (including optional `?.map`).
|
|
16
|
-
*/
|
|
17
|
-
const isMapCallee = (callee) => {
|
|
18
|
-
const c = unwrapExpression(callee);
|
|
19
|
-
if (c.type === 'MemberExpression') {
|
|
20
|
-
if (c.computed) {
|
|
21
|
-
return c.property.type === 'StringLiteral' && c.property.value === 'map';
|
|
22
|
-
}
|
|
23
|
-
return c.property.type === 'Identifier' && c.property.name === 'map';
|
|
24
|
-
}
|
|
25
|
-
if (c.type === 'OptionalMemberExpression') {
|
|
26
|
-
if (c.computed) {
|
|
27
|
-
return c.property.type === 'StringLiteral' && c.property.value === 'map';
|
|
28
|
-
}
|
|
29
|
-
return c.property.type === 'Identifier' && c.property.name === 'map';
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
};
|
|
33
|
-
exports.isMapCallee = isMapCallee;
|
|
34
|
-
/**
|
|
35
|
-
* True when the JSX element at `nodePath` is defined inside a `.map()` callback
|
|
36
|
-
* (array iteration). Used to flag duplicate / edit behavior for list-driven JSX.
|
|
37
|
-
*/
|
|
38
|
-
const isJsxUnderMapCallback = (ast, nodePath) => {
|
|
39
|
-
const jsxPath = (0, delete_jsx_node_1.findJsxElementPathForDeletion)(ast, nodePath);
|
|
40
|
-
if (!jsxPath) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
let path = jsxPath.parentPath;
|
|
44
|
-
while (path) {
|
|
45
|
-
const n = path.node;
|
|
46
|
-
if (n.type === 'ArrowFunctionExpression' ||
|
|
47
|
-
n.type === 'FunctionExpression') {
|
|
48
|
-
const outer = path.parentPath;
|
|
49
|
-
if ((outer === null || outer === void 0 ? void 0 : outer.node.type) === 'CallExpression') {
|
|
50
|
-
const call = outer.node;
|
|
51
|
-
if ((0, exports.isMapCallee)(call.callee) &&
|
|
52
|
-
call.arguments.some((arg) => arg === n)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if ((outer === null || outer === void 0 ? void 0 : outer.node.type) === 'OptionalCallExpression') {
|
|
57
|
-
const call = outer.node;
|
|
58
|
-
if ((0, exports.isMapCallee)(call.callee) &&
|
|
59
|
-
call.arguments.some((arg) => arg === n)) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
path = path.parentPath;
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
};
|
|
68
|
-
exports.isJsxUnderMapCallback = isJsxUnderMapCallback;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { SequenceNodePath } from 'remotion';
|
|
2
|
-
import type { SequenceSchema } from 'remotion';
|
|
3
|
-
export type SequencePropUpdate = {
|
|
4
|
-
key: string;
|
|
5
|
-
value: unknown;
|
|
6
|
-
defaultValue: unknown | null;
|
|
7
|
-
};
|
|
8
|
-
export type RemovedProp = {
|
|
9
|
-
key: string;
|
|
10
|
-
valueString: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema, }: {
|
|
13
|
-
input: string;
|
|
14
|
-
nodePath: SequenceNodePath;
|
|
15
|
-
updates: SequencePropUpdate[];
|
|
16
|
-
schema?: SequenceSchema | undefined;
|
|
17
|
-
}) => {
|
|
18
|
-
serialized: string;
|
|
19
|
-
oldValueStrings: string[];
|
|
20
|
-
logLine: number;
|
|
21
|
-
removedProps: RemovedProp[];
|
|
22
|
-
};
|
|
23
|
-
export declare const updateSequenceProps: ({ input, nodePath, updates, schema, prettierConfigOverride, }: {
|
|
24
|
-
input: string;
|
|
25
|
-
nodePath: SequenceNodePath;
|
|
26
|
-
updates: SequencePropUpdate[];
|
|
27
|
-
schema: SequenceSchema;
|
|
28
|
-
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
29
|
-
}) => Promise<{
|
|
30
|
-
output: string;
|
|
31
|
-
oldValueStrings: string[];
|
|
32
|
-
formatted: boolean;
|
|
33
|
-
logLine: number;
|
|
34
|
-
removedProps: RemovedProp[];
|
|
35
|
-
}>;
|
|
@@ -1,228 +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.updateSequenceProps = exports.updateSequencePropsAst = void 0;
|
|
37
|
-
const recast = __importStar(require("recast"));
|
|
38
|
-
const can_update_sequence_props_1 = require("../preview-server/routes/can-update-sequence-props");
|
|
39
|
-
const format_file_content_1 = require("./format-file-content");
|
|
40
|
-
const parse_ast_1 = require("./parse-ast");
|
|
41
|
-
const update_nested_prop_1 = require("./update-nested-prop");
|
|
42
|
-
const b = recast.types.builders;
|
|
43
|
-
const removeVariantKey = ({ node, variantKey, }) => {
|
|
44
|
-
var _a;
|
|
45
|
-
const dotIndex = variantKey.indexOf('.');
|
|
46
|
-
if (dotIndex === -1) {
|
|
47
|
-
const idx = (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.findIndex((a) => a.type === 'JSXAttribute' &&
|
|
48
|
-
a.name.type === 'JSXIdentifier' &&
|
|
49
|
-
a.name.name === variantKey);
|
|
50
|
-
if (idx !== undefined && idx !== -1 && node.attributes) {
|
|
51
|
-
node.attributes.splice(idx, 1);
|
|
52
|
-
}
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
(0, update_nested_prop_1.updateNestedProp)({
|
|
56
|
-
node,
|
|
57
|
-
parentKey: variantKey.slice(0, dotIndex),
|
|
58
|
-
childKey: variantKey.slice(dotIndex + 1),
|
|
59
|
-
value: undefined,
|
|
60
|
-
defaultValue: null,
|
|
61
|
-
isDefault: true,
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const snapshotTopLevelAttrs = (node) => {
|
|
65
|
-
var _a;
|
|
66
|
-
const result = new Map();
|
|
67
|
-
for (const a of (_a = node.attributes) !== null && _a !== void 0 ? _a : []) {
|
|
68
|
-
if (a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier') {
|
|
69
|
-
result.set(a.name.name, recast
|
|
70
|
-
.print(a)
|
|
71
|
-
.code.replace(/\s+/g, ' ')
|
|
72
|
-
.replace(/,(\s*[}\]])/g, '$1')
|
|
73
|
-
.trim());
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
};
|
|
78
|
-
const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
79
|
-
var _a, _b, _c;
|
|
80
|
-
var _d, _e;
|
|
81
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
82
|
-
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
83
|
-
if (!node) {
|
|
84
|
-
throw new Error('Could not find a JSX element at the specified line to update');
|
|
85
|
-
}
|
|
86
|
-
const logLine = (_d = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : 1;
|
|
87
|
-
const oldValueStrings = [];
|
|
88
|
-
const initialAttrs = snapshotTopLevelAttrs(node);
|
|
89
|
-
const updatedTopLevelKeys = new Set(updates.map(({ key }) => {
|
|
90
|
-
const dot = key.indexOf('.');
|
|
91
|
-
return dot === -1 ? key : key.slice(0, dot);
|
|
92
|
-
}));
|
|
93
|
-
for (const { key, value, defaultValue } of updates) {
|
|
94
|
-
let oldValueString = '';
|
|
95
|
-
const isDefault = defaultValue !== null &&
|
|
96
|
-
JSON.stringify(value) === JSON.stringify(defaultValue);
|
|
97
|
-
const dotIndex = key.indexOf('.');
|
|
98
|
-
const isNested = dotIndex !== -1;
|
|
99
|
-
const parentKey = isNested ? key.slice(0, dotIndex) : key;
|
|
100
|
-
const childKey = isNested ? key.slice(dotIndex + 1) : '';
|
|
101
|
-
if (isNested) {
|
|
102
|
-
oldValueString = (0, update_nested_prop_1.updateNestedProp)({
|
|
103
|
-
node,
|
|
104
|
-
parentKey,
|
|
105
|
-
childKey,
|
|
106
|
-
value,
|
|
107
|
-
defaultValue,
|
|
108
|
-
isDefault,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
const attrIndex = (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.findIndex((a) => {
|
|
113
|
-
if (a.type === 'JSXSpreadAttribute') {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
if (a.name.type === 'JSXNamespacedName') {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
return a.name.name === key;
|
|
120
|
-
});
|
|
121
|
-
const attr = attrIndex !== undefined && attrIndex !== -1
|
|
122
|
-
? (_c = node.attributes) === null || _c === void 0 ? void 0 : _c[attrIndex]
|
|
123
|
-
: undefined;
|
|
124
|
-
if (attr && attr.type !== 'JSXSpreadAttribute' && attr.value) {
|
|
125
|
-
const printed = recast.print(attr.value).code;
|
|
126
|
-
// Strip JSX expression container braces, e.g. "{30}" -> "30"
|
|
127
|
-
oldValueString =
|
|
128
|
-
printed.startsWith('{') && printed.endsWith('}')
|
|
129
|
-
? printed.slice(1, -1)
|
|
130
|
-
: printed;
|
|
131
|
-
}
|
|
132
|
-
else if (attr && attr.type !== 'JSXSpreadAttribute' && !attr.value) {
|
|
133
|
-
// JSX shorthand like `loop` (no value) is implicitly `true`
|
|
134
|
-
oldValueString = 'true';
|
|
135
|
-
}
|
|
136
|
-
else if (!attr && defaultValue !== null) {
|
|
137
|
-
oldValueString = JSON.stringify(defaultValue);
|
|
138
|
-
}
|
|
139
|
-
if (isDefault) {
|
|
140
|
-
if (attr && attr.type !== 'JSXSpreadAttribute' && node.attributes) {
|
|
141
|
-
node.attributes.splice(attrIndex, 1);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
const parsed = (0, update_nested_prop_1.parseValueExpression)(value);
|
|
146
|
-
const newValue = value === true ? null : b.jsxExpressionContainer(parsed);
|
|
147
|
-
if (!attr || attr.type === 'JSXSpreadAttribute') {
|
|
148
|
-
const newAttr = b.jsxAttribute(b.jsxIdentifier(key), newValue);
|
|
149
|
-
if (!node.attributes) {
|
|
150
|
-
node.attributes = [];
|
|
151
|
-
}
|
|
152
|
-
node.attributes.push(newAttr);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
attr.value = newValue;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
oldValueStrings.push(oldValueString);
|
|
160
|
-
if (schema && !isNested) {
|
|
161
|
-
const fieldSchema = schema[key];
|
|
162
|
-
if (fieldSchema && fieldSchema.type === 'enum') {
|
|
163
|
-
let oldRawValue;
|
|
164
|
-
try {
|
|
165
|
-
oldRawValue = JSON.parse(oldValueString);
|
|
166
|
-
}
|
|
167
|
-
catch (_f) {
|
|
168
|
-
oldRawValue = oldValueString;
|
|
169
|
-
}
|
|
170
|
-
if (oldRawValue !== value) {
|
|
171
|
-
const oldVariant = typeof oldRawValue === 'string'
|
|
172
|
-
? fieldSchema.variants[oldRawValue]
|
|
173
|
-
: undefined;
|
|
174
|
-
const newVariant = typeof value === 'string' ? fieldSchema.variants[value] : undefined;
|
|
175
|
-
if (oldVariant) {
|
|
176
|
-
const newKeys = new Set(newVariant ? Object.keys(newVariant) : []);
|
|
177
|
-
for (const variantKey of Object.keys(oldVariant)) {
|
|
178
|
-
if (newKeys.has(variantKey)) {
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
removeVariantKey({ node, variantKey });
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
const finalAttrNames = new Set();
|
|
189
|
-
for (const a of (_e = node.attributes) !== null && _e !== void 0 ? _e : []) {
|
|
190
|
-
if (a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier') {
|
|
191
|
-
finalAttrNames.add(a.name.name);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const removedProps = [];
|
|
195
|
-
for (const [name, valueString] of initialAttrs) {
|
|
196
|
-
if (finalAttrNames.has(name) || updatedTopLevelKeys.has(name)) {
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
removedProps.push({ key: name, valueString });
|
|
200
|
-
}
|
|
201
|
-
return {
|
|
202
|
-
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
203
|
-
oldValueStrings,
|
|
204
|
-
logLine,
|
|
205
|
-
removedProps,
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
exports.updateSequencePropsAst = updateSequencePropsAst;
|
|
209
|
-
const updateSequenceProps = async ({ input, nodePath, updates, schema, prettierConfigOverride, }) => {
|
|
210
|
-
const { serialized, oldValueStrings, logLine, removedProps } = (0, exports.updateSequencePropsAst)({
|
|
211
|
-
input,
|
|
212
|
-
nodePath,
|
|
213
|
-
updates,
|
|
214
|
-
schema,
|
|
215
|
-
});
|
|
216
|
-
const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
|
|
217
|
-
input: serialized,
|
|
218
|
-
prettierConfigOverride,
|
|
219
|
-
});
|
|
220
|
-
return {
|
|
221
|
-
output,
|
|
222
|
-
oldValueStrings,
|
|
223
|
-
formatted,
|
|
224
|
-
logLine,
|
|
225
|
-
removedProps,
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
exports.updateSequenceProps = updateSequenceProps;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const warnAboutPrettierOnce: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => void;
|
|
2
|
-
export declare const normalizeQuotes: (str: string) => string;
|
|
3
|
-
export declare const fg: (r: number, g: number, b: number, str: string) => string;
|
|
4
|
-
export declare const bg: (r: number, g: number, b: number, str: string) => string;
|
|
5
|
-
export declare const strikeThrough: (str: string) => string;
|
|
6
|
-
export type PropDelta = {
|
|
7
|
-
key: string;
|
|
8
|
-
valueString: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const formatPropChange: ({ key, oldValueString, newValueString, defaultValueString, removedProps, addedProps, }: {
|
|
11
|
-
key: string;
|
|
12
|
-
oldValueString: string;
|
|
13
|
-
newValueString: string;
|
|
14
|
-
defaultValueString: string | null;
|
|
15
|
-
removedProps: PropDelta[];
|
|
16
|
-
addedProps: PropDelta[];
|
|
17
|
-
}) => string;
|
|
18
|
-
export declare const logUpdate: ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }: {
|
|
19
|
-
fileRelativeToRoot: string;
|
|
20
|
-
line: number;
|
|
21
|
-
key: string;
|
|
22
|
-
oldValueString: string;
|
|
23
|
-
newValueString: string;
|
|
24
|
-
defaultValueString: string | null;
|
|
25
|
-
formatted: boolean;
|
|
26
|
-
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
27
|
-
removedProps: PropDelta[];
|
|
28
|
-
addedProps: PropDelta[];
|
|
29
|
-
}) => void;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logUpdate = exports.formatPropChange = exports.strikeThrough = exports.bg = exports.fg = exports.normalizeQuotes = exports.warnAboutPrettierOnce = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
let warnedAboutPrettier = false;
|
|
6
|
-
const warnAboutPrettierOnce = (logLevel) => {
|
|
7
|
-
if (warnedAboutPrettier) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
warnedAboutPrettier = true;
|
|
11
|
-
renderer_1.RenderInternals.Log.warn({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.yellow('Could not format with Prettier. File will need to be formatted manually.'));
|
|
12
|
-
};
|
|
13
|
-
exports.warnAboutPrettierOnce = warnAboutPrettierOnce;
|
|
14
|
-
const normalizeQuotes = (str) => {
|
|
15
|
-
if (str.length >= 2 &&
|
|
16
|
-
((str.startsWith("'") && str.endsWith("'")) ||
|
|
17
|
-
(str.startsWith('"') && str.endsWith('"')))) {
|
|
18
|
-
return `'${str.slice(1, -1)}'`;
|
|
19
|
-
}
|
|
20
|
-
return str;
|
|
21
|
-
};
|
|
22
|
-
exports.normalizeQuotes = normalizeQuotes;
|
|
23
|
-
// 24-bit ANSI helpers
|
|
24
|
-
const fg = (r, g, b, str) => `\u001b[38;2;${r};${g};${b}m${str}\u001b[39m`;
|
|
25
|
-
exports.fg = fg;
|
|
26
|
-
const bg = (r, g, b, str) => `\u001b[48;2;${r};${g};${b}m${str}\u001b[49m`;
|
|
27
|
-
exports.bg = bg;
|
|
28
|
-
// eslint-disable-next-line no-control-regex
|
|
29
|
-
const stripAnsi = (str) => str.replace(/\u001b\[[0-9;]*m/g, '');
|
|
30
|
-
const strikeThrough = (str) => `\u001b[9m\u001b[38;2;255;85;85m${stripAnsi(str)}\u001b[39m\u001b[29m`;
|
|
31
|
-
exports.strikeThrough = strikeThrough;
|
|
32
|
-
// Monokai-inspired syntax colors
|
|
33
|
-
const attrName = (str) => (0, exports.fg)(166, 226, 46, str);
|
|
34
|
-
const equals = (str) => (0, exports.fg)(249, 38, 114, str);
|
|
35
|
-
const punctuation = (str) => (0, exports.fg)(248, 248, 242, str);
|
|
36
|
-
const stringValue = (str) => (0, exports.fg)(230, 219, 116, str);
|
|
37
|
-
const numberValue = (str) => (0, exports.fg)(174, 129, 255, str);
|
|
38
|
-
const colorValue = (str) => {
|
|
39
|
-
if ((str.startsWith("'") && str.endsWith("'")) ||
|
|
40
|
-
(str.startsWith('"') && str.endsWith('"'))) {
|
|
41
|
-
return stringValue(str);
|
|
42
|
-
}
|
|
43
|
-
if (/^-?\d+(\.\d+)?$/.test(str)) {
|
|
44
|
-
return numberValue(str);
|
|
45
|
-
}
|
|
46
|
-
return punctuation(str);
|
|
47
|
-
};
|
|
48
|
-
const colorEnabled = () => renderer_1.RenderInternals.chalk.enabled();
|
|
49
|
-
// Format key={value} with Monokai syntax highlighting
|
|
50
|
-
const formatSimpleProp = (key, value) => {
|
|
51
|
-
return `${attrName(key)}${equals('=')}${punctuation('{')}${colorValue(value)}${punctuation('}')}`;
|
|
52
|
-
};
|
|
53
|
-
// Format parentKey={{childKey: value}} with Monokai syntax highlighting
|
|
54
|
-
const formatNestedProp = (parentKey, childKey, value) => {
|
|
55
|
-
return `${attrName(parentKey)}${equals('=')}${punctuation('{{')}${punctuation(childKey)}${punctuation(':')} ${colorValue(value)}${punctuation('}}')}`;
|
|
56
|
-
};
|
|
57
|
-
const formatSideProps = ({ removedProps, addedProps, }) => {
|
|
58
|
-
const parts = [];
|
|
59
|
-
for (const { valueString } of removedProps) {
|
|
60
|
-
parts.push(colorEnabled() ? (0, exports.strikeThrough)(valueString) : valueString);
|
|
61
|
-
}
|
|
62
|
-
for (const { valueString } of addedProps) {
|
|
63
|
-
parts.push(valueString);
|
|
64
|
-
}
|
|
65
|
-
if (parts.length === 0) {
|
|
66
|
-
return '';
|
|
67
|
-
}
|
|
68
|
-
return `, ${parts.join(', ')}`;
|
|
69
|
-
};
|
|
70
|
-
const formatPropChange = ({ key, oldValueString, newValueString, defaultValueString, removedProps, addedProps, }) => {
|
|
71
|
-
const suffix = formatSideProps({ removedProps, addedProps });
|
|
72
|
-
if (!colorEnabled()) {
|
|
73
|
-
const dotIdx = key.indexOf('.');
|
|
74
|
-
if (dotIdx === -1) {
|
|
75
|
-
return `${key}={${oldValueString}} \u2192 ${key}={${newValueString}}${suffix}`;
|
|
76
|
-
}
|
|
77
|
-
const parent = key.slice(0, dotIdx);
|
|
78
|
-
const child = key.slice(dotIdx + 1);
|
|
79
|
-
return `${parent}={{${child}: ${oldValueString}}} \u2192 ${parent}={{${child}: ${newValueString}}}${suffix}`;
|
|
80
|
-
}
|
|
81
|
-
const dotIndex = key.indexOf('.');
|
|
82
|
-
const formatProp = (value) => dotIndex === -1
|
|
83
|
-
? formatSimpleProp(key, value)
|
|
84
|
-
: formatNestedProp(key.slice(0, dotIndex), key.slice(dotIndex + 1), value);
|
|
85
|
-
if (defaultValueString !== null && newValueString === defaultValueString) {
|
|
86
|
-
return `${(0, exports.strikeThrough)(formatProp(oldValueString))}${suffix}`;
|
|
87
|
-
}
|
|
88
|
-
if (defaultValueString !== null && oldValueString === defaultValueString) {
|
|
89
|
-
return `${formatProp(newValueString)}${suffix}`;
|
|
90
|
-
}
|
|
91
|
-
return `${formatProp(oldValueString)} \u2192 ${formatProp(newValueString)}${suffix}`;
|
|
92
|
-
};
|
|
93
|
-
exports.formatPropChange = formatPropChange;
|
|
94
|
-
const logUpdate = ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }) => {
|
|
95
|
-
const locationLabel = `${fileRelativeToRoot}:${line}`;
|
|
96
|
-
const propChange = (0, exports.formatPropChange)({
|
|
97
|
-
key,
|
|
98
|
-
oldValueString: (0, exports.normalizeQuotes)(oldValueString),
|
|
99
|
-
newValueString: (0, exports.normalizeQuotes)(newValueString),
|
|
100
|
-
defaultValueString: defaultValueString !== null ? (0, exports.normalizeQuotes)(defaultValueString) : null,
|
|
101
|
-
removedProps,
|
|
102
|
-
addedProps,
|
|
103
|
-
});
|
|
104
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}:`)} ${propChange}`);
|
|
105
|
-
if (!formatted) {
|
|
106
|
-
(0, exports.warnAboutPrettierOnce)(logLevel);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
exports.logUpdate = logUpdate;
|