build: ship pre-built API bundle; images copy output instead of installing
- API: `pnpm build` bundles dist/ into apps/api/.output (esbuild), with Linux musl native packages for sharp and argon2 kept alongside - docker/api.Dockerfile copies that output; no pnpm install on the server - add dist/migrate.js (prisma migrate deploy equivalent, same _prisma_migrations table and lock) so the Prisma CLI is not needed at runtime - pnpm-workspace: supportedArchitectures for linux/x64/musl - admin: apps/admin/.env.production sets VITE_SITE_URL for the production build - drop NPM_REGISTRY / SITE_URL build args from compose and .env.example - gitignore: anchor node_modules rules so pre-built node_modules are committed - README: describe the pre-built deploy flow Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
ee8258556d
commit
10e453e4be
+22
@@ -0,0 +1,22 @@
|
||||
function addUniqueItem(arr, item) {
|
||||
if (arr.indexOf(item) === -1)
|
||||
arr.push(item);
|
||||
}
|
||||
function removeItem(arr, item) {
|
||||
const index = arr.indexOf(item);
|
||||
if (index > -1)
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// Adapted from array-move
|
||||
function moveItem([...arr], fromIndex, toIndex) {
|
||||
const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
|
||||
if (startIndex >= 0 && startIndex < arr.length) {
|
||||
const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
|
||||
const [item] = arr.splice(fromIndex, 1);
|
||||
arr.splice(endIndex, 0, item);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
export { addUniqueItem, moveItem, removeItem };
|
||||
//# sourceMappingURL=array.mjs.map
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
const clamp = (min, max, v) => {
|
||||
if (v > max)
|
||||
return max;
|
||||
if (v < min)
|
||||
return min;
|
||||
return v;
|
||||
};
|
||||
|
||||
export { clamp };
|
||||
//# sourceMappingURL=clamp.mjs.map
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { backIn } from './back.mjs';
|
||||
|
||||
const anticipate = (p) => p >= 1
|
||||
? 1
|
||||
: (p *= 2) < 1
|
||||
? 0.5 * backIn(p)
|
||||
: 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
|
||||
|
||||
export { anticipate };
|
||||
//# sourceMappingURL=anticipate.mjs.map
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { cubicBezier } from './cubic-bezier.mjs';
|
||||
import { mirrorEasing } from './modifiers/mirror.mjs';
|
||||
import { reverseEasing } from './modifiers/reverse.mjs';
|
||||
|
||||
const backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
||||
const backIn = /*@__PURE__*/ reverseEasing(backOut);
|
||||
const backInOut = /*@__PURE__*/ mirrorEasing(backIn);
|
||||
|
||||
export { backIn, backInOut, backOut };
|
||||
//# sourceMappingURL=back.mjs.map
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { mirrorEasing } from './modifiers/mirror.mjs';
|
||||
import { reverseEasing } from './modifiers/reverse.mjs';
|
||||
|
||||
const circIn = (p) => 1 - Math.sin(Math.acos(p));
|
||||
const circOut = reverseEasing(circIn);
|
||||
const circInOut = mirrorEasing(circIn);
|
||||
|
||||
export { circIn, circInOut, circOut };
|
||||
//# sourceMappingURL=circ.mjs.map
|
||||
Generated
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
import { noop } from '../noop.mjs';
|
||||
|
||||
/*
|
||||
Bezier function generator
|
||||
This has been modified from Gaëtan Renaudeau's BezierEasing
|
||||
https://github.com/gre/bezier-easing/blob/master/src/index.js
|
||||
https://github.com/gre/bezier-easing/blob/master/LICENSE
|
||||
|
||||
t is found for a given x with Newton-Raphson, safeguarded by a bisection
|
||||
bracket: whenever a Newton step would leave the bracket (near flat parts
|
||||
of the curve), it bisects instead. This converges to full precision in
|
||||
~5 iterations on typical curves, so output is smooth rather than snapped
|
||||
to a fixed bisection grid. The slope is estimated with a forward
|
||||
difference, and the lookup table is omitted, to save bytes.
|
||||
|
||||
x = 0 and x = 1 return exactly 0 and 1. x outside [0, 1] starts outside
|
||||
the bracket, so it bisects towards the nearer end and saturates to within
|
||||
~1e-12 of 0 or 1.
|
||||
Usage
|
||||
const easeOut = cubicBezier(.17,.67,.83,.67);
|
||||
const x = easeOut(0.5); // returns 0.627...
|
||||
*/
|
||||
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
||||
// Bernstein form, so it is exactly 0 at t = 0 and exactly 1 at t = 1.
|
||||
const calcBezier = (t, a1, a2) => t * (3 * (1 - t) * ((1 - t) * a1 + t * a2) + t * t);
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
function cubicBezier(mX1, mY1, mX2, mY2) {
|
||||
// If this is a linear gradient, return linear easing
|
||||
if (mX1 === mY1 && mX2 === mY2)
|
||||
return noop;
|
||||
return (x) => {
|
||||
let lowerBound = 0;
|
||||
let upperBound = 1;
|
||||
let t = x;
|
||||
for (let i = 0;; i++) {
|
||||
// If t is outside the bracket, because x is out of range or a
|
||||
// Newton step overshot where the slope is ~0, bisect instead.
|
||||
if (!(t >= lowerBound && t <= upperBound)) {
|
||||
t = (lowerBound + upperBound) / 2;
|
||||
}
|
||||
const currentX = calcBezier(t, mX1, mX2) - x;
|
||||
if (currentX * currentX < 1e-28 || i === 40)
|
||||
break;
|
||||
currentX > 0 ? (upperBound = t) : (lowerBound = t);
|
||||
// Newton-Raphson step, with dx/dt from a forward difference
|
||||
t -=
|
||||
(currentX * 1e-7) /
|
||||
(calcBezier(t + 1e-7, mX1, mX2) - x - currentX);
|
||||
}
|
||||
return calcBezier(t, mY1, mY2);
|
||||
};
|
||||
}
|
||||
|
||||
export { cubicBezier };
|
||||
//# sourceMappingURL=cubic-bezier.mjs.map
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { cubicBezier } from './cubic-bezier.mjs';
|
||||
|
||||
const easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1);
|
||||
const easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1);
|
||||
const easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1);
|
||||
|
||||
export { easeIn, easeInOut, easeOut };
|
||||
//# sourceMappingURL=ease.mjs.map
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Accepts an easing function and returns a new one that outputs mirrored values for
|
||||
// the second half of the animation. Turns easeIn into easeInOut.
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
|
||||
|
||||
export { mirrorEasing };
|
||||
//# sourceMappingURL=mirror.mjs.map
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Accepts an easing function and returns a new one that outputs reversed values.
|
||||
// Turns easeIn into easeOut.
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);
|
||||
|
||||
export { reverseEasing };
|
||||
//# sourceMappingURL=reverse.mjs.map
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import { clamp } from '../clamp.mjs';
|
||||
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
function steps(numSteps, direction = "end") {
|
||||
return (progress) => {
|
||||
progress =
|
||||
direction === "end"
|
||||
? Math.min(progress, 0.999)
|
||||
: Math.max(progress, 0.001);
|
||||
const expanded = progress * numSteps;
|
||||
const rounded = direction === "end" ? Math.floor(expanded) : Math.ceil(expanded);
|
||||
return clamp(0, 1, rounded / numSteps);
|
||||
};
|
||||
}
|
||||
|
||||
export { steps };
|
||||
//# sourceMappingURL=steps.mjs.map
|
||||
Generated
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import { wrap } from '../../wrap.mjs';
|
||||
import { isEasingArray } from './is-easing-array.mjs';
|
||||
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
function getEasingForSegment(easing, i) {
|
||||
return isEasingArray(easing) ? easing[wrap(0, easing.length, i)] : easing;
|
||||
}
|
||||
|
||||
export { getEasingForSegment };
|
||||
//# sourceMappingURL=get-easing-for-segment.mjs.map
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
||||
|
||||
export { isBezierDefinition };
|
||||
//# sourceMappingURL=is-bezier-definition.mjs.map
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const isEasingArray = (ease) => {
|
||||
return Array.isArray(ease) && typeof ease[0] !== "number";
|
||||
};
|
||||
|
||||
export { isEasingArray };
|
||||
//# sourceMappingURL=is-easing-array.mjs.map
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import { invariant } from '../../errors.mjs';
|
||||
import { noop } from '../../noop.mjs';
|
||||
import { anticipate } from '../anticipate.mjs';
|
||||
import { backOut, backInOut, backIn } from '../back.mjs';
|
||||
import { circOut, circInOut, circIn } from '../circ.mjs';
|
||||
import { cubicBezier } from '../cubic-bezier.mjs';
|
||||
import { easeOut, easeInOut, easeIn } from '../ease.mjs';
|
||||
import { isBezierDefinition } from './is-bezier-definition.mjs';
|
||||
|
||||
const easingLookup = {
|
||||
linear: noop,
|
||||
easeIn,
|
||||
easeInOut,
|
||||
easeOut,
|
||||
circIn,
|
||||
circInOut,
|
||||
circOut,
|
||||
backIn,
|
||||
backInOut,
|
||||
backOut,
|
||||
anticipate,
|
||||
};
|
||||
const isValidEasing = (easing) => {
|
||||
return typeof easing === "string";
|
||||
};
|
||||
const easingDefinitionToFunction = (definition) => {
|
||||
if (isBezierDefinition(definition)) {
|
||||
// If cubic bezier definition, create bezier curve
|
||||
invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`, "cubic-bezier-length");
|
||||
const [x1, y1, x2, y2] = definition;
|
||||
return cubicBezier(x1, y1, x2, y2);
|
||||
}
|
||||
else if (isValidEasing(definition)) {
|
||||
// Else lookup from table
|
||||
invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`, "invalid-easing-type");
|
||||
return easingLookup[definition];
|
||||
}
|
||||
return definition;
|
||||
};
|
||||
|
||||
export { easingDefinitionToFunction };
|
||||
//# sourceMappingURL=map.mjs.map
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import { formatErrorMessage } from './format-error-message.mjs';
|
||||
|
||||
let warning = () => { };
|
||||
let invariant = () => { };
|
||||
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
||||
warning = (check, message, errorCode) => {
|
||||
if (!check && typeof console !== "undefined") {
|
||||
console.warn(formatErrorMessage(message, errorCode));
|
||||
}
|
||||
};
|
||||
invariant = (check, message, errorCode) => {
|
||||
if (!check) {
|
||||
throw new Error(formatErrorMessage(message, errorCode));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { invariant, warning };
|
||||
//# sourceMappingURL=errors.mjs.map
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
function formatErrorMessage(message, errorCode) {
|
||||
return errorCode
|
||||
? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`
|
||||
: message;
|
||||
}
|
||||
|
||||
export { formatErrorMessage };
|
||||
//# sourceMappingURL=format-error-message.mjs.map
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
const MotionGlobalConfig = {};
|
||||
|
||||
export { MotionGlobalConfig };
|
||||
//# sourceMappingURL=global-config.mjs.map
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
export { addUniqueItem, moveItem, removeItem } from './array.mjs';
|
||||
export { clamp } from './clamp.mjs';
|
||||
export { invariant, warning } from './errors.mjs';
|
||||
export { MotionGlobalConfig } from './global-config.mjs';
|
||||
export { isNumericalString } from './is-numerical-string.mjs';
|
||||
export { isObject } from './is-object.mjs';
|
||||
export { isZeroValueString } from './is-zero-value-string.mjs';
|
||||
export { memo } from './memo.mjs';
|
||||
export { noop } from './noop.mjs';
|
||||
export { pipe } from './pipe.mjs';
|
||||
export { progress } from './progress.mjs';
|
||||
export { SubscriptionManager } from './subscription-manager.mjs';
|
||||
export { millisecondsToSeconds, secondsToMilliseconds } from './time-conversion.mjs';
|
||||
export { velocityPerSecond } from './velocity-per-second.mjs';
|
||||
export { hasWarned, warnOnce } from './warn-once.mjs';
|
||||
export { wrap } from './wrap.mjs';
|
||||
export { anticipate } from './easing/anticipate.mjs';
|
||||
export { backIn, backInOut, backOut } from './easing/back.mjs';
|
||||
export { circIn, circInOut, circOut } from './easing/circ.mjs';
|
||||
export { cubicBezier } from './easing/cubic-bezier.mjs';
|
||||
export { easeIn, easeInOut, easeOut } from './easing/ease.mjs';
|
||||
export { mirrorEasing } from './easing/modifiers/mirror.mjs';
|
||||
export { reverseEasing } from './easing/modifiers/reverse.mjs';
|
||||
export { steps } from './easing/steps.mjs';
|
||||
export { getEasingForSegment } from './easing/utils/get-easing-for-segment.mjs';
|
||||
export { isBezierDefinition } from './easing/utils/is-bezier-definition.mjs';
|
||||
export { isEasingArray } from './easing/utils/is-easing-array.mjs';
|
||||
export { easingDefinitionToFunction } from './easing/utils/map.mjs';
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
|
||||
*/
|
||||
const isNumericalString = (v) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v);
|
||||
|
||||
export { isNumericalString };
|
||||
//# sourceMappingURL=is-numerical-string.mjs.map
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
const isObject = (value) => typeof value === "object" && value !== null;
|
||||
|
||||
export { isObject };
|
||||
//# sourceMappingURL=is-object.mjs.map
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Check if the value is a zero value string like "0px" or "0%"
|
||||
*/
|
||||
const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v);
|
||||
|
||||
export { isZeroValueString };
|
||||
//# sourceMappingURL=is-zero-value-string.mjs.map
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
function memo(callback) {
|
||||
let result;
|
||||
return () => {
|
||||
if (result === undefined)
|
||||
result = callback();
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
export { memo };
|
||||
//# sourceMappingURL=memo.mjs.map
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const noop = (any) => any;
|
||||
|
||||
export { noop };
|
||||
//# sourceMappingURL=noop.mjs.map
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Pipe
|
||||
* Compose other transformers to run linearily
|
||||
* pipe(min(20), max(40))
|
||||
* @param {...functions} transformers
|
||||
* @return {function}
|
||||
*/
|
||||
const pipe = (...transformers) => transformers.reduce((a, b) => (v) => b(a(v)));
|
||||
|
||||
export { pipe };
|
||||
//# sourceMappingURL=pipe.mjs.map
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
Progress within given range
|
||||
|
||||
Given a lower limit and an upper limit, we return the progress
|
||||
(expressed as a number 0-1) represented by the given value, and
|
||||
limit that progress to within 0-1.
|
||||
*/
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const progress = (from, to, value) => {
|
||||
const range = to - from;
|
||||
return range ? (value - from) / range : 1;
|
||||
};
|
||||
|
||||
export { progress };
|
||||
//# sourceMappingURL=progress.mjs.map
|
||||
Generated
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
import { addUniqueItem, removeItem } from './array.mjs';
|
||||
|
||||
class SubscriptionManager {
|
||||
constructor() {
|
||||
this.subscriptions = [];
|
||||
}
|
||||
add(handler) {
|
||||
addUniqueItem(this.subscriptions, handler);
|
||||
return () => this.remove(handler);
|
||||
}
|
||||
remove(handler) {
|
||||
removeItem(this.subscriptions, handler);
|
||||
}
|
||||
notify(a, b, c) {
|
||||
const numSubscriptions = this.subscriptions.length;
|
||||
if (!numSubscriptions)
|
||||
return;
|
||||
if (numSubscriptions === 1) {
|
||||
/**
|
||||
* If there's only a single handler we can just call it without invoking a loop.
|
||||
*/
|
||||
this.subscriptions[0](a, b, c);
|
||||
}
|
||||
else {
|
||||
for (let i = 0; i < numSubscriptions; i++) {
|
||||
/**
|
||||
* Check whether the handler exists before firing as it's possible
|
||||
* the subscriptions were modified during this loop running.
|
||||
*/
|
||||
const handler = this.subscriptions[i];
|
||||
handler && handler(a, b, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
getSize() {
|
||||
return this.subscriptions.length;
|
||||
}
|
||||
clear() {
|
||||
this.subscriptions.length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
export { SubscriptionManager };
|
||||
//# sourceMappingURL=subscription-manager.mjs.map
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Converts seconds to milliseconds
|
||||
*
|
||||
* @param seconds - Time in seconds.
|
||||
* @return milliseconds - Converted time in milliseconds.
|
||||
*/
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const secondsToMilliseconds = (seconds) => seconds * 1000;
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
|
||||
|
||||
export { millisecondsToSeconds, secondsToMilliseconds };
|
||||
//# sourceMappingURL=time-conversion.mjs.map
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Convert velocity into velocity per second
|
||||
*/
|
||||
/*#__NO_SIDE_EFFECTS__*/
|
||||
const velocityPerSecond = (velocity, frameDuration) => frameDuration ? velocity * (1000 / frameDuration) : 0;
|
||||
|
||||
export { velocityPerSecond };
|
||||
//# sourceMappingURL=velocity-per-second.mjs.map
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { formatErrorMessage } from './format-error-message.mjs';
|
||||
|
||||
const warned = new Set();
|
||||
function hasWarned(message) {
|
||||
return warned.has(message);
|
||||
}
|
||||
function warnOnce(condition, message, errorCode) {
|
||||
if (condition || warned.has(message))
|
||||
return;
|
||||
console.warn(formatErrorMessage(message, errorCode));
|
||||
warned.add(message);
|
||||
}
|
||||
|
||||
export { hasWarned, warnOnce };
|
||||
//# sourceMappingURL=warn-once.mjs.map
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
const wrap = (min, max, v) => {
|
||||
const rangeSize = max - min;
|
||||
return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;
|
||||
};
|
||||
|
||||
export { wrap };
|
||||
//# sourceMappingURL=wrap.mjs.map
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "motion-utils",
|
||||
"version": "14.1.1",
|
||||
"author": "Matt Perry",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/motiondivision/motion",
|
||||
"main": "./dist/cjs/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"module": "./dist/es/index.mjs",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"import": "./dist/es/index.mjs",
|
||||
"default": "./dist/cjs/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rm -rf types dist lib",
|
||||
"build": "yarn clean && tsc -p . && rollup -c",
|
||||
"dev": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\"",
|
||||
"test": "jest --config jest.config.json --max-workers=2"
|
||||
},
|
||||
"gitHead": "23b2a5697ffa854d6da4c26b04ea0d2425e033d7",
|
||||
"devDependencies": {
|
||||
"concurrently": "^7.3.0",
|
||||
"jest": "^29.7.0",
|
||||
"rollup": "4.59.0",
|
||||
"typescript": "5.4.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user