@trebired/bundler 1.6.0 → 3.0.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +208 -282
  3. package/dist/core/asset-manifest.d.ts.map +1 -1
  4. package/dist/core/asset-manifest.js +70 -72
  5. package/dist/core/asset-manifest.js.map +1 -1
  6. package/dist/core/build.d.ts.map +1 -1
  7. package/dist/core/build.js +5 -10
  8. package/dist/core/build.js.map +1 -1
  9. package/dist/core/derive-manifest.d.ts.map +1 -1
  10. package/dist/core/derive-manifest.js +4 -0
  11. package/dist/core/derive-manifest.js.map +1 -1
  12. package/dist/core/discovery.d.ts +13 -16
  13. package/dist/core/discovery.d.ts.map +1 -1
  14. package/dist/core/discovery.js +321 -150
  15. package/dist/core/discovery.js.map +1 -1
  16. package/dist/core/esbuild-options.d.ts +1 -3
  17. package/dist/core/esbuild-options.d.ts.map +1 -1
  18. package/dist/core/esbuild-options.js +4 -21
  19. package/dist/core/esbuild-options.js.map +1 -1
  20. package/dist/core/manifest.d.ts +2 -2
  21. package/dist/core/manifest.d.ts.map +1 -1
  22. package/dist/core/manifest.js +2 -11
  23. package/dist/core/manifest.js.map +1 -1
  24. package/dist/core/shared.d.ts +3 -9
  25. package/dist/core/shared.d.ts.map +1 -1
  26. package/dist/core/shared.js +5 -22
  27. package/dist/core/shared.js.map +1 -1
  28. package/dist/core/watch.d.ts.map +1 -1
  29. package/dist/core/watch.js +20 -32
  30. package/dist/core/watch.js.map +1 -1
  31. package/dist/index.d.ts +1 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +0 -1
  34. package/dist/index.js.map +1 -1
  35. package/dist/plugins/virtual-entries.d.ts.map +1 -1
  36. package/dist/plugins/virtual-entries.js +11 -5
  37. package/dist/plugins/virtual-entries.js.map +1 -1
  38. package/dist/types.d.ts +69 -31
  39. package/dist/types.d.ts.map +1 -1
  40. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,26 @@ All notable changes to `@trebired/bundler` will be documented here.
4
4
 
5
5
  This project follows semantic versioning once published.
6
6
 
7
+ ## 3.0.0
8
+
9
+ - Rebuilt `@trebired/bundler` around discover-only configuration and removed public manual `entries`.
10
+ - Removed public `virtualEntries`; grouped bundle entry modules are now internal implementation detail only.
11
+ - Removed package-owned build `mode` profiles in favor of explicit `minify`, `stripComments`, `sourcemap`, and related esbuild-like flags.
12
+ - Replaced top-level discover include/exclude behavior with ordered discover `rules` using `entry`, `bundle`, and `ignore` strategies.
13
+ - Added per-rule `maxBundleSize` for grouped bundles, still defaulting to `50mb`.
14
+ - Kept grouped bundle filenames package-owned under the `bundle-...` naming scheme.
15
+ - Added source ownership metadata to build results and watch hooks so runtime code can resolve source file -> owning entry key.
16
+ - Redesigned the runtime asset manifest around `entries`, `sources`, `entryOutputs`, `outputs`, and `rules`, including grouped bundle membership and ignored-source tracking.
17
+ - Made `.client.*` and `.defer.*` entries fail when they import JS or TS files owned by grouped bundle rules.
18
+
19
+ ## 2.0.0
20
+
21
+ - Changed `discover` to group discovered `.js` and `.ts` files into auto-named script bundles by default.
22
+ - Changed `discover` to group discovered `.css` and `.scss` files into auto-named style bundles by default.
23
+ - Added `discover.maxBundleSize` with a default of `50mb`, splitting grouped discovered bundles only when the full group exceeds the limit.
24
+ - Kept discovered `.jsx` and `.tsx` files as normal per-file entries.
25
+ - Made grouped discovered builds fail when one grouped source file is larger than the configured max bundle size.
26
+
7
27
  ## 1.6.0
8
28
 
9
29
  - Added `buildAssetManifest()` for a runtime-friendly asset manifest keyed by logical entries and source paths.
