@bemedev/dev-utils 1.2.0 → 1.3.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/README.md CHANGED
@@ -17,6 +17,7 @@ testing utilities, and configuration management.
17
17
  | [`rolldownConfig`](#rolldownconfig) | Rolldown bundler configuration factory |
18
18
  | [`buildTests`](#buildtests) | CLI tooling to build and test packages |
19
19
  | [`plugins`](#plugins) | Vite development helper plugins |
20
+ | [`utils`](#utils) | Utility functions and helpers |
20
21
 
21
22
  > **Note (v0.8.1):** The `./vitest-alias` export has been removed. Path
22
23
  > alias resolution is now handled natively by Vite via `resolve.alias` with
@@ -53,7 +54,8 @@ import {
53
54
  } from '@bemedev/dev-utils/vitest-extended';
54
55
  import { defineConfig } from '@bemedev/dev-utils/rolldown';
55
56
  import { addTarball, cleanup } from '@bemedev/dev-utils/build-tests';
56
- import { suppressWarnings } from '@bemedev/dev-utils/plugins';
57
+ import { suppressWarnings, hmr } from '@bemedev/dev-utils/plugins';
58
+ import { clamp, toArray, identity, sleep } from '@bemedev/dev-utils/utils';
57
59
  ```
58
60
 
59
61
  ---
@@ -682,6 +684,91 @@ export default defineConfig({
682
684
 
683
685
  ---
684
686
 
687
+ ### `hmr(props?)`
688
+
689
+ Vite plugin providing Hot Module Reloading (HMR) capabilities for external
690
+ file paths by watching files and executing build scripts when changes are
691
+ detected.
692
+
693
+ ```typescript
694
+ import { hmr } from '@bemedev/dev-utils/plugins';
695
+ import { defineConfig } from 'vite';
696
+
697
+ export default defineConfig({
698
+ plugins: [
699
+ hmr({
700
+ paths: ['../packages/*/src/**'],
701
+ scripts: ['pnpm --filter ./packages/* build'],
702
+ debounce: 1000,
703
+ }),
704
+ ],
705
+ });
706
+ ```
707
+
708
+ **Parameters (`props`)**
709
+
710
+ | Property | Type | Default | Description |
711
+ | ---------- | --------------------- | ------- | ---------------------------------------------------------------------- |
712
+ | `paths` | `string \| string[]` | `[]` | File path(s) to watch for changes |
713
+ | `scripts` | `string \| string[]` | `[]` | Shell command(s) to execute on file changes |
714
+ | `debounce` | `number \| undefined` | `500` | Cooldown interval in milliseconds to prevent build loops (500–10000ms) |
715
+
716
+ **Returns** a Vite `Plugin` (`{ name: 'hmr-add-on' }`).
717
+
718
+ ---
719
+
720
+ ## `utils`
721
+
722
+ General development utility helpers available via the `./utils` sub-path
723
+ export.
724
+
725
+ ### `clamp(value, min, max)`
726
+
727
+ Restricts a number between a minimum and maximum boundary.
728
+
729
+ ```typescript
730
+ import { clamp } from '@bemedev/dev-utils/utils';
731
+
732
+ clamp(5, 0, 10); // 5
733
+ clamp(-5, 0, 10); // 0
734
+ clamp(15, 0, 10); // 10
735
+ ```
736
+
737
+ ### `toArray(value)`
738
+
739
+ Normalizes a single value, array, null, or undefined into an array.
740
+
741
+ ```typescript
742
+ import { toArray } from '@bemedev/dev-utils/utils';
743
+
744
+ toArray('foo'); // ['foo']
745
+ toArray(['a', 'b']); // ['a', 'b']
746
+ toArray(undefined); // []
747
+ toArray(null); // []
748
+ ```
749
+
750
+ ### `identity(value)`
751
+
752
+ Returns the passed argument unchanged.
753
+
754
+ ```typescript
755
+ import { identity } from '@bemedev/dev-utils/utils';
756
+
757
+ identity('test'); // 'test'
758
+ ```
759
+
760
+ ### `sleep(ms)`
761
+
762
+ Asynchronously pauses execution for a given number of milliseconds.
763
+
764
+ ```typescript
765
+ import { sleep } from '@bemedev/dev-utils/utils';
766
+
767
+ await sleep(1000); // waits 1 second
768
+ ```
769
+
770
+ ---
771
+
685
772
  <br/>
686
773
 
687
774
  ## Licence
@@ -0,0 +1,69 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_utils_clamp = require("../utils/clamp.cjs");
3
+ const require_utils_array = require("../utils/array.cjs");
4
+ let path = require("path");
5
+ let child_process = require("child_process");
6
+ //#region src/plugins/hmr.ts
7
+ /**
8
+ * Normalizes backslashes in a file path to forward slashes.
9
+ *
10
+ * @param path - File path to normalize.
11
+ *
12
+ * @returns Normalized path string.
13
+ */
14
+ const normalizePath = (path$1) => path$1.replace(/\\/g, "/");
15
+ /**
16
+ * Vite plugin providing Hot Module Reloading (HMR) capabilities for external
17
+ * file paths by watching files and executing build scripts on changes.
18
+ *
19
+ * @param props - Configuration properties of type {@linkcode HmrPluginProps}.
20
+ *
21
+ * @returns A Vite plugin object of type {@linkcode Plugin}.
22
+ */
23
+ const hmr = (props) => {
24
+ let isBuilding = false;
25
+ const debounce = require_utils_clamp.clamp(props?.debounce ?? 500, 500, 1e4);
26
+ const paths = [];
27
+ let isDev = false;
28
+ return {
29
+ name: "hmr-add-on",
30
+ configResolved(config) {
31
+ isDev = !config.isProduction;
32
+ if (!isDev) return;
33
+ const resolvedPaths = require_utils_array.toArray(props?.paths).map((p) => (0, path.isAbsolute)(p) ? p : (0, path.resolve)(config.root, p)).map(normalizePath);
34
+ paths.push(...resolvedPaths);
35
+ },
36
+ configureServer(server) {
37
+ if (!isDev) return;
38
+ server.watcher.add(paths);
39
+ },
40
+ handleHotUpdate(ctx) {
41
+ if (!isDev) return;
42
+ if (isBuilding) return ctx.modules;
43
+ const normalizedFile = normalizePath(ctx.file);
44
+ if (paths.some((p) => normalizedFile.includes(p))) {
45
+ console.log(`\n⚡ External file modified: ${ctx.file}. Starting build...`);
46
+ try {
47
+ isBuilding = true;
48
+ require_utils_array.toArray(props?.scripts).forEach((script) => {
49
+ (0, child_process.execSync)(script, { stdio: "inherit" });
50
+ });
51
+ ctx.server.moduleGraph.invalidateAll();
52
+ ctx.server.ws.send({ type: "full-reload" });
53
+ } catch (error) {
54
+ console.error("❌ Command execution failed during HMR:", error);
55
+ } finally {
56
+ setTimeout(() => {
57
+ isBuilding = false;
58
+ console.log("✅ Build completed. Ready for subsequent changes.");
59
+ }, debounce);
60
+ }
61
+ }
62
+ return ctx.modules;
63
+ }
64
+ };
65
+ };
66
+ //#endregion
67
+ exports.hmr = hmr;
68
+
69
+ //# sourceMappingURL=hmr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmr.cjs","names":["path","clamp","toArray","isAbsolute","resolve"],"sources":["../../src/plugins/hmr.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport { resolve, isAbsolute } from 'path';\n\nimport { type Plugin } from 'vitest/config';\n\nimport { toArray } from '#utils/array';\nimport { clamp } from '#utils/clamp';\nimport type { SoA } from '#utils/types';\n\n/**\n * Configuration options for the HMR add-on plugin.\n */\nexport type HmrPluginProps = {\n /** Single file path or array of file paths of type {@linkcode SoA} to watch for changes. */\n paths?: SoA<string>;\n\n /** Single shell command or array of shell commands of type {@linkcode SoA} to execute when a change is detected. */\n scripts?: SoA<string>;\n\n /** Optional interval in milliseconds to wait before allowing another build. */\n debounce?: number;\n};\n\n/**\n * Normalizes backslashes in a file path to forward slashes.\n *\n * @param path - File path to normalize.\n *\n * @returns Normalized path string.\n */\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\n/**\n * Vite plugin providing Hot Module Reloading (HMR) capabilities for external\n * file paths by watching files and executing build scripts on changes.\n *\n * @param props - Configuration properties of type {@linkcode HmrPluginProps}.\n *\n * @returns A Vite plugin object of type {@linkcode Plugin}.\n */\nexport const hmr = (props?: HmrPluginProps): Plugin => {\n // Lock variable to prevent infinite build loops\n let isBuilding = false;\n const debounce = clamp(props?.debounce ?? 500, 500, 10_000);\n const paths: string[] = [];\n let isDev = false;\n\n return {\n name: 'hmr-add-on',\n\n configResolved(config) {\n isDev = !config.isProduction;\n if (!isDev) return;\n\n // Resolve relative paths based on Vite project root\n const resolvedPaths = toArray(props?.paths)\n .map(p => (isAbsolute(p) ? p : resolve(config.root, p)))\n .map(normalizePath);\n\n paths.push(...resolvedPaths);\n },\n\n configureServer(server) {\n if (!isDev) return;\n\n server.watcher.add(paths);\n },\n\n handleHotUpdate(ctx) {\n if (!isDev) return;\n\n // 1. If a build is already in progress, ignore ALL changes (prevents loops)\n if (isBuilding) return ctx.modules;\n const normalizedFile = normalizePath(ctx.file);\n const checks = paths.some(p => normalizedFile.includes(p));\n\n if (checks) {\n console.log(\n `\\n⚡ External file modified: ${ctx.file}. Starting build...`,\n );\n\n try {\n // 2. Acquire lock before starting the build\n isBuilding = true;\n const scripts = toArray(props?.scripts);\n\n scripts.forEach(script => {\n execSync(script, { stdio: 'inherit' });\n });\n\n // Invalidate module graph so Vite reads fresh built files from disk\n ctx.server.moduleGraph.invalidateAll();\n ctx.server.ws.send({ type: 'full-reload' });\n } catch (error) {\n console.error('❌ Command execution failed during HMR:', error);\n } finally {\n // 3. Once build is complete, wait for the debounce period to allow\n // Vite to ignore generated build files, then release the lock.\n setTimeout(() => {\n isBuilding = false;\n console.log(\n '✅ Build completed. Ready for subsequent changes.',\n );\n }, debounce);\n }\n }\n\n return ctx.modules;\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;AA8BA,MAAM,iBAAiB,WAAiBA,OAAK,QAAQ,OAAO,GAAG;;;;;;;;;AAU/D,MAAa,OAAO,UAAmC;CAErD,IAAI,aAAa;CACjB,MAAM,WAAWC,oBAAAA,MAAM,OAAO,YAAY,KAAK,KAAK,GAAM;CAC1D,MAAM,QAAkB,CAAC;CACzB,IAAI,QAAQ;CAEZ,OAAO;EACL,MAAM;EAEN,eAAe,QAAQ;GACrB,QAAQ,CAAC,OAAO;GAChB,IAAI,CAAC,OAAO;GAGZ,MAAM,gBAAgBC,oBAAAA,QAAQ,OAAO,KAAK,CAAC,CACxC,KAAI,OAAA,GAAMC,KAAAA,WAAAA,CAAW,CAAC,IAAI,KAAA,GAAIC,KAAAA,QAAAA,CAAQ,OAAO,MAAM,CAAC,CAAE,CAAC,CACvD,IAAI,aAAa;GAEpB,MAAM,KAAK,GAAG,aAAa;EAC7B;EAEA,gBAAgB,QAAQ;GACtB,IAAI,CAAC,OAAO;GAEZ,OAAO,QAAQ,IAAI,KAAK;EAC1B;EAEA,gBAAgB,KAAK;GACnB,IAAI,CAAC,OAAO;GAGZ,IAAI,YAAY,OAAO,IAAI;GAC3B,MAAM,iBAAiB,cAAc,IAAI,IAAI;GAG7C,IAFe,MAAM,MAAK,MAAK,eAAe,SAAS,CAAC,CAE/C,GAAG;IACV,QAAQ,IACN,+BAA+B,IAAI,KAAK,oBAC1C;IAEA,IAAI;KAEF,aAAa;KAGb,oBAFgBF,QAAQ,OAAO,OAEzB,CAAC,CAAC,SAAQ,WAAU;MACxB,CAAA,GAAA,cAAA,SAAA,CAAS,QAAQ,EAAE,OAAO,UAAU,CAAC;KACvC,CAAC;KAGD,IAAI,OAAO,YAAY,cAAc;KACrC,IAAI,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5C,SAAS,OAAO;KACd,QAAQ,MAAM,0CAA0C,KAAK;IAC/D,UAAU;KAGR,iBAAiB;MACf,aAAa;MACb,QAAQ,IACN,kDACF;KACF,GAAG,QAAQ;IACb;GACF;GAEA,OAAO,IAAI;EACb;CACF;AACF"}
@@ -0,0 +1,22 @@
1
+ import { type Plugin } from 'vitest/config';
2
+ import type { SoA } from '../utils/types';
3
+ /**
4
+ * Configuration options for the HMR add-on plugin.
5
+ */
6
+ export type HmrPluginProps = {
7
+ /** Single file path or array of file paths of type {@linkcode SoA} to watch for changes. */
8
+ paths?: SoA<string>;
9
+ /** Single shell command or array of shell commands of type {@linkcode SoA} to execute when a change is detected. */
10
+ scripts?: SoA<string>;
11
+ /** Optional interval in milliseconds to wait before allowing another build. */
12
+ debounce?: number;
13
+ };
14
+ /**
15
+ * Vite plugin providing Hot Module Reloading (HMR) capabilities for external
16
+ * file paths by watching files and executing build scripts on changes.
17
+ *
18
+ * @param props - Configuration properties of type {@linkcode HmrPluginProps}.
19
+ *
20
+ * @returns A Vite plugin object of type {@linkcode Plugin}.
21
+ */
22
+ export declare const hmr: (props?: HmrPluginProps) => Plugin;
@@ -0,0 +1,68 @@
1
+ import { clamp } from "../utils/clamp.js";
2
+ import { toArray } from "../utils/array.js";
3
+ import { isAbsolute, resolve } from "path";
4
+ import { execSync } from "child_process";
5
+ //#region src/plugins/hmr.ts
6
+ /**
7
+ * Normalizes backslashes in a file path to forward slashes.
8
+ *
9
+ * @param path - File path to normalize.
10
+ *
11
+ * @returns Normalized path string.
12
+ */
13
+ const normalizePath = (path) => path.replace(/\\/g, "/");
14
+ /**
15
+ * Vite plugin providing Hot Module Reloading (HMR) capabilities for external
16
+ * file paths by watching files and executing build scripts on changes.
17
+ *
18
+ * @param props - Configuration properties of type {@linkcode HmrPluginProps}.
19
+ *
20
+ * @returns A Vite plugin object of type {@linkcode Plugin}.
21
+ */
22
+ const hmr = (props) => {
23
+ let isBuilding = false;
24
+ const debounce = clamp(props?.debounce ?? 500, 500, 1e4);
25
+ const paths = [];
26
+ let isDev = false;
27
+ return {
28
+ name: "hmr-add-on",
29
+ configResolved(config) {
30
+ isDev = !config.isProduction;
31
+ if (!isDev) return;
32
+ const resolvedPaths = toArray(props?.paths).map((p) => isAbsolute(p) ? p : resolve(config.root, p)).map(normalizePath);
33
+ paths.push(...resolvedPaths);
34
+ },
35
+ configureServer(server) {
36
+ if (!isDev) return;
37
+ server.watcher.add(paths);
38
+ },
39
+ handleHotUpdate(ctx) {
40
+ if (!isDev) return;
41
+ if (isBuilding) return ctx.modules;
42
+ const normalizedFile = normalizePath(ctx.file);
43
+ if (paths.some((p) => normalizedFile.includes(p))) {
44
+ console.log(`\n⚡ External file modified: ${ctx.file}. Starting build...`);
45
+ try {
46
+ isBuilding = true;
47
+ toArray(props?.scripts).forEach((script) => {
48
+ execSync(script, { stdio: "inherit" });
49
+ });
50
+ ctx.server.moduleGraph.invalidateAll();
51
+ ctx.server.ws.send({ type: "full-reload" });
52
+ } catch (error) {
53
+ console.error("❌ Command execution failed during HMR:", error);
54
+ } finally {
55
+ setTimeout(() => {
56
+ isBuilding = false;
57
+ console.log("✅ Build completed. Ready for subsequent changes.");
58
+ }, debounce);
59
+ }
60
+ }
61
+ return ctx.modules;
62
+ }
63
+ };
64
+ };
65
+ //#endregion
66
+ export { hmr };
67
+
68
+ //# sourceMappingURL=hmr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmr.js","names":[],"sources":["../../src/plugins/hmr.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport { resolve, isAbsolute } from 'path';\n\nimport { type Plugin } from 'vitest/config';\n\nimport { toArray } from '#utils/array';\nimport { clamp } from '#utils/clamp';\nimport type { SoA } from '#utils/types';\n\n/**\n * Configuration options for the HMR add-on plugin.\n */\nexport type HmrPluginProps = {\n /** Single file path or array of file paths of type {@linkcode SoA} to watch for changes. */\n paths?: SoA<string>;\n\n /** Single shell command or array of shell commands of type {@linkcode SoA} to execute when a change is detected. */\n scripts?: SoA<string>;\n\n /** Optional interval in milliseconds to wait before allowing another build. */\n debounce?: number;\n};\n\n/**\n * Normalizes backslashes in a file path to forward slashes.\n *\n * @param path - File path to normalize.\n *\n * @returns Normalized path string.\n */\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\n/**\n * Vite plugin providing Hot Module Reloading (HMR) capabilities for external\n * file paths by watching files and executing build scripts on changes.\n *\n * @param props - Configuration properties of type {@linkcode HmrPluginProps}.\n *\n * @returns A Vite plugin object of type {@linkcode Plugin}.\n */\nexport const hmr = (props?: HmrPluginProps): Plugin => {\n // Lock variable to prevent infinite build loops\n let isBuilding = false;\n const debounce = clamp(props?.debounce ?? 500, 500, 10_000);\n const paths: string[] = [];\n let isDev = false;\n\n return {\n name: 'hmr-add-on',\n\n configResolved(config) {\n isDev = !config.isProduction;\n if (!isDev) return;\n\n // Resolve relative paths based on Vite project root\n const resolvedPaths = toArray(props?.paths)\n .map(p => (isAbsolute(p) ? p : resolve(config.root, p)))\n .map(normalizePath);\n\n paths.push(...resolvedPaths);\n },\n\n configureServer(server) {\n if (!isDev) return;\n\n server.watcher.add(paths);\n },\n\n handleHotUpdate(ctx) {\n if (!isDev) return;\n\n // 1. If a build is already in progress, ignore ALL changes (prevents loops)\n if (isBuilding) return ctx.modules;\n const normalizedFile = normalizePath(ctx.file);\n const checks = paths.some(p => normalizedFile.includes(p));\n\n if (checks) {\n console.log(\n `\\n⚡ External file modified: ${ctx.file}. Starting build...`,\n );\n\n try {\n // 2. Acquire lock before starting the build\n isBuilding = true;\n const scripts = toArray(props?.scripts);\n\n scripts.forEach(script => {\n execSync(script, { stdio: 'inherit' });\n });\n\n // Invalidate module graph so Vite reads fresh built files from disk\n ctx.server.moduleGraph.invalidateAll();\n ctx.server.ws.send({ type: 'full-reload' });\n } catch (error) {\n console.error('❌ Command execution failed during HMR:', error);\n } finally {\n // 3. Once build is complete, wait for the debounce period to allow\n // Vite to ignore generated build files, then release the lock.\n setTimeout(() => {\n isBuilding = false;\n console.log(\n '✅ Build completed. Ready for subsequent changes.',\n );\n }, debounce);\n }\n }\n\n return ctx.modules;\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;AA8BA,MAAM,iBAAiB,SAAiB,KAAK,QAAQ,OAAO,GAAG;;;;;;;;;AAU/D,MAAa,OAAO,UAAmC;CAErD,IAAI,aAAa;CACjB,MAAM,WAAW,MAAM,OAAO,YAAY,KAAK,KAAK,GAAM;CAC1D,MAAM,QAAkB,CAAC;CACzB,IAAI,QAAQ;CAEZ,OAAO;EACL,MAAM;EAEN,eAAe,QAAQ;GACrB,QAAQ,CAAC,OAAO;GAChB,IAAI,CAAC,OAAO;GAGZ,MAAM,gBAAgB,QAAQ,OAAO,KAAK,CAAC,CACxC,KAAI,MAAM,WAAW,CAAC,IAAI,IAAI,QAAQ,OAAO,MAAM,CAAC,CAAE,CAAC,CACvD,IAAI,aAAa;GAEpB,MAAM,KAAK,GAAG,aAAa;EAC7B;EAEA,gBAAgB,QAAQ;GACtB,IAAI,CAAC,OAAO;GAEZ,OAAO,QAAQ,IAAI,KAAK;EAC1B;EAEA,gBAAgB,KAAK;GACnB,IAAI,CAAC,OAAO;GAGZ,IAAI,YAAY,OAAO,IAAI;GAC3B,MAAM,iBAAiB,cAAc,IAAI,IAAI;GAG7C,IAFe,MAAM,MAAK,MAAK,eAAe,SAAS,CAAC,CAE/C,GAAG;IACV,QAAQ,IACN,+BAA+B,IAAI,KAAK,oBAC1C;IAEA,IAAI;KAEF,aAAa;KAGb,QAFwB,OAAO,OAEzB,CAAC,CAAC,SAAQ,WAAU;MACxB,SAAS,QAAQ,EAAE,OAAO,UAAU,CAAC;KACvC,CAAC;KAGD,IAAI,OAAO,YAAY,cAAc;KACrC,IAAI,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5C,SAAS,OAAO;KACd,QAAQ,MAAM,0CAA0C,KAAK;IAC/D,UAAU;KAGR,iBAAiB;MACf,aAAa;MACb,QAAQ,IACN,kDACF;KACF,GAAG,QAAQ;IACb;GACF;GAEA,OAAO,IAAI;EACb;CACF;AACF"}
@@ -1,3 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_plugins_suppressWarnings = require("./suppressWarnings.cjs");
3
+ const require_plugins_hmr = require("./hmr.cjs");
4
+ exports.hmr = require_plugins_hmr.hmr;
3
5
  exports.suppressWarnings = require_plugins_suppressWarnings.suppressWarnings;
@@ -1 +1,2 @@
1
1
  export * from './suppressWarnings';
2
+ export * from './hmr';
@@ -1,2 +1,3 @@
1
1
  import { suppressWarnings } from "./suppressWarnings.js";
2
- export { suppressWarnings };
2
+ import { hmr } from "./hmr.js";
3
+ export { hmr, suppressWarnings };
@@ -15,7 +15,7 @@ let rollup_plugin_circular_dependencies = require("rollup-plugin-circular-depend
15
15
  */
16
16
  function circulars(options = {}) {
17
17
  const all = (0, rollup_plugin_circular_dependencies.circularDependencies)(options);
18
- const CIRCULAR_CHUNKS = require_utils_array.toArray(options.exclude).map((f) => (0, glob.globSync)(f, { nodir: true })).flat().map(require_rolldown_config_helpers.withoutExtension).map((file) => (0, path.relative)("src", file));
18
+ const CIRCULAR_CHUNKS = require_utils_array.toArray(options.exclude).filter(Boolean).map((f) => (0, glob.globSync)(f, { nodir: true })).flat().map(require_rolldown_config_helpers.withoutExtension).map((file) => (0, path.relative)("src", file));
19
19
  return {
20
20
  ...all,
21
21
  name: "better circular-dependencies",
@@ -1 +1 @@
1
- {"version":3,"file":"circulars.cjs","names":["circularDependencies","toArray","globSync","withoutExtension","relative","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & { exclude?: string | string[] };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,OAAA,GAAMA,oCAAAA,qBAAAA,CAAqB,OAAO;CAGxC,MAAM,kBAFUC,oBAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,kCAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
1
+ {"version":3,"file":"circulars.cjs","names":["circularDependencies","toArray","globSync","withoutExtension","relative","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,OAAA,GAAMA,oCAAAA,qBAAAA,CAAqB,OAAO;CAGxC,MAAM,kBAFUC,oBAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,kCAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
@@ -1,10 +1,11 @@
1
1
  import type { RolldownPluginOption } from 'rolldown';
2
2
  import { circularDependencies } from 'rollup-plugin-circular-dependencies';
3
+ import { type SoA } from '../../utils/index.js';
3
4
  /**
4
5
  * Options for the circular dependencies plugin.
5
6
  */
6
- export type CircularDependenciesOptions = Parameters<typeof circularDependencies>[0] & {
7
- exclude?: string | string[];
7
+ export type CircularDependenciesOptions = Omit<Parameters<typeof circularDependencies>[0], 'exclude'> & {
8
+ exclude?: SoA<string>;
8
9
  };
9
10
  /**
10
11
  * Creates a configured circular dependencies plugin instance with suppression for known patterns.
@@ -14,7 +14,7 @@ import { circularDependencies } from "rollup-plugin-circular-dependencies";
14
14
  */
15
15
  function circulars(options = {}) {
16
16
  const all = circularDependencies(options);
17
- const CIRCULAR_CHUNKS = toArray(options.exclude).map((f) => globSync(f, { nodir: true })).flat().map(withoutExtension).map((file) => relative("src", file));
17
+ const CIRCULAR_CHUNKS = toArray(options.exclude).filter(Boolean).map((f) => globSync(f, { nodir: true })).flat().map(withoutExtension).map((file) => relative("src", file));
18
18
  return {
19
19
  ...all,
20
20
  name: "better circular-dependencies",
@@ -1 +1 @@
1
- {"version":3,"file":"circulars.js","names":[],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & { exclude?: string | string[] };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAAS,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
1
+ {"version":3,"file":"circulars.js","names":[],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log(\n '[bemedev] Skipping circular dependency warnings for:',\n );\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAAS,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"array.cjs","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\n/**\n * Normalizes a single value, array, null, or undefined into an array.\n *\n * @param value - Value to normalize.\n *\n * @returns Array containing the value, or empty array if null/undefined.\n */\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n\nexport { type ToArray_F };\n"],"mappings":";;;;;;;;;AASA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,CAAC;CACpB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CAEjC,OAAO,CAAC,KAAK;AACf"}
1
+ {"version":3,"file":"array.cjs","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\n/**\n * Normalizes a single value, array, null, or undefined into an array.\n *\n * @param value - Value to normalize.\n *\n * @returns Array containing the value, or empty array if null/undefined.\n */\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value] as any;\n};\n\nexport { type ToArray_F };\n"],"mappings":";;;;;;;;;AASA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,CAAC;CACpB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CAEjC,OAAO,CAAC,KAAK;AACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"array.js","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\n/**\n * Normalizes a single value, array, null, or undefined into an array.\n *\n * @param value - Value to normalize.\n *\n * @returns Array containing the value, or empty array if null/undefined.\n */\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n\nexport { type ToArray_F };\n"],"mappings":";;;;;;;;AASA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,CAAC;CACpB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CAEjC,OAAO,CAAC,KAAK;AACf"}
1
+ {"version":3,"file":"array.js","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\n/**\n * Normalizes a single value, array, null, or undefined into an array.\n *\n * @param value - Value to normalize.\n *\n * @returns Array containing the value, or empty array if null/undefined.\n */\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value] as any;\n};\n\nexport { type ToArray_F };\n"],"mappings":";;;;;;;;AASA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,CAAC;CACpB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CAEjC,OAAO,CAAC,KAAK;AACf"}
@@ -0,0 +1,18 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/clamp.ts
3
+ /**
4
+ * Restricts a number between a minimum and maximum boundary.
5
+ *
6
+ * @param value - Value to clamp.
7
+ * @param min - Minimum allowed boundary.
8
+ * @param max - Maximum allowed boundary.
9
+ *
10
+ * @returns Clamped value within the range `[min, max]`.
11
+ */
12
+ const clamp = (value, min, max) => {
13
+ return Math.min(Math.max(value, min), max);
14
+ };
15
+ //#endregion
16
+ exports.clamp = clamp;
17
+
18
+ //# sourceMappingURL=clamp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.cjs","names":[],"sources":["../../src/utils/clamp.ts"],"sourcesContent":["/**\n * Restricts a number between a minimum and maximum boundary.\n *\n * @param value - Value to clamp.\n * @param min - Minimum allowed boundary.\n * @param max - Maximum allowed boundary.\n *\n * @returns Clamped value within the range `[min, max]`.\n */\nexport const clamp = (value: number, min: number, max: number) => {\n return Math.min(Math.max(value, min), max);\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,SAAS,OAAe,KAAa,QAAgB;CAChE,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC3C"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Restricts a number between a minimum and maximum boundary.
3
+ *
4
+ * @param value - Value to clamp.
5
+ * @param min - Minimum allowed boundary.
6
+ * @param max - Maximum allowed boundary.
7
+ *
8
+ * @returns Clamped value within the range `[min, max]`.
9
+ */
10
+ export declare const clamp: (value: number, min: number, max: number) => number;
@@ -0,0 +1,17 @@
1
+ //#region src/utils/clamp.ts
2
+ /**
3
+ * Restricts a number between a minimum and maximum boundary.
4
+ *
5
+ * @param value - Value to clamp.
6
+ * @param min - Minimum allowed boundary.
7
+ * @param max - Maximum allowed boundary.
8
+ *
9
+ * @returns Clamped value within the range `[min, max]`.
10
+ */
11
+ const clamp = (value, min, max) => {
12
+ return Math.min(Math.max(value, min), max);
13
+ };
14
+ //#endregion
15
+ export { clamp };
16
+
17
+ //# sourceMappingURL=clamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.js","names":[],"sources":["../../src/utils/clamp.ts"],"sourcesContent":["/**\n * Restricts a number between a minimum and maximum boundary.\n *\n * @param value - Value to clamp.\n * @param min - Minimum allowed boundary.\n * @param max - Maximum allowed boundary.\n *\n * @returns Clamped value within the range `[min, max]`.\n */\nexport const clamp = (value: number, min: number, max: number) => {\n return Math.min(Math.max(value, min), max);\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,SAAS,OAAe,KAAa,QAAgB;CAChE,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,GAAG,GAAG,GAAG;AAC3C"}
@@ -1,9 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_sleep = require("./sleep.cjs");
3
3
  const require_utils_identity = require("./identity.cjs");
4
+ const require_utils_clamp = require("./clamp.cjs");
4
5
  const require_utils_array = require("./array.cjs");
5
6
  const require_utils_bemedev_globals_utils__unknown = require("./bemedev/globals/utils/_unknown.cjs");
6
7
  exports._unknown = require_utils_bemedev_globals_utils__unknown._unknown;
8
+ exports.clamp = require_utils_clamp.clamp;
7
9
  exports.identity = require_utils_identity.identity;
8
10
  exports.sleep = require_utils_sleep.sleep;
9
11
  exports.toArray = require_utils_array.toArray;
@@ -1,5 +1,6 @@
1
1
  export * from './identity';
2
2
  export * from './sleep';
3
3
  export * from './types';
4
+ export * from './clamp';
4
5
  export * from './array';
5
6
  export * from './bemedev/globals/utils/_unknown';
@@ -1,5 +1,6 @@
1
1
  import { sleep } from "./sleep.js";
2
2
  import { identity } from "./identity.js";
3
+ import { clamp } from "./clamp.js";
3
4
  import { toArray } from "./array.js";
4
5
  import { _unknown } from "./bemedev/globals/utils/_unknown.js";
5
- export { _unknown, identity, sleep, toArray };
6
+ export { _unknown, clamp, identity, sleep, toArray };
@@ -4,8 +4,15 @@ export * from './bemedev/globals/types';
4
4
  *
5
5
  * @template `T` - Item type.
6
6
  *
7
- * @param value - Optional single value or array.
7
+ * @param value - Optional single value or array of type {@linkcode SoA}.
8
8
  *
9
9
  * @returns Array containing the value(s).
10
10
  */
11
- export type ToArray_F = <T>(value?: T | T[]) => T[];
11
+ export type ToArray_F = <T>(value?: T | T[] | ReadonlyArray<T>) => T[];
12
+ /**
13
+ * Single or Array (SoA) helper type. Represents a single value, an array of
14
+ * values, or a readonly array of values.
15
+ *
16
+ * @template `T` - Item type.
17
+ */
18
+ export type SoA<T> = T | T[] | ReadonlyArray<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemedev/dev-utils",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "A collection of utilities for Node.js development, including build tools, testing utilities, and configuration management.",
5
5
  "author": {
6
6
  "email": "bri_lvi@icloud.com",
@@ -95,7 +95,7 @@
95
95
  "cmd-ts": "^0.15.0",
96
96
  "edit-json-file": "^1.8.1",
97
97
  "glob": "^13.0.6",
98
- "oxc-transform": "^0.145.0",
98
+ "oxc-transform": "^0.147.0",
99
99
  "rollup-plugin-circular-dependencies": "^2.0.1",
100
100
  "rollup-plugin-node-externals": "^9.0.1",
101
101
  "shelljs": "^0.10.0",
@@ -107,17 +107,17 @@
107
107
  "@bemedev/basifun": "0.5.3",
108
108
  "@rollup/plugin-typescript": "^12.3.0",
109
109
  "@types/edit-json-file": "^1.7.4",
110
- "@types/node": "^26.2.0",
110
+ "@types/node": "^26.4.0",
111
111
  "@types/shelljs": "^0.10.0",
112
112
  "@vitest/ui": "4.1.11",
113
- "rolldown": "^1.2.4",
113
+ "rolldown": "^1.2.6",
114
114
  "unplugin-dts": "^1.0.3",
115
115
  "vitest": "4.1.11",
116
116
  "zod": "^4.4.3",
117
117
  "zx": "^8.8.5"
118
118
  },
119
119
  "peerDependencies": {
120
- "rolldown": "^1.2.4",
120
+ "rolldown": "^1.2.6",
121
121
  "vitest": "4.1.11"
122
122
  },
123
123
  "scripts": {