moriajs 0.1.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/README.md +380 -0
- package/apps/playground/dist/index.d.ts +8 -0
- package/apps/playground/dist/index.d.ts.map +1 -0
- package/apps/playground/dist/index.js +36 -0
- package/apps/playground/dist/index.js.map +1 -0
- package/apps/playground/node_modules/.bin/rimraf +17 -0
- package/apps/playground/node_modules/.bin/rimraf.CMD +12 -0
- package/apps/playground/node_modules/.bin/rimraf.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsc +17 -0
- package/apps/playground/node_modules/.bin/tsc.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsc.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsserver +17 -0
- package/apps/playground/node_modules/.bin/tsserver.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsserver.ps1 +41 -0
- package/apps/playground/node_modules/.bin/tsx +17 -0
- package/apps/playground/node_modules/.bin/tsx.CMD +12 -0
- package/apps/playground/node_modules/.bin/tsx.ps1 +41 -0
- package/apps/playground/package.json +25 -0
- package/apps/playground/src/index.ts +41 -0
- package/apps/playground/tsconfig.json +10 -0
- package/package.json +23 -0
- package/packages/auth/dist/index.d.ts +84 -0
- package/packages/auth/dist/index.d.ts.map +1 -0
- package/packages/auth/dist/index.js +78 -0
- package/packages/auth/dist/index.js.map +1 -0
- package/packages/auth/node_modules/.bin/rimraf +17 -0
- package/packages/auth/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/auth/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/auth/node_modules/.bin/tsc +17 -0
- package/packages/auth/node_modules/.bin/tsc.CMD +12 -0
- package/packages/auth/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/auth/node_modules/.bin/tsserver +17 -0
- package/packages/auth/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/auth/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/auth/package.json +34 -0
- package/packages/auth/src/index.ts +138 -0
- package/packages/auth/tsconfig.json +10 -0
- package/packages/cli/dist/bin.d.ts +7 -0
- package/packages/cli/dist/bin.d.ts.map +1 -0
- package/packages/cli/dist/bin.js +8 -0
- package/packages/cli/dist/bin.js.map +1 -0
- package/packages/cli/dist/index.d.ts +8 -0
- package/packages/cli/dist/index.d.ts.map +1 -0
- package/packages/cli/dist/index.js +60 -0
- package/packages/cli/dist/index.js.map +1 -0
- package/packages/cli/node_modules/.bin/rimraf +17 -0
- package/packages/cli/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/cli/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/cli/node_modules/.bin/tsc +17 -0
- package/packages/cli/node_modules/.bin/tsc.CMD +12 -0
- package/packages/cli/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/cli/node_modules/.bin/tsserver +17 -0
- package/packages/cli/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/cli/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/cli/package.json +33 -0
- package/packages/cli/src/bin.ts +10 -0
- package/packages/cli/src/index.ts +71 -0
- package/packages/cli/tsconfig.json +10 -0
- package/packages/core/dist/app.d.ts +42 -0
- package/packages/core/dist/app.d.ts.map +1 -0
- package/packages/core/dist/app.js +65 -0
- package/packages/core/dist/app.js.map +1 -0
- package/packages/core/dist/config.d.ts +61 -0
- package/packages/core/dist/config.d.ts.map +1 -0
- package/packages/core/dist/config.js +18 -0
- package/packages/core/dist/config.js.map +1 -0
- package/packages/core/dist/index.d.ts +13 -0
- package/packages/core/dist/index.d.ts.map +1 -0
- package/packages/core/dist/index.js +10 -0
- package/packages/core/dist/index.js.map +1 -0
- package/packages/core/dist/plugins.d.ts +38 -0
- package/packages/core/dist/plugins.d.ts.map +1 -0
- package/packages/core/dist/plugins.js +19 -0
- package/packages/core/dist/plugins.js.map +1 -0
- package/packages/core/node_modules/.bin/pino-pretty +17 -0
- package/packages/core/node_modules/.bin/pino-pretty.CMD +12 -0
- package/packages/core/node_modules/.bin/pino-pretty.ps1 +41 -0
- package/packages/core/node_modules/.bin/rimraf +17 -0
- package/packages/core/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/core/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/core/node_modules/.bin/tsc +17 -0
- package/packages/core/node_modules/.bin/tsc.CMD +12 -0
- package/packages/core/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/core/node_modules/.bin/tsserver +17 -0
- package/packages/core/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/core/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/core/package.json +35 -0
- package/packages/core/src/app.ts +103 -0
- package/packages/core/src/config.ts +66 -0
- package/packages/core/src/index.ts +14 -0
- package/packages/core/src/plugins.ts +42 -0
- package/packages/core/tsconfig.json +10 -0
- package/packages/create-moria/dist/bin.d.ts +7 -0
- package/packages/create-moria/dist/bin.d.ts.map +1 -0
- package/packages/create-moria/dist/bin.js +8 -0
- package/packages/create-moria/dist/bin.js.map +1 -0
- package/packages/create-moria/dist/index.d.ts +13 -0
- package/packages/create-moria/dist/index.d.ts.map +1 -0
- package/packages/create-moria/dist/index.js +142 -0
- package/packages/create-moria/dist/index.js.map +1 -0
- package/packages/create-moria/node_modules/.bin/rimraf +17 -0
- package/packages/create-moria/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/create-moria/node_modules/.bin/tsc +17 -0
- package/packages/create-moria/node_modules/.bin/tsc.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/create-moria/node_modules/.bin/tsserver +17 -0
- package/packages/create-moria/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/create-moria/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/create-moria/package.json +28 -0
- package/packages/create-moria/src/bin.ts +10 -0
- package/packages/create-moria/src/index.ts +168 -0
- package/packages/create-moria/tsconfig.json +10 -0
- package/packages/db/dist/index.d.ts +71 -0
- package/packages/db/dist/index.d.ts.map +1 -0
- package/packages/db/dist/index.js +89 -0
- package/packages/db/dist/index.js.map +1 -0
- package/packages/db/node_modules/.bin/rimraf +17 -0
- package/packages/db/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/db/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/db/node_modules/.bin/tsc +17 -0
- package/packages/db/node_modules/.bin/tsc.CMD +12 -0
- package/packages/db/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/db/node_modules/.bin/tsserver +17 -0
- package/packages/db/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/db/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/db/package.json +37 -0
- package/packages/db/src/index.ts +119 -0
- package/packages/db/tsconfig.json +10 -0
- package/packages/renderer/dist/index.d.ts +55 -0
- package/packages/renderer/dist/index.d.ts.map +1 -0
- package/packages/renderer/dist/index.js +85 -0
- package/packages/renderer/dist/index.js.map +1 -0
- package/packages/renderer/node_modules/.bin/rimraf +17 -0
- package/packages/renderer/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/renderer/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/renderer/node_modules/.bin/tsc +17 -0
- package/packages/renderer/node_modules/.bin/tsc.CMD +12 -0
- package/packages/renderer/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/renderer/node_modules/.bin/tsserver +17 -0
- package/packages/renderer/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/renderer/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/renderer/package.json +34 -0
- package/packages/renderer/src/index.ts +110 -0
- package/packages/renderer/tsconfig.json +14 -0
- package/packages/ui/dist/index.d.ts +76 -0
- package/packages/ui/dist/index.d.ts.map +1 -0
- package/packages/ui/dist/index.js +176 -0
- package/packages/ui/dist/index.js.map +1 -0
- package/packages/ui/node_modules/.bin/rimraf +17 -0
- package/packages/ui/node_modules/.bin/rimraf.CMD +12 -0
- package/packages/ui/node_modules/.bin/rimraf.ps1 +41 -0
- package/packages/ui/node_modules/.bin/tsc +17 -0
- package/packages/ui/node_modules/.bin/tsc.CMD +12 -0
- package/packages/ui/node_modules/.bin/tsc.ps1 +41 -0
- package/packages/ui/node_modules/.bin/tsserver +17 -0
- package/packages/ui/node_modules/.bin/tsserver.CMD +12 -0
- package/packages/ui/node_modules/.bin/tsserver.ps1 +41 -0
- package/packages/ui/package.json +29 -0
- package/packages/ui/src/index.ts +230 -0
- package/packages/ui/tsconfig.json +16 -0
- package/pnpm-workspace.yaml +3 -0
- package/tsconfig.base.json +25 -0
- package/turbo.json +35 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-moria",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Create a new MoriaJS project",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-moria": "./dist/bin.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"clean": "rimraf dist .turbo"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"cac": "^6.7.0",
|
|
18
|
+
"picocolors": "^1.1.0",
|
|
19
|
+
"prompts": "^2.4.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typescript": "^5.7.0",
|
|
23
|
+
"rimraf": "^6.0.0",
|
|
24
|
+
"@types/node": "^22.0.0",
|
|
25
|
+
"@types/prompts": "^2.4.0"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT"
|
|
28
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create-moria
|
|
3
|
+
*
|
|
4
|
+
* Interactive project scaffolder for MoriaJS.
|
|
5
|
+
* Supports both TypeScript and JavaScript projects.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx create-moria my-app
|
|
9
|
+
* npx create-moria my-app --typescript
|
|
10
|
+
* npx create-moria my-app --javascript
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { cac } from 'cac';
|
|
14
|
+
import pc from 'picocolors';
|
|
15
|
+
import prompts from 'prompts';
|
|
16
|
+
import { writeFileSync, mkdirSync, existsSync } from 'node:fs';
|
|
17
|
+
import { join, resolve } from 'node:path';
|
|
18
|
+
|
|
19
|
+
const VERSION = '0.1.0';
|
|
20
|
+
|
|
21
|
+
export const cli = cac('create-moria');
|
|
22
|
+
|
|
23
|
+
cli
|
|
24
|
+
.command('[project-name]', 'Create a new MoriaJS project')
|
|
25
|
+
.option('--typescript', 'Use TypeScript (default)')
|
|
26
|
+
.option('--javascript', 'Use JavaScript')
|
|
27
|
+
.option('--db <adapter>', 'Database adapter: pg | sqlite', { default: 'sqlite' })
|
|
28
|
+
.action(async (projectName?: string, options?: Record<string, unknown>) => {
|
|
29
|
+
console.log();
|
|
30
|
+
console.log(pc.cyan('🏔️ create-moria') + pc.dim(` v${VERSION}`));
|
|
31
|
+
console.log(pc.dim(' The MoriaJS project scaffolder'));
|
|
32
|
+
console.log();
|
|
33
|
+
|
|
34
|
+
// Interactive prompts if not provided via args
|
|
35
|
+
const answers = await prompts([
|
|
36
|
+
{
|
|
37
|
+
type: projectName ? null : 'text',
|
|
38
|
+
name: 'projectName',
|
|
39
|
+
message: 'Project name:',
|
|
40
|
+
initial: 'my-moria-app',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: options?.typescript || options?.javascript ? null : 'select',
|
|
44
|
+
name: 'language',
|
|
45
|
+
message: 'Language:',
|
|
46
|
+
choices: [
|
|
47
|
+
{ title: 'TypeScript', value: 'ts' },
|
|
48
|
+
{ title: 'JavaScript', value: 'js' },
|
|
49
|
+
],
|
|
50
|
+
initial: 0,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: options?.db ? null : 'select',
|
|
54
|
+
name: 'database',
|
|
55
|
+
message: 'Database:',
|
|
56
|
+
choices: [
|
|
57
|
+
{ title: 'SQLite (easy local development)', value: 'sqlite' },
|
|
58
|
+
{ title: 'PostgreSQL (production-ready)', value: 'pg' },
|
|
59
|
+
],
|
|
60
|
+
initial: 0,
|
|
61
|
+
},
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
const name = projectName ?? answers.projectName;
|
|
65
|
+
const lang = options?.javascript ? 'js' : (answers.language ?? 'ts');
|
|
66
|
+
const db = (options?.db as string) ?? answers.database ?? 'sqlite';
|
|
67
|
+
const dir = resolve(process.cwd(), name);
|
|
68
|
+
|
|
69
|
+
if (existsSync(dir)) {
|
|
70
|
+
console.log(pc.red(`Error: directory "${name}" already exists.`));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
console.log();
|
|
75
|
+
console.log(pc.green(`Creating MoriaJS project in ${pc.bold(dir)}`));
|
|
76
|
+
console.log(pc.dim(` Language: ${lang === 'ts' ? 'TypeScript' : 'JavaScript'}`));
|
|
77
|
+
console.log(pc.dim(` Database: ${db}`));
|
|
78
|
+
console.log();
|
|
79
|
+
|
|
80
|
+
// Create project structure
|
|
81
|
+
mkdirSync(join(dir, 'src', 'routes'), { recursive: true });
|
|
82
|
+
mkdirSync(join(dir, 'src', 'views'), { recursive: true });
|
|
83
|
+
|
|
84
|
+
// package.json
|
|
85
|
+
writeFileSync(
|
|
86
|
+
join(dir, 'package.json'),
|
|
87
|
+
JSON.stringify(
|
|
88
|
+
{
|
|
89
|
+
name,
|
|
90
|
+
version: '0.1.0',
|
|
91
|
+
type: 'module',
|
|
92
|
+
private: true,
|
|
93
|
+
scripts: {
|
|
94
|
+
dev: 'moria dev',
|
|
95
|
+
build: 'moria build',
|
|
96
|
+
start: 'moria start',
|
|
97
|
+
},
|
|
98
|
+
dependencies: {
|
|
99
|
+
'@moriajs/core': 'latest',
|
|
100
|
+
'@moriajs/renderer': 'latest',
|
|
101
|
+
'@moriajs/db': 'latest',
|
|
102
|
+
'@moriajs/auth': 'latest',
|
|
103
|
+
'@moriajs/ui': 'latest',
|
|
104
|
+
mithril: '^2.2.0',
|
|
105
|
+
},
|
|
106
|
+
devDependencies:
|
|
107
|
+
lang === 'ts'
|
|
108
|
+
? {
|
|
109
|
+
'@moriajs/cli': 'latest',
|
|
110
|
+
typescript: '^5.7.0',
|
|
111
|
+
'@types/mithril': '^2.2.0',
|
|
112
|
+
}
|
|
113
|
+
: {
|
|
114
|
+
'@moriajs/cli': 'latest',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
null,
|
|
118
|
+
2
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// moria.config
|
|
123
|
+
const ext = lang === 'ts' ? 'ts' : 'js';
|
|
124
|
+
const configContent =
|
|
125
|
+
lang === 'ts'
|
|
126
|
+
? `import { defineConfig } from '@moriajs/core';
|
|
127
|
+
|
|
128
|
+
export default defineConfig({
|
|
129
|
+
server: {
|
|
130
|
+
port: 3000,
|
|
131
|
+
},
|
|
132
|
+
database: {
|
|
133
|
+
adapter: '${db}',
|
|
134
|
+
${db === 'sqlite' ? "filename: './dev.db'," : "url: process.env.DATABASE_URL,"}
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
`
|
|
138
|
+
: `/** @type {import('@moriajs/core').MoriaConfig} */
|
|
139
|
+
export default {
|
|
140
|
+
server: {
|
|
141
|
+
port: 3000,
|
|
142
|
+
},
|
|
143
|
+
database: {
|
|
144
|
+
adapter: '${db}',
|
|
145
|
+
${db === 'sqlite' ? "filename: './dev.db'," : "url: process.env.DATABASE_URL,"}
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
`;
|
|
149
|
+
|
|
150
|
+
writeFileSync(join(dir, `moria.config.${ext}`), configContent);
|
|
151
|
+
|
|
152
|
+
// .gitignore
|
|
153
|
+
writeFileSync(
|
|
154
|
+
join(dir, '.gitignore'),
|
|
155
|
+
'node_modules/\ndist/\n.env\n*.db\n.turbo/\n'
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
console.log(pc.green('✅ Project created successfully!'));
|
|
159
|
+
console.log();
|
|
160
|
+
console.log(pc.cyan(' Next steps:'));
|
|
161
|
+
console.log(pc.dim(` cd ${name}`));
|
|
162
|
+
console.log(pc.dim(' pnpm install'));
|
|
163
|
+
console.log(pc.dim(' pnpm dev'));
|
|
164
|
+
console.log();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
cli.version(VERSION);
|
|
168
|
+
cli.help();
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @moriajs/db
|
|
3
|
+
*
|
|
4
|
+
* Database-agnostic adapter layer built on Kysely.
|
|
5
|
+
* Default: PostgreSQL (production), SQLite (development).
|
|
6
|
+
* Designed to work with kysely-schema for schema-first development.
|
|
7
|
+
*/
|
|
8
|
+
import { Kysely } from 'kysely';
|
|
9
|
+
/**
|
|
10
|
+
* Supported database adapters.
|
|
11
|
+
*/
|
|
12
|
+
export type DatabaseAdapter = 'pg' | 'sqlite' | 'mysql';
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for creating a database connection.
|
|
15
|
+
*/
|
|
16
|
+
export interface DatabaseConfig {
|
|
17
|
+
/** Database adapter to use */
|
|
18
|
+
adapter: DatabaseAdapter;
|
|
19
|
+
/** Connection URL (for pg/mysql) */
|
|
20
|
+
url?: string;
|
|
21
|
+
/** File path (for sqlite) */
|
|
22
|
+
filename?: string;
|
|
23
|
+
/** Connection pool size */
|
|
24
|
+
pool?: {
|
|
25
|
+
min?: number;
|
|
26
|
+
max?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a Kysely database instance with the specified adapter.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Production (PostgreSQL)
|
|
35
|
+
* const db = await createDatabase({
|
|
36
|
+
* adapter: 'pg',
|
|
37
|
+
* url: process.env.DATABASE_URL,
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Development (SQLite)
|
|
41
|
+
* const db = await createDatabase({
|
|
42
|
+
* adapter: 'sqlite',
|
|
43
|
+
* filename: './dev.db',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function createDatabase<T>(config: DatabaseConfig): Promise<Kysely<T>>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a MoriaJS database plugin for Fastify integration.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { createApp } from '@moriajs/core';
|
|
54
|
+
* import { createDatabasePlugin } from '@moriajs/db';
|
|
55
|
+
*
|
|
56
|
+
* const app = await createApp();
|
|
57
|
+
* await app.use(createDatabasePlugin({
|
|
58
|
+
* adapter: 'sqlite',
|
|
59
|
+
* filename: './dev.db',
|
|
60
|
+
* }));
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function createDatabasePlugin(config: DatabaseConfig): {
|
|
64
|
+
name: string;
|
|
65
|
+
register({ server }: {
|
|
66
|
+
server: {
|
|
67
|
+
decorate: (key: string, value: unknown) => void;
|
|
68
|
+
};
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAkC,MAAM,QAAQ,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,8BAA8B;IAC9B,OAAO,EAAE,eAAe,CAAC;IACzB,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,IAAI,CAAC,EAAE;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACL;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAGlF;AA0CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc;;yBAGxB;QAAE,MAAM,EAAE;YAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;SAAE,CAAA;KAAE;EAKjG"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @moriajs/db
|
|
3
|
+
*
|
|
4
|
+
* Database-agnostic adapter layer built on Kysely.
|
|
5
|
+
* Default: PostgreSQL (production), SQLite (development).
|
|
6
|
+
* Designed to work with kysely-schema for schema-first development.
|
|
7
|
+
*/
|
|
8
|
+
import { Kysely, PostgresDialect, SqliteDialect } from 'kysely';
|
|
9
|
+
/**
|
|
10
|
+
* Create a Kysely database instance with the specified adapter.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* // Production (PostgreSQL)
|
|
15
|
+
* const db = await createDatabase({
|
|
16
|
+
* adapter: 'pg',
|
|
17
|
+
* url: process.env.DATABASE_URL,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* // Development (SQLite)
|
|
21
|
+
* const db = await createDatabase({
|
|
22
|
+
* adapter: 'sqlite',
|
|
23
|
+
* filename: './dev.db',
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export async function createDatabase(config) {
|
|
28
|
+
const dialect = await createDialect(config);
|
|
29
|
+
return new Kysely({ dialect });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create the appropriate Kysely dialect based on adapter config.
|
|
33
|
+
*/
|
|
34
|
+
async function createDialect(config) {
|
|
35
|
+
switch (config.adapter) {
|
|
36
|
+
case 'pg': {
|
|
37
|
+
// Dynamic import — pg is an optional dependency
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-explicit-any
|
|
39
|
+
const pg = globalThis.require('pg');
|
|
40
|
+
return new PostgresDialect({
|
|
41
|
+
pool: new pg.Pool({
|
|
42
|
+
connectionString: config.url,
|
|
43
|
+
min: config.pool?.min ?? 2,
|
|
44
|
+
max: config.pool?.max ?? 10,
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
case 'sqlite': {
|
|
50
|
+
// Dynamic import — better-sqlite3 is an optional dependency
|
|
51
|
+
const BetterSqlite3Module = await import('better-sqlite3');
|
|
52
|
+
const BetterSqlite3 = BetterSqlite3Module.default;
|
|
53
|
+
return new SqliteDialect({
|
|
54
|
+
database: new BetterSqlite3(config.filename ?? ':memory:'),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
case 'mysql': {
|
|
58
|
+
throw new Error('@moriajs/db: MySQL adapter is not yet implemented. ' +
|
|
59
|
+
'Contributions welcome!');
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
throw new Error(`@moriajs/db: Unknown adapter "${config.adapter}"`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create a MoriaJS database plugin for Fastify integration.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import { createApp } from '@moriajs/core';
|
|
71
|
+
* import { createDatabasePlugin } from '@moriajs/db';
|
|
72
|
+
*
|
|
73
|
+
* const app = await createApp();
|
|
74
|
+
* await app.use(createDatabasePlugin({
|
|
75
|
+
* adapter: 'sqlite',
|
|
76
|
+
* filename: './dev.db',
|
|
77
|
+
* }));
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function createDatabasePlugin(config) {
|
|
81
|
+
return {
|
|
82
|
+
name: '@moriajs/db',
|
|
83
|
+
async register({ server }) {
|
|
84
|
+
const db = await createDatabase(config);
|
|
85
|
+
server.decorate('db', db);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAwBhE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,MAAsB;IAC1D,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,IAAI,MAAM,CAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,aAAa,CAAC,MAAsB;IAC/C,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,CAAC,CAAC;YACR,gDAAgD;YAChD,qGAAqG;YACrG,MAAM,EAAE,GAAI,UAAkB,CAAC,OAAO,CAAC,IAAI,CAA6D,CAAC;YACzG,OAAO,IAAI,eAAe,CAAC;gBACvB,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC;oBACd,gBAAgB,EAAE,MAAM,CAAC,GAAG;oBAC5B,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;oBAC1B,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE;oBAC3B,8DAA8D;iBACjE,CAAQ;aACZ,CAAC,CAAC;QACP,CAAC;QAED,KAAK,QAAQ,CAAC,CAAC,CAAC;YACZ,4DAA4D;YAC5D,MAAM,mBAAmB,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC3D,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,CAAC;YAClD,OAAO,IAAI,aAAa,CAAC;gBACrB,QAAQ,EAAE,IAAI,aAAa,CAAC,MAAM,CAAC,QAAQ,IAAI,UAAU,CAAC;aAC7D,CAAC,CAAC;QACP,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,IAAI,KAAK,CACX,qDAAqD;gBACrD,wBAAwB,CAC3B,CAAC;QACN,CAAC;QAED;YACI,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;IAC5E,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACvD,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAmE;YACtF,MAAM,EAAE,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;YACxC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9B,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../rimraf/dist/esm/bin.mjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../rimraf/dist/esm/bin.mjs" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\esm\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\esm\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\rimraf\dist\esm\bin.mjs" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\rimraf\dist\esm\bin.mjs" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\esm\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\dist\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules\rimraf\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\rimraf@6.1.2\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/esm/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/dist/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules/rimraf/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/rimraf@6.1.2/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../rimraf/dist/esm/bin.mjs" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,17 @@
|
|
|
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="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../typescript/bin/tsc" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\typescript\bin\tsc" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\typescript\bin\tsc" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../typescript/bin/tsc" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|
|
@@ -0,0 +1,17 @@
|
|
|
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="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../typescript/bin/tsserver" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@SETLOCAL
|
|
2
|
+
@IF NOT DEFINED NODE_PATH (
|
|
3
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
4
|
+
) ELSE (
|
|
5
|
+
@SET "NODE_PATH=C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
|
6
|
+
)
|
|
7
|
+
@IF EXIST "%~dp0\node.exe" (
|
|
8
|
+
"%~dp0\node.exe" "%~dp0\..\typescript\bin\tsserver" %*
|
|
9
|
+
) ELSE (
|
|
10
|
+
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
11
|
+
node "%~dp0\..\typescript\bin\tsserver" %*
|
|
12
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
$pathsep=":"
|
|
6
|
+
$env_node_path=$env:NODE_PATH
|
|
7
|
+
$new_node_path="C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\bin\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules\typescript\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\typescript@5.9.3\node_modules;C:\Codes\node\2026\github\moriajs\node_modules\.pnpm\node_modules"
|
|
8
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
9
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
10
|
+
# are installed in the same directory
|
|
11
|
+
$exe=".exe"
|
|
12
|
+
$pathsep=";"
|
|
13
|
+
} else {
|
|
14
|
+
$new_node_path="/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/bin/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/typescript@5.9.3/node_modules:/mnt/c/Codes/node/2026/github/moriajs/node_modules/.pnpm/node_modules"
|
|
15
|
+
}
|
|
16
|
+
if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
17
|
+
$env:NODE_PATH=$new_node_path
|
|
18
|
+
} else {
|
|
19
|
+
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ret=0
|
|
23
|
+
if (Test-Path "$basedir/node$exe") {
|
|
24
|
+
# Support pipeline input
|
|
25
|
+
if ($MyInvocation.ExpectingInput) {
|
|
26
|
+
$input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
27
|
+
} else {
|
|
28
|
+
& "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
29
|
+
}
|
|
30
|
+
$ret=$LASTEXITCODE
|
|
31
|
+
} else {
|
|
32
|
+
# Support pipeline input
|
|
33
|
+
if ($MyInvocation.ExpectingInput) {
|
|
34
|
+
$input | & "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
35
|
+
} else {
|
|
36
|
+
& "node$exe" "$basedir/../typescript/bin/tsserver" $args
|
|
37
|
+
}
|
|
38
|
+
$ret=$LASTEXITCODE
|
|
39
|
+
}
|
|
40
|
+
$env:NODE_PATH=$env_node_path
|
|
41
|
+
exit $ret
|