@stacksjs/utils 0.51.0 → 0.52.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/dist/base.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- export declare const assert: (condition: boolean, message: string) => asserts condition;
2
- export declare const toString: (v: any) => any;
3
- export declare const noop: () => void;
4
- export declare const loop: (times: number, callback: any) => void;
5
- export declare const getTypeName: (v: any) => any;
1
+ export declare function toString(v: any): any;
2
+ export declare function loop(times: number, callback: any): void;
3
+ export declare function getTypeName(v: any): any;
package/dist/base.mjs CHANGED
@@ -1,16 +1,12 @@
1
- export const assert = (condition, message) => {
2
- if (!condition)
3
- throw new Error(message);
4
- };
5
- export const toString = (v) => Object.prototype.toString.call(v);
6
- export const noop = () => {
7
- };
8
- export const loop = (times, callback) => {
1
+ export function toString(v) {
2
+ return Object.prototype.toString.call(v);
3
+ }
4
+ export function loop(times, callback) {
9
5
  [...Array(times)].forEach((item, i) => callback(i));
10
- };
11
- export const getTypeName = (v) => {
6
+ }
7
+ export function getTypeName(v) {
12
8
  if (v === null)
13
9
  return "null";
14
10
  const type = toString(v).slice(8, -1).toLowerCase();
15
11
  return typeof v === "object" || typeof v === "function" ? type : typeof v;
16
- };
12
+ }
@@ -0,0 +1,23 @@
1
+ import type { AppOptions, CacheOptions, CdnOptions, CronJobOptions, DatabaseOptions, DebugOptions, DnsOptions, EmailOptions, Events, GitOptions, HashingOptions, LibraryOptions, Model, NotificationOptions, PagesOption, PaymentOptions, SearchEngineOptions, ServicesOptions, StorageOptions, UiOptions, UserCliOptions } from '@stacksjs/types';
2
+ export declare function env(key: any, _fallback?: any): any;
3
+ export declare function defineApp(options: Partial<AppOptions>): Partial<AppOptions>;
4
+ export declare function defineCache(options: Partial<CacheOptions>): Partial<CacheOptions>;
5
+ export declare function defineCdn(options: Partial<CdnOptions>): Partial<CdnOptions>;
6
+ export declare function defineCli(options: Partial<UserCliOptions>): Partial<UserCliOptions>;
7
+ export declare function defineCronJobsConfig(options: Partial<CronJobOptions>[]): Partial<CronJobOptions>[];
8
+ export declare function defineDatabase(options: Partial<DatabaseOptions>): Partial<DatabaseOptions>;
9
+ export declare function defineDebugConfig(options: Partial<DebugOptions>): Partial<DebugOptions>;
10
+ export declare function defineDns(options: Partial<DnsOptions>): Partial<DnsOptions>;
11
+ export declare function defineEmailConfig(options: Partial<EmailOptions>): Partial<EmailOptions>;
12
+ export declare function defineEvents(options: Partial<Events>): Partial<Events>;
13
+ export declare function defineGit(options: Partial<GitOptions>): Partial<GitOptions>;
14
+ export declare function defineHashing(options: Partial<HashingOptions>): Partial<HashingOptions>;
15
+ export declare function defineLibrary(options: Partial<LibraryOptions>): Partial<LibraryOptions>;
16
+ export declare function defineModel(options: Partial<Model>): Partial<Model>;
17
+ export declare function defineNotification(options: Partial<NotificationOptions>): Partial<NotificationOptions>;
18
+ export declare function definePage(options: Partial<PagesOption>): Partial<PagesOption>;
19
+ export declare function definePayment(options: Partial<PaymentOptions>): Partial<PaymentOptions>;
20
+ export declare function defineSearchEngine(options: Partial<SearchEngineOptions>): Partial<SearchEngineOptions>;
21
+ export declare function defineServices(options: Partial<ServicesOptions>): Partial<ServicesOptions>;
22
+ export declare function defineStorage(options: Partial<StorageOptions>): Partial<StorageOptions>;
23
+ export declare function defineUi(options: Partial<UiOptions>): Partial<UiOptions>;
@@ -0,0 +1,66 @@
1
+ export function env(key, _fallback) {
2
+ return key;
3
+ }
4
+ export function defineApp(options) {
5
+ return options;
6
+ }
7
+ export function defineCache(options) {
8
+ return options;
9
+ }
10
+ export function defineCdn(options) {
11
+ return options;
12
+ }
13
+ export function defineCli(options) {
14
+ return options;
15
+ }
16
+ export function defineCronJobsConfig(options) {
17
+ return options;
18
+ }
19
+ export function defineDatabase(options) {
20
+ return options;
21
+ }
22
+ export function defineDebugConfig(options) {
23
+ return options;
24
+ }
25
+ export function defineDns(options) {
26
+ return options;
27
+ }
28
+ export function defineEmailConfig(options) {
29
+ return options;
30
+ }
31
+ export function defineEvents(options) {
32
+ return options;
33
+ }
34
+ export function defineGit(options) {
35
+ return options;
36
+ }
37
+ export function defineHashing(options) {
38
+ return options;
39
+ }
40
+ export function defineLibrary(options) {
41
+ return options;
42
+ }
43
+ export function defineModel(options) {
44
+ return options;
45
+ }
46
+ export function defineNotification(options) {
47
+ return options;
48
+ }
49
+ export function definePage(options) {
50
+ return options;
51
+ }
52
+ export function definePayment(options) {
53
+ return options;
54
+ }
55
+ export function defineSearchEngine(options) {
56
+ return options;
57
+ }
58
+ export function defineServices(options) {
59
+ return options;
60
+ }
61
+ export function defineStorage(options) {
62
+ return options;
63
+ }
64
+ export function defineUi(options) {
65
+ return options;
66
+ }
@@ -0,0 +1 @@
1
+ export { add, allocate, compare, convert, equal, greaterThan, greaterThanOrEqual, hasSubUnits, isZero, lessThan, lessThanOrEqual, maximum, minimum, multiply, normalizeScale, dinero, dinero as money, subtract, toSnapshot, toUnits, toDecimal, trimScale, haveSameCurrency, haveSameAmount, } from 'dinero.js';
@@ -0,0 +1,26 @@
1
+ export {
2
+ add,
3
+ allocate,
4
+ compare,
5
+ convert,
6
+ equal,
7
+ greaterThan,
8
+ greaterThanOrEqual,
9
+ hasSubUnits,
10
+ isZero,
11
+ lessThan,
12
+ lessThanOrEqual,
13
+ maximum,
14
+ minimum,
15
+ multiply,
16
+ normalizeScale,
17
+ dinero,
18
+ dinero as money,
19
+ subtract,
20
+ toSnapshot,
21
+ toUnits,
22
+ toDecimal,
23
+ trimScale,
24
+ haveSameCurrency,
25
+ haveSameAmount
26
+ } from "dinero.js";
@@ -0,0 +1 @@
1
+ export { debounce } from 'perfect-debounce';
@@ -0,0 +1 @@
1
+ export { debounce } from "perfect-debounce";
@@ -0,0 +1,2 @@
1
+ import { rimraf } from 'rimraf';
2
+ export { rimraf, rimraf as del };
@@ -0,0 +1,2 @@
1
+ import { rimraf } from "rimraf";
2
+ export { rimraf, rimraf as del };
package/dist/guards.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  * @category Guards
5
5
  * @example array.filter(notNullish)
