susee 0.1.2 → 0.1.4
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 +21 -6
- package/dist/index.cjs +1 -1664
- package/dist/index.cjs.map +1 -8
- package/dist/index.d.cts +10 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1626
- package/dist/index.mjs.map +1 -8
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
<h1>susee</h1>
|
|
4
4
|
</div>
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Susee is a small TypeScript bundler that collates a package's local dependency tree, then emits compiled artifacts for ESM and/or CommonJS along with type definitions. It can also update `package.json` exports automatically for main and subpath exports.
|
|
7
7
|
|
|
8
8
|
**Key points**
|
|
9
|
+
|
|
9
10
|
- Produces ESM (`.mjs`) and/or CommonJS (`.cjs`) outputs and corresponding type files (`.d.mts` / `.d.cts`).
|
|
10
11
|
- Merges local dependency files into a single bundled input for the TypeScript compiler.
|
|
11
12
|
- Supports simple plugin hooks at multiple stages: `dependency`, `pre-process`, and `post-process`.
|
|
@@ -41,25 +42,35 @@ Example `susee.config.ts`:
|
|
|
41
42
|
|
|
42
43
|
```ts
|
|
43
44
|
import type { SuSeeConfig } from "susee";
|
|
45
|
+
import suseeBannerText from "@suseejs/plugin-banner-text";
|
|
46
|
+
import suseeTerser from "@suseejs/plugin-terser";
|
|
47
|
+
|
|
48
|
+
const licenseText = `
|
|
49
|
+
/*! *****************************************************************************
|
|
50
|
+
Copyright (c) John Doe <johndoe@jhondoe.org>
|
|
51
|
+
|
|
52
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
53
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
54
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
+
***************************************************************************** */
|
|
56
|
+
`.trim();
|
|
44
57
|
|
|
45
58
|
const config: SuSeeConfig = {
|
|
46
59
|
entryPoints: [
|
|
47
60
|
{
|
|
48
61
|
entry: "src/index.ts",
|
|
49
62
|
exportPath: ".",
|
|
50
|
-
format: "both",
|
|
51
|
-
renameDuplicates: true,
|
|
52
|
-
outDir: "dist",
|
|
63
|
+
format: "both",
|
|
53
64
|
},
|
|
54
65
|
],
|
|
55
|
-
|
|
56
|
-
allowUpdatePackageJson: true,
|
|
66
|
+
plugins: [suseeBannerText(licenseText), suseeTerser()],
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
export default config;
|
|
60
70
|
```
|
|
61
71
|
|
|
62
72
|
Config summary:
|
|
73
|
+
|
|
63
74
|
- `entryPoints`: array of entry definitions
|
|
64
75
|
- `entry` — path to entry file (required)
|
|
65
76
|
- `exportPath` — `.` or a subpath like `./feature`
|
|
@@ -73,6 +84,7 @@ Config summary:
|
|
|
73
84
|
## Plugins
|
|
74
85
|
|
|
75
86
|
Plugins in the ecosystem have three common types:
|
|
87
|
+
|
|
76
88
|
- `dependency` — transform dependency list before bundling
|
|
77
89
|
- `pre-process` — modify the joined bundle text before compilation
|
|
78
90
|
- `post-process` — modify emitted output files
|
|
@@ -82,17 +94,20 @@ Plugins may be provided as objects or factories (functions returning the plugin)
|
|
|
82
94
|
## package.json updates
|
|
83
95
|
|
|
84
96
|
When `allowUpdatePackageJson` is enabled, susee will:
|
|
97
|
+
|
|
85
98
|
- set `type` to `module` (to ensure ESM compatibility)
|
|
86
99
|
- add/update `main`, `module`, `types` and `exports` for the main export when building the package root
|
|
87
100
|
- merge subpath exports for non-root `exportPath`s without overwriting unrelated exports
|
|
88
101
|
|
|
89
102
|
Output file name hints (produced by the compiler):
|
|
103
|
+
|
|
90
104
|
- ESM JS -> `.mjs`
|
|
91
105
|
- ESM types -> `.d.mts`
|
|
92
106
|
- CJS JS -> `.cjs`
|
|
93
107
|
- CJS types -> `.d.cts`
|
|
94
108
|
|
|
95
109
|
## Limitations & notes
|
|
110
|
+
|
|
96
111
|
- The bundler only processes local TypeScript files and does not bundle `node_modules` packages.
|
|
97
112
|
- The entry file should be an ESM-compatible TypeScript file.
|
|
98
113
|
- Exports from the entry file are not removed — only dependency exports may be stripped during bundling.
|