package/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # @trebired/bundler
2
2
 
3
- Fast bundler wrapper around `esbuild` with SCSS support, compact build modes, watch mode, and inline source path annotations.
3
+ Discover-only bundler wrapper around `esbuild` with SCSS support, watch mode, source annotations, and a runtime-friendly asset manifest.
4
4
 
5
- `@trebired/bundler` is not a full custom bundler. It keeps the package-owned API small and lets `esbuild` do the heavy lifting, while adding logging aligned with other packages published by Trebired, SCSS compilation through `sass-embedded`, built-in source walking, config-driven CLI commands, virtual entry modules, derived manifest helpers, and inline source path comments in generated output.
6
-
7
- The default build mode is `compact`. It enables minification and comment stripping unless you turn on source annotations.
5
+ `@trebired/bundler` now has one public entry model: discovery rules. You describe what the bundler should find, whether each matched file should stay isolated, join a grouped bundle, or be ignored, and the package handles the rest.
8
6
 
9
7
  ## Install
10
8
 
@@ -14,38 +12,6 @@ Runtime support: Bun 1+ and Node.js 18+.
14
12
  npm install @trebired/bundler
15
13
  ```
16
14
 
17
- ## What It Is For
18
-
19
- Use this when:
20
-
21
- - you want a bundling package that fits alongside other packages published by Trebired instead of wiring `esbuild` directly in every project
22
- - you need one package that handles `tsx`, `jsx`, `ts`, `js`, `scss`, and `css`
23
- - you want the package to discover entry files by walking your source tree
24
- - you want in-memory generated entry modules without writing temp files
25
- - you want watch mode and config-driven CLI commands without building a separate toolchain wrapper
26
- - you want newly created matching files to join the build without external entry regeneration code
27
- - you want a manifest describing resolved entries and generated outputs
28
- - you want a stable helper for turning esbuild metafiles into runtime asset graphs
29
- - you want a runtime-friendly asset manifest keyed by entry names and source paths
30
- - you want a package-owned helper for collecting script and stylesheet links for selected entries
31
- - you want a generic import graph walker with tsconfig path resolution for higher-level presets
32
- - you want rebuild hooks instead of scraping logger text
33
- - you want generated bundles to optionally include inline comments that point back to the original source file path
34
- - you want production-lean defaults with minified output and stripped comments
35
- - you want a stronger `extreme` mode for the most aggressive package-owned compacting defaults
36
- - you want package-owned logs routed through `@trebired/logger-adapter`
37
-
38
- ## What It Does Not Do
39
-
40
- This package does not:
41
-
42
- - replace `esbuild`
43
- - provide a dev server or HMR
44
- - invent a separate package-specific module graph format
45
- - manage HTML templates or deployment assets for you
46
-
47
- If you want a fast bundling wrapper from the Trebired package ecosystem, use this package. If you want a fully custom bundler runtime, this package is intentionally not that.
48
-
49
15
  ## Quick Start
50
16
 
51
17
  ```ts
@@ -53,14 +19,37 @@ import { bundle } from "@trebired/bundler";
53
19
 
