brrrty 0.0.0-stage → 0.0.11

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.
Files changed (5) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +304 -0
  3. package/README.md +44 -2
  4. package/bin/brrrty +136 -0
  5. package/package.json +34 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Josh Sherman and Brrrty contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,304 @@
1
+ Brrrty is a Rust port inspired by and derived from Eleventy (11ty),
2
+ https://www.11ty.dev/, which is MIT licensed:
3
+
4
+ Copyright (c) 2017–2024 Zach Leatherman @zachleat
5
+
6
+ Thank you to Zach and the Eleventy community for the model this project
7
+ builds on.
8
+
9
+ Brrrty also reproduces the behavior of, and ports code or data from, the
10
+ projects below. Each is credited with its copyright notice and license.
11
+
12
+ ======================================================================
13
+ MIT License
14
+ ======================================================================
15
+
16
+ These projects are released under the MIT License. Their notices:
17
+
18
+ - Eleventy (11ty) 3.1.8, https://www.11ty.dev/: the build model, its
19
+ `slug`, `slugify` and `url` filters, pagination and the HTML `<base>`
20
+ plugin
21
+ Copyright (c) 2017–2024 Zach Leatherman @zachleat
22
+
23
+ - @11ty/eleventy-plugin-rss 3.1.0: the feed plugin and its virtual templates
24
+ Copyright (c) 2018 Zach Leatherman @zachleat
25
+
26
+ - @11ty/eleventy-plugin-syntaxhighlight 5.0.2: fenced code and the
27
+ `{% highlight %}` tag, its language aliases, line highlights and
28
+ attributes
29
+ Copyright (c) 2018 Zach Leatherman @zachleat
30
+
31
+ - LiquidJS 10.30.1: the Liquid tokenizer, parser, tags and standard filters
32
+ Copyright (c) 2016 Jun Yang
33
+
34
+ - markdown-it 14.3.3 and 15.0.3: Markdown rendering behavior
35
+ Copyright (c) 2014 Vitaly Puzrin, Alex Kocharin.
36
+
37
+ - Luxon 3.7.2: the `toFormat` date formatter
38
+ Copyright 2019 JS Foundation and other contributors
39
+
40
+ - posthtml 0.16.7
41
+ Copyright (c) 2015 PostHTML
42
+
43
+ - posthtml-parser 0.11.0
44
+ Copyright (c) 2015 Ivan Voischev <voischev.ivan@ya.ru>
45
+
46
+ - posthtml-render 3.0.0
47
+ Copyright (c) 2017 Ivan Voischev <voischev.ivan@ya.ru>
48
+
49
+ - htmlparser2 7.2.0: the tokenizer and tree building behind posthtml-parser
50
+ Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
51
+
52
+ - @11ty/posthtml-urls 1.0.3
53
+ Copyright (c) 2019 Steven Vachon
54
+
55
+ - parse-srcset 1.0.2
56
+ Copyright (c) 2014 Alex Bell
57
+
58
+ - picomatch 4.0.7: glob matching for `getFilteredByGlob`
59
+ Copyright (c) 2017-present, Jon Schlinkert.
60
+
61
+ - js-yaml 4: front matter scalar resolution
62
+ Copyright (C) 2011-2015 by Vitaly Puzrin
63
+
64
+ - slugify 1.6.9: the `slug` filter and its character map
65
+ Copyright (c) Simeon Velichkov <simeonvelichkov@gmail.com>
66
+
67
+ - @sindresorhus/slugify 2.2.1 and @sindresorhus/transliterate 1.6.0:
68
+ the `slugify` filter and its tables
69
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
70
+
71
+ - Prism 1.30.0, https://prismjs.com/: the language grammars and their
72
+ regular expressions (brrrty-prism's grammars/prism.json is dumped from
73
+ them), the tokenizer, hooks and highlighting behavior, and the code of
74
+ its test fixtures (in brrrty-prism's tests/probes/highlight)
75
+ Copyright (c) 2012 Lea Verou
76
+
77
+ - @11ty/eleventy-dev-server 2.1.2: `brrrty serve`'s live-reload client, the
78
+ script's place in the page, and the server's behavior
79
+ Copyright (c) Zach Leatherman @zachleat (MIT, per its package.json)
80
+
81
+ - morphdom 2.7.8: patches a page in place on live reload (bundled unchanged)
82
+ Copyright (c) Patrick Steele-Idem <pnidem@gmail.com> (psteeleidem.com)
83
+
84
+ Each is provided under these terms:
85
+
86
+ Permission is hereby granted, free of charge, to any person obtaining a copy
87
+ of this software and associated documentation files (the "Software"), to deal
88
+ in the Software without restriction, including without limitation the rights
89
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
90
+ copies of the Software, and to permit persons to whom the Software is
91
+ furnished to do so, subject to the following conditions:
92
+
93
+ The above copyright notice and this permission notice shall be included in all
94
+ copies or substantial portions of the Software.
95
+
96
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
97
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
98
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
99
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
101
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
102
+ SOFTWARE.
103
+
104
+ ======================================================================
105
+ ISC License
106
+ ======================================================================
107
+
108
+ - is-json 2.0.1: how posthtml-render decides an attribute holds JSON
109
+
110
+ The ISC License
111
+
112
+ Copyright (c) Joaquim José F. Serafim
113
+
114
+ Permission to use, copy, modify, and/or distribute this software for any
115
+ purpose with or without fee is hereby granted, provided that the above
116
+ copyright notice and this permission notice appear in all copies.
117
+
118
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
119
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
120
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
121
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
122
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
123
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
124
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
125
+
126
+ ======================================================================
127
+ BSD 2-Clause License
128
+ ======================================================================
129
+
130
+ - Nunjucks 3.2.4, https://mozilla.github.io/nunjucks/: the lexer and
131
+ parser (src/lexer.js, src/parser.js) and the shape of its syntax tree
132
+
133
+ Copyright (c) 2012-2015, James Long
134
+ All rights reserved.
135
+
136
+ Redistribution and use in source and binary forms, with or without
137
+ modification, are permitted provided that the following conditions are
138
+ met:
139
+
140
+ Redistributions of source code must retain the above copyright
141
+ notice, this list of conditions and the following disclaimer.
142
+
143
+ Redistributions in binary form must reproduce the above copyright
144
+ notice, this list of conditions and the following disclaimer in
145
+ the documentation and/or other materials provided with the
146
+ distribution.
147
+
148
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
149
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
150
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
151
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
152
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
153
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
154
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
155
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
156
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
157
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
158
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
159
+
160
+ Brrrty's changes: the lexer and parser are written in Rust, with the
161
+ same steps; `elif` chains are kept as a flat list; and tags and
162
+ expressions may nest at most 256 levels deep.
163
+
164
+ ======================================================================
165
+ BSD 3-Clause License (V8)
166
+ ======================================================================
167
+
168
+ - V8 14.6.202 (the JavaScript engine in Node 26): the `Array.prototype.sort`
169
+ TimSort (third_party/v8/builtins/array-sort.tq) and the `Date` string
170
+ parser
171
+
172
+ Copyright 2014, the V8 project authors. All rights reserved.
173
+ Redistribution and use in source and binary forms, with or without
174
+ modification, are permitted provided that the following conditions are
175
+ met:
176
+
177
+ * Redistributions of source code must retain the above copyright
178
+ notice, this list of conditions and the following disclaimer.
179
+ * Redistributions in binary form must reproduce the above
180
+ copyright notice, this list of conditions and the following
181
+ disclaimer in the documentation and/or other materials provided
182
+ with the distribution.
183
+ * Neither the name of Google Inc. nor the names of its
184
+ contributors may be used to endorse or promote products derived
185
+ from this software without specific prior written permission.
186
+
187
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
188
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
190
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
191
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
192
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
193
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
194
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
195
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
196
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
197
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
198
+
199
+ ======================================================================
200
+ Python Software Foundation License Version 2
201
+ ======================================================================
202
+
203
+ - V8's array-sort.tq is itself a port of CPython's listobject.c TimSort:
204
+
205
+ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
206
+ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Python Software Foundation;
207
+ All Rights Reserved
208
+
209
+ Brrrty's change: the algorithm is written in Rust instead of Torque and C,
210
+ with the same comparisons and moves.
211
+
212
+ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
213
+ --------------------------------------------
214
+
215
+ 1. This LICENSE AGREEMENT is between the Python Software Foundation
216
+ ("PSF"), and the Individual or Organization ("Licensee") accessing and
217
+ otherwise using this software ("Python") in source or binary form and
218
+ its associated documentation.
219
+
220
+ 2. Subject to the terms and conditions of this License Agreement, PSF hereby
221
+ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
222
+ analyze, test, perform and/or display publicly, prepare derivative works,
223
+ distribute, and otherwise use Python alone or in any derivative version,
224
+ provided, however, that PSF's License Agreement and PSF's notice of copyright,
225
+ i.e., "Copyright (c) 2001 Python Software Foundation; All Rights Reserved"
226
+ are retained in Python alone or in any derivative version prepared by Licensee.
227
+
228
+ 3. In the event Licensee prepares a derivative work that is based on
229
+ or incorporates Python or any part thereof, and wants to make
230
+ the derivative work available to others as provided herein, then
231
+ Licensee hereby agrees to include in any such work a brief summary of
232
+ the changes made to Python.
233
+
234
+ 4. PSF is making Python available to Licensee on an "AS IS"
235
+ basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
236
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
237
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
238
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
239
+ INFRINGE ANY THIRD PARTY RIGHTS.
240
+
241
+ 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
242
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
243
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
244
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
245
+
246
+ 6. This License Agreement will automatically terminate upon a material
247
+ breach of its terms and conditions.
248
+
249
+ 7. Nothing in this License Agreement shall be deemed to create any
250
+ relationship of agency, partnership, or joint venture between PSF and
251
+ Licensee. This License Agreement does not grant permission to use PSF
252
+ trademarks or trade name in a trademark sense to endorse or promote
253
+ products or services of Licensee, or any third party.
254
+
255
+ 8. By copying, installing or otherwise using Python, Licensee
256
+ agrees to be bound by the terms and conditions of this License
257
+ Agreement.
258
+
259
+ ======================================================================
260
+ Unicode License V3 (ICU)
261
+ ======================================================================
262
+
263
+ - ICU 78.3, as Node 26 ships it: the time zone name tables generated into
264
+ brrrty-js/src/zones.rs and brrrty-core/src/helpers/luxon_zones.rs
265
+
266
+ UNICODE LICENSE V3
267
+
268
+ COPYRIGHT AND PERMISSION NOTICE
269
+
270
+ Copyright © 2016-2025 Unicode, Inc.
271
+
272
+ NOTICE TO USER: Carefully read the following legal agreement. BY
273
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
274
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
275
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
276
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
277
+
278
+ Permission is hereby granted, free of charge, to any person obtaining a
279
+ copy of data files and any associated documentation (the "Data Files") or
280
+ software and any associated documentation (the "Software") to deal in the
281
+ Data Files or Software without restriction, including without limitation
282
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
283
+ copies of the Data Files or Software, and to permit persons to whom the
284
+ Data Files or Software are furnished to do so, provided that either (a)
285
+ this copyright and permission notice appear with all copies of the Data
286
+ Files or Software, or (b) this copyright and permission notice appear in
287
+ associated Documentation.
288
+
289
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
290
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
291
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
292
+ THIRD PARTY RIGHTS.
293
+
294
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
295
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
296
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
297
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
298
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
299
+ FILES OR SOFTWARE.
300
+
301
+ Except as contained in this notice, the name of a copyright holder shall
302
+ not be used in advertising or otherwise to promote the sale, use or other
303
+ dealings in these Data Files or Software without prior written
304
+ authorization of the copyright holder.
package/README.md CHANGED
@@ -1,3 +1,45 @@
1
- # Temporary Holding Version
1
+ # Brrrty
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Eleventy, but make it go brrr.**
4
+
5
+ Brrrty is a fast, independent static site generator written in Rust that aims to build your existing 11ty site unchanged. Three Rs, like "go brrr".
6
+
7
+ Status: early development. See the [repository](https://github.com/brrrty/brrrty) for what works today.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install --save-dev brrrty
13
+ ```
14
+
15
+ Then point your scripts at it:
16
+
17
+ ```json
18
+ "scripts": {
19
+ "build": "brrrty build",
20
+ "start": "brrrty serve"
21
+ }
22
+ ```
23
+
24
+ Or run it once with `npx brrrty build`.
25
+
26
+ ## How it is installed
27
+
28
+ This package is a small launcher. The Brrrty binary comes prebuilt in a package for your platform, which npm picks from this package's optional dependencies:
29
+
30
+ | Platform | Package |
31
+ |---|---|
32
+ | macOS, Apple Silicon | `@brrrty/darwin-arm64` |
33
+ | macOS, Intel | `@brrrty/darwin-x64` |
34
+ | Linux, arm64 | `@brrrty/linux-arm64-musl` |
35
+ | Linux, x64 | `@brrrty/linux-x64-musl` |
36
+
37
+ The Linux binaries are static, so they run on Alpine and on glibc distributions alike. Nothing is downloaded or compiled at install time and there are no install scripts, so `npm ci --ignore-scripts` works. Installs that skip optional dependencies (`--omit=optional`) leave the binary out, and `brrrty` says so when it runs.
38
+
39
+ On other platforms, build Brrrty from source with `cargo install brrrty`.
40
+
41
+ The launcher passes arguments, input and output through unchanged and exits with the binary's exit status. Ctrl-C, Ctrl-\\ and SIGTERM reach the binary, so `brrrty serve` stops cleanly under `npm run` and `npx`, and if the launcher itself is killed, `brrrty serve` stops on its own. Ctrl-Z suspends npm and the launcher but not `brrrty serve`, which keeps serving until you resume and stop it.
42
+
43
+ ## License
44
+
45
+ MIT
package/bin/brrrty ADDED
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Runs the prebuilt Brrrty binary from the platform package npm installed
5
+ // alongside this one (one of the optionalDependencies). Arguments, stdio and
6
+ // the environment go through unchanged, and the binary's exit status comes
7
+ // back out: the same code, or death by the same signal.
8
+
9
+ const childProcess = require('child_process');
10
+ const path = require('path');
11
+
12
+ // `${process.platform}-${process.arch}` to the package with that binary.
13
+ // Linux binaries are static (musl), so one package serves Alpine and glibc
14
+ // distros alike.
15
+ const PACKAGES = {
16
+ 'darwin-arm64': '@brrrty/darwin-arm64',
17
+ 'darwin-x64': '@brrrty/darwin-x64',
18
+ 'linux-arm64': '@brrrty/linux-arm64-musl',
19
+ 'linux-x64': '@brrrty/linux-x64-musl',
20
+ };
21
+
22
+ // Signals passed on to the binary: every one that would end it and that Node
23
+ // can catch. (Node reserves SIGUSR1 for its debugger. SIGKILL can't be caught,
24
+ // so the binary watches for this process to go away instead; see
25
+ // LAUNCHER_PID_VAR.)
26
+ const FORWARDED = ['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGTERM', 'SIGUSR2', 'SIGALRM'];
27
+
28
+ // Set to this process's id for the binary, which then stops by itself (as on
29
+ // SIGTERM) once this process is gone, even when it was killed with SIGKILL.
30
+ const LAUNCHER_PID_VAR = 'BRRRTY_LAUNCHER_PID';
31
+
32
+ // Ctrl-C under `npm run` or `npx` reaches this process twice: once from the
33
+ // terminal and once from npm, which forwards it. Copies of a signal that come
34
+ // within this many milliseconds of the last one passed on count as one, so the
35
+ // binary sees one Ctrl-C per keypress (its second Ctrl-C means "quit now").
36
+ const COALESCE_MS = 200;
37
+
38
+ class LauncherError extends Error {}
39
+
40
+ function platformKey(platform, arch) {
41
+ return `${platform}-${arch}`;
42
+ }
43
+
44
+ // The path of the binary for this platform, or a LauncherError saying why
45
+ // there is none.
46
+ function binaryPath(platform = process.platform, arch = process.arch, resolve = require.resolve) {
47
+ const key = platformKey(platform, arch);
48
+ const pkg = PACKAGES[key];
49
+ if (!pkg) {
50
+ throw new LauncherError(
51
+ `brrrty: there is no prebuilt Brrrty binary for ${key}. ` +
52
+ `Prebuilt binaries cover ${Object.keys(PACKAGES).join(', ')}. ` +
53
+ 'On other platforms, build Brrrty from source with `cargo install brrrty`.',
54
+ );
55
+ }
56
+ let manifest;
57
+ try {
58
+ manifest = resolve(`${pkg}/package.json`);
59
+ } catch {
60
+ throw new LauncherError(
61
+ `brrrty: the Brrrty binary for ${key} comes in the package ${pkg}, which is not installed. ` +
62
+ 'npm installs it as an optional dependency of brrrty, so it is left out when optional ' +
63
+ 'dependencies are skipped (--omit=optional, --no-optional) or when the lockfile was ' +
64
+ `made without it. Reinstall with optional dependencies, or add ${pkg} yourself.`,
65
+ );
66
+ }
67
+ return path.join(path.dirname(manifest), 'bin', 'brrrty');
68
+ }
69
+
70
+ // Runs the binary, passes signals on, and ends this process the way the
71
+ // binary ended.
72
+ function run(bin, args, { coalesceMs = COALESCE_MS } = {}) {
73
+ // On Unix the binary gets a session of its own (`detached` calls setsid),
74
+ // so a Ctrl-C at the terminal reaches it only through this process and
75
+ // arrives once. It has no controlling terminal: it can't open /dev/tty.
76
+ const child = childProcess.spawn(bin, args, {
77
+ stdio: 'inherit',
78
+ detached: process.platform !== 'win32',
79
+ env: { ...process.env, [LAUNCHER_PID_VAR]: String(process.pid) },
80
+ });
81
+
82
+ const lastSent = new Map();
83
+ const handlers = new Map();
84
+ for (const signal of FORWARDED) {
85
+ const handler = () => {
86
+ // A monotonic clock, so a wall-clock step can't swallow signals.
87
+ const now = performance.now();
88
+ const last = lastSent.get(signal);
89
+ if (last !== undefined && now - last < coalesceMs) return;
90
+ lastSent.set(signal, now);
91
+ try {
92
+ child.kill(signal);
93
+ } catch {
94
+ // Already gone; its exit is on the way.
95
+ }
96
+ };
97
+ handlers.set(signal, handler);
98
+ process.on(signal, handler);
99
+ }
100
+
101
+ child.on('error', (err) => {
102
+ process.stderr.write(`brrrty: could not run ${bin}: ${err.message}\n`);
103
+ process.exit(1);
104
+ });
105
+
106
+ child.on('exit', (code, signal) => {
107
+ for (const [sig, handler] of handlers) process.removeListener(sig, handler);
108
+ if (signal) {
109
+ // End by the same signal, so whoever started us sees what we saw.
110
+ process.kill(process.pid, signal);
111
+ // Only reached if the signal is ignored or handled elsewhere.
112
+ const number = require('os').constants.signals[signal] || 0;
113
+ setTimeout(() => process.exit(128 + number), 100);
114
+ return;
115
+ }
116
+ process.exit(code);
117
+ });
118
+ }
119
+
120
+ function main() {
121
+ let bin;
122
+ try {
123
+ bin = binaryPath();
124
+ } catch (err) {
125
+ if (!(err instanceof LauncherError)) throw err;
126
+ process.stderr.write(`${err.message}\n`);
127
+ process.exit(1);
128
+ }
129
+ run(bin, process.argv.slice(2));
130
+ }
131
+
132
+ if (require.main === module) {
133
+ main();
134
+ }
135
+
136
+ module.exports = { PACKAGES, FORWARDED, LAUNCHER_PID_VAR, LauncherError, binaryPath, run };
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "brrrty",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.11",
4
+ "description": "Eleventy, but make it go brrr. A fast static site generator, written in Rust, that builds your existing 11ty site.",
5
+ "keywords": [
6
+ "static-site",
7
+ "ssg",
8
+ "eleventy",
9
+ "11ty",
10
+ "site-generator"
11
+ ],
12
+ "homepage": "https://brrrty.com",
13
+ "bugs": "https://github.com/brrrty/brrrty/issues",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/brrrty/brrrty.git",
17
+ "directory": "npm/brrrty"
18
+ },
19
+ "license": "MIT",
20
+ "bin": {
21
+ "brrrty": "bin/brrrty"
22
+ },
23
+ "files": [
24
+ "bin/",
25
+ "NOTICE"
26
+ ],
27
+ "engines": {
28
+ "node": ">=18"
29
+ },
30
+ "optionalDependencies": {
31
+ "@brrrty/darwin-arm64": "0.0.11",
32
+ "@brrrty/darwin-x64": "0.0.11",
33
+ "@brrrty/linux-arm64-musl": "0.0.11",
34
+ "@brrrty/linux-x64-musl": "0.0.11"
35
+ }
36
+ }