create-next-hydra 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -3
- package/dist/composition/add.d.ts.map +1 -1
- package/dist/composition/add.js +64 -33
- package/dist/composition/catalog.d.ts.map +1 -1
- package/dist/composition/catalog.js +5 -1
- package/dist/composition/format.d.ts.map +1 -1
- package/dist/composition/format.js +3 -1
- package/dist/composition/packages.d.ts +2 -2
- package/dist/composition/packages.d.ts.map +1 -1
- package/dist/composition/packages.js +13 -12
- package/dist/composition/planner.d.ts.map +1 -1
- package/dist/composition/planner.js +88 -42
- package/dist/composition/schema.d.ts +59 -0
- package/dist/composition/schema.d.ts.map +1 -1
- package/dist/composition/schema.js +52 -1
- package/dist/composition/types.d.ts +26 -2
- package/dist/composition/types.d.ts.map +1 -1
- package/dist/composition/typescript-paths.d.ts +6 -0
- package/dist/composition/typescript-paths.d.ts.map +1 -0
- package/dist/composition/typescript-paths.js +157 -0
- package/dist/composition/use.d.ts.map +1 -1
- package/dist/composition/use.js +5 -0
- package/dist/composition/workspace.d.ts.map +1 -1
- package/dist/composition/workspace.js +5 -3
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +8 -1
- package/dist/sanitize.d.ts.map +1 -1
- package/dist/sanitize.js +89 -2
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +5 -0
- package/package.json +11 -4
- package/schema/selection-definition.json +65 -3
|
@@ -11,6 +11,16 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
11
11
|
source: string;
|
|
12
12
|
target: string;
|
|
13
13
|
}>, "many">>;
|
|
14
|
+
binding: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
sourcePath: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>>;
|
|
16
|
+
specifier: z.ZodString;
|
|
17
|
+
}, "strict", z.ZodTypeAny, {
|
|
18
|
+
sourcePath?: string | undefined;
|
|
19
|
+
specifier: string;
|
|
20
|
+
}, {
|
|
21
|
+
sourcePath?: string | undefined;
|
|
22
|
+
specifier: string;
|
|
23
|
+
}>>;
|
|
14
24
|
compatibility: z.ZodDefault<z.ZodObject<{
|
|
15
25
|
conflicts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
16
26
|
requires: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -49,6 +59,19 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
49
59
|
dependency: string;
|
|
50
60
|
path: string;
|
|
51
61
|
}>, "many">>;
|
|
62
|
+
providerDependencies: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
63
|
+
cwd: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
64
|
+
section: z.ZodEnum<["dependencies", "devDependencies", "optionalDependencies"]>;
|
|
65
|
+
slot: z.ZodEnum<["auth", "cms", "commerce"]>;
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
67
|
+
cwd: string;
|
|
68
|
+
section: "dependencies" | "devDependencies" | "optionalDependencies";
|
|
69
|
+
slot: "auth" | "cms" | "commerce";
|
|
70
|
+
}, {
|
|
71
|
+
cwd: string;
|
|
72
|
+
section: "dependencies" | "devDependencies" | "optionalDependencies";
|
|
73
|
+
slot: "auth" | "cms" | "commerce";
|
|
74
|
+
}>, "many">>;
|
|
52
75
|
selections: z.ZodOptional<z.ZodObject<{
|
|
53
76
|
addOns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
54
77
|
providers: z.ZodOptional<z.ZodObject<{
|
|
@@ -85,6 +108,10 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
85
108
|
source: string;
|
|
86
109
|
target: string;
|
|
87
110
|
}[];
|
|
111
|
+
binding?: {
|
|
112
|
+
sourcePath?: string | undefined;
|
|
113
|
+
specifier: string;
|
|
114
|
+
} | undefined;
|
|
88
115
|
compatibility: {
|
|
89
116
|
conflicts: string[];
|
|
90
117
|
requires: string[];
|
|
@@ -101,6 +128,11 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
101
128
|
dependency: string;
|
|
102
129
|
path: string;
|
|
103
130
|
}[];
|
|
131
|
+
providerDependencies: {
|
|
132
|
+
cwd: string;
|
|
133
|
+
section: "dependencies" | "devDependencies" | "optionalDependencies";
|
|
134
|
+
slot: "auth" | "cms" | "commerce";
|
|
135
|
+
}[];
|
|
104
136
|
selections?: {
|
|
105
137
|
addOns: string[];
|
|
106
138
|
providers?: {
|
|
@@ -115,6 +147,10 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
115
147
|
source: string;
|
|
116
148
|
target: string;
|
|
117
149
|
}[] | undefined;
|
|
150
|
+
binding?: {
|
|
151
|
+
sourcePath?: string | undefined;
|
|
152
|
+
specifier: string;
|
|
153
|
+
} | undefined;
|
|
118
154
|
compatibility?: {
|
|
119
155
|
conflicts?: string[] | undefined;
|
|
120
156
|
requires?: string[] | undefined;
|
|
@@ -131,6 +167,11 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
131
167
|
dependency: string;
|
|
132
168
|
path: string;
|
|
133
169
|
}[] | undefined;
|
|
170
|
+
providerDependencies?: {
|
|
171
|
+
cwd: string;
|
|
172
|
+
section: "dependencies" | "devDependencies" | "optionalDependencies";
|
|
173
|
+
slot: "auth" | "cms" | "commerce";
|
|
174
|
+
}[] | undefined;
|
|
134
175
|
selections?: {
|
|
135
176
|
addOns?: string[] | undefined;
|
|
136
177
|
providers?: {
|
|
@@ -145,6 +186,10 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
145
186
|
source: string;
|
|
146
187
|
target: string;
|
|
147
188
|
}[];
|
|
189
|
+
binding?: {
|
|
190
|
+
sourcePath?: string | undefined;
|
|
191
|
+
specifier: string;
|
|
192
|
+
} | undefined;
|
|
148
193
|
compatibility: {
|
|
149
194
|
conflicts: string[];
|
|
150
195
|
requires: string[];
|
|
@@ -161,6 +206,11 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
161
206
|
dependency: string;
|
|
162
207
|
path: string;
|
|
163
208
|
}[];
|
|
209
|
+
providerDependencies: {
|
|
210
|
+
cwd: string;
|
|
211
|
+
section: "dependencies" | "devDependencies" | "optionalDependencies";
|
|
212
|
+
slot: "auth" | "cms" | "commerce";
|
|
213
|
+
}[];
|
|
164
214
|
selections?: {
|
|
165
215
|
addOns: string[];
|
|
166
216
|
providers?: {
|
|
@@ -175,6 +225,10 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
175
225
|
source: string;
|
|
176
226
|
target: string;
|
|
177
227
|
}[] | undefined;
|
|
228
|
+
binding?: {
|
|
229
|
+
sourcePath?: string | undefined;
|
|
230
|
+
specifier: string;
|
|
231
|
+
} | undefined;
|
|
178
232
|
compatibility?: {
|
|
179
233
|
conflicts?: string[] | undefined;
|
|
180
234
|
requires?: string[] | undefined;
|
|
@@ -191,6 +245,11 @@ export declare const selectionDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
191
245
|
dependency: string;
|
|
192
246
|
path: string;
|
|
193
247
|
}[] | undefined;
|
|
248
|
+
providerDependencies?: {
|
|
249
|
+
cwd: string;
|
|
250
|
+
section: "dependencies" | "devDependencies" | "optionalDependencies";
|
|
251
|
+
slot: "auth" | "cms" | "commerce";
|
|
252
|
+
}[] | undefined;
|
|
194
253
|
selections?: {
|
|
195
254
|
addOns?: string[] | undefined;
|
|
196
255
|
providers?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composition/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,+BAA+B,4HAC+E,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composition/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,+BAA+B,4HAC+E,CAAC;AAyE5H,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmGlC,CAAC;AAEL,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAC;AAEZ,wBAAgB,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,MAAM,EAAE,CAK1D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { PROVIDER_SLOTS } from "./types.js";
|
|
3
|
+
import { PROVIDER_ALIASES, PROVIDER_SLOTS } from "./types.js";
|
|
4
4
|
export const NEXT_HYDRA_SELECTION_SCHEMA_URL = "https://raw.githubusercontent.com/jakala-na/next-hydra/main/packages/create-next-hydra/schema/selection-definition.json";
|
|
5
5
|
const workspaceRelativePathSchema = z
|
|
6
6
|
.string()
|
|
@@ -21,6 +21,23 @@ const packageRequirementSchema = z
|
|
|
21
21
|
specifier: z.string().min(1),
|
|
22
22
|
})
|
|
23
23
|
.strict();
|
|
24
|
+
const providerBindingSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
sourcePath: workspaceFilePathSchema.optional(),
|
|
27
|
+
specifier: z.string().min(1),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
const providerDependencySchema = z
|
|
31
|
+
.object({
|
|
32
|
+
cwd: workspaceRelativePathSchema,
|
|
33
|
+
section: z.enum([
|
|
34
|
+
"dependencies",
|
|
35
|
+
"devDependencies",
|
|
36
|
+
"optionalDependencies",
|
|
37
|
+
]),
|
|
38
|
+
slot: z.enum(PROVIDER_SLOTS),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
24
41
|
const pnpmPatchSchema = z
|
|
25
42
|
.object({
|
|
26
43
|
dependency: z.string().min(1),
|
|
@@ -40,6 +57,7 @@ const presetSelectionsSchema = z
|
|
|
40
57
|
providers: providerSelectionsSchema.optional(),
|
|
41
58
|
})
|
|
42
59
|
.strict();
|
|
60
|
+
const providerAliasNames = new Set(Object.values(PROVIDER_ALIASES));
|
|
43
61
|
export const selectionDefinitionSchema = z
|
|
44
62
|
.object({
|
|
45
63
|
assets: z
|
|
@@ -50,6 +68,7 @@ export const selectionDefinitionSchema = z
|
|
|
50
68
|
})
|
|
51
69
|
.strict())
|
|
52
70
|
.default([]),
|
|
71
|
+
binding: providerBindingSchema.optional(),
|
|
53
72
|
compatibility: z
|
|
54
73
|
.object({
|
|
55
74
|
conflicts: z.array(z.string().min(1)).default([]),
|
|
@@ -61,6 +80,7 @@ export const selectionDefinitionSchema = z
|
|
|
61
80
|
kind: z.enum(["provider", "add-on", "preset"]),
|
|
62
81
|
packages: z.array(packageRequirementSchema).default([]),
|
|
63
82
|
pnpmPatches: z.array(pnpmPatchSchema).default([]),
|
|
83
|
+
providerDependencies: z.array(providerDependencySchema).default([]),
|
|
64
84
|
selections: presetSelectionsSchema.optional(),
|
|
65
85
|
slot: z.enum(PROVIDER_SLOTS).optional(),
|
|
66
86
|
})
|
|
@@ -73,6 +93,13 @@ export const selectionDefinitionSchema = z
|
|
|
73
93
|
path: ["slot"],
|
|
74
94
|
});
|
|
75
95
|
}
|
|
96
|
+
if (definition.kind === "provider" && !definition.binding) {
|
|
97
|
+
context.addIssue({
|
|
98
|
+
code: z.ZodIssueCode.custom,
|
|
99
|
+
message: "a provider must declare its binding",
|
|
100
|
+
path: ["binding"],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
76
103
|
if (definition.kind !== "provider" && definition.slot) {
|
|
77
104
|
context.addIssue({
|
|
78
105
|
code: z.ZodIssueCode.custom,
|
|
@@ -80,6 +107,30 @@ export const selectionDefinitionSchema = z
|
|
|
80
107
|
path: ["slot"],
|
|
81
108
|
});
|
|
82
109
|
}
|
|
110
|
+
if (definition.kind !== "provider" && definition.binding) {
|
|
111
|
+
context.addIssue({
|
|
112
|
+
code: z.ZodIssueCode.custom,
|
|
113
|
+
message: `${definition.kind} must not declare a provider binding`,
|
|
114
|
+
path: ["binding"],
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (definition.kind === "preset" &&
|
|
118
|
+
definition.providerDependencies.length > 0) {
|
|
119
|
+
context.addIssue({
|
|
120
|
+
code: z.ZodIssueCode.custom,
|
|
121
|
+
message: "a preset must not declare provider dependencies",
|
|
122
|
+
path: ["providerDependencies"],
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
for (const [index, requirement] of definition.packages.entries()) {
|
|
126
|
+
if (providerAliasNames.has(requirement.name)) {
|
|
127
|
+
context.addIssue({
|
|
128
|
+
code: z.ZodIssueCode.custom,
|
|
129
|
+
message: "stable Provider aliases must be declared through providerDependencies",
|
|
130
|
+
path: ["packages", index, "name"],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
83
134
|
if (definition.kind === "preset" && !definition.selections) {
|
|
84
135
|
context.addIssue({
|
|
85
136
|
code: z.ZodIssueCode.custom,
|
|
@@ -3,7 +3,11 @@ import type { RegistryItem } from "shadcn/schema";
|
|
|
3
3
|
export type RegistriesConfig = Awaited<ReturnType<typeof getRegistriesConfig>>;
|
|
4
4
|
export declare const PROVIDER_SLOTS: readonly ["auth", "cms", "commerce"];
|
|
5
5
|
export type ProviderSlot = (typeof PROVIDER_SLOTS)[number];
|
|
6
|
-
export declare const PROVIDER_ALIASES:
|
|
6
|
+
export declare const PROVIDER_ALIASES: {
|
|
7
|
+
readonly auth: "@repo/auth";
|
|
8
|
+
readonly cms: "@repo/cms";
|
|
9
|
+
readonly commerce: "@repo/commerce-provider";
|
|
10
|
+
};
|
|
7
11
|
export type SelectionKind = "provider" | "add-on" | "preset";
|
|
8
12
|
export type DependencySection = "dependencies" | "devDependencies" | "optionalDependencies";
|
|
9
13
|
export type PackageRequirement = {
|
|
@@ -12,6 +16,16 @@ export type PackageRequirement = {
|
|
|
12
16
|
name: string;
|
|
13
17
|
specifier: string;
|
|
14
18
|
};
|
|
19
|
+
export type PackageRequirementTarget = Omit<PackageRequirement, "specifier">;
|
|
20
|
+
export type ProviderBinding = {
|
|
21
|
+
specifier: string;
|
|
22
|
+
sourcePath?: string;
|
|
23
|
+
};
|
|
24
|
+
export type ProviderDependency = {
|
|
25
|
+
cwd: string;
|
|
26
|
+
section: DependencySection;
|
|
27
|
+
slot: ProviderSlot;
|
|
28
|
+
};
|
|
15
29
|
export type AssetContribution = {
|
|
16
30
|
source: string;
|
|
17
31
|
target: string;
|
|
@@ -28,11 +42,13 @@ export type SelectionDefinition = {
|
|
|
28
42
|
id: string;
|
|
29
43
|
kind: SelectionKind;
|
|
30
44
|
slot?: ProviderSlot;
|
|
45
|
+
binding?: ProviderBinding;
|
|
31
46
|
compatibility: {
|
|
32
47
|
requires: string[];
|
|
33
48
|
conflicts: string[];
|
|
34
49
|
};
|
|
35
50
|
packages: PackageRequirement[];
|
|
51
|
+
providerDependencies: ProviderDependency[];
|
|
36
52
|
pnpmPatches: PnpmPatch[];
|
|
37
53
|
assets: AssetContribution[];
|
|
38
54
|
selections?: {
|
|
@@ -69,18 +85,26 @@ export type PreparedComposition = {
|
|
|
69
85
|
target: string;
|
|
70
86
|
}[];
|
|
71
87
|
};
|
|
88
|
+
export type TypeScriptPathAlias = {
|
|
89
|
+
alias: string;
|
|
90
|
+
cwd: string;
|
|
91
|
+
sourcePath: string;
|
|
92
|
+
};
|
|
93
|
+
export type TypeScriptPathAliasTarget = Pick<TypeScriptPathAlias, "alias" | "cwd">;
|
|
72
94
|
export type CompositionPlan = {
|
|
73
95
|
selection: WorkspaceSelection;
|
|
74
96
|
selections: CatalogSelection[];
|
|
75
97
|
entryItems: string[];
|
|
76
98
|
registryItems: string[];
|
|
77
99
|
packageRequirements: PackageRequirement[];
|
|
78
|
-
|
|
100
|
+
catalogPackageRequirementTargets: PackageRequirementTarget[];
|
|
79
101
|
pnpmPatches: PnpmPatch[];
|
|
80
102
|
catalogPnpmPatches: PnpmPatch[];
|
|
81
103
|
assets: AssetContribution[];
|
|
82
104
|
managedTargets: string[];
|
|
83
105
|
catalogManagedTargets: string[];
|
|
106
|
+
catalogTypeScriptPathAliases: TypeScriptPathAliasTarget[];
|
|
107
|
+
typeScriptPathAliases: TypeScriptPathAlias[];
|
|
84
108
|
variableTargets: string[];
|
|
85
109
|
instructions: string[];
|
|
86
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/composition/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC;AAE/E,eAAO,MAAM,cAAc,YAAI,MAAM,EAAE,KAAK,EAAE,UAAU,CAAU,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,eAAO,MAAM,gBAAgB,
|
|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AE,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,4BAA4B,EAAE,yBAAyB,EAAE,CAAC;IAC1D,qBAAqB,EAAE,mBAAmB,EAAE,CAAC;IAC7C,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CompositionPlan } from "./types.js";
|
|
2
|
+
type TypeScriptPathPlan = Pick<CompositionPlan, "catalogTypeScriptPathAliases" | "typeScriptPathAliases">;
|
|
3
|
+
export declare const applyTypeScriptPathAliases: (workspaceRoot: string, plan: TypeScriptPathPlan) => Promise<void>;
|
|
4
|
+
export declare const checkTypeScriptPathAliases: (workspaceRoot: string, plan: TypeScriptPathPlan) => Promise<string[]>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=typescript-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-paths.d.ts","sourceRoot":"","sources":["../../src/composition/typescript-paths.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,YAAY,CAAC;AAkBvE,KAAK,kBAAkB,GAAG,IAAI,CAC5B,eAAe,EACf,8BAA8B,GAAG,uBAAuB,CACzD,CAAC;AAmHF,eAAO,MAAM,0BAA0B,kBACtB,MAAM,QACf,kBAAkB,KACvB,OAAO,CAAC,IAAI,CA+Cd,CAAC;AAEF,eAAO,MAAM,0BAA0B,kBACtB,MAAM,QACf,kBAAkB,KACvB,OAAO,CAAC,MAAM,EAAE,CAiClB,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { pathExists } from "../fs-utils.js";
|
|
6
|
+
import { CompositionValidationError } from "./errors.js";
|
|
7
|
+
const typeScriptConfigSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
compilerOptions: z
|
|
10
|
+
.object({
|
|
11
|
+
paths: z.record(z.string(), z.array(z.string())).optional(),
|
|
12
|
+
})
|
|
13
|
+
.passthrough()
|
|
14
|
+
.optional(),
|
|
15
|
+
})
|
|
16
|
+
.passthrough();
|
|
17
|
+
const formattingOptions = {
|
|
18
|
+
eol: "\n",
|
|
19
|
+
insertFinalNewline: true,
|
|
20
|
+
insertSpaces: true,
|
|
21
|
+
tabSize: 2,
|
|
22
|
+
};
|
|
23
|
+
const parseTypeScriptConfig = (source, label) => {
|
|
24
|
+
const errors = [];
|
|
25
|
+
// SAFETY: jsonc-parser types its decoded JSON value as any; Zod validates it
|
|
26
|
+
// immediately below before it enters the composition domain.
|
|
27
|
+
const value = parse(source, errors, {
|
|
28
|
+
allowTrailingComma: true,
|
|
29
|
+
disallowComments: false,
|
|
30
|
+
});
|
|
31
|
+
if (errors.length > 0) {
|
|
32
|
+
throw new CompositionValidationError(`${label} is not valid JSONC.`, [
|
|
33
|
+
...new Set(errors.map((error) => printParseErrorCode(error.error))),
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
const result = typeScriptConfigSchema.safeParse(value);
|
|
37
|
+
if (!result.success) {
|
|
38
|
+
throw new CompositionValidationError(`${label} is not a valid tsconfig.json file.`, result.error.issues.map((issue) => issue.message));
|
|
39
|
+
}
|
|
40
|
+
return result.data;
|
|
41
|
+
};
|
|
42
|
+
const toPosixRelative = (from, to) => {
|
|
43
|
+
const relative = path.relative(from, to).split(path.sep).join(path.posix.sep);
|
|
44
|
+
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
45
|
+
};
|
|
46
|
+
const expectedPaths = (workspaceRoot, requirement) => {
|
|
47
|
+
const consumerRoot = path.join(workspaceRoot, requirement.cwd);
|
|
48
|
+
const targetRoot = path.join(workspaceRoot, requirement.sourcePath);
|
|
49
|
+
const relativeTarget = toPosixRelative(consumerRoot, targetRoot);
|
|
50
|
+
return [
|
|
51
|
+
{ alias: requirement.alias, expected: [relativeTarget] },
|
|
52
|
+
{
|
|
53
|
+
alias: `${requirement.alias}/*`,
|
|
54
|
+
expected: [`${relativeTarget}/*`],
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
};
|
|
58
|
+
const insertBeforeWorkspaceWildcard = (properties) => {
|
|
59
|
+
const wildcardIndex = properties.indexOf("@repo/*");
|
|
60
|
+
return wildcardIndex === -1 ? properties.length : wildcardIndex;
|
|
61
|
+
};
|
|
62
|
+
const samePath = (actual, expected) => actual !== undefined &&
|
|
63
|
+
actual.length === expected.length &&
|
|
64
|
+
actual.every((value, index) => value === expected[index]);
|
|
65
|
+
const typeScriptConfigPath = (cwd) => path.posix.join(cwd, "tsconfig.json");
|
|
66
|
+
const typeScriptConfigPlans = (plan) => {
|
|
67
|
+
const byConfig = new Map();
|
|
68
|
+
for (const target of plan.catalogTypeScriptPathAliases) {
|
|
69
|
+
const config = typeScriptConfigPath(target.cwd);
|
|
70
|
+
const entry = byConfig.get(config) ?? {
|
|
71
|
+
desired: [],
|
|
72
|
+
governed: new Set(),
|
|
73
|
+
};
|
|
74
|
+
entry.governed.add(target.alias);
|
|
75
|
+
byConfig.set(config, entry);
|
|
76
|
+
}
|
|
77
|
+
for (const alias of plan.typeScriptPathAliases) {
|
|
78
|
+
const config = typeScriptConfigPath(alias.cwd);
|
|
79
|
+
const entry = byConfig.get(config) ?? {
|
|
80
|
+
desired: [],
|
|
81
|
+
governed: new Set(),
|
|
82
|
+
};
|
|
83
|
+
entry.desired.push(alias);
|
|
84
|
+
entry.governed.add(alias.alias);
|
|
85
|
+
byConfig.set(config, entry);
|
|
86
|
+
}
|
|
87
|
+
const configs = [...byConfig].map(([config, entry]) => ({
|
|
88
|
+
config,
|
|
89
|
+
desired: entry.desired,
|
|
90
|
+
governed: [...entry.governed],
|
|
91
|
+
}));
|
|
92
|
+
// eslint-disable-next-line unicorn/no-array-sort -- The newly-created array is safe to sort in place.
|
|
93
|
+
return configs.sort((left, right) => left.config.localeCompare(right.config));
|
|
94
|
+
};
|
|
95
|
+
const governedPathAliases = (alias) => [alias, `${alias}/*`];
|
|
96
|
+
export const applyTypeScriptPathAliases = async (workspaceRoot, plan) => {
|
|
97
|
+
await Promise.all(typeScriptConfigPlans(plan).map(async ({ config, desired, governed }) => {
|
|
98
|
+
const absoluteConfigPath = path.join(workspaceRoot, config);
|
|
99
|
+
if (desired.length === 0 && !(await pathExists(absoluteConfigPath))) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let source = await readFile(absoluteConfigPath, "utf-8");
|
|
103
|
+
const configValue = parseTypeScriptConfig(source, config);
|
|
104
|
+
const paths = configValue.compilerOptions?.paths ?? {};
|
|
105
|
+
const updates = desired.flatMap((entry) => expectedPaths(workspaceRoot, entry));
|
|
106
|
+
const desiredAliases = new Set(desired.map((entry) => entry.alias));
|
|
107
|
+
const removals = governed
|
|
108
|
+
.filter((alias) => !desiredAliases.has(alias))
|
|
109
|
+
.flatMap(governedPathAliases)
|
|
110
|
+
.filter((alias) => paths[alias] !== undefined);
|
|
111
|
+
if (removals.length === 0 &&
|
|
112
|
+
updates.every(({ alias, expected }) => samePath(paths[alias], expected))) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
for (const alias of removals) {
|
|
116
|
+
source = applyEdits(source, modify(source, ["compilerOptions", "paths", alias], undefined, {
|
|
117
|
+
formattingOptions,
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
for (const { alias, expected } of updates) {
|
|
121
|
+
source = applyEdits(source, modify(source, ["compilerOptions", "paths", alias], expected, {
|
|
122
|
+
formattingOptions,
|
|
123
|
+
getInsertionIndex: insertBeforeWorkspaceWildcard,
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
await writeFile(absoluteConfigPath, source, "utf-8");
|
|
127
|
+
}));
|
|
128
|
+
};
|
|
129
|
+
export const checkTypeScriptPathAliases = async (workspaceRoot, plan) => {
|
|
130
|
+
const issues = await Promise.all(typeScriptConfigPlans(plan).map(async ({ config, desired, governed }) => {
|
|
131
|
+
const absoluteConfigPath = path.join(workspaceRoot, config);
|
|
132
|
+
if (!(await pathExists(absoluteConfigPath))) {
|
|
133
|
+
return desired.length === 0 ? [] : [`${config}: file is missing`];
|
|
134
|
+
}
|
|
135
|
+
const source = await readFile(absoluteConfigPath, "utf-8");
|
|
136
|
+
const configValue = parseTypeScriptConfig(source, config);
|
|
137
|
+
const paths = configValue.compilerOptions?.paths ?? {};
|
|
138
|
+
const desiredAliases = new Set(desired.map((entry) => entry.alias));
|
|
139
|
+
const pathIssues = desired
|
|
140
|
+
.flatMap((entry) => expectedPaths(workspaceRoot, entry))
|
|
141
|
+
.filter(({ alias, expected }) => !samePath(paths[alias], expected))
|
|
142
|
+
.map(({ alias, expected }) => `${config}: expected compilerOptions.paths.${alias} to be ${JSON.stringify(expected)}`);
|
|
143
|
+
const stalePathIssues = governed
|
|
144
|
+
.filter((alias) => !desiredAliases.has(alias))
|
|
145
|
+
.flatMap(governedPathAliases)
|
|
146
|
+
.flatMap((alias) => {
|
|
147
|
+
const actual = paths[alias];
|
|
148
|
+
return actual === undefined
|
|
149
|
+
? []
|
|
150
|
+
: [
|
|
151
|
+
`${config}: expected compilerOptions.paths.${alias} to be absent, found ${JSON.stringify(actual)}`,
|
|
152
|
+
];
|
|
153
|
+
});
|
|
154
|
+
return [...pathIssues, ...stalePathIssues];
|
|
155
|
+
}));
|
|
156
|
+
return issues.flat();
|
|
157
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../src/composition/use.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAyB,UAAU,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../src/composition/use.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAyB,UAAU,EAAE,MAAM,WAAW,CAAC;AA2B9D,MAAM,MAAM,qBAAqB,GAAG;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,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;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,GAAG,CACnB,OAAO,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,KACnC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAEhC,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D,CAAC;AA+DF,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,OAAO,UAAuB,GACtC,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,YAAY,GAAE,eAAoB,GACjC,OAAO,CAAC,IAAI,CAAC,CA4Jf"}
|
package/dist/composition/use.js
CHANGED
|
@@ -7,6 +7,7 @@ import { CompositionValidationError } from "./errors.js";
|
|
|
7
7
|
import { formatCompositionPlan, formatCompositionPreview, formatCompositionResult, hasCompositionChanges, } from "./format.js";
|
|
8
8
|
import { installPreparedComposition, prepareComposition, validatePackageRequirementTargets, } from "./install.js";
|
|
9
9
|
import { planComposition, selectionFromPreset } from "./planner.js";
|
|
10
|
+
import { applyTypeScriptPathAliases } from "./typescript-paths.js";
|
|
10
11
|
import { applyPackageRequirements, applyPnpmPatches, checkWorkspaceComposition, readWorkspaceSelection, removeWorkspaceTargets, writeWorkspaceSelection, } from "./workspace.js";
|
|
11
12
|
function requestedSelection(current, options, presetSelection) {
|
|
12
13
|
const providers = presetSelection
|
|
@@ -132,6 +133,7 @@ export async function useComposition(options, dependencies = {}) {
|
|
|
132
133
|
"remove managed application files",
|
|
133
134
|
"install selected source",
|
|
134
135
|
"update package aliases",
|
|
136
|
+
"update TypeScript paths",
|
|
135
137
|
"update pnpm patches",
|
|
136
138
|
"install dependencies",
|
|
137
139
|
];
|
|
@@ -157,6 +159,9 @@ export async function useComposition(options, dependencies = {}) {
|
|
|
157
159
|
await runStep("update package aliases", async () => {
|
|
158
160
|
await applyPackageRequirements(cwd, plan);
|
|
159
161
|
});
|
|
162
|
+
await runStep("update TypeScript paths", async () => {
|
|
163
|
+
await applyTypeScriptPathAliases(cwd, plan);
|
|
164
|
+
});
|
|
160
165
|
await runStep("update pnpm patches", async () => {
|
|
161
166
|
await applyPnpmPatches(cwd, plan);
|
|
162
167
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/composition/workspace.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/composition/workspace.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAE1D,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAyB7B;AAED,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,wBAAwB,CAC5C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,eAAe,CAAC,qBAAqB,CAAC,GACnD,OAAO,CAAC,IAAI,CAAC,CAgCf;AAuBD,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAyBD,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,yBAAyB,CAC7C,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,eAAe,EACrB,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,GAChD,OAAO,CAAC,MAAM,EAAE,CAAC,CAuGnB"}
|
|
@@ -5,6 +5,7 @@ import { pathExists, readJsonFile, removePath, writeJsonFile, } from "../fs-util
|
|
|
5
5
|
import { CompositionValidationError } from "./errors.js";
|
|
6
6
|
import { readPackageJson } from "./packages.js";
|
|
7
7
|
import { formatZodError, workspaceSelectionSchema } from "./schema.js";
|
|
8
|
+
import { checkTypeScriptPathAliases } from "./typescript-paths.js";
|
|
8
9
|
export const WORKSPACE_SELECTION_FILE = "next-hydra.json";
|
|
9
10
|
export async function readWorkspaceSelection(workspaceRoot) {
|
|
10
11
|
const filePath = path.join(workspaceRoot, WORKSPACE_SELECTION_FILE);
|
|
@@ -31,7 +32,7 @@ export async function writeWorkspaceSelection(workspaceRoot, selection) {
|
|
|
31
32
|
}
|
|
32
33
|
export async function applyPackageRequirements(workspaceRoot, plan) {
|
|
33
34
|
const selected = new Set(plan.packageRequirements.map((requirement) => `${requirement.cwd}\0${requirement.section}\0${requirement.name}`));
|
|
34
|
-
const removals = plan.
|
|
35
|
+
const removals = plan.catalogPackageRequirementTargets.filter((requirement) => !selected.has(`${requirement.cwd}\0${requirement.section}\0${requirement.name}`));
|
|
35
36
|
const byManifest = new Map();
|
|
36
37
|
for (const requirement of removals) {
|
|
37
38
|
const manifest = path.posix.join(requirement.cwd, "package.json");
|
|
@@ -148,7 +149,7 @@ export async function removeWorkspaceTargets(workspaceRoot, targets) {
|
|
|
148
149
|
export async function checkWorkspaceComposition(workspaceRoot, plan, managedFiles) {
|
|
149
150
|
const drift = [];
|
|
150
151
|
const selected = new Set(plan.packageRequirements.map((requirement) => `${requirement.cwd}\0${requirement.section}\0${requirement.name}`));
|
|
151
|
-
const unselectedPackageDrift = await Promise.all(plan.
|
|
152
|
+
const unselectedPackageDrift = await Promise.all(plan.catalogPackageRequirementTargets.map(async (requirement) => {
|
|
152
153
|
const key = `${requirement.cwd}\0${requirement.section}\0${requirement.name}`;
|
|
153
154
|
if (selected.has(key)) {
|
|
154
155
|
return;
|
|
@@ -173,7 +174,8 @@ export async function checkWorkspaceComposition(workspaceRoot, plan, managedFile
|
|
|
173
174
|
? undefined
|
|
174
175
|
: `${manifest}: expected ${requirement.section}.${requirement.name} to be ${requirement.specifier}, found ${actual ?? "missing"}`;
|
|
175
176
|
}));
|
|
176
|
-
|
|
177
|
+
const typeScriptPathDrift = await checkTypeScriptPathAliases(workspaceRoot, plan);
|
|
178
|
+
drift.push(...selectedPackageDrift.filter((issue) => issue !== undefined), ...typeScriptPathDrift);
|
|
177
179
|
if (plan.catalogPnpmPatches.length > 0) {
|
|
178
180
|
const workspaceFile = path.join(workspaceRoot, "pnpm-workspace.yaml");
|
|
179
181
|
const { config } = readPnpmWorkspaceConfig(await readFile(workspaceFile, "utf-8"));
|
package/dist/constants.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const DEFAULT_REPO_URL = "https://github.com/jakala-na/next-hydra
|
|
|
4
4
|
export declare const DEFAULT_COMMIT_MESSAGE = "Initial commit";
|
|
5
5
|
export declare const DEFAULT_PACKAGE_MANAGER = "pnpm";
|
|
6
6
|
export declare const DEFAULT_STARTER: StarterDefinition;
|
|
7
|
-
export declare const SANITIZE_REMOVE_PATHS: readonly [".changeset", ".git", ".github/workflows/registry-integrity.yml", ".github/workflows/release-create-next-hydra.yml", ".scratch", "RELEASING.md", "apps/docs", "next-hydra.json", "packages/create-next-hydra", "scripts/release-create-next-hydra.mjs", "scripts/sync-registry-files.ts"];
|
|
7
|
+
export declare const SANITIZE_REMOVE_PATHS: readonly [".changeset", ".git", ".github/workflows/e2e.yml", ".github/workflows/registry-integrity.yml", ".github/workflows/release-create-next-hydra.yml", ".scratch", "RELEASING.md", "apps/docs", "next-hydra.json", "packages/create-next-hydra", "scripts/release-create-next-hydra.mjs", "scripts/sync-registry-files.ts"];
|
|
8
8
|
export declare const SANITIZE_REMOVE_SCRIPTS: readonly ["changeset", "changeset:status", "publish:cli", "registry:check", "registry:sync", "release:create-next-hydra", "release:create-next-hydra:dry-run", "version:cli"];
|
|
9
9
|
export declare const SANITIZE_REMOVE_ROOT_DEPENDENCIES: readonly ["@clack/prompts", "commander"];
|
|
10
10
|
export declare const SANITIZE_REMOVE_ROOT_DEV_DEPENDENCIES: readonly ["@changesets/cli"];
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C,eAAO,MAAM,gBA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C3B,mCAAmC,EACnC,aAAa,CACL,CAAC;AAEX,eAAO,MAAM,iCAAiC,YAC5C,gBAAgB,EAChB,WAAW,CACH,CAAC;AAEX,eAAO,MAAM,qCAAqC,YAChD,iBAAiB,CACT,CAAC"}
|
package/dist/constants.js
CHANGED
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,cAGC;CACF;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAiBhE;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,cAGC;CACF;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAiBhE;AAyBD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,YAAY,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAajB"}
|
package/dist/prompts.js
CHANGED
|
@@ -22,7 +22,14 @@ export async function promptForTargetDirectory() {
|
|
|
22
22
|
return result.trim();
|
|
23
23
|
}
|
|
24
24
|
const PROVIDER_CHOICES = {
|
|
25
|
-
auth: [
|
|
25
|
+
auth: [
|
|
26
|
+
{ label: "WorkOS", value: "workos" },
|
|
27
|
+
{
|
|
28
|
+
hint: "sign-in/out, token validation, and registration onboarding",
|
|
29
|
+
label: "Clerk",
|
|
30
|
+
value: "clerk",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
26
33
|
cms: [
|
|
27
34
|
{
|
|
28
35
|
hint: "includes the Drupal backend app",
|
package/dist/sanitize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAmDA,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC,CAAC;AA0GF,wBAAsB,eAAe,CAAC,EACpC,UAAU,EACV,UAAU,EACV,sBAA2B,GAC5B,EAAE,sBAAsB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA+B3D"}
|