6
6
  */
7
- export declare function notNullish<T>(v: T | null | undefined): v is NonNullable<T>;
8
7
  /**
9
8
  * Type guard to filter out null values
10
9
  *
package/dist/guards.mjs CHANGED
@@ -1,6 +1,3 @@
1
- export function notNullish(v) {
2
- return v != null;
3
- }
4
1
  export function noNull(v) {
5
2
  return v !== null;
6
3
  }
package/dist/helpers.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CliOptions, Manifest, NpmScript } from '@stacksjs/types';
1
+ import type { CliOptions, CommandResult, Manifest, NpmScript } from '@stacksjs/types';
2
2
  import detectIndent from 'detect-indent';
3
3
  export declare function isProjectCreated(): Promise<boolean>;
4
4
  export declare function frameworkVersion(): Promise<string>;
@@ -10,8 +10,6 @@ export declare function isAppKeySet(): Promise<boolean>;
10
10
  * @param preset
11
11
  */
12
12
  export declare function determineResetPreset(preset?: string): string[];
13
- export declare function env(key?: string, fallback?: any): any;
14
- export declare function config(key?: string, fallback?: string): void;
15
13
  /**
16
14
  * Determines whether the specified value is a package manifest.
17
15
  */
@@ -24,12 +22,24 @@ export declare function setEnvValue(key: string, value: string): Promise<void>;
24
22
  /**
25
23
  * Runs the specified NPM script in the package.json file.
26
24
  */
