arri 0.57.3 → 0.57.4
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 +50 -7
- package/dist/cli.cjs +110 -47
- package/dist/cli.mjs +110 -47
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/{arri.976d7393.cjs → arri.09919c6d.cjs} +23 -0
- package/dist/shared/{arri.1de410ff.mjs → arri.339f2f92.mjs} +23 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -5,19 +5,62 @@ Command line interface for ARRI-RPC
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
7
|
- [Commands](#commands)
|
|
8
|
+
- [Running code generators](#running-code-generators)
|
|
8
9
|
- [Usage with @arrirpc/server](#usage-with-arrirpcserver)
|
|
9
10
|
|
|
10
11
|
## Commands
|
|
11
12
|
|
|
12
13
|
Run `arri --help` to get a full list of commands
|
|
13
14
|
|
|
14
|
-
| Cmd | Description
|
|
15
|
-
| -------------------- |
|
|
16
|
-
| codegen [input-file] | Run generate clients specified in the `arri.config.ts`. See [here](
|
|
17
|
-
| init [dir] | Scaffold an arri app/library
|
|
18
|
-
| list | List available arri versions
|
|
19
|
-
| use [version] | Update arri dependencies to a specific version (checks recursively for package.json, pubspec.yaml, cargo.toml, etc)
|
|
20
|
-
| version | Print current CLI version
|
|
15
|
+
| Cmd | Description |
|
|
16
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| codegen [input-file] | Run generate clients specified in the `arri.config.ts`. See [here](#running-arri-codegen) for details. |
|
|
18
|
+
| init [dir] | Scaffold an arri app/library |
|
|
19
|
+
| list | List available arri versions |
|
|
20
|
+
| use [version] | Update arri dependencies to a specific version (checks recursively for package.json, pubspec.yaml, cargo.toml, etc) |
|
|
21
|
+
| version | Print current CLI version |
|
|
22
|
+
|
|
23
|
+
## Running code generators
|
|
24
|
+
|
|
25
|
+
Before running codegen you need to setup a valid Arri Config
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// arri.config.ts
|
|
29
|
+
import { defineConfig, generators } from "arri";
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
generators: [
|
|
33
|
+
generators.dartClient({
|
|
34
|
+
clientName: "Client",
|
|
35
|
+
outputPath: "<some-output-file>",
|
|
36
|
+
}),
|
|
37
|
+
generators.typescriptClient({
|
|
38
|
+
clientName: "Client",
|
|
39
|
+
outputPath: "<some-output-file>",
|
|
40
|
+
}),
|
|
41
|
+
// etc...
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Run the codegen command
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# run generators from an app definition file
|
|
50
|
+
# app definition files can be TS, JS, or JSON
|
|
51
|
+
arri codegen AppDefinition.ts
|
|
52
|
+
arri codegen AppDefinition.json
|
|
53
|
+
|
|
54
|
+
# run generators from an app definition JSON http endpoint
|
|
55
|
+
arri codegen https://example.com/__definition
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Codegen Flags
|
|
59
|
+
|
|
60
|
+
| Flag | Aliases | Description |
|
|
61
|
+
| -------- | ------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| --config | -c | Path to an arri config. Default is `arri.config.ts` |
|
|
63
|
+
| --watch | -w | Watch an app definition file for changes. Only works on files. It will throw an error if invoked against an HTTP endpoint |
|
|
21
64
|
|
|
22
65
|
## Usage with @arrirpc/server
|
|
23
66
|
|
package/dist/cli.cjs
CHANGED
|
@@ -11,7 +11,8 @@ 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.09919c6d.cjs');
|
|
15
|
+
const chokidar = require('chokidar');
|
|
15
16
|
const ofetch = require('ofetch');
|
|
16
17
|
const Degit = require('degit');
|
|
17
18
|
const enquirer = require('enquirer');
|
|
@@ -236,74 +237,136 @@ const codegen = citty.defineCommand({
|
|
|
236
237
|
type: "string",
|
|
237
238
|
alias: ["c"],
|
|
238
239
|
default: "arri.config.ts"
|
|
240
|
+
},
|
|
241
|
+
watch: {
|
|
242
|
+
type: "boolean",
|
|
243
|
+
alias: ["w"],
|
|
244
|
+
default: false
|
|
239
245
|
}
|
|
240
246
|
},
|
|
241
247
|
async run({ args }) {
|
|
248
|
+
if (!fs__default$1.existsSync(path__default.resolve(args.config))) {
|
|
249
|
+
dev.logger.error(
|
|
250
|
+
`Unable to load arri config at ${args.config}. Please specify a valid config path with --config`
|
|
251
|
+
);
|
|
252
|
+
process.exit(1);
|
|
253
|
+
}
|
|
254
|
+
const { config } = await c12.loadConfig({
|
|
255
|
+
configFile: path__default.resolve(args.config)
|
|
256
|
+
});
|
|
257
|
+
if (!dev.isArriConfig(config)) {
|
|
258
|
+
dev.logger.error(`Invalid arri config at ${args.config}`);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
if (!config.generators?.length) {
|
|
262
|
+
dev.logger.error(`No generators specified in ${args.config}`);
|
|
263
|
+
process.exit(1);
|
|
264
|
+
}
|
|
242
265
|
const isUrl = args.schema.startsWith("http://") || args.schema.startsWith("https://");
|
|
243
|
-
const isTs = args.schema.endsWith(".ts");
|
|
244
|
-
const isJs = args.schema.endsWith(".js");
|
|
245
266
|
let def;
|
|
246
267
|
if (isUrl) {
|
|
268
|
+
if (args.watch)
|
|
269
|
+
throw new Error("Cannot watch a URL");
|
|
247
270
|
const result = await ofetch.ofetch(args.schema);
|
|
248
271
|
if (!codegenUtils.isAppDefinition(result)) {
|
|
249
272
|
throw new Error(`Invalid App Definition at ${args.schema}`);
|
|
250
273
|
}
|
|
251
274
|
def = result;
|
|
252
275
|
} else {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
configFile: args.schema
|
|
259
|
-
});
|
|
260
|
-
if (!codegenUtils.isAppDefinition(schemaResult.config)) {
|
|
261
|
-
throw new Error(`Invalid App Definition at ${args.schema}`);
|
|
262
|
-
}
|
|
263
|
-
def = schemaResult.config;
|
|
264
|
-
} else {
|
|
265
|
-
const jsonString = JSON.parse(
|
|
266
|
-
fs__default$1.readFileSync(args.schema, { encoding: "utf-8" })
|
|
267
|
-
);
|
|
268
|
-
if (!codegenUtils.isAppDefinition(jsonString)) {
|
|
269
|
-
throw new Error(`Invalid App Definition at ${args.schema}`);
|
|
276
|
+
try {
|
|
277
|
+
def = await getAppDefinitionFromFile(args.schema);
|
|
278
|
+
} catch (err) {
|
|
279
|
+
if (!args.watch) {
|
|
280
|
+
throw err;
|
|
270
281
|
}
|
|
271
|
-
|
|
282
|
+
dev.logger.error(err);
|
|
272
283
|
}
|
|
273
284
|
}
|
|
274
|
-
if (!def) {
|
|
285
|
+
if (!def && !args.watch) {
|
|
275
286
|
throw new Error(`Unable to find App Definition at ${args.schema}`);
|
|
276
287
|
}
|
|
277
|
-
if (
|
|
278
|
-
|
|
279
|
-
|
|
288
|
+
if (def) {
|
|
289
|
+
const initialStartTime = /* @__PURE__ */ new Date();
|
|
290
|
+
await runGenerators(def, config.generators ?? []);
|
|
291
|
+
dev.logger.success(
|
|
292
|
+
`Generators completed in ${( new Date()).getTime() - initialStartTime.getTime()}ms`
|
|
280
293
|
);
|
|
281
294
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
295
|
+
if (!args.watch)
|
|
296
|
+
process.exit(0);
|
|
297
|
+
const watcher = chokidar.watch(args.schema, { ignoreInitial: true });
|
|
298
|
+
dev.logger.info(`Watching ${args.schema} for changes...`);
|
|
299
|
+
watcher.on("add", async (_, __) => {
|
|
300
|
+
try {
|
|
301
|
+
dev.logger.info(`Change detected`);
|
|
302
|
+
const startTime = /* @__PURE__ */ new Date();
|
|
303
|
+
await runGenerators(
|
|
304
|
+
await getAppDefinitionFromFile(args.schema),
|
|
305
|
+
config.generators ?? []
|
|
306
|
+
);
|
|
307
|
+
dev.logger.success(
|
|
308
|
+
`Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
|
|
309
|
+
);
|
|
310
|
+
} catch (err) {
|
|
311
|
+
dev.logger.error(err);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
watcher.on("change", async (_, __) => {
|
|
315
|
+
try {
|
|
316
|
+
dev.logger.info(`Change detected in AppDefinition file.`);
|
|
317
|
+
const startTime = /* @__PURE__ */ new Date();
|
|
318
|
+
await runGenerators(
|
|
319
|
+
await getAppDefinitionFromFile(args.schema),
|
|
320
|
+
config.generators ?? []
|
|
321
|
+
);
|
|
322
|
+
dev.logger.success(
|
|
323
|
+
`Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
|
|
324
|
+
);
|
|
325
|
+
} catch (err) {
|
|
326
|
+
dev.logger.error(err);
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
async function getAppDefinitionFromFile(file) {
|
|
332
|
+
if (!fs__default$1.existsSync(file)) {
|
|
333
|
+
throw new Error(`Unable to find ${file}`);
|
|
334
|
+
}
|
|
335
|
+
const isTs = file.endsWith(".ts");
|
|
336
|
+
const isJs = file.endsWith(".js");
|
|
337
|
+
if (isTs || isJs) {
|
|
338
|
+
const schemaResult = await c12.loadConfig({
|
|
339
|
+
configFile: file
|
|
340
|
+
});
|
|
341
|
+
if (!codegenUtils.isAppDefinition(schemaResult.config)) {
|
|
342
|
+
throw new Error(`Invalid App Definition at ${file}`);
|
|
290
343
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
(gen) => gen.generator(
|
|
296
|
-
def ?? {
|
|
297
|
-
schemaVersion: "0.0.6",
|
|
298
|
-
procedures: {},
|
|
299
|
-
definitions: {}
|
|
300
|
-
}
|
|
301
|
-
)
|
|
302
|
-
)
|
|
344
|
+
return schemaResult.config;
|
|
345
|
+
} else {
|
|
346
|
+
const parsingResult = JSON.parse(
|
|
347
|
+
fs__default$1.readFileSync(file, { encoding: "utf-8" })
|
|
303
348
|
);
|
|
304
|
-
|
|
349
|
+
if (!codegenUtils.isAppDefinition(parsingResult)) {
|
|
350
|
+
throw new Error(`Invalid App Definition at ${file}`);
|
|
351
|
+
}
|
|
352
|
+
return parsingResult;
|
|
305
353
|
}
|
|
306
|
-
}
|
|
354
|
+
}
|
|
355
|
+
async function runGenerators(def, generators) {
|
|
356
|
+
dev.logger.info(`Generating ${generators?.length} client(s)`);
|
|
357
|
+
await Promise.allSettled(
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
359
|
+
generators.map(
|
|
360
|
+
(gen) => gen.generator(
|
|
361
|
+
def ?? {
|
|
362
|
+
schemaVersion: "0.0.6",
|
|
363
|
+
procedures: {},
|
|
364
|
+
definitions: {}
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
)
|
|
368
|
+
);
|
|
369
|
+
}
|
|
307
370
|
|
|
308
371
|
const init = citty.defineCommand({
|
|
309
372
|
meta: {
|
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,8 @@ 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 getArriPackageMetadata, h 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 getArriPackageMetadata, h as dev } from './shared/arri.339f2f92.mjs';
|
|
13
|
+
import { watch } from 'chokidar';
|
|
13
14
|
import { ofetch } from 'ofetch';
|
|
14
15
|
import Degit from 'degit';
|
|
15
16
|
import enquirer from 'enquirer';
|
|
@@ -223,74 +224,136 @@ const codegen = defineCommand({
|
|
|
223
224
|
type: "string",
|
|
224
225
|
alias: ["c"],
|
|
225
226
|
default: "arri.config.ts"
|
|
227
|
+
},
|
|
228
|
+
watch: {
|
|
229
|
+
type: "boolean",
|
|
230
|
+
alias: ["w"],
|
|
231
|
+
default: false
|
|
226
232
|
}
|
|
227
233
|
},
|
|
228
234
|
async run({ args }) {
|
|
235
|
+
if (!fs$1.existsSync(path.resolve(args.config))) {
|
|
236
|
+
logger.error(
|
|
237
|
+
`Unable to load arri config at ${args.config}. Please specify a valid config path with --config`
|
|
238
|
+
);
|
|
239
|
+
process.exit(1);
|
|
240
|
+
}
|
|
241
|
+
const { config } = await loadConfig({
|
|
242
|
+
configFile: path.resolve(args.config)
|
|
243
|
+
});
|
|
244
|
+
if (!isArriConfig(config)) {
|
|
245
|
+
logger.error(`Invalid arri config at ${args.config}`);
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
if (!config.generators?.length) {
|
|
249
|
+
logger.error(`No generators specified in ${args.config}`);
|
|
250
|
+
process.exit(1);
|
|
251
|
+
}
|
|
229
252
|
const isUrl = args.schema.startsWith("http://") || args.schema.startsWith("https://");
|
|
230
|
-
const isTs = args.schema.endsWith(".ts");
|
|
231
|
-
const isJs = args.schema.endsWith(".js");
|
|
232
253
|
let def;
|
|
233
254
|
if (isUrl) {
|
|
255
|
+
if (args.watch)
|
|
256
|
+
throw new Error("Cannot watch a URL");
|
|
234
257
|
const result = await ofetch(args.schema);
|
|
235
258
|
if (!isAppDefinition(result)) {
|
|
236
259
|
throw new Error(`Invalid App Definition at ${args.schema}`);
|
|
237
260
|
}
|
|
238
261
|
def = result;
|
|
239
262
|
} else {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
configFile: args.schema
|
|
246
|
-
});
|
|
247
|
-
if (!isAppDefinition(schemaResult.config)) {
|
|
248
|
-
throw new Error(`Invalid App Definition at ${args.schema}`);
|
|
249
|
-
}
|
|
250
|
-
def = schemaResult.config;
|
|
251
|
-
} else {
|
|
252
|
-
const jsonString = JSON.parse(
|
|
253
|
-
fs$1.readFileSync(args.schema, { encoding: "utf-8" })
|
|
254
|
-
);
|
|
255
|
-
if (!isAppDefinition(jsonString)) {
|
|
256
|
-
throw new Error(`Invalid App Definition at ${args.schema}`);
|
|
263
|
+
try {
|
|
264
|
+
def = await getAppDefinitionFromFile(args.schema);
|
|
265
|
+
} catch (err) {
|
|
266
|
+
if (!args.watch) {
|
|
267
|
+
throw err;
|
|
257
268
|
}
|
|
258
|
-
|
|
269
|
+
logger.error(err);
|
|
259
270
|
}
|
|
260
271
|
}
|
|
261
|
-
if (!def) {
|
|
272
|
+
if (!def && !args.watch) {
|
|
262
273
|
throw new Error(`Unable to find App Definition at ${args.schema}`);
|
|
263
274
|
}
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
|
|
275
|
+
if (def) {
|
|
276
|
+
const initialStartTime = /* @__PURE__ */ new Date();
|
|
277
|
+
await runGenerators(def, config.generators ?? []);
|
|
278
|
+
logger.success(
|
|
279
|
+
`Generators completed in ${( new Date()).getTime() - initialStartTime.getTime()}ms`
|
|
267
280
|
);
|
|
268
281
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
282
|
+
if (!args.watch)
|
|
283
|
+
process.exit(0);
|
|
284
|
+
const watcher = watch(args.schema, { ignoreInitial: true });
|
|
285
|
+
logger.info(`Watching ${args.schema} for changes...`);
|
|
286
|
+
watcher.on("add", async (_, __) => {
|
|
287
|
+
try {
|
|
288
|
+
logger.info(`Change detected`);
|
|
289
|
+
const startTime = /* @__PURE__ */ new Date();
|
|
290
|
+
await runGenerators(
|
|
291
|
+
await getAppDefinitionFromFile(args.schema),
|
|
292
|
+
config.generators ?? []
|
|
293
|
+
);
|
|
294
|
+
logger.success(
|
|
295
|
+
`Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
|
|
296
|
+
);
|
|
297
|
+
} catch (err) {
|
|
298
|
+
logger.error(err);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
watcher.on("change", async (_, __) => {
|
|
302
|
+
try {
|
|
303
|
+
logger.info(`Change detected in AppDefinition file.`);
|
|
304
|
+
const startTime = /* @__PURE__ */ new Date();
|
|
305
|
+
await runGenerators(
|
|
306
|
+
await getAppDefinitionFromFile(args.schema),
|
|
307
|
+
config.generators ?? []
|
|
308
|
+
);
|
|
309
|
+
logger.success(
|
|
310
|
+
`Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
|
|
311
|
+
);
|
|
312
|
+
} catch (err) {
|
|
313
|
+
logger.error(err);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
async function getAppDefinitionFromFile(file) {
|
|
319
|
+
if (!fs$1.existsSync(file)) {
|
|
320
|
+
throw new Error(`Unable to find ${file}`);
|
|
321
|
+
}
|
|
322
|
+
const isTs = file.endsWith(".ts");
|
|
323
|
+
const isJs = file.endsWith(".js");
|
|
324
|
+
if (isTs || isJs) {
|
|
325
|
+
const schemaResult = await loadConfig({
|
|
326
|
+
configFile: file
|
|
327
|
+
});
|
|
328
|
+
if (!isAppDefinition(schemaResult.config)) {
|
|
329
|
+
throw new Error(`Invalid App Definition at ${file}`);
|
|
277
330
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
(gen) => gen.generator(
|
|
283
|
-
def ?? {
|
|
284
|
-
schemaVersion: "0.0.6",
|
|
285
|
-
procedures: {},
|
|
286
|
-
definitions: {}
|
|
287
|
-
}
|
|
288
|
-
)
|
|
289
|
-
)
|
|
331
|
+
return schemaResult.config;
|
|
332
|
+
} else {
|
|
333
|
+
const parsingResult = JSON.parse(
|
|
334
|
+
fs$1.readFileSync(file, { encoding: "utf-8" })
|
|
290
335
|
);
|
|
291
|
-
|
|
336
|
+
if (!isAppDefinition(parsingResult)) {
|
|
337
|
+
throw new Error(`Invalid App Definition at ${file}`);
|
|
338
|
+
}
|
|
339
|
+
return parsingResult;
|
|
292
340
|
}
|
|
293
|
-
}
|
|
341
|
+
}
|
|
342
|
+
async function runGenerators(def, generators) {
|
|
343
|
+
logger.info(`Generating ${generators?.length} client(s)`);
|
|
344
|
+
await Promise.allSettled(
|
|
345
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
346
|
+
generators.map(
|
|
347
|
+
(gen) => gen.generator(
|
|
348
|
+
def ?? {
|
|
349
|
+
schemaVersion: "0.0.6",
|
|
350
|
+
procedures: {},
|
|
351
|
+
definitions: {}
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
)
|
|
355
|
+
);
|
|
356
|
+
}
|
|
294
357
|
|
|
295
358
|
const init = defineCommand({
|
|
296
359
|
meta: {
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const codegenDart = require('@arrirpc/codegen-dart');
|
|
|
4
4
|
const codegenKotlin = require('@arrirpc/codegen-kotlin');
|
|
5
5
|
const codegenRust = require('@arrirpc/codegen-rust');
|
|
6
6
|
const codegenTs = require('@arrirpc/codegen-ts');
|
|
7
|
-
const dev = require('./shared/arri.
|
|
7
|
+
const dev = require('./shared/arri.09919c6d.cjs');
|
|
8
8
|
const codegenUtils = require('@arrirpc/codegen-utils');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('@joshmossas/listhen');
|
package/dist/index.d.cts
CHANGED
|
@@ -34,6 +34,11 @@ interface ArriConfig {
|
|
|
34
34
|
* Use this to add directories outside of the srcDir that should trigger a dev server reload
|
|
35
35
|
*/
|
|
36
36
|
additionalWatchDirs?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* If you want to serve both https and http on the dev server
|
|
39
|
+
*/
|
|
40
|
+
httpWithHttps?: boolean;
|
|
41
|
+
httpWithHttpsPort?: number;
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
declare function isArriConfig(input: unknown): input is ArriConfig;
|
package/dist/index.d.mts
CHANGED
|
@@ -34,6 +34,11 @@ interface ArriConfig {
|
|
|
34
34
|
* Use this to add directories outside of the srcDir that should trigger a dev server reload
|
|
35
35
|
*/
|
|
36
36
|
additionalWatchDirs?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* If you want to serve both https and http on the dev server
|
|
39
|
+
*/
|
|
40
|
+
httpWithHttps?: boolean;
|
|
41
|
+
httpWithHttpsPort?: number;
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
declare function isArriConfig(input: unknown): input is ArriConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ interface ArriConfig {
|
|
|
34
34
|
* Use this to add directories outside of the srcDir that should trigger a dev server reload
|
|
35
35
|
*/
|
|
36
36
|
additionalWatchDirs?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* If you want to serve both https and http on the dev server
|
|
39
|
+
*/
|
|
40
|
+
httpWithHttps?: boolean;
|
|
41
|
+
httpWithHttpsPort?: number;
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
declare function isArriConfig(input: unknown): input is ArriConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { dartClientGenerator } from '@arrirpc/codegen-dart';
|
|
|
2
2
|
import { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
|
|
3
3
|
import { rustClientGenerator } from '@arrirpc/codegen-rust';
|
|
4
4
|
import { typescriptClientGenerator } from '@arrirpc/codegen-ts';
|
|
5
|
-
export { D as DEV_DEFINITION_ENDPOINT, d as defaultConfig, b as defineConfig, i as isArriConfig, a as isResolvedArriConfig } from './shared/arri.
|
|
5
|
+
export { D as DEV_DEFINITION_ENDPOINT, d as defaultConfig, b as defineConfig, i as isArriConfig, a as isResolvedArriConfig } from './shared/arri.339f2f92.mjs';
|
|
6
6
|
export { createAppDefinition } from '@arrirpc/codegen-utils';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import '@joshmossas/listhen';
|
|
@@ -364,6 +364,28 @@ async function createDevServer(config) {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
});
|
|
367
|
+
let secondaryListener;
|
|
368
|
+
if (config.devServer.httpWithHttps) {
|
|
369
|
+
secondaryListener = await listhen.listen(h3.toNodeListener(app), {
|
|
370
|
+
port: config.devServer.httpWithHttpsPort ?? config.port + 1,
|
|
371
|
+
https: false,
|
|
372
|
+
http2: config.http2,
|
|
373
|
+
public: true,
|
|
374
|
+
ws: {
|
|
375
|
+
resolve(info) {
|
|
376
|
+
if (ws?.resolve) {
|
|
377
|
+
return ws.resolve(info);
|
|
378
|
+
}
|
|
379
|
+
return {};
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
qr: false,
|
|
383
|
+
showURL: false
|
|
384
|
+
});
|
|
385
|
+
logger.info(
|
|
386
|
+
`Serving unencrypted traffic from port ${secondaryListener.address.port}`
|
|
387
|
+
);
|
|
388
|
+
}
|
|
367
389
|
async function reload() {
|
|
368
390
|
const appEntry = (await import(path__default.resolve(
|
|
369
391
|
config.rootDir,
|
|
@@ -378,6 +400,7 @@ async function createDevServer(config) {
|
|
|
378
400
|
return {
|
|
379
401
|
h3App: app,
|
|
380
402
|
listener,
|
|
403
|
+
secondaryListener,
|
|
381
404
|
reload,
|
|
382
405
|
ws
|
|
383
406
|
};
|
|
@@ -343,6 +343,28 @@ async function createDevServer(config) {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
});
|
|
346
|
+
let secondaryListener;
|
|
347
|
+
if (config.devServer.httpWithHttps) {
|
|
348
|
+
secondaryListener = await listen(toNodeListener(app), {
|
|
349
|
+
port: config.devServer.httpWithHttpsPort ?? config.port + 1,
|
|
350
|
+
https: false,
|
|
351
|
+
http2: config.http2,
|
|
352
|
+
public: true,
|
|
353
|
+
ws: {
|
|
354
|
+
resolve(info) {
|
|
355
|
+
if (ws?.resolve) {
|
|
356
|
+
return ws.resolve(info);
|
|
357
|
+
}
|
|
358
|
+
return {};
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
qr: false,
|
|
362
|
+
showURL: false
|
|
363
|
+
});
|
|
364
|
+
logger.info(
|
|
365
|
+
`Serving unencrypted traffic from port ${secondaryListener.address.port}`
|
|
366
|
+
);
|
|
367
|
+
}
|
|
346
368
|
async function reload() {
|
|
347
369
|
const appEntry = (await import(path.resolve(
|
|
348
370
|
config.rootDir,
|
|
@@ -357,6 +379,7 @@ async function createDevServer(config) {
|
|
|
357
379
|
return {
|
|
358
380
|
h3App: app,
|
|
359
381
|
listener,
|
|
382
|
+
secondaryListener,
|
|
360
383
|
reload,
|
|
361
384
|
ws
|
|
362
385
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arri",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"ofetch": "^1.3.4",
|
|
40
40
|
"pathe": "^1.1.2",
|
|
41
41
|
"prettier": "^3.3.3",
|
|
42
|
-
"@arrirpc/codegen-dart": "0.57.
|
|
43
|
-
"@arrirpc/codegen-rust": "0.57.
|
|
44
|
-
"@arrirpc/
|
|
45
|
-
"@arrirpc/codegen-
|
|
46
|
-
"@arrirpc/
|
|
47
|
-
"@arrirpc/codegen-
|
|
42
|
+
"@arrirpc/codegen-dart": "0.57.4",
|
|
43
|
+
"@arrirpc/codegen-rust": "0.57.4",
|
|
44
|
+
"@arrirpc/schema": "0.57.4",
|
|
45
|
+
"@arrirpc/codegen-kotlin": "0.57.4",
|
|
46
|
+
"@arrirpc/codegen-utils": "0.57.4",
|
|
47
|
+
"@arrirpc/codegen-ts": "0.57.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/degit": "^2.8.6"
|