rolldown 0.10.0 → 0.10.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/dist/chunks/prompt.cjs +2 -1
- package/dist/chunks/prompt.cjs.map +1 -1
- package/dist/chunks/prompt.mjs +2 -1
- package/dist/chunks/prompt.mjs.map +1 -1
- package/dist/cli.cjs +79 -12
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +77 -10
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +147 -54
- package/dist/index.d.mts +147 -54
- package/dist/index.d.ts +147 -54
- package/dist/index.mjs +1 -1
- package/dist/shared/{rolldown.dda7e541.mjs → rolldown.04482f71.mjs} +157 -248
- package/dist/shared/rolldown.04482f71.mjs.map +1 -0
- package/dist/shared/{rolldown.63afb352.cjs → rolldown.ee864e8d.cjs} +158 -249
- package/dist/shared/rolldown.ee864e8d.cjs.map +1 -0
- package/package.json +18 -16
- package/dist/shared/rolldown.63afb352.cjs.map +0 -1
- package/dist/shared/rolldown.dda7e541.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import process$1 from 'node:process';
|
|
2
|
-
import
|
|
2
|
+
import nodePath, { sep } from 'node:path';
|
|
3
3
|
import { formatWithOptions } from 'node:util';
|
|
4
4
|
import * as tty from 'node:tty';
|
|
5
|
+
import { pathToFileURL } from 'url';
|
|
5
6
|
import { performance } from 'node:perf_hooks';
|
|
6
|
-
import { r as rolldown, a as arraify } from './shared/rolldown.
|
|
7
|
+
import { r as rolldown, a as arraify } from './shared/rolldown.04482f71.mjs';
|
|
7
8
|
import 'fs';
|
|
8
9
|
|
|
9
10
|
const LogLevels = {
|
|
@@ -1797,10 +1798,12 @@ async function loadConfig(configPath) {
|
|
|
1797
1798
|
if (!isSupportedFormat(configPath)) {
|
|
1798
1799
|
throw new Error(ERR_UNSUPPORTED_CONFIG_FORMAT);
|
|
1799
1800
|
}
|
|
1800
|
-
return import(configPath).
|
|
1801
|
+
return import(pathToFileURL(configPath).toString()).then(
|
|
1802
|
+
(config) => config.default
|
|
1803
|
+
);
|
|
1801
1804
|
}
|
|
1802
1805
|
function isSupportedFormat(configPath) {
|
|
1803
|
-
const ext =
|
|
1806
|
+
const ext = nodePath.extname(configPath);
|
|
1804
1807
|
return /\.(js|mjs)$/.test(ext);
|
|
1805
1808
|
}
|
|
1806
1809
|
|
|
@@ -1811,15 +1814,79 @@ async function bundle(configExport) {
|
|
|
1811
1814
|
}
|
|
1812
1815
|
}
|
|
1813
1816
|
async function bundleInner(options) {
|
|
1814
|
-
const
|
|
1817
|
+
const dir = options.output?.dir ?? "dist";
|
|
1818
|
+
const startTime = performance.now();
|
|
1815
1819
|
const build = await rolldown(options);
|
|
1816
|
-
await build.write(options?.output);
|
|
1817
|
-
|
|
1818
|
-
|
|
1820
|
+
const _output = await build.write(options?.output);
|
|
1821
|
+
const entTime = performance.now();
|
|
1822
|
+
const outputEntries = collectOutputEntries(_output.output);
|
|
1823
|
+
const outputLayoutSizes = collectOutputLayoutAdjustmentSizes(outputEntries);
|
|
1824
|
+
printOutputEntries(outputEntries, outputLayoutSizes, dir);
|
|
1825
|
+
consola.success(
|
|
1826
|
+
`Finished in ${colors.bold((entTime - startTime).toFixed(2))} ms`
|
|
1819
1827
|
);
|
|
1820
1828
|
}
|
|
1829
|
+
function collectOutputEntries(output) {
|
|
1830
|
+
return output.map((chunk) => ({
|
|
1831
|
+
type: chunk.type,
|
|
1832
|
+
fileName: chunk.fileName,
|
|
1833
|
+
size: chunk.type === "chunk" ? chunk.code.length : chunk.source.length
|
|
1834
|
+
}));
|
|
1835
|
+
}
|
|
1836
|
+
function collectOutputLayoutAdjustmentSizes(entries) {
|
|
1837
|
+
let longest = 0;
|
|
1838
|
+
let biggestSize = 0;
|
|
1839
|
+
for (const entry of entries) {
|
|
1840
|
+
if (entry.fileName.length > longest) {
|
|
1841
|
+
longest = entry.fileName.length;
|
|
1842
|
+
}
|
|
1843
|
+
if (entry.size > biggestSize) {
|
|
1844
|
+
biggestSize = entry.size;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
const sizePad = displaySize(biggestSize).length;
|
|
1848
|
+
return {
|
|
1849
|
+
longest,
|
|
1850
|
+
biggestSize,
|
|
1851
|
+
sizePad
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
const numberFormatter = new Intl.NumberFormat("en", {
|
|
1855
|
+
maximumFractionDigits: 2,
|
|
1856
|
+
minimumFractionDigits: 2
|
|
1857
|
+
});
|
|
1858
|
+
function displaySize(bytes) {
|
|
1859
|
+
return `${numberFormatter.format(bytes / 1e3)} kB`;
|
|
1860
|
+
}
|
|
1861
|
+
const CHUNK_GROUPS = [
|
|
1862
|
+
{ type: "asset", color: colors.green },
|
|
1863
|
+
{ type: "chunk", color: colors.cyan }
|
|
1864
|
+
];
|
|
1865
|
+
function printOutputEntries(entries, sizeAdjustment, distPath) {
|
|
1866
|
+
for (const group of CHUNK_GROUPS) {
|
|
1867
|
+
const filtered = entries.filter((e) => e.type === group.type);
|
|
1868
|
+
if (!filtered.length) {
|
|
1869
|
+
continue;
|
|
1870
|
+
}
|
|
1871
|
+
for (const entry of filtered.sort((a, z) => a.size - z.size)) {
|
|
1872
|
+
let log = colors.dim(withTrailingSlash(distPath));
|
|
1873
|
+
log += group.color(entry.fileName.padEnd(sizeAdjustment.longest + 2));
|
|
1874
|
+
log += colors.white(entry.type);
|
|
1875
|
+
log += colors.dim(
|
|
1876
|
+
` \u2502 size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`
|
|
1877
|
+
);
|
|
1878
|
+
consola.info(log);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
function withTrailingSlash(path) {
|
|
1883
|
+
if (path[path.length - 1] !== "/") {
|
|
1884
|
+
return `${path}/`;
|
|
1885
|
+
}
|
|
1886
|
+
return path;
|
|
1887
|
+
}
|
|
1821
1888
|
|
|
1822
|
-
const version = "0.10.
|
|
1889
|
+
const version = "0.10.1";
|
|
1823
1890
|
const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
1824
1891
|
|
|
1825
1892
|
const DEFAULT_CONFIG_FILENAME = "rolldown.config.js";
|
|
@@ -1858,7 +1925,7 @@ const main = defineCommand({
|
|
|
1858
1925
|
function parseArgs(args) {
|
|
1859
1926
|
const { config } = args;
|
|
1860
1927
|
const cwd = process$1.cwd();
|
|
1861
|
-
const configPath = config ?
|
|
1928
|
+
const configPath = config ? nodePath.resolve(cwd, config) : nodePath.resolve(cwd, DEFAULT_CONFIG_FILENAME);
|
|
1862
1929
|
return { configPath };
|
|
1863
1930
|
}
|
|
1864
1931
|
runMain(main);
|