@node-cli/bundlecheck 1.3.0 → 1.4.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/README.md +202 -0
- package/dist/bundlecheck.js +23 -21
- package/dist/bundlecheck.js.map +1 -1
- package/dist/bundler.d.ts +10 -6
- package/dist/bundler.js +92 -84
- package/dist/bundler.js.map +1 -1
- package/dist/cache.d.ts +18 -15
- package/dist/cache.js +39 -35
- package/dist/cache.js.map +1 -1
- package/dist/defaults.d.ts +2 -2
- package/dist/defaults.js +10 -10
- package/dist/defaults.js.map +1 -1
- package/dist/index.d.ts +320 -10
- package/dist/index.js +229 -0
- package/dist/index.js.map +1 -0
- package/dist/trend.d.ts +14 -8
- package/dist/trend.js +39 -33
- package/dist/trend.js.map +1 -1
- package/dist/versions.d.ts +1 -1
- package/dist/versions.js +12 -10
- package/dist/versions.js.map +1 -1
- package/package.json +5 -5
package/dist/trend.js
CHANGED
|
@@ -5,31 +5,32 @@ import { checkBundleSize, formatBytes, getExternals, parsePackageSpecifier } fro
|
|
|
5
5
|
import { getCachedResult, normalizeCacheKey, setCachedResult } from "./cache.js";
|
|
6
6
|
import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
7
7
|
/**
|
|
8
|
-
* Select versions for trend analysis
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Select versions for trend analysis Returns the most recent stable versions
|
|
9
|
+
* (newest first) Filters out prerelease versions (canary, alpha, beta, rc,
|
|
10
|
+
* etc.)
|
|
11
11
|
*/ export function selectTrendVersions(allVersions, count = TREND_VERSION_COUNT) {
|
|
12
12
|
// Filter out prerelease versions (canary, alpha, beta, rc, etc.)
|
|
13
13
|
const stableVersions = allVersions.filter((v)=>!prerelease(v));
|
|
14
14
|
return stableVersions.slice(0, count);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Analyze bundle size trend across multiple versions
|
|
17
|
+
* Analyze bundle size trend across multiple versions.
|
|
18
18
|
*/ export async function analyzeTrend(options) {
|
|
19
19
|
const { packageName, versions, exports, additionalExternals, noExternal, gzipLevel, boring, registry, platform, force } = options;
|
|
20
20
|
const log = new Logger({
|
|
21
21
|
boring
|
|
22
22
|
});
|
|
23
23
|
const results = [];
|
|
24
|
-
// Parse base package name (without version)
|
|
24
|
+
// Parse base package name (without version).
|
|
25
25
|
const { name: baseName } = parsePackageSpecifier(packageName);
|
|
26
|
-
// Compute externals for cache key (same logic as bundler)
|
|
26
|
+
// Compute externals for cache key (same logic as bundler).
|
|
27
27
|
const externals = getExternals(baseName, additionalExternals, noExternal);
|
|
28
28
|
for (const version of versions){
|
|
29
29
|
const versionedPackage = `${packageName}@${version}`;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Build cache key for this version.
|
|
32
|
+
* NOTE: platform can be undefined (auto-detect), which is stored as "auto" in cache.
|
|
33
|
+
*/ const cacheKey = normalizeCacheKey({
|
|
33
34
|
packageName: baseName,
|
|
34
35
|
version,
|
|
35
36
|
exports,
|
|
@@ -38,7 +39,7 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
38
39
|
externals,
|
|
39
40
|
noExternal: noExternal ?? false
|
|
40
41
|
});
|
|
41
|
-
// Check cache first (unless --force flag is set)
|
|
42
|
+
// Check cache first (unless --force flag is set).
|
|
42
43
|
if (!force) {
|
|
43
44
|
const cached = getCachedResult(cacheKey);
|
|
44
45
|
if (cached) {
|
|
@@ -62,7 +63,7 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
62
63
|
registry,
|
|
63
64
|
platform
|
|
64
65
|
});
|
|
65
|
-
// Store result in cache
|
|
66
|
+
// Store result in cache.
|
|
66
67
|
setCachedResult(cacheKey, result);
|
|
67
68
|
results.push({
|
|
68
69
|
version,
|
|
@@ -70,14 +71,14 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
70
71
|
gzipSize: result.gzipSize
|
|
71
72
|
});
|
|
72
73
|
} catch {
|
|
73
|
-
// Skip versions that fail to analyze
|
|
74
|
+
// Skip versions that fail to analyze.
|
|
74
75
|
log.info(` Skipping ${version} (failed to analyze)`);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
return results;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
|
-
* Render a bar graph showing bundle size trend
|
|
81
|
+
* Render a bar graph showing bundle size trend.
|
|
81
82
|
*/ export function renderTrendGraph(packageName, results, boring = false) {
|
|
82
83
|
if (results.length === 0) {
|
|
83
84
|
return [
|
|
@@ -85,18 +86,19 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
85
86
|
];
|
|
86
87
|
}
|
|
87
88
|
const lines = [];
|
|
88
|
-
// Color helper (respects boring flag)
|
|
89
|
+
// Color helper (respects boring flag).
|
|
89
90
|
const blue = (text)=>boring ? text : kleur.blue(text);
|
|
90
|
-
// Check if gzip data is available (null for node platform)
|
|
91
|
+
// Check if gzip data is available (null for node platform).
|
|
91
92
|
const hasGzipData = results.some((r)=>r.gzipSize !== null);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Create maps from formatted string to representative value This ensures
|
|
95
|
+
* values that display the same get the same bar length.
|
|
96
|
+
*/ const gzipFormattedToValue = new Map();
|
|
95
97
|
const rawFormattedToValue = new Map();
|
|
96
98
|
for (const result of results){
|
|
97
99
|
if (hasGzipData && result.gzipSize !== null) {
|
|
98
100
|
const gzipFormatted = formatBytes(result.gzipSize);
|
|
99
|
-
// Use first occurrence as representative value for each formatted string
|
|
101
|
+
// Use first occurrence as representative value for each formatted string.
|
|
100
102
|
if (!gzipFormattedToValue.has(gzipFormatted)) {
|
|
101
103
|
gzipFormattedToValue.set(gzipFormatted, result.gzipSize);
|
|
102
104
|
}
|
|
@@ -106,7 +108,7 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
106
108
|
rawFormattedToValue.set(rawFormatted, result.rawSize);
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
|
-
// Get unique representative values for min/max calculation
|
|
111
|
+
// Get unique representative values for min/max calculation.
|
|
110
112
|
const uniqueGzipValues = [
|
|
111
113
|
...gzipFormattedToValue.values()
|
|
112
114
|
];
|
|
@@ -117,26 +119,26 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
117
119
|
const maxGzipSize = hasGzipData ? Math.max(...uniqueGzipValues) : 0;
|
|
118
120
|
const minRawSize = Math.min(...uniqueRawValues);
|
|
119
121
|
const maxRawSize = Math.max(...uniqueRawValues);
|
|
120
|
-
// Find max version length for alignment
|
|
122
|
+
// Find max version length for alignment.
|
|
121
123
|
const maxVersionLen = Math.max(...results.map((r)=>r.version.length));
|
|
122
|
-
// Bar width (characters)
|
|
124
|
+
// Bar width (characters).
|
|
123
125
|
const barWidth = 30;
|
|
124
126
|
const minBarWidth = 10; // Minimum bar length for smallest value
|
|
125
|
-
// Helper to calculate bar length with min-max scaling
|
|
127
|
+
// Helper to calculate bar length with min-max scaling.
|
|
126
128
|
const calcBarLength = (value, min, max)=>{
|
|
127
129
|
if (max === min) {
|
|
128
130
|
return barWidth; // All values are the same
|
|
129
131
|
}
|
|
130
|
-
// Scale from minBarWidth to barWidth based on position between min and max
|
|
132
|
+
// Scale from minBarWidth to barWidth based on position between min and max.
|
|
131
133
|
const ratio = (value - min) / (max - min);
|
|
132
134
|
return Math.round(minBarWidth + ratio * (barWidth - minBarWidth));
|
|
133
135
|
};
|
|
134
|
-
// Header
|
|
136
|
+
// Header.
|
|
135
137
|
lines.push("");
|
|
136
138
|
lines.push(`${blue("Bundle Size:")} ${packageName}`);
|
|
137
139
|
lines.push("─".repeat(60));
|
|
138
140
|
lines.push("");
|
|
139
|
-
// Gzip size bars (only for browser platform)
|
|
141
|
+
// Gzip size bars (only for browser platform).
|
|
140
142
|
if (hasGzipData) {
|
|
141
143
|
lines.push(blue("Gzip Size:"));
|
|
142
144
|
for (const result of results){
|
|
@@ -144,8 +146,10 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
144
146
|
continue;
|
|
145
147
|
}
|
|
146
148
|
const sizeStr = formatBytes(result.gzipSize);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Use representative value for this formatted string to ensure consistent
|
|
151
|
+
* bar length.
|
|
152
|
+
*/ const representativeValue = gzipFormattedToValue.get(sizeStr);
|
|
149
153
|
const barLength = calcBarLength(representativeValue, minGzipSize, maxGzipSize);
|
|
150
154
|
const bar = "▇".repeat(barLength);
|
|
151
155
|
const padding = " ".repeat(maxVersionLen - result.version.length);
|
|
@@ -153,19 +157,21 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
153
157
|
}
|
|
154
158
|
lines.push("");
|
|
155
159
|
}
|
|
156
|
-
// Raw size bars
|
|
160
|
+
// Raw size bars.
|
|
157
161
|
lines.push(blue("Raw Size:"));
|
|
158
162
|
for (const result of results){
|
|
159
163
|
const sizeStr = formatBytes(result.rawSize);
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Use representative value for this formatted string to ensure consistent bar
|
|
166
|
+
* length.
|
|
167
|
+
*/ const representativeValue = rawFormattedToValue.get(sizeStr);
|
|
162
168
|
const barLength = calcBarLength(representativeValue, minRawSize, maxRawSize);
|
|
163
169
|
const bar = "▇".repeat(barLength);
|
|
164
170
|
const padding = " ".repeat(maxVersionLen - result.version.length);
|
|
165
171
|
lines.push(` ${result.version}${padding} ${bar} ${sizeStr}`);
|
|
166
172
|
}
|
|
167
173
|
lines.push("");
|
|
168
|
-
// Summary
|
|
174
|
+
// Summary.
|
|
169
175
|
const oldestResult = results[results.length - 1];
|
|
170
176
|
const newestResult = results[0];
|
|
171
177
|
if (results.length > 1) {
|
|
@@ -174,7 +180,7 @@ import { TREND_VERSION_COUNT } from "./defaults.js";
|
|
|
174
180
|
const rawTrend = rawDiff >= 0 ? `+${formatBytes(rawDiff)}` : `-${formatBytes(Math.abs(rawDiff))}`;
|
|
175
181
|
lines.push("─".repeat(60));
|
|
176
182
|
lines.push(`Change from ${oldestResult.version} to ${newestResult.version}:`);
|
|
177
|
-
// Gzip summary (only for browser platform)
|
|
183
|
+
// Gzip summary (only for browser platform).
|
|
178
184
|
if (hasGzipData && newestResult.gzipSize !== null && oldestResult.gzipSize !== null) {
|
|
179
185
|
const gzipDiff = newestResult.gzipSize - oldestResult.gzipSize;
|
|
180
186
|
const gzipPercent = (gzipDiff / oldestResult.gzipSize * 100).toFixed(1);
|
package/dist/trend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/trend.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport kleur from \"kleur\";\nimport { prerelease } from \"semver\";\nimport {\n\tcheckBundleSize,\n\tformatBytes,\n\tgetExternals,\n\tparsePackageSpecifier,\n} from \"./bundler.js\";\nimport {\n\tgetCachedResult,\n\tnormalizeCacheKey,\n\tsetCachedResult,\n} from \"./cache.js\";\nimport { TREND_VERSION_COUNT } from \"./defaults.js\";\n\nexport type TrendResult = {\n\tversion: string;\n\trawSize: number;\n\t/** Gzip size in bytes, or null for node platform */\n\tgzipSize: number | null;\n};\n\nexport type TrendOptions = {\n\tpackageName: string;\n\tversions: string[];\n\texports?: string[];\n\tadditionalExternals?: string[];\n\tnoExternal?: boolean;\n\tgzipLevel?: number;\n\tboring?: boolean;\n\tregistry?: string;\n\t/** Target platform. If undefined, auto-detects from package.json engines */\n\tplatform?: \"browser\" | \"node\";\n\t/** Bypass cache and force re-fetch/re-calculation */\n\tforce?: boolean;\n};\n\n/**\n * Select versions for trend analysis\n * Returns the most recent stable versions (newest first)\n * Filters out prerelease versions (canary, alpha, beta, rc, etc.)\n */\nexport function selectTrendVersions(\n\tallVersions: string[],\n\tcount: number = TREND_VERSION_COUNT,\n): string[] {\n\t// Filter out prerelease versions (canary, alpha, beta, rc, etc.)\n\tconst stableVersions = allVersions.filter((v) => !prerelease(v));\n\treturn stableVersions.slice(0, count);\n}\n\n/**\n * Analyze bundle size trend across multiple versions\n */\nexport async function analyzeTrend(\n\toptions: TrendOptions,\n): Promise<TrendResult[]> {\n\tconst {\n\t\tpackageName,\n\t\tversions,\n\t\texports,\n\t\tadditionalExternals,\n\t\tnoExternal,\n\t\tgzipLevel,\n\t\tboring,\n\t\tregistry,\n\t\tplatform,\n\t\tforce,\n\t} = options;\n\n\tconst log = new Logger({ boring });\n\tconst results: TrendResult[] = [];\n\n\t// Parse base package name (without version)\n\tconst { name: baseName } = parsePackageSpecifier(packageName);\n\n\t// Compute externals for cache key (same logic as bundler)\n\tconst externals = getExternals(baseName, additionalExternals, noExternal);\n\n\tfor (const version of versions) {\n\t\tconst versionedPackage = `${packageName}@${version}`;\n\n\t\t// Build cache key for this version\n\t\t// Note: platform can be undefined (auto-detect), which is stored as \"auto\" in cache\n\t\tconst cacheKey = normalizeCacheKey({\n\t\t\tpackageName: baseName,\n\t\t\tversion,\n\t\t\texports,\n\t\t\tplatform,\n\t\t\tgzipLevel: gzipLevel ?? 5,\n\t\t\texternals,\n\t\t\tnoExternal: noExternal ?? false,\n\t\t});\n\n\t\t// Check cache first (unless --force flag is set)\n\t\tif (!force) {\n\t\t\tconst cached = getCachedResult(cacheKey);\n\t\t\tif (cached) {\n\t\t\t\tlog.info(` Checking ${version}... (cached)`);\n\t\t\t\tresults.push({\n\t\t\t\t\tversion,\n\t\t\t\t\trawSize: cached.rawSize,\n\t\t\t\t\tgzipSize: cached.gzipSize,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tlog.info(` Checking ${version}...`);\n\n\t\ttry {\n\t\t\tconst result = await checkBundleSize({\n\t\t\t\tpackageName: versionedPackage,\n\t\t\t\texports,\n\t\t\t\tadditionalExternals,\n\t\t\t\tnoExternal,\n\t\t\t\tgzipLevel,\n\t\t\t\tregistry,\n\t\t\t\tplatform,\n\t\t\t});\n\n\t\t\t// Store result in cache\n\t\t\tsetCachedResult(cacheKey, result);\n\n\t\t\tresults.push({\n\t\t\t\tversion,\n\t\t\t\trawSize: result.rawSize,\n\t\t\t\tgzipSize: result.gzipSize,\n\t\t\t});\n\t\t} catch {\n\t\t\t// Skip versions that fail to analyze\n\t\t\tlog.info(` Skipping ${version} (failed to analyze)`);\n\t\t}\n\t}\n\n\treturn results;\n}\n\n/**\n * Render a bar graph showing bundle size trend\n */\nexport function renderTrendGraph(\n\tpackageName: string,\n\tresults: TrendResult[],\n\tboring: boolean = false,\n): string[] {\n\tif (results.length === 0) {\n\t\treturn [\"No data to display\"];\n\t}\n\n\tconst lines: string[] = [];\n\n\t// Color helper (respects boring flag)\n\tconst blue = (text: string) => (boring ? text : kleur.blue(text));\n\n\t// Check if gzip data is available (null for node platform)\n\tconst hasGzipData = results.some((r) => r.gzipSize !== null);\n\n\t// Create maps from formatted string to representative value\n\t// This ensures values that display the same get the same bar length\n\tconst gzipFormattedToValue = new Map<string, number>();\n\tconst rawFormattedToValue = new Map<string, number>();\n\n\tfor (const result of results) {\n\t\tif (hasGzipData && result.gzipSize !== null) {\n\t\t\tconst gzipFormatted = formatBytes(result.gzipSize);\n\t\t\t// Use first occurrence as representative value for each formatted string\n\t\t\tif (!gzipFormattedToValue.has(gzipFormatted)) {\n\t\t\t\tgzipFormattedToValue.set(gzipFormatted, result.gzipSize);\n\t\t\t}\n\t\t}\n\t\tconst rawFormatted = formatBytes(result.rawSize);\n\t\tif (!rawFormattedToValue.has(rawFormatted)) {\n\t\t\trawFormattedToValue.set(rawFormatted, result.rawSize);\n\t\t}\n\t}\n\n\t// Get unique representative values for min/max calculation\n\tconst uniqueGzipValues = [...gzipFormattedToValue.values()];\n\tconst uniqueRawValues = [...rawFormattedToValue.values()];\n\n\tconst minGzipSize = hasGzipData ? Math.min(...uniqueGzipValues) : 0;\n\tconst maxGzipSize = hasGzipData ? Math.max(...uniqueGzipValues) : 0;\n\tconst minRawSize = Math.min(...uniqueRawValues);\n\tconst maxRawSize = Math.max(...uniqueRawValues);\n\n\t// Find max version length for alignment\n\tconst maxVersionLen = Math.max(...results.map((r) => r.version.length));\n\n\t// Bar width (characters)\n\tconst barWidth = 30;\n\tconst minBarWidth = 10; // Minimum bar length for smallest value\n\n\t// Helper to calculate bar length with min-max scaling\n\tconst calcBarLength = (value: number, min: number, max: number): number => {\n\t\tif (max === min) {\n\t\t\treturn barWidth; // All values are the same\n\t\t}\n\t\t// Scale from minBarWidth to barWidth based on position between min and max\n\t\tconst ratio = (value - min) / (max - min);\n\t\treturn Math.round(minBarWidth + ratio * (barWidth - minBarWidth));\n\t};\n\n\t// Header\n\tlines.push(\"\");\n\tlines.push(`${blue(\"Bundle Size:\")} ${packageName}`);\n\tlines.push(\"─\".repeat(60));\n\tlines.push(\"\");\n\n\t// Gzip size bars (only for browser platform)\n\tif (hasGzipData) {\n\t\tlines.push(blue(\"Gzip Size:\"));\n\t\tfor (const result of results) {\n\t\t\tif (result.gzipSize === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst sizeStr = formatBytes(result.gzipSize);\n\t\t\t// Use representative value for this formatted string to ensure consistent bar length\n\t\t\tconst representativeValue = gzipFormattedToValue.get(sizeStr) as number;\n\t\t\tconst barLength = calcBarLength(\n\t\t\t\trepresentativeValue,\n\t\t\t\tminGzipSize,\n\t\t\t\tmaxGzipSize,\n\t\t\t);\n\t\t\tconst bar = \"▇\".repeat(barLength);\n\t\t\tconst padding = \" \".repeat(maxVersionLen - result.version.length);\n\t\t\tlines.push(` ${result.version}${padding} ${bar} ${sizeStr}`);\n\t\t}\n\n\t\tlines.push(\"\");\n\t}\n\n\t// Raw size bars\n\tlines.push(blue(\"Raw Size:\"));\n\tfor (const result of results) {\n\t\tconst sizeStr = formatBytes(result.rawSize);\n\t\t// Use representative value for this formatted string to ensure consistent bar length\n\t\tconst representativeValue = rawFormattedToValue.get(sizeStr) as number;\n\t\tconst barLength = calcBarLength(\n\t\t\trepresentativeValue,\n\t\t\tminRawSize,\n\t\t\tmaxRawSize,\n\t\t);\n\t\tconst bar = \"▇\".repeat(barLength);\n\t\tconst padding = \" \".repeat(maxVersionLen - result.version.length);\n\t\tlines.push(` ${result.version}${padding} ${bar} ${sizeStr}`);\n\t}\n\n\tlines.push(\"\");\n\n\t// Summary\n\tconst oldestResult = results[results.length - 1];\n\tconst newestResult = results[0];\n\n\tif (results.length > 1) {\n\t\tconst rawDiff = newestResult.rawSize - oldestResult.rawSize;\n\t\tconst rawPercent = ((rawDiff / oldestResult.rawSize) * 100).toFixed(1);\n\t\tconst rawTrend =\n\t\t\trawDiff >= 0\n\t\t\t\t? `+${formatBytes(rawDiff)}`\n\t\t\t\t: `-${formatBytes(Math.abs(rawDiff))}`;\n\n\t\tlines.push(\"─\".repeat(60));\n\t\tlines.push(\n\t\t\t`Change from ${oldestResult.version} to ${newestResult.version}:`,\n\t\t);\n\n\t\t// Gzip summary (only for browser platform)\n\t\tif (\n\t\t\thasGzipData &&\n\t\t\tnewestResult.gzipSize !== null &&\n\t\t\toldestResult.gzipSize !== null\n\t\t) {\n\t\t\tconst gzipDiff = newestResult.gzipSize - oldestResult.gzipSize;\n\t\t\tconst gzipPercent = ((gzipDiff / oldestResult.gzipSize) * 100).toFixed(1);\n\t\t\tconst gzipTrend =\n\t\t\t\tgzipDiff >= 0\n\t\t\t\t\t? `+${formatBytes(gzipDiff)}`\n\t\t\t\t\t: `-${formatBytes(Math.abs(gzipDiff))}`;\n\t\t\tlines.push(\n\t\t\t\t` ${blue(\"Gzip:\")} ${gzipTrend} (${gzipDiff >= 0 ? \"+\" : \"\"}${gzipPercent}%)`,\n\t\t\t);\n\t\t}\n\n\t\tlines.push(\n\t\t\t` ${blue(\"Raw:\")} ${rawTrend} (${rawDiff >= 0 ? \"+\" : \"\"}${rawPercent}%)`,\n\t\t);\n\t}\n\n\tlines.push(\"\");\n\n\treturn lines;\n}\n"],"names":["Logger","kleur","prerelease","checkBundleSize","formatBytes","getExternals","parsePackageSpecifier","getCachedResult","normalizeCacheKey","setCachedResult","TREND_VERSION_COUNT","selectTrendVersions","allVersions","count","stableVersions","filter","v","slice","analyzeTrend","options","packageName","versions","exports","additionalExternals","noExternal","gzipLevel","boring","registry","platform","force","log","results","name","baseName","externals","version","versionedPackage","cacheKey","cached","info","push","rawSize","gzipSize","result","renderTrendGraph","length","lines","blue","text","hasGzipData","some","r","gzipFormattedToValue","Map","rawFormattedToValue","gzipFormatted","has","set","rawFormatted","uniqueGzipValues","values","uniqueRawValues","minGzipSize","Math","min","maxGzipSize","max","minRawSize","maxRawSize","maxVersionLen","map","barWidth","minBarWidth","calcBarLength","value","ratio","round","repeat","sizeStr","representativeValue","get","barLength","bar","padding","oldestResult","newestResult","rawDiff","rawPercent","toFixed","rawTrend","abs","gzipDiff","gzipPercent","gzipTrend"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,QAAQ;AAC1B,SAASC,UAAU,QAAQ,SAAS;AACpC,SACCC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,qBAAqB,QACf,eAAe;AACtB,SACCC,eAAe,EACfC,iBAAiB,EACjBC,eAAe,QACT,aAAa;AACpB,SAASC,mBAAmB,QAAQ,gBAAgB;AAwBpD;;;;CAIC,GACD,OAAO,SAASC,oBACfC,WAAqB,EACrBC,QAAgBH,mBAAmB;IAEnC,iEAAiE;IACjE,MAAMI,iBAAiBF,YAAYG,MAAM,CAAC,CAACC,IAAM,CAACd,WAAWc;IAC7D,OAAOF,eAAeG,KAAK,CAAC,GAAGJ;AAChC;AAEA;;CAEC,GACD,OAAO,eAAeK,aACrBC,OAAqB;IAErB,MAAM,EACLC,WAAW,EACXC,QAAQ,EACRC,OAAO,EACPC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACL,GAAGV;IAEJ,MAAMW,MAAM,IAAI9B,OAAO;QAAE0B;IAAO;IAChC,MAAMK,UAAyB,EAAE;IAEjC,4C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AK2B,GAAG,CAACC,YAAY;YACzC7C,MAAMN,IAAI,CACT,CAAC,EAAE,EAAEO,KAAK,SAAS,CAAC,EAAE8C,UAAU,EAAE,EAAEF,YAAY,IAAI,MAAM,KAAKC,YAAY,EAAE,CAAC;QAEhF;QAEA9C,MAAMN,IAAI,CACT,CAAC,EAAE,EAAEO,KAAK,QAAQ,EAAE,EAAE0C,SAAS,EAAE,EAAEH,WAAW,IAAI,MAAM,KAAKC,WAAW,EAAE,CAAC;IAE7E;IAEAzC,MAAMN,IAAI,CAAC;IAEX,OAAOM;AACR"}
|
|
1
|
+
{"version":3,"sources":["../src/trend.ts"],"sourcesContent":["import { Logger } from \"@node-cli/logger\";\nimport kleur from \"kleur\";\nimport { prerelease } from \"semver\";\nimport {\n\tcheckBundleSize,\n\tformatBytes,\n\tgetExternals,\n\tparsePackageSpecifier,\n} from \"./bundler.js\";\nimport {\n\tgetCachedResult,\n\tnormalizeCacheKey,\n\tsetCachedResult,\n} from \"./cache.js\";\nimport { TREND_VERSION_COUNT } from \"./defaults.js\";\n\nexport type TrendResult = {\n\tversion: string;\n\trawSize: number;\n\t/**\n\t * Gzip size in bytes, or null for node platform.\n\t */\n\tgzipSize: number | null;\n};\n\nexport type TrendOptions = {\n\tpackageName: string;\n\tversions: string[];\n\texports?: string[];\n\tadditionalExternals?: string[];\n\tnoExternal?: boolean;\n\tgzipLevel?: number;\n\tboring?: boolean;\n\tregistry?: string;\n\t/**\n\t * Target platform. If undefined, auto-detects from package.json engines.\n\t */\n\tplatform?: \"browser\" | \"node\";\n\t/**\n\t * Bypass cache and force re-fetch/re-calculation.\n\t */\n\tforce?: boolean;\n};\n\n/**\n * Select versions for trend analysis Returns the most recent stable versions\n * (newest first) Filters out prerelease versions (canary, alpha, beta, rc,\n * etc.)\n */\nexport function selectTrendVersions(\n\tallVersions: string[],\n\tcount: number = TREND_VERSION_COUNT,\n): string[] {\n\t// Filter out prerelease versions (canary, alpha, beta, rc, etc.)\n\tconst stableVersions = allVersions.filter((v) => !prerelease(v));\n\treturn stableVersions.slice(0, count);\n}\n\n/**\n * Analyze bundle size trend across multiple versions.\n */\nexport async function analyzeTrend(\n\toptions: TrendOptions,\n): Promise<TrendResult[]> {\n\tconst {\n\t\tpackageName,\n\t\tversions,\n\t\texports,\n\t\tadditionalExternals,\n\t\tnoExternal,\n\t\tgzipLevel,\n\t\tboring,\n\t\tregistry,\n\t\tplatform,\n\t\tforce,\n\t} = options;\n\n\tconst log = new Logger({ boring });\n\tconst results: TrendResult[] = [];\n\n\t// Parse base package name (without version).\n\tconst { name: baseName } = parsePackageSpecifier(packageName);\n\n\t// Compute externals for cache key (same logic as bundler).\n\tconst externals = getExternals(baseName, additionalExternals, noExternal);\n\n\tfor (const version of versions) {\n\t\tconst versionedPackage = `${packageName}@${version}`;\n\n\t\t/**\n\t\t * Build cache key for this version.\n\t\t * NOTE: platform can be undefined (auto-detect), which is stored as \"auto\" in cache.\n\t\t */\n\t\tconst cacheKey = normalizeCacheKey({\n\t\t\tpackageName: baseName,\n\t\t\tversion,\n\t\t\texports,\n\t\t\tplatform,\n\t\t\tgzipLevel: gzipLevel ?? 5,\n\t\t\texternals,\n\t\t\tnoExternal: noExternal ?? false,\n\t\t});\n\n\t\t// Check cache first (unless --force flag is set).\n\t\tif (!force) {\n\t\t\tconst cached = getCachedResult(cacheKey);\n\t\t\tif (cached) {\n\t\t\t\tlog.info(` Checking ${version}... (cached)`);\n\t\t\t\tresults.push({\n\t\t\t\t\tversion,\n\t\t\t\t\trawSize: cached.rawSize,\n\t\t\t\t\tgzipSize: cached.gzipSize,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tlog.info(` Checking ${version}...`);\n\n\t\ttry {\n\t\t\tconst result = await checkBundleSize({\n\t\t\t\tpackageName: versionedPackage,\n\t\t\t\texports,\n\t\t\t\tadditionalExternals,\n\t\t\t\tnoExternal,\n\t\t\t\tgzipLevel,\n\t\t\t\tregistry,\n\t\t\t\tplatform,\n\t\t\t});\n\n\t\t\t// Store result in cache.\n\t\t\tsetCachedResult(cacheKey, result);\n\n\t\t\tresults.push({\n\t\t\t\tversion,\n\t\t\t\trawSize: result.rawSize,\n\t\t\t\tgzipSize: result.gzipSize,\n\t\t\t});\n\t\t} catch {\n\t\t\t// Skip versions that fail to analyze.\n\t\t\tlog.info(` Skipping ${version} (failed to analyze)`);\n\t\t}\n\t}\n\n\treturn results;\n}\n\n/**\n * Render a bar graph showing bundle size trend.\n */\nexport function renderTrendGraph(\n\tpackageName: string,\n\tresults: TrendResult[],\n\tboring: boolean = false,\n): string[] {\n\tif (results.length === 0) {\n\t\treturn [\"No data to display\"];\n\t}\n\n\tconst lines: string[] = [];\n\n\t// Color helper (respects boring flag).\n\tconst blue = (text: string) => (boring ? text : kleur.blue(text));\n\n\t// Check if gzip data is available (null for node platform).\n\tconst hasGzipData = results.some((r) => r.gzipSize !== null);\n\n\t/**\n\t * Create maps from formatted string to representative value This ensures\n\t * values that display the same get the same bar length.\n\t */\n\tconst gzipFormattedToValue = new Map<string, number>();\n\tconst rawFormattedToValue = new Map<string, number>();\n\n\tfor (const result of results) {\n\t\tif (hasGzipData && result.gzipSize !== null) {\n\t\t\tconst gzipFormatted = formatBytes(result.gzipSize);\n\t\t\t// Use first occurrence as representative value for each formatted string.\n\t\t\tif (!gzipFormattedToValue.has(gzipFormatted)) {\n\t\t\t\tgzipFormattedToValue.set(gzipFormatted, result.gzipSize);\n\t\t\t}\n\t\t}\n\t\tconst rawFormatted = formatBytes(result.rawSize);\n\t\tif (!rawFormattedToValue.has(rawFormatted)) {\n\t\t\trawFormattedToValue.set(rawFormatted, result.rawSize);\n\t\t}\n\t}\n\n\t// Get unique representative values for min/max calculation.\n\tconst uniqueGzipValues = [...gzipFormattedToValue.values()];\n\tconst uniqueRawValues = [...rawFormattedToValue.values()];\n\n\tconst minGzipSize = hasGzipData ? Math.min(...uniqueGzipValues) : 0;\n\tconst maxGzipSize = hasGzipData ? Math.max(...uniqueGzipValues) : 0;\n\tconst minRawSize = Math.min(...uniqueRawValues);\n\tconst maxRawSize = Math.max(...uniqueRawValues);\n\n\t// Find max version length for alignment.\n\tconst maxVersionLen = Math.max(...results.map((r) => r.version.length));\n\n\t// Bar width (characters).\n\tconst barWidth = 30;\n\tconst minBarWidth = 10; // Minimum bar length for smallest value\n\n\t// Helper to calculate bar length with min-max scaling.\n\tconst calcBarLength = (value: number, min: number, max: number): number => {\n\t\tif (max === min) {\n\t\t\treturn barWidth; // All values are the same\n\t\t}\n\t\t// Scale from minBarWidth to barWidth based on position between min and max.\n\t\tconst ratio = (value - min) / (max - min);\n\t\treturn Math.round(minBarWidth + ratio * (barWidth - minBarWidth));\n\t};\n\n\t// Header.\n\tlines.push(\"\");\n\tlines.push(`${blue(\"Bundle Size:\")} ${packageName}`);\n\tlines.push(\"─\".repeat(60));\n\tlines.push(\"\");\n\n\t// Gzip size bars (only for browser platform).\n\tif (hasGzipData) {\n\t\tlines.push(blue(\"Gzip Size:\"));\n\t\tfor (const result of results) {\n\t\t\tif (result.gzipSize === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst sizeStr = formatBytes(result.gzipSize);\n\t\t\t/**\n\t\t\t * Use representative value for this formatted string to ensure consistent\n\t\t\t * bar length.\n\t\t\t */\n\t\t\tconst representativeValue = gzipFormattedToValue.get(sizeStr) as number;\n\t\t\tconst barLength = calcBarLength(\n\t\t\t\trepresentativeValue,\n\t\t\t\tminGzipSize,\n\t\t\t\tmaxGzipSize,\n\t\t\t);\n\t\t\tconst bar = \"▇\".repeat(barLength);\n\t\t\tconst padding = \" \".repeat(maxVersionLen - result.version.length);\n\t\t\tlines.push(` ${result.version}${padding} ${bar} ${sizeStr}`);\n\t\t}\n\n\t\tlines.push(\"\");\n\t}\n\n\t// Raw size bars.\n\tlines.push(blue(\"Raw Size:\"));\n\tfor (const result of results) {\n\t\tconst sizeStr = formatBytes(result.rawSize);\n\t\t/**\n\t\t * Use representative value for this formatted string to ensure consistent bar\n\t\t * length.\n\t\t */\n\t\tconst representativeValue = rawFormattedToValue.get(sizeStr) as number;\n\t\tconst barLength = calcBarLength(\n\t\t\trepresentativeValue,\n\t\t\tminRawSize,\n\t\t\tmaxRawSize,\n\t\t);\n\t\tconst bar = \"▇\".repeat(barLength);\n\t\tconst padding = \" \".repeat(maxVersionLen - result.version.length);\n\t\tlines.push(` ${result.version}${padding} ${bar} ${sizeStr}`);\n\t}\n\n\tlines.push(\"\");\n\n\t// Summary.\n\tconst oldestResult = results[results.length - 1];\n\tconst newestResult = results[0];\n\n\tif (results.length > 1) {\n\t\tconst rawDiff = newestResult.rawSize - oldestResult.rawSize;\n\t\tconst rawPercent = ((rawDiff / oldestResult.rawSize) * 100).toFixed(1);\n\t\tconst rawTrend =\n\t\t\trawDiff >= 0\n\t\t\t\t? `+${formatBytes(rawDiff)}`\n\t\t\t\t: `-${formatBytes(Math.abs(rawDiff))}`;\n\n\t\tlines.push(\"─\".repeat(60));\n\t\tlines.push(\n\t\t\t`Change from ${oldestResult.version} to ${newestResult.version}:`,\n\t\t);\n\n\t\t// Gzip summary (only for browser platform).\n\t\tif (\n\t\t\thasGzipData &&\n\t\t\tnewestResult.gzipSize !== null &&\n\t\t\toldestResult.gzipSize !== null\n\t\t) {\n\t\t\tconst gzipDiff = newestResult.gzipSize - oldestResult.gzipSize;\n\t\t\tconst gzipPercent = ((gzipDiff / oldestResult.gzipSize) * 100).toFixed(1);\n\t\t\tconst gzipTrend =\n\t\t\t\tgzipDiff >= 0\n\t\t\t\t\t? `+${formatBytes(gzipDiff)}`\n\t\t\t\t\t: `-${formatBytes(Math.abs(gzipDiff))}`;\n\t\t\tlines.push(\n\t\t\t\t` ${blue(\"Gzip:\")} ${gzipTrend} (${gzipDiff >= 0 ? \"+\" : \"\"}${gzipPercent}%)`,\n\t\t\t);\n\t\t}\n\n\t\tlines.push(\n\t\t\t` ${blue(\"Raw:\")} ${rawTrend} (${rawDiff >= 0 ? \"+\" : \"\"}${rawPercent}%)`,\n\t\t);\n\t}\n\n\tlines.push(\"\");\n\n\treturn lines;\n}\n"],"names":["Logger","kleur","prerelease","checkBundleSize","formatBytes","getExternals","parsePackageSpecifier","getCachedResult","normalizeCacheKey","setCachedResult","TREND_VERSION_COUNT","selectTrendVersions","allVersions","count","stableVersions","filter","v","slice","analyzeTrend","options","packageName","versions","exports","additionalExternals","noExternal","gzipLevel","boring","registry","platform","force","log","results","name","baseName","externals","version","versionedPackage","cacheKey","cached","info","push","rawSize","gzipSize","result","renderTrendGraph","length","lines","blue","text","hasGzipData","some","r","gzipFormattedToValue","Map","rawFormattedToValue","gzipFormatted","has","set","rawFormatted","uniqueGzipValues","values","uniqueRawValues","minGzipSize","Math","min","maxGzipSize","max","minRawSize","maxRawSize","maxVersionLen","map","barWidth","minBarWidth","calcBarLength","value","ratio","round","repeat","sizeStr","representativeValue","get","barLength","bar","padding","oldestResult","newestResult","rawDiff","rawPercent","toFixed","rawTrend","abs","gzipDiff","gzipPercent","gzipTrend"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,QAAQ;AAC1B,SAASC,UAAU,QAAQ,SAAS;AACpC,SACCC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,qBAAqB,QACf,eAAe;AACtB,SACCC,eAAe,EACfC,iBAAiB,EACjBC,eAAe,QACT,aAAa;AACpB,SAASC,mBAAmB,QAAQ,gBAAgB;AA8BpD;;;;CAIC,GACD,OAAO,SAASC,oBACfC,WAAqB,EACrBC,QAAgBH,mBAAmB;IAEnC,iEAAiE;IACjE,MAAMI,iBAAiBF,YAAYG,MAAM,CAAC,CAACC,IAAM,CAACd,WAAWc;IAC7D,OAAOF,eAAeG,KAAK,CAAC,GAAGJ;AAChC;AAEA;;CAEC,GACD,OAAO,eAAeK,aACrBC,OAAqB;IAErB,MAAM,EACLC,WAAW,EACXC,QAAQ,EACRC,OAAO,EACPC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,MA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AC;YACvE,MAAMK,YACLF,YAAY,IACT,CAAC,CAAC,EAAEvF,YAAYuF,WAAW,GAC3B,CAAC,CAAC,EAAEvF,YAAY2D,KAAK2B,GAAG,CAACC,YAAY;YACzC7C,MAAMN,IAAI,CACT,CAAC,EAAE,EAAEO,KAAK,SAAS,CAAC,EAAE8C,UAAU,EAAE,EAAEF,YAAY,IAAI,MAAM,KAAKC,YAAY,EAAE,CAAC;QAEhF;QAEA9C,MAAMN,IAAI,CACT,CAAC,EAAE,EAAEO,KAAK,QAAQ,EAAE,EAAE0C,SAAS,EAAE,EAAEH,WAAW,IAAI,MAAM,KAAKC,WAAW,EAAE,CAAC;IAE7E;IAEAzC,MAAMN,IAAI,CAAC;IAEX,OAAOM;AACR"}
|
package/dist/versions.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export type FetchVersionsOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function fetchPackageVersions(packageNameOrOptions: string | FetchVersionsOptions): Promise<NpmPackageInfo>;
|
|
10
10
|
/**
|
|
11
|
-
* Prompt user to select a version from available versions
|
|
11
|
+
* Prompt user to select a version from available versions.
|
|
12
12
|
*/
|
|
13
13
|
export declare function promptForVersion(packageName: string, versions: string[], tags: Record<string, string>): Promise<string>;
|
package/dist/versions.js
CHANGED
|
@@ -3,16 +3,16 @@ import { rsort } from "semver";
|
|
|
3
3
|
import { parsePackageSpecifier } from "./bundler.js";
|
|
4
4
|
import { DEFAULT_REGISTRY } from "./defaults.js";
|
|
5
5
|
export async function fetchPackageVersions(packageNameOrOptions) {
|
|
6
|
-
// Support both string (legacy) and options object
|
|
6
|
+
// Support both string (legacy) and options object.
|
|
7
7
|
const { packageName, registry } = typeof packageNameOrOptions === "string" ? {
|
|
8
8
|
packageName: packageNameOrOptions,
|
|
9
9
|
registry: undefined
|
|
10
10
|
} : packageNameOrOptions;
|
|
11
|
-
// Parse the package specifier to get just the name (without version)
|
|
11
|
+
// Parse the package specifier to get just the name (without version).
|
|
12
12
|
const { name } = parsePackageSpecifier(packageName);
|
|
13
|
-
// Use custom registry or default
|
|
13
|
+
// Use custom registry or default.
|
|
14
14
|
const registryUrl = registry || DEFAULT_REGISTRY;
|
|
15
|
-
// Ensure no trailing slash
|
|
15
|
+
// Ensure no trailing slash.
|
|
16
16
|
const baseUrl = registryUrl.replace(/\/$/, "");
|
|
17
17
|
const url = `${baseUrl}/${name}`;
|
|
18
18
|
const response = await fetch(url);
|
|
@@ -20,7 +20,7 @@ export async function fetchPackageVersions(packageNameOrOptions) {
|
|
|
20
20
|
throw new Error(`Failed to fetch package info: ${response.statusText}`);
|
|
21
21
|
}
|
|
22
22
|
const data = await response.json();
|
|
23
|
-
// Get all versions sorted by semver (newest first)
|
|
23
|
+
// Get all versions sorted by semver (newest first).
|
|
24
24
|
const versions = rsort(Object.keys(data.versions || {}));
|
|
25
25
|
// Get dist-tags (latest, next, beta, etc.)
|
|
26
26
|
const tags = data["dist-tags"] || {};
|
|
@@ -30,23 +30,25 @@ export async function fetchPackageVersions(packageNameOrOptions) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Prompt user to select a version from available versions
|
|
33
|
+
* Prompt user to select a version from available versions.
|
|
34
34
|
*/ export async function promptForVersion(packageName, versions, tags) {
|
|
35
|
-
// Build choices with tags highlighted
|
|
35
|
+
// Build choices with tags highlighted.
|
|
36
36
|
const taggedVersions = new Set(Object.values(tags));
|
|
37
37
|
const tagByVersion = Object.fromEntries(Object.entries(tags).map(([tag, ver])=>[
|
|
38
38
|
ver,
|
|
39
39
|
tag
|
|
40
40
|
]));
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Limit to most recent 20 versions for usability, but include all tagged
|
|
43
|
+
* versions.
|
|
44
|
+
*/ const recentVersions = versions.slice(0, 20);
|
|
43
45
|
const displayVersions = [
|
|
44
46
|
...new Set([
|
|
45
47
|
...Object.values(tags),
|
|
46
48
|
...recentVersions
|
|
47
49
|
])
|
|
48
50
|
];
|
|
49
|
-
// Sort so tagged versions appear first, then by version order
|
|
51
|
+
// Sort so tagged versions appear first, then by version order.
|
|
50
52
|
displayVersions.sort((a, b)=>{
|
|
51
53
|
const aTagged = taggedVersions.has(a);
|
|
52
54
|
const bTagged = taggedVersions.has(b);
|
package/dist/versions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/versions.ts"],"sourcesContent":["import select from \"@inquirer/select\";\nimport { rsort } from \"semver\";\nimport { parsePackageSpecifier } from \"./bundler.js\";\nimport { DEFAULT_REGISTRY } from \"./defaults.js\";\n\nexport type NpmPackageInfo = {\n\tversions: string[];\n\ttags: Record<string, string>;\n};\n\n/**\n * Fetch available versions for an npm package from the registry
|
|
1
|
+
{"version":3,"sources":["../src/versions.ts"],"sourcesContent":["import select from \"@inquirer/select\";\nimport { rsort } from \"semver\";\nimport { parsePackageSpecifier } from \"./bundler.js\";\nimport { DEFAULT_REGISTRY } from \"./defaults.js\";\n\nexport type NpmPackageInfo = {\n\tversions: string[];\n\ttags: Record<string, string>;\n};\n\n/**\n * Fetch available versions for an npm package from the registry.\n */\ntype NpmRegistryResponse = {\n\tversions?: Record<string, unknown>;\n\t\"dist-tags\"?: Record<string, string>;\n};\n\nexport type FetchVersionsOptions = {\n\tpackageName: string;\n\tregistry?: string;\n};\n\nexport async function fetchPackageVersions(\n\tpackageNameOrOptions: string | FetchVersionsOptions,\n): Promise<NpmPackageInfo> {\n\t// Support both string (legacy) and options object.\n\tconst { packageName, registry } =\n\t\ttypeof packageNameOrOptions === \"string\"\n\t\t\t? { packageName: packageNameOrOptions, registry: undefined }\n\t\t\t: packageNameOrOptions;\n\n\t// Parse the package specifier to get just the name (without version).\n\tconst { name } = parsePackageSpecifier(packageName);\n\n\t// Use custom registry or default.\n\tconst registryUrl = registry || DEFAULT_REGISTRY;\n\t// Ensure no trailing slash.\n\tconst baseUrl = registryUrl.replace(/\\/$/, \"\");\n\tconst url = `${baseUrl}/${name}`;\n\tconst response = await fetch(url);\n\n\tif (!response.ok) {\n\t\tthrow new Error(`Failed to fetch package info: ${response.statusText}`);\n\t}\n\n\tconst data = (await response.json()) as NpmRegistryResponse;\n\n\t// Get all versions sorted by semver (newest first).\n\tconst versions = rsort(Object.keys(data.versions || {}));\n\n\t// Get dist-tags (latest, next, beta, etc.)\n\tconst tags = data[\"dist-tags\"] || {};\n\n\treturn { versions, tags };\n}\n\n/**\n * Prompt user to select a version from available versions.\n */\nexport async function promptForVersion(\n\tpackageName: string,\n\tversions: string[],\n\ttags: Record<string, string>,\n): Promise<string> {\n\t// Build choices with tags highlighted.\n\tconst taggedVersions = new Set(Object.values(tags));\n\tconst tagByVersion = Object.fromEntries(\n\t\tObject.entries(tags).map(([tag, ver]) => [ver, tag]),\n\t);\n\n\t/**\n\t * Limit to most recent 20 versions for usability, but include all tagged\n\t * versions.\n\t */\n\tconst recentVersions = versions.slice(0, 20);\n\tconst displayVersions = [\n\t\t...new Set([...Object.values(tags), ...recentVersions]),\n\t];\n\n\t// Sort so tagged versions appear first, then by version order.\n\tdisplayVersions.sort((a, b) => {\n\t\tconst aTagged = taggedVersions.has(a);\n\t\tconst bTagged = taggedVersions.has(b);\n\t\tif (aTagged && !bTagged) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (!aTagged && bTagged) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn versions.indexOf(a) - versions.indexOf(b);\n\t});\n\n\tconst choices = displayVersions.map((ver) => {\n\t\tconst tag = tagByVersion[ver];\n\t\treturn {\n\t\t\tname: tag ? `${ver} (${tag})` : ver,\n\t\t\tvalue: ver,\n\t\t};\n\t});\n\n\tconst selectedVersion = await select({\n\t\tmessage: `Select a version for ${packageName}:`,\n\t\tchoices,\n\t\tpageSize: 15,\n\t});\n\n\treturn selectedVersion;\n}\n"],"names":["select","rsort","parsePackageSpecifier","DEFAULT_REGISTRY","fetchPackageVersions","packageNameOrOptions","packageName","registry","undefined","name","registryUrl","baseUrl","replace","url","response","fetch","ok","Error","statusText","data","json","versions","Object","keys","tags","promptForVersion","taggedVersions","Set","values","tagByVersion","fromEntries","entries","map","tag","ver","recentVersions","slice","displayVersions","sort","a","b","aTagged","has","bTagged","indexOf","choices","value","selectedVersion","message","pageSize"],"mappings":"AAAA,OAAOA,YAAY,mBAAmB;AACtC,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,gBAAgB,QAAQ,gBAAgB;AAoBjD,OAAO,eAAeC,qBACrBC,oBAAmD;IAEnD,mDAAmD;IACnD,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAC9B,OAAOF,yBAAyB,WAC7B;QAAEC,aAAaD;QAAsBE,UAAUC;IAAU,IACzDH;IAEJ,sEAAsE;IACtE,MAAM,EAAEI,IAAI,EAAE,GAAGP,sBAAsBI;IAEvC,kCAAkC;IAClC,MAAMI,cAAcH,YAAYJ;IAChC,4BAA4B;IAC5B,MAAMQ,UAAUD,YAAYE,OAAO,CAAC,OAAO;IAC3C,MAAMC,MAAM,GAAGF,QAAQ,CAAC,EAAEF,MAAM;IAChC,MAAMK,WAAW,MAAMC,MAAMF;IAE7B,IAAI,CAACC,SAASE,EAAE,EAAE;QACjB,MAAM,IAAIC,MAAM,CAAC,8BAA8B,EAAEH,SAASI,UAAU,EAAE;IACvE;IAEA,MAAMC,OAAQ,MAAML,SAASM,IAAI;IAEjC,oDAAoD;IACpD,MAAMC,WAAWpB,MAAMqB,OAAOC,IAAI,CAACJ,KAAKE,QAAQ,IAAI,CAAC;IAErD,2CAA2C;IAC3C,MAAMG,OAAOL,IAAI,CAAC,YAAY,IAAI,CAAC;IAEnC,OAAO;QAAEE;QAAUG;IAAK;AACzB;AAEA;;CAEC,GACD,OAAO,eAAeC,iBACrBnB,WAAmB,EACnBe,QAAkB,EAClBG,IAA4B;IAE5B,uCAAuC;IACvC,MAAME,iBAAiB,IAAIC,IAAIL,OAAOM,MAAM,CAACJ;IAC7C,MAAMK,eAAeP,OAAOQ,WAAW,CACtCR,OAAOS,OAAO,CAACP,MAAMQ,GAAG,CAAC,CAAC,CAACC,KAAKC,IAAI,GAAK;YAACA;YAAKD;SAAI;IAGpD;;;EAGC,GACD,MAAME,iBAAiBd,SAASe,KAAK,CAAC,GAAG;IACzC,MAAMC,kBAAkB;WACpB,IAAIV,IAAI;eAAIL,OAAOM,MAAM,CAACJ;eAAUW;SAAe;KACtD;IAED,+DAA+D;IAC/DE,gBAAgBC,IAAI,CAAC,CAACC,GAAGC;QACxB,MAAMC,UAAUf,eAAegB,GAAG,CAACH;QACnC,MAAMI,UAAUjB,eAAegB,GAAG,CAACF;QACnC,IAAIC,WAAW,CAACE,SAAS;YACxB,OAAO,CAAC;QACT;QACA,IAAI,CAACF,WAAWE,SAAS;YACxB,OAAO;QACR;QACA,OAAOtB,SAASuB,OAAO,CAACL,KAAKlB,SAASuB,OAAO,CAACJ;IAC/C;IAEA,MAAMK,UAAUR,gBAAgBL,GAAG,CAAC,CAACE;QACpC,MAAMD,MAAMJ,YAAY,CAACK,IAAI;QAC7B,OAAO;YACNzB,MAAMwB,MAAM,GAAGC,IAAI,EAAE,EAAED,IAAI,CAAC,CAAC,GAAGC;YAChCY,OAAOZ;QACR;IACD;IAEA,MAAMa,kBAAkB,MAAM/C,OAAO;QACpCgD,SAAS,CAAC,qBAAqB,EAAE1C,YAAY,CAAC,CAAC;QAC/CuC;QACAI,UAAU;IACX;IAEA,OAAOF;AACR"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-cli/bundlecheck",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"description": "CLI tool to check the bundle size of npm packages (like bundlephobia)",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
+
"main": "./dist/index.js",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
12
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/
|
|
13
|
+
"import": "./dist/index.js"
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
16
|
"bin": "dist/bundlecheck.js",
|
|
@@ -19,8 +20,7 @@
|
|
|
19
20
|
],
|
|
20
21
|
"node": ">=20",
|
|
21
22
|
"scripts": {
|
|
22
|
-
"build": "npm-run-all --serial clean build:types build:js
|
|
23
|
-
"build:barrel": "barrelsby --delete --directory dist --pattern \"**/*.d.ts\" --name \"index.d\"",
|
|
23
|
+
"build": "npm-run-all --serial clean build:types build:js",
|
|
24
24
|
"build:js": "swc --strip-leading-paths --source-maps --out-dir dist src",
|
|
25
25
|
"build:types": "tsc",
|
|
26
26
|
"clean": "rimraf dist types coverage",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"@vitest/coverage-v8": "4.0.18",
|
|
51
51
|
"vitest": "4.0.18"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "00b91b9bd59c6e8edc7f1730eef4d5042a7fb555"
|
|
54
54
|
}
|