27
- export declare function runNpmScript(script: NpmScript, options?: CliOptions): Promise<import("neverthrow").Result<import("execa").ExecaReturnValue<string>, Error>>;
25
+ export declare function runNpmScript(script: NpmScript, options?: CliOptions): Promise<CommandResult>;
28
26
  /**
29
27
  * Determines whether the specified NPM script exists in the given manifest.
30
28
  */
31
29
  export declare function hasScript(manifest: Manifest, script: NpmScript): boolean;
32
- export * from '@dinero.js/currencies';
33
- export * from 'dinero.js';
30
+ export declare function parseYaml(content: any): any;
31
+ /**
32
+ * Determines the level of debugging.
33
+ *
34
+ * The debug level is determined by the following:
35
+ * 1. The --verbose flag
36
+ * 2. The debug property in the app configuration
37
+ *
38
+ * Currently, we don't support a custom debug level,
39
+ * though, we would like to in the future.
40
+ *
41
+ * @param options
42
+ */
43
+ export declare function determineDebugLevel(options?: CliOptions): boolean;
34
44
  export { detectIndent };
35
45
  export { detectNewline } from 'detect-newline';
package/dist/helpers.mjs CHANGED
@@ -1,8 +1,9 @@
1
- import { log, runCommand, spawn } from "@stacksjs/cli";
1
+ import detectIndent from "detect-indent";
2
2
  import { frameworkPath, projectPath } from "@stacksjs/path";
3
+ import { parse } from "yaml";
4
+ import { log, runCommand, spawn } from "@stacksjs/cli";
3
5
  import storage from "@stacksjs/storage";
