xenopomp-essentials 0.0.1-beta.9 → 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.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Fluent interface for creating paths of application.
3
+ *
4
+ * @since 0.0.1
5
+ *
6
+ * @example
7
+ * import { PathBuilder } from 'xenopomp-essentials/cli-tools';
8
+ *
9
+ * const builder = new PathBuilder();
10
+ *
11
+ * const res = builder
12
+ * .appSource()
13
+ * .cd('./dist/src')
14
+ * .file('.prettierrc')
15
+ * .build();
16
+ *
17
+ * console.log(res); //? C:/Projects/example/node_modules/xenopomp-essentials/dist/src/.prettierrc
18
+ */
19
+ declare class PathBuilder {
20
+ private paths;
21
+ private pushPaths;
22
+ /**
23
+ * Pushes any custom paths to builder.
24
+ * @since 0.0.1
25
+ * @param paths
26
+ */
27
+ cd(...paths: string[]): PathBuilder;
28
+ /**
29
+ * Pushes filename to paths.
30
+ * @since 0.0.1
31
+ * @param fileName
32
+ */
33
+ file<T extends `${string}.${string}`>(fileName: T): PathBuilder;
34
+ /**
35
+ * Pushes path to compiled app directory.
36
+ * Is useful for cli tools that have to access files inside their bundles.
37
+ *
38
+ * It probably may take no effect (if import.meta is not available in a scope).
39
+ * If it is, will push cwd.
40
+ *
41
+ * @since 0.0.1
42
+ */
43
+ appSource(): PathBuilder;
44
+ /**
45
+ * Gets path of directory where script is running. In cli tools it access
46
+ * path, where cli tool was started.
47
+ * @since 0.0.1
48
+ */
49
+ cwd(): PathBuilder;
50
+ /**
51
+ * @since 0.0.1
52
+ */
53
+ clear(): PathBuilder;
54
+ /**
55
+ * @since 0.0.1
56
+ */
57
+ build(): string;
58
+ }
59
+
60
+ export { PathBuilder };
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Fluent interface for creating paths of application.
3
+ *
4
+ * @since 0.0.1
5
+ *
6
+ * @example
7
+ * import { PathBuilder } from 'xenopomp-essentials/cli-tools';
8
+ *
9
+ * const builder = new PathBuilder();
10
+ *
11
+ * const res = builder
12
+ * .appSource()
13
+ * .cd('./dist/src')
14
+ * .file('.prettierrc')
15
+ * .build();
16
+ *
17
+ * console.log(res); //? C:/Projects/example/node_modules/xenopomp-essentials/dist/src/.prettierrc
18
+ */
19
+ declare class PathBuilder {
20
+ private paths;
21
+ private pushPaths;
22
+ /**
23
+ * Pushes any custom paths to builder.
24
+ * @since 0.0.1
25
+ * @param paths
26
+ */
27
+ cd(...paths: string[]): PathBuilder;
28
+ /**
29
+ * Pushes filename to paths.
30
+ * @since 0.0.1
31
+ * @param fileName
32
+ */
33
+ file<T extends `${string}.${string}`>(fileName: T): PathBuilder;
34
+ /**
35
+ * Pushes path to compiled app directory.
36
+ * Is useful for cli tools that have to access files inside their bundles.
37
+ *
38
+ * It probably may take no effect (if import.meta is not available in a scope).
39
+ * If it is, will push cwd.
40
+ *
41
+ * @since 0.0.1
42
+ */
43
+ appSource(): PathBuilder;
44
+ /**
45
+ * Gets path of directory where script is running. In cli tools it access
46
+ * path, where cli tool was started.
47
+ * @since 0.0.1
48
+ */
49
+ cwd(): PathBuilder;
50
+ /**
51
+ * @since 0.0.1
52
+ */
53
+ clear(): PathBuilder;
54
+ /**
55
+ * @since 0.0.1
56
+ */
57
+ build(): string;
58
+ }
59
+
60
+ export { PathBuilder };
@@ -0,0 +1 @@
1
+ import s from"node:path";import{z as r}from"zod";const i=r.object({dirname:r.string().optional()}),h=i.parse(import.meta);class a{paths=[];pushPaths(...t){return this.paths.push(...t),this}cd(...t){return this.pushPaths(...t)}file(t){return this.pushPaths(`./${t}`)}appSource(){return h.dirname?this.pushPaths(s.join(s.dirname(h.dirname),"../")):this.cwd()}cwd(){return this.pushPaths(process.cwd())}clear(){return this.paths=[],this}build(){return s.join(...this.paths)}}export{a as PathBuilder};
@@ -0,0 +1,10 @@
1
+ import ririd from '@ririd/eslint-config';
2
+ import { D as Defined } from '../shared/xenopomp-essentials.BFV6RP1V.mjs';
3
+
4
+ type RiridParams = Parameters<typeof ririd>;
5
+ type RiridOptions = Defined<RiridParams[0]>;
6
+ type UserConfig = Defined<RiridParams[1]>;
7
+
8
+ declare function xenopomp(options?: RiridOptions, ...userConfigs: UserConfig[]): ReturnType<typeof ririd>;
9
+
10
+ export { xenopomp as default };
@@ -0,0 +1,10 @@
1
+ import ririd from '@ririd/eslint-config';
2
+ import { D as Defined } from '../shared/xenopomp-essentials.BFV6RP1V.js';
3
+
4
+ type RiridParams = Parameters<typeof ririd>;
5
+ type RiridOptions = Defined<RiridParams[0]>;
6
+ type UserConfig = Defined<RiridParams[1]>;
7
+
8
+ declare function xenopomp(options?: RiridOptions, ...userConfigs: UserConfig[]): ReturnType<typeof ririd>;
9
+
10
+ export { xenopomp as default };
@@ -0,0 +1 @@
1
+ import s from"@ririd/eslint-config";import{deepmerge as r}from"deepmerge-ts";import e from"globals";const n={next:!0,react:!0,jsonc:!1,yaml:!1,stylistic:{semi:!0,quotes:"single"},typescript:{overrides:{"ts/consistent-type-definitions":["error","interface"],"ts/interface-name-prefix":"off","ts/explicit-function-return-type":"off","ts/explicit-module-boundary-types":"off","ts/no-explicit-any":"off"}},rules:{"import/order":"off","react/react-in-jsx-scope":"off","react/prop-types":"off","antfu/top-level-function":"off","perfectionist/sort-imports":"off","perfectionist/sort-named-imports":"off","perfectionist/sort-named-exports":"off","antfu/consistent-chaining":"off","perfectionist/sort-exports":"off","style/no-multiple-empty-lines":"off"}};function i(t,...o){return s(r(n,t),{name:"Old config",languageOptions:{globals:{...e.browser,...e.jquery,...e.node,document:"readonly",navigator:"readonly",window:"readonly"}},ignores:["**/.next/*","**/node_modules/*","**/.github/*","cypress","**/__tests__/e2e/*","*.json","**/*.d.ts",".eslintrc.js","eslint.config.js",".prettierrc",".stylelintrc.js","tsconfig.json","package.json","*.md","*.config.ts","*.config.js","*.md"]},{name:"Rules breakup #1",rules:{"@next/next/no-duplicate-head":"off"}},{name:"Rules breakup #2",rules:{"style/operator-linebreak":"off","test/consistent-test-it":"off","test/prefer-lowercase-title":"off","style/jsx-quotes":"off","style/multiline-ternary":"off","style/indent":"off"},ignores:["cypress"]},...o)}export{i as default};
package/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ElementType, ComponentProps, FC, ReactNode, Dispatch, SetStateAction } from 'react';
2
+ export { D as Defined } from './shared/xenopomp-essentials.BFV6RP1V.mjs';
2
3
  import { Jsonifiable } from 'type-fest';
