zard-cli 1.0.0-beta.115 → 1.0.0-beta.117
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/commands/add/component-installer.js +3 -3
- package/commands/add/component-installer.js.map +1 -1
- package/commands/add/component-selector.d.ts +3 -3
- package/commands/add/component-selector.js +3 -3
- package/commands/add/dependency-resolver.js +10 -7
- package/commands/add/dependency-resolver.js.map +1 -1
- package/commands/add/index.d.ts.map +1 -1
- package/commands/add/index.js +12 -20
- package/commands/add/index.js.map +1 -1
- package/commands/add/wizard.d.ts +8 -7
- package/commands/add/wizard.d.ts.map +1 -1
- package/commands/add/wizard.js +2 -2
- package/commands/add/wizard.js.map +1 -1
- package/commands/init/config-prompter.d.ts +18 -13
- package/commands/init/config-prompter.d.ts.map +1 -1
- package/commands/init/config-prompter.js +25 -19
- package/commands/init/config-prompter.js.map +1 -1
- package/commands/init/dependencies.d.ts.map +1 -1
- package/commands/init/dependencies.js +21 -24
- package/commands/init/dependencies.js.map +1 -1
- package/commands/init/index.js +20 -20
- package/commands/init/index.js.map +1 -1
- package/commands/init/project-kind.d.ts +39 -39
- package/commands/init/project-kind.d.ts.map +1 -1
- package/commands/init/project-kind.js +44 -44
- package/commands/init/project-kind.js.map +1 -1
- package/commands/init/steps.d.ts +3 -4
- package/commands/init/steps.d.ts.map +1 -1
- package/commands/init/steps.js +25 -24
- package/commands/init/steps.js.map +1 -1
- package/commands/init/tailwind-setup.d.ts +5 -5
- package/commands/init/tailwind-setup.js +14 -14
- package/commands/init/tailwind-setup.js.map +1 -1
- package/commands/init/tsconfig-updater.d.ts +4 -4
- package/commands/init/tsconfig-updater.js +12 -12
- package/commands/init/tsconfig-updater.js.map +1 -1
- package/commands/init/update-angular-config.js +4 -4
- package/commands/init/vite-setup.d.ts +5 -4
- package/commands/init/vite-setup.d.ts.map +1 -1
- package/commands/init/vite-setup.js +11 -10
- package/commands/init/vite-setup.js.map +1 -1
- package/commands/init/wizard.d.ts +5 -5
- package/commands/init/wizard.d.ts.map +1 -1
- package/commands/init/wizard.js +29 -29
- package/commands/init/wizard.js.map +1 -1
- package/core/icons/families.d.ts +20 -20
- package/core/icons/families.d.ts.map +1 -1
- package/core/icons/families.js +11 -11
- package/core/icons/families.js.map +1 -1
- package/core/icons/icon-map.d.ts.map +1 -1
- package/core/icons/icon-map.js +7 -4
- package/core/icons/icon-map.js.map +1 -1
- package/core/icons/index.d.ts +50 -50
- package/core/icons/index.d.ts.map +1 -1
- package/core/icons/index.js +45 -45
- package/core/icons/index.js.map +1 -1
- package/core/registry/registry-data.d.ts.map +1 -1
- package/core/registry/registry-data.js +82 -15
- package/core/registry/registry-data.js.map +1 -1
- package/core/themes/theme-definitions.d.ts.map +1 -1
- package/core/themes/theme-definitions.js +10 -0
- package/core/themes/theme-definitions.js.map +1 -1
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +6 -8
- package/ui/blocks.d.ts +29 -28
- package/ui/blocks.d.ts.map +1 -1
- package/ui/blocks.js +27 -27
- package/ui/blocks.js.map +1 -1
- package/ui/brand.d.ts +5 -5
- package/ui/brand.d.ts.map +1 -1
- package/ui/brand.js +6 -6
- package/ui/brand.js.map +1 -1
- package/ui/engine/animation/index.d.ts +2 -3
- package/ui/engine/animation/index.d.ts.map +1 -1
- package/ui/engine/animation/index.js +2 -3
- package/ui/engine/animation/index.js.map +1 -1
- package/ui/engine/ansi/index.d.ts +10 -11
- package/ui/engine/ansi/index.d.ts.map +1 -1
- package/ui/engine/ansi/index.js +6 -7
- package/ui/engine/ansi/index.js.map +1 -1
- package/ui/engine/components/index.d.ts +3 -3
- package/ui/engine/components/index.js +4 -4
- package/ui/engine/cursor/index.d.ts +3 -4
- package/ui/engine/cursor/index.d.ts.map +1 -1
- package/ui/engine/cursor/index.js +2 -3
- package/ui/engine/cursor/index.js.map +1 -1
- package/ui/engine/diff/index.d.ts +2 -3
- package/ui/engine/diff/index.d.ts.map +1 -1
- package/ui/engine/diff/index.js +5 -6
- package/ui/engine/diff/index.js.map +1 -1
- package/ui/engine/events/index.d.ts +2 -2
- package/ui/engine/events/index.js +3 -3
- package/ui/engine/events/index.js.map +1 -1
- package/ui/engine/focus/index.d.ts +2 -2
- package/ui/engine/focus/index.js +2 -2
- package/ui/engine/frame/index.d.ts +4 -4
- package/ui/engine/frame/index.js +0 -0
- package/ui/engine/index.d.ts +7 -7
- package/ui/engine/index.js +7 -7
- package/ui/engine/input/index.d.ts +2 -2
- package/ui/engine/input/index.js +11 -11
- package/ui/engine/input/index.js.map +1 -1
- package/ui/engine/layout/index.d.ts +3 -3
- package/ui/engine/layout/index.js +7 -7
- package/ui/engine/layout/index.js.map +1 -1
- package/ui/engine/renderer/index.d.ts +4 -4
- package/ui/engine/renderer/index.d.ts.map +1 -1
- package/ui/engine/renderer/index.js +3 -3
- package/ui/engine/scheduler/index.d.ts +3 -3
- package/ui/engine/scheduler/index.js +5 -5
- package/ui/engine/scheduler/index.js.map +1 -1
- package/ui/engine/screen/index.d.ts +5 -5
- package/ui/engine/screen/index.d.ts.map +1 -1
- package/ui/engine/screen/index.js +7 -7
- package/ui/engine/screen/index.js.map +1 -1
- package/ui/engine/terminal/index.d.ts +29 -29
- package/ui/engine/terminal/index.d.ts.map +1 -1
- package/ui/engine/terminal/index.js +47 -47
- package/ui/engine/terminal/index.js.map +1 -1
- package/ui/engine/testing/index.d.ts +4 -4
- package/ui/engine/testing/index.d.ts.map +1 -1
- package/ui/engine/testing/index.js +2 -2
- package/ui/engine/theme/index.d.ts +2 -3
- package/ui/engine/theme/index.d.ts.map +1 -1
- package/ui/engine/theme/index.js +3 -4
- package/ui/engine/theme/index.js.map +1 -1
- package/ui/engine/utils/index.d.ts +2 -2
- package/ui/engine/utils/index.js +4 -4
- package/ui/engine/utils/index.js.map +1 -1
- package/ui/gate.d.ts +7 -7
- package/ui/gate.d.ts.map +1 -1
- package/ui/gate.js +5 -5
- package/ui/index.d.ts +3 -3
- package/ui/index.js +3 -3
- package/ui/log-sink.d.ts +9 -9
- package/ui/log-sink.d.ts.map +1 -1
- package/ui/log-sink.js +9 -9
- package/ui/log-sink.js.map +1 -1
- package/ui/output.d.ts +6 -6
- package/ui/output.d.ts.map +1 -1
- package/ui/output.js +6 -6
- package/ui/output.js.map +1 -1
- package/ui/report.d.ts +8 -8
- package/ui/report.d.ts.map +1 -1
- package/ui/report.js +7 -7
- package/ui/report.js.map +1 -1
- package/ui/runner.d.ts +25 -25
- package/ui/runner.d.ts.map +1 -1
- package/ui/runner.js +27 -27
- package/ui/runner.js.map +1 -1
- package/ui/style.d.ts +7 -7
- package/ui/style.d.ts.map +1 -1
- package/ui/style.js +8 -8
- package/ui/style.js.map +1 -1
- package/ui/testing/fake-tty.d.ts +4 -4
- package/ui/testing/fake-tty.js +4 -4
- package/ui/text-input.d.ts +14 -13
- package/ui/text-input.d.ts.map +1 -1
- package/ui/text-input.js +15 -13
- package/ui/text-input.js.map +1 -1
- package/ui/theme.d.ts +4 -4
- package/ui/theme.js +4 -4
- package/utils/angular-compat.d.ts +21 -0
- package/utils/angular-compat.d.ts.map +1 -0
- package/utils/angular-compat.js +52 -0
- package/utils/angular-compat.js.map +1 -0
- package/utils/config.d.ts +6 -6
- package/utils/config.d.ts.map +1 -1
- package/utils/config.js +20 -20
- package/utils/config.js.map +1 -1
- package/utils/errors.d.ts +5 -5
- package/utils/errors.js +5 -5
- package/utils/get-project-info.d.ts +6 -6
- package/utils/get-project-info.d.ts.map +1 -1
- package/utils/get-project-info.js +35 -35
- package/utils/get-project-info.js.map +1 -1
- package/utils/http-client.d.ts.map +1 -1
- package/utils/http-client.js +18 -3
- package/utils/http-client.js.map +1 -1
- package/utils/icon-catalog.d.ts +16 -15
- package/utils/icon-catalog.d.ts.map +1 -1
- package/utils/icon-catalog.js +21 -20
- package/utils/icon-catalog.js.map +1 -1
- package/utils/logger.d.ts +3 -3
- package/utils/logger.js +9 -9
- package/utils/logger.js.map +1 -1
- package/utils/package-manager.d.ts +25 -25
- package/utils/package-manager.js +48 -48
- package/utils/package-manager.js.map +1 -1
- package/utils/registry.d.ts +14 -14
- package/utils/registry.d.ts.map +1 -1
- package/utils/registry.js +23 -19
- package/utils/registry.js.map +1 -1
- package/utils/schema-version.d.ts +11 -10
- package/utils/schema-version.d.ts.map +1 -1
- package/utils/schema-version.js +11 -10
- package/utils/schema-version.js.map +1 -1
- package/utils/source-file.d.ts +21 -21
- package/utils/source-file.d.ts.map +1 -1
- package/utils/source-file.js +24 -24
- package/utils/source-file.js.map +1 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Which manager the *project* uses.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* (`npx`
|
|
7
|
-
*
|
|
8
|
-
* package-lock.json
|
|
9
|
-
*
|
|
5
|
+
* Order matters. `npm_config_user_agent` describes how the CLI was invoked
|
|
6
|
+
* (`npx` always says npm), not what the project uses — trusting it first gave a
|
|
7
|
+
* bun project `packageManager: "npm"` in its components.json and a
|
|
8
|
+
* package-lock.json next to its bun.lock. The project answers for itself: the
|
|
9
|
+
* package.json `packageManager` field first, then the lockfiles.
|
|
10
10
|
*/
|
|
11
11
|
export declare function detectPackageManager(cwd?: string): Promise<PackageManager>;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* How to suggest running the CLI again.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* A different question: not which manager the project installs dependencies
|
|
16
|
+
* with, but how the CLI was just invoked. Someone who ran `npx zard-cli init`
|
|
17
|
+
* in a bun project does not expect to finish reading `bunx` — and the `npx`
|
|
18
|
+
* they already used works. Only when that cannot be known does the project's
|
|
19
|
+
* manager answer.
|
|
20
20
|
*/
|
|
21
21
|
export declare function suggestedRunner(packageManager: PackageManager): string;
|
|
22
22
|
export declare function getPackageManager(cwd?: string): Promise<'npm' | 'yarn' | 'pnpm' | 'bun'>;
|
|
23
23
|
export declare function getInstallCommand(packageManager: string, isDev?: boolean): Promise<string[]>;
|
|
24
24
|
export declare function installPackages(packages: string[], cwd: string, packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun', isDev?: boolean, legacyPeerDeps?: boolean): Promise<void>;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Installs the batch and, if the manager rejects the tree over a peer conflict,
|
|
27
|
+
* retries with the check relaxed.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* The fallback is remembered for the rest of the run: once the first batch
|
|
30
|
+
* needed it, the following ones will need it for the same reason, and an
|
|
31
|
+
* attempt already known to be doomed costs a full tree resolution.
|
|
32
32
|
*/
|
|
33
33
|
export declare function installPackagesWithRetry(packages: string[], cwd: string, packageManager: PackageManager, isDev?: boolean): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Drops from the batch the packages the project already declares and resolves.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* The manager charges a lot per invocation — it revalidates the whole tree even
|
|
38
|
+
* when there is nothing to do — so the win is not in making the install faster
|
|
39
|
+
* but in not calling it. An `add` in an already-initialized project asks for
|
|
40
|
+
* exactly the dependencies `init` put there.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* The filter is deliberately conservative: when in doubt the package stays in
|
|
43
|
+
* the batch and the manager decides. Comparing only the major is enough because
|
|
44
|
+
* the versions the CLI asks for are always of the form `^N`.
|
|
45
45
|
*/
|
|
46
46
|
export declare function filterInstalledPackages(packages: string[], cwd: string): Promise<string[]>;
|
|
47
47
|
export {};
|
package/utils/package-manager.js
CHANGED
|
@@ -8,18 +8,18 @@ import * as path from 'node:path';
|
|
|
8
8
|
let cachedPackageManager = null;
|
|
9
9
|
const SUPPORTED = ['npm', 'yarn', 'pnpm', 'bun'];
|
|
10
10
|
function asPackageManager(value) {
|
|
11
|
-
// `yarn@berry`, `pnpm@6`, `bun@1.3.14` —
|
|
11
|
+
// `yarn@berry`, `pnpm@6`, `bun@1.3.14` — only the family matters.
|
|
12
12
|
const name = value?.split('@')[0];
|
|
13
13
|
return SUPPORTED.includes(name) ? name : null;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Which manager the *project* uses.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
* (`npx`
|
|
20
|
-
*
|
|
21
|
-
* package-lock.json
|
|
22
|
-
*
|
|
18
|
+
* Order matters. `npm_config_user_agent` describes how the CLI was invoked
|
|
19
|
+
* (`npx` always says npm), not what the project uses — trusting it first gave a
|
|
20
|
+
* bun project `packageManager: "npm"` in its components.json and a
|
|
21
|
+
* package-lock.json next to its bun.lock. The project answers for itself: the
|
|
22
|
+
* package.json `packageManager` field first, then the lockfiles.
|
|
23
23
|
*/
|
|
24
24
|
export async function detectPackageManager(cwd = process.cwd()) {
|
|
25
25
|
if (cachedPackageManager)
|
|
@@ -46,13 +46,13 @@ const RUNNER = {
|
|
|
46
46
|
bun: 'bunx',
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* How to suggest running the CLI again.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
51
|
+
* A different question: not which manager the project installs dependencies
|
|
52
|
+
* with, but how the CLI was just invoked. Someone who ran `npx zard-cli init`
|
|
53
|
+
* in a bun project does not expect to finish reading `bunx` — and the `npx`
|
|
54
|
+
* they already used works. Only when that cannot be known does the project's
|
|
55
|
+
* manager answer.
|
|
56
56
|
*/
|
|
57
57
|
export function suggestedRunner(packageManager) {
|
|
58
58
|
const userAgent = process.env.npm_config_user_agent || '';
|
|
@@ -66,7 +66,7 @@ export function suggestedRunner(packageManager) {
|
|
|
66
66
|
return RUNNER.npm;
|
|
67
67
|
return RUNNER[packageManager];
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
69
|
+
/** The package.json `packageManager` field — the Corepack standard, an explicit declaration. */
|
|
70
70
|
async function readPackageManagerField(cwd) {
|
|
71
71
|
try {
|
|
72
72
|
const manifest = JSON.parse(await readFile(path.join(cwd, 'package.json'), 'utf8'));
|
|
@@ -94,11 +94,11 @@ export async function getInstallCommand(packageManager, isDev = false) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* Work the manager does out of habit that the install itself does not need.
|
|
98
98
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
99
|
+
* The vulnerability audit sends the whole tree to the registry and waits for an
|
|
100
|
+
* answer; in an Angular project, with over a thousand packages, that alone
|
|
101
|
+
* accounts for several seconds of a call that installs half a dozen.
|
|
102
102
|
*/
|
|
103
103
|
function speedFlags(packageManager) {
|
|
104
104
|
return packageManager === 'npm' ? ['--no-audit', '--no-fund'] : [];
|
|
@@ -113,17 +113,16 @@ export async function installPackages(packages, cwd, packageManager, isDev = fal
|
|
|
113
113
|
if (legacyPeerDeps && packageManager === 'pnpm') {
|
|
114
114
|
args.push('--no-strict-peer-dependencies');
|
|
115
115
|
}
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
116
|
+
// With the interactive screen mounted, inheriting stdio would let the package
|
|
117
|
+
// manager write over the frame. In that case the output is captured and only
|
|
118
|
+
// shows up in debug mode; outside it, the behaviour stays "pass the output
|
|
119
|
+
// through live".
|
|
120
120
|
if (isCapturing()) {
|
|
121
121
|
const command = `${packageManager} ${args.join(' ')}`;
|
|
122
122
|
try {
|
|
123
|
-
// stdin
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// invisível atrás da tela cheia.
|
|
123
|
+
// stdin ignored, not piped: an open input pipe never sees EOF and the
|
|
124
|
+
// package manager waits on it forever. Closing stdin also guarantees it
|
|
125
|
+
// never opens a prompt, which would be invisible behind the full screen.
|
|
127
126
|
const result = await execa(packageManager, args, {
|
|
128
127
|
cwd,
|
|
129
128
|
stdin: 'ignore',
|
|
@@ -133,35 +132,36 @@ export async function installPackages(packages, cwd, packageManager, isDev = fal
|
|
|
133
132
|
logger.debug(`${command}\n${result.stdout}`);
|
|
134
133
|
}
|
|
135
134
|
catch (error) {
|
|
136
|
-
//
|
|
137
|
-
//
|
|
135
|
+
// Without this the failure reaches the user as one generic line: the
|
|
136
|
+
// package manager's real output stays in the sink and is printed with the
|
|
137
|
+
// summary.
|
|
138
138
|
logger.error(`${command} failed:\n${outputOf(error)}`);
|
|
139
139
|
throw error;
|
|
140
140
|
}
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
// stdin
|
|
144
|
-
//
|
|
145
|
-
// background)
|
|
146
|
-
//
|
|
143
|
+
// stdin ignored here too. The install takes its packages as arguments and has
|
|
144
|
+
// nothing to ask; inheriting a stdin that never closes (a pipe, CI, a
|
|
145
|
+
// background job) leaves the manager waiting for an EOF that never comes —
|
|
146
|
+
// output stays live because stdout and stderr are still inherited.
|
|
147
147
|
await execa(packageManager, args, { cwd, stdin: 'ignore', stdout: 'inherit', stderr: 'inherit' });
|
|
148
148
|
}
|
|
149
149
|
function outputOf(error) {
|
|
150
150
|
const { stderr, stdout, message } = (error ?? {});
|
|
151
151
|
return (stderr?.trim() || stdout?.trim() || message || String(error)).trim();
|
|
152
152
|
}
|
|
153
|
-
/**
|
|
153
|
+
/** Only npm and pnpm can relax peer checking; elsewhere, retrying repeats the same failure. */
|
|
154
154
|
function canRelaxPeers(packageManager) {
|
|
155
155
|
return packageManager === 'npm' || packageManager === 'pnpm';
|
|
156
156
|
}
|
|
157
157
|
let peerRelaxationEngaged = false;
|
|
158
158
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
159
|
+
* Installs the batch and, if the manager rejects the tree over a peer conflict,
|
|
160
|
+
* retries with the check relaxed.
|
|
161
161
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
162
|
+
* The fallback is remembered for the rest of the run: once the first batch
|
|
163
|
+
* needed it, the following ones will need it for the same reason, and an
|
|
164
|
+
* attempt already known to be doomed costs a full tree resolution.
|
|
165
165
|
*/
|
|
166
166
|
export async function installPackagesWithRetry(packages, cwd, packageManager, isDev = false) {
|
|
167
167
|
if (packages.length === 0)
|
|
@@ -182,16 +182,16 @@ export async function installPackagesWithRetry(packages, cwd, packageManager, is
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
185
|
+
* Drops from the batch the packages the project already declares and resolves.
|
|
186
186
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
187
|
+
* The manager charges a lot per invocation — it revalidates the whole tree even
|
|
188
|
+
* when there is nothing to do — so the win is not in making the install faster
|
|
189
|
+
* but in not calling it. An `add` in an already-initialized project asks for
|
|
190
|
+
* exactly the dependencies `init` put there.
|
|
191
191
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
192
|
+
* The filter is deliberately conservative: when in doubt the package stays in
|
|
193
|
+
* the batch and the manager decides. Comparing only the major is enough because
|
|
194
|
+
* the versions the CLI asks for are always of the form `^N`.
|
|
195
195
|
*/
|
|
196
196
|
export async function filterInstalledPackages(packages, cwd) {
|
|
197
197
|
const declared = await readDeclaredDependencies(cwd);
|
|
@@ -210,7 +210,7 @@ export async function filterInstalledPackages(packages, cwd) {
|
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
function parseSpec(spec) {
|
|
213
|
-
//
|
|
213
|
+
// The `@` in `@ng-icons/core` opens the scope, not the version — hence the last one.
|
|
214
214
|
const separator = spec.lastIndexOf('@');
|
|
215
215
|
if (separator <= 0)
|
|
216
216
|
return { name: spec, range: null };
|
|
@@ -228,7 +228,7 @@ async function readDeclaredDependencies(cwd) {
|
|
|
228
228
|
return null;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
/** node_modules
|
|
231
|
+
/** node_modules can sit above the project — workspaces hoist everything to the root. */
|
|
232
232
|
function isResolvable(name, cwd) {
|
|
233
233
|
let dir = path.resolve(cwd);
|
|
234
234
|
for (;;) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../src/utils/package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,IAAI,oBAAoB,GAA0B,IAAI,CAAC;AAEvD,MAAM,SAAS,GAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5E,SAAS,gBAAgB,CAAC,KAAgC;IACxD,
|
|
1
|
+
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../src/utils/package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAA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AAED,KAAK,UAAU,wBAAwB,CAAC,GAAW;IACjD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACpF,OAAO,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,wFAAwF;AACxF,SAAS,YAAY,CAAC,IAAY,EAAE,GAAW;IAC7C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE5B,SAAS,CAAC;QACR,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QAElE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QACjC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/utils/registry.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { type IconFamily } from '../core/icons/index.js';
|
|
|
2
2
|
import type { Config } from '../utils/config.js';
|
|
3
3
|
export declare const DEFAULT_REGISTRY_URL: string;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* The icons a component draws, as the registry publishes them.
|
|
6
6
|
*
|
|
7
|
-
* `family`
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `family` is the family the files are written in — anyone installing with a
|
|
8
|
+
* different family in `components.json` learns from this field that they need
|
|
9
|
+
* rewriting. Absent from items published before this property existed.
|
|
10
10
|
*/
|
|
11
11
|
export interface RegistryIcons {
|
|
12
12
|
family: string;
|
|
13
13
|
symbols: string[];
|
|
14
14
|
tokens: string[];
|
|
15
|
-
/**
|
|
15
|
+
/** The icons that only appear in the demos. Absent from the index, which does not carry them. */
|
|
16
16
|
demos?: {
|
|
17
17
|
symbols: string[];
|
|
18
18
|
tokens: string[];
|
|
@@ -33,7 +33,7 @@ export interface RegistryItem {
|
|
|
33
33
|
}
|
|
34
34
|
export interface RegistryIndex {
|
|
35
35
|
$schema: string;
|
|
36
|
-
/**
|
|
36
|
+
/** The file's shape. Absent from registries older than the field. */
|
|
37
37
|
schemaVersion?: number;
|
|
38
38
|
name: string;
|
|
39
39
|
homepage: string;
|
|
@@ -50,11 +50,11 @@ export interface RegistryIndex {
|
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* The family the item's files are written in.
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
55
|
+
* An item with no `icons` — published before the property existed — is in
|
|
56
|
+
* lucide, which was the only possibility. So is an unknown value: better the
|
|
57
|
+
* right guess than refusing to install over an unfamiliar field.
|
|
58
58
|
*/
|
|
59
59
|
export declare function sourceFamilyOf(item: Pick<RegistryItem, 'icons'>): IconFamily;
|
|
60
60
|
export declare function getRegistryUrl(config?: Config): string;
|
|
@@ -65,11 +65,11 @@ export declare function fetchComponentFromRegistry(componentName: string, regist
|
|
|
65
65
|
export declare function getAvailableComponents(registryUrl?: string): Promise<string[]>;
|
|
66
66
|
export interface TransformOptions {
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* The destination came from `--path`, outside the configured alias.
|
|
69
69
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* `utils`
|
|
70
|
+
* In that case the batch's components become neighbours on disk, and the
|
|
71
|
+
* relative path is what resolves — the alias would point at the folder they are
|
|
72
|
+
* not in. `utils` and `core` stay on the alias, because `init` installed them.
|
|
73
73
|
*/
|
|
74
74
|
readonly siblingComponents?: boolean;
|
|
75
75
|
}
|
package/utils/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAmD,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC5G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAOnD,eAAO,MAAM,oBAAoB,QAE0D,CAAC;AAE5F;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAmD,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC5G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAOnD,eAAO,MAAM,oBAAoB,QAE0D,CAAC;AAE5F;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,iGAAiG;IACjG,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAC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EAAE,CAAC,CAGpF;AAOD,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAyCxG;AAED,wBAAsB,cAAc,CAClC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,YAAY,CAAC,CAoCvB"}
|
package/utils/registry.js
CHANGED
|
@@ -8,11 +8,11 @@ import { assertSupportedSchema } from '../utils/schema-version.js';
|
|
|
8
8
|
export const DEFAULT_REGISTRY_URL = process.env['ZARD_REGISTRY_URL'] ||
|
|
9
9
|
(BUILD_REGISTRY_URL !== '__REGISTRY_URL__' ? BUILD_REGISTRY_URL : 'https://zardui.com/r');
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* The family the item's files are written in.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* An item with no `icons` — published before the property existed — is in
|
|
14
|
+
* lucide, which was the only possibility. So is an unknown value: better the
|
|
15
|
+
* right guess than refusing to install over an unfamiliar field.
|
|
16
16
|
*/
|
|
17
17
|
export function sourceFamilyOf(item) {
|
|
18
18
|
const family = item.icons?.family;
|
|
@@ -37,20 +37,27 @@ export function validateRegistryUrl(url) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Keyed by registry URL, not global.
|
|
42
|
+
*
|
|
43
|
+
* `registryUrl` is a `components.json` field, so two registries can be read in one
|
|
44
|
+
* run — and a single cache entry handed the second call the first registry's index.
|
|
45
|
+
*/
|
|
46
|
+
const registryIndexCache = new Map();
|
|
41
47
|
export async function fetchRegistryIndex(registryUrl) {
|
|
42
48
|
const baseUrl = registryUrl || DEFAULT_REGISTRY_URL;
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
const cached = registryIndexCache.get(baseUrl);
|
|
50
|
+
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
|
|
51
|
+
return cached.data;
|
|
45
52
|
}
|
|
46
53
|
const url = `${baseUrl}/registry.json`;
|
|
47
54
|
const data = await fetchJson(url);
|
|
48
55
|
assertSupportedSchema(data.schemaVersion, 'registry.json');
|
|
49
|
-
registryIndexCache
|
|
56
|
+
registryIndexCache.set(baseUrl, { data, timestamp: Date.now() });
|
|
50
57
|
return data;
|
|
51
58
|
}
|
|
52
59
|
export function invalidateRegistryCache() {
|
|
53
|
-
registryIndexCache
|
|
60
|
+
registryIndexCache.clear();
|
|
54
61
|
}
|
|
55
62
|
export async function fetchComponentFromRegistry(componentName, registryUrl) {
|
|
56
63
|
const baseUrl = registryUrl || DEFAULT_REGISTRY_URL;
|
|
@@ -73,9 +80,6 @@ export function transformContent(content, config, options = {}) {
|
|
|
73
80
|
core: trimSlashes(config.aliases.core),
|
|
74
81
|
services: trimSlashes(config.aliases.services),
|
|
75
82
|
};
|
|
76
|
-
// Replace utils imports
|
|
77
|
-
transformed = transformed.replace(/from ['"]\.\.\/\.\.\/shared\/utils\/utils['"]/g, `from '${aliases.utils}/merge-classes'`);
|
|
78
|
-
transformed = transformed.replace(/from ['"]\.\.\/\.\.\/shared\/utils\/number['"]/g, `from '${aliases.utils}/number'`);
|
|
79
83
|
// Replace relative component imports with aliased imports
|
|
80
84
|
const componentImportRegex = /from ['"]\.\.\/([\w-/.]+)['"]/g;
|
|
81
85
|
transformed = transformed.replace(componentImportRegex, `from '${aliases.components}/$1'`);
|
|
@@ -87,10 +91,10 @@ export function transformContent(content, config, options = {}) {
|
|
|
87
91
|
if (!value) {
|
|
88
92
|
continue;
|
|
89
93
|
}
|
|
90
|
-
//
|
|
91
|
-
// (`from '@/shared/core'`).
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
+
// The subpath is optional: `card.component.ts` imports the barrel directly
|
|
95
|
+
// (`from '@/shared/core'`). Requiring `/something` after the key let that
|
|
96
|
+
// import escape the substitution, and the installed component kept pointing
|
|
97
|
+
// at `@/shared/core` — a folder that does not exist under a custom alias.
|
|
94
98
|
const regex = new RegExp(`(['"])@\\/shared\\/${key}(\\/[\\w\\-\\/.]+)?\\1`, 'g');
|
|
95
99
|
transformed = transformed.replace(regex, (_match, quote, subpath) => {
|
|
96
100
|
return `${quote}${value}${subpath ?? ''}${quote}`;
|
|
@@ -111,9 +115,9 @@ export async function fetchComponent(componentName, config, registryUrl, options
|
|
|
111
115
|
missing.add(symbol);
|
|
112
116
|
return { name: file.name, content: retargeted.content };
|
|
113
117
|
});
|
|
114
|
-
//
|
|
115
|
-
// import
|
|
116
|
-
//
|
|
118
|
+
// An icon with no equivalent in the chosen family keeps its original symbol,
|
|
119
|
+
// and its import no longer resolves. Failing the whole install over that would
|
|
120
|
+
// be worse: the rest of the component is correct and the fix is one line.
|
|
117
121
|
if (missing.size > 0) {
|
|
118
122
|
logger.warn(`"${componentName}" uses icons that ${config.icons} does not provide: ${[...missing].sort().join(', ')}. ` +
|
|
119
123
|
'They were left untouched — replace them by hand.');
|
package/utils/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAmB,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM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AM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QAC7C,MAAM,UAAU,GAAG,aAAa,CAC9B,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAC/C,YAAY,EACZ,MAAM,CAAC,KAAK,EACZ,WAAW,EAAE,CACd,CAAC;QACF,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAE7D,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,6EAA6E;IAC7E,+EAA+E;IAC/E,0EAA0E;IAC1E,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CACT,IAAI,aAAa,qBAAqB,MAAM,CAAC,KAAK,sBAAsB,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YACxG,kDAAkD,CACrD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,KAAK,EAAE,gBAAgB;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The registry FORMAT version this CLI understands.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Not to be confused with the package version, which the index also publishes:
|
|
5
|
+
* that one says which release the content came from, this one says what shape it
|
|
6
|
+
* has. Without separating them there was no way for the registry to change shape
|
|
7
|
+
* without silently breaking whoever was already installed — the CLI would read
|
|
8
|
+
* `files` from an item with a different shape and get it wrong without a word.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
* item
|
|
10
|
+
* It goes up when the change breaks a reader: a field removed, a meaning
|
|
11
|
+
* altered, an item reorganized. A new optional field raises nothing.
|
|
11
12
|
*/
|
|
12
13
|
export declare const SUPPORTED_SCHEMA_VERSION = 1;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Rejects a document newer than this CLI knows how to read.
|
|
15
16
|
*
|
|
16
|
-
* A
|
|
17
|
-
*
|
|
17
|
+
* A missing field means a registry older than the field itself, which is version
|
|
18
|
+
* 1 by definition.
|
|
18
19
|
*/
|
|
19
20
|
export declare function assertSupportedSchema(schemaVersion: number | undefined, source: string): void;
|
|
20
21
|
//# sourceMappingURL=schema-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"schema-version.d.ts","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAS7F"}
|
package/utils/schema-version.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { SchemaVersionError } from '../utils/errors.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The registry FORMAT version this CLI understands.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Not to be confused with the package version, which the index also publishes:
|
|
6
|
+
* that one says which release the content came from, this one says what shape it
|
|
7
|
+
* has. Without separating them there was no way for the registry to change shape
|
|
8
|
+
* without silently breaking whoever was already installed — the CLI would read
|
|
9
|
+
* `files` from an item with a different shape and get it wrong without a word.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
* item
|
|
11
|
+
* It goes up when the change breaks a reader: a field removed, a meaning
|
|
12
|
+
* altered, an item reorganized. A new optional field raises nothing.
|
|
12
13
|
*/
|
|
13
14
|
export const SUPPORTED_SCHEMA_VERSION = 1;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Rejects a document newer than this CLI knows how to read.
|
|
16
17
|
*
|
|
17
|
-
* A
|
|
18
|
-
*
|
|
18
|
+
* A missing field means a registry older than the field itself, which is version
|
|
19
|
+
* 1 by definition.
|
|
19
20
|
*/
|
|
20
21
|
export function assertSupportedSchema(schemaVersion, source) {
|
|
21
22
|
const version = schemaVersion ?? 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-version.js","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"schema-version.js","sourceRoot":"","sources":["../../src/utils/schema-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAAiC,EAAE,MAAc;IACrF,MAAM,OAAO,GAAG,aAAa,IAAI,CAAC,CAAC;IAEnC,IAAI,OAAO,GAAG,wBAAwB,EAAE,CAAC;QACvC,MAAM,IAAI,kBAAkB,CAC1B,2BAA2B,MAAM,eAAe,OAAO,+BAA+B,wBAAwB,IAAI;YAChH,oGAAoG,CACvG,CAAC;IACJ,CAAC;AACH,CAAC"}
|