arri 0.69.2 → 0.71.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.27334236.cjs');
6
+ const common = require('./shared/arri.B5C6h-L0.cjs');
7
7
  const fs = require('node:fs');
8
8
  const codegenUtils = require('@arrirpc/codegen-utils');
9
9
  const chokidar = require('chokidar');
@@ -116,8 +116,7 @@ const codegen = citty.defineCommand({
116
116
  const isUrl = args.schema.startsWith("http://") || args.schema.startsWith("https://");
117
117
  let def;
118
118
  if (isUrl) {
119
- if (args.watch)
120
- throw new Error("Cannot watch a URL");
119
+ if (args.watch) throw new Error("Cannot watch a URL");
121
120
  const result = await ofetch.ofetch(args.schema);
122
121
  if (!codegenUtils.isAppDefinition(result)) {
123
122
  throw new Error(`Invalid App Definition at ${args.schema}`);
@@ -140,11 +139,10 @@ const codegen = citty.defineCommand({
140
139
  const initialStartTime = /* @__PURE__ */ new Date();
141
140
  await runGenerators(def, config.generators ?? []);
142
141
  common.logger.success(
143
- `Generators completed in ${( new Date()).getTime() - initialStartTime.getTime()}ms`
142
+ `Generators completed in ${(/* @__PURE__ */ new Date()).getTime() - initialStartTime.getTime()}ms`
144
143
  );
145
144
  }
146
- if (!args.watch)
147
- process.exit(0);
145
+ if (!args.watch) process.exit(0);
148
146
  const watcher = chokidar.watch(args.schema, { ignoreInitial: true });
149
147
  common.logger.info(`Watching ${args.schema} for changes...`);
150
148
  watcher.on("add", async (_, __) => {
@@ -156,7 +154,7 @@ const codegen = citty.defineCommand({
156
154
  config.generators ?? []
157
155
  );
158
156
  common.logger.success(
159
- `Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
157
+ `Generators completed in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
160
158
  );
161
159
  } catch (err) {
162
160
  common.logger.error(err);
@@ -171,7 +169,7 @@ const codegen = citty.defineCommand({
171
169
  config.generators ?? []
172
170
  );
173
171
  common.logger.success(
174
- `Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
172
+ `Generators completed in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
175
173
  );
176
174
  } catch (err) {
177
175
  common.logger.error(err);
@@ -207,7 +205,7 @@ async function runGenerators(def, generators) {
207
205
  common.logger.info(`Generating ${generators?.length} client(s)`);
208
206
  await Promise.allSettled(
209
207
  generators.map(
210
- (gen) => gen.generator(
208
+ (gen) => gen.run(
211
209
  def ?? {
212
210
  schemaVersion: "0.0.7",
213
211
  procedures: {},
package/dist/cli.d.cts CHANGED
@@ -1,2 +1 @@
1
1
 
2
- export { }
package/dist/cli.d.mts CHANGED
@@ -1,2 +1 @@
1
1
 
2
- export { }
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
1
 
2
- export { }
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.cc4e1de8.mjs';
4
+ import { a as isArriConfig, l as logger, g as getArriPackageMetadata, e as dev } from './shared/arri.B1sCS4gX.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';
@@ -104,8 +104,7 @@ const codegen = defineCommand({
104
104
  const isUrl = args.schema.startsWith("http://") || args.schema.startsWith("https://");
105
105
  let def;
106
106
  if (isUrl) {
107
- if (args.watch)
108
- throw new Error("Cannot watch a URL");
107
+ if (args.watch) throw new Error("Cannot watch a URL");
109
108
  const result = await ofetch(args.schema);
110
109
  if (!isAppDefinition(result)) {
111
110
  throw new Error(`Invalid App Definition at ${args.schema}`);
@@ -128,11 +127,10 @@ const codegen = defineCommand({
128
127
  const initialStartTime = /* @__PURE__ */ new Date();
129
128
  await runGenerators(def, config.generators ?? []);
130
129
  logger.success(
131
- `Generators completed in ${( new Date()).getTime() - initialStartTime.getTime()}ms`
130
+ `Generators completed in ${(/* @__PURE__ */ new Date()).getTime() - initialStartTime.getTime()}ms`
132
131
  );
133
132
  }
134
- if (!args.watch)
135
- process.exit(0);
133
+ if (!args.watch) process.exit(0);
136
134
  const watcher = watch(args.schema, { ignoreInitial: true });
137
135
  logger.info(`Watching ${args.schema} for changes...`);
138
136
  watcher.on("add", async (_, __) => {
@@ -144,7 +142,7 @@ const codegen = defineCommand({
144
142
  config.generators ?? []
145
143
  );
146
144
  logger.success(
147
- `Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
145
+ `Generators completed in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
148
146
  );
149
147
  } catch (err) {
150
148
  logger.error(err);
@@ -159,7 +157,7 @@ const codegen = defineCommand({
159
157
  config.generators ?? []
160
158
  );
161
159
  logger.success(
162
- `Generators completed in ${( new Date()).getTime() - startTime.getTime()}ms`
160
+ `Generators completed in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
163
161
  );
164
162
  } catch (err) {
165
163
  logger.error(err);
@@ -195,7 +193,7 @@ async function runGenerators(def, generators) {
195
193
  logger.info(`Generating ${generators?.length} client(s)`);
196
194
  await Promise.allSettled(
197
195
  generators.map(
198
- (gen) => gen.generator(
196
+ (gen) => gen.run(
199
197
  def ?? {
200
198
  schemaVersion: "0.0.7",
201
199
  procedures: {},
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const codegenDart = require('@arrirpc/codegen-dart');
4
- const codegenKotlin = require('@arrirpc/codegen-kotlin');
5
- const codegenRust = require('@arrirpc/codegen-rust');
6
- const codegenSwift = require('@arrirpc/codegen-swift');
7
- const codegenTs = require('@arrirpc/codegen-ts');
8
- const common = require('./shared/arri.27334236.cjs');
3
+ const dartCodegen = require('@arrirpc/codegen-dart');
4
+ const kotlinCodegen = require('@arrirpc/codegen-kotlin');
5
+ const rustCodegen = require('@arrirpc/codegen-rust');
6
+ const swiftCodegen = require('@arrirpc/codegen-swift');
7
+ const typescriptCodegen = require('@arrirpc/codegen-ts');
8
+ const common = require('./shared/arri.B5C6h-L0.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');
@@ -38,6 +38,11 @@ function _interopNamespaceCompat(e) {
38
38
  return n;
39
39
  }
40
40
 
41
+ const dartCodegen__namespace = /*#__PURE__*/_interopNamespaceCompat(dartCodegen);
42
+ const kotlinCodegen__namespace = /*#__PURE__*/_interopNamespaceCompat(kotlinCodegen);
43
+ const rustCodegen__namespace = /*#__PURE__*/_interopNamespaceCompat(rustCodegen);
44
+ const swiftCodegen__namespace = /*#__PURE__*/_interopNamespaceCompat(swiftCodegen);
45
+ const typescriptCodegen__namespace = /*#__PURE__*/_interopNamespaceCompat(typescriptCodegen);
41
46
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
42
47
  const path__default = /*#__PURE__*/_interopDefaultCompat(path);
43
48
  const chokidar__default = /*#__PURE__*/_interopDefaultCompat(chokidar);
@@ -100,8 +105,7 @@ function goServer(options = {}) {
100
105
  }
101
106
  }
102
107
  async function closeChildProcess() {
103
- if (!childProcess)
104
- return true;
108
+ if (!childProcess) return true;
105
109
  return new Promise((res, rej) => {
106
110
  childProcess?.on("close", () => res(true));
107
111
  childProcess?.on("exit", () => res(true));
@@ -120,7 +124,7 @@ function goServer(options = {}) {
120
124
  default: {
121
125
  await closeChildProcess();
122
126
  childProcess?.removeAllListeners();
123
- childProcess = void 0;
127
+ childProcess = undefined;
124
128
  spawnProcess();
125
129
  }
126
130
  }
@@ -160,7 +164,7 @@ function goServer(options = {}) {
160
164
  generators.map((generator) => generator.run(appDef, true))
161
165
  );
162
166
  common.logger.success(
163
- `Ran ${generators.length} generator(s) in ${( new Date()).getTime() - startTime.getTime()}ms`
167
+ `Ran ${generators.length} generator(s) in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
164
168
  );
165
169
  hasRunGenerators = true;
166
170
  }
@@ -201,7 +205,7 @@ function goServer(options = {}) {
201
205
  generators.map((generator) => generator.run(appDef, false))
202
206
  );
203
207
  common.logger.success(
204
- `Ran ${generators.length} generator(s) in ${( new Date()).getTime() - startTime.getTime()}ms`
208
+ `Ran ${generators.length} generator(s) in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
205
209
  );
206
210
  }
207
211
  });
@@ -209,7 +213,7 @@ function goServer(options = {}) {
209
213
 
210
214
  function tsServer(serverConfig) {
211
215
  return common.defineServerConfig({
212
- devArgs: void 0,
216
+ devArgs: undefined,
213
217
  async devFn(_, generators) {
214
218
  const resolvedConfig = {
215
219
  port: serverConfig?.port ?? defaultTsServerConfig.port,
@@ -227,7 +231,7 @@ function tsServer(serverConfig) {
227
231
  };
228
232
  await startDevServer(resolvedConfig, generators);
229
233
  },
230
- buildArgs: void 0,
234
+ buildArgs: undefined,
231
235
  async buildFn(args, generators) {
232
236
  const resolvedConfig = {
233
237
  port: serverConfig?.port ?? 3e3,
@@ -268,9 +272,9 @@ const defaultTsServerConfig = {
268
272
  https: false,
269
273
  http2: false,
270
274
  devServer: {
271
- additionalWatchDirs: void 0,
272
- httpWithHttps: void 0,
273
- httpWithHttpsPort: void 0
275
+ additionalWatchDirs: undefined,
276
+ httpWithHttps: undefined,
277
+ httpWithHttpsPort: undefined
274
278
  }
275
279
  };
276
280
  async function startBuild(generators, serverConfig, skipCodeGen = false) {
@@ -320,7 +324,7 @@ async function startBuild(generators, serverConfig, skipCodeGen = false) {
320
324
  generators.map((generator) => generator.run(def)) ?? []
321
325
  );
322
326
  common.logger.log(
323
- `${clientCount} client(s) generated in ${( new Date()).getTime() - startTime}ms`
327
+ `${clientCount} client(s) generated in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
324
328
  );
325
329
  } else {
326
330
  common.logger.warn(
@@ -593,7 +597,7 @@ async function startDevServer(config, generators) {
593
597
  const newAppDef = await devServer.reload();
594
598
  const newAppDefStr = JSON.stringify(newAppDef);
595
599
  common.logger.log(
596
- `Server restarted in ${( new Date()).getTime() - reloadStart}ms`
600
+ `Server restarted in ${(/* @__PURE__ */ new Date()).getTime() - reloadStart}ms`
597
601
  );
598
602
  if (generators.length && newAppDefStr !== appDefStr) {
599
603
  common.logger.info(
@@ -618,7 +622,7 @@ async function generateClientsFromDefinition(appDef, generators) {
618
622
  generators.map((generator) => generator.run(appDef, true))
619
623
  );
620
624
  common.logger.success(
621
- `Generated ${clientCount} client${clientCount === 1 ? "" : "s"} in ${( new Date()).getTime() - startTime}ms`
625
+ `Generated ${clientCount} client${clientCount === 1 ? "" : "s"} in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
622
626
  );
623
627
  } catch (err) {
624
628
  common.logger.error(err);
@@ -703,7 +707,7 @@ async function getFsRouteBatch(glob, globPattern, config) {
703
707
  const disallowedNameChars = "~`!@#$%^&*()-+=[]{}\\|:;\"'<>,./";
704
708
  const getRpcMetaFromPath = (config, filePath) => {
705
709
  if (!config.procedureDir) {
706
- return void 0;
710
+ return undefined;
707
711
  }
708
712
  const resolvedFilePath = filePath.split("./").join("/");
709
713
  const parts = resolvedFilePath.split("/");
@@ -719,7 +723,7 @@ const getRpcMetaFromPath = (config, filePath) => {
719
723
  const serviceParts = nameParts.filter((part) => part.trim().length > 0).map((part) => codegenUtils.removeDisallowedChars(part, disallowedNameChars));
720
724
  const fileNameParts = fileName.split(".");
721
725
  if (!fileNameParts.length) {
722
- return void 0;
726
+ return undefined;
723
727
  }
724
728
  const rpcName = codegenUtils.removeDisallowedChars(
725
729
  fileNameParts[0],
@@ -741,11 +745,18 @@ const servers = {
741
745
  };
742
746
 
743
747
  const generators = {
744
- dartClient: codegenDart.dartClientGenerator,
745
- kotlinClient: codegenKotlin.kotlinClientGenerator,
746
- rustClient: codegenRust.rustClientGenerator,
747
- typescriptClient: codegenTs.typescriptClientGenerator,
748
- swiftClient: codegenSwift.swiftClientGenerator
748
+ dartClient: dartCodegen__namespace.dartClientGenerator,
749
+ kotlinClient: kotlinCodegen__namespace.kotlinClientGenerator,
750
+ rustClient: rustCodegen__namespace.rustClientGenerator,
751
+ typescriptClient: typescriptCodegen__namespace.typescriptClientGenerator,
752
+ swiftClient: swiftCodegen__namespace.swiftClientGenerator
753
+ };
754
+ const codegen = {
755
+ dart: dartCodegen__namespace,
756
+ kotlin: kotlinCodegen__namespace,
757
+ rust: rustCodegen__namespace,
758
+ swift: swiftCodegen__namespace,
759
+ ts: typescriptCodegen__namespace
749
760
  };
750
761
 
751
762
  exports.DEV_DEFINITION_ENDPOINT = common.DEV_DEFINITION_ENDPOINT;
@@ -754,5 +765,6 @@ exports.defineServerConfig = common.defineServerConfig;
754
765
  exports.isArriConfig = common.isArriConfig;
755
766
  exports.isServerConfig = common.isServerConfig;
756
767
  exports.createAppDefinition = codegenUtils.createAppDefinition;
768
+ exports.codegen = codegen;
757
769
  exports.generators = generators;
758
770
  exports.servers = servers;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import * as _arrirpc_codegen_swift from '@arrirpc/codegen-swift';
2
- import * as _arrirpc_codegen_ts from '@arrirpc/codegen-ts';
3
- import * as _arrirpc_codegen_rust from '@arrirpc/codegen-rust';
4
- import * as _arrirpc_codegen_kotlin from '@arrirpc/codegen-kotlin';
5
1
  import * as _arrirpc_codegen_utils from '@arrirpc/codegen-utils';
6
2
  import { Generator } from '@arrirpc/codegen-utils';
7
3
  export { AppDefinition, createAppDefinition } from '@arrirpc/codegen-utils';
8
- import * as _arrirpc_codegen_dart from '@arrirpc/codegen-dart';
4
+ import * as dartCodegen from '@arrirpc/codegen-dart';
5
+ import * as kotlinCodegen from '@arrirpc/codegen-kotlin';
6
+ import * as rustCodegen from '@arrirpc/codegen-rust';
7
+ import * as swiftCodegen from '@arrirpc/codegen-swift';
8
+ import * as typescriptCodegen from '@arrirpc/codegen-ts';
9
9
  import { ArgsDef, ParsedArgs } from 'citty';
10
10
  import esbuild from 'esbuild';
11
11
 
@@ -48,7 +48,7 @@ interface TsServerConfig {
48
48
  */
49
49
  procedureGlobPatterns?: string[];
50
50
  buildDir?: string;
51
- esbuild?: Omit<esbuild.BuildOptions, "bundle" | "format" | "outfile" | "outdir" | "entryNames" | "entryPoints" | "packages">;
51
+ esbuild?: Omit<esbuild.BuildOptions, 'bundle' | 'format' | 'outfile' | 'outdir' | 'entryNames' | 'entryPoints' | 'packages'>;
52
52
  https?: {
53
53
  cert: string;
54
54
  key: string;
@@ -74,11 +74,18 @@ declare const servers: {
74
74
  };
75
75
 
76
76
  declare const generators: {
77
- readonly dartClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_dart.DartClientGeneratorOptions>;
78
- readonly kotlinClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_kotlin.KotlinClientOptions>;
79
- readonly rustClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_rust.RustClientGeneratorOptions>;
80
- readonly typescriptClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_ts.TypescriptGeneratorOptions>;
81
- readonly swiftClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_swift.SwiftClientGeneratorOptions>;
77
+ readonly dartClient: _arrirpc_codegen_utils.GeneratorPlugin<dartCodegen.DartClientGeneratorOptions>;
78
+ readonly kotlinClient: _arrirpc_codegen_utils.GeneratorPlugin<kotlinCodegen.KotlinClientOptions>;
79
+ readonly rustClient: _arrirpc_codegen_utils.GeneratorPlugin<rustCodegen.RustClientGeneratorOptions>;
80
+ readonly typescriptClient: _arrirpc_codegen_utils.GeneratorPlugin<typescriptCodegen.TypescriptGeneratorOptions>;
81
+ readonly swiftClient: _arrirpc_codegen_utils.GeneratorPlugin<swiftCodegen.SwiftClientGeneratorOptions>;
82
+ };
83
+ declare const codegen: {
84
+ dart: typeof dartCodegen;
85
+ kotlin: typeof kotlinCodegen;
86
+ rust: typeof rustCodegen;
87
+ swift: typeof swiftCodegen;
88
+ ts: typeof typescriptCodegen;
82
89
  };
83
90
 
84
- export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
91
+ export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
- import * as _arrirpc_codegen_swift from '@arrirpc/codegen-swift';
2
- import * as _arrirpc_codegen_ts from '@arrirpc/codegen-ts';
3
- import * as _arrirpc_codegen_rust from '@arrirpc/codegen-rust';
4
- import * as _arrirpc_codegen_kotlin from '@arrirpc/codegen-kotlin';
5
1
  import * as _arrirpc_codegen_utils from '@arrirpc/codegen-utils';
6
2
  import { Generator } from '@arrirpc/codegen-utils';
7
3
  export { AppDefinition, createAppDefinition } from '@arrirpc/codegen-utils';
8
- import * as _arrirpc_codegen_dart from '@arrirpc/codegen-dart';
4
+ import * as dartCodegen from '@arrirpc/codegen-dart';
5
+ import * as kotlinCodegen from '@arrirpc/codegen-kotlin';
6
+ import * as rustCodegen from '@arrirpc/codegen-rust';
7
+ import * as swiftCodegen from '@arrirpc/codegen-swift';
8
+ import * as typescriptCodegen from '@arrirpc/codegen-ts';
9
9
  import { ArgsDef, ParsedArgs } from 'citty';
10
10
  import esbuild from 'esbuild';
11
11
 
@@ -48,7 +48,7 @@ interface TsServerConfig {
48
48
  */
49
49
  procedureGlobPatterns?: string[];
50
50
  buildDir?: string;
51
- esbuild?: Omit<esbuild.BuildOptions, "bundle" | "format" | "outfile" | "outdir" | "entryNames" | "entryPoints" | "packages">;
51
+ esbuild?: Omit<esbuild.BuildOptions, 'bundle' | 'format' | 'outfile' | 'outdir' | 'entryNames' | 'entryPoints' | 'packages'>;
52
52
  https?: {
53
53
  cert: string;
54
54
  key: string;
@@ -74,11 +74,18 @@ declare const servers: {
74
74
  };
75
75
 
76
76
  declare const generators: {
77
- readonly dartClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_dart.DartClientGeneratorOptions>;
78
- readonly kotlinClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_kotlin.KotlinClientOptions>;
79
- readonly rustClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_rust.RustClientGeneratorOptions>;
80
- readonly typescriptClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_ts.TypescriptGeneratorOptions>;
81
- readonly swiftClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_swift.SwiftClientGeneratorOptions>;
77
+ readonly dartClient: _arrirpc_codegen_utils.GeneratorPlugin<dartCodegen.DartClientGeneratorOptions>;
78
+ readonly kotlinClient: _arrirpc_codegen_utils.GeneratorPlugin<kotlinCodegen.KotlinClientOptions>;
79
+ readonly rustClient: _arrirpc_codegen_utils.GeneratorPlugin<rustCodegen.RustClientGeneratorOptions>;
80
+ readonly typescriptClient: _arrirpc_codegen_utils.GeneratorPlugin<typescriptCodegen.TypescriptGeneratorOptions>;
81
+ readonly swiftClient: _arrirpc_codegen_utils.GeneratorPlugin<swiftCodegen.SwiftClientGeneratorOptions>;
82
+ };
83
+ declare const codegen: {
84
+ dart: typeof dartCodegen;
85
+ kotlin: typeof kotlinCodegen;
86
+ rust: typeof rustCodegen;
87
+ swift: typeof swiftCodegen;
88
+ ts: typeof typescriptCodegen;
82
89
  };
83
90
 
84
- export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
91
+ export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import * as _arrirpc_codegen_swift from '@arrirpc/codegen-swift';
2
- import * as _arrirpc_codegen_ts from '@arrirpc/codegen-ts';
3
- import * as _arrirpc_codegen_rust from '@arrirpc/codegen-rust';
4
- import * as _arrirpc_codegen_kotlin from '@arrirpc/codegen-kotlin';
5
1
  import * as _arrirpc_codegen_utils from '@arrirpc/codegen-utils';
6
2
  import { Generator } from '@arrirpc/codegen-utils';
7
3
  export { AppDefinition, createAppDefinition } from '@arrirpc/codegen-utils';
8
- import * as _arrirpc_codegen_dart from '@arrirpc/codegen-dart';
4
+ import * as dartCodegen from '@arrirpc/codegen-dart';
5
+ import * as kotlinCodegen from '@arrirpc/codegen-kotlin';
6
+ import * as rustCodegen from '@arrirpc/codegen-rust';
7
+ import * as swiftCodegen from '@arrirpc/codegen-swift';
8
+ import * as typescriptCodegen from '@arrirpc/codegen-ts';
9
9
  import { ArgsDef, ParsedArgs } from 'citty';
10
10
  import esbuild from 'esbuild';
11
11
 
@@ -48,7 +48,7 @@ interface TsServerConfig {
48
48
  */
49
49
  procedureGlobPatterns?: string[];
50
50
  buildDir?: string;
51
- esbuild?: Omit<esbuild.BuildOptions, "bundle" | "format" | "outfile" | "outdir" | "entryNames" | "entryPoints" | "packages">;
51
+ esbuild?: Omit<esbuild.BuildOptions, 'bundle' | 'format' | 'outfile' | 'outdir' | 'entryNames' | 'entryPoints' | 'packages'>;
52
52
  https?: {
53
53
  cert: string;
54
54
  key: string;
@@ -74,11 +74,18 @@ declare const servers: {
74
74
  };
75
75
 
76
76
  declare const generators: {
77
- readonly dartClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_dart.DartClientGeneratorOptions>;
78
- readonly kotlinClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_kotlin.KotlinClientOptions>;
79
- readonly rustClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_rust.RustClientGeneratorOptions>;
80
- readonly typescriptClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_ts.TypescriptGeneratorOptions>;
81
- readonly swiftClient: _arrirpc_codegen_utils.GeneratorPlugin<_arrirpc_codegen_swift.SwiftClientGeneratorOptions>;
77
+ readonly dartClient: _arrirpc_codegen_utils.GeneratorPlugin<dartCodegen.DartClientGeneratorOptions>;
78
+ readonly kotlinClient: _arrirpc_codegen_utils.GeneratorPlugin<kotlinCodegen.KotlinClientOptions>;
79
+ readonly rustClient: _arrirpc_codegen_utils.GeneratorPlugin<rustCodegen.RustClientGeneratorOptions>;
80
+ readonly typescriptClient: _arrirpc_codegen_utils.GeneratorPlugin<typescriptCodegen.TypescriptGeneratorOptions>;
81
+ readonly swiftClient: _arrirpc_codegen_utils.GeneratorPlugin<swiftCodegen.SwiftClientGeneratorOptions>;
82
+ };
83
+ declare const codegen: {
84
+ dart: typeof dartCodegen;
85
+ kotlin: typeof kotlinCodegen;
86
+ rust: typeof rustCodegen;
87
+ swift: typeof swiftCodegen;
88
+ ts: typeof typescriptCodegen;
82
89
  };
83
90
 
84
- export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
91
+ export { type ArriConfig, DEV_DEFINITION_ENDPOINT, type ServerConfig, type TsServerConfig, codegen, defineConfig, defineServerConfig, generators, isArriConfig, isServerConfig, servers };
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { dartClientGenerator } from '@arrirpc/codegen-dart';
2
- import { kotlinClientGenerator } from '@arrirpc/codegen-kotlin';
3
- import { rustClientGenerator } from '@arrirpc/codegen-rust';
4
- import { swiftClientGenerator } from '@arrirpc/codegen-swift';
5
- import { typescriptClientGenerator } from '@arrirpc/codegen-ts';
6
- import { d as defineServerConfig, l as logger, i as isInsideDir } from './shared/arri.cc4e1de8.mjs';
7
- export { D as DEV_DEFINITION_ENDPOINT, b as defineConfig, a as isArriConfig, c as isServerConfig } from './shared/arri.cc4e1de8.mjs';
1
+ import * as dartCodegen from '@arrirpc/codegen-dart';
2
+ import * as kotlinCodegen from '@arrirpc/codegen-kotlin';
3
+ import * as rustCodegen from '@arrirpc/codegen-rust';
4
+ import * as swiftCodegen from '@arrirpc/codegen-swift';
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';
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';
@@ -79,8 +79,7 @@ function goServer(options = {}) {
79
79
  }
80
80
  }
81
81
  async function closeChildProcess() {
82
- if (!childProcess)
83
- return true;
82
+ if (!childProcess) return true;
84
83
  return new Promise((res, rej) => {
85
84
  childProcess?.on("close", () => res(true));
86
85
  childProcess?.on("exit", () => res(true));
@@ -99,7 +98,7 @@ function goServer(options = {}) {
99
98
  default: {
100
99
  await closeChildProcess();
101
100
  childProcess?.removeAllListeners();
102
- childProcess = void 0;
101
+ childProcess = undefined;
103
102
  spawnProcess();
104
103
  }
105
104
  }
@@ -139,7 +138,7 @@ function goServer(options = {}) {
139
138
  generators.map((generator) => generator.run(appDef, true))
140
139
  );
141
140
  logger.success(
142
- `Ran ${generators.length} generator(s) in ${( new Date()).getTime() - startTime.getTime()}ms`
141
+ `Ran ${generators.length} generator(s) in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
143
142
  );
144
143
  hasRunGenerators = true;
145
144
  }
@@ -180,7 +179,7 @@ function goServer(options = {}) {
180
179
  generators.map((generator) => generator.run(appDef, false))
181
180
  );
182
181
  logger.success(
183
- `Ran ${generators.length} generator(s) in ${( new Date()).getTime() - startTime.getTime()}ms`
182
+ `Ran ${generators.length} generator(s) in ${(/* @__PURE__ */ new Date()).getTime() - startTime.getTime()}ms`
184
183
  );
185
184
  }
186
185
  });
@@ -188,7 +187,7 @@ function goServer(options = {}) {
188
187
 
189
188
  function tsServer(serverConfig) {
190
189
  return defineServerConfig({
191
- devArgs: void 0,
190
+ devArgs: undefined,
192
191
  async devFn(_, generators) {
193
192
  const resolvedConfig = {
194
193
  port: serverConfig?.port ?? defaultTsServerConfig.port,
@@ -206,7 +205,7 @@ function tsServer(serverConfig) {
206
205
  };
207
206
  await startDevServer(resolvedConfig, generators);
208
207
  },
209
- buildArgs: void 0,
208
+ buildArgs: undefined,
210
209
  async buildFn(args, generators) {
211
210
  const resolvedConfig = {
212
211
  port: serverConfig?.port ?? 3e3,
@@ -247,9 +246,9 @@ const defaultTsServerConfig = {
247
246
  https: false,
248
247
  http2: false,
249
248
  devServer: {
250
- additionalWatchDirs: void 0,
251
- httpWithHttps: void 0,
252
- httpWithHttpsPort: void 0
249
+ additionalWatchDirs: undefined,
250
+ httpWithHttps: undefined,
251
+ httpWithHttpsPort: undefined
253
252
  }
254
253
  };
255
254
  async function startBuild(generators, serverConfig, skipCodeGen = false) {
@@ -299,7 +298,7 @@ async function startBuild(generators, serverConfig, skipCodeGen = false) {
299
298
  generators.map((generator) => generator.run(def)) ?? []
300
299
  );
301
300
  logger.log(
302
- `${clientCount} client(s) generated in ${( new Date()).getTime() - startTime}ms`
301
+ `${clientCount} client(s) generated in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
303
302
  );
304
303
  } else {
305
304
  logger.warn(
@@ -572,7 +571,7 @@ async function startDevServer(config, generators) {
572
571
  const newAppDef = await devServer.reload();
573
572
  const newAppDefStr = JSON.stringify(newAppDef);
574
573
  logger.log(
575
- `Server restarted in ${( new Date()).getTime() - reloadStart}ms`
574
+ `Server restarted in ${(/* @__PURE__ */ new Date()).getTime() - reloadStart}ms`
576
575
  );
577
576
  if (generators.length && newAppDefStr !== appDefStr) {
578
577
  logger.info(
@@ -597,7 +596,7 @@ async function generateClientsFromDefinition(appDef, generators) {
597
596
  generators.map((generator) => generator.run(appDef, true))
598
597
  );
599
598
  logger.success(
600
- `Generated ${clientCount} client${clientCount === 1 ? "" : "s"} in ${( new Date()).getTime() - startTime}ms`
599
+ `Generated ${clientCount} client${clientCount === 1 ? "" : "s"} in ${(/* @__PURE__ */ new Date()).getTime() - startTime}ms`
601
600
  );
602
601
  } catch (err) {
603
602
  logger.error(err);
@@ -682,7 +681,7 @@ async function getFsRouteBatch(glob, globPattern, config) {
682
681
  const disallowedNameChars = "~`!@#$%^&*()-+=[]{}\\|:;\"'<>,./";
683
682
  const getRpcMetaFromPath = (config, filePath) => {
684
683
  if (!config.procedureDir) {
685
- return void 0;
684
+ return undefined;
686
685
  }
687
686
  const resolvedFilePath = filePath.split("./").join("/");
688
687
  const parts = resolvedFilePath.split("/");
@@ -698,7 +697,7 @@ const getRpcMetaFromPath = (config, filePath) => {
698
697
  const serviceParts = nameParts.filter((part) => part.trim().length > 0).map((part) => removeDisallowedChars(part, disallowedNameChars));
699
698
  const fileNameParts = fileName.split(".");
700
699
  if (!fileNameParts.length) {
701
- return void 0;
700
+ return undefined;
702
701
  }
703
702
  const rpcName = removeDisallowedChars(
704
703
  fileNameParts[0],
@@ -720,11 +719,18 @@ const servers = {
720
719
  };
721
720
 
722
721
  const generators = {
723
- dartClient: dartClientGenerator,
724
- kotlinClient: kotlinClientGenerator,
725
- rustClient: rustClientGenerator,
726
- typescriptClient: typescriptClientGenerator,
727
- swiftClient: swiftClientGenerator
722
+ dartClient: dartCodegen.dartClientGenerator,
723
+ kotlinClient: kotlinCodegen.kotlinClientGenerator,
724
+ rustClient: rustCodegen.rustClientGenerator,
725
+ typescriptClient: typescriptCodegen.typescriptClientGenerator,
726
+ swiftClient: swiftCodegen.swiftClientGenerator
727
+ };
728
+ const codegen = {
729
+ dart: dartCodegen,
730
+ kotlin: kotlinCodegen,
731
+ rust: rustCodegen,
732
+ swift: swiftCodegen,
733
+ ts: typescriptCodegen
728
734
  };
729
735
 
730
- export { defineServerConfig, generators, servers };
736
+ export { codegen, defineServerConfig, generators, servers };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.69.2",
3
+ "version": "0.71.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -27,25 +27,25 @@
27
27
  "dependencies": {
28
28
  "@joshmossas/listhen": "^1.11.1",
29
29
  "c12": "^2.0.1",
30
- "chokidar": "^4.0.1",
30
+ "chokidar": "^4.0.3",
31
31
  "citty": "^0.1.6",
32
- "consola": "^3.2.3",
32
+ "consola": "^3.3.3",
33
33
  "degit": "^2.8.4",
34
34
  "enquirer": "^2.4.1",
35
- "esbuild": "^0.24.0",
35
+ "esbuild": "^0.24.2",
36
36
  "esbuild-plugin-replace": "^1.4.0",
37
37
  "globby": "^14.0.2",
38
- "h3": "^1.13.0",
38
+ "h3": "^1.13.1",
39
39
  "ofetch": "^1.4.1",
40
- "pathe": "^1.1.2",
41
- "prettier": "^3.4.1",
42
- "@arrirpc/codegen-dart": "0.69.2",
43
- "@arrirpc/codegen-kotlin": "0.69.2",
44
- "@arrirpc/codegen-swift": "0.69.2",
45
- "@arrirpc/codegen-ts": "0.69.2",
46
- "@arrirpc/codegen-rust": "0.69.2",
47
- "@arrirpc/schema": "0.69.2",
48
- "@arrirpc/codegen-utils": "0.69.2"
40
+ "pathe": "^2.0.1",
41
+ "prettier": "^3.4.2",
42
+ "@arrirpc/codegen-dart": "0.71.0",
43
+ "@arrirpc/codegen-kotlin": "0.71.0",
44
+ "@arrirpc/codegen-rust": "0.71.0",
45
+ "@arrirpc/codegen-swift": "0.71.0",
46
+ "@arrirpc/codegen-ts": "0.71.0",
47
+ "@arrirpc/codegen-utils": "0.71.0",
48
+ "@arrirpc/schema": "0.71.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/degit": "^2.8.6"