4
- import { ui } from "@stacksjs/config";
5
- import detectIndent from "detect-indent";
6
+ import { app, ui } from "@stacksjs/config";
6
7
  export async function isProjectCreated() {
7
8
  if (storage.isFile(".env"))
8
9
  return await isAppKeySet();
@@ -15,8 +16,8 @@ export async function frameworkVersion() {
15
16
  return packageJson.version;
16
17
  }
17
18
  export async function isAppKeySet() {
18
- const env2 = await storage.readTextFile(".env", projectPath());
19
- const lines = env2.data.split("\n");
19
+ const env = await storage.readTextFile(".env", projectPath());
20
+ const lines = env.data.split("\n");
20
21
  const appKey = lines.find((line) => line.startsWith("APP_KEY="));
21
22
  if (appKey && appKey.length > 16)
22
23
  return true;
@@ -37,15 +38,6 @@ export function determineResetPreset(preset) {
37
38
  return ["import '@unocss/reset/antfu.css'"];
38
39
  return [];
39
40
  }
40
- export function env(key, fallback) {
41
- if (key && import.meta?.env) {
42
- return import.meta.env[key];
43
- }
44
- return fallback;
45
- }
46
- export function config(key, fallback) {
47
- console.log("key", key, "fallback", fallback);
48
- }
49
41
  export function isManifest(obj) {
50
42
  return obj && typeof obj === "object" && isOptionalString(obj.name) && isOptionalString(obj.version) && isOptionalString(obj.description);
51
43
  }
@@ -74,7 +66,13 @@ export function hasScript(manifest, script) {
74
66
  return Boolean(scripts[script]);
75
67
  return false;
76
68
  }
77
- export * from "@dinero.js/currencies";
78
- export * from "dinero.js";
69
+ export function parseYaml(content) {
70
+ return parse(content);
71
+ }
72
+ export function determineDebugLevel(options) {
73
+ if (options?.verbose === true)
74
+ return true;
75
+ return app.debug === true;
76
+ }
79
77
  export { detectIndent };
80
78
  export { detectNewline } from "detect-newline";
package/dist/index.d.ts CHANGED
@@ -1,13 +1,15 @@
1
- export { assert, toString, noop, loop, getTypeName } from './base';
1
+ export * from './base';
2
+ export * from './config';
3
+ export * from './currency';
4
+ export * from './debounce';
5
+ export * from './delete';
2
6
  export * from './equal';
3
- export * from './helpers';
4
- export type { SingletonPromiseReturn, ControlledPromise } from './promise';
5
- export { createSingletonPromise, createPromiseLock, createControlledPromise, sleep } from './promise';
6
7
  export * from './function';
7
8
  export * from './guards';
8
- export { isDef, isBoolean, isFunction, isNumber, isString, isObject, isWindow, isBrowser, isServer, isMap, isSet, isPromise } from './is';
9
+ export * from './helpers';
10
+ export * from './math';
9
11
  export * from './p';
10
- export * from './vendor';
11
- export * from '@vueuse/core';
12
- export * from '@vueuse/math';
13
- export * from '@vueuse/shared';
12
+ export * from './promise';
13
+ export * from './throttle';
14
+ export * from './vendors';
15
+ export * from './versions';
package/dist/index.mjs CHANGED
@@ -1,12 +1,15 @@
1
- export { assert, toString, noop, loop, getTypeName } from "./base.mjs";
1
+ export * from "./base.mjs";
2
+ export * from "./config.mjs";
3
+ export * from "./currency.mjs";
4
+ export * from "./debounce.mjs";
5
+ export * from "./delete.mjs";
2
6
  export * from "./equal.mjs";
3
- export * from "./helpers.mjs";
4
- export { createSingletonPromise, createPromiseLock, createControlledPromise, sleep } from "./promise.mjs";
5
7
  export * from "./function.mjs";
6
8
  export * from "./guards.mjs";
7
- export { isDef, isBoolean, isFunction, isNumber, isString, isObject, isWindow, isBrowser, isServer, isMap, isSet, isPromise } from "./is.mjs";
9
+ export * from "./helpers.mjs";
10
+ export * from "./math.mjs";
8
11
  export * from "./p.mjs";
9
- export * from "./vendor.mjs";
10
- export * from "@vueuse/core";
11
- export * from "@vueuse/math";
12
- export * from "@vueuse/shared";
12
+ export * from "./promise.mjs";
13
+ export * from "./throttle.mjs";
14
+ export * from "./vendors.mjs";
15
+ export * from "./versions.mjs";
package/dist/math.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const clamp: (n: number, min: number, max: number) => number;
2
+ export declare function rand(min: number, max: number): number;
3
+ export { and, createGenericProjection, createProjection, logicNot, logicOr, not, or, useAbs, useAverage, useCeil, useClamp, useFloor, useMath, useMax, useMin, usePrecision, useProjection, useRound, useSum, useTrunc, } from '@vueuse/math';
package/dist/math.mjs ADDED
@@ -0,0 +1,28 @@
1
+ export const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
2
+ export function rand(min, max) {
3
+ min = Math.ceil(min);
4
+ max = Math.floor(max);
5
+ return Math.floor(Math.random() * (max - min + 1)) + min;
6
+ }
7
+ export {
8
+ and,
9
+ createGenericProjection,
10
+ createProjection,
11
+ logicNot,
12
+ logicOr,
13
+ not,
14
+ or,
15
+ useAbs,
16
+ useAverage,
17
+ useCeil,
18
+ useClamp,
19
+ useFloor,
20
+ useMath,
21
+ useMax,
22
+ useMin,
23
+ usePrecision,
24
+ useProjection,
25
+ useRound,
26
+ useSum,
27
+ useTrunc
28
+ } from "@vueuse/math";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Throttle a function.
3
+ *
4
+ * @param fn
5
+ * @param wait
6
+ * @returns
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // logs window dimensions at most every 250ms
11
+ * window.addEventListener(
12
+ * "resize",
13
+ * throttle(function (evt) {
14
+ * console.log(window.innerWidth)
15
+ * console.log(window.innerHeight)
16
+ * }, 250)
17
+ * )
18
+ */
19
+ export declare function throttle(fn: Function, wait?: number): (this: unknown, ...args: any[]) => void;
@@ -0,0 +1,20 @@
1
+ export function throttle(fn, wait = 300) {
2
+ let inThrottle;
3
+ let lastFn;
4
+ let lastTime;
5
+ return function(...args) {
6
+ if (!inThrottle) {
7
+ fn.apply(this, args);
8
+ lastTime = Date.now();
9
+ inThrottle = true;
10
+ } else {
11
+ clearTimeout(lastFn);
12
+ lastFn = setTimeout(() => {
13
+ if (Date.now() - lastTime >= wait) {
14
+ fn.apply(this, args);
15
+ lastTime = Date.now();
16
+ }
17
+ }, Math.max(wait - (Date.now() - lastTime), 0));
18
+ }
19
+ };
20
+ }
@@ -0,0 +1,3 @@
1
+ export { asyncComputed, breakpointsAntDesign, breakpointsBootstrapV5, breakpointsMasterCss, breakpointsQuasar, breakpointsSematic, breakpointsTailwind, breakpointsVuetify, cloneFnJSON, computedAsync, computedInject, createFetch, createReusableTemplate, createTemplatePromise, createUnrefFn, customStorageEventName, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, executeTransition, formatTimeAgo, getSSRHandler, mapGamepadToXbox360Controller, onClickOutside, onKeyDown, onKeyPressed, onKeyStroke, onKeyUp, onLongPress, onStartTyping, setSSRHandler, templateRef, unrefElement, useActiveElement, useAnimate, useAsyncQueue, useAsyncState, useBase64, useBattery, useBluetooth, useBreakpoints, useBroadcastChannel, useBrowserLocation, useCached, useClipboard, useCloned, useColorMode, useConfirmDialog, useCssVar, useCurrentElement, useCycleList, useDark, useDebouncedRefHistory, useDeviceMotion, useDeviceOrientation, useDevicePixelRatio, useDevicesList, useDisplayMedia, useDocumentVisibility, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementHover, useElementSize, useElementVisibility, useEventBus, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetch, useFileDialog, useFileSystemAccess, useFocus, useFocusWithin, useFps, useFullscreen, useGamepad, useGeolocation, useIdle, useImage, useInfiniteScroll, useIntersectionObserver, useKeyModifier, useLocalStorage, useMagicKeys, useManualRefHistory, useMediaControls, useMediaQuery, useMemoize, useMemory, useMounted, useMouse, useMouseInElement, useMousePressed, useMutationObserver, useNavigatorLanguage, useNetwork, useObjectUrl, useOffsetPagination, useOnline, usePageLeave, useParallax, useParentElement, usePerformanceObserver, usePermission, usePointer, usePointerLock, usePointerSwipe, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePreferredReducedMotion, usePrevious, useRafFn, useRefHistory, useResizeObserver, useScreenOrientation, useScreenSafeArea, useScriptTag, useScroll, useScrollLock, useSessionStorage, useShare, useSorted, useSpeechRecognition, useSpeechSynthesis, useStepper, useStorage, useStorageAsync, useStyleTag, useSupported, useSwipe, useTemplateRefsList, useTextDirection, useTextSelection, useTextareaAutosize, useThrottledRefHistory, useTimeAgo, useTimeoutPoll, useTimestamp, useTitle, useTransition, useUrlSearchParams, useUserMedia, useVModel, useVModels, useVibrate, useVirtualList, useWakeLock, useWebNotification, useWebSocket, useWebWorker, useWebWorkerFn, useWindowFocus, useWindowScroll, useWindowSize, useDateFormat, useNow, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever, syncRef, syncRefs, throttledRef, throttledWatch, toReactive, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, isDefined, ignorableWatch, extendRef, eagerComputed, debouncedRef, debouncedWatch, createReactiveFn, createSharedComposable, createInjectionState, createGlobalState, createEventHook, controlledRef, controlledComputed, computedEager, computedWithControl, autoResetRef, } from '@vueuse/core';
2
+ export type { HeadClient, HeadObject, HeadObjectPlain, HookBeforeDomUpdate, HookEntriesResolved, HookTagsResolved, LegacyHeadOptions, } from '@vueuse/head';
3
+ export { Head, HeadVuePlugin, createHead, renderHeadToString, } from '@vueuse/head';
@@ -0,0 +1,209 @@
1
+ export {
2
+ asyncComputed,
3
+ breakpointsAntDesign,
4
+ breakpointsBootstrapV5,
5
+ breakpointsMasterCss,
6
+ breakpointsQuasar,
7
+ breakpointsSematic,
8
+ breakpointsTailwind,
9
+ breakpointsVuetify,
10
+ cloneFnJSON,
11
+ computedAsync,
12
+ computedInject,
13
+ createFetch,
14
+ createReusableTemplate,
15
+ createTemplatePromise,
16
+ createUnrefFn,
17
+ customStorageEventName,
18
+ defaultDocument,
19
+ defaultLocation,
20
+ defaultNavigator,
21
+ defaultWindow,
22
+ executeTransition,
23
+ formatTimeAgo,
24
+ getSSRHandler,
25
+ mapGamepadToXbox360Controller,
26
+ onClickOutside,
27
+ onKeyDown,
28
+ onKeyPressed,
29
+ onKeyStroke,
30
+ onKeyUp,
31
+ onLongPress,
32
+ onStartTyping,
33
+ setSSRHandler,
34
+ templateRef,
35
+ unrefElement,
36
+ useActiveElement,
37
+ useAnimate,
38
+ useAsyncQueue,
39
+ useAsyncState,
40
+ useBase64,
41
+ useBattery,
42
+ useBluetooth,
43
+ useBreakpoints,
44
+ useBroadcastChannel,
45
+ useBrowserLocation,
46
+ useCached,
47
+ useClipboard,
48
+ useCloned,
49
+ useColorMode,
50
+ useConfirmDialog,
51
+ useCssVar,
52
+ useCurrentElement,
53
+ useCycleList,
54
+ useDark,
55
+ useDebouncedRefHistory,
56
+ useDeviceMotion,
57
+ useDeviceOrientation,
58
+ useDevicePixelRatio,
59
+ useDevicesList,
60
+ useDisplayMedia,
61
+ useDocumentVisibility,
62
+ useDraggable,
63
+ useDropZone,
64
+ useElementBounding,
65
+ useElementByPoint,
66
+ useElementHover,
67
+ useElementSize,
68
+ useElementVisibility,
69
+ useEventBus,
70
+ useEventListener,
71
+ useEventSource,
72
+ useEyeDropper,
73
+ useFavicon,
74
+ useFetch,
75
+ useFileDialog,
76
+ useFileSystemAccess,
77
+ useFocus,
78
+ useFocusWithin,
79
+ useFps,
80
+ useFullscreen,
81
+ useGamepad,
82
+ useGeolocation,
83
+ useIdle,
84
+ useImage,
85
+ useInfiniteScroll,
86
+ useIntersectionObserver,
87
+ useKeyModifier,
88
+ useLocalStorage,
89
+ useMagicKeys,
90
+ useManualRefHistory,
91
+ useMediaControls,
92
+ useMediaQuery,
93
+ useMemoize,
94
+ useMemory,
95
+ useMounted,
96
+ useMouse,
97
+ useMouseInElement,
98
+ useMousePressed,
99
+ useMutationObserver,
100
+ useNavigatorLanguage,
101
+ useNetwork,
102
+ useObjectUrl,
103
+ useOffsetPagination,
104
+ useOnline,
105
+ usePageLeave,
106
+ useParallax,
107
+ useParentElement,
108
+ usePerformanceObserver,
109
+ usePermission,
110
+ usePointer,
111
+ usePointerLock,
112
+ usePointerSwipe,
113
+ usePreferredColorScheme,
114
+ usePreferredContrast,
115
+ usePreferredDark,
116
+ usePreferredLanguages,
117
+ usePreferredReducedMotion,
118
+ usePrevious,
119
+ useRafFn,
120
+ useRefHistory,
121
+ useResizeObserver,
122
+ useScreenOrientation,
123
+ useScreenSafeArea,
124
+ useScriptTag,
125
+ useScroll,
126
+ useScrollLock,
127
+ useSessionStorage,
128
+ useShare,
129
+ useSorted,
130
+ useSpeechRecognition,
131
+ useSpeechSynthesis,
132
+ useStepper,
133
+ useStorage,
134
+ useStorageAsync,
135
+ useStyleTag,
136
+ useSupported,
137
+ useSwipe,
138
+ useTemplateRefsList,
139
+ useTextDirection,
140
+ useTextSelection,
141
+ useTextareaAutosize,
142
+ useThrottledRefHistory,
143
+ useTimeAgo,
144
+ useTimeoutPoll,
145
+ useTimestamp,
146
+ useTitle,
147
+ useTransition,
148
+ useUrlSearchParams,
149
+ useUserMedia,
150
+ useVModel,
151
+ useVModels,
152
+ useVibrate,
153
+ useVirtualList,
154
+ useWakeLock,
155
+ useWebNotification,
156
+ useWebSocket,
157
+ useWebWorker,
158
+ useWebWorkerFn,
159
+ useWindowFocus,
160
+ useWindowScroll,
161
+ useWindowSize,
162
+ useDateFormat,
163
+ useNow,
164
+ watchArray,
165
+ watchAtMost,
166
+ watchDebounced,
167
+ watchDeep,
168
+ watchIgnorable,
169
+ watchImmediate,
170
+ watchOnce,
171
+ watchPausable,
172
+ watchThrottled,
173
+ watchTriggerable,
174
+ watchWithFilter,
175
+ whenever,
176
+ syncRef,
177
+ syncRefs,
178
+ throttledRef,
179
+ throttledWatch,
180
+ toReactive,
181
+ tryOnBeforeMount,
182
+ tryOnBeforeUnmount,
183
+ tryOnMounted,
184
+ tryOnScopeDispose,
185
+ tryOnUnmounted,
186
+ until,
187
+ isDefined,
188
+ ignorableWatch,
189
+ extendRef,
190
+ eagerComputed,
191
+ debouncedRef,
192
+ debouncedWatch,
193
+ createReactiveFn,
194
+ createSharedComposable,
195
+ createInjectionState,
196
+ createGlobalState,
197
+ createEventHook,
198
+ controlledRef,
199
+ controlledComputed,
200
+ computedEager,
201
+ computedWithControl,
202
+ autoResetRef
203
+ } from "@vueuse/core";
204
+ export {
205
+ Head,
206
+ HeadVuePlugin,
207
+ createHead,
208
+ renderHeadToString
209
+ } from "@vueuse/head";
@@ -0,0 +1 @@
1
+ export * as semver from 'semver';
@@ -0,0 +1 @@
1
+ export * as semver from "semver";
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@stacksjs/utils",
3
3
  "type": "module",
4
- "version": "0.51.0",
5
- "packageManager": "pnpm@7.26.3",
4
+ "version": "0.52.1",
5
+ "packageManager": "pnpm@8.5.1",
6
6
  "description": "The Stacks helper functions.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -26,6 +26,12 @@
26
26
  "functions",
27
27
  "stacks"
28
28
  ],
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.mjs"
33
+ }
34
+ },
29
35
  "main": "dist/index.mjs",