3
- export { transliterate } from 'transliteration';
4
+ import * as transliteration from 'transliteration';
4
5
 
5
6
  /**
6
7
  * Matches any object but not arrays, class instances etc.
@@ -134,6 +135,11 @@ type FunctionalChildren<Args extends any[]> = ReactNode | ((...args: Args) => Re
134
135
  */
135
136
  type FcProps<Comp> = Comp extends FC<infer Props> ? Props : never;
136
137
 
138
+ /**
139
+ * Matches any proper React component.
140
+ */
141
+ type AnyFC = FC<unknown>;
142
+
137
143
  /**
138
144
  * Make any async func synchronous.
139
145
  *
@@ -227,12 +233,6 @@ type DeepInject<T, I extends AnyObject> = T extends object ? {
227
233
  [K in keyof T]: T[K] extends object ? T[K] & I & DeepInject<T[K], I> : T[K];
228
234
  } & I : T;
229
235
 
230
- /**
231
- * Removes undefined from union type.
232
- * @since 0.0.1
233
- */
234
- type Defined<T> = Exclude<T, undefined>;
235
-
236
236
  /**
237
237
  * Return never if type does not match JSON schema.
238
238
  *
@@ -498,4 +498,67 @@ interface VersionData {
498
498
  */
499
499
  declare const parseVersion: (raw: string) => VersionData;
