robuild 0.1.0 → 0.1.2

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.
@@ -0,0 +1,3 @@
1
+ import { t as RobuildPluginManager } from "./manager-DyYf90Z5.mjs";
2
+
3
+ export { RobuildPluginManager };
@@ -1,4 +1,4 @@
1
- //#region src/features/plugin-manager.ts
1
+ //#region src/plugins/manager.ts
2
2
  /**
3
3
  * Simplified plugin manager that leverages rolldown's plugin system
4
4
  */
@@ -2,7 +2,7 @@
2
2
  var package_default = {
3
3
  name: "robuild",
4
4
  type: "module",
5
- version: "0.1.0",
5
+ version: "0.1.2",
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",
@@ -29,7 +29,7 @@ var package_default = {
29
29
  "test:raw": "vitest run",
30
30
  "test:watch": "vitest",
31
31
  "test:coverage": "turbo test:coverage:raw --filter=robuild",
32
- "test:coverage:raw": "vitest run --coverage",
32
+ "test:coverage:raw": "vitest run --coverage && node scripts/update-coverage.mjs",
33
33
  "test:coverage:watch": "vitest --coverage",
34
34
  "test:ui": "vitest --ui",
35
35
  "test:types": "tsc --noEmit --skipLibCheck src/**/*.ts",
@@ -41,38 +41,38 @@ var package_default = {
41
41
  "clean": "rm -rf .turbo dist coverage"
42
42
  },
43
43
  dependencies: {
44
- "c12": "^3.0.4",
44
+ "c12": "4.0.0-beta.2",
45
45
  "cac": "^6.7.14",
46
- "chokidar": "^3.0.3",
46
+ "chokidar": "^5.0.0",
47
47
  "consola": "^3.4.2",
48
- "exsolve": "^1.0.5",
49
- "glob": "^11.0.3",
50
- "js-yaml": "^4.1.0",
51
- "magic-string": "^0.30.17",
52
- "minimatch": "^10.0.3",
53
- "oxc-minify": "^0.98.0",
54
- "oxc-parser": "^0.98.0",
55
- "oxc-transform": "^0.98.0",
56
- "pretty-bytes": "^7.0.1",
57
- "rolldown": "1.0.0-rc.3",
58
- "rolldown-plugin-dts": "^0.16.5",
59
- "tinyglobby": "^0.2.14",
60
- "typescript": "^5.8.3"
48
+ "exsolve": "^1.0.8",
49
+ "glob": "^13.0.3",
50
+ "js-yaml": "^4.1.1",
51
+ "magic-string": "^0.30.21",
52
+ "minimatch": "^10.2.0",
53
+ "oxc-minify": "^0.112.0",
54
+ "oxc-parser": "^0.112.0",
55
+ "oxc-transform": "^0.112.0",
56
+ "pretty-bytes": "^7.1.0",
57
+ "rolldown": "1.0.0-rc.4",
58
+ "rolldown-plugin-dts": "^0.22.1",
59
+ "tinyglobby": "^0.2.15",
60
+ "typescript": "^5.9.3"
61
61
  },
62
62
  devDependencies: {
63
- "@antfu/eslint-config": "^5.3.0",
63
+ "@antfu/eslint-config": "^7.4.3",
64
64
  "@types/js-yaml": "^4.0.9",
65
- "@types/node": "^24.4.0",
66
- "@vitest/coverage-v8": "^3.2.2",
67
- "automd": "^0.4.0",
68
- "changelogen": "^0.6.1",
69
- "eslint": "^9.28.0",
65
+ "@types/node": "^25.2.3",
66
+ "@vitest/coverage-v8": "^4.0.18",
67
+ "automd": "^0.4.3",
68
+ "changelogen": "^0.6.2",
69
+ "eslint": "^10.0.0",
70
70
  "esno": "^4.8.0",
71
71
  "git-cz": "^4.9.0",
72
- "prettier": "^3.5.3",
72
+ "prettier": "^3.8.1",
73
73
  "turbo": "^2.8.7",
74
- "vitepress": "^1.6.3",
75
- "vitest": "^3.2.2"
74
+ "vitepress": "^1.6.4",
75
+ "vitest": "^4.0.18"
76
76
  }
77
77
  };
78
78
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as configureLogger, l as logger, t as build } from "./_chunks/build-DbAuaVYJ.mjs";
2
+ import { g as logger, h as configureLogger, t as build } from "./_chunks/build-ZPgEqYgE.mjs";
3
3
  import { colors } from "consola/utils";