30
36
  "module": "dist/index.mjs",
31
37
  "types": "dist/index.d.ts",
@@ -36,42 +42,60 @@
36
42
  "dist",
37
43
  "README.md"
38
44
  ],
39
- "engines": {
40
- "node": ">=v18.14.0",
41
- "pnpm": ">=7.26.3"
42
- },
43
45
  "peerDependencies": {
44
- "@vueuse/core": "^9.12.0",
45
- "@vueuse/head": "^1.0.24",
46
- "@vueuse/math": "^9.12.0",
47
- "@vueuse/shared": "^9.12.0",
46
+ "@vueuse/core": "^10.1.2",
47
+ "@vueuse/head": "^1.1.26",
48
+ "@vueuse/math": "^10.1.2",
49
+ "@vueuse/shared": "^10.1.2",
50
+ "defu": "^6.1.2",
51
+ "detect-indent": "^7.0.1",
52
+ "detect-newline": "^4.0.0",
53
+ "dinero.js": "2.0.0-alpha.14",
54
+ "fast-glob": "^3.2.12",
55
+ "kolorist": "1.8.0",
56
+ "p-limit": "^4.0.0",
57
+ "rimraf": "^5.0.1",
58
+ "semver": "^7.5.1",
59
+ "yaml": "^2.2.2",
60
+ "@stacksjs/arrays": "0.52.1",
61
+ "@stacksjs/cli": "0.52.1",
62
+ "@stacksjs/config": "0.52.1",
63
+ "@stacksjs/development": "0.52.1",
64
+ "@stacksjs/lint": "0.52.1",
65
+ "@stacksjs/path": "0.52.1",
66
+ "@stacksjs/storage": "0.52.1",
67
+ "@stacksjs/types": "0.52.1"
68
+ },
69
+ "dependencies": {
70
+ "@vueuse/core": "^10.1.2",
71
+ "@vueuse/head": "^1.1.26",
72
+ "@vueuse/math": "^10.1.2",
73
+ "@vueuse/shared": "^10.1.2",
48
74
  "defu": "^6.1.2",
49
75
  "detect-indent": "^7.0.1",
50
76
  "detect-newline": "^4.0.0",
51
- "dinero.js": "2.0.0-alpha.13",
52
- "esno": "^0.16.3",
77
+ "dinero.js": "2.0.0-alpha.14",
53
78
  "fast-glob": "^3.2.12",
54
- "kolorist": "1.6.0",
79
+ "kolorist": "1.8.0",
55
80
  "p-limit": "^4.0.0",
56
- "rimraf": "^4.1.2",
57
- "throttle-debounce": "^5.0.0",
58
- "@stacksjs/arrays": "0.51.0",
59
- "@stacksjs/cli": "0.51.0",
60
- "@stacksjs/config": "0.51.0",
61
- "@stacksjs/lint": "0.51.0",
62
- "@stacksjs/path": "0.51.0",
63
- "@stacksjs/storage": "0.51.0",
64
- "@stacksjs/types": "0.51.0"
81
+ "perfect-debounce": "^1.0.0",
82
+ "rimraf": "^5.0.1",
83
+ "semver": "^7.5.1",
84
+ "yaml": "^2.2.2",
85
+ "@stacksjs/arrays": "0.52.1",
86
+ "@stacksjs/cli": "0.52.1",
87
+ "@stacksjs/config": "0.52.1",
88
+ "@stacksjs/lint": "0.52.1",
89
+ "@stacksjs/path": "0.52.1",
90
+ "@stacksjs/storage": "0.52.1",
91
+ "@stacksjs/types": "0.52.1"
65
92
  },
