@jadeja/ts 1.0.0-alpha.0 → 1.0.0-alpha.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +1 -1
  3. package/dist/{src/configs → configs}/oxfmt/base.d.ts +2 -2
  4. package/dist/{src/configs → configs}/oxfmt/base.d.ts.map +1 -1
  5. package/dist/{oxfmt.js → configs/oxfmt/base.js} +2 -9
  6. package/dist/configs/oxfmt/base.js.map +1 -0
  7. package/dist/{src/configs → configs}/oxfmt/lib.d.ts +2 -2
  8. package/dist/{src/configs → configs}/oxfmt/lib.d.ts.map +1 -1
  9. package/dist/configs/oxfmt/lib.js +7 -0
  10. package/dist/configs/oxfmt/lib.js.map +1 -0
  11. package/dist/{src/configs → configs}/oxfmt/next.d.ts +2 -2
  12. package/dist/{src/configs → configs}/oxfmt/next.d.ts.map +1 -1
  13. package/dist/configs/oxfmt/next.js +14 -0
  14. package/dist/configs/oxfmt/next.js.map +1 -0
  15. package/dist/{src/configs → configs}/oxlint/base.d.ts +8 -3
  16. package/dist/configs/oxlint/base.d.ts.map +1 -0
  17. package/dist/{oxlint.js → configs/oxlint/base.js} +10 -72
  18. package/dist/configs/oxlint/base.js.map +1 -0
  19. package/dist/{src/configs → configs}/oxlint/lib.d.ts +32 -27
  20. package/dist/configs/oxlint/lib.d.ts.map +1 -0
  21. package/dist/configs/oxlint/lib.js +7 -0
  22. package/dist/configs/oxlint/lib.js.map +1 -0
  23. package/dist/{src/configs → configs}/oxlint/next.d.ts +7 -3
  24. package/dist/configs/oxlint/next.d.ts.map +1 -0
  25. package/dist/configs/oxlint/next.js +70 -0
  26. package/dist/configs/oxlint/next.js.map +1 -0
  27. package/dist/configs/vite/base.d.ts +4 -0
  28. package/dist/configs/vite/base.d.ts.map +1 -0
  29. package/dist/configs/vite/base.js +18 -0
  30. package/dist/configs/vite/base.js.map +1 -0
  31. package/dist/configs/vite/lib.d.ts +18 -0
  32. package/dist/configs/vite/lib.d.ts.map +1 -0
  33. package/dist/configs/vite/lib.js +38 -0
  34. package/dist/configs/vite/lib.js.map +1 -0
  35. package/dist/lib/debounce.js +10 -0
  36. package/dist/lib/debounce.js.map +1 -0
  37. package/dist/lib/logger.js +15 -0
  38. package/dist/lib/logger.js.map +1 -0
  39. package/dist/{src/lib → lib}/operations.d.ts +3 -3
  40. package/dist/{src/lib → lib}/operations.d.ts.map +1 -1
  41. package/dist/lib/operations.js +21 -0
  42. package/dist/lib/operations.js.map +1 -0
  43. package/dist/lib/singleton.d.ts +12 -0
  44. package/dist/lib/singleton.d.ts.map +1 -0
  45. package/dist/lib/singleton.js +25 -0
  46. package/dist/lib/singleton.js.map +1 -0
  47. package/dist/lib/types.d.ts.map +1 -0
  48. package/dist/lib/types.js +6 -0
  49. package/dist/lib/types.js.map +1 -0
  50. package/dist/lib/utils.d.ts +13 -0
  51. package/dist/lib/utils.d.ts.map +1 -0
  52. package/dist/lib/utils.js +14 -0
  53. package/dist/lib/utils.js.map +1 -0
  54. package/dist/node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js +3105 -0
  55. package/dist/node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js.map +1 -0
  56. package/dist/{src/plugins → plugins}/vite/copy-folders.d.ts.map +1 -1
  57. package/dist/plugins/vite/copy-folders.js +22 -0
  58. package/dist/plugins/vite/copy-folders.js.map +1 -0
  59. package/dist/plugins/vite/remove-folders.d.ts +14 -0
  60. package/dist/plugins/vite/remove-folders.d.ts.map +1 -0
  61. package/dist/plugins/vite/remove-folders.js +18 -0
  62. package/dist/plugins/vite/remove-folders.js.map +1 -0
  63. package/dist/types/util.d.ts +33 -0
  64. package/dist/types/util.d.ts.map +1 -0
  65. package/package.json +31 -43
  66. package/dist/lib.js +0 -36
  67. package/dist/lib.js.map +0 -1
  68. package/dist/oxfmt.js.map +0 -1
  69. package/dist/oxlint.js.map +0 -1
  70. package/dist/src/configs/oxfmt/index.d.ts +0 -4
  71. package/dist/src/configs/oxfmt/index.d.ts.map +0 -1
  72. package/dist/src/configs/oxfmt/types.d.ts +0 -2
  73. package/dist/src/configs/oxfmt/types.d.ts.map +0 -1
  74. package/dist/src/configs/oxlint/base.d.ts.map +0 -1
  75. package/dist/src/configs/oxlint/index.d.ts +0 -4
  76. package/dist/src/configs/oxlint/index.d.ts.map +0 -1
  77. package/dist/src/configs/oxlint/lib.d.ts.map +0 -1
  78. package/dist/src/configs/oxlint/next.d.ts.map +0 -1
  79. package/dist/src/configs/oxlint/types.d.ts +0 -2
  80. package/dist/src/configs/oxlint/types.d.ts.map +0 -1
  81. package/dist/src/lib/index.d.ts +0 -5
  82. package/dist/src/lib/index.d.ts.map +0 -1
  83. package/dist/src/lib/types.d.ts.map +0 -1
  84. package/dist/src/lib/utils.d.ts +0 -8
  85. package/dist/src/lib/utils.d.ts.map +0 -1
  86. package/dist/src/plugins/vite/index.d.ts +0 -2
  87. package/dist/src/plugins/vite/index.d.ts.map +0 -1
  88. package/dist/src/types/index.d.ts +0 -2
  89. package/dist/src/types/index.d.ts.map +0 -1
  90. package/dist/src/types/shared.d.ts +0 -34
  91. package/dist/src/types/shared.d.ts.map +0 -1
  92. package/dist/vite-plugins.js +0 -22
  93. package/dist/vite-plugins.js.map +0 -1
  94. /package/dist/{src/configs → configs}/ts/base.json +0 -0
  95. /package/dist/{src/configs → configs}/ts/lib.json +0 -0
  96. /package/dist/{src/configs → configs}/ts/next.json +0 -0
  97. /package/dist/{src/lib → lib}/debounce.d.ts +0 -0
  98. /package/dist/{src/lib → lib}/debounce.d.ts.map +0 -0
  99. /package/dist/{src/lib → lib}/logger.d.ts +0 -0
  100. /package/dist/{src/lib → lib}/logger.d.ts.map +0 -0
  101. /package/dist/{src/lib → lib}/types.d.ts +0 -0
  102. /package/dist/{src/plugins → plugins}/vite/copy-folders.d.ts +0 -0
  103. /package/dist/{types.js → types/util.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","names":[],"sources":["../../../src/configs/vite/lib.ts"],"sourcesContent":["// oxlint-disable import/no-relative-parent-imports\n\nimport { relative, resolve } from \"node:path\";\n\nimport { glob } from \"glob\";\n\nimport { freshRegex } from \"../../lib/operations.ts\";\nimport { extractExtensions } from \"../../lib/utils.ts\";\n\nimport viteBase from \"./base.ts\";\n\nimport type { UserConfig } from \"vite\";\n\n/* ============================================================================================= */\n\nexport interface CreateInputEntriesOptions {\n /**\n * `import.meta.dirname`\n */\n dirname: string;\n\n /**\n * paths to create input entry\n */\n entries: string[];\n}\n\nexport const createInputEntries = ({ dirname, entries }: CreateInputEntriesOptions) => {\n //\n const paths: Record<string, string> = {};\n\n for (const entry of entries) {\n for (const file of glob.sync(entry)) {\n // 1. get path relative to 'src' (e.g., 'components/button.tsx')\n // 2. remove the extension\n const key = relative(\"src\", file).replace(\n freshRegex(`\\\\.(${extractExtensions(file).join(\"|\")})$`),\n \"\",\n );\n\n // the absolute path to the file\n const value = resolve(dirname, file);\n\n paths[key] = value;\n }\n }\n\n return paths;\n};\n\n/* ============================================================================================= */\n\nexport type ViteLib = (options: { peerDependencies: Record<string, string> }) => UserConfig;\n\nexport const viteLib: ViteLib = ({ peerDependencies }) => {\n //\n\n return {\n //\n\n /* ============================================================================================\n\t\t BASE\n\t ============================================================================================ */\n\n ...viteBase,\n\n /* ============================================================================================\n BUILD\n ============================================================================================ */\n\n build: {\n //\n ...viteBase.build,\n\n sourcemap: true,\n\n // mark as library\n lib: {\n // using `config.build.rolldownOptions.input`\n entry: \"\",\n\n // minify whitespace is disabled for es format\n // https://vite.dev/config/build-options#build-minify\n formats: [\"es\"],\n },\n\n // tansformer options\n rolldownOptions: {\n //\n ...viteBase.build?.rolldownOptions,\n\n // force these to be external (don't bundle them)\n external: [\n //\n // @ts-expect-error iterator issue\n // oxlint-disable-next-line typescript/no-misused-spread\n ...(viteBase.build?.rolldownOptions?.external ?? []),\n\n // exclude all peerDependencies (as strings or Regex)\n ...Object.keys(peerDependencies).flatMap((dep) => {\n return [dep, freshRegex(`^${dep}/`)];\n }),\n ],\n\n // input will be added in actual `vite.config.ts`\n // input: createInputEntries({dirname: import.meta.dirname, entries: []})\n\n output: {\n //\n // oxlint-disable-next-line typescript/no-misused-spread\n ...viteBase.build?.rolldownOptions?.output,\n\n preserveModules: true,\n preserveModulesRoot: \"src\",\n entryFileNames: \"[name].js\",\n },\n },\n },\n };\n};\n\n/* ============================================================================================= */\n\nexport default viteLib;\n"],"mappings":";;;;;;AA2BA,IAAa,KAAsB,EAAE,YAAS,iBAAyC;CAErF,IAAM,IAAgC,CAAC;CAEvC,KAAK,IAAM,KAAS,GAClB,KAAK,IAAM,KAAQ,EAAK,KAAK,CAAK,GAAG;EAGnC,IAAM,IAAM,EAAS,OAAO,CAAI,EAAE,QAChC,EAAW,OAAO,EAAkB,CAAI,EAAE,KAAK,GAAG,EAAE,GAAG,GACvD,EACF;EAKA,EAAM,KAFQ,EAAQ,GAAS,CAElB;CACf;CAGF,OAAO;AACT,GAMa,KAAoB,EAAE,2BAG1B;CAOL,GAAG;CAMH,OAAO;EAEL,GAAG,EAAS;EAEZ,WAAW;EAGX,KAAK;GAEH,OAAO;GAIP,SAAS,CAAC,IAAI;EAChB;EAGA,iBAAiB;GAEf,GAAG,EAAS,OAAO;GAGnB,UAAU,CAIR,GAAI,EAAS,OAAO,iBAAiB,YAAY,CAAC,GAGlD,GAAG,OAAO,KAAK,CAAgB,EAAE,SAAS,MACjC,CAAC,GAAK,EAAW,IAAI,EAAI,EAAE,CAAC,CACpC,CACH;GAKA,QAAQ;IAGN,GAAG,EAAS,OAAO,iBAAiB;IAEpC,iBAAiB;IACjB,qBAAqB;IACrB,gBAAgB;GAClB;EACF;CACF;AACF"}
@@ -0,0 +1,10 @@
1
+ //#region src/lib/debounce.ts
2
+ var e, t = (t, n = 1e3) => {
3
+ clearTimeout(e), e = setTimeout(() => {
4
+ t(), clearTimeout(e);
5
+ }, n);
6
+ };
7
+ //#endregion
8
+ export { t as default };
9
+
10
+ //# sourceMappingURL=debounce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.js","names":[],"sources":["../../src/lib/debounce.ts"],"sourcesContent":["// global variable for this module instance\nlet timer: ReturnType<typeof setTimeout>;\n\n/**\n * prevent duplicate function call in specified time period\n *\n * @param fn - an anonymous function to delay execution\n * @param delay - delay for provided function execution (default `1000` in milliseconds)\n */\nconst debounce = (fn: () => void, delay = 1000) => {\n //\n clearTimeout(timer);\n\n timer = setTimeout(() => {\n fn();\n clearTimeout(timer);\n }, delay);\n};\n\n/* ============================================================================================= */\n\nexport default debounce;\n"],"mappings":";AACA,IAAI,GAQE,KAAY,GAAgB,IAAQ,QAAS;CAIjD,AAFA,aAAa,CAAK,GAElB,IAAQ,iBAAiB;EAEvB,AADA,EAAG,GACH,aAAa,CAAK;CACpB,GAAG,CAAK;AACV"}
@@ -0,0 +1,15 @@
1
+ //#region src/lib/logger.ts
2
+ var e = (e) => {
3
+ let t;
4
+ throw t = e instanceof Error ? e.message : typeof e == "string" ? e : String(e), Error(t);
5
+ }, { log: t } = console, n = (e = "-", n = 50) => {
6
+ t(e.repeat(n));
7
+ }, r = (e) => {
8
+ t(`\n${e}\n`);
9
+ }, { warn: i } = console, a = (e) => {
10
+ i(`\n${e}\n`);
11
+ };
12
+ //#endregion
13
+ export { t as log, n as logDivider, r as logNewLine, e as throwError, i as warn, a as warnNewLine };
14
+
15
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","names":[],"sources":["../../src/lib/logger.ts"],"sourcesContent":["/**\n * throws an error with the provided message.\n *\n * @param err - The error message to throw.\n */\nexport const throwError = <T>(err: T) => {\n //\n let errMsg: string;\n\n if (err instanceof Error) {\n errMsg = err.message;\n } else if (typeof err === \"string\") {\n errMsg = err;\n } else {\n errMsg = String(err);\n }\n\n throw new Error(errMsg);\n};\n\n/* ============================================================================================= */\n\n/**\n * logs a message to the console.\n *\n * @param msg - The message to log.\n */\nexport const { log } = console;\n\n/* ============================================================================================= */\n\n/**\n * logs a divider line to the console.\n *\n * @param divider - The character to use for the divider (default is \"-\").\n * @param count - The number of times to repeat the divider character (default is 50).\n */\nexport const logDivider = (divider = \"-\", count = 50) => {\n log(divider.repeat(count));\n};\n\n/* ============================================================================================= */\n\n/**\n * logs a new line with an optional message to the console.\n *\n * @param msg - The message to include in the new line (optional).\n */\nexport const logNewLine = <T>(msg?: T) => {\n log(`\\n${msg}\\n`);\n};\n\n/* ============================================================================================= */\n\n/**\n * logs a warning message to the console.\n *\n * @param msg - The warning message to log.\n */\nexport const { warn } = console;\n\n/* ============================================================================================= */\n\n/**\n * logs a new line with an optional warning message to the console.\n *\n * @param msg - The warning message to include in the new line (optional).\n */\nexport const warnNewLine = <T>(msg?: T) => {\n warn(`\\n${msg}\\n`);\n};\n"],"mappings":";AAKA,IAAa,KAAiB,MAAW;CAEvC,IAAI;CAUJ,MARA,AAKE,IALE,aAAe,QACR,EAAI,UACJ,OAAO,KAAQ,WACf,IAEA,OAAO,CAAG,GAGX,MAAM,CAAM;AACxB,GASa,EAAE,WAAQ,SAUV,KAAc,IAAU,KAAK,IAAQ,OAAO;CACvD,EAAI,EAAQ,OAAO,CAAK,CAAC;AAC3B,GASa,KAAiB,MAAY;CACxC,EAAI,KAAK,EAAI,GAAG;AAClB,GASa,EAAE,YAAS,SASX,KAAkB,MAAY;CACzC,EAAK,KAAK,EAAI,GAAG;AACnB"}
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @returns `source` object deep (nested) merge into `target` object.
8
8
  *
9
- * @throws If either `target` or `source` is not an object.
9
+ * @throws { Error } If either `target` or `source` is not an object.
10
10
  */
11
11
  export declare const deepMergeObj: <T, U>(target: T, source: U) => T & U;
12
12
  /**
@@ -18,7 +18,7 @@ export declare const deepMergeObj: <T, U>(target: T, source: U) => T & U;
18
18
  *
19
19
  * @returns A deep copy of the input data.
20
20
  *
21
- * @throws If any part of the input data is not serializable.
21
+ * @throws { Error } If any part of the input data is not serializable.
22
22
  */
23
23
  export declare const deepCopy: <T>(data: T) => T;
24
24
  /**
@@ -37,5 +37,5 @@ export declare const deepCopy: <T>(data: T) => T;
37
37
  *
38
38
  * @returns A new RegExp instance with identical pattern and flags.
39
39
  */
40
- export declare const freshRegex: (regex: RegExp) => RegExp;
40
+ export declare const freshRegex: (regex: RegExp | string) => RegExp;
41
41
  //# sourceMappingURL=operations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/lib/operations.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,UAqBtD,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,MAAM,CAAC,KAAG,CAgBrC,CAAC;AAIF;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,WAAsB,CAAC"}
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/lib/operations.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,UAmBtD,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,MAAM,CAAC,KAAG,CAgBrC,CAAC;AAIF;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,GAAG,MAAM,WAEhD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { log as e, throwError as t } from "./logger.js";
2
+ import { isArr as n, isObj as r } from "./types.js";
3
+ //#region src/lib/operations.ts
4
+ var i = (e, n) => {
5
+ if (!r(e)) return t("target must be an object");
6
+ if (!r(n)) return t("source must be an object");
7
+ for (let t in n) t in e && r(e[t]) && r(n[t]) ? i(e[t], n[t]) : e[t] = n[t];
8
+ return e;
9
+ }, a = (i) => {
10
+ try {
11
+ if (r(i)) return { ...structuredClone(i) };
12
+ if (n(i)) return [...structuredClone(i)];
13
+ } catch (n) {
14
+ e("Any part of the input data is not serializable."), t(n);
15
+ }
16
+ return i;
17
+ }, o = (e) => new RegExp(e);
18
+ //#endregion
19
+ export { a as deepCopy, i as deepMergeObj, o as freshRegex };
20
+
21
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","names":[],"sources":["../../src/lib/operations.ts"],"sourcesContent":["import { log, throwError } from \"./logger.ts\";\nimport { isArr, isObj } from \"./types.ts\";\n\n/* ============================================================================================= */\n\n/**\n * recursively merges the properties of the source object into the target object.\n *\n * @param target - The target object to merge into. Must be an object.\n * @param source - The source object to merge from. Must be an object.\n *\n * @returns `source` object deep (nested) merge into `target` object.\n *\n * @throws { Error } If either `target` or `source` is not an object.\n */\nexport const deepMergeObj = <T, U>(target: T, source: U) => {\n //\n if (!isObj(target)) {\n return throwError(\"target must be an object\");\n }\n if (!isObj(source)) {\n return throwError(\"source must be an object\");\n }\n\n for (const key in source) {\n if (key in (target as never) && isObj((target as never)[key]) && isObj(source[key])) {\n deepMergeObj<typeof target, typeof source>((target as never)[key], (source as never)[key]);\n } else {\n // oxlint-disable-next-line typescript/no-explicit-any, typescript/no-unsafe-member-access\n (target as any)[key] = source[key];\n }\n }\n\n return target as T & U;\n};\n\n/* ============================================================================================= */\n\n/**\n * creates a deep copy of the given data using `structuredClone`.\n *\n * If the input is not an object or array, the original data is returned.\n *\n * @param data - The data to be copied. Can be an object or array.\n *\n * @returns A deep copy of the input data.\n *\n * @throws { Error } If any part of the input data is not serializable.\n */\nexport const deepCopy = <T>(data: T): T => {\n //\n try {\n //\n if (isObj(data)) {\n return { ...structuredClone(data) };\n } else if (isArr(data)) {\n return [...structuredClone(data)] as T;\n }\n //\n } catch (error) {\n log(\"Any part of the input data is not serializable.\");\n throwError(error);\n }\n\n return data;\n};\n\n/* ============================================================================================= */\n\n/**\n * returns a fresh RegExp instance cloned from the provided input. This ensures the internal\n * `lastIndex` state is reset to `0`, making the regex safe to reuse with stateful flags like `g` or\n * `y` across multiple operations (e.g. `test`, `replace`, `exec`), particularly in long-lived\n * runtimes such as HMR or shared modules.\n *\n * The returned RegExp preserves: - pattern source - flags (g, i, m, s, u, y, d, etc.)\n *\n * @example\n * -fresh(LCH_COLOR_FORMAT_PATTERN).test(rawColor);\n * -text.replace(fresh(LCH_COLOR_FORMAT_PATTERN), transformer);\n *\n * @param regex - The RegExp instance to clone.\n *\n * @returns A new RegExp instance with identical pattern and flags.\n */\n// reset lastIndex via new instance\nexport const freshRegex = (regex: RegExp | string) => {\n return new RegExp(regex);\n};\n"],"mappings":";;;AAeA,IAAa,KAAsB,GAAW,MAAc;CAE1D,IAAI,CAAC,EAAM,CAAM,GACf,OAAO,EAAW,0BAA0B;CAE9C,IAAI,CAAC,EAAM,CAAM,GACf,OAAO,EAAW,0BAA0B;CAG9C,KAAK,IAAM,KAAO,GAChB,AAAI,KAAQ,KAAoB,EAAO,EAAiB,EAAI,KAAK,EAAM,EAAO,EAAI,IAChF,EAA4C,EAAiB,IAAO,EAAiB,EAAI,IAGzF,EAAgB,KAAO,EAAO;CAIlC,OAAO;AACT,GAea,KAAe,MAAe;CAEzC,IAAI;EAEF,IAAI,EAAM,CAAI,GACZ,OAAO,EAAE,GAAG,gBAAgB,CAAI,EAAE;EAC7B,IAAI,EAAM,CAAI,GACnB,OAAO,CAAC,GAAG,gBAAgB,CAAI,CAAC;CAGpC,SAAS,GAAO;EAEd,AADA,EAAI,iDAAiD,GACrD,EAAW,CAAK;CAClB;CAEA,OAAO;AACT,GAqBa,KAAc,MAClB,IAAI,OAAO,CAAK"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * single instance for a unique key
3
+ */
4
+ export declare class Singleton {
5
+ private static readonly instances;
6
+ static get<T extends Singleton>(key: string): T;
7
+ set<K extends keyof this>(key: K, value: (typeof this)[K]): void;
8
+ get<K extends keyof this>(key: K): this[K];
9
+ register<T>(instance: T, method: string): void;
10
+ registerMethods<T>(instance: T, methods: string[]): void;
11
+ }
12
+ //# sourceMappingURL=singleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../src/lib/singleton.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAS;IAEpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAgC;WAEnD,GAAG,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAiB/C,GAAG,CAAC,CAAC,SAAS,MAAM,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IAIzD,GAAG,CAAC,CAAC,SAAS,MAAM,IAAI,EAAE,GAAG,EAAE,CAAC;IAQhC,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM;IASvC,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;CAMzD"}
@@ -0,0 +1,25 @@
1
+ //#region src/lib/singleton.ts
2
+ var e = class e {
3
+ static instances = /* @__PURE__ */ new Map();
4
+ static get(t) {
5
+ let n = e.instances.get(t);
6
+ return n || (n = new this(), e.instances.set(t, n)), n;
7
+ }
8
+ set(e, t) {
9
+ this[e] = t;
10
+ }
11
+ get(e) {
12
+ return this[e];
13
+ }
14
+ register(e, t) {
15
+ let n = e[t];
16
+ typeof n == "function" && this.set(t, n.bind(this));
17
+ }
18
+ registerMethods(e, t) {
19
+ for (let n of t) this.register(e, n);
20
+ }
21
+ };
22
+ //#endregion
23
+ export { e as Singleton };
24
+
25
+ //# sourceMappingURL=singleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleton.js","names":[],"sources":["../../src/lib/singleton.ts"],"sourcesContent":["/**\n * single instance for a unique key\n */\nexport class Singleton {\n //\n private static readonly instances = new Map<string, Singleton>();\n\n public static get<T extends Singleton>(key: string): T {\n //\n let instance = Singleton.instances.get(key);\n\n if (!instance) {\n instance = new this();\n\n Singleton.instances.set(key, instance);\n }\n\n return instance as T;\n }\n\n /* =========================\n\t\tHANDLE PROPERTIES\n\t========================= */\n\n public set<K extends keyof this>(key: K, value: (typeof this)[K]) {\n this[key] = value;\n }\n\n public get<K extends keyof this>(key: K) {\n return this[key];\n }\n\n /* =========================\n\t\tHANDLE METHODS\n\t========================= */\n\n public register<T>(instance: T, method: string) {\n //\n const fn = instance[method as keyof T];\n\n if (typeof fn === \"function\") {\n this.set(method as keyof this, fn.bind(this) as this[keyof this]);\n }\n }\n\n public registerMethods<T>(instance: T, methods: string[]) {\n for (const method of methods) {\n //\n this.register(instance, method);\n }\n }\n}\n"],"mappings":";AAGA,IAAa,IAAb,MAAa,EAAU;CAErB,OAAwB,4BAAY,IAAI,IAAuB;CAE/D,OAAc,IAAyB,GAAgB;EAErD,IAAI,IAAW,EAAU,UAAU,IAAI,CAAG;EAQ1C,OANK,MACH,IAAW,IAAI,KAAK,GAEpB,EAAU,UAAU,IAAI,GAAK,CAAQ,IAGhC;CACT;CAMA,IAAiC,GAAQ,GAAyB;EAChE,KAAK,KAAO;CACd;CAEA,IAAiC,GAAQ;EACvC,OAAO,KAAK;CACd;CAMA,SAAmB,GAAa,GAAgB;EAE9C,IAAM,IAAK,EAAS;EAEpB,AAAI,OAAO,KAAO,cAChB,KAAK,IAAI,GAAsB,EAAG,KAAK,IAAI,CAAqB;CAEpE;CAEA,gBAA0B,GAAa,GAAmB;EACxD,KAAK,IAAM,KAAU,GAEnB,KAAK,SAAS,GAAU,CAAM;CAElC;AACF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,CAAC,sBAE9B,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,CAAC,sBAE9B,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,KAAK,CAAC,wBAE7B,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,CAAC,qBAE9B,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,KAAK,CAAC,YAE9B,CAAC"}
@@ -0,0 +1,6 @@
1
+ //#region src/lib/types.ts
2
+ var e = (e) => typeof e == "string", t = (e) => typeof e == "number", n = (e) => typeof e == "function", r = (e) => Array.isArray(e), i = (e) => !!e && typeof e == "object" && !r(e);
3
+ //#endregion
4
+ export { r as isArr, n as isFn, t as isNum, i as isObj, e as isStr };
5
+
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/lib/types.ts"],"sourcesContent":["/**\n * checks if the provided data is a string.\n *\n * @param arg - The data to check.\n *\n * @returns `true` if the data is a string, otherwise `false`.\n */\nexport const isStr = <T>(arg: T) => {\n return typeof arg === \"string\";\n};\n\n/* ============================================================================================= */\n\n/**\n * checks if the provided data is a number.\n *\n * @param arg - The data to check.\n *\n * @returns `true` if the data is a number, otherwise `false`.\n */\nexport const isNum = <T>(arg: T) => {\n return typeof arg === \"number\";\n};\n\n/* ============================================================================================= */\n\n/**\n * checks if the provided data is a function.\n *\n * @param arg - The data to check.\n *\n * @returns `true` if the data is a function, otherwise `false`.\n */\nexport const isFn = <T>(arg: T) => {\n return typeof arg === \"function\";\n};\n\n/* ============================================================================================= */\n\n/**\n * checks if the provided data is an array.\n *\n * @param arg - The data to check.\n *\n * @returns `true` if the data is an array, otherwise `false`.\n */\nexport const isArr = <T>(arg: T) => {\n return Array.isArray(arg);\n};\n\n/* ============================================================================================= */\n\n/**\n * checks if the provided data is an object (not an array, or null).\n *\n * @param arg - The data to check.\n *\n * @returns `true` if the data is an object, otherwise `false`.\n */\nexport const isObj = <T>(arg: T) => {\n return Boolean(arg) && typeof arg === \"object\" && !isArr(arg);\n};\n"],"mappings":";AAOA,IAAa,KAAY,MAChB,OAAO,KAAQ,UAYX,KAAY,MAChB,OAAO,KAAQ,UAYX,KAAW,MACf,OAAO,KAAQ,YAYX,KAAY,MAChB,MAAM,QAAQ,CAAG,GAYb,KAAY,MAChB,EAAQ,KAAQ,OAAO,KAAQ,YAAY,CAAC,EAAM,CAAG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * put the app to sleep for defined time for artificial delay to improve the UX
3
+ *
4
+ * @param time - time for artificial delay (default `250)
5
+ */
6
+ export declare const sleep: (time?: number) => Promise<void>;
7
+ /**
8
+ * extracts extensions from a string pattern like ".ext" or ".{ext1,ext2}"
9
+ *
10
+ * @param str - The pattern string (e.g., "*.{ts,tsx}")
11
+ */
12
+ export declare const extractExtensions: (str: string) => string[];
13
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,eAAO,MAAM,KAAK,GAAU,aAAU,KAAG,OAAO,CAAC,IAAI,CAOpD,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,aAgB5C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { throwError as e } from "./logger.js";
2
+ //#region src/lib/utils.ts
3
+ var t = async (e = 250) => new Promise((t) => {
4
+ setTimeout(() => {
5
+ t();
6
+ }, e);
7
+ }), n = (t) => {
8
+ let n = /\.(\{?[\w,]+\}?)$/.exec(t);
9
+ return n ? n[1].replaceAll(/[{}]/g, "").split(",") : e(`extension(s) are required! :: ${t}`);
10
+ };
11
+ //#endregion
12
+ export { n as extractExtensions, t as sleep };
13
+
14
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/lib/utils.ts"],"sourcesContent":["import { throwError } from \"./logger.ts\";\n\n/* ============================================================================================= */\n\n/**\n * put the app to sleep for defined time for artificial delay to improve the UX\n *\n * @param time - time for artificial delay (default `250)\n */\n// oxlint-disable-next-line require-await\nexport const sleep = async (time = 250): Promise<void> => {\n //\n return new Promise<void>((resolve) => {\n setTimeout(() => {\n resolve();\n }, time);\n });\n};\n\n/* ============================================================================================= */\n\n/**\n * extracts extensions from a string pattern like \".ext\" or \".{ext1,ext2}\"\n *\n * @param str - The pattern string (e.g., \"*.{ts,tsx}\")\n */\nexport const extractExtensions = (str: string) => {\n // regex explanation:\n // 1. \\. : Match a literal dot\n // 2. \\{? : Optionally match an opening curly brace\n // 3. ([\\w,]+) : Capture group for the extensions (alphanumeric and commas)\n // 4. \\}? : Optionally match a closing curly brace\n // 5. $ : Ensure we are at the end of the string\n const match = /\\.(\\{?[\\w,]+\\}?)$/.exec(str);\n\n if (!match) {\n return throwError(`extension(s) are required! :: ${str}`);\n }\n\n // match[1] contains the extension part (e.g., \"ts\" or \"{ts,tsx}\")\n // we remove '{' and '}' and split by comma\n return match[1].replaceAll(/[{}]/g, \"\").split(\",\");\n};\n"],"mappings":";;AAUA,IAAa,IAAQ,OAAO,IAAO,QAE1B,IAAI,SAAe,MAAY;CACpC,iBAAiB;EACf,EAAQ;CACV,GAAG,CAAI;AACT,CAAC,GAUU,KAAqB,MAAgB;CAOhD,IAAM,IAAQ,oBAAoB,KAAK,CAAG;CAQ1C,OANK,IAME,EAAM,GAAG,WAAW,SAAS,EAAE,EAAE,MAAM,GAAG,IALxC,EAAW,iCAAiC,GAAK;AAM5D"}