robuild 0.0.4 → 0.0.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.
|
@@ -7,14 +7,14 @@ import prettyBytes from "pretty-bytes";
|
|
|
7
7
|
import { builtinModules } from "node:module";
|
|
8
8
|
import { defu } from "defu";
|
|
9
9
|
import { resolveModulePath } from "exsolve";
|
|
10
|
-
import
|
|
10
|
+
import { parseSync } from "oxc-parser";
|
|
11
11
|
import { rolldown } from "rolldown";
|
|
12
12
|
import { dts } from "rolldown-plugin-dts";
|
|
13
13
|
import { promises, readdirSync, statSync } from "node:fs";
|
|
14
14
|
import { gzipSync } from "node:zlib";
|
|
15
15
|
import { minify } from "oxc-minify";
|
|
16
16
|
import MagicString from "magic-string";
|
|
17
|
-
import
|
|
17
|
+
import { transform } from "oxc-transform";
|
|
18
18
|
import { glob } from "tinyglobby";
|
|
19
19
|
|
|
20
20
|
//#region src/utils.ts
|
|
@@ -132,7 +132,7 @@ async function rolldownBuild(ctx, entry, hooks) {
|
|
|
132
132
|
await mkdir(dirname(distPath), { recursive: true });
|
|
133
133
|
consola.log(`${colors.magenta("[stub bundle] ")} ${colors.underline(fmtPath(distPath))}`);
|
|
134
134
|
const srcContents = await readFile(srcPath, "utf8");
|
|
135
|
-
const parsed =
|
|
135
|
+
const parsed = parseSync(srcPath, srcContents);
|
|
136
136
|
const exportNames = parsed.module.staticExports.flatMap((e) => e.entries.map((e$1) => e$1.exportName.kind === "Default" ? "default" : e$1.exportName.name));
|
|
137
137
|
const hasDefaultExport = exportNames.includes("default");
|
|
138
138
|
const firstLine = srcContents.split("\n")[0];
|
|
@@ -151,7 +151,7 @@ async function rolldownBuild(ctx, entry, hooks) {
|
|
|
151
151
|
external: [
|
|
152
152
|
...builtinModules,
|
|
153
153
|
...builtinModules.map((m) => `node:${m}`),
|
|
154
|
-
...[...Object.keys(ctx.pkg.dependencies || {}), ...Object.keys(ctx.pkg.peerDependencies || {})].flatMap((p) => [p, new RegExp(`^${p}/`)])
|
|
154
|
+
...[...Object.keys(ctx.pkg.dependencies || {}), ...Object.keys(ctx.pkg.peerDependencies || {})].flatMap((p) => [p, /* @__PURE__ */ new RegExp(`^${p}/`)])
|
|
155
155
|
]
|
|
156
156
|
});
|
|
157
157
|
if (entry.dts !== false) rolldownConfig.plugins.push(...dts({ ...entry.dts }));
|
|
@@ -274,7 +274,7 @@ async function transformModule(entryPath, entry) {
|
|
|
274
274
|
lang: "ts",
|
|
275
275
|
sourceType: "module"
|
|
276
276
|
};
|
|
277
|
-
const parsed =
|
|
277
|
+
const parsed = parseSync(entryPath, sourceText, { ...sourceOptions });
|
|
278
278
|
if (parsed.errors.length > 0) throw new Error(`Errors while parsing ${entryPath}:`, { cause: parsed.errors });
|
|
279
279
|
const resolveOptions = {
|
|
280
280
|
...entry.resolve,
|
|
@@ -303,7 +303,7 @@ async function transformModule(entryPath, entry) {
|
|
|
303
303
|
for (const staticImport of parsed.module.staticImports) rewriteSpecifier(staticImport.moduleRequest);
|
|
304
304
|
for (const staticExport of parsed.module.staticExports) for (const staticExportEntry of staticExport.entries) if (staticExportEntry.moduleRequest) rewriteSpecifier(staticExportEntry.moduleRequest);
|
|
305
305
|
sourceText = magicString.toString();
|
|
306
|
-
const transformed =
|
|
306
|
+
const transformed = transform(entryPath, sourceText, {
|
|
307
307
|
...entry.oxc,
|
|
308
308
|
...sourceOptions,
|
|
309
309
|
cwd: dirname(entryPath),
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -7,4 +7,4 @@ import { BuildConfig, BuildEntry, BundleEntry, TransformEntry, defineConfig } fr
|
|
|
7
7
|
*/
|
|
8
8
|
declare function build(config: BuildConfig): Promise<void>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { BuildConfig, BuildEntry, BundleEntry, TransformEntry, build, defineConfig };
|
|
10
|
+
export { type BuildConfig, type BuildEntry, type BundleEntry, type TransformEntry, build, defineConfig };
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robuild",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.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",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"defu": "^6.1.4",
|
|
37
37
|
"exsolve": "^1.0.5",
|
|
38
38
|
"magic-string": "^0.30.17",
|
|
39
|
-
"oxc-minify": "^0.
|
|
40
|
-
"oxc-parser": "^0.
|
|
41
|
-
"oxc-transform": "^0.
|
|
42
|
-
"pretty-bytes": "^7.0.
|
|
43
|
-
"rolldown": "1.0.0-beta.
|
|
44
|
-
"rolldown-plugin-dts": "^0.
|
|
39
|
+
"oxc-minify": "^0.89.0",
|
|
40
|
+
"oxc-parser": "^0.89.0",
|
|
41
|
+
"oxc-transform": "^0.89.0",
|
|
42
|
+
"pretty-bytes": "^7.0.1",
|
|
43
|
+
"rolldown": "1.0.0-beta.30",
|
|
44
|
+
"rolldown-plugin-dts": "^0.16.5",
|
|
45
45
|
"tinyglobby": "^0.2.14",
|
|
46
46
|
"typescript": "^5.8.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@antfu/eslint-config": "^
|
|
50
|
-
"@types/node": "^
|
|
49
|
+
"@antfu/eslint-config": "^5.3.0",
|
|
50
|
+
"@types/node": "^24.4.0",
|
|
51
51
|
"@vitest/coverage-v8": "^3.2.2",
|
|
52
52
|
"automd": "^0.4.0",
|
|
53
53
|
"changelogen": "^0.6.1",
|