500
500
 
501
- export { type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DeepInject, type DeepWriteable, type Defined, type EmptyObject, type FcProps, type Fn, type FunctionalChildren, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type Preid, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type VersionData, type WeakOmit, type Writeable, capitalize, parseVersion, pipe, uncapitalize };
501
+ /**
502
+ * Transforms any given string to transliterated variant.
503
+ *
504
+ * @since 0.0.1
505
+ */
506
+ declare const transliterate: transliteration.TransliterateFunction;
507
+
508
+ /**
509
+ * Constraints number with min and max values.
510
+ * @param num
511
+ * @param min
512
+ * @param max
513
+ *
514
+ * @example Min value
515
+ * console.log({
516
+ * ogNum: 1, // 1
517
+ * minmax: minmax(1, [2, undefined]), // 2
518
+ * });
519
+ *
520
+ * @example Max value
521
+ * console.log({
522
+ * ogNum: 1001, // 1001
523
+ * minmax: minmax(1001, [undefined, 900]), // 900
524
+ * });
525
+ *
526
+ * @example Min and max value
527
+ * console.log({
528
+ * ogNum: 600, // 600
529
+ * minmax: minmax(1001, [2, 900]), // 600
530
+ * });
531
+ */
532
+ declare const minmax: (num: number, [min, max]: [min: number | undefined, max: number | undefined]) => number;
533
+
534
+ /**
535
+ * Creates properly type object with jsxDotNotation.
536
+ *
537
+ * @param comp
538
+ * @param rest
539
+ *
540
+ * @example
541
+ * const FlexComp: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
542
+ * const FlexRow: FC<PropsWithChildren & { short?: boolean }> = ({ children }) => (
543
+ * <div>{children}</div>
544
+ * );
545
+ * const FlexCol: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
546
+ *
547
+ * const Flex = jsxDotNotation(FlexComp, {
548
+ * Row: FlexRow,
549
+ * Col: FlexCol,
550
+ * });
551
+ *
552
+ * const Am = () => {
553
+ * return (
554
+ * <Flex>
555
+ * <Flex.Row short>
556
+ * <Flex.Col></Flex.Col>
557
+ * </Flex.Row>
558
+ * </Flex>
559
+ * );
560
+ * };
561
+ */
562
+ declare function jsxDotNotation<Props = EmptyObject, Rest extends Record<string, FC<AnyObject>> = EmptyObject>(comp: FC<Props>, rest: Rest): FC<Props> & Rest;
563
+
564
+ export { type AnyFC, type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DeepInject, type DeepWriteable, type EmptyObject, type FcProps, type Fn, type FunctionalChildren, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type Preid, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type VersionData, type WeakOmit, type Writeable, capitalize, jsxDotNotation, minmax, parseVersion, pipe, transliterate, uncapitalize };
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ElementType, ComponentProps, FC, ReactNode, Dispatch, SetStateAction } from 'react';
2
+ export { D as Defined } from './shared/xenopomp-essentials.BFV6RP1V.js';
2
3
  import { Jsonifiable } from 'type-fest';
3
- export { transliterate } from 'transliteration';
4
+ import * as transliteration from 'transliteration';
4
5
 
5
6
  /**
6
7
  * Matches any object but not arrays, class instances etc.
@@ -134,6 +135,11 @@ type FunctionalChildren<Args extends any[]> = ReactNode | ((...args: Args) => Re
134
135
  */
135
136
  type FcProps<Comp> = Comp extends FC<infer Props> ? Props : never;
136
137
 
