New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

void

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

void - npm Package Compare versions

Package version was removed
This package version has been unpublished, mostly likely due to security reasons
Comparing version
0.1.6
to
3.0.1
+16
dist/config/index.d.ts
import { Size, Units, Sizes } from '..';
export * as Config from './methods';
/** The configuration options for a sketch, with shorthands allowed. */
export type Config = {
dimensions?: Size | Sizes<2>;
dpi?: number;
fps?: number;
frames?: number;
margin?: Sizes<1> | Sizes<2> | Sizes<3> | Sizes<4>;
orientation?: Orientation;
precision?: Sizes<1>;
units?: Units;
};
/** The orientation of a set of dimensions. */
export type Orientation = 'square' | 'portrait' | 'landscape';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AAEnC,uEAAuE;AACvE,MAAM,MAAM,MAAM,GAAG;IACnB,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAA"}
import { Config } from '.';
import { Sizes, Orientation, Units } from '..';
/** Resolve the dimensions of a `config`. */
export declare function dimensions(config: Config): Sizes<2>;
/** Resolve the margin from a `config`. */
export declare function margin(config: Config): Sizes<4>;
/** Resolve the orientation from a `config`. */
export declare function orientation(config: Config): Orientation | undefined;
/** Resolve the precision of a `config`. */
export declare function precision(config: Config): [number, Units];
/** Resolve the units of a `config`. */
export declare function units(config: Config): Units;
//# sourceMappingURL=methods.d.ts.map
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/config/methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAA;AAC1B,OAAO,EAAE,KAAK,EAAQ,WAAW,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAGpD,4CAA4C;AAC5C,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAOnD;AAED,0CAA0C;AAC1C,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAkB/C;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAUnE;AAED,2CAA2C;AAC3C,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAIzD;AAED,uCAAuC;AACvC,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAE3C"}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

export * as Void from './void';
export * from './config';
export * from './size';
export * from './sketch';
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA"}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

