robuild 0.0.20 → 0.1.1

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.0.20",
5
+ version: "0.1.1",
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",
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-ZNO1BJMb.mjs";
2
+ import { g as logger, h as configureLogger, t as build } from "./_chunks/build-D6PKwgm3.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
@@ -723,4 +723,4 @@ interface ExportsConfig {
723
723
  //#region src/config.d.ts
724
724
  declare function defineConfig(config: BuildConfig): BuildConfig;
725
725
  //#endregion
726
- export { RobuildPlugin as a, BundleEntry as i, BuildConfig as n, TransformEntry as o, BuildEntry as r, defineConfig as t };
726
+ 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,207 @@ 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
10
+ //#region src/plugins/builtin/cjs-default.d.ts
11
11
 
12
12
  /**
13
- * Combine multiple plugins into one
13
+ * Create CJS default export handling plugin
14
14
  */
15
- declare function combinePlugins(name: string, plugins: RobuildPlugin[]): RobuildPlugin;
15
+ declare function createCjsDefaultPlugin(mode?: boolean | 'auto'): RobuildPlugin;
16
16
  //#endregion
17
- //#region src/plugins/node-polyfills.d.ts
17
+ //#region src/plugins/builtin/glob-import.d.ts
18
18
  /**
19
- * Built-in plugin for Node.js polyfills
19
+ * Create a glob import plugin for robuild
20
20
  */
21
- declare function nodePolyfillsPlugin(): RobuildPlugin;
21
+ declare function createGlobImportPlugin(options?: GlobImportOptions): RobuildPlugin;
22
+ /**
23
+ * Check if code contains glob imports
24
+ */
25
+ declare function hasGlobImports(code: string): boolean;
26
+ //#endregion
27
+ //#region src/plugins/builtin/loaders.d.ts
28
+ /**
29
+ * Default loader mappings for common file extensions.
30
+ *
31
+ * Uses Rolldown's native moduleTypes:
32
+ * - 'asset': Auto-detect (base64 for small files, file path for large)
33
+ * - 'file': Always emit as separate file
34
+ * - 'base64': Always inline as base64 data URL
35
+ * - 'text': Import as string
36
+ */
37
+ declare const DEFAULT_LOADERS: Record<string, LoaderType>;
38
+ /**
39
+ * Get loader type for a file based on its extension
40
+ */
41
+ declare function getLoaderForFile(filePath: string, loaders?: Record<string, LoaderConfig>): LoaderType;
42
+ /**
43
+ * Create a loader plugin for robuild
44
+ */
45
+ declare function createLoaderPlugin(loaders?: Record<string, LoaderConfig>): RobuildPlugin;
22
46
  //#endregion
23
- //#region src/plugins/node-protocol.d.ts
47
+ //#region src/plugins/builtin/node-protocol.d.ts
24
48
  /**
25
49
  * Rolldown plugin for Node.js protocol handling
26
50
  */
27
51
  declare function nodeProtocolPlugin(nodeProtocol: 'strip' | boolean): Plugin;
28
52
  //#endregion
29
- //#region src/plugins/shebang.d.ts
53
+ //#region src/plugins/builtin/shebang.d.ts
30
54
  declare const SHEBANG_RE: RegExp;
31
55
  declare function shebangPlugin(): RobuildPlugin;
32
56
  declare function hasShebang(code: string): boolean;
33
57
  declare function makeExecutable(filePath: string): Promise<void>;
34
58
  //#endregion
35
- //#region src/plugins/text.d.ts
59
+ //#region src/plugins/builtin/shims.d.ts
60
+ /**
61
+ * Default shims configuration
62
+ */
63
+ declare const DEFAULT_SHIMS_CONFIG: Required<ShimsConfig>;
64
+ /**
65
+ * Create shims plugin
66
+ */
67
+ declare function createShimsPlugin(config?: boolean | ShimsConfig): RobuildPlugin;
68
+ /**
69
+ * Create browser-specific shims plugin
70
+ */
71
+ declare function createBrowserShimsPlugin(): RobuildPlugin;
72
+ /**
73
+ * Create Node.js-specific shims plugin
74
+ */
75
+ declare function createNodeShimsPlugin(): RobuildPlugin;
76
+ //#endregion
77
+ //#region src/plugins/builtin/skip-node-modules.d.ts
78
+ /**
79
+ * Create skip node_modules plugin
80
+ */
81
+ declare function createSkipNodeModulesPlugin(options?: {
82
+ noExternal?: (string | RegExp)[];
83
+ }): RobuildPlugin;
84
+ //#endregion
85
+ //#region src/plugins/extras/node-polyfills.d.ts
86
+ /**
87
+ * Built-in plugin for Node.js polyfills
88
+ */
89
+ declare function nodePolyfillsPlugin(): RobuildPlugin;
90
+ //#endregion
91
+ //#region src/plugins/extras/text.d.ts
36
92
  /**
37
93
  * Built-in plugin for text file imports
38
94
  */
39
95
  declare function textPlugin(extensions?: string[]): RobuildPlugin;
40
96
  //#endregion
41
- //#region src/plugins/url.d.ts
97
+ //#region src/plugins/extras/url.d.ts
42
98
  /**
43
99
  * Built-in plugin for URL imports (assets)
44
100
  */
45
101
  declare function urlPlugin(extensions?: string[]): RobuildPlugin;
46
102
  //#endregion
47
- //#region src/plugins/virtual.d.ts
103
+ //#region src/plugins/extras/virtual.d.ts
48
104
  /**
49
105
  * Built-in plugin for virtual modules
50
106
  */
51
107
  declare function virtualPlugin(modules: Record<string, string>): RobuildPlugin;
52
108
  //#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 };
109
+ //#region src/plugins/factory.d.ts
110
+ /**
111
+ * Create a robuild plugin with enhanced hooks
112
+ */
113
+ declare function createRobuildPlugin(name: string, hooks: Partial<RobuildPlugin>): RobuildPlugin;
114
+ /**
115
+ * Create a plugin factory function
116
+ */
117
+ declare function createPluginFactory<T = any>(name: string, factory: (options?: T) => Partial<RobuildPlugin>): RobuildPluginFactory<T>;
118
+ /**
119
+ * Extend a rolldown plugin with robuild-specific hooks
120
+ */
121
+ declare function extendRolldownPlugin(plugin: Plugin, robuildHooks: {
122
+ robuildSetup?: (context: RobuildPluginContext) => void | Promise<void>;
123
+ robuildBuildStart?: (context: RobuildPluginContext) => void | Promise<void>;
124
+ robuildBuildEnd?: (context: RobuildPluginContext, result?: any) => void | Promise<void>;
125
+ }): RobuildPlugin;
126
+ /**
127
+ * Create a simple transform plugin
128
+ */
129
+ declare function createTransformPlugin(name: string, transform: (code: string, id: string, context: RobuildPluginContext) => string | null | Promise<string | null>, filter?: RegExp): RobuildPlugin;
130
+ /**
131
+ * Create a simple load plugin
132
+ */
133
+ declare function createLoadPlugin(name: string, load: (id: string, context: RobuildPluginContext) => string | null | Promise<string | null>, filter?: RegExp): RobuildPlugin;
134
+ /**
135
+ * Create a simple resolve plugin
136
+ */
137
+ declare function createResolvePlugin(name: string, resolveId: (id: string, importer: string | undefined, context: RobuildPluginContext) => string | null | Promise<string | null>, filter?: RegExp): RobuildPlugin;
138
+ /**
139
+ * Combine multiple plugins into one
140
+ */
141
+ declare function combinePlugins(name: string, plugins: RobuildPlugin[]): RobuildPlugin;
142
+ //#endregion
143
+ //#region src/plugins/manager.d.ts
144
+ /**
145
+ * Simplified plugin manager that leverages rolldown's plugin system
146
+ */
147
+ declare class RobuildPluginManager {
148
+ private plugins;
149
+ private context;
150
+ constructor(config: BuildConfig, entry: BuildEntry, pkgDir: string);
151
+ /**
152
+ * Normalize plugin options to RobuildPlugin instances
153
+ */
154
+ private normalizePlugins;
155
+ /**
156
+ * Normalize a single plugin option
157
+ */
158
+ private normalizePlugin;
159
+ /**
160
+ * Check if plugin is already a RobuildPlugin
161
+ */
162
+ private isRobuildPlugin;
163
+ /**
164
+ * Check if plugin is a rolldown/rollup plugin
165
+ */
166
+ private isRolldownPlugin;
167
+ /**
168
+ * Check if plugin is a Vite plugin
169
+ */
170
+ private isVitePlugin;
171
+ /**
172
+ * Check if plugin is an Unplugin
173
+ */
174
+ private isUnplugin;
175
+ /**
176
+ * Adapt rolldown plugin to RobuildPlugin
177
+ */
178
+ private adaptRolldownPlugin;
179
+ /**
180
+ * Adapt Vite plugin to RobuildPlugin
181
+ */
182
+ private adaptVitePlugin;
183
+ /**
184
+ * Adapt Unplugin to RobuildPlugin
185
+ */
186
+ private adaptUnplugin;
187
+ /**
188
+ * Initialize robuild-specific plugin hooks
189
+ */
190
+ initializeRobuildHooks(): Promise<void>;
191
+ /**
192
+ * Execute robuild buildStart hooks
193
+ */
194
+ executeRobuildBuildStart(): Promise<void>;
195
+ /**
196
+ * Execute robuild buildEnd hooks
197
+ */
198
+ executeRobuildBuildEnd(result?: any): Promise<void>;
199
+ /**
200
+ * Get rolldown-compatible plugins for direct use
201
+ */
202
+ getRolldownPlugins(): Plugin[];
203
+ /**
204
+ * Get all plugins
205
+ */
206
+ getPlugins(): RobuildPlugin[];
207
+ /**
208
+ * Update context (useful when build parameters change)
209
+ */
210
+ updateContext(updates: Partial<RobuildPluginContext>): void;
211
+ }
212
+ //#endregion
213
+ 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 };