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.
Files changed (207) hide show
  1. package/README.md +126 -27
  2. package/dist/add-command.d.ts +11 -0
  3. package/dist/add-command.d.ts.map +1 -0
  4. package/dist/add-command.js +75 -0
  5. package/dist/addition.d.ts +67 -0
  6. package/dist/addition.d.ts.map +1 -0
  7. package/dist/addition.js +422 -0
  8. package/dist/application-git.d.ts +20 -0
  9. package/dist/application-git.d.ts.map +1 -0
  10. package/dist/application-git.js +57 -0
  11. package/dist/baseline.d.ts +22 -0
  12. package/dist/baseline.d.ts.map +1 -0
  13. package/dist/baseline.js +90 -0
  14. package/dist/cli.js +5 -18
  15. package/dist/commands.d.ts +22 -0
  16. package/dist/commands.d.ts.map +1 -0
  17. package/dist/commands.js +197 -0
  18. package/dist/composition-lint.d.ts +20 -0
  19. package/dist/composition-lint.d.ts.map +1 -0
  20. package/dist/composition-lint.js +288 -0
  21. package/dist/composition.d.ts +24 -0
  22. package/dist/composition.d.ts.map +1 -0
  23. package/dist/composition.js +420 -0
  24. package/dist/create-command.d.ts +21 -0
  25. package/dist/create-command.d.ts.map +1 -0
  26. package/dist/create-command.js +128 -0
  27. package/dist/demo-instrumentation.d.ts +5 -0
  28. package/dist/demo-instrumentation.d.ts.map +1 -0
  29. package/dist/demo-instrumentation.js +300 -0
  30. package/dist/environment.d.ts +7 -0
  31. package/dist/environment.d.ts.map +1 -0
  32. package/dist/environment.js +81 -0
  33. package/dist/errors.d.ts +156 -0
  34. package/dist/errors.d.ts.map +1 -0
  35. package/dist/errors.js +140 -0
  36. package/dist/file-policy.d.ts +6 -0
  37. package/dist/file-policy.d.ts.map +1 -0
  38. package/dist/file-policy.js +38 -0
  39. package/dist/files.d.ts +7 -0
  40. package/dist/files.d.ts.map +1 -0
  41. package/dist/files.js +66 -0
  42. package/dist/hosting.d.ts +5 -0
  43. package/dist/hosting.d.ts.map +1 -0
  44. package/dist/hosting.js +107 -0
  45. package/dist/index.d.ts +4 -6
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +17 -89
  48. package/dist/initialization.d.ts +14 -0
  49. package/dist/initialization.d.ts.map +1 -0
  50. package/dist/initialization.js +266 -0
  51. package/dist/lint-workspaces.d.ts +2 -0
  52. package/dist/lint-workspaces.d.ts.map +1 -0
  53. package/dist/lint-workspaces.js +62 -0
  54. package/dist/model.d.ts +143 -0
  55. package/dist/model.d.ts.map +1 -0
  56. package/dist/model.js +61 -0
  57. package/dist/package-catalog.d.ts +8 -0
  58. package/dist/package-catalog.d.ts.map +1 -0
  59. package/dist/package-catalog.js +61 -0
  60. package/dist/packages.d.ts +57 -0
  61. package/dist/packages.d.ts.map +1 -0
  62. package/dist/packages.js +237 -0
  63. package/dist/process-group.d.ts +5 -0
  64. package/dist/process-group.d.ts.map +1 -0
  65. package/dist/process-group.js +23 -0
  66. package/dist/reference-workspace-bindings.d.ts +38 -0
  67. package/dist/reference-workspace-bindings.d.ts.map +1 -0
  68. package/dist/reference-workspace-bindings.js +41 -0
  69. package/dist/reference-workspace.d.ts +6 -0
  70. package/dist/reference-workspace.d.ts.map +1 -0
  71. package/dist/reference-workspace.js +62 -0
  72. package/dist/registry.d.ts +187 -0
  73. package/dist/registry.d.ts.map +1 -0
  74. package/dist/registry.js +107 -0
  75. package/dist/runtime.d.ts +9 -0
  76. package/dist/runtime.d.ts.map +1 -0
  77. package/dist/runtime.js +22 -0
  78. package/dist/selection.d.ts +704 -0
  79. package/dist/selection.d.ts.map +1 -0
  80. package/dist/selection.js +424 -0
  81. package/dist/shadcn-protocol.d.ts +22 -0
  82. package/dist/shadcn-protocol.d.ts.map +1 -0
  83. package/dist/shadcn-protocol.js +13 -0
  84. package/dist/shadcn-worker.d.ts +2 -0
  85. package/dist/shadcn-worker.d.ts.map +1 -0
  86. package/dist/shadcn-worker.js +43 -0
  87. package/dist/shadcn.d.ts +22 -0
  88. package/dist/shadcn.d.ts.map +1 -0
  89. package/dist/shadcn.js +101 -0
  90. package/dist/source-changes.d.ts +55 -0
  91. package/dist/source-changes.d.ts.map +1 -0
  92. package/dist/source-changes.js +225 -0
  93. package/dist/source-inventory.d.ts +25 -0
  94. package/dist/source-inventory.d.ts.map +1 -0
  95. package/dist/source-inventory.js +212 -0
  96. package/dist/source-root.d.ts +4 -0
  97. package/dist/source-root.d.ts.map +1 -0
  98. package/dist/source-root.js +20 -0
  99. package/dist/staging.d.ts +19 -0
  100. package/dist/staging.d.ts.map +1 -0
  101. package/dist/staging.js +42 -0
  102. package/dist/tasks.d.ts +44 -0
  103. package/dist/tasks.d.ts.map +1 -0
  104. package/dist/tasks.js +137 -0
  105. package/dist/templates.d.ts +217 -0
  106. package/dist/templates.d.ts.map +1 -0
  107. package/dist/templates.js +161 -0
  108. package/dist/test-reference-workspace.d.ts +2 -0
  109. package/dist/test-reference-workspace.d.ts.map +1 -0
  110. package/dist/test-reference-workspace.js +6 -0
  111. package/dist/types.d.ts +2 -9
  112. package/dist/types.d.ts.map +1 -1
  113. package/dist/typescript-paths.d.ts +10 -0
  114. package/dist/typescript-paths.d.ts.map +1 -0
  115. package/dist/typescript-paths.js +52 -0
  116. package/dist/workspace-dependencies.d.ts +26 -0
  117. package/dist/workspace-dependencies.d.ts.map +1 -0
  118. package/dist/workspace-dependencies.js +478 -0
  119. package/dist/workspace-files.d.ts +24 -0
  120. package/dist/workspace-files.d.ts.map +1 -0
  121. package/dist/workspace-files.js +395 -0
  122. package/dist/workspace-lock.d.ts +12 -0
  123. package/dist/workspace-lock.d.ts.map +1 -0
  124. package/dist/workspace-lock.js +104 -0
  125. package/dist/workspace-snapshots.d.ts +24 -0
  126. package/dist/workspace-snapshots.d.ts.map +1 -0
  127. package/dist/workspace-snapshots.js +218 -0
  128. package/dist/workspace-sources.d.ts +27 -0
  129. package/dist/workspace-sources.d.ts.map +1 -0
  130. package/dist/workspace-sources.js +88 -0
  131. package/dist/workspace-state.d.ts +325 -0
  132. package/dist/workspace-state.d.ts.map +1 -0
  133. package/dist/workspace-state.js +571 -0
  134. package/dist/workspaces.d.ts +73 -0
  135. package/dist/workspaces.d.ts.map +1 -0
  136. package/dist/workspaces.js +396 -0
  137. package/package.json +27 -20
  138. package/schema/selection-definition.json +143 -4
  139. package/dist/clone.d.ts +0 -9
  140. package/dist/clone.d.ts.map +0 -1
  141. package/dist/clone.js +0 -19
  142. package/dist/composition/add.d.ts +0 -14
  143. package/dist/composition/add.d.ts.map +0 -1
  144. package/dist/composition/add.js +0 -484
  145. package/dist/composition/catalog.d.ts +0 -26
  146. package/dist/composition/catalog.d.ts.map +0 -1
  147. package/dist/composition/catalog.js +0 -317
  148. package/dist/composition/errors.d.ts +0 -5
  149. package/dist/composition/errors.d.ts.map +0 -1
  150. package/dist/composition/errors.js +0 -8
  151. package/dist/composition/format.d.ts +0 -6
  152. package/dist/composition/format.d.ts.map +0 -1
  153. package/dist/composition/format.js +0 -65
  154. package/dist/composition/install.d.ts +0 -16
  155. package/dist/composition/install.d.ts.map +0 -1
  156. package/dist/composition/install.js +0 -175
  157. package/dist/composition/packages.d.ts +0 -6
  158. package/dist/composition/packages.d.ts.map +0 -1
  159. package/dist/composition/packages.js +0 -55
  160. package/dist/composition/paths.d.ts +0 -4
  161. package/dist/composition/paths.d.ts.map +0 -1
  162. package/dist/composition/paths.js +0 -47
  163. package/dist/composition/planner.d.ts +0 -4
  164. package/dist/composition/planner.d.ts.map +0 -1
  165. package/dist/composition/planner.js +0 -366
  166. package/dist/composition/schema.d.ts +0 -294
  167. package/dist/composition/schema.d.ts.map +0 -1
  168. package/dist/composition/schema.js +0 -166
  169. package/dist/composition/types.d.ts +0 -111
  170. package/dist/composition/types.d.ts.map +0 -1
  171. package/dist/composition/types.js +0 -6
  172. package/dist/composition/typescript-paths.d.ts +0 -6
  173. package/dist/composition/typescript-paths.d.ts.map +0 -1
  174. package/dist/composition/typescript-paths.js +0 -157
  175. package/dist/composition/use.d.ts +0 -23
  176. package/dist/composition/use.d.ts.map +0 -1
  177. package/dist/composition/use.js +0 -187
  178. package/dist/composition/workspace.d.ts +0 -10
  179. package/dist/composition/workspace.d.ts.map +0 -1
  180. package/dist/composition/workspace.js +0 -210
  181. package/dist/constants.d.ts +0 -11
  182. package/dist/constants.d.ts.map +0 -1
  183. package/dist/constants.js +0 -39
  184. package/dist/fs-utils.d.ts +0 -9
  185. package/dist/fs-utils.d.ts.map +0 -1
  186. package/dist/fs-utils.js +0 -64
  187. package/dist/git.d.ts +0 -28
  188. package/dist/git.d.ts.map +0 -1
  189. package/dist/git.js +0 -107
  190. package/dist/instruction-renderer.d.ts +0 -17
  191. package/dist/instruction-renderer.d.ts.map +0 -1
  192. package/dist/instruction-renderer.js +0 -132
  193. package/dist/logger.d.ts +0 -13
  194. package/dist/logger.d.ts.map +0 -1
  195. package/dist/logger.js +0 -26
  196. package/dist/prompts.d.ts +0 -7
  197. package/dist/prompts.d.ts.map +0 -1
  198. package/dist/prompts.js +0 -54
  199. package/dist/sanitize.d.ts +0 -10
  200. package/dist/sanitize.d.ts.map +0 -1
  201. package/dist/sanitize.js +0 -110
  202. package/dist/scaffold.d.ts +0 -7
  203. package/dist/scaffold.d.ts.map +0 -1
  204. package/dist/scaffold.js +0 -330
  205. package/dist/version.d.ts +0 -2
  206. package/dist/version.d.ts.map +0 -1
  207. package/dist/version.js +0 -2