/** Export the size-related methods namespace. */
export * as Size from './methods';
/** A recognized size keyword. */
export type Size = keyof typeof SIZES;
/** Sizes of length `N`, with specific units. */
export type Sizes<N extends number, T extends number[] = []> = T extends {
length: N;
} ? [...T, Units] : Sizes<N, [...T, number]>;
/** The unit of measurement for the canvas. */
export type Units = 'm' | 'cm' | 'mm' | 'in' | 'ft' | 'yd' | 'pt' | 'pc' | 'px';
/** Types of unit systems. */
export type UnitsSystem = 'metric' | 'imperial';
/** A dictionary of recognized paper sizes. */
export declare const SIZES: {
readonly A0: readonly [841, 1189, "mm"];
readonly A1: readonly [594, 841, "mm"];
readonly A2: readonly [420, 594, "mm"];
readonly A3: readonly [297, 420, "mm"];
readonly A4: readonly [210, 297, "mm"];
readonly A5: readonly [148, 210, "mm"];
readonly A6: readonly [105, 148, "mm"];
readonly A7: readonly [74, 105, "mm"];
readonly A8: readonly [52, 74, "mm"];
readonly A9: readonly [37, 52, "mm"];
readonly A10: readonly [26, 37, "mm"];
readonly B0: readonly [1000, 1414, "mm"];
readonly B1: readonly [707, 1000, "mm"];
readonly B2: readonly [500, 707, "mm"];
readonly B3: readonly [353, 500, "mm"];
readonly B4: readonly [250, 353, "mm"];
readonly B5: readonly [176, 250, "mm"];
readonly B6: readonly [125, 176, "mm"];
readonly B7: readonly [88, 125, "mm"];
readonly B8: readonly [62, 88, "mm"];
readonly B9: readonly [44, 62, "mm"];
readonly B10: readonly [31, 44, "mm"];
readonly C0: readonly [917, 1297, "mm"];
readonly C1: readonly [648, 917, "mm"];
readonly C2: readonly [458, 648, "mm"];
readonly C3: readonly [324, 458, "mm"];
readonly C4: readonly [229, 324, "mm"];
readonly C5: readonly [162, 229, "mm"];
readonly C6: readonly [114, 162, "mm"];
readonly C7: readonly [81, 114, "mm"];
readonly C8: readonly [57, 81, "mm"];
readonly C9: readonly [40, 57, "mm"];
readonly C10: readonly [28, 40, "mm"];
readonly Letter: readonly [8.5, 11, "in"];
readonly Legal: readonly [8.5, 14, "in"];
readonly Tabloid: readonly [11, 17, "in"];
readonly 'JIS B0': readonly [1030, 1456, "mm"];
readonly 'JIS B1': readonly [728, 1030, "mm"];
readonly 'JIS B2': readonly [515, 728, "mm"];
readonly 'JIS B3': readonly [364, 515, "mm"];
readonly 'JIS B4': readonly [257, 364, "mm"];
readonly 'JIS B5': readonly [182, 257, "mm"];
readonly 'JIS B6': readonly [128, 182, "mm"];
readonly 'JIS B7': readonly [91, 128, "mm"];
readonly 'JIS B8': readonly [64, 91, "mm"];
readonly 'JIS B9': readonly [45, 64, "mm"];
readonly 'JIS B10': readonly [32, 45, "mm"];
readonly 'ANSI A': readonly [8.5, 11, "in"];
readonly 'ANSI B': readonly [11, 17, "in"];
readonly 'ANSI C': readonly [17, 22, "in"];
readonly 'ANSI D': readonly [22, 34, "in"];
readonly 'ANSI E': readonly [34, 44, "in"];
readonly 'Arch A': readonly [9, 12, "in"];
readonly 'Arch B': readonly [12, 18, "in"];
readonly 'Arch C': readonly [18, 24, "in"];
readonly 'Arch D': readonly [24, 36, "in"];
readonly 'Arch E': readonly [36, 48, "in"];
readonly '4R': readonly [4, 6, "in"];
readonly '5R': readonly [5, 7, "in"];
readonly '6R': readonly [6, 8, "in"];
readonly '8R': readonly [8, 10, "in"];
readonly '10R': readonly [10, 12, "in"];
readonly '11R': readonly [11, 14, "in"];
readonly '12R': readonly [12, 15, "in"];
readonly '14R': readonly [14, 17, "in"];
readonly '16R': readonly [16, 20, "in"];
readonly '20R': readonly [20, 24, "in"];
readonly '240p': readonly [426, 240, "px"];
readonly '360p': readonly [640, 360, "px"];
readonly '480p': readonly [854, 480, "px"];
readonly '720p': readonly [1280, 720, "px"];
readonly '1080p': readonly [1920, 1080, "px"];
readonly '1440p': readonly [2560, 1440, "px"];
readonly '2160p': readonly [3840, 2160, "px"];
readonly '4320p': readonly [7680, 4320, "px"];
};
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/size/index.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,iCAAiC;AACjC,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,KAAK,CAAA;AAErC,gDAAgD;AAChD,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS;IACvE,MAAM,EAAE,CAAC,CAAA;CACV,GACG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GACb,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAE5B,8CAA8C;AAC9C,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE/E,6BAA6B;AAC7B,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAA;AAE/C,8CAA8C;AAC9C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGR,CAAA"}
import { Size, Sizes } from '..';
/** Get the dimensions for a size. */
export declare function dimensions(size: Size): Sizes<2>;
/** Check if a `value` is a size keyword. */
export declare function is(value: unknown): value is Size;
/** Try to match a `width`, `height`, and `units` to a size keyword. */
export declare function match(width: number, height: number, units: string): Size | null;
//# sourceMappingURL=methods.d.ts.map
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/size/methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAS,MAAM,IAAI,CAAA;AAEvC,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAG/C;AAED,4CAA4C;AAC5C,wBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEhD;AAED,uEAAuE;AACvE,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,IAAI,GAAG,IAAI,CAQb"}
import { Config, Units } from '..';
/** The sketch-related methods. */
export * as Sketch from './methods';
/** An object representing a Void sketch's state. */
export type Sketch = {
config: Config;
construct: () => void;
draw?: () => void;
container: HTMLElement;
el: HTMLElement;
frame?: Frame;
handlers?: Handlers;
hash: string;
keyboard?: Keyboard;
layers: Record<string, Layer>;
pointer?: Pointer;
output: Output;
prng?: () => number;
raf?: number;
schemas?: Record<string, Schema>;
settings: Settings;
status?: 'playing' | 'paused' | 'stopped';
traits: Record<string, any>;
};
/** A frame of a sketch's draw function. */
export type Frame = {
count: number;
time: number;
rate: number;
};
/** The event handlers of a sketch. */
export type Handlers = {
construct: Array<() => void>;
draw: Array<() => void>;
error: Array<(error: Error) => void>;
play: Array<() => void>;
pause: Array<() => void>;
stop: Array<() => void>;
};
/** Data about the keyboard while a sketch is running. */
export type Keyboard = {
code: string | null;
codes: Record<string, true>;
key: string | null;
keys: Record<string, true>;
};
/** A layer of the sketch. */
export type Layer = {
hidden: boolean;
export?: () => string;
};
/** Output settings when exporting a sketch. */
export type Output = OutputPng | OutputJpg | OutputWebp | OutputSvg | OutputPdf;
/** PNG output settings. */
export type OutputPng = {
type: 'png';
};
/** JPG output settings. */
export type OutputJpg = {
type: 'jpg';
quality: number;
};
export type OutputWebp = {
type: 'webp';
quality?: number;
};
export type OutputSvg = {
type: 'svg';
};
export type OutputPdf = {
type: 'pdf';
rasterize?: boolean;
};
/** Data about the mouse while a sketch is running. */
export type Pointer = {
type: 'mouse' | 'pen' | 'touch' | null;
x: number | null;
y: number | null;
position: [number, number] | null;
button: number | null;
buttons: Record<number, true>;
};
/** A schema which defines the values of a trait. */
export type Schema = SchemaBool | SchemaInt | SchemaFloat | SchemaPick;
/** A schema for boolean traits. */
export type SchemaBool = {
type: 'boolean';
probability: number;
initial?: boolean;
};
/** A schema for integer traits. */
export type SchemaInt = {
type: 'int';
min: number;
max: number;
step: number;
initial?: number;
};
/** A schema for floating point number traits. */
export type SchemaFloat = {
type: 'float';
min: number;
max: number;
step?: number;
initial?: number;
};
/** A schema for enum traits. */
export type SchemaPick = {
type: 'pick';
names: string[];
weights: number[];
initial?: string;
};
/** The userland-exposed settings of a sketch. */
export type Settings = {
dpi: number;
fps: number;
frames: number;
height: number;
margin: [number, number, number, number];
precision: number | null;
units: Units;
width: number;
};
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sketch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,CAAA;AAElC,kCAAkC;AAClC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AAEnC,oDAAoD;AACpD,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,SAAS,EAAE,WAAW,CAAA;IACtB,EAAE,EAAE,WAAW,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ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GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,gCAAgC;AAChC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
import { Config, Schema } from '..';
import { Frame, Handlers, Keyboard, Layer, Pointer, Sketch } from '.';
/** Get the current sketch and assert one exists. */
export declare function assert(): Sketch;
/** Attach the sketch to the DOM. */
export declare function attach(sketch: Sketch): void;
/** Get the current sketch from the global `VOID` context. */
export declare function current(): Sketch | undefined;
/** Detach the sketch from the DOM. */
export declare function detach(sketch: Sketch): void;
/** Get the full-sized dimensions of a `sketch`, including margins, in the sketch's own units. */
export declare function dimensions(sketch: Sketch, mode?: 'sketch' | 'pixel' | 'device'): [number, number];
/** Emit an `event` to all the sketch's handlers. */
export declare function emit<T extends keyof Handlers>(sketch: Sketch, event: T, ...args: Parameters<Handlers[T][number]>): void;
/** Execute a `fn` with the sketch loaded on the global `VOID` context. */
export declare function exec(sketch: Sketch, fn: () => void): void;
/** Run a `fn` with a fork of the PRNG, consuming only one random value. */
export declare function fork<T>(sketch: Sketch, fn: () => T): T;
/** Get the sketch's current frame information. */
export declare function frame(sketch: Sketch): Frame;
/** Get the sketch's current keyboard information. */
export declare function keyboard(sketch: Sketch): Keyboard;
/** Create a new layer with `name`. */
export declare function layer(sketch: Sketch, name?: string): Layer;
/** Create a sketch from a `construct` function, with optional `el` and `overrides`. */
export declare function of(attrs: {
construct: () => void;
container: HTMLElement;
el?: HTMLElement;
hash: string;
layers?: Sketch['layers'];
config?: Sketch['config'];
traits?: Sketch['traits'];
output?: Sketch['output'];
}): Sketch;
/** Attach a `callback` to when an `event` is emitted. */
export declare function on<T extends keyof Handlers>(sketch: Sketch, event: T, callback: Handlers[T][number]): void;
/** Play the sketch's draw loop. */
export declare function play(sketch: Sketch): void;
/** Pause the sketch's draw loop. */
export declare function pause(sketch: Sketch): void;
/** Get the sketch's current pointer information. */
export declare function pointer(sketch: Sketch): Pointer;
/** Get the sketch's seeded pseudo-random number generator. */
export declare function prng(sketch: Sketch): () => number;
/** Save the sketch's layers as an image. */
export declare function save(sketch: Sketch): Promise<string>;
export declare function saveImage(sketch: Sketch): Promise<string>;
export declare function saveSvg(sketch: Sketch): Promise<string>;
/** Resolve a `config` object into the sketch's settings. */
export declare function settings(sketch: Sketch, config: Config): Sketch['settings'];
/** Stop the sketch's draw loop. */
export declare function stop(sketch: Sketch): void;
/** Set a trait on a `sketch` to a new value. */
export declare function trait(sketch: Sketch, name: string, value: any, schema: Schema): void;
//# sourceMappingURL=methods.d.ts.map
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/sketch/methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,EAAE,MAAM,IAA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,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CA4C3E;AAED,mCAAmC;AACnC,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,QAMlC;AAED,gDAAgD;AAChD,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,MAAM,GACb,IAAI,CAIN"}
import { Orientation, Units } from '.';
/** The SVG namespace string. */
export declare const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
/** The prefix for Base64-encoded SVG data URIs. */
export declare const SVG_DATA_URI_PREFIX = "data:image/svg+xml;base64,";
/** The fixed DPI that CSS uses when displaying real-world units. */
export declare const CSS_DPI = 96;
/** Convert an SVG string to a data URI. */
export declare function svgStringToDataUri(svg: string): string;
/** Convert an SVG data URI to an SVG string. */
export declare function svgDataUriToString(uri: string): string;
/** Convert an SVG string to an SVG element. */
export declare function svgStringToElement(string: string): SVGSVGElement;
/** Convert an SVG element to an SVG string. */
export declare function svgElementToString(el: SVGSVGElement): string;
/** Apply an `orientation` to a `width` and `height`. */
export declare function applyOrientation(width: number, height: number, orientation: Orientation): [number, number];
/** Resolve the orientation of a `width` and `height`. */
export declare function resolveOrientation(width: number, height: number): Orientation;
/** A pseudo-random number generator using the SFC32 algorithm. */
export declare function Sfc32(a: number, b: number, c: number, d: number): () => number;
/** Convert a `value` from one unit to another. */
export declare function convertUnits(value: number, from: Units, to: Units, options?: {
dpi?: number;
precision?: number;
}): number;
//# sourceMappingURL=utils.d.ts.map
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAe,MAAM,GAAG,CAAA;AAEnD,gCAAgC;AAChC,eAAO,MAAM,aAAa,+BAA+B,CAAA;AAEzD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAE/D,oEAAoE;AACpE,eAAO,MAAM,OAAO,KAAK,CAAA;AAEzB,2CAA2C;AAC3C,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAKhE;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,aAAa,GAAG,MAAM,CAK5D;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,GACvB,CAAC,MAAM,EAAE,MAAM,CAAC,CASlB;AAED,yDAAyD;AACzD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAE7E;AAED,kEAAkE;AAClE,wBAAgB,KAAK,CACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,MAAM,MAAM,CAcd;AAoBD,kDAAkD;AAClD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,KAAK,EACX,EAAE,EAAE,KAAK,EACT,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,MAAM,CA0BR"}
import { Sketch, Config, Pointer, Keyboard, Units } from '.';
type Nameable = string | number | boolean | null;
type Nameify<T> = T extends Nameable ? T : string;
type Narrowable = string | number | bigint | boolean | symbol | object | undefined | void | null | {};
/**
* Defines a boolean trait.
*
* If you pass an `initial` value, it will always be used as the default value
* for the trait in a sketch, until overriden.
*
* Other, when randomly generated, you can pass a `probability` which is the
* chance that the boolean will be `true`.
*/
export declare function bool(name: string, probability?: number): boolean;
export declare function bool(name: string, initial: boolean): boolean;
/**
* Convert a `value` from one unit to another.
*
* By default this uses the sketch's units as the output units, but that can be
* overriden with the third `to` argument.
*/
export declare function convert(value: number, from: Units, to?: Units): number;
export declare function convert(value: number, from: Units, options: {
dpi?: number;
precision?: number;
}): number;
export declare function convert(value: number, from: Units, to: Units, options: {
dpi?: number;
precision?: number;
}): number;
/**
* Define a `draw` function with the drawing logic to render each frame of an
* animated sketch.
*/
export declare function draw(fn: () => void): void;
/**
* Attach an event listener to the canvas.
*/
export declare function event<E extends keyof GlobalEventHandlersEventMap>(event: E, callback: (e: GlobalEventHandlersEventMap[E]) => void): () => void;
/**
* Define a floating point trait.
*
* You can either pass a single `initial` argument which will be used as the
* default value. Or you can pass a `min`, `max`, and optional `step` and the
* trait will be randomly generated.
*/
export declare function float(name: string, initial: number): number;
export declare function float(name: string, min: number, max: number, step?: number): number;
/**
* Run a function `fn` with a fork of the current pseudo-random number generator
* seed, so that it only consumes one random value.
*/
export declare function fork<T>(fn: () => T): T;
/**
* Define an integer trait.
*
* You can either pass a single `initial` argument which will be used as the
* default value. Or you can pass a `min`, `max`, and optional `step` and the
* trait will be randomly generated.
*/
export declare function int(name: string, initial: number): number;
export declare function int(name: string, min: number, max: number, step?: number): number;
/**
* Get a reference to the current keyboard data.
*
* The returned object is mutable and will continue to stay up to date as keys
* are pressed down and lifted up.
*/
export declare function keyboard(): Keyboard;
/**
* Get a new canvas layer to draw on, placed above all other layers.
*
* If the `name` argument is omitted it will be auto-generated.
*/
export declare function layer(name?: string): CanvasRenderingContext2D;
/**
* Define a trait that picks one of many `choices`.
*
* You may pass an `initial` value as the second argument. Otherwise, the choice
* will be randomly picked for you.
*
* The choices may either be an array or object of values. For weighted choices,
* the array or object values should be a tuple, where the first element is a
* number representing the weight.
*/
export declare function pick<V extends Narrowable>(name: string, choices: Choices<V>): V;
export declare function pick<V>(name: string, choices: Choices<V>): V;
export declare function pick<V extends Narrowable>(name: string, initial: Nameify<V>, choices: Choices<V>): V;
export declare function pick<V>(name: string, initial: Nameify<V>, choices: Choices<V>): V;
/**
* Get a reference to the current pointer (eg. mouse, pen, finger) data.
*
* The returned object is mutable and will continue to stay up to date as the
* viewer clicks, taps, or hovers.
*
* Note that the pointer only refers to the "primary" pointer, and to handle
* multi-touch scenarios you'll need to attach your own event handlers with the
* `Void.event()` method instead.
*/
export declare function pointer(): Pointer;
/**
* Return a random number from `0` (inclusive) to `1` (exclusive) using the
* sketch's seeded pseudo-random number generator.
*
* This is the same as `Math.random` but with deterministic randomness.
*/
export declare function random(): number;
export declare function random(min: number, max: number, step?: number): number;
/**
* Setup the layout and scene for a sketch.
*
* This method returns an object of all the resolved settings of a sketch,
* including the resolved `width` and `height` of the canvas.
*/
export declare function settings(): Sketch['settings'];
export declare function settings(config: Config): Sketch['settings'];
export declare function settings(dimensions: Config['dimensions']): Sketch['settings'];
type Choices<V> = V extends Nameable ? readonly V[] | readonly [number, V][] | Record<string, V> | Record<string, [number, V]> : Exclude<readonly V[], readonly any[][]> | readonly [number, V][] | Record<string, Exclude<V, any[]>> | Record<string, [number, V]>;
export {};
//# sourceMappingURL=void.d.ts.map
{"version":3,"file":"void.d.ts","sourceRoot":"","sources":["../src/void.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,CAAA;AAS5D,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAGhD,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAA;AAGjD,KAAK,UAAU,GACX,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,IAAI,GACJ,IAAI,GACJ,EAAE,CAAA;AAEN;;;;;;;;GAQG;AACH,wBAA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EAAE,MAAM,GAAG,MAAM,CAAA;AAgBvE;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAC,CAAA;AAC9C,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AAC5D,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AAc9E,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,GAE5B,SAAS,CAAC,EAAE,GACZ,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,GACtB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GACjB,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,GAE3B,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,CAAC,GACvC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA"}
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/banner-dark.png">
<img alt="Void" src="./docs/images/banner-light.png">
</picture>
</p>
<p align="center">
A toolkit for making generative art.
</p>
<p align="center">
<a href="#introduction">Introduction</a> •
<a href="#examples">Examples</a> •
<a href="#documentation">Documentation</a>
</p>
<br/>
Void makes it easy to create and explore generative art. It gives you the workflows you know from modern graphics programs, paired with a simple, powerful library for building sketches with [HTML's `<canvas>`](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API).
- **Tweak variables.** The traits of a sketch can be changed directly in the UI, so you can experiment quickly, and create a variety of different outputs.
- **Export artwork.** The output of a sketch can be exported to raster formats like PNG or JPG, as well as vector formats like SVG out of the box!
- **Control randomness.** Changing the random seed for a sketch allows you to reproduce existing outputs, or create entirely new outputs.
- **Customize layout.** Use common presets like `Letter`, `A4`, or `1080p`, or define a custom size, add margins, change orientations, etc.
- **Import dependencies.** Sketches are just JavaScript (or TypeScript) files, so you can import useful helpers from [npm](https://www.npmjs.com/) packages or neighboring files as usual.
- **Bundle efficiently.** The Void library is designed to be completely treeshake-able, so it produces the absolute smallest bundle sizes when packaging up your code.
- **Feel familiar.** Void's UI is inspired by modern tools like [Figma](https://www.figma.com/) and [Blender](https://www.blender.org/), its API is inspired by creative coding frameworks like [P5.js](https://p5js.org/) and [canvas-sketch](https://github.com/mattdesl/canvas-sketch).
<br/>
<p align="center">
<img src="./docs/images/recording.gif" />
</p>
<br/>
### Introduction
To get started, download the Void desktop app:
<a href="https://github.com/ianstormtaylor/void/releases/latest/download/Void-macOS-arm64.dmg">
<img width="248" height="44" alt="Download for Mac (Apple Silicon)" src="./docs/images/download-mac-silicon.png" />
</a>
<a href="https://github.com/ianstormtaylor/void/releases/latest/download/Void-macOS-x64.dmg">
<img width="182" height="44" alt="Download for Mac (Intel)" src="./docs/images/download-mac-intel.png" />
</a>
<a href="https://github.com/ianstormtaylor/void/releases/latest/download/Void-Windows-Setup-x64.exe">
<img width="133" height="44" alt="Download for Windows" src="./docs/images/download-windows.png" />
</a>
<a href="https://github.com/ianstormtaylor/void/releases/latest/download/Void-Linux-x86_64.AppImage">
<img width="133" height="44" alt="Download for Linux" src="./docs/images/download-linux.png" />
</a>
<br/>
<br/>
Install the `void` package:
```bash
npm install --save void
```
Create a new sketch file:
```js
import { Void } from 'void'
export default function () {
let { width, height } = Void.settings([300, 300, 'px'])
let radius = Void.int('radius', 10, 150)
let ctx = Void.layer()
ctx.beginPath()
ctx.arc(width / 2, height / 2, radius, 0, Math.PI * 2, false)
ctx.fill()
}
```
Then open the sketch file with the Void app:
![A screenshot of the basic sketch in the Void app.](./docs/images/introduction.png)
If you see a black circle on the screen, congrats!
The <kbd>Radius</kbd> trait has a randomly generated value. You can change it in the sidebar and the sketch will update in real time. This is a simple sketch that draws just one shape, but you can do a lot more…
<br/>
### Examples
Void is designed to make it easy to quickly iterate on sketches, so you can explore new ideas quickly. To get a sense for what's possible, here are some examples:
- **Basics**
- [Introduction](./examples/basics/introduction.js)
- [Layers](./examples/basics/layers.js)
- [Noise](./examples/basics/noise.js)
- [Animation](./examples/basics/animation.js)
- [Pointer](./examples/basics/pointer.js)
- **Classics**
- [Bill Kolomyjec](./examples/classics/bill-kolomyjec.js) — [original](http://recodeproject.com/artwork/v2n3random-squares)
- [Ellsworth Kelly](./examples/classics/ellsworth-kelly.js) — [original](https://www.moma.org/collection/works/35484)
- [François Morellet](./examples/classics/francois-morellet.js) — [original](https://www.wikiart.org/en/francois-morellet/tirets-neon-0-90-avec-4-rythmes-interferents-191)
- [Georg Nees](./examples/classics/georg-nees.js) — [original](https://collections.vam.ac.uk/item/O221321/schotter-print-nees-georg/)
- [Vera Molnár](./examples/classics/vera-molnar.js) — [original](https://pratiques-picturales.net/article63.html)
Download and open any example file in the Void desktop app to see their output.
<br/>
### Documentation
Void's API is designed to be extremely simple to use. It gives you a handful of tools that are useful when making generative art, and it delegates the rendering itself to the HTML [`<canvas>`](https://www.google.com/search?client=firefox-b-1-d&q=mdn+canvas) element.
It's built as a series of helper functions:
- [**Canvas**](./docs/void.md#canvas)
- [`Void.draw()`](./docs/void.md#voiddraw)
- [`Void.layer()`](./docs/void.md#voidlayer)
- [`Void.settings()`](./docs/void.md#voidsettings)
- [**Traits**](./docs/void.md#traits)
- [`Void.bool()`](./docs/void.md#voidbool)
- [`Void.float()`](./docs/void.md#voidfloat)
- [`Void.int()`](./docs/void.md#voidint)
- [`Void.pick()`](./docs/void.md#voidpick)
- [**Interaction**](./docs/void.md#interaction)
- [`Void.event()`](./docs/void.md#voidevent)
- [`Void.keyboard()`](./docs/void.md#voidkeyboard)
- [`Void.pointer()`](./docs/void.md#voidpointer)
- [**Utils**](./docs/void.md#utils)
- [`Void.convert()`](./docs/void.md#voidconvert)
- [`Void.fork()`](./docs/void.md#voidfork)
- [`Void.random()`](./docs/void.md#voidrandom)
<br/>
### License
Void is open-source and [MIT-licensed](./License.md). If you run into issues or think of improvements, all contributions are very welcome! Feel free to [open an issue](https://github.com/ianstormtaylor/void/issues) or [submit a pull request](https://github.com/ianstormtaylor/void/pulls).
<br/>
### Thanks
Thanks to [Eric Johnson](https://github.com/edj-boston) for letting us use the `void` package name on NPM! Thanks to [Lauren Lee McCarthy](https://github.com/lmccart) and [Matt DesLauriers](https://github.com/mattdesl) for creating P5.js and canvas-sketch which served as inspiration for the API.
+75
-32
{
"name": "void",
"version": "0.1.6",
"description": "A NodeJS module that intelligently invalidates your CloudFront Cache.",
"main": "./lib/Void.js",
"version": "3.0.1",
"description": "A toolkit for making generative art.",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/void.git",
"type": "module",
"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"engines": {
"node": ">=16",
"typescript": ">=4.9"
},
"scripts": {
"test": "mocha"
"build": "rm -rf ./{dist} && rollup --config ./rollup.config.js",
"coverage": "vitest run --coverage",
"dev": "vitest watch",
"release": "npm run build && npm run test && npm version",
"test": "vitest run"
},
"repository": {
"type": "git",
"url": "git://github.com/edj-boston/void.git"
"dependencies": {},
"devDependencies": {
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-typescript": "^10.0.1",
"@vitest/coverage-c8": "^0.25.3",
"rollup": "^3.5.0",
"vite": "*",
"vitest": "*"
},
"keywords": [
"AWS",
"CloudFront",
"invalidate",
"cache",
"clear",
"request",
"Amazon",
"automatic",
"asynchronous"
],
"author": "Eric Johnson",
"license": "MIT",
"bugs": {
"url": "https://github.com/edj-boston/void/issues"
},
"homepage": "https://voidjs.com",
"devDependencies": {
"mocha": "^1.4.3",
"should": "^3.3.1"
},
"dependencies": {
"aws-sdk": "^2.0.0-rc.14",
"jquery-extend": "^2.0.3",
"file": "^0.2.2"
}
"2d",
"3d",
"animation",
"art",
"axidraw",
"canvas",
"canvas2d",
"coding",
"controls",
"creative",
"dat",
"draw",
"editor",
"export",
"generative",
"gif",
"gui",
"hud",
"input",
"jpg",
"math",
"opengl",
"p5",
"pen",
"physics",
"plotter",
"png",
"processing",
"random",
"seed",
"shape",
"simulate",
"simulation",
"sketch",
"slider",
"studio",
"svg",
"three",
"trait",
"tweakpane",
"ui",
"utils",
"variable",
"vector",
"void",
"webgl"
]
}

Sorry, the diff of this file is not supported yet

language: node_js
node_js:
- '0.11'
- '0.10'
env:
global:
- secure: xGFuq3RAytMDckBZg+U+sX7ewyKdrDMEhAXoVZovhXdygmAmT9kEQksQHYPHUwYNpsCYQPNHa9aFOZ6JUgWlcFU3l425YEP8QTlkcchIlbWSCbpa2GTfqUR+e2kPbnvYhbcT0cX0D6WAa1+QUn9rQNXOXHlLwCF1vzlu4XO+n7Y=
- secure: olCdl0Ykg77MN/SXDqe31C34LcbjWrQD73AUuMs7syEFg0ixsoJJSSNKw81X3cF8geS3RwensrirNHsZFpwp1VAy+yPelvaaXhyXUn0aCj2ObRE544Yj5rLSw2MS+vLBtxPwbizLsD0fe90K4geOhZyj2fFbcz1olUWzVWfnyHI=
- secure: t/d2ATp/6Xgx0Js081HdDpiHn7+g7699lrLhljFEZRxBDK2FQOmr3U3ejdsGfut2hA24+8ub/RZgVmuCfbqbpeMZHSqmaBFRz7SEdd3syfCqYBeAQnZe+XwEKsKmsZxUvgOex3sXmrkGi4xZSIfrANabojjEP/msg/p/ZLeEfus=

Sorry, the diff of this file is not supported yet

var AWS = require('aws-sdk'),
Void = require('./lib/Void.js');
Job = require('./lib/Job.js');
var v = new Void({
paths : [
'/index.html',
'/index2.html',
'/foo/bar.html',
'/foo2/bar2.html'
],
maxPaths : 1,
maxJobs : 3
});
// External dependencies
var AWS = require('aws-sdk'),
extend = require('jquery-extend');
// Constructor
var Job = function( options ) {
// Defaults
var defaults = {
name : Math.random().toString(36).substr(2, 5).toUpperCase(), // Random name for logging, can be overridden
prefix : '', // Optional prefix for logging
id : '', // Assigned by CloudFront
paths : [], // Array of paths
status : 'paused', // Status string, one of 'paused', 'running', 'complete'
cloudfront : new AWS.CloudFront(), // Credentialed AWS-SDK object
distribution : process.env.DISTRIBUTION_ID,
running : null, // Timestamp when the job started running
checking : null, // Timestamp when the invalidation was created
createInterval : 2, // Minutes to wait before retrying to create an `Invalidation`
createTimeout : 30, // Minutes to wait after 'running' status to quit trying to create an invalidation
checkDelay : 10, // Minutes to wait before the first status check
checkInterval : 2, // Minutes to wait between 2nd-Nth status checks
checkTimeout : 20, // Minutes to wait after the invalidation is created to quit and stop checking for progress
complete : null, // Optional callback to fire when invalidation completes
timeout : null // Optional callback to fire when invalidation completes
};
// Extend `this` by our `defaults` and `options`
extend(true, this, defaults, options);
// Return this for chaining
return this;
}
// Run the job
Job.prototype.run = function() {
this.status = 'running';
this.running = +new Date;
this.create();
}
// Attempt to create the invalidation
Job.prototype.create = function() {
// See if we've timed out
if( (+new Date-this.running) > this.createTimeout * 60000 ) {
var message = 'Timeout: could not create invalidation after ' + this.createTimeout + ' minutes';
this.log(message);
if(typeof this.timeout == 'function') this.timeout(null, message, this);
return;
}
// Setup some data for the API
var params = {
DistributionId: this.distribution,
InvalidationBatch: {
CallerReference: this.name,
Paths: {
Quantity: this.paths.length,
Items: this.paths
}
}
};
// Send the request to AWS CloudFront
this.cloudfront.createInvalidation(params, function(err, data) {
if(err) {
if(err.code == 'TooManyInvalidationsInProgress') {
this.log('Too many invalidations, retrying in ' + this.createInterval + ' minute(s)');
setTimeout(this.create.bind(this), this.createInterval*60000);
} else {
this.log('Failed: ' + err.message);
}
} else {
this.id = data.Id;
this.log('Invalidation "' + this.id + '" created. Checking in ' + this.checkDelay + ' minute(s)...');
this.checking = +new Date;
setTimeout(this.check.bind(this), this.checkDelay*60000);
}
}.bind(this));
}
// Get the invalidation status from the API
Job.prototype.check = function() {
// See if we've timed out
if( (+new Date-this.checking) > this.checkTimeout * 60000 ) {
var message = 'Timeout: stopped checking invalidation after ' + this.checkTimeout + ' minutes';
this.log(message);
if(typeof this.timeout == 'function') this.timeout(null, message, this);
return;
}
// Setup some data for the API
var params = {
DistributionId: this.distribution,
Id: this.id
};
// Send the request to AWS CloudFront
this.cloudfront.getInvalidation(params, function(err, data) {
if (err) {
this.log(err, err.stack);
this.complete(err);
return;
}
// Handle the status we get back
switch( data.Status ) {
case 'InProgress':
this.log('In progress, re-checking in ' + this.checkInterval + ' minute(s)...');
setTimeout(this.check.bind(this), this.checkInterval*60000);
return;
case 'Completed':
this.status = 'complete';
var message = 'Invalidation "' + this.id + '" completed!';
this.log(message);
if(typeof this.complete == 'function') this.complete(null, message, this);
return;
default:
console.log(data); // something unexpected happened
return;
}
}.bind(this));
}
// Log labeled messages
Job.prototype.log = function( message ) {
message = '[Job:' + this.name + '] ' + message;
if( this.prefix ) message = this.prefix + message;
console.log(message);
}
// Throw labeled errors
Job.prototype.err = function( message ) {
message = '[Job:' + this.name + '] ' + message;
if( this.prefix ) message = this.prefix + message;
throw new Error(message);
}
// Export the constructor
module.exports = Job;
// External dependancies
var file = require('file');
// Our helper function
var scan = function( dir ) {
var path = process.cwd() + dir;
var arr = [];
file.walkSync(dir, function(dirPath, dirs, files) {
files.forEach(function(file) {
arr.push(dirPath.replace(dir, '') + '/' + file);
});
});
return arr;
}
module.exports = scan;
// External dependancies
var AWS = require('aws-sdk'),
extend = require('jquery-extend'),
Job = require('./Job.js'),
scan = require('./scan.js');
// Constructor
var Void = function( options ) {
// Defaults
var defaults = {
name : Math.random().toString(36).substr(2, 5).toUpperCase(), // Random name for logging, can be overridden
distribution : process.env.DISTRIBUTION_ID, // AWS distribution id
paths : [], // Paths to be cleared
dirs : [], // Dirs to be scanned and added to `paths`
poison : [], // Paths to be removed from `paths`
queue : [], // Queue of invalidations
maxPaths : 2, // Max number of paths per invalidation
maxJobs : 3, // Max number of simultaneous `Job` objects
cloudfront : new AWS.CloudFront() // Credentialed AWS-SDK object
};
// Extend `this` by our `defaults` and `options`
extend(true, this, defaults, options);
// Recurse `dirs` and add to `paths`
this.dirs.forEach(function(dir) {
var paths = scan(dir);
this.paths = this.paths.concat(paths)
}, this);
// Remove `poison` items from `paths`
this.poison.forEach(function(path) {
var i = this.paths.indexOf(path);
if( i > -1 ) this.paths.splice(i, 1);
}, this);
// Batch up paths into jobs and place them in the queue
this.populateQueue();
// Run the max number of jobs (or all jobs if fewer than max)
var max = ( this.queue.length < this.maxJobs ) ? this.queue.length : this.maxJobs;
for(i=0; i<max; i++) this.queue[i].run();
};
// Callback to loop over the queue and activate a job or notify when complete
Void.prototype.runNextJob = function(err, data) {
if(err) this.err(err);
var counter = 0;
for(i=0; i<this.queue.length; i++) {
var job = this.queue[i];
if(job.status == 'paused') {
job.run();
return;
} else if(job.status == 'complete') {
counter++;
}
}
if( counter == this.queue.length ) this.log('All jobs complete!');
};
// Batch up our raw data into jobs and place them in the queue
Void.prototype.populateQueue = function() {
var counter = 0;
for(i=0, j=this.paths.length; i<j; i+=this.maxPaths) {
var subset = this.paths.slice(i, i+this.maxPaths);
this.queue.push( new Job({
prefix : '[Void:' + this.name + ']',
paths : subset,
complete : this.runNextJob.bind(this)
}) );
counter++;
}
this.log('Created ' + counter + ' item(s) in the queue');
}
// Log labeled messages
Void.prototype.log = function( message ) {
console.log('[Void:' + this.name + '] ' + message);
}
// Throw labeled errors
Void.prototype.err = function( message ) {
throw new Error('[Void:' + this.name + '] ' + message);
}
// Export the constructor
module.exports = Void;
The MIT License (MIT)
Copyright (c) 2014 Eric Johnson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Void [![Build Status](https://travis-ci.org/edj-boston/void.svg?branch=master)](https://travis-ci.org/edj-boston/void)
====
[Void](https://github.com/edj-boston/void) is a NodeJS [module](https://www.npmjs.org/package/teleshenvoidmodule) that intelligently invalidates your CloudFront Cache. It respects the following limitations:
* Hard limit of 1000 paths per invalidation
* Only 3 invalidations can run at the same time (and other processes may be creating them too)
* There is no callback for the native AWS SDK, so the API must be polled
Installation
------------
$ npm install void
Void relies on the [AWS-SDK](https://www.npmjs.org/package/aws-sdk), which requires that you set two environment variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
You can [export](http://www.cyberciti.biz/faq/linux-unix-shell-export-command/) them in the shell for local testing or permanent use. You can also load them into your environment using a tool like [supervisor](https://www.npmjs.org/package/supervisor) or [foreman](http://ddollar.github.io/foreman/) to load an .env file.
Follow your hosting provider's instructions for setting environment variables in production:
* [Heroku](https://devcenter.heroku.com/articles/nodejs-support#environment)
* [AWS Elastic Beanstalk](http://docs.aws.amazon.com/gettingstarted/latest/deploy/envvar.html)
Void requires a third environment variable that contains the CloudFront distribution id:
DISTRIBUTION_ID
__WARNING:__ Do _not_ place your AWS credentials or CloudFront Distribution ID in source control!
Usage
-----
Require void at the top of your script.
```js
var Void = require('void');
```
Call the constructor with the `new` keyword.
```js
var v = new Void();
```
_Note:_ Use a capital "V" for the constructor and a single, lowercase "v" to avoid collision with the reserved word "void".
Arguments
---------
* __name:__ will default to a 5 character string for logging
* __distribution:__ will default to `process.env.DISTRIBUTION_ID`
* __paths:__ Array of path strings to be cleared
* __dirs:__ Array of directories to be scanned and added to `paths`
* __poison:__ Array of path strings to be removed from `paths`
* __maxPaths:__ Max number of paths per invalidation (defaults to 1000)
* __maxJobs:__ Max number of simultaneous invalidations (defaults to 3)
Properties
----------
* __queue:__ Queue of invalidations
* __cloudfront:__ The AWS-SDK object
Example
-------
We can change the default `maxPaths` method to see some complex behavior:
```js
var v = new Void({
paths : [
'/index.html',
'/index2.html',
'/foo/bar.html',
'/foo2/bar2.html'
],
maxPaths : 1
});
```
This will result in the the following console output:
```
[Void:IWZ33] Created 4 item(s) in the queue
[Void:IWZ33][Job:H27NL] Invalidation "IVBLZ2PCXZL5Q" created. Checking in 10 minute(s)...
[Void:IWZ33][Job:JD9ZU] Invalidation "I35PDGSFYBCA1X" created. Checking in 10 minute(s)...
[Void:IWZ33][Job:H1C3R] Too many invalidations, retrying in 2 minute(s)
[Void:IWZ33][Job:H1C3R] Too many invalidations, retrying in 2 minute(s)
[Void:IWZ33][Job:H1C3R] Too many invalidations, retrying in 2 minute(s)
[Void:IWZ33][Job:H1C3R] Too many invalidations, retrying in 2 minute(s)
[Void:IWZ33][Job:H1C3R] Too many invalidations, retrying in 2 minute(s)
[Void:IWZ33][Job:H27NL] In progress, re-checking in 2 minute(s)...
[Void:IWZ33][Job:JD9ZU] In progress, re-checking in 2 minute(s)...
[Void:IWZ33][Job:H1C3R] Too many invalidations, retrying in 2 minute(s)
[Void:IWZ33][Job:H27NL] In progress, re-checking in 2 minute(s)...
[Void:IWZ33][Job:JD9ZU] In progress, re-checking in 2 minute(s)...
[Void:IWZ33][Job:H1C3R] Invalidation "I13B9HSQI6RO7J" created. Checking in 10 minute(s)...
[Void:IWZ33][Job:JD9ZU] Invalidation "I35PDGSFYBCA1X" completed!
[Void:IWZ33][Job:H27NL] Invalidation "IVBLZ2PCXZL5Q" completed!
[Void:IWZ33][Job:7BTD7] Invalidation "I3HRQCLJU7OSZ7" created. Checking in 10 minute(s)...
[Void:IWZ33][Job:H1C3R] Invalidation "I13B9HSQI6RO7J" completed!
[Void:IWZ33][Job:7BTD7] In progress, re-checking in 2 minute(s)...
[Void:IWZ33][Job:7BTD7] Invalidation "I3HRQCLJU7OSZ7" completed!
[Void:IWZ23] All jobs complete!
```
Tests
-----
Install the global dependancies with sudo permissions.
```
$ sudo npm install -g mocha
$ sudo npm install -g should
```
Run mocha directly to see the test results.
```
$ cd void
$ mocha
```
__WARNING:__ Tests will fail unless you have the `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `DISTRIBUTION_ID` variables configured in your environment!
Notes
-----
1. You may incur charges if you invalidate your CloudFront cache frequently. PLease see their [documentation](http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#PayingForInvalidation) and pricing.
2. Again… do NOT put your AWS credentials of CloudFront distribution id in source control
To do
-----
1. More tests
2. Surface granual `Job` properties in `Void` constructor for more flexibility
3. `Void` event callbacks
4. Document `Job` object
// External dependancies
var assert = require('assert'),
should = require('should');
describe('AWS credentials', function() {
it('should throw an error if AWS_ACCESS_KEY_ID is undefined in the environment', function() {
assert.notEqual(process.env.AWS_ACCESS_KEY_ID, undefined);
});
it('should throw an error if AWS_SECRET_ACCESS_KEY is undefined in the environment', function() {
assert.notEqual(process.env.AWS_SECRET_ACCESS_KEY, undefined );
});
it('should throw an error if DISTRIBUTION_ID is undefined in the environment', function() {
assert.notEqual(process.env.DISTRIBUTION_ID, undefined );
});
});
// External dependancies
var assert = require('assert'),
should = require('should'),
Job = require('../lib/Job.js'),
AWS = require('aws-sdk');
// Constructor
describe('Job', function() {
/* *
* Validation
*/
it('should have a 5 character name property', function() {
var job = new Job;
assert.equal(job.name.length, 5);
});
it('should have at least one path item', function() {
var job = new Job({
paths : ['/index.html'],
});
assert.notEqual(job.paths.length, 0);
});
/* *
* Timeouts
*/
/*it('should timeout while creating the invalidation', function(done) {
this.timeout(60000 * 20);
var job = new Job({
paths : [
'/index1.html',
'/index2.html',
'/index3.html',
'/index4.html'
],
createTimeout : 0.1,
createInterval : 0.1,
maxPaths : 1,
maxJobs : 4,
timeout : done
}).run();
});*/
/*it('should timeout while checking the invalidation', function(done) {
this.timeout(60000 * 20);
var job = new Job({
paths : ['/foo/bar.html'],
createInterval : 0.1,
checkTimeout : 0.1,
checkDelay : 0.1,
checkInterval : 0.1,
timeout : function() {
done();
}
});
job.run();
});*/
});
// External dependancies
var assert = require('assert'),
should = require('should'),
Void = require('../lib/Void.js');
// Constructor
describe('Void', function() {
/* *
* Queue building
*/
it('should have a queue of length 6', function() {
var v = new Void({
paths : ['/css/custom.css', '/index.html'],
dirs : ['test/static']
});
assert.equal(v.queue.length, 6);
});
it('should have a queue of length 5 because of the poison list', function() {
var v = new Void({
paths : ['/css/custom.css', '/index.html'],
dirs : ['test/static'],
poison : ['/test1.html', '/test2.html']
});
assert.equal(v.queue.length, 5);
});
});