create-next-hydra 0.3.0 → 0.4.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/README.md +126 -27
- package/dist/add-command.d.ts +11 -0
- package/dist/add-command.d.ts.map +1 -0
- package/dist/add-command.js +75 -0
- package/dist/addition.d.ts +67 -0
- package/dist/addition.d.ts.map +1 -0
- package/dist/addition.js +422 -0
- package/dist/application-git.d.ts +20 -0
- package/dist/application-git.d.ts.map +1 -0
- package/dist/application-git.js +57 -0
- package/dist/baseline.d.ts +22 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +90 -0
- package/dist/cli.js +5 -18
- package/dist/commands.d.ts +22 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +197 -0
- package/dist/composition-lint.d.ts +20 -0
- package/dist/composition-lint.d.ts.map +1 -0
- package/dist/composition-lint.js +288 -0
- package/dist/composition.d.ts +24 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +420 -0
- package/dist/create-command.d.ts +21 -0
- package/dist/create-command.d.ts.map +1 -0
- package/dist/create-command.js +128 -0
- package/dist/demo-instrumentation.d.ts +5 -0
- package/dist/demo-instrumentation.d.ts.map +1 -0
- package/dist/demo-instrumentation.js +300 -0
- package/dist/environment.d.ts +7 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +81 -0
- package/dist/errors.d.ts +156 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +140 -0
- package/dist/file-policy.d.ts +6 -0
- package/dist/file-policy.d.ts.map +1 -0
- package/dist/file-policy.js +38 -0
- package/dist/files.d.ts +7 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +66 -0
- package/dist/hosting.d.ts +5 -0
- package/dist/hosting.d.ts.map +1 -0
- package/dist/hosting.js +107 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -89
- package/dist/initialization.d.ts +14 -0
- package/dist/initialization.d.ts.map +1 -0
- package/dist/initialization.js +266 -0
- package/dist/lint-workspaces.d.ts +2 -0
- package/dist/lint-workspaces.d.ts.map +1 -0
- package/dist/lint-workspaces.js +62 -0
- package/dist/model.d.ts +143 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +61 -0
- package/dist/package-catalog.d.ts +8 -0
- package/dist/package-catalog.d.ts.map +1 -0
- package/dist/package-catalog.js +61 -0
- package/dist/packages.d.ts +57 -0
- package/dist/packages.d.ts.map +1 -0
- package/dist/packages.js +237 -0
- package/dist/process-group.d.ts +5 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +23 -0
- package/dist/reference-workspace-bindings.d.ts +38 -0
- package/dist/reference-workspace-bindings.d.ts.map +1 -0
- package/dist/reference-workspace-bindings.js +41 -0
- package/dist/reference-workspace.d.ts +6 -0
- package/dist/reference-workspace.d.ts.map +1 -0
- package/dist/reference-workspace.js +62 -0
- package/dist/registry.d.ts +187 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +107 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +22 -0
- package/dist/selection.d.ts +704 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/selection.js +424 -0
- package/dist/shadcn-protocol.d.ts +22 -0
- package/dist/shadcn-protocol.d.ts.map +1 -0
- package/dist/shadcn-protocol.js +13 -0
- package/dist/shadcn-worker.d.ts +2 -0
- package/dist/shadcn-worker.d.ts.map +1 -0
- package/dist/shadcn-worker.js +43 -0
- package/dist/shadcn.d.ts +22 -0
- package/dist/shadcn.d.ts.map +1 -0
- package/dist/shadcn.js +101 -0
- package/dist/source-changes.d.ts +55 -0
- package/dist/source-changes.d.ts.map +1 -0
- package/dist/source-changes.js +225 -0
- package/dist/source-inventory.d.ts +25 -0
- package/dist/source-inventory.d.ts.map +1 -0
- package/dist/source-inventory.js +212 -0
- package/dist/source-root.d.ts +4 -0
- package/dist/source-root.d.ts.map +1 -0
- package/dist/source-root.js +20 -0
- package/dist/staging.d.ts +19 -0
- package/dist/staging.d.ts.map +1 -0
- package/dist/staging.js +42 -0
- package/dist/tasks.d.ts +44 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +137 -0
- package/dist/templates.d.ts +217 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +161 -0
- package/dist/test-reference-workspace.d.ts +2 -0
- package/dist/test-reference-workspace.d.ts.map +1 -0
- package/dist/test-reference-workspace.js +6 -0
- package/dist/types.d.ts +2 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/typescript-paths.d.ts +10 -0
- package/dist/typescript-paths.d.ts.map +1 -0
- package/dist/typescript-paths.js +52 -0
- package/dist/workspace-dependencies.d.ts +26 -0
- package/dist/workspace-dependencies.d.ts.map +1 -0
- package/dist/workspace-dependencies.js +478 -0
- package/dist/workspace-files.d.ts +24 -0
- package/dist/workspace-files.d.ts.map +1 -0
- package/dist/workspace-files.js +395 -0
- package/dist/workspace-lock.d.ts +12 -0
- package/dist/workspace-lock.d.ts.map +1 -0
- package/dist/workspace-lock.js +104 -0
- package/dist/workspace-snapshots.d.ts +24 -0
- package/dist/workspace-snapshots.d.ts.map +1 -0
- package/dist/workspace-snapshots.js +218 -0
- package/dist/workspace-sources.d.ts +27 -0
- package/dist/workspace-sources.d.ts.map +1 -0
- package/dist/workspace-sources.js +88 -0
- package/dist/workspace-state.d.ts +325 -0
- package/dist/workspace-state.d.ts.map +1 -0
- package/dist/workspace-state.js +571 -0
- package/dist/workspaces.d.ts +73 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +396 -0
- package/package.json +27 -20
- package/schema/selection-definition.json +143 -4
- package/dist/clone.d.ts +0 -9
- package/dist/clone.d.ts.map +0 -1
- package/dist/clone.js +0 -19
- package/dist/composition/add.d.ts +0 -14
- package/dist/composition/add.d.ts.map +0 -1
- package/dist/composition/add.js +0 -484
- package/dist/composition/catalog.d.ts +0 -26
- package/dist/composition/catalog.d.ts.map +0 -1
- package/dist/composition/catalog.js +0 -317
- package/dist/composition/errors.d.ts +0 -5
- package/dist/composition/errors.d.ts.map +0 -1
- package/dist/composition/errors.js +0 -8
- package/dist/composition/format.d.ts +0 -6
- package/dist/composition/format.d.ts.map +0 -1
- package/dist/composition/format.js +0 -65
- package/dist/composition/install.d.ts +0 -16
- package/dist/composition/install.d.ts.map +0 -1
- package/dist/composition/install.js +0 -175
- package/dist/composition/packages.d.ts +0 -6
- package/dist/composition/packages.d.ts.map +0 -1
- package/dist/composition/packages.js +0 -55
- package/dist/composition/paths.d.ts +0 -4
- package/dist/composition/paths.d.ts.map +0 -1
- package/dist/composition/paths.js +0 -47
- package/dist/composition/planner.d.ts +0 -4
- package/dist/composition/planner.d.ts.map +0 -1
- package/dist/composition/planner.js +0 -366
- package/dist/composition/schema.d.ts +0 -294
- package/dist/composition/schema.d.ts.map +0 -1
- package/dist/composition/schema.js +0 -166
- package/dist/composition/types.d.ts +0 -111
- package/dist/composition/types.d.ts.map +0 -1
- package/dist/composition/types.js +0 -6
- package/dist/composition/typescript-paths.d.ts +0 -6
- package/dist/composition/typescript-paths.d.ts.map +0 -1
- package/dist/composition/typescript-paths.js +0 -157
- package/dist/composition/use.d.ts +0 -23
- package/dist/composition/use.d.ts.map +0 -1
- package/dist/composition/use.js +0 -187
- package/dist/composition/workspace.d.ts +0 -10
- package/dist/composition/workspace.d.ts.map +0 -1
- package/dist/composition/workspace.js +0 -210
- package/dist/constants.d.ts +0 -11
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -39
- package/dist/fs-utils.d.ts +0 -9
- package/dist/fs-utils.d.ts.map +0 -1
- package/dist/fs-utils.js +0 -64
- package/dist/git.d.ts +0 -28
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js +0 -107
- package/dist/instruction-renderer.d.ts +0 -17
- package/dist/instruction-renderer.d.ts.map +0 -1
- package/dist/instruction-renderer.js +0 -132
- package/dist/logger.d.ts +0 -13
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -26
- package/dist/prompts.d.ts +0 -7
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js +0 -54
- package/dist/sanitize.d.ts +0 -10
- package/dist/sanitize.d.ts.map +0 -1
- package/dist/sanitize.js +0 -110
- package/dist/scaffold.d.ts +0 -7
- package/dist/scaffold.d.ts.map +0 -1
- package/dist/scaffold.js +0 -330
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -2
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { Effect, FileSystem, Path } from "effect";
|
|
2
|
+
import type { RegistryItem } from "shadcn/schema";
|
|
3
|
+
import { InvalidComposition } from "./errors.ts";
|
|
4
|
+
import type { RegistryInstruction, SelectionRequest } from "./model.ts";
|
|
5
|
+
import { Shadcn } from "./shadcn.ts";
|
|
6
|
+
import type { RegistryCatalog } from "./shadcn.ts";
|
|
7
|
+
export declare function registryInstructions(items: readonly RegistryItem[]): readonly RegistryInstruction[];
|
|
8
|
+
export declare const acquireRegistry: (cwd: string, request: {
|
|
9
|
+
readonly reference: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly registry: RegistryCatalog;
|
|
12
|
+
readonly selection: SelectionRequest;
|
|
13
|
+
}) => Effect.Effect<{
|
|
14
|
+
external: Set<string>;
|
|
15
|
+
observed: Map<string, string>;
|
|
16
|
+
references: Map<string, string>;
|
|
17
|
+
registry: {
|
|
18
|
+
items: ({
|
|
19
|
+
type: "registry:base";
|
|
20
|
+
name: string;
|
|
21
|
+
tailwind?: {
|
|
22
|
+
config?: {
|
|
23
|
+
theme?: Record<string, any> | undefined;
|
|
24
|
+
content?: string[] | undefined;
|
|
25
|
+
plugins?: string[] | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
docs?: string | undefined;
|
|
29
|
+
$schema?: string | undefined;
|
|
30
|
+
config?: {
|
|
31
|
+
tailwind?: {
|
|
32
|
+
baseColor?: string | undefined;
|
|
33
|
+
config?: string | undefined;
|
|
34
|
+
css?: string | undefined;
|
|
35
|
+
cssVariables?: boolean | undefined;
|
|
36
|
+
prefix?: string | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
39
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
40
|
+
iconLibrary?: string | undefined;
|
|
41
|
+
style?: string | undefined;
|
|
42
|
+
$schema?: string | undefined;
|
|
43
|
+
rsc?: boolean | undefined;
|
|
44
|
+
tsx?: boolean | undefined;
|
|
45
|
+
rtl?: boolean | undefined;
|
|
46
|
+
aliases?: {
|
|
47
|
+
components?: string | undefined;
|
|
48
|
+
ui?: string | undefined;
|
|
49
|
+
utils?: string | undefined;
|
|
50
|
+
lib?: string | undefined;
|
|
51
|
+
hooks?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
registries?: Record<string, string | {
|
|
54
|
+
url: string;
|
|
55
|
+
params?: Record<string, string> | undefined;
|
|
56
|
+
headers?: Record<string, string> | undefined;
|
|
57
|
+
}> | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
css?: Record<string, any> | undefined;
|
|
60
|
+
extends?: string | undefined;
|
|
61
|
+
title?: string | undefined;
|
|
62
|
+
author?: string | undefined;
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
dependencies?: string[] | undefined;
|
|
65
|
+
devDependencies?: string[] | undefined;
|
|
66
|
+
registryDependencies?: string[] | undefined;
|
|
67
|
+
files?: ({
|
|
68
|
+
path: string;
|
|
69
|
+
type: "registry:page" | "registry:file";
|
|
70
|
+
target: string;
|
|
71
|
+
content?: string | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
path: string;
|
|
74
|
+
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:theme" | "registry:style" | "registry:item" | "registry:base" | "registry:font" | "registry:example" | "registry:internal";
|
|
75
|
+
content?: string | undefined;
|
|
76
|
+
target?: string | undefined;
|
|
77
|
+
})[] | undefined;
|
|
78
|
+
cssVars?: {
|
|
79
|
+
theme?: Record<string, string> | undefined;
|
|
80
|
+
light?: Record<string, string> | undefined;
|
|
81
|
+
dark?: Record<string, string> | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
envVars?: Record<string, string> | undefined;
|
|
84
|
+
meta?: Record<string, any> | undefined;
|
|
85
|
+
categories?: string[] | undefined;
|
|
86
|
+
} | {
|
|
87
|
+
font: {
|
|
88
|
+
family: string;
|
|
89
|
+
provider: "google";
|
|
90
|
+
import: string;
|
|
91
|
+
variable: string;
|
|
92
|
+
weight?: string[] | undefined;
|
|
93
|
+
subsets?: string[] | undefined;
|
|
94
|
+
selector?: string | undefined;
|
|
95
|
+
dependency?: string | undefined;
|
|
96
|
+
};
|
|
97
|
+
type: "registry:font";
|
|
98
|
+
name: string;
|
|
99
|
+
tailwind?: {
|
|
100
|
+
config?: {
|
|
101
|
+
theme?: Record<string, any> | undefined;
|
|
102
|
+
content?: string[] | undefined;
|
|
103
|
+
plugins?: string[] | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
docs?: string | undefined;
|
|
107
|
+
$schema?: string | undefined;
|
|
108
|
+
css?: Record<string, any> | undefined;
|
|
109
|
+
extends?: string | undefined;
|
|
110
|
+
title?: string | undefined;
|
|
111
|
+
author?: string | undefined;
|
|
112
|
+
description?: string | undefined;
|
|
113
|
+
dependencies?: string[] | undefined;
|
|
114
|
+
devDependencies?: string[] | undefined;
|
|
115
|
+
registryDependencies?: string[] | undefined;
|
|
116
|
+
files?: ({
|
|
117
|
+
path: string;
|
|
118
|
+
type: "registry:page" | "registry:file";
|
|
119
|
+
target: string;
|
|
120
|
+
content?: string | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
path: string;
|
|
123
|
+
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:theme" | "registry:style" | "registry:item" | "registry:base" | "registry:font" | "registry:example" | "registry:internal";
|
|
124
|
+
content?: string | undefined;
|
|
125
|
+
target?: string | undefined;
|
|
126
|
+
})[] | undefined;
|
|
127
|
+
cssVars?: {
|
|
128
|
+
theme?: Record<string, string> | undefined;
|
|
129
|
+
light?: Record<string, string> | undefined;
|
|
130
|
+
dark?: Record<string, string> | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
envVars?: Record<string, string> | undefined;
|
|
133
|
+
meta?: Record<string, any> | undefined;
|
|
134
|
+
categories?: string[] | undefined;
|
|
135
|
+
} | {
|
|
136
|
+
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:page" | "registry:file" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
|
|
137
|
+
name: string;
|
|
138
|
+
tailwind?: {
|
|
139
|
+
config?: {
|
|
140
|
+
theme?: Record<string, any> | undefined;
|
|
141
|
+
content?: string[] | undefined;
|
|
142
|
+
plugins?: string[] | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
} | undefined;
|
|
145
|
+
docs?: string | undefined;
|
|
146
|
+
$schema?: string | undefined;
|
|
147
|
+
css?: Record<string, any> | undefined;
|
|
148
|
+
extends?: string | undefined;
|
|
149
|
+
title?: string | undefined;
|
|
150
|
+
author?: string | undefined;
|
|
151
|
+
description?: string | undefined;
|
|
152
|
+
dependencies?: string[] | undefined;
|
|
153
|
+
devDependencies?: string[] | undefined;
|
|
154
|
+
registryDependencies?: string[] | undefined;
|
|
155
|
+
files?: ({
|
|
156
|
+
path: string;
|
|
157
|
+
type: "registry:page" | "registry:file";
|
|
158
|
+
target: string;
|
|
159
|
+
content?: string | undefined;
|
|
160
|
+
} | {
|
|
161
|
+
path: string;
|
|
162
|
+
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:theme" | "registry:style" | "registry:item" | "registry:base" | "registry:font" | "registry:example" | "registry:internal";
|
|
163
|
+
content?: string | undefined;
|
|
164
|
+
target?: string | undefined;
|
|
165
|
+
})[] | undefined;
|
|
166
|
+
cssVars?: {
|
|
167
|
+
theme?: Record<string, string> | undefined;
|
|
168
|
+
light?: Record<string, string> | undefined;
|
|
169
|
+
dark?: Record<string, string> | undefined;
|
|
170
|
+
} | undefined;
|
|
171
|
+
envVars?: Record<string, string> | undefined;
|
|
172
|
+
meta?: Record<string, any> | undefined;
|
|
173
|
+
categories?: string[] | undefined;
|
|
174
|
+
})[];
|
|
175
|
+
name: string;
|
|
176
|
+
$schema?: string | undefined | undefined;
|
|
177
|
+
homepage: string;
|
|
178
|
+
include?: string[] | undefined | undefined;
|
|
179
|
+
pagination?: {
|
|
180
|
+
total: number;
|
|
181
|
+
offset: number;
|
|
182
|
+
limit: number;
|
|
183
|
+
hasMore: boolean;
|
|
184
|
+
} | undefined | undefined;
|
|
185
|
+
};
|
|
186
|
+
}, InvalidComposition | import("./errors.ts").RegistryFailure | import("effect/Schema").SchemaError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path | Shadcn>;
|
|
187
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMxE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,YAAY,EAAE,GAC7B,SAAS,mBAAmB,EAAE,CAIhC;AAUD,eAAO,MAAM,eAAe;wBAGA,MAAM;;uBAEP,eAAe;wBACd,gBAAgB;;;;;;;;;;sBA8Ggm+B,CAAC;yBAAqB,CAAC;2BAAsD,CAAC;2BAA2C,CAAC;;;;;;wBAAkK,CAAC;6BAAyB,CAAC;0BAAwC,CAAC;uBAAqC,CAAC;gCAA8C,CAAC;0BAAyC,CAAC;;yBAA8D,CAAC;0BAAyG,CAAC;2BAAoD,CAAC;qBAAmC,CAAC;uBAAqC,CAAC;mBAAiC,CAAC;mBAAkC,CAAC;mBAAkC,CAAC;uBAAsC,CAAC;8BAA0B,CAAC;sBAAoC,CAAC;yBAAuC,CAAC;uBAAqC,CAAC;yBAAuC,CAAC;;0BAA+D,CAAC;;0BAAuE,CAAC;2BAAyD,CAAC;;;;;;;;;;;;;;;uBAAwgB,CAAC;;;;uBAAsT,CAAC;sBAAoC,CAAC;;;qBAAyE,CAAC;qBAAmD,CAAC;oBAAkD,CAAC;;;;;;;;;;;sBAAu3P,CAAC;uBAAuC,CAAC;wBAAwC,CAAC;0BAAwC,CAAC;;;;;sBAAyG,CAAC;yBAAqB,CAAC;2BAAsD,CAAC;2BAA2C,CAAC;;;;;;;;;;;;;;;;;uBAA0jB,CAAC;;;;uBAAsT,CAAC;sBAAoC,CAAC;;;qBAAyE,CAAC;qBAAmD,CAAC;oBAAkD,CAAC;;;;;;;;;sBAA49M,CAAC;yBAAqB,CAAC;2BAAsD,CAAC;2BAA2C,CAAC;;;;;;;;;;;;;;;;;uBAA0jB,CAAC;;;;uBAAsT,CAAC;sBAAoC,CAAC;;;qBAAyE,CAAC;qBAAmD,CAAC;oBAAkD,CAAC;;;;;;;;;;;;;;;;;+LADz2kD,CAAC"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from "node:util";
|
|
2
|
+
import { Effect, FileSystem, Path } from "effect";
|
|
3
|
+
import { InvalidComposition } from "./errors.js";
|
|
4
|
+
import { registryIndex, resolveSelection, selectedConditionalDependencies, } from "./selection.js";
|
|
5
|
+
import { Shadcn } from "./shadcn.js";
|
|
6
|
+
export function registryInstructions(items) {
|
|
7
|
+
return items.flatMap((item) => item.docs?.trim() ? [{ item: item.name, text: item.docs }] : []);
|
|
8
|
+
}
|
|
9
|
+
const emptyRegistry = {
|
|
10
|
+
homepage: "",
|
|
11
|
+
items: [],
|
|
12
|
+
name: "installation",
|
|
13
|
+
};
|
|
14
|
+
// Keep the acquired artifacts, not just their URLs. Inspection and installation
|
|
15
|
+
// must agree even when a remote registry changes during the operation.
|
|
16
|
+
export const acquireRegistry = Effect.fn("Registry.acquire")(function* (cwd, request) {
|
|
17
|
+
const fs = yield* FileSystem.FileSystem;
|
|
18
|
+
const path = yield* Path.Path;
|
|
19
|
+
const shadcn = yield* Shadcn;
|
|
20
|
+
const initial = "registry" in request ? request.registry : emptyRegistry;
|
|
21
|
+
const registry = { ...initial, items: [...initial.items] };
|
|
22
|
+
const references = new Map();
|
|
23
|
+
const external = new Set();
|
|
24
|
+
const observed = new Map();
|
|
25
|
+
const repository = /^https:\/\/github\.com\/(?<repository>[^/]+\/[^/]+?)(?:\.git)?\/?$/u.exec(initial.homepage ?? "")?.groups?.repository;
|
|
26
|
+
const acquire = (reference) => Effect.gen(function* () {
|
|
27
|
+
let index = yield* registryIndex(registry, references);
|
|
28
|
+
let name = index.references.get(reference);
|
|
29
|
+
if (!name) {
|
|
30
|
+
const local = path.resolve(cwd, reference);
|
|
31
|
+
const isLocal = yield* fs.exists(local);
|
|
32
|
+
let resolved = reference;
|
|
33
|
+
if (isLocal) {
|
|
34
|
+
resolved = local;
|
|
35
|
+
}
|
|
36
|
+
else if (repository &&
|
|
37
|
+
!reference.includes("/") &&
|
|
38
|
+
!reference.includes("#")) {
|
|
39
|
+
resolved = `${repository}/${reference}`;
|
|
40
|
+
}
|
|
41
|
+
if (isLocal) {
|
|
42
|
+
observed.set(local, yield* fs.readFileString(local));
|
|
43
|
+
}
|
|
44
|
+
const fetched = yield* shadcn.getRegistryItems([resolved], cwd);
|
|
45
|
+
const [item] = fetched;
|
|
46
|
+
if (!item || fetched.length !== 1) {
|
|
47
|
+
return yield* new InvalidComposition({
|
|
48
|
+
message: "The registry did not return the requested artifact.",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const existing = registry.items.find((candidate) => candidate.name === item.name);
|
|
52
|
+
const replacesSource = repository !== undefined &&
|
|
53
|
+
reference.includes("#") &&
|
|
54
|
+
reference.split("#", 1)[0] === `${repository}/${item.name}` &&
|
|
55
|
+
!external.has(item.name);
|
|
56
|
+
if (existing && !isDeepStrictEqual(existing, item) && !replacesSource) {
|
|
57
|
+
return yield* new InvalidComposition({
|
|
58
|
+
message: `Registry artifact name collision: ${item.name}`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (existing) {
|
|
62
|
+
registry.items[registry.items.indexOf(existing)] = item;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
registry.items.push(item);
|
|
66
|
+
}
|
|
67
|
+
({ name } = item);
|
|
68
|
+
references.set(reference, name);
|
|
69
|
+
references.set(resolved, name);
|
|
70
|
+
external.add(name);
|
|
71
|
+
index = yield* registryIndex(registry, references);
|
|
72
|
+
const metadata = index.metadataByName.get(name);
|
|
73
|
+
if ((metadata?.assets?.length ?? 0) > 0) {
|
|
74
|
+
return yield* new InvalidComposition({
|
|
75
|
+
message: "Published artifacts cannot refer to source-only binary assets.",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return { index, name };
|
|
80
|
+
});
|
|
81
|
+
if ("selection" in request && "preset" in request.selection) {
|
|
82
|
+
yield* acquire(request.selection.preset);
|
|
83
|
+
}
|
|
84
|
+
const selection = "selection" in request
|
|
85
|
+
? yield* resolveSelection(yield* registryIndex(registry, references), request.selection)
|
|
86
|
+
: undefined;
|
|
87
|
+
const pending = "reference" in request ? [request.reference] : [];
|
|
88
|
+
if (selection) {
|
|
89
|
+
pending.push("app-web", ...Object.values(selection.providers), ...selection.addOns);
|
|
90
|
+
}
|
|
91
|
+
const visited = new Set();
|
|
92
|
+
while (pending.length) {
|
|
93
|
+
const reference = pending.pop();
|
|
94
|
+
if (reference === undefined || visited.has(reference)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
visited.add(reference);
|
|
98
|
+
const { index, name } = yield* acquire(reference);
|
|
99
|
+
const item = index.items.get(name);
|
|
100
|
+
pending.push(...(item?.registryDependencies ?? []));
|
|
101
|
+
const metadata = index.metadataByName.get(name);
|
|
102
|
+
if (selection) {
|
|
103
|
+
pending.push(...selectedConditionalDependencies(metadata, selection));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { external, observed, references, registry };
|
|
107
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NodeServices } from "@effect/platform-node";
|
|
2
|
+
import { Layer } from "effect";
|
|
3
|
+
import { Composition } from "./composition.ts";
|
|
4
|
+
import { Shadcn } from "./shadcn.ts";
|
|
5
|
+
import { SourceInventory } from "./source-inventory.ts";
|
|
6
|
+
import { WorkspaceSources } from "./workspace-sources.ts";
|
|
7
|
+
import { Workspaces } from "./workspaces.ts";
|
|
8
|
+
export declare const runtime: Layer.Layer<Shadcn | SourceInventory | WorkspaceSources | Composition | Workspaces | NodeServices.NodeServices, import("./errors.ts").InvalidComposition, never>;
|
|
9
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,eAAO,MAAM,OAAO,kKAanB,CAAC"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeServices } from "@effect/platform-node";
|
|
2
|
+
import { Layer } from "effect";
|
|
3
|
+
import { Composition } from "./composition.js";
|
|
4
|
+
import { Shadcn } from "./shadcn.js";
|
|
5
|
+
import { SourceChanges } from "./source-changes.js";
|
|
6
|
+
import { SourceInventory } from "./source-inventory.js";
|
|
7
|
+
import { WorkspaceDependencies } from "./workspace-dependencies.js";
|
|
8
|
+
import { WorkspaceFiles } from "./workspace-files.js";
|
|
9
|
+
import { WorkspaceSnapshots } from "./workspace-snapshots.js";
|
|
10
|
+
import { WorkspaceSources } from "./workspace-sources.js";
|
|
11
|
+
import { WorkspaceState } from "./workspace-state.js";
|
|
12
|
+
import { Workspaces } from "./workspaces.js";
|
|
13
|
+
const platform = NodeServices.layer;
|
|
14
|
+
const registry = Shadcn.layer();
|
|
15
|
+
const composition = Composition.layer.pipe(Layer.provide(registry), Layer.provide(SourceInventory.layer), Layer.provide(platform));
|
|
16
|
+
export const runtime = Workspaces.layer.pipe(Layer.provide([
|
|
17
|
+
WorkspaceState.layer,
|
|
18
|
+
SourceChanges.layer,
|
|
19
|
+
WorkspaceSnapshots.layer,
|
|
20
|
+
WorkspaceFiles.layer,
|
|
21
|
+
WorkspaceDependencies.layer,
|
|
22
|
+
]), Layer.provideMerge(registry), Layer.provideMerge(composition), Layer.provideMerge(WorkspaceSources.layer), Layer.provideMerge(SourceInventory.layer), Layer.provideMerge(platform));
|