@@ -0,0 +1,44 @@
1
+ import { Effect, Schema } from "effect";
2
+ import type { PreparedFile } from "./model.ts";
3
+ /** Cache correctness is application policy, shared by customer and named workspaces regardless of deployment location. */
4
+ export declare const applicationTasks: (files: readonly PreparedFile[]) => Effect.Effect<{
5
+ envMode: string;
6
+ futureFlags: {
7
+ affectedUsingTaskInputs: boolean;
8
+ };
9
+ tasks: {
10
+ build: {
11
+ dependsOn: string[];
12
+ env: string[];
13
+ inputs: string[];
14
+ outputs: string[];
15
+ };
16
+ dev: {
17
+ cache: boolean;
18
+ passThroughEnv: string[];
19
+ persistent: boolean;
20
+ };
21
+ e2e: {
22
+ cache: boolean;
23
+ };
24
+ "e2e:list": {
25
+ cache: boolean;
26
+ };
27
+ test: {
28
+ dependsOn: string[];
29
+ env: string[];
30
+ inputs: string[];
31
+ };
32
+ typecheck: {
33
+ dependsOn: string[];
34
+ env: string[];
35
+ inputs: string[];
36
+ };
37
+ } & Record<`${string}#build`, {
38
+ dependsOn: string[];
39
+ env: string[];
40
+ inputs: string[];
41
+ outputs: string[];
42
+ }>;
43
+ }, Schema.SchemaError, never>;
44
+ //# sourceMappingURL=tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAa/C,0HAA0H;AAC1H,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2I5B,CAAC"}
package/dist/tasks.js ADDED
@@ -0,0 +1,137 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { cacheDirectories, environmentFileType } from "./file-policy.js";
3
+ import { internalDependencies, ManifestJson } from "./packages.js";
4
+ const nonSourceDirectories = [
5
+ ...cacheDirectories,
6
+ ".git",
7
+ "coverage",
8
+ ".features-gen",
9
+ "playwright-report",
10
+ "test-results",
11
+ ".workflow-data",
12
+ ];
13
+ /** Cache correctness is application policy, shared by customer and named workspaces regardless of deployment location. */
14
+ export const applicationTasks = Effect.fn("Composition.applicationTasks")(function* (files) {
15
+ const buildEnvironment = [
16
+ "ANALYZE",
17
+ "NODE_ENV",
18
+ "VERCEL",
19
+ "VERCEL_ENV",
20
+ "VERCEL_PROJECT_PRODUCTION_URL",
21
+ // Sentry uploads must retry when their destination or credentials change.
22
+ "SENTRY_ORG",
23
+ "SENTRY_PROJECT",
24
+ "SENTRY_AUTH_TOKEN",
25
+ ];
26
+ const packages = new Map();
27
+ const environment = new Map();
28
+ for (const file of files) {
29
+ if (file.target === "package.json" ||
30
+ !file.target.endsWith("/package.json")) {
31
+ continue;
32
+ }
33
+ const manifest = yield* Schema.decodeEffect(ManifestJson)(new TextDecoder().decode(file.content));
34
+ if (manifest.name !== undefined) {
35
+ packages.set(manifest.name, {
36
+ dependencies: internalDependencies(manifest),
37
+ directory: file.target.slice(0, -"/package.json".length),
38
+ });
39
+ }
40
+ }
41
+ for (const file of files) {
42
+ if (environmentFileType(file.target) === undefined) {
43
+ continue;
44
+ }
45
+ const directory = file.target
46
+ .slice(0, file.target.lastIndexOf("/") + 1)
47
+ .replace(/\/$/u, "");
48
+ const names = environment.get(directory) ?? new Set();
49
+ environment.set(directory, names);
50
+ for (const match of new TextDecoder()
51
+ .decode(file.content)
52
+ .matchAll(/^\s*(?:export\s+)?(?<name>[A-Za-z_][A-Za-z0-9_]*)\s*=/gmu)) {
53
+ if (match.groups?.name &&
54
+ !match.groups.name.startsWith("NEXT_PUBLIC_")) {
55
+ names.add(match.groups.name);
56
+ }
57
+ }
58
+ }
59
+ // Explicit inputs include physical sources under Git-ignored development workspaces.
60
+ const inputs = [
61
+ "**/*",
62
+ ...nonSourceDirectories.map((directory) => `!**/${directory}/**`),
63
+ "!**/*.tsbuildinfo",
64
+ "!next-env.d.ts",
65
+ "!next.config.compiled.js",
66
+ "!app/.well-known/workflow/**",
67
+ ];
68
+ const build = {
69
+ dependsOn: ["^build", "typecheck", "test"],
70
+ env: buildEnvironment,
71
+ inputs,
72
+ outputs: [".next/**", "!.next/cache/**", "!.next/dev/**"],
73
+ };
74
+ const builds = {};
75
+ for (const [name, app] of packages) {
76
+ if (!app.directory.startsWith("apps/")) {
77
+ continue;
78
+ }
79
+ const names = new Set([
80
+ ...buildEnvironment,
81
+ ...(environment.get("") ?? []),
82
+ ]);
83
+ const visited = new Set();
84
+ const collect = (packageName) => {
85
+ if (visited.has(packageName)) {
86
+ return;
87
+ }
88
+ visited.add(packageName);
89
+ const selected = packages.get(packageName);
90
+ if (selected === undefined) {
91
+ return;
92
+ }
93
+ for (const [directory, variables] of environment) {
94
+ if (directory === selected.directory ||
95
+ directory.startsWith(`${selected.directory}/`)) {
96
+ for (const variable of variables) {
97
+ names.add(variable);
98
+ }
99
+ }
100
+ }
101
+ for (const dependency of selected.dependencies) {
102
+ collect(dependency);
103
+ }
104
+ };
105
+ collect(name);
106
+ // Root package-specific tasks replace the generic definition entirely.
107
+ builds[`${name}#build`] = { ...build, env: [...names] };
108
+ }
109
+ // Unit tests use fixtures rather than deployment environment files.
110
+ const testInputs = [...inputs, "!**/.env", "!**/.env.*"];
111
+ const tasks = {
112
+ build,
113
+ dev: {
114
+ cache: false,
115
+ passThroughEnv: ["PORTLESS_*"],
116
+ persistent: true,
117
+ },
118
+ e2e: { cache: false },
119
+ "e2e:list": { cache: false },
120
+ test: {
121
+ dependsOn: ["^test"],
122
+ env: ["!NEXT_PUBLIC_*"],
123
+ inputs: testInputs,
124
+ },
125
+ typecheck: {
126
+ dependsOn: ["^typecheck"],
127
+ env: ["!NEXT_PUBLIC_*"],
128
+ inputs,
129
+ },
130
+ };
131
+ const scopedTasks = { ...tasks, ...builds };
132
+ return {
133
+ envMode: "loose",
134
+ futureFlags: { affectedUsingTaskInputs: true },
135
+ tasks: scopedTasks,
136
+ };
137
+ });
@@ -0,0 +1,217 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { InvalidComposition } from "./errors.ts";
3
+ export declare const Binding: Schema.Struct<{
4
+ readonly as: Schema.optionalKey<Schema.String>;
5
+ readonly export: Schema.String;
6
+ readonly module: Schema.NonEmptyString;
7
+ readonly order: Schema.optionalKey<Schema.Int>;
8
+ readonly slot: Schema.NonEmptyString;
9
+ readonly target: Schema.NonEmptyString;
10
+ }>;
11
+ declare const Template: Schema.Struct<{
12
+ readonly slots: Schema.$Record<Schema.String, Schema.Literals<readonly ["members", "wrapper", "element", "call", "factory", "graphql"]>>;
13
+ readonly source: Schema.NonEmptyString;
14
+ readonly target: Schema.NonEmptyString;
15
+ }>;
16
+ export declare const TemplateDefinition: Schema.Struct<{
17
+ readonly slotBindings: Schema.optionalKey<Schema.$Array<Schema.Struct<{
18
+ readonly as: Schema.optionalKey<Schema.String>;
19
+ readonly export: Schema.String;
20
+ readonly module: Schema.NonEmptyString;
21
+ readonly order: Schema.optionalKey<Schema.Int>;
22
+ readonly slot: Schema.NonEmptyString;
23
+ readonly target: Schema.NonEmptyString;
24
+ }>>>;
25
+ readonly templates: Schema.optionalKey<Schema.$Array<Schema.Struct<{
26
+ readonly slots: Schema.$Record<Schema.String, Schema.Literals<readonly ["members", "wrapper", "element", "call", "factory", "graphql"]>>;
27
+ readonly source: Schema.NonEmptyString;
28
+ readonly target: Schema.NonEmptyString;
29
+ }>>>;
30
+ }>;
31
+ export type Template = typeof Template.Type;
32
+ export type Binding = typeof Binding.Type & {
33
+ readonly owner: string;
34
+ };
35
+ export declare const readTemplateDefinitions: (items: readonly ({
36
+ type: "registry:base";
37
+ name: string;
38
+ tailwind?: {
39
+ config?: {
40
+ theme?: Record<string, any> | undefined;
41
+ content?: string[] | undefined;
42
+ plugins?: string[] | undefined;
43
+ } | undefined;
44
+ } | undefined;
45
+ docs?: string | undefined;
46
+ $schema?: string | undefined;
47
+ config?: {
48
+ tailwind?: {
49
+ baseColor?: string | undefined;
50
+ config?: string | undefined;
51
+ css?: string | undefined;
52
+ cssVariables?: boolean | undefined;
53
+ prefix?: string | undefined;
54
+ } | undefined;
55
+ menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
56
+ menuAccent?: "subtle" | "bold" | undefined;
57
+ iconLibrary?: string | undefined;
58
+ style?: string | undefined;
59
+ $schema?: string | undefined;
60
+ rsc?: boolean | undefined;
61
+ tsx?: boolean | undefined;
62
+ rtl?: boolean | undefined;
63
+ aliases?: {
64
+ components?: string | undefined;
65
+ ui?: string | undefined;
66
+ utils?: string | undefined;
67
+ lib?: string | undefined;
68
+ hooks?: string | undefined;
69
+ } | undefined;
70
+ registries?: Record<string, string | {
71
+ url: string;
72
+ params?: Record<string, string> | undefined;
73
+ headers?: Record<string, string> | undefined;
74
+ }> | undefined;
75
+ } | undefined;
76
+ css?: Record<string, any> | undefined;
77
+ extends?: string | undefined;
78
+ title?: string | undefined;
79
+ author?: string | undefined;
80
+ description?: string | undefined;
81
+ dependencies?: string[] | undefined;
82
+ devDependencies?: string[] | undefined;
83
+ registryDependencies?: string[] | undefined;
84
+ files?: ({
85
+ path: string;
86
+ type: "registry:page" | "registry:file";
87
+ target: string;
88
+ content?: string | undefined;
89
+ } | {
90
+ path: string;
91
+ 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";
92
+ content?: string | undefined;
93
+ target?: string | undefined;
94
+ })[] | undefined;
95
+ cssVars?: {
96
+ theme?: Record<string, string> | undefined;
97
+ light?: Record<string, string> | undefined;
98
+ dark?: Record<string, string> | undefined;
99
+ } | undefined;
100
+ envVars?: Record<string, string> | undefined;
101
+ meta?: Record<string, any> | undefined;
102
+ categories?: string[] | undefined;
103
+ } | {
104
+ font: {
105
+ family: string;
106
+ provider: "google";
107
+ import: string;
108
+ variable: string;
109
+ weight?: string[] | undefined;
110
+ subsets?: string[] | undefined;
111
+ selector?: string | undefined;
112
+ dependency?: string | undefined;
113
+ };
114
+ type: "registry:font";
115
+ name: string;
116
+ tailwind?: {
117
+ config?: {
118
+ theme?: Record<string, any> | undefined;
119
+ content?: string[] | undefined;
120
+ plugins?: string[] | undefined;
121
+ } | undefined;
122
+ } | undefined;
123
+ docs?: string | undefined;
124
+ $schema?: string | undefined;
125
+ css?: Record<string, any> | undefined;
126
+ extends?: string | undefined;
127
+ title?: string | undefined;
128
+ author?: string | undefined;
129
+ description?: string | undefined;
130
+ dependencies?: string[] | undefined;
131
+ devDependencies?: string[] | undefined;
132
+ registryDependencies?: string[] | undefined;
133
+ files?: ({
134
+ path: string;
135
+ type: "registry:page" | "registry:file";
136
+ target: string;
137
+ content?: string | undefined;
138
+ } | {
139
+ path: string;
140
+ 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";
141
+ content?: string | undefined;
142
+ target?: string | undefined;
143
+ })[] | undefined;
144
+ cssVars?: {
145
+ theme?: Record<string, string> | undefined;
146
+ light?: Record<string, string> | undefined;
147
+ dark?: Record<string, string> | undefined;
148
+ } | undefined;
149
+ envVars?: Record<string, string> | undefined;
150
+ meta?: Record<string, any> | undefined;
151
+ categories?: string[] | undefined;
152
+ } | {
153
+ 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";
154
+ name: string;
155
+ tailwind?: {
156
+ config?: {
157
+ theme?: Record<string, any> | undefined;
158
+ content?: string[] | undefined;
159
+ plugins?: string[] | undefined;
160
+ } | undefined;
161
+ } | undefined;
162
+ docs?: string | undefined;
163
+ $schema?: string | undefined;
164
+ css?: Record<string, any> | undefined;
165
+ extends?: string | undefined;
166
+ title?: string | undefined;
167
+ author?: string | undefined;
168
+ description?: string | undefined;
169
+ dependencies?: string[] | undefined;
170
+ devDependencies?: string[] | undefined;
171
+ registryDependencies?: string[] | undefined;
172
+ files?: ({
173
+ path: string;
174
+ type: "registry:page" | "registry:file";
175
+ target: string;
176
+ content?: string | undefined;
177
+ } | {
178
+ path: string;
179
+ 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";
180
+ content?: string | undefined;
181
+ target?: string | undefined;
182
+ })[] | undefined;
183
+ cssVars?: {
184
+ theme?: Record<string, string> | undefined;
185
+ light?: Record<string, string> | undefined;
186
+ dark?: Record<string, string> | undefined;
187
+ } | undefined;
188
+ envVars?: Record<string, string> | undefined;
189
+ meta?: Record<string, any> | undefined;
190
+ categories?: string[] | undefined;
191
+ })[], published: ReadonlySet<string>) => Effect.Effect<Map<string, {
192
+ readonly slotBindings?: readonly {
193
+ readonly export: string;
194
+ readonly module: string;
195
+ readonly slot: string;
196
+ readonly target: string;
197
+ readonly as?: string | undefined;
198
+ readonly order?: number | undefined;
199
+ }[] | undefined;
200
+ readonly templates?: readonly {
201
+ readonly slots: {
202
+ readonly [x: string]: "members" | "wrapper" | "element" | "call" | "factory" | "graphql";
203
+ };
204
+ readonly source: string;
205
+ readonly target: string;
206
+ }[] | undefined;
207
+ }>, InvalidComposition | Schema.SchemaError, never>;
208
+ export declare const orderBindings: (bindings: readonly Binding[]) => readonly Binding[];
209
+ export declare const renderTemplate: (template: {
210
+ readonly slots: {
211
+ readonly [x: string]: "members" | "wrapper" | "element" | "call" | "factory" | "graphql";
212
+ };
213
+ readonly source: string;
214
+ readonly target: string;
215
+ }, bindings: readonly Binding[], source: string) => Effect.Effect<string, InvalidComposition, never>;
216
+ export {};
217
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,eAAO,MAAM,OAAO;;;;;;;EAOlB,CAAC;AACH,QAAA,MAAM,QAAQ;;;;EAcZ,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;EAG7B,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAC5C,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,eAAO,MAAM,uBAAuB;;;;cAyKwu6B,CAAC;iBAAqB,CAAC;mBAAsD,CAAC;mBAA2C,CAAC;;;;;;gBAAkK,CAAC;qBAAyB,CAAC;kBAAwC,CAAC;eAAqC,CAAC;wBAA8C,CAAC;kBAAyC,CAAC;;iBAA8D,CAAC;kBAAyG,CAAC;mBAAoD,CAAC;aAAmC,CAAC;eAAqC,CAAC;WAAiC,CAAC;WAAkC,CAAC;WAAkC,CAAC;eAAsC,CAAC;sBAA0B,CAAC;cAAoC,CAAC;iBAAuC,CAAC;eAAqC,CAAC;iBAAuC,CAAC;;kBAA+D,CAAC;;kBAAuE,CAAC;mBAAyD,CAAC;;;;;;;;;;;;;;;eAAwgB,CAAC;;;;eAAsT,CAAC;cAAoC,CAAC;;;aAAyE,CAAC;aAAmD,CAAC;YAAkD,CAAC;;;;;;;;;;;cAAu3P,CAAC;eAAuC,CAAC;gBAAwC,CAAC;kBAAwC,CAAC;;;;;cAAyG,CAAC;iBAAqB,CAAC;mBAAsD,CAAC;mBAA2C,CAAC;;;;;;;;;;;;;;;;;eAA0jB,CAAC;;;;eAAsT,CAAC;cAAoC,CAAC;;;aAAyE,CAAC;aAAmD,CAAC;YAAkD,CAAC;;;;;;;;;cAA49M,CAAC;iBAAqB,CAAC;mBAAsD,CAAC;mBAA2C,CAAC;;;;;;;;;;;;;;;;;eAA0jB,CAAC;;;;eAAsT,CAAC;cAAoC,CAAC;;;aAAyE,CAAC;aAAmD,CAAC;YAAkD,CAAC;;;;;;;;;;;;;;;;;;;;;mDAzI1+gD,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,UAAU,SAAS,OAAO,EAAE,KAC3B,SAAS,OAAO,EAOhB,CAAC;AAEJ,eAAO,MAAM,cAAc;;;;;;oGA2H1B,CAAC"}
@@ -0,0 +1,161 @@
1
+ import { Array as EffectArray, Effect, Order, Schema } from "effect";
2
+ import { format } from "oxfmt";
3
+ import { InvalidComposition } from "./errors.js";
4
+ import { relativeFile } from "./files.js";
5
+ const Identifier = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][\w$]*$/u));
6
+ export const Binding = Schema.Struct({
7
+ as: Schema.optionalKey(Identifier),
8
+ export: Identifier,
9
+ module: Schema.NonEmptyString,
10
+ order: Schema.optionalKey(Schema.Int),
11
+ slot: Schema.NonEmptyString,
12
+ target: Schema.NonEmptyString,
13
+ });
14
+ const Template = Schema.Struct({
15
+ slots: Schema.Record(Schema.String, Schema.Literals([
16
+ "members",
17
+ "wrapper",
18
+ "element",
19
+ "call",
20
+ "factory",
21
+ "graphql",
22
+ ])),
23
+ source: Schema.NonEmptyString,
24
+ target: Schema.NonEmptyString,
25
+ });
26
+ export const TemplateDefinition = Schema.Struct({
27
+ slotBindings: Schema.optionalKey(Schema.Array(Binding)),
28
+ templates: Schema.optionalKey(Schema.Array(Template)),
29
+ });
30
+ export const readTemplateDefinitions = Effect.fn("Composition.templates")(function* (items, published) {
31
+ const definitions = new Map();
32
+ for (const item of items) {
33
+ const definition = yield* Schema.decodeUnknownEffect(TemplateDefinition)(item.meta?.composition ?? {}, { onExcessProperty: "error" });
34
+ if (published.has(item.name) && (definition.templates?.length ?? 0) > 0) {
35
+ return yield* new InvalidComposition({
36
+ message: `Published artifact ${item.name} cannot read source-only templates. Publish materialized files or bindings to templates owned by the source checkout.`,
37
+ });
38
+ }
39
+ const slotBindings = [];
40
+ for (const binding of definition.slotBindings ?? []) {
41
+ slotBindings.push({
42
+ ...binding,
43
+ target: yield* relativeFile(binding.target),
44
+ });
45
+ }
46
+ const templates = [];
47
+ for (const template of definition.templates ?? []) {
48
+ templates.push({
49
+ ...template,
50
+ source: yield* relativeFile(template.source),
51
+ target: yield* relativeFile(template.target),
52
+ });
53
+ }
54
+ definitions.set(item.name, { slotBindings, templates });
55
+ }
56
+ return definitions;
57
+ });
58
+ export const orderBindings = (bindings) => EffectArray.sort(bindings, (a, b) => Order.Number(a.order ?? 0, b.order ?? 0) ||
59
+ Order.String(a.owner, b.owner) ||
60
+ Order.String(a.export, b.export));
61
+ export const renderTemplate = Effect.fn("Composition.renderTemplate")(function* (template, bindings, source) {
62
+ const selected = orderBindings(bindings);
63
+ const locals = selected.map((binding) => binding.as ?? binding.export);
64
+ if (new Set(locals).size !== locals.length) {
65
+ return yield* new InvalidComposition({
66
+ message: `Conflicting imports for ${template.target}`,
67
+ });
68
+ }
69
+ const importsByModule = new Map();
70
+ for (const binding of selected) {
71
+ const imports = importsByModule.get(binding.module) ?? [];
72
+ imports.push(`${binding.export}${binding.as ? ` as ${binding.as}` : ""}`);
73
+ importsByModule.set(binding.module, imports);
74
+ }
75
+ const markers = new Map([
76
+ [
77
+ "imports",
78
+ [...importsByModule]
79
+ .map(([module, imports]) => `import { ${imports.join(", ")} } from ${JSON.stringify(module)};`)
80
+ .join("\n"),
81
+ ],
82
+ ]);
83
+ for (const [slot, kind] of Object.entries(template.slots)) {
84
+ const slotBindings = selected.filter((binding) => binding.slot === slot);
85
+ const entries = slotBindings.map((binding) => binding.as ?? binding.export);
86
+ if (kind === "element" && entries.length > 1) {
87
+ return yield* new InvalidComposition({
88
+ message: `${template.target}#${slot} accepts at most one element`,
89
+ });
90
+ }
91
+ if (kind === "wrapper" || kind === "call") {
92
+ markers.set(`${slot}.open`, entries
93
+ .map((name) => (kind === "wrapper" ? `<${name}>` : `${name}(`))
94
+ .join(""));
95
+ markers.set(`${slot}.close`, EffectArray.reverse(entries)
96
+ .map((name) => (kind === "wrapper" ? `</${name}>` : ")"))
97
+ .join(""));
98
+ }
99
+ else if (kind === "graphql") {
100
+ markers.set(`${slot}.spreads`, slotBindings.map((binding) => `...${binding.export}`).join("\n"));
101
+ markers.set(`${slot}.documents`, entries.join(", "));
102
+ }
103
+ else {
104
+ markers.set(slot, entries
105
+ .map((name) => {
106
+ if (kind === "element") {
107
+ return `<${name} />`;
108
+ }
109
+ if (kind === "factory") {
110
+ return `${name}()`;
111
+ }
112
+ return name;
113
+ })
114
+ .join(", "));
115
+ }
116
+ }
117
+ let content = source;
118
+ for (const [name, value] of markers) {
119
+ const marker = `{{${name}}}`;
120
+ if (content.split(marker).length !== 2) {
121
+ return yield* new InvalidComposition({
122
+ message: `${template.source} must contain exactly one ${marker}`,
123
+ });
124
+ }
125
+ content = content.replace(marker, () => value);
126
+ }
127
+ for (const match of content.matchAll(/\{\{#(?<slot>\w+)\}\}(?<body>[\s\S]*?)\{\{\/\k<slot>\}\}/gu)) {
128
+ const slot = match.groups?.slot;
129
+ if (!slot || !Object.hasOwn(template.slots, slot)) {
130
+ return yield* new InvalidComposition({
131
+ message: `Undeclared conditional slot in ${template.source}`,
132
+ });
133
+ }
134
+ content = content.replace(match[0], () => selected.some((binding) => binding.slot === slot)
135
+ ? (match.groups?.body ?? "")
136
+ : "");
137
+ }
138
+ if (/\{\{[^}]+\}\}/u.test(content)) {
139
+ return yield* new InvalidComposition({
140
+ message: `Undeclared template marker in ${template.source}`,
141
+ });
142
+ }
143
+ const formatted = yield* Effect.tryPromise({
144
+ catch: () => new InvalidComposition({ message: `Cannot format ${template.target}` }),
145
+ try: async () => await format(template.target, content, {
146
+ printWidth: 80,
147
+ sortImports: {
148
+ ignoreCase: true,
149
+ newlinesBetween: true,
150
+ order: "asc",
151
+ },
152
+ trailingComma: "es5",
153
+ }),
154
+ });
155
+ if (formatted.errors.length) {
156
+ return yield* new InvalidComposition({
157
+ message: `Invalid rendered source: ${template.target}`,
158
+ });
159
+ }
160
+ return formatted.code;
161
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=test-reference-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-reference-workspace.d.ts","sourceRoot":"","sources":["../src/test-reference-workspace.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { NodeRuntime } from "@effect/platform-node";
2
+ import { Effect } from "effect";
3
+ import { testReferenceWorkspace } from "./reference-workspace.js";
4
+ import { runtime } from "./runtime.js";
5
+ import { findSourceRoot } from "./source-root.js";
6
+ NodeRuntime.runMain(findSourceRoot(process.cwd()).pipe(Effect.flatMap(testReferenceWorkspace), Effect.provide(runtime)));
package/dist/types.d.ts CHANGED
@@ -9,6 +9,8 @@ export type CreateOptions = {
9
9
  auth?: string;
10
10
  cms?: string;
11
11
  commerce?: string;
12
+ search?: string;
13
+ without?: ("auth" | "cms" | "commerce" | "search")[];
12
14
  addOns?: string[];
13
15
  preset?: string;
14
16
  };
@@ -28,13 +30,4 @@ export type ScaffoldResult = {
28
30
  gitInitialized: boolean;
29
31
  committed: boolean;
30
32
  };
31
- export type GitInitResult = {
32
- gitInitialized: boolean;
33
- committed: boolean;
34
- commitError?: string;
35
- };
36
- export type RunCommandResult = {
37
- stdout: string;
38
- stderr: string;
39
- };
40
33
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Effect, FileSystem, Path, Schema } from "effect";
2
+ import { InvalidComposition } from "./errors.ts";
3
+ export interface TypeScriptAlias {
4
+ readonly cwd: string;
5
+ readonly alias: string;
6
+ readonly sourcePath: string;
7
+ }
8
+ export type TypeScriptAliasTarget = Omit<TypeScriptAlias, "sourcePath">;
9
+ export declare const applyTypeScriptAliases: (root: string, aliases: readonly TypeScriptAlias[], ownedAliases: readonly TypeScriptAliasTarget[]) => Effect.Effect<undefined, InvalidComposition | Schema.SchemaError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>;
10
+ //# sourceMappingURL=typescript-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-paths.d.ts","sourceRoot":"","sources":["../src/typescript-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAI1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AACD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAaxE,eAAO,MAAM,sBAAsB,4PAyDjC,CAAC"}