arri 0.11.3 → 0.12.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 +29 -10
- package/dist/cli.mjs +29 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/{arri.537f5e35.mjs → arri.4d91d9b0.mjs} +3 -1
- package/dist/shared/{arri.a90e9723.cjs → arri.fa32b1ba.cjs} +3 -1
- package/package.json +5 -5
package/dist/cli.cjs
CHANGED
|
@@ -11,7 +11,7 @@ const consola = require('consola');
|
|
|
11
11
|
const esbuild = require('esbuild');
|
|
12
12
|
const path = require('pathe');
|
|
13
13
|
const prettier = require('prettier');
|
|
14
|
-
const config = require('./shared/arri.
|
|
14
|
+
const config = require('./shared/arri.fa32b1ba.cjs');
|
|
15
15
|
const globby = require('globby');
|
|
16
16
|
const scule = require('scule');
|
|
17
17
|
const arriCodegenDart = require('arri-codegen-dart');
|
|
@@ -160,7 +160,7 @@ async function transpileFiles(config) {
|
|
|
160
160
|
outdir: outDir,
|
|
161
161
|
bundle: false,
|
|
162
162
|
format: "esm",
|
|
163
|
-
target: "
|
|
163
|
+
target: "node20",
|
|
164
164
|
platform: "node"
|
|
165
165
|
});
|
|
166
166
|
}
|
|
@@ -227,12 +227,18 @@ async function startBuild(config, skipCodeGen = false) {
|
|
|
227
227
|
`Build finished! You can start your server by running "node .output/server.js"`
|
|
228
228
|
);
|
|
229
229
|
}
|
|
230
|
+
const BUILD_ENTRY_DEFAULT_FILE = "__default_arri_server.js";
|
|
231
|
+
const CODEGEN_DEFAULT_FILE = "__default_arri_codegen.js";
|
|
230
232
|
async function bundleFiles(config, allowCodegen = true) {
|
|
231
233
|
if (allowCodegen) {
|
|
232
234
|
await esbuild.build({
|
|
233
235
|
...config.esbuild,
|
|
234
236
|
entryPoints: [
|
|
235
|
-
path__default.resolve(
|
|
237
|
+
path__default.resolve(
|
|
238
|
+
config.rootDir,
|
|
239
|
+
config.buildDir,
|
|
240
|
+
CODEGEN_DEFAULT_FILE
|
|
241
|
+
)
|
|
236
242
|
],
|
|
237
243
|
platform: config.esbuild.platform ?? "node",
|
|
238
244
|
target: config.esbuild.target ?? "node18",
|
|
@@ -244,14 +250,23 @@ async function bundleFiles(config, allowCodegen = true) {
|
|
|
244
250
|
js: `import { createRequire as topLevelCreateRequire } from 'module';
|
|
245
251
|
const require = topLevelCreateRequire(import.meta.url);`
|
|
246
252
|
},
|
|
247
|
-
|
|
253
|
+
outfile: path__default.resolve(config.rootDir, ".output", "codegen.js")
|
|
248
254
|
});
|
|
249
255
|
}
|
|
256
|
+
let buildEntry = path__default.resolve(
|
|
257
|
+
config.rootDir,
|
|
258
|
+
config.buildDir,
|
|
259
|
+
BUILD_ENTRY_DEFAULT_FILE
|
|
260
|
+
);
|
|
261
|
+
if (config.buildEntry) {
|
|
262
|
+
const parts = config.buildEntry.split(".");
|
|
263
|
+
parts.pop();
|
|
264
|
+
const mergedParts = `${parts.join(".")}.js`;
|
|
265
|
+
buildEntry = path__default.resolve(config.rootDir, config.buildDir, mergedParts);
|
|
266
|
+
}
|
|
250
267
|
await esbuild.build({
|
|
251
268
|
...config.esbuild,
|
|
252
|
-
entryPoints: [
|
|
253
|
-
path__default.resolve(config.rootDir, config.buildDir, "server.js")
|
|
254
|
-
],
|
|
269
|
+
entryPoints: [buildEntry],
|
|
255
270
|
platform: config.esbuild.platform ?? "node",
|
|
256
271
|
target: config.esbuild.target ?? "node20",
|
|
257
272
|
bundle: true,
|
|
@@ -264,10 +279,13 @@ async function bundleFiles(config, allowCodegen = true) {
|
|
|
264
279
|
const require = topLevelCreateRequire(import.meta.url);`
|
|
265
280
|
},
|
|
266
281
|
allowOverwrite: true,
|
|
267
|
-
|
|
282
|
+
outfile: path__default.resolve(config.rootDir, ".output", "server.js")
|
|
268
283
|
});
|
|
269
284
|
}
|
|
270
285
|
async function createBuildEntryModule(config) {
|
|
286
|
+
if (config.buildEntry) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
271
289
|
const appModule = path__default.resolve(config.rootDir, config.srcDir, config.entry);
|
|
272
290
|
const appImportParts = path__default.relative(path__default.resolve(config.rootDir, config.srcDir), appModule).split(".");
|
|
273
291
|
appImportParts.pop();
|
|
@@ -289,9 +307,10 @@ for (const route of routes) {
|
|
|
289
307
|
|
|
290
308
|
void listen(toNodeListener(app.h3App), {
|
|
291
309
|
port: process.env.PORT ?? ${config.port},
|
|
310
|
+
public: true,
|
|
292
311
|
});`;
|
|
293
312
|
await fs__default.writeFile(
|
|
294
|
-
path__default.resolve(config.rootDir, config.buildDir,
|
|
313
|
+
path__default.resolve(config.rootDir, config.buildDir, BUILD_ENTRY_DEFAULT_FILE),
|
|
295
314
|
virtualEntry
|
|
296
315
|
);
|
|
297
316
|
}
|
|
@@ -327,7 +346,7 @@ async function createBuildCodegenModule(config) {
|
|
|
327
346
|
{ tabWidth: 4, parser: "typescript" }
|
|
328
347
|
);
|
|
329
348
|
await fs__default.writeFile(
|
|
330
|
-
path__default.resolve(config.rootDir, config.buildDir,
|
|
349
|
+
path__default.resolve(config.rootDir, config.buildDir, CODEGEN_DEFAULT_FILE),
|
|
331
350
|
virtualModule
|
|
332
351
|
);
|
|
333
352
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import * as esbuild from 'esbuild';
|
|
|
10
10
|
import { build as build$1 } from 'esbuild';
|
|
11
11
|
import path from 'pathe';
|
|
12
12
|
import prettier from 'prettier';
|
|
13
|
-
import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.
|
|
13
|
+
import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.4d91d9b0.mjs';
|
|
14
14
|
import { globby } from 'globby';
|
|
15
15
|
import { camelCase, kebabCase } from 'scule';
|
|
16
16
|
import { dartClientGenerator } from 'arri-codegen-dart';
|
|
@@ -136,7 +136,7 @@ async function transpileFiles(config) {
|
|
|
136
136
|
outdir: outDir,
|
|
137
137
|
bundle: false,
|
|
138
138
|
format: "esm",
|
|
139
|
-
target: "
|
|
139
|
+
target: "node20",
|
|
140
140
|
platform: "node"
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -203,12 +203,18 @@ async function startBuild(config, skipCodeGen = false) {
|
|
|
203
203
|
`Build finished! You can start your server by running "node .output/server.js"`
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
|
+
const BUILD_ENTRY_DEFAULT_FILE = "__default_arri_server.js";
|
|
207
|
+
const CODEGEN_DEFAULT_FILE = "__default_arri_codegen.js";
|
|
206
208
|
async function bundleFiles(config, allowCodegen = true) {
|
|
207
209
|
if (allowCodegen) {
|
|
208
210
|
await build$1({
|
|
209
211
|
...config.esbuild,
|
|
210
212
|
entryPoints: [
|
|
211
|
-
path.resolve(
|
|
213
|
+
path.resolve(
|
|
214
|
+
config.rootDir,
|
|
215
|
+
config.buildDir,
|
|
216
|
+
CODEGEN_DEFAULT_FILE
|
|
217
|
+
)
|
|
212
218
|
],
|
|
213
219
|
platform: config.esbuild.platform ?? "node",
|
|
214
220
|
target: config.esbuild.target ?? "node18",
|
|
@@ -220,14 +226,23 @@ async function bundleFiles(config, allowCodegen = true) {
|
|
|
220
226
|
js: `import { createRequire as topLevelCreateRequire } from 'module';
|
|
221
227
|
const require = topLevelCreateRequire(import.meta.url);`
|
|
222
228
|
},
|
|
223
|
-
|
|
229
|
+
outfile: path.resolve(config.rootDir, ".output", "codegen.js")
|
|
224
230
|
});
|
|
225
231
|
}
|
|
232
|
+
let buildEntry = path.resolve(
|
|
233
|
+
config.rootDir,
|
|
234
|
+
config.buildDir,
|
|
235
|
+
BUILD_ENTRY_DEFAULT_FILE
|
|
236
|
+
);
|
|
237
|
+
if (config.buildEntry) {
|
|
238
|
+
const parts = config.buildEntry.split(".");
|
|
239
|
+
parts.pop();
|
|
240
|
+
const mergedParts = `${parts.join(".")}.js`;
|
|
241
|
+
buildEntry = path.resolve(config.rootDir, config.buildDir, mergedParts);
|
|
242
|
+
}
|
|
226
243
|
await build$1({
|
|
227
244
|
...config.esbuild,
|
|
228
|
-
entryPoints: [
|
|
229
|
-
path.resolve(config.rootDir, config.buildDir, "server.js")
|
|
230
|
-
],
|
|
245
|
+
entryPoints: [buildEntry],
|
|
231
246
|
platform: config.esbuild.platform ?? "node",
|
|
232
247
|
target: config.esbuild.target ?? "node20",
|
|
233
248
|
bundle: true,
|
|
@@ -240,10 +255,13 @@ async function bundleFiles(config, allowCodegen = true) {
|
|
|
240
255
|
const require = topLevelCreateRequire(import.meta.url);`
|
|
241
256
|
},
|
|
242
257
|
allowOverwrite: true,
|
|
243
|
-
|
|
258
|
+
outfile: path.resolve(config.rootDir, ".output", "server.js")
|
|
244
259
|
});
|
|
245
260
|
}
|
|
246
261
|
async function createBuildEntryModule(config) {
|
|
262
|
+
if (config.buildEntry) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
247
265
|
const appModule = path.resolve(config.rootDir, config.srcDir, config.entry);
|
|
248
266
|
const appImportParts = path.relative(path.resolve(config.rootDir, config.srcDir), appModule).split(".");
|
|
249
267
|
appImportParts.pop();
|
|
@@ -265,9 +283,10 @@ for (const route of routes) {
|
|
|
265
283
|
|
|
266
284
|
void listen(toNodeListener(app.h3App), {
|
|
267
285
|
port: process.env.PORT ?? ${config.port},
|
|
286
|
+
public: true,
|
|
268
287
|
});`;
|
|
269
288
|
await fs.writeFile(
|
|
270
|
-
path.resolve(config.rootDir, config.buildDir,
|
|
289
|
+
path.resolve(config.rootDir, config.buildDir, BUILD_ENTRY_DEFAULT_FILE),
|
|
271
290
|
virtualEntry
|
|
272
291
|
);
|
|
273
292
|
}
|
|
@@ -303,7 +322,7 @@ async function createBuildCodegenModule(config) {
|
|
|
303
322
|
{ tabWidth: 4, parser: "typescript" }
|
|
304
323
|
);
|
|
305
324
|
await fs.writeFile(
|
|
306
|
-
path.resolve(config.rootDir, config.buildDir,
|
|
325
|
+
path.resolve(config.rootDir, config.buildDir, CODEGEN_DEFAULT_FILE),
|
|
307
326
|
virtualModule
|
|
308
327
|
);
|
|
309
328
|
}
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
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, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, s as registerRoute, r as registerRpc } from './shared/arri.
|
|
1
|
+
export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, s as registerRoute, r as registerRpc } from './shared/arri.4d91d9b0.mjs';
|
|
2
2
|
export * from 'h3';
|
|
3
3
|
import 'arri-validate';
|
|
4
4
|
import 'arri-codegen-utils';
|
|
@@ -713,6 +713,7 @@ const defaultConfig = {
|
|
|
713
713
|
procedureGlobPatterns: ["**/*.rpc.ts"],
|
|
714
714
|
clientGenerators: [],
|
|
715
715
|
buildDir: ".arri",
|
|
716
|
+
buildEntry: "",
|
|
716
717
|
esbuild: {}
|
|
717
718
|
};
|
|
718
719
|
function defineConfig(config) {
|
|
@@ -725,7 +726,8 @@ function defineConfig(config) {
|
|
|
725
726
|
procedureGlobPatterns: config.procedureGlobPatterns ?? defaultConfig.procedureGlobPatterns,
|
|
726
727
|
clientGenerators: config.clientGenerators ?? defaultConfig.clientGenerators,
|
|
727
728
|
buildDir: config.buildDir ?? defaultConfig.buildDir,
|
|
728
|
-
esbuild: config.esbuild ?? defaultConfig.esbuild
|
|
729
|
+
esbuild: config.esbuild ?? defaultConfig.esbuild,
|
|
730
|
+
buildEntry: config.buildEntry ?? ""
|
|
729
731
|
};
|
|
730
732
|
}
|
|
731
733
|
|
|
@@ -715,6 +715,7 @@ const defaultConfig = {
|
|
|
715
715
|
procedureGlobPatterns: ["**/*.rpc.ts"],
|
|
716
716
|
clientGenerators: [],
|
|
717
717
|
buildDir: ".arri",
|
|
718
|
+
buildEntry: "",
|
|
718
719
|
esbuild: {}
|
|
719
720
|
};
|
|
720
721
|
function defineConfig(config) {
|
|
@@ -727,7 +728,8 @@ function defineConfig(config) {
|
|
|
727
728
|
procedureGlobPatterns: config.procedureGlobPatterns ?? defaultConfig.procedureGlobPatterns,
|
|
728
729
|
clientGenerators: config.clientGenerators ?? defaultConfig.clientGenerators,
|
|
729
730
|
buildDir: config.buildDir ?? defaultConfig.buildDir,
|
|
730
|
-
esbuild: config.esbuild ?? defaultConfig.esbuild
|
|
731
|
+
esbuild: config.esbuild ?? defaultConfig.esbuild,
|
|
732
|
+
buildEntry: config.buildEntry ?? ""
|
|
731
733
|
};
|
|
732
734
|
}
|
|
733
735
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arri",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"pathe": "^1.1.1",
|
|
31
31
|
"prettier": "^3.0.3",
|
|
32
32
|
"scule": "^1.0.0",
|
|
33
|
-
"arri-codegen-dart": "0.
|
|
34
|
-
"arri-codegen-
|
|
35
|
-
"arri-codegen-
|
|
36
|
-
"arri-validate": "0.
|
|
33
|
+
"arri-codegen-dart": "0.12.0",
|
|
34
|
+
"arri-codegen-ts": "0.12.0",
|
|
35
|
+
"arri-codegen-utils": "0.12.0",
|
|
36
|
+
"arri-validate": "0.12.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"listhen": "1.x"
|