arri 0.15.1 → 0.16.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/dist/cli.cjs CHANGED
@@ -12,7 +12,7 @@ const esbuild = require('esbuild');
12
12
  const esbuildPluginReplace = require('esbuild-plugin-replace');
13
13
  const path = require('pathe');
14
14
  const prettier = require('prettier');
15
- const config = require('./shared/arri.2eb37786.cjs');
15
+ const config = require('./shared/arri.beaf548c.cjs');
16
16
  const globby = require('globby');
17
17
  const scule = require('scule');
18
18
  const arriCodegenDart = require('arri-codegen-dart');
@@ -302,6 +302,12 @@ const require = topLevelCreateRequire(import.meta.url);`
302
302
  const appModule = path__default.resolve(config.rootDir, config.srcDir, config.entry);
303
303
  const appImportParts = path__default.relative(path__default.resolve(config.rootDir, config.srcDir), appModule).split(".");
304
304
  appImportParts.pop();
305
+ let httpsString = ``;
306
+ if (config.https === true) {
307
+ httpsString = `https: true,`;
308
+ } else if (typeof config.https === "object") {
309
+ httpsString = `https: { cert: '${config.https.cert}', key: '${config.https.key}', passphrase: ${config.https.passphrase ? `'${config.https.passphrase}'` : "undefined"}},`;
310
+ }
305
311
  const virtualEntry = `import { toNodeListener } from 'arri';
306
312
  import { listen } from 'listhen';
307
313
  import app from './${OUT_APP_FILE}';
@@ -309,6 +315,7 @@ import app from './${OUT_APP_FILE}';
309
315
  void listen(toNodeListener(app.h3App), {
310
316
  port: process.env.PORT ?? ${config.port},
311
317
  public: true,
318
+ ${httpsString}
312
319
  });`;
313
320
  await fs__default.writeFile(
314
321
  path__default.resolve(config.rootDir, ".output", GEN_SERVER_ENTRY_FILE),
@@ -440,7 +447,8 @@ const startListener = (config, showQr = false) => listhen.listenAndWatch(path__d
440
447
  public: true,
441
448
  port: config.port,
442
449
  logger: logger$1,
443
- qr: showQr
450
+ qr: showQr,
451
+ https: config.https
444
452
  });
445
453
  async function bundleFilesContext(config) {
446
454
  const serverContent = `import app from './${OUT_APP_FILE}';
@@ -536,8 +544,12 @@ async function startDevServer(config) {
536
544
  }
