youmightnotneed 0.1.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/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +178 -0
- package/dist/bin.js.map +1 -0
- package/dist/colors.d.ts +24 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +24 -0
- package/dist/colors.js.map +1 -0
- package/dist/render.d.ts +18 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +134 -0
- package/dist/render.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Johannes Maendle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, 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,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# youmightnotneed
|
|
2
|
+
|
|
3
|
+
Find the modern CSS and HTML that replaces your JavaScript dependencies.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npx youmightnotneed
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Reads the nearest `package.json` and prints what the platform now covers,
|
|
10
|
+
grouped by how well supported the replacement is.
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npx youmightnotneed [path] [options]
|
|
14
|
+
|
|
15
|
+
path A package.json, or a directory holding one.
|
|
16
|
+
-v, --verbose Print every condition where the dependency still wins.
|
|
17
|
+
--json Machine-readable output.
|
|
18
|
+
--no-color Disable colour. NO_COLOR is respected too.
|
|
19
|
+
-h, --help Show help.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Run it with `--verbose` before you change anything. The conditions are the
|
|
23
|
+
point: a dependency in `package.json` is not proof of what it is used for, so
|
|
24
|
+
every finding is a "this may apply", and the report says when it does not.
|
|
25
|
+
|
|
26
|
+
Powered by [`@jomae/catalog`](https://www.npmjs.com/package/@jomae/catalog).
|
|
27
|
+
MIT.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* npx youmightnotneed
|
|
4
|
+
*
|
|
5
|
+
* Reads a package.json, runs the catalog's detect(), prints a report. All the
|
|
6
|
+
* I/O lives here; the rendering and the detection are both pure.
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
10
|
+
import { analyze, BASELINE_DATA_DATE, packageSizes, WEB_FEATURES_VERSION, } from "@jomae/catalog";
|
|
11
|
+
import { createPalette } from "./colors.js";
|
|
12
|
+
import { renderJson, renderReport } from "./render.js";
|
|
13
|
+
const HELP = `
|
|
14
|
+
youmightnotneed · is it CSS yet?
|
|
15
|
+
|
|
16
|
+
Finds the modern CSS and HTML that replaces your JavaScript dependencies.
|
|
17
|
+
|
|
18
|
+
Usage
|
|
19
|
+
npx youmightnotneed [path] [options]
|
|
20
|
+
|
|
21
|
+
path A package.json, or a directory containing one.
|
|
22
|
+
Defaults to the nearest package.json from the current
|
|
23
|
+
directory upwards.
|
|
24
|
+
|
|
25
|
+
Options
|
|
26
|
+
-v, --verbose Print every condition under which the dependency is still
|
|
27
|
+
the right call. Recommended before you change anything.
|
|
28
|
+
--json Machine-readable output.
|
|
29
|
+
--no-color Disable colour. Also respects the NO_COLOR variable.
|
|
30
|
+
-h, --help Show this.
|
|
31
|
+
--version Print the version.
|
|
32
|
+
|
|
33
|
+
Notes
|
|
34
|
+
A dependency in package.json is not proof of what it is used for, so every
|
|
35
|
+
finding is a "this may apply", not an instruction. Read the conditions.
|
|
36
|
+
`;
|
|
37
|
+
function parseArgs(argv) {
|
|
38
|
+
const args = {
|
|
39
|
+
path: undefined,
|
|
40
|
+
verbose: false,
|
|
41
|
+
json: false,
|
|
42
|
+
color: !process.env.NO_COLOR,
|
|
43
|
+
help: false,
|
|
44
|
+
version: false,
|
|
45
|
+
};
|
|
46
|
+
for (const arg of argv) {
|
|
47
|
+
switch (arg) {
|
|
48
|
+
case "-v":
|
|
49
|
+
case "--verbose":
|
|
50
|
+
args.verbose = true;
|
|
51
|
+
break;
|
|
52
|
+
case "--json":
|
|
53
|
+
args.json = true;
|
|
54
|
+
break;
|
|
55
|
+
case "--no-color":
|
|
56
|
+
args.color = false;
|
|
57
|
+
break;
|
|
58
|
+
case "-h":
|
|
59
|
+
case "--help":
|
|
60
|
+
args.help = true;
|
|
61
|
+
break;
|
|
62
|
+
case "--version":
|
|
63
|
+
args.version = true;
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
if (arg.startsWith("-")) {
|
|
67
|
+
console.error(`Unknown option: ${arg}`);
|
|
68
|
+
console.error("Run with --help to see the available options.");
|
|
69
|
+
process.exit(2);
|
|
70
|
+
}
|
|
71
|
+
args.path = arg;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return args;
|
|
76
|
+
}
|
|
77
|
+
/** Walks up from a directory looking for a package.json. */
|
|
78
|
+
function findPackageJson(start) {
|
|
79
|
+
let dir = resolve(start);
|
|
80
|
+
for (let depth = 0; depth < 40; depth += 1) {
|
|
81
|
+
const candidate = join(dir, "package.json");
|
|
82
|
+
try {
|
|
83
|
+
readFileSync(candidate, "utf8");
|
|
84
|
+
return candidate;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
const parent = dirname(dir);
|
|
88
|
+
if (parent === dir)
|
|
89
|
+
return null;
|
|
90
|
+
dir = parent;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function resolveTarget(input) {
|
|
96
|
+
if (!input) {
|
|
97
|
+
const found = findPackageJson(process.cwd());
|
|
98
|
+
if (!found) {
|
|
99
|
+
console.error("No package.json found here or in any parent directory.\nPass a path: npx youmightnotneed ./path/to/package.json");
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
return found;
|
|
103
|
+
}
|
|
104
|
+
const target = resolve(input);
|
|
105
|
+
if (basename(target) === "package.json")
|
|
106
|
+
return target;
|
|
107
|
+
const inDir = join(target, "package.json");
|
|
108
|
+
try {
|
|
109
|
+
readFileSync(inDir, "utf8");
|
|
110
|
+
return inDir;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
console.error(`No package.json at ${inDir}`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function readPackageJson(file) {
|
|
118
|
+
let raw;
|
|
119
|
+
try {
|
|
120
|
+
raw = readFileSync(file, "utf8");
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
console.error(`Could not read ${file}`);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const parsed = JSON.parse(raw);
|
|
128
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
129
|
+
throw new Error("not an object");
|
|
130
|
+
}
|
|
131
|
+
return parsed;
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
console.error(`${file} is not valid JSON.`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function readOwnVersion() {
|
|
139
|
+
try {
|
|
140
|
+
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
141
|
+
return pkg.version ?? "unknown";
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return "unknown";
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const args = parseArgs(process.argv.slice(2));
|
|
148
|
+
if (args.help) {
|
|
149
|
+
console.info(HELP);
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
if (args.version) {
|
|
153
|
+
console.info(readOwnVersion());
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
const target = resolveTarget(args.path);
|
|
157
|
+
const pkg = readPackageJson(target);
|
|
158
|
+
const report = analyze(pkg);
|
|
159
|
+
if (args.json) {
|
|
160
|
+
console.info(renderJson(report));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
const useColor = args.color && process.stdout.isTTY === true;
|
|
164
|
+
console.info(renderReport(report, {
|
|
165
|
+
palette: createPalette(useColor),
|
|
166
|
+
projectName: pkg.name ?? basename(dirname(target)),
|
|
167
|
+
provenance: {
|
|
168
|
+
baselineOn: BASELINE_DATA_DATE,
|
|
169
|
+
webFeaturesVersion: WEB_FEATURES_VERSION,
|
|
170
|
+
sizesOn: packageSizes.fetchedOn,
|
|
171
|
+
},
|
|
172
|
+
verbose: args.verbose,
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
// The report is informational, so a clean run always exits 0. A CI-friendly
|
|
176
|
+
// threshold flag can come later, once the catalog has settled.
|
|
177
|
+
process.exit(0);
|
|
178
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,kBAAkB,EAElB,YAAY,EACZ,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBZ,CAAC;AAWF,SAAS,SAAS,CAAC,IAAuB;IACxC,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ;QAC5B,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,IAAI,CAAC;YACV,KAAK,WAAW;gBACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,MAAM;YACR,KAAK,QAAQ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CAAC;IACN,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;IAC7D,OAAO,CAAC,IAAI,CACV,YAAY,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC;QAChC,WAAW,EAAE,GAAG,CAAC,IAAI,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,UAAU,EAAE;YACV,UAAU,EAAE,kBAAkB;YAC9B,kBAAkB,EAAE,oBAAoB;YACxC,OAAO,EAAE,YAAY,CAAC,SAAS;SAChC;QACD,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,+DAA+D;AAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/colors.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A very small ANSI helper. The CLI has no dependencies beyond the catalog, so
|
|
3
|
+
* terminal output screenshots well without pulling in a colour library.
|
|
4
|
+
*/
|
|
5
|
+
declare const CODES: {
|
|
6
|
+
readonly reset: `${string}0m`;
|
|
7
|
+
readonly bold: `${string}1m`;
|
|
8
|
+
readonly dim: `${string}2m`;
|
|
9
|
+
readonly red: `${string}31m`;
|
|
10
|
+
readonly green: `${string}32m`;
|
|
11
|
+
readonly yellow: `${string}33m`;
|
|
12
|
+
readonly blue: `${string}34m`;
|
|
13
|
+
readonly cyan: `${string}36m`;
|
|
14
|
+
readonly grey: `${string}90m`;
|
|
15
|
+
};
|
|
16
|
+
export type ColorName = Exclude<keyof typeof CODES, "reset">;
|
|
17
|
+
export interface Palette {
|
|
18
|
+
(name: ColorName, text: string): string;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Returns a painter that becomes the identity function when colour is off. */
|
|
22
|
+
export declare function createPalette(enabled: boolean): Palette;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,QAAA,MAAM,KAAK;aACT,KAAK;aACL,IAAI;aACJ,GAAG;aACH,GAAG;aACH,KAAK;aACL,MAAM;aACN,IAAI;aACJ,IAAI;aACJ,IAAI;CACI,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,OAAO,KAAK,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,WAAW,OAAO;IACtB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAKvD"}
|
package/dist/colors.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A very small ANSI helper. The CLI has no dependencies beyond the catalog, so
|
|
3
|
+
* terminal output screenshots well without pulling in a colour library.
|
|
4
|
+
*/
|
|
5
|
+
/** ASCII escape, built at runtime to keep a control character out of source. */
|
|
6
|
+
const ESC = `${String.fromCharCode(27)}[`;
|
|
7
|
+
const CODES = {
|
|
8
|
+
reset: `${ESC}0m`,
|
|
9
|
+
bold: `${ESC}1m`,
|
|
10
|
+
dim: `${ESC}2m`,
|
|
11
|
+
red: `${ESC}31m`,
|
|
12
|
+
green: `${ESC}32m`,
|
|
13
|
+
yellow: `${ESC}33m`,
|
|
14
|
+
blue: `${ESC}34m`,
|
|
15
|
+
cyan: `${ESC}36m`,
|
|
16
|
+
grey: `${ESC}90m`,
|
|
17
|
+
};
|
|
18
|
+
/** Returns a painter that becomes the identity function when colour is off. */
|
|
19
|
+
export function createPalette(enabled) {
|
|
20
|
+
const paint = ((name, text) => enabled ? `${CODES[name]}${text}${CODES.reset}` : text);
|
|
21
|
+
paint.enabled = enabled;
|
|
22
|
+
return paint;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gFAAgF;AAChF,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC;AAE1C,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,GAAG,GAAG,IAAI;IACjB,IAAI,EAAE,GAAG,GAAG,IAAI;IAChB,GAAG,EAAE,GAAG,GAAG,IAAI;IACf,GAAG,EAAE,GAAG,GAAG,KAAK;IAChB,KAAK,EAAE,GAAG,GAAG,KAAK;IAClB,MAAM,EAAE,GAAG,GAAG,KAAK;IACnB,IAAI,EAAE,GAAG,GAAG,KAAK;IACjB,IAAI,EAAE,GAAG,GAAG,KAAK;IACjB,IAAI,EAAE,GAAG,GAAG,KAAK;CACT,CAAC;AASX,+EAA+E;AAC/E,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,KAAK,GAAG,CAAC,CAAC,IAAe,EAAE,IAAY,EAAE,EAAE,CAC/C,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAY,CAAC;IACrE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Report } from "@jomae/catalog";
|
|
2
|
+
import type { Palette } from "./colors.ts";
|
|
3
|
+
export interface RenderOptions {
|
|
4
|
+
palette: Palette;
|
|
5
|
+
/** Shown in the header, usually the package.json name field. */
|
|
6
|
+
projectName?: string | undefined;
|
|
7
|
+
provenance: {
|
|
8
|
+
baselineOn: string;
|
|
9
|
+
webFeaturesVersion: string;
|
|
10
|
+
sizesOn: string;
|
|
11
|
+
};
|
|
12
|
+
/** Print the full unless list. When false, print only a count. */
|
|
13
|
+
verbose: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function renderReport(report: Report, options: RenderOptions): string;
|
|
16
|
+
/** --json, so scripts and agents get the data without parsing terminal text. */
|
|
17
|
+
export declare function renderJson(report: Report): string;
|
|
18
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,aAAa,CAAC;AA+CtD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,kEAAkE;IAClE,OAAO,EAAE,OAAO,CAAC;CAClB;AA2DD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CA2D3E;AAED,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA6BjD"}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { baselineLabel, formatBytes, formatHeadline, } from "@jomae/catalog";
|
|
2
|
+
const TIERS = [
|
|
3
|
+
{
|
|
4
|
+
status: "widely",
|
|
5
|
+
heading: "Baseline widely available",
|
|
6
|
+
note: "safe to use today",
|
|
7
|
+
marker: "+",
|
|
8
|
+
color: "green",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
status: "newly",
|
|
12
|
+
heading: "Baseline newly available",
|
|
13
|
+
note: "works in current browsers, check your support target",
|
|
14
|
+
marker: "~",
|
|
15
|
+
color: "yellow",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
status: "limited",
|
|
19
|
+
heading: "Limited availability",
|
|
20
|
+
note: "not in every engine yet, so it needs a fallback",
|
|
21
|
+
marker: "!",
|
|
22
|
+
color: "red",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
status: "unknown",
|
|
26
|
+
heading: "Support unverified",
|
|
27
|
+
note: "the catalog could not resolve these, so treat them with suspicion",
|
|
28
|
+
marker: "?",
|
|
29
|
+
color: "grey",
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
function renderFinding(finding, options) {
|
|
33
|
+
const { palette } = options;
|
|
34
|
+
const lines = [];
|
|
35
|
+
const size = finding.replaceableBytes === null
|
|
36
|
+
? "size unknown"
|
|
37
|
+
: formatBytes(finding.replaceableBytes);
|
|
38
|
+
lines.push(` ${palette("bold", finding.rule.title)} ${palette("grey", `(${size})`)}`);
|
|
39
|
+
lines.push(` ${palette("dim", "you have ")}${finding.matched
|
|
40
|
+
.map((m) => palette("cyan", m.name))
|
|
41
|
+
.join(", ")}`);
|
|
42
|
+
lines.push(` ${palette("dim", "native ")}${finding.rule.native}`);
|
|
43
|
+
const limitedBy = finding.baseline.limitedBy;
|
|
44
|
+
if (limitedBy) {
|
|
45
|
+
lines.push(` ${palette("dim", "capped by ")}${palette("grey", `${limitedBy.name}, ${baselineLabel(limitedBy.status).toLowerCase()}`)}`);
|
|
46
|
+
}
|
|
47
|
+
// Never show a replacement without the conditions under which it is wrong.
|
|
48
|
+
if (options.verbose) {
|
|
49
|
+
lines.push(` ${palette("dim", "keep it if")}`);
|
|
50
|
+
for (const condition of finding.rule.agent.unless) {
|
|
51
|
+
lines.push(` ${palette("grey", `- ${condition}`)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const count = finding.rule.agent.unless.length;
|
|
56
|
+
lines.push(` ${palette("dim", `keep it if ${count} condition${count === 1 ? "" : "s"} apply, see --verbose`)}`);
|
|
57
|
+
}
|
|
58
|
+
lines.push("");
|
|
59
|
+
return lines;
|
|
60
|
+
}
|
|
61
|
+
function footer(options) {
|
|
62
|
+
const { provenance } = options;
|
|
63
|
+
return [
|
|
64
|
+
`Baseline from web-features@${provenance.webFeaturesVersion}, captured ${provenance.baselineOn}.`,
|
|
65
|
+
`Sizes from bundlephobia, captured ${provenance.sizesOn}.`,
|
|
66
|
+
"Details and live demos: https://youmightnotneed.dev",
|
|
67
|
+
].join("\n");
|
|
68
|
+
}
|
|
69
|
+
export function renderReport(report, options) {
|
|
70
|
+
const { palette } = options;
|
|
71
|
+
const { findings, summary } = report;
|
|
72
|
+
const lines = [];
|
|
73
|
+
lines.push("");
|
|
74
|
+
const title = palette("bold", "youmightnotneed");
|
|
75
|
+
lines.push(options.projectName
|
|
76
|
+
? `${title} ${palette("grey", `· ${options.projectName}`)}`
|
|
77
|
+
: title);
|
|
78
|
+
lines.push("");
|
|
79
|
+
if (findings.length === 0) {
|
|
80
|
+
lines.push(` ${palette("green", "Nothing in this package.json has a native equivalent in the catalog.")}`);
|
|
81
|
+
lines.push(` ${palette("grey", "That is a real result. The catalog only covers CSS and HTML replacements.")}`);
|
|
82
|
+
lines.push("");
|
|
83
|
+
lines.push(palette("grey", footer(options)));
|
|
84
|
+
lines.push("");
|
|
85
|
+
return lines.join("\n");
|
|
86
|
+
}
|
|
87
|
+
lines.push(` ${palette("bold", formatHeadline(summary.replaceableBytes, summary.packageCount))}`);
|
|
88
|
+
lines.push(` ${palette("grey", "Minified and gzipped, and 'up to' on purpose: a dependency being installed is not proof of how it is used.")}`);
|
|
89
|
+
if (summary.hasUnknownSizes) {
|
|
90
|
+
lines.push(` ${palette("grey", "Some matched packages have no measurement, so the real figure is higher.")}`);
|
|
91
|
+
}
|
|
92
|
+
lines.push("");
|
|
93
|
+
for (const tier of TIERS) {
|
|
94
|
+
const inTier = findings.filter((f) => f.baseline.status === tier.status);
|
|
95
|
+
if (inTier.length === 0)
|
|
96
|
+
continue;
|
|
97
|
+
lines.push(`${palette(tier.color, tier.marker)} ${palette("bold", tier.heading)} ${palette("grey", `· ${tier.note}`)}`);
|
|
98
|
+
lines.push("");
|
|
99
|
+
for (const finding of inTier) {
|
|
100
|
+
lines.push(...renderFinding(finding, options));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
lines.push(palette("grey", footer(options)));
|
|
104
|
+
lines.push("");
|
|
105
|
+
return lines.join("\n");
|
|
106
|
+
}
|
|
107
|
+
/** --json, so scripts and agents get the data without parsing terminal text. */
|
|
108
|
+
export function renderJson(report) {
|
|
109
|
+
return JSON.stringify({
|
|
110
|
+
summary: report.summary,
|
|
111
|
+
findings: report.findings.map((finding) => ({
|
|
112
|
+
ruleId: finding.rule.id,
|
|
113
|
+
title: finding.rule.title,
|
|
114
|
+
native: finding.rule.native,
|
|
115
|
+
baseline: {
|
|
116
|
+
status: finding.baseline.status,
|
|
117
|
+
label: baselineLabel(finding.baseline.status),
|
|
118
|
+
limitedBy: finding.baseline.limitedBy?.id ?? null,
|
|
119
|
+
dataDate: finding.baseline.dataDate,
|
|
120
|
+
},
|
|
121
|
+
matched: finding.matched.map((m) => ({
|
|
122
|
+
name: m.name,
|
|
123
|
+
fields: m.fields,
|
|
124
|
+
gzip: m.gzip,
|
|
125
|
+
})),
|
|
126
|
+
replaceableBytes: finding.replaceableBytes,
|
|
127
|
+
when: finding.rule.agent.when,
|
|
128
|
+
unless: finding.rule.agent.unless,
|
|
129
|
+
snippet: finding.rule.agent.snippet,
|
|
130
|
+
demoUrl: finding.rule.human.demoUrl ?? null,
|
|
131
|
+
})),
|
|
132
|
+
}, null, 2);
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,WAAW,EACX,cAAc,GAEf,MAAM,gBAAgB,CAAC;AAiBxB,MAAM,KAAK,GAAW;IACpB;QACE,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,2BAA2B;QACpC,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,OAAO;KACf;IACD;QACE,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,0BAA0B;QACnC,IAAI,EAAE,sDAAsD;QAC5D,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,QAAQ;KAChB;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,iDAAiD;QACvD,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,KAAK;KACb;IACD;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,oBAAoB;QAC7B,IAAI,EAAE,mEAAmE;QACzE,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,MAAM;KACd;CACF,CAAC;AAeF,SAAS,aAAa,CAAC,OAAgB,EAAE,OAAsB;IAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GACR,OAAO,CAAC,gBAAgB,KAAK,IAAI;QAC/B,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE5C,KAAK,CAAC,IAAI,CACR,KAAK,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,GAAG,CAAC,EAAE,CAC3E,CAAC;IACF,KAAK,CAAC,IAAI,CAC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C,IAAI,CAAC,KAAK,CAAC,IAAI;YAC7B,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;YACjC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;YACnC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI;SAC5C,CAAC,CAAC;KACJ,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "youmightnotneed",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Find the modern CSS and HTML that replaces your JavaScript dependencies.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Johannes Maendle",
|
|
8
|
+
"homepage": "https://youmightnotneed.dev",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/jomaendle/youmightnotneed.git",
|
|
12
|
+
"directory": "packages/cli"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"css",
|
|
16
|
+
"baseline",
|
|
17
|
+
"bundle-size",
|
|
18
|
+
"dependencies",
|
|
19
|
+
"cli"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"youmightnotneed": "./dist/bin.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@jomae/catalog": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=22.18.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"vitest": "^4.1.11",
|
|
39
|
+
"@types/node": "^24.13.3",
|
|
40
|
+
"@vitest/coverage-v8": "^4.1.11"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
45
|
+
"start": "node src/bin.ts",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:coverage": "vitest run --coverage"
|
|
48
|
+
}
|
|
49
|
+
}
|