quickbundle 1.2.0 → 2.1.0
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/LICENSE +1 -1
- package/README.md +63 -19
- package/dist/index.js +308 -0
- package/package.json +59 -145
- package/bin/bundler/bundler.d.ts +0 -2
- package/bin/bundler/bundler.js +0 -92
- package/bin/bundler/configs/esbuild.d.ts +0 -8
- package/bin/bundler/configs/esbuild.js +0 -65
- package/bin/bundler/configs/index.d.ts +0 -22
- package/bin/bundler/configs/index.js +0 -34
- package/bin/bundler/configs/package.d.ts +0 -11
- package/bin/bundler/configs/package.js +0 -28
- package/bin/bundler/configs/typescript.d.ts +0 -6
- package/bin/bundler/configs/typescript.js +0 -33
- package/bin/bundler/index.d.ts +0 -1
- package/bin/bundler/index.js +0 -6
- package/bin/bundler/workers/dts.d.ts +0 -1
- package/bin/bundler/workers/dts.js +0 -25
- package/bin/bundler/workers/esbuild.d.ts +0 -1
- package/bin/bundler/workers/esbuild.js +0 -15
- package/bin/constants.d.ts +0 -1
- package/bin/constants.js +0 -4
- package/bin/helpers.d.ts +0 -6
- package/bin/helpers.js +0 -36
- package/bin/index.d.ts +0 -2
- package/bin/index.js +0 -4
- package/bin/program/commands/build.d.ts +0 -2
- package/bin/program/commands/build.js +0 -63
- package/bin/program/commands/watch.d.ts +0 -2
- package/bin/program/commands/watch.js +0 -52
- package/bin/program/index.d.ts +0 -1
- package/bin/program/index.js +0 -12
- package/bin/tsconfig.tsbuildinfo +0 -1
- package/bin/types.d.ts +0 -1
- package/bin/types.js +0 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<br>
|
|
2
2
|
<div align="center">
|
|
3
3
|
<h1>📦 Quickbundle</h1>
|
|
4
|
-
<strong>The zero-configuration bundler
|
|
4
|
+
<strong>The zero-configuration transpiler and bundler for the web</strong>
|
|
5
5
|
</div>
|
|
6
6
|
<br>
|
|
7
7
|
<br>
|
|
@@ -10,17 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
Quickbundle allows you to bundle a library in a **quick**, **fast** and **easy** way:
|
|
12
12
|
|
|
13
|
-
- Fast build and watch mode
|
|
14
|
-
- Zero configuration: define the build artifacts in your `package.json
|
|
15
|
-
- Support of
|
|
16
|
-
- JavaScript, TypeScript, JSX,
|
|
17
|
-
- TypeScript declaration file (`.d.ts`)
|
|
18
|
-
-
|
|
19
|
-
- Optimized build with automatic dependency inclusion (`peerDependencies` and `dependencies` are not bundled in the final output)
|
|
13
|
+
- Fast build and watch mode powered by [Rollup module bundler](https://rollupjs.org/) and [SWC transpiler](https://swc.rs/).
|
|
14
|
+
- Zero configuration: define the build artifacts in your `package.json`, and you're all set!
|
|
15
|
+
- Support of `cjs` & `esm` module formats output.
|
|
16
|
+
- Support of several loaders including JavaScript, TypeScript, JSX, JSON, and Images.
|
|
17
|
+
- TypeScript's declaration file (`.d.ts`) bundling.
|
|
18
|
+
- Automatic dependency inclusion (`peerDependencies` and `dependencies` are not bundled in the final output, `devDependencies` are unless they're not imported).
|
|
20
19
|
|
|
21
20
|
<br>
|
|
22
21
|
|
|
23
|
-
## 🚀
|
|
22
|
+
## 🚀 Quick Start
|
|
24
23
|
|
|
25
24
|
1️⃣ Install by running:
|
|
26
25
|
|
|
@@ -38,15 +37,19 @@ yarn add quickbundle
|
|
|
38
37
|
```jsonc
|
|
39
38
|
{
|
|
40
39
|
"name": "lib", // Package name
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"source": "src/index.ts(x)?", // Source code entrypoint
|
|
43
|
+
"types": "./dist/index.d.ts", // Typing output file (if defined, can increase build time)
|
|
44
|
+
"import": "./dist/index.mjs", // ESM output file
|
|
45
|
+
"require": "./dist/index.cjs" // CommonJS output file
|
|
46
|
+
}
|
|
47
|
+
}
|
|
46
48
|
"scripts": {
|
|
47
49
|
"build": "quickbundle build", // Production mode (optimizes bundle)
|
|
48
50
|
"watch": "quickbundle watch", // Development mode (watches each file change)
|
|
49
|
-
}
|
|
51
|
+
},
|
|
52
|
+
// ...
|
|
50
53
|
}
|
|
51
54
|
```
|
|
52
55
|
|
|
@@ -63,21 +66,62 @@ yarn build
|
|
|
63
66
|
|
|
64
67
|
<br>
|
|
65
68
|
|
|
69
|
+
## 👨🍳 Patterns
|
|
70
|
+
|
|
71
|
+
### Optimize the build output
|
|
72
|
+
|
|
73
|
+
By default, Quickbundle does the following built-in optimizations during the bundling process:
|
|
74
|
+
|
|
75
|
+
- 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.
|
|
76
|
+
- [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.
|
|
77
|
+
|
|
78
|
+
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:
|
|
79
|
+
|
|
80
|
+
- 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).
|
|
81
|
+
- 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.).
|
|
82
|
+
- Risk of side effects with double optimizations (producer side and then consumer side).
|
|
83
|
+
|
|
84
|
+
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).
|
|
85
|
+
|
|
86
|
+
However, for non-library targets or if you would like to minify the build output on your side anyway, Quickbundle still provides the ability to enable the minification via:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
quickbundle build --minification
|
|
90
|
+
quickbundle watch --minification
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Enable source maps generation
|
|
94
|
+
|
|
95
|
+
By default, source maps are not enabled but Quickbundle still provides the ability to enable it via:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
quickbundle build --source-maps
|
|
99
|
+
quickbundle watch --source-maps
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Enabling source map generation is needed only if a build is [obfuscated (minified)](#optimize-the-build-output) for debugging-easing purposes. It generally pairs with the [`minification` flag](#optimize-the-build-output).
|
|
103
|
+
|
|
104
|
+
<br>
|
|
105
|
+
|
|
66
106
|
## 🤩 Used by
|
|
67
107
|
|
|
68
|
-
- [@adbayb/
|
|
108
|
+
- [@adbayb/stack](https://github.com/adbayb/stack) My opinionated toolbox for JavaScript/TypeScript projects.
|
|
109
|
+
|
|
110
|
+
<br>
|
|
111
|
+
|
|
112
|
+
## ✍️ Contribution
|
|
69
113
|
|
|
70
|
-
|
|
114
|
+
We're open to new contributions, you can find more details [here](./CONTRIBUTING.md).
|
|
71
115
|
|
|
72
116
|
<br>
|
|
73
117
|
|
|
74
118
|
## 💙 Acknowledgements
|
|
75
119
|
|
|
76
|
-
- The backend is powered by [
|
|
120
|
+
- 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.
|
|
77
121
|
- 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).
|
|
78
122
|
|
|
79
123
|
<br>
|
|
80
124
|
|
|
81
125
|
## 📖 License
|
|
82
126
|
|
|
83
|
-
[MIT](./LICENSE "License MIT")
|
|
127
|
+
[MIT](./LICENSE "License MIT").
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { helpers, termost } from 'termost';
|
|
3
|
+
import { gzipSize } from 'gzip-size';
|
|
4
|
+
import { rollup, watch as watch$1 } from 'rollup';
|
|
5
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
+
import json from '@rollup/plugin-json';
|
|
7
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
8
|
+
import url from '@rollup/plugin-url';
|
|
9
|
+
import { createRequire } from 'node:module';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import dts from 'rollup-plugin-dts';
|
|
12
|
+
import externals from 'rollup-plugin-node-externals';
|
|
13
|
+
import { swc } from 'rollup-plugin-swc3';
|
|
14
|
+
import { readFile as readFile$1 } from 'node:fs/promises';
|
|
15
|
+
|
|
16
|
+
const onLog = (_, log)=>{
|
|
17
|
+
if (log.message.includes("Generated an empty chunk")) return;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const build = async (configurations)=>{
|
|
21
|
+
var _process_env;
|
|
22
|
+
(_process_env = process.env).NODE_ENV ?? (_process_env.NODE_ENV = "production");
|
|
23
|
+
const output = [];
|
|
24
|
+
for (const config of configurations){
|
|
25
|
+
const initialTime = Date.now();
|
|
26
|
+
const bundle = await rollup({
|
|
27
|
+
...config,
|
|
28
|
+
onLog
|
|
29
|
+
});
|
|
30
|
+
if (config.output) {
|
|
31
|
+
const outputEntries = Array.isArray(config.output) ? config.output : [
|
|
32
|
+
config.output
|
|
33
|
+
];
|
|
34
|
+
const promises = [];
|
|
35
|
+
for (const outputEntry of outputEntries){
|
|
36
|
+
const outputFilename = outputEntry.file ?? outputEntry.dir;
|
|
37
|
+
if (!outputFilename) {
|
|
38
|
+
throw new Error("Misconfigured file entry point. Make sure to define an `import`, `require`, or `default` field.");
|
|
39
|
+
}
|
|
40
|
+
promises.push(new Promise((resolve, reject)=>{
|
|
41
|
+
bundle.write(outputEntry).then(()=>{
|
|
42
|
+
resolve({
|
|
43
|
+
elapedTime: Date.now() - initialTime,
|
|
44
|
+
filename: outputFilename
|
|
45
|
+
});
|
|
46
|
+
}).catch(reject);
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
output.push(...await Promise.all(promises));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return output;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const CWD = process.cwd();
|
|
56
|
+
|
|
57
|
+
const require = createRequire(import.meta.url);
|
|
58
|
+
const PKG = require(join(CWD, "./package.json"));
|
|
59
|
+
const createConfigurations = (options = {
|
|
60
|
+
minification: false,
|
|
61
|
+
sourceMaps: false
|
|
62
|
+
})=>{
|
|
63
|
+
/**
|
|
64
|
+
* Entry-point resolution:
|
|
65
|
+
* Following the [package entry-point specification](https://nodejs.org/api/packages.html#package-entry-points),
|
|
66
|
+
* whenever an export object is defined, it take precedence over other classical entry-point fields
|
|
67
|
+
* (such as main, module, and types defined at the root package.json level).
|
|
68
|
+
*/ if (PKG.main ?? PKG.module ?? PKG.types ?? !PKG.exports) {
|
|
69
|
+
throw new Error("Invalid package entry points contract. Use the recommended [`exports` field](https://nodejs.org/api/packages.html#package-entry-points) instead and, for TypeScript-based projects, update the `tsconfig.json` file to resolve it properly (`moduleResolution` must be set to `Bundler` (or `NodeNext`)).");
|
|
70
|
+
}
|
|
71
|
+
const outputEntryPointFields = [
|
|
72
|
+
"import",
|
|
73
|
+
"require",
|
|
74
|
+
"types"
|
|
75
|
+
];
|
|
76
|
+
const output = Object.entries(PKG.exports).flatMap(([name, entryPoints])=>{
|
|
77
|
+
if (typeof entryPoints === "string") return [];
|
|
78
|
+
const entryPointKeys = Object.keys(entryPoints);
|
|
79
|
+
if (entryPointKeys.includes("source")) {
|
|
80
|
+
const hasAtLeastOneRequiredField = outputEntryPointFields.some((field)=>entryPointKeys.includes(field));
|
|
81
|
+
if (!hasAtLeastOneRequiredField) {
|
|
82
|
+
throw new Error(`A \`source\` field is defined without a provided \`${name}\` module entry point. Make sure to define at least one entry point (including ${outputEntryPointFields.join(", ")})`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return [
|
|
86
|
+
entryPoints.source && createMainConfig({
|
|
87
|
+
...entryPoints,
|
|
88
|
+
source: entryPoints.source
|
|
89
|
+
}, options),
|
|
90
|
+
entryPoints.source && entryPoints.types && createTypesConfig({
|
|
91
|
+
source: entryPoints.source,
|
|
92
|
+
types: entryPoints.types
|
|
93
|
+
})
|
|
94
|
+
].filter(Boolean);
|
|
95
|
+
});
|
|
96
|
+
if (output.length === 0) {
|
|
97
|
+
throw new Error("No `source` field is set for the targetted package. If a build step is necessary, make sure to configure at least one `source` field in the package `exports` contract.");
|
|
98
|
+
}
|
|
99
|
+
return output;
|
|
100
|
+
};
|
|
101
|
+
const getPlugins = (...customPlugins)=>{
|
|
102
|
+
return [
|
|
103
|
+
externals({
|
|
104
|
+
builtins: true,
|
|
105
|
+
deps: true,
|
|
106
|
+
/**
|
|
107
|
+
* As they're not installed consumer side, `devDependencies` are declared as internal dependencies (via the `false` value)
|
|
108
|
+
* and bundled into the dist if and only if imported and not listed as `peerDependencies` (otherwise, they're considered external).
|
|
109
|
+
*/ devDeps: false,
|
|
110
|
+
optDeps: true,
|
|
111
|
+
peerDeps: true
|
|
112
|
+
}),
|
|
113
|
+
nodeResolve({
|
|
114
|
+
/**
|
|
115
|
+
* The `exports` conditional fields definition order is important in the `package.json file`.
|
|
116
|
+
* To be resolved first, `types` field must always come first in the package.json exports definition.
|
|
117
|
+
* @see https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencing.
|
|
118
|
+
*/ exportConditions: [
|
|
119
|
+
"types"
|
|
120
|
+
]
|
|
121
|
+
}),
|
|
122
|
+
commonjs(),
|
|
123
|
+
url(),
|
|
124
|
+
json(),
|
|
125
|
+
...customPlugins
|
|
126
|
+
];
|
|
127
|
+
};
|
|
128
|
+
const createMainConfig = (entryPoints, options)=>{
|
|
129
|
+
const { minification, sourceMaps } = options;
|
|
130
|
+
const output = [
|
|
131
|
+
entryPoints.require && {
|
|
132
|
+
file: entryPoints.require,
|
|
133
|
+
format: "cjs",
|
|
134
|
+
sourcemap: sourceMaps
|
|
135
|
+
},
|
|
136
|
+
entryPoints.import && {
|
|
137
|
+
file: entryPoints.import,
|
|
138
|
+
format: "es",
|
|
139
|
+
sourcemap: sourceMaps
|
|
140
|
+
}
|
|
141
|
+
].filter(Boolean);
|
|
142
|
+
return {
|
|
143
|
+
input: entryPoints.source,
|
|
144
|
+
output,
|
|
145
|
+
plugins: getPlugins(swc({
|
|
146
|
+
minify: minification,
|
|
147
|
+
sourceMaps
|
|
148
|
+
}))
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
const createTypesConfig = (entryPoints)=>{
|
|
152
|
+
return {
|
|
153
|
+
input: entryPoints.source,
|
|
154
|
+
output: [
|
|
155
|
+
{
|
|
156
|
+
file: entryPoints.types
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
plugins: getPlugins(dts({
|
|
160
|
+
compilerOptions: {
|
|
161
|
+
incremental: false
|
|
162
|
+
},
|
|
163
|
+
respectExternal: true
|
|
164
|
+
}))
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
// eslint-disable-next-line import/no-default-export
|
|
168
|
+
createConfigurations();
|
|
169
|
+
|
|
170
|
+
const readFile = readFile$1;
|
|
171
|
+
|
|
172
|
+
const createCommand = (program, input)=>{
|
|
173
|
+
return program.command(input).option({
|
|
174
|
+
key: "minification",
|
|
175
|
+
name: "minification",
|
|
176
|
+
description: "Enable minification",
|
|
177
|
+
defaultValue: false
|
|
178
|
+
}).option({
|
|
179
|
+
key: "sourceMaps",
|
|
180
|
+
name: "source-maps",
|
|
181
|
+
description: "Enable source maps generation",
|
|
182
|
+
defaultValue: false
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const createBuildCommand = (program)=>{
|
|
187
|
+
createCommand(program, {
|
|
188
|
+
name: "build",
|
|
189
|
+
description: "Build the source code (production mode)"
|
|
190
|
+
}).task({
|
|
191
|
+
key: "buildOutput",
|
|
192
|
+
label: "Bundle assets 📦",
|
|
193
|
+
async handler (context) {
|
|
194
|
+
return build(createConfigurations({
|
|
195
|
+
minification: context.minification,
|
|
196
|
+
sourceMaps: context.sourceMaps
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
}).task({
|
|
200
|
+
key: "logInput",
|
|
201
|
+
label: "Generate report 📝",
|
|
202
|
+
async handler (context) {
|
|
203
|
+
return computeBundleSize(context.buildOutput);
|
|
204
|
+
},
|
|
205
|
+
skip (context) {
|
|
206
|
+
return context.buildOutput.length === 0;
|
|
207
|
+
}
|
|
208
|
+
}).task({
|
|
209
|
+
handler (context) {
|
|
210
|
+
const padding = context.logInput.map((item)=>item.rawSize).reduce((pad, currentRawSize)=>{
|
|
211
|
+
return Math.max(pad, String(currentRawSize).length);
|
|
212
|
+
}, 0) + 2;
|
|
213
|
+
context.logInput.forEach((item)=>{
|
|
214
|
+
helpers.message([
|
|
215
|
+
`${item.rawSize.toString().padStart(padding)} B raw`,
|
|
216
|
+
`${item.compressedSize.toString().padStart(padding)} B gz`
|
|
217
|
+
], {
|
|
218
|
+
label: `${item.filename} (took ${item.elapedTime}ms)`,
|
|
219
|
+
type: "information"
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
skip (context) {
|
|
224
|
+
return context.buildOutput.length === 0;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
const computeBundleSize = async (buildOutput)=>{
|
|
229
|
+
const computeFileSize = async (buildItemOutput)=>{
|
|
230
|
+
const content = await readFile(buildItemOutput.filename);
|
|
231
|
+
const gzSize = await gzipSize(content);
|
|
232
|
+
return {
|
|
233
|
+
...buildItemOutput,
|
|
234
|
+
compressedSize: gzSize,
|
|
235
|
+
rawSize: content.byteLength
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
return Promise.all(buildOutput.map(async (item)=>computeFileSize(item)));
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const watch = (configurations)=>{
|
|
242
|
+
var _process_env;
|
|
243
|
+
(_process_env = process.env).NODE_ENV ?? (_process_env.NODE_ENV = "development");
|
|
244
|
+
const watcher = watch$1(configurations.map((config)=>({
|
|
245
|
+
...config,
|
|
246
|
+
onLog
|
|
247
|
+
})));
|
|
248
|
+
let startDuration;
|
|
249
|
+
console.clear();
|
|
250
|
+
watcher.on("event", async (event)=>{
|
|
251
|
+
switch(event.code){
|
|
252
|
+
case "START":
|
|
253
|
+
{
|
|
254
|
+
startDuration = Date.now();
|
|
255
|
+
clearLog(`Build in progress...`, {
|
|
256
|
+
type: "information"
|
|
257
|
+
});
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
case "BUNDLE_END":
|
|
261
|
+
await event.result.close();
|
|
262
|
+
break;
|
|
263
|
+
case "END":
|
|
264
|
+
{
|
|
265
|
+
const duration = Date.now() - startDuration;
|
|
266
|
+
clearLog(`Build done in ${duration}ms (at ${new Date().toLocaleTimeString()})`, {
|
|
267
|
+
type: "success"
|
|
268
|
+
});
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
case "ERROR":
|
|
272
|
+
{
|
|
273
|
+
const { error } = event;
|
|
274
|
+
clearLog(`${String(error)}`, {
|
|
275
|
+
type: "error"
|
|
276
|
+
});
|
|
277
|
+
console.error("\n", error);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
const clearLog = (...input)=>{
|
|
284
|
+
console.clear();
|
|
285
|
+
helpers.message(...input);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const createWatchCommand = (program)=>{
|
|
289
|
+
createCommand(program, {
|
|
290
|
+
name: "watch",
|
|
291
|
+
description: "Watch and rebuild on any code change (development mode)"
|
|
292
|
+
}).task({
|
|
293
|
+
handler (context) {
|
|
294
|
+
watch(createConfigurations({
|
|
295
|
+
minification: context.minification,
|
|
296
|
+
sourceMaps: context.sourceMaps
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
const createProgram = (...commandBuilders)=>{
|
|
303
|
+
const program = termost("The zero-configuration bundler powered by ESBuild");
|
|
304
|
+
for (const commandBuilder of commandBuilders){
|
|
305
|
+
commandBuilder(program);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
createProgram(createBuildCommand, createWatchCommand);
|
package/package.json
CHANGED
|
@@ -1,146 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"lint-staged": "13.2.2",
|
|
62
|
-
"prettier": "2.8.8",
|
|
63
|
-
"semantic-release": "21.0.2",
|
|
64
|
-
"vitest": "0.31.0"
|
|
65
|
-
},
|
|
66
|
-
"packageManager": "pnpm@8.1.1",
|
|
67
|
-
"engines": {
|
|
68
|
-
"node": ">= 16.13.1"
|
|
69
|
-
},
|
|
70
|
-
"commitlint": {
|
|
71
|
-
"extends": [
|
|
72
|
-
"@commitlint/config-conventional"
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
"prettier": "@adbayb/prettier-config",
|
|
76
|
-
"eslintConfig": {
|
|
77
|
-
"extends": "@adbayb"
|
|
78
|
-
},
|
|
79
|
-
"husky": {
|
|
80
|
-
"hooks": {
|
|
81
|
-
"pre-commit": "lint-staged",
|
|
82
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"lint-staged": {
|
|
86
|
-
"**/*.{js,jsx,ts,tsx}": [
|
|
87
|
-
"pnpm lint"
|
|
88
|
-
],
|
|
89
|
-
"**/*.{json,md,mdx,html,css}": [
|
|
90
|
-
"pnpm format"
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
"release": {
|
|
94
|
-
"branches": [
|
|
95
|
-
"main"
|
|
96
|
-
],
|
|
97
|
-
"ci": false,
|
|
98
|
-
"plugins": [
|
|
99
|
-
[
|
|
100
|
-
"@semantic-release/commit-analyzer",
|
|
101
|
-
{
|
|
102
|
-
"releaseRules": [
|
|
103
|
-
{
|
|
104
|
-
"breaking": true,
|
|
105
|
-
"release": "major"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"revert": true,
|
|
109
|
-
"release": "patch"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"type": "feat",
|
|
113
|
-
"release": "minor"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"type": "fix",
|
|
117
|
-
"release": "patch"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"type": "perf",
|
|
121
|
-
"release": "patch"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"type": "refactor",
|
|
125
|
-
"release": "patch"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"type": "chore",
|
|
129
|
-
"scope": "deps",
|
|
130
|
-
"release": "patch"
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
"@semantic-release/release-notes-generator",
|
|
136
|
-
"@semantic-release/npm",
|
|
137
|
-
[
|
|
138
|
-
"@semantic-release/git",
|
|
139
|
-
{
|
|
140
|
-
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
|
|
141
|
-
}
|
|
142
|
-
],
|
|
143
|
-
"@semantic-release/github"
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
}
|
|
2
|
+
"name": "quickbundle",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "The zero-configuration transpiler and bundler for the web",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Ayoub Adib",
|
|
7
|
+
"email": "adbayb@gmail.com",
|
|
8
|
+
"url": "https://twitter.com/adbayb"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@github.com:adbayb/quickbundle.git",
|
|
13
|
+
"directory": "quickbundle"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"library",
|
|
18
|
+
"bundle",
|
|
19
|
+
"build",
|
|
20
|
+
"compiler",
|
|
21
|
+
"transpiler",
|
|
22
|
+
"module",
|
|
23
|
+
"fast",
|
|
24
|
+
"esbuild",
|
|
25
|
+
"swc",
|
|
26
|
+
"microbundle"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"quickbundle": "dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"source": "./src/index.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
43
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
44
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
45
|
+
"@rollup/plugin-url": "^8.0.2",
|
|
46
|
+
"gzip-size": "^7.0.0",
|
|
47
|
+
"rollup": "^4.24.0",
|
|
48
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
49
|
+
"rollup-plugin-node-externals": "^7.1.3",
|
|
50
|
+
"rollup-plugin-swc3": "^0.12.1",
|
|
51
|
+
"termost": "^0.14.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "20.16.11"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "rollup --config ./src/bundler/config.ts --configPlugin rollup-plugin-swc3 && chmod +x ./dist/index.js",
|
|
58
|
+
"watch": "rollup --watch --config ./src/bundler/config.ts --configPlugin rollup-plugin-swc3"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/bin/bundler/bundler.d.ts
DELETED