@platformatic/nitro 4.0.0-new-config.2 → 4.0.0-new-config.5

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseCapability, BaseContext, BaseOptions } from '@platformatic/basic'
1
+ import { ApplicationDefinition, BaseCapability, BaseContext, BaseOptions, CapabilityFactoryOptions, ConfigContext, DeferredApplicationDefinition } from '@platformatic/basic'
2
2
  import { Configuration, ConfigurationOptions } from '@platformatic/foundation'
3
3
  import { ViteCapability } from '@platformatic/vite'
4
4
  import { JSONSchemaType } from 'ajv'
@@ -52,3 +52,10 @@ export declare const schema: JSONSchemaType<PlatformaticNitroConfig>
52
52
  export declare const schemaComponents: { nitro: JSONSchemaType<object> }
53
53
  export declare const version: string
54
54
  export declare const supportedVersions: { nitro: string, nitropack: string }
55
+
56
+ export type NitroConfigOptions = CapabilityFactoryOptions<PlatformaticNitroConfig, 'vite' | 'nitro', never>
57
+
58
+ export declare function nitro (options?: NitroConfigOptions): ApplicationDefinition
59
+ export declare function nitro (
60
+ callback: (context: ConfigContext) => NitroConfigOptions | Promise<NitroConfigOptions>
61
+ ): DeferredApplicationDefinition
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { resolve, transform as basicTransform, validationOptions } from '@platformatic/basic'
2
- import { kMetadata, loadConfiguration as utilsLoadConfiguration } from '@platformatic/foundation'
1
+ import { loadCapabilityConfiguration, transform as basicTransform, validationOptions } from '@platformatic/basic'
2
+ import { kMetadata } from '@platformatic/foundation'
3
3
  import { hasViteConfigFile, NitroCapability, NitroViteCapability } from './lib/capability.js'
4
4
  import { schema } from './lib/schema.js'
5
5
 
@@ -16,14 +16,12 @@ export async function transform (config, schema, options) {
16
16
  }
17
17
 
18
18
  export async function loadConfiguration (configOrRoot, sourceOrConfig, context) {
19
- const { root, source } = await resolve(configOrRoot, sourceOrConfig, 'application')
20
-
21
- return utilsLoadConfiguration(source, context?.schema ?? schema, {
19
+ return loadCapabilityConfiguration(configOrRoot, sourceOrConfig, context, {
20
+ schema,
21
+ scope: import.meta.filename,
22
+ suffixes: 'application',
22
23
  validationOptions,
23
- transform,
24
- replaceEnv: true,
25
- root,
26
- ...context
24
+ transform
27
25
  })
28
26
  }
29
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/nitro",
3
- "version": "4.0.0-new-config.2",
3
+ "version": "4.0.0-new-config.5",
4
4
  "description": "Platformatic Nitro Capability",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -32,10 +32,10 @@
32
32
  "dependencies": {
33
33
  "light-my-request": "^6.6.0",
34
34
  "semver": "^7.6.3",
35
- "@platformatic/basic": "4.0.0-new-config.2",
36
- "@platformatic/vite": "4.0.0-new-config.2",
37
- "@platformatic/globals": "4.0.0-new-config.2",
38
- "@platformatic/foundation": "4.0.0-new-config.2"
35
+ "@platformatic/basic": "4.0.0-new-config.5",
36
+ "@platformatic/globals": "4.0.0-new-config.5",
37
+ "@platformatic/vite": "4.0.0-new-config.5",
38
+ "@platformatic/foundation": "4.0.0-new-config.5"
39
39
  },
40
40
  "devDependencies": {
41
41
  "cleaner-spec-reporter": "^0.5.0",
@@ -48,8 +48,8 @@
48
48
  "typescript": "~6.0.3",
49
49
  "vite": "^7.2.4",
50
50
  "ws": "^8.18.0",
51
- "@platformatic/service": "4.0.0-new-config.2",
52
- "@platformatic/gateway": "4.0.0-new-config.2"
51
+ "@platformatic/gateway": "4.0.0-new-config.5",
52
+ "@platformatic/service": "4.0.0-new-config.5"
53
53
  },
54
54
  "engines": {
55
55
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/nitro/4.0.0-new-config.2.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/nitro/4.0.0-new-config.5.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Nitro Config",
5
5
  "type": "object",
@@ -178,7 +178,8 @@
178
178
  }
179
179
  },
180
180
  "default": {},
181
- "additionalProperties": true
181
+ "additionalProperties": true,
182
+ "title": "AppLoggerOptions"
182
183
  },
183
184
  "server": {
184
185
  "type": "object",
@@ -299,10 +300,12 @@
299
300
  "required": [
300
301
  "key",
301
302
  "cert"
302
- ]
303
+ ],
304
+ "title": "HttpsOptions"
303
305
  }
304
306
  },
305
- "additionalProperties": false
307
+ "additionalProperties": false,
308
+ "title": "AppServerOptions"
306
309
  },
307
310
  "watch": {
308
311
  "anyOf": [
@@ -338,7 +341,8 @@
338
341
  "default": null
339
342
  }
340
343
  },
