@azure-net/kit 2.2.2 → 2.2.5

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.
@@ -19,6 +19,12 @@ type ArrayItemRules<Context> = ValidationRuleResult<Context>[] | Record<string,
19
19
  type ArrayParams<Context> = LengthParams & {
20
20
  schema?: ArrayItemRules<Context>;
21
21
  };
22
+ /**
23
+ *
24
+ * @param validationMessages - BaseValidationMessages
25
+ * @returns ValidationRuleResult<T, D>
26
+ * @description Creates the rules for the schema.
27
+ */
22
28
  export declare const createRules: <M extends BaseValidationMessages>(validationMessages: M) => {
23
29
  string: <T = unknown, D = unknown>(params?: ValidationRuleParams<"string", LengthParams>) => ValidationRuleResult<T, D>;
24
30
  number: <T = unknown, D_1 = unknown>(params?: ValidationRuleParams<"number", RangeParams>) => ValidationRuleResult<T, D_1>;
@@ -1,8 +1,20 @@
1
1
  import { masks } from '../../../constants/masks.js';
2
+ /**
3
+ *
4
+ * @param validationMessages - BaseValidationMessages
5
+ * @returns ValidationRuleResult<T, D>
6
+ * @description Creates the rules for the schema.
7
+ */
2
8
  export const createRules = (validationMessages) => {
3
9
  const checkVal = (val) => {
4
10
  return val !== undefined && val !== null;
5
11
  };
12
+ /**
13
+ *
14
+ * @param params - ValidationRuleParams<'string', LengthParams>
15
+ * @returns ValidationRuleResult<T, D>
16
+ * @description Checks if the value is a string and if it is within the length specified in the params.
17
+ */
6
18
  const string = (params) => {
7
19
  const { message, length } = { ...params, message: { ...validationMessages.string, ...params?.message } };
8
20
  return ({ val }) => {
@@ -22,6 +34,12 @@ export const createRules = (validationMessages) => {
22
34
  return undefined;
23
35
  };
24
36
  };
37
+ /**
38
+ *
39
+ * @param params - ValidationRuleParams<'number', RangeParams>
40
+ * @returns ValidationRuleResult<T, D>
41
+ * @description Checks if the value is a whole number (integer) and if it is within the range specified in the params.
42
+ */
25
43
  const number = (params) => {
26
44
  const { message, range } = { ...params, message: { ...validationMessages.number, ...params?.message } };
27
45
  return ({ val }) => {
@@ -42,6 +60,12 @@ export const createRules = (validationMessages) => {
42
60
  return undefined;
43
61
  };
44
62
  };
63
+ /**
64
+ *
65
+ * @param params - ValidationRuleParams<'finite', RangeParams & { maxDigitsAfterDot?: number }>
66
+ * @returns ValidationRuleResult<T, D>
67
+ * @description Checks if the value is a finite number and if it is within the range specified in the params.
68
+ */
45
69
  const finite = (params) => {
46
70
  const { message, maxDigitsAfterDot, range } = { ...params, message: { ...validationMessages.finite, ...params?.message } };
47
71
  return ({ val }) => {
@@ -65,6 +89,12 @@ export const createRules = (validationMessages) => {
65
89
  return undefined;
66
90
  };
67
91
  };
92
+ /**
93
+ *
94
+ * @param params - ValidationRuleParams<'boolean', { expected?: boolean }>
95
+ * @returns ValidationRuleResult<T, D>
96
+ * @description Checks if the value is a boolean and if it is the expected value specified in the params.
97
+ */
68
98
  const boolean = (params) => {
69
99
  const { message, expected } = { ...params, message: { ...validationMessages.boolean, ...params?.message } };
70
100
  return ({ val }) => {
@@ -78,6 +108,12 @@ export const createRules = (validationMessages) => {
78
108
  return undefined;
79
109
  };
80
110
  };
111
+ /**
112
+ *
113
+ * @param params - ValidationRuleParams<'array', ArrayParams<T>>
114
+ * @returns ValidationRuleResult<T>
115
+ * @description Checks if the value is an array and if it is within the length specified in the params. Can check every array item with the rules specified in the schema.
116
+ */
81
117
  const array = (params) => {
82
118
  const { message, length = {}, schema } = { ...params, message: { ...validationMessages.array, ...params?.message } };
83
119
  return ({ val, listValues, key }) => {
@@ -138,10 +174,15 @@ export const createRules = (validationMessages) => {
138
174
  return undefined;
139
175
  };
140
176
  };
177
+ /**
178
+ *
179
+ * @param params - ValidationRuleParams<'phone'>
180
+ * @returns ValidationRuleResult<T, D>
181
+ * @description Checks if the value is a phone number and if it is valid.
182
+ */
183
+ const countryCodes = new Set(Object.values(masks).map((country) => country.cc)).add('8');
141
184
  const phone = (params) => {
142
185
  const { message } = { ...params, message: params?.message ?? validationMessages.phone };
143
- const countryCodes = new Set(Object.values(masks).map((country) => country.cc));
144
- countryCodes.add('8');
145
186
  return ({ val }) => {
146
187
  if (checkVal(val)) {
147
188
  // eslint-disable-next-line
@@ -198,6 +239,12 @@ export const createRules = (validationMessages) => {
198
239
  return undefined;
199
240
  };
200
241
  };
242
+ /**
243
+ *
244
+ * @param params - ValidationRuleParams<'email'>
245
+ * @returns ValidationRuleResult<T, D>
246
+ * @description Checks if the value is a valid email address.
247
+ */
201
248
  const email = (params) => {
202
249
  const { message } = { message: params?.message ?? validationMessages.email };
203
250
  const emailRegExp =
@@ -211,6 +258,12 @@ export const createRules = (validationMessages) => {
211
258
  return undefined;
212
259
  };
213
260
  };
261
+ /**
262
+ *
263
+ * @param params - ValidationRuleParams<'lettersOnly', { whiteSpaces?: boolean }>
264
+ * @returns ValidationRuleResult<T, D>
265
+ * @description Checks if the value is a string and if it contains only letters.
266
+ */
214
267
  const lettersOnly = (params) => {
215
268
  const { message, whiteSpaces = false } = { ...params, message: params?.message ?? validationMessages.lettersOnly };
216
269
  const lettersRegex = whiteSpaces ? /^[а-яА-Яa-zA-Z\s]+$/ : /^[а-яА-Яa-zA-Z]+$/;
@@ -222,6 +275,12 @@ export const createRules = (validationMessages) => {
222
275
  return undefined;
223
276
  };
224
277
  };
278
+ /**
279
+ *
280
+ * @param params - ValidationRuleParams<'allowedOnly', { allowed?: unknown[] }>
281
+ * @returns ValidationRuleResult<T, D>
282
+ * @description Checks if the value is in the allowed values specified in the params.
283
+ */
225
284
  const allowedOnly = (params) => {
226
285
  const { message, allowed } = { ...params, message: params?.message ?? validationMessages.allowedOnly };
227
286
  return ({ val }) => {
@@ -239,6 +298,12 @@ export const createRules = (validationMessages) => {
239
298
  return undefined;
240
299
  };
241
300
  };
301
+ /**
302
+ *
303
+ * @param params - ValidationRuleParams<'sameAs', { key: keyof T | string }>
304
+ * @returns ValidationRuleResult<T, D>
305
+ * @description Checks if the value is the same as the value of the field specified in the params.
306
+ */
242
307
  const sameAs = (params) => {
243
308
  const { message, key } = { ...params, message: params?.message ?? validationMessages.sameAs };
244
309
  return ({ val, listValues }) => {
@@ -252,7 +317,7 @@ export const createRules = (validationMessages) => {
252
317
  return JSON.stringify(val) === JSON.stringify(listValues[key]) ? undefined : message(String(key));
253
318
  }
254
319
  catch {
255
- return undefined;
320
+ return 'Parsing error';
256
321
  }
257
322
  default:
258
323
  return String(val ?? '') === String(listValues?.[key] ?? '') ? undefined : message(String(key));
@@ -261,6 +326,12 @@ export const createRules = (validationMessages) => {
261
326
  return undefined;
262
327
  };
263
328
  };
329
+ /**
330
+ *
331
+ * @param params - ValidationRuleParams<'notSameAs', { key: keyof T | string }>
332
+ * @returns ValidationRuleResult<T, D>
333
+ * @description Checks if the value is not the same as the value of the field specified in the params.
334
+ */
264
335
  const notSameAs = (params) => {
265
336
  const { message, key } = { ...params, message: params?.message ?? validationMessages.notSameAs };
266
337
  return ({ val, listValues }) => {
@@ -274,7 +345,7 @@ export const createRules = (validationMessages) => {
274
345
  return JSON.stringify(val) !== JSON.stringify(listValues[key]) ? undefined : message(String(key));
275
346
  }
276
347
  catch {
277
- return undefined;
348
+ return 'Parsing error';
278
349
  }
279
350
  default:
280
351
  return String(val) === String(listValues?.[key]) ? undefined : message(String(key));
@@ -283,6 +354,12 @@ export const createRules = (validationMessages) => {
283
354
  return undefined;
284
355
  };
285
356
  };
357
+ /**
358
+ *
359
+ * @param params - ValidationRuleParams<'required', { byCondition?: (params: ValidationParams<T, D, J>) => boolean }>
360
+ * @returns ValidationRuleResult<T, D, J>
361
+ * @description Marks the field as required. If the byCondition is specified, the field will be required only if the byCondition returns true.
362
+ */
286
363
  const required = (params) => {
287
364
  const { message, byCondition } = { ...params, message: params?.message ?? validationMessages.required };
288
365
  return ({ val, listValues, key }) => {
@@ -299,6 +376,12 @@ export const createRules = (validationMessages) => {
299
376
  return undefined;
300
377
  };
301
378
  };
379
+ /**
380
+ *
381
+ * @param params - ValidationRuleParams<'password', { length?: number; specialChars?: boolean | number; numbers?: boolean | number; lowerUpperCasePattern?: boolean }>
382
+ * @returns ValidationRuleResult<T, D>
383
+ * @description Sets the password rules. Can check the length, the number of special characters, the number of numbers and the presence of uppercase and lowercase letters.
384
+ */
302
385
  const password = (params) => {
303
386
  const { message, length = 8, specialChars, numbers, lowerUpperCasePattern } = { ...params, message: { ...validationMessages.password, ...params?.message } };
304
387
  return ({ val }) => {
@@ -1,9 +1,12 @@
1
1
  import type { RequestErrors } from '../../delivery/schema/index.js';
2
2
  import type { AsyncActionResponse } from '../../index.js';
3
+ type InitialData<FormData> = Partial<FormData> | Promise<Partial<FormData>> | (() => Partial<FormData> | Promise<Partial<FormData>>);
3
4
  export interface FormConfig<FormData, Response> {
4
- initialData?: Partial<FormData>;
5
+ initialData?: InitialData<FormData>;
5
6
  onSuccess?: (response: Response) => Promise<void> | void;
6
7
  onError?: () => Promise<void> | void;
8
+ beforeSubmit?: (form: ActiveFormController<FormData>, abort: () => void) => Promise<void> | void;
9
+ waitForInitialData?: boolean;
7
10
  }
8
11
  export interface ActiveForm<FormData, Response, Custom> {
9
12
  data: Partial<FormData>;
@@ -12,6 +15,12 @@ export interface ActiveForm<FormData, Response, Custom> {
12
15
  reset: (toInitial?: boolean) => void;
13
16
  pending: boolean;
14
17
  dirty: boolean;
18
+ ready: Promise<Partial<FormData>>;
19
+ }
20
+ export interface ActiveFormController<FormData> {
21
+ data: Partial<FormData>;
22
+ errors: RequestErrors<FormData>;
23
+ reset: (toInitial?: boolean) => void;
15
24
  }
16
25
  type ExtractResponse<T> = T extends AsyncActionResponse<infer R, unknown, unknown> ? R : never;
17
26
  type ExtractFormData<T> = T extends AsyncActionResponse<unknown, infer D, unknown> ? D : never;
@@ -1,12 +1,50 @@
1
1
  import { ObjectUtil } from 'azure-net-tools';
2
2
  export const createActiveForm = (onSubmit, config) => {
3
- const initial = config?.initialData ?? {};
3
+ const isPromise = (value) => {
4
+ return typeof value?.then === 'function';
5
+ };
6
+ const resolveInitialSource = () => {
7
+ const source = config?.initialData;
8
+ if (!source) {
9
+ return { sync: true, value: {} };
10
+ }
11
+ const result = typeof source === 'function' ? source() : source;
12
+ if (isPromise(result)) {
13
+ return { sync: false, promise: result };
14
+ }
15
+ return { sync: true, value: (result ?? {}) };
16
+ };
17
+ const initialSource = resolveInitialSource();
18
+ let initial = initialSource.sync ? initialSource.value : {};
4
19
  let formData = $state(ObjectUtil.deepClone(initial));
5
20
  let formErrors = $state({});
6
21
  let pending = $state(false);
7
22
  const dirty = $derived(JSON.stringify(formData) !== JSON.stringify(initial));
23
+ const ready = (async () => {
24
+ if (!initialSource.sync) {
25
+ initial = (await initialSource.promise) ?? {};
26
+ if (config?.waitForInitialData !== false) {
27
+ formData = ObjectUtil.deepClone(initial);
28
+ }
29
+ }
30
+ return initial;
31
+ })();
8
32
  const submit = async () => {
9
33
  pending = true;
34
+ if (config?.beforeSubmit) {
35
+ let aborted = false;
36
+ const abort = () => {
37
+ aborted = true;
38
+ pending = false;
39
+ };
40
+ await config.beforeSubmit(formApi, () => abort());
41
+ if (aborted) {
42
+ return {
43
+ success: false,
44
+ response: undefined
45
+ };
46
+ }
47
+ }
10
48
  try {
11
49
  const result = await onSubmit($state.snapshot(formData));
12
50
  if (result.error?.fields) {
@@ -28,7 +66,7 @@ export const createActiveForm = (onSubmit, config) => {
28
66
  formData = toInitial ? ObjectUtil.deepClone(initial) : {};
29
67
  formErrors = {};
30
68
  };
31
- return {
69
+ const formApi = {
32
70
  get data() {
33
71
  return formData;
34
72
  },
@@ -38,12 +76,20 @@ export const createActiveForm = (onSubmit, config) => {
38
76
  get errors() {
39
77
  return formErrors;
40
78
  },
79
+ set errors(value) {
80
+ formErrors = value;
81
+ },
82
+ reset
83
+ };
84
+ return {
85
+ ...formApi,
41
86
  get dirty() {
42
87
  return dirty;
43
88
  },
44
89
  get pending() {
45
90
  return pending;
46
91
  },
92
+ ready,
47
93
  submit,
48
94
  reset
49
95
  };
@@ -15,6 +15,7 @@ export interface AsyncSignalSvelte<TData, TError = Error> {
15
15
  pending: boolean;
16
16
  execute: () => Promise<void>;
17
17
  refresh: () => Promise<void>;
18
+ ready: Promise<TData | undefined>;
18
19
  reset: () => void;
19
20
  abort: () => void;
20
21
  }
@@ -52,7 +52,8 @@ export const createAsyncSignal = (handler, options = {}) => {
52
52
  let status = $state('idle');
53
53
  const pending = $derived(status === 'pending');
54
54
  let abortController = null;
55
- async function execute() {
55
+ let currentPromise = null;
56
+ const run = async () => {
56
57
  if (abortController) {
57
58
  abortController.abort();
58
59
  }
@@ -62,25 +63,35 @@ export const createAsyncSignal = (handler, options = {}) => {
62
63
  try {
63
64
  const result = await handler(abortController.signal);
64
65
  if (abortController.signal.aborted) {
65
- return;
66
+ return undefined;
66
67
  }
67
68
  data = result;
68
69
  status = 'success';
69
70
  if (options.onSuccess) {
70
71
  options.onSuccess(result);
71
72
  }
73
+ return result;
72
74
  }
73
75
  catch (err) {
74
76
  if (err instanceof Error && err.name === 'AbortError') {
75
- return;
77
+ return undefined;
76
78
  }
77
79
  error = err;
78
80
  status = 'error';
79
81
  if (options.onError) {
80
82
  options.onError(err);
81
83
  }
84
+ return undefined;
82
85
  }
83
- }
86
+ };
87
+ const execute = async () => {
88
+ if (status === 'pending' && currentPromise) {
89
+ await currentPromise;
90
+ return;
91
+ }
92
+ currentPromise = run();
93
+ await currentPromise;
94
+ };
84
95
  if (EnvironmentUtil.isBrowser) {
85
96
  const signalKey = key ?? asyncSignalManager.generateKey();
86
97
  asyncSignalManager.register(signalKey, () => execute());
@@ -127,12 +138,16 @@ export const createAsyncSignal = (handler, options = {}) => {
127
138
  get pending() {
128
139
  return pending;
129
140
  },
141
+ get ready() {
142
+ return currentPromise ?? Promise.resolve(data);
143
+ },
130
144
  execute,
131
145
  refresh: execute,
132
146
  reset: () => {
133
147
  data = undefined;
134
148
  error = undefined;
135
149
  status = 'idle';
150
+ currentPromise = null;
136
151
  if (abortController) {
137
152
  abortController.abort();
138
153
  abortController = null;
@@ -0,0 +1,20 @@
1
+ export type QuerySignal = {
2
+ refresh: () => Promise<void>;
3
+ };
4
+ export interface CreateQueryOptions<T extends Record<string, unknown>> {
5
+ initial: T;
6
+ signal?: QuerySignal;
7
+ excludeKeys?: (keyof T)[];
8
+ debounceMs?: number;
9
+ autoRefresh?: boolean;
10
+ }
11
+ export interface QueryController<T extends Record<string, unknown>> {
12
+ data: T;
13
+ patch: (values: Partial<T>) => void;
14
+ set: <K extends keyof T>(key: K, value: T[K]) => void;
15
+ reset: () => void;
16
+ snapshot: () => T;
17
+ initial: () => T;
18
+ attachSignal: (signal?: QuerySignal) => void;
19
+ }
20
+ export declare const createQuery: <T extends Record<string, unknown>>(options: CreateQueryOptions<T>) => QueryController<T>;
@@ -0,0 +1,71 @@
1
+ import { ObjectUtil } from 'azure-net-tools';
2
+ export const createQuery = (options) => {
3
+ const { initial: initialValue, signal: initialSignal, excludeKeys, debounceMs = 0, autoRefresh = true } = options;
4
+ const baseInitial = ObjectUtil.deepClone(initialValue);
5
+ let signal = initialSignal;
6
+ let data = $state(ObjectUtil.deepClone(baseInitial));
7
+ const resolveKeys = () => {
8
+ const keys = Object.keys(baseInitial).slice();
9
+ if (excludeKeys?.length) {
10
+ return keys.filter((key) => !excludeKeys.includes(key));
11
+ }
12
+ return keys;
13
+ };
14
+ const keys = resolveKeys();
15
+ let isFirstRun = true;
16
+ let debounceTimer = null;
17
+ const scheduleRefresh = () => {
18
+ if (!signal)
19
+ return;
20
+ if (debounceTimer)
21
+ clearTimeout(debounceTimer);
22
+ if (debounceMs > 0) {
23
+ debounceTimer = setTimeout(() => {
24
+ void signal?.refresh();
25
+ }, debounceMs);
26
+ }
27
+ else {
28
+ void signal.refresh();
29
+ }
30
+ };
31
+ if (autoRefresh) {
32
+ $effect(() => {
33
+ keys.forEach((key) => {
34
+ void data[key];
35
+ });
36
+ if (isFirstRun) {
37
+ isFirstRun = false;
38
+ return;
39
+ }
40
+ scheduleRefresh();
41
+ });
42
+ }
43
+ const patch = (values) => {
44
+ data = { ...data, ...values };
45
+ };
46
+ const set = (key, value) => {
47
+ data = { ...data, [key]: value };
48
+ };
49
+ const reset = () => {
50
+ data = ObjectUtil.deepClone(baseInitial);
51
+ };
52
+ const snapshot = () => ObjectUtil.deepClone(data);
53
+ const initial = () => ObjectUtil.deepClone(baseInitial);
54
+ const attachSignal = (nextSignal) => {
55
+ signal = nextSignal;
56
+ };
57
+ return {
58
+ get data() {
59
+ return data;
60
+ },
61
+ set data(value) {
62
+ data = value;
63
+ },
64
+ patch,
65
+ set,
66
+ reset,
67
+ snapshot,
68
+ initial,
69
+ attachSignal
70
+ };
71
+ };
@@ -0,0 +1 @@
1
+ export * from './Query.svelte.js';
@@ -0,0 +1 @@
1
+ export * from './Query.svelte.js';
@@ -1,2 +1,3 @@
1
1
  export * from './AsyncSignal/index.js';
2
2
  export * from './ActiveForm/index.js';
3
+ export * from './Query/index.js';
@@ -1,2 +1,3 @@
1
1
  export * from './AsyncSignal/index.js';
2
2
  export * from './ActiveForm/index.js';
3
+ export * from './Query/index.js';
package/package.json CHANGED
@@ -1,133 +1,141 @@
1
1
  {
2
- "name": "@azure-net/kit",
3
- "version": "2.2.2",
4
- "files": [
5
- "dist",
6
- "!dist/**/*.test.*",
7
- "!dist/**/*.spec.*"
8
- ],
9
- "sideEffects": [
10
- "**/*.css"
11
- ],
12
- "svelte": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "type": "module",
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "svelte": "./dist/index.js"
19
- },
20
- "./constants": {
21
- "types": "./dist/core/constants/index.d.ts",
22
- "svelte": "./dist/core/constants/index.js"
23
- },
24
- "./infra": {
25
- "types": "./dist/core/infra/index.d.ts",
26
- "svelte": "./dist/core/infra/index.js"
27
- },
28
- "./schema": {
29
- "types": "./dist/core/delivery/schema/rules/index.d.ts",
30
- "svelte": "./dist/core/delivery/schema/rules/index.js"
31
- },
32
- "./edges": {
33
- "types": "./dist/edges/index.d.ts",
34
- "svelte": "./dist/edges/index.js"
35
- },
36
- "./edges/server": {
37
- "types": "./dist/edges/server/index.d.ts",
38
- "svelte": "./dist/edges/server/index.js"
39
- },
40
- "./edges/state": {
41
- "types": "./dist/edges/state/index.d.ts",
42
- "svelte": "./dist/edges/state/index.js"
43
- },
44
- "./edges/context": {
45
- "types": "./dist/edges/context/index.d.ts",
46
- "svelte": "./dist/edges/context/index.js"
47
- },
48
- "./edges/dev": {
49
- "types": "./dist/edges/dev/index.d.ts",
50
- "svelte": "./dist/edges/dev/index.js"
51
- },
52
- "./edges/plugin": {
53
- "types": "./dist/edges/plugin/index.d.ts",
54
- "svelte": "./dist/edges/plugin/index.js",
55
- "import": "./dist/edges/plugin/index.js"
56
- },
57
- "./tools": {
58
- "types": "./dist/tools/index.d.ts",
59
- "svelte": "./dist/tools/index.js"
60
- },
61
- "./i18n": {
62
- "types": "./dist/i18n/index.d.ts",
63
- "svelte": "./dist/i18n/index.js"
64
- }
65
- },
66
- "peerDependencies": {
67
- "svelte": ">=5.0.0",
68
- "@sveltejs/kit": ">=2.16.0"
69
- },
70
- "devDependencies": {
71
- "@eslint/compat": "^1.2.5",
72
- "@eslint/js": "^9.18.0",
73
- "@playwright/test": "^1.49.1",
74
- "@sveltejs/adapter-auto": "^6.0.0",
75
- "@sveltejs/kit": "^2.16.0",
76
- "@sveltejs/package": "^2.0.0",
77
- "@sveltejs/vite-plugin-svelte": "^5.0.0",
78
- "@testing-library/jest-dom": "^6.6.3",
79
- "@testing-library/svelte": "^5.2.4",
80
- "eslint": "^9.18.0",
81
- "eslint-config-prettier": "^10.0.1",
82
- "eslint-plugin-svelte": "^3.0.0",
83
- "globals": "^16.0.0",
84
- "jsdom": "^26.0.0",
85
- "prettier": "^3.4.2",
86
- "prettier-plugin-svelte": "^3.3.3",
87
- "publint": "^0.3.2",
88
- "svelte": "^5.0.0",
89
- "svelte-check": "^4.0.0",
90
- "typescript": "^5.0.0",
91
- "typescript-eslint": "^8.20.0",
92
- "vite": "^6.2.6",
93
- "vitest": "^3.0.0",
94
- "@commitlint/cli": "^19.7.1",
95
- "semantic-release": "^24.2.3",
96
- "@semantic-release/git": "^10.0.1",
97
- "git-cz": "^4.9.0",
98
- "husky": "^9.1.7",
99
- "commander": "^13.1.0",
100
- "commitizen": "^4.3.1",
101
- "env-cmd": "^10.1.0"
102
- },
103
- "config": {
104
- "commitizen": {
105
- "path": "git-cz"
106
- }
107
- },
108
- "keywords": [
109
- "svelte"
110
- ],
111
- "dependencies": {
112
- "azure-net-tools": "^1.1.2",
113
- "edges-svelte": "^2.2.0",
114
- "edges-svelte-translations": "^2.2.0",
115
- "ky": "^1.14.0"
116
- },
117
- "scripts": {
118
- "dev": "vite dev",
119
- "build": "vite build && npm run prepack",
120
- "preview": "vite preview",
121
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
122
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
123
- "format": "prettier --write .",
124
- "lint": "prettier --check . && eslint .",
125
- "test:unit": "vitest",
126
- "test": "npm run test:unit -- --run && npm run test:e2e",
127
- "test:e2e": "playwright test",
128
- "semantic-release": "env-cmd semantic-release",
129
- "precommit": "pnpm lint && pnpm check",
130
- "commit": "pnpm format && git add . && git-cz && git push",
131
- "release": "pnpm commit && pnpm semantic-release"
132
- }
133
- }
2
+ "name": "@azure-net/kit",
3
+ "version": "2.2.5",
4
+ "scripts": {
5
+ "dev": "vite dev",
6
+ "build": "vite build && npm run prepack",
7
+ "preview": "vite preview",
8
+ "prepare": "svelte-kit sync || echo ''",
9
+ "prepack": "svelte-kit sync && svelte-package && publint",
10
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
12
+ "format": "prettier --write .",
13
+ "lint": "prettier --check . && eslint .",
14
+ "test:unit": "vitest",
15
+ "test": "npm run test:unit -- --run && npm run test:e2e",
16
+ "test:e2e": "playwright test",
17
+ "semantic-release": "env-cmd semantic-release",
18
+ "precommit": "pnpm lint && pnpm check",
19
+ "commit": "pnpm format && git add . && git-cz && git push",
20
+ "release": "pnpm commit && pnpm semantic-release"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "!dist/**/*.test.*",
25
+ "!dist/**/*.spec.*"
26
+ ],
27
+ "sideEffects": [
28
+ "**/*.css"
29
+ ],
30
+ "svelte": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "type": "module",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "svelte": "./dist/index.js"
37
+ },
38
+ "./constants": {
39
+ "types": "./dist/core/constants/index.d.ts",
40
+ "svelte": "./dist/core/constants/index.js"
41
+ },
42
+ "./infra": {
43
+ "types": "./dist/core/infra/index.d.ts",
44
+ "svelte": "./dist/core/infra/index.js"
45
+ },
46
+ "./schema": {
47
+ "types": "./dist/core/delivery/schema/rules/index.d.ts",
48
+ "svelte": "./dist/core/delivery/schema/rules/index.js"
49
+ },
50
+ "./edges": {
51
+ "types": "./dist/edges/index.d.ts",
52
+ "svelte": "./dist/edges/index.js"
53
+ },
54
+ "./edges/server": {
55
+ "types": "./dist/edges/server/index.d.ts",
56
+ "svelte": "./dist/edges/server/index.js"
57
+ },
58
+ "./edges/state": {
59
+ "types": "./dist/edges/state/index.d.ts",
60
+ "svelte": "./dist/edges/state/index.js"
61
+ },
62
+ "./edges/context": {
63
+ "types": "./dist/edges/context/index.d.ts",
64
+ "svelte": "./dist/edges/context/index.js"
65
+ },
66
+ "./edges/dev": {
67
+ "types": "./dist/edges/dev/index.d.ts",
68
+ "svelte": "./dist/edges/dev/index.js"
69
+ },
70
+ "./edges/plugin": {
71
+ "types": "./dist/edges/plugin/index.d.ts",
72
+ "svelte": "./dist/edges/plugin/index.js",
73
+ "import": "./dist/edges/plugin/index.js"
74
+ },
75
+ "./tools": {
76
+ "types": "./dist/tools/index.d.ts",
77
+ "svelte": "./dist/tools/index.js"
78
+ },
79
+ "./i18n": {
80
+ "types": "./dist/i18n/index.d.ts",
81
+ "svelte": "./dist/i18n/index.js"
82
+ }
83
+ },
84
+ "peerDependencies": {
85
+ "svelte": ">=5.0.0",
86
+ "@sveltejs/kit": ">=2.16.0"
87
+ },
88
+ "devDependencies": {
89
+ "@eslint/compat": "^1.2.5",
90
+ "@eslint/js": "^9.18.0",
91
+ "@playwright/test": "^1.49.1",
92
+ "@sveltejs/adapter-auto": "^6.0.0",
93
+ "@sveltejs/kit": "^2.16.0",
94
+ "@sveltejs/package": "^2.0.0",
95
+ "@sveltejs/vite-plugin-svelte": "^5.0.0",
96
+ "@testing-library/jest-dom": "^6.6.3",
97
+ "@testing-library/svelte": "^5.2.4",
98
+ "eslint": "^9.18.0",
99
+ "eslint-config-prettier": "^10.0.1",
100
+ "eslint-plugin-svelte": "^3.0.0",
101
+ "globals": "^16.0.0",
102
+ "jsdom": "^26.0.0",
103
+ "prettier": "^3.4.2",
104
+ "prettier-plugin-svelte": "^3.3.3",
105
+ "publint": "^0.3.2",
106
+ "svelte": "^5.0.0",
107
+ "svelte-check": "^4.0.0",
108
+ "typescript": "^5.0.0",
109
+ "typescript-eslint": "^8.20.0",
110
+ "vite": "^6.2.6",
111
+ "vitest": "^3.0.0",
112
+ "@commitlint/cli": "^19.7.1",
113
+ "semantic-release": "^24.2.3",
114
+ "@semantic-release/git": "^10.0.1",
115
+ "git-cz": "^4.9.0",
116
+ "husky": "^9.1.7",
117
+ "commander": "^13.1.0",
118
+ "commitizen": "^4.3.1",
119
+ "env-cmd": "^10.1.0"
120
+ },
121
+ "config": {
122
+ "commitizen": {
123
+ "path": "git-cz"
124
+ }
125
+ },
126
+ "keywords": [
127
+ "svelte"
128
+ ],
129
+ "pnpm": {
130
+ "onlyBuiltDependencies": [
131
+ "esbuild"
132
+ ]
133
+ },
134
+ "packageManager": "pnpm@9.13.2+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a",
135
+ "dependencies": {
136
+ "azure-net-tools": "^1.1.2",
137
+ "edges-svelte": "^2.2.0",
138
+ "edges-svelte-translations": "^2.2.0",
139
+ "ky": "^1.14.0"
140
+ }
141
+ }