@kensio/colophon 2.15.2 → 2.15.4
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/dist/cli/args/usage.d.ts +1 -1
- package/dist/cli/args/usage.d.ts.map +1 -1
- package/dist/cli/args/usage.js +4 -0
- package/dist/cli/args/usage.js.map +1 -1
- package/dist/generate/index.d.ts +4 -1
- package/dist/generate/index.d.ts.map +1 -1
- package/dist/generate/index.js +6 -1
- package/dist/generate/index.js.map +1 -1
- package/dist/generate/options.d.ts +14 -0
- package/dist/generate/options.d.ts.map +1 -1
- package/dist/generate/options.js +6 -0
- package/dist/generate/options.js.map +1 -1
- package/dist/generate/plan.d.ts +8 -0
- package/dist/generate/plan.d.ts.map +1 -1
- package/dist/generate/plan.js +1 -0
- package/dist/generate/plan.js.map +1 -1
- package/dist/generate/thread-pool.d.ts +30 -0
- package/dist/generate/thread-pool.d.ts.map +1 -0
- package/dist/generate/thread-pool.js +59 -0
- package/dist/generate/thread-pool.js.map +1 -0
- package/package.json +2 -2
package/dist/cli/args/usage.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Help text for `--help`, and for a run that asks for nothing else. */
|
|
2
|
-
export declare const usage = "colophon: generate social meta images from frontmatter\n\nUsage:\n colophon [contentDir] [options] Render the images for a content tree\n colophon init [contentDir] Write a starter config module\n colophon preview <file> [options] Render one post and open it\n colophon eject hugo Write a Hugo partial that reads the\n manifest and emits the meta tags\n\nImages carry a stamp of the props, config and size they came from, so a rebuild\nrenders only the ones that have actually changed.\n\nOptions:\n -c, --config <path> Load a config module. Its default export is either a\n ColophonConfig or a function (async or not) returning\n one, for a config that has to compute something.\n -f, --force Re-render every image, ignoring the stamps. For init\n and eject, overwrite a file that is already there\n -o, --overwrite Alias for --force\n -n, --dry-run Report what would change and write nothing\n -w, --watch Rebuild whenever a content file changes\n --concurrency <n> How many images to render at once\n --size <name> Which configured size preview renders\n -h, --help Show this help\n\nDefaults:\n contentDir content\n --concurrency one per available CPU\n --size the first configured size\n\nThe first argument is a command where it names one, so a content directory\ncalled init, preview or eject has to be written as ./init.";
|
|
2
|
+
export declare const usage = "colophon: generate social meta images from frontmatter\n\nUsage:\n colophon [contentDir] [options] Render the images for a content tree\n colophon init [contentDir] Write a starter config module\n colophon preview <file> [options] Render one post and open it\n colophon eject hugo Write a Hugo partial that reads the\n manifest and emits the meta tags\n\nImages carry a stamp of the props, config and size they came from, so a rebuild\nrenders only the ones that have actually changed.\n\nOptions:\n -c, --config <path> Load a config module. Its default export is either a\n ColophonConfig or a function (async or not) returning\n one, for a config that has to compute something.\n -f, --force Re-render every image, ignoring the stamps. For init\n and eject, overwrite a file that is already there\n -o, --overwrite Alias for --force\n -n, --dry-run Report what would change and write nothing\n -w, --watch Rebuild whenever a content file changes\n --concurrency <n> How many images to render at once\n --size <name> Which configured size preview renders\n -h, --help Show this help\n\nDefaults:\n contentDir content\n --concurrency one per available CPU\n --size the first configured size\n\nRendering happens on the libuv thread pool, four threads deep unless\nUV_THREADPOOL_SIZE says otherwise. A higher concurrency than that queues, and\nthe build warns. Raise the pool by setting the variable in the environment.\n\nThe first argument is a command where it names one, so a content directory\ncalled init, preview or eject has to be written as ./init.";
|
|
3
3
|
//# sourceMappingURL=usage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/args/usage.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/args/usage.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,KAAK,ywDAmCyC,CAAC"}
|
package/dist/cli/args/usage.js
CHANGED
|
@@ -29,6 +29,10 @@ Defaults:
|
|
|
29
29
|
--concurrency one per available CPU
|
|
30
30
|
--size the first configured size
|
|
31
31
|
|
|
32
|
+
Rendering happens on the libuv thread pool, four threads deep unless
|
|
33
|
+
UV_THREADPOOL_SIZE says otherwise. A higher concurrency than that queues, and
|
|
34
|
+
the build warns. Raise the pool by setting the variable in the environment.
|
|
35
|
+
|
|
32
36
|
The first argument is a command where it names one, so a content directory
|
|
33
37
|
called init, preview or eject has to be written as ./init.`;
|
|
34
38
|
//# sourceMappingURL=usage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/cli/args/usage.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/cli/args/usage.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DAmCsC,CAAC"}
|
package/dist/generate/index.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export type { GeneratedImage, GenerateOptions } from "./options.js";
|
|
|
13
13
|
* everything. Sizes with no image to render are never rasterised.
|
|
14
14
|
*
|
|
15
15
|
* Rendering runs `concurrency` images at a time rather than all of them, so a
|
|
16
|
-
* large tree does not start hundreds of rasterisations at once.
|
|
16
|
+
* large tree does not start hundreds of rasterisations at once. How many of
|
|
17
|
+
* those make progress at a time is the libuv thread pool's business, and a
|
|
18
|
+
* build asking for more than the pool has says so in a warning. See
|
|
19
|
+
* {@link GenerateOptions.concurrency}.
|
|
17
20
|
*
|
|
18
21
|
* `dryRun` stops short of writing: the plan is built and the stamps are read,
|
|
19
22
|
* so the results say which images are out of date, but nothing is rendered and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC,CAgC3B"}
|
package/dist/generate/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { readImageStamp } from "../stamp/index.js";
|
|
|
4
4
|
import { resolveConcurrency } from "./options.js";
|
|
5
5
|
import { planBuild } from "./plan.js";
|
|
6
6
|
import { renderImage } from "./render-image.js";
|
|
7
|
+
import { warnIfPoolIsSmaller } from "./thread-pool.js";
|
|
7
8
|
export { defaultOutputPath } from "./output-path.js";
|
|
8
9
|
/**
|
|
9
10
|
* Walk a content tree and render meta images for every file that declares
|
|
@@ -17,7 +18,10 @@ export { defaultOutputPath } from "./output-path.js";
|
|
|
17
18
|
* everything. Sizes with no image to render are never rasterised.
|
|
18
19
|
*
|
|
19
20
|
* Rendering runs `concurrency` images at a time rather than all of them, so a
|
|
20
|
-
* large tree does not start hundreds of rasterisations at once.
|
|
21
|
+
* large tree does not start hundreds of rasterisations at once. How many of
|
|
22
|
+
* those make progress at a time is the libuv thread pool's business, and a
|
|
23
|
+
* build asking for more than the pool has says so in a warning. See
|
|
24
|
+
* {@link GenerateOptions.concurrency}.
|
|
21
25
|
*
|
|
22
26
|
* `dryRun` stops short of writing: the plan is built and the stamps are read,
|
|
23
27
|
* so the results say which images are out of date, but nothing is rendered and
|
|
@@ -26,6 +30,7 @@ export { defaultOutputPath } from "./output-path.js";
|
|
|
26
30
|
export async function generate(options) {
|
|
27
31
|
const concurrency = resolveConcurrency(options.concurrency);
|
|
28
32
|
const plan = await planBuild(options);
|
|
33
|
+
warnIfPoolIsSmaller(concurrency, plan.config.onWarning);
|
|
29
34
|
const results = await mapConcurrent(plan.jobs, concurrency, async (job) => {
|
|
30
35
|
const isSkipped = options.overwrite !== true &&
|
|
31
36
|
(await readImageStamp(job.outputPath)) === job.stamp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAwB;IAExB,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IACtC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAExD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACxE,MAAM,SAAS,GACb,OAAO,CAAC,SAAS,KAAK,IAAI;YAC1B,CAAC,MAAM,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC;QAEvD,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;YAC1C,MAAM,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QAED,MAAM,MAAM,GAAmB;YAC7B,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,OAAO,EAAE,SAAS;SACnB,CAAC;QACF,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,0EAA0E;IAC1E,kEAAkE;IAClE,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAC5B,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -51,6 +51,14 @@ export interface GenerateOptions {
|
|
|
51
51
|
/**
|
|
52
52
|
* How many images to render at once. Defaults to the number of CPUs the
|
|
53
53
|
* process can use. Must be a positive integer.
|
|
54
|
+
*
|
|
55
|
+
* The parts of a render that take real time (the rasteriser, the PNG
|
|
56
|
+
* recompression and the quantiser) all run on the libuv thread pool. That
|
|
57
|
+
* pool has four threads unless `UV_THREADPOOL_SIZE` says otherwise, so on a
|
|
58
|
+
* machine with more cores than that a higher concurrency only queues work
|
|
59
|
+
* up. libuv sizes the pool from the environment before the process starts,
|
|
60
|
+
* and a build can only read it. Where the pool is the smaller of the two,
|
|
61
|
+
* `generate` warns.
|
|
54
62
|
*/
|
|
55
63
|
readonly concurrency?: number;
|
|
56
64
|
/** Called after each image is written or skipped. */
|
|
@@ -61,6 +69,12 @@ export interface GenerateOptions {
|
|
|
61
69
|
* the process can actually use. Rasterising is CPU-bound, so starting more
|
|
62
70
|
* than that only queues the work up while holding every pending image in
|
|
63
71
|
* memory.
|
|
72
|
+
*
|
|
73
|
+
* The real ceiling is the smaller of this and the libuv thread pool. That
|
|
74
|
+
* pool holds four threads unless `UV_THREADPOOL_SIZE` was set in the
|
|
75
|
+
* environment, so the default here is reached on a machine of four cores or
|
|
76
|
+
* fewer, or with the pool sized to match. `generate` warns where the two
|
|
77
|
+
* disagree.
|
|
64
78
|
*/
|
|
65
79
|
export declare function resolveConcurrency(concurrency: number | undefined): number;
|
|
66
80
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/generate/options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;I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,cAAc,CAAC;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACzC,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC;IACtE;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAY1E"}
|
package/dist/generate/options.js
CHANGED
|
@@ -4,6 +4,12 @@ import { availableParallelism } from "node:os";
|
|
|
4
4
|
* the process can actually use. Rasterising is CPU-bound, so starting more
|
|
5
5
|
* than that only queues the work up while holding every pending image in
|
|
6
6
|
* memory.
|
|
7
|
+
*
|
|
8
|
+
* The real ceiling is the smaller of this and the libuv thread pool. That
|
|
9
|
+
* pool holds four threads unless `UV_THREADPOOL_SIZE` was set in the
|
|
10
|
+
* environment, so the default here is reached on a machine of four cores or
|
|
11
|
+
* fewer, or with the pool sized to match. `generate` warns where the two
|
|
12
|
+
* disagree.
|
|
7
13
|
*/
|
|
8
14
|
export function resolveConcurrency(concurrency) {
|
|
9
15
|
if (concurrency === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/generate/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/generate/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAuE/C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAA+B;IAChE,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,uBAAuB,MAAM,CAAC,WAAW,CAAC,gCAAgC,CAC3E,CAAC;IACJ,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/generate/plan.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PlannedManifest } from "../manifest/index.js";
|
|
2
2
|
import type { Stamper } from "../stamp/index.js";
|
|
3
|
+
import type { ResolvedConfig } from "../types.js";
|
|
3
4
|
import type { RenderJob } from "./job.js";
|
|
4
5
|
import type { GenerateOptions } from "./options.js";
|
|
5
6
|
/**
|
|
@@ -9,6 +10,13 @@ import type { GenerateOptions } from "./options.js";
|
|
|
9
10
|
export interface BuildPlan {
|
|
10
11
|
readonly jobs: readonly RenderJob[];
|
|
11
12
|
readonly stamper: Stamper;
|
|
13
|
+
/**
|
|
14
|
+
* The build's own config, before any per-size overrides. Where a build has
|
|
15
|
+
* something to say about the run as a whole, this is where its `onWarning`
|
|
16
|
+
* comes from. The per-image handler lives on each job, and a tree with no
|
|
17
|
+
* images to render has no job to take one from.
|
|
18
|
+
*/
|
|
19
|
+
readonly config: ResolvedConfig;
|
|
12
20
|
/** What to write down about the build, where a config asked for it. */
|
|
13
21
|
readonly manifest: PlannedManifest | undefined;
|
|
14
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/generate/plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/generate/plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAMpD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;CAChD;AAqBD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAoD5E"}
|
package/dist/generate/plan.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/generate/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,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,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ;SAChD,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC3B,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;IAE1D,OAAO;QACL,IAAI,EAAE,GAAG;QACT,OAAO;QACP,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WarningHandler } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* How many threads this process's libuv pool has.
|
|
4
|
+
*
|
|
5
|
+
* The pool is sized once from the environment, the first time anything asks it
|
|
6
|
+
* to do work. A `process.env.UV_THREADPOOL_SIZE` written from inside the
|
|
7
|
+
* process arrives after that moment and changes nothing. This function only
|
|
8
|
+
* reads.
|
|
9
|
+
*
|
|
10
|
+
* libuv reads the setting with `atoi` and treats a zero as unset, and an
|
|
11
|
+
* unparseable value gives it a zero. Anything short of a positive integer
|
|
12
|
+
* therefore reads back here as the default.
|
|
13
|
+
*/
|
|
14
|
+
export declare function threadPoolSize(setting?: string | undefined): number;
|
|
15
|
+
/**
|
|
16
|
+
* A warner that says the concurrency a build asked for is above what the
|
|
17
|
+
* thread pool can serve, and says it once.
|
|
18
|
+
*
|
|
19
|
+
* Once, because the ceiling belongs to the process. A watch rebuilding on
|
|
20
|
+
* every content change would otherwise repeat the same line all day, and no
|
|
21
|
+
* build can act on it while it runs. The state lives in the returned function,
|
|
22
|
+
* so a test can hold one of its own and the shared warner stays shared.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createThreadPoolWarner(): (concurrency: number, onWarning: WarningHandler, poolSize?: number) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Tell a build that its concurrency is capped by the thread pool. One warner
|
|
27
|
+
* for the process, so every build in it shares the one warning.
|
|
28
|
+
*/
|
|
29
|
+
export declare const warnIfPoolIsSmaller: (concurrency: number, onWarning: WarningHandler, poolSize?: number) => void;
|
|
30
|
+
//# sourceMappingURL=thread-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-pool.d.ts","sourceRoot":"","sources":["../../src/generate/thread-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASlD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,GAAG,SAA6C,GAC9D,MAAM,CAQR;AAcD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,CACxC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,cAAc,EACzB,QAAQ,CAAC,EAAE,MAAM,KACd,IAAI,CAWR;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gBApBjB,MAAM,aACR,cAAc,aACd,MAAM,KACd,IAiBsD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many threads libuv starts when `UV_THREADPOOL_SIZE` says nothing, and
|
|
3
|
+
* the largest pool it will build however big the setting is.
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_POOL_SIZE = 4;
|
|
6
|
+
const MAX_POOL_SIZE = 1024;
|
|
7
|
+
/**
|
|
8
|
+
* How many threads this process's libuv pool has.
|
|
9
|
+
*
|
|
10
|
+
* The pool is sized once from the environment, the first time anything asks it
|
|
11
|
+
* to do work. A `process.env.UV_THREADPOOL_SIZE` written from inside the
|
|
12
|
+
* process arrives after that moment and changes nothing. This function only
|
|
13
|
+
* reads.
|
|
14
|
+
*
|
|
15
|
+
* libuv reads the setting with `atoi` and treats a zero as unset, and an
|
|
16
|
+
* unparseable value gives it a zero. Anything short of a positive integer
|
|
17
|
+
* therefore reads back here as the default.
|
|
18
|
+
*/
|
|
19
|
+
export function threadPoolSize(setting = process.env["UV_THREADPOOL_SIZE"]) {
|
|
20
|
+
const parsed = Number(setting);
|
|
21
|
+
if (!Number.isSafeInteger(parsed) || parsed < 1) {
|
|
22
|
+
return DEFAULT_POOL_SIZE;
|
|
23
|
+
}
|
|
24
|
+
return Math.min(parsed, MAX_POOL_SIZE);
|
|
25
|
+
}
|
|
26
|
+
/** What to say about a concurrency the pool is too small to serve. */
|
|
27
|
+
function message(concurrency, poolSize) {
|
|
28
|
+
return (`Rendering ${String(concurrency)} images at once, but the libuv thread` +
|
|
29
|
+
` pool has ${String(poolSize)} threads. Rasterising, PNG recompression` +
|
|
30
|
+
` and quantising all run on that pool, so only ${String(poolSize)}` +
|
|
31
|
+
" renders make progress at a time. Set" +
|
|
32
|
+
` UV_THREADPOOL_SIZE=${String(concurrency)} in the environment before the` +
|
|
33
|
+
" process starts to lift the ceiling.");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A warner that says the concurrency a build asked for is above what the
|
|
37
|
+
* thread pool can serve, and says it once.
|
|
38
|
+
*
|
|
39
|
+
* Once, because the ceiling belongs to the process. A watch rebuilding on
|
|
40
|
+
* every content change would otherwise repeat the same line all day, and no
|
|
41
|
+
* build can act on it while it runs. The state lives in the returned function,
|
|
42
|
+
* so a test can hold one of its own and the shared warner stays shared.
|
|
43
|
+
*/
|
|
44
|
+
export function createThreadPoolWarner() {
|
|
45
|
+
let hasWarned = false;
|
|
46
|
+
return (concurrency, onWarning, poolSize = threadPoolSize()) => {
|
|
47
|
+
if (hasWarned || concurrency <= poolSize) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
hasWarned = true;
|
|
51
|
+
onWarning(message(concurrency, poolSize));
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Tell a build that its concurrency is capped by the thread pool. One warner
|
|
56
|
+
* for the process, so every build in it shares the one warning.
|
|
57
|
+
*/
|
|
58
|
+
export const warnIfPoolIsSmaller = createThreadPoolWarner();
|
|
59
|
+
//# sourceMappingURL=thread-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-pool.js","sourceRoot":"","sources":["../../src/generate/thread-pool.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAO,GAAuB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAE/D,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACzC,CAAC;AAED,sEAAsE;AACtE,SAAS,OAAO,CAAC,WAAmB,EAAE,QAAgB;IACpD,OAAO,CACL,aAAa,MAAM,CAAC,WAAW,CAAC,uCAAuC;QACvE,aAAa,MAAM,CAAC,QAAQ,CAAC,0CAA0C;QACvE,iDAAiD,MAAM,CAAC,QAAQ,CAAC,EAAE;QACnE,uCAAuC;QACvC,uBAAuB,MAAM,CAAC,WAAW,CAAC,gCAAgC;QAC1E,sCAAsC,CACvC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB;IAKpC,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,GAAG,cAAc,EAAE,EAAE,EAAE;QAC7D,IAAI,SAAS,IAAI,WAAW,IAAI,QAAQ,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;QAED,SAAS,GAAG,IAAI,CAAC;QACjB,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"repository": "https://github.com/KensioSoftware/colophon",
|
|
6
6
|
"homepage": "https://github.com/KensioSoftware/colophon#readme",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"version": "2.15.
|
|
8
|
+
"version": "2.15.4",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
96
96
|
"dejavu-fonts-ttf": "^2.37.3",
|
|
97
97
|
"fta-cli": "^3.0.0",
|
|
98
|
-
"oxfmt": "^0.
|
|
98
|
+
"oxfmt": "^0.63.0",
|
|
99
99
|
"oxlint": "^1.77.0",
|
|
100
100
|
"oxlint-tsgolint": "^7.0.2001",
|
|
101
101
|
"semantic-release": "25.0.9",
|