xenopomp-essentials 0.5.0-canary.1 → 0.5.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint/index.d.mts +2 -1
- package/eslint/index.d.ts +2 -1
- package/index.d.mts +3 -1
- package/index.d.ts +3 -1
- package/package.json +4 -2
- package/shared/xenopomp-essentials.B-Vt61jj.d.mts +3 -0
- package/shared/xenopomp-essentials.B-Vt61jj.d.ts +3 -0
- package/vitest/index.d.mts +81 -14
- package/vitest/index.d.ts +81 -14
- package/vitest/index.mjs +1 -1
package/eslint/index.d.mts
CHANGED
|
@@ -36,4 +36,5 @@ type Options = OptionsConfig & CustomConfig & TypedFlatConfigItem & CustomOption
|
|
|
36
36
|
*/
|
|
37
37
|
declare function xenopomp(options?: Options, ...userConfigs: UserConfigItem[]): Configs;
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { xenopomp as default };
|
|
40
|
+
export type { Configs, CustomConfig, Options, UserConfigItem };
|
package/eslint/index.d.ts
CHANGED
|
@@ -36,4 +36,5 @@ type Options = OptionsConfig & CustomConfig & TypedFlatConfigItem & CustomOption
|
|
|
36
36
|
*/
|
|
37
37
|
declare function xenopomp(options?: Options, ...userConfigs: UserConfigItem[]): Configs;
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { xenopomp as default };
|
|
40
|
+
export type { Configs, CustomConfig, Options, UserConfigItem };
|
package/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { P as PromiseOr } from './shared/xenopomp-essentials.B-Vt61jj.mjs';
|
|
1
2
|
import { ElementType, ComponentProps, FC, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
2
3
|
import { Jsonifiable } from 'type-fest';
|
|
3
4
|
import * as transliteration from 'transliteration';
|
|
@@ -616,4 +617,5 @@ declare const minmax: (num: number, [min, max]: [min: number | undefined, max: n
|
|
|
616
617
|
*/
|
|
617
618
|
declare function jsxDotNotation<Props = EmptyObject, Rest extends Record<string, FC<any>> = EmptyObject>(comp: FC<Props>, rest: Rest): FC<Props> & Rest;
|
|
618
619
|
|
|
619
|
-
export {
|
|
620
|
+
export { capitalize, jsxDotNotation, minmax, parseVersion, pipe, transliterate, uncapitalize };
|
|
621
|
+
export type { AnyFC, AnyObject, ArrayItemType, ArrayType, AsyncFC, AsyncReturnType, AsyncVariableFC, DataAttributes, Defined, EmptyObject, FCProps, FcProps, Fn, FunctionalChildren, InjectDeep, Jsonish, Lenient, LenientAutocomplete, MatchType, MergeTypes, Modify, NextErrorParams, NextParams, NextSearchParams, Nullable, OneOf, OnlyFirst, Optional, Preid, Prettify, PrettifyDeep, RecordKey, RecordValue, ReplaceReturnType, SelectivePartial, SetState, StrictOmit, Synchronous, Undefinable, VariableFC, VariableProps, VersionData, WeakOmit, Writeable, WriteableDeep };
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { P as PromiseOr } from './shared/xenopomp-essentials.B-Vt61jj.js';
|
|
1
2
|
import { ElementType, ComponentProps, FC, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
2
3
|
import { Jsonifiable } from 'type-fest';
|
|
3
4
|
import * as transliteration from 'transliteration';
|
|
@@ -616,4 +617,5 @@ declare const minmax: (num: number, [min, max]: [min: number | undefined, max: n
|
|
|
616
617
|
*/
|
|
617
618
|
declare function jsxDotNotation<Props = EmptyObject, Rest extends Record<string, FC<any>> = EmptyObject>(comp: FC<Props>, rest: Rest): FC<Props> & Rest;
|
|
618
619
|
|
|
619
|
-
export {
|
|
620
|
+
export { capitalize, jsxDotNotation, minmax, parseVersion, pipe, transliterate, uncapitalize };
|
|
621
|
+
export type { AnyFC, AnyObject, ArrayItemType, ArrayType, AsyncFC, AsyncReturnType, AsyncVariableFC, DataAttributes, Defined, EmptyObject, FCProps, FcProps, Fn, FunctionalChildren, InjectDeep, Jsonish, Lenient, LenientAutocomplete, MatchType, MergeTypes, Modify, NextErrorParams, NextParams, NextSearchParams, Nullable, OneOf, OnlyFirst, Optional, Preid, Prettify, PrettifyDeep, RecordKey, RecordValue, ReplaceReturnType, SelectivePartial, SetState, StrictOmit, Synchronous, Undefinable, VariableFC, VariableProps, VersionData, WeakOmit, Writeable, WriteableDeep };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xenopomp-essentials",
|
|
3
|
-
"version": "0.5.0-canary.
|
|
3
|
+
"version": "0.5.0-canary.2",
|
|
4
4
|
"author": "XenoPOMP <101574433+XenoPOMP@users.noreply.github.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
"@typescript-eslint/types": "^8.48.0",
|
|
54
54
|
"@typescript-eslint/utils": "^8.48.0",
|
|
55
55
|
"@typescript-eslint/visitor-keys": "^8.48.0",
|
|
56
|
+
"@vitest/spy": "^4.0.14",
|
|
57
|
+
"ansi-colors": "^4.1.3",
|
|
56
58
|
"deepmerge-ts": "^7.1.5",
|
|
57
59
|
"eslint": "^9.22.0",
|
|
58
60
|
"eslint-config-prettier": "^10.1.1",
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
"prettier": "^3.4.2",
|
|
89
91
|
"react-dom": "^19.2.0",
|
|
90
92
|
"tsd": "^0.31.2",
|
|
91
|
-
"unbuild": "^3.
|
|
93
|
+
"unbuild": "^3.6.1",
|
|
92
94
|
"vite": "^7.2.4",
|
|
93
95
|
"vite-tsconfig-paths": "^5.1.4"
|
|
94
96
|
}
|
package/vitest/index.d.mts
CHANGED
|
@@ -1,26 +1,93 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as PromiseOr } from '../shared/xenopomp-essentials.B-Vt61jj.mjs';
|
|
2
|
+
import { render, renderHook } from '@testing-library/react';
|
|
3
|
+
import * as vitest from 'vitest';
|
|
4
|
+
import * as _vitest_spy from '@vitest/spy';
|
|
2
5
|
|
|
3
6
|
/** Executes function and expects that it won't throw. */
|
|
4
|
-
declare const assertNotThrowing: (callable: () =>
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Deeply checks if two objects are equal.
|
|
8
|
-
*
|
|
9
|
-
* @param expected
|
|
10
|
-
* @param real
|
|
11
|
-
*/
|
|
12
|
-
declare const expectToDeepEqual: <Type>(expected: Type, real: NoInfer<Type>) => void;
|
|
7
|
+
declare const assertNotThrowing: <T = void>(callable: () => PromiseOr<T>) => void;
|
|
13
8
|
|
|
14
9
|
type RenderArguments = Parameters<typeof render>;
|
|
15
10
|
type RenderHookArguments = Parameters<typeof renderHook>;
|
|
16
11
|
type RenderFunc<Args extends unknown[] = RenderArguments> = (...args: Args) => void;
|
|
17
|
-
/**
|
|
18
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Renders component and expects that it won`t throw.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* test('It renders', () => {
|
|
17
|
+
* test('It renders', () => {
|
|
18
|
+
* assertRendering(<MyComponent />, {
|
|
19
|
+
* wrapper: RQProvider,
|
|
20
|
+
* });
|
|
21
|
+
* });
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
declare const assertRendering: RenderFunc;
|
|
19
26
|
/**
|
|
20
27
|
* Renders hook within test React component without having to create that component yourself.
|
|
21
28
|
* Expects that it won't throw error.
|
|
29
|
+
*
|
|
22
30
|
* @param props
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* test('It renders', () => {
|
|
34
|
+
* assertHookRendering(() => useExampleStore());
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
declare const assertHookRendering: RenderFunc<RenderHookArguments>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Mocks .env file.
|
|
41
|
+
*
|
|
42
|
+
* @param additionalMocks key-value record of env variables that also have to be mocked.
|
|
43
|
+
*/
|
|
44
|
+
declare const mockEnv: (additionalMocks?: Record<string, string>) => void;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Clear all mocks from Vitest.
|
|
48
|
+
*/
|
|
49
|
+
declare const clearMocks: () => void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Mock **next/navigation** package.
|
|
53
|
+
*/
|
|
54
|
+
declare const mockRouter: () => void;
|
|
55
|
+
|
|
56
|
+
declare const twApiMock: {
|
|
57
|
+
addBase: vitest.Mock<_vitest_spy.Procedure>;
|
|
58
|
+
addComponents: vitest.Mock<_vitest_spy.Procedure>;
|
|
59
|
+
addUtilities: vitest.Mock<_vitest_spy.Procedure>;
|
|
60
|
+
addVariant: vitest.Mock<_vitest_spy.Procedure>;
|
|
61
|
+
config: vitest.Mock<_vitest_spy.Procedure>;
|
|
62
|
+
corePlugins: vitest.Mock<_vitest_spy.Procedure>;
|
|
63
|
+
e: vitest.Mock<_vitest_spy.Procedure>;
|
|
64
|
+
matchComponents: vitest.Mock<_vitest_spy.Procedure>;
|
|
65
|
+
matchUtilities: vitest.Mock<_vitest_spy.Procedure>;
|
|
66
|
+
matchVariant: vitest.Mock<_vitest_spy.Procedure>;
|
|
67
|
+
theme: vitest.Mock<_vitest_spy.Procedure>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type Caller = (...args: any[]) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Creates custom spy factory object that is callable.
|
|
73
|
+
* @param context
|
|
74
|
+
* @example
|
|
75
|
+
* const { callSpy, expectToBeCalled, expectToBeNotCalled } =
|
|
76
|
+
* spyFactory('spyFactory test');
|
|
77
|
+
*
|
|
78
|
+
* // Call spy with some args
|
|
79
|
+
* const args: any[] = [1, 'some', 'args', 2];
|
|
80
|
+
* callSpy(...args);
|
|
81
|
+
*
|
|
82
|
+
* // Run expectation func
|
|
83
|
+
* expectToBeCalled(...args);
|
|
84
|
+
* expectToBeNotCalled(2, 2, 7);
|
|
23
85
|
*/
|
|
24
|
-
declare
|
|
86
|
+
declare function spyFactory(context: string): {
|
|
87
|
+
expectToBeCalled: Caller;
|
|
88
|
+
expectToBeNotCalled: Caller;
|
|
89
|
+
spy: vitest.Mock<(...args: any[]) => void>;
|
|
90
|
+
callSpy: Caller;
|
|
91
|
+
};
|
|
25
92
|
|
|
26
|
-
export { assertNotThrowing,
|
|
93
|
+
export { assertHookRendering, assertNotThrowing, assertRendering, clearMocks, mockEnv, mockRouter, spyFactory, twApiMock };
|
package/vitest/index.d.ts
CHANGED
|
@@ -1,26 +1,93 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as PromiseOr } from '../shared/xenopomp-essentials.B-Vt61jj.js';
|
|
2
|
+
import { render, renderHook } from '@testing-library/react';
|
|
3
|
+
import * as vitest from 'vitest';
|
|
4
|
+
import * as _vitest_spy from '@vitest/spy';
|
|
2
5
|
|
|
3
6
|
/** Executes function and expects that it won't throw. */
|
|
4
|
-
declare const assertNotThrowing: (callable: () =>
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Deeply checks if two objects are equal.
|
|
8
|
-
*
|
|
9
|
-
* @param expected
|
|
10
|
-
* @param real
|
|
11
|
-
*/
|
|
12
|
-
declare const expectToDeepEqual: <Type>(expected: Type, real: NoInfer<Type>) => void;
|
|
7
|
+
declare const assertNotThrowing: <T = void>(callable: () => PromiseOr<T>) => void;
|
|
13
8
|
|
|
14
9
|
type RenderArguments = Parameters<typeof render>;
|
|
15
10
|
type RenderHookArguments = Parameters<typeof renderHook>;
|
|
16
11
|
type RenderFunc<Args extends unknown[] = RenderArguments> = (...args: Args) => void;
|
|
17
|
-
/**
|
|
18
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Renders component and expects that it won`t throw.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* test('It renders', () => {
|
|
17
|
+
* test('It renders', () => {
|
|
18
|
+
* assertRendering(<MyComponent />, {
|
|
19
|
+
* wrapper: RQProvider,
|
|
20
|
+
* });
|
|
21
|
+
* });
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
declare const assertRendering: RenderFunc;
|
|
19
26
|
/**
|
|
20
27
|
* Renders hook within test React component without having to create that component yourself.
|
|
21
28
|
* Expects that it won't throw error.
|
|
29
|
+
*
|
|
22
30
|
* @param props
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* test('It renders', () => {
|
|
34
|
+
* assertHookRendering(() => useExampleStore());
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
declare const assertHookRendering: RenderFunc<RenderHookArguments>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Mocks .env file.
|
|
41
|
+
*
|
|
42
|
+
* @param additionalMocks key-value record of env variables that also have to be mocked.
|
|
43
|
+
*/
|
|
44
|
+
declare const mockEnv: (additionalMocks?: Record<string, string>) => void;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Clear all mocks from Vitest.
|
|
48
|
+
*/
|
|
49
|
+
declare const clearMocks: () => void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Mock **next/navigation** package.
|
|
53
|
+
*/
|
|
54
|
+
declare const mockRouter: () => void;
|
|
55
|
+
|
|
56
|
+
declare const twApiMock: {
|
|
57
|
+
addBase: vitest.Mock<_vitest_spy.Procedure>;
|
|
58
|
+
addComponents: vitest.Mock<_vitest_spy.Procedure>;
|
|
59
|
+
addUtilities: vitest.Mock<_vitest_spy.Procedure>;
|
|
60
|
+
addVariant: vitest.Mock<_vitest_spy.Procedure>;
|
|
61
|
+
config: vitest.Mock<_vitest_spy.Procedure>;
|
|
62
|
+
corePlugins: vitest.Mock<_vitest_spy.Procedure>;
|
|
63
|
+
e: vitest.Mock<_vitest_spy.Procedure>;
|
|
64
|
+
matchComponents: vitest.Mock<_vitest_spy.Procedure>;
|
|
65
|
+
matchUtilities: vitest.Mock<_vitest_spy.Procedure>;
|
|
66
|
+
matchVariant: vitest.Mock<_vitest_spy.Procedure>;
|
|
67
|
+
theme: vitest.Mock<_vitest_spy.Procedure>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type Caller = (...args: any[]) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Creates custom spy factory object that is callable.
|
|
73
|
+
* @param context
|
|
74
|
+
* @example
|
|
75
|
+
* const { callSpy, expectToBeCalled, expectToBeNotCalled } =
|
|
76
|
+
* spyFactory('spyFactory test');
|
|
77
|
+
*
|
|
78
|
+
* // Call spy with some args
|
|
79
|
+
* const args: any[] = [1, 'some', 'args', 2];
|
|
80
|
+
* callSpy(...args);
|
|
81
|
+
*
|
|
82
|
+
* // Run expectation func
|
|
83
|
+
* expectToBeCalled(...args);
|
|
84
|
+
* expectToBeNotCalled(2, 2, 7);
|
|
23
85
|
*/
|
|
24
|
-
declare
|
|
86
|
+
declare function spyFactory(context: string): {
|
|
87
|
+
expectToBeCalled: Caller;
|
|
88
|
+
expectToBeNotCalled: Caller;
|
|
89
|
+
spy: vitest.Mock<(...args: any[]) => void>;
|
|
90
|
+
callSpy: Caller;
|
|
91
|
+
};
|
|
25
92
|
|
|
26
|
-
export { assertNotThrowing,
|
|
93
|
+
export { assertHookRendering, assertNotThrowing, assertRendering, clearMocks, mockEnv, mockRouter, spyFactory, twApiMock };
|
package/vitest/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expect as t}from"vitest";import{render as
|
|
1
|
+
import{expect as c,vi as t}from"vitest";import{render as l,renderHook as r}from"@testing-library/react";import{blue as i,green as u,blueBright as d}from"ansi-colors";const a=e=>{c(()=>e()).not.toThrow()},f=(...e)=>{a(()=>l(...e))},h=(...e)=>{a(()=>r(...e))},m=e=>{t.stubEnv("CANONICAL_URL","http://localhost:4242"),t.stubEnv("IS_PRODUCTION","false"),e&&Object.entries(e).forEach(([n,o])=>t.stubEnv(n,o))},p=()=>{t.clearAllMocks(),t.resetAllMocks(),t.unstubAllEnvs(),t.unstubAllGlobals()},C=()=>{t.mock("next/navigation",()=>({useRouter:()=>({push(){}}),usePathname:()=>"/"}))},x={addBase:t.fn(),addComponents:t.fn(),addUtilities:t.fn(),addVariant:t.fn(),config:t.fn(),corePlugins:t.fn(),e:t.fn(),matchComponents:t.fn(),matchUtilities:t.fn(),matchVariant:t.fn(),theme:t.fn()};class b{_executionContext;constructor(n){this._executionContext=n}call(...n){console.debug(`${i(`[${this._executionContext}]`)} ${u(`Custom spy is called with these args: ${d(n.map(o=>`${o}`).join(", "))}`)}`)}}function g(e){const n=new b(e),o=t.spyOn(n,"call");return{expectToBeCalled:(...s)=>c(o).toHaveBeenCalledWith(s),expectToBeNotCalled:(...s)=>c(o).not.toHaveBeenCalledWith(s),spy:o,callSpy:(...s)=>n.call(s)}}export{h as assertHookRendering,a as assertNotThrowing,f as assertRendering,p as clearMocks,m as mockEnv,C as mockRouter,g as spyFactory,x as twApiMock};
|