arri 0.39.2 → 0.40.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 +42 -35
- package/dist/cli.mjs +41 -34
- package/package.json +8 -8
package/dist/cli.cjs
CHANGED
|
@@ -17,7 +17,7 @@ const globby = require('globby');
|
|
|
17
17
|
const scule = require('scule');
|
|
18
18
|
const ofetch = require('ofetch');
|
|
19
19
|
const listhen = require('@joshmossas/listhen');
|
|
20
|
-
const
|
|
20
|
+
const watcher = require('@parcel/watcher');
|
|
21
21
|
const Degit = require('degit');
|
|
22
22
|
const enquirer = require('enquirer');
|
|
23
23
|
require('h3');
|
|
@@ -43,7 +43,7 @@ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs$1);
|
|
|
43
43
|
const esbuild__namespace = /*#__PURE__*/_interopNamespaceCompat(esbuild);
|
|
44
44
|
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
45
45
|
const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
|
|
46
|
-
const
|
|
46
|
+
const watcher__default = /*#__PURE__*/_interopDefaultCompat(watcher);
|
|
47
47
|
const Degit__default = /*#__PURE__*/_interopDefaultCompat(Degit);
|
|
48
48
|
const enquirer__default = /*#__PURE__*/_interopDefaultCompat(enquirer);
|
|
49
49
|
|
|
@@ -186,7 +186,8 @@ async function transpileFiles(config) {
|
|
|
186
186
|
bundle: false,
|
|
187
187
|
format: "esm",
|
|
188
188
|
target: "node20",
|
|
189
|
-
platform: "node"
|
|
189
|
+
platform: "node",
|
|
190
|
+
allowOverwrite: true
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
|
|
@@ -497,7 +498,7 @@ export default app.h3App;`;
|
|
|
497
498
|
path__default.resolve(config.rootDir, ".output", OUT_SERVER_ENTRY),
|
|
498
499
|
serverContent
|
|
499
500
|
);
|
|
500
|
-
|
|
501
|
+
await esbuild__namespace.build({
|
|
501
502
|
...config.esbuild,
|
|
502
503
|
entryPoints: [
|
|
503
504
|
path__default.resolve(config.rootDir, config.buildDir, GEN_APP_FILE)
|
|
@@ -506,9 +507,10 @@ export default app.h3App;`;
|
|
|
506
507
|
format: "esm",
|
|
507
508
|
bundle: true,
|
|
508
509
|
sourcemap: true,
|
|
509
|
-
target: "
|
|
510
|
+
target: "node20",
|
|
510
511
|
platform: "node",
|
|
511
|
-
packages: "external"
|
|
512
|
+
packages: "external",
|
|
513
|
+
allowOverwrite: true
|
|
512
514
|
});
|
|
513
515
|
}
|
|
514
516
|
async function startDevServer(config) {
|
|
@@ -519,8 +521,7 @@ async function startDevServer(config) {
|
|
|
519
521
|
createAppWithRoutesModule(config),
|
|
520
522
|
transpileFiles(config)
|
|
521
523
|
]);
|
|
522
|
-
|
|
523
|
-
await bundleFiles.rebuild();
|
|
524
|
+
await bundleFilesContext(config);
|
|
524
525
|
const listener = await startListener(config, true);
|
|
525
526
|
setTimeout(async () => {
|
|
526
527
|
await generateClients(config);
|
|
@@ -531,35 +532,39 @@ async function startDevServer(config) {
|
|
|
531
532
|
process.on("exit", async () => {
|
|
532
533
|
await Promise.allSettled([
|
|
533
534
|
listener.close(),
|
|
534
|
-
fileWatcher?.
|
|
535
|
-
bundleFiles.dispose()
|
|
535
|
+
fileWatcher?.unsubscribe()
|
|
536
536
|
]);
|
|
537
537
|
});
|
|
538
538
|
process.on("SIGINT", cleanExit);
|
|
539
539
|
process.on("SIGTERM", cleanExit);
|
|
540
540
|
async function load(isRestart, reason) {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
if (fileWatcher) {
|
|
542
|
+
await fileWatcher.unsubscribe();
|
|
543
|
+
}
|
|
544
|
+
const srcDir = path__default.resolve(config.rootDir ?? "", config.srcDir);
|
|
545
|
+
if (config.esbuild.alias) {
|
|
546
|
+
for (const key of Object.keys(config.esbuild.alias)) {
|
|
547
|
+
config.esbuild.alias[key];
|
|
544
548
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
549
|
+
}
|
|
550
|
+
const buildDir = path__default.resolve(config.rootDir, config.buildDir);
|
|
551
|
+
const outDir = path__default.resolve(config.rootDir, ".output");
|
|
552
|
+
fileWatcher = await watcher__default.subscribe(
|
|
553
|
+
srcDir,
|
|
554
|
+
async (err, events) => {
|
|
555
|
+
if (err) {
|
|
556
|
+
logger.error(err);
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
let doNothing = true;
|
|
560
|
+
for (const event of events) {
|
|
561
|
+
if (event.type === "create") {
|
|
562
|
+
continue;
|
|
552
563
|
}
|
|
564
|
+
doNothing = false;
|
|
565
|
+
break;
|
|
553
566
|
}
|
|
554
|
-
|
|
555
|
-
const buildDir = path__default.resolve(config.rootDir, config.buildDir);
|
|
556
|
-
const outDir = path__default.resolve(config.rootDir, ".output");
|
|
557
|
-
fileWatcher = chokidar__default.watch(dirsToWatch, {
|
|
558
|
-
ignored: [buildDir, outDir],
|
|
559
|
-
ignoreInitial: true
|
|
560
|
-
});
|
|
561
|
-
fileWatcher.on("all", async (event, file) => {
|
|
562
|
-
if (event === "add" || event === "addDir") {
|
|
567
|
+
if (doNothing) {
|
|
563
568
|
return;
|
|
564
569
|
}
|
|
565
570
|
await createAppWithRoutesModule(config);
|
|
@@ -569,10 +574,10 @@ async function startDevServer(config) {
|
|
|
569
574
|
"Change detected. Bundling files and restarting server...."
|
|
570
575
|
);
|
|
571
576
|
await transpileFiles(config);
|
|
572
|
-
await
|
|
577
|
+
await bundleFilesContext(config);
|
|
573
578
|
bundleCreated = true;
|
|
574
|
-
} catch (
|
|
575
|
-
logger.error("ERROR",
|
|
579
|
+
} catch (err2) {
|
|
580
|
+
logger.error("ERROR", err2);
|
|
576
581
|
bundleCreated = false;
|
|
577
582
|
}
|
|
578
583
|
if (bundleCreated && config.generators.length) {
|
|
@@ -581,9 +586,11 @@ async function startDevServer(config) {
|
|
|
581
586
|
bundleCreated = false;
|
|
582
587
|
}, 1e3);
|
|
583
588
|
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
ignore: [buildDir, outDir]
|
|
592
|
+
}
|
|
593
|
+
);
|
|
587
594
|
}
|
|
588
595
|
await load();
|
|
589
596
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import { globby } from 'globby';
|
|
|
16
16
|
import { camelCase, kebabCase } from 'scule';
|
|
17
17
|
import { ofetch } from 'ofetch';
|
|
18
18
|
import { listenAndWatch } from '@joshmossas/listhen';
|
|
19
|
-
import
|
|
19
|
+
import watcher from '@parcel/watcher';
|
|
20
20
|
import Degit from 'degit';
|
|
21
21
|
import enquirer from 'enquirer';
|
|
22
22
|
import 'h3';
|
|
@@ -162,7 +162,8 @@ async function transpileFiles(config) {
|
|
|
162
162
|
bundle: false,
|
|
163
163
|
format: "esm",
|
|
164
164
|
target: "node20",
|
|
165
|
-
platform: "node"
|
|
165
|
+
platform: "node",
|
|
166
|
+
allowOverwrite: true
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
169
|
|
|
@@ -473,7 +474,7 @@ export default app.h3App;`;
|
|
|
473
474
|
path.resolve(config.rootDir, ".output", OUT_SERVER_ENTRY),
|
|
474
475
|
serverContent
|
|
475
476
|
);
|
|
476
|
-
|
|
477
|
+
await esbuild.build({
|
|
477
478
|
...config.esbuild,
|
|
478
479
|
entryPoints: [
|
|
479
480
|
path.resolve(config.rootDir, config.buildDir, GEN_APP_FILE)
|
|
@@ -482,9 +483,10 @@ export default app.h3App;`;
|
|
|
482
483
|
format: "esm",
|
|
483
484
|
bundle: true,
|
|
484
485
|
sourcemap: true,
|
|
485
|
-
target: "
|
|
486
|
+
target: "node20",
|
|
486
487
|
platform: "node",
|
|
487
|
-
packages: "external"
|
|
488
|
+
packages: "external",
|
|
489
|
+
allowOverwrite: true
|
|
488
490
|
});
|
|
489
491
|
}
|
|
490
492
|
async function startDevServer(config) {
|
|
@@ -495,8 +497,7 @@ async function startDevServer(config) {
|
|
|
495
497
|
createAppWithRoutesModule(config),
|
|
496
498
|
transpileFiles(config)
|
|
497
499
|
]);
|
|
498
|
-
|
|
499
|
-
await bundleFiles.rebuild();
|
|
500
|
+
await bundleFilesContext(config);
|
|
500
501
|
const listener = await startListener(config, true);
|
|
501
502
|
setTimeout(async () => {
|
|
502
503
|
await generateClients(config);
|
|
@@ -507,35 +508,39 @@ async function startDevServer(config) {
|
|
|
507
508
|
process.on("exit", async () => {
|
|
508
509
|
await Promise.allSettled([
|
|
509
510
|
listener.close(),
|
|
510
|
-
fileWatcher?.
|
|
511
|
-
bundleFiles.dispose()
|
|
511
|
+
fileWatcher?.unsubscribe()
|
|
512
512
|
]);
|
|
513
513
|
});
|
|
514
514
|
process.on("SIGINT", cleanExit);
|
|
515
515
|
process.on("SIGTERM", cleanExit);
|
|
516
516
|
async function load(isRestart, reason) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
517
|
+
if (fileWatcher) {
|
|
518
|
+
await fileWatcher.unsubscribe();
|
|
519
|
+
}
|
|
520
|
+
const srcDir = path.resolve(config.rootDir ?? "", config.srcDir);
|
|
521
|
+
if (config.esbuild.alias) {
|
|
522
|
+
for (const key of Object.keys(config.esbuild.alias)) {
|
|
523
|
+
config.esbuild.alias[key];
|
|
520
524
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
525
|
+
}
|
|
526
|
+
const buildDir = path.resolve(config.rootDir, config.buildDir);
|
|
527
|
+
const outDir = path.resolve(config.rootDir, ".output");
|
|
528
|
+
fileWatcher = await watcher.subscribe(
|
|
529
|
+
srcDir,
|
|
530
|
+
async (err, events) => {
|
|
531
|
+
if (err) {
|
|
532
|
+
logger.error(err);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
let doNothing = true;
|
|
536
|
+
for (const event of events) {
|
|
537
|
+
if (event.type === "create") {
|
|
538
|
+
continue;
|
|
528
539
|
}
|
|
540
|
+
doNothing = false;
|
|
541
|
+
break;
|
|
529
542
|
}
|
|
530
|
-
|
|
531
|
-
const buildDir = path.resolve(config.rootDir, config.buildDir);
|
|
532
|
-
const outDir = path.resolve(config.rootDir, ".output");
|
|
533
|
-
fileWatcher = chokidar.watch(dirsToWatch, {
|
|
534
|
-
ignored: [buildDir, outDir],
|
|
535
|
-
ignoreInitial: true
|
|
536
|
-
});
|
|
537
|
-
fileWatcher.on("all", async (event, file) => {
|
|
538
|
-
if (event === "add" || event === "addDir") {
|
|
543
|
+
if (doNothing) {
|
|
539
544
|
return;
|
|
540
545
|
}
|
|
541
546
|
await createAppWithRoutesModule(config);
|
|
@@ -545,10 +550,10 @@ async function startDevServer(config) {
|
|
|
545
550
|
"Change detected. Bundling files and restarting server...."
|
|
546
551
|
);
|
|
547
552
|
await transpileFiles(config);
|
|
548
|
-
await
|
|
553
|
+
await bundleFilesContext(config);
|
|
549
554
|
bundleCreated = true;
|
|
550
|
-
} catch (
|
|
551
|
-
logger.error("ERROR",
|
|
555
|
+
} catch (err2) {
|
|
556
|
+
logger.error("ERROR", err2);
|
|
552
557
|
bundleCreated = false;
|
|
553
558
|
}
|
|
554
559
|
if (bundleCreated && config.generators.length) {
|
|
@@ -557,9 +562,11 @@ async function startDevServer(config) {
|
|
|
557
562
|
bundleCreated = false;
|
|
558
563
|
}, 1e3);
|
|
559
564
|
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
ignore: [buildDir, outDir]
|
|
568
|
+
}
|
|
569
|
+
);
|
|
563
570
|
}
|
|
564
571
|
await load();
|
|
565
572
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arri",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"arri": "./dist/cli.mjs"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@joshmossas/listhen": "1.
|
|
28
|
+
"@joshmossas/listhen": "1.10.0",
|
|
29
|
+
"@parcel/watcher": "^2.4.1",
|
|
29
30
|
"c12": "^1.10.0",
|
|
30
|
-
"chokidar": "^3.6.0",
|
|
31
31
|
"citty": "^0.1.6",
|
|
32
32
|
"consola": "^3.2.3",
|
|
33
33
|
"crossws": "^0.2.4",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"prettier": "^3.2.5",
|
|
45
45
|
"scule": "^1.3.0",
|
|
46
46
|
"uncrypto": "^0.1.3",
|
|
47
|
-
"arri-codegen-
|
|
48
|
-
"arri-codegen-utils": "0.
|
|
49
|
-
"arri-
|
|
50
|
-
"arri-
|
|
47
|
+
"arri-codegen-dart": "0.40.0",
|
|
48
|
+
"arri-codegen-utils": "0.40.0",
|
|
49
|
+
"arri-validate": "0.40.0",
|
|
50
|
+
"arri-codegen-ts": "0.40.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/degit": "^2.8.6",
|
|
54
|
-
"bun-types": "^1.1.
|
|
54
|
+
"bun-types": "^1.1.4"
|
|
55
55
|
}
|
|
56
56
|
}
|