138
+ /**
139
+ * Matches any proper React component.
140
+ */
141
+ type AnyFC = FC<unknown>;
142
+
137
143
  /**
138
144
  * Make any async func synchronous.
139
145
  *
@@ -227,12 +233,6 @@ type DeepInject<T, I extends AnyObject> = T extends object ? {
227
233
  [K in keyof T]: T[K] extends object ? T[K] & I & DeepInject<T[K], I> : T[K];
228
234
  } & I : T;
229
235
 
230
- /**
231
- * Removes undefined from union type.
232
- * @since 0.0.1
233
- */
234
- type Defined<T> = Exclude<T, undefined>;
235
-
236
236
  /**
237
237
  * Return never if type does not match JSON schema.
238
238
  *
@@ -498,4 +498,67 @@ interface VersionData {
498
498
  */
499
499
  declare const parseVersion: (raw: string) => VersionData;
500
500
 
501
- export { type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DeepInject, type DeepWriteable, type Defined, type EmptyObject, type FcProps, type Fn, type FunctionalChildren, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type Preid, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type VersionData, type WeakOmit, type Writeable, capitalize, parseVersion, pipe, uncapitalize };
501
+ /**
502
+ * Transforms any given string to transliterated variant.
503
+ *
504
+ * @since 0.0.1
505
+ */
506
+ declare const transliterate: transliteration.TransliterateFunction;
507
+
508
+ /**
509
+ * Constraints number with min and max values.
510
+ * @param num
511
+ * @param min
512
+ * @param max
513
+ *
514
+ * @example Min value
515
+ * console.log({
516
+ * ogNum: 1, // 1
517
+ * minmax: minmax(1, [2, undefined]), // 2
518
+ * });
519
+ *
520
+ * @example Max value
521
+ * console.log({
522
+ * ogNum: 1001, // 1001
523
+ * minmax: minmax(1001, [undefined, 900]), // 900
524
+ * });
525
+ *
526
+ * @example Min and max value
527
+ * console.log({
528
+ * ogNum: 600, // 600
529
+ * minmax: minmax(1001, [2, 900]), // 600
530
+ * });
531
+ */
532
+ declare const minmax: (num: number, [min, max]: [min: number | undefined, max: number | undefined]) => number;
533
+
534
+ /**
535
+ * Creates properly type object with jsxDotNotation.
536
+ *
537
+ * @param comp
538
+ * @param rest
539
+ *
540
+ * @example
541
+ * const FlexComp: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
542
+ * const FlexRow: FC<PropsWithChildren & { short?: boolean }> = ({ children }) => (
543
+ * <div>{children}</div>
544
+ * );
545
+ * const FlexCol: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
546
+ *
547
+ * const Flex = jsxDotNotation(FlexComp, {
548
+ * Row: FlexRow,
549
+ * Col: FlexCol,
550
+ * });
551
+ *
552
+ * const Am = () => {
553
+ * return (
554
+ * <Flex>
555
+ * <Flex.Row short>
556
+ * <Flex.Col></Flex.Col>
557
+ * </Flex.Row>
558
+ * </Flex>
559
+ * );
560
+ * };
561
+ */
562
+ declare function jsxDotNotation<Props = EmptyObject, Rest extends Record<string, FC<AnyObject>> = EmptyObject>(comp: FC<Props>, rest: Rest): FC<Props> & Rest;
563
+
564
+ export { type AnyFC, type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DeepInject, type DeepWriteable, type EmptyObject, type FcProps, type Fn, type FunctionalChildren, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type Preid, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type VersionData, type WeakOmit, type Writeable, capitalize, jsxDotNotation, minmax, parseVersion, pipe, transliterate, uncapitalize };
package/index.mjs CHANGED
@@ -1 +1 @@
1
- export{transliterate}from"transliteration";function n(t){function e(r){return t(r)}return e.pipe=r=>n(i=>r(t(i))),e}function a(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){return t.charAt(0).toLowerCase()+t.slice(1)}const o=t=>{const e=t.match(/(\d\.){2}\d/gi)?.at(0)||null,r=t.match(/(?<=-)\w+(?=\.\d)/gi)?.at(0),i=t.match(/(?<=((\d\.){2}\d-\w+\.))\d+/gi)?.at(0);return{version:e,preid:r,prerelease:i}};export{a as capitalize,o as parseVersion,n as pipe,c as uncapitalize};
1
+ import{transliterate as a}from"transliteration";function i(t){function r(n){return t(n)}return r.pipe=n=>i(e=>n(t(e))),r}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function c(t){return t.charAt(0).toLowerCase()+t.slice(1)}const s=t=>{const r=t.match(/(\d\.){2}\d/gi)?.at(0)||null,n=t.match(/(?<=-)\w+(?=\.\d)/gi)?.at(0),e=t.match(/(?<=((\d\.){2}\d-\w+\.))\d+/gi)?.at(0);return{version:r,preid:n,prerelease:e}},p=a,u=(t,[r,n])=>r&&t<=r?r:n&&t>=n?n:t;function l(t,r){return Object.assign(t,r)}export{o as capitalize,l as jsxDotNotation,u as minmax,s as parseVersion,i as pipe,p as transliterate,c as uncapitalize};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xenopomp-essentials",
3
- "version": "0.0.1-beta.9",
3
+ "version": "0.1.1",
4
4
  "author": "XenoPOMP <101574433+XenoPOMP@users.noreply.github.com>",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,15 +12,12 @@