341
- "additionalProperties": false
344
+ "additionalProperties": false,
345
+ "title": "WatchOptions"
342
346
  },
343
347
  {
344
348
  "type": "boolean"
@@ -384,9 +388,6 @@
384
388
  "default": {},
385
389
  "additionalProperties": false
386
390
  },
387
- "entrypointPort": {
388
- "type": "number"
389
- },
390
391
  "changeDirectoryBeforeExecution": {
391
392
  "type": "boolean",
392
393
  "default": false
@@ -401,7 +402,8 @@
401
402
  },
402
403
  "additionalProperties": false,
403
404
  "required": [],
404
- "default": {}
405
+ "default": {},
406
+ "title": "BuildableApplicationOptions"
405
407
  },
406
408
  "runtime": {
407
409
  "type": "object",
@@ -446,7 +448,8 @@
446
448
  "type": "boolean",
447
449
  "default": false
448
450
  }
449
- }
451
+ },
452
+ "title": "ExtensionEntry"
450
453
  },
451
454
  {
452
455
  "type": "array",
@@ -475,7 +478,8 @@
475
478
  "type": "boolean",
476
479
  "default": false
477
480
  }
478
- }
481
+ },
482
+ "title": "ExtensionEntry"
479
483
  }
480
484
  ]
481
485
  }
@@ -542,6 +546,9 @@
542
546
  "url": {
543
547
  "type": "string"
544
548
  },
549
+ "module": {
550
+ "type": "string"
551
+ },
545
552
  "gitBranch": {
546
553
  "type": "string",
547
554
  "default": "main"
@@ -583,7 +590,8 @@
583
590
  "minimum": 0,
584
591
  "maximum": 1
585
592
  }
586
- }
593
+ },
594
+ "title": "ApplicationWorkersOptions"
587
595
  }
588
596
  ]
589
597
  },
@@ -736,7 +744,8 @@
736
744
  ]
737
745
  }
738
746
  },
739
- "additionalProperties": false
747
+ "additionalProperties": false,
748
+ "title": "ApplicationHealthOptions"
740
749
  },
741
750
  "restartOnError": {
742
751
  "description": "Overrides the runtime-level restartOnError for this application. Set to false or 0 to never restart the application when it crashes, a positive number to wait that amount of milliseconds between restarts, or true to use the default delay.",
@@ -835,14 +844,15 @@
835
844
  "additionalProperties": false
836
845
  }
837
846
  },
838
- "additionalProperties": false
847
+ "additionalProperties": false,
848
+ "title": "PermissionsOptions"
839
849
  },
840
- "telemetry": {
850
+ "tracing": {
841
851
  "type": "object",
842
852
  "properties": {
843
853
  "instrumentations": {
844
854
  "type": "array",
845
- "description": "An array of instrumentations loaded if telemetry is enabled",
855
+ "description": "An array of instrumentations loaded if tracing is enabled",
846
856
  "items": {
847
857
  "oneOf": [
848
858
  {
@@ -869,7 +879,8 @@
869
879
  ]
870
880
  }
871
881
  }
872
- }
882
+ },
883
+ "title": "ApplicationTelemetryOverrides"
873
884
  },
874
885
  "compileCache": {
875
886
  "anyOf": [
@@ -889,7 +900,8 @@
889
900
  "description": "Directory to store compile cache. Defaults to .plt/compile-cache in app root"
890
901
  }
891
902
  },
892
- "additionalProperties": false
903
+ "additionalProperties": false,
904
+ "title": "CompileCacheOptions"
893
905
  }
894
906
  ]
895
907
  },
@@ -916,7 +928,8 @@
916
928
  }
917
929
  ]
918
930
  }
919
- }
931
+ },
932
+ "title": "ApplicationEntry"
920
933
  }
921
934
  },
922
935
  "workers": {
@@ -973,7 +986,8 @@
973
986
  "minimum": 0,
974
987
  "maximum": 1
975
988
  }
976
- }
989
+ },
990
+ "title": "WorkersOptions"
977
991
  }
978
992
  ]
979
993
  },
@@ -1157,7 +1171,8 @@
1157
1171
  }
1158
1172
  },
1159
1173
  "default": {},
1160
- "additionalProperties": true
1174
+ "additionalProperties": true,
1175
+ "title": "AppLoggerOptions"
1161
1176
  },
1162
1177
  "reuseTcpPorts": {
1163
1178
  "type": "boolean",
@@ -1229,7 +1244,8 @@
1229
1244
  "runtime",
1230
1245
  "application"
1231
1246
  ],
1232
- "additionalProperties": false
1247
+ "additionalProperties": false,
1248
+ "title": "GracefulShutdownOptions"
1233
1249
  },
1234
1250
  "health": {
1235
1251
  "type": "object",
@@ -1391,7 +1407,8 @@
1391
1407
  "default": 262144
1392
1408
  }
1393
1409
  },
1394
- "additionalProperties": false
1410
+ "additionalProperties": false,
1411
+ "title": "HealthOptions"
1395
1412
  },
1396
1413
  "healthProbes": {
1397
1414
  "anyOf": [
@@ -1508,7 +1525,8 @@
1508
1525
  ]
1509
1526
  }
