@platformatic/vite 3.25.0 → 3.27.0
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 +56 -0
- package/lib/capability.js +26 -10
- package/package.json +6 -6
- package/schema.json +259 -1
package/config.d.ts
CHANGED
|
@@ -525,6 +525,62 @@ export interface PlatformaticViteConfig {
|
|
|
525
525
|
[k: string]: string | [string, ...string[]];
|
|
526
526
|
};
|
|
527
527
|
};
|
|
528
|
+
application?: {
|
|
529
|
+
reuseTcpPorts?: boolean;
|
|
530
|
+
workers?:
|
|
531
|
+
| number
|
|
532
|
+
| string
|
|
533
|
+
| {
|
|
534
|
+
static?: number;
|
|
535
|
+
minimum?: number;
|
|
536
|
+
maximum?: number;
|
|
537
|
+
[k: string]: unknown;
|
|
538
|
+
};
|
|
539
|
+
health?: {
|
|
540
|
+
enabled?: boolean | string;
|
|
541
|
+
interval?: number | string;
|
|
542
|
+
gracePeriod?: number | string;
|
|
543
|
+
maxUnhealthyChecks?: number | string;
|
|
544
|
+
maxELU?: number | string;
|
|
545
|
+
maxHeapUsed?: number | string;
|
|
546
|
+
maxHeapTotal?: number | string;
|
|
547
|
+
maxYoungGeneration?: number | string;
|
|
548
|
+
codeRangeSize?: number | string;
|
|
549
|
+
};
|
|
550
|
+
arguments?: string[];
|
|
551
|
+
env?: {
|
|
552
|
+
[k: string]: string;
|
|
553
|
+
};
|
|
554
|
+
envfile?: string;
|
|
555
|
+
sourceMaps?: boolean;
|
|
556
|
+
packageManager?: "npm" | "pnpm" | "yarn";
|
|
557
|
+
preload?: string | string[];
|
|
558
|
+
nodeOptions?: string;
|
|
559
|
+
execArgv?: string[];
|
|
560
|
+
permissions?: {
|
|
561
|
+
fs?: {
|
|
562
|
+
read?: string[];
|
|
563
|
+
write?: string[];
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
telemetry?: {
|
|
567
|
+
/**
|
|
568
|
+
* An array of instrumentations loaded if telemetry is enabled
|
|
569
|
+
*/
|
|
570
|
+
instrumentations?: (
|
|
571
|
+
| string
|
|
572
|
+
| {
|
|
573
|
+
package: string;
|
|
574
|
+
exportName?: string;
|
|
575
|
+
options?: {
|
|
576
|
+
[k: string]: unknown;
|
|
577
|
+
};
|
|
578
|
+
[k: string]: unknown;
|
|
579
|
+
}
|
|
580
|
+
)[];
|
|
581
|
+
[k: string]: unknown;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
528
584
|
};
|
|
529
585
|
vite?: {
|
|
530
586
|
configFile?: string | boolean;
|
package/lib/capability.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
ensureTrailingSlash,
|
|
7
7
|
errors,
|
|
8
8
|
getServerUrl,
|
|
9
|
-
importFile
|
|
10
|
-
resolvePackage
|
|
9
|
+
importFile
|
|
11
10
|
} from '@platformatic/basic'
|
|
11
|
+
import { resolvePackageViaCJS } from '@platformatic/basic/lib/utils.js'
|
|
12
12
|
import { ensureLoggableError } from '@platformatic/foundation'
|
|
13
13
|
import { NodeCapability } from '@platformatic/node'
|
|
14
14
|
import fastify from 'fastify'
|
|
@@ -38,7 +38,7 @@ export class ViteCapability extends BaseCapability {
|
|
|
38
38
|
return
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
this.#vite = dirname(
|
|
41
|
+
this.#vite = dirname(await resolvePackageViaCJS(this.root, 'vite'))
|
|
42
42
|
|
|
43
43
|
// In Vite 6, module resolving changed, adjust it
|
|
44
44
|
if (!existsSync(resolve(this.#vite, 'dist/node/index.js'))) {
|
|
@@ -95,12 +95,12 @@ export class ViteCapability extends BaseCapability {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
await this.init()
|
|
98
|
-
const { build } = await importFile(resolve(this.#vite, 'dist/node/index.js'))
|
|
98
|
+
const { build, createBuilder } = await importFile(resolve(this.#vite, 'dist/node/index.js'))
|
|
99
99
|
|
|
100
100
|
try {
|
|
101
101
|
globalThis.platformatic.isBuilding = true
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
const buildOptions = {
|
|
104
104
|
root: this.root,
|
|
105
105
|
base: basePath,
|
|
106
106
|
mode: 'production',
|
|
@@ -118,7 +118,15 @@ export class ViteCapability extends BaseCapability {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
]
|
|
121
|
-
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// createBuilder was added in Vite 6 and might be needed for multi environment frameworks like TanStack
|
|
124
|
+
if (createBuilder) {
|
|
125
|
+
const builder = await createBuilder(buildOptions, null)
|
|
126
|
+
await builder.buildApp()
|
|
127
|
+
} else {
|
|
128
|
+
await build(buildOptions)
|
|
129
|
+
}
|
|
122
130
|
} finally {
|
|
123
131
|
globalThis.platformatic.isBuilding = false
|
|
124
132
|
}
|
|
@@ -361,19 +369,19 @@ export class ViteSSRCapability extends NodeCapability {
|
|
|
361
369
|
|
|
362
370
|
await this.init()
|
|
363
371
|
|
|
364
|
-
let vite = dirname(
|
|
372
|
+
let vite = dirname(await resolvePackageViaCJS(this.root, 'vite'))
|
|
365
373
|
// In Vite 6, module resolving changed, adjust it
|
|
366
374
|
if (!existsSync(resolve(vite, 'dist/node/index.js'))) {
|
|
367
375
|
vite = resolve(vite, '../..')
|
|
368
376
|
}
|
|
369
377
|
|
|
370
|
-
const { build } = await importFile(resolve(vite, 'dist/node/index.js'))
|
|
378
|
+
const { build, createBuilder } = await importFile(resolve(vite, 'dist/node/index.js'))
|
|
371
379
|
|
|
372
380
|
// Build the client
|
|
373
381
|
try {
|
|
374
382
|
globalThis.platformatic.isBuilding = true
|
|
375
383
|
|
|
376
|
-
|
|
384
|
+
const buildOptions = {
|
|
377
385
|
root: resolve(this.root, clientDirectory),
|
|
378
386
|
base: basePath,
|
|
379
387
|
mode: 'production',
|
|
@@ -392,7 +400,15 @@ export class ViteSSRCapability extends NodeCapability {
|
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
402
|
]
|
|
395
|
-
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// createBuilder was added in Vite 6 and might be needed for multi environment frameworks like TanStack
|
|
406
|
+
if (createBuilder) {
|
|
407
|
+
const builder = await createBuilder(buildOptions, null)
|
|
408
|
+
await builder.buildApp()
|
|
409
|
+
} else {
|
|
410
|
+
await build(buildOptions)
|
|
411
|
+
}
|
|
396
412
|
} finally {
|
|
397
413
|
globalThis.platformatic.isBuilding = false
|
|
398
414
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/vite",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0",
|
|
4
4
|
"description": "Platformatic Vite Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"@fastify/static": "^8.0.0",
|
|
19
19
|
"fastify": "^5.0.0",
|
|
20
20
|
"semver": "^7.6.3",
|
|
21
|
-
"@platformatic/basic": "3.
|
|
22
|
-
"@platformatic/
|
|
23
|
-
"@platformatic/
|
|
21
|
+
"@platformatic/basic": "3.27.0",
|
|
22
|
+
"@platformatic/foundation": "3.27.0",
|
|
23
|
+
"@platformatic/node": "3.27.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"typescript": "^5.5.4",
|
|
33
33
|
"vite": "^7.1.4",
|
|
34
34
|
"ws": "^8.18.0",
|
|
35
|
-
"@platformatic/gateway": "3.
|
|
36
|
-
"@platformatic/service": "3.
|
|
35
|
+
"@platformatic/gateway": "3.27.0",
|
|
36
|
+
"@platformatic/service": "3.27.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/vite/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/vite/3.27.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Vite Config",
|
|
5
5
|
"type": "object",
|
|
@@ -619,6 +619,12 @@
|
|
|
619
619
|
"nodeOptions": {
|
|
620
620
|
"type": "string"
|
|
621
621
|
},
|
|
622
|
+
"execArgv": {
|
|
623
|
+
"type": "array",
|
|
624
|
+
"items": {
|
|
625
|
+
"type": "string"
|
|
626
|
+
}
|
|
627
|
+
},
|
|
622
628
|
"permissions": {
|
|
623
629
|
"type": "object",
|
|
624
630
|
"properties": {
|
|
@@ -1926,6 +1932,258 @@
|
|
|
1926
1932
|
"deny"
|
|
1927
1933
|
],
|
|
1928
1934
|
"additionalProperties": false
|
|
1935
|
+
},
|
|
1936
|
+
"application": {
|
|
1937
|
+
"type": "object",
|
|
1938
|
+
"properties": {
|
|
1939
|
+
"reuseTcpPorts": {
|
|
1940
|
+
"type": "boolean",
|
|
1941
|
+
"default": true
|
|
1942
|
+
},
|
|
1943
|
+
"workers": {
|
|
1944
|
+
"anyOf": [
|
|
1945
|
+
{
|
|
1946
|
+
"type": "number"
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"type": "string"
|
|
1950
|
+
},
|
|
1951
|
+
{
|
|
1952
|
+
"type": "object",
|
|
1953
|
+
"properties": {
|
|
1954
|
+
"static": {
|
|
1955
|
+
"type": "number",
|
|
1956
|
+
"minimum": 1
|
|
1957
|
+
},
|
|
1958
|
+
"minimum": {
|
|
1959
|
+
"type": "number",
|
|
1960
|
+
"minimum": 1
|
|
1961
|
+
},
|
|
1962
|
+
"maximum": {
|
|
1963
|
+
"type": "number",
|
|
1964
|
+
"minimum": 0
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
]
|
|
1969
|
+
},
|
|
1970
|
+
"health": {
|
|
1971
|
+
"type": "object",
|
|
1972
|
+
"default": {},
|
|
1973
|
+
"properties": {
|
|
1974
|
+
"enabled": {
|
|
1975
|
+
"anyOf": [
|
|
1976
|
+
{
|
|
1977
|
+
"type": "boolean"
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
"type": "string"
|
|
1981
|
+
}
|
|
1982
|
+
]
|
|
1983
|
+
},
|
|
1984
|
+
"interval": {
|
|
1985
|
+
"anyOf": [
|
|
1986
|
+
{
|
|
1987
|
+
"type": "number",
|
|
1988
|
+
"minimum": 0
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"type": "string"
|
|
1992
|
+
}
|
|
1993
|
+
]
|
|
1994
|
+
},
|
|
1995
|
+
"gracePeriod": {
|
|
1996
|
+
"anyOf": [
|
|
1997
|
+
{
|
|
1998
|
+
"type": "number",
|
|
1999
|
+
"minimum": 0
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
"type": "string"
|
|
2003
|
+
}
|
|
2004
|
+
]
|
|
2005
|
+
},
|
|
2006
|
+
"maxUnhealthyChecks": {
|
|
2007
|
+
"anyOf": [
|
|
2008
|
+
{
|
|
2009
|
+
"type": "number",
|
|
2010
|
+
"minimum": 1
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
"type": "string"
|
|
2014
|
+
}
|
|
2015
|
+
]
|
|
2016
|
+
},
|
|
2017
|
+
"maxELU": {
|
|
2018
|
+
"anyOf": [
|
|
2019
|
+
{
|
|
2020
|
+
"type": "number",
|
|
2021
|
+
"minimum": 0,
|
|
2022
|
+
"maximum": 1
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
"type": "string"
|
|
2026
|
+
}
|
|
2027
|
+
]
|
|
2028
|
+
},
|
|
2029
|
+
"maxHeapUsed": {
|
|
2030
|
+
"anyOf": [
|
|
2031
|
+
{
|
|
2032
|
+
"type": "number",
|
|
2033
|
+
"minimum": 0,
|
|
2034
|
+
"maximum": 1
|
|
2035
|
+
},
|
|
2036
|
+
{
|
|
2037
|
+
"type": "string"
|
|
2038
|
+
}
|
|
2039
|
+
]
|
|
2040
|
+
},
|
|
2041
|
+
"maxHeapTotal": {
|
|
2042
|
+
"anyOf": [
|
|
2043
|
+
{
|
|
2044
|
+
"type": "number",
|
|
2045
|
+
"minimum": 0
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
"type": "string"
|
|
2049
|
+
}
|
|
2050
|
+
]
|
|
2051
|
+
},
|
|
2052
|
+
"maxYoungGeneration": {
|
|
2053
|
+
"anyOf": [
|
|
2054
|
+
{
|
|
2055
|
+
"type": "number",
|
|
2056
|
+
"minimum": 0
|
|
2057
|
+
},
|
|
2058
|
+
{
|
|
2059
|
+
"type": "string"
|
|
2060
|
+
}
|
|
2061
|
+
]
|
|
2062
|
+
},
|
|
2063
|
+
"codeRangeSize": {
|
|
2064
|
+
"anyOf": [
|
|
2065
|
+
{
|
|
2066
|
+
"type": "number",
|
|
2067
|
+
"minimum": 0
|
|
2068
|
+
},
|
|
2069
|
+
{
|
|
2070
|
+
"type": "string"
|
|
2071
|
+
}
|
|
2072
|
+
]
|
|
2073
|
+
}
|
|
2074
|
+
},
|
|
2075
|
+
"additionalProperties": false
|
|
2076
|
+
},
|
|
2077
|
+
"arguments": {
|
|
2078
|
+
"type": "array",
|
|
2079
|
+
"items": {
|
|
2080
|
+
"type": "string"
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
"env": {
|
|
2084
|
+
"type": "object",
|
|
2085
|
+
"additionalProperties": {
|
|
2086
|
+
"type": "string"
|
|
2087
|
+
}
|
|
2088
|
+
},
|
|
2089
|
+
"envfile": {
|
|
2090
|
+
"type": "string"
|
|
2091
|
+
},
|
|
2092
|
+
"sourceMaps": {
|
|
2093
|
+
"type": "boolean"
|
|
2094
|
+
},
|
|
2095
|
+
"packageManager": {
|
|
2096
|
+
"type": "string",
|
|
2097
|
+
"enum": [
|
|
2098
|
+
"npm",
|
|
2099
|
+
"pnpm",
|
|
2100
|
+
"yarn"
|
|
2101
|
+
]
|
|
2102
|
+
},
|
|
2103
|
+
"preload": {
|
|
2104
|
+
"anyOf": [
|
|
2105
|
+
{
|
|
2106
|
+
"type": "string",
|
|
2107
|
+
"resolvePath": true
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
"type": "array",
|
|
2111
|
+
"items": {
|
|
2112
|
+
"type": "string",
|
|
2113
|
+
"resolvePath": true
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
]
|
|
2117
|
+
},
|
|
2118
|
+
"nodeOptions": {
|
|
2119
|
+
"type": "string"
|
|
2120
|
+
},
|
|
2121
|
+
"execArgv": {
|
|
2122
|
+
"type": "array",
|
|
2123
|
+
"items": {
|
|
2124
|
+
"type": "string"
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2127
|
+
"permissions": {
|
|
2128
|
+
"type": "object",
|
|
2129
|
+
"properties": {
|
|
2130
|
+
"fs": {
|
|
2131
|
+
"type": "object",
|
|
2132
|
+
"properties": {
|
|
2133
|
+
"read": {
|
|
2134
|
+
"type": "array",
|
|
2135
|
+
"items": {
|
|
2136
|
+
"type": "string"
|
|
2137
|
+
}
|
|
2138
|
+
},
|
|
2139
|
+
"write": {
|
|
2140
|
+
"type": "array",
|
|
2141
|
+
"items": {
|
|
2142
|
+
"type": "string"
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
},
|
|
2146
|
+
"additionalProperties": false
|
|
2147
|
+
}
|
|
2148
|
+
},
|
|
2149
|
+
"additionalProperties": false
|
|
2150
|
+
},
|
|
2151
|
+
"telemetry": {
|
|
2152
|
+
"type": "object",
|
|
2153
|
+
"properties": {
|
|
2154
|
+
"instrumentations": {
|
|
2155
|
+
"type": "array",
|
|
2156
|
+
"description": "An array of instrumentations loaded if telemetry is enabled",
|
|
2157
|
+
"items": {
|
|
2158
|
+
"oneOf": [
|
|
2159
|
+
{
|
|
2160
|
+
"type": "string"
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
"type": "object",
|
|
2164
|
+
"properties": {
|
|
2165
|
+
"package": {
|
|
2166
|
+
"type": "string"
|
|
2167
|
+
},
|
|
2168
|
+
"exportName": {
|
|
2169
|
+
"type": "string"
|
|
2170
|
+
},
|
|
2171
|
+
"options": {
|
|
2172
|
+
"type": "object",
|
|
2173
|
+
"additionalProperties": true
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
"required": [
|
|
2177
|
+
"package"
|
|
2178
|
+
]
|
|
2179
|
+
}
|
|
2180
|
+
]
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
},
|
|
2186
|
+
"additionalProperties": false
|
|
1929
2187
|
}
|
|
1930
2188
|
},
|
|
1931
2189
|
"additionalProperties": false
|