arri 0.72.0 → 0.74.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
@@ -3,7 +3,7 @@
3
3
 
4
4
  const citty = require('citty');
5
5
  const c12 = require('c12');
6
- const common = require('./shared/arri.B5C6h-L0.cjs');
6
+ const common = require('./shared/arri.pHQOQ5Wb.cjs');
7
7
  const fs = require('node:fs');
8
8
  const codegenUtils = require('@arrirpc/codegen-utils');
9
9
  const chokidar = require('chokidar');
@@ -251,7 +251,7 @@ const init = citty.defineCommand({
251
251
  }
252
252
  },
253
253
  async run(context) {
254
- const args = schema.a.parse(CliArgs, context.args);
254
+ const args = schema.a.parseUnsafe(CliArgs, context.args);
255
255
  if (!args.type) {
256
256
  const { projectType } = await enquirer__default.prompt([
257
257
  {
@@ -633,7 +633,7 @@ const PubPackageResponse = schema.a.object({
633
633
  });
634
634
  async function getDartPackageMeta() {
635
635
  const response = await ofetch.ofetch("https://pub.dev/api/packages/arri_client");
636
- const data = schema.a.parse(PubPackageResponse, response);
636
+ const data = schema.a.parseUnsafe(PubPackageResponse, response);
637
637
  return data;
638
638
  }
639
639
  function updatePubspecYaml(fileContent, version, strict = true) {
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env node
2
2
  import { defineCommand, runCommand, runMain } from 'citty';
3
3
  import { loadConfig } from 'c12';
4
- import { a as isArriConfig, l as logger, g as getArriPackageMetadata, e as dev } from './shared/arri.B1sCS4gX.mjs';
4
+ import { a as isArriConfig, l as logger, g as getArriPackageMetadata, e as dev } from './shared/arri.CGlJ9Ywd.mjs';
5
5
  import fs, { rmSync, readFileSync, writeFileSync } from 'node:fs';
6
6
  import { isAppDefinition, kebabCase } from '@arrirpc/codegen-utils';
7
7
  import { watch } from 'chokidar';
@@ -239,7 +239,7 @@ const init = defineCommand({
239
239
  }
240
240
  },
241
241
  async run(context) {
242
- const args = a.parse(CliArgs, context.args);
242
+ const args = a.parseUnsafe(CliArgs, context.args);
243
243
  if (!args.type) {
244
244
  const { projectType } = await enquirer.prompt([
245
245
  {
@@ -621,7 +621,7 @@ const PubPackageResponse = a.object({
621
621
  });
622
622
  async function getDartPackageMeta() {
623
623
  const response = await ofetch("https://pub.dev/api/packages/arri_client");
624
- const data = a.parse(PubPackageResponse, response);
624
+ const data = a.parseUnsafe(PubPackageResponse, response);
625
625
  return data;
626
626
  }
627
627
  function updatePubspecYaml(fileContent, version, strict = true) {
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@ const kotlinCodegen = require('@arrirpc/codegen-kotlin');
5
5
  const rustCodegen = require('@arrirpc/codegen-rust');
6
6
  const swiftCodegen = require('@arrirpc/codegen-swift');
7
7
  const typescriptCodegen = require('@arrirpc/codegen-ts');
8
- const common = require('./shared/arri.B5C6h-L0.cjs');
8
+ const common = require('./shared/arri.pHQOQ5Wb.cjs');
9
9
  const node_child_process = require('node:child_process');
10
10
  const fs = require('node:fs');
11
11
  const path = require('node:path');
@@ -321,7 +321,7 @@ async function startBuild(generators, serverConfig, skipCodeGen = false) {
321
321
  const startTime = (/* @__PURE__ */ new Date()).getTime();
322
322
  common.logger.log(`Generating ${clientCount} client(s)...`);
323
323
  await Promise.all(
324
- generators.map((generator) => generator.run(def)) ?? []
324
+ generators.map((generator) => generator.run(def, false)) ?? []
325
325
  );
326
326
  common.logger.log(
327
327
  `${clientCount} client(s) generated in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
@@ -430,7 +430,7 @@ async function createCodegenEntryFile(config) {
430
430
  const virtualModule = await prettier__default.format(
431
431
  `
432
432
  import { writeFileSync } from 'node:fs';
433
- import path from 'pathe';
433
+ import path from 'node:path';
434
434
  import app from './${OUT_APP_FILE}';
435
435
 
436
436
  const __dirname = new URL(".", import.meta.url).pathname;
@@ -537,7 +537,7 @@ async function startDevServer(config, generators) {
537
537
  let appDefStr = JSON.stringify(appDef);
538
538
  if (generators.length) {
539
539
  common.logger.info(`Running generators...`);
540
- await generateClientsFromDefinition(appDef, generators);
540
+ await generateClientsFromDefinition(appDef, generators, true);
541
541
  } else {
542
542
  common.logger.warn(`No generators specified in config. Skipping codegen.`);
543
543
  }
@@ -603,7 +603,11 @@ async function startDevServer(config, generators) {
603
603
  common.logger.info(
604
604
  `App Definition updated. Regenerating clients...`
605
605
  );
606
- await generateClientsFromDefinition(newAppDef, generators);
606
+ await generateClientsFromDefinition(
607
+ newAppDef,
608
+ generators,
609
+ true
610
+ );
607
611
  appDef = newAppDef;
608
612
  appDefStr = newAppDefStr;
609
613
  }
@@ -614,16 +618,21 @@ async function startDevServer(config, generators) {
614
618
  }
615
619
  await load();
616
620
  }
617
- async function generateClientsFromDefinition(appDef, generators) {
621
+ async function generateClientsFromDefinition(appDef, generators, isDev) {
618
622
  const startTime = (/* @__PURE__ */ new Date()).getTime();
619
623
  try {
620
624
  const clientCount = generators.length;
621
- await Promise.allSettled(
622
- generators.map((generator) => generator.run(appDef, true))
625
+ const result = await Promise.allSettled(
626
+ generators.map((generator) => generator.run(appDef, isDev))
623
627
  );
624
628
  common.logger.success(
625
629
  `Generated ${clientCount} client${clientCount === 1 ? "" : "s"} in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
626
630
  );
631
+ for (const item of result) {
632
+ if (item.status === "rejected") {
633
+ console.error("ERROR", item.reason);
634
+ }
635
+ }
627
636
  } catch (err) {
628
637
  common.logger.error(err);
629
638
  }
package/dist/index.mjs CHANGED
@@ -3,8 +3,8 @@ import * as kotlinCodegen from '@arrirpc/codegen-kotlin';
3
3
  import * as rustCodegen from '@arrirpc/codegen-rust';
4
4
  import * as swiftCodegen from '@arrirpc/codegen-swift';
5
5
  import * as typescriptCodegen from '@arrirpc/codegen-ts';
6
- import { d as defineServerConfig, l as logger, i as isInsideDir } from './shared/arri.B1sCS4gX.mjs';
7
- export { D as DEV_DEFINITION_ENDPOINT, b as defineConfig, a as isArriConfig, c as isServerConfig } from './shared/arri.B1sCS4gX.mjs';
6
+ import { d as defineServerConfig, l as logger, i as isInsideDir } from './shared/arri.CGlJ9Ywd.mjs';
7
+ export { D as DEV_DEFINITION_ENDPOINT, b as defineConfig, a as isArriConfig, c as isServerConfig } from './shared/arri.CGlJ9Ywd.mjs';
8
8
  import { execSync, spawn } from 'node:child_process';
9
9
  import fs$1, { existsSync, readFileSync } from 'node:fs';
10
10
  import path from 'node:path';
@@ -295,7 +295,7 @@ async function startBuild(generators, serverConfig, skipCodeGen = false) {
295
295
  const startTime = (/* @__PURE__ */ new Date()).getTime();
296
296
  logger.log(`Generating ${clientCount} client(s)...`);
297
297
  await Promise.all(
298
- generators.map((generator) => generator.run(def)) ?? []
298
+ generators.map((generator) => generator.run(def, false)) ?? []
299
299
  );
300
300
  logger.log(
301
301
  `${clientCount} client(s) generated in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
@@ -404,7 +404,7 @@ async function createCodegenEntryFile(config) {
404
404
  const virtualModule = await prettier.format(
405
405
  `
406
406
  import { writeFileSync } from 'node:fs';
407
- import path from 'pathe';
407
+ import path from 'node:path';
408
408
  import app from './${OUT_APP_FILE}';
409
409
 
410
410
  const __dirname = new URL(".", import.meta.url).pathname;
@@ -511,7 +511,7 @@ async function startDevServer(config, generators) {
511
511
  let appDefStr = JSON.stringify(appDef);
512
512
  if (generators.length) {
513
513
  logger.info(`Running generators...`);
514
- await generateClientsFromDefinition(appDef, generators);
514
+ await generateClientsFromDefinition(appDef, generators, true);
515
515
  } else {
516
516
  logger.warn(`No generators specified in config. Skipping codegen.`);
517
517
  }
@@ -577,7 +577,11 @@ async function startDevServer(config, generators) {
577
577
  logger.info(
578
578
  `App Definition updated. Regenerating clients...`
579
579
  );
580
- await generateClientsFromDefinition(newAppDef, generators);
580
+ await generateClientsFromDefinition(
581
+ newAppDef,
582
+ generators,
583
+ true
584
+ );
581
585
  appDef = newAppDef;
582
586
  appDefStr = newAppDefStr;
583
587
  }
@@ -588,16 +592,21 @@ async function startDevServer(config, generators) {
588
592
  }
589
593
  await load();
590
594
  }
591
- async function generateClientsFromDefinition(appDef, generators) {
595
+ async function generateClientsFromDefinition(appDef, generators, isDev) {
592
596
  const startTime = (/* @__PURE__ */ new Date()).getTime();
593
597
  try {
594
598
  const clientCount = generators.length;
595
- await Promise.allSettled(
596
- generators.map((generator) => generator.run(appDef, true))
599
+ const result = await Promise.allSettled(
600
+ generators.map((generator) => generator.run(appDef, isDev))
597
601
  );
598
602
  logger.success(
599
603
  `Generated ${clientCount} client${clientCount === 1 ? "" : "s"} in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
600
604
  );
605
+ for (const item of result) {
606
+ if (item.status === "rejected") {
607
+ console.error("ERROR", item.reason);
608
+ }
609
+ }
601
610
  } catch (err) {
602
611
  logger.error(err);
603
612
  }
@@ -1,7 +1,7 @@
1
1
  import { loadConfig } from 'c12';
2
2
  import { defineCommand, runCommand } from 'citty';
3
3
  import path from 'pathe';
4
- import { a, ValidationError } from '@arrirpc/schema';
4
+ import { a, ValidationException } from '@arrirpc/schema';
5
5
  import { createConsola } from 'consola';
6
6
  import { ofetch } from 'ofetch';
7
7
 
@@ -79,12 +79,11 @@ function isInsideDir(dir, parentDir) {
79
79
  }
80
80
  async function getArriPackageMetadata() {
81
81
  const npmPackageResponse = await ofetch("https://registry.npmjs.com/arri");
82
- const arriInfo = a.safeParse(NpmRegistryPackage, npmPackageResponse);
82
+ const arriInfo = a.parse(NpmRegistryPackage, npmPackageResponse);
83
83
  if (!arriInfo.success) {
84
84
  const errors = a.errors(NpmRegistryPackage, npmPackageResponse);
85
- console.warn(errors);
86
- throw new ValidationError({
87
- message: "Arri parsing response from registry",
85
+ throw new ValidationException({
86
+ message: "Error parsing response from registry",
88
87
  errors
89
88
  });
90
89
  }
@@ -85,12 +85,11 @@ function isInsideDir(dir, parentDir) {
85
85
  }
86
86
  async function getArriPackageMetadata() {
87
87
  const npmPackageResponse = await ofetch.ofetch("https://registry.npmjs.com/arri");
88
- const arriInfo = schema.a.safeParse(NpmRegistryPackage, npmPackageResponse);
88
+ const arriInfo = schema.a.parse(NpmRegistryPackage, npmPackageResponse);
89
89
  if (!arriInfo.success) {
90
90
  const errors = schema.a.errors(NpmRegistryPackage, npmPackageResponse);
91
- console.warn(errors);
92
- throw new schema.ValidationError({
93
- message: "Arri parsing response from registry",
91
+ throw new schema.ValidationException({
92
+ message: "Error parsing response from registry",
94
93
  errors
95
94
  });
96
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.72.0",
3
+ "version": "0.74.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -35,17 +35,17 @@
35
35
  "esbuild": "^0.24.2",
36
36
  "esbuild-plugin-replace": "^1.4.0",
37
37
  "globby": "^14.0.2",
38
- "h3": "^1.13.1",
38
+ "h3": "^1.14.0",
39
39
  "ofetch": "^1.4.1",
40
- "pathe": "^2.0.1",
40
+ "pathe": "^2.0.2",
41
41
  "prettier": "^3.4.2",
42
- "@arrirpc/codegen-dart": "0.72.0",
43
- "@arrirpc/codegen-rust": "0.72.0",
44
- "@arrirpc/codegen-kotlin": "0.72.0",
45
- "@arrirpc/codegen-swift": "0.72.0",
46
- "@arrirpc/codegen-utils": "0.72.0",
47
- "@arrirpc/codegen-ts": "0.72.0",
48
- "@arrirpc/schema": "0.72.0"
42
+ "@arrirpc/codegen-dart": "0.74.0",
43
+ "@arrirpc/codegen-kotlin": "0.74.0",
44
+ "@arrirpc/codegen-rust": "0.74.0",
45
+ "@arrirpc/codegen-utils": "0.74.0",
46
+ "@arrirpc/codegen-swift": "0.74.0",
47
+ "@arrirpc/schema": "0.74.0",
48
+ "@arrirpc/codegen-ts": "0.74.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/degit": "^2.8.6"