@remotion/lambda 4.0.143 → 4.0.145

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/LICENSE.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Remotion License
2
2
 
3
+ In Remotion 5.0, the license will slightly change. [View the changes here](https://github.com/remotion-dev/remotion/pull/3750).
4
+
5
+ ---
6
+
3
7
  Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
4
8
 
5
9
  - [Free license](#free-license)
@@ -59,11 +59,11 @@ export declare const internalDeploySite: (args_0: MandatoryParameters & {
59
59
  getValue: ({ commandLine }: {
60
60
  commandLine: Record<string, unknown>;
61
61
  }) => {
62
- value: "error" | "info" | "verbose" | "warn";
62
+ value: "error" | "verbose" | "info" | "warn";
63
63
  source: string;
64
64
  };
65
- setConfig: (newLogLevel: "error" | "info" | "verbose" | "warn") => void;
66
- type: "error" | "info" | "verbose" | "warn";
65
+ setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
66
+ type: "error" | "verbose" | "info" | "warn";
67
67
  };
68
68
  readonly throwIfSiteExists: {
69
69
  cliFlag: string;
@@ -1,11 +1,13 @@
1
1
  /**
2
- * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for excuting CLI commands or calling Node.JS functions.
3
- * @link https://remotion.dev/docs/lambda/getuserpolicy
2
+ * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
3
+ * @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
4
+ * @returns {string} A JSON string representation of the user policy.
4
5
  */
5
6
  export declare const getUserPolicy: () => string;
6
7
  export declare const ROLE_NAME = "remotion-lambda-role";
7
8
  /**
8
9
  * @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
9
- * @link https://remotion.dev/docs/lambda/getrolepolicy
10
+ * @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
11
+ * @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
10
12
  */
11
13
  export declare const getRolePolicy: () => string;
@@ -30,15 +30,17 @@ const suggestedRolePolicy = {
30
30
  ],
31
31
  };
32
32
  /**
33
- * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for excuting CLI commands or calling Node.JS functions.
34
- * @link https://remotion.dev/docs/lambda/getuserpolicy
33
+ * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
34
+ * @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
35
+ * @returns {string} A JSON string representation of the user policy.
35
36
  */
36
37
  const getUserPolicy = () => JSON.stringify(suggestedPolicy, null, 2);
37
38
  exports.getUserPolicy = getUserPolicy;
38
39
  exports.ROLE_NAME = 'remotion-lambda-role';
39
40
  /**
40
41
  * @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
41
- * @link https://remotion.dev/docs/lambda/getrolepolicy
42
+ * @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
43
+ * @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
42
44
  */
43
45
  const getRolePolicy = () => JSON.stringify(suggestedRolePolicy, null, 2);
44
46
  exports.getRolePolicy = getRolePolicy;
@@ -12,6 +12,8 @@ const lambda_version_string_1 = require("../shared/lambda-version-string");
12
12
  * @returns {string} The speculated lambda function name
13
13
  */
14
14
  const speculateFunctionName = ({ memorySizeInMb, diskSizeInMb, timeoutInSeconds, }) => {
15
+ // find-function-name.ts uses this for templating
16
+ // consider this before adding any validation here
15
17
  return [
16
18
  `${defaults_1.RENDER_FN_PREFIX}${lambda_version_string_1.LAMBDA_VERSION_STRING}`,
17
19
  `mem${memorySizeInMb}mb`,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.findFunctionName = void 0;
4
4
  const version_1 = require("remotion/version");
5
5
  const get_functions_1 = require("../../api/get-functions");
6
+ const client_1 = require("../../client");
6
7
  const constants_1 = require("../../shared/constants");
7
8
  const args_1 = require("../args");
8
9
  const functions_1 = require("../commands/functions");
@@ -17,11 +18,27 @@ const findFunctionName = async (logLevel) => {
17
18
  region: (0, get_aws_region_1.getAwsRegion)(),
18
19
  compatibleOnly: false,
19
20
  });
20
- let lambdasWithMatchingVersion = remotionLambdas.filter((l) => l.version === version_1.VERSION);
21
+ const lambdasWithMatchingVersion = remotionLambdas.filter((l) => l.version === version_1.VERSION);
21
22
  const logOptions = {
22
23
  indent: false,
23
24
  logLevel,
24
25
  };
26
+ const cliFlag = args_1.parsedLambdaCli['function-name'];
27
+ if (cliFlag) {
28
+ const compatibleFunctionExists = lambdasWithMatchingVersion.find((l) => l.functionName === cliFlag);
29
+ if (!compatibleFunctionExists) {
30
+ log_1.Log.warn({ indent: false, logLevel }, `Function "${cliFlag}" does not match naming convention ${(0, client_1.speculateFunctionName)({ diskSizeInMb: '[disk]', memorySizeInMb: '[memory]', timeoutInSeconds: '[timeout]' })}.`);
31
+ log_1.Log.warn({ indent: false, logLevel }, 'Remotion relies on the naming to determine function information. This is an unsupported workflow.');
32
+ if (lambdasWithMatchingVersion.length > 0) {
33
+ log_1.Log.info(logOptions, 'The following functions were found:');
34
+ for (const l of lambdasWithMatchingVersion) {
35
+ log_1.Log.info(logOptions, `- ${l.functionName} (v${l.version})`);
36
+ }
37
+ log_1.Log.info(logOptions, 'Prefer using one of those functions by passing their name to `--function-name` or removing it entirely.');
38
+ }
39
+ return cliFlag;
40
+ }
41
+ }
25
42
  if (lambdasWithMatchingVersion.length === 0) {
26
43
  log_1.Log.error({ indent: false, logLevel }, `No Lambda functions with version ${version_1.VERSION} found in your account.`);
27
44
  if (remotionLambdas.length > 0) {
@@ -33,39 +50,18 @@ const findFunctionName = async (logLevel) => {
33
50
  (0, quit_1.quit)(1);
34
51
  }
35
52
  if (lambdasWithMatchingVersion.length > 1) {
36
- if (args_1.parsedLambdaCli['function-name']) {
37
- const prevFunctions = [...lambdasWithMatchingVersion];
38
- lambdasWithMatchingVersion = lambdasWithMatchingVersion.filter((l) => l.functionName === args_1.parsedLambdaCli['function-name']);
39
- if (lambdasWithMatchingVersion.length === 0) {
40
- log_1.Log.error({ indent: false, logLevel }, `No Lambda function with name "${args_1.parsedLambdaCli['function-name']}" and version ${version_1.VERSION} found in your account.`);
41
- log_1.Log.info(logOptions);
42
- if (prevFunctions.length === 0) {
43
- log_1.Log.info(logOptions, `No functions for version ${version_1.VERSION} were found, deploy one using:`);
44
- log_1.Log.info(logOptions, ` npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${deploy_1.FUNCTIONS_DEPLOY_SUBCOMMAND}`);
45
- (0, quit_1.quit)(1);
46
- }
47
- log_1.Log.info(logOptions, 'The following functions were found:');
48
- for (const l of prevFunctions) {
49
- log_1.Log.info(logOptions, `- ${l.functionName} (v${l.version})`);
50
- }
51
- log_1.Log.info(logOptions, 'Remove the `--function-name` parameter use one of them.');
52
- (0, quit_1.quit)(1);
53
- }
54
- }
55
- else {
56
- log_1.Log.error({ indent: false, logLevel }, 'More than 1 lambda function found in your account. Unsure which one to use.');
57
- log_1.Log.info(logOptions);
58
- log_1.Log.info(logOptions, 'Possible solutions:');
59
- log_1.Log.info(logOptions, '- Define using `--function-name` which function you want to use.');
60
- log_1.Log.info(logOptions, `- Delete extraneous lambda functions in your AWS console or using:`);
61
- log_1.Log.info(logOptions, ` npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${rm_1.FUNCTIONS_RM_SUBCOMMAND} $(npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${ls_1.FUNCTIONS_LS_SUBCOMMAND} -q) -y`);
62
- log_1.Log.info(logOptions);
63
- log_1.Log.info(logOptions, `The following functions were found (only showing v${version_1.VERSION}):`);
64
- for (const l of lambdasWithMatchingVersion) {
65
- log_1.Log.info(logOptions, `- ${l.functionName}`);
66
- }
67
- (0, quit_1.quit)(1);
53
+ log_1.Log.error({ indent: false, logLevel }, 'More than 1 lambda function found in your account. Unsure which one to use.');
54
+ log_1.Log.info(logOptions);
55
+ log_1.Log.info(logOptions, 'Possible solutions:');
56
+ log_1.Log.info(logOptions, '- Define using `--function-name` which function you want to use.');
57
+ log_1.Log.info(logOptions, `- Delete extraneous lambda functions in your AWS console or using:`);
58
+ log_1.Log.info(logOptions, ` npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${rm_1.FUNCTIONS_RM_SUBCOMMAND} $(npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${ls_1.FUNCTIONS_LS_SUBCOMMAND} -q) -y`);
59
+ log_1.Log.info(logOptions);
60
+ log_1.Log.info(logOptions, `The following functions were found (only showing v${version_1.VERSION}):`);
61
+ for (const l of lambdasWithMatchingVersion) {
62
+ log_1.Log.info(logOptions, `- ${l.functionName}`);
68
63
  }
64
+ (0, quit_1.quit)(1);
69
65
  }
70
66
  const { functionName } = lambdasWithMatchingVersion[0];
71
67
  return functionName;
@@ -3,8 +3,5 @@ export declare const planFrameRanges: ({ framesPerLambda, frameRange, everyNthFr
3
3
  frameRange: [number, number];
4
4
  everyNthFrame: number;
5
5
  }) => {
6
- chunks: [
7
- number,
8
- number
9
- ][];
6
+ chunks: [number, number][];
10
7
  };
@@ -1 +1 @@
1
- export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "sa-east-1" | "eu-south-1" | "af-south-1" | "ap-east-1" | "me-south-1";
1
+ export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-south-1" | "ap-east-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "me-south-1" | "sa-east-1";
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
4
4
  type: z.ZodLiteral<"render-id-determined">;
5
5
  renderId: z.ZodString;
6
6
  }, "strip", z.ZodTypeAny, {
7
- renderId: string;
8
7
  type: "render-id-determined";
9
- }, {
10
8
  renderId: string;
9
+ }, {
11
10
  type: "render-id-determined";
11
+ renderId: string;
12
12
  }>]>;
13
13
  export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
14
14
  export declare const isStreamingPayload: (str: string) => false | {
15
- renderId: string;
16
15
  type: "render-id-determined";
16
+ renderId: string;
17
17
  };
18
18
  export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
19
19
  export {};
@@ -10,6 +10,7 @@ type RenderStillLambdaResponsePayload = {
10
10
  outKey: string;
11
11
  size: number;
12
12
  bucketName: string;
13
+ sizeInBytes: number;
13
14
  estimatedPrice: CostsInfo;
14
15
  renderId: string;
15
16
  };
@@ -209,6 +209,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
209
209
  type: 'success',
210
210
  output: url,
211
211
  size,
212
+ sizeInBytes: size,
212
213
  bucketName,
213
214
  estimatedPrice: (0, format_costs_info_1.formatCostsInfo)(estimatedPrice),
214
215
  renderId,
@@ -1,5 +1,5 @@
1
1
  export declare const LambdaInternals: {
2
- executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "info" | "verbose" | "warn") => Promise<void>;
2
+ executeCommand: (args: string[], remotionRoot: string, logLevel: "error" | "verbose" | "info" | "warn") => Promise<void>;
3
3
  makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, }: import("./api/make-lambda-payload").InnerRenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
4
4
  getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, logLevel, }: import(".").GetRenderProgressInput) => import("./defaults").LambdaStatusPayload;
5
5
  makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, }: import("./api/render-still-on-lambda").RenderStillOnLambdaNonNullInput) => Promise<{
@@ -14,7 +14,7 @@ export declare const LambdaInternals: {
14
14
  maxRetries: number;
15
15
  frame: number;
16
16
  privacy: import("./defaults").Privacy;
17
- logLevel: "error" | "info" | "verbose" | "warn";
17
+ logLevel: "error" | "verbose" | "info" | "warn";
18
18
  outName: import("./defaults").OutNameInput | null;
19
19
  timeoutInMilliseconds: number;
20
20
  chromiumOptions: import("@remotion/renderer").ChromiumOptions;
@@ -30,7 +30,7 @@ export declare const LambdaInternals: {
30
30
  internalDeploySite: (args_0: {
31
31
  entryPoint: string;
32
32
  bucketName: string;
33
- region: "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "sa-east-1" | "eu-south-1" | "af-south-1" | "ap-east-1" | "me-south-1";
33
+ region: "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-south-1" | "ap-east-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "me-south-1" | "sa-east-1";
34
34
  } & {
35
35
  siteName: string;
36
36
  options: {
@@ -56,11 +56,11 @@ export declare const LambdaInternals: {
56
56
  getValue: ({ commandLine }: {
57
57
  commandLine: Record<string, unknown>;
58
58
  }) => {
59
- value: "error" | "info" | "verbose" | "warn";
59
+ value: "error" | "verbose" | "info" | "warn";
60
60
  source: string;
61
61
  };
62
- setConfig: (newLogLevel: "error" | "info" | "verbose" | "warn") => void;
63
- type: "error" | "info" | "verbose" | "warn";
62
+ setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
63
+ type: "error" | "verbose" | "info" | "warn";
64
64
  };
65
65
  readonly throwIfSiteExists: {
66
66
  cliFlag: string;
@@ -4,4 +4,7 @@ export type DownloadBehavior = {
4
4
  type: 'download';
5
5
  fileName: string | null;
6
6
  };
7
+ export type HexInfo = {
8
+ containsHex: boolean;
9
+ };
7
10
  export declare const getContentDispositionHeader: (behavior: DownloadBehavior | null) => string | undefined;
@@ -4,6 +4,33 @@
4
4
  // visit the link
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getContentDispositionHeader = void 0;
7
+ const problematicCharacters = {
8
+ '%3A': ':',
9
+ '%2F': '/',
10
+ '%3F': '?',
11
+ '%23': '#',
12
+ '%5B': '[',
13
+ '%5D': ']',
14
+ '%40': '@',
15
+ '%21': '!',
16
+ '%24': '$',
17
+ '%26': '&',
18
+ '%27': "'",
19
+ '%28': '(',
20
+ '%29': ')',
21
+ '%2A': '*',
22
+ '%2B': '+',
23
+ '%2C': ',',
24
+ '%3B': ';',
25
+ };
26
+ const includesHexOfUnsafeChar = (path) => {
27
+ for (const key of Object.keys(problematicCharacters)) {
28
+ if (path.includes(key)) {
29
+ return { containsHex: true };
30
+ }
31
+ }
32
+ return { containsHex: false };
33
+ };
7
34
  const getContentDispositionHeader = (behavior) => {
8
35
  if (behavior === null) {
9
36
  return undefined;
@@ -14,6 +41,10 @@ const getContentDispositionHeader = (behavior) => {
14
41
  if (behavior.fileName === null) {
15
42
  return `attachment`;
16
43
  }
17
- return `attachment; filename="${behavior.fileName}"`;
44
+ const { containsHex } = includesHexOfUnsafeChar(behavior.fileName);
45
+ if (containsHex) {
46
+ return `attachment; filename="${behavior.fileName}"`;
47
+ }
48
+ return `attachment; filename="${encodeURIComponent(behavior.fileName)}"`;
18
49
  };
19
50
  exports.getContentDispositionHeader = getContentDispositionHeader;
@@ -55,6 +55,10 @@ const isFlakyError = (err) => {
55
55
  message.includes('socket hang up')) {
56
56
  return true;
57
57
  }
58
+ if ((message === null || message === void 0 ? void 0 : message.includes('Target closed')) ||
59
+ (message === null || message === void 0 ? void 0 : message.includes('Session closed'))) {
60
+ return true;
61
+ }
58
62
  return false;
59
63
  };
60
64
  exports.isFlakyError = isFlakyError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.143",
3
+ "version": "4.0.145",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -26,10 +26,10 @@
26
26
  "aws-policies": "^1.0.1",
27
27
  "mime-types": "2.1.34",
28
28
  "zod": "3.22.3",
29
- "@remotion/bundler": "4.0.143",
30
- "@remotion/cli": "4.0.143",
31
- "@remotion/renderer": "4.0.143",
32
- "remotion": "4.0.143"
29
+ "@remotion/bundler": "4.0.145",
30
+ "@remotion/cli": "4.0.145",
31
+ "remotion": "4.0.145",
32
+ "@remotion/renderer": "4.0.145"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jonny/eslint-config": "3.0.281",
@@ -45,11 +45,11 @@
45
45
  "ts-node": "10.9.2",
46
46
  "vitest": "0.31.1",
47
47
  "zip-lib": "^0.7.2",
48
- "@remotion/bundler": "4.0.143",
49
- "@remotion/compositor-linux-arm64-gnu": "4.0.143"
48
+ "@remotion/compositor-linux-arm64-gnu": "4.0.145",
49
+ "@remotion/bundler": "4.0.145"
50
50
  },
51
51
  "peerDependencies": {
52
- "@remotion/bundler": "4.0.143"
52
+ "@remotion/bundler": "4.0.145"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
@@ -86,7 +86,6 @@
86
86
  "test": "vitest src/test/unit --run",
87
87
  "watch": "tsc -w",
88
88
  "build": "tsc -d && pnpm run buildlambda",
89
- "buildlambda": "ts-node src/admin/bundle-lambda.ts",
90
- "start": "ts-node src/run.ts"
89
+ "buildlambda": "ts-node src/admin/bundle-lambda.ts"
91
90
  }
92
91
  }
Binary file
@@ -1,14 +0,0 @@
1
- type SerializedJSONWithCustomFields = {
2
- serializedString: string;
3
- customDateUsed: boolean;
4
- customFileUsed: boolean;
5
- mapUsed: boolean;
6
- setUsed: boolean;
7
- };
8
- export declare const FILE_TOKEN = "remotion-file:";
9
- export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
10
- data: Record<string, unknown>;
11
- indent: number | undefined;
12
- staticBase: string | null;
13
- }) => SerializedJSONWithCustomFields;
14
- export {};
@@ -1,36 +0,0 @@
1
- "use strict";
2
- // Must keep this file in sync with the one in packages/core/src/input-props-serialization.ts!
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
5
- const DATE_TOKEN = 'remotion-date:';
6
- exports.FILE_TOKEN = 'remotion-file:';
7
- const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
8
- let customDateUsed = false;
9
- let customFileUsed = false;
10
- let mapUsed = false;
11
- let setUsed = false;
12
- const serializedString = JSON.stringify(data, function (key, value) {
13
- const item = this[key];
14
- if (item instanceof Date) {
15
- customDateUsed = true;
16
- return `${DATE_TOKEN}${item.toISOString()}`;
17
- }
18
- if (item instanceof Map) {
19
- mapUsed = true;
20
- return value;
21
- }
22
- if (item instanceof Set) {
23
- setUsed = true;
24
- return value;
25
- }
26
- if (typeof item === 'string' &&
27
- staticBase !== null &&
28
- item.startsWith(staticBase)) {
29
- customFileUsed = true;
30
- return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
31
- }
32
- return value;
33
- }, indent);
34
- return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
35
- };
36
- exports.serializeJSONWithDate = serializeJSONWithDate;