robuild 0.2.1 → 0.2.3
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-CKpqg1bY.mjs → build-CNPfGUF2.mjs} +52 -35
- package/dist/_chunks/{build-DlIVMHjs.mjs → build-Dstxx_ve.mjs} +1 -1
- package/dist/_chunks/{dist-D0KplbyY.mjs → dist-BHTRvvCk.mjs} +1 -1
- package/dist/_chunks/{package-CnVlN8gc.mjs → package-DgXMIpBS.mjs} +19 -19
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/package.json +19 -19
|
@@ -611,17 +611,26 @@ function normalizeChunkFileName(chunkFileName) {
|
|
|
611
611
|
*
|
|
612
612
|
* Since rolldown 1.0.0-rc.9 removed experimental CSS bundling support,
|
|
613
613
|
* this plugin handles CSS files by:
|
|
614
|
-
* 1.
|
|
615
|
-
* 2.
|
|
616
|
-
* 3. Emitting
|
|
614
|
+
* 1. Intercepting CSS file resolution and loading them as empty JS modules
|
|
615
|
+
* 2. Tracking the importer chain to assign CSS to the correct output chunk
|
|
616
|
+
* 3. Emitting CSS asset files in generateBundle
|
|
617
617
|
*
|
|
618
618
|
* This allows CSS imports in JS/TS files to work without rolldown errors.
|
|
619
619
|
*/
|
|
620
620
|
function createBuiltinCssPlugin(options = {}) {
|
|
621
621
|
const { fileName = "style.css", splitting = true } = options;
|
|
622
622
|
const cssMap = /* @__PURE__ */ new Map();
|
|
623
|
+
const cssImporters = /* @__PURE__ */ new Map();
|
|
623
624
|
return {
|
|
624
625
|
name: "robuild:css",
|
|
626
|
+
resolveId(id, importer) {
|
|
627
|
+
if (importer && id.endsWith(".css")) {
|
|
628
|
+
const resolved = resolve(dirname(importer), id);
|
|
629
|
+
if (!cssImporters.has(resolved)) cssImporters.set(resolved, /* @__PURE__ */ new Set());
|
|
630
|
+
cssImporters.get(resolved).add(importer);
|
|
631
|
+
}
|
|
632
|
+
return null;
|
|
633
|
+
},
|
|
625
634
|
async load(id) {
|
|
626
635
|
if (!id.endsWith(".css")) return null;
|
|
627
636
|
try {
|
|
@@ -637,37 +646,43 @@ function createBuiltinCssPlugin(options = {}) {
|
|
|
637
646
|
},
|
|
638
647
|
generateBundle(_outputOptions, bundle) {
|
|
639
648
|
if (cssMap.size === 0) return;
|
|
640
|
-
if (splitting) {
|
|
641
|
-
const chunks = Object.values(bundle);
|
|
642
|
-
for (const chunk of chunks) {
|
|
643
|
-
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
644
|
-
const chunkCss = [];
|
|
645
|
-
const visited = /* @__PURE__ */ new Set();
|
|
646
|
-
function collectCss(moduleIds) {
|
|
647
|
-
for (const id of moduleIds) {
|
|
648
|
-
if (visited.has(id)) continue;
|
|
649
|
-
visited.add(id);
|
|
650
|
-
if (cssMap.has(id)) chunkCss.push(cssMap.get(id));
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
collectCss(chunk.moduleIds);
|
|
654
|
-
if (chunkCss.length > 0) {
|
|
655
|
-
const cssContent = chunkCss.join("\n");
|
|
656
|
-
const cssFileName = chunk.fileName.replace(/\.(m?js|cjs)$/, ".css");
|
|
657
|
-
this.emitFile({
|
|
658
|
-
type: "asset",
|
|
659
|
-
fileName: cssFileName,
|
|
660
|
-
source: cssContent
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
} else {
|
|
649
|
+
if (!splitting) {
|
|
665
650
|
const allCss = [...cssMap.values()].join("\n");
|
|
666
651
|
if (allCss.trim()) this.emitFile({
|
|
667
652
|
type: "asset",
|
|
668
653
|
fileName,
|
|
669
654
|
source: allCss
|
|
670
655
|
});
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
const chunks = Object.values(bundle).filter((c) => c.type === "chunk");
|
|
659
|
+
const chunkModuleIds = /* @__PURE__ */ new Map();
|
|
660
|
+
for (const chunk of chunks) chunkModuleIds.set(chunk.fileName, new Set(chunk.moduleIds));
|
|
661
|
+
function findOwnerChunks(cssId) {
|
|
662
|
+
const importers = cssImporters.get(cssId);
|
|
663
|
+
if (!importers || importers.size === 0) return chunks.filter((c) => c.isEntry).map((c) => c.fileName);
|
|
664
|
+
const ownerChunks = /* @__PURE__ */ new Set();
|
|
665
|
+
for (const [chunkFileName, moduleIds] of chunkModuleIds) for (const importerId of importers) if (moduleIds.has(importerId)) ownerChunks.add(chunkFileName);
|
|
666
|
+
if (ownerChunks.size === 0) return chunks.filter((c) => c.isEntry).map((c) => c.fileName);
|
|
667
|
+
return [...ownerChunks];
|
|
668
|
+
}
|
|
669
|
+
const chunkCssMap = /* @__PURE__ */ new Map();
|
|
670
|
+
for (const [cssId, cssContent] of cssMap) {
|
|
671
|
+
const ownerChunks = findOwnerChunks(cssId);
|
|
672
|
+
for (const chunkFileName of ownerChunks) {
|
|
673
|
+
if (!chunkCssMap.has(chunkFileName)) chunkCssMap.set(chunkFileName, []);
|
|
674
|
+
chunkCssMap.get(chunkFileName).push(cssContent);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
for (const [chunkFileName, cssList] of chunkCssMap) {
|
|
678
|
+
const cssContent = cssList.join("\n");
|
|
679
|
+
if (!cssContent.trim()) continue;
|
|
680
|
+
const cssFileName = chunkFileName.replace(/\.(m?js|cjs)$/, ".css");
|
|
681
|
+
this.emitFile({
|
|
682
|
+
type: "asset",
|
|
683
|
+
fileName: cssFileName,
|
|
684
|
+
source: cssContent
|
|
685
|
+
});
|
|
671
686
|
}
|
|
672
687
|
}
|
|
673
688
|
};
|
|
@@ -1128,7 +1143,7 @@ function normalizeWasmConfig(config) {
|
|
|
1128
1143
|
*/
|
|
1129
1144
|
async function createWasmPlugin(config) {
|
|
1130
1145
|
try {
|
|
1131
|
-
const { wasm } = await import("./dist-
|
|
1146
|
+
const { wasm } = await import("./dist-BHTRvvCk.mjs");
|
|
1132
1147
|
return wasm({
|
|
1133
1148
|
maxFileSize: config.maxFileSize,
|
|
1134
1149
|
fileName: config.fileName,
|
|
@@ -1525,9 +1540,10 @@ async function rolldownBuild(ctx, entry, hooks, config) {
|
|
|
1525
1540
|
const hasDefaultExport = parseSync(srcPath, srcContents).module.staticExports.flatMap((e) => e.entries.map((e) => e.exportName.kind === "Default" ? "default" : e.exportName.name)).includes("default");
|
|
1526
1541
|
const firstLine = srcContents.split("\n")[0];
|
|
1527
1542
|
const hasShebangLine = firstLine.startsWith("#!");
|
|
1528
|
-
|
|
1543
|
+
const relativeSrcPath = relative(dirname(distPath), srcPath);
|
|
1544
|
+
await writeFile(distPath, `${hasShebangLine ? `${firstLine}\n` : ""}export * from "${relativeSrcPath}";\n${hasDefaultExport ? `export { default } from "${relativeSrcPath}";\n` : ""}`, "utf8");
|
|
1529
1545
|
if (hasShebangLine) await makeExecutable(distPath);
|
|
1530
|
-
await writeFile(distPath.replace(/\.mjs$/, ".d.mts"), `export * from "${
|
|
1546
|
+
await writeFile(distPath.replace(/\.mjs$/, ".d.mts"), `export * from "${relativeSrcPath}";\n${hasDefaultExport ? `export { default } from "${relativeSrcPath}";\n` : ""}`, "utf8");
|
|
1531
1547
|
}
|
|
1532
1548
|
return;
|
|
1533
1549
|
}
|
|
@@ -1963,7 +1979,8 @@ async function transformModule(entryPath, entry) {
|
|
|
1963
1979
|
for (const staticImport of parsed.module.staticImports) rewriteSpecifier(staticImport.moduleRequest);
|
|
1964
1980
|
for (const staticExport of parsed.module.staticExports) for (const staticExportEntry of staticExport.entries) if (staticExportEntry.moduleRequest) rewriteSpecifier(staticExportEntry.moduleRequest);
|
|
1965
1981
|
sourceText = magicString.toString();
|
|
1966
|
-
const
|
|
1982
|
+
const relativeSrcPath = relative(entry.outDir, entryPath);
|
|
1983
|
+
const transformed = await transform(relativeSrcPath, sourceText, {
|
|
1967
1984
|
...entry.oxc,
|
|
1968
1985
|
...sourceOptions,
|
|
1969
1986
|
cwd: dirname(entryPath),
|
|
@@ -1982,7 +1999,7 @@ async function transformModule(entryPath, entry) {
|
|
|
1982
1999
|
throw error;
|
|
1983
2000
|
}
|
|
1984
2001
|
if (entry.minify) {
|
|
1985
|
-
const res = await minify(
|
|
2002
|
+
const res = await minify(relativeSrcPath, transformed.code, entry.minify === true ? {} : entry.minify);
|
|
1986
2003
|
transformed.code = res.code;
|
|
1987
2004
|
transformed.map = res.map;
|
|
1988
2005
|
}
|
|
@@ -2315,7 +2332,7 @@ function createBuildResult(entries, startTime) {
|
|
|
2315
2332
|
* Perform watch build using rolldown's built-in watch mode
|
|
2316
2333
|
*/
|
|
2317
2334
|
async function performWatchBuild(config, ctx, startTime) {
|
|
2318
|
-
const { performBuild } = await import("./build-
|
|
2335
|
+
const { performBuild } = await import("./build-Dstxx_ve.mjs");
|
|
2319
2336
|
await performBuild(config, ctx, startTime);
|
|
2320
2337
|
const bundleEntries = (config.entries || []).filter((entry) => {
|
|
2321
2338
|
if (typeof entry === "string") return !entry.endsWith("/");
|
|
@@ -2335,7 +2352,7 @@ async function performWatchBuild(config, ctx, startTime) {
|
|
|
2335
2352
|
*/
|
|
2336
2353
|
async function startRolldownWatch(config, ctx, bundleEntries) {
|
|
2337
2354
|
logger.info("Watching for changes...");
|
|
2338
|
-
const { inheritConfig } = await import("./build-
|
|
2355
|
+
const { inheritConfig } = await import("./build-Dstxx_ve.mjs");
|
|
2339
2356
|
const watchConfigs = [];
|
|
2340
2357
|
for (const rawEntry of bundleEntries) {
|
|
2341
2358
|
let entry = typeof rawEntry === "string" ? parseEntryString(rawEntry) : rawEntry;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as inheritConfig, r as performBuild } from "./build-
|
|
1
|
+
import { n as inheritConfig, r as performBuild } from "./build-CNPfGUF2.mjs";
|
|
2
2
|
export { inheritConfig, performBuild };
|
|
@@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
5
5
|
import { exactRegex, id, include, or } from "rolldown/filter";
|
|
6
|
-
//#region node_modules/.pnpm/rolldown-plugin-wasm@0.2.1_rolldown@1.0.
|
|
6
|
+
//#region node_modules/.pnpm/rolldown-plugin-wasm@0.2.1_rolldown@1.0.1/node_modules/rolldown-plugin-wasm/dist/index.mjs
|
|
7
7
|
const HELPERS_ID = "\0wasm-helpers.js";
|
|
8
8
|
const nodeFilePath = `
|
|
9
9
|
const { readFile } = process.getBuiltinModule('fs/promises')
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "robuild",
|
|
4
4
|
type: "module",
|
|
5
|
-
version: "0.2.
|
|
5
|
+
version: "0.2.3",
|
|
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",
|
|
@@ -43,44 +43,44 @@ var package_default = {
|
|
|
43
43
|
"prepare": "husky"
|
|
44
44
|
},
|
|
45
45
|
dependencies: {
|
|
46
|
-
"c12": "4.0.0-beta.
|
|
46
|
+
"c12": "4.0.0-beta.5",
|
|
47
47
|
"cac": "^7.0.0",
|
|
48
48
|
"chokidar": "^5.0.0",
|
|
49
49
|
"consola": "^3.4.2",
|
|
50
50
|
"exsolve": "^1.0.8",
|
|
51
51
|
"glob": "^13.0.6",
|
|
52
|
-
"jiti": "^2.
|
|
52
|
+
"jiti": "^2.7.0",
|
|
53
53
|
"js-yaml": "^4.1.1",
|
|
54
54
|
"magic-string": "^0.30.21",
|
|
55
|
-
"minimatch": "^10.2.
|
|
56
|
-
"oxc-minify": "^0.
|
|
57
|
-
"oxc-parser": "^0.
|
|
58
|
-
"oxc-transform": "^0.
|
|
55
|
+
"minimatch": "^10.2.5",
|
|
56
|
+
"oxc-minify": "^0.131.0",
|
|
57
|
+
"oxc-parser": "^0.131.0",
|
|
58
|
+
"oxc-transform": "^0.131.0",
|
|
59
59
|
"pretty-bytes": "^7.1.0",
|
|
60
|
-
"rolldown": "1.0.
|
|
61
|
-
"rolldown-plugin-dts": "^0.
|
|
62
|
-
"tinyglobby": "^0.2.
|
|
63
|
-
"typescript": "^
|
|
60
|
+
"rolldown": "1.0.1",
|
|
61
|
+
"rolldown-plugin-dts": "^0.25.1",
|
|
62
|
+
"tinyglobby": "^0.2.16",
|
|
63
|
+
"typescript": "^6.0.3"
|
|
64
64
|
},
|
|
65
65
|
devDependencies: {
|
|
66
66
|
"@types/js-yaml": "^4.0.9",
|
|
67
|
-
"@types/node": "^25.
|
|
68
|
-
"@vitest/coverage-v8": "^4.1.
|
|
67
|
+
"@types/node": "^25.8.0",
|
|
68
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
69
69
|
"automd": "^0.4.3",
|
|
70
70
|
"changelogen": "^0.6.2",
|
|
71
71
|
"esno": "^4.8.0",
|
|
72
72
|
"git-cz": "^4.9.0",
|
|
73
73
|
"husky": "^9.1.7",
|
|
74
74
|
"lightningcss": "^1.32.0",
|
|
75
|
-
"lint-staged": "^
|
|
76
|
-
"oxlint": "^1.
|
|
75
|
+
"lint-staged": "^17.0.4",
|
|
76
|
+
"oxlint": "^1.65.0",
|
|
77
77
|
"rolldown-plugin-wasm": "^0.2.1",
|
|
78
|
-
"turbo": "^2.
|
|
78
|
+
"turbo": "^2.9.14",
|
|
79
79
|
"unplugin-lightningcss": "^0.4.5",
|
|
80
|
-
"vite": "^
|
|
80
|
+
"vite": "^7.3.3",
|
|
81
81
|
"vitepress": "^1.6.4",
|
|
82
|
-
"vitepress-plugin-group-icons": "^1.7.
|
|
83
|
-
"vitest": "^4.1.
|
|
82
|
+
"vitepress-plugin-group-icons": "^1.7.5",
|
|
83
|
+
"vitest": "^4.1.6"
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
//#endregion
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as configureLogger, t as build, v as logger } from "./_chunks/build-
|
|
2
|
+
import { _ as configureLogger, t as build, v as logger } from "./_chunks/build-CNPfGUF2.mjs";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { colors } from "consola/utils";
|
|
5
5
|
import process from "node:process";
|
package/dist/index.d.mts
CHANGED
|
@@ -248,9 +248,9 @@ declare function createCssCodeSplitPlugin(config: Pick<Required<CssOptions>, 'sp
|
|
|
248
248
|
*
|
|
249
249
|
* Since rolldown 1.0.0-rc.9 removed experimental CSS bundling support,
|
|
250
250
|
* this plugin handles CSS files by:
|
|
251
|
-
* 1.
|
|
252
|
-
* 2.
|
|
253
|
-
* 3. Emitting
|
|
251
|
+
* 1. Intercepting CSS file resolution and loading them as empty JS modules
|
|
252
|
+
* 2. Tracking the importer chain to assign CSS to the correct output chunk
|
|
253
|
+
* 3. Emitting CSS asset files in generateBundle
|
|
254
254
|
*
|
|
255
255
|
* This allows CSS imports in JS/TS files to work without rolldown errors.
|
|
256
256
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as resolveCssOptions, S as esbuildTargetToLightningCSS, a as createSkipNodeModulesPlugin, b as createCssCodeSplitPlugin, 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 createLightningCSSPlugin, y as createBuiltinCssPlugin } from "./_chunks/build-
|
|
1
|
+
import { C as resolveCssOptions, S as esbuildTargetToLightningCSS, a as createSkipNodeModulesPlugin, b as createCssCodeSplitPlugin, 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 createLightningCSSPlugin, y as createBuiltinCssPlugin } from "./_chunks/build-CNPfGUF2.mjs";
|
|
2
2
|
import { t as defineConfig } from "./_chunks/config-DnVMMWOP.mjs";
|
|
3
3
|
import { extname } from "node:path";
|
|
4
4
|
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.2.
|
|
4
|
+
"version": "0.2.3",
|
|
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",
|
|
@@ -44,43 +44,43 @@
|
|
|
44
44
|
"prepare": "husky"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"c12": "4.0.0-beta.
|
|
47
|
+
"c12": "4.0.0-beta.5",
|
|
48
48
|
"cac": "^7.0.0",
|
|
49
49
|
"chokidar": "^5.0.0",
|
|
50
50
|
"consola": "^3.4.2",
|
|
51
51
|
"exsolve": "^1.0.8",
|
|
52
52
|
"glob": "^13.0.6",
|
|
53
|
-
"jiti": "^2.
|
|
53
|
+
"jiti": "^2.7.0",
|
|
54
54
|
"js-yaml": "^4.1.1",
|
|
55
55
|
"magic-string": "^0.30.21",
|
|
56
|
-
"minimatch": "^10.2.
|
|
57
|
-
"oxc-minify": "^0.
|
|
58
|
-
"oxc-parser": "^0.
|
|
59
|
-
"oxc-transform": "^0.
|
|
56
|
+
"minimatch": "^10.2.5",
|
|
57
|
+
"oxc-minify": "^0.131.0",
|
|
58
|
+
"oxc-parser": "^0.131.0",
|
|
59
|
+
"oxc-transform": "^0.131.0",
|
|
60
60
|
"pretty-bytes": "^7.1.0",
|
|
61
|
-
"rolldown": "1.0.
|
|
62
|
-
"rolldown-plugin-dts": "^0.
|
|
63
|
-
"tinyglobby": "^0.2.
|
|
64
|
-
"typescript": "^
|
|
61
|
+
"rolldown": "1.0.1",
|
|
62
|
+
"rolldown-plugin-dts": "^0.25.1",
|
|
63
|
+
"tinyglobby": "^0.2.16",
|
|
64
|
+
"typescript": "^6.0.3"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/js-yaml": "^4.0.9",
|
|
68
|
-
"@types/node": "^25.
|
|
69
|
-
"@vitest/coverage-v8": "^4.1.
|
|
68
|
+
"@types/node": "^25.8.0",
|
|
69
|
+
"@vitest/coverage-v8": "^4.1.6",
|
|
70
70
|
"automd": "^0.4.3",
|
|
71
71
|
"changelogen": "^0.6.2",
|
|
72
72
|
"esno": "^4.8.0",
|
|
73
73
|
"git-cz": "^4.9.0",
|
|
74
74
|
"husky": "^9.1.7",
|
|
75
75
|
"lightningcss": "^1.32.0",
|
|
76
|
-
"lint-staged": "^
|
|
77
|
-
"oxlint": "^1.
|
|
76
|
+
"lint-staged": "^17.0.4",
|
|
77
|
+
"oxlint": "^1.65.0",
|
|
78
78
|
"rolldown-plugin-wasm": "^0.2.1",
|
|
79
|
-
"turbo": "^2.
|
|
79
|
+
"turbo": "^2.9.14",
|
|
80
80
|
"unplugin-lightningcss": "^0.4.5",
|
|
81
|
-
"vite": "^
|
|
81
|
+
"vite": "^7.3.3",
|
|
82
82
|
"vitepress": "^1.6.4",
|
|
83
|
-
"vitepress-plugin-group-icons": "^1.7.
|
|
84
|
-
"vitest": "^4.1.
|
|
83
|
+
"vitepress-plugin-group-icons": "^1.7.5",
|
|
84
|
+
"vitest": "^4.1.6"
|
|
85
85
|
}
|
|
86
86
|
}
|