Add .gitignore to exclude all node packages and lock files

This commit is contained in:
Adolfo Reyna
2026-02-23 21:56:04 -05:00
parent faae96c9ed
commit dcc5c6c044
9747 changed files with 1555105 additions and 2 deletions
@@ -0,0 +1,18 @@
# @remotion/licensing
Manage your Remotion.pro license
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/licensing.svg?style=flat&color=black&label=Downloads)](https://npmcharts.com/compare/@remotion/licensing?minimal=true)
## Installation
```bash
npm install @remotion/licensing --save-exact
```
When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.
Remove the `^` character from the version number to use the exact version.
## Usage
See the [documentation](https://www.remotion.dev/docs/licensing) for more information.
@@ -0,0 +1,126 @@
// src/is-network-error.ts
function isNetworkError(error) {
if (error.message.includes("Failed to fetch") || error.message.includes("Load failed") || error.message.includes("NetworkError when attempting to fetch resource")) {
return true;
}
return false;
}
// src/register-usage-event.ts
var HOST = "https://www.remotion.pro";
var DEFAULT_MAX_RETRIES = 3;
var exponentialBackoffMs = (attempt) => {
return 1000 * 2 ** (attempt - 1);
};
var sleep = (ms) => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
};
var internalRegisterUsageEvent = async ({
host,
succeeded,
event,
isStill,
isProduction,
licenseKey
}) => {
let lastError;
const totalAttempts = DEFAULT_MAX_RETRIES + 1;
for (let attempt = 1;attempt <= totalAttempts; attempt++) {
const abortController = new AbortController;
const timeout = setTimeout(() => {
abortController.abort();
}, 1e4);
try {
const res = await fetch(`${HOST}/api/track/register-usage-point`, {
method: "POST",
body: JSON.stringify({
event,
apiKey: licenseKey,
host,
succeeded,
isStill,
isProduction
}),
headers: {
"Content-Type": "application/json"
},
signal: abortController.signal
});
clearTimeout(timeout);
const json = await res.json();
if (json.success) {
return {
billable: json.billable,
classification: json.classification
};
}
if (!res.ok) {
throw new Error(json.error);
}
throw new Error(`Unexpected response from server: ${JSON.stringify(json)}`);
} catch (err) {
clearTimeout(timeout);
const error = err;
const isTimeout = error.name === "AbortError";
const isRetryable = isNetworkError(error) || isTimeout;
if (!isRetryable) {
throw err;
}
lastError = isTimeout ? new Error("Request timed out after 10 seconds") : error;
if (attempt < totalAttempts) {
const backoffMs = exponentialBackoffMs(attempt);
console.log(`Failed to send usage event (attempt ${attempt}/${totalAttempts}), retrying in ${backoffMs}ms...`, err);
await sleep(backoffMs);
}
}
}
throw lastError;
};
var registerUsageEvent = (options) => {
const licenseKey = "licenseKey" in options ? options.licenseKey : null;
const apiKey = "apiKey" in options ? options.apiKey : null;
return internalRegisterUsageEvent({
...options,
isStill: options.isStill ?? false,
isProduction: options.isProduction ?? true,
licenseKey: licenseKey ?? apiKey ?? null
});
};
// src/get-usage.ts
var getUsage = async ({
since,
...apiOrLicenseKey
}) => {
const apiKey = "apiKey" in apiOrLicenseKey ? apiOrLicenseKey.apiKey : null;
const licenseKey = "licenseKey" in apiOrLicenseKey ? apiOrLicenseKey.licenseKey : null;
const res = await fetch(`${HOST}/api/track/get-usage`, {
method: "POST",
body: JSON.stringify({
apiKey: licenseKey ?? apiKey,
since: since ?? null
}),
headers: {
"Content-Type": "application/json"
}
});
const json = await res.json();
if (json.success) {
return {
cloudRenders: json.cloudRenders,
webcodecConversions: json.webcodecConversions
};
}
throw new Error(json.error);
};
// src/index.ts
var LicensingInternals = {
internalRegisterUsageEvent
};
export {
registerUsageEvent,
getUsage,
LicensingInternals
};
@@ -0,0 +1,21 @@
import type { EitherApiKeyOrLicenseKey } from './register-usage-event';
export type EventCount = {
billable: number;
failed: number;
development: number;
};
export type GetUsageApiResponse = {
success: true;
cloudRenders: EventCount;
webcodecConversions: EventCount;
} | {
success: false;
error: string;
};
export type GetUsageResponse = {
cloudRenders: EventCount;
webcodecConversions: EventCount;
};
export declare const getUsage: ({ since, ...apiOrLicenseKey }: {
since?: number | null;
} & EitherApiKeyOrLicenseKey) => Promise<GetUsageResponse>;
@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUsage = void 0;
const register_usage_event_1 = require("./register-usage-event");
const getUsage = async ({ since, ...apiOrLicenseKey }) => {
const apiKey = 'apiKey' in apiOrLicenseKey ? apiOrLicenseKey.apiKey : null;
const licenseKey = 'licenseKey' in apiOrLicenseKey ? apiOrLicenseKey.licenseKey : null;
const res = await fetch(`${register_usage_event_1.HOST}/api/track/get-usage`, {
method: 'POST',
body: JSON.stringify({
apiKey: licenseKey !== null && licenseKey !== void 0 ? licenseKey : apiKey,
since: since !== null && since !== void 0 ? since : null,
}),
headers: {
'Content-Type': 'application/json',
},
});
const json = (await res.json());
if (json.success) {
return {
cloudRenders: json.cloudRenders,
webcodecConversions: json.webcodecConversions,
};
}
throw new Error(json.error);
};
exports.getUsage = getUsage;
@@ -0,0 +1,14 @@
export { UsageEventClassification as Classification, registerUsageEvent, RegisterUsageEventResponse, } from './register-usage-event';
export { EventCount, getUsage, GetUsageResponse } from './get-usage';
export declare const LicensingInternals: {
internalRegisterUsageEvent: ({ host, succeeded, event, isStill, isProduction, licenseKey, }: {
host: string | null;
succeeded: boolean;
event: "webcodec-conversion" | "cloud-render";
} & {
isStill: boolean;
isProduction: boolean;
} & {
licenseKey: string | null;
}) => Promise<import("./register-usage-event").RegisterUsageEventResponse>;
};
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LicensingInternals = exports.getUsage = exports.registerUsageEvent = void 0;
const register_usage_event_1 = require("./register-usage-event");
var register_usage_event_2 = require("./register-usage-event");
Object.defineProperty(exports, "registerUsageEvent", { enumerable: true, get: function () { return register_usage_event_2.registerUsageEvent; } });
var get_usage_1 = require("./get-usage");
Object.defineProperty(exports, "getUsage", { enumerable: true, get: function () { return get_usage_1.getUsage; } });
exports.LicensingInternals = {
internalRegisterUsageEvent: register_usage_event_1.internalRegisterUsageEvent,
};
@@ -0,0 +1 @@
export declare function isNetworkError(error: Error): boolean;
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNetworkError = isNetworkError;
function isNetworkError(error) {
if (
// Chrome
error.message.includes('Failed to fetch') ||
// Safari
error.message.includes('Load failed') ||
// Firefox
error.message.includes('NetworkError when attempting to fetch resource')) {
return true;
}
return false;
}
@@ -0,0 +1,36 @@
export declare const HOST = "https://www.remotion.pro";
import type { NoReactInternals } from 'remotion/no-react';
export declare const exponentialBackoffMs: (attempt: number) => number;
export declare const sleep: (ms: number) => Promise<void>;
export type RegisterUsageEventResponse = {
billable: boolean;
classification: UsageEventClassification;
};
type UsageEventType = 'webcodec-conversion' | 'cloud-render';
export type UsageEventClassification = 'billable' | 'development' | 'failed';
export type EitherApiKeyOrLicenseKey = true extends typeof NoReactInternals.ENABLE_V5_BREAKING_CHANGES ? {
licenseKey: string | null;
} : {
/**
* @deprecated Use `licenseKey` instead
*/
apiKey: string | null;
} | {
licenseKey: string | null;
};
type RegisterUsageEventMandatoryOptions = {
host: string | null;
succeeded: boolean;
event: UsageEventType;
};
type OptionalRegisterUsageEventOptional = {
isStill: boolean;
isProduction: boolean;
};
type InternalRegisterUsageEventOptions = RegisterUsageEventMandatoryOptions & OptionalRegisterUsageEventOptional & {
licenseKey: string | null;
};
type RegisterUsageEventOptions = RegisterUsageEventMandatoryOptions & EitherApiKeyOrLicenseKey & Partial<OptionalRegisterUsageEventOptional>;
export declare const internalRegisterUsageEvent: ({ host, succeeded, event, isStill, isProduction, licenseKey, }: InternalRegisterUsageEventOptions) => Promise<RegisterUsageEventResponse>;
export declare const registerUsageEvent: (options: RegisterUsageEventOptions) => Promise<RegisterUsageEventResponse>;
export {};
@@ -0,0 +1,87 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerUsageEvent = exports.internalRegisterUsageEvent = exports.sleep = exports.exponentialBackoffMs = exports.HOST = void 0;
exports.HOST = 'https://www.remotion.pro';
const is_network_error_1 = require("./is-network-error");
const DEFAULT_MAX_RETRIES = 3;
const exponentialBackoffMs = (attempt) => {
return 1000 * 2 ** (attempt - 1);
};
exports.exponentialBackoffMs = exponentialBackoffMs;
const sleep = (ms) => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
};
exports.sleep = sleep;
const internalRegisterUsageEvent = async ({ host, succeeded, event, isStill, isProduction, licenseKey, }) => {
let lastError;
const totalAttempts = DEFAULT_MAX_RETRIES + 1;
for (let attempt = 1; attempt <= totalAttempts; attempt++) {
const abortController = new AbortController();
const timeout = setTimeout(() => {
abortController.abort();
}, 10000);
try {
const res = await fetch(`${exports.HOST}/api/track/register-usage-point`, {
method: 'POST',
body: JSON.stringify({
event,
apiKey: licenseKey,
host,
succeeded,
isStill,
isProduction,
}),
headers: {
'Content-Type': 'application/json',
},
signal: abortController.signal,
});
clearTimeout(timeout);
const json = (await res.json());
if (json.success) {
return {
billable: json.billable,
classification: json.classification,
};
}
if (!res.ok) {
throw new Error(json.error);
}
throw new Error(`Unexpected response from server: ${JSON.stringify(json)}`);
}
catch (err) {
clearTimeout(timeout);
const error = err;
const isTimeout = error.name === 'AbortError';
const isRetryable = (0, is_network_error_1.isNetworkError)(error) || isTimeout;
if (!isRetryable) {
throw err;
}
lastError = isTimeout
? new Error('Request timed out after 10 seconds')
: error;
if (attempt < totalAttempts) {
const backoffMs = (0, exports.exponentialBackoffMs)(attempt);
// eslint-disable-next-line no-console
console.log(`Failed to send usage event (attempt ${attempt}/${totalAttempts}), retrying in ${backoffMs}ms...`, err);
await (0, exports.sleep)(backoffMs);
}
}
}
throw lastError;
};
exports.internalRegisterUsageEvent = internalRegisterUsageEvent;
const registerUsageEvent = (options) => {
var _a, _b, _c;
const licenseKey = 'licenseKey' in options ? options.licenseKey : null;
const apiKey = 'apiKey' in options ? options.apiKey : null;
return (0, exports.internalRegisterUsageEvent)({
...options,
isStill: (_a = options.isStill) !== null && _a !== void 0 ? _a : false,
isProduction: (_b = options.isProduction) !== null && _b !== void 0 ? _b : true,
licenseKey: (_c = licenseKey !== null && licenseKey !== void 0 ? licenseKey : apiKey) !== null && _c !== void 0 ? _c : null,
});
};
exports.registerUsageEvent = registerUsageEvent;
@@ -0,0 +1,42 @@
{
"repository": {
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/licensing"
},
"name": "@remotion/licensing",
"version": "4.0.423",
"description": "Manage your Remotion.pro license",
"main": "dist",
"sideEffects": false,
"scripts": {
"lint": "eslint src",
"formatting": "prettier --experimental-cli src --check",
"make": "tsc -d && bun --env-file=../.env.bundle bundle.ts",
"test": "bun test src/test/prod-domain.test.ts src/test/register-usage-event-retry.test.ts"
},
"author": "Jonny Burger <jonny@remotion.dev>",
"contributors": [],
"license": "MIT",
"bugs": {
"url": "https://github.com/remotion-dev/remotion/issues"
},
"publishConfig": {
"access": "public"
},
"dependencies": {},
"devDependencies": {
"@remotion/eslint-config-internal": "4.0.423",
"eslint": "9.19.0",
"msw": "^2.7.1",
"remotion": "4.0.423"
},
"homepage": "https://www.remotion.dev/docs/licensing",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"module": "./dist/esm/index.mjs",
"import": "./dist/esm/index.mjs"
}
}
}