arri 0.45.4 → 0.45.6
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/dist/cli.cjs +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/shared/{arri.e5993636.mjs → arri.1b895cef.mjs} +63 -63
- package/dist/shared/{arri.547ce62e.cjs → arri.f2ee916e.cjs} +63 -63
- package/package.json +6 -6
package/dist/cli.cjs
CHANGED
|
@@ -11,7 +11,7 @@ const esbuild = require('esbuild');
|
|
|
11
11
|
const esbuildPluginReplace = require('esbuild-plugin-replace');
|
|
12
12
|
const path = require('pathe');
|
|
13
13
|
const prettier = require('prettier');
|
|
14
|
-
const dev = require('./shared/arri.
|
|
14
|
+
const dev = require('./shared/arri.f2ee916e.cjs');
|
|
15
15
|
const ofetch = require('ofetch');
|
|
16
16
|
const Degit = require('degit');
|
|
17
17
|
const enquirer = require('enquirer');
|
|
@@ -106,7 +106,7 @@ async function startBuild(config, skipCodeGen = false) {
|
|
|
106
106
|
`Build finished! You can start your server by running "node .output/${dev.OUT_SERVER_ENTRY}"`
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
|
-
async function bundleAppEntry(config,
|
|
109
|
+
async function bundleAppEntry(config, _allowCodegen = true) {
|
|
110
110
|
const appEntry = path__default.resolve(
|
|
111
111
|
config.rootDir,
|
|
112
112
|
config.buildDir,
|
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { build as build$1 } from 'esbuild';
|
|
|
9
9
|
import { replace } from 'esbuild-plugin-replace';
|
|
10
10
|
import path from 'pathe';
|
|
11
11
|
import prettier from 'prettier';
|
|
12
|
-
import { d as defaultConfig, l as logger, s as setupWorkingDir, c as createAppWithRoutesModule, O as OUT_CODEGEN, e as OUT_SERVER_ENTRY, G as GEN_APP_FILE, f as OUT_APP_FILE, i as isArriConfig, g as dev } from './shared/arri.
|
|
12
|
+
import { d as defaultConfig, l as logger, s as setupWorkingDir, c as createAppWithRoutesModule, O as OUT_CODEGEN, e as OUT_SERVER_ENTRY, G as GEN_APP_FILE, f as OUT_APP_FILE, i as isArriConfig, g as dev } from './shared/arri.1b895cef.mjs';
|
|
13
13
|
import { ofetch } from 'ofetch';
|
|
14
14
|
import Degit from 'degit';
|
|
15
15
|
import enquirer from 'enquirer';
|
|
@@ -95,7 +95,7 @@ async function startBuild(config, skipCodeGen = false) {
|
|
|
95
95
|
`Build finished! You can start your server by running "node .output/${OUT_SERVER_ENTRY}"`
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
|
-
async function bundleAppEntry(config,
|
|
98
|
+
async function bundleAppEntry(config, _allowCodegen = true) {
|
|
99
99
|
const appEntry = path.resolve(
|
|
100
100
|
config.rootDir,
|
|
101
101
|
config.buildDir,
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const dev = require('./shared/arri.f2ee916e.cjs');
|
|
3
4
|
const codegenDart = require('@arrirpc/codegen-dart');
|
|
4
|
-
const codegenTs = require('@arrirpc/codegen-ts');
|
|
5
5
|
const codegenKotlin = require('@arrirpc/codegen-kotlin');
|
|
6
|
+
const codegenTs = require('@arrirpc/codegen-ts');
|
|
6
7
|
const codegenUtils = require('@arrirpc/codegen-utils');
|
|
7
|
-
const dev = require('./shared/arri.547ce62e.cjs');
|
|
8
8
|
require('node:fs');
|
|
9
9
|
require('node:fs/promises');
|
|
10
10
|
require('@joshmossas/listhen');
|
|
@@ -19,12 +19,12 @@ require('scule');
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
exports.dartClientGenerator = codegenDart.dartClientGenerator;
|
|
23
|
-
exports.typescriptClientGenerator = codegenTs.typescriptClientGenerator;
|
|
24
|
-
exports.kotlinClientGenerator = codegenKotlin.kotlinClientGenerator;
|
|
25
|
-
exports.createAppDefinition = codegenUtils.createAppDefinition;
|
|
26
22
|
exports.DEV_DEFINITION_ENDPOINT = dev.DEV_DEFINITION_ENDPOINT;
|
|
27
23
|
exports.defaultConfig = dev.defaultConfig;
|
|
28
24
|
exports.defineConfig = dev.defineConfig;
|
|
29
25
|
exports.isArriConfig = dev.isArriConfig;
|
|
30
26
|
exports.isResolvedArriConfig = dev.isResolvedArriConfig;
|
|
27
|
+
exports.dartClientGenerator = codegenDart.dartClientGenerator;
|
|
28
|
+
exports.kotlinClientGenerator = codegenKotlin.kotlinClientGenerator;
|
|
29
|
+
exports.typescriptClientGenerator = codegenTs.typescriptClientGenerator;
|
|
30
|
+
exports.createAppDefinition = codegenUtils.createAppDefinition;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
2
|
-
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
3
|
-
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
4
1
|
import { ClientGenerator } from '@arrirpc/codegen-utils';
|
|
5
2
|
export { AppDefinition, createAppDefinition } from '@arrirpc/codegen-utils';
|
|
6
3
|
import { BuildOptions } from 'esbuild';
|
|
4
|
+
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
5
|
+
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
6
|
+
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
7
|
+
|
|
8
|
+
declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
|
|
7
9
|
|
|
8
10
|
interface ArriConfig {
|
|
9
11
|
port?: number;
|
|
@@ -38,6 +40,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
|
|
|
38
40
|
declare const defaultConfig: Required<ArriConfig>;
|
|
39
41
|
declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
|
|
40
42
|
|
|
41
|
-
declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
|
|
42
|
-
|
|
43
43
|
export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ResolvedArriConfig, defaultConfig, defineConfig, isArriConfig, isResolvedArriConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
2
|
-
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
3
|
-
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
4
1
|
import { ClientGenerator } from '@arrirpc/codegen-utils';
|
|
5
2
|
export { AppDefinition, createAppDefinition } from '@arrirpc/codegen-utils';
|
|
6
3
|
import { BuildOptions } from 'esbuild';
|
|
4
|
+
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
5
|
+
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
6
|
+
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
7
|
+
|
|
8
|
+
declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
|
|
7
9
|
|
|
8
10
|
interface ArriConfig {
|
|
9
11
|
port?: number;
|
|
@@ -38,6 +40,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
|
|
|
38
40
|
declare const defaultConfig: Required<ArriConfig>;
|
|
39
41
|
declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
|
|
40
42
|
|
|
41
|
-
declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
|
|
42
|
-
|
|
43
43
|
export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ResolvedArriConfig, defaultConfig, defineConfig, isArriConfig, isResolvedArriConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
2
|
-
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
3
|
-
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
4
1
|
import { ClientGenerator } from '@arrirpc/codegen-utils';
|
|
5
2
|
export { AppDefinition, createAppDefinition } from '@arrirpc/codegen-utils';
|
|
6
3
|
import { BuildOptions } from 'esbuild';
|
|
4
|
+
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
5
|
+
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
6
|
+
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
7
|
+
|
|
8
|
+
declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
|
|
7
9
|
|
|
8
10
|
interface ArriConfig {
|
|
9
11
|
port?: number;
|
|
@@ -38,6 +40,4 @@ type ResolvedArriConfig = Required<ArriConfig>;
|
|
|
38
40
|
declare const defaultConfig: Required<ArriConfig>;
|
|
39
41
|
declare function defineConfig(config: ArriConfig): ResolvedArriConfig;
|
|
40
42
|
|
|
41
|
-
declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/__definition";
|
|
42
|
-
|
|
43
43
|
export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ResolvedArriConfig, defaultConfig, defineConfig, isArriConfig, isResolvedArriConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export { D as DEV_DEFINITION_ENDPOINT, d as defaultConfig, b as defineConfig, i as isArriConfig, a as isResolvedArriConfig } from './shared/arri.1b895cef.mjs';
|
|
1
2
|
export { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
2
|
-
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
3
3
|
export { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
4
|
+
export { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
4
5
|
export { createAppDefinition } from '@arrirpc/codegen-utils';
|
|
5
|
-
export { D as DEV_DEFINITION_ENDPOINT, d as defaultConfig, b as defineConfig, i as isArriConfig, a as isResolvedArriConfig } from './shared/arri.e5993636.mjs';
|
|
6
6
|
import 'node:fs';
|
|
7
7
|
import 'node:fs/promises';
|
|
8
8
|
import '@joshmossas/listhen';
|
|
@@ -11,67 +11,6 @@ import { createConsola } from 'consola';
|
|
|
11
11
|
import prettier from 'prettier';
|
|
12
12
|
import { camelCase, kebabCase } from 'scule';
|
|
13
13
|
|
|
14
|
-
function isArriConfig(input) {
|
|
15
|
-
if (typeof input !== "object" || input === null) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
if ("generators" in input) {
|
|
19
|
-
if (!Array.isArray(input.generators)) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if ("port" in input) {
|
|
24
|
-
if (typeof input.port !== "number") {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
if (Number.isNaN(input.port)) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if ("entry" in input && typeof input.entry !== "string") {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
function isResolvedArriConfig(input) {
|
|
37
|
-
if (!isArriConfig(input)) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return typeof input.rootDir === "string" && typeof input.srcDir === "string" && (typeof input.procedureDir === "string" || typeof input.procedureDir === "boolean") && Array.isArray(input.procedureGlobPatterns) && Array.isArray(input.generators);
|
|
41
|
-
}
|
|
42
|
-
const defaultConfig = {
|
|
43
|
-
port: 3e3,
|
|
44
|
-
rootDir: ".",
|
|
45
|
-
srcDir: "src",
|
|
46
|
-
entry: "app.ts",
|
|
47
|
-
serverEntry: "",
|
|
48
|
-
procedureDir: "procedures",
|
|
49
|
-
procedureGlobPatterns: ["**/*.rpc.ts"],
|
|
50
|
-
generators: [],
|
|
51
|
-
buildDir: ".arri",
|
|
52
|
-
esbuild: {},
|
|
53
|
-
https: false,
|
|
54
|
-
http2: false,
|
|
55
|
-
devServer: {}
|
|
56
|
-
};
|
|
57
|
-
function defineConfig(config) {
|
|
58
|
-
return {
|
|
59
|
-
port: config.port ?? defaultConfig.port,
|
|
60
|
-
rootDir: config.rootDir ?? defaultConfig.rootDir,
|
|
61
|
-
srcDir: config.srcDir ?? defaultConfig.srcDir,
|
|
62
|
-
entry: config.entry ?? defaultConfig.entry,
|
|
63
|
-
procedureDir: config.procedureDir ?? defaultConfig.procedureDir,
|
|
64
|
-
procedureGlobPatterns: config.procedureGlobPatterns ?? defaultConfig.procedureGlobPatterns,
|
|
65
|
-
generators: config.generators ?? defaultConfig.generators,
|
|
66
|
-
buildDir: config.buildDir ?? defaultConfig.buildDir,
|
|
67
|
-
esbuild: config.esbuild ?? defaultConfig.esbuild,
|
|
68
|
-
serverEntry: config.serverEntry ?? "",
|
|
69
|
-
https: config.https ?? false,
|
|
70
|
-
http2: config.http2 ?? false,
|
|
71
|
-
devServer: config.devServer ?? {}
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
14
|
const logger = createConsola().withTag("arri");
|
|
76
15
|
const GEN_APP_FILE = "__arri_app.ts";
|
|
77
16
|
const GEN_SERVER_ENTRY_FILE = "__arri_server.ts";
|
|
@@ -209,6 +148,67 @@ function isInsideDir(dir, parentDir) {
|
|
|
209
148
|
return false;
|
|
210
149
|
}
|
|
211
150
|
|
|
151
|
+
function isArriConfig(input) {
|
|
152
|
+
if (typeof input !== "object" || input === null) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
if ("generators" in input) {
|
|
156
|
+
if (!Array.isArray(input.generators)) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if ("port" in input) {
|
|
161
|
+
if (typeof input.port !== "number") {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
if (Number.isNaN(input.port)) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if ("entry" in input && typeof input.entry !== "string") {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
function isResolvedArriConfig(input) {
|
|
174
|
+
if (!isArriConfig(input)) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
return typeof input.rootDir === "string" && typeof input.srcDir === "string" && (typeof input.procedureDir === "string" || typeof input.procedureDir === "boolean") && Array.isArray(input.procedureGlobPatterns) && Array.isArray(input.generators);
|
|
178
|
+
}
|
|
179
|
+
const defaultConfig = {
|
|
180
|
+
port: 3e3,
|
|
181
|
+
rootDir: ".",
|
|
182
|
+
srcDir: "src",
|
|
183
|
+
entry: "app.ts",
|
|
184
|
+
serverEntry: "",
|
|
185
|
+
procedureDir: "procedures",
|
|
186
|
+
procedureGlobPatterns: ["**/*.rpc.ts"],
|
|
187
|
+
generators: [],
|
|
188
|
+
buildDir: ".arri",
|
|
189
|
+
esbuild: {},
|
|
190
|
+
https: false,
|
|
191
|
+
http2: false,
|
|
192
|
+
devServer: {}
|
|
193
|
+
};
|
|
194
|
+
function defineConfig(config) {
|
|
195
|
+
return {
|
|
196
|
+
port: config.port ?? defaultConfig.port,
|
|
197
|
+
rootDir: config.rootDir ?? defaultConfig.rootDir,
|
|
198
|
+
srcDir: config.srcDir ?? defaultConfig.srcDir,
|
|
199
|
+
entry: config.entry ?? defaultConfig.entry,
|
|
200
|
+
procedureDir: config.procedureDir ?? defaultConfig.procedureDir,
|
|
201
|
+
procedureGlobPatterns: config.procedureGlobPatterns ?? defaultConfig.procedureGlobPatterns,
|
|
202
|
+
generators: config.generators ?? defaultConfig.generators,
|
|
203
|
+
buildDir: config.buildDir ?? defaultConfig.buildDir,
|
|
204
|
+
esbuild: config.esbuild ?? defaultConfig.esbuild,
|
|
205
|
+
serverEntry: config.serverEntry ?? "",
|
|
206
|
+
https: config.https ?? false,
|
|
207
|
+
http2: config.http2 ?? false,
|
|
208
|
+
devServer: config.devServer ?? {}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
212
|
const DEV_ENDPOINT_ROOT = `/__arri_dev__`;
|
|
213
213
|
const DEV_DEFINITION_ENDPOINT = `${DEV_ENDPOINT_ROOT}/__definition`;
|
|
214
214
|
const dev = defineCommand({
|
|
@@ -300,7 +300,7 @@ async function startDevServer(config) {
|
|
|
300
300
|
});
|
|
301
301
|
process.on("SIGINT", cleanExit);
|
|
302
302
|
process.on("SIGTERM", cleanExit);
|
|
303
|
-
async function load(
|
|
303
|
+
async function load(_isRestart, _reason) {
|
|
304
304
|
if (fileWatcher) {
|
|
305
305
|
await fileWatcher.close();
|
|
306
306
|
}
|
|
@@ -334,7 +334,7 @@ async function startDevServer(config) {
|
|
|
334
334
|
"**/.git/**"
|
|
335
335
|
]
|
|
336
336
|
});
|
|
337
|
-
fileWatcher.on("all", async (eventName,
|
|
337
|
+
fileWatcher.on("all", async (eventName, _path) => {
|
|
338
338
|
if (eventName === "addDir" || eventName === "add") {
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
@@ -32,67 +32,6 @@ const esbuild__namespace = /*#__PURE__*/_interopNamespaceCompat(esbuild);
|
|
|
32
32
|
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
33
33
|
const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
|
|
34
34
|
|
|
35
|
-
function isArriConfig(input) {
|
|
36
|
-
if (typeof input !== "object" || input === null) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
if ("generators" in input) {
|
|
40
|
-
if (!Array.isArray(input.generators)) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if ("port" in input) {
|
|
45
|
-
if (typeof input.port !== "number") {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
if (Number.isNaN(input.port)) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if ("entry" in input && typeof input.entry !== "string") {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
function isResolvedArriConfig(input) {
|
|
58
|
-
if (!isArriConfig(input)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
return typeof input.rootDir === "string" && typeof input.srcDir === "string" && (typeof input.procedureDir === "string" || typeof input.procedureDir === "boolean") && Array.isArray(input.procedureGlobPatterns) && Array.isArray(input.generators);
|
|
62
|
-
}
|
|
63
|
-
const defaultConfig = {
|
|
64
|
-
port: 3e3,
|
|
65
|
-
rootDir: ".",
|
|
66
|
-
srcDir: "src",
|
|
67
|
-
entry: "app.ts",
|
|
68
|
-
serverEntry: "",
|
|
69
|
-
procedureDir: "procedures",
|
|
70
|
-
procedureGlobPatterns: ["**/*.rpc.ts"],
|
|
71
|
-
generators: [],
|
|
72
|
-
buildDir: ".arri",
|
|
73
|
-
esbuild: {},
|
|
74
|
-
https: false,
|
|
75
|
-
http2: false,
|
|
76
|
-
devServer: {}
|
|
77
|
-
};
|
|
78
|
-
function defineConfig(config) {
|
|
79
|
-
return {
|
|
80
|
-
port: config.port ?? defaultConfig.port,
|
|
81
|
-
rootDir: config.rootDir ?? defaultConfig.rootDir,
|
|
82
|
-
srcDir: config.srcDir ?? defaultConfig.srcDir,
|
|
83
|
-
entry: config.entry ?? defaultConfig.entry,
|
|
84
|
-
procedureDir: config.procedureDir ?? defaultConfig.procedureDir,
|
|
85
|
-
procedureGlobPatterns: config.procedureGlobPatterns ?? defaultConfig.procedureGlobPatterns,
|
|
86
|
-
generators: config.generators ?? defaultConfig.generators,
|
|
87
|
-
buildDir: config.buildDir ?? defaultConfig.buildDir,
|
|
88
|
-
esbuild: config.esbuild ?? defaultConfig.esbuild,
|
|
89
|
-
serverEntry: config.serverEntry ?? "",
|
|
90
|
-
https: config.https ?? false,
|
|
91
|
-
http2: config.http2 ?? false,
|
|
92
|
-
devServer: config.devServer ?? {}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
35
|
const logger = consola.createConsola().withTag("arri");
|
|
97
36
|
const GEN_APP_FILE = "__arri_app.ts";
|
|
98
37
|
const GEN_SERVER_ENTRY_FILE = "__arri_server.ts";
|
|
@@ -230,6 +169,67 @@ function isInsideDir(dir, parentDir) {
|
|
|
230
169
|
return false;
|
|
231
170
|
}
|
|
232
171
|
|
|
172
|
+
function isArriConfig(input) {
|
|
173
|
+
if (typeof input !== "object" || input === null) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
if ("generators" in input) {
|
|
177
|
+
if (!Array.isArray(input.generators)) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if ("port" in input) {
|
|
182
|
+
if (typeof input.port !== "number") {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
if (Number.isNaN(input.port)) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if ("entry" in input && typeof input.entry !== "string") {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
function isResolvedArriConfig(input) {
|
|
195
|
+
if (!isArriConfig(input)) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return typeof input.rootDir === "string" && typeof input.srcDir === "string" && (typeof input.procedureDir === "string" || typeof input.procedureDir === "boolean") && Array.isArray(input.procedureGlobPatterns) && Array.isArray(input.generators);
|
|
199
|
+
}
|
|
200
|
+
const defaultConfig = {
|
|
201
|
+
port: 3e3,
|
|
202
|
+
rootDir: ".",
|
|
203
|
+
srcDir: "src",
|
|
204
|
+
entry: "app.ts",
|
|
205
|
+
serverEntry: "",
|
|
206
|
+
procedureDir: "procedures",
|
|
207
|
+
procedureGlobPatterns: ["**/*.rpc.ts"],
|
|
208
|
+
generators: [],
|
|
209
|
+
buildDir: ".arri",
|
|
210
|
+
esbuild: {},
|
|
211
|
+
https: false,
|
|
212
|
+
http2: false,
|
|
213
|
+
devServer: {}
|
|
214
|
+
};
|
|
215
|
+
function defineConfig(config) {
|
|
216
|
+
return {
|
|
217
|
+
port: config.port ?? defaultConfig.port,
|
|
218
|
+
rootDir: config.rootDir ?? defaultConfig.rootDir,
|
|
219
|
+
srcDir: config.srcDir ?? defaultConfig.srcDir,
|
|
220
|
+
entry: config.entry ?? defaultConfig.entry,
|
|
221
|
+
procedureDir: config.procedureDir ?? defaultConfig.procedureDir,
|
|
222
|
+
procedureGlobPatterns: config.procedureGlobPatterns ?? defaultConfig.procedureGlobPatterns,
|
|
223
|
+
generators: config.generators ?? defaultConfig.generators,
|
|
224
|
+
buildDir: config.buildDir ?? defaultConfig.buildDir,
|
|
225
|
+
esbuild: config.esbuild ?? defaultConfig.esbuild,
|
|
226
|
+
serverEntry: config.serverEntry ?? "",
|
|
227
|
+
https: config.https ?? false,
|
|
228
|
+
http2: config.http2 ?? false,
|
|
229
|
+
devServer: config.devServer ?? {}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
233
|
const DEV_ENDPOINT_ROOT = `/__arri_dev__`;
|
|
234
234
|
const DEV_DEFINITION_ENDPOINT = `${DEV_ENDPOINT_ROOT}/__definition`;
|
|
235
235
|
const dev = citty.defineCommand({
|
|
@@ -321,7 +321,7 @@ async function startDevServer(config) {
|
|
|
321
321
|
});
|
|
322
322
|
process.on("SIGINT", cleanExit);
|
|
323
323
|
process.on("SIGTERM", cleanExit);
|
|
324
|
-
async function load(
|
|
324
|
+
async function load(_isRestart, _reason) {
|
|
325
325
|
if (fileWatcher) {
|
|
326
326
|
await fileWatcher.close();
|
|
327
327
|
}
|
|
@@ -355,7 +355,7 @@ async function startDevServer(config) {
|
|
|
355
355
|
"**/.git/**"
|
|
356
356
|
]
|
|
357
357
|
});
|
|
358
|
-
fileWatcher.on("all", async (eventName,
|
|
358
|
+
fileWatcher.on("all", async (eventName, _path) => {
|
|
359
359
|
if (eventName === "addDir" || eventName === "add") {
|
|
360
360
|
return;
|
|
361
361
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arri",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"consola": "^3.2.3",
|
|
33
33
|
"degit": "^2.8.4",
|
|
34
34
|
"enquirer": "^2.4.1",
|
|
35
|
-
"esbuild": "^0.21.
|
|
35
|
+
"esbuild": "^0.21.4",
|
|
36
36
|
"esbuild-plugin-replace": "^1.4.0",
|
|
37
37
|
"globby": "^14.0.1",
|
|
38
38
|
"ofetch": "^1.3.4",
|
|
39
39
|
"pathe": "^1.1.2",
|
|
40
40
|
"prettier": "^3.2.5",
|
|
41
41
|
"scule": "^1.3.0",
|
|
42
|
-
"@arrirpc/codegen-
|
|
43
|
-
"@arrirpc/codegen-
|
|
44
|
-
"@arrirpc/codegen-
|
|
45
|
-
"@arrirpc/codegen-
|
|
42
|
+
"@arrirpc/codegen-kotlin": "0.45.6",
|
|
43
|
+
"@arrirpc/codegen-utils": "0.45.6",
|
|
44
|
+
"@arrirpc/codegen-dart": "0.45.6",
|
|
45
|
+
"@arrirpc/codegen-ts": "0.45.6"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/degit": "^2.8.6"
|