quickbundle 0.0.0-next-d3fa7f0 → 0.0.0-next-164ae7d
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 -21
- package/dist/index.mjs +5 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
Quickbundle allows you to bundle a library in a **quick**, **fast** and **easy** way:
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
- Zero configuration: define the build artifacts in your `package.json`, and you're all set!
|
|
14
|
+
- Fast build and watch mode powered by Rollup[^1] and SWC[^2].
|
|
15
|
+
- Compile and cross compile standalone executables for systems that do not have Node.js installed[^3].
|
|
16
|
+
- Support of `cjs` & `esm` module formats output.
|
|
17
|
+
- Support of several loaders including JavaScript, TypeScript, JSX, JSON, and Images.
|
|
18
|
+
- TypeScript's declaration file (`.d.ts`) bundling.
|
|
19
|
+
- Automatic dependency inclusion:
|
|
20
|
+
- For the build and watch mode, `peerDependencies` and `dependencies` are not bundled in the final output, `devDependencies` are unless they're not imported.
|
|
21
|
+
- For the compile mode, all dependencies are included to make the code standalone.
|
|
22
22
|
|
|
23
23
|
[^1]: A [module bundler](https://rollupjs.org/) optimized for better tree-shaking processing and seamless interoperability of CommonJS and ESM formats with minimal code footprint.
|
|
24
24
|
|
|
@@ -45,7 +45,7 @@ yarn add quickbundle
|
|
|
45
45
|
|
|
46
46
|
#### For building libraries
|
|
47
47
|
|
|
48
|
-
-
|
|
48
|
+
- When exporting exclusively ESM format:
|
|
49
49
|
|
|
50
50
|
```jsonc
|
|
51
51
|
{
|
|
@@ -70,7 +70,7 @@ yarn add quickbundle
|
|
|
70
70
|
}
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
-
|
|
73
|
+
- When exporting both CommonJS (CJS) and ECMAScript Modules (ESM) format:
|
|
74
74
|
|
|
75
75
|
> [!warning]
|
|
76
76
|
> Please be aware of [dual-package-hazard-related risks](https://github.com/nodejs/package-examples?tab=readme-ov-file#dual-package-hazard) first.
|
|
@@ -105,8 +105,8 @@ yarn add quickbundle
|
|
|
105
105
|
> [!warning]
|
|
106
106
|
> The `compile` command relies on the [Node.js SEA (Single Executable Applications feature)](https://nodejs.org/api/single-executable-applications.html). This feature comes with some limitations which Quickbundle attempts to address:
|
|
107
107
|
>
|
|
108
|
-
> -
|
|
109
|
-
> -
|
|
108
|
+
> - The source code must not rely on [external dependencies](https://github.com/nodejs/single-executable/discussions/70) 🛑. To partially address this, Quickbundle bundles all dependencies (whatever their types, as long as they're used) and inline dynamic imports by default ✅.
|
|
109
|
+
> - The bundled code must use the CommonJS module system 🛑. To address this, Quickbundle always outputs CJS modules in compile mode ✅.
|
|
110
110
|
|
|
111
111
|
```jsonc
|
|
112
112
|
{
|
|
@@ -142,14 +142,14 @@ yarn build
|
|
|
142
142
|
|
|
143
143
|
By default, Quickbundle does the following built-in optimizations during the bundling process:
|
|
144
144
|
|
|
145
|
-
-
|
|
146
|
-
-
|
|
145
|
+
- Include, in the build output, only the code that is effectively imported and used in the source code. Setting the `sideEffects` package.json field to `false` marks the package as a side-effect-free one and helps Quickbundle to safely prune unused exports.
|
|
146
|
+
- [Identify and annotate](https://rollupjs.org/configuration-options/#treeshake-annotations) side-effect-free code (functions, ...) to enable a fine-grained dead-code elimination process later consumer side. For example, if a consumer uses only one library API, build output annotations added by Quickbundle allow the consumer's bundler remove all other unused APIs.
|
|
147
147
|
|
|
148
148
|
However, Quickbundle doesn't minify the build output. Indeed, in general, **if the build targets a library (the most Quickbundle use case)**, minification is not necessary since enabling it can introduce some challenges:
|
|
149
149
|
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
150
|
+
- Reduce the build output discoverability inside the `node_modules` folder (minified code is an obfuscated code that can be hard to read for code audit/debugging purposes).
|
|
151
|
+
- Generate suboptimal source maps for the bundled library, as the consumer bundler will generate source maps based on the already minified library build (transformed code, mangled variable names, etc.).
|
|
152
|
+
- Risk of side effects with double optimizations (producer side and then consumer side).
|
|
153
153
|
|
|
154
154
|
Popular open source libraries ([Vue](https://unpkg.com/browse/vue@3.4.24/dist/), [SolidJS](https://unpkg.com/browse/solid-js@1.8.17/dist/), [Material UI](https://unpkg.com/browse/@material-ui/core@4.12.4/), ...) do not provide minified builds as the build optimization is sensitive to the consumer context (e.g. environment targets (browser support), ...) and needs to be fully owned upstream (i.e. consumer/application-side).
|
|
155
155
|
|
|
@@ -193,7 +193,7 @@ quickbundle compile --target node-v23.1.0-win-x64 # Embeds Node v23 runtime buil
|
|
|
193
193
|
|
|
194
194
|
## 🤩 Used by
|
|
195
195
|
|
|
196
|
-
-
|
|
196
|
+
- [@adbayb/stack](https://github.com/adbayb/stack) My opinionated toolbox for JavaScript/TypeScript projects.
|
|
197
197
|
|
|
198
198
|
<br>
|
|
199
199
|
|
|
@@ -205,8 +205,8 @@ We're open to new contributions, you can find more details [here](./CONTRIBUTING
|
|
|
205
205
|
|
|
206
206
|
## 💙 Acknowledgements
|
|
207
207
|
|
|
208
|
-
-
|
|
209
|
-
-
|
|
208
|
+
- The backend is powered by [Rollup](https://github.com/rollup/rollup) and its plugin ecosystem (including [SWC](https://github.com/swc-project/swc)) to make blazing-fast builds. A special shoutout to all contributors involved.
|
|
209
|
+
- The zero-configuration approach was inspired by [microbundle](https://github.com/developit/microbundle). A special shoutout to its author [Jason Miller](https://github.com/developit) and [all contributors](https://github.com/developit/microbundle/graphs/contributors).
|
|
210
210
|
|
|
211
211
|
<br>
|
|
212
212
|
|
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import os from 'node:os';
|
|
|
19
19
|
import { gzipSize } from 'gzip-size';
|
|
20
20
|
|
|
21
21
|
var name = "quickbundle";
|
|
22
|
-
var version = "0.0.0-next-
|
|
22
|
+
var version = "0.0.0-next-164ae7d";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Resolve a relative path from the Quickbundle node modules directory.
|
|
@@ -558,6 +558,10 @@ const createBuildCommand = (program)=>{
|
|
|
558
558
|
return index === 0 ? message : ` ${message}`;
|
|
559
559
|
}).join("\n"), {
|
|
560
560
|
label: `${item.filePath} (took ${item.elapsedTime}ms)`,
|
|
561
|
+
lineBreak: {
|
|
562
|
+
end: false,
|
|
563
|
+
start: true
|
|
564
|
+
},
|
|
561
565
|
type: "information"
|
|
562
566
|
});
|
|
563
567
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickbundle",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-164ae7d",
|
|
4
4
|
"description": "The zero-configuration transpiler and bundler for the web",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ayoub Adib",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"rollup-plugin-dts": "^6.1.1",
|
|
60
60
|
"rollup-plugin-node-externals": "^7.1.3",
|
|
61
61
|
"rollup-plugin-swc3": "^0.12.1",
|
|
62
|
-
"termost": "^1.
|
|
62
|
+
"termost": "^1.4.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/decompress": "4.2.7",
|