@jfdevelops/create-error 0.1.1
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/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/create-error.cjs +135 -0
- package/dist/create-error.cjs.map +1 -0
- package/dist/create-error.d.cts +101 -0
- package/dist/create-error.d.cts.map +1 -0
- package/dist/create-error.d.mts +101 -0
- package/dist/create-error.d.mts.map +1 -0
- package/dist/create-error.mjs +134 -0
- package/dist/create-error.mjs.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +3 -0
- package/dist/types.d.cts +291 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +291 -0
- package/dist/types.d.mts.map +1 -0
- package/package.json +70 -0
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
declare const typeSlot: unique symbol;
|
|
5
|
+
/** Marks a blueprint value that is resolved by a later builder stage. */
|
|
6
|
+
type TypeSlot<Kind extends string, Payload = never> = {
|
|
7
|
+
readonly [typeSlot]: {
|
|
8
|
+
readonly kind: Kind;
|
|
9
|
+
readonly payload: Payload;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
type DefinitionInput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferInput<Schema>;
|
|
13
|
+
type DefinitionOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
|
|
14
|
+
type ExactDefinition<Input, Definition> = Input extends object ? Definition & Record<Exclude<keyof Definition, keyof Input>, never> : Definition;
|
|
15
|
+
type DefinitionTemplate<Schema extends StandardSchemaV1> = DefinitionOutput<Schema> extends object ? { readonly [Key in keyof DefinitionOutput<Schema>]: DefinitionOutput<Schema>[Key] & TypeSlot<'definition', Key> } : never;
|
|
16
|
+
type ConcreteDefinition<Schema extends StandardSchemaV1> = DefinitionOutput<Schema> extends object ? { readonly [Key in keyof DefinitionOutput<Schema>]: DefinitionOutput<Schema>[Key] } : never;
|
|
17
|
+
type DataSlot = TypeSlot<'data'>;
|
|
18
|
+
type ImplementationSlot = TypeSlot<'implementation'> & {
|
|
19
|
+
<const Argument$1>(argument: Argument$1): string & TypeSlot<'implementationArgument', Argument$1>;
|
|
20
|
+
};
|
|
21
|
+
/** Values available while an error instance is being created. */
|
|
22
|
+
interface BlueprintContext<Schema extends StandardSchemaV1> {
|
|
23
|
+
/** The parsed definition captured by the concrete error class. */
|
|
24
|
+
definition: DefinitionTemplate<Schema>;
|
|
25
|
+
/** The resolved, and optionally schema-validated, constructor data. */
|
|
26
|
+
data: DataSlot;
|
|
27
|
+
/**
|
|
28
|
+
* Calls the concrete error's implementation with one argument.
|
|
29
|
+
*
|
|
30
|
+
* The argument passed here defines the implementation callback's parameter
|
|
31
|
+
* type. Concrete definition fields are included automatically when the
|
|
32
|
+
* argument is a plain object.
|
|
33
|
+
*/
|
|
34
|
+
implementation: ImplementationSlot;
|
|
35
|
+
}
|
|
36
|
+
/** Values available when resolving a concrete error's constructor input. */
|
|
37
|
+
interface ResolveContext<Schema extends StandardSchemaV1> {
|
|
38
|
+
/** The parsed definition captured by the concrete error class. */
|
|
39
|
+
definition: DefinitionTemplate<Schema>;
|
|
40
|
+
/** The value passed to the concrete error constructor. */
|
|
41
|
+
input: object;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Configuration accepted by {@link createError}.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const config = {
|
|
49
|
+
* definition,
|
|
50
|
+
* data: {
|
|
51
|
+
* property: 'context',
|
|
52
|
+
* resolve: ({ input }) => input,
|
|
53
|
+
* },
|
|
54
|
+
* message: ({ data, implementation }) => implementation(data),
|
|
55
|
+
* } satisfies CreateErrorConfig<typeof definition>;
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
interface CreateErrorConfig<Schema extends StandardSchemaV1> {
|
|
59
|
+
/**
|
|
60
|
+
* A Standard Schema object that parses every concrete error definition.
|
|
61
|
+
* Validation must be synchronous because class creation is synchronous.
|
|
62
|
+
*/
|
|
63
|
+
definition: Schema;
|
|
64
|
+
/**
|
|
65
|
+
* Controls how constructor input becomes the error's stored data.
|
|
66
|
+
*
|
|
67
|
+
* Use `resolve` to normalize input or combine it with the concrete
|
|
68
|
+
* definition. The resulting value is validated by `defineContext`, when
|
|
69
|
+
* present, and then stored under `property` on every error instance.
|
|
70
|
+
*
|
|
71
|
+
* @example Preserve input while adding a definition value
|
|
72
|
+
* ```ts
|
|
73
|
+
* data: {
|
|
74
|
+
* property: 'context',
|
|
75
|
+
* resolve: ({ definition, input }) => ({
|
|
76
|
+
* ...input,
|
|
77
|
+
* scope: definition.scope,
|
|
78
|
+
* }),
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
data: {
|
|
83
|
+
/**
|
|
84
|
+
* The public instance property that receives the final resolved data.
|
|
85
|
+
*
|
|
86
|
+
* For example, `property: 'context'` makes `error.context` available.
|
|
87
|
+
*/
|
|
88
|
+
property: string;
|
|
89
|
+
/**
|
|
90
|
+
* Converts constructor input into the value used by the error blueprint.
|
|
91
|
+
*
|
|
92
|
+
* This callback runs first. It can return the input unchanged, normalize
|
|
93
|
+
* it, or add values from the concrete definition. Its result becomes the
|
|
94
|
+
* input to the optional context schema.
|
|
95
|
+
*/
|
|
96
|
+
resolve(context: ResolveContext<Schema>): unknown;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Creates the native `Error.message` after data resolution and validation.
|
|
100
|
+
*/
|
|
101
|
+
message(context: BlueprintContext<Schema>): string;
|
|
102
|
+
/**
|
|
103
|
+
* Creates additional public fields and methods for each error instance.
|
|
104
|
+
*
|
|
105
|
+
* Use this to expose definition values such as `code`, derive fields from
|
|
106
|
+
* resolved data, or attach convenience methods. It does not transform or
|
|
107
|
+
* validate constructor input; use `data.resolve` and `defineContext` for
|
|
108
|
+
* that.
|
|
109
|
+
*
|
|
110
|
+
* @example Expose definition and resolved-data values
|
|
111
|
+
* ```ts
|
|
112
|
+
* properties: ({ definition, data }) => ({
|
|
113
|
+
* code: definition.code,
|
|
114
|
+
* context: data,
|
|
115
|
+
* describe: () => `${definition.code}: ${data.field}`,
|
|
116
|
+
* })
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
properties?(context: BlueprintContext<Schema>): object;
|
|
120
|
+
/**
|
|
121
|
+
* Serializes every error in the family when `toJSON()` or `JSON.stringify`
|
|
122
|
+
* is called.
|
|
123
|
+
*
|
|
124
|
+
* The callback receives the fully constructed error, including the data
|
|
125
|
+
* property and any fields or methods returned by `properties`.
|
|
126
|
+
*
|
|
127
|
+
* @example Return an API-safe error representation
|
|
128
|
+
* ```ts
|
|
129
|
+
* toJSON: (error) => ({
|
|
130
|
+
* name: error.name,
|
|
131
|
+
* code: error.code,
|
|
132
|
+
* message: error.message,
|
|
133
|
+
* context: error.context,
|
|
134
|
+
* })
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
toJSON?(error: Error & Record<string, unknown>): unknown;
|
|
138
|
+
}
|
|
139
|
+
type ResolveTemplate<Config> = Config extends {
|
|
140
|
+
data: {
|
|
141
|
+
resolve: (...arguments_: infer _Arguments) => infer Resolved;
|
|
142
|
+
};
|
|
143
|
+
} ? Resolved : never;
|
|
144
|
+
type InjectedDefinitionKeys<Template> = { [Key in keyof Template]: Template[Key] extends TypeSlot<'definition', PropertyKey> ? Key : never }[keyof Template];
|
|
145
|
+
type ConstructorInput<Config, Data> = Data extends readonly unknown[] ? Data : Data extends object ? Omit<Data, Extract<InjectedDefinitionKeys<ResolveTemplate<Config>>, keyof Data>> : Data;
|
|
146
|
+
type ReplaceTuple<Values extends readonly unknown[], Definition, Data, Implementation> = { [Index in keyof Values]: ReplaceTemplate<Values[Index], Definition, Data, Implementation> };
|
|
147
|
+
type ReplaceTemplate<Type, Definition, Data, Implementation> = Type extends TypeSlot<'definition', infer Key> ? Key extends keyof Definition ? Definition[Key] : never : Type extends TypeSlot<'data'> ? Data : Type extends TypeSlot<'implementation'> ? Implementation : Type extends ((...arguments_: infer Arguments) => infer Result) ? (...arguments_: ReplaceTuple<Arguments, Definition, Data, Implementation>) => ReplaceTemplate<Result, Definition, Data, Implementation> : Type extends readonly unknown[] ? ReplaceTuple<Type, Definition, Data, Implementation> : Type extends object ? { [Key in keyof Type]: ReplaceTemplate<Type[Key], Definition, Data, Implementation> } : Type;
|
|
148
|
+
type PropertiesTemplate<Config> = Config extends {
|
|
149
|
+
properties: (...arguments_: infer _Arguments) => infer Properties;
|
|
150
|
+
} ? Properties : object;
|
|
151
|
+
type DataPropertyTemplate<Config> = Config extends {
|
|
152
|
+
data: {
|
|
153
|
+
property: infer Property extends string;
|
|
154
|
+
};
|
|
155
|
+
} ? { [Key in Property]: DataSlot } : object;
|
|
156
|
+
/**
|
|
157
|
+
* The error shape visible to a blueprint's `toJSON` callback.
|
|
158
|
+
*
|
|
159
|
+
* It contains native `Error` fields, the configured data property, and every
|
|
160
|
+
* member returned by `properties`.
|
|
161
|
+
*/
|
|
162
|
+
type BlueprintErrorTemplate<Config> = Error & DataPropertyTemplate<Config> & PropertiesTemplate<Config>;
|
|
163
|
+
type InstanceProperties<Config, Definition, Data, Implementation> = ReplaceTemplate<PropertiesTemplate<Config>, Definition, Data, Implementation> & ReplaceTemplate<DataPropertyTemplate<Config>, Definition, Data, Implementation> & Error & (Config extends {
|
|
164
|
+
toJSON: (...arguments_: infer _Arguments) => infer Json;
|
|
165
|
+
} ? {
|
|
166
|
+
toJSON(): ReplaceTemplate<Json, Definition, Data, Implementation>;
|
|
167
|
+
} : object);
|
|
168
|
+
type MessageTemplate<Config> = Config extends {
|
|
169
|
+
message: (...arguments_: infer _Arguments) => infer Message;
|
|
170
|
+
} ? Message : string;
|
|
171
|
+
type ImplementationArgumentWithDefinition<Argument$1, Definition, Data> = Argument$1 extends TypeSlot<'data'> ? Data : ReplaceTemplate<Argument$1, Definition, Data, never> extends infer Resolved ? Argument$1 extends TypeSlot<string, unknown> ? Resolved : Resolved extends readonly unknown[] ? Resolved : Resolved extends ((...arguments_: infer _Arguments) => unknown) ? Resolved : Resolved extends object ? Omit<Definition, keyof Resolved> & Resolved : Resolved : never;
|
|
172
|
+
type ImplementationArgument<Config, Definition, Data> = MessageTemplate<Config> extends TypeSlot<'implementationArgument', infer Argument> ? ImplementationArgumentWithDefinition<Argument, Definition, Data> : never;
|
|
173
|
+
type ImplementationCallback<Config, Definition, Data> = (argument: ImplementationArgument<Config, Definition, Data>) => string;
|
|
174
|
+
type PassedImplementationArgument<Config, Definition, Data> = MessageTemplate<Config> extends TypeSlot<'implementationArgument', infer Argument> ? Argument extends TypeSlot<'data'> ? Data : ReplaceTemplate<Argument, Definition, Data, never> : never;
|
|
175
|
+
type PassedImplementationCallback<Config, Definition, Data> = (argument: PassedImplementationArgument<Config, Definition, Data>) => string;
|
|
176
|
+
interface ErrorClassStatics {
|
|
177
|
+
/**
|
|
178
|
+
* Throws this error class when `condition` is falsy.
|
|
179
|
+
*
|
|
180
|
+
* A function can be supplied as `input` to avoid constructing error data
|
|
181
|
+
* unless the invariant fails. TypeScript narrows `condition` after a
|
|
182
|
+
* successful call.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* MissingUserError.invariant(
|
|
187
|
+
* user,
|
|
188
|
+
* () => ({ userId }),
|
|
189
|
+
* { cause },
|
|
190
|
+
* );
|
|
191
|
+
*
|
|
192
|
+
* user.id; // narrowed to the truthy branch
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
invariant<Condition, Input>(this: new (input: Input, options?: ErrorOptions) => Error, condition: Condition, input: Input | (() => Input), options?: ErrorOptions): asserts condition;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The shared native `Error` base created for one blueprint.
|
|
199
|
+
*
|
|
200
|
+
* Use `factory.Error` for family-wide `instanceof` checks or as a public base
|
|
201
|
+
* type for errors created by the same blueprint.
|
|
202
|
+
*/
|
|
203
|
+
type FamilyErrorClass = (abstract new (...arguments_: never[]) => Error) & ErrorClassStatics;
|
|
204
|
+
/** An extendable concrete error class produced by a configured factory. */
|
|
205
|
+
interface ConcreteErrorClass<Input, Instance> extends ErrorClassStatics {
|
|
206
|
+
/**
|
|
207
|
+
* Creates an error from family-specific input.
|
|
208
|
+
*
|
|
209
|
+
* Pass native `ErrorOptions` as the second argument to preserve a `cause`.
|
|
210
|
+
*/
|
|
211
|
+
new (input: Input, options?: ErrorOptions): Instance;
|
|
212
|
+
}
|
|
213
|
+
type ImplementedErrorClass<Config, Definition, Input, Data> = ConcreteErrorClass<ConstructorInput<Config, Input>, InstanceProperties<Config, Definition, Data, PassedImplementationCallback<Config, Definition, Data>>>;
|
|
214
|
+
type ExtendsNever<Value, OnTrue, OnFalse> = [Value] extends [never] ? OnTrue : OnFalse;
|
|
215
|
+
type BuilderData<Data, InferredData> = ExtendsNever<Data, InferredData, Data>;
|
|
216
|
+
type DefaultBuilderData<Data> = ExtendsNever<Data, unknown, Data>;
|
|
217
|
+
type BuilderInput<Input, Data> = ExtendsNever<Input, Data, Input>;
|
|
218
|
+
type Expand<Type> = Type extends ((...arguments_: infer Arguments) => infer Result) ? (...arguments_: Arguments) => Result : Type;
|
|
219
|
+
/** Captures the final behavior for one concrete error class. */
|
|
220
|
+
interface ImplementationBuilder<Config, Definition, Input = never, Data = never> {
|
|
221
|
+
/**
|
|
222
|
+
* Creates an extendable error class from a message implementation.
|
|
223
|
+
*
|
|
224
|
+
* The callback receives the single argument chosen by the blueprint's call
|
|
225
|
+
* to `implementation(argument)`. When that argument is a plain object, the
|
|
226
|
+
* concrete definition's fields are also available on it.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* const MissingUserError = createRequestError({
|
|
231
|
+
* code: 'missingUser',
|
|
232
|
+
* }).implement(
|
|
233
|
+
* ({ code, context }) => `${code}: ${context.userId} was not found`,
|
|
234
|
+
* );
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
implement<InferredData = DefaultBuilderData<Data>>(implementation: Expand<ImplementationCallback<Config, Definition, BuilderData<Data, InferredData>>>): ImplementedErrorClass<Config, Definition, BuilderInput<Input, BuilderData<Data, InferredData>>, BuilderData<Data, InferredData>>;
|
|
238
|
+
}
|
|
239
|
+
/** Configures one concrete error definition before creating its class. */
|
|
240
|
+
interface ErrorDefinitionBuilder<Config, Definition> extends ImplementationBuilder<Config, Definition> {
|
|
241
|
+
/**
|
|
242
|
+
* Validates and optionally transforms resolved data with a Standard Schema.
|
|
243
|
+
*
|
|
244
|
+
* The schema's input becomes the concrete class's constructor input and its
|
|
245
|
+
* output becomes the stored data and implementation value. Validation must
|
|
246
|
+
* be synchronous. After selecting a schema, only `implement` is available.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* const MissingUserError = createRequestError({ code: 'missingUser' })
|
|
251
|
+
* .defineContext(z.object({ userId: z.string() }))
|
|
252
|
+
* .implement(({ userId }) => `User ${userId} was not found`);
|
|
253
|
+
*
|
|
254
|
+
* new MissingUserError({ userId: 'user_123' });
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
defineContext<const ContextSchema extends StandardSchemaV1>(context: ContextSchema): ImplementationBuilder<Config, Definition, StandardSchemaV1.InferInput<ContextSchema>, StandardSchemaV1.InferOutput<ContextSchema>>;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* A callable factory for creating related, strongly typed error classes.
|
|
261
|
+
*
|
|
262
|
+
* Call it with a concrete definition to receive a builder, or use `.Error` as
|
|
263
|
+
* the common base class for every error produced by this factory.
|
|
264
|
+
*/
|
|
265
|
+
type ErrorFamilyFactory<Schema extends StandardSchemaV1, Config> = {
|
|
266
|
+
/**
|
|
267
|
+
* Parses and captures a concrete definition. Definition-derived fields use
|
|
268
|
+
* the schema's output type so transforms remain type-safe.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* const builder = createRequestError({
|
|
273
|
+
* code: 'missingUser',
|
|
274
|
+
* scope: 'request',
|
|
275
|
+
* });
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
<const Definition extends DefinitionInput<Schema>>(definition: ExactDefinition<DefinitionInput<Schema>, Definition>): ErrorDefinitionBuilder<Config, ConcreteDefinition<Schema>>;
|
|
279
|
+
/**
|
|
280
|
+
* The shared native `Error` base for every class created by this factory.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* error instanceof createRequestError.Error;
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
Error: FamilyErrorClass;
|
|
288
|
+
};
|
|
289
|
+
//#endregion
|
|
290
|
+
export { BlueprintContext, BlueprintErrorTemplate, CreateErrorConfig, ErrorFamilyFactory };
|
|
291
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;cAEc;;AAFgD,KAKzD,QAHS,CAAA,aAAuB,MAAA,EAAA,UAAA,KAAA,CAAA,GAAA;EAGhC,UACO,QAAA,CADC,EAAA;IAEM,SAAA,IAAA,EAAA,IAAA;IACG,SAAA,OAAA,EAAA,OAAA;EAFV,CAAA;CAAQ;AAAA,KAMf,eAAA,CAAA,eAA+B,gBAAhB,CAAA,GAClB,gBAAA,CAAiB,UADC,CACU,MADV,CAAA;KAGf,gBAH+B,CAAA,eAGC,gBAHD,CAAA,GAIlC,gBAAA,CAAiB,WAJiB,CAIL,MAJK,CAAA;KAM/B,eALyB,CAAA,KAAA,EAAA,UAAA,CAAA,GA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,qBAzED,CA0EA,MA1EA,EA2EA,UA3EA,EA4EA,gBAAA,CAAiB,UA5EjB,CA4E4B,aA5E5B,CAAA,EA6EA,gBAAA,CAAiB,WA7EjB,CA6E6B,aA7E7B,CAAA,CAAA;;;AACO;;;;;AAEwC,KAoFvC,kBApFuC,CAAA,eAoFL,gBApFK,EAAA,MAAA,CAAA,GAAA;EAE9C;;;;;AAAuC;;;;;;AAEC;EAEzB,CAAA,yBA2FQ,eA3FR,CA2FwB,MA3FxB,CAAA,CAAA,CAAA,UAAA,EA4FJ,eA5FI,CA4FY,eA5FZ,CA4F4B,MA5F5B,CAAA,EA4FqC,UA5FrC,CAAA,CAAA,EA6Ff,sBA7Fe,CA6FQ,MA7FR,EA6FgB,kBA7FhB,CA6FmC,MA7FnC,CAAA,CAAA;EACA;;;;AAIpB;;;;EAyBM,KAAA,EAyEG,gBAzEH;CACY"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jfdevelops/create-error",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Create strongly typed, configurable error families.",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/jfdevelops/error-blueprint.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/jfdevelops/error-blueprint/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/jfdevelops/error-blueprint#readme",
|
|
16
|
+
"packageManager": "pnpm@10.28.1",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=20.19.0"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/index.d.cts",
|
|
33
|
+
"default": "./dist/index.cjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.cjs",
|
|
39
|
+
"module": "./dist/index.mjs",
|
|
40
|
+
"types": "./dist/index.d.mts",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@standard-schema/spec": "1.1.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsdown",
|
|
46
|
+
"check": "pnpm typecheck && pnpm test && pnpm build && pnpm test:package",
|
|
47
|
+
"changeset": "changeset",
|
|
48
|
+
"dev": "tsdown --watch",
|
|
49
|
+
"release": "changeset publish",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"test:package": "tsc --noEmit -p test/fixtures/tsconfig.json",
|
|
52
|
+
"test:watch": "vitest",
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"version-packages": "changeset version"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public",
|
|
58
|
+
"provenance": true
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@changesets/cli": "3.0.3",
|
|
62
|
+
"@types/node": "^24.3.0",
|
|
63
|
+
"rolldown": "^1.0.0-beta.31",
|
|
64
|
+
"tsdown": "^0.17.2",
|
|
65
|
+
"typescript": "^5.9.2",
|
|
66
|
+
"vite": "^7.1.11",
|
|
67
|
+
"vitest": "^3.2.4",
|
|
68
|
+
"zod": "4.6.5"
|
|
69
|
+
}
|
|
70
|
+
}
|