@gluhar/core 2.0.0-dev.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,311 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.3.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.2.0...@pezak/hui-core@1.3.0) (2024-09-12)
7
+
8
+
9
+ ### 🚀 Enhancements
10
+
11
+ - UseBaseUrl ([cb32c71](https://github.com/harryyaprakov/hui/commit/cb32c714fde766e7394fac792b7d86acf84d17e8))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.2.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.1.5...@pezak/hui-core@1.2.0) (2024-09-12)
18
+
19
+
20
+ ### 🚀 Enhancements
21
+
22
+ - Version bump ([32cd173](https://github.com/harryyaprakov/hui/commit/32cd173ed800a4d4ede5286e65b9c5728ce39950))
23
+
24
+
25
+
26
+
27
+
28
+ ## [1.1.5](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.1.4...@pezak/hui-core@1.1.5) (2024-09-12)
29
+
30
+ **📝 Note:** Version bump only for package @pezak/hui-core
31
+
32
+
33
+
34
+
35
+
36
+ ## [1.1.4](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.1.3...@pezak/hui-core@1.1.4) (2024-05-10)
37
+
38
+
39
+ ### 🩹 Fixes
40
+
41
+ - GetRandomBetween returning something wildly incorrect ([76dfb02](https://github.com/harryyaprakov/hui/commit/76dfb02b7b1f6063496ef47b7f0300749245be65))
42
+
43
+
44
+
45
+
46
+
47
+ ## [1.1.3](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.1.2...@pezak/hui-core@1.1.3) (2024-04-10)
48
+
49
+
50
+ ### 🩹 Fixes
51
+
52
+ - Type imports, core types export ([866186a](https://github.com/harryyaprakov/hui/commit/866186aca1ad1bab03b5b6b0d0621a29f67518f6))
53
+
54
+
55
+
56
+
57
+
58
+ ## [1.1.2](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.1.1...@pezak/hui-core@1.1.2) (2024-03-31)
59
+
60
+ **📝 Note:** Version bump only for package @pezak/hui-core
61
+
62
+
63
+
64
+
65
+
66
+ ## [1.1.1](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.1.0...@pezak/hui-core@1.1.1) (2024-03-27)
67
+
68
+ **📝 Note:** Version bump only for package @pezak/hui-core
69
+
70
+
71
+
72
+
73
+
74
+ # [1.1.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.0.4...@pezak/hui-core@1.1.0) (2024-03-27)
75
+
76
+
77
+ ### 🚀 Enhancements
78
+
79
+ - Proper build and dist process for core and sanity ([3699c59](https://github.com/harryyaprakov/hui/commit/3699c59cd24dc9a9a34779c89924101c938a59de))
80
+
81
+
82
+
83
+
84
+
85
+ ## [1.0.4](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.0.3...@pezak/hui-core@1.0.4) (2024-03-26)
86
+
87
+
88
+ ### 🩹 Fixes
89
+
90
+ - Package json fixes ([a5823da](https://github.com/harryyaprakov/hui/commit/a5823daef779c4d9be0e0794cee20ee120ed6c6b))
91
+
92
+
93
+
94
+
95
+
96
+ ## [1.0.3](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.0.2...@pezak/hui-core@1.0.3) (2024-03-26)
97
+
98
+
99
+ ### 🩹 Fixes
100
+
101
+ - Copy readme and changelog to dist on build ([5b27677](https://github.com/harryyaprakov/hui/commit/5b27677f8a18a21d1ccbea85bb0d8a611c43938e))
102
+
103
+
104
+
105
+
106
+
107
+ ## [1.0.2](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.0.0...@pezak/hui-core@1.0.2) (2024-03-26)
108
+
109
+
110
+ ### 🩹 Fixes
111
+
112
+ - Hui-core module name ([51c45dc](https://github.com/harryyaprakov/hui/commit/51c45dc55bd675fc0899aca4efb2a456d942c9c6))
113
+
114
+
115
+
116
+
117
+
118
+ ## [1.0.1](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@1.0.0...@pezak/hui-core@1.0.1) (2024-03-26)
119
+
120
+
121
+ ### 🩹 Fixes
122
+
123
+ - Hui-core module name ([51c45dc](https://github.com/harryyaprakov/hui/commit/51c45dc55bd675fc0899aca4efb2a456d942c9c6))
124
+
125
+
126
+
127
+
128
+
129
+ # [1.0.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.5.0...@pezak/hui-core@1.0.0) (2024-03-26)
130
+
131
+
132
+ ### 🚀 Enhancements
133
+
134
+ - Hui-core is in v1 ([30acbca](https://github.com/harryyaprakov/hui/commit/30acbcaa732a8ec92b472c1144da83342b2c3775))
135
+ - Initiate hui-core as a package for basic shared composables, utils and types. ([0570751](https://github.com/harryyaprakov/hui/commit/0570751b8e8810c135557b42ed8d4d03ab389b30))
136
+
137
+
138
+
139
+
140
+
141
+ # [0.5.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.2.0...@pezak/hui-core@0.5.0) (2024-03-26)
142
+
143
+
144
+ ### 🩹 Fixes
145
+
146
+ - A small change again ([e664a0f](https://github.com/harryyaprakov/hui/commit/e664a0f22f5f6a9977064181b7d66f4e91ac7988))
147
+ - Pimp changelog ([c813e4a](https://github.com/harryyaprakov/hui/commit/c813e4a4a7ce19d09ee46a20ae6d351086472f1c))
148
+
149
+
150
+ ### 🚀 Enhancements
151
+
152
+ - Pimp changelogs to be like Nuxt / unjs/changelogen ([afeb9cc](https://github.com/harryyaprakov/hui/commit/afeb9cce1b507e51beb1b8aa8e919c841b28ba02))
153
+
154
+
155
+
156
+
157
+
158
+ # [0.4.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.2.0...@pezak/hui-core@0.4.0) (2024-03-26)
159
+
160
+
161
+ ### 🩹 Fixes
162
+
163
+ - A small change again ([e664a0f](https://github.com/harryyaprakov/hui/commit/e664a0f22f5f6a9977064181b7d66f4e91ac7988))
164
+ - Pimp changelog ([c813e4a](https://github.com/harryyaprakov/hui/commit/c813e4a4a7ce19d09ee46a20ae6d351086472f1c))
165
+
166
+
167
+ ### 🚀 Enhancements
168
+
169
+ - Pimp changelogs to be like Nuxt / unjs/changelogen ([afeb9cc](https://github.com/harryyaprakov/hui/commit/afeb9cce1b507e51beb1b8aa8e919c841b28ba02))
170
+
171
+
172
+
173
+
174
+
175
+ # [0.3.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.2.0...@pezak/hui-core@0.3.0) (2024-03-26)
176
+
177
+
178
+ ### 🩹 Fixes
179
+
180
+ - A small change again ([e664a0f](https://github.com/harryyaprakov/hui/commit/e664a0f22f5f6a9977064181b7d66f4e91ac7988))
181
+
182
+
183
+ ### 🚀 Enhancements
184
+
185
+ - Pimp changelogs to be like Nuxt / unjs/changelogen ([afeb9cc](https://github.com/harryyaprakov/hui/commit/afeb9cce1b507e51beb1b8aa8e919c841b28ba02))
186
+
187
+
188
+
189
+
190
+
191
+ # [0.2.0](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.1.5...@pezak/hui-core@0.2.0) (2024-03-25)
192
+
193
+
194
+ ### 🚀 Enhancements
195
+
196
+ - Some test feature added ([012c975](https://github.com/harryyaprakov/hui/commit/012c97562d237a5c762ad9d2f82c7d2e76d5a605))
197
+
198
+
199
+
200
+
201
+
202
+ ## [0.1.5](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.1.4...@pezak/hui-core@0.1.5) (2024-03-25)
203
+
204
+ **📝 Note:** Version bump only for package @pezak/hui-core
205
+
206
+
207
+
208
+
209
+
210
+ ## [0.1.4](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.1.3...@pezak/hui-core@0.1.4) (2024-03-25)
211
+
212
+ **📝 Note:** Version bump only for package @pezak/hui-core
213
+
214
+
215
+
216
+
217
+
218
+ ## [0.1.3](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.1.2...@pezak/hui-core@0.1.3) (2024-03-25)
219
+
220
+
221
+ ### 🩹 Fixes
222
+
223
+ - Core build ([a2228e7](https://github.com/harryyaprakov/hui/commit/a2228e70f3fb18ddc7bd79961e9c8e161d3dfbe2))
224
+
225
+
226
+
227
+
228
+
229
+ ## [0.1.2](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.1.0...@pezak/hui-core@0.1.2) (2024-03-25)
230
+
231
+ **📝 Note:** Version bump only for package @pezak/hui-core
232
+
233
+
234
+
235
+
236
+
237
+ ## [0.1.1](https://github.com/harryyaprakov/hui/compare/@pezak/hui-core@0.1.0...@pezak/hui-core@0.1.1) (2024-03-25)
238
+
239
+ **📝 Note:** Version bump only for package @pezak/hui-core
240
+
241
+
242
+
243
+
244
+
245
+ # 0.1.0 (2024-02-25)
246
+
247
+ ### 🩹 Fixes
248
+
249
+ - **core:** making a test change to core ([00b9629](https://github.com/harryyaprakov/hui/commit/00b9629ab3dd209931dc2cf1cc222beb5a89cfa4))
250
+
251
+ ## 0.0.5 (2024-02-25)
252
+
253
+ ### 🚀 Enhancements
254
+
255
+ - init dev with two example packages ([416ecc4](https://github.com/harryyaprakov/hui/commit/416ecc45457acec888806c58bdcb7f5f0fba9472))
256
+ - **repo:** added lerna ([dadeca9](https://github.com/harryyaprakov/hui/commit/dadeca9b503dbe2b0f3c25eaaf7a85e7f2dd21c4))
257
+
258
+ # @pezak/hui-core
259
+
260
+ ## v0.0.5
261
+
262
+ [compare changes](https://github.com/harryyaprakov/hui/compare/v0.0.3...v0.0.5)
263
+
264
+ ### 🚀 Enhancements
265
+
266
+ - Init dev with two example packages ([416ecc4](https://github.com/harryyaprakov/hui/commit/416ecc4))
267
+ - **repo:** Added lerna ([dadeca9](https://github.com/harryyaprakov/hui/commit/dadeca9))
268
+
269
+ ### 🩹 Fixes
270
+
271
+ - Publish without release label ([c233f3d](https://github.com/harryyaprakov/hui/commit/c233f3d))
272
+
273
+ ### 🏡 Chore
274
+
275
+ - Testing out changeset ([c8ab5f3](https://github.com/harryyaprakov/hui/commit/c8ab5f3))
276
+ - Add auto for versioning and publishing ([ec5caf9](https://github.com/harryyaprakov/hui/commit/ec5caf9))
277
+ - Remove turbo and add lerna ([1ae9159](https://github.com/harryyaprakov/hui/commit/1ae9159))
278
+ - Add workspaces scripts ([4020d94](https://github.com/harryyaprakov/hui/commit/4020d94))
279
+ - **release:** V0.0.3 ([e0bcb93](https://github.com/harryyaprakov/hui/commit/e0bcb93))
280
+ - **release:** V0.0.3 ([b32aa79](https://github.com/harryyaprakov/hui/commit/b32aa79))
281
+
282
+ ### ❤️ Contributors
283
+
284
+ - Harry Yaprakov <h@yaprakov.com>
285
+
286
+ ## v0.0.3
287
+
288
+ ### 🚀 Enhancements
289
+
290
+ - Init dev with two example packages ([416ecc4](https://github.com/harryyaprakov/hui/commit/416ecc4))
291
+
292
+ ### 🩹 Fixes
293
+
294
+ - Publish without release label ([c233f3d](https://github.com/harryyaprakov/hui/commit/c233f3d))
295
+
296
+ ### 🏡 Chore
297
+
298
+ - Testing out changeset ([c8ab5f3](https://github.com/harryyaprakov/hui/commit/c8ab5f3))
299
+ - Add auto for versioning and publishing ([ec5caf9](https://github.com/harryyaprakov/hui/commit/ec5caf9))
300
+ - Remove turbo and add lerna ([1ae9159](https://github.com/harryyaprakov/hui/commit/1ae9159))
301
+ - Add workspaces scripts ([4020d94](https://github.com/harryyaprakov/hui/commit/4020d94))
302
+
303
+ ### ❤️ Contributors
304
+
305
+ - Harry Yaprakov <h@yaprakov.com>
306
+
307
+ ## 0.0.2
308
+
309
+ ### Patch Changes
310
+
311
+ - chore: Initializing hui-core and hui-sanity packages.
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ <!--
2
+ Get your module up and running quickly.
3
+
4
+ Find and replace all on all files (CMD+SHIFT+F):
5
+ - Name: My Module
6
+ - Package name: my-module
7
+ - Description: My new Nuxt module
8
+ -->
9
+
10
+ # My Module
11
+
12
+ [![npm version][npm-version-src]][npm-version-href]
13
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
14
+ [![License][license-src]][license-href]
15
+ [![Nuxt][nuxt-src]][nuxt-href]
16
+
17
+ My new Nuxt module for doing amazing things.
18
+
19
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
20
+ <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
21
+ <!-- - [📖 &nbsp;Documentation](https://example.com) -->
22
+
23
+ ## Features
24
+
25
+ <!-- Highlight some of the features your module provide here -->
26
+ - ⛰ &nbsp;Foo
27
+ - 🚠 &nbsp;Bar
28
+ - 🌲 &nbsp;Baz
29
+
30
+ ## Quick Setup
31
+
32
+ 1. Add `my-module` dependency to your project
33
+
34
+ ```bash
35
+ # Using pnpm
36
+ pnpm add -D my-module
37
+
38
+ # Using yarn
39
+ yarn add --dev my-module
40
+
41
+ # Using npm
42
+ npm install --save-dev my-module
43
+ ```
44
+
45
+ 2. Add `my-module` to the `modules` section of `nuxt.config.ts`
46
+
47
+ ```js
48
+ export default defineNuxtConfig({
49
+ modules: [
50
+ 'my-module'
51
+ ]
52
+ })
53
+ ```
54
+
55
+ That's it! You can now use My Module in your Nuxt app ✨
56
+
57
+ ## Development
58
+
59
+ ```bash
60
+ # Install dependencies
61
+ npm install
62
+
63
+ # Generate type stubs
64
+ npm run dev:prepare
65
+
66
+ # Develop with the playground
67
+ npm run dev
68
+
69
+ # Build the playground
70
+ npm run dev:build
71
+
72
+ # Run ESLint
73
+ npm run lint
74
+
75
+ # Run Vitest
76
+ npm run test
77
+ npm run test:watch
78
+
79
+ # Release new version
80
+ npm run release
81
+ ```
82
+
83
+ <!-- Badges -->
84
+ [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
85
+ [npm-version-href]: https://npmjs.com/package/my-module
86
+
87
+ [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
88
+ [npm-downloads-href]: https://npmjs.com/package/my-module
89
+
90
+ [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
91
+ [license-href]: https://npmjs.com/package/my-module
92
+
93
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
94
+ [nuxt-href]: https://nuxt.com
@@ -0,0 +1,5 @@
1
+ module.exports = function(...args) {
2
+ return import('./module.mjs').then(m => m.default.call(this, ...args))
3
+ }
4
+ const _meta = module.exports.meta = require('./module.json')
5
+ module.exports.getMeta = () => Promise.resolve(_meta)
@@ -0,0 +1,7 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface GluharCoreOptions {
4
+ }
5
+ declare const _default: _nuxt_schema.NuxtModule<GluharCoreOptions, GluharCoreOptions, false>;
6
+
7
+ export { type GluharCoreOptions, _default as default };
@@ -0,0 +1,7 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ interface GluharCoreOptions {
4
+ }
5
+ declare const _default: _nuxt_schema.NuxtModule<GluharCoreOptions, GluharCoreOptions, false>;
6
+
7
+ export { type GluharCoreOptions, _default as default };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@gluhar/core",
3
+ "configKey": "gluharCore",
4
+ "version": "2.0.0-dev.0",
5
+ "builder": {
6
+ "@nuxt/module-builder": "0.8.3",
7
+ "unbuild": "2.0.0"
8
+ }
9
+ }
@@ -0,0 +1,18 @@
1
+ import { defineNuxtModule, createResolver, installModule, addImportsDir } from '@nuxt/kit';
2
+
3
+ const module = defineNuxtModule({
4
+ meta: {
5
+ name: "@gluhar/core",
6
+ configKey: "gluharCore"
7
+ },
8
+ // Default configuration options of the Nuxt module
9
+ defaults: {},
10
+ setup(options, nuxt) {
11
+ const { resolve } = createResolver(import.meta.url);
12
+ installModule("@nuxtjs/device");
13
+ addImportsDir(resolve("runtime/composables"));
14
+ addImportsDir(resolve("runtime/utils"));
15
+ }
16
+ });
17
+
18
+ export { module as default };
@@ -0,0 +1,3 @@
1
+ export declare const useClientOnly: () => {
2
+ isClient: import("vue").Ref<boolean, boolean>;
3
+ };
@@ -0,0 +1,8 @@
1
+ import { onMounted, ref } from "vue";
2
+ export const useClientOnly = () => {
3
+ const mounted = ref(false);
4
+ onMounted(() => {
5
+ mounted.value = true;
6
+ });
7
+ return { isClient: mounted };
8
+ };
@@ -0,0 +1,17 @@
1
+ export declare const useResponsive: () => {
2
+ isMobile: import("vue").Ref<boolean, boolean>;
3
+ breakpoints: Record<"sm" | "md" | "lg" | "xl" | "2xl", import("vue").Ref<boolean, boolean>> & {
4
+ greaterOrEqual: (k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">) => import("vue").Ref<boolean>;
5
+ smallerOrEqual: (k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">) => import("vue").Ref<boolean>;
6
+ greater(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): import("vue").Ref<boolean>;
7
+ smaller(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): import("vue").Ref<boolean>;
8
+ between(a: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">, b: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): import("vue").Ref<boolean>;
9
+ isGreater(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): boolean;
10
+ isGreaterOrEqual(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): boolean;
11
+ isSmaller(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): boolean;
12
+ isSmallerOrEqual(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): boolean;
13
+ isInBetween(a: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">, b: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl" | "2xl">): boolean;
14
+ current: () => import("vue").ComputedRef<string[]>;
15
+ active(): import("vue").ComputedRef<string | undefined>;
16
+ };
17
+ };
@@ -0,0 +1,8 @@
1
+ import { useBreakpoints, breakpointsTailwind } from "@vueuse/core";
2
+ import { useDevice } from "#imports";
3
+ export const useResponsive = () => {
4
+ const breakpoints = useBreakpoints(breakpointsTailwind);
5
+ const { isMobile } = useDevice();
6
+ const mobile = breakpoints.smaller("sm") || isMobile;
7
+ return { isMobile: mobile, breakpoints };
8
+ };
@@ -0,0 +1,3 @@
1
+ import { breakpointsTailwind } from "@vueuse/core";
2
+ export type NonNegativeInteger<T extends number> = number extends T ? never : `${T}` extends `-${string}` | `${string}.${string}` ? never : T;
3
+ export type Breakpoint = keyof typeof breakpointsTailwind;
File without changes
@@ -0,0 +1,10 @@
1
+ export declare const capitalize: (s: string) => string;
2
+ export declare const envMode: () => "dev" | "prod";
3
+ /**
4
+ * Returns the base URL based on the environment mode.
5
+ *
6
+ * @param {string} baseUrl - The base URL to be used.
7
+ * @returns {string | undefined} - The base URL if the environment mode is "prod", otherwise undefined.
8
+ */
9
+ export declare const useBaseUrl: (baseUrl: string) => string | undefined;
10
+ export declare const asyncTimeout: (ms: number) => Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ export const capitalize = (s) => s && s[0].toUpperCase() + s.slice(1);
2
+ export const envMode = () => process.env.NODE_ENV === "development" ? "dev" : "prod";
3
+ export const useBaseUrl = (baseUrl) => {
4
+ return envMode() === "prod" ? baseUrl : void 0;
5
+ };
6
+ export const asyncTimeout = (ms) => new Promise((res) => setTimeout(res, ms));
@@ -0,0 +1,4 @@
1
+ export declare const readModule: <T extends Record<string, any>>(path: string | undefined, options?: {
2
+ cwd?: boolean;
3
+ default?: boolean;
4
+ }) => Promise<T>;
@@ -0,0 +1,13 @@
1
+ import { readFileSync } from "fs";
2
+ import { join } from "path";
3
+ import { evalModule } from "mlly";
4
+ export const readModule = async (path, options = { cwd: true }) => {
5
+ if (!path) throw new Error("[@gluhar/core] readModule | No path provided.");
6
+ const p = options?.cwd ? join(process.cwd(), path) : path;
7
+ const file = readFileSync(p)?.toString();
8
+ if (!file)
9
+ throw new Error("[@gluhar/core] readModule | File not found on path: " + p);
10
+ const sanitizedFile = file.replaceAll(" as const", "");
11
+ const module = await evalModule(sanitizedFile);
12
+ return options?.default ? module.default : module;
13
+ };
@@ -0,0 +1,6 @@
1
+ import type { NonNegativeInteger } from "../types.js";
2
+ export declare const getRandomInt: (max?: number) => number;
3
+ export declare const getRandomBetween: (min: number, max: number) => number;
4
+ export declare const getRandomDigits: <N extends number>(count: NonNegativeInteger<N>) => number;
5
+ export declare const getRandomHex: <N extends number>(count?: NonNegativeInteger<N>) => string;
6
+ export declare const getUuid: () => string;
@@ -0,0 +1,5 @@
1
+ export const getRandomInt = (max = 100) => Math.floor(Math.random() * max);
2
+ export const getRandomBetween = (min, max) => getRandomInt(max - min + 1) + min;
3
+ export const getRandomDigits = (count) => getRandomBetween(9 * 10 ** (count - 1), 10 ** (count - 1));
4
+ export const getRandomHex = (count) => [...Array(count || 6)].map(() => getRandomBetween(0, 15).toString(16)).join("");
5
+ export const getUuid = () => `huuid-${getRandomHex()}-${getRandomHex()}-${getRandomHex()}`;
@@ -0,0 +1,2 @@
1
+ export * from "./common.js";
2
+ export * from "./generators.js";
@@ -0,0 +1,2 @@
1
+ export * from "./common.js";
2
+ export * from "./generators.js";
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.js'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { type GluharCoreOptions, default } from './module.js'
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { type GluharCoreOptions, default } from './module'
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@gluhar/core",
3
+ "version": "2.0.0-dev.0",
4
+ "description": "Gluhar Core packages.",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/types.d.ts",
9
+ "import": "./dist/module.mjs",
10
+ "require": "./dist/module.cjs"
11
+ },
12
+ "./utils/*": {
13
+ "types": "./dist/runtime/utils/*.d.ts",
14
+ "import": "./dist/runtime/utils/*.js"
15
+ },
16
+ "./types": {
17
+ "types": "./dist/runtime/types/index.d.ts"
18
+ }
19
+ },
20
+ "main": "./dist/module.cjs",
21
+ "types": "./dist/types.d.ts",
22
+ "files": [
23
+ "dist",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "scripts": {
27
+ "gluhar": "npm run gluhar --prefix ../.. -- --cwd=$PWD",
28
+ "build": "npm run gluhar build -- -t module",
29
+ "dev": "nuxi dev playground",
30
+ "dev:build": "nuxi build playground",
31
+ "dev:prepare": "nuxt-module-build build && nuxt-module-build prepare && nuxi prepare playground",
32
+ "lint": "eslint .",
33
+ "test": "echo 'Testing'",
34
+ "test:watch": "vitest watch"
35
+ },
36
+ "dependencies": {
37
+ "@nuxt/kit": "^3.13.1",
38
+ "@nuxtjs/device": "^3.2.2",
39
+ "@vueuse/core": "^11.0.3",
40
+ "mlly": "^1.7.1"
41
+ },
42
+ "devDependencies": {
43
+ "@nuxt/devtools": "latest",
44
+ "@nuxt/eslint-config": "^0.5.6",
45
+ "@nuxt/module-builder": "^0.8.3",
46
+ "@nuxt/schema": "^3.13.1",
47
+ "@nuxt/test-utils": "^3.14.1",
48
+ "@types/node": "^22.5.4",
49
+ "changelogen": "^0.5.5",
50
+ "copyfiles": "^2.4.1",
51
+ "eslint": "^9.10.0",
52
+ "nuxt": "^3.13.1",
53
+ "vitest": "^2.0.5"
54
+ },
55
+ "gitHead": "7e440d8b9fec347229003a5d5a6885479bd426ab"
56
+ }