arri 0.16.5 → 0.18.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,13 +12,13 @@ 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.9c3d197c.cjs');
15
+ const config = require('./shared/arri.34c274c5.cjs');
16
16
  const globby = require('globby');
17
17
  const scule = require('scule');
18
18
  const arriCodegenDart = require('arri-codegen-dart');
19
19
  const ofetch = require('ofetch');
20
+ const listhen = require('@joshmossas/listhen');
20
21
  const chokidar = require('chokidar');
21
- const listhen = require('listhen');
22
22
  const Degit = require('degit');
23
23
  require('h3');
24
24
  require('arri-validate');
@@ -309,12 +309,13 @@ const require = topLevelCreateRequire(import.meta.url);`
309
309
  httpsString = `https: { cert: '${config.https.cert}', key: '${config.https.key}', passphrase: ${config.https.passphrase ? `'${config.https.passphrase}'` : "undefined"}},`;
310
310
  }
311
311
  const virtualEntry = `import { toNodeListener } from 'arri';
312
- import { listen } from 'listhen';
312
+ import { listen } from '@joshmossas/listhen';
313
313
  import app from './${OUT_APP_FILE}';
314
314
 
315
315
  void listen(toNodeListener(app.h3App), {
316
316
  port: process.env.PORT ?? ${config.port},
317
317
  public: true,
318
+ http2: ${config.http2 ?? false},
318
319
  ${httpsString}
319
320
  });`;
320
321
  await fs__default.writeFile(
@@ -448,7 +449,8 @@ const startListener = (config, showQr = false) => listhen.listenAndWatch(path__d
448
449
  port: config.port,
449
450
  logger: logger$1,
450
451
  qr: showQr,
451
- https: config.https
452
+ https: config.https,
453
+ http2: config.http2
452
454
  });
453
455
  async function bundleFilesContext(config) {
454
456
  const serverContent = `import app from './${OUT_APP_FILE}';
@@ -573,7 +575,6 @@ async function createEntryModule(config) {
573
575
  const appImportParts = path__default.relative(path__default.resolve(config.rootDir, config.srcDir), appModule).split(".");
574
576
  appImportParts.pop();
575
577
  const virtualEntry = `import { toNodeListener } from 'h3';
576
- import { listen } from 'listhen';
577
578
  import app from './${GEN_APP_FILE}';
578
579
 
579
580
  export default app.h3App;`;
package/dist/cli.mjs CHANGED
@@ -11,13 +11,13 @@ 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.883e4574.mjs';
14
+ import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.0ddf73b7.mjs';
15
15
  import { globby } from 'globby';
16
16
  import { camelCase, kebabCase } from 'scule';
17
17
  import { dartClientGenerator } from 'arri-codegen-dart';
18
18
  import { ofetch } from 'ofetch';
19
+ import { listenAndWatch } from '@joshmossas/listhen';
19
20
  import chokidar from 'chokidar';
20
- import { listenAndWatch } from 'listhen';
21
21
  import Degit from 'degit';
22
22
  import 'h3';
23
23
  import 'arri-validate';
@@ -285,12 +285,13 @@ const require = topLevelCreateRequire(import.meta.url);`
285
285
  httpsString = `https: { cert: '${config.https.cert}', key: '${config.https.key}', passphrase: ${config.https.passphrase ? `'${config.https.passphrase}'` : "undefined"}},`;
286
286
  }
287
287
  const virtualEntry = `import { toNodeListener } from 'arri';
288
- import { listen } from 'listhen';
288
+ import { listen } from '@joshmossas/listhen';
289
289
  import app from './${OUT_APP_FILE}';
290
290
 
291
291
  void listen(toNodeListener(app.h3App), {
292
292
  port: process.env.PORT ?? ${config.port},
293
293
  public: true,
294
+ http2: ${config.http2 ?? false},
294
295
  ${httpsString}
295
296
  });`;
296
297
  await fs.writeFile(
@@ -424,7 +425,8 @@ const startListener = (config, showQr = false) => listenAndWatch(path.resolve(co
424
425
  port: config.port,
425
426
  logger: logger$1,
426
427
  qr: showQr,
427
- https: config.https
428
+ https: config.https,
429
+ http2: config.http2
428
430
  });
429
431
  async function bundleFilesContext(config) {
430
432
  const serverContent = `import app from './${OUT_APP_FILE}';
@@ -549,7 +551,6 @@ async function createEntryModule(config) {
549
551
  const appImportParts = path.relative(path.resolve(config.rootDir, config.srcDir), appModule).split(".");
550
552
  appImportParts.pop();
551
553
  const virtualEntry = `import { toNodeListener } from 'h3';
552
- import { listen } from 'listhen';
553
554
  import app from './${GEN_APP_FILE}';
554
555
 
555
556
  export default app.h3App;`;
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const config = require('./shared/arri.9c3d197c.cjs');
3
+ const config = require('./shared/arri.34c274c5.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-validate');
6
6
  require('arri-codegen-utils');
package/dist/index.d.cts CHANGED
@@ -244,6 +244,7 @@ interface ArriConfig {
244
244
  key: string;
245
245
  passphrase?: string;
246
246
  } | boolean;
247
+ http2?: boolean;
247
248
  }
248
249
  declare function isArriConfig(input: unknown): input is ArriConfig;
249
250
  declare function isResolvedArriConfig(input: unknown): input is ResolvedArriConfig;
package/dist/index.d.mts CHANGED
@@ -244,6 +244,7 @@ interface ArriConfig {
244
244
  key: string;
245
245
  passphrase?: string;
246
246
  } | boolean;
247
+ http2?: boolean;
247
248
  }
