Skip to content

Commit 1a001de

Browse files
committed
chore: wip
chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip
1 parent 6903e61 commit 1a001de

File tree

20 files changed

+427
-408
lines changed

20 files changed

+427
-408
lines changed

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ ide:
1818
- any: ['.stacks/ide/**', '!.stacks/ide/package.json', '!.stacks/ide/**/package.json']
1919

2020
jetbrains:
21-
- any: [ '.stacks/ide/jetbrains/**', '!.stacks/ide/jetbrains/package.json']
21+
- any: ['.stacks/ide/jetbrains/**', '!.stacks/ide/jetbrains/package.json']
2222

2323
vscode:
24-
- any: [ '.stacks/ide/vscode/**', '!.stacks/ide/vscode/package.json']
24+
- any: ['.stacks/ide/vscode/**', '!.stacks/ide/vscode/package.json']
2525

2626
libs:
2727
- any: ['.stacks/libs/**', '!.stacks/libs/**/package.json']

.stacks/auto-imports.d.ts

Lines changed: 110 additions & 180 deletions
Large diffs are not rendered by default.

.stacks/core/arrays/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './arr'
2-
// export * as arr from './arr'
3-
// export * from './macro'
2+
export * as arr from './arr'
3+
export * from './macro'

.stacks/core/cli/src/console.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,3 @@ export class Prompt {
7474
}
7575

7676
export const prompt = new Prompt()
77-
78-
export { log }

.stacks/core/cli/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ export * from './parse'
66
export * from './run'
77
export * from './spinner'
88
export * from './utilities'
9-
10-
export { ExitCode } from '@stacksjs/types'

.stacks/core/config/build.config.ts