1510
1527
  },
1511
- "additionalProperties": false
1528
+ "additionalProperties": false,
1529
+ "title": "HealthProbesOptions"
1512
1530
  }
1513
1531
  ],
1514
1532
  "default": true
@@ -1605,7 +1623,8 @@
1605
1623
  }
1606
1624
  ]
1607
1625
  }
1608
- }
1626
+ },
1627
+ "title": "UndiciOptions"
1609
1628
  },
1610
1629
  "httpCache": {
1611
1630
  "oneOf": [
@@ -1661,7 +1680,8 @@
1661
1680
  "default": "shared",
1662
1681
  "description": "Cache type. \"shared\" caches may be shared between users, \"private\" caches are user-specific."
1663
1682
  }
1664
- }
1683
+ },
1684
+ "title": "HttpCacheOptions"
1665
1685
  }
1666
1686
  ]
1667
1687
  },
@@ -1702,7 +1722,8 @@
1702
1722
  "description": "Custom path for the control socket. If not specified, uses the default platform-specific location."
1703
1723
  }
1704
1724
  },
1705
- "additionalProperties": false
1725
+ "additionalProperties": false,
1726
+ "title": "ManagementApiOptions"
1706
1727
  }
1707
1728
  ],
1708
1729
  "default": true
@@ -1855,7 +1876,8 @@
1855
1876
  "required": [
1856
1877
  "key",
1857
1878
  "cert"
1858
- ]
1879
+ ],
1880
+ "title": "HttpsOptions"
1859
1881
  },
1860
1882
  "auth": {
1861
1883
  "type": "object",
@@ -2134,11 +2156,13 @@
2134
2156
  }
2135
2157
  }
2136
2158
  },
2137
- "additionalProperties": false
2159
+ "additionalProperties": false,
2160
+ "title": "MetricsOptions"
2138
2161
  }
2139
- ]
2162
+ ],
2163
+ "default": false
2140
2164
  },
2141
- "telemetry": {
2165
+ "tracing": {
2142
2166
  "type": "object",
2143
2167
  "properties": {
2144
2168
  "enabled": {
@@ -2309,7 +2333,8 @@
2309
2333
  "required": [
2310
2334
  "applicationName"
2311
2335
  ],
2312
- "additionalProperties": false
2336
+ "additionalProperties": false,
2337
+ "title": "TelemetryOptions"
2313
2338
  },
2314
2339
  "verticalScaler": {
2315
2340
  "type": "object",
@@ -2565,7 +2590,8 @@
2565
2590
  "description": "Directory to store compile cache. Defaults to .plt/compile-cache in app root"
2566
2591
  }
2567
2592
  },
2568
- "additionalProperties": false
2593
+ "additionalProperties": false,
2594
+ "title": "CompileCacheOptions"
2569
2595
  }
2570
2596
  ]
2571
2597
  },
@@ -2609,7 +2635,8 @@
2609
2635
  "minimum": 0,
2610
2636
  "maximum": 1
2611
2637
  }
2612
- }
2638
+ },
2639
+ "title": "ApplicationWorkersOptions"
2613
2640
  }
2614
2641
  ]
2615
2642
  },
@@ -2762,7 +2789,8 @@
2762
2789
  ]
2763
2790
  }
2764
2791
  },
2765
- "additionalProperties": false
2792
+ "additionalProperties": false,
2793
+ "title": "ApplicationHealthOptions"
2766
2794
  },
2767
2795
  "restartOnError": {
2768
2796
  "description": "Overrides the runtime-level restartOnError for this application. Set to false or 0 to never restart the application when it crashes, a positive number to wait that amount of milliseconds between restarts, or true to use the default delay.",
@@ -2854,14 +2882,15 @@
2854
2882
  "additionalProperties": false
2855
2883
  }
2856
2884
  },
2857
- "additionalProperties": false
2885
+ "additionalProperties": false,
2886
+ "title": "PermissionsOptions"
2858
2887
  },
2859
- "telemetry": {
2888
+ "tracing": {
2860
2889
  "type": "object",
2861
2890
  "properties": {
2862
2891
  "instrumentations": {
2863
2892
  "type": "array",
2864
- "description": "An array of instrumentations loaded if telemetry is enabled",
2893
+ "description": "An array of instrumentations loaded if tracing is enabled",
2865
2894
  "items": {
2866
2895
  "oneOf": [
2867
2896
  {
@@ -2888,7 +2917,8 @@
2888
2917
  ]
2889
2918
  }
2890
2919
  }
2891
- }
2920
+ },
2921
+ "title": "ApplicationTelemetryOverrides"
2892
2922
  },
2893
2923
  "compileCache": {
2894
2924
  "anyOf": [
@@ -2908,7 +2938,8 @@
2908
2938
  "description": "Directory to store compile cache. Defaults to .plt/compile-cache in app root"
2909
2939
  }
2910
2940
  },
2911
- "additionalProperties": false
2941
+ "additionalProperties": false,
2942
+ "title": "CompileCacheOptions"
2912
2943
  }
2913
2944
  ]
2914
2945
  }