4
4
  import process from "node:process";
5
5
  import { loadConfig } from "c12";
@@ -75,7 +75,7 @@ async function runBuild(entries, flags) {
75
75
  const baseEntry = {
76
76
  type: "bundle",
77
77
  input: input.split(","),
78
- outDir
78
+ outDir: outDir || flags.outDir
79
79
  };
80
80
  if (flags.format) baseEntry.format = Array.isArray(flags.format) ? flags.format : [flags.format];
81
81
  if (flags.platform) baseEntry.platform = flags.platform;
package/dist/config.d.mts CHANGED
@@ -5,7 +5,6 @@ import { MinifyOptions as MinifyOptions$1 } from "oxc-minify";
5
5
  import { TransformOptions } from "oxc-transform";
6
6
 
7
7
  //#region src/types.d.ts
8
-
9
8
  /**
10
9
  * Target platform
11
10
  */
@@ -723,4 +722,4 @@ interface ExportsConfig {
723
722
  //#region src/config.d.ts
724
723
  declare function defineConfig(config: BuildConfig): BuildConfig;
725
724
  //#endregion
726
- export { RobuildPlugin as a, BundleEntry as i, BuildConfig as n, TransformEntry as o, BuildEntry as r, defineConfig as t };
725
+ export { GlobImportOptions as a, RobuildPlugin as c, ShimsConfig as d, TransformEntry as f, BundleEntry as i, RobuildPluginContext as l, BuildConfig as n, LoaderConfig as o, BuildEntry as r, LoaderType as s, defineConfig as t, RobuildPluginFactory as u };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as RobuildPlugin, i as BundleEntry, n as BuildConfig, o as TransformEntry, r as BuildEntry, t as defineConfig } from "./config.mjs";
1
+ import { a as GlobImportOptions, c as RobuildPlugin, d as ShimsConfig, f as TransformEntry, i as BundleEntry, l as RobuildPluginContext, n as BuildConfig, o as LoaderConfig, r as BuildEntry, s as LoaderType, t as defineConfig, u as RobuildPluginFactory } from "./config.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
 
4
4
  //#region src/build.d.ts
@@ -7,47 +7,206 @@ import { Plugin } from "rolldown";
7
7
  */
8
8
  declare function build(config: BuildConfig): Promise<void>;
9
9
  //#endregion
10
- //#region src/features/plugin-utils.d.ts
11
-
10
+ //#region src/plugins/builtin/cjs-default.d.ts
12
11
  /**
13
- * Combine multiple plugins into one
12
+ * Create CJS default export handling plugin
14
13
  */
15
- declare function combinePlugins(name: string, plugins: RobuildPlugin[]): RobuildPlugin;
14
+ declare function createCjsDefaultPlugin(mode?: boolean | 'auto'): RobuildPlugin;
16
15
  //#endregion
17
- //#region src/plugins/node-polyfills.d.ts
16
+ //#region src/plugins/builtin/glob-import.d.ts
18
17
  /**
19
- * Built-in plugin for Node.js polyfills
18
+ * Create a glob import plugin for robuild
20
19
  */
21
- declare function nodePolyfillsPlugin(): RobuildPlugin;
20
+ declare function createGlobImportPlugin(options?: GlobImportOptions): RobuildPlugin;
21
+ /**
22
+ * Check if code contains glob imports
23
+ */
24
+ declare function hasGlobImports(code: string): boolean;
25
+ //#endregion
26
+ //#region src/plugins/builtin/loaders.d.ts
27
+ /**
28
+ * Default loader mappings for common file extensions.
29
+ *
30
+ * Uses Rolldown's native moduleTypes:
31
+ * - 'asset': Auto-detect (base64 for small files, file path for large)
32
+ * - 'file': Always emit as separate file
33
+ * - 'base64': Always inline as base64 data URL
34
+ * - 'text': Import as string
35
+ */
36
+ declare const DEFAULT_LOADERS: Record<string, LoaderType>;
37
+ /**
38
+ * Get loader type for a file based on its extension
39
+ */
40
+ declare function getLoaderForFile(filePath: string, loaders?: Record<string, LoaderConfig>): LoaderType;
41
+ /**
42
+ * Create a loader plugin for robuild
43
+ */
44
+ declare function createLoaderPlugin(loaders?: Record<string, LoaderConfig>): RobuildPlugin;
22
45
  //#endregion
23
- //#region src/plugins/node-protocol.d.ts
46
+ //#region src/plugins/builtin/node-protocol.d.ts
24
47
  /**
25
48
  * Rolldown plugin for Node.js protocol handling
26
49
  */
27
50
  declare function nodeProtocolPlugin(nodeProtocol: 'strip' | boolean): Plugin;
28
51
  //#endregion
29
- //#region src/plugins/shebang.d.ts
52
+ //#region src/plugins/builtin/shebang.d.ts
30
53
  declare const SHEBANG_RE: RegExp;
31
54
  declare function shebangPlugin(): RobuildPlugin;
32
55
  declare function hasShebang(code: string): boolean;
33
56
  declare function makeExecutable(filePath: string): Promise<void>;
34
57
  //#endregion
35
- //#region src/plugins/text.d.ts
58
+ //#region src/plugins/builtin/shims.d.ts
59
+ /**
60
+ * Default shims configuration
61
+ */
62
+ declare const DEFAULT_SHIMS_CONFIG: Required<ShimsConfig>;
63
+ /**
64
+ * Create shims plugin
65
+ */
66
+ declare function createShimsPlugin(config?: boolean | ShimsConfig): RobuildPlugin;
67
+ /**
68
+ * Create browser-specific shims plugin
69
+ */
70
+ declare function createBrowserShimsPlugin(): RobuildPlugin;
71
+ /**
72
+ * Create Node.js-specific shims plugin
73
+ */
74
+ declare function createNodeShimsPlugin(): RobuildPlugin;
75
+ //#endregion
76
+ //#region src/plugins/builtin/skip-node-modules.d.ts
77
+ /**
78
+ * Create skip node_modules plugin
79
+ */
80
+ declare function createSkipNodeModulesPlugin(options?: {
81
+ noExternal?: (string | RegExp)[];
82
+ }): RobuildPlugin;
83
+ //#endregion
84
+ //#region src/plugins/extras/node-polyfills.d.ts
85
+ /**
86
+ * Built-in plugin for Node.js polyfills
87
+ */
88
+ declare function nodePolyfillsPlugin(): RobuildPlugin;
89
+ //#endregion
90
+ //#region src/plugins/extras/text.d.ts
36
91
  /**
37
92
  * Built-in plugin for text file imports
38
93
  */
39
94
  declare function textPlugin(extensions?: string[]): RobuildPlugin;
40
95
  //#endregion
41
- //#region src/plugins/url.d.ts
96
+ //#region src/plugins/extras/url.d.ts
42
97
  /**
43
98
  * Built-in plugin for URL imports (assets)
44
99
  */
45
100
  declare function urlPlugin(extensions?: string[]): RobuildPlugin;
46
101
  //#endregion
47
- //#region src/plugins/virtual.d.ts
102
+ //#region src/plugins/extras/virtual.d.ts
48
103
  /**
49
104
  * Built-in plugin for virtual modules
50
105
  */
51
106
  declare function virtualPlugin(modules: Record<string, string>): RobuildPlugin;
52
107
  //#endregion
53
- export { type BuildConfig, type BuildEntry, type BundleEntry, type RobuildPlugin, SHEBANG_RE, type TransformEntry, build, combinePlugins, defineConfig, hasShebang, makeExecutable, nodePolyfillsPlugin, nodeProtocolPlugin, shebangPlugin, textPlugin, urlPlugin, virtualPlugin };
108
+ //#region src/plugins/factory.d.ts
109
+ /**
110
+ * Create a robuild plugin with enhanced hooks
111
+ */
112
+ declare function createRobuildPlugin(name: string, hooks: Partial<RobuildPlugin>): RobuildPlugin;
113
+ /**
114
+ * Create a plugin factory function
115
+ */
116
+ declare function createPluginFactory<T = any>(name: string, factory: (options?: T) => Partial<RobuildPlugin>): RobuildPluginFactory<T>;
117
+ /**
118
+ * Extend a rolldown plugin with robuild-specific hooks
119
+ */
120
+ declare function extendRolldownPlugin(plugin: Plugin, robuildHooks: {
121
+ robuildSetup?: (context: RobuildPluginContext) => void | Promise<void>;
122
+ robuildBuildStart?: (context: RobuildPluginContext) => void | Promise<void>;
123
+ robuildBuildEnd?: (context: RobuildPluginContext, result?: any) => void | Promise<void>;
124
+ }): RobuildPlugin;
125
+ /**
126
+ * Create a simple transform plugin
127
+ */
128
+ declare function createTransformPlugin(name: string, transform: (code: string, id: string, context: RobuildPluginContext) => string | null | Promise<string | null>, filter?: RegExp): RobuildPlugin;
129
+ /**
130
+ * Create a simple load plugin
131
+ */
132
+ declare function createLoadPlugin(name: string, load: (id: string, context: RobuildPluginContext) => string | null | Promise<string | null>, filter?: RegExp): RobuildPlugin;
133
+ /**
134
+ * Create a simple resolve plugin
135
+ */
136
+ declare function createResolvePlugin(name: string, resolveId: (id: string, importer: string | undefined, context: RobuildPluginContext) => string | null | Promise<string | null>, filter?: RegExp): RobuildPlugin;
137
+ /**
138
+ * Combine multiple plugins into one
139
+ */
140
+ declare function combinePlugins(name: string, plugins: RobuildPlugin[]): RobuildPlugin;
141
+ //#endregion
142
+ //#region src/plugins/manager.d.ts
143
+ /**
144
+ * Simplified plugin manager that leverages rolldown's plugin system
145
+ */
146
+ declare class RobuildPluginManager {
147
+ private plugins;
148
+ private context;
149
+ constructor(config: BuildConfig, entry: BuildEntry, pkgDir: string);
150
+ /**
151
+ * Normalize plugin options to RobuildPlugin instances
152
+ */
153
+ private normalizePlugins;
154
+ /**
155
+ * Normalize a single plugin option
156
+ */
157
+ private normalizePlugin;
158
+ /**
159
+ * Check if plugin is already a RobuildPlugin
160
+ */
161
+ private isRobuildPlugin;
162
+ /**
163
+ * Check if plugin is a rolldown/rollup plugin
164
+ */
165
+ private isRolldownPlugin;
166
+ /**
167
+ * Check if plugin is a Vite plugin
168
+ */
169
+ private isVitePlugin;
170
+ /**
171
+ * Check if plugin is an Unplugin
172
+ */
173
+ private isUnplugin;
174
+ /**
175
+ * Adapt rolldown plugin to RobuildPlugin
176
+ */
177
+ private adaptRolldownPlugin;
178
+ /**
179
+ * Adapt Vite plugin to RobuildPlugin
180
+ */
181
+ private adaptVitePlugin;
182
+ /**
183
+ * Adapt Unplugin to RobuildPlugin
184
+ */
185
+ private adaptUnplugin;
186
+ /**
187
+ * Initialize robuild-specific plugin hooks
188
+ */
189
+ initializeRobuildHooks(): Promise<void>;
190
+ /**
191
+ * Execute robuild buildStart hooks
192
+ */
193
+ executeRobuildBuildStart(): Promise<void>;
194
+ /**
195
+ * Execute robuild buildEnd hooks
196
+ */
197
+ executeRobuildBuildEnd(result?: any): Promise<void>;
198
+ /**
199
+ * Get rolldown-compatible plugins for direct use
200
+ */
201
+ getRolldownPlugins(): Plugin[];
202
+ /**
203
+ * Get all plugins
204
+ */
205
+ getPlugins(): RobuildPlugin[];
206
+ /**
207
+ * Update context (useful when build parameters change)
208
+ */
209
+ updateContext(updates: Partial<RobuildPluginContext>): void;
210
+ }
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 };