silgi 0.36.18 → 0.37.1
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/build.mjs +1 -0
- package/dist/cli/build.mjs +78 -52
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/init.mjs +1 -0
- package/dist/cli/install.mjs +1 -0
- package/dist/cli/watch.mjs +1 -0
- package/dist/core/index.mjs +48 -38
- package/dist/index.mjs +0 -1
- package/dist/runtime/internal/next.mjs +1 -26
- package/dist/runtime/internal/nitro.mjs +1 -32
- package/dist/types/index.d.mts +594 -593
- package/package.json +2 -1
package/dist/types/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { ApifulConfig } from 'apiful/config';
|
|
|
2
2
|
import { C12InputConfig, ResolvedConfig, ConfigWatcher, WatchConfigOptions } from 'c12';
|
|
3
3
|
import { ChokidarOptions } from 'chokidar';
|
|
4
4
|
import { DateString, CompatibilityDateSpec, CompatibilityDates } from 'compatx';
|
|
5
|
-
import { ConsolaInstance,
|
|
5
|
+
import { ConsolaInstance, ConsolaOptions, LogLevel } from 'consola';
|
|
6
6
|
import { Hookable, NestedHooks } from 'hookable';
|
|
7
7
|
import { Ignore, Options } from 'ignore';
|
|
8
8
|
import { TSConfig } from 'pkg-types';
|
|
@@ -11,7 +11,7 @@ import { ResolvedServiceDefinition as ResolvedServiceDefinition$1, SilgiRuntimeS
|
|
|
11
11
|
import { Adapter, TablesSchema, InferModelTypes } from 'unadapter/types';
|
|
12
12
|
import { UnimportPluginOptions } from 'unimport/unplugin';
|
|
13
13
|
import * as h3 from 'h3';
|
|
14
|
-
import {
|
|
14
|
+
import { HTTPMethod as HTTPMethod$1, Session, H3Event } from 'h3';
|
|
15
15
|
import * as nitropack_types from 'nitropack/types';
|
|
16
16
|
import { NitroRuntimeConfig } from 'nitropack/types';
|
|
17
17
|
import { Defu } from 'defu';
|
|
@@ -21,12 +21,12 @@ import { Stats } from 'node:fs';
|
|
|
21
21
|
import { ESMImport, ESMCodeGenOptions } from 'knitwork';
|
|
22
22
|
import { Unimport } from 'unimport';
|
|
23
23
|
import { Storage, TransactionOptions, BuiltinDriverName, StorageValue } from 'unstorage';
|
|
24
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
25
|
-
import { ProviderName } from 'std-env';
|
|
26
24
|
import { ServerRequest } from 'srvx';
|
|
25
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
27
26
|
import { NitroApp } from 'nitropack';
|
|
28
27
|
import { RouterContext } from 'rou3';
|
|
29
28
|
import { silgiFetch } from 'silgi';
|
|
29
|
+
import { ProviderName } from 'std-env';
|
|
30
30
|
import { FetchOptions, FetchResponse } from 'ofetch';
|
|
31
31
|
|
|
32
32
|
interface SilgiCompatibilityIssue {
|
|
@@ -321,6 +321,60 @@ interface GenerateAppOptions {
|
|
|
321
321
|
filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
325
|
+
type AllPaths = SilgiRouterTypes extends {
|
|
326
|
+
keys: infer U;
|
|
327
|
+
} ? keyof U extends never ? string : keyof U : string;
|
|
328
|
+
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
329
|
+
[K in Param]: string;
|
|
330
|
+
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
331
|
+
[K in Param]: string;
|
|
332
|
+
} : unknown;
|
|
333
|
+
|
|
334
|
+
type HttpMethod = 'get' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace';
|
|
335
|
+
type RouterParams<R extends AllPaths | (string & {})> = ExtractPathParams<R>;
|
|
336
|
+
type SilgiFetchOptions<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]> = {
|
|
337
|
+
method?: M;
|
|
338
|
+
params?: ExtractPathParams<P>;
|
|
339
|
+
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
340
|
+
} & Omit<FetchOptions, 'method' | 'body' | 'params'>;
|
|
341
|
+
type SilgiFetchClient = <P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: BasePath, options?: SilgiFetchOptions<P, BasePath, M>) => Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
342
|
+
|
|
343
|
+
interface SilgiAppPlugin {
|
|
344
|
+
(silgi: Silgi): Promise<void> | void;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
interface CapturedErrorContext {
|
|
348
|
+
event?: SilgiEvent;
|
|
349
|
+
[key: string]: unknown;
|
|
350
|
+
}
|
|
351
|
+
type CaptureError = (silgi: Silgi, error: Error, context: CapturedErrorContext) => void;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* The listeners to Silgi
|
|
355
|
+
*/
|
|
356
|
+
interface SilgiRuntimeHooks {
|
|
357
|
+
/**
|
|
358
|
+
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
359
|
+
* @param silgi The configured Silgi object
|
|
360
|
+
* @returns Promise
|
|
361
|
+
*/
|
|
362
|
+
'ready': (silgi: Silgi) => HookResult;
|
|
363
|
+
/**
|
|
364
|
+
* Called when silgi instance is gracefully closing.
|
|
365
|
+
* @param silgi The configured silgi object
|
|
366
|
+
* @returns Promise
|
|
367
|
+
*/
|
|
368
|
+
'close': (silgi: Silgi) => HookResult;
|
|
369
|
+
'app:setup:start': (silgi: Silgi) => HookResult;
|
|
370
|
+
'request:on': (event: SilgiEvent) => HookResult;
|
|
371
|
+
'fetch:before': (context: ModuleHookContext) => HookResult;
|
|
372
|
+
'fetch:after': (context: ModuleHookContext) => HookResult;
|
|
373
|
+
'fetch:error': (context: ModuleHookContext) => HookResult;
|
|
374
|
+
'fetch:finally': (context: Omit<ModuleHookContext, 'event'>) => HookResult;
|
|
375
|
+
'error': CaptureError;
|
|
376
|
+
}
|
|
377
|
+
|
|
324
378
|
type ServiceMethods<Schema extends SilgiSchema$1, Path extends keyof Schema, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
|
|
325
379
|
[M in keyof Schema[Path]]?: ServiceSetup<Schema, Path, M, Resolved, HiddenParameters>;
|
|
326
380
|
};
|
|
@@ -404,440 +458,68 @@ interface SilgiURL {
|
|
|
404
458
|
queryParams?: Record<string, string>;
|
|
405
459
|
}
|
|
406
460
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
interface SilgiCompatibility {
|
|
415
|
-
/**
|
|
416
|
-
* Required silgi version in semver format.
|
|
417
|
-
* @example `^3.2.0` or `>=3.13.0`.
|
|
418
|
-
*/
|
|
419
|
-
silgi?: string;
|
|
420
|
-
}
|
|
421
|
-
interface ModuleMeta {
|
|
422
|
-
/** Module name. */
|
|
423
|
-
name?: string;
|
|
424
|
-
/** Module description. */
|
|
425
|
-
description?: string;
|
|
426
|
-
/** Module author. */
|
|
427
|
-
author?: string;
|
|
428
|
-
/** Module license. */
|
|
429
|
-
license?: string;
|
|
430
|
-
/** Module version. */
|
|
431
|
-
version?: string;
|
|
432
|
-
/**
|
|
433
|
-
* The configuration key used within `silgi.config` for this module's options.
|
|
434
|
-
* For example, `@silgijs/axios` uses `axios`.
|
|
435
|
-
*/
|
|
436
|
-
configKey?: string;
|
|
437
|
-
/**
|
|
438
|
-
* Constraints for the versions of silgi or features this module requires.
|
|
439
|
-
*/
|
|
440
|
-
compatibility?: SilgiCompatibility;
|
|
441
|
-
/**
|
|
442
|
-
* @private
|
|
443
|
-
*/
|
|
444
|
-
_modules?: {
|
|
445
|
-
[key: string]: string;
|
|
461
|
+
type CustomDriverName = string & {
|
|
462
|
+
_custom?: any;
|
|
463
|
+
};
|
|
464
|
+
interface StorageMounts {
|
|
465
|
+
[path: string]: {
|
|
466
|
+
driver: BuiltinDriverName | CustomDriverName;
|
|
467
|
+
[option: string]: any;
|
|
446
468
|
};
|
|
447
|
-
/**
|
|
448
|
-
* @private
|
|
449
|
-
*/
|
|
450
|
-
_packageName?: string;
|
|
451
|
-
cliToRuntimeOptionsKeys?: string[];
|
|
452
|
-
readonly afterDependencies?: ReadonlyArray<string>;
|
|
453
|
-
readonly beforeDependencies?: ReadonlyArray<string>;
|
|
454
|
-
readonly requiredDependencies?: ReadonlyArray<string>;
|
|
455
|
-
[key: string]: unknown;
|
|
456
469
|
}
|
|
457
|
-
interface
|
|
458
|
-
configKey: string;
|
|
459
|
-
name: string;
|
|
460
|
-
}
|
|
461
|
-
type ModuleHookContext = Readonly<{
|
|
462
|
-
url: SilgiURL;
|
|
463
|
-
input?: unknown;
|
|
464
|
-
result?: unknown;
|
|
465
|
-
modules?: SilgiRuntimeActions;
|
|
466
|
-
error?: Error;
|
|
467
|
-
success?: boolean;
|
|
468
|
-
cached?: boolean;
|
|
469
|
-
}>;
|
|
470
|
-
/** The options received. */
|
|
471
|
-
type ModuleOptionsCustom = Record<string, any>;
|
|
472
|
-
type Prettify<T> = {
|
|
473
|
-
[K in keyof T]: T[K];
|
|
474
|
-
} & {};
|
|
475
|
-
type ResolvedModuleOptions<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>> = Prettify<Defu<Partial<TOptions>, [
|
|
476
|
-
Partial<TOptions>,
|
|
477
|
-
TOptionsDefaults
|
|
478
|
-
]>>;
|
|
479
|
-
interface ModuleDefinition<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>, TWith extends boolean> {
|
|
480
|
-
meta?: ModuleMeta;
|
|
481
|
-
defaults?: TOptionsDefaults | ((silgi: SilgiCLI) => Awaitable<TOptionsDefaults>);
|
|
482
|
-
hooks?: Partial<SilgiCLIHooks>;
|
|
483
|
-
setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI & SilgiModuleOptions) => ModuleSetupReturn;
|
|
470
|
+
interface SilgiStorageBase {
|
|
484
471
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
setup?: number;
|
|
492
|
-
[key: string]: number | undefined;
|
|
493
|
-
};
|
|
472
|
+
type StorageKeyGenerator<TInput> = (input: TInput) => string | Promise<string>;
|
|
473
|
+
interface StorageConfig<TInput> {
|
|
474
|
+
options: TransactionOptions;
|
|
475
|
+
base: 'memory' | keyof SilgiStorageBase;
|
|
476
|
+
key?: StorageKeyGenerator<TInput>;
|
|
477
|
+
scope?: 'request' | 'global';
|
|
494
478
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
479
|
+
interface StorageKeyParams<TInput = unknown> {
|
|
480
|
+
url: SilgiURL;
|
|
481
|
+
input: TInput;
|
|
482
|
+
requestId?: string;
|
|
483
|
+
keyGenerator?: StorageKeyGenerator<TInput>;
|
|
484
|
+
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
500
485
|
}
|
|
501
486
|
|
|
502
|
-
interface
|
|
503
|
-
}
|
|
504
|
-
type CommandType = 'run' | 'prepare' | 'install' | 'dev' | 'init';
|
|
505
|
-
interface SilgiRouterTypes {
|
|
506
|
-
}
|
|
507
|
-
interface DefaultHooks {
|
|
487
|
+
interface SilgiRuntimeConfig {
|
|
508
488
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
var __nitro__: {
|
|
526
|
-
useRuntimeConfig?: <T extends NitroRuntimeConfig = NitroRuntimeConfig>(event?: H3Event) => T;
|
|
489
|
+
interface SilgiOptions {
|
|
490
|
+
consolaOptions?: Partial<ConsolaOptions>;
|
|
491
|
+
present: PresetNameInput;
|
|
492
|
+
hooks: Partial<SilgiRuntimeHooks & DefaultHooks>;
|
|
493
|
+
/**
|
|
494
|
+
* Set to `true` to enable debug mode.
|
|
495
|
+
*
|
|
496
|
+
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.
|
|
497
|
+
*
|
|
498
|
+
* @default false
|
|
499
|
+
*/
|
|
500
|
+
debug: boolean;
|
|
501
|
+
storage: StorageMounts;
|
|
502
|
+
putStorage?: Storage<StorageValue>;
|
|
503
|
+
runtimeConfig: SilgiRuntimeConfig & {
|
|
527
504
|
[key: string]: any;
|
|
528
505
|
};
|
|
506
|
+
captureError: CaptureError;
|
|
507
|
+
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
|
|
508
|
+
[key: string]: any;
|
|
529
509
|
}
|
|
530
510
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
stdName?: ProviderName;
|
|
540
|
-
aliases?: string[];
|
|
541
|
-
static?: boolean;
|
|
542
|
-
compatibilityDate?: DateString;
|
|
511
|
+
/**
|
|
512
|
+
* Main interface containing all route definitions.
|
|
513
|
+
* Example:
|
|
514
|
+
* {
|
|
515
|
+
* "/api/blueSpace/basket/getBook": { ... }
|
|
516
|
+
* }
|
|
517
|
+
*/
|
|
518
|
+
interface Routers {
|
|
543
519
|
}
|
|
544
|
-
|
|
545
|
-
type Schema = 'zod' | 'valibot' | 'arkType' | 'typebox';
|
|
546
520
|
/**
|
|
547
|
-
*
|
|
548
|
-
|
|
549
|
-
interface SilgiCLIOptions extends PresetOptions {
|
|
550
|
-
_config: SilgiCLIConfig;
|
|
551
|
-
_c12: ResolvedConfig<SilgiCLIConfig> | ConfigWatcher<SilgiCLIConfig>;
|
|
552
|
-
_cli?: {
|
|
553
|
-
command?: string;
|
|
554
|
-
};
|
|
555
|
-
commandType: CommandType;
|
|
556
|
-
commands: Commands$1[];
|
|
557
|
-
schemaVendor: Schema | Schema[];
|
|
558
|
-
environments: DotenvOptions$1[];
|
|
559
|
-
activeEnvironment: 'prod' | 'docker' | 'staging' | 'testing' | '.env' | (string & {});
|
|
560
|
-
envOptions: EnvOptions$1;
|
|
561
|
-
runtimeConfig: SilgiRuntimeConfig$1 & {
|
|
562
|
-
[key: string]: any;
|
|
563
|
-
};
|
|
564
|
-
storages: string[];
|
|
565
|
-
hooks: NestedHooks<SilgiCLIHooks$1>;
|
|
566
|
-
plugins: {
|
|
567
|
-
path: string;
|
|
568
|
-
packageImport: string;
|
|
569
|
-
}[];
|
|
570
|
-
baseURL: string;
|
|
571
|
-
compatibilityDate: CompatibilityDates;
|
|
572
|
-
modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
573
|
-
_modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
574
|
-
isPreparingModules: boolean;
|
|
575
|
-
debug: true | {
|
|
576
|
-
command?: boolean;
|
|
577
|
-
install?: boolean;
|
|
578
|
-
};
|
|
579
|
-
preset: PresetName;
|
|
580
|
-
static: boolean;
|
|
581
|
-
logLevel: LogLevel;
|
|
582
|
-
appConfig: AppConfig;
|
|
583
|
-
appConfigFiles: string[];
|
|
584
|
-
codegen: {
|
|
585
|
-
env: {
|
|
586
|
-
safeList: string[][];
|
|
587
|
-
};
|
|
588
|
-
};
|
|
589
|
-
storage: StorageMounts$1;
|
|
590
|
-
devStorage: StorageMounts$1;
|
|
591
|
-
workspaceDir: string;
|
|
592
|
-
rootDir: string;
|
|
593
|
-
srcDir: string;
|
|
594
|
-
migrationDir: string;
|
|
595
|
-
scanDirs: string[];
|
|
596
|
-
build: {
|
|
597
|
-
dir: string;
|
|
598
|
-
typesDir: string;
|
|
599
|
-
/**
|
|
600
|
-
* It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
* @example
|
|
604
|
-
* ```js
|
|
605
|
-
* templates: [
|
|
606
|
-
* {
|
|
607
|
-
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
608
|
-
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
609
|
-
* }
|
|
610
|
-
* ]
|
|
611
|
-
* ```
|
|
612
|
-
*/
|
|
613
|
-
templates: SilgiTemplate$1<any>[];
|
|
614
|
-
};
|
|
615
|
-
modulesDir: string[];
|
|
616
|
-
output: {
|
|
617
|
-
dir: string;
|
|
618
|
-
serverDir: string;
|
|
619
|
-
publicDir: string;
|
|
620
|
-
};
|
|
621
|
-
serverDir: string;
|
|
622
|
-
clientDir: string;
|
|
623
|
-
silgi: {
|
|
624
|
-
/**
|
|
625
|
-
* @default "{serverDir}/silgi"
|
|
626
|
-
*/
|
|
627
|
-
serverDir: string;
|
|
628
|
-
clientDir: string;
|
|
629
|
-
/**
|
|
630
|
-
* @default "{serverDir}/public"
|
|
631
|
-
*/
|
|
632
|
-
publicDir: string;
|
|
633
|
-
/**
|
|
634
|
-
* @default "{silgi.serverDir}/utils"
|
|
635
|
-
*/
|
|
636
|
-
utilsDir: string;
|
|
637
|
-
/**
|
|
638
|
-
* @default "{silgi.serverDir}/types"
|
|
639
|
-
*/
|
|
640
|
-
typesDir: string;
|
|
641
|
-
/**
|
|
642
|
-
* @default "{silgi.serverDir}/vfs"
|
|
643
|
-
*/
|
|
644
|
-
vfsDir: string;
|
|
645
|
-
};
|
|
646
|
-
imports: UnimportPluginOptions | false;
|
|
647
|
-
watchOptions: ChokidarOptions;
|
|
648
|
-
nodeModulesDirs: string[];
|
|
649
|
-
devServer: {
|
|
650
|
-
watch: string[];
|
|
651
|
-
};
|
|
652
|
-
framework: SilgiFrameworkInfo$1;
|
|
653
|
-
/**
|
|
654
|
-
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building.
|
|
655
|
-
*
|
|
656
|
-
* @default ["**\/*.stories.{js,cts,mts,ts,jsx,tsx}","**\/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}","**\/*.d.{cts,mts,ts}","**\/.{pnpm-store,vercel,netlify,output,git,cache,data}",".nuxt/analyze",".nuxt","**\/-*.*"]
|
|
657
|
-
*/
|
|
658
|
-
ignore: Array<string>;
|
|
659
|
-
/**
|
|
660
|
-
* Whether Nuxt is running in development mode.
|
|
661
|
-
*
|
|
662
|
-
* Normally, you should not need to set this.
|
|
663
|
-
*
|
|
664
|
-
* @default false
|
|
665
|
-
*/
|
|
666
|
-
dev: boolean;
|
|
667
|
-
/**
|
|
668
|
-
* jiti with stub mode
|
|
669
|
-
* @default false
|
|
670
|
-
*/
|
|
671
|
-
stub: boolean;
|
|
672
|
-
/**
|
|
673
|
-
* Whether your app is being unit tested.
|
|
674
|
-
*
|
|
675
|
-
* @default false
|
|
676
|
-
*/
|
|
677
|
-
test: boolean;
|
|
678
|
-
extensions: string[];
|
|
679
|
-
future: {
|
|
680
|
-
/**
|
|
681
|
-
* This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
|
|
682
|
-
*
|
|
683
|
-
* It improves type support when using modern libraries with `exports`.
|
|
684
|
-
* You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
685
|
-
*
|
|
686
|
-
* @default true
|
|
687
|
-
*
|
|
688
|
-
* @see [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
|
|
689
|
-
*/
|
|
690
|
-
typescriptBundlerResolution: boolean;
|
|
691
|
-
};
|
|
692
|
-
typescript: {
|
|
693
|
-
/**
|
|
694
|
-
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks)
|
|
695
|
-
*
|
|
696
|
-
* @default true
|
|
697
|
-
*/
|
|
698
|
-
strict: boolean;
|
|
699
|
-
/**
|
|
700
|
-
* Modules to generate deep aliases for within `compilerOptions.paths`. This does not yet support subpaths. It may be necessary when using Nuxt within a pnpm monorepo with `shamefully-hoist=false`.
|
|
701
|
-
*
|
|
702
|
-
* @default ["nitro/types","nitro/runtime","defu","h3","consola","ofetch","@unhead/vue","@nuxt/devtools","vue","@vue/runtime-core","@vue/compiler-sfc","vue-router","vue-router/auto-routes","unplugin-vue-router/client","@nuxt/schema","nuxt"]
|
|
703
|
-
*/
|
|
704
|
-
hoist: Array<string>;
|
|
705
|
-
/**
|
|
706
|
-
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
|
|
707
|
-
*
|
|
708
|
-
* @default false
|
|
709
|
-
*/
|
|
710
|
-
includeWorkspace: boolean;
|
|
711
|
-
/**
|
|
712
|
-
* Enable build-time type checking.
|
|
713
|
-
*
|
|
714
|
-
* If set to true, this will type check in development. You can restrict this to build-time type checking by setting it to `build`. Requires to install `typescript` and `vue-tsc` as dev dependencies.
|
|
715
|
-
*
|
|
716
|
-
* @default false
|
|
717
|
-
*
|
|
718
|
-
* @see [Nuxt TypeScript docs](https://nuxt.com/docs/guide/concepts/typescript)
|
|
719
|
-
*/
|
|
720
|
-
typeCheck: boolean | 'build';
|
|
721
|
-
/**
|
|
722
|
-
* You can extend generated `.nuxt/tsconfig.json` using this option.
|
|
723
|
-
*
|
|
724
|
-
*/
|
|
725
|
-
tsConfig: TSConfig;
|
|
726
|
-
/**
|
|
727
|
-
* Generate a `*.vue` shim.
|
|
728
|
-
*
|
|
729
|
-
* We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) generate accurate types for your components.
|
|
730
|
-
* Note that you may wish to set this to `true` if you are using other libraries, such as ESLint, that are unable to understand the type of `.vue` files.
|
|
731
|
-
*
|
|
732
|
-
* @default false
|
|
733
|
-
*/
|
|
734
|
-
shim: boolean;
|
|
735
|
-
/**
|
|
736
|
-
* @default "types/silgi.tsconfig.json"
|
|
737
|
-
*/
|
|
738
|
-
tsconfigPath: string;
|
|
739
|
-
/**
|
|
740
|
-
* @default true
|
|
741
|
-
*/
|
|
742
|
-
generateTsConfig: boolean;
|
|
743
|
-
/**
|
|
744
|
-
* @default ['silgiTypes']
|
|
745
|
-
*/
|
|
746
|
-
customConditions: string[];
|
|
747
|
-
/**
|
|
748
|
-
* Enable generating runtime configuration types.
|
|
749
|
-
*
|
|
750
|
-
* @default true
|
|
751
|
-
*/
|
|
752
|
-
generateRuntimeConfigTypes: boolean;
|
|
753
|
-
/**
|
|
754
|
-
* @default false
|
|
755
|
-
* Behavior of import paths in auto-generated silgi files
|
|
756
|
-
*/
|
|
757
|
-
removeFileExtension: boolean;
|
|
758
|
-
};
|
|
759
|
-
alias: Record<string, string>;
|
|
760
|
-
/**
|
|
761
|
-
* @default ['silgi']
|
|
762
|
-
*/
|
|
763
|
-
conditions: string[];
|
|
764
|
-
/**
|
|
765
|
-
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
|
|
766
|
-
*
|
|
767
|
-
*
|
|
768
|
-
* @see [node-ignore](https://github.com/kaelzhang/node-ignore)
|
|
769
|
-
*
|
|
770
|
-
* @example
|
|
771
|
-
* ```js
|
|
772
|
-
* ignoreOptions: {
|
|
773
|
-
* ignorecase: false
|
|
774
|
-
* }
|
|
775
|
-
* ```
|
|
776
|
-
*/
|
|
777
|
-
ignoreOptions: Options;
|
|
778
|
-
installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
|
|
779
|
-
apiFul: ApifulConfig;
|
|
780
|
-
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* Silgi input config (silgi.config)
|
|
784
|
-
*/
|
|
785
|
-
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate' | '_config' | '_c12' | 'consola'>>, C12InputConfig<SilgiCLIConfig>, Partial<SilgiModuleOptions> {
|
|
786
|
-
preset?: PresetNameInput;
|
|
787
|
-
extends?: string | string[] | SilgiPreset;
|
|
788
|
-
compatibilityDate?: CompatibilityDateSpec;
|
|
789
|
-
}
|
|
790
|
-
interface AppConfig {
|
|
791
|
-
[key: string]: any;
|
|
792
|
-
}
|
|
793
|
-
interface LoadConfigOptions {
|
|
794
|
-
watch?: boolean;
|
|
795
|
-
c12?: WatchConfigOptions;
|
|
796
|
-
compatibilityDate?: CompatibilityDateSpec;
|
|
797
|
-
consola?: ConsolaInstance;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
|
|
801
|
-
type AllPaths = SilgiRouterTypes extends {
|
|
802
|
-
keys: infer U;
|
|
803
|
-
} ? keyof U extends never ? string : keyof U : string;
|
|
804
|
-
type ExtractPathParams<T extends string> = T extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
805
|
-
[K in Param]: string;
|
|
806
|
-
} & ExtractPathParams<Rest> : T extends `${infer _Start}:${infer Param}` ? {
|
|
807
|
-
[K in Param]: string;
|
|
808
|
-
} : unknown;
|
|
809
|
-
|
|
810
|
-
type HttpMethod = 'get' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace';
|
|
811
|
-
type RouterParams<R extends AllPaths | (string & {})> = ExtractPathParams<R>;
|
|
812
|
-
type SilgiFetchOptions<P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]> = {
|
|
813
|
-
method?: M;
|
|
814
|
-
params?: ExtractPathParams<P>;
|
|
815
|
-
body?: SilgiRouterTypes[BasePath][M]['input'];
|
|
816
|
-
} & Omit<FetchOptions, 'method' | 'body' | 'params'>;
|
|
817
|
-
type SilgiFetchClient = <P extends AllPaths | (string & {}), BasePath extends keyof SilgiRouterTypes = TrimAfterFourSlashes<P> extends keyof SilgiRouterTypes ? TrimAfterFourSlashes<P> : never, M extends keyof SilgiRouterTypes[BasePath] = keyof SilgiRouterTypes[BasePath]>(url: BasePath, options?: SilgiFetchOptions<P, BasePath, M>) => Promise<FetchResponse<SilgiRouterTypes[BasePath][M]['output']>>;
|
|
818
|
-
|
|
819
|
-
interface SilgiAppPlugin {
|
|
820
|
-
(silgi: Silgi): Promise<void> | void;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
interface CapturedErrorContext {
|
|
824
|
-
event?: SilgiEvent;
|
|
825
|
-
[key: string]: unknown;
|
|
826
|
-
}
|
|
827
|
-
type CaptureError = (silgi: Silgi, error: Error, context: CapturedErrorContext) => void;
|
|
828
|
-
|
|
829
|
-
/**
|
|
830
|
-
* Main interface containing all route definitions.
|
|
831
|
-
* Example:
|
|
832
|
-
* {
|
|
833
|
-
* "/api/blueSpace/basket/getBook": { ... }
|
|
834
|
-
* }
|
|
835
|
-
*/
|
|
836
|
-
interface Routers {
|
|
837
|
-
}
|
|
838
|
-
/**
|
|
839
|
-
* Extracts the prefix (first segment) from a URL, including the leading slash.
|
|
840
|
-
* @example ExtractPrefix<'/api/blueSpace/basket'> // '/api'
|
|
521
|
+
* Extracts the prefix (first segment) from a URL, including the leading slash.
|
|
522
|
+
* @example ExtractPrefix<'/api/blueSpace/basket'> // '/api'
|
|
841
523
|
*/
|
|
842
524
|
type ExtractPrefix<URL extends string> = URL extends `/${infer Prefix}/${string}` ? `/${Prefix}` : never;
|
|
843
525
|
/**
|
|
@@ -953,208 +635,527 @@ type MethodSchemas<PathParamsStr extends string = ''> = {
|
|
|
953
635
|
interface ResolvedSchema {
|
|
954
636
|
[routePath: string]: MethodSchemas<string>;
|
|
955
637
|
}
|
|
956
|
-
/**
|
|
957
|
-
* Represents a schema definition that has been fully resolved,
|
|
958
|
-
* typically after processing and validating all schema components.
|
|
959
|
-
*/
|
|
960
|
-
interface ResolvedSchemaDefinition {
|
|
961
|
-
[key: string]: {
|
|
962
|
-
[method: string]: BaseMethodSchema;
|
|
638
|
+
/**
|
|
639
|
+
* Represents a schema definition that has been fully resolved,
|
|
640
|
+
* typically after processing and validating all schema components.
|
|
641
|
+
*/
|
|
642
|
+
interface ResolvedSchemaDefinition {
|
|
643
|
+
[key: string]: {
|
|
644
|
+
[method: string]: BaseMethodSchema;
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
interface SilgiRuntimeShareds extends SilgiRuntimeSharedsExtend {
|
|
649
|
+
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
650
|
+
runtimeConfig: SilgiRuntimeConfig;
|
|
651
|
+
$fetch: typeof silgiFetch;
|
|
652
|
+
silgi: Silgi;
|
|
653
|
+
}
|
|
654
|
+
interface SilgiRuntimeSharedsExtend {
|
|
655
|
+
}
|
|
656
|
+
interface ExtendShared {
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
type StandardHTTPMethod = 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE';
|
|
660
|
+
type HTTPMethod = SilgiRuntimeMethods extends Record<string, any> ? keyof SilgiRuntimeMethods | StandardHTTPMethod : StandardHTTPMethod;
|
|
661
|
+
interface SilgiRoute {
|
|
662
|
+
route: string;
|
|
663
|
+
method?: HTTPMethod;
|
|
664
|
+
setup: ServiceSetup;
|
|
665
|
+
schema: ResolvedSchemaDefinition;
|
|
666
|
+
}
|
|
667
|
+
interface Silgi {
|
|
668
|
+
router: RouterContext<SilgiRoute>;
|
|
669
|
+
routerPrefixs: string[];
|
|
670
|
+
schemas: ResolvedSchemaDefinition;
|
|
671
|
+
services: ResolvedServiceDefinition;
|
|
672
|
+
shared: SilgiRuntimeShareds;
|
|
673
|
+
plugins: SilgiAppPlugin[];
|
|
674
|
+
framework?: {
|
|
675
|
+
nitro?: NitroApp;
|
|
676
|
+
};
|
|
677
|
+
_ignore?: Ignore;
|
|
678
|
+
hooks: Hookable<SilgiRuntimeHooks & DefaultHooks>;
|
|
679
|
+
hook: Silgi['hooks']['hook'];
|
|
680
|
+
callHook: Silgi['hooks']['callHook'];
|
|
681
|
+
addHooks: Silgi['hooks']['addHooks'];
|
|
682
|
+
ready: () => Promise<void>;
|
|
683
|
+
close: () => Promise<void>;
|
|
684
|
+
logger: ConsolaInstance;
|
|
685
|
+
storage: Storage;
|
|
686
|
+
envOptions: EnvOptions;
|
|
687
|
+
options: SilgiOptions & SilgiRuntimeOptions;
|
|
688
|
+
captureError: CaptureError;
|
|
689
|
+
}
|
|
690
|
+
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
691
|
+
options: DeepPartial<SilgiOptions>;
|
|
692
|
+
}
|
|
693
|
+
interface BuildSilgi {
|
|
694
|
+
framework?: {
|
|
695
|
+
nitro?: NitroApp;
|
|
696
|
+
};
|
|
697
|
+
modules?: Partial<SilgiRuntimeOptions>;
|
|
698
|
+
options?: Partial<SilgiOptions>;
|
|
699
|
+
}
|
|
700
|
+
type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Route extends keyof Schema = keyof Schema, Method extends keyof Schema[Route] = keyof Schema[Route], _Resolved extends boolean = true, _HiddenParameters extends boolean = true> = Omit<RequestInit, 'body' | 'headers' | 'method'> & {
|
|
701
|
+
method: Method;
|
|
702
|
+
body?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
703
|
+
input?: infer I;
|
|
704
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown : unknown;
|
|
705
|
+
headers?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
706
|
+
headers?: infer H;
|
|
707
|
+
} ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown : unknown;
|
|
708
|
+
} & (Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
709
|
+
pathParams?: infer P;
|
|
710
|
+
} ? P extends StandardSchemaV1 ? {
|
|
711
|
+
pathParams: StandardSchemaV1.InferInput<P>;
|
|
712
|
+
} : {
|
|
713
|
+
pathParams?: unknown;
|
|
714
|
+
} : {
|
|
715
|
+
pathParams?: unknown;
|
|
716
|
+
} : {
|
|
717
|
+
pathParams?: unknown;
|
|
718
|
+
} : {
|
|
719
|
+
pathParams?: unknown;
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
interface ExtendContext {
|
|
723
|
+
}
|
|
724
|
+
interface SilgiRuntimeContext extends Record<string, any> {
|
|
725
|
+
params?: Record<string, string>;
|
|
726
|
+
/**
|
|
727
|
+
* Matched router Node
|
|
728
|
+
*
|
|
729
|
+
* @experimental The object structure may change in non-major version.
|
|
730
|
+
*/
|
|
731
|
+
matchedRoute?: SilgiRoute;
|
|
732
|
+
sessions?: Record<string, Session>;
|
|
733
|
+
clientAddress?: string;
|
|
734
|
+
source?: any;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Bu nitrojs, h3 event or request context.
|
|
738
|
+
*/
|
|
739
|
+
interface SilgiEvent extends Record<string, unknown> {
|
|
740
|
+
/**
|
|
741
|
+
* Event context.
|
|
742
|
+
*/
|
|
743
|
+
readonly context: SilgiRuntimeContext;
|
|
744
|
+
/**
|
|
745
|
+
* Incoming HTTP request info.
|
|
746
|
+
*
|
|
747
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
748
|
+
*/
|
|
749
|
+
readonly req: ServerRequest;
|
|
750
|
+
/**
|
|
751
|
+
* Access to the parsed request URL.
|
|
752
|
+
*
|
|
753
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/URL)
|
|
754
|
+
*/
|
|
755
|
+
readonly url: URL;
|
|
756
|
+
/**
|
|
757
|
+
* Prepared HTTP response.
|
|
758
|
+
*/
|
|
759
|
+
readonly res: {
|
|
760
|
+
status?: number;
|
|
761
|
+
statusText?: string;
|
|
762
|
+
readonly headers: Headers;
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
interface SilgiRuntimeActions {
|
|
767
|
+
}
|
|
768
|
+
interface SilgiModuleOptions {
|
|
769
|
+
}
|
|
770
|
+
interface SilgiRuntimeOptions {
|
|
771
|
+
}
|
|
772
|
+
type SilgiModuleInput = (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false);
|
|
773
|
+
interface SilgiCompatibility {
|
|
774
|
+
/**
|
|
775
|
+
* Required silgi version in semver format.
|
|
776
|
+
* @example `^3.2.0` or `>=3.13.0`.
|
|
777
|
+
*/
|
|
778
|
+
silgi?: string;
|
|
779
|
+
}
|
|
780
|
+
interface ModuleMeta {
|
|
781
|
+
/** Module name. */
|
|
782
|
+
name?: string;
|
|
783
|
+
/** Module description. */
|
|
784
|
+
description?: string;
|
|
785
|
+
/** Module author. */
|
|
786
|
+
author?: string;
|
|
787
|
+
/** Module license. */
|
|
788
|
+
license?: string;
|
|
789
|
+
/** Module version. */
|
|
790
|
+
version?: string;
|
|
791
|
+
/**
|
|
792
|
+
* The configuration key used within `silgi.config` for this module's options.
|
|
793
|
+
* For example, `@silgijs/axios` uses `axios`.
|
|
794
|
+
*/
|
|
795
|
+
configKey?: string;
|
|
796
|
+
/**
|
|
797
|
+
* Constraints for the versions of silgi or features this module requires.
|
|
798
|
+
*/
|
|
799
|
+
compatibility?: SilgiCompatibility;
|
|
800
|
+
/**
|
|
801
|
+
* @private
|
|
802
|
+
*/
|
|
803
|
+
_modules?: {
|
|
804
|
+
[key: string]: string;
|
|
963
805
|
};
|
|
806
|
+
/**
|
|
807
|
+
* @private
|
|
808
|
+
*/
|
|
809
|
+
_packageName?: string;
|
|
810
|
+
cliToRuntimeOptionsKeys?: string[];
|
|
811
|
+
readonly afterDependencies?: ReadonlyArray<string>;
|
|
812
|
+
readonly beforeDependencies?: ReadonlyArray<string>;
|
|
813
|
+
readonly requiredDependencies?: ReadonlyArray<string>;
|
|
814
|
+
[key: string]: unknown;
|
|
964
815
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
};
|
|
969
|
-
interface StorageMounts {
|
|
970
|
-
[path: string]: {
|
|
971
|
-
driver: BuiltinDriverName | CustomDriverName;
|
|
972
|
-
[option: string]: any;
|
|
973
|
-
};
|
|
816
|
+
interface ResolvedModuleMeta extends ModuleMeta {
|
|
817
|
+
configKey: string;
|
|
818
|
+
name: string;
|
|
974
819
|
}
|
|
975
|
-
|
|
820
|
+
type ModuleHookContext = Readonly<{
|
|
821
|
+
event?: SilgiEvent;
|
|
822
|
+
url: SilgiURL;
|
|
823
|
+
input?: unknown;
|
|
824
|
+
result?: unknown;
|
|
825
|
+
route: SilgiRoute;
|
|
826
|
+
error?: Error;
|
|
827
|
+
success?: boolean;
|
|
828
|
+
cached?: boolean;
|
|
829
|
+
}>;
|
|
830
|
+
/** The options received. */
|
|
831
|
+
type ModuleOptionsCustom = Record<string, any>;
|
|
832
|
+
type Prettify<T> = {
|
|
833
|
+
[K in keyof T]: T[K];
|
|
834
|
+
} & {};
|
|
835
|
+
type ResolvedModuleOptions<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>> = Prettify<Defu<Partial<TOptions>, [
|
|
836
|
+
Partial<TOptions>,
|
|
837
|
+
TOptionsDefaults
|
|
838
|
+
]>>;
|
|
839
|
+
interface ModuleDefinition<TOptions extends ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions>, TWith extends boolean> {
|
|
840
|
+
meta?: ModuleMeta;
|
|
841
|
+
defaults?: TOptionsDefaults | ((silgi: SilgiCLI) => Awaitable<TOptionsDefaults>);
|
|
842
|
+
hooks?: Partial<SilgiCLIHooks>;
|
|
843
|
+
setup?: (this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI & SilgiModuleOptions) => ModuleSetupReturn;
|
|
976
844
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
845
|
+
interface ModuleSetupInstallResult {
|
|
846
|
+
/**
|
|
847
|
+
* Timing information for the initial setup
|
|
848
|
+
*/
|
|
849
|
+
timings?: {
|
|
850
|
+
/** Total time took for module setup in ms */
|
|
851
|
+
setup?: number;
|
|
852
|
+
[key: string]: number | undefined;
|
|
853
|
+
};
|
|
983
854
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
|
|
855
|
+
type ModuleSetupReturn = Awaitable<false | void | ModuleSetupInstallResult>;
|
|
856
|
+
interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom, TOptionsDefaults extends Partial<TOptions> = Partial<TOptions>, TWith extends boolean = false> {
|
|
857
|
+
(this: void, resolvedOptions: TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions, silgi: SilgiCLI): ModuleSetupReturn;
|
|
858
|
+
getOptions?: (inlineOptions?: Partial<TOptions>, silgi?: SilgiCLI) => Promise<TWith extends true ? ResolvedModuleOptions<TOptions, TOptionsDefaults> : TOptions>;
|
|
859
|
+
getMeta?: () => Promise<ModuleMeta>;
|
|
990
860
|
}
|
|
991
861
|
|
|
992
|
-
interface
|
|
993
|
-
storage: <T extends StorageValue = StorageValue>(base: StorageConfig<T>['base']) => Storage<T>;
|
|
994
|
-
runtimeConfig: SilgiRuntimeConfig;
|
|
995
|
-
$fetch: typeof silgiFetch;
|
|
996
|
-
silgi: Silgi;
|
|
862
|
+
interface SilgiRuntimeMethods {
|
|
997
863
|
}
|
|
998
|
-
|
|
864
|
+
type CommandType = 'run' | 'prepare' | 'install' | 'dev' | 'init';
|
|
865
|
+
interface SilgiRouterTypes {
|
|
999
866
|
}
|
|
1000
|
-
interface
|
|
867
|
+
interface DefaultHooks {
|
|
868
|
+
}
|
|
869
|
+
type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends Record<string, any> ? {
|
|
870
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
871
|
+
} : T;
|
|
872
|
+
type DeepRequired<T> = T extends (...args: any[]) => any ? T : T extends Record<string, any> ? {
|
|
873
|
+
[P in keyof T]-?: DeepRequired<T[P]>;
|
|
874
|
+
} : T;
|
|
875
|
+
type Awaitable<T> = T | Promise<T>;
|
|
876
|
+
declare global {
|
|
877
|
+
var $silgiStatus: CommandType;
|
|
878
|
+
var _silgi_runtime: SilgiRuntimeOptions;
|
|
879
|
+
namespace NodeJS {
|
|
880
|
+
interface Global {
|
|
881
|
+
$silgiStatus: CommandType;
|
|
882
|
+
_silgi_runtime: SilgiRuntimeOptions;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
var __nitro__: {
|
|
886
|
+
useRuntimeConfig?: <T extends NitroRuntimeConfig = NitroRuntimeConfig>(event?: H3Event) => T;
|
|
887
|
+
[key: string]: any;
|
|
888
|
+
};
|
|
1001
889
|
}
|
|
1002
890
|
|
|
1003
|
-
type
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
891
|
+
type SilgiPreset = (SilgiCLIConfig & {
|
|
892
|
+
_meta?: SilgiPresetMeta;
|
|
893
|
+
}) | (() => SilgiCLIConfig & {
|
|
894
|
+
_meta?: SilgiPresetMeta;
|
|
895
|
+
});
|
|
896
|
+
interface SilgiPresetMeta {
|
|
897
|
+
url: string;
|
|
898
|
+
name: string;
|
|
899
|
+
stdName?: ProviderName;
|
|
900
|
+
aliases?: string[];
|
|
901
|
+
static?: boolean;
|
|
902
|
+
compatibilityDate?: DateString;
|
|
1010
903
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
904
|
+
|
|
905
|
+
type Schema = 'zod' | 'valibot' | 'arkType' | 'typebox';
|
|
906
|
+
/**
|
|
907
|
+
* SilgiCLI normalized options (silgi.options)
|
|
908
|
+
*/
|
|
909
|
+
interface SilgiCLIOptions extends PresetOptions {
|
|
910
|
+
_config: SilgiCLIConfig;
|
|
911
|
+
_c12: ResolvedConfig<SilgiCLIConfig> | ConfigWatcher<SilgiCLIConfig>;
|
|
912
|
+
_cli?: {
|
|
913
|
+
command?: string;
|
|
914
|
+
};
|
|
915
|
+
commandType: CommandType;
|
|
916
|
+
commands: Commands$1[];
|
|
917
|
+
schemaVendor: Schema | Schema[];
|
|
918
|
+
environments: DotenvOptions$1[];
|
|
919
|
+
activeEnvironment: 'prod' | 'docker' | 'staging' | 'testing' | '.env' | (string & {});
|
|
920
|
+
envOptions: EnvOptions$1;
|
|
921
|
+
runtimeConfig: SilgiRuntimeConfig$1 & {
|
|
922
|
+
[key: string]: any;
|
|
923
|
+
};
|
|
924
|
+
storages: string[];
|
|
925
|
+
hooks: NestedHooks<SilgiCLIHooks$1>;
|
|
926
|
+
plugins: {
|
|
927
|
+
path: string;
|
|
928
|
+
packageImport: string;
|
|
929
|
+
}[];
|
|
930
|
+
baseURL: string;
|
|
931
|
+
compatibilityDate: CompatibilityDates;
|
|
932
|
+
modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
933
|
+
_modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
|
|
934
|
+
isPreparingModules: boolean;
|
|
935
|
+
debug: true | {
|
|
936
|
+
command?: boolean;
|
|
937
|
+
install?: boolean;
|
|
938
|
+
};
|
|
939
|
+
preset: PresetName;
|
|
940
|
+
static: boolean;
|
|
941
|
+
logLevel: LogLevel;
|
|
942
|
+
appConfig: AppConfig;
|
|
943
|
+
appConfigFiles: string[];
|
|
944
|
+
codegen: {
|
|
945
|
+
env: {
|
|
946
|
+
safeList: string[][];
|
|
947
|
+
};
|
|
948
|
+
};
|
|
949
|
+
storage: StorageMounts$1;
|
|
950
|
+
devStorage: StorageMounts$1;
|
|
951
|
+
workspaceDir: string;
|
|
952
|
+
rootDir: string;
|
|
953
|
+
srcDir: string;
|
|
954
|
+
migrationDir: string;
|
|
955
|
+
scanDirs: string[];
|
|
956
|
+
build: {
|
|
957
|
+
dir: string;
|
|
958
|
+
typesDir: string;
|
|
959
|
+
/**
|
|
960
|
+
* It is recommended to use `addTemplate` from `@nuxt/kit` instead of this option.
|
|
961
|
+
*
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```js
|
|
965
|
+
* templates: [
|
|
966
|
+
* {
|
|
967
|
+
* src: '~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
968
|
+
* dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
969
|
+
* }
|
|
970
|
+
* ]
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
templates: SilgiTemplate$1<any>[];
|
|
974
|
+
};
|
|
975
|
+
modulesDir: string[];
|
|
976
|
+
output: {
|
|
977
|
+
dir: string;
|
|
978
|
+
serverDir: string;
|
|
979
|
+
publicDir: string;
|
|
980
|
+
};
|
|
981
|
+
serverDir: string;
|
|
982
|
+
clientDir: string;
|
|
983
|
+
silgi: {
|
|
984
|
+
/**
|
|
985
|
+
* @default "{serverDir}/silgi"
|
|
986
|
+
*/
|
|
987
|
+
serverDir: string;
|
|
988
|
+
clientDir: string;
|
|
989
|
+
/**
|
|
990
|
+
* @default "{serverDir}/public"
|
|
991
|
+
*/
|
|
992
|
+
publicDir: string;
|
|
993
|
+
/**
|
|
994
|
+
* @default "{silgi.serverDir}/utils"
|
|
995
|
+
*/
|
|
996
|
+
utilsDir: string;
|
|
997
|
+
/**
|
|
998
|
+
* @default "{silgi.serverDir}/types"
|
|
999
|
+
*/
|
|
1000
|
+
typesDir: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* @default "{silgi.serverDir}/vfs"
|
|
1003
|
+
*/
|
|
1004
|
+
vfsDir: string;
|
|
1020
1005
|
};
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
ready: () => Promise<void>;
|
|
1027
|
-
close: () => Promise<void>;
|
|
1028
|
-
logger: ConsolaInstance;
|
|
1029
|
-
storage: Storage;
|
|
1030
|
-
envOptions: EnvOptions;
|
|
1031
|
-
options: SilgiOptions & SilgiRuntimeOptions;
|
|
1032
|
-
captureError: CaptureError;
|
|
1033
|
-
}
|
|
1034
|
-
interface SilgiConfig extends Partial<Omit<Silgi, 'options'>>, Partial<SilgiRuntimeOptions> {
|
|
1035
|
-
options: DeepPartial<SilgiOptions>;
|
|
1036
|
-
}
|
|
1037
|
-
interface BuildSilgi {
|
|
1038
|
-
framework?: {
|
|
1039
|
-
nitro?: NitroApp;
|
|
1006
|
+
imports: UnimportPluginOptions | false;
|
|
1007
|
+
watchOptions: ChokidarOptions;
|
|
1008
|
+
nodeModulesDirs: string[];
|
|
1009
|
+
devServer: {
|
|
1010
|
+
watch: string[];
|
|
1040
1011
|
};
|
|
1041
|
-
|
|
1042
|
-
options?: Partial<SilgiOptions>;
|
|
1043
|
-
}
|
|
1044
|
-
type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Route extends keyof Schema = keyof Schema, Method extends keyof Schema[Route] = keyof Schema[Route], _Resolved extends boolean = true, _HiddenParameters extends boolean = true> = Omit<RequestInit, 'body' | 'headers' | 'method'> & {
|
|
1045
|
-
method: Method;
|
|
1046
|
-
body?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
1047
|
-
input?: infer I;
|
|
1048
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown : unknown;
|
|
1049
|
-
headers?: Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
1050
|
-
headers?: infer H;
|
|
1051
|
-
} ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown : unknown;
|
|
1052
|
-
} & (Route extends keyof Schema ? Method extends keyof Schema[Route] ? Schema[Route][Method] extends {
|
|
1053
|
-
pathParams?: infer P;
|
|
1054
|
-
} ? P extends StandardSchemaV1 ? {
|
|
1055
|
-
pathParams: StandardSchemaV1.InferInput<P>;
|
|
1056
|
-
} : {
|
|
1057
|
-
pathParams?: unknown;
|
|
1058
|
-
} : {
|
|
1059
|
-
pathParams?: unknown;
|
|
1060
|
-
} : {
|
|
1061
|
-
pathParams?: unknown;
|
|
1062
|
-
} : {
|
|
1063
|
-
pathParams?: unknown;
|
|
1064
|
-
});
|
|
1065
|
-
|
|
1066
|
-
interface ExtendContext {
|
|
1067
|
-
}
|
|
1068
|
-
interface SilgiRuntimeContext extends Record<string, any> {
|
|
1069
|
-
params?: Record<string, string>;
|
|
1012
|
+
framework: SilgiFrameworkInfo$1;
|
|
1070
1013
|
/**
|
|
1071
|
-
*
|
|
1014
|
+
* More customizable than `ignorePrefix`: all files matching glob patterns specified inside the `ignore` array will be ignored in building.
|
|
1072
1015
|
*
|
|
1073
|
-
* @
|
|
1074
|
-
*/
|
|
1075
|
-
matchedRoute?: SilgiRoute;
|
|
1076
|
-
sessions?: Record<string, Session>;
|
|
1077
|
-
clientAddress?: string;
|
|
1078
|
-
source?: any;
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Bu nitrojs, h3 event or request context.
|
|
1082
|
-
*/
|
|
1083
|
-
interface SilgiEvent extends Record<string, unknown> {
|
|
1084
|
-
/**
|
|
1085
|
-
* Event context.
|
|
1016
|
+
* @default ["**\/*.stories.{js,cts,mts,ts,jsx,tsx}","**\/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}","**\/*.d.{cts,mts,ts}","**\/.{pnpm-store,vercel,netlify,output,git,cache,data}",".nuxt/analyze",".nuxt","**\/-*.*"]
|
|
1086
1017
|
*/
|
|
1087
|
-
|
|
1018
|
+
ignore: Array<string>;
|
|
1088
1019
|
/**
|
|
1089
|
-
*
|
|
1020
|
+
* Whether Nuxt is running in development mode.
|
|
1090
1021
|
*
|
|
1091
|
-
*
|
|
1092
|
-
*/
|
|
1093
|
-
readonly req: ServerRequest;
|
|
1094
|
-
/**
|
|
1095
|
-
* Access to the parsed request URL.
|
|
1022
|
+
* Normally, you should not need to set this.
|
|
1096
1023
|
*
|
|
1097
|
-
*
|
|
1024
|
+
* @default false
|
|
1098
1025
|
*/
|
|
1099
|
-
|
|
1026
|
+
dev: boolean;
|
|
1100
1027
|
/**
|
|
1101
|
-
*
|
|
1028
|
+
* jiti with stub mode
|
|
1029
|
+
* @default false
|
|
1102
1030
|
*/
|
|
1103
|
-
|
|
1104
|
-
status?: number;
|
|
1105
|
-
statusText?: string;
|
|
1106
|
-
readonly headers: Headers;
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
/**
|
|
1111
|
-
* The listeners to Silgi
|
|
1112
|
-
*/
|
|
1113
|
-
interface SilgiRuntimeHooks {
|
|
1031
|
+
stub: boolean;
|
|
1114
1032
|
/**
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1117
|
-
* @
|
|
1033
|
+
* Whether your app is being unit tested.
|
|
1034
|
+
*
|
|
1035
|
+
* @default false
|
|
1118
1036
|
*/
|
|
1119
|
-
|
|
1037
|
+
test: boolean;
|
|
1038
|
+
extensions: string[];
|
|
1039
|
+
future: {
|
|
1040
|
+
/**
|
|
1041
|
+
* This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and Vite.
|
|
1042
|
+
*
|
|
1043
|
+
* It improves type support when using modern libraries with `exports`.
|
|
1044
|
+
* You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
1045
|
+
*
|
|
1046
|
+
* @default true
|
|
1047
|
+
*
|
|
1048
|
+
* @see [TypeScript PR implementing `bundler` module resolution](https://github.com/microsoft/TypeScript/pull/51669)
|
|
1049
|
+
*/
|
|
1050
|
+
typescriptBundlerResolution: boolean;
|
|
1051
|
+
};
|
|
1052
|
+
typescript: {
|
|
1053
|
+
/**
|
|
1054
|
+
* TypeScript comes with certain checks to give you more safety and analysis of your program. Once you’ve converted your codebase to TypeScript, you can start enabling these checks for greater safety. [Read More](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks)
|
|
1055
|
+
*
|
|
1056
|
+
* @default true
|
|
1057
|
+
*/
|
|
1058
|
+
strict: boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* Modules to generate deep aliases for within `compilerOptions.paths`. This does not yet support subpaths. It may be necessary when using Nuxt within a pnpm monorepo with `shamefully-hoist=false`.
|
|
1061
|
+
*
|
|
1062
|
+
* @default ["nitro/types","nitro/runtime","defu","h3","consola","ofetch","@unhead/vue","@nuxt/devtools","vue","@vue/runtime-core","@vue/compiler-sfc","vue-router","vue-router/auto-routes","unplugin-vue-router/client","@nuxt/schema","nuxt"]
|
|
1063
|
+
*/
|
|
1064
|
+
hoist: Array<string>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Include parent workspace in the Nuxt project. Mostly useful for themes and module authors.
|
|
1067
|
+
*
|
|
1068
|
+
* @default false
|
|
1069
|
+
*/
|
|
1070
|
+
includeWorkspace: boolean;
|
|
1071
|
+
/**
|
|
1072
|
+
* Enable build-time type checking.
|
|
1073
|
+
*
|
|
1074
|
+
* If set to true, this will type check in development. You can restrict this to build-time type checking by setting it to `build`. Requires to install `typescript` and `vue-tsc` as dev dependencies.
|
|
1075
|
+
*
|
|
1076
|
+
* @default false
|
|
1077
|
+
*
|
|
1078
|
+
* @see [Nuxt TypeScript docs](https://nuxt.com/docs/guide/concepts/typescript)
|
|
1079
|
+
*/
|
|
1080
|
+
typeCheck: boolean | 'build';
|
|
1081
|
+
/**
|
|
1082
|
+
* You can extend generated `.nuxt/tsconfig.json` using this option.
|
|
1083
|
+
*
|
|
1084
|
+
*/
|
|
1085
|
+
tsConfig: TSConfig;
|
|
1086
|
+
/**
|
|
1087
|
+
* Generate a `*.vue` shim.
|
|
1088
|
+
*
|
|
1089
|
+
* We recommend instead letting the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) generate accurate types for your components.
|
|
1090
|
+
* Note that you may wish to set this to `true` if you are using other libraries, such as ESLint, that are unable to understand the type of `.vue` files.
|
|
1091
|
+
*
|
|
1092
|
+
* @default false
|
|
1093
|
+
*/
|
|
1094
|
+
shim: boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* @default "types/silgi.tsconfig.json"
|
|
1097
|
+
*/
|
|
1098
|
+
tsconfigPath: string;
|
|
1099
|
+
/**
|
|
1100
|
+
* @default true
|
|
1101
|
+
*/
|
|
1102
|
+
generateTsConfig: boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* @default ['silgiTypes']
|
|
1105
|
+
*/
|
|
1106
|
+
customConditions: string[];
|
|
1107
|
+
/**
|
|
1108
|
+
* Enable generating runtime configuration types.
|
|
1109
|
+
*
|
|
1110
|
+
* @default true
|
|
1111
|
+
*/
|
|
1112
|
+
generateRuntimeConfigTypes: boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* @default false
|
|
1115
|
+
* Behavior of import paths in auto-generated silgi files
|
|
1116
|
+
*/
|
|
1117
|
+
removeFileExtension: boolean;
|
|
1118
|
+
};
|
|
1119
|
+
alias: Record<string, string>;
|
|
1120
1120
|
/**
|
|
1121
|
-
*
|
|
1122
|
-
* @param silgi The configured silgi object
|
|
1123
|
-
* @returns Promise
|
|
1121
|
+
* @default ['silgi']
|
|
1124
1122
|
*/
|
|
1125
|
-
|
|
1126
|
-
'app:setup:start': (silgi: Silgi) => HookResult;
|
|
1127
|
-
'request:on': (event: SilgiEvent) => HookResult;
|
|
1128
|
-
'fetch:before': (context: ModuleHookContext) => HookResult;
|
|
1129
|
-
'fetch:after': (context: ModuleHookContext) => HookResult;
|
|
1130
|
-
'fetch:error': (context: Omit<ModuleHookContext, 'event'>) => HookResult;
|
|
1131
|
-
'fetch:finally': (context: Omit<ModuleHookContext, 'event'>) => HookResult;
|
|
1132
|
-
'error': CaptureError;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
interface SilgiRuntimeConfig {
|
|
1136
|
-
}
|
|
1137
|
-
interface SilgiOptions {
|
|
1138
|
-
consolaOptions?: Partial<ConsolaOptions>;
|
|
1139
|
-
present: PresetNameInput;
|
|
1140
|
-
hooks: Partial<SilgiRuntimeHooks & DefaultHooks>;
|
|
1123
|
+
conditions: string[];
|
|
1141
1124
|
/**
|
|
1142
|
-
*
|
|
1125
|
+
* Pass options directly to `node-ignore` (which is used by Nuxt to ignore files).
|
|
1143
1126
|
*
|
|
1144
|
-
* At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.
|
|
1145
1127
|
*
|
|
1146
|
-
* @
|
|
1128
|
+
* @see [node-ignore](https://github.com/kaelzhang/node-ignore)
|
|
1129
|
+
*
|
|
1130
|
+
* @example
|
|
1131
|
+
* ```js
|
|
1132
|
+
* ignoreOptions: {
|
|
1133
|
+
* ignorecase: false
|
|
1134
|
+
* }
|
|
1135
|
+
* ```
|
|
1147
1136
|
*/
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
runtimeConfig: SilgiRuntimeConfig & {
|
|
1152
|
-
[key: string]: any;
|
|
1153
|
-
};
|
|
1154
|
-
captureError: CaptureError;
|
|
1137
|
+
ignoreOptions: Options;
|
|
1138
|
+
installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
|
|
1139
|
+
apiFul: ApifulConfig;
|
|
1155
1140
|
adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Silgi input config (silgi.config)
|
|
1144
|
+
*/
|
|
1145
|
+
interface SilgiCLIConfig extends DeepPartial<Omit<SilgiCLIOptions, 'preset' | 'compatibilityDate' | '_config' | '_c12' | 'consola'>>, C12InputConfig<SilgiCLIConfig>, Partial<SilgiModuleOptions> {
|
|
1146
|
+
preset?: PresetNameInput;
|
|
1147
|
+
extends?: string | string[] | SilgiPreset;
|
|
1148
|
+
compatibilityDate?: CompatibilityDateSpec;
|
|
1149
|
+
}
|
|
1150
|
+
interface AppConfig {
|
|
1156
1151
|
[key: string]: any;
|
|
1157
1152
|
}
|
|
1153
|
+
interface LoadConfigOptions {
|
|
1154
|
+
watch?: boolean;
|
|
1155
|
+
c12?: WatchConfigOptions;
|
|
1156
|
+
compatibilityDate?: CompatibilityDateSpec;
|
|
1157
|
+
consola?: ConsolaInstance;
|
|
1158
|
+
}
|
|
1158
1159
|
|
|
1159
1160
|
interface DotenvOptions {
|
|
1160
1161
|
/**
|