stacks 0.49.1 → 0.49.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.
- package/README.md +2 -2
- package/buddy/README.md +2 -2
- package/buddy/package.json +1 -1
- package/buddy/src/commands/dev.ts +15 -2
- package/core/actions/package.json +1 -1
- package/core/actions/src/dev.ts +0 -2
- package/core/actions/src/helpers/utils.ts +1 -1
- package/core/ai/package.json +1 -1
- package/core/alias/package.json +1 -1
- package/core/arrays/package.json +1 -1
- package/core/arrays/src/index.ts +14 -0
- package/core/auth/package.json +1 -1
- package/core/build/package.json +1 -1
- package/core/cache/package.json +4 -2
- package/core/cache/src/drivers/memcached.ts +1 -1
- package/core/cache/src/drivers/upstash.ts +2 -0
- package/core/cache/src/index.ts +1 -0
- package/core/chat/package.json +1 -2
- package/core/cli/README.md +1 -1
- package/core/cli/package.json +1 -1
- package/core/cli/src/helpers.ts +1 -1
- package/core/cloud/package.json +1 -1
- package/core/collections/package.json +1 -1
- package/core/config/package.json +1 -1
- package/core/dashboard/package.json +1 -1
- package/core/database/package.json +1 -1
- package/core/datetime/package.json +1 -1
- package/core/desktop/package.json +1 -1
- package/core/docs/package.json +1 -1
- package/core/domains/package.json +1 -1
- package/core/drivers/package.json +1 -1
- package/core/email/package.json +2 -2
- package/core/error-handling/package.json +1 -1
- package/core/events/package.json +1 -1
- package/core/git/package.json +1 -1
- package/core/health/package.json +1 -1
- package/core/lint/package.json +1 -1
- package/core/logging/package.json +1 -1
- package/core/modules/package.json +1 -1
- package/core/notifications/build.config.ts +1 -0
- package/core/notifications/package.json +2 -2
- package/core/notifications/src/index.ts +2 -2
- package/core/objects/package.json +1 -1
- package/core/objects/src/index.ts +17 -1
- package/core/path/package.json +1 -1
- package/core/payments/package.json +1 -1
- package/core/push/package.json +2 -2
- package/core/realtime/package.json +1 -1
- package/core/router/package.json +1 -1
- package/core/search-engine/package.json +1 -1
- package/core/security/package.json +1 -1
- package/core/server/package.json +1 -1
- package/core/sms/package.json +1 -3
- package/core/storage/package.json +1 -1
- package/core/storage/src/index.ts +1 -3
- package/core/strings/package.json +1 -1
- package/core/tables/dist/index.html +15 -0
- package/core/tables/package.json +1 -1
- package/core/tables/vite.config.ts +1 -1
- package/core/testing/package.json +1 -1
- package/core/types/package.json +1 -1
- package/core/types/src/cli.ts +4 -4
- package/core/ui/package.json +2 -2
- package/core/utils/node_modules/.bin/rimraf +2 -2
- package/core/utils/package.json +2 -2
- package/core/utils/src/base.ts +14 -5
- package/core/utils/src/equal.ts +27 -0
- package/core/utils/src/helpers.ts +2 -1
- package/core/utils/src/index.ts +5 -4
- package/core/utils/src/is.ts +11 -9
- package/core/utils/src/p.ts +4 -3
- package/core/utils/src/promise.ts +50 -17
- package/core/x-ray/package.json +1 -1
- package/package.json +2 -2
- package/core/chat/node_modules/.bin/maizzle +0 -17
- package/core/sms/node_modules/.bin/maizzle +0 -17
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ _Develop dynamic UIs with helpers for atomic design, and much more._
|
|
|
38
38
|
- 🌐 **Web** _"a routing & templating engine that makes sense" using components—SSG & PWA ready_
|
|
39
39
|
- 🖥️ **Desktop** _components as desktop elements_
|
|
40
40
|
- 📚 **Library** _auto-builds component & function libraries_
|
|
41
|
-
- ⚡️ Powered by
|
|
41
|
+
- ⚡️ Powered by Nitro, Tauri, UnoCSS, Vite & Vue
|
|
42
42
|
|
|
43
43
|
### Stacks Functions
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ _Develop serverless (or server) functions with countless helpers to build scalab
|
|
|
46
46
|
|
|
47
47
|
- 🪄 **AI** _deep OpenAI integration_
|
|
48
48
|
- 🤖 **APIs** _scalability & maintainability built-in_
|
|
49
|
-
- 🏎️ **Cache** _Redis, DynamoDB, SingleStore, and
|
|
49
|
+
- 🏎️ **Cache** _Redis, DynamoDB, Upstash, SingleStore, and more—serverless_
|
|
50
50
|
- ⚙️ **CLIs** _create beautiful CLIs for Linux, Windows, and Mac—without requirements_
|
|
51
51
|
- 📀 **Database** _MySQL, Postgres, PlanetScale, Supabase, Prisma, ..._
|
|
52
52
|
- 👾 **Errors** _native type-safe error handling_
|
package/buddy/README.md
CHANGED
|
@@ -38,7 +38,7 @@ _Develop dynamic UIs with helpers for atomic design, and much more._
|
|
|
38
38
|
- 🌐 **Web** _"a routing & templating engine that makes sense" using components—SSG & PWA ready_
|
|
39
39
|
- 🖥️ **Desktop** _components as desktop elements_
|
|
40
40
|
- 📚 **Library** _auto-builds component & function libraries_
|
|
41
|
-
- ⚡️ Powered by
|
|
41
|
+
- ⚡️ Powered by Nitro, Tauri, UnoCSS, Vite & Vue
|
|
42
42
|
|
|
43
43
|
### Stacks Functions
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ _Develop serverless (or server) functions with countless helpers to build scalab
|
|
|
46
46
|
|
|
47
47
|
- 🪄 **AI** _deep OpenAI integration_
|
|
48
48
|
- 🤖 **APIs** _scalability & maintainability built-in_
|
|
49
|
-
- 🏎️ **Cache** _Redis, DynamoDB, SingleStore, and
|
|
49
|
+
- 🏎️ **Cache** _Redis, DynamoDB, Upstash, SingleStore, and more—serverless_
|
|
50
50
|
- ⚙️ **CLIs** _create beautiful CLIs for Linux, Windows, and Mac—without requirements_
|
|
51
51
|
- 📀 **Database** _MySQL, Postgres, PlanetScale, Supabase, Prisma, ..._
|
|
52
52
|
- 👾 **Errors** _native type-safe error handling_
|
package/buddy/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Action, ExitCode } from '@stacksjs/types'
|
|
2
2
|
import { runAction } from '@stacksjs/actions'
|
|
3
3
|
import type { CLI, DevOption, DevOptions } from '@stacksjs/types'
|
|
4
|
-
import { intro, outro, prompts } from '@stacksjs/cli'
|
|
4
|
+
import { intro, log, outro, prompts } from '@stacksjs/cli'
|
|
5
5
|
import { components, desktop, docs, functions, pages, invoke as startDevelopmentServer } from '@stacksjs/actions/dev'
|
|
6
6
|
|
|
7
7
|
async function dev(buddy: CLI) {
|
|
@@ -60,7 +60,20 @@ async function dev(buddy: CLI) {
|
|
|
60
60
|
const perf = await intro('buddy dev:components')
|
|
61
61
|
const result = await runAction(Action.DevComponents, { ...options, debug: true })
|
|
62
62
|
|
|
63
|
-
if (
|
|
63
|
+
if (options.debug)
|
|
64
|
+
log.info('result is', result)
|
|
65
|
+
|
|
66
|
+
// check if result is an array
|
|
67
|
+
if (Array.isArray(result)) {
|
|
68
|
+
// check if any of the items in the array is an error
|
|
69
|
+
if (result.some(item => item.isErr())) {
|
|
70
|
+
outro('While running the dev:components command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error)
|
|
71
|
+
process.exit()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// check if result is an error
|
|
76
|
+
else if (result.isErr()) {
|
|
64
77
|
outro('While running the dev:components command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error)
|
|
65
78
|
process.exit()
|
|
66
79
|
}
|
package/core/actions/src/dev.ts
CHANGED
|
@@ -33,8 +33,6 @@ export async function dev(options: DevOptions) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export async function components(options: DevOptions) {
|
|
36
|
-
// eslint-disable-next-line no-console
|
|
37
|
-
console.log('here?')
|
|
38
36
|
log.info('Starting your components dev server...')
|
|
39
37
|
await runNpmScript(NpmScript.DevComponents, options)
|
|
40
38
|
}
|
|
@@ -35,7 +35,7 @@ export type ActionResult = Promise<
|
|
|
35
35
|
*/
|
|
36
36
|
export async function runAction(action: string, options?: CliOptions): Promise<
|
|
37
37
|
Result<CommandResult<string>, Error>
|
|
38
|
-
|
|
38
|
+
| Result<CommandResult<string>, Error>[]
|
|
39
39
|
| Err<CommandResult<string>, string>
|
|
40
40
|
> {
|
|
41
41
|
if (!hasAction(action))
|
package/core/ai/package.json
CHANGED
package/core/alias/package.json
CHANGED
package/core/arrays/package.json
CHANGED
package/core/arrays/src/index.ts
CHANGED
|
@@ -89,6 +89,20 @@ export function uniq<T>(array: readonly T[]): T[] {
|
|
|
89
89
|
return Array.from(new Set(array))
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Unique an Array by a custom equality function
|
|
94
|
+
*
|
|
95
|
+
* @category Array
|
|
96
|
+
*/
|
|
97
|
+
export function uniqueBy<T>(array: readonly T[], equalFn: (a: any, b: any) => boolean): T[] {
|
|
98
|
+
return array.reduce((acc: T[], cur: any) => {
|
|
99
|
+
const index = acc.findIndex((item: any) => equalFn(cur, item))
|
|
100
|
+
if (index === -1)
|
|
101
|
+
acc.push(cur)
|
|
102
|
+
return acc
|
|
103
|
+
}, [])
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
/**
|
|
93
107
|
* Get last item
|
|
94
108
|
*
|
package/core/auth/package.json
CHANGED
package/core/build/package.json
CHANGED
package/core/cache/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/cache",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
|
-
"description": "The Stacks way
|
|
6
|
+
"description": "The Stacks way of caching.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"cache",
|
|
21
|
+
"serverless",
|
|
21
22
|
"redis",
|
|
23
|
+
"upstash",
|
|
22
24
|
"dynamodb",
|
|
23
25
|
"utilities",
|
|
24
26
|
"functions",
|
|
@@ -10,7 +10,7 @@ async function set(key: string, value: any, duration: number): Promise<void> {
|
|
|
10
10
|
async function get(key: string): Promise<any> {
|
|
11
11
|
const value = await client.get(key)
|
|
12
12
|
|
|
13
|
-
return value.
|
|
13
|
+
return value.toString()
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
async function del(key: string): Promise<void> {
|
package/core/cache/src/index.ts
CHANGED
package/core/chat/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/chat",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks Chat Integration. Easy sending of messages for chat services",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"typecheck": "tsc --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@maizzle/framework": "latest",
|
|
47
46
|
"@novu/discord": "^0.10.2",
|
|
48
47
|
"@novu/node": "^0.10.2",
|
|
49
48
|
"@novu/slack": "^0.10.2",
|
package/core/cli/README.md
CHANGED
|
@@ -51,7 +51,7 @@ async function install() {
|
|
|
51
51
|
try {
|
|
52
52
|
const spin = spinner('Running...').start()
|
|
53
53
|
setTimeout(() => {
|
|
54
|
-
spin.text = italic('
|
|
54
|
+
spin.text = italic('This may take a few moments...')
|
|
55
55
|
}, 5000)
|
|
56
56
|
await spawn('pnpm install')
|
|
57
57
|
spin.stop()
|
package/core/cli/package.json
CHANGED
package/core/cli/src/helpers.ts
CHANGED
package/core/cloud/package.json
CHANGED
package/core/config/package.json
CHANGED
package/core/docs/package.json
CHANGED
package/core/email/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/email",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typecheck": "tsc --noEmit"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@maizzle/framework": "
|
|
55
|
+
"@maizzle/framework": "^4.3.1",
|
|
56
56
|
"@novu/emailjs": "^0.10.2",
|
|
57
57
|
"@novu/mailgun": "^0.10.2",
|
|
58
58
|
"@novu/mailjet": "^0.10.2",
|
package/core/events/package.json
CHANGED
package/core/git/package.json
CHANGED
package/core/health/package.json
CHANGED
package/core/lint/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/notifications",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks notifications integration.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typecheck": "tsc --noEmit"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@maizzle/framework": "
|
|
55
|
+
"@maizzle/framework": "^4.3.1",
|
|
56
56
|
"@novu/discord": "^0.10.2",
|
|
57
57
|
"@novu/emailjs": "^0.10.2",
|
|
58
58
|
"@novu/gupshup": "^0.10.2",
|
|
@@ -16,7 +16,7 @@ const useSMS = (driver = 'twilio') => {
|
|
|
16
16
|
return sms[driver as keyof typeof sms]
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
function useNotification(typeParam = 'email', driverParam = 'sendgrid'): any {
|
|
20
20
|
const type = typeParam || config.type
|
|
21
21
|
const driver = driverParam || config.driver
|
|
22
22
|
|
|
@@ -32,7 +32,7 @@ const useNotification = (typeParam = null, driverParam = null) => {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
function notification(): any {
|
|
36
36
|
return useNotification()
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -108,11 +108,27 @@ function isMergeableObject(item: any): item is Object {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Create a new subset object by providing keys.
|
|
112
|
+
*
|
|
113
|
+
* @category Object
|
|
114
|
+
*/
|
|
115
|
+
export function objectPick<O extends object, T extends keyof O>(obj: O, keys: T[], omitUndefined = false) {
|
|
116
|
+
return keys.reduce((n, k) => {
|
|
117
|
+
if (k in obj) {
|
|
118
|
+
if (!omitUndefined || obj[k] !== undefined)
|
|
119
|
+
n[k] = obj[k]
|
|
120
|
+
}
|
|
121
|
+
return n
|
|
122
|
+
}, {} as Pick<O, T>)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Clear undefined fields from an object. It mutates the object.
|
|
112
127
|
*
|
|
113
128
|
* @category Object
|
|
114
129
|
*/
|
|
115
130
|
export function clearUndefined<T extends object>(obj: T): T {
|
|
131
|
+
// @ts-expect-error some description
|
|
116
132
|
Object.keys(obj).forEach((key: string) => (obj[key] === undefined ? delete obj[key] : {}))
|
|
117
133
|
return obj
|
|
118
134
|
}
|
package/core/path/package.json
CHANGED
package/core/push/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/push",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks Push integration",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@maizzle/framework": "
|
|
47
|
+
"@maizzle/framework": "^4.3.1",
|
|
48
48
|
"@novu/node": "^0.10.2",
|
|
49
49
|
"@novu/stateless": "^0.10.2",
|
|
50
50
|
"@stacksjs/cli": "workspace:*",
|
package/core/router/package.json
CHANGED
package/core/server/package.json
CHANGED
package/core/sms/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/sms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks SMS integration. Painlessly create & manage your inboxes, templates, and send sms.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"sms",
|
|
21
|
-
"ses",
|
|
22
21
|
"stacks",
|
|
23
22
|
"gupshup",
|
|
24
23
|
"nexmo",
|
|
@@ -50,7 +49,6 @@
|
|
|
50
49
|
"typecheck": "tsc --noEmit"
|
|
51
50
|
},
|
|
52
51
|
"peerDependencies": {
|
|
53
|
-
"@maizzle/framework": "latest",
|
|
54
52
|
"@novu/gupshup": "^0.10.2",
|
|
55
53
|
"@novu/nexmo": "^0.10.2",
|
|
56
54
|
"@novu/node": "^0.10.2",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url'
|
|
2
2
|
import fs from 'fs-extra'
|
|
3
|
-
import detectIndent from '
|
|
4
|
-
import { detectNewline } from 'detect-newline'
|
|
3
|
+
import { detectIndent, detectNewline } from '@stacksjs/utils'
|
|
5
4
|
import type { JsonFile, TextFile } from '@stacksjs/types'
|
|
6
5
|
import { componentsPath, dirname, functionsPath, join, projectPath } from '@stacksjs/path'
|
|
7
6
|
import { contains } from '@stacksjs/arrays'
|
|
@@ -200,7 +199,6 @@ export const filesystem = {
|
|
|
200
199
|
doesFolderExist,
|
|
201
200
|
fs, // potentially refactor to `...fs` but, currently, there is an issues when building @stacksjs/config
|
|
202
201
|
// the problem is relating to https://github.com/microsoft/TypeScript/issues/5711#issuecomment-157793294
|
|
203
|
-
fileURLToPath,
|
|
204
202
|
}
|
|
205
203
|
|
|
206
204
|
export default filesystem
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + Vue</title>
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-ee90d6db.js"></script>
|
|
9
|
+
<link rel="stylesheet" href="/assets/index-b1ae86b3.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="app"></div>
|
|
13
|
+
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
package/core/tables/package.json
CHANGED
package/core/types/package.json
CHANGED
package/core/types/src/cli.ts
CHANGED
|
@@ -32,9 +32,9 @@ export interface CliOptions {
|
|
|
32
32
|
/**
|
|
33
33
|
* **CLI Debug Level**
|
|
34
34
|
*
|
|
35
|
-
* When your application is in debug mode, a different level
|
|
36
|
-
* like stack traces, will be shown
|
|
37
|
-
*
|
|
35
|
+
* When your application is in debug mode, a different level
|
|
36
|
+
* of information, like stack traces, will be shown. When
|
|
37
|
+
* disabled, it defaults to the "normal experience."
|
|
38
38
|
*
|
|
39
39
|
* @default false
|
|
40
40
|
*/
|
|
@@ -177,7 +177,7 @@ export const enum NpmScript {
|
|
|
177
177
|
BuildStacks = 'build:stacks',
|
|
178
178
|
Clean = 'rimraf ./pnpm-lock.yaml ./node_modules/ ./.stacks/**/node_modules',
|
|
179
179
|
Dev = 'dev',
|
|
180
|
-
DevComponents = 'vite --config
|
|
180
|
+
DevComponents = 'vite --config ./core/build/src/vue-components.ts',
|
|
181
181
|
DevDocs = 'dev:docs',
|
|
182
182
|
DevDesktop = 'dev:desktop',
|
|
183
183
|
DevPages = 'dev:pages',
|
package/core/ui/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks atomic UI engine, powered by UnoCSS.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@stacksjs/build": "workspace:*",
|
|
54
54
|
"@stacksjs/config": "workspace:*",
|
|
55
55
|
"@unocss/transformer-compile-class": "^0.48.4",
|
|
56
|
-
"pinia": "^2.0.
|
|
56
|
+
"pinia": "^2.0.29",
|
|
57
57
|
"unocss": "^0.48.4",
|
|
58
58
|
"vue": "^3.2.45",
|
|
59
59
|
"vue-tsc": "^1.0.24"
|
|
@@ -11,7 +11,7 @@ else
|
|
|
11
11
|
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
12
|
fi
|
|
13
13
|
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/rimraf@4.0.
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/rimraf@4.0.7/node_modules/rimraf/dist/cjs/src/bin.js" "$@"
|
|
15
15
|
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/rimraf@4.0.
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/rimraf@4.0.7/node_modules/rimraf/dist/cjs/src/bin.js" "$@"
|
|
17
17
|
fi
|
package/core/utils/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks helper functions.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"fast-glob": "^3.2.12",
|
|
67
67
|
"kolorist": "1.6.0",
|
|
68
68
|
"p-limit": "^4.0.0",
|
|
69
|
-
"rimraf": "^4.0.
|
|
69
|
+
"rimraf": "^4.0.7",
|
|
70
70
|
"throttle-debounce": "^5.0.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
package/core/utils/src/base.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const assert = (condition: boolean, message: string): asserts condition => {
|
|
2
|
+
if (!condition)
|
|
3
|
+
throw new Error(message)
|
|
4
|
+
}
|
|
5
|
+
|
|
5
6
|
export const toString = (v: any) => Object.prototype.toString.call(v)
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
export const noop = () => {}
|
|
7
9
|
|
|
8
10
|
export const loop = (times: number, callback: any) => {
|
|
9
11
|
[...Array(times)].forEach((item, i) => callback(i))
|
|
10
12
|
}
|
|
13
|
+
|
|
14
|
+
export const getTypeName = (v: any) => {
|
|
15
|
+
if (v === null)
|
|
16
|
+
return 'null'
|
|
17
|
+
const type = toString(v).slice(8, -1).toLowerCase()
|
|
18
|
+
return typeof v === 'object' || typeof v === 'function' ? type : typeof v
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getTypeName } from './base'
|
|
2
|
+
|
|
3
|
+
export function isDeepEqual(value1: any, value2: any): boolean {
|
|
4
|
+
const type1 = getTypeName(value1)
|
|
5
|
+
const type2 = getTypeName(value2)
|
|
6
|
+
if (type1 !== type2)
|
|
7
|
+
return false
|
|
8
|
+
|
|
9
|
+
if (type1 === 'array') {
|
|
10
|
+
if (value1.length !== value2.length)
|
|
11
|
+
return false
|
|
12
|
+
|
|
13
|
+
return value1.every((item: any, i: number) => {
|
|
14
|
+
return isDeepEqual(item, value2[i])
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
if (type1 === 'object') {
|
|
18
|
+
const keyArr = Object.keys(value1)
|
|
19
|
+
if (keyArr.length !== Object.keys(value2).length)
|
|
20
|
+
return false
|
|
21
|
+
|
|
22
|
+
return keyArr.every((key: string) => {
|
|
23
|
+
return isDeepEqual(value1[key], value2[key])
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
return Object.is(value1, value2)
|
|
27
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { CliOptions, Manifest, NpmScript } from '@stacksjs/types'
|
|
|
3
3
|
import { frameworkPath, projectPath } from '@stacksjs/path'
|
|
4
4
|
import storage from '@stacksjs/storage'
|
|
5
5
|
import { ui } from '@stacksjs/config'
|
|
6
|
+
import detectIndent from 'detect-indent'
|
|
6
7
|
|
|
7
8
|
export async function isProjectCreated() {
|
|
8
9
|
if (storage.isFile('.env'))
|
|
@@ -130,5 +131,5 @@ export function hasScript(manifest: Manifest, script: NpmScript): boolean {
|
|
|
130
131
|
|
|
131
132
|
export * from '@dinero.js/currencies'
|
|
132
133
|
export * from 'dinero.js'
|
|
133
|
-
export
|
|
134
|
+
export { detectIndent }
|
|
134
135
|
export { detectNewline } from 'detect-newline'
|
package/core/utils/src/index.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { assert, toString, noop, loop, getTypeName } from './base'
|
|
2
|
+
export * from './equal'
|
|
2
3
|
export * from './helpers'
|
|
3
|
-
export
|
|
4
|
+
export type { SingletonPromiseReturn, ControlledPromise } from './promise'
|
|
5
|
+
export { createSingletonPromise, createPromiseLock, createControlledPromise, sleep } from './promise'
|
|
4
6
|
export * from './function'
|
|
5
7
|
export * from './guards'
|
|
6
|
-
export
|
|
8
|
+
export { isDef, isBoolean, isFunction, isNumber, isString, isObject, isWindow, isBrowser, isServer, isMap, isSet, isPromise } from './is'
|
|
7
9
|
export * from './p'
|
|
8
10
|
export * from './vendor'
|
|
9
11
|
|
|
10
12
|
export * from '@vueuse/core'
|
|
11
13
|
export * from '@vueuse/math'
|
|
12
|
-
// export * from '@vueuse/head'
|
|
13
14
|
export * from '@vueuse/shared'
|
package/core/utils/src/is.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { toString } from './base'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// export const isWindow = (val: any): boolean => typeof window !== 'undefined' && toString(val) === '[object Window]'
|
|
3
|
+
export const isDef = <T = any>(val?: T): val is T => typeof val !== 'undefined'
|
|
4
|
+
export const isBoolean = (val: any): val is boolean => typeof val === 'boolean'
|
|
5
|
+
export const isFunction = <T extends Function> (val: any): val is T => typeof val === 'function'
|
|
6
|
+
export const isNumber = (val: any): val is number => typeof val === 'number'
|
|
7
|
+
export const isString = (val: unknown): val is string => typeof val === 'string'
|
|
8
|
+
export const isObject = (val: any): val is object => toString(val) === '[object Object]'
|
|
9
|
+
export const isWindow = (val: any): boolean => typeof window !== 'undefined' && toString(val) === '[object Window]'
|
|
11
10
|
export const isBrowser = typeof window !== 'undefined'
|
|
12
11
|
export const isServer = typeof document === 'undefined' // https://remix.run/docs/en/v1/pages/gotchas#typeof-window-checks
|
|
12
|
+
export const isMap = (val: any): val is Map<any, any> => toString(val) === '[object Map]'
|
|
13
|
+
export const isSet = (val: any): val is Set<any> => toString(val) === '[object Set]'
|
|
14
|
+
export const isPromise = <T = any>(val: any): val is Promise<T> => isObject(val) && isFunction(val.then) && isFunction(val.catch)
|
package/core/utils/src/p.ts
CHANGED
|
@@ -81,10 +81,11 @@ class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
|
81
81
|
|
|
82
82
|
then(fn?: () => PromiseLike<any>) {
|
|
83
83
|
const p = this.promise
|
|
84
|
+
|
|
84
85
|
if (fn)
|
|
85
86
|
return p.then(fn)
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
return p
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
catch(fn?: (err: unknown) => PromiseLike<any>) {
|
|
@@ -103,7 +104,7 @@ class PInstance<T = any> extends Promise<Awaited<T>[]> {
|
|
|
103
104
|
* @category Promise
|
|
104
105
|
* @example
|
|
105
106
|
* ```
|
|
106
|
-
* import { p } from '@
|
|
107
|
+
* import { p } from '@stacksjs/utils'
|
|
107
108
|
*
|
|
108
109
|
* const items = [1, 2, 3, 4, 5]
|
|
109
110
|
*
|
|
@@ -1,22 +1,48 @@
|
|
|
1
1
|
import { remove } from '@stacksjs/arrays'
|
|
2
2
|
import type { Fn } from '@stacksjs/types'
|
|
3
3
|
|
|
4
|
+
export interface SingletonPromiseReturn<T> {
|
|
5
|
+
(): Promise<T>
|
|
6
|
+
/**
|
|
7
|
+
* Reset current staled promise.
|
|
8
|
+
* Await it to have proper shutdown.
|
|
9
|
+
*/
|
|
10
|
+
reset: () => Promise<void>
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
14
|
+
* Promise with `resolve` and `reject` methods of itself
|
|
15
|
+
*/
|
|
16
|
+
export interface ControlledPromise<T = void> extends Promise<T> {
|
|
17
|
+
resolve(value: T | PromiseLike<T>): void
|
|
18
|
+
reject(reason?: any): void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Create singleton promise function.
|
|
6
23
|
*
|
|
7
24
|
* @category Promise
|
|
8
25
|
*/
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
export function createSingletonPromise<T>(fn: () => Promise<T>): SingletonPromiseReturn<T> {
|
|
27
|
+
let _promise: Promise<T> | undefined
|
|
28
|
+
|
|
29
|
+
function wrapper() {
|
|
30
|
+
if (!_promise)
|
|
31
|
+
_promise = fn()
|
|
32
|
+
return _promise
|
|
33
|
+
}
|
|
34
|
+
wrapper.reset = async () => {
|
|
35
|
+
const _prev = _promise
|
|
36
|
+
_promise = undefined
|
|
37
|
+
if (_prev)
|
|
38
|
+
await _prev
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return wrapper
|
|
16
42
|
}
|
|
17
43
|
|
|
18
44
|
/**
|
|
19
|
-
* Create a promise lock
|
|
45
|
+
* Create a promise lock.
|
|
20
46
|
*
|
|
21
47
|
* @category Promise
|
|
22
48
|
* @example
|
|
@@ -57,14 +83,6 @@ export function createPromiseLock() {
|
|
|
57
83
|
}
|
|
58
84
|
}
|
|
59
85
|
|
|
60
|
-
/**
|
|
61
|
-
* Promise with `resolve` and `reject` methods of itself
|
|
62
|
-
*/
|
|
63
|
-
export interface ControlledPromise<T = void> extends Promise<T> {
|
|
64
|
-
resolve(value: T | PromiseLike<T>): void
|
|
65
|
-
reject(reason?: any): void
|
|
66
|
-
}
|
|
67
|
-
|
|
68
86
|
/**
|
|
69
87
|
* Return a Promise with `resolve` and `reject` methods
|
|
70
88
|
*
|
|
@@ -89,3 +107,18 @@ export function createControlledPromise<T>(): ControlledPromise<T> {
|
|
|
89
107
|
promise.reject = reject
|
|
90
108
|
return promise
|
|
91
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Promised `setTimeout`.
|
|
113
|
+
*
|
|
114
|
+
* @category Promise
|
|
115
|
+
*/
|
|
116
|
+
export function sleep(ms: number, callback?: Fn<any>) {
|
|
117
|
+
return new Promise<void>(resolve =>
|
|
118
|
+
|
|
119
|
+
setTimeout(async () => {
|
|
120
|
+
await callback?.()
|
|
121
|
+
resolve()
|
|
122
|
+
}, ms),
|
|
123
|
+
)
|
|
124
|
+
}
|
package/core/x-ray/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stacks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.49.
|
|
4
|
+
"version": "0.49.2",
|
|
5
5
|
"packageManager": "pnpm@7.25.0",
|
|
6
6
|
"description": "The Stacks framework.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"web-types": "./web-types.json",
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@stacksjs/buddy": "0.49.
|
|
68
|
+
"@stacksjs/buddy": "0.49.2"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"buddy": "esno ./buddy/src/cli.ts",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
-
esac
|
|
7
|
-
|
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
-
else
|
|
11
|
-
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
-
fi
|
|
13
|
-
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/@maizzle+framework@4.3.1_glob@7.2.3/node_modules/@maizzle/framework/bin/maizzle" "$@"
|
|
15
|
-
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/@maizzle+framework@4.3.1_glob@7.2.3/node_modules/@maizzle/framework/bin/maizzle" "$@"
|
|
17
|
-
fi
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
-
|
|
4
|
-
case `uname` in
|
|
5
|
-
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
-
esac
|
|
7
|
-
|
|
8
|
-
if [ -z "$NODE_PATH" ]; then
|
|
9
|
-
export NODE_PATH="/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
-
else
|
|
11
|
-
export NODE_PATH="$NODE_PATH:/home/runner/work/stacks/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
-
fi
|
|
13
|
-
if [ -x "$basedir/node" ]; then
|
|
14
|
-
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/@maizzle+framework@4.3.1_glob@7.2.3/node_modules/@maizzle/framework/bin/maizzle" "$@"
|
|
15
|
-
else
|
|
16
|
-
exec node "$basedir/../../../../../node_modules/.pnpm/@maizzle+framework@4.3.1_glob@7.2.3/node_modules/@maizzle/framework/bin/maizzle" "$@"
|
|
17
|
-
fi
|