@vitus-labs/tools-rollup 1.9.1-alpha.1 → 1.9.1-alpha.11
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 +89 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# @vitus-labs/tools-rollup
|
|
2
|
+
|
|
3
|
+
[Rollup](https://rollupjs.org)-powered build tool for TypeScript libraries.
|
|
4
|
+
|
|
5
|
+
Supports multi-platform, multi-format builds with TypeScript declaration bundling via Microsoft API Extractor.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add -d @vitus-labs/tools-rollup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Add to your `package.json`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "vl_build",
|
|
21
|
+
"dev": "vl_build-watch"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## How it works
|
|
27
|
+
|
|
28
|
+
The build tool reads your `package.json` to determine what output bundles to produce:
|
|
29
|
+
|
|
30
|
+
| `package.json` field | Format | Platform |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `exports.import` | ESM | universal |
|
|
33
|
+
| `exports.require` | CJS | universal |
|
|
34
|
+
| `main` | CJS or ESM | universal |
|
|
35
|
+
| `module` | ESM | universal |
|
|
36
|
+
| `browser` | same as source | browser |
|
|
37
|
+
| `react-native` | ESM | native |
|
|
38
|
+
| `umd:main` | UMD | — |
|
|
39
|
+
| `unpkg` | UMD (minified) | — |
|
|
40
|
+
|
|
41
|
+
TypeScript declarations are bundled into a single `.d.ts` file using API Extractor when `exports.types` (or `types`/`typings`) is set.
|
|
42
|
+
|
|
43
|
+
### Platform globals
|
|
44
|
+
|
|
45
|
+
These constants are injected at build time based on the output platform:
|
|
46
|
+
|
|
47
|
+
| Constant | Description |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `__VERSION__` | Package version from `package.json` |
|
|
50
|
+
| `__BROWSER__` | `true` for browser builds |
|
|
51
|
+
| `__NODE__` | `true` for node builds |
|
|
52
|
+
| `__WEB__` | `true` for node + browser + universal |
|
|
53
|
+
| `__NATIVE__` | `true` for React Native builds |
|
|
54
|
+
| `__CLIENT__` | `true` for browser + native |
|
|
55
|
+
|
|
56
|
+
Add type declarations to your project:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"compilerOptions": {
|
|
61
|
+
"types": ["@vitus-labs/tools-rollup/global"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
Configure via `vl-tools.config.mjs` (key: `build`):
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
export default {
|
|
72
|
+
build: {
|
|
73
|
+
sourceDir: 'src',
|
|
74
|
+
outputDir: 'lib',
|
|
75
|
+
typescript: true,
|
|
76
|
+
esModulesOnly: false,
|
|
77
|
+
replaceGlobals: true,
|
|
78
|
+
external: ['react/jsx-runtime'],
|
|
79
|
+
globals: {
|
|
80
|
+
react: 'React',
|
|
81
|
+
'react-dom': 'ReactDOM',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitus-labs/tools-rollup",
|
|
3
|
-
"version": "1.9.1-alpha.
|
|
3
|
+
"version": "1.9.1-alpha.11+60255d1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@rollup/plugin-terser": "^0.4.4",
|
|
44
44
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
45
45
|
"@types/node": "^25.3.0",
|
|
46
|
-
"@vitus-labs/tools-core": "1.9.1-alpha.
|
|
46
|
+
"@vitus-labs/tools-core": "1.9.1-alpha.11+60255d1",
|
|
47
47
|
"chalk": "^5.6.2",
|
|
48
48
|
"find-up": "^8.0.0",
|
|
49
49
|
"lodash-es": "^4.17.23",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/lodash-es": "^4.17.12",
|
|
64
|
-
"@vitus-labs/tools-typescript": "1.9.1-alpha.
|
|
64
|
+
"@vitus-labs/tools-typescript": "1.9.1-alpha.11+60255d1",
|
|
65
65
|
"typescript": "^5.9.3"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "60255d1e0f077704603a45844643ff823439dd0c"
|
|
68
68
|
}
|