@normed/bundle 2.0.5 → 2.1.1
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/CHANGELOG.md +19 -5
- package/README.md +102 -1
- package/bundles/bin/cli.js +1989 -1906
- package/bundles/builders.d.ts +2 -2
- package/bundles/bundle.d.ts +2 -2
- package/bundles/clean.d.ts +1 -1
- package/bundles/entrypoints.d.ts +4 -4
- package/bundles/es-build.plugins.d.ts +2 -2
- package/bundles/index.d.ts +3 -3
- package/bundles/index.js +1945 -1887
- package/bundles/log.d.ts +1 -1
- package/bundles/types.d.ts +4 -2
- package/bundles/utils.d.ts +17 -6
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
|
+
This file follows SEMVER.
|
|
2
|
+
|
|
3
|
+
Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
4
|
+
|
|
5
|
+
1. MAJOR version when you make incompatible API changes,
|
|
6
|
+
2. MINOR version when you add functionality in a backwards compatible manner, and
|
|
7
|
+
3. PATCH version when you make backwards compatible bug fixes.
|
|
8
|
+
|
|
9
|
+
# 2.1.0
|
|
10
|
+
|
|
11
|
+
* MINOR: Adds the 'library' platform, to automatically output without dependencies.
|
|
12
|
+
* MINOR: Adds support for not including any dependencies in the bundle via the '*' option.
|
|
13
|
+
* MINOR: Improves the README.md by documenting configuration options for the CLI and package.json.
|
|
14
|
+
* MINOR: Syncs the programming API and the CLI, allowing features previously unique to each to be used from either.
|
|
1
15
|
# 2.0.5
|
|
2
16
|
|
|
3
17
|
* MINOR: Uses pnpify as a hail mary
|
|
4
18
|
|
|
5
19
|
# 2.0.4
|
|
6
20
|
|
|
7
|
-
* MINOR: Fixes builds to actually use the normal compiler and not tsc
|
|
8
|
-
* MINOR: declarations now work for typescript
|
|
9
21
|
* MINOR: metafiles can be output with --analyse
|
|
22
|
+
* PATCH: Fixes builds to actually use the normal compiler and not tsc
|
|
23
|
+
* PATCH: declarations now work for typescript
|
|
10
24
|
|
|
11
25
|
# 2.0.3
|
|
12
26
|
|
|
13
27
|
* MINOR: Adds color
|
|
14
28
|
* MINOR: Bumps dependencies
|
|
15
29
|
* MINOR: Uses bundle's own log function for logging in cli rather than console.log/error
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
30
|
+
* PATCH: Fixes build to support ES2020 and less types
|
|
31
|
+
* PATCH: Correctly handles escaping Windows paths during substitution
|
|
32
|
+
* PATCH: Alters build logs to have relative paths only
|
package/README.md
CHANGED
|
@@ -28,8 +28,109 @@ The following additional variables provided by `@normed/bundle`, and do not exis
|
|
|
28
28
|
|
|
29
29
|
The current version of `@normed/bundle` is built on top of es-build for speed.
|
|
30
30
|
|
|
31
|
+
# Configuration
|
|
32
|
+
|
|
33
|
+
Specify your configuration in your `package.json` by adding the `"bundle"` entry.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
{
|
|
37
|
+
"bundle"?: {
|
|
38
|
+
"entrypoints"?: string[], // Manually specify entrypoints here.
|
|
39
|
+
"analyse"?: boolean, // When true, outputs bundle analysis files.
|
|
40
|
+
"typescript"?: {
|
|
41
|
+
"external"?: 'all' | string[], // Which dependencies not to include in the bundle.
|
|
42
|
+
"declarations"?: boolean, // emit typescript declarations.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or if calling via the command line:
|
|
49
|
+
```sh
|
|
50
|
+
bundle --tsc-external
|
|
51
|
+
|
|
52
|
+
bundle --tsc-declarations
|
|
53
|
+
|
|
54
|
+
bundle --indir <directory>
|
|
55
|
+
|
|
56
|
+
bundle --outdir <directory>
|
|
57
|
+
|
|
58
|
+
bundle --platform <browser | web | node | server | library>
|
|
59
|
+
```
|
|
60
|
+
### bundling
|
|
61
|
+
|
|
62
|
+
By default this utility exports the `bundle` command; this command defaults to building mode, but it can be explicitly set if desired.
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
# These two commands are equivalent
|
|
66
|
+
yarn bundle
|
|
67
|
+
yarn bundle --build
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### cleaning
|
|
71
|
+
|
|
72
|
+
If you want bundle to delete the contents of the output directory, you can tell it to clean it:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
yarn bundle --clean
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Logging
|
|
79
|
+
|
|
80
|
+
Increase logging with the `--verbose` and `--debug` flags. Decrease logging with the `--quiet` flag.
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
yarn bundle --verbose
|
|
84
|
+
yarn bundle -v
|
|
85
|
+
|
|
86
|
+
yarn bundle --debug
|
|
87
|
+
|
|
88
|
+
yarn bundle --quiet
|
|
89
|
+
yarn bundle -q
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### entrypoints
|
|
93
|
+
|
|
94
|
+
All files ending in `.static.<ext>`, `.node.<ext>`, and `.web.<ext>` are automatically picked up as entrypoints.
|
|
95
|
+
|
|
96
|
+
Any files you don't want to name with such a suffix can be added manually. To add the files `anchovies.ts` and `pics/cartoons.png` manually:
|
|
97
|
+
|
|
98
|
+
*via `package.json`:*
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"bundle": {
|
|
102
|
+
"entrypoints": [ "anchovies.ts", "pics/cartoons.png" ]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
*via cli:*
|
|
108
|
+
```sh
|
|
109
|
+
yarn bundle --entrypoint anchovies.ts --entrypoint pics/cartoons.png
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### analyse
|
|
113
|
+
|
|
114
|
+
To get a report on bundle content and size enable analysis:
|
|
115
|
+
|
|
116
|
+
*`package.json`*:
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"bundle": {
|
|
120
|
+
"analyse": true
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
*via cli:*
|
|
126
|
+
```sh
|
|
127
|
+
bundle --analyse
|
|
128
|
+
```
|
|
129
|
+
|
|
31
130
|
# Development
|
|
32
131
|
|
|
132
|
+
Feel free to contribute to the codebase, issues and code welcome.
|
|
133
|
+
|
|
33
134
|
## build pipeline
|
|
34
135
|
|
|
35
|
-
`@normed/bundle` is bootstrapped by being built from typescript to javascript first (using `tsc`, output to `dist`), then using the javascript output to build the original source (output to `bundles-a`), then using that output to build the original source again (output to `bundles`), and finally the last two outputs are compared to ensure they are the same.
|
|
136
|
+
`@normed/bundle` is bootstrapped by being built from typescript to javascript first (using `tsc`, output to `dist`), then using the javascript output to build the original source (output to `bundles-a`), then using that output to build the original source again (output to `bundles`), and finally the last two outputs are compared to ensure they are the same. This acts as a nice little test to check some of the functionality of `@normed/bundle`.
|