susee 2.0.4 → 2.1.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.
package/README.md CHANGED
@@ -9,508 +9,240 @@
9
9
 
10
10
  [![NPM][nodei_img]][nodei_url]
11
11
 
12
- [![npm version][npm_v_img]][npm_v_url] [![license][license_img]](LICENSE)[![OpenSSF Baseline](https://www.bestpractices.dev/projects/13115/baseline)](https://www.bestpractices.dev/projects/13115) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/13115/badge)](https://www.bestpractices.dev/projects/13115)
12
+ [![npm version][npm_v_img]][npm_v_url] [![license][license_img]](LICENSE) [![OpenSSF Baseline](https://www.bestpractices.dev/projects/13115/baseline)](https://www.bestpractices.dev/projects/13115) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/13115/badge)](https://www.bestpractices.dev/projects/13115)
13
13
 
14
14
  ## Overview
15
15
 
16
- `susee` is a **TypeScript-first bundler** specialized for library packages.Unlike general-purpose bundlers, `susee` focuses on consolidating a package's local TypeScript dependency tree into consolidated source units and compiling them into dual-format artifacts (ESM and CommonJS) using a high-performance `Rust` core.
17
-
18
- > [!NOTE]
19
- >
20
- > - Starting with **v2.0.0**, Susee's core is written in **Rust** and compiled to a native Node.js addon via **N-API** (`@napi-rs/cli`). The compiler, bundler, and minifier all run in native code for maximum performance.
21
- > - The output JavaScript is minified with the **[oxc](https://oxc.rs) minifier** when `minify` is enabled.
22
- > - Config files use the **JSONC** format (`susee.config.jsonc`).
23
-
24
- ---
16
+ `susee` is a **TypeScript-first bundler** powered by `oxc`, specialized for library packages. Unlike general-purpose bundlers, `susee` focuses on consolidating a package's local TypeScript dependency tree into consolidated source units and compiling them into dual-format artifacts (ESM and CommonJS).
25
17
 
26
18
  ## Key Features
27
19
 
28
- **Native Performance via N-API and Rust** — Key native components: Bundler , Compiler, Minifier, N-API Bridge
29
-
30
- **Dual-Format Module Output** — Generate both ESM and CommonJS formats automatically
31
-
32
- **Duplicate Declaration Detection** — Fails fast when bundled files contain conflicting top-level declarations
33
-
34
- **Fast Builds** — Optimized for library packages with minimal overhead
35
-
36
- ✅ **Built-in Minification** — Minify output JavaScript with the oxc minifier
37
-
38
- ✅ **Package.json Management** — Automatic updates to package.json fields based on the build results
39
-
40
- ✅ **CLI & Programmatic API** — Use as a CLI tool or integrate directly
41
-
42
- ---
20
+ - **TypeScript-first build flow** — built around library development, not application bundling. Preserves a package-oriented workflow with declaration output and clean library artifacts.
21
+ - **Dual output support** — produces both ESM and CommonJS from the same entry definition, so packages work with modern `import` and legacy `require` ecosystems.
22
+ - **Duplicate declaration validation** — when source consolidation produces conflicting top-level declarations, the build fails with file and location output instead of silently renaming.
23
+ - **Fast, low-overhead builds** — a lean pipeline that fits package development and release workflows without app-level complexity.
24
+ - **Package metadata update** — can update `package.json` `exports`, `main`, `module`, and `types` fields after build output is generated.
25
+ - **Built-in minification** — runs the `oxc-minify` minifier over emitted JavaScript when enabled.
26
+ - **CLI and programmatic API** — use the CLI for local development/CI, or call the build API for custom scripting.
27
+ - **JSX support** — detects JSX in bundled output and validates the JSX runtime (React or a configured `jsxImportSource`) before compiling.
43
28
 
44
- ## Installation and Quick Start
29
+ ## Install
45
30
 
46
- ### Installation Methods
47
-
48
- #### Local Development Dependency (Recommended)
49
-
50
- Install `susee` as a development dependency in your project:
51
-
52
- ```bash
31
+ ```sh
53
32
  npm i -D susee
54
33
  ```
55
34
 
56
- This method is recommended for library projects as it ensures the bundler version is locked to the project and available for CI/CD pipelines.
57
-
58
- #### Global Installation
59
-
60
- For system-wide availability of the `susee` CLI:
61
-
62
- ```bash
63
- npm install -g susee
64
- ```
65
-
66
- Global installation enables running `susee` directly from any directory without the `npx` prefix.
35
+ Verify the installation:
67
36
 
68
- #### Installation Verification
69
-
70
- After installation, verify the package is available by checking the version command:
71
-
72
- ```bash
37
+ ```sh
73
38
  npx susee --version
74
39
  ```
75
40
 
76
- ---
77
-
78
- ### Quick Start
41
+ ## Quick Start
79
42
 
80
- ### Using config file
43
+ ### 1. Create a config file
81
44
 
82
- The easiest way to start is using the built-in initialization command which generates a configuration template at your project root. This command creates a `susee.config.jsonc` file.
45
+ Generate a starter `susee.config.{ts,js,mjs}` in your project root:
83
46
 
84
- ```bash
47
+ ```sh
85
48
  npx susee init
86
49
  ```
87
50
 
88
- Build your project by running:
89
-
90
- ```bash
91
- npx susee
92
- ```
93
-
94
- ### Using Programmatic API (Node.js)
95
-
96
- You can trigger the build process within a JavaScript/TypeScript script using the `suseeBuild()` N-API function.
97
-
98
- ```typescript
99
- import { suseeBuild } from "susee";
100
-
101
- suseeBuild({
102
- entryPoints: [
103
- {
104
- entry: "src/index.ts",
105
- exportPath: ".",
106
- format: ["esm", "commonjs"],
107
- },
108
- ],
109
- outDir: "dist",
110
- allowUpdatePackageJson: true,
111
- minify: true,
112
- });
113
- ```
114
-
115
- ### Using CLI (Direct Build)
51
+ The interactive prompt asks whether your project is TypeScript. For TS projects it writes `susee.config.ts`; for JS projects it writes `susee.config.js` (ESM) or `susee.config.mjs` (CommonJS) based on your `package.json#type`.
116
52
 
117
- Build a single entry directly without a config file. This method uses default values for options not explicitly provided.
118
-
119
- ```bash
120
- npx susee build src/index.ts --outdir dist --format esm --minify
121
- ```
122
-
123
- ### Contributor Setup (Repository)
124
-
125
- When contributing to this repository, use `npm` to keep installs aligned with `package-lock.json` and npm-based scripts.
126
-
127
- ```bash
128
- npm install
129
- npm run hooks:install
130
- ```
131
-
132
- This installs project dependencies and configures local git hooks for commit workflow checks.
133
-
134
- ---
135
-
136
- ## Security
137
-
138
- Please report vulnerabilities privately and follow the disclosure process in [SECURITY.md](./SECURITY.md).
139
-
140
- Do not open public issues for security reports.
141
-
142
- ---
143
-
144
- ## N-API (Node.js) Exports
145
-
146
- Susee's Rust core is exposed to Node.js via N-API (`@napi-rs/cli`). The following functions and types are available:
147
-
148
- ### `suseeBuild(config?)`
149
-
150
- Build from the provided config object or from a discovered `susee.config.jsonc` file. If neither exists, Susee logs an error and exits with code `1`.
53
+ ### 2. Define your entries
151
54
 
152
55
  ```ts
153
- import { suseeBuild, type SuSeeConfig } from "susee";
56
+ // susee.config.ts
57
+ import type { SuSeeConfig } from "susee";
154
58
 
155
- // Build from an explicit config object
156
- suseeBuild({
59
+ const config: SuSeeConfig = {
157
60
  entryPoints: [
158
61
  {
159
- entry: "src/index.ts",
160
- exportPath: ".",
161
- format: ["esm", "commonjs"],
62
+ entry: "src/index.ts", // required — entry file path
63
+ exportPath: ".", // required — "." for main export, or "./foo"
64
+ format: ["esm"], // optional, default ["esm"]
65
+ tsconfigFilePath: undefined, // optional, custom tsconfig
66
+ checks: { // optional, all default false
67
+ checkAnonymous: false,
68
+ checkDefaultExports: false,
69
+ checkNpmInstalled: false,
70
+ },
71
+ minify: false, // optional: true | { options: MinifyOptions }
162
72
  },
163
73
  ],
164
- outDir: "dist",
165
- allowUpdatePackageJson: false,
166
- minify: true,
167
- });
168
-
169
- // Build from susee.config.jsonc (config omitted)
170
- suseeBuild();
171
- ```
172
-
173
- | Parameter | Type | Required | Default | Description |
174
- | --------- | -------------------------- | -------- | ------- | --------------------------------------------- |
175
- | `config` | `SuSeeConfig \| undefined` | No | — | Build options. If omitted, loads config file. |
176
-
177
- ### `cliBuild(args)`
178
-
179
- Run the CLI dispatcher programmatically. Pass `process.argv.slice(2)` from the JavaScript side.
180
-
181
- ```ts
182
- import { cliBuild } from "susee";
74
+ outDir: "dist", // optional, default "dist"
75
+ allowUpdatePackageJson: false, // optional, default false
76
+ };
183
77
 
184
- cliBuild(process.argv.slice(2));
78
+ export default config;
185
79
  ```
186
80
 
187
- | Parameter | Type | Required | Description |
188
- | --------- | ---------- | -------- | -------------------------------------------------- |
189
- | `args` | `string[]` | Yes | CLI arguments (typically `process.argv.slice(2)`). |
81
+ ### 3. Build
190
82
 
191
- ### `suseeBundler(entry)`
192
-
193
- Bundle a single entry and return the merged source string. This export does not expose plugin or warning options.
194
-
195
- ```ts
196
- import { suseeBundler } from "susee";
197
-
198
- const bundled = suseeBundler("src/index.ts");
199
- console.log(bundled);
83
+ ```sh
84
+ npx susee build
200
85
  ```
201
86
 
202
- | Parameter | Type | Required | Description |
203
- | --------- | -------- | -------- | ----------------------------------------- |
204
- | `entry` | `string` | Yes | Entry file path relative to project root. |
205
-
206
- **Returns:** `string` — the bundled source code.
207
-
208
- ### `OutputFormat` (enum)
209
-
210
- N-API enum representing the output module format.
211
-
212
- ```ts
213
- enum OutputFormat {
214
- Esm = "esm",
215
- Commonjs = "commonjs",
216
- }
217
- ```
87
+ Susee reads your config, bundles each entry point, compiles to ESM and/or CommonJS, and writes output to `dist` by default.
218
88
 
219
- ### `SuSeeConfig` (object)
89
+ ## CLI
220
90
 
221
- ```ts
222
- interface SuSeeConfig {
223
- entryPoints: EntryPoint[];
224
- outDir?: string; // default: "dist"
225
- allowUpdatePackageJson?: boolean; // default: false
226
- minify?: boolean; // default: false
227
- }
228
91
  ```
229
-
230
- ### `EntryPoint` (object)
231
-
232
- ```ts
233
- interface EntryPoint {
234
- entry: string;
235
- exportPath: string; // "." or "./sub/path"
236
- format?: OutputFormat[]; // default: ["esm"]
237
- tsconfigFilePath?: string | null; // default: null
238
- warning?: boolean; // default: false
239
- }
92
+ susee build Build using susee.config.{ts,js,mjs}
93
+ susee init Generate susee.config.{ts,js,mjs}
94
+ susee --version / -v Print version
95
+ susee --help / -h Show help
96
+ susee build <entry> [options] Build from a single entry file
240
97
  ```
241
98
 
242
- ---
243
-
244
- ## Rust API
245
-
246
- The Rust core library exposes the following public functions and types via the `susee` crate:
247
-
248
- ### `core::build(config: Option<&SuSeeConfig>)`
99
+ ### Build Flags
249
100
 
250
- Top-level build entry point. When `config` is `None`, the config is loaded from `susee.config.jsonc` in the current directory.
101
+ | Flag | Type | Default | Description |
102
+ |------|------|---------|-------------|
103
+ | `--entry <path>` | string | — | Entry file (optional if given positionally) |
104
+ | `--outdir <path>` | string | `dist` | Output directory |
105
+ | `--format` | `cjs\|commonjs\|esm` | `esm` | Output module format |
106
+ | `--tsconfig <path>` | string | `undefined` | Custom tsconfig path |
107
+ | `--allow-update[=true\|false]` | boolean | `false` | Allow `package.json` updates |
108
+ | `--minify[=true\|false]` | boolean | `false` | Minify output JS |
109
+ | `--check[=true\|false]` | boolean | `false` | Run bundler lint checks |
251
110
 
252
- ```rust
253
- use susee::{SuSeeConfig,susee_build};
111
+ Flags accept both `--flag=value` and `--flag value` syntax.
254
112
 
255
- // Build from config file
256
- core::build(None);
113
+ ### Examples
257
114
 
258
- // Build from explicit config
259
- let config = SuSeeConfig {
260
- entry_points: vec![susee::core::EntryPoint {
261
- entry: "src/index.ts".to_string(),
262
- export_path: ".".to_string(),
263
- format: Some(vec![susee::core::OutputFormat::Esm]),
264
- tsconfig_file_path: None,
265
- warning: Some(false),
266
- }],
267
- out_dir: Some("dist".to_string()),
268
- allow_update_package_json: Some(false),
269
- minify: Some(true),
270
- };
271
- susee_build(Some(&config));
115
+ ```sh
116
+ npx susee build src/index.ts --outdir dist
117
+ npx susee build src/index.ts --format commonjs
118
+ npx susee build --entry src/index.ts --format esm --tsconfig tsconfig.build.json
119
+ npx susee build src/index.ts --minify
272
120
  ```
273
121
 
274
- ### `core::susee_build(config: &SuSeeConfig) -> Result<(), String>`
275
-
276
- Build from a config reference. Returns `Ok(())` on success or an error string on failure.
122
+ ## Programmatic API
277
123
 
278
- ```rust
279
- use susee::{susee_build, SuSeeConfig, EntryPoint, OutputFormat};
124
+ ```ts
125
+ import { build, type SuSeeConfig } from "susee";
280
126
 
281
- let config = SuSeeConfig {
282
- entry_points: vec![EntryPoint {
283
- entry: "src/index.ts".to_string(),
284
- export_path: ".".to_string(),
285
- format: Some(vec![OutputFormat::Esm, OutputFormat::Commonjs]),
286
- tsconfig_file_path: None,
287
- warning: Some(false),
288
- }],
289
- out_dir: Some("dist".to_string()),
290
- allow_update_package_json: Some(false),
291
- minify: Some(true),
127
+ const config: SuSeeConfig = {
128
+ entryPoints: [
129
+ { entry: "src/index.ts", exportPath: "." },
130
+ ],
131
+ outDir: "dist",
132
+ allowUpdatePackageJson: true,
292
133
  };
293
134
 
294
- susee_build(&config).expect("build failed");
135
+ await build(config);
295
136
  ```
296
137
 
297
- ### `core::bundler(entry: &str, cwd: &str) -> std::io::Result<BundleResult>`
298
-
299
- Bundle a single entry and return the merged source string along with project type metadata.
300
-
301
- ```rust
302
- use susee::core::bundler;
303
-
304
- let result = bundler("src/index.ts", ".")?;
305
- println!("{}", result.bundled_code);
138
+ `build()` resolves options from the argument first, then from a root config file. If neither is available it logs an error and exits with code 1.
139
+
140
+ ## How It Works
141
+
142
+ ```mermaid
143
+ flowchart TD
144
+ A[CLI / Programmatic API] --> B["build()"]
145
+ B --> C{options provided?}
146
+ C -->|yes| D[generateBuildOptions]
147
+ C -->|no| E[finalSuseeConfig]
148
+ E -->|no config| F[Error + exit 1]
149
+ E -->|found| D
150
+ D --> G[Compiler]
151
+ G --> H[For each entry point]
152
+ H --> I["bundler() — suseeBundler (oxc)"]
153
+ I --> J[Bundled source string]
154
+ J --> K{format}
155
+ K -->|commonjs| L["_commonjs()"]
156
+ K -->|esm| M["_esm()"]
157
+ L --> N["suseeCompiler — ts6 in-memory host"]
158
+ M --> N
159
+ N --> O["getCompilerOptions — tsconfig → per-format"]
160
+ O --> P["ts6.createProgram + emit"]
161
+ P --> Q{minify?}
162
+ Q -->|yes| R[oxcMinify]
163
+ Q -->|no| S["Write .cjs/.mjs + .d.* + .map"]
164
+ R --> S
165
+ S --> T{update package?}
166
+ T -->|yes| U["files.writePackageJson"]
306
167
  ```
307
168
 
308
- ### `core::susee_cli_build_with_args(args: Vec<String>)`
309
-
310
- CLI dispatcher with explicit args. Reads `std::env::args_os().skip(1)` for the standalone binary, or accepts args passed from the N-API layer.
169
+ The pipeline bundles each entry point's local dependency tree into a single source string, compiles it in-memory with the TypeScript compiler (`@suseejs/ts6`), optionally minifies with `oxc-minify`, and writes dual-format artifacts with declaration and source-map files.
311
170
 
312
- ```rust
313
- use susee::core::susee_cli_build_with_args;
171
+ ## Source Architecture
314
172
 
315
- susee_cli_build_with_args(vec!["build".to_string(), "src/index.ts".to_string()]);
316
173
  ```
317
-
318
- ### Rust Types
319
-
320
- #### `SuSeeConfig`
321
-
322
- ```rust
323
- pub struct SuSeeConfig {
324
- pub entry_points: Vec<EntryPoint>,
325
- pub out_dir: Option<String>,
326
- pub allow_update_package_json: Option<bool>,
327
- pub minify: Option<bool>,
328
- }
174
+ src/
175
+ ├── index.ts # Public API — re-exports build + SuSeeConfig
176
+ ├── build.ts # Build orchestrator — resolves config, runs Compiler
177
+ ├── bundler.ts # Wrapper around @suseejs/susee_bundler (oxc)
178
+ ├── cli/
179
+ │ ├── index.ts # CLI entrypoint & command dispatch
180
+ │ ├── parse_args.ts # Parses CLI flags into SuSeeConfig
181
+ │ ├── init.ts # `susee init` — scaffolds config file
182
+ │ └── print_help.ts # `susee --help` output
183
+ ├── compiler/
184
+ │ ├── index.ts # Compiler class — bundles + emits CJS/ESM + types
185
+ │ ├── suseeCompiler.ts# In-memory TypeScript compilation host
186
+ │ └── tsoptions.ts # Resolves tsconfig.json into per-format options
187
+ ├── config/
188
+ │ └── index.ts # Config types, validation, and normalization
189
+ └── helpers/
190
+ ├── files.ts # File system namespace + package.json writer
191
+ └── minify.ts # oxc-minify wrapper
329
192
  ```
330
193
 
331
- #### `EntryPoint`
194
+ See [`src/README.md`](src/README.md) for detailed module documentation.
332
195
 
333
- ```rust
334
- pub struct EntryPoint {
335
- pub entry: String,
336
- pub export_path: String,
337
- pub format: Option<Vec<OutputFormat>>,
338
- pub tsconfig_file_path: Option<String>,
339
- pub warning: Option<bool>,
340
- }
341
- ```
196
+ ## Configuration Reference
342
197
 
343
- #### `OutputFormat`
198
+ ### `SuSeeConfig`
344
199
 
345
- ```rust
346
- #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
347
- #[serde(rename_all = "lowercase")]
348
- pub enum OutputFormat {
349
- Commonjs, // serialized as "commonjs"
350
- Esm, // serialized as "esm"
351
- }
352
- ```
353
-
354
- #### `BuildOptions` (internal)
200
+ | Field | Type | Required | Default | Description |
201
+ |-------|------|----------|---------|-------------|
202
+ | `entryPoints` | `EntryPoint[]` | yes | — | Array of entry point definitions |
203
+ | `outDir` | `string` | no | `dist` | Output directory |
204
+ | `allowUpdatePackageJson` | `boolean` | no | `false` | Allow susee to update `package.json` |
355
205
 
356
- ```rust
357
- pub struct BuildOptions {
358
- pub build_entry_points: Vec<BuildEntryPoint>,
359
- pub update_package: bool,
360
- pub out_dir: String,
361
- pub minify: bool,
362
- }
363
- ```
206
+ ### `EntryPoint`
364
207
 
365
- ### Cargo.toml
208
+ | Field | Type | Required | Default | Description |
209
+ |-------|------|----------|---------|-------------|
210
+ | `entry` | `string` | yes | — | Entry file path |
211
+ | `exportPath` | `"." \| "./${string}"` | yes | — | Export path for this entry |
212
+ | `format` | `("commonjs" \| "esm")[]` | no | `["esm"]` | Output module formats |
213
+ | `tsconfigFilePath` | `string` | no | `undefined` | Custom tsconfig path |
214
+ | `checks` | `CheckOptions` | no | all `false` | Bundler lint checks |
215
+ | `minify` | `boolean \| { options: MinifyOptions }` | no | `false` | Minify output |
366
216
 
367
- ```toml
368
- [dependencies]
369
- susee = "2"
370
- ```
217
+ ### `CheckOptions`
371
218
 
372
- ---
219
+ | Field | Type | Default | Description |
220
+ |-------|------|---------|-------------|
221
+ | `checkAnonymous` | `boolean` | `false` | Check for anonymous declarations |
222
+ | `checkDefaultExports` | `boolean` | `false` | Check default exports |
223
+ | `checkNpmInstalled` | `boolean` | `false` | Check that npm deps are installed |
373
224
 
374
- ## CLI Usage
225
+ ### TSConfig Resolution Priority
375
226
 
376
- ```txt
377
- Susee CLI.
227
+ For each entry point, compiler options resolve in this order:
378
228
 
379
- Usage:
380
- susee Build using susee.config.jsonc
381
- susee init Generate susee.config.jsonc
382
- susee --version | -v Check susee version
383
- susee --help | -h Show this message
384
- susee build <entry> [options] Build from a single entry file
385
- ```
229
+ 1. Custom `tsconfigFilePath` on the entry point
230
+ 2. `tsconfig.json` at the project root
231
+ 3. Susee defaults (`module: ES2020` for ESM, `module: CommonJS` for CJS, `target: Latest`)
386
232
 
387
- ### CLI Build Options
233
+ ## Development
388
234
 
389
- ```txt
390
- --entry <path> Entry file (optional if provided as positional <entry>)
391
- --outdir <path> Output directory (default: dist)
392
- --format <cjs|commonjs|esm> Output format (default: esm)
393
- --tsconfig <path> Custom tsconfig path
394
- --allow-update[=true|false] Allow package.json updates (default: false)
395
- --warning[=true|false] Treat dependency graph warnings as fatal (default: false)
396
- --minify[=true|false] Minify output JavaScript code (default: false)
235
+ ```sh
236
+ npm run build # compile src/ via oxnode build.ts
237
+ npm run lint # oxlint
238
+ npm run fmt # oxfmt
397
239
  ```
398
240
 
399
- ### CLI Examples
400
-
401
- ```bash
402
- npx susee build src/index.ts --outdir dist
403
- npx susee build src/index.ts --format commonjs
404
- npx susee build --entry src/index.ts --format esm
405
- ```
406
-
407
- Notes:
408
-
409
- 1. `susee build` accepts either a positional `<entry>` or `--entry <path>`.
410
- 2. `--profile` is also accepted on plain `susee` config-driven builds.
411
- 3. `--minify` enables the oxc minifier on the emitted JavaScript output.
412
- 4. The CLI clears the target `outDir` before writing new output.
413
-
414
- ---
415
-
416
- ## Config File
417
-
418
- The config file uses the **JSONC** format (JSON with comments) and must be named:
419
-
420
- - `susee.config.jsonc`
421
-
422
- ### `susee.config.jsonc` example
423
-
424
- ```jsonc
425
- {
426
- // Entry points to bundle
427
- "entryPoints": [
428
- {
429
- "entry": "src/index.ts",
430
- "exportPath": ".",
431
- "format": ["esm", "commonjs"],
432
- "tsconfigFilePath": null,
433
- "warning": false,
434
- },
435
- ],
436
- // Output directory (default: "dist")
437
- "outDir": "dist",
438
- // Update package.json fields from build output (default: false)
439
- "allowUpdatePackageJson": false,
440
- // Minify output JS with the oxc minifier (default: false)
441
- "minify": true,
442
- }
443
- ```
444
-
445
- ### Config schema
446
-
447
- | Field | Type | Required | Default | Description |
448
- | -------------------------------- | -------------- | -------- | --------- | ---------------------------------------- |
449
- | `entryPoints` | `EntryPoint[]` | Yes | — | List of entry points to build. |
450
- | `outDir` | `string` | No | `"dist"` | Root output directory. |
451
- | `allowUpdatePackageJson` | `boolean` | No | `false` | Update package.json from build output. |
452
- | `minify` | `boolean` | No | `false` | Minify emitted JS with the oxc minifier. |
453
- | `entryPoints[].entry` | `string` | Yes | — | Entry file path. |
454
- | `entryPoints[].exportPath` | `string` | Yes | — | Package export path (`.` or `./sub`). |
455
- | `entryPoints[].format` | `string[]` | No | `["esm"]` | Output formats: `"esm"`, `"commonjs"`. |
456
- | `entryPoints[].tsconfigFilePath` | `string\|null` | No | `null` | Custom tsconfig path. |
457
- | `entryPoints[].warning` | `boolean` | No | `false` | Treat dependency warnings as fatal. |
458
-
459
- ---
460
-
461
- ## Output Notes
462
-
463
- For an entry like `src/index.ts` with both formats enabled, output includes:
464
-
465
- 1. ESM: `dist/index.mjs`
466
- 2. CommonJS: `dist/index.cjs`
467
- 3. Type declarations: `dist/index.d.mts` and `dist/index.d.cts`
468
- 4. Sourcemaps: `dist/index.mjs.map` and `dist/index.cjs.map`
469
-
470
- When `minify` is enabled, the ESM and CommonJS output files are minified using the **oxc** minifier.
471
-
472
- Declaration files are emitted by the compiler when available.
473
-
474
- ## Build Output Matrix
475
-
476
- | Input | Output Directory Rule | ESM Files | CommonJS Files |
477
- | -------------------------------------------- | --------------------- | ------------------------------------------- | ------------------------------------------- |
478
- | `entry: "src/index.ts"`, `exportPath: "."` | `<outDir>` | `index.mjs`, `index.mjs.map`, `index.d.mts` | `index.cjs`, `index.cjs.map`, `index.d.cts` |
479
- | `entry: "src/foo.ts"`, `exportPath: "./foo"` | `<outDir>/foo` | `foo.mjs`, `foo.mjs.map`, `foo.d.mts` | `foo.cjs`, `foo.cjs.map`, `foo.d.cts` |
480
-
481
- Notes:
482
-
483
- 1. Default `outDir` is `dist` when not set.
484
- 2. For subpath exports, output directory is computed as `outDir + exportPath.slice(1)`.
485
- 3. Declarations (`.d.mts` / `.d.cts`) are emitted when provided by the underlying compiler result.
486
-
487
- ## Package.json Update Matrix
488
-
489
- When `allowUpdatePackageJson` (config) or `--allow-update` (CLI build) is enabled, Susee rewrites package metadata from the emitted file paths.
490
-
491
- 1. Main export build with `exportPath: "."` and CommonJS output: updates `main` to the generated `.cjs` file.
492
- 2. Main export build with `exportPath: "."` and ESM output: updates `module` to the generated `.mjs` file.
493
- 3. Main export build with `exportPath: "."` and declarations: updates `types` to the generated declaration file.
494
- 4. Any export build with generated import or require declarations: creates or merges `exports` entries for that export path.
495
- 5. Any package update: forces `type` to `"module"`.
496
-
497
- Notes:
498
-
499
- 1. Package update requires a `package.json` file in the project root.
500
- 2. For subpath exports, Susee merges the generated entry into existing `exports` when that field is an object.
501
- 3. For the main export path `.`, Susee replaces `exports` with the generated root mapping.
502
-
503
- ## Validation Rules
504
-
505
- From config validation logic:
506
-
507
- 1. At least one `entryPoints` item is required.
508
- 2. Duplicate `exportPath` values are rejected.
509
- 3. Each `entry` path must exist.
510
- 4. Duplicate top-level declarations across bundled files fail the build during dependency analysis.
511
- 5. CommonJS modules in the dependency tree fail the build unless you handle them with `@suseejs/commonjs-plugin`.
241
+ ## Key Dependencies
512
242
 
513
- Violations print an error and exit with code `1`.
243
+ - [`@suseejs/susee_bundler`](https://www.npmjs.com/package/@suseejs/susee_bundler) oxc-powered bundling engine
244
+ - [`@suseejs/ts6`](https://www.npmjs.com/package/@suseejs/ts6) — TypeScript compiler fork for type-checking and declaration emit
245
+ - [`oxc-minify`](https://www.npmjs.com/package/oxc-minify) — JavaScript minification
514
246
 
515
247
  ## License
516
248
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map