Skip to content

Commit 5d5ed6c

Browse files
authored
fix: add engines.runtime to package.json (#5664)
1 parent af8efd4 commit 5d5ed6c

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

src/schemas/json/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,33 @@
336336
"description": "What action to take if validation fails"
337337
}
338338
}
339+
},
340+
"runtimeEngineDependency": {
341+
"description": "Specifies a supported JavaScript runtime.",
342+
"type": "object",
343+
"required": [
344+
"name"
345+
],
346+
"properties": {
347+
"name": {
348+
"type": "string",
349+
"description": "The runtime name"
350+
},
351+
"version": {
352+
"type": "string",
353+
"description": "The version range for the runtime"
354+
},
355+
"onFail": {
356+
"type": "string",
357+
"enum": [
358+
"ignore",
359+
"warn",
360+
"error",
361+
"download"
362+
],
363+
"description": "What action to take if runtime validation fails"
364+
}
365+
}
339366
}
340367
},
341368
"type": "object",
@@ -811,6 +838,20 @@
811838
"properties": {
812839
"node": {
813840
"type": "string"
841+
},
842+
"runtime": {
843+
"oneOf": [
844+
{
845+
"$ref": "#/definitions/runtimeEngineDependency"
846+
},
847+
{
848+
"type": "array",
849+
"items": {
850+
"$ref": "#/definitions/runtimeEngineDependency"
851+
}
852+
}
853+
],
854+
"description": "Specifies which JavaScript runtimes (like Node.js, Deno, Bun) are supported. Values should use WinterCG Runtime Keys (see https://runtime-keys.proposal.wintercg.org/)."
814855
}
815856
},
816857
"additionalProperties": {

src/test/package/pnpm-fields.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"$schema": "../../schemas/json/package.json",
3+
"engines": {
4+
"runtime": [
5+
{
6+
"name": "deno",
7+
"onFail": "warn",
8+
"version": "^2.0.0"
9+
},
10+
{
11+
"name": "node",
12+
"onFail": "download",
13+
"version": ">=24"
14+
}
15+
]
16+
},
317
"name": "pnpm-fields",
418
"pnpm": {
519
"allowNonAppliedPatches": true,

0 commit comments

Comments
 (0)