12
12
  "engines": {
13
13
  "node": "20 || >=22"
14
14
  },
15
- "publishConfig": {
16
- "tag": "beta"
17
- },
18
15
  "scripts": {
19
16
  "build": "run-p build:* && run-p build:packages:*",
20
17
  "build:main": "unbuild --config .config/build.config.ts",
21
18
  "build:packages:cli": "echo CLI",
22
19
  "lint": "run-s lint:*",
23
- "lint:code": "eslint -c ./.config/eslint.config.mjs .",
20
+ "lint:code": "eslint",
24
21
  "coverage": "vitest run --coverage -c ./.config/vitest.config.ts",
25
22
  "prepare": "husky"
26
23
  },
@@ -28,18 +25,26 @@
28
25
  "types": "./index.d.ts",
29
26
  "peerDependencies": {
30
27
  "@types/react": ">=19",
28
+ "eslint": "^9",
31
29
  "next": ">=15",
32
30
  "react": ">=19",
33
31
  "type-fest": ">=4",
34
- "typescript": ">=5.4"
32
+ "typescript": ">=5.4",
33
+ "zod": "*"
35
34
  },
36
35
  "dependencies": {
36
+ "@antfu/eslint-config": "^4.10.1",
37
+ "@ririd/eslint-config": "^1.4.0",
37
38
  "@types/react": "^19.0.8",
39
+ "deepmerge-ts": "^7.1.5",
40
+ "eslint": "^9.22.0",
41
+ "globals": "^16.0.0",
38
42
  "next": "^15.1.6",
39
43
  "react": "^19.0.0",
40
44
  "transliteration": "^2.3.5",
41
45
  "type-fest": "^4.33.0",
42
- "typescript": "^5.7.3"
46
+ "typescript": "^5.7.3",
47
+ "zod": "^3.24.1"
43
48
  },
44
49
  "devDependencies": {
45
50
  "@testing-library/dom": "^10.4.0",
@@ -47,11 +52,10 @@
47
52
  "@trivago/prettier-plugin-sort-imports": "^5.2.1",
48
53
  "@vitejs/plugin-react": "^4.3.4",
49
54
  "@vitest/coverage-istanbul": "^3.0.4",
50
- "eslint": "^9.19.0",
51
- "eslint-config-xeno": "^2.0.3-rc.3",
52
55
  "esno": "^4.8.0",
53
56
  "husky": "^9.1.7",
54
57
  "hygen": "^6.2.11",
58
+ "jiti": "^2.4.2",
55
59
  "jsdom": "^26.0.0",
56
60
  "lint-staged": "^15.4.2",
57
61
  "npm-run-all": "^4.1.5",
@@ -62,7 +66,6 @@
62
66
  "unbuild": "^3.3.1",
63
67
  "vite": "^6.0.11",
64
68
  "vite-tsconfig-paths": "^5.1.4",
65
- "vitest": "^3.0.4",
66
- "zod": "^3.24.1"
69
+ "vitest": "^3.0.4"
67
70
  }
68
71
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Removes undefined from union type.
3
+ * @since 0.0.1
4
+ */
5
+ type Defined<T> = Exclude<T, undefined>;
6
+
7
+ export type { Defined as D };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Removes undefined from union type.
3
+ * @since 0.0.1
4
+ */
5
+ type Defined<T> = Exclude<T, undefined>;
6
+
7
+ export type { Defined as D };