537
545
  async function generateClients(config$1) {
538
546
  try {
547
+ const protocol = config$1.https === true || typeof config$1.https === "object" ? "https" : "http";
548
+ if (protocol === "https") {
549
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
550
+ }
539
551
  const result = await ofetch.ofetch(
540
- `http://127.0.0.1:${config$1.port}${config.DEV_DEFINITION_ENDPOINT}`
552
+ `${protocol}://127.0.0.1:${config$1.port}${config.DEV_DEFINITION_ENDPOINT}`
541
553
  );
542
554
  if (!arriCodegenUtils.isAppDefinition(result)) {
543
555
  return;
package/dist/cli.mjs CHANGED
@@ -11,7 +11,7 @@ import { build as build$1 } from 'esbuild';
11
11
  import { replace } from 'esbuild-plugin-replace';
12
12
  import path from 'pathe';
13
13
  import prettier from 'prettier';
14
- import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.28516ef9.mjs';
14
+ import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.ff70fe08.mjs';
15
15
  import { globby } from 'globby';
16
16
  import { camelCase, kebabCase } from 'scule';
17
17
  import { dartClientGenerator } from 'arri-codegen-dart';
@@ -278,6 +278,12 @@ const require = topLevelCreateRequire(import.meta.url);`
278
278
  const appModule = path.resolve(config.rootDir, config.srcDir, config.entry);
279
279
  const appImportParts = path.relative(path.resolve(config.rootDir, config.srcDir), appModule).split(".");
280
280
  appImportParts.pop();
281
+ let httpsString = ``;
282
+ if (config.https === true) {
283
+ httpsString = `https: true,`;
284
+ } else if (typeof config.https === "object") {
285
+ httpsString = `https: { cert: '${config.https.cert}', key: '${config.https.key}', passphrase: ${config.https.passphrase ? `'${config.https.passphrase}'` : "undefined"}},`;
286
+ }
281
287
  const virtualEntry = `import { toNodeListener } from 'arri';
282
288
  import { listen } from 'listhen';
283
289
  import app from './${OUT_APP_FILE}';
@@ -285,6 +291,7 @@ import app from './${OUT_APP_FILE}';
285
291
  void listen(toNodeListener(app.h3App), {
286
292
  port: process.env.PORT ?? ${config.port},
287
293
  public: true,
294
+ ${httpsString}
288
295
  });`;
289
296
  await fs.writeFile(
290
297
  path.resolve(config.rootDir, ".output", GEN_SERVER_ENTRY_FILE),
@@ -416,7 +423,8 @@ const startListener = (config, showQr = false) => listenAndWatch(path.resolve(co
416
423
  public: true,
417
424
  port: config.port,
418
425
  logger: logger$1,
419
- qr: showQr
426
+ qr: showQr,
427
+ https: config.https
420
428
  });
421
429
  async function bundleFilesContext(config) {
422
430
  const serverContent = `import app from './${OUT_APP_FILE}';
@@ -512,8 +520,12 @@ async function startDevServer(config) {
512
520
  }
513
521
  async function generateClients(config) {
514
522
  try {
523
+ const protocol = config.https === true || typeof config.https === "object" ? "https" : "http";
524
+ if (protocol === "https") {
525
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
526
+ }
515
527
  const result = await ofetch(
516
- `http://127.0.0.1:${config.port}${DEV_DEFINITION_ENDPOINT}`
528
+ `${protocol}://127.0.0.1:${config.port}${DEV_DEFINITION_ENDPOINT}`
517
529
  );
518
530
  if (!isAppDefinition(result)) {
519
531
  return;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const config = require('./shared/arri.2eb37786.cjs');
3
+ const config = require('./shared/arri.beaf548c.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-validate');
6
6
  require('arri-codegen-utils');
package/dist/index.d.cts CHANGED
@@ -239,6 +239,11 @@ interface ArriConfig {
239
239
  clientGenerators?: Array<ClientGenerator<any>>;
240
240
  buildDir?: string;
241
241
  esbuild?: Omit<BuildOptions, "outfile" | "outdir" | "entryNames" | "entryPoints">;
242
+ https?: {
243
+ cert: string;
244
+ key: string;
245
+ passphrase?: string;
246
+ } | boolean;
242
247
  }
243
248
  declare function isArriConfig(input: unknown): input is ArriConfig;
244
249
  declare function isResolvedArriConfig(input: unknown): input is ResolvedArriConfig;
package/dist/index.d.mts CHANGED
@@ -239,6 +239,11 @@ interface ArriConfig {
239
239
  clientGenerators?: Array<ClientGenerator<any>>;
240
240
  buildDir?: string;
241
241
  esbuild?: Omit<BuildOptions, "outfile" | "outdir" | "entryNames" | "entryPoints">;
242
+ https?: {
243
+ cert: string;
244
+ key: string;
245
+ passphrase?: string;
246
+ } | boolean;
242
247
  }
243
248
  declare function isArriConfig(input: unknown): input is ArriConfig;
244
249
  declare function isResolvedArriConfig(input: unknown): input is ResolvedArriConfig;
package/dist/index.d.ts CHANGED
@@ -239,6 +239,11 @@ interface ArriConfig {
239
239
  clientGenerators?: Array<ClientGenerator<any>>;
240
240
  buildDir?: string;
241
241
  esbuild?: Omit<BuildOptions, "outfile" | "outdir" | "entryNames" | "entryPoints">;
242
+ https?: {
243
+ cert: string;
244
+ key: string;
245
+ passphrase?: string;
246
+ } | boolean;
242
247
  }
243
248
  declare function isArriConfig(input: unknown): input is ArriConfig;
244
249
  declare function isResolvedArriConfig(input: unknown): input is ResolvedArriConfig;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, B as EventStreamConnection, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, w as defineEventStreamRpc, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, y as formatSse, z as formatSseList, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, x as isEventStreamRpc, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, C as registerEventStreamRpc, s as registerRoute, r as registerRpc, u as setSseHeaders, v as validateRpcRequestInput } from './shared/arri.28516ef9.mjs';
1
+ export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, B as EventStreamConnection, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, w as defineEventStreamRpc, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, y as formatSse, z as formatSseList, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, x as isEventStreamRpc, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, C as registerEventStreamRpc, s as registerRoute, r as registerRpc, u as setSseHeaders, v as validateRpcRequestInput } from './shared/arri.ff70fe08.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-validate';
4
4
  import 'arri-codegen-utils';
@@ -967,7 +967,8 @@ const defaultConfig = {
967
967
  clientGenerators: [],
968
968
  buildDir: ".arri",
969
969
  serverEntry: "",
970
- esbuild: {}
970
+ esbuild: {},
971
+ https: false
971
972
  };
972
973
  function defineConfig(config) {
973
974
  return {
@@ -980,7 +981,8 @@ function defineConfig(config) {
980
981
  clientGenerators: config.clientGenerators ?? defaultConfig.clientGenerators,
981
982
  buildDir: config.buildDir ?? defaultConfig.buildDir,
982
983
  esbuild: config.esbuild ?? defaultConfig.esbuild,
983
- serverEntry: config.serverEntry ?? ""
984
+ serverEntry: config.serverEntry ?? "",
985
+ https: config.https ?? false
984
986
  };
985
987
  }
986
988
 
@@ -965,7 +965,8 @@ const defaultConfig = {
965
965
  clientGenerators: [],
966
966
  buildDir: ".arri",
967
967
  serverEntry: "",
968
- esbuild: {}
968
+ esbuild: {},
969
+ https: false
969
970
  };
970
971
  function defineConfig(config) {
971
972
  return {
@@ -978,7 +979,8 @@ function defineConfig(config) {
978
979
  clientGenerators: config.clientGenerators ?? defaultConfig.clientGenerators,
979
980
  buildDir: config.buildDir ?? defaultConfig.buildDir,
980
981
  esbuild: config.esbuild ?? defaultConfig.esbuild,
981
- serverEntry: config.serverEntry ?? ""
982
+ serverEntry: config.serverEntry ?? "",
983
+ https: config.https ?? false
982
984
  };
983
985
  }
984
986
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -40,10 +40,10 @@
40
40
  "prettier": "^3.1.0",
41
41
  "scule": "^1.1.0",
42
42
  "uncrypto": "^0.1.3",
43
- "arri-codegen-dart": "0.15.1",
44
- "arri-codegen-ts": "0.15.1",
45
- "arri-codegen-utils": "0.15.1",
46
- "arri-validate": "0.15.1"
43
+ "arri-codegen-dart": "0.16.0",
44
+ "arri-codegen-utils": "0.16.0",
45
+ "arri-validate": "0.16.0",
46
+ "arri-codegen-ts": "0.16.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "listhen": "1.x"