robuild 0.1.3 → 0.1.5
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 +15 -15
- package/dist/_chunks/build-DdGjMqZ-.mjs +3 -0
- package/dist/_chunks/{build-ZPgEqYgE.mjs → build-xQVEbj8V.mjs} +162 -8
- package/dist/_chunks/manager-7_zLtHqz.mjs +3 -0
- package/dist/_chunks/{manager-DyYf90Z5.mjs → manager-uQxDLzY6.mjs} +1 -1
- package/dist/_chunks/{package-1iOPXtIh.mjs → package-D_zFqFUx.mjs} +6 -6
- package/dist/cli.mjs +1 -1
- package/dist/config.d.mts +39 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +6 -6
- package/dist/_chunks/build-DsVOIGdc.mjs +0 -3
- package/dist/_chunks/manager-CnmjrU85.mjs +0 -3
package/README.md
CHANGED
|
@@ -97,21 +97,21 @@ Visit our documentation site for detailed guides, API reference, and examples.
|
|
|
97
97
|
<!-- coverage-start -->
|
|
98
98
|
| File | Stmts | Branch | Funcs | Lines |
|
|
99
99
|
|------|-------|--------|-------|-------|
|
|
100
|
-
| **All files** | **
|
|
101
|
-
| src/build.ts |
|
|
102
|
-
| src/builders |
|
|
103
|
-
| src/config |
|
|
104
|
-
| src/config.ts | 0.00% |
|
|
105
|
-
| src/core |
|
|
106
|
-
| src/deprecated | 0.00% |
|
|
100
|
+
| **All files** | **45.60%** | **40.43%** | **45.72%** | **45.78%** |
|
|
101
|
+
| src/build.ts | 84.15% | 67.74% | 100.00% | 83.54% |
|
|
102
|
+
| src/builders | 79.83% | 71.76% | 85.19% | 79.83% |
|
|
103
|
+
| src/config | 42.31% | 26.21% | 56.67% | 42.06% |
|
|
104
|
+
| src/config.ts | 0.00% | 0.00% | 0.00% | 0.00% |
|
|
105
|
+
| src/core | 67.74% | 57.14% | 63.16% | 67.74% |
|
|
106
|
+
| src/deprecated | 0.00% | 0.00% | 0.00% | 0.00% |
|
|
107
107
|
| src/index.ts | 0.00% | 0.00% | 0.00% | 0.00% |
|
|
108
|
-
| src/plugins |
|
|
109
|
-
| src/plugins/builtin |
|
|
110
|
-
| src/plugins/extras | 0.00% |
|
|
111
|
-
| src/transforms |
|
|
112
|
-
| src/types.ts | 0.00% |
|
|
113
|
-
| src/utils |
|
|
114
|
-
| src/watch.ts |
|
|
108
|
+
| src/plugins | 7.50% | 8.33% | 18.42% | 7.63% |
|
|
109
|
+
| src/plugins/builtin | 16.46% | 18.03% | 23.08% | 16.51% |
|
|
110
|
+
| src/plugins/extras | 0.00% | 0.00% | 0.00% | 0.00% |
|
|
111
|
+
| src/transforms | 71.43% | 63.77% | 81.82% | 71.27% |
|
|
112
|
+
| src/types.ts | 0.00% | 0.00% | 0.00% | 0.00% |
|
|
113
|
+
| src/utils | 73.87% | 61.17% | 95.65% | 73.87% |
|
|
114
|
+
| src/watch.ts | 0.00% | 0.00% | 0.00% | 0.00% |
|
|
115
115
|
<!-- coverage-end -->
|
|
116
116
|
|
|
117
117
|
Run coverage locally:
|
|
@@ -132,5 +132,5 @@ pnpm test:coverage
|
|
|
132
132
|
[bundle-href]: https://bundlephobia.com/result?p=robuild
|
|
133
133
|
[license-src]: https://img.shields.io/github/license/Sunny-117/robuild.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
134
134
|
[license-href]: https://github.com/Sunny-117/robuild/blob/main/LICENSE
|
|
135
|
-
[coverage-src]: https://img.shields.io/badge/coverage-
|
|
135
|
+
[coverage-src]: https://img.shields.io/badge/coverage-45.6%25-yellow?style=flat&colorA=080f12
|
|
136
136
|
[coverage-href]: #test-coverage
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as RobuildPluginManager } from "./manager-
|
|
1
|
+
import { t as RobuildPluginManager } from "./manager-uQxDLzY6.mjs";
|
|
2
2
|
import { builtinModules } from "node:module";
|
|
3
3
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
4
|
import { colors } from "consola/utils";
|
|
@@ -8,7 +8,7 @@ import { resolveModulePath } from "exsolve";
|
|
|
8
8
|
import { parseSync } from "oxc-parser";
|
|
9
9
|
import { rolldown, watch } from "rolldown";
|
|
10
10
|
import { dts } from "rolldown-plugin-dts";
|
|
11
|
-
import { existsSync, promises, readdirSync, statSync } from "node:fs";
|
|
11
|
+
import { existsSync, promises, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
13
13
|
import { gzipSync } from "node:zlib";
|
|
14
14
|
import { minify } from "oxc-minify";
|
|
@@ -839,7 +839,7 @@ function createNodeShimsPlugin() {
|
|
|
839
839
|
return {
|
|
840
840
|
name: "node-shims",
|
|
841
841
|
transform: async (code, id) => {
|
|
842
|
-
if (
|
|
842
|
+
if (!id.endsWith(".mjs") && !id.endsWith(".js")) return null;
|
|
843
843
|
const needs = detectShimNeeds(code);
|
|
844
844
|
const shims = [];
|
|
845
845
|
if (needs.needsDirname || needs.needsRequire) shims.push(NODE_GLOBALS_SHIM);
|
|
@@ -1083,7 +1083,8 @@ async function rolldownBuild(ctx, entry, hooks, config) {
|
|
|
1083
1083
|
const res = await rolldown(formatConfig);
|
|
1084
1084
|
const formatOutDir = fullOutDir;
|
|
1085
1085
|
let entryFileName = `[name]${extension}`;
|
|
1086
|
-
if (
|
|
1086
|
+
if (entry.fileName) entryFileName = entry.fileName;
|
|
1087
|
+
else if (isMultiFormat) {
|
|
1087
1088
|
if (format === "cjs" || format === "commonjs") entryFileName = `[name].cjs`;
|
|
1088
1089
|
else if (format === "es" || format === "esm" || format === "module") entryFileName = `[name].mjs`;
|
|
1089
1090
|
else if (format === "iife" || format === "umd") entryFileName = `[name].js`;
|
|
@@ -1104,7 +1105,7 @@ async function rolldownBuild(ctx, entry, hooks, config) {
|
|
|
1104
1105
|
if (entry.sourcemap !== void 0) robuildOutputConfig.sourcemap = entry.sourcemap;
|
|
1105
1106
|
const outConfig = {
|
|
1106
1107
|
...robuildOutputConfig,
|
|
1107
|
-
...userOutputConfig
|
|
1108
|
+
...userOutputConfig
|
|
1108
1109
|
};
|
|
1109
1110
|
await hooks.rolldownOutput?.(outConfig, res, ctx);
|
|
1110
1111
|
const { output } = await res.write(outConfig);
|
|
@@ -1206,7 +1207,8 @@ function normalizeBundleInputs(input, ctx) {
|
|
|
1206
1207
|
* Unbundle mode: preserve file structure without bundling
|
|
1207
1208
|
*/
|
|
1208
1209
|
async function unbundleTransform(ctx, entry) {
|
|
1209
|
-
|
|
1210
|
+
const inputDir = entry.input;
|
|
1211
|
+
await processDirectoryUnbundled(inputDir, entry.outDir || join(ctx.pkgDir, "dist"), entry);
|
|
1210
1212
|
}
|
|
1211
1213
|
/**
|
|
1212
1214
|
* Process directory in unbundle mode
|
|
@@ -1576,6 +1578,150 @@ function convertExternal(external) {
|
|
|
1576
1578
|
return external;
|
|
1577
1579
|
}
|
|
1578
1580
|
|
|
1581
|
+
//#endregion
|
|
1582
|
+
//#region src/transforms/exports.ts
|
|
1583
|
+
/**
|
|
1584
|
+
* Generate package.json exports field based on build configuration
|
|
1585
|
+
*/
|
|
1586
|
+
function generatePackageExports(ctx, exportsConfig = { enabled: true }) {
|
|
1587
|
+
if (!exportsConfig.enabled) return {};
|
|
1588
|
+
const exports = {};
|
|
1589
|
+
const includeTypes = exportsConfig.includeTypes !== false;
|
|
1590
|
+
if (exportsConfig.custom) Object.assign(exports, exportsConfig.custom);
|
|
1591
|
+
for (const entry of ctx.entries) if (entry.type === "bundle") {
|
|
1592
|
+
const bundleEntry = entry;
|
|
1593
|
+
if (!bundleEntry.generateExports && !exportsConfig.enabled) continue;
|
|
1594
|
+
const exportEntries = generateExportFromBundleEntry(ctx.pkgDir, bundleEntry, includeTypes);
|
|
1595
|
+
for (const exportEntry of exportEntries) exports[exportEntry.key] = createExportValue(exportEntry);
|
|
1596
|
+
} else if (entry.type === "transform") {
|
|
1597
|
+
const transformEntry = entry;
|
|
1598
|
+
if (!exportsConfig.enabled) continue;
|
|
1599
|
+
const exportEntries = generateExportFromTransformEntry(ctx.pkgDir, transformEntry, includeTypes);
|
|
1600
|
+
for (const exportEntry of exportEntries) exports[exportEntry.key] = createExportValue(exportEntry);
|
|
1601
|
+
}
|
|
1602
|
+
return exports;
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Generate export entries from a bundle entry
|
|
1606
|
+
*/
|
|
1607
|
+
function generateExportFromBundleEntry(pkgDir, entry, includeTypes) {
|
|
1608
|
+
const exports = [];
|
|
1609
|
+
const inputValue = entry.input ?? entry.entry ?? "src/index.ts";
|
|
1610
|
+
const rawOutDir = entry.outDir || "dist";
|
|
1611
|
+
const outDir = isAbsolute(rawOutDir) ? relative(pkgDir, rawOutDir) : rawOutDir;
|
|
1612
|
+
const formats = Array.isArray(entry.format) ? entry.format : [entry.format || "es"];
|
|
1613
|
+
const platform = entry.platform || "node";
|
|
1614
|
+
const isMultiFormat = formats.length > 1;
|
|
1615
|
+
const inputs = normalizeInput(inputValue, pkgDir);
|
|
1616
|
+
for (const [name, _srcPath] of Object.entries(inputs)) {
|
|
1617
|
+
let exportKey;
|
|
1618
|
+
if (entry.exportPath) exportKey = entry.exportPath;
|
|
1619
|
+
else exportKey = getExportKeyFromName(name);
|
|
1620
|
+
const exportEntry = { key: exportKey };
|
|
1621
|
+
for (const format of formats) {
|
|
1622
|
+
const outputPath = `./${join(outDir, `${name}${getOutputExtension(format, isMultiFormat, platform, entry.fixedExtension)}`)}`;
|
|
1623
|
+
if (format === "es" || format === "esm" || format === "module") exportEntry.import = outputPath;
|
|
1624
|
+
else if (format === "cjs" || format === "commonjs") exportEntry.require = outputPath;
|
|
1625
|
+
else if (!exportEntry.import) exportEntry.import = outputPath;
|
|
1626
|
+
}
|
|
1627
|
+
if (includeTypes && entry.dts !== false) exportEntry.types = `./${join(outDir, `${name}${entry.fixedExtension ? ".d.mts" : ".d.mts"}`)}`;
|
|
1628
|
+
exports.push(exportEntry);
|
|
1629
|
+
}
|
|
1630
|
+
return exports;
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Generate export entries from a transform entry
|
|
1634
|
+
*/
|
|
1635
|
+
function generateExportFromTransformEntry(pkgDir, entry, includeTypes) {
|
|
1636
|
+
const exports = [];
|
|
1637
|
+
const rawOutDir = entry.outDir || "dist";
|
|
1638
|
+
const outDir = isAbsolute(rawOutDir) ? relative(pkgDir, rawOutDir) : rawOutDir;
|
|
1639
|
+
const exportEntry = {
|
|
1640
|
+
key: ".",
|
|
1641
|
+
import: `./${join(outDir, "index.mjs")}`
|
|
1642
|
+
};
|
|
1643
|
+
if (includeTypes) exportEntry.types = `./${join(outDir, "index.d.mts")}`;
|
|
1644
|
+
exports.push(exportEntry);
|
|
1645
|
+
return exports;
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Normalize input to a Record<string, string> format
|
|
1649
|
+
*/
|
|
1650
|
+
function normalizeInput(input, pkgDir) {
|
|
1651
|
+
if (typeof input === "object" && !Array.isArray(input)) {
|
|
1652
|
+
const result = {};
|
|
1653
|
+
for (const [key, value] of Object.entries(input)) result[key] = value;
|
|
1654
|
+
return result;
|
|
1655
|
+
}
|
|
1656
|
+
const result = {};
|
|
1657
|
+
const inputs = Array.isArray(input) ? input : [input];
|
|
1658
|
+
for (const src of inputs) {
|
|
1659
|
+
const name = getNameFromPath(src, pkgDir);
|
|
1660
|
+
result[name] = src;
|
|
1661
|
+
}
|
|
1662
|
+
return result;
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Get name from source path
|
|
1666
|
+
*/
|
|
1667
|
+
function getNameFromPath(srcPath, pkgDir) {
|
|
1668
|
+
let path = srcPath;
|
|
1669
|
+
if (pkgDir && isAbsolute(srcPath)) path = relative(pkgDir, srcPath);
|
|
1670
|
+
path = path.replace(/^\.\//, "");
|
|
1671
|
+
path = path.replace(/^src\//, "");
|
|
1672
|
+
path = path.replace(/\.(ts|js|tsx|jsx|mts|mjs|cts|cjs)$/, "");
|
|
1673
|
+
const dir = dirname(path);
|
|
1674
|
+
const base = basename(path);
|
|
1675
|
+
if (dir === "." || dir === "") return base;
|
|
1676
|
+
return join(dir, base);
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Get export key from entry name
|
|
1680
|
+
*/
|
|
1681
|
+
function getExportKeyFromName(name) {
|
|
1682
|
+
if (name === "index") return ".";
|
|
1683
|
+
if (name.endsWith("/index")) return `./${name.replace(/\/index$/, "")}`;
|
|
1684
|
+
return `./${name}`;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Get output file extension
|
|
1688
|
+
*/
|
|
1689
|
+
function getOutputExtension(format, isMultiFormat, platform, fixedExtension) {
|
|
1690
|
+
if (isMultiFormat) {
|
|
1691
|
+
if (format === "cjs" || format === "commonjs") return ".cjs";
|
|
1692
|
+
else if (format === "es" || format === "esm" || format === "module") return ".mjs";
|
|
1693
|
+
else if (format === "iife" || format === "umd") return ".js";
|
|
1694
|
+
}
|
|
1695
|
+
return getFormatExtension(format, platform, fixedExtension);
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Create export value from export entry
|
|
1699
|
+
*/
|
|
1700
|
+
function createExportValue(entry) {
|
|
1701
|
+
const value = {};
|
|
1702
|
+
if (entry.types) value.types = entry.types;
|
|
1703
|
+
if (entry.import) value.import = entry.import;
|
|
1704
|
+
if (entry.require) value.require = entry.require;
|
|
1705
|
+
const nonTypeKeys = Object.keys(value).filter((k) => k !== "types");
|
|
1706
|
+
if (nonTypeKeys.length === 1 && !entry.types) return value[nonTypeKeys[0]];
|
|
1707
|
+
return value;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Update package.json with generated exports
|
|
1711
|
+
*/
|
|
1712
|
+
function updatePackageJsonExports(packageRoot, exports) {
|
|
1713
|
+
const packageJsonPath = join(packageRoot, "package.json");
|
|
1714
|
+
try {
|
|
1715
|
+
const content = readFileSync(packageJsonPath, "utf-8");
|
|
1716
|
+
const packageJson = JSON.parse(content);
|
|
1717
|
+
packageJson.exports = exports;
|
|
1718
|
+
writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, "utf-8");
|
|
1719
|
+
logger.info(`${colors.cyan("Exports")} Updated package.json exports field`);
|
|
1720
|
+
} catch (error) {
|
|
1721
|
+
throw new Error(`Failed to update package.json: ${error}`);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1579
1725
|
//#endregion
|
|
1580
1726
|
//#region src/transforms/on-success.ts
|
|
1581
1727
|
const execAsync = promisify(exec);
|
|
@@ -1619,7 +1765,7 @@ function createBuildResult(entries, startTime) {
|
|
|
1619
1765
|
* Perform watch build using rolldown's built-in watch mode
|
|
1620
1766
|
*/
|
|
1621
1767
|
async function performWatchBuild(config, ctx, startTime) {
|
|
1622
|
-
const { performBuild } = await import("./build-
|
|
1768
|
+
const { performBuild } = await import("./build-DdGjMqZ-.mjs");
|
|
1623
1769
|
await performBuild(config, ctx, startTime);
|
|
1624
1770
|
const bundleEntries = (config.entries || []).filter((entry) => {
|
|
1625
1771
|
if (typeof entry === "string") return !entry.endsWith("/");
|
|
@@ -1640,7 +1786,7 @@ async function performWatchBuild(config, ctx, startTime) {
|
|
|
1640
1786
|
*/
|
|
1641
1787
|
async function startRolldownWatch(config, ctx, bundleEntries) {
|
|
1642
1788
|
logger.info("Watching for changes...");
|
|
1643
|
-
const { RobuildPluginManager } = await import("./manager-
|
|
1789
|
+
const { RobuildPluginManager } = await import("./manager-7_zLtHqz.mjs");
|
|
1644
1790
|
const watchConfigs = [];
|
|
1645
1791
|
for (const rawEntry of bundleEntries) {
|
|
1646
1792
|
const entry = typeof rawEntry === "string" ? parseEntryString(rawEntry) : rawEntry;
|
|
@@ -1823,6 +1969,14 @@ async function performBuild(config, ctx, startTime) {
|
|
|
1823
1969
|
for (const outDir of entries.map((e) => e.outDir).sort()) if (!outDirs.some((dir) => outDir.startsWith(dir))) outDirs.push(outDir);
|
|
1824
1970
|
for (const entry of entries) await (entry.type === "bundle" ? rolldownBuild(ctx, entry, hooks, config) : transformDir(ctx, entry));
|
|
1825
1971
|
await hooks.end?.(ctx);
|
|
1972
|
+
if (config.exports?.enabled) {
|
|
1973
|
+
const packageExports = generatePackageExports({
|
|
1974
|
+
pkgDir: ctx.pkgDir,
|
|
1975
|
+
config,
|
|
1976
|
+
entries
|
|
1977
|
+
}, config.exports);
|
|
1978
|
+
if (Object.keys(packageExports).length > 0 && config.exports.autoUpdate !== false) updatePackageJsonExports(ctx.pkgDir, packageExports);
|
|
1979
|
+
}
|
|
1826
1980
|
if (shouldFailOnWarnings(config.failOnWarn || false)) throw new Error("Build failed due to warnings");
|
|
1827
1981
|
const dirSize = analyzeDir(outDirs);
|
|
1828
1982
|
logger.info(colors.dim(`\nTotal: ${colors.bold(prettyBytes(dirSize.size))} (${dirSize.files} files)`));
|
|
@@ -130,7 +130,7 @@ var RobuildPluginManager = class {
|
|
|
130
130
|
*/
|
|
131
131
|
getRolldownPlugins() {
|
|
132
132
|
return this.plugins.map((plugin) => {
|
|
133
|
-
const { robuildSetup, robuildBuildStart, robuildBuildEnd, ...rolldownPlugin } = plugin;
|
|
133
|
+
const { robuildSetup: _setup, robuildBuildStart: _start, robuildBuildEnd: _end, ...rolldownPlugin } = plugin;
|
|
134
134
|
return rolldownPlugin;
|
|
135
135
|
});
|
|
136
136
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "robuild",
|
|
4
4
|
type: "module",
|
|
5
|
-
version: "0.1.
|
|
5
|
+
version: "0.1.5",
|
|
6
6
|
packageManager: "pnpm@10.11.1",
|
|
7
7
|
description: "Zero-config ESM/TS package builder. Powered by Rolldown and Oxc",
|
|
8
8
|
license: "MIT",
|
|
@@ -20,8 +20,9 @@ var package_default = {
|
|
|
20
20
|
"build:raw": "pnpm test:types && pnpm robuild",
|
|
21
21
|
"dev": "pnpm test:raw",
|
|
22
22
|
"lint": "turbo lint:raw --filter=robuild",
|
|
23
|
-
"lint:raw": "
|
|
24
|
-
"lint:fix": "automd &&
|
|
23
|
+
"lint:raw": "oxlint -c oxlint.json .",
|
|
24
|
+
"lint:fix": "automd && oxlint -c oxlint.json --fix .",
|
|
25
|
+
"format": "oxlint -c oxlint.json --fix .",
|
|
25
26
|
"robuild": "esno src/cli.ts",
|
|
26
27
|
"prepack": "pnpm build",
|
|
27
28
|
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
|
@@ -60,18 +61,17 @@ var package_default = {
|
|
|
60
61
|
"typescript": "^5.9.3"
|
|
61
62
|
},
|
|
62
63
|
devDependencies: {
|
|
63
|
-
"@antfu/eslint-config": "^7.4.3",
|
|
64
64
|
"@types/js-yaml": "^4.0.9",
|
|
65
65
|
"@types/node": "^25.2.3",
|
|
66
66
|
"@vitest/coverage-v8": "^4.0.18",
|
|
67
67
|
"automd": "^0.4.3",
|
|
68
68
|
"changelogen": "^0.6.2",
|
|
69
|
-
"eslint": "^10.0.0",
|
|
70
69
|
"esno": "^4.8.0",
|
|
71
70
|
"git-cz": "^4.9.0",
|
|
72
|
-
"
|
|
71
|
+
"oxlint": "^1.49.0",
|
|
73
72
|
"turbo": "^2.8.7",
|
|
74
73
|
"vitepress": "^1.6.4",
|
|
74
|
+
"vitepress-plugin-group-icons": "^1.7.1",
|
|
75
75
|
"vitest": "^4.0.18"
|
|
76
76
|
}
|
|
77
77
|
};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { g as logger, h as configureLogger, t as build } from "./_chunks/build-
|
|
2
|
+
import { g as logger, h as configureLogger, t as build } from "./_chunks/build-xQVEbj8V.mjs";
|
|
3
3
|
import { colors } from "consola/utils";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { loadConfig } from "c12";
|
package/dist/config.d.mts
CHANGED
|
@@ -84,6 +84,21 @@ interface _BuildEntry {
|
|
|
84
84
|
* Defaults to `dist/` if not provided.
|
|
85
85
|
*/
|
|
86
86
|
outDir?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Custom output file name.
|
|
89
|
+
*
|
|
90
|
+
* Overrides the default naming convention. Should include the file extension.
|
|
91
|
+
* Only works with single-entry builds.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* {
|
|
96
|
+
* input: './src/index.ts',
|
|
97
|
+
* fileName: 'bundle.min.js'
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
fileName?: string;
|
|
87
102
|
/**
|
|
88
103
|
* Avoid actual build but instead link to the source files.
|
|
89
104
|
*/
|
|
@@ -342,6 +357,29 @@ type BundleEntry = _BuildEntry & {
|
|
|
342
357
|
* @default false
|
|
343
358
|
*/
|
|
344
359
|
dtsOnly?: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Generate package.json exports entry for this entry.
|
|
362
|
+
*
|
|
363
|
+
* When enabled, this entry will be included in the generated exports field.
|
|
364
|
+
*
|
|
365
|
+
* @default false
|
|
366
|
+
*/
|
|
367
|
+
generateExports?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Custom export path for this entry.
|
|
370
|
+
*
|
|
371
|
+
* If not specified, the export path will be derived from the input path.
|
|
372
|
+
* Use '.' for the main export, or './subpath' for subpath exports.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* {
|
|
377
|
+
* input: './src/utils/index.ts',
|
|
378
|
+
* exportPath: './utils'
|
|
379
|
+
* }
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
exportPath?: string;
|
|
345
383
|
};
|
|
346
384
|
type TransformEntry = _BuildEntry & {
|
|
347
385
|
type: 'transform';
|
|
@@ -722,4 +760,4 @@ interface ExportsConfig {
|
|
|
722
760
|
//#region src/config.d.ts
|
|
723
761
|
declare function defineConfig(config: BuildConfig): BuildConfig;
|
|
724
762
|
//#endregion
|
|
725
|
-
export {
|
|
763
|
+
export { ExportsConfig as a, LoaderType as c, RobuildPluginFactory as d, ShimsConfig as f, BundleEntry as i, RobuildPlugin as l, BuildConfig as n, GlobImportOptions as o, TransformEntry as p, BuildEntry as r, LoaderConfig as s, defineConfig as t, RobuildPluginContext as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as ExportsConfig, c as LoaderType, d as RobuildPluginFactory, f as ShimsConfig, i as BundleEntry, l as RobuildPlugin, n as BuildConfig, o as GlobImportOptions, p as TransformEntry, r as BuildEntry, s as LoaderConfig, t as defineConfig, u as RobuildPluginContext } from "./config.mjs";
|
|
2
2
|
import { Plugin } from "rolldown";
|
|
3
3
|
|
|
4
4
|
//#region src/build.d.ts
|
|
@@ -209,4 +209,4 @@ declare class RobuildPluginManager {
|
|
|
209
209
|
updateContext(updates: Partial<RobuildPluginContext>): void;
|
|
210
210
|
}
|
|
211
211
|
//#endregion
|
|
212
|
-
export { type BuildConfig, type BuildEntry, type BundleEntry, DEFAULT_LOADERS, DEFAULT_SHIMS_CONFIG, type RobuildPlugin, RobuildPluginManager, SHEBANG_RE, type TransformEntry, build, combinePlugins, createBrowserShimsPlugin, createCjsDefaultPlugin, createGlobImportPlugin, createLoadPlugin, createLoaderPlugin, createNodeShimsPlugin, createPluginFactory, createResolvePlugin, createRobuildPlugin, createShimsPlugin, createSkipNodeModulesPlugin, createTransformPlugin, defineConfig, extendRolldownPlugin, getLoaderForFile, hasGlobImports, hasShebang, makeExecutable, nodePolyfillsPlugin, nodeProtocolPlugin, shebangPlugin, textPlugin, urlPlugin, virtualPlugin };
|
|
212
|
+
export { type BuildConfig, type BuildEntry, type BundleEntry, DEFAULT_LOADERS, DEFAULT_SHIMS_CONFIG, type ExportsConfig, type RobuildPlugin, RobuildPluginManager, SHEBANG_RE, type TransformEntry, build, combinePlugins, createBrowserShimsPlugin, createCjsDefaultPlugin, createGlobImportPlugin, createLoadPlugin, createLoaderPlugin, createNodeShimsPlugin, createPluginFactory, createResolvePlugin, createRobuildPlugin, createShimsPlugin, createSkipNodeModulesPlugin, createTransformPlugin, defineConfig, extendRolldownPlugin, getLoaderForFile, hasGlobImports, hasShebang, makeExecutable, nodePolyfillsPlugin, nodeProtocolPlugin, shebangPlugin, textPlugin, urlPlugin, virtualPlugin };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createBrowserShimsPlugin, c as SHEBANG_RE, d as shebangPlugin, f as nodeProtocolPlugin, g as logger, i as DEFAULT_SHIMS_CONFIG, l as hasShebang, m as hasGlobImports, o as createNodeShimsPlugin, p as createGlobImportPlugin, r as createSkipNodeModulesPlugin, s as createShimsPlugin, t as build, u as makeExecutable } from "./_chunks/build-
|
|
2
|
-
import { t as RobuildPluginManager } from "./_chunks/manager-
|
|
1
|
+
import { a as createBrowserShimsPlugin, c as SHEBANG_RE, d as shebangPlugin, f as nodeProtocolPlugin, g as logger, i as DEFAULT_SHIMS_CONFIG, l as hasShebang, m as hasGlobImports, o as createNodeShimsPlugin, p as createGlobImportPlugin, r as createSkipNodeModulesPlugin, s as createShimsPlugin, t as build, u as makeExecutable } from "./_chunks/build-xQVEbj8V.mjs";
|
|
2
|
+
import { t as RobuildPluginManager } from "./_chunks/manager-uQxDLzY6.mjs";
|
|
3
3
|
import { defineConfig } from "./config.mjs";
|
|
4
4
|
import { extname } from "node:path";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robuild",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"packageManager": "pnpm@10.11.1",
|
|
6
6
|
"description": "Zero-config ESM/TS package builder. Powered by Rolldown and Oxc",
|
|
7
7
|
"license": "MIT",
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"build:raw": "pnpm test:types && pnpm robuild",
|
|
22
22
|
"dev": "pnpm test:raw",
|
|
23
23
|
"lint": "turbo lint:raw --filter=robuild",
|
|
24
|
-
"lint:raw": "
|
|
25
|
-
"lint:fix": "automd &&
|
|
24
|
+
"lint:raw": "oxlint -c oxlint.json .",
|
|
25
|
+
"lint:fix": "automd && oxlint -c oxlint.json --fix .",
|
|
26
|
+
"format": "oxlint -c oxlint.json --fix .",
|
|
26
27
|
"robuild": "esno src/cli.ts",
|
|
27
28
|
"prepack": "pnpm build",
|
|
28
29
|
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
|
@@ -61,18 +62,17 @@
|
|
|
61
62
|
"typescript": "^5.9.3"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@antfu/eslint-config": "^7.4.3",
|
|
65
65
|
"@types/js-yaml": "^4.0.9",
|
|
66
66
|
"@types/node": "^25.2.3",
|
|
67
67
|
"@vitest/coverage-v8": "^4.0.18",
|
|
68
68
|
"automd": "^0.4.3",
|
|
69
69
|
"changelogen": "^0.6.2",
|
|
70
|
-
"eslint": "^10.0.0",
|
|
71
70
|
"esno": "^4.8.0",
|
|
72
71
|
"git-cz": "^4.9.0",
|
|
73
|
-
"
|
|
72
|
+
"oxlint": "^1.49.0",
|
|
74
73
|
"turbo": "^2.8.7",
|
|
75
74
|
"vitepress": "^1.6.4",
|
|
75
|
+
"vitepress-plugin-group-icons": "^1.7.1",
|
|
76
76
|
"vitest": "^4.0.18"
|
|
77
77
|
}
|
|
78
78
|
}
|