toiljs 0.0.139 → 0.0.141

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.
@@ -36,6 +36,7 @@ export interface ClientConfig {
36
36
  }
37
37
  export type DevNodeMode = 'hot' | 'regional' | 'continental' | 'daemon' | 'all';
38
38
  export interface DaemonConfig {
39
+ readonly enabled?: boolean;
39
40
  readonly region?: string;
40
41
  readonly standbyRegion?: string;
41
42
  readonly defaultIntervalMs?: number;
@@ -60,6 +61,7 @@ export interface ServerConfig {
60
61
  readonly threads?: number | 'auto';
61
62
  }
62
63
  export interface ResolvedDaemonConfig {
64
+ readonly enabled?: boolean;
63
65
  readonly region: string | null;
64
66
  readonly standbyRegion: string | null;
65
67
  readonly defaultIntervalMs: number;
@@ -37,6 +37,8 @@ export async function loadConfig(opts = {}) {
37
37
  const client = user.client ?? {};
38
38
  if (user.server?.logging !== undefined && typeof user.server.logging !== 'boolean')
39
39
  throw new Error('server.logging must be a boolean');
40
+ if (user.server?.daemon?.enabled !== undefined && typeof user.server.daemon.enabled !== 'boolean')
41
+ throw new Error('server.daemon.enabled must be a boolean');
40
42
  const authRoutes = user.server?.authRoutes ?? {};
41
43
  if (typeof authRoutes !== 'object' || Array.isArray(authRoutes))
42
44
  throw new Error('server.authRoutes must be an object');
@@ -116,6 +118,7 @@ function resolveDaemonConfig(d) {
116
118
  if (maxTasks <= 0 || maxTasks > 1024)
117
119
  maxTasks = Math.min(1024, Math.max(1, maxTasks || 64));
118
120
  return {
121
+ enabled: d?.enabled,
119
122
  region: d?.region ?? null,
120
123
  standbyRegion: d?.standbyRegion ?? null,
121
124
  defaultIntervalMs,
@@ -46,11 +46,7 @@ function serverEntryFiles(root) {
46
46
  return [];
47
47
  const result = new Set(entries.map((e) => path.relative(root, path.resolve(root, e))));
48
48
  const dirs = serverDirs(root);
49
- let scanned = 0;
50
- const cap = 500;
51
- const visit = (dir, depth) => {
52
- if (scanned >= cap || depth > 16)
53
- return;
49
+ const visit = (dir) => {
54
50
  let listing;
55
51
  try {
56
52
  listing = fs.readdirSync(dir, { withFileTypes: true });
@@ -59,15 +55,12 @@ function serverEntryFiles(root) {
59
55
  return;
60
56
  }
61
57
  for (const entry of listing) {
62
- if (scanned >= cap)
63
- break;
64
58
  const full = path.join(dir, entry.name);
65
59
  if (entry.isDirectory()) {
66
60
  if (entry.name !== 'node_modules')
67
- visit(full, depth + 1);
61
+ visit(full);
68
62
  }
69
63
  else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) {
70
- scanned++;
71
64
  try {
72
65
  if (SURFACE_DECORATOR.test(fs.readFileSync(full, 'utf8'))) {
73
66
  result.add(path.relative(root, full));
@@ -79,7 +72,7 @@ function serverEntryFiles(root) {
79
72
  }
80
73
  };
81
74
  for (const dir of dirs)
82
- visit(dir, 0);
75
+ visit(dir);
83
76
  return [...result].sort();
84
77
  }
85
78
  function authEntryFiles(root, appHasUser) {
@@ -414,7 +407,7 @@ export function assertNoStreamInRequestTier(root, split) {
414
407
  function toilscriptPass(root, files, opts) {
415
408
  const args = [...files, '--target', 'release'];
416
409
  const logLib = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../server/globals/toil-log.ts');
417
- args.push('--lib', logLib, '--use', 'Log=ToilLog', '--use', `__TOIL_LOGGING=${opts.logging ? '1' : '0'}`);
410
+ args.push('--lib', logLib, '--use', 'Log=ToilLog', '--use', 'console=ToilConsole', '--use', `__TOIL_LOGGING=${opts.logging ? '1' : '0'}`);
418
411
  const editorTier = opts.mode === 'cold' ? 'cold' : opts.withRpc ? 'request' : 'stream';
419
412
  const editorDir = serverDirs(root)[0] ?? path.join(root, 'server');
420
413
  args.push('--editorTypes', path.join(editorDir, `toilscript.${editorTier}.generated.d.ts`));