54
20
  await bundle({
55
21
  discover: {
56
- dir: "./src",
57
- include: ["app.tsx", "theme.css"],
58
- },
59
- virtualEntries: {
60
- "entry-server": `
61
- import { message } from "./src/lib/message";
62
- export const rendered = message.toUpperCase();
63
- `,
22
+ dir: "./src/frontend",
23
+ rules: [
24
+ {
25
+ key: "client",
26
+ include: ["**/*.client.ts", "**/*.client.tsx"],
27
+ strategy: "entry",
28
+ },
29
+ {
30
+ key: "defer",
31
+ include: ["**/*.defer.ts"],
32
+ strategy: "entry",
33
+ },
34
+ {
35
+ key: "global-style",
36
+ include: ["css/**/*.css", "css/**/*.scss"],
37
+ strategy: "bundle",
38
+ maxBundleSize: "50mb",
39
+ },
40
+ {
41
+ key: "shared-script",
42
+ include: ["**/*.ts", "**/*.js"],
43
+ exclude: ["**/*.client.ts", "**/*.client.tsx", "**/*.defer.ts"],
44
+ strategy: "bundle",
45
+ maxBundleSize: "50mb",
46
+ },
47
+ {
48
+ key: "ignored-tests",
49
+ include: ["**/*.test.*", "**/*.spec.*"],
50
+ strategy: "ignore",
51
+ },
52
+ ],
64
53
  },
65
54
  outDir: "./dist",
66
55
  sourcemap: "external",
@@ -79,10 +68,25 @@ import { defineBundlerConfig } from "@trebired/bundler";
79
68
  export default defineBundlerConfig({
80
69
  discover: {
81
70
  dir: "./src/frontend",
82
- include: ["**/*.tsx", "**/*.scss", "**/*.css"],
71
+ rules: [
72
+ {
73
+ key: "client",
74
+ include: ["**/*.client.ts", "**/*.client.tsx"],
75
+ strategy: "entry",
76
+ },
77
+ {
78
+ key: "global-style",
79
+ include: ["css/**/*.css", "css/**/*.scss"],
80
+ strategy: "bundle",
81
+ },
82
+ {
83
+ key: "shared-script",
84
+ include: ["shared/**/*.ts", "shared/**/*.js"],
85
+ strategy: "bundle",
86
+ },
87
+ ],
83
88
  },
84
89
  outDir: "./dist",
85
- annotateSources: true,
86
90
  manifest: true,
87
91
  });
88
92
  ```
@@ -94,75 +98,82 @@ trebired-bundler build --config ./bundler.config.mjs
94
98
  trebired-bundler watch --config ./bundler.config.mjs
95
99
  ```
96
100
 
97
- ## Discovery And Walking
101
+ ## Discover Rules
98
102
 
99
- Set `discover` when you want `@trebired/bundler` to walk the source tree and build the entry list itself.
103
+ Rules are ordered. First match wins.
100
104
 
101
- ```ts
102
- await bundle({
103
- discover: {
104
- dir: "./src/frontend",
105
- include: ["**/*.tsx", "global/**/*.scss"],
106
- exclude: ["**/*.test.tsx"],
107
- ignoreDirs: ["legacy"],
108
- namePrefix: "frontend",
109
- },
110
- outDir: "./dist",
111
- });
112
- ```
105
+ - `entry`: keep one output entry per matched file
106
+ - `bundle`: group all matched files together, then split only when the whole group exceeds `maxBundleSize`
107
+ - `ignore`: track the file as intentionally ignored and exclude it from outputs
113
108
 
114
- The package:
109
+ Every discovered file must match exactly one rule. If a file is in scope and matches nothing, the build fails.
115
110
 
116
- - walks the configured directory recursively
117
- - matches files by extension plus optional include and exclude patterns
118
- - derives entry names from relative paths
119
- - rebuilds the entry list during watch mode when matching files are added or removed
111
+ ### `maxBundleSize`
120
112
 
121
- You can combine manual `entries` with `discover`. If both resolve the same entry name to different files, the build fails so the collision is explicit.
113
+ - only valid on `bundle` rules
114
+ - defaults to `50mb`
115
+ - accepts bytes or strings like `"512kb"`, `"50mb"`, or `"1gb"`
116
+ - splits by summed source-file size before handing grouped parts to `esbuild`
117
+ - fails the build if a single grouped file is larger than the configured limit
122
118
 
123
- ## Manifest
119
+ ### Bundle Naming
124
120
 
125
- Set `manifest: true` to write `dist/bundler-manifest.json`, or pass `manifest: { file: "custom-name.json" }` to choose a different path inside `outDir`.
121
+ Grouped outputs always use package-owned names:
126
122
 
127
- The manifest contains:
123
+ - `bundle-<stable-id>.js`
124
+ - `bundle-<stable-id>-2.js`
125
+ - `bundle-<stable-id>.css`
126
+ - `bundle-<stable-id>-2.css`
128
127
 
129
- - resolved entries
130
- - whether each entry came from `manual` config or `discover`
131
- - generated output files
132
- - a runtime-friendly `assetManifest` keyed by entry source path, with lookup maps for entry names and emitted outputs
128
+ Callers do not provide custom grouped bundle names.
133
129
 
134
- If you want a runtime-friendly asset graph directly in app code, call `deriveManifest()` on the returned `metafile`:
130
+ ## Frontend Conventions
135
131
 
136
- ```ts
137
- import { bundle, deriveManifest } from "@trebired/bundler";
132
+ This API is meant for conventions like:
138
133
 
139
- const result = await bundle({
140
- entries: {
141
- app: "./src/app.tsx",
142
- },
143
- outDir: "./dist",
144
- });
134
+ - `*.client.ts`
135
+ - `*.client.tsx`
136
+ - `*.defer.ts`
137
+ - global `css/**/*.css`
138
+ - global `css/**/*.scss`
145
139
 
146
- const manifest = deriveManifest(result.metafile!, {
147
- rootDir: process.cwd(),
148
- outDir: "./dist",
149
- });
150
- ```
140
+ Typical setup:
141
+
142
+ - client boot files use `strategy: "entry"`
143
+ - defer boot files use `strategy: "entry"`
144
+ - shared JS/TS helpers use `strategy: "bundle"`
145
+ - global CSS/SCSS uses `strategy: "bundle"`
146
+ - tests and non-runtime files use `strategy: "ignore"`
151
147
 
152
- The helper returns:
148
+ Important behavior:
149
+
150
+ - grouped `bundle` rules must stay style-only or script-only; mixing CSS/SCSS with JS/TS in one rule fails
151
+ - `*.client.*` and `*.defer.*` entries may not import JS/TS files owned by a grouped bundle rule; that fails the build because those files are treated as shared standalone bundles, not implicit app-entry dependencies
152
+
153
+ ## Manifest
153
154
 
154
- - `entries`: entry output -> JS/CSS/import graph
155
- - `chunks`: shared output -> import/CSS graph
156
- - `allOutputs`: flat normalized output index
155
+ Set `manifest: true` to write `dist/bundler-manifest.json`, or pass `manifest: { file: "custom-name.json" }`.
157
156
 
158
- If you want a manifest ready for runtime asset selection, use `buildAssetManifest()`:
157
+ The build result also exposes `assetManifest` directly.
159
158
 
160
159
  ```ts
161
160
  import { buildAssetManifest, bundle, collectAssetLinks } from "@trebired/bundler";
162
161
 
163
162
  const result = await bundle({
164
- entries: {
165
- app: "./src/app.tsx",
163
+ discover: {
164
+ dir: "./src/frontend",
165
+ rules: [
166
+ {
167
+ key: "client",
168
+ include: ["**/*.client.ts", "**/*.client.tsx"],
169
+ strategy: "entry",
170
+ },
171
+ {
172
+ key: "global-style",
173
+ include: ["css/**/*.css", "css/**/*.scss"],
174
+ strategy: "bundle",
175
+ },
176
+ ],
166
177
  },
167
178
  outDir: "./dist",
168
179
  });
@@ -171,55 +182,79 @@ const assetManifest = result.assetManifest || buildAssetManifest({
171
182
  metafile: result.metafile!,
172
183
  outDir: "./dist",
173
184
  rootDir: process.cwd(),
174
- resolvedEntries: result.entries,
185
+ resolvedDiscovery: result.resolvedDiscovery,
175
186
  });
176
187
 
177
- const assets = collectAssetLinks(assetManifest, ["app"], {
188
+ const assets = collectAssetLinks(assetManifest, [
189
+ "src/frontend/home.client.tsx",
190
+ ], {
191
+ from: "source",
178
192
  publicPath: "/",
179
193
  });
180
194
  ```
181
195
 
182
- The runtime asset manifest exposes:
183
-
184
- - `entries`: entry source path -> primary file, reachable JS, reachable CSS, and other emitted assets
185
- - `entryNames`: logical entry name -> entry source path
186
- - `entryOutputs`: emitted entry file -> entry source path
187
- - `outputs`: emitted output index relative to `outDir`
188
-
189
- ## Virtual Entries
196
+ ### Asset Manifest Shape
190
197
 
191
- Use `virtualEntries` when you want generated entry modules without writing temporary files:
198
+ `result.entries` is a source ownership map:
192
199
 
193
200
  ```ts
194
- await bundle({
195
- entries: {
196
- app: "./src/app.tsx",
197
- },
198
- virtualEntries: {
199
- "entry-server": `
200
- import { message } from "./src/lib/message";
201
- export const rendered = message.toUpperCase();
202
- `,
203
- "global.client": `
204
- import "./src/styles/site.scss";
205
- console.log("global-client");
206
- `,
207
- },
208
- outDir: "./dist",
209
- });
201
+ Record<string, string>
202
+ // source path -> owning entry key
210
203
  ```
211
204
 
212
- Virtual entries are loaded as TypeScript/ESM modules and resolve relative imports from `rootDir`.
205
+ `assetManifest` exposes:
206
+
207
+ - `sources[sourcePath]`: source file -> owning entry key, rule key, strategy, outputs
208
+ - `entries[entryKey]`: entry or grouped bundle -> owned sources, outputs, JS, CSS, assets
209
+ - `entryOutputs[emittedFile]`: emitted entry output -> entry key
210
+ - `outputs[outputFile]`: normalized output metadata
211
+ - `rules[ruleKey]`: grouped entry keys plus ignored sources for that rule
212
+
213
+ This lets runtime code resolve either:
214
+
215
+ - a source path to its owning entry key
216
+ - an entry key to the emitted scripts/styles/assets
217
+ - a grouped bundle back to the exact source files it owns
218
+
219
+ ### Collecting Runtime Links
220
+
221
+ Use `collectAssetLinks()` when app code needs scripts and styles for one or more sources or entry keys.
213
222
 
214
- ## Watch Hooks
223
+ Supported lookup modes:
215
224
 
216
- Use watch hooks when app code needs clean lifecycle points after rebuilds:
225
+ - `from: "source"`
226
+ - `from: "entryKey"`
227
+ - `from: "entryOutput"`
228
+ - `from: "auto"` (default)
229
+
230
+ ## Watch Mode
231
+
232
+ `watch()` stays discover-driven.
233
+
234
+ - added or removed matching files trigger a discovery rescan
235
+ - if source ownership changes, the bundler rebuilds the esbuild context
236
+ - `onEntrySetChanged()` receives the new source ownership map
237
+ - `onRebuilt()` receives the full `BundlerBuildResult`
238
+ - invalid intermediate states still surface failures, but the watcher keeps running and recovers on the next valid filesystem change
217
239
 
218
240
  ```ts
219
- await watch({
241
+ import { watch } from "@trebired/bundler";
242
+
243
+ const session = await watch({
220
244
  discover: {
221
- dir: "./src/pages",
222
- include: ["**/*.tsx"],
245
+ dir: "./src/frontend",
246
+ rules: [
247
+ {
248
+ key: "client",
249
+ include: ["**/*.client.ts", "**/*.client.tsx"],
250
+ strategy: "entry",
251
+ },
252
+ {
253
+ key: "shared-script",
254
+ include: ["shared/**/*.ts", "shared/**/*.js"],
255
+ strategy: "bundle",
256
+ },
257
+ ],
223
258
  },
224
259
  outDir: "./dist",
225
260
  async onEntrySetChanged(entries) {
@@ -229,13 +264,13 @@ await watch({
229
264
  console.log(result.outputs);
230
265
  },
231
266
  });
232
- ```
233
267
 
234
- `onEntrySetChanged()` runs only when the resolved entry set changes. `onRebuilt()` runs after a successful rebuild result is assembled.
268
+ await session.dispose();
269
+ ```
235
270
 
236
271
  ## Import Graph Walking
237
272
 
238
- Use `walkImportGraph()` when a higher-level preset needs to inspect internal source dependencies without reimplementing relative import or tsconfig-path resolution:
273
+ Use `walkImportGraph()` when a higher-level tool needs to inspect internal source dependencies without bundling:
239
274
 
240
275
  ```ts
241
276
  import { walkImportGraph } from "@trebired/bundler";
@@ -246,131 +281,38 @@ const graph = await walkImportGraph({
246
281
  });
247
282
  ```
248
283
 
249
- The helper:
250
-
251
- - walks static imports, re-exports, and string-literal dynamic imports
252
- - resolves relative imports and tsconfig `paths`
253
- - returns a root-relative file graph with resolved internal imports marked explicitly
254
-
255
- ## Optimization Defaults
256
-
257
- `@trebired/bundler` now defaults to production-lean output through `mode: "compact"`:
258
-
259
- - `mode` defaults to `"compact"`
260
- - `minify` defaults to `true`
261
- - `stripComments` defaults to `true`
262
- - source annotations stay opt-in through `annotateSources: true`
263
-
264
- Available modes:
265
-
266
- - `debug`: readable output, no minification, no comment stripping by default
267
- - `compact`: minified output with stripped preserved comments by default
268
- - `extreme`: compact mode with the strongest package-owned compacting profile, without renaming classes or artifacts
269
-
270
- If you want a more readable debug build:
271
-
272
- ```ts
273
- await bundle({
274
- entries: {
275
- app: "./src/app.tsx",
276
- },
277
- mode: "debug",
278
- minify: false,
279
- outDir: "./dist",
280
- stripComments: false,
281
- });
282
- ```
284
+ It resolves:
283
285
 
284
- ## Extreme Mode
286
+ - relative imports
287
+ - re-exports
288
+ - string-literal dynamic imports
289
+ - tsconfig `paths`
285
290
 
286
- Use `mode: "extreme"` when you want the package to apply its strongest built-in compacting profile:
291
+ ## Public Config Shape
287
292
 
288
293
  ```ts
289
- await bundle({
290
- entries: {
291
- app: "./src/app.tsx",
292
- },
293
- mode: "extreme",
294
- outDir: "./dist",
295
- });
296
- ```
297
-
298
- This mode enables:
299
-
300
- - minification
301
- - stripped preserved comments
302
- - stable entry, chunk, and asset naming
303
-
304
- Today `extreme` intentionally keeps the same readable artifact and class names as other modes. The difference is its production-lean compacting profile, not obfuscation.
305
-
306
- ## Source Annotation Comments
307
-
308
- Set `annotateSources: true` to inject preserved inline comments into bundled output.
309
-
310
- JavaScript and TypeScript modules are annotated like this:
311
-
312
- ```js
313
- /*! source: src/app.tsx */
314
- ```
315
-
316
- CSS and SCSS sources are annotated like this:
317
-
318
- ```css
319
- /*! source: src/styles/site.scss */
320
- ```
321
-
322
- These comments are emitted with project-relative POSIX-style paths so the generated bundle still points back to the original source file that contributed that segment.
323
-
324
- ## Supported File Types
325
-
326
- The package supports:
327
-
328
- - `js`
329
- - `jsx`
330
- - `ts`
331
- - `tsx`
332
- - `css`
333
- - `scss`
334
-
335
- Plain JS, TS, JSX, TSX, and CSS are handled directly by `esbuild`. SCSS is compiled with `sass-embedded` and then passed back into the bundle pipeline as CSS.
336
-
337
- ## Logging
338
-
339
- Package-owned logs are normalized through `@trebired/logger-adapter`, the same way other packages published by Trebired do it.
340
-
341
- You can pass:
342
-
343
- - a logger using the same call shape as other Trebired packages
344
- - an event sink logger
345
- - a common logger object
346
- - a custom `loggerAdapter(logger, event)` for exact output control
294
+ type BundlerDiscoverRuleStrategy = "entry" | "bundle" | "ignore";
295
+
296
+ type BundlerDiscoverRule = {
297
+ key: string;
298
+ include: string[];
299
+ exclude?: string[];
300
+ strategy: BundlerDiscoverRuleStrategy;
301
+ maxBundleSize?: number | string;
302
+ };
347
303
 
348
- ## Public API
304
+ type BundlerDiscoverOptions = {
305
+ dir: string;
306
+ rules: BundlerDiscoverRule[];
307
+ ignoreDirs?: string[];
308
+ };
349
309
 
350
- ```ts
351
310
  type BundlerOptions = {
352
- entries?: string[] | Record<string, string>;
353
- discover?: {
354
- dir: string;
355
- include?: string[];
356
- exclude?: string[];
357
- extensions?: string[];
358
- ignoreDirs?: string[];
359
- namePrefix?: string;
360
- } | Array<{
361
- dir: string;
362
- include?: string[];
363
- exclude?: string[];
364
- extensions?: string[];
365
- ignoreDirs?: string[];
366
- namePrefix?: string;
367
- }>;
368
- virtualEntries?: Record<string, string>;
311
+ discover: BundlerDiscoverOptions | BundlerDiscoverOptions[];
369
312
  outDir: string;
370
313
  rootDir?: string;
371
- mode?: "debug" | "compact" | "extreme";
372
314
  environment?: "browser" | "node" | "neutral";
373
- format?: "esm" | "cjs" | "iife";
315
+ format?: Format;
374
316
  target?: string | string[];
375
317
  minify?: boolean;
376
318
  stripComments?: boolean;
@@ -381,45 +323,29 @@ type BundlerOptions = {
381
323
  define?: Record<string, string>;
382
324
  clean?: boolean;
383
325
  annotateSources?: boolean;
384
- manifest?: boolean | {
385
- file?: string;
386
- };
326
+ manifest?: boolean | { file?: string };
387
327
  onRebuilt?: (result: BundlerBuildResult) => void | Promise<void>;
388
328
  onEntrySetChanged?: (entries: Record<string, string>) => void | Promise<void>;
389
- logger?: unknown;
390
- loggerAdapter?: (logger: unknown, event: unknown) => unknown;
329
+ logger?: BundlerLogger;
330
+ loggerAdapter?: BundlerLoggerAdapter;
391
331
  };
332
+ ```
392
333
 
393
- declare function bundle(options: BundlerOptions): Promise<{
394
- entries: Record<string, string>;
395
- outputs: string[];
396
- warnings: number;
397
- metafile?: object;
398
- manifestPath?: string;
399
- durationMs: number;
400
- }>;
401
-
402
- declare function deriveManifest(
403
- metafile: object,
404
- options: {
405
- rootDir: string;
406
- outDir: string;
407
- },
408
- ): {
409
- entries: Record<string, unknown>;
410
- chunks: Record<string, unknown>;
411
- allOutputs: Record<string, unknown>;
412
- };
334
+ ## Migration Notes
413
335
 
414
- declare function watch(options: BundlerOptions): Promise<{
415
- rebuild(): Promise<{
416
- entries: Record<string, string>;
417
- outputs: string[];
418
- warnings: number;
419
- metafile?: object;
420
- manifestPath?: string;
421
- durationMs: number;
422
- }>;
423
- dispose(): Promise<void>;
424
- }>;
425
- ```
336
+ This release removes the old mixed entry model.
337
+
338
+ - `entries` is gone
339
+ - public `virtualEntries` is gone
340
+ - `mode` is gone
341
+ - `discover.include` / `discover.exclude` at the top level is replaced by ordered `discover.rules`
342
+ - runtime code using `entryNames` or `entrySources` should move to `assetManifest.sources` and `assetManifest.entries`
343
+
344
+ ## What It Does Not Do
345
+
346
+ This package does not:
347
+
348
+ - replace `esbuild`
349
+ - provide a dev server or HMR
350
+ - invent a custom runtime module system
351
+ - auto-convert grouped shared JS/TS sources into dependency-safe page entry imports
@@ -1 +1 @@
1
- {"version":3,"file":"asset-manifest.d.ts","sourceRoot":"","sources":["../../src/core/asset-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EAEpB,gCAAgC,EAChC,0BAA0B,EAE1B,+BAA+B,EAGhC,MAAM,aAAa,CAAC;AA8HrB,iBAAS,kBAAkB,CAAC,OAAO,EAAE,gCAAgC,GAAG,oBAAoB,CAkF3F;AA0CD,iBAAS,iBAAiB,CACxB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,GAAE,+BAAoC,GAC5C,0BAA0B,CAqD5B;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"asset-manifest.d.ts","sourceRoot":"","sources":["../../src/core/asset-manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAEpB,gCAAgC,EAChC,0BAA0B,EAE1B,+BAA+B,EAEhC,MAAM,aAAa,CAAC;AA2GrB,iBAAS,kBAAkB,CAAC,OAAO,EAAE,gCAAgC,GAAG,oBAAoB,CA0G3F;AAqCD,iBAAS,iBAAiB,CACxB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,GAAE,+BAAoC,GAC5C,0BAA0B,CAqD5B;AAED,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC"}