Add .gitignore to exclude all node packages and lock files
This commit is contained in:
Generated
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringifyDefaultProps = void 0;
|
||||
const no_react_1 = require("remotion/no-react");
|
||||
function replacerWithPath(replacer) {
|
||||
const m = new Map();
|
||||
return function (field, value) {
|
||||
const path = [m.get(this), field].flat(1);
|
||||
if (value === Object(value)) {
|
||||
m.set(value, path);
|
||||
}
|
||||
return replacer.call(this, field, value, path.filter((item) => typeof item !== 'undefined' && item !== ''));
|
||||
};
|
||||
}
|
||||
const doesMatchPath = (path1, enumPaths) => {
|
||||
return enumPaths.some((p) =>
|
||||
// especially 0 for root!
|
||||
path1.length === p.length &&
|
||||
path1.every((item, index) => {
|
||||
if (p[index] === '[]' && !Number.isNaN(Number(item))) {
|
||||
return true;
|
||||
}
|
||||
if (p[index] === '{}' && typeof item === 'string') {
|
||||
return true;
|
||||
}
|
||||
return item === p[index];
|
||||
}));
|
||||
};
|
||||
const stringifyDefaultProps = ({ props, enumPaths, }) => {
|
||||
return JSON.stringify(props, replacerWithPath(function (key, value, path) {
|
||||
/* Don't replace with arrow function! This function uses `this` */
|
||||
const item = this[key];
|
||||
if (typeof item === 'string' && doesMatchPath(path, enumPaths)) {
|
||||
return `${item}__ADD_AS_CONST__`;
|
||||
}
|
||||
// For zMatrix()
|
||||
if (doesMatchPath(path, enumPaths)) {
|
||||
return `__REMOVEQUOTE__${JSON.stringify(item)}__ADD_AS_LITERAL_CONST__`;
|
||||
}
|
||||
if (typeof item === 'string' &&
|
||||
item.startsWith(no_react_1.NoReactInternals.FILE_TOKEN)) {
|
||||
return `__REMOVEQUOTE____WRAP_IN_STATIC_FILE_START__${decodeURIComponent(item.replace(no_react_1.NoReactInternals.FILE_TOKEN, ''))}__WRAP_IN_STATIC_FILE_END____REMOVEQUOTE__`;
|
||||
}
|
||||
if (typeof item === 'string' &&
|
||||
item.startsWith(no_react_1.NoReactInternals.DATE_TOKEN)) {
|
||||
return `__REMOVEQUOTE____WRAP_IN_DATE_START__${decodeURIComponent(item.replace(no_react_1.NoReactInternals.DATE_TOKEN, ''))}__WRAP_IN_DATE_END____REMOVEQUOTE__`;
|
||||
}
|
||||
return value;
|
||||
}))
|
||||
.replace(/"__REMOVEQUOTE__/g, '')
|
||||
.replace(/__REMOVEQUOTE__"/g, '')
|
||||
.replace(/__ADD_AS_CONST__"/g, '" as const')
|
||||
.replace(/__ADD_AS_LITERAL_CONST__"/g, ' as const')
|
||||
.replace(/__WRAP_IN_STATIC_FILE_START__/g, 'staticFile("')
|
||||
.replace(/__WRAP_IN_STATIC_FILE_END__/g, '")')
|
||||
.replace(/__WRAP_IN_DATE_START__/g, 'new Date("')
|
||||
.replace(/__WRAP_IN_DATE_END__/g, '")');
|
||||
};
|
||||
exports.stringifyDefaultProps = stringifyDefaultProps;
|
||||
Reference in New Issue
Block a user