Lines changed: 97 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,135 @@ export default defineBuildConfig({
55
entries,
66

77
externals: [
8+
'unocss',
9+
'@novu/stateless',
10+
'meilisearch',
11+
'vue',
12+
'@vinejs/vine',
13+
'vite-plugin-pwa',
14+
'vite-plugin-inspect',
15+
'neverthrow',
16+
'cac',
17+
'execa',
18+
'unplugin-vue-components',
19+
'vite-ssg',
20+
'vite',
21+
'vitepress',
22+
'unplugin-auto-import',
23+
'ora',
824
'stacks',
25+
'stacks/actions',
26+
'stacks/ai',
27+
'stacks/alias',
28+
'stacks/analytics',
29+
'stacks/arrays',
30+
'stacks/auth',
31+
'stacks/buddy',
32+
'stacks/build',
33+
'stacks/cache',
34+
'stacks/chat',
35+
'stacks/cli',
36+
'stacks/cloud',
37+
'stacks/collections',
38+
'stacks/config',
39+
'stacks/database',
40+
'stacks/datetime',
41+
'stacks/desktop',
42+
'stacks/development',
43+
'stacks/dns',
44+
'stacks/docs',
45+
'stacks/email',
46+
'stacks/error-handling',
47+
'stacks/events',
48+
'stacks/faker',
49+
'stacks/git',
50+
'stacks/health',
51+
'stacks/lint',
52+
'stacks/logging',
53+
'stacks/notifications',
54+
'stacks/objects',
55+
'stacks/orm',
56+
'stacks/path',
57+
'stacks/payments',
58+
'stacks/push',
59+
'stacks/query-builder',
60+
'stacks/queue',
61+
'stacks/realtime',
62+
'stacks/repl',
63+
'stacks/router',
64+
'stacks/scheduler',
65+
'stacks/search-engine',
66+
'stacks/security',
67+
'stacks/server',
68+
'stacks/signals',
69+
'stacks/slug',
70+
'stacks/sms',
71+
'stacks/storage',
72+
'stacks/strings',
73+
'stacks/tinker',
74+
'stacks/testing',
75+
'stacks/types',
76+
'stacks/ui',
977
'stacks/utils',
1078
'stacks/validation',
11-
'stacks/path',
79+
'stacks/vite',
80+
'stacks/vite-plugin',
81+
'@stacksjs/actions',
1282
'@stacksjs/ai',
1383
'@stacksjs/alias',
1484
'@stacksjs/analytics',
85+
'@stacksjs/arrays',
1586
'@stacksjs/auth',
1687
'@stacksjs/buddy',
1788
'@stacksjs/build',
89+
'@stacksjs/cache',
1890
'@stacksjs/chat',
91+
'@stacksjs/cli',
92+
'@stacksjs/cloud',
93+
'@stacksjs/collections',
94+
'@stacksjs/config',
1995
'@stacksjs/database',
2096
'@stacksjs/datetime',
2197
'@stacksjs/desktop',
98+
'@stacksjs/development',
99+
'@stacksjs/dns',
100+
'@stacksjs/docs',
22101
'@stacksjs/email',
102+
'@stacksjs/error-handling',
23103
'@stacksjs/events',
104+
'@stacksjs/faker',
105+
'@stacksjs/git',
24106
'@stacksjs/health',
107+
'@stacksjs/lint',
108+
'@stacksjs/logging',
25109
'@stacksjs/notifications',
26110
'@stacksjs/objects',
27111
'@stacksjs/orm',
112+
'@stacksjs/path',
28113
'@stacksjs/payments',
29114
'@stacksjs/push',
115+
'@stacksjs/query-builder',
30116
'@stacksjs/queue',
31117
'@stacksjs/realtime',
118+
'@stacksjs/repl',
32119
'@stacksjs/router',
33120
'@stacksjs/scheduler',
121+
'@stacksjs/search-engine',
34122
'@stacksjs/security',
35-
'@stacksjs/slug',
36-
'@stacksjs/sms',
37-
'@stacksjs/dns',
38-
'@stacksjs/cloud',
39-
'@stacksjs/cache',
40-
'@stacksjs/query-builder',
41-
'@stacksjs/actions',
42123
'@stacksjs/server',
43124
'@stacksjs/signals',
44-
'@stacksjs/search-engine',
45-
'@stacksjs/arrays',
46-
'@stacksjs/strings',
47-
'@stacksjs/cli',
48-
'@stacksjs/docs',
49-
'@stacksjs/repl',
50-
'@stacksjs/vite',
51-
'@stacksjs/ui',
52-
'@stacksjs/lint',
53-
'@stacksjs/logging',
54-
'@stacksjs/collections',
55-
'@stacksjs/faker',
56-
'@stacksjs/git',
57-
'@stacksjs/error-handling',
125+
'@stacksjs/slug',
126+
'@stacksjs/sms',
58127
'@stacksjs/storage',
59-
'@stacksjs/path',
128+
'@stacksjs/strings',
129+
'@stacksjs/tinker',
130+
'@stacksjs/testing',
60131
'@stacksjs/types',
132+
'@stacksjs/ui',
61133
'@stacksjs/utils',
62134
'@stacksjs/validation',
63-
'@stacksjs/development',
64-
'@stacksjs/testing',
135+
'@stacksjs/vite',
136+
'@stacksjs/vite-plugin',
65137
],
66138

67139
rollup: {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { logsPath } from 'stacks/path'
2+
import type { StacksError, ValidationError } from 'stacks/types'
3+
import { fs } from 'stacks/storage'
4+
import { log } from 'stacks/logging'
5+
import { italic } from 'stacks/cli'
6+
7+
export class ErrorHandler {
8+
static logFile = logsPath('errors.log')
9+
10+
static handle(err: StacksError, options?: any) {
11+
this.writeErrorToConsole(err, options)
12+
this.writeErrorToFile(err)
13+
}
14+
15+
static handleError(err: Error, options?: any) {
16+
this.handle(err, options)
17+
}
18+
19+
static writeErrorToFile(err: StacksError) {
20+
let formattedError: string
21+
22+
if (isErrorOfTypeValidation(err))
23+
formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.messages}\n`
24+
else
25+
formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}\n`
26+
27+
fs.appendFile(this.logFile, formattedError, 'utf8')
28+
.catch((err) => {
29+
log.error(`Failed to write error to ./storage/logs/errors.log: ${italic(err.message)}`, err)
30+
})
31+
}
32+
33+
static writeErrorToConsole(err: StacksError, options?: any) {
34+
log.error(err, options)
35+
}
36+
}
37+
38+
export function handleError(err: StacksError, options?: any): void {
39+
ErrorHandler.handle(err, options)
40+
}
41+
42+
function isErrorOfTypeValidation(err: any): err is ValidationError {
43+
return err && typeof err.message === 'string'
44+
}
Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,2 @@
1-
import { fs } from '@stacksjs/storage'
2-
import { italic, log } from '@stacksjs/cli'
3-
import { logsPath } from '@stacksjs/path'
4-
5-
import type { StacksError, ValidationError } from '@stacksjs/types'
6-
7-
export {
8-
Err,
9-
Ok,
10-
Result,
11-
ResultAsync,
12-
err,
13-
errAsync,
14-
fromPromise,
15-
fromSafePromise,
16-
fromThrowable,
17-
ok,
18-
okAsync,
19-
} from 'neverthrow'
20-
21-
class ErrorHandler {
22-
static logFile = logsPath('errors.log')
23-
24-
static handle(err: StacksError, options?: any) {
25-
this.writeErrorToConsole(err, options)
26-
this.writeErrorToFile(err)
27-
}
28-
29-
static handleError(err: Error, options?: any) {
30-
this.handle(err, options)
31-
}
32-
33-
static writeErrorToFile(err: StacksError) {
34-
let formattedError: string
35-
36-
if (isErrorOfTypeValidation(err))
37-
formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.messages}\n`
38-
else
39-
formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}\n`
40-
41-
fs.appendFile(this.logFile, formattedError, 'utf8')
42-
.catch((err) => {
43-
log.error(`Failed to write error to ./storage/logs/errors.log: ${italic(err.message)}`, err)
44-
})
45-
}
46-
47-
static writeErrorToConsole(err: StacksError, options?: any) {
48-
log.error(err, options)
49-
}
50-
}
51-
52-
function isErrorOfTypeValidation(err: any): err is ValidationError {
53-
return err && typeof err.message === 'string'
54-
}
55-
56-
export function handleError(err: StacksError, options?: any): void {
57-
ErrorHandler.handle(err, options)
58-
}
1+
export * from './handler'
2+
export { err, errAsync, fromPromise, fromSafePromise, fromThrowable, ok, okAsync, Err, Ok, Result, ResultAsync } from 'neverthrow'

.stacks/core/objects/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"dev": "unbuild --stub",
4343
"typecheck": "tsc --noEmit"
4444
},
45+
"peerDependencies": {
46+
"@stacksjs/collections": "workspace:*",
47+
"@stacksjs/types": "workspace:*"
48+
},
4549
"dependencies": {
4650
"@stacksjs/collections": "workspace:*",
4751
"@stacksjs/types": "workspace:*",

.stacks/core/objects/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { notNullish } from '@stacksjs/utils'
22
import { isObject } from '@stacksjs/validation'
33
import type { DeepMerge } from '@stacksjs/types'
44

5-
export { Collection, collect } from '@stacksjs/collections'
5+
export * from '@stacksjs/collections'
66

77
/**
88
* Map key/value pairs for an object, and construct a new one
@@ -141,7 +141,7 @@ export function clearUndefined<T extends object>(obj: T): T {
141141
* @category Object
142142
*/
143143
export function hasOwnProperty<T>(obj: T, v: PropertyKey) {
144-
if (obj == null)
145-
return false
146-
return Object.prototype.hasOwnProperty.call(obj, v)
144+
return obj == null
145+
? false
146+
: Object.prototype.hasOwnProperty.call(obj, v)
147147
}

0 commit comments

Comments
 (0)