stacks 0.58.56 → 0.58.58
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/core/actions/dist/src/index.js +9 -3
- package/core/actions/dist/src/release.js +9 -3
- package/core/actions/dist/src/upgrade.js +1 -1
- package/core/actions/package.json +1 -1
- package/core/actions/src/action.ts +11 -3
- package/core/ai/dist/index.js +4 -4
- package/core/ai/package.json +3 -3
- package/core/alias/package.json +1 -1
- package/core/analytics/package.json +1 -1
- package/core/api/package.json +1 -1
- package/core/arrays/package.json +1 -1
- package/core/auth/package.json +1 -1
- package/core/buddy/dist/{chunk-d52e40a990b45728.js → chunk-e9c0ec1a3b7be088.js} +120 -92
- package/core/buddy/dist/cli.js +1 -1
- package/core/buddy/dist/index.js +1 -1
- package/core/buddy/package.json +1 -1
- package/core/buddy/src/commands/configure.ts +38 -27
- package/core/buddy/src/commands/deploy.ts +81 -56
- package/core/buddy/src/commands/setup.ts +11 -9
- package/core/build/package.json +1 -1
- package/core/bun-create/bud/package.json +1 -1
- package/core/bun-create/buddy/package.json +1 -1
- package/core/bun-create/stack/package.json +1 -1
- package/core/bun-create/stacks/package.json +1 -1
- package/core/bun-create/stx/package.json +1 -1
- package/core/bun-plugin-yaml/package.json +1 -1
- package/core/cache/package.json +2 -2
- package/core/chat/package.json +8 -8
- package/core/cli/dist/index.js +7 -1
- package/core/cli/package.json +1 -1
- package/core/cli/src/exec.ts +8 -0
- package/core/cloud/deploy.ts +3 -2
- package/core/cloud/dist/index.js +145 -54
- package/core/cloud/package.json +28 -28
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package-lock.json +6 -6
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +2 -2
- package/core/cloud/src/cloud/index.ts +76 -50
- package/core/cloud/src/cloud/queue.ts +106 -9
- package/core/cloud/src/cloud/router-layer/nodejs/package.json +2 -2
- package/core/collections/package.json +1 -1
- package/core/config/package.json +1 -1
- package/core/database/package.json +1 -1
- package/core/datetime/package.json +1 -1
- package/core/desktop/package.json +9 -9
- package/core/development/package.json +1 -1
- package/core/dns/package.json +4 -4
- package/core/docs/package.json +1 -1
- package/core/email/package.json +12 -12
- package/core/enums/package.json +1 -1
- package/core/env/package.json +1 -1
- package/core/error-handling/package.json +1 -1
- package/core/eslint-config/package.json +1 -1
- package/core/events/package.json +1 -1
- package/core/faker/package.json +1 -1
- package/core/git/package.json +1 -1
- package/core/health/package.json +1 -1
- package/core/http/package.json +1 -1
- package/core/lint/package.json +1 -1
- package/core/logging/dist/index.js +161 -4
- package/core/logging/package.json +1 -1
- package/core/logging/src/index.ts +55 -12
- package/core/notifications/package.json +22 -22
- package/core/objects/package.json +1 -1
- package/core/orm/package.json +1 -1
- package/core/path/dist/index.js +1 -1
- package/core/path/package.json +1 -1
- package/core/path/src/index.ts +1 -1
- package/core/payments/package.json +1 -1
- package/core/push/package.json +5 -5
- package/core/query-builder/package.json +1 -1
- package/core/queue/dist/index.js +5 -1
- package/core/queue/package.json +1 -1
- package/core/queue/src/index.ts +5 -1
- package/core/raycast/package.json +1 -1
- package/core/realtime/package.json +1 -1
- package/core/repl/package.json +1 -1
- package/core/router/package.json +1 -1
- package/core/scheduler/dist/index.js +4 -0
- package/core/scheduler/package.json +1 -1
- package/core/scheduler/src/index.ts +1 -0
- package/core/scheduler/src/schedule.ts +5 -0
- package/core/search-engine/package.json +1 -1
- package/core/security/package.json +1 -1
- package/core/server/package.json +1 -1
- package/core/signals/package.json +1 -1
- package/core/slug/package.json +1 -1
- package/core/sms/package.json +11 -11
- package/core/storage/package.json +1 -1
- package/core/strings/package.json +1 -1
- package/core/tables/package.json +1 -1
- package/core/testing/package.json +1 -1
- package/core/tinker/package.json +1 -1
- package/core/tunnel/package.json +1 -1
- package/core/types/dist/index.js +8 -3
- package/core/types/package.json +3 -3
- package/core/types/src/configure.ts +7 -0
- package/core/types/src/cron-jobs.ts +14 -4
- package/core/ui/package.json +6 -6
- package/core/utils/dist/index.js +32 -1
- package/core/utils/package.json +1 -1
- package/core/utils/src/index.ts +1 -0
- package/core/utils/src/retry.ts +33 -0
- package/core/validation/package.json +1 -1
- package/core/vite/dist/index.js +1 -1
- package/core/vite/package.json +1 -1
- package/core/whois/package.json +1 -1
- package/core/x-ray/package.json +1 -1
- package/core/zsh-buddy/package.json +1 -1
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { Cluster, TaskDefinition } from 'aws-cdk-lib'
|
|
1
|
+
import type { Cluster, TaskDefinition } from 'aws-cdk-lib/aws-ecs'
|
|
2
2
|
import { aws_ec2 as ec2 } from 'aws-cdk-lib'
|
|
3
3
|
import type { Construct } from 'constructs'
|
|
4
|
+
import { pascalCase, slug } from '@stacksjs/strings'
|
|
5
|
+
import { fs } from '@stacksjs/storage'
|
|
6
|
+
import { path } from '@stacksjs/path'
|
|
4
7
|
import { Rule, Schedule } from 'aws-cdk-lib/aws-events'
|
|
5
8
|
import { EcsTask } from 'aws-cdk-lib/aws-events-targets'
|
|
6
9
|
import type { NestedCloudProps } from '../types'
|
|
@@ -11,19 +14,96 @@ export interface QueueStackProps extends NestedCloudProps {
|
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export class QueueStack {
|
|
17
|
+
scope: Construct
|
|
18
|
+
props: QueueStackProps
|
|
19
|
+
|
|
14
20
|
constructor(scope: Construct, props: QueueStackProps) {
|
|
15
|
-
|
|
21
|
+
this.scope = scope
|
|
22
|
+
this.props = props
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async init() {
|
|
26
|
+
const jobsDir = path.jobsPath()
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const jobFiles = await fs.readdir(jobsDir)
|
|
30
|
+
const actionFiles = await fs.readdir(actionsDir)
|
|
31
|
+
const jobs = []
|
|
32
|
+
|
|
33
|
+
// then, need to loop through all app/Jobs/*.ts and create a rule for each, potentially overwriting the Schedule.ts jobs
|
|
34
|
+
for (const file of jobFiles) {
|
|
35
|
+
if (!file.endsWith('.ts'))
|
|
36
|
+
continue
|
|
37
|
+
|
|
38
|
+
const filePath = path.jobsPath(file)
|
|
39
|
+
|
|
40
|
+
// Await the loading of the job module
|
|
41
|
+
jobs.push(await this.loadModule(filePath))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
for (const file of actionFiles) {
|
|
45
|
+
if (!file.endsWith('.ts'))
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
const filePath = path.actionsPath(file)
|
|
49
|
+
|
|
50
|
+
// Await the loading of the job module
|
|
51
|
+
jobs.push(await this.loadModule(filePath))
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const job of jobs)
|
|
55
|
+
await this.createQueueRule(job)
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
console.error('Error reading the jobs directory:', err)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Helper function to convert a rate string to a cron object for AWS Schedule
|
|
63
|
+
cronScheduleFromRate(rate: string): { minute?: string, hour?: string, month?: string, weekDay?: string, year?: string } {
|
|
64
|
+
// Assuming the rate is in standard cron format, split it to map to the AWS Schedule.cron() parameters
|
|
65
|
+
const parts = rate.split(' ')
|
|
66
|
+
return {
|
|
67
|
+
minute: parts[0],
|
|
68
|
+
hour: parts[1],
|
|
69
|
+
month: parts[2],
|
|
70
|
+
weekDay: parts[3],
|
|
71
|
+
year: parts[4],
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async loadModule(filePath: string) {
|
|
76
|
+
const jobModule = await import(filePath)
|
|
77
|
+
|
|
78
|
+
return jobModule
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
createQueueRule(job: any) {
|
|
82
|
+
// Now you can safely access job.default.rate
|
|
83
|
+
const rate = job.default?.rate
|
|
84
|
+
|
|
85
|
+
// if no rate or job is disabled, no need to schedule, skip
|
|
86
|
+
if (!rate || job.default?.enabled === false)
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
// Convert the rate to a Schedule object
|
|
90
|
+
const schedule = Schedule.cron(this.cronScheduleFromRate(rate))
|
|
91
|
+
|
|
92
|
+
const id = `QueueRule${pascalCase(file.replace('.ts', ''))}`
|
|
93
|
+
|
|
94
|
+
// Perform operations with the jobModule.default as needed
|
|
95
|
+
const rule = new Rule(this.scope, id, {
|
|
16
96
|
// schedule to run every second
|
|
17
|
-
ruleName: `${props.appName}-${props.appEnv}-queue-rule`,
|
|
18
|
-
schedule
|
|
97
|
+
ruleName: `${this.props.appName}-${this.props.appEnv}-queue-rule-${slug(file.replace('.ts', ''))}`,
|
|
98
|
+
schedule,
|
|
19
99
|
})
|
|
20
100
|
|
|
21
101
|
rule.addTarget(new EcsTask({
|
|
22
|
-
cluster: props.cluster,
|
|
23
|
-
taskDefinition: props.taskDefinition,
|
|
102
|
+
cluster: this.props.cluster,
|
|
103
|
+
taskDefinition: this.props.taskDefinition,
|
|
24
104
|
containerOverrides: [
|
|
25
105
|
{
|
|
26
|
-
containerName: `${props.appName}-${props.appEnv}-api`,
|
|
106
|
+
containerName: `${this.props.appName}-${this.props.appEnv}-api`,
|
|
27
107
|
environment: [
|
|
28
108
|
{
|
|
29
109
|
name: 'QUEUE_WORKER',
|
|
@@ -31,13 +111,30 @@ export class QueueStack {
|
|
|
31
111
|
},
|
|
32
112
|
{
|
|
33
113
|
name: 'JOB',
|
|
34
|
-
value:
|
|
114
|
+
value: file,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'JOB_BACKOFF_FACTOR',
|
|
118
|
+
value: jobModule.default?.backoffFactor,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'JOB_RETRIES',
|
|
122
|
+
value: jobModule.default?.tries,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'JOB_INITIAL_DELAY',
|
|
126
|
+
value: jobModule.default?.initialDelay,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'JOB_JITTER',
|
|
130
|
+
value: jobModule.default?.jitter,
|
|
35
131
|
},
|
|
36
132
|
],
|
|
37
133
|
},
|
|
38
134
|
],
|
|
39
135
|
|
|
40
|
-
retryAttempts:
|
|
136
|
+
retryAttempts: 1, // we utilize a custom retry mechanism in the job itself
|
|
137
|
+
// retryAttempts: jobModule.default.tries || 3,
|
|
41
138
|
|
|
42
139
|
subnetSelection: {
|
|
43
140
|
subnetType: ec2.SubnetType.PUBLIC, // SubnetType.PRIVATE_WITH_EGRESS
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stacks-router-layer",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.58",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@stacksjs/router": "^0.58.
|
|
13
|
+
"@stacksjs/router": "^0.58.57"
|
|
14
14
|
}
|
|
15
15
|
}
|
package/core/config/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/desktop",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.58",
|
|
5
5
|
"description": "The Stacks Desktop engine.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@stacksjs/build": "workspace:*",
|
|
64
64
|
"@stacksjs/server": "workspace:*",
|
|
65
|
-
"@tauri-apps/api": "1.5.3",
|
|
66
|
-
"@tauri-apps/cli": "1.5.9",
|
|
67
|
-
"unified-network": "0.6.4",
|
|
65
|
+
"@tauri-apps/api": "^1.5.3",
|
|
66
|
+
"@tauri-apps/cli": "^1.5.9",
|
|
67
|
+
"unified-network": "^0.6.4",
|
|
68
68
|
"unstorage": "^1.10.1",
|
|
69
|
-
"vue": "3.4.
|
|
69
|
+
"vue": "^3.4.16"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@stacksjs/build": "workspace:*",
|
|
73
73
|
"@stacksjs/server": "workspace:*",
|
|
74
|
-
"@tauri-apps/api": "1.5.3",
|
|
75
|
-
"@tauri-apps/cli": "1.5.9",
|
|
76
|
-
"unified-network": "0.6.4",
|
|
74
|
+
"@tauri-apps/api": "^1.5.3",
|
|
75
|
+
"@tauri-apps/cli": "^1.5.9",
|
|
76
|
+
"unified-network": "^0.6.4",
|
|
77
77
|
"unstorage": "^1.10.1",
|
|
78
|
-
"vue": "3.4.
|
|
78
|
+
"vue": "^3.4.16"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@stacksjs/development": "workspace:*"
|
package/core/dns/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/dns",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.58",
|
|
5
5
|
"description": "Easily manage your DNS.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"prepublishOnly": "bun --bun run build"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@aws-sdk/client-route-53": "^3.
|
|
55
|
-
"@aws-sdk/client-route-53-domains": "^3.
|
|
54
|
+
"@aws-sdk/client-route-53": "^3.509.0",
|
|
55
|
+
"@aws-sdk/client-route-53-domains": "^3.509.0",
|
|
56
56
|
"@stacksjs/actions": "workspace:*",
|
|
57
57
|
"@stacksjs/error-handling": "workspace:*",
|
|
58
58
|
"@stacksjs/path": "workspace:*",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"aws-cdk-lib": "^2.126.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aws-sdk/client-route-53": "^3.
|
|
64
|
+
"@aws-sdk/client-route-53": "^3.509.0",
|
|
65
65
|
"@stacksjs/actions": "workspace:*",
|
|
66
66
|
"@stacksjs/error-handling": "workspace:*",
|
|
67
67
|
"@stacksjs/path": "workspace:*",
|
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.58.
|
|
4
|
+
"version": "0.58.58",
|
|
5
5
|
"description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@maizzle/framework": "^4.7.5",
|
|
68
|
-
"@novu/stateless": "^0.23.
|
|
68
|
+
"@novu/stateless": "^0.23.1",
|
|
69
69
|
"@stacksjs/cli": "workspace:*",
|
|
70
70
|
"@stacksjs/config": "workspace:*",
|
|
71
71
|
"@stacksjs/error-handling": "workspace:*",
|
|
@@ -78,16 +78,16 @@
|
|
|
78
78
|
"uuid": "^9.0.1"
|
|
79
79
|
},
|
|
80
80
|
"optionalDependencies": {
|
|
81
|
-
"@novu/emailjs": "^0.23.
|
|
82
|
-
"@novu/mailgun": "^0.23.
|
|
83
|
-
"@novu/mailjet": "^0.23.
|
|
84
|
-
"@novu/mandrill": "^0.23.
|
|
85
|
-
"@novu/netcore": "^0.23.
|
|
86
|
-
"@novu/node": "^0.23.
|
|
87
|
-
"@novu/nodemailer": "^0.23.
|
|
88
|
-
"@novu/postmark": "^0.23.
|
|
89
|
-
"@novu/sendgrid": "^0.23.
|
|
90
|
-
"@novu/ses": "^0.23.
|
|
81
|
+
"@novu/emailjs": "^0.23.1",
|
|
82
|
+
"@novu/mailgun": "^0.23.1",
|
|
83
|
+
"@novu/mailjet": "^0.23.1",
|
|
84
|
+
"@novu/mandrill": "^0.23.1",
|
|
85
|
+
"@novu/netcore": "^0.23.1",
|
|
86
|
+
"@novu/node": "^0.23.1",
|
|
87
|
+
"@novu/nodemailer": "^0.23.1",
|
|
88
|
+
"@novu/postmark": "^0.23.1",
|
|
89
|
+
"@novu/sendgrid": "^0.23.1",
|
|
90
|
+
"@novu/ses": "^0.23.1"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@stacksjs/development": "workspace:*"
|
package/core/enums/package.json
CHANGED
package/core/env/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.58",
|
|
5
5
|
"description": "The Stacks.js ESLint config preset, heavily inspired by Anthony's ESLint config.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
7
7
|
"license": "MIT",
|
package/core/events/package.json
CHANGED
package/core/faker/package.json
CHANGED
package/core/git/package.json
CHANGED
package/core/health/package.json
CHANGED
package/core/http/package.json
CHANGED
package/core/lint/package.json
CHANGED
|
@@ -1776,7 +1776,7 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1776
1776
|
});
|
|
1777
1777
|
|
|
1778
1778
|
// src/index.ts
|
|
1779
|
-
import
|
|
1779
|
+
import process3 from "process";
|
|
1780
1780
|
|
|
1781
1781
|
// /home/runner/work/stacks/stacks/node_modules/consola/dist/index.mjs
|
|
1782
1782
|
init_consola_36c0034f();
|
|
@@ -1786,17 +1786,174 @@ init_utils();
|
|
|
1786
1786
|
|
|
1787
1787
|
// src/index.ts
|
|
1788
1788
|
import {ExitCode} from "@stacksjs/types";
|
|
1789
|
+
|
|
1790
|
+
// /home/runner/work/stacks/stacks/storage/framework/core/path/src/index.ts
|
|
1791
|
+
import process2 from "process";
|
|
1792
|
+
|
|
1793
|
+
// /home/runner/work/stacks/stacks/node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
1794
|
+
var normalizeWindowsPath = function(input = "") {
|
|
1795
|
+
if (!input) {
|
|
1796
|
+
return input;
|
|
1797
|
+
}
|
|
1798
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r2) => r2.toUpperCase());
|
|
1799
|
+
};
|
|
1800
|
+
var cwd = function() {
|
|
1801
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
1802
|
+
return process.cwd().replace(/\\/g, "/");
|
|
1803
|
+
}
|
|
1804
|
+
return "/";
|
|
1805
|
+
};
|
|
1806
|
+
var normalizeString = function(path, allowAboveRoot) {
|
|
1807
|
+
let res = "";
|
|
1808
|
+
let lastSegmentLength = 0;
|
|
1809
|
+
let lastSlash = -1;
|
|
1810
|
+
let dots = 0;
|
|
1811
|
+
let char = null;
|
|
1812
|
+
for (let index = 0;index <= path.length; ++index) {
|
|
1813
|
+
if (index < path.length) {
|
|
1814
|
+
char = path[index];
|
|
1815
|
+
} else if (char === "/") {
|
|
1816
|
+
break;
|
|
1817
|
+
} else {
|
|
1818
|
+
char = "/";
|
|
1819
|
+
}
|
|
1820
|
+
if (char === "/") {
|
|
1821
|
+
if (lastSlash === index - 1 || dots === 1)
|
|
1822
|
+
;
|
|
1823
|
+
else if (dots === 2) {
|
|
1824
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
1825
|
+
if (res.length > 2) {
|
|
1826
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
1827
|
+
if (lastSlashIndex === -1) {
|
|
1828
|
+
res = "";
|
|
1829
|
+
lastSegmentLength = 0;
|
|
1830
|
+
} else {
|
|
1831
|
+
res = res.slice(0, lastSlashIndex);
|
|
1832
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
1833
|
+
}
|
|
1834
|
+
lastSlash = index;
|
|
1835
|
+
dots = 0;
|
|
1836
|
+
continue;
|
|
1837
|
+
} else if (res.length > 0) {
|
|
1838
|
+
res = "";
|
|
1839
|
+
lastSegmentLength = 0;
|
|
1840
|
+
lastSlash = index;
|
|
1841
|
+
dots = 0;
|
|
1842
|
+
continue;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
if (allowAboveRoot) {
|
|
1846
|
+
res += res.length > 0 ? "/.." : "..";
|
|
1847
|
+
lastSegmentLength = 2;
|
|
1848
|
+
}
|
|
1849
|
+
} else {
|
|
1850
|
+
if (res.length > 0) {
|
|
1851
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
1852
|
+
} else {
|
|
1853
|
+
res = path.slice(lastSlash + 1, index);
|
|
1854
|
+
}
|
|
1855
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
1856
|
+
}
|
|
1857
|
+
lastSlash = index;
|
|
1858
|
+
dots = 0;
|
|
1859
|
+
} else if (char === "." && dots !== -1) {
|
|
1860
|
+
++dots;
|
|
1861
|
+
} else {
|
|
1862
|
+
dots = -1;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return res;
|
|
1866
|
+
};
|
|
1867
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
1868
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
1869
|
+
var resolve = function(...arguments_) {
|
|
1870
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
1871
|
+
let resolvedPath = "";
|
|
1872
|
+
let resolvedAbsolute = false;
|
|
1873
|
+
for (let index = arguments_.length - 1;index >= -1 && !resolvedAbsolute; index--) {
|
|
1874
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
1875
|
+
if (!path || path.length === 0) {
|
|
1876
|
+
continue;
|
|
1877
|
+
}
|
|
1878
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
1879
|
+
resolvedAbsolute = isAbsolute(path);
|
|
1880
|
+
}
|
|
1881
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
1882
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
1883
|
+
return `/${resolvedPath}`;
|
|
1884
|
+
}
|
|
1885
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1886
|
+
};
|
|
1887
|
+
var isAbsolute = function(p2) {
|
|
1888
|
+
return _IS_ABSOLUTE_RE.test(p2);
|
|
1889
|
+
};
|
|
1890
|
+
// /home/runner/work/stacks/stacks/storage/framework/core/path/src/index.ts
|
|
1891
|
+
function logsPath(path2) {
|
|
1892
|
+
return projectStoragePath(`logs/${path2 || ""}`);
|
|
1893
|
+
}
|
|
1894
|
+
function projectPath(filePath = "") {
|
|
1895
|
+
let path2 = process2.cwd();
|
|
1896
|
+
while (path2.includes("storage"))
|
|
1897
|
+
path2 = resolve(path2, "..");
|
|
1898
|
+
return resolve(path2, filePath);
|
|
1899
|
+
}
|
|
1900
|
+
function projectStoragePath(path2) {
|
|
1901
|
+
return projectPath(`storage/${path2 || ""}`);
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// src/index.ts
|
|
1905
|
+
async function writeToLogFile(message) {
|
|
1906
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}\n`;
|
|
1907
|
+
try {
|
|
1908
|
+
const file = Bun.file(logFilePath);
|
|
1909
|
+
const writer = file.writer();
|
|
1910
|
+
const text2 = await file.text();
|
|
1911
|
+
writer.write(`${text2}\n`);
|
|
1912
|
+
writer.write(`${formattedMessage}\n`);
|
|
1913
|
+
await writer.end();
|
|
1914
|
+
} catch (error) {
|
|
1915
|
+
const file = Bun.file(logFilePath);
|
|
1916
|
+
const writer = file.writer();
|
|
1917
|
+
writer.write(`${formattedMessage}\n`);
|
|
1918
|
+
await writer.end();
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1789
1921
|
function dump(...args) {
|
|
1790
|
-
|
|
1922
|
+
args.forEach((arg) => log.debug(arg));
|
|
1791
1923
|
}
|
|
1792
1924
|
function dd(...args) {
|
|
1793
1925
|
args.forEach((arg) => log.debug(arg));
|
|
1794
|
-
|
|
1926
|
+
process3.exit(ExitCode.FatalError);
|
|
1795
1927
|
}
|
|
1796
1928
|
var logger = consola;
|
|
1797
|
-
var
|
|
1929
|
+
var logFilePath = logsPath("console.log");
|
|
1930
|
+
var log = {
|
|
1931
|
+
info: async (...arg) => {
|
|
1932
|
+
consola.info(...arg);
|
|
1933
|
+
await writeToLogFile(`INFO: ${arg}`);
|
|
1934
|
+
},
|
|
1935
|
+
success: async (msg) => {
|
|
1936
|
+
consola.success(msg);
|
|
1937
|
+
await writeToLogFile(`SUCCESS: ${msg}`);
|
|
1938
|
+
},
|
|
1939
|
+
error: async (err, options) => {
|
|
1940
|
+
handleError(err, options);
|
|
1941
|
+
await writeToLogFile(`ERROR: ${err}`);
|
|
1942
|
+
},
|
|
1943
|
+
warn: async (arg) => {
|
|
1944
|
+
consola.warn(arg);
|
|
1945
|
+
await writeToLogFile(`WARN: ${arg}`);
|
|
1946
|
+
},
|
|
1947
|
+
debug: async (arg) => {
|
|
1948
|
+
consola.debug(arg);
|
|
1949
|
+
await writeToLogFile(`DEBUG: ${arg}`);
|
|
1950
|
+
},
|
|
1951
|
+
dump,
|
|
1952
|
+
dd
|
|
1953
|
+
};
|
|
1798
1954
|
export {
|
|
1799
1955
|
logger,
|
|
1956
|
+
logFilePath,
|
|
1800
1957
|
log,
|
|
1801
1958
|
dump,
|
|
1802
1959
|
dd
|