memoir-cli 3.9.0 → 3.10.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.
@@ -1,47 +0,0 @@
1
- // Single source of truth for OS-specific config locations.
2
- //
3
- // Why this exists: before this module, every adapter branched on a single
4
- // `isWin` flag — `isWin ? <windows> : <macOS>`. On Linux, `process.platform`
5
- // is `'linux'`, so those ternaries silently fell through to the *macOS* path
6
- // (`~/Library/Application Support/...`), which doesn't exist on Linux. memoir
7
- // would then detect zero tools, sync nothing, and the user would churn without
8
- // any error — the "silent-zero-memory activation cliff."
9
- //
10
- // Every function is parameterized by { platform, env, home } so the three OS
11
- // branches can be unit-tested from any machine, not just the target OS. Runtime
12
- // callers omit the options and get the live platform.
13
-
14
- import path from 'node:path';
15
- import os from 'node:os';
16
-
17
- const HOME = os.homedir();
18
-
19
- // VS Code-family per-user config base: <root>/<App>/User
20
- // win32 : %APPDATA%/<App>/User
21
- // darwin : ~/Library/Application Support/<App>/User
22
- // linux : $XDG_CONFIG_HOME (or ~/.config)/<App>/User
23
- export function vscodeUserDir(appName, { platform = process.platform, env = process.env, home = HOME } = {}) {
24
- if (platform === 'win32') {
25
- const appData = env.APPDATA || path.join(home, 'AppData', 'Roaming');
26
- return path.join(appData, appName, 'User');
27
- }
28
- if (platform === 'darwin') {
29
- return path.join(home, 'Library', 'Application Support', appName, 'User');
30
- }
31
- // linux + anything else POSIX-y
32
- const xdg = env.XDG_CONFIG_HOME || path.join(home, '.config');
33
- return path.join(xdg, appName, 'User');
34
- }
35
-
36
- // A VS Code extension's globalStorage dir (e.g. Cline lives under the base
37
- // "Code" install, not its own app dir).
38
- export function vscodeGlobalStorage(extId, opts = {}) {
39
- return path.join(vscodeUserDir('Code', opts), 'globalStorage', extId);
40
- }
41
-
42
- // XDG-aware ~/.config base, for non-VSCode tools that already store there
43
- // (zed, github-copilot). Exposed so callers don't re-hardcode ~/.config and
44
- // drift from XDG_CONFIG_HOME.
45
- export function xdgConfigDir({ env = process.env, home = HOME } = {}) {
46
- return env.XDG_CONFIG_HOME || path.join(home, '.config');
47
- }