flagstaff 0.3.1 → 0.3.2

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/import.js CHANGED
@@ -1,20 +1,12 @@
1
1
  const DEFAULT_INTERVAL = 80;
2
2
  const DEFAULT_STATIC = '…';
3
3
  export function fromCliSpinners(corpus, { name = 'cli-spinners', staticFor = () => DEFAULT_STATIC } = {}) {
4
- const spinners = {};
5
- for (const [style, spinner] of Object.entries(corpus)) {
6
- if (!Array.isArray(spinner?.frames) || spinner.frames.length === 0)
7
- continue;
8
- spinners[style] = { frames: spinner.frames, interval: spinner.interval ?? DEFAULT_INTERVAL, static: staticFor(style, spinner) };
9
- }
4
+ const spinners = Object.fromEntries(Object.entries(corpus)
5
+ .filter(([, spinner]) => Array.isArray(spinner?.frames) && spinner.frames.length > 0)
6
+ .map(([style, spinner]) => [style, { frames: spinner.frames, interval: spinner.interval ?? DEFAULT_INTERVAL, static: staticFor(style, spinner) }]));
10
7
  return { name, contract: 1, spinners };
11
8
  }
12
9
  export function fromCliBoxes(corpus, { name = 'cli-boxes' } = {}) {
13
- const borders = {};
14
- for (const [style, box] of Object.entries(corpus)) {
15
- if (typeof box?.topLeft !== 'string')
16
- continue;
17
- borders[style] = box;
18
- }
10
+ const borders = Object.fromEntries(Object.entries(corpus).filter(([, box]) => typeof box?.topLeft === 'string'));
19
11
  return { name, contract: 1, borders };
20
12
  }
package/dist/plugin.js CHANGED
@@ -116,7 +116,7 @@ function deepFrozen(value, seen = new WeakMap()) {
116
116
  const copy = (Array.isArray(value) ? [] : {});
117
117
  seen.set(value, copy);
118
118
  for (const [k, v] of Object.entries(value))
119
- copy[k] = deepFrozen(v, seen);
119
+ Object.defineProperty(copy, k, { value: deepFrozen(v, seen), writable: true, enumerable: true, configurable: true });
120
120
  return frozen(copy);
121
121
  }
122
122
  export function register(plugin) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flagstaff",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "The staff the flag flies from. A terminal frame loop with a static projection for agents and screen readers, and a plugin host for spinners, progress, boxes and tables. Drop-in paths for ora, log-update, boxen and cli-table3. Zero dependencies.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -121,7 +121,7 @@
121
121
  "roundel": "^0.3.1"
122
122
  },
123
123
  "devDependencies": {
124
- "fast-check": "^4.10.0",
125
- "vitest": "^5.0.0"
124
+ "fast-check": "^4.10.1",
125
+ "vitest": "^5.0.1"
126
126
  }
127
127
  }