248
249
  declare function isArriConfig(input: unknown): input is ArriConfig;
249
250
  declare function isResolvedArriConfig(input: unknown): input is ResolvedArriConfig;
package/dist/index.d.ts CHANGED
@@ -244,6 +244,7 @@ interface ArriConfig {
244
244
  key: string;
245
245
  passphrase?: string;
246
246
  } | boolean;
247
+ http2?: boolean;
247
248
  }
248
249
  declare function isArriConfig(input: unknown): input is ArriConfig;
249
250
  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.883e4574.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.0ddf73b7.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-validate';
4
4
  import 'arri-codegen-utils';
@@ -1,4 +1,4 @@
1
- import { createError, isError, setResponseStatus, send, eventHandler, isPreflightRequest, setResponseHeader, readRawBody, getValidatedQuery, setHeaders, getHeader, defineEventHandler, getQuery, setHeader, createRouter, createApp, sendError } from 'h3';
1
+ import { createError, isError, setResponseStatus, send, eventHandler, isPreflightRequest, setResponseHeader, readRawBody, getValidatedQuery, setHeaders, getHeader, sendStream, defineEventHandler, getQuery, setHeader, createRouter, createApp, sendError } from 'h3';
2
2
  import { a, isAObjectSchema, isARecordSchema, isADiscriminatorSchema } from 'arri-validate';
3
3
  import { isRpcHttpMethod, removeDisallowedChars } from 'arri-codegen-utils';
4
4
  import { kebabCase, pascalCase } from 'scule';
@@ -416,7 +416,6 @@ var __publicField$2 = (obj, key, value) => {
416
416
  };
