robuild 0.1.10 → 0.1.11
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/{build-CGYlmT8l.mjs → build--tBh0Drv.mjs} +231 -75
- package/dist/_chunks/build-CJFQ6BGl.mjs +3 -0
- package/dist/_chunks/{package-BDBL-BH1.mjs → package-0FiBABsk.mjs} +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/config.mjs +1 -1
- package/dist/index.mjs +2 -3
- package/package.json +1 -1
- package/dist/_chunks/build-Bw6PbOSI.mjs +0 -3
- package/dist/_chunks/manager-7_zLtHqz.mjs +0 -3
- package/dist/_chunks/manager-uQxDLzY6.mjs +0 -155
- /package/dist/_chunks/{config-BlC5U5aX.mjs → config-BGTiuDLt.mjs} +0 -0
- /package/dist/_chunks/{dist-fY5yKI94.mjs → dist-Dg_s5x2F.mjs} +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { t as RobuildPluginManager } from "./manager-uQxDLzY6.mjs";
|
|
2
1
|
import { builtinModules } from "node:module";
|
|
3
2
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
3
|
import { colors } from "consola/utils";
|
|
@@ -1078,7 +1077,7 @@ function normalizeWasmConfig(config) {
|
|
|
1078
1077
|
*/
|
|
1079
1078
|
async function createWasmPlugin(config) {
|
|
1080
1079
|
try {
|
|
1081
|
-
const { wasm } = await import("./dist-
|
|
1080
|
+
const { wasm } = await import("./dist-Dg_s5x2F.mjs");
|
|
1082
1081
|
return wasm({
|
|
1083
1082
|
maxFileSize: config.maxFileSize,
|
|
1084
1083
|
fileName: config.fileName,
|
|
@@ -1091,6 +1090,160 @@ async function createWasmPlugin(config) {
|
|
|
1091
1090
|
}
|
|
1092
1091
|
}
|
|
1093
1092
|
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/plugins/manager.ts
|
|
1095
|
+
/**
|
|
1096
|
+
* Simplified plugin manager that leverages rolldown's plugin system
|
|
1097
|
+
*/
|
|
1098
|
+
var RobuildPluginManager = class {
|
|
1099
|
+
plugins = [];
|
|
1100
|
+
context;
|
|
1101
|
+
constructor(config, entry, pkgDir) {
|
|
1102
|
+
this.context = {
|
|
1103
|
+
config,
|
|
1104
|
+
entry,
|
|
1105
|
+
pkgDir,
|
|
1106
|
+
outDir: entry.outDir || "dist",
|
|
1107
|
+
format: entry.format || "es",
|
|
1108
|
+
platform: entry.platform || "node",
|
|
1109
|
+
target: entry.target || "es2022"
|
|
1110
|
+
};
|
|
1111
|
+
this.plugins = this.normalizePlugins(config.plugins || []);
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Normalize plugin options to RobuildPlugin instances
|
|
1115
|
+
*/
|
|
1116
|
+
normalizePlugins(pluginOptions) {
|
|
1117
|
+
return pluginOptions.map((pluginOption) => this.normalizePlugin(pluginOption));
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Normalize a single plugin option
|
|
1121
|
+
*/
|
|
1122
|
+
normalizePlugin(pluginOption) {
|
|
1123
|
+
if (typeof pluginOption === "function") return this.normalizePlugin(pluginOption());
|
|
1124
|
+
if (typeof pluginOption === "object" && pluginOption !== null) {
|
|
1125
|
+
if (this.isRobuildPlugin(pluginOption)) return pluginOption;
|
|
1126
|
+
if (this.isRolldownPlugin(pluginOption)) return this.adaptRolldownPlugin(pluginOption);
|
|
1127
|
+
if (this.isVitePlugin(pluginOption)) return this.adaptVitePlugin(pluginOption);
|
|
1128
|
+
if (this.isUnplugin(pluginOption)) return this.adaptUnplugin(pluginOption);
|
|
1129
|
+
return this.adaptRolldownPlugin(pluginOption);
|
|
1130
|
+
}
|
|
1131
|
+
throw new Error(`Invalid plugin option: ${typeof pluginOption}`);
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Check if plugin is already a RobuildPlugin
|
|
1135
|
+
*/
|
|
1136
|
+
isRobuildPlugin(plugin) {
|
|
1137
|
+
return plugin.meta?.robuild === true || plugin.robuildSetup || plugin.robuildBuildStart || plugin.robuildBuildEnd;
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Check if plugin is a rolldown/rollup plugin
|
|
1141
|
+
*/
|
|
1142
|
+
isRolldownPlugin(plugin) {
|
|
1143
|
+
return plugin.name && (plugin.buildStart || plugin.buildEnd || plugin.resolveId || plugin.load || plugin.transform || plugin.generateBundle || plugin.writeBundle);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Check if plugin is a Vite plugin
|
|
1147
|
+
*/
|
|
1148
|
+
isVitePlugin(plugin) {
|
|
1149
|
+
return plugin.config || plugin.configResolved || plugin.configureServer || plugin.meta?.vite === true;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Check if plugin is an Unplugin
|
|
1153
|
+
*/
|
|
1154
|
+
isUnplugin(plugin) {
|
|
1155
|
+
return plugin.unplugin === true || plugin.meta?.unplugin === true;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Adapt rolldown plugin to RobuildPlugin
|
|
1159
|
+
*/
|
|
1160
|
+
adaptRolldownPlugin(plugin) {
|
|
1161
|
+
return {
|
|
1162
|
+
...plugin,
|
|
1163
|
+
meta: {
|
|
1164
|
+
...plugin.meta,
|
|
1165
|
+
framework: "rolldown",
|
|
1166
|
+
robuild: true,
|
|
1167
|
+
rollup: true
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Adapt Vite plugin to RobuildPlugin
|
|
1173
|
+
*/
|
|
1174
|
+
adaptVitePlugin(plugin) {
|
|
1175
|
+
return {
|
|
1176
|
+
...plugin,
|
|
1177
|
+
meta: {
|
|
1178
|
+
...plugin.meta,
|
|
1179
|
+
framework: "vite",
|
|
1180
|
+
robuild: true,
|
|
1181
|
+
vite: true
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Adapt Unplugin to RobuildPlugin
|
|
1187
|
+
*/
|
|
1188
|
+
adaptUnplugin(plugin) {
|
|
1189
|
+
return {
|
|
1190
|
+
...plugin,
|
|
1191
|
+
meta: {
|
|
1192
|
+
...plugin.meta,
|
|
1193
|
+
framework: "unplugin",
|
|
1194
|
+
robuild: true,
|
|
1195
|
+
unplugin: true,
|
|
1196
|
+
rollup: true,
|
|
1197
|
+
vite: true,
|
|
1198
|
+
webpack: true,
|
|
1199
|
+
esbuild: true
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Initialize robuild-specific plugin hooks
|
|
1205
|
+
*/
|
|
1206
|
+
async initializeRobuildHooks() {
|
|
1207
|
+
for (const plugin of this.plugins) if (plugin.robuildSetup) await plugin.robuildSetup(this.context);
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Execute robuild buildStart hooks
|
|
1211
|
+
*/
|
|
1212
|
+
async executeRobuildBuildStart() {
|
|
1213
|
+
for (const plugin of this.plugins) if (plugin.robuildBuildStart) await plugin.robuildBuildStart(this.context);
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Execute robuild buildEnd hooks
|
|
1217
|
+
*/
|
|
1218
|
+
async executeRobuildBuildEnd(result) {
|
|
1219
|
+
for (const plugin of this.plugins) if (plugin.robuildBuildEnd) await plugin.robuildBuildEnd(this.context, result);
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Get rolldown-compatible plugins for direct use
|
|
1223
|
+
*/
|
|
1224
|
+
getRolldownPlugins() {
|
|
1225
|
+
return this.plugins.map((plugin) => {
|
|
1226
|
+
const { robuildSetup: _setup, robuildBuildStart: _start, robuildBuildEnd: _end, ...rolldownPlugin } = plugin;
|
|
1227
|
+
return rolldownPlugin;
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Get all plugins
|
|
1232
|
+
*/
|
|
1233
|
+
getPlugins() {
|
|
1234
|
+
return this.plugins;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Update context (useful when build parameters change)
|
|
1238
|
+
*/
|
|
1239
|
+
updateContext(updates) {
|
|
1240
|
+
this.context = {
|
|
1241
|
+
...this.context,
|
|
1242
|
+
...updates
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1094
1247
|
//#endregion
|
|
1095
1248
|
//#region src/transforms/banner.ts
|
|
1096
1249
|
/**
|
|
@@ -1184,7 +1337,11 @@ async function copyFiles(cwd, outDir, copyOptions) {
|
|
|
1184
1337
|
|
|
1185
1338
|
//#endregion
|
|
1186
1339
|
//#region src/builders/bundle.ts
|
|
1187
|
-
|
|
1340
|
+
/**
|
|
1341
|
+
* Create rolldown InputOptions config for a bundle entry.
|
|
1342
|
+
* This is shared between build mode and watch mode to ensure consistent behavior.
|
|
1343
|
+
*/
|
|
1344
|
+
async function createBundleInputConfig(ctx, entry, config) {
|
|
1188
1345
|
const entryInput = getBundleEntryInput(entry);
|
|
1189
1346
|
if (!entryInput) throw new Error("Entry input is required");
|
|
1190
1347
|
const inputs = normalizeBundleInputs(entryInput, ctx);
|
|
@@ -1202,29 +1359,6 @@ async function rolldownBuild(ctx, entry, hooks, config) {
|
|
|
1202
1359
|
target,
|
|
1203
1360
|
outDir: fullOutDir
|
|
1204
1361
|
});
|
|
1205
|
-
await pluginManager.executeRobuildBuildStart();
|
|
1206
|
-
await cleanOutputDir(ctx.pkgDir, fullOutDir, entry.clean ?? true);
|
|
1207
|
-
if (entry.dtsOnly) {
|
|
1208
|
-
logger.info("Running in dtsOnly mode - only generating declaration files");
|
|
1209
|
-
entry.dts = entry.dts === false ? true : entry.dts || true;
|
|
1210
|
-
formats.length = 0;
|
|
1211
|
-
formats.push("esm");
|
|
1212
|
-
}
|
|
1213
|
-
if (entry.stub) {
|
|
1214
|
-
for (const [distName, srcPath] of Object.entries(inputs)) {
|
|
1215
|
-
const distPath = join(ctx.pkgDir, "dist", `${distName}.mjs`);
|
|
1216
|
-
await mkdir(dirname(distPath), { recursive: true });
|
|
1217
|
-
logger.log(`${colors.cyan("Stub")} ${colors.green(fmtPath(distPath))}`);
|
|
1218
|
-
const srcContents = await readFile(srcPath, "utf8");
|
|
1219
|
-
const hasDefaultExport = parseSync(srcPath, srcContents).module.staticExports.flatMap((e) => e.entries.map((e) => e.exportName.kind === "Default" ? "default" : e.exportName.name)).includes("default");
|
|
1220
|
-
const firstLine = srcContents.split("\n")[0];
|
|
1221
|
-
const hasShebangLine = firstLine.startsWith("#!");
|
|
1222
|
-
await writeFile(distPath, `${hasShebangLine ? `${firstLine}\n` : ""}export * from "${srcPath}";\n${hasDefaultExport ? `export { default } from "${srcPath}";\n` : ""}`, "utf8");
|
|
1223
|
-
if (hasShebangLine) await makeExecutable(distPath);
|
|
1224
|
-
await writeFile(distPath.replace(/\.mjs$/, ".d.mts"), `export * from "${srcPath}";\n${hasDefaultExport ? `export { default } from "${srcPath}";\n` : ""}`, "utf8");
|
|
1225
|
-
}
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
1362
|
const externalConfig = resolveExternalConfig(ctx, {
|
|
1229
1363
|
external: entry.external,
|
|
1230
1364
|
noExternal: entry.noExternal
|
|
@@ -1282,7 +1416,7 @@ async function rolldownBuild(ctx, entry, hooks, config) {
|
|
|
1282
1416
|
if (cssSplitPlugin) rolldownPlugins.push(cssSplitPlugin);
|
|
1283
1417
|
rolldownPlugins.push(...pluginManager.getRolldownPlugins());
|
|
1284
1418
|
const moduleTypes = {};
|
|
1285
|
-
if (entry.loaders) for (const [ext,
|
|
1419
|
+
if (entry.loaders) for (const [ext, loaderConfig] of Object.entries(entry.loaders)) moduleTypes[ext] = loaderConfig.loader;
|
|
1286
1420
|
const robuildGeneratedConfig = {
|
|
1287
1421
|
cwd: ctx.pkgDir,
|
|
1288
1422
|
input: inputs,
|
|
@@ -1299,11 +1433,52 @@ async function rolldownBuild(ctx, entry, hooks, config) {
|
|
|
1299
1433
|
if (entry.treeshake !== void 0) if (typeof entry.treeshake === "boolean") robuildGeneratedConfig.treeshake = entry.treeshake;
|
|
1300
1434
|
else robuildGeneratedConfig.treeshake = entry.treeshake;
|
|
1301
1435
|
const { output: userOutputConfig, plugins: userPlugins, ...userRolldownConfig } = entry.rolldown || {};
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1436
|
+
return {
|
|
1437
|
+
inputConfig: {
|
|
1438
|
+
...robuildGeneratedConfig,
|
|
1439
|
+
...userRolldownConfig,
|
|
1440
|
+
plugins: [...rolldownPlugins, ...Array.isArray(userPlugins) ? userPlugins : userPlugins ? [userPlugins] : []]
|
|
1441
|
+
},
|
|
1442
|
+
pluginManager,
|
|
1443
|
+
formats,
|
|
1444
|
+
platform,
|
|
1445
|
+
target,
|
|
1446
|
+
fullOutDir,
|
|
1447
|
+
isMultiFormat,
|
|
1448
|
+
userOutputConfig
|
|
1306
1449
|
};
|
|
1450
|
+
}
|
|
1451
|
+
async function rolldownBuild(ctx, entry, hooks, config) {
|
|
1452
|
+
const entryInput = getBundleEntryInput(entry);
|
|
1453
|
+
if (!entryInput) throw new Error("Entry input is required");
|
|
1454
|
+
const inputs = normalizeBundleInputs(entryInput, ctx);
|
|
1455
|
+
const formats = Array.isArray(entry.format) ? entry.format : [entry.format || "es"];
|
|
1456
|
+
const outDir = entry.outDir || "dist";
|
|
1457
|
+
const fullOutDir = resolve(ctx.pkgDir, outDir);
|
|
1458
|
+
const { inputConfig: baseRolldownConfig, pluginManager, platform, isMultiFormat, userOutputConfig } = await createBundleInputConfig(ctx, entry, config);
|
|
1459
|
+
await pluginManager.executeRobuildBuildStart();
|
|
1460
|
+
await cleanOutputDir(ctx.pkgDir, fullOutDir, entry.clean ?? true);
|
|
1461
|
+
if (entry.dtsOnly) {
|
|
1462
|
+
logger.info("Running in dtsOnly mode - only generating declaration files");
|
|
1463
|
+
entry.dts = entry.dts === false ? true : entry.dts || true;
|
|
1464
|
+
formats.length = 0;
|
|
1465
|
+
formats.push("esm");
|
|
1466
|
+
}
|
|
1467
|
+
if (entry.stub) {
|
|
1468
|
+
for (const [distName, srcPath] of Object.entries(inputs)) {
|
|
1469
|
+
const distPath = join(ctx.pkgDir, "dist", `${distName}.mjs`);
|
|
1470
|
+
await mkdir(dirname(distPath), { recursive: true });
|
|
1471
|
+
logger.log(`${colors.cyan("Stub")} ${colors.green(fmtPath(distPath))}`);
|
|
1472
|
+
const srcContents = await readFile(srcPath, "utf8");
|
|
1473
|
+
const hasDefaultExport = parseSync(srcPath, srcContents).module.staticExports.flatMap((e) => e.entries.map((e) => e.exportName.kind === "Default" ? "default" : e.exportName.name)).includes("default");
|
|
1474
|
+
const firstLine = srcContents.split("\n")[0];
|
|
1475
|
+
const hasShebangLine = firstLine.startsWith("#!");
|
|
1476
|
+
await writeFile(distPath, `${hasShebangLine ? `${firstLine}\n` : ""}export * from "${srcPath}";\n${hasDefaultExport ? `export { default } from "${srcPath}";\n` : ""}`, "utf8");
|
|
1477
|
+
if (hasShebangLine) await makeExecutable(distPath);
|
|
1478
|
+
await writeFile(distPath.replace(/\.mjs$/, ".d.mts"), `export * from "${srcPath}";\n${hasDefaultExport ? `export { default } from "${srcPath}";\n` : ""}`, "utf8");
|
|
1479
|
+
}
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1307
1482
|
await hooks.rolldownConfig?.(baseRolldownConfig, ctx);
|
|
1308
1483
|
const filePathMap = /* @__PURE__ */ new Map();
|
|
1309
1484
|
const buildFormat = async (format) => {
|
|
@@ -2020,7 +2195,7 @@ function createBuildResult(entries, startTime) {
|
|
|
2020
2195
|
* Perform watch build using rolldown's built-in watch mode
|
|
2021
2196
|
*/
|
|
2022
2197
|
async function performWatchBuild(config, ctx, startTime) {
|
|
2023
|
-
const { performBuild } = await import("./build-
|
|
2198
|
+
const { performBuild } = await import("./build-CJFQ6BGl.mjs");
|
|
2024
2199
|
await performBuild(config, ctx, startTime);
|
|
2025
2200
|
const bundleEntries = (config.entries || []).filter((entry) => {
|
|
2026
2201
|
if (typeof entry === "string") return !entry.endsWith("/");
|
|
@@ -2035,56 +2210,37 @@ async function performWatchBuild(config, ctx, startTime) {
|
|
|
2035
2210
|
/**
|
|
2036
2211
|
* Start rolldown watch mode for bundle entries
|
|
2037
2212
|
*
|
|
2038
|
-
*
|
|
2039
|
-
*
|
|
2040
|
-
* The watch mode then monitors for file changes and triggers rebuilds.
|
|
2213
|
+
* Uses the same configuration logic as build mode via createBundleInputConfig
|
|
2214
|
+
* to ensure consistent behavior between build and watch modes.
|
|
2041
2215
|
*/
|
|
2042
2216
|
async function startRolldownWatch(config, ctx, bundleEntries) {
|
|
2043
2217
|
logger.info("Watching for changes...");
|
|
2044
|
-
const {
|
|
2218
|
+
const { inheritConfig } = await import("./build-CJFQ6BGl.mjs");
|
|
2045
2219
|
const watchConfigs = [];
|
|
2046
2220
|
for (const rawEntry of bundleEntries) {
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
if (!
|
|
2221
|
+
let entry = typeof rawEntry === "string" ? parseEntryString(rawEntry) : rawEntry;
|
|
2222
|
+
entry = inheritConfig(entry, config);
|
|
2223
|
+
if (!getBundleEntryInput(entry)) {
|
|
2050
2224
|
logger.warn("Skipping entry without input:", entry);
|
|
2051
2225
|
continue;
|
|
2052
2226
|
}
|
|
2053
|
-
const
|
|
2054
|
-
const
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
const externalConfig = resolveExternalConfig(ctx, {
|
|
2071
|
-
external: entry.external,
|
|
2072
|
-
noExternal: entry.noExternal
|
|
2073
|
-
});
|
|
2074
|
-
const watchConfig = {
|
|
2075
|
-
input: rolldownInput,
|
|
2076
|
-
output: {
|
|
2077
|
-
dir: entry.outDir,
|
|
2078
|
-
format: formatMap[rolldownFormat] || "es",
|
|
2079
|
-
entryFileNames: `[name]${extension}`,
|
|
2080
|
-
sourcemap: entry.sourcemap
|
|
2081
|
-
},
|
|
2082
|
-
platform: platform === "node" ? "node" : "neutral",
|
|
2083
|
-
external: externalConfig,
|
|
2084
|
-
transform: { target },
|
|
2085
|
-
plugins: rolldownPlugins
|
|
2086
|
-
};
|
|
2087
|
-
watchConfigs.push(watchConfig);
|
|
2227
|
+
const { inputConfig, formats, platform, fullOutDir } = await createBundleInputConfig(ctx, entry, config);
|
|
2228
|
+
for (const format of formats) {
|
|
2229
|
+
const extension = getFormatExtension(format, platform);
|
|
2230
|
+
const watchConfig = {
|
|
2231
|
+
...inputConfig,
|
|
2232
|
+
output: {
|
|
2233
|
+
dir: fullOutDir,
|
|
2234
|
+
format: format === "esm" ? "es" : format,
|
|
2235
|
+
entryFileNames: `[name]${extension}`,
|
|
2236
|
+
sourcemap: typeof entry.sourcemap === "object" ? void 0 : entry.sourcemap,
|
|
2237
|
+
minify: entry.minify,
|
|
2238
|
+
banner: entry.banner,
|
|
2239
|
+
footer: entry.footer
|
|
2240
|
+
}
|
|
2241
|
+
};
|
|
2242
|
+
watchConfigs.push(watchConfig);
|
|
2243
|
+
}
|
|
2088
2244
|
}
|
|
2089
2245
|
const watcher = watch(watchConfigs);
|
|
2090
2246
|
watcher.on("event", (event) => {
|
|
@@ -2247,4 +2403,4 @@ async function readJSON(specifier) {
|
|
|
2247
2403
|
}
|
|
2248
2404
|
|
|
2249
2405
|
//#endregion
|
|
2250
|
-
export {
|
|
2406
|
+
export { resolveCssOptions as S, configureLogger as _, createSkipNodeModulesPlugin as a, createLightningCSSPlugin as b, createNodeShimsPlugin as c, hasShebang as d, makeExecutable as f, hasGlobImports as g, createGlobImportPlugin as h, RobuildPluginManager as i, createShimsPlugin as l, nodeProtocolPlugin as m, inheritConfig as n, DEFAULT_SHIMS_CONFIG as o, shebangPlugin as p, performBuild as r, createBrowserShimsPlugin as s, build as t, SHEBANG_RE as u, logger as v, esbuildTargetToLightningCSS as x, createCssCodeSplitPlugin as y };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { _ as configureLogger, t as build, v as logger } from "./_chunks/build--tBh0Drv.mjs";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { colors } from "consola/utils";
|
|
5
5
|
import process from "node:process";
|
package/dist/config.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as defineConfig } from "./_chunks/config-BlC5U5aX.mjs";
|
|
1
|
+
import { S as resolveCssOptions, a as createSkipNodeModulesPlugin, b as createLightningCSSPlugin, c as createNodeShimsPlugin, d as hasShebang, f as makeExecutable, g as hasGlobImports, h as createGlobImportPlugin, i as RobuildPluginManager, l as createShimsPlugin, m as nodeProtocolPlugin, o as DEFAULT_SHIMS_CONFIG, p as shebangPlugin, s as createBrowserShimsPlugin, t as build, u as SHEBANG_RE, v as logger, x as esbuildTargetToLightningCSS, y as createCssCodeSplitPlugin } from "./_chunks/build--tBh0Drv.mjs";
|
|
2
|
+
import { t as defineConfig } from "./_chunks/config-BGTiuDLt.mjs";
|
|
4
3
|
import { extname } from "node:path";
|
|
5
4
|
import { readFile } from "node:fs/promises";
|
|
6
5
|
|
package/package.json
CHANGED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
//#region src/plugins/manager.ts
|
|
2
|
-
/**
|
|
3
|
-
* Simplified plugin manager that leverages rolldown's plugin system
|
|
4
|
-
*/
|
|
5
|
-
var RobuildPluginManager = class {
|
|
6
|
-
plugins = [];
|
|
7
|
-
context;
|
|
8
|
-
constructor(config, entry, pkgDir) {
|
|
9
|
-
this.context = {
|
|
10
|
-
config,
|
|
11
|
-
entry,
|
|
12
|
-
pkgDir,
|
|
13
|
-
outDir: entry.outDir || "dist",
|
|
14
|
-
format: entry.format || "es",
|
|
15
|
-
platform: entry.platform || "node",
|
|
16
|
-
target: entry.target || "es2022"
|
|
17
|
-
};
|
|
18
|
-
this.plugins = this.normalizePlugins(config.plugins || []);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Normalize plugin options to RobuildPlugin instances
|
|
22
|
-
*/
|
|
23
|
-
normalizePlugins(pluginOptions) {
|
|
24
|
-
return pluginOptions.map((pluginOption) => this.normalizePlugin(pluginOption));
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Normalize a single plugin option
|
|
28
|
-
*/
|
|
29
|
-
normalizePlugin(pluginOption) {
|
|
30
|
-
if (typeof pluginOption === "function") return this.normalizePlugin(pluginOption());
|
|
31
|
-
if (typeof pluginOption === "object" && pluginOption !== null) {
|
|
32
|
-
if (this.isRobuildPlugin(pluginOption)) return pluginOption;
|
|
33
|
-
if (this.isRolldownPlugin(pluginOption)) return this.adaptRolldownPlugin(pluginOption);
|
|
34
|
-
if (this.isVitePlugin(pluginOption)) return this.adaptVitePlugin(pluginOption);
|
|
35
|
-
if (this.isUnplugin(pluginOption)) return this.adaptUnplugin(pluginOption);
|
|
36
|
-
return this.adaptRolldownPlugin(pluginOption);
|
|
37
|
-
}
|
|
38
|
-
throw new Error(`Invalid plugin option: ${typeof pluginOption}`);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if plugin is already a RobuildPlugin
|
|
42
|
-
*/
|
|
43
|
-
isRobuildPlugin(plugin) {
|
|
44
|
-
return plugin.meta?.robuild === true || plugin.robuildSetup || plugin.robuildBuildStart || plugin.robuildBuildEnd;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check if plugin is a rolldown/rollup plugin
|
|
48
|
-
*/
|
|
49
|
-
isRolldownPlugin(plugin) {
|
|
50
|
-
return plugin.name && (plugin.buildStart || plugin.buildEnd || plugin.resolveId || plugin.load || plugin.transform || plugin.generateBundle || plugin.writeBundle);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Check if plugin is a Vite plugin
|
|
54
|
-
*/
|
|
55
|
-
isVitePlugin(plugin) {
|
|
56
|
-
return plugin.config || plugin.configResolved || plugin.configureServer || plugin.meta?.vite === true;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Check if plugin is an Unplugin
|
|
60
|
-
*/
|
|
61
|
-
isUnplugin(plugin) {
|
|
62
|
-
return plugin.unplugin === true || plugin.meta?.unplugin === true;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Adapt rolldown plugin to RobuildPlugin
|
|
66
|
-
*/
|
|
67
|
-
adaptRolldownPlugin(plugin) {
|
|
68
|
-
return {
|
|
69
|
-
...plugin,
|
|
70
|
-
meta: {
|
|
71
|
-
...plugin.meta,
|
|
72
|
-
framework: "rolldown",
|
|
73
|
-
robuild: true,
|
|
74
|
-
rollup: true
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Adapt Vite plugin to RobuildPlugin
|
|
80
|
-
*/
|
|
81
|
-
adaptVitePlugin(plugin) {
|
|
82
|
-
return {
|
|
83
|
-
...plugin,
|
|
84
|
-
meta: {
|
|
85
|
-
...plugin.meta,
|
|
86
|
-
framework: "vite",
|
|
87
|
-
robuild: true,
|
|
88
|
-
vite: true
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Adapt Unplugin to RobuildPlugin
|
|
94
|
-
*/
|
|
95
|
-
adaptUnplugin(plugin) {
|
|
96
|
-
return {
|
|
97
|
-
...plugin,
|
|
98
|
-
meta: {
|
|
99
|
-
...plugin.meta,
|
|
100
|
-
framework: "unplugin",
|
|
101
|
-
robuild: true,
|
|
102
|
-
unplugin: true,
|
|
103
|
-
rollup: true,
|
|
104
|
-
vite: true,
|
|
105
|
-
webpack: true,
|
|
106
|
-
esbuild: true
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Initialize robuild-specific plugin hooks
|
|
112
|
-
*/
|
|
113
|
-
async initializeRobuildHooks() {
|
|
114
|
-
for (const plugin of this.plugins) if (plugin.robuildSetup) await plugin.robuildSetup(this.context);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Execute robuild buildStart hooks
|
|
118
|
-
*/
|
|
119
|
-
async executeRobuildBuildStart() {
|
|
120
|
-
for (const plugin of this.plugins) if (plugin.robuildBuildStart) await plugin.robuildBuildStart(this.context);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Execute robuild buildEnd hooks
|
|
124
|
-
*/
|
|
125
|
-
async executeRobuildBuildEnd(result) {
|
|
126
|
-
for (const plugin of this.plugins) if (plugin.robuildBuildEnd) await plugin.robuildBuildEnd(this.context, result);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Get rolldown-compatible plugins for direct use
|
|
130
|
-
*/
|
|
131
|
-
getRolldownPlugins() {
|
|
132
|
-
return this.plugins.map((plugin) => {
|
|
133
|
-
const { robuildSetup: _setup, robuildBuildStart: _start, robuildBuildEnd: _end, ...rolldownPlugin } = plugin;
|
|
134
|
-
return rolldownPlugin;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Get all plugins
|
|
139
|
-
*/
|
|
140
|
-
getPlugins() {
|
|
141
|
-
return this.plugins;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Update context (useful when build parameters change)
|
|
145
|
-
*/
|
|
146
|
-
updateContext(updates) {
|
|
147
|
-
this.context = {
|
|
148
|
-
...this.context,
|
|
149
|
-
...updates
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
//#endregion
|
|
155
|
-
export { RobuildPluginManager as t };
|
|
File without changes
|
|
File without changes
|