@platformatic/vite 3.19.0 → 3.21.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 +10 -0
- package/index.js +23 -0
- package/lib/capability.js +8 -0
- package/lib/schema.js +18 -1
- package/package.json +6 -6
- package/schema.json +62 -6
package/config.d.ts
CHANGED
|
@@ -231,6 +231,7 @@ export interface PlatformaticViteConfig {
|
|
|
231
231
|
maxHeapUsed?: number | string;
|
|
232
232
|
maxHeapTotal?: number | string;
|
|
233
233
|
maxYoungGeneration?: number | string;
|
|
234
|
+
codeRangeSize?: number | string;
|
|
234
235
|
};
|
|
235
236
|
undici?: {
|
|
236
237
|
agentOptions?: {
|
|
@@ -530,5 +531,14 @@ export interface PlatformaticViteConfig {
|
|
|
530
531
|
serverDirectory?: string;
|
|
531
532
|
}
|
|
532
533
|
| boolean;
|
|
534
|
+
notFoundHandler?:
|
|
535
|
+
| boolean
|
|
536
|
+
| string
|
|
537
|
+
| {
|
|
538
|
+
enabled?: boolean;
|
|
539
|
+
path?: string;
|
|
540
|
+
contentType?: string;
|
|
541
|
+
statusCode?: number;
|
|
542
|
+
};
|
|
533
543
|
};
|
|
534
544
|
}
|
package/index.js
CHANGED
|
@@ -18,6 +18,29 @@ export async function transform (config, schema, options) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
if (typeof config.vite.notFoundHandler !== 'undefined') {
|
|
22
|
+
let enabled = false
|
|
23
|
+
let path = 'index.html'
|
|
24
|
+
let statusCode = 200
|
|
25
|
+
let contentType = 'text/html; charset=utf-8'
|
|
26
|
+
|
|
27
|
+
if (typeof config.vite.notFoundHandler === 'boolean') {
|
|
28
|
+
enabled = config.vite.notFoundHandler
|
|
29
|
+
} else if (typeof config.vite.notFoundHandler === 'string') {
|
|
30
|
+
enabled = true
|
|
31
|
+
path = config.vite.notFoundHandler
|
|
32
|
+
} else {
|
|
33
|
+
enabled = config.vite.notFoundHandler.enabled ?? false
|
|
34
|
+
path = config.vite.notFoundHandler.path ?? path
|
|
35
|
+
statusCode = config.vite.notFoundHandler.statusCode ?? statusCode
|
|
36
|
+
contentType = config.vite.notFoundHandler.contentType ?? contentType
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
config.vite.notFoundHandler = { enabled, path, statusCode, contentType }
|
|
40
|
+
} else {
|
|
41
|
+
config.vite.notFoundHandler = { enabled: false }
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
return config
|
|
22
45
|
}
|
|
23
46
|
|
package/lib/capability.js
CHANGED
|
@@ -265,6 +265,14 @@ export class ViteCapability extends BaseCapability {
|
|
|
265
265
|
schemaHide: true
|
|
266
266
|
})
|
|
267
267
|
|
|
268
|
+
if (config.vite.notFoundHandler?.enabled) {
|
|
269
|
+
const { statusCode, contentType, path } = config.vite.notFoundHandler
|
|
270
|
+
|
|
271
|
+
this.#app.setNotFoundHandler((_, reply) => {
|
|
272
|
+
return reply.code(statusCode).type(contentType).sendFile(path, { contentType: false })
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
268
276
|
await this.#app.ready()
|
|
269
277
|
}
|
|
270
278
|
}
|
package/lib/schema.js
CHANGED
|
@@ -26,7 +26,7 @@ const vite = {
|
|
|
26
26
|
default: {}
|
|
27
27
|
},
|
|
28
28
|
ssr: {
|
|
29
|
-
|
|
29
|
+
anyOf: [
|
|
30
30
|
{
|
|
31
31
|
type: 'object',
|
|
32
32
|
properties: {
|
|
@@ -41,6 +41,23 @@ const vite = {
|
|
|
41
41
|
{ type: 'boolean' }
|
|
42
42
|
],
|
|
43
43
|
default: false
|
|
44
|
+
},
|
|
45
|
+
notFoundHandler: {
|
|
46
|
+
anyOf: [
|
|
47
|
+
{ type: 'boolean' },
|
|
48
|
+
{ type: 'string' },
|
|
49
|
+
{
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
enabled: { type: 'boolean' },
|
|
53
|
+
path: { type: 'string', default: 'index.html' },
|
|
54
|
+
contentType: { type: 'string', default: 'text/html; charset=utf-8' },
|
|
55
|
+
statusCode: { type: 'number', default: 200 }
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
default: false
|
|
44
61
|
}
|
|
45
62
|
},
|
|
46
63
|
default: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/vite",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.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/foundation": "3.
|
|
23
|
-
"@platformatic/node": "3.
|
|
21
|
+
"@platformatic/basic": "3.21.0",
|
|
22
|
+
"@platformatic/foundation": "3.21.0",
|
|
23
|
+
"@platformatic/node": "3.21.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/
|
|
36
|
-
"@platformatic/
|
|
35
|
+
"@platformatic/service": "3.21.0",
|
|
36
|
+
"@platformatic/gateway": "3.21.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.21.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Vite Config",
|
|
5
5
|
"type": "object",
|
|
@@ -549,6 +549,17 @@
|
|
|
549
549
|
"type": "string"
|
|
550
550
|
}
|
|
551
551
|
]
|
|
552
|
+
},
|
|
553
|
+
"codeRangeSize": {
|
|
554
|
+
"anyOf": [
|
|
555
|
+
{
|
|
556
|
+
"type": "number",
|
|
557
|
+
"minimum": 0
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"type": "string"
|
|
561
|
+
}
|
|
562
|
+
]
|
|
552
563
|
}
|
|
553
564
|
},
|
|
554
565
|
"additionalProperties": false
|
|
@@ -576,8 +587,7 @@
|
|
|
576
587
|
"type": "string"
|
|
577
588
|
},
|
|
578
589
|
"sourceMaps": {
|
|
579
|
-
"type": "boolean"
|
|
580
|
-
"default": false
|
|
590
|
+
"type": "boolean"
|
|
581
591
|
},
|
|
582
592
|
"packageManager": {
|
|
583
593
|
"type": "string",
|
|
@@ -1142,7 +1152,8 @@
|
|
|
1142
1152
|
{
|
|
1143
1153
|
"type": "string"
|
|
1144
1154
|
}
|
|
1145
|
-
]
|
|
1155
|
+
],
|
|
1156
|
+
"default": 4294967296
|
|
1146
1157
|
},
|
|
1147
1158
|
"maxYoungGeneration": {
|
|
1148
1159
|
"anyOf": [
|
|
@@ -1153,7 +1164,20 @@
|
|
|
1153
1164
|
{
|
|
1154
1165
|
"type": "string"
|
|
1155
1166
|
}
|
|
1156
|
-
]
|
|
1167
|
+
],
|
|
1168
|
+
"default": 134217728
|
|
1169
|
+
},
|
|
1170
|
+
"codeRangeSize": {
|
|
1171
|
+
"anyOf": [
|
|
1172
|
+
{
|
|
1173
|
+
"type": "number",
|
|
1174
|
+
"minimum": 0
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
"type": "string"
|
|
1178
|
+
}
|
|
1179
|
+
],
|
|
1180
|
+
"default": 268435456
|
|
1157
1181
|
}
|
|
1158
1182
|
},
|
|
1159
1183
|
"additionalProperties": false
|
|
@@ -1923,7 +1947,7 @@
|
|
|
1923
1947
|
"default": {}
|
|
1924
1948
|
},
|
|
1925
1949
|
"ssr": {
|
|
1926
|
-
"
|
|
1950
|
+
"anyOf": [
|
|
1927
1951
|
{
|
|
1928
1952
|
"type": "object",
|
|
1929
1953
|
"properties": {
|
|
@@ -1953,6 +1977,38 @@
|
|
|
1953
1977
|
}
|
|
1954
1978
|
],
|
|
1955
1979
|
"default": false
|
|
1980
|
+
},
|
|
1981
|
+
"notFoundHandler": {
|
|
1982
|
+
"anyOf": [
|
|
1983
|
+
{
|
|
1984
|
+
"type": "boolean"
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
"type": "string"
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
"type": "object",
|
|
1991
|
+
"properties": {
|
|
1992
|
+
"enabled": {
|
|
1993
|
+
"type": "boolean"
|
|
1994
|
+
},
|
|
1995
|
+
"path": {
|
|
1996
|
+
"type": "string",
|
|
1997
|
+
"default": "index.html"
|
|
1998
|
+
},
|
|
1999
|
+
"contentType": {
|
|
2000
|
+
"type": "string",
|
|
2001
|
+
"default": "text/html; charset=utf-8"
|
|
2002
|
+
},
|
|
2003
|
+
"statusCode": {
|
|
2004
|
+
"type": "number",
|
|
2005
|
+
"default": 200
|
|
2006
|
+
}
|
|
2007
|
+
},
|
|
2008
|
+
"additionalProperties": false
|
|
2009
|
+
}
|
|
2010
|
+
],
|
|
2011
|
+
"default": false
|
|
1956
2012
|
}
|
|
1957
2013
|
},
|
|
1958
2014
|
"default": {},
|