66
93
  "devDependencies": {
67
- "@types/throttle-debounce": "^5.0.0",
68
- "mkdist": "^1.1.0",
69
- "typescript": "^4.9.5",
70
- "@stacksjs/testing": "0.51.0"
94
+ "@stacksjs/development": "0.52.1"
71
95
  },
72
96
  "scripts": {
73
- "build": "mkdist -d",
74
- "dev": "mkdist -d",
97
+ "build": "unbuild",
98
+ "dev": "unbuild --stub",
75
99
  "typecheck": "tsc --noEmit"
76
100
  }
77
101
  }
package/dist/is.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export declare const isDef: <T = any>(val?: T | undefined) => val is T;
2
- export declare const isBoolean: (val: any) => val is boolean;
3
- export declare const isFunction: <T extends Function>(val: any) => val is T;
4
- export declare const isNumber: (val: any) => val is number;
5
- export declare const isString: (val: unknown) => val is string;
6
- export declare const isObject: (val: any) => val is object;
7
- export declare const isWindow: (val: any) => boolean;
8
- export declare const isBrowser: boolean;
9
- export declare const isServer: boolean;
10
- export declare const isMap: (val: any) => val is Map<any, any>;
11
- export declare const isSet: (val: any) => val is Set<any>;
12
- export declare const isPromise: <T = any>(val: any) => val is Promise<T>;
package/dist/is.mjs DELETED
@@ -1,13 +0,0 @@
1
- import { toString } from "./base.mjs";
2
- export const isDef = (val) => typeof val !== "undefined";
3
- export const isBoolean = (val) => typeof val === "boolean";
4
- export const isFunction = (val) => typeof val === "function";
5
- export const isNumber = (val) => typeof val === "number";
6
- export const isString = (val) => typeof val === "string";
7
- export const isObject = (val) => toString(val) === "[object Object]";
8
- export const isWindow = (val) => typeof window !== "undefined" && toString(val) === "[object Window]";
9
- export const isBrowser = typeof window !== "undefined";
10
- export const isServer = typeof document === "undefined";
11
- export const isMap = (val) => toString(val) === "[object Map]";
12
- export const isSet = (val) => toString(val) === "[object Set]";
13
- export const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
package/dist/vendor.d.ts DELETED
@@ -1 +0,0 @@
1
- export { throttle, debounce } from 'throttle-debounce';
package/dist/vendor.mjs DELETED
@@ -1 +0,0 @@
1
- export { throttle, debounce } from "throttle-debounce";