@simbo/platform-check 0.0.0-stage → 1.0.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/CHANGELOG.md +38 -0
- package/LICENSE.md +20 -0
- package/README.md +157 -2
- package/dist/compare-targets.d.ts +11 -0
- package/dist/compare-targets.js +66 -0
- package/dist/compare-targets.js.map +1 -0
- package/dist/compat-data.d.ts +19 -0
- package/dist/compat-data.js +109 -0
- package/dist/compat-data.js.map +1 -0
- package/dist/data-packages.d.ts +50 -0
- package/dist/data-packages.js +214 -0
- package/dist/data-packages.js.map +1 -0
- package/dist/es-mapping.d.ts +26 -0
- package/dist/es-mapping.js +143 -0
- package/dist/es-mapping.js.map +1 -0
- package/dist/expected-targets.d.ts +48 -0
- package/dist/expected-targets.js +93 -0
- package/dist/expected-targets.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.types.d.ts +54 -0
- package/dist/internal.types.js +2 -0
- package/dist/internal.types.js.map +1 -0
- package/dist/node-checks.d.ts +34 -0
- package/dist/node-checks.js +96 -0
- package/dist/node-checks.js.map +1 -0
- package/dist/node-schedule.d.ts +39 -0
- package/dist/node-schedule.js +61 -0
- package/dist/node-schedule.js.map +1 -0
- package/dist/options-schema.d.ts +63 -0
- package/dist/options-schema.js +55 -0
- package/dist/options-schema.js.map +1 -0
- package/dist/platform-check.d.ts +25 -0
- package/dist/platform-check.js +334 -0
- package/dist/platform-check.js.map +1 -0
- package/dist/platform-check.types.d.ts +419 -0
- package/dist/platform-check.types.js +2 -0
- package/dist/platform-check.types.js.map +1 -0
- package/dist/typescript-libs.d.ts +50 -0
- package/dist/typescript-libs.js +186 -0
- package/dist/typescript-libs.js.map +1 -0
- package/package.json +78 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @simbo/platform-check
|
|
2
|
+
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6b70f11: Publish from CI with npm trusted publishing.
|
|
8
|
+
|
|
9
|
+
- This release is the first one published by the release workflow, with
|
|
10
|
+
provenance, instead of by hand; the package itself is unchanged.
|
|
11
|
+
|
|
12
|
+
## 1.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- 429be5e: Add package `@simbo/platform-check` to check whether the Node.js and
|
|
17
|
+
ECMAScript platform targets of a repository are still current.
|
|
18
|
+
|
|
19
|
+
- Checks `engines.node` of the root and all workspaces, private ones included,
|
|
20
|
+
against the release lines that Node.js maintains, `@types/node` against the
|
|
21
|
+
lowest of them, and `.nvmrc` against the Active LTS line, using the Node.js
|
|
22
|
+
release schedule.
|
|
23
|
+
- Derives the TypeScript sub-libs, `target` and `resolveJsonModule` that the
|
|
24
|
+
lowest supported Node.js version (MDN browser-compat-data) and browsers that
|
|
25
|
+
are Baseline Widely Available on the date of the check (web-features)
|
|
26
|
+
support, with `universal` requiring both.
|
|
27
|
+
- Compares them with shared presets in both directions and with the
|
|
28
|
+
configurations of every workspace, following project references, for
|
|
29
|
+
settings that are ahead of its environment.
|
|
30
|
+
- Accepts release lines that are dropped early and libs that a workspace
|
|
31
|
+
provides beyond its environment, each with a reason, and reports such
|
|
32
|
+
entries once they no longer apply.
|
|
33
|
+
- Reports sub-libs and targets of the installed TypeScript that its mapping
|
|
34
|
+
does not cover, keys of the mapping that the data does not know, and data
|
|
35
|
+
packages, its own and those of Browserslist, that are older than 60 days
|
|
36
|
+
while a newer version exists within or outside the range of their dependent.
|
|
37
|
+
- Tells for each finding whether to raise, lower, add, remove or update a
|
|
38
|
+
setting.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2026 Simon Lepel <simbo@simbo.de> (https://simbo.de)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,158 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Platform Check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
📦
|
|
4
|
+
[**`@simbo/platform-check`**](https://npmjs.com/package/@simbo/platform-check)
|
|
5
|
+
|
|
6
|
+
A utility library that checks whether a repository's **Node.js and ECMAScript
|
|
7
|
+
platform targets are still current**: `engines`, `@types/node` and `.nvmrc`
|
|
8
|
+
against the Node.js release schedule, and `lib`, `target` and
|
|
9
|
+
`resolveJsonModule` of TypeScript configurations against what the supported
|
|
10
|
+
environments provide.
|
|
11
|
+
|
|
12
|
+
See
|
|
13
|
+
[@simbo/platform-check-cli](https://npmjs.com/package/@simbo/platform-check-cli)
|
|
14
|
+
for the corresponding CLI.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Follows the release lines that Node.js maintains, from the
|
|
19
|
+
[Node.js release schedule](https://github.com/nodejs/Release)
|
|
20
|
+
|
|
21
|
+
- Derives the TypeScript sub-libs, the `target` and JSON module support of
|
|
22
|
+
Node.js from
|
|
23
|
+
[MDN browser-compat-data](https://github.com/mdn/browser-compat-data) and of
|
|
24
|
+
browsers from [web-features](https://github.com/web-platform-dx/web-features)
|
|
25
|
+
(Baseline Widely Available)
|
|
26
|
+
|
|
27
|
+
- Checks shared TypeScript presets and the configurations of every workspace,
|
|
28
|
+
private ones included
|
|
29
|
+
|
|
30
|
+
- Reports whether a setting can be raised or must be lowered
|
|
31
|
+
|
|
32
|
+
- Reports outdated data packages: its own and those of Browserslist
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
Requires Node.js `^24.15.0 || >=26.0.0` and TypeScript 6 as a peer dependency.
|
|
37
|
+
|
|
38
|
+
The check fetches data from GitHub and the npm registry. Run it on demand or on
|
|
39
|
+
a schedule, not as part of builds or pull request checks: the data changes over
|
|
40
|
+
time.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Install `@simbo/platform-check` from the npm registry:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm i [-D] @simbo/platform-check
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
[`platformCheck()`](https://simbo.de/packages/functions/_simbo_platform-check.platformCheck/)
|
|
53
|
+
returns all findings; no findings mean that everything is current.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { platformCheck } from '@simbo/platform-check';
|
|
57
|
+
|
|
58
|
+
const { findings } = await platformCheck({
|
|
59
|
+
droppedNodeLines: [{ major: 22, reason: 'Dropped before its end of life.' }],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
for (const { subject, message, change } of findings) {
|
|
63
|
+
console.log(`${subject}: ${message} (${change})`);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For a complete API reference, see the
|
|
68
|
+
[documentation](https://simbo.de/packages/modules/_simbo_platform-check/).
|
|
69
|
+
|
|
70
|
+
### What Is Checked
|
|
71
|
+
|
|
72
|
+
The environments follow from each `package.json`, like in
|
|
73
|
+
[`@simbo/tsconfig`](https://npmjs.com/package/@simbo/tsconfig): `engines.node`
|
|
74
|
+
alone is `node`, `browserslist` alone is `browser`, both are `universal`.
|
|
75
|
+
|
|
76
|
+
| Check | Expected |
|
|
77
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
78
|
+
| `engines` | `engines.node` of every manifest covers exactly the maintained Node.js release lines. |
|
|
79
|
+
| `types-node` | The `@types/node` major is the lowest maintained release line. |
|
|
80
|
+
| `nvmrc` | `.nvmrc` holds a version of the Active LTS release line. |
|
|
81
|
+
| `lib` | The ECMAScript sub-libs whose APIs all supported environments have. |
|
|
82
|
+
| `target` | The highest ECMAScript version whose syntax all supported environments support. |
|
|
83
|
+
| `resolve-json-module` | Enabled where all supported environments support standard JSON modules. |
|
|
84
|
+
| `mapping` | The mapping covers the installed TypeScript, and the data knows every key of the mapping. |
|
|
85
|
+
| `config` | `droppedNodeLines` names only maintained release lines, `libExceptions` only existing workspaces. |
|
|
86
|
+
| `data` | Data packages are not older than `maxDataAge` days while a newer version exists, in or outside range. |
|
|
87
|
+
|
|
88
|
+
Node.js support means the lowest minimum version of all `engines.node` ranges,
|
|
89
|
+
without flags or partial implementations; presets serve the lowest supported
|
|
90
|
+
version of the repository. Browser support means
|
|
91
|
+
[Baseline Widely Available](https://web.dev/baseline) on the date of the check:
|
|
92
|
+
30 months after a feature became Baseline Newly Available. Every workspace with
|
|
93
|
+
`browserslist` counts as targeting Baseline Widely Available, as
|
|
94
|
+
[`@simbo/browserslist-config`](https://npmjs.com/package/@simbo/browserslist-config)
|
|
95
|
+
does; the query itself is not evaluated. `universal` requires both. Features
|
|
96
|
+
without data count as unsupported and are reported as `mapping` findings.
|
|
97
|
+
|
|
98
|
+
Presets are compared in both directions. Workspaces report only settings that
|
|
99
|
+
are ahead of their environment, since raising them is the job of the presets.
|
|
100
|
+
For workspaces, the check reads `tsconfig.json` and `tsconfig.build.json` and
|
|
101
|
+
follows their project references. Solution files that only reference other
|
|
102
|
+
configurations are not compared themselves. In browser workspaces,
|
|
103
|
+
configurations with `node` in `types`, such as the one for `vite.config.ts`, are
|
|
104
|
+
compared with Node.js. Only ECMAScript libs are compared; `DOM`, `WebWorker` and
|
|
105
|
+
similar libs are not checked.
|
|
106
|
+
|
|
107
|
+
An `engines` range may have an open upper bound; its minimum patch version is
|
|
108
|
+
not checked. `@types/node` specifiers with a protocol, such as `catalog:` or
|
|
109
|
+
`workspace:`, are skipped.
|
|
110
|
+
|
|
111
|
+
Data packages are compared with the newest version within the range of the
|
|
112
|
+
package that depends on them, which a lockfile update installs. A newer major
|
|
113
|
+
outside that range is reported for the dependent, such as this package for
|
|
114
|
+
`web-features` or `browserslist` for `caniuse-lite`.
|
|
115
|
+
|
|
116
|
+
### API
|
|
117
|
+
|
|
118
|
+
Besides
|
|
119
|
+
[`platformCheck()`](https://simbo.de/packages/functions/_simbo_platform-check.platformCheck/),
|
|
120
|
+
the package exports `optionsSchema`, `validateOptions()` and `DEFAULT_PRESETS`
|
|
121
|
+
for configuration loaders, `formatLibs()` and `formatTarget()` for reports, and
|
|
122
|
+
the types. The result contains the installed TypeScript version and the
|
|
123
|
+
ECMAScript sub-libs it knows, so reports need nothing else.
|
|
124
|
+
|
|
125
|
+
### Options
|
|
126
|
+
|
|
127
|
+
| Option | Default | Description |
|
|
128
|
+
| ------------------ | --------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
129
|
+
| `workingDir` | `process.cwd()` | A directory inside the repository; the check runs from the monorepo root. |
|
|
130
|
+
| `date` | `new Date()` | The date to check against. |
|
|
131
|
+
| `nvmrc` | `'.nvmrc'` | The `.nvmrc` path relative to the root, or `false`; a missing file is not checked. |
|
|
132
|
+
| `droppedNodeLines` | `[]` | Maintained release lines that are deliberately not supported, with a reason. |
|
|
133
|
+
| `presets` | `node`, `browser`, `universal` of `@simbo/tsconfig` | Shared configurations with their environment, as paths or package specifiers. |
|
|
134
|
+
| `workspaces` | `true` | Whether to check `tsconfig.json` and `tsconfig.build.json` of every workspace. |
|
|
135
|
+
| `libExceptions` | `[]` | Libs that a workspace may provide beyond its environment, such as for polyfills. |
|
|
136
|
+
| `maxDataAge` | `60` | Days after which an outdated data package is a finding. |
|
|
137
|
+
| `fetch` | `globalThis.fetch` | The function to fetch the release schedule and registry data. |
|
|
138
|
+
|
|
139
|
+
### Mapping
|
|
140
|
+
|
|
141
|
+
TypeScript groups APIs into sub-libs such as `ES2024.Promise`. The package maps
|
|
142
|
+
each sub-lib from ES2022 on to the
|
|
143
|
+
[browser-compat-data](https://github.com/mdn/browser-compat-data) keys of its
|
|
144
|
+
APIs, and each ECMAScript version to the keys of the syntax that `target`
|
|
145
|
+
transpiles or rejects. Sub-libs and syntax of older versions are assumed to be
|
|
146
|
+
supported. When TypeScript adds a sub-lib or version, or when updated data no
|
|
147
|
+
longer knows a key, the `mapping` check reports it until a new version of this
|
|
148
|
+
package covers it.
|
|
149
|
+
|
|
150
|
+
## Related Packages
|
|
151
|
+
|
|
152
|
+
- [`@simbo/platform-check-cli`](https://npmjs.com/package/@simbo/platform-check-cli)
|
|
153
|
+
- [`@simbo/tsconfig`](https://npmjs.com/package/@simbo/tsconfig)
|
|
154
|
+
- [`@simbo/browserslist-config`](https://npmjs.com/package/@simbo/browserslist-config)
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
[MIT © Simon Lepel](https://simbo.mit-license.org/2026/)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CompareTargetsOptions, Finding, PlatformTargets } from './platform-check.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compares configured TypeScript settings with the expected ones.
|
|
4
|
+
*
|
|
5
|
+
* @param subject - What the settings belong to, such as a file path.
|
|
6
|
+
* @param expected - The settings that the environment supports.
|
|
7
|
+
* @param actual - The configured settings.
|
|
8
|
+
* @param options - Options for the comparison.
|
|
9
|
+
* @returns The findings.
|
|
10
|
+
*/
|
|
11
|
+
export declare function compareTargets(subject: string, expected: PlatformTargets, actual: PlatformTargets, options: CompareTargetsOptions): Finding[];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { formatTarget } from './typescript-libs.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compares configured TypeScript settings with the expected ones.
|
|
4
|
+
*
|
|
5
|
+
* @param subject - What the settings belong to, such as a file path.
|
|
6
|
+
* @param expected - The settings that the environment supports.
|
|
7
|
+
* @param actual - The configured settings.
|
|
8
|
+
* @param options - Options for the comparison.
|
|
9
|
+
* @returns The findings.
|
|
10
|
+
*/
|
|
11
|
+
export function compareTargets(subject, expected, actual, options) {
|
|
12
|
+
const findings = [];
|
|
13
|
+
const allowed = new Set(options.allowedLibs);
|
|
14
|
+
const extra = actual.libs.filter(lib => !expected.libs.includes(lib) && !allowed.has(lib));
|
|
15
|
+
if (extra.length > 0) {
|
|
16
|
+
findings.push({
|
|
17
|
+
check: 'lib',
|
|
18
|
+
subject,
|
|
19
|
+
change: 'lower',
|
|
20
|
+
message: `lib provides APIs that not all supported environments have: ${extra.join(', ')}`,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const missing = expected.libs.filter(lib => !actual.libs.includes(lib));
|
|
24
|
+
if (options.reportBehind && missing.length > 0) {
|
|
25
|
+
findings.push({
|
|
26
|
+
check: 'lib',
|
|
27
|
+
subject,
|
|
28
|
+
change: 'raise',
|
|
29
|
+
message: `lib can provide APIs that all supported environments have: ${missing.join(', ')}`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (actual.target > expected.target) {
|
|
33
|
+
findings.push({
|
|
34
|
+
check: 'target',
|
|
35
|
+
subject,
|
|
36
|
+
change: 'lower',
|
|
37
|
+
message: `target ${formatTarget(actual.target)} is ahead of the supported syntax ${formatTarget(expected.target)}`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else if (options.reportBehind && actual.target < expected.target) {
|
|
41
|
+
findings.push({
|
|
42
|
+
check: 'target',
|
|
43
|
+
subject,
|
|
44
|
+
change: 'raise',
|
|
45
|
+
message: `target ${formatTarget(actual.target)} can be raised to ${formatTarget(expected.target)}`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (actual.resolveJsonModule && !expected.resolveJsonModule) {
|
|
49
|
+
findings.push({
|
|
50
|
+
check: 'resolve-json-module',
|
|
51
|
+
subject,
|
|
52
|
+
change: 'lower',
|
|
53
|
+
message: 'resolveJsonModule is enabled, but not all supported environments support JSON modules',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else if (options.reportBehind && !actual.resolveJsonModule && expected.resolveJsonModule) {
|
|
57
|
+
findings.push({
|
|
58
|
+
check: 'resolve-json-module',
|
|
59
|
+
subject,
|
|
60
|
+
change: 'raise',
|
|
61
|
+
message: 'resolveJsonModule can be enabled, as all supported environments support JSON modules',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return findings;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=compare-targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare-targets.js","sourceRoot":"","sources":["../src/compare-targets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,QAAyB,EACzB,MAAuB,EACvB,OAA8B;IAE9B,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7C,MAAM,KAAK,GAAG,MAAM,C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CAAC,IAAI,CAAC;YACZ,KAAK,EAAE,QAAQ;YACf,OAAO;YACP,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,UAAU,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;SACnG,CAAC,CAAC;IACL,CAAC;IAED,IAAI,MAAM,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAC5D,QAAQ,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE,qBAAqB;YAC5B,OAAO;YACP,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,uFAAuF;SACjG,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAC3F,QAAQ,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE,qBAAqB;YAC5B,OAAO;YACP,MAAM,EAAE,OAAO;YACf,OAAO,EAAE,sFAAsF;SAChG,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { CompareTargetsOptions, Finding, PlatformTargets } from './platform-check.types.js';\nimport { formatTarget } from './typescript-libs.js';\n\n/**\n * Compares configured TypeScript settings with the expected ones.\n *\n * @param subject - What the settings belong to, such as a file path.\n * @param expected - The settings that the environment supports.\n * @param actual - The configured settings.\n * @param options - Options for the comparison.\n * @returns The findings.\n */\nexport function compareTargets(\n subject: string,\n expected: PlatformTargets,\n actual: PlatformTargets,\n options: CompareTargetsOptions,\n): Finding[] {\n const findings: Finding[] = [];\n const allowed = new Set(options.allowedLibs);\n\n const extra = actual.libs.filter(lib => !expected.libs.includes(lib) && !allowed.has(lib));\n if (extra.length > 0) {\n findings.push({\n check: 'lib',\n subject,\n change: 'lower',\n message: `lib provides APIs that not all supported environments have: ${extra.join(', ')}`,\n });\n }\n const missing = expected.libs.filter(lib => !actual.libs.includes(lib));\n if (options.reportBehind && missing.length > 0) {\n findings.push({\n check: 'lib',\n subject,\n change: 'raise',\n message: `lib can provide APIs that all supported environments have: ${missing.join(', ')}`,\n });\n }\n\n if (actual.target > expected.target) {\n findings.push({\n check: 'target',\n subject,\n change: 'lower',\n message: `target ${formatTarget(actual.target)} is ahead of the supported syntax ${formatTarget(expected.target)}`,\n });\n } else if (options.reportBehind && actual.target < expected.target) {\n findings.push({\n check: 'target',\n subject,\n change: 'raise',\n message: `target ${formatTarget(actual.target)} can be raised to ${formatTarget(expected.target)}`,\n });\n }\n\n if (actual.resolveJsonModule && !expected.resolveJsonModule) {\n findings.push({\n check: 'resolve-json-module',\n subject,\n change: 'lower',\n message: 'resolveJsonModule is enabled, but not all supported environments support JSON modules',\n });\n } else if (options.reportBehind && !actual.resolveJsonModule && expected.resolveJsonModule) {\n findings.push({\n check: 'resolve-json-module',\n subject,\n change: 'raise',\n message: 'resolveJsonModule can be enabled, as all supported environments support JSON modules',\n });\n }\n\n return findings;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CompatData as BrowserCompatData } from '@mdn/browser-compat-data';
|
|
2
|
+
import type { CompatData, WebFeatures } from './platform-check.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the compatibility checks from browser-compat-data and web-features.
|
|
5
|
+
*
|
|
6
|
+
* @param browserCompatData - The data of `@mdn/browser-compat-data`.
|
|
7
|
+
* @param features - The `features` of `web-features`.
|
|
8
|
+
* @param date - The date to check Baseline Widely Available against.
|
|
9
|
+
* @returns The compatibility checks.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCompatData(browserCompatData: BrowserCompatData, features: WebFeatures, date: Date): CompatData;
|
|
12
|
+
/**
|
|
13
|
+
* Loads the compatibility checks from the installed `@mdn/browser-compat-data`
|
|
14
|
+
* and `web-features`.
|
|
15
|
+
*
|
|
16
|
+
* @param date - The date to check Baseline Widely Available against.
|
|
17
|
+
* @returns The compatibility checks.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadCompatData(date: Date): Promise<CompatData>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
/**
|
|
3
|
+
* The months after which a Baseline Newly Available feature becomes Baseline
|
|
4
|
+
* Widely Available.
|
|
5
|
+
*/
|
|
6
|
+
const WIDELY_AVAILABLE_MONTHS = 30;
|
|
7
|
+
/**
|
|
8
|
+
* Parses a Baseline date, counting ranged dates such as `≤2020-03-24` as
|
|
9
|
+
* their upper bound.
|
|
10
|
+
*
|
|
11
|
+
* @param value - The date as `YYYY-MM-DD`, optionally prefixed with `≤`.
|
|
12
|
+
* @returns The date, or `undefined`.
|
|
13
|
+
*/
|
|
14
|
+
function parseBaselineDate(value) {
|
|
15
|
+
return value === undefined ? undefined : new Date(`${value.replace(/^≤/u, '')}T00:00:00Z`);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks whether a Baseline status means Widely Available on a date.
|
|
19
|
+
*
|
|
20
|
+
* @param status - The Baseline status.
|
|
21
|
+
* @param date - The date.
|
|
22
|
+
* @returns `true` if the feature is widely available on the date.
|
|
23
|
+
*/
|
|
24
|
+
function isWidelyAvailableOn(status, date) {
|
|
25
|
+
const high = parseBaselineDate(status.baseline_high_date);
|
|
26
|
+
if (high !== undefined)
|
|
27
|
+
return high <= date;
|
|
28
|
+
const low = parseBaselineDate(status.baseline_low_date);
|
|
29
|
+
if (low === undefined)
|
|
30
|
+
return false;
|
|
31
|
+
const widely = new Date(low);
|
|
32
|
+
widely.setUTCMonth(widely.getUTCMonth() + WIDELY_AVAILABLE_MONTHS);
|
|
33
|
+
return widely <= date;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates the compatibility checks from browser-compat-data and web-features.
|
|
37
|
+
*
|
|
38
|
+
* @param browserCompatData - The data of `@mdn/browser-compat-data`.
|
|
39
|
+
* @param features - The `features` of `web-features`.
|
|
40
|
+
* @param date - The date to check Baseline Widely Available against.
|
|
41
|
+
* @returns The compatibility checks.
|
|
42
|
+
*/
|
|
43
|
+
export function createCompatData(browserCompatData, features, date) {
|
|
44
|
+
// web-features states the Baseline status of each browser-compat-data key.
|
|
45
|
+
const statusByKey = new Map();
|
|
46
|
+
for (const feature of Object.values(features)) {
|
|
47
|
+
if (feature.kind !== 'feature')
|
|
48
|
+
continue;
|
|
49
|
+
const statuses = Object.entries(feature.status?.by_compat_key ?? {});
|
|
50
|
+
for (const [key, status] of statuses) {
|
|
51
|
+
statusByKey.set(key, status);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const getCompatStatement = (key) => {
|
|
55
|
+
let node = browserCompatData;
|
|
56
|
+
for (const part of key.split('.')) {
|
|
57
|
+
node = node?.[part];
|
|
58
|
+
}
|
|
59
|
+
return node?.__compat;
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
isKnown: (key) => statusByKey.has(key) && getCompatStatement(key)?.support.nodejs !== undefined,
|
|
63
|
+
isWidelyAvailable: (key) => {
|
|
64
|
+
const status = statusByKey.get(key);
|
|
65
|
+
return status !== undefined && isWidelyAvailableOn(status, date);
|
|
66
|
+
},
|
|
67
|
+
isSupportedByNode: (key, version) => {
|
|
68
|
+
const support = getCompatStatement(key)?.support.nodejs;
|
|
69
|
+
return [support ?? []].flat().some(statement => isSupportedBy(statement, version));
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks whether a support statement covers a version without flags, prefixes
|
|
75
|
+
* or partial implementations.
|
|
76
|
+
*
|
|
77
|
+
* @param statement - The support statement.
|
|
78
|
+
* @param version - The version to check.
|
|
79
|
+
* @returns `true` if the version is supported.
|
|
80
|
+
*/
|
|
81
|
+
function isSupportedBy(statement, version) {
|
|
82
|
+
const { version_added: added } = statement;
|
|
83
|
+
if (typeof added !== 'string' ||
|
|
84
|
+
statement.version_removed !== undefined ||
|
|
85
|
+
statement.flags !== undefined ||
|
|
86
|
+
statement.prefix !== undefined ||
|
|
87
|
+
statement.alternative_name !== undefined ||
|
|
88
|
+
statement.partial_implementation) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
// Ranged versions such as `≤18` count as their upper bound.
|
|
92
|
+
const addedVersion = semver.coerce(added.replace(/^≤/u, ''));
|
|
93
|
+
return addedVersion !== null && semver.gte(version, addedVersion);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Loads the compatibility checks from the installed `@mdn/browser-compat-data`
|
|
97
|
+
* and `web-features`.
|
|
98
|
+
*
|
|
99
|
+
* @param date - The date to check Baseline Widely Available against.
|
|
100
|
+
* @returns The compatibility checks.
|
|
101
|
+
*/
|
|
102
|
+
export async function loadCompatData(date) {
|
|
103
|
+
const [{ default: browserCompatData }, webFeatures] = await Promise.all([
|
|
104
|
+
import('@mdn/browser-compat-data', { with: { type: 'json' } }),
|
|
105
|
+
import('web-features'),
|
|
106
|
+
]);
|
|
107
|
+
return createCompatData(browserCompatData, webFeatures.features, date);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=compat-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat-data.js","sourceRoot":"","sources":["../src/compat-data.ts"],"names":[],"mappings":"AAKA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B;;;GAGG;AACH,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,KAAyB;IAClD,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC;AAC7F,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,MAAsB,EAAE,IAAU;IAC7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,MAAM,CA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I,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAU;IAC7C,MAAM,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACtE,MAAM,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;QAC9D,MAAM,CAAC,cAAc,CAAuC;KAC7D,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import type {\n CompatData as BrowserCompatData,\n CompatStatement,\n SimpleSupportStatement,\n} from '@mdn/browser-compat-data';\nimport semver from 'semver';\n\nimport type { BaselineStatus, CompatData, WebFeatures } from './platform-check.types.js';\n\n/**\n * The months after which a Baseline Newly Available feature becomes Baseline\n * Widely Available.\n */\nconst WIDELY_AVAILABLE_MONTHS = 30;\n\n/**\n * Parses a Baseline date, counting ranged dates such as `≤2020-03-24` as\n * their upper bound.\n *\n * @param value - The date as `YYYY-MM-DD`, optionally prefixed with `≤`.\n * @returns The date, or `undefined`.\n */\nfunction parseBaselineDate(value: string | undefined): Date | undefined {\n return value === undefined ? undefined : new Date(`${value.replace(/^≤/u, '')}T00:00:00Z`);\n}\n\n/**\n * Checks whether a Baseline status means Widely Available on a date.\n *\n * @param status - The Baseline status.\n * @param date - The date.\n * @returns `true` if the feature is widely available on the date.\n */\nfunction isWidelyAvailableOn(status: BaselineStatus, date: Date): boolean {\n const high = parseBaselineDate(status.baseline_high_date);\n if (high !== undefined) return high <= date;\n const low = parseBaselineDate(status.baseline_low_date);\n if (low === undefined) return false;\n const widely = new Date(low);\n widely.setUTCMonth(widely.getUTCMonth() + WIDELY_AVAILABLE_MONTHS);\n return widely <= date;\n}\n\n/**\n * Creates the compatibility checks from browser-compat-data and web-features.\n *\n * @param browserCompatData - The data of `@mdn/browser-compat-data`.\n * @param features - The `features` of `web-features`.\n * @param date - The date to check Baseline Widely Available against.\n * @returns The compatibility checks.\n */\nexport function createCompatData(browserCompatData: BrowserCompatData, features: WebFeatures, date: Date): CompatData {\n // web-features states the Baseline status of each browser-compat-data key.\n const statusByKey = new Map<string, BaselineStatus>();\n for (const feature of Object.values(features)) {\n if (feature.kind !== 'feature') continue;\n const statuses = Object.entries(feature.status?.by_compat_key ?? {});\n for (const [key, status] of statuses) {\n statusByKey.set(key, status);\n }\n }\n\n const getCompatStatement = (key: string): CompatStatement | undefined => {\n let node: unknown = browserCompatData;\n for (const part of key.split('.')) {\n node = (node as Partial<Record<string, unknown>> | undefined)?.[part];\n }\n return (node as { __compat?: CompatStatement } | undefined)?.__compat;\n };\n\n return {\n isKnown: (key: string): boolean => statusByKey.has(key) && getCompatStatement(key)?.support.nodejs !== undefined,\n isWidelyAvailable: (key: string): boolean => {\n const status = statusByKey.get(key);\n return status !== undefined && isWidelyAvailableOn(status, date);\n },\n isSupportedByNode: (key: string, version: string): boolean => {\n const support = getCompatStatement(key)?.support.nodejs;\n return [support ?? []].flat().some(statement => isSupportedBy(statement, version));\n },\n };\n}\n\n/**\n * Checks whether a support statement covers a version without flags, prefixes\n * or partial implementations.\n *\n * @param statement - The support statement.\n * @param version - The version to check.\n * @returns `true` if the version is supported.\n */\nfunction isSupportedBy(statement: SimpleSupportStatement, version: string): boolean {\n const { version_added: added } = statement;\n if (\n typeof added !== 'string' ||\n statement.version_removed !== undefined ||\n statement.flags !== undefined ||\n statement.prefix !== undefined ||\n statement.alternative_name !== undefined ||\n statement.partial_implementation\n ) {\n return false;\n }\n // Ranged versions such as `≤18` count as their upper bound.\n const addedVersion = semver.coerce(added.replace(/^≤/u, ''));\n return addedVersion !== null && semver.gte(version, addedVersion);\n}\n\n/**\n * Loads the compatibility checks from the installed `@mdn/browser-compat-data`\n * and `web-features`.\n *\n * @param date - The date to check Baseline Widely Available against.\n * @returns The compatibility checks.\n */\nexport async function loadCompatData(date: Date): Promise<CompatData> {\n const [{ default: browserCompatData }, webFeatures] = await Promise.all([\n import('@mdn/browser-compat-data', { with: { type: 'json' } }),\n import('web-features') as Promise<{ features: WebFeatures }>,\n ]);\n return createCompatData(browserCompatData, webFeatures.features, date);\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DataPackage, FetchFn, Finding, InstalledPackage, RegistryPackage } from './platform-check.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Finds the installed versions of the data packages that this library uses:
|
|
4
|
+
* `web-features` and `@mdn/browser-compat-data`.
|
|
5
|
+
*
|
|
6
|
+
* @returns The installed packages.
|
|
7
|
+
* @throws {Error} If a package cannot be found.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findOwnDataPackages(): Promise<InstalledPackage[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Finds the installed versions of the Browserslist data packages,
|
|
12
|
+
* `caniuse-lite` and `baseline-browser-mapping`, through the `browserslist`
|
|
13
|
+
* that each directory resolves.
|
|
14
|
+
*
|
|
15
|
+
* @param directories - Absolute directories with a `package.json`.
|
|
16
|
+
* @returns The distinct installed packages, sorted.
|
|
17
|
+
*/
|
|
18
|
+
export declare function findBrowserslistDataPackages(directories: string[]): Promise<InstalledPackage[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetches the versions, publish dates and the latest version of a package
|
|
21
|
+
* from the npm registry.
|
|
22
|
+
*
|
|
23
|
+
* @param name - The package name.
|
|
24
|
+
* @param fetchFn - The function to fetch the registry data with.
|
|
25
|
+
* @returns The registry data.
|
|
26
|
+
* @throws {Error} If the registry data cannot be fetched.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchRegistryPackage(name: string, fetchFn?: FetchFn): Promise<RegistryPackage>;
|
|
29
|
+
/**
|
|
30
|
+
* Combines an installed package with its registry data.
|
|
31
|
+
*
|
|
32
|
+
* @param installed - The installed package.
|
|
33
|
+
* @param registry - The registry data of the package.
|
|
34
|
+
* @returns The version information.
|
|
35
|
+
*/
|
|
36
|
+
export declare function describeDataPackage(installed: InstalledPackage, registry: RegistryPackage): DataPackage;
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether an installed data package is outdated:
|
|
39
|
+
*
|
|
40
|
+
* - a newer version within the range exists, and the installed one is older
|
|
41
|
+
* than the maximum age, which a lockfile update resolves;
|
|
42
|
+
* - a version outside the range has been the latest for longer than the
|
|
43
|
+
* maximum age, which an update of the dependent resolves.
|
|
44
|
+
*
|
|
45
|
+
* @param data - The version information.
|
|
46
|
+
* @param date - The date to check against.
|
|
47
|
+
* @param maxAge - The maximum age in days.
|
|
48
|
+
* @returns The findings.
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkDataPackage(data: DataPackage, date: Date, maxAge: number): Finding[];
|