@amagaki/amagaki 3.1.2 → 4.1.0

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/README.md CHANGED
@@ -1,70 +1,74 @@
1
1
  # Amagaki
2
2
 
3
- [![NPM Version][npm-image]][npm-url]
4
- [![GitHub Actions][github-image]][github-url]
5
- [![codecov][codecov-image]][codecov-url]
6
- [![TypeScript Style Guide][gts-image]][gts-url]
7
-
8
- Amagaki is a marketing website generator. It's written in TypeScript and TS is a
9
- first-class citizen. It's specifically built for hand-coding marketing and
10
- informational websites. Flexible URLs, benchmarking, localization, a plugin
11
- system, and multiple template engines are all built-in.
12
-
13
- Amagaki takes concepts from [Grow.dev](https://github.com/grow/grow) and evolves
14
- them to a TypeScript-first ecosystem.
15
-
16
- ## [🍊 Start here with the documentation](https://amagaki.dev)
17
-
18
- ## Key concepts
19
-
20
- - TypeScript and Node
21
- - Minimal core dependencies
22
- - Inbuilt build metrics (memory usage, generated file size, routes, locales,
23
- translations)
24
- - Multiple template languages (Nunjucks as default)
25
- - A static site generator (not a frontend framework)
26
- - Renders pages at request time (unlike other static generators which watch and rebuild)
27
- - Localization is an inbuilt feature
28
- - Custom YAML types for extending the content layer
29
- - Plugin system
30
- - Benchmarking inbuilt
31
-
32
- ## Try it out
33
-
34
- Amagaki is distributed as an npm package. When starting a new site from scratch,
35
- we recommend using `create-amagaki` which uses the official
36
- [`amagaki-starter`](https://github.com/blinkk/amagaki-starter).
37
-
38
- ```shell
39
- # Create a new Amagaki project interactively
40
- npx create-amagaki
41
-
42
- # Start the dev server
43
- npm run dev
3
+ [![npm version](https://img.shields.io/npm/v/@amagaki/amagaki.svg)](https://www.npmjs.com/package/@amagaki/amagaki)
4
+ [![Run tests](https://github.com/blinkk/amagaki/actions/workflows/test-amagaki.yml/badge.svg)](https://github.com/blinkk/amagaki/actions/workflows/test-amagaki.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/blinkk/amagaki/blob/main/LICENSE.md)
6
+
7
+ > [!NOTE]
8
+ > **Maintenance mode:** Amagaki is actively maintained for existing sites with bug fixes and dependency updates, but for new projects we recommend <img src="https://amagaki.dev/static/images/rootjs-beet.svg" width="13" height="19" alt="" align="absmiddle">&nbsp;[**Root.js**](https://rootjs.dev) ([GitHub](https://github.com/blinkk/rootjs)) — our modern successor built with TypeScript, Preact/TSX, file routing, i18n, and a built-in CMS.
9
+
10
+ **Amagaki** is a TypeScript-based static site generator designed for hand-coding marketing and informational websites. It provides flexible URL routing, built-in localization, custom YAML types, an extensible plugin architecture, build profiling, and pluggable template engines.
11
+
12
+ Amagaki takes concepts from [Grow](https://grow.dev) and brings them to a TypeScript and Node.js ecosystem.
13
+
14
+ ## Documentation
15
+
16
+ Read the full documentation and API reference at **[amagaki.dev](https://amagaki.dev)**.
17
+
18
+ ## Key Features
19
+
20
+ - **TypeScript & Node.js**: Write site configuration, plugins, and custom routes in TypeScript with minimal core dependencies.
21
+ - **Data-driven content**: Author structured content in YAML and Markdown with built-in YAML constructors (`!pod.doc`, `!pod.collection`, `!pod.staticFile`, `!pod.string`, `!IfLocale`, `!IfEnvironment`).
22
+ - **Pluggable template engines**: Ships with Nunjucks out of the box and supports registering custom template engines (such as Preact/TSX).
23
+ - **On-demand dev server**: Renders pages on request during development instead of rebuilding the entire site on every edit.
24
+ - **Built-in localization (i18n)**: Manage translatable strings, locale-scoped fields, and localized URLs natively.
25
+ - **Extensible plugin system**: Hook into routing, YAML parsing, template engines, Express dev server middleware, and build lifecycle events.
26
+ - **Built-in profiling**: Inspect memory usage, build times, route counts, and missing translation reports on every build.
27
+
28
+ ## Requirements
29
+
30
+ - Node.js **20+**
31
+
32
+ ## Quick Start
44
33
 
45
- # Build the site
46
- npm run build
34
+ Scaffold a new zero-bundler project from [`examples/starter/`](https://github.com/blinkk/amagaki/tree/main/examples/starter):
35
+
36
+ ```bash
37
+ npx create-amagaki my-site
38
+ cd my-site
39
+ npm run dev
47
40
  ```
48
41
 
49
- If you are integrating into an existing project, you can install Amagaki directly.
42
+ Or install `@amagaki/amagaki` directly in an existing project:
50
43
 
51
- ```shell
52
- # Install Amagaki
44
+ ```bash
53
45
  npm install --save @amagaki/amagaki
54
46
  ```
55
- ## Benchmarks
56
-
57
- You can view the [benchmark
58
- history](https://blinkk.github.io/amagaki/benchmark/) that shows the benchmark
59
- metrics when running `amagaki build` against the
60
- [amagaki-benchmark](https://github.com/blinkk/amagaki-benchmark) test
61
- repository.
62
-
63
- [github-image]: https://github.com/blinkk/amagaki/workflows/Run%20tests/badge.svg
64
- [github-url]: https://github.com/blinkk/amagaki/actions
65
- [codecov-image]: https://codecov.io/gh/blinkk/amagaki/branch/main/graph/badge.svg
66
- [codecov-url]: https://codecov.io/gh/blinkk/amagaki
67
- [gts-image]: https://img.shields.io/badge/code%20style-google-blueviolet.svg
68
- [gts-url]: https://github.com/google/gts
69
- [npm-image]: https://img.shields.io/npm/v/@amagaki/amagaki.svg
70
- [npm-url]: https://npmjs.org/package/@amagaki/amagaki
47
+
48
+ ### Common Commands
49
+
50
+ ```bash
51
+ npx amagaki serve # Start the local development server (default port 8080)
52
+ npx amagaki build # Build the static site to ./build/
53
+ npx amagaki --profile build # Build and print detailed profiling tables
54
+ npx amagaki export -o ./out # Export a build to another directory with diff summary
55
+ ```
56
+
57
+ ## Development
58
+
59
+ This monorepo uses npm workspaces, TypeScript, and AVA:
60
+
61
+ ```bash
62
+ git clone https://github.com/blinkk/amagaki.git
63
+ cd amagaki
64
+ npm ci
65
+ npm run build -w packages/amagaki
66
+ npm run build -w packages/amagaki-plugin-page-builder
67
+ npm run build -w packages/amagaki-engine-preact
68
+ npm run build -w packages/create-amagaki
69
+ npm test --workspaces
70
+ ```
71
+
72
+ ## License
73
+
74
+ [MIT](https://github.com/blinkk/amagaki/blob/main/LICENSE.md)
@@ -0,0 +1,10 @@
1
+ export declare const ansi: {
2
+ blue: (text: string) => string;
3
+ cyan: (text: string) => string;
4
+ gray: (text: string) => string;
5
+ green: (text: string) => string;
6
+ greenBright: (text: string) => string;
7
+ red: (text: string) => string;
8
+ yellow: (text: string) => string;
9
+ };
10
+ export default ansi;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ansi = void 0;
4
+ const useColor = () => process.env.NO_COLOR === undefined &&
5
+ process.env.TERM !== 'dumb' &&
6
+ Boolean(process.stdout.isTTY);
7
+ const wrap = (code) => (text) => useColor() ? `\x1b[${code}m${text}\x1b[39m` : text;
8
+ exports.ansi = {
9
+ blue: wrap(34),
10
+ cyan: wrap(36),
11
+ gray: wrap(90),
12
+ green: wrap(32),
13
+ greenBright: wrap(92),
14
+ red: wrap(31),
15
+ yellow: wrap(33),
16
+ };
17
+ exports.default = exports.ansi;
@@ -1,4 +1,4 @@
1
- import * as cliProgress from 'cli-progress';
1
+ import { ProgressBar } from './progress';
2
2
  import { GitCommit } from './gitData';
3
3
  import { Pod } from './pod';
4
4
  import { TranslationString } from './string';
@@ -18,8 +18,8 @@ export interface BuildDiffPaths {
18
18
  noChanges: Array<string>;
19
19
  deletes: Array<string>;
20
20
  }
21
- declare type LocalesToNumMissingTranslations = Record<string, number>;
22
- declare type LocalesToMissingTranslations = Record<string, TranslationString[]>;
21
+ type LocalesToNumMissingTranslations = Record<string, number>;
22
+ type LocalesToMissingTranslations = Record<string, TranslationString[]>;
23
23
  export interface BuildMetrics {
24
24
  memoryUsage: number;
25
25
  localesToNumMissingTranslations: LocalesToNumMissingTranslations;
@@ -69,7 +69,7 @@ export declare class Builder {
69
69
  deleteOutputFiles(paths: Array<string>, outputRootDir: string): void;
70
70
  getManifest(filePath: string): BuildManifest | null;
71
71
  cleanOutputUsingManifests(existingManifest: BuildManifest | null, newManifest: BuildManifest, options?: BuildOptions): BuildDiffPaths;
72
- static createProgressBar(label: string): cliProgress.SingleBar;
72
+ static createProgressBar(label: string): ProgressBar;
73
73
  export(options: ExportOptions): Promise<BuildDiffPaths>;
74
74
  build(options?: BuildOptions): Promise<BuildResult>;
75
75
  logResult(buildDiff: BuildDiffPaths, buildMetrics: BuildMetrics, options?: BuildOptions): void;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -11,20 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
11
15
  }) : function(o, v) {
12
16
  o["default"] = v;
13
17
  });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
21
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
37
  };
24
38
  Object.defineProperty(exports, "__esModule", { value: true });
25
39
  exports.Builder = void 0;
26
- const async = __importStar(require("async"));
27
- const cliProgress = __importStar(require("cli-progress"));
40
+ const concurrency = __importStar(require("./concurrency"));
41
+ const progress_1 = require("./progress");
28
42
  const crypto = __importStar(require("crypto"));
29
43
  const fs = __importStar(require("fs"));
30
44
  const fsPath = __importStar(require("path"));
@@ -32,8 +46,8 @@ const stream = __importStar(require("stream"));
32
46
  const util = __importStar(require("util"));
33
47
  const utils = __importStar(require("./utils"));
34
48
  const gitData_1 = require("./gitData");
35
- const chalk_1 = __importDefault(require("chalk"));
36
- const minimatch_1 = __importDefault(require("minimatch"));
49
+ const ansi_1 = __importDefault(require("./ansi"));
50
+ const minimatch_1 = require("minimatch");
37
51
  class Builder {
38
52
  constructor(pod) {
39
53
  this.pod = pod;
@@ -197,13 +211,7 @@ class Builder {
197
211
  return buildDiffPaths;
198
212
  }
199
213
  static createProgressBar(label) {
200
- const isTTY = Boolean(process.env.TERM !== 'dumb' && process.stdin.isTTY);
201
- const options = {
202
- format: chalk_1.default.green(`${label} ({value}/{total}): `) +
203
- '{bar} Total: {customDuration}',
204
- noTTYOutput: isTTY,
205
- };
206
- return new cliProgress.SingleBar(options, cliProgress.Presets.shades_classic);
214
+ return new progress_1.ProgressBar(label);
207
215
  }
208
216
  async export(options) {
209
217
  const buildDir = options.buildDir ?? this.pod.getAbsoluteFilePath(this.outputDirectoryPodPath);
@@ -257,14 +265,14 @@ class Builder {
257
265
  }
258
266
  }
259
267
  if (exportManifest?.commit) {
260
- console.log(chalk_1.default.yellow(`Previous export:`), `${exportManifest.built} by ${exportManifest.commit.author.email} (${exportManifest.commit.sha.slice(0, 6)})`);
268
+ console.log(ansi_1.default.yellow(`Previous export:`), `${exportManifest.built} by ${exportManifest.commit.author.email} (${exportManifest.commit.sha.slice(0, 6)})`);
261
269
  }
262
270
  if (buildManifest?.commit) {
263
- console.log(chalk_1.default.yellow(` Current build:`), `${buildManifest.built} by ${buildManifest.commit.author.email} (${buildManifest.commit.sha.slice(0, 6)})`);
271
+ console.log(ansi_1.default.yellow(` Current build:`), `${buildManifest.built} by ${buildManifest.commit.author.email} (${buildManifest.commit.sha.slice(0, 6)})`);
264
272
  }
265
273
  const numOperations = result.adds.length + result.edits.length + result.deletes.length;
266
274
  if (numOperations === 0) {
267
- console.log(chalk_1.default.blue('No changes since last export: ') +
275
+ console.log(ansi_1.default.blue('No changes since last export: ') +
268
276
  this.pod.getAbsoluteFilePath(options.exportDir));
269
277
  return result;
270
278
  }
@@ -278,7 +286,7 @@ class Builder {
278
286
  }
279
287
  // Copy adds and edits.
280
288
  const moveFiles = [...result.adds, ...result.edits];
281
- await async.mapLimit(moveFiles, Builder.NumConcurrentCopies, async (filePath) => {
289
+ await concurrency.mapLimit(moveFiles, Builder.NumConcurrentCopies, async (filePath) => {
282
290
  const relativePath = filePath.replace(/^\//, '');
283
291
  const source = fsPath.join(buildDir, relativePath);
284
292
  const destination = fsPath.join(options.exportDir, relativePath);
@@ -294,11 +302,11 @@ class Builder {
294
302
  await Promise.all([
295
303
  this.writeFileAsync(exportManifestPath, JSON.stringify(buildManifest, null, 2)),
296
304
  ]);
297
- console.log(chalk_1.default.blue('Changes: ') +
298
- chalk_1.default.green(`${result.adds.length} adds, `) +
299
- chalk_1.default.yellow(`${result.edits.length} edits, `) +
300
- chalk_1.default.red(`${result.deletes.length} deletes`));
301
- console.log(chalk_1.default.blue('Export complete: ') +
305
+ console.log(ansi_1.default.blue('Changes: ') +
306
+ ansi_1.default.green(`${result.adds.length} adds, `) +
307
+ ansi_1.default.yellow(`${result.edits.length} edits, `) +
308
+ ansi_1.default.red(`${result.deletes.length} deletes`));
309
+ console.log(ansi_1.default.blue('Export complete: ') +
302
310
  this.pod.getAbsoluteFilePath(options.exportDir));
303
311
  return result;
304
312
  }
@@ -332,7 +340,7 @@ class Builder {
332
340
  // Only build routes matching patterns.
333
341
  if (options?.patterns) {
334
342
  routes = routes.filter(route => options.patterns?.some(pattern => route.podPath &&
335
- (0, minimatch_1.default)(route.podPath.replace(/^\//, ''), pattern.replace(/^\//, ''), {
343
+ (0, minimatch_1.minimatch)(route.podPath.replace(/^\//, ''), pattern.replace(/^\//, ''), {
336
344
  matchBase: true,
337
345
  })));
338
346
  }
@@ -358,7 +366,7 @@ class Builder {
358
366
  // Copy all static files and build all other routes.
359
367
  const errors = [];
360
368
  const errorRoutes = [];
361
- await async.eachLimit(createdPaths, Builder.NumConcurrentBuilds, async (createdPath) => {
369
+ await concurrency.eachLimit(createdPaths, Builder.NumConcurrentBuilds, async (createdPath) => {
362
370
  try {
363
371
  // Copy the file, or build it if it's a dynamic route.
364
372
  if (createdPath.route.provider.type === 'staticDir') {
@@ -385,11 +393,11 @@ class Builder {
385
393
  }
386
394
  if (errors.length) {
387
395
  bar.stop();
388
- console.error(chalk_1.default.yellow(`\nFound ${errors.length} errors building the following routes.\n`));
396
+ console.error(ansi_1.default.yellow(`\nFound ${errors.length} errors building the following routes.\n`));
389
397
  errorRoutes.map(route => {
390
398
  console.error(` ${route.urlPath}`);
391
399
  });
392
- console.error(chalk_1.default.yellow('\nThe first error was:'));
400
+ console.error(ansi_1.default.yellow('\nThe first error was:'));
393
401
  if (errors[0].message) {
394
402
  console.log(`\n${errors[0].message}\n`);
395
403
  }
@@ -421,7 +429,7 @@ class Builder {
421
429
  customDuration: Builder.formatProgressBarTime(0),
422
430
  });
423
431
  }
424
- await async.mapLimit(createdPaths, Builder.NumConcurrentCopies, async (createdPath) => {
432
+ await concurrency.mapLimit(createdPaths, Builder.NumConcurrentCopies, async (createdPath) => {
425
433
  // Start by building the manifest (and getting file shas).
426
434
  buildManifest.files.push({
427
435
  path: createdPath.normalPath,
@@ -495,32 +503,32 @@ class Builder {
495
503
  return result;
496
504
  }
497
505
  logResult(buildDiff, buildMetrics, options) {
498
- console.log(chalk_1.default.blue('Memory usage: ') + utils.formatBytes(buildMetrics.memoryUsage));
506
+ console.log(ansi_1.default.blue('Memory usage: ') + utils.formatBytes(buildMetrics.memoryUsage));
499
507
  if (buildMetrics.numDocumentRoutes) {
500
- console.log(chalk_1.default.blue('Documents: ') +
508
+ console.log(ansi_1.default.blue('Documents: ') +
501
509
  `${buildMetrics.numDocumentRoutes} (${utils.formatBytes(buildMetrics.outputSizeDocuments)}) ${options?.patterns ? '*incremental build' : ''}`);
502
510
  }
503
511
  if (buildMetrics.numStaticRoutes) {
504
- console.log(chalk_1.default.blue('Static files: ') +
512
+ console.log(ansi_1.default.blue('Static files: ') +
505
513
  `${buildMetrics.numStaticRoutes} (${utils.formatBytes(buildMetrics.outputSizeStaticFiles)})`);
506
514
  }
507
515
  if (buildMetrics.numMissingTranslations) {
508
- console.log(chalk_1.default.blue('Missing translations: ') +
516
+ console.log(ansi_1.default.blue('Missing translations: ') +
509
517
  Object.entries(buildMetrics.localesToNumMissingTranslations)
510
518
  .map(([locale, numMissingTranslations]) => {
511
519
  return `${locale} (${numMissingTranslations})`;
512
520
  })
513
521
  .join(', '));
514
522
  if (options?.writeLocales) {
515
- console.log(chalk_1.default.blue('Saved locales: ') +
523
+ console.log(ansi_1.default.blue('Saved locales: ') +
516
524
  this.pod.getAbsoluteFilePath(this.missingTranslationsPodPath));
517
525
  }
518
526
  }
519
- console.log(chalk_1.default.blue('Changes: ') +
520
- chalk_1.default.green(`${buildDiff.adds.length} adds, `) +
521
- chalk_1.default.yellow(`${buildDiff.edits.length} edits, `) +
522
- chalk_1.default.red(`${buildDiff.deletes.length} deletes`));
523
- console.log(chalk_1.default.blue('Build complete: ') +
527
+ console.log(ansi_1.default.blue('Changes: ') +
528
+ ansi_1.default.green(`${buildDiff.adds.length} adds, `) +
529
+ ansi_1.default.yellow(`${buildDiff.edits.length} edits, `) +
530
+ ansi_1.default.red(`${buildDiff.deletes.length} deletes`));
531
+ console.log(ansi_1.default.blue('Build complete: ') +
524
532
  this.pod.getAbsoluteFilePath(this.outputDirectoryPodPath));
525
533
  }
526
534
  async writeLocales(localesToMissingTranslations) {
package/dist/src/cli.js CHANGED
@@ -2,7 +2,11 @@
2
2
  "use strict";
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
6
10
  }) : (function(o, m, k, k2) {
7
11
  if (k2 === undefined) k2 = k;
8
12
  o[k2] = m[k];
@@ -12,15 +16,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
12
16
  }) : function(o, v) {
13
17
  o["default"] = v;
14
18
  });
15
- var __importStar = (this && this.__importStar) || function (mod) {
16
- if (mod && mod.__esModule) return mod;
17
- var result = {};
18
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
19
- __setModuleDefault(result, mod);
20
- return result;
21
- };
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
22
36
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.isNodeVersionSupported = exports.MIN_NODE_VERSION = exports.VERSION = void 0;
37
+ exports.MIN_NODE_VERSION = exports.VERSION = void 0;
38
+ exports.isNodeVersionSupported = isNodeVersionSupported;
24
39
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
25
40
  // @ts-ignore: File is located two directories down when packed.
26
41
  const packageData = __importStar(require("../../package.json"));
@@ -83,4 +98,3 @@ function isNodeVersionSupported() {
83
98
  }
84
99
  return true;
85
100
  }
86
- exports.isNodeVersionSupported = isNodeVersionSupported;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -11,23 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
11
15
  }) : function(o, v) {
12
16
  o["default"] = v;
13
17
  });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
24
35
  Object.defineProperty(exports, "__esModule", { value: true });
25
36
  exports.Collection = void 0;
26
37
  const fs = __importStar(require("fs"));
27
38
  const fsPath = __importStar(require("path"));
28
39
  const document_1 = require("./document");
29
40
  const locale_1 = require("./locale");
30
- const glob_1 = __importDefault(require("glob"));
41
+ const glob_1 = require("glob");
31
42
  /**
32
43
  * Collections represent groups of documents. Collections allow documents to
33
44
  * share things, such as locales, URL path formats, views, etc. A collection
@@ -76,13 +87,13 @@ class Collection {
76
87
  `${pod.defaultContentPodPath}**/${Collection.ConfigFile}`,
77
88
  ];
78
89
  patterns.forEach(pattern => {
79
- glob_1.default
80
- .sync(pattern, {
90
+ (0, glob_1.globSync)(pattern, {
81
91
  cwd: pod.root,
82
92
  root: pod.root,
83
93
  matchBase: false,
84
94
  nodir: true,
85
95
  })
96
+ .sort()
86
97
  .forEach(path => {
87
98
  paths.add(path);
88
99
  });
@@ -120,12 +131,12 @@ class Collection {
120
131
  */
121
132
  get subcollections() {
122
133
  const pattern = fsPath.join(this.podPath, '**', Collection.ConfigFile);
123
- return glob_1.default
124
- .sync(pattern, {
134
+ return (0, glob_1.globSync)(pattern, {
125
135
  cwd: this.pod.root,
126
136
  root: this.pod.root,
127
137
  nodir: true,
128
138
  })
139
+ .sort()
129
140
  .map(path => {
130
141
  // Convert absolute paths to pod paths.
131
142
  return fsPath.dirname(path).replace(this.pod.root, '');
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getPodWithEnvironment = void 0;
6
+ exports.getPodWithEnvironment = getPodWithEnvironment;
7
7
  const __1 = require("..");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  function getPodWithEnvironment(path, globalOptions, env) {
@@ -14,4 +14,3 @@ function getPodWithEnvironment(path, globalOptions, env) {
14
14
  }
15
15
  return pod;
16
16
  }
17
- exports.getPodWithEnvironment = getPodWithEnvironment;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ServeCommand = void 0;
7
7
  const global_1 = require("./global");
8
8
  const server_1 = require("../server");
9
- const chalk_1 = __importDefault(require("chalk"));
9
+ const ansi_1 = __importDefault(require("../ansi"));
10
10
  class ServeCommand {
11
11
  constructor(globalOptions, options) {
12
12
  this.globalOptions = globalOptions;
@@ -25,12 +25,12 @@ class ServeCommand {
25
25
  port: port,
26
26
  });
27
27
  server.on(server_1.Server.Events.RELOAD, (e) => {
28
- console.log(chalk_1.default.greenBright('Reloaded:'), `${pod.env.scheme}://${pod.env.host}:${e.server.port}/`);
28
+ console.log(ansi_1.default.greenBright('Reloaded:'), `${pod.env.scheme}://${pod.env.host}:${e.server.port}/`);
29
29
  });
30
30
  server.once(server_1.Server.Events.LISTENING, (e) => {
31
- console.log(chalk_1.default.green('🍊 Pod:'), `${pod.root}`);
32
- console.log(chalk_1.default.green('Server:'), `${pod.env.scheme}://${pod.env.host}:${e.server.port}/`);
33
- console.log(chalk_1.default.green(' Ready. Press ctrl+c to quit.'));
31
+ console.log(ansi_1.default.green('🍊 Pod:'), `${pod.root}`);
32
+ console.log(ansi_1.default.green('Server:'), `${pod.env.scheme}://${pod.env.host}:${e.server.port}/`);
33
+ console.log(ansi_1.default.green(' Ready. Press ctrl+c to quit.'));
34
34
  });
35
35
  await server.start();
36
36
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Runs an async iterator over `items` with at most `limit` concurrent executions.
3
+ */
4
+ export declare function eachLimit<T>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<unknown>): Promise<void>;
5
+ /**
6
+ * Maps an async iterator over `items` with at most `limit` concurrent executions,
7
+ * preserving result order.
8
+ */
9
+ export declare function mapLimit<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.eachLimit = eachLimit;
4
+ exports.mapLimit = mapLimit;
5
+ /**
6
+ * Runs an async iterator over `items` with at most `limit` concurrent executions.
7
+ */
8
+ async function eachLimit(items, limit, fn) {
9
+ await mapLimit(items, limit, fn);
10
+ }
11
+ /**
12
+ * Maps an async iterator over `items` with at most `limit` concurrent executions,
13
+ * preserving result order.
14
+ */
15
+ async function mapLimit(items, limit, fn) {
16
+ const results = new Array(items.length);
17
+ const concurrency = Math.max(1, Math.min(limit, items.length || 1));
18
+ let nextIndex = 0;
19
+ const worker = async () => {
20
+ while (nextIndex < items.length) {
21
+ const current = nextIndex++;
22
+ results[current] = await fn(items[current], current);
23
+ }
24
+ };
25
+ await Promise.all(Array.from({ length: concurrency }, () => worker()));
26
+ return results;
27
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Recursively walks plain objects and arrays, transforming values via `callback`.
3
+ * Class instances and functions are passed directly to `callback` without recursing
4
+ * into their properties.
5
+ */
6
+ export declare class DeepWalk {
7
+ walk(value: any, callback: (value: any) => Promise<any> | any): Promise<any>;
8
+ }