susee 2.0.3 → 2.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.
- package/README.md +31 -32
- package/bin/susee +1 -2
- package/dist/index.d.mts +92 -0
- package/dist/index.mjs +651 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +63 -36
- package/index.d.ts +0 -140
- package/index.js +0 -708
package/README.md
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<img src="https://susee.phothin.dev/logo/susee-bg-white.webp" width="160" height="160" alt="susee" />
|
|
5
5
|
<h1>Susee</h1>
|
|
6
|
+
<p>A high-performance TypeScript library bundler</p>
|
|
6
7
|
</div>
|
|
7
8
|
<!-- markdownlint-enable MD033 -->
|
|
8
9
|
|
|
9
10
|
[![NPM][nodei_img]][nodei_url]
|
|
10
11
|
|
|
11
|
-
[![npm version][npm_v_img]][npm_v_url] [![license][license_img]](LICENSE)[![
|
|
12
|
+
[![npm version][npm_v_img]][npm_v_url] [![license][license_img]](LICENSE)[](https://www.bestpractices.dev/projects/13115) [](https://www.bestpractices.dev/projects/13115)
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
+
## Overview
|
|
14
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.
|
|
16
17
|
|
|
17
18
|
> [!NOTE]
|
|
18
19
|
>
|
|
@@ -24,11 +25,9 @@ A **TypeScript-first** bundler designed specifically for **library packages** th
|
|
|
24
25
|
|
|
25
26
|
## Key Features
|
|
26
27
|
|
|
27
|
-
✅ **
|
|
28
|
+
✅ **Native Performance via N-API and Rust** — Key native components: Bundler , Compiler, Minifier, N-API Bridge
|
|
28
29
|
|
|
29
|
-
✅ **
|
|
30
|
-
|
|
31
|
-
✅ **Dual Output** — Generate both ESM and CommonJS formats automatically
|
|
30
|
+
✅ **Dual-Format Module Output** — Generate both ESM and CommonJS formats automatically
|
|
32
31
|
|
|
33
32
|
✅ **Duplicate Declaration Detection** — Fails fast when bundled files contain conflicting top-level declarations
|
|
34
33
|
|
|
@@ -171,9 +170,9 @@ suseeBuild({
|
|
|
171
170
|
suseeBuild();
|
|
172
171
|
```
|
|
173
172
|
|
|
174
|
-
| Parameter
|
|
175
|
-
|
|
|
176
|
-
| `config`
|
|
173
|
+
| Parameter | Type | Required | Default | Description |
|
|
174
|
+
| --------- | -------------------------- | -------- | ------- | --------------------------------------------- |
|
|
175
|
+
| `config` | `SuSeeConfig \| undefined` | No | — | Build options. If omitted, loads config file. |
|
|
177
176
|
|
|
178
177
|
### `cliBuild(args)`
|
|
179
178
|
|
|
@@ -185,9 +184,9 @@ import { cliBuild } from "susee";
|
|
|
185
184
|
cliBuild(process.argv.slice(2));
|
|
186
185
|
```
|
|
187
186
|
|
|
188
|
-
| Parameter | Type
|
|
189
|
-
| --------- |
|
|
190
|
-
| `args` | `string[]`
|
|
187
|
+
| Parameter | Type | Required | Description |
|
|
188
|
+
| --------- | ---------- | -------- | -------------------------------------------------- |
|
|
189
|
+
| `args` | `string[]` | Yes | CLI arguments (typically `process.argv.slice(2)`). |
|
|
191
190
|
|
|
192
191
|
### `suseeBundler(entry)`
|
|
193
192
|
|
|
@@ -222,9 +221,9 @@ enum OutputFormat {
|
|
|
222
221
|
```ts
|
|
223
222
|
interface SuSeeConfig {
|
|
224
223
|
entryPoints: EntryPoint[];
|
|
225
|
-
outDir?: string;
|
|
224
|
+
outDir?: string; // default: "dist"
|
|
226
225
|
allowUpdatePackageJson?: boolean; // default: false
|
|
227
|
-
minify?: boolean;
|
|
226
|
+
minify?: boolean; // default: false
|
|
228
227
|
}
|
|
229
228
|
```
|
|
230
229
|
|
|
@@ -233,10 +232,10 @@ interface SuSeeConfig {
|
|
|
233
232
|
```ts
|
|
234
233
|
interface EntryPoint {
|
|
235
234
|
entry: string;
|
|
236
|
-
exportPath: string;
|
|
237
|
-
format?: OutputFormat[];
|
|
235
|
+
exportPath: string; // "." or "./sub/path"
|
|
236
|
+
format?: OutputFormat[]; // default: ["esm"]
|
|
238
237
|
tsconfigFilePath?: string | null; // default: null
|
|
239
|
-
warning?: boolean;
|
|
238
|
+
warning?: boolean; // default: false
|
|
240
239
|
}
|
|
241
240
|
```
|
|
242
241
|
|
|
@@ -431,31 +430,31 @@ The config file uses the **JSONC** format (JSON with comments) and must be named
|
|
|
431
430
|
"exportPath": ".",
|
|
432
431
|
"format": ["esm", "commonjs"],
|
|
433
432
|
"tsconfigFilePath": null,
|
|
434
|
-
"warning": false
|
|
435
|
-
}
|
|
433
|
+
"warning": false,
|
|
434
|
+
},
|
|
436
435
|
],
|
|
437
436
|
// Output directory (default: "dist")
|
|
438
437
|
"outDir": "dist",
|
|
439
438
|
// Update package.json fields from build output (default: false)
|
|
440
439
|
"allowUpdatePackageJson": false,
|
|
441
440
|
// Minify output JS with the oxc minifier (default: false)
|
|
442
|
-
"minify": true
|
|
441
|
+
"minify": true,
|
|
443
442
|
}
|
|
444
443
|
```
|
|
445
444
|
|
|
446
445
|
### Config schema
|
|
447
446
|
|
|
448
|
-
| Field
|
|
449
|
-
|
|
|
450
|
-
| `entryPoints`
|
|
451
|
-
| `outDir`
|
|
452
|
-
| `allowUpdatePackageJson
|
|
453
|
-
| `minify`
|
|
454
|
-
| `entryPoints[].entry`
|
|
455
|
-
| `entryPoints[].exportPath`
|
|
456
|
-
| `entryPoints[].format`
|
|
457
|
-
| `entryPoints[].tsconfigFilePath` | `string\|null` | No
|
|
458
|
-
| `entryPoints[].warning`
|
|
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. |
|
|
459
458
|
|
|
460
459
|
---
|
|
461
460
|
|
package/bin/susee
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type CheckOptions } from '@suseejs/susee_bundler';
|
|
2
|
+
import { type MinifyOptions } from 'oxc-minify';
|
|
3
|
+
type OutputFormat = ('commonjs' | 'esm')[];
|
|
4
|
+
interface EntryPoint {
|
|
5
|
+
/**
|
|
6
|
+
* Entry of file path of package
|
|
7
|
+
*
|
|
8
|
+
* required
|
|
9
|
+
*/
|
|
10
|
+
entry: string;
|
|
11
|
+
/**
|
|
12
|
+
* Info for output
|
|
13
|
+
*
|
|
14
|
+
* required
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* path for package
|
|
18
|
+
*
|
|
19
|
+
* required
|
|
20
|
+
*/
|
|
21
|
+
exportPath: '.' | `./${string}`;
|
|
22
|
+
/**
|
|
23
|
+
* Output module type of package
|
|
24
|
+
*
|
|
25
|
+
* default - [esm]
|
|
26
|
+
*/
|
|
27
|
+
format?: OutputFormat;
|
|
28
|
+
/**
|
|
29
|
+
* Custom tsconfig.json path for package typescript compiler options
|
|
30
|
+
*
|
|
31
|
+
* Priority -
|
|
32
|
+
* 1. this custom tsconfig.json
|
|
33
|
+
* 2. tsconfig.json at root directory
|
|
34
|
+
* 3. default compiler options of susee
|
|
35
|
+
*
|
|
36
|
+
* default - undefined
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
tsconfigFilePath?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Lint checks to run on the bundled output.
|
|
42
|
+
*
|
|
43
|
+
* default - { checkAnonymous: false, checkDefaultExports: false, checkNpmInstalled: false }
|
|
44
|
+
*/
|
|
45
|
+
checks?: CheckOptions;
|
|
46
|
+
/**
|
|
47
|
+
* Minify the bundled output.
|
|
48
|
+
*
|
|
49
|
+
* Pass `true` for default minification, or an object with custom `MinifyOptions`.
|
|
50
|
+
*
|
|
51
|
+
* default - false
|
|
52
|
+
*/
|
|
53
|
+
minify?: boolean | {
|
|
54
|
+
options: MinifyOptions;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Configuration for Susee Bundler
|
|
59
|
+
*/
|
|
60
|
+
interface SuSeeConfig {
|
|
61
|
+
/**
|
|
62
|
+
* Array of entry points object
|
|
63
|
+
*
|
|
64
|
+
* required
|
|
65
|
+
*/
|
|
66
|
+
entryPoints: EntryPoint[];
|
|
67
|
+
/**
|
|
68
|
+
* Out directory
|
|
69
|
+
*
|
|
70
|
+
* default - dist
|
|
71
|
+
*/
|
|
72
|
+
outDir?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Allow bundler to update your package.json.
|
|
75
|
+
*
|
|
76
|
+
* default - false
|
|
77
|
+
*/
|
|
78
|
+
allowUpdatePackageJson?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Run a Susee build.
|
|
82
|
+
*
|
|
83
|
+
* Resolution order:
|
|
84
|
+
* 1. Use `options` when provided.
|
|
85
|
+
* 2. Otherwise try loading root config via `finalSuseeConfig()`.
|
|
86
|
+
*
|
|
87
|
+
* If neither source is available, this logs an error and exits with code 1.
|
|
88
|
+
*/
|
|
89
|
+
declare function build(options?: SuSeeConfig): any;
|
|
90
|
+
export type { SuSeeConfig };
|
|
91
|
+
export { build };
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|