@platformatic/tanstack 3.68.0 → 4.0.0-new-config.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/config.d.ts +1 -41
- package/index.js +2 -0
- package/lib/capability.js +32 -32
- package/lib/factory.js +12 -0
- package/lib/schema.js +6 -3
- package/package.json +13 -7
- package/schema.js +7 -0
- package/schema.json +10 -136
- package/watt.json +0 -3
package/config.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface PlatformaticTanStackConfig {
|
|
|
66
66
|
hostname?: string;
|
|
67
67
|
port?: number | string;
|
|
68
68
|
/**
|
|
69
|
-
* Configures how
|
|
69
|
+
* Configures how the port is assigned when the application runs multiple workers. When set to shared (the default), all workers listen on the same port (which requires SO_REUSEPORT support). When set to perWorkerIncrement, each worker listens on its own port, starting from port (worker 0) and incrementing by one for each additional worker.
|
|
70
70
|
*/
|
|
71
71
|
portAssignment?: "shared" | "perWorkerIncrement";
|
|
72
72
|
/**
|
|
@@ -224,46 +224,6 @@ export interface PlatformaticTanStackConfig {
|
|
|
224
224
|
};
|
|
225
225
|
[k: string]: unknown;
|
|
226
226
|
};
|
|
227
|
-
server?: {
|
|
228
|
-
hostname?: string;
|
|
229
|
-
port?: number | string;
|
|
230
|
-
/**
|
|
231
|
-
* Configures how entrypoint server worker ports are assigned. When set to shared, all workers listen on the same port. When set to perWorkerIncrement, each worker will use its own port, starting from port (worker 0).
|
|
232
|
-
*/
|
|
233
|
-
portAssignment?: "shared" | "perWorkerIncrement";
|
|
234
|
-
/**
|
|
235
|
-
* The maximum length of the queue of pending connections
|
|
236
|
-
*/
|
|
237
|
-
backlog?: number;
|
|
238
|
-
http2?: boolean;
|
|
239
|
-
https?: {
|
|
240
|
-
allowHTTP1?: boolean;
|
|
241
|
-
key:
|
|
242
|
-
| string
|
|
243
|
-
| {
|
|
244
|
-
path?: string;
|
|
245
|
-
}
|
|
246
|
-
| (
|
|
247
|
-
| string
|
|
248
|
-
| {
|
|
249
|
-
path?: string;
|
|
250
|
-
}
|
|
251
|
-
)[];
|
|
252
|
-
cert:
|
|
253
|
-
| string
|
|
254
|
-
| {
|
|
255
|
-
path?: string;
|
|
256
|
-
}
|
|
257
|
-
| (
|
|
258
|
-
| string
|
|
259
|
-
| {
|
|
260
|
-
path?: string;
|
|
261
|
-
}
|
|
262
|
-
)[];
|
|
263
|
-
requestCert?: boolean;
|
|
264
|
-
rejectUnauthorized?: boolean;
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
227
|
reuseTcpPorts?: boolean;
|
|
268
228
|
startTimeout?: number;
|
|
269
229
|
restartOnError?: boolean | number;
|
package/index.js
CHANGED
package/lib/capability.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
buildAdditionalServerOptions,
|
|
3
2
|
cleanBasePath,
|
|
4
3
|
createServerListener,
|
|
5
4
|
ensureTrailingSlash,
|
|
@@ -53,25 +52,23 @@ export class TanstackCapability extends ViteCapability {
|
|
|
53
52
|
this.subprocessTerminationSignal = 'SIGKILL'
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
async
|
|
57
|
-
// Make this idempotent
|
|
58
|
-
/* c8 ignore next 3 */
|
|
59
|
-
if (this.url) {
|
|
60
|
-
return this.url
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
await super._start({ listen })
|
|
64
|
-
|
|
55
|
+
async _start () {
|
|
65
56
|
const config = this.config
|
|
66
57
|
const command = config.application.commands[this.isProduction ? 'production' : 'development']
|
|
67
58
|
|
|
68
59
|
if (command) {
|
|
69
60
|
return this.startWithCommand(command)
|
|
70
|
-
} else if (!this.isProduction) {
|
|
71
|
-
return super.start({ listen })
|
|
72
61
|
}
|
|
73
62
|
|
|
74
|
-
|
|
63
|
+
if (typeof this.serverConfig?.port === 'undefined') {
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!this.isProduction) {
|
|
68
|
+
return super._start()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await this.#startProduction()
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
async #startProduction () {
|
|
@@ -81,28 +78,31 @@ export class TanstackCapability extends ViteCapability {
|
|
|
81
78
|
this.#basePath = await this._getBasePathFromBuildInfo()
|
|
82
79
|
|
|
83
80
|
const serverOptions = this.serverConfig
|
|
84
|
-
const serverPromise = createServerListener(
|
|
85
|
-
serverOptions?.port ?? true,
|
|
86
|
-
serverOptions?.hostname ?? true,
|
|
87
|
-
await buildAdditionalServerOptions(serverOptions)
|
|
88
|
-
)
|
|
81
|
+
const serverPromise = createServerListener()
|
|
89
82
|
|
|
90
83
|
const httpsOptions = await sanitizeHTTPSOptions(serverOptions?.https)
|
|
84
|
+
const environment = {
|
|
85
|
+
NITRO_HOST: serverOptions?.hostname ?? '127.0.0.1',
|
|
86
|
+
NITRO_PORT: serverOptions?.port ?? 0,
|
|
87
|
+
NITRO_SSL_CERT: httpsOptions?.cert && this.#serializeCertificateValue(httpsOptions.cert),
|
|
88
|
+
NITRO_SSL_KEY: httpsOptions?.key && this.#serializeCertificateValue(httpsOptions.key)
|
|
89
|
+
}
|
|
90
|
+
const originalEnvironment = new Map()
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const originalKey = process.env.NITRO_SSL_KEY
|
|
92
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
93
|
+
if (typeof value === 'undefined') {
|
|
94
|
+
continue
|
|
95
|
+
}
|
|
97
96
|
|
|
98
|
-
process.env
|
|
99
|
-
process.env
|
|
97
|
+
originalEnvironment.set(key, process.env[key])
|
|
98
|
+
process.env[key] = value.toString()
|
|
99
|
+
}
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.#restoreEnvironmentVariables(
|
|
101
|
+
try {
|
|
102
|
+
await this.#importProductionNitro(outputDirectory)
|
|
103
|
+
} finally {
|
|
104
|
+
for (const [key, value] of originalEnvironment) {
|
|
105
|
+
this.#restoreEnvironmentVariables(key, value)
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -114,9 +114,9 @@ export class TanstackCapability extends ViteCapability {
|
|
|
114
114
|
return this.url
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
async
|
|
117
|
+
async _stop () {
|
|
118
118
|
const hasChildrenManager = !!this.childManager
|
|
119
|
-
await super.
|
|
119
|
+
await super._stop()
|
|
120
120
|
|
|
121
121
|
// ViteCapability.stop already stops child processs
|
|
122
122
|
if (hasChildrenManager || !this.isProduction) {
|
package/lib/factory.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineCapabilityFactory } from '@platformatic/basic'
|
|
2
|
+
import { schema, version } from './schema.js'
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
Vite-derived capabilities flatten the vite block alongside their own; outputDirectory comes
|
|
6
|
+
from the capability's block while application.outputDirectory stays nested, which is why the
|
|
7
|
+
application block is not flattened anywhere.
|
|
8
|
+
*/
|
|
9
|
+
export const tanstack = defineCapabilityFactory('@platformatic/tanstack', schema, {
|
|
10
|
+
version,
|
|
11
|
+
flatten: ['vite']
|
|
12
|
+
})
|
package/lib/schema.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { schemaComponents as basicSchemaComponents } from '@platformatic/basic'
|
|
2
|
-
import { schemaComponents as utilsSchemaComponents } from '@platformatic/foundation'
|
|
3
|
-
import { schemaComponents as viteSchemaComponents } from '@platformatic/vite'
|
|
1
|
+
import { schemaComponents as basicSchemaComponents } from '@platformatic/basic/lib/schema.js'
|
|
2
|
+
import { schemaComponents as utilsSchemaComponents } from '@platformatic/foundation/lib/schema.js'
|
|
3
|
+
import { schemaComponents as viteSchemaComponents } from '@platformatic/vite/lib/schema.js'
|
|
4
4
|
import { readFileSync } from 'node:fs'
|
|
5
5
|
import { resolve } from 'node:path'
|
|
6
6
|
|
|
7
7
|
export const packageJson = JSON.parse(readFileSync(resolve(import.meta.dirname, '../package.json'), 'utf8'))
|
|
8
8
|
export const version = packageJson.version
|
|
9
9
|
|
|
10
|
+
// The port is checked before any startup path is selected, so no port means no start.
|
|
11
|
+
export const servesWithoutPort = { development: false, production: false }
|
|
12
|
+
|
|
10
13
|
export const schemaComponents = {}
|
|
11
14
|
|
|
12
15
|
export const schema = {
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/tanstack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-new-config.1",
|
|
4
4
|
"description": "Platformatic TanStack Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js",
|
|
9
|
+
"./schema": "./schema.js",
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./*": "./*"
|
|
12
|
+
},
|
|
7
13
|
"repository": {
|
|
8
14
|
"type": "git",
|
|
9
15
|
"url": "git+https://github.com/platformatic/platformatic.git"
|
|
@@ -16,10 +22,10 @@
|
|
|
16
22
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
23
|
"dependencies": {
|
|
18
24
|
"semver": "^7.6.3",
|
|
19
|
-
"@platformatic/basic": "
|
|
20
|
-
"@platformatic/foundation": "
|
|
21
|
-
"@platformatic/globals": "
|
|
22
|
-
"@platformatic/vite": "
|
|
25
|
+
"@platformatic/basic": "4.0.0-new-config.1",
|
|
26
|
+
"@platformatic/foundation": "4.0.0-new-config.1",
|
|
27
|
+
"@platformatic/globals": "4.0.0-new-config.1",
|
|
28
|
+
"@platformatic/vite": "4.0.0-new-config.1"
|
|
23
29
|
},
|
|
24
30
|
"devDependencies": {
|
|
25
31
|
"@tanstack/react-router": "^1.139.7",
|
|
@@ -39,8 +45,8 @@
|
|
|
39
45
|
"vite-plugin-solid": "^2.11.10",
|
|
40
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
41
47
|
"ws": "^8.18.0",
|
|
42
|
-
"@platformatic/gateway": "
|
|
43
|
-
"@platformatic/service": "
|
|
48
|
+
"@platformatic/gateway": "4.0.0-new-config.1",
|
|
49
|
+
"@platformatic/service": "4.0.0-new-config.1"
|
|
44
50
|
},
|
|
45
51
|
"engines": {
|
|
46
52
|
"node": ">=22.19.0"
|
package/schema.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The light /schema subpath, part of the v4 capability contract. It carries the schema and the
|
|
2
|
+
// package-level metadata main-side preparation needs, and imports nothing that would pull the
|
|
3
|
+
// capability's implementation in with it — boot resolves this rather than the package entry.
|
|
4
|
+
//
|
|
5
|
+
// Light is a statement about import cost, never about safety: this executes in the main process
|
|
6
|
+
// with full privileges, like any capability code.
|
|
7
|
+
export * from './lib/schema.js'
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/tanstack/
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/tanstack/4.0.0-new-config.1.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic TanStack Config",
|
|
5
5
|
"type": "object",
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
"shared",
|
|
203
203
|
"perWorkerIncrement"
|
|
204
204
|
],
|
|
205
|
-
"description": "Configures how
|
|
205
|
+
"description": "Configures how the port is assigned when the application runs multiple workers. When set to shared (the default), all workers listen on the same port (which requires SO_REUSEPORT support). When set to perWorkerIncrement, each worker listens on its own port, starting from port (worker 0) and incrementing by one for each additional worker."
|
|
206
206
|
},
|
|
207
207
|
"backlog": {
|
|
208
208
|
"type": "integer",
|
|
@@ -536,7 +536,14 @@
|
|
|
536
536
|
"resolvePath": true
|
|
537
537
|
},
|
|
538
538
|
"config": {
|
|
539
|
-
"
|
|
539
|
+
"anyOf": [
|
|
540
|
+
{
|
|
541
|
+
"type": "string"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"type": "object"
|
|
545
|
+
}
|
|
546
|
+
]
|
|
540
547
|
},
|
|
541
548
|
"url": {
|
|
542
549
|
"type": "string"
|
|
@@ -545,12 +552,6 @@
|
|
|
545
552
|
"type": "string",
|
|
546
553
|
"default": "main"
|
|
547
554
|
},
|
|
548
|
-
"useHttp": {
|
|
549
|
-
"type": "boolean"
|
|
550
|
-
},
|
|
551
|
-
"websocket": {
|
|
552
|
-
"type": "boolean"
|
|
553
|
-
},
|
|
554
555
|
"reuseTcpPorts": {
|
|
555
556
|
"type": "boolean",
|
|
556
557
|
"default": true
|
|
@@ -1164,133 +1165,6 @@
|
|
|
1164
1165
|
"default": {},
|
|
1165
1166
|
"additionalProperties": true
|
|
1166
1167
|
},
|
|
1167
|
-
"server": {
|
|
1168
|
-
"type": "object",
|
|
1169
|
-
"properties": {
|
|
1170
|
-
"hostname": {
|
|
1171
|
-
"type": "string"
|
|
1172
|
-
},
|
|
1173
|
-
"port": {
|
|
1174
|
-
"anyOf": [
|
|
1175
|
-
{
|
|
1176
|
-
"type": "integer"
|
|
1177
|
-
},
|
|
1178
|
-
{
|
|
1179
|
-
"type": "string"
|
|
1180
|
-
}
|
|
1181
|
-
]
|
|
1182
|
-
},
|
|
1183
|
-
"portAssignment": {
|
|
1184
|
-
"type": "string",
|
|
1185
|
-
"enum": [
|
|
1186
|
-
"shared",
|
|
1187
|
-
"perWorkerIncrement"
|
|
1188
|
-
],
|
|
1189
|
-
"description": "Configures how entrypoint server worker ports are assigned. When set to shared, all workers listen on the same port. When set to perWorkerIncrement, each worker will use its own port, starting from port (worker 0)."
|
|
1190
|
-
},
|
|
1191
|
-
"backlog": {
|
|
1192
|
-
"type": "integer",
|
|
1193
|
-
"description": "The maximum length of the queue of pending connections"
|
|
1194
|
-
},
|
|
1195
|
-
"http2": {
|
|
1196
|
-
"type": "boolean"
|
|
1197
|
-
},
|
|
1198
|
-
"https": {
|
|
1199
|
-
"type": "object",
|
|
1200
|
-
"properties": {
|
|
1201
|
-
"allowHTTP1": {
|
|
1202
|
-
"type": "boolean"
|
|
1203
|
-
},
|
|
1204
|
-
"key": {
|
|
1205
|
-
"anyOf": [
|
|
1206
|
-
{
|
|
1207
|
-
"type": "string"
|
|
1208
|
-
},
|
|
1209
|
-
{
|
|
1210
|
-
"type": "object",
|
|
1211
|
-
"properties": {
|
|
1212
|
-
"path": {
|
|
1213
|
-
"type": "string",
|
|
1214
|
-
"resolvePath": true
|
|
1215
|
-
}
|
|
1216
|
-
},
|
|
1217
|
-
"additionalProperties": false
|
|
1218
|
-
},
|
|
1219
|
-
{
|
|
1220
|
-
"type": "array",
|
|
1221
|
-
"items": {
|
|
1222
|
-
"anyOf": [
|
|
1223
|
-
{
|
|
1224
|
-
"type": "string"
|
|
1225
|
-
},
|
|
1226
|
-
{
|
|
1227
|
-
"type": "object",
|
|
1228
|
-
"properties": {
|
|
1229
|
-
"path": {
|
|
1230
|
-
"type": "string",
|
|
1231
|
-
"resolvePath": true
|
|
1232
|
-
}
|
|
1233
|
-
},
|
|
1234
|
-
"additionalProperties": false
|
|
1235
|
-
}
|
|
1236
|
-
]
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
]
|
|
1240
|
-
},
|
|
1241
|
-
"cert": {
|
|
1242
|
-
"anyOf": [
|
|
1243
|
-
{
|
|
1244
|
-
"type": "string"
|
|
1245
|
-
},
|
|
1246
|
-
{
|
|
1247
|
-
"type": "object",
|
|
1248
|
-
"properties": {
|
|
1249
|
-
"path": {
|
|
1250
|
-
"type": "string",
|
|
1251
|
-
"resolvePath": true
|
|
1252
|
-
}
|
|
1253
|
-
},
|
|
1254
|
-
"additionalProperties": false
|
|
1255
|
-
},
|
|
1256
|
-
{
|
|
1257
|
-
"type": "array",
|
|
1258
|
-
"items": {
|
|
1259
|
-
"anyOf": [
|
|
1260
|
-
{
|
|
1261
|
-
"type": "string"
|
|
1262
|
-
},
|
|
1263
|
-
{
|
|
1264
|
-
"type": "object",
|
|
1265
|
-
"properties": {
|
|
1266
|
-
"path": {
|
|
1267
|
-
"type": "string",
|
|
1268
|
-
"resolvePath": true
|
|
1269
|
-
}
|
|
1270
|
-
},
|
|
1271
|
-
"additionalProperties": false
|
|
1272
|
-
}
|
|
1273
|
-
]
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
]
|
|
1277
|
-
},
|
|
1278
|
-
"requestCert": {
|
|
1279
|
-
"type": "boolean"
|
|
1280
|
-
},
|
|
1281
|
-
"rejectUnauthorized": {
|
|
1282
|
-
"type": "boolean"
|
|
1283
|
-
}
|
|
1284
|
-
},
|
|
1285
|
-
"additionalProperties": false,
|
|
1286
|
-
"required": [
|
|
1287
|
-
"key",
|
|
1288
|
-
"cert"
|
|
1289
|
-
]
|
|
1290
|
-
}
|
|
1291
|
-
},
|
|
1292
|
-
"additionalProperties": false
|
|
1293
|
-
},
|
|
1294
1168
|
"reuseTcpPorts": {
|
|
1295
1169
|
"type": "boolean",
|
|
1296
1170
|
"default": true
|
package/watt.json
DELETED