@platformatic/tanstack 3.71.1-alpha.0 → 4.0.0-alpha.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 +764 -830
- package/index.d.ts +8 -1
- package/index.js +9 -9
- package/lib/capability.js +32 -32
- package/lib/factory.js +12 -0
- package/lib/schema.js +6 -3
- package/package.json +15 -9
- package/schema.js +7 -0
- package/schema.json +180 -390
- package/watt.json +0 -3
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 { JSONSchemaType } from 'ajv'
|
|
4
4
|
import type { PlatformaticTanStackConfig } from './config.d.ts'
|
|
@@ -33,3 +33,10 @@ export declare const schema: JSONSchemaType<PlatformaticTanStackConfig>
|
|
|
33
33
|
export declare const schemaComponents: {}
|
|
34
34
|
export declare const version: string
|
|
35
35
|
export declare const supportedVersions: string
|
|
36
|
+
|
|
37
|
+
export type TanstackConfigOptions = CapabilityFactoryOptions<PlatformaticTanStackConfig, 'vite', never>
|
|
38
|
+
|
|
39
|
+
export declare function createTanstackConfig (options?: TanstackConfigOptions): ApplicationDefinition
|
|
40
|
+
export declare function createTanstackConfig (
|
|
41
|
+
callback: (context: ConfigContext) => TanstackConfigOptions | Promise<TanstackConfigOptions>
|
|
42
|
+
): DeferredApplicationDefinition
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { kMetadata
|
|
1
|
+
import { loadCapabilityConfiguration, validationOptions } from '@platformatic/basic'
|
|
2
|
+
import { kMetadata } from '@platformatic/foundation'
|
|
3
3
|
import { TanstackCapability } from './lib/capability.js'
|
|
4
4
|
import { schema } from './lib/schema.js'
|
|
5
5
|
|
|
@@ -11,14 +11,12 @@ import { schema } from './lib/schema.js'
|
|
|
11
11
|
// }
|
|
12
12
|
|
|
13
13
|
export async function loadConfiguration (configOrRoot, sourceOrConfig, context) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return loadCapabilityConfiguration(configOrRoot, sourceOrConfig, context, {
|
|
15
|
+
schema,
|
|
16
|
+
scope: import.meta.filename,
|
|
17
|
+
suffixes: 'application',
|
|
17
18
|
validationOptions,
|
|
18
|
-
// transform
|
|
19
|
-
replaceEnv: true,
|
|
20
|
-
root,
|
|
21
|
-
...context
|
|
19
|
+
// transform
|
|
22
20
|
})
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -29,3 +27,5 @@ export async function create (configOrRoot, sourceOrConfig, context) {
|
|
|
29
27
|
|
|
30
28
|
export * from './lib/capability.js'
|
|
31
29
|
export { packageJson, schema, schemaComponents, version } from './lib/schema.js'
|
|
30
|
+
|
|
31
|
+
export * from './lib/factory.js'
|
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 createTanstackConfig = 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/schema'
|
|
2
|
+
import { schemaComponents as utilsSchemaComponents } from '@platformatic/foundation/schema'
|
|
3
|
+
import { schemaComponents as viteSchemaComponents } from '@platformatic/vite/schema'
|
|
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-alpha.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/
|
|
20
|
-
"@platformatic/foundation": "
|
|
21
|
-
"@platformatic/
|
|
22
|
-
"@platformatic/vite": "
|
|
25
|
+
"@platformatic/basic": "4.0.0-alpha.1",
|
|
26
|
+
"@platformatic/foundation": "4.0.0-alpha.1",
|
|
27
|
+
"@platformatic/globals": "4.0.0-alpha.1",
|
|
28
|
+
"@platformatic/vite": "4.0.0-alpha.1"
|
|
23
29
|
},
|
|
24
30
|
"devDependencies": {
|
|
25
31
|
"@tanstack/react-router": "^1.139.7",
|
|
@@ -35,15 +41,15 @@
|
|
|
35
41
|
"react-dom": "^19.1.0",
|
|
36
42
|
"tstyche": "^7.0.0",
|
|
37
43
|
"typescript": "~6.0.3",
|
|
38
|
-
"vite": "^
|
|
44
|
+
"vite": "^7.2.4",
|
|
39
45
|
"vite-plugin-solid": "^2.11.10",
|
|
40
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
41
47
|
"ws": "^8.18.0",
|
|
42
|
-
"@platformatic/
|
|
43
|
-
"@platformatic/
|
|
48
|
+
"@platformatic/service": "4.0.0-alpha.1",
|
|
49
|
+
"@platformatic/gateway": "4.0.0-alpha.1"
|
|
44
50
|
},
|
|
45
51
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
52
|
+
"node": ">=24.20.0"
|
|
47
53
|
},
|
|
48
54
|
"scripts": {
|
|
49
55
|
"test": "npm run test:types && node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
|
package/schema.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The light /schema subpath, part of the 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'
|