417
417
  function setSseHeaders(event) {
418
418
  setHeaders(event, {
419
- "Transfer-Encoding": "chunked",
420
419
  "Content-Type": "text/event-stream",
421
420
  Connection: "keep-alive",
422
421
  "Cache-Control": "no-cache"
@@ -482,6 +481,7 @@ class EventStreamConnection {
482
481
  */
483
482
  start() {
484
483
  this.h3Event._handled = true;
484
+ void sendStream(this.h3Event, this.readable);
485
485
  this.pingInterval = setInterval(async () => {
486
486
  await this.publishEvent({
487
487
  id: this.lastEventId,
@@ -537,11 +537,11 @@ class EventStreamConnection {
537
537
  }
538
538
  async publishEvents(events) {
539
539
  const payload = formatSseList(events);
540
- this.h3Event.node.res.write(payload);
540
+ await this.writer.write(this.encoder.encode(payload));
541
541
  }
542
542
  async publishEvent(event) {
543
543
  const payload = formatSse(event);
544
- this.h3Event.node.res.write(payload);
544
+ await this.writer.write(this.encoder.encode(payload));
545
545
  }
546
546
  async cleanup() {
547
547
  if (this.pingInterval) {
@@ -965,7 +965,8 @@ const defaultConfig = {
965
965
  buildDir: ".arri",
966
966
  serverEntry: "",
967
967
  esbuild: {},
968
- https: false
968
+ https: false,
969
+ http2: false
969
970
  };
970
971
  function defineConfig(config) {
971
972
  return {
@@ -979,7 +980,8 @@ function defineConfig(config) {
979
980
  buildDir: config.buildDir ?? defaultConfig.buildDir,
980
981
  esbuild: config.esbuild ?? defaultConfig.esbuild,
981
982
  serverEntry: config.serverEntry ?? "",
982
- https: config.https ?? false
983
+ https: config.https ?? false,
984
+ http2: config.http2 ?? false
983
985
  };
984
986
  }
985
987
 
@@ -418,7 +418,6 @@ var __publicField$2 = (obj, key, value) => {
418
418
  };
419
419
  function setSseHeaders(event) {
420
420
  h3.setHeaders(event, {
421
- "Transfer-Encoding": "chunked",
422
421
  "Content-Type": "text/event-stream",
423
422
  Connection: "keep-alive",
424
423
  "Cache-Control": "no-cache"
@@ -484,6 +483,7 @@ class EventStreamConnection {
484
483
  */
485
484
  start() {
486
485
  this.h3Event._handled = true;
486
+ void h3.sendStream(this.h3Event, this.readable);
487
487
  this.pingInterval = setInterval(async () => {
488
488
  await this.publishEvent({
489
489
  id: this.lastEventId,
@@ -539,11 +539,11 @@ class EventStreamConnection {
539
539
  }
540
540
  async publishEvents(events) {
541
541
  const payload = formatSseList(events);
542
- this.h3Event.node.res.write(payload);
542
+ await this.writer.write(this.encoder.encode(payload));
543
543
  }
544
544
  async publishEvent(event) {
545
545
  const payload = formatSse(event);
546
- this.h3Event.node.res.write(payload);
546
+ await this.writer.write(this.encoder.encode(payload));
547
547
  }
548
548
  async cleanup() {
549
549
  if (this.pingInterval) {
@@ -967,7 +967,8 @@ const defaultConfig = {
967
967
  buildDir: ".arri",
968
968
  serverEntry: "",
969
969
  esbuild: {},
970
- https: false
970
+ https: false,
971
+ http2: false
971
972
  };
972
973
  function defineConfig(config) {
973
974
  return {
@@ -981,7 +982,8 @@ function defineConfig(config) {
981
982
  buildDir: config.buildDir ?? defaultConfig.buildDir,
982
983
  esbuild: config.esbuild ?? defaultConfig.esbuild,
983
984
  serverEntry: config.serverEntry ?? "",
984
- https: config.https ?? false
985
+ https: config.https ?? false,
986
+ http2: config.http2 ?? false
985
987
  };
986
988
  }
987
989
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.16.5",
3
+ "version": "0.18.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -40,13 +40,13 @@
40
40
  "prettier": "^3.1.0",
41
41
  "scule": "^1.1.1",
42
42
  "uncrypto": "^0.1.3",
43
- "arri-codegen-dart": "0.16.5",
44
- "arri-codegen-ts": "0.16.5",
45
- "arri-codegen-utils": "0.16.5",
46
- "arri-validate": "0.16.5"
43
+ "arri-codegen-dart": "0.18.0",
44
+ "arri-validate": "0.18.0",
45
+ "arri-codegen-utils": "0.18.0",
46
+ "arri-codegen-ts": "0.18.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "listhen": "1.x"
49
+ "@joshmossas/listhen": "1.5.12"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/degit": "^2.8.6",