quickbundle 2.5.1 → 2.6.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.
Files changed (2) hide show
  1. package/dist/index.mjs +23 -23
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -21,8 +21,7 @@ const isRecord = (value)=>{
21
21
  };
22
22
 
23
23
  const build = async (configurations)=>{
24
- var _process_env;
25
- (_process_env = process.env).NODE_ENV ?? (_process_env.NODE_ENV = "production");
24
+ process.env.NODE_ENV ??= "production";
26
25
  const output = [];
27
26
  for (const config of configurations){
28
27
  const initialTime = Date.now();
@@ -43,7 +42,7 @@ const build = async (configurations)=>{
43
42
  promises.push(new Promise((resolve, reject)=>{
44
43
  bundle.write(outputEntry).then(()=>{
45
44
  resolve({
46
- elapedTime: Date.now() - initialTime,
45
+ elapsedTime: Date.now() - initialTime,
47
46
  filename: outputFilename
48
47
  });
49
48
  }).catch(reject);
@@ -143,15 +142,6 @@ const getPlugins = (...customPlugins)=>{
143
142
  optDeps: true,
144
143
  peerDeps: true
145
144
  }),
146
- nodeResolve({
147
- /**
148
- * The `exports` conditional fields definition order is important in the `package.json file`.
149
- * To be resolved first, `types` field must always come first in the package.json exports definition.
150
- * @see https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencing.
151
- */ exportConditions: [
152
- "types"
153
- ]
154
- }),
155
145
  commonjs(),
156
146
  url(),
157
147
  json(),
@@ -179,7 +169,7 @@ const createMainConfig = (entryPoints, options)=>{
179
169
  return {
180
170
  input: entryPoints.source,
181
171
  output,
182
- plugins: getPlugins(swc({
172
+ plugins: getPlugins(nodeResolve(), swc({
183
173
  minify: minification,
184
174
  sourceMaps
185
175
  }))
@@ -193,7 +183,15 @@ const createTypesConfig = (entryPoints)=>{
193
183
  file: entryPoints.types
194
184
  }
195
185
  ],
196
- plugins: getPlugins(dts({
186
+ plugins: getPlugins(nodeResolve({
187
+ /**
188
+ * The `exports` conditional fields definition order is important in the `package.json file`.
189
+ * To be resolved first, `types` field must always come first in the package.json exports definition.
190
+ * @see https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencing.
191
+ */ exportConditions: [
192
+ "types"
193
+ ]
194
+ }), dts({
197
195
  compilerOptions: {
198
196
  incremental: false
199
197
  },
@@ -244,15 +242,14 @@ const createBuildCommand = (program)=>{
244
242
  }
245
243
  }).task({
246
244
  handler (context) {
247
- const padding = context.logInput.map((item)=>item.rawSize).reduce((pad, currentRawSize)=>{
248
- return Math.max(pad, String(currentRawSize).length);
249
- }, 0) + 2;
250
245
  context.logInput.forEach((item)=>{
251
246
  helpers.message([
252
- `${item.rawSize.toString().padStart(padding)} B raw`,
253
- `${item.compressedSize.toString().padStart(padding)} B gz`
254
- ], {
255
- label: `${item.filename} (took ${item.elapedTime}ms)`,
247
+ `${formatSize(item.rawSize)} raw`,
248
+ `${formatSize(item.compressedSize)} gzip`
249
+ ].map((message, index)=>{
250
+ return index === 0 ? message : ` ${message}`;
251
+ }).join("\n"), {
252
+ label: `${item.filename} (took ${item.elapsedTime}ms)`,
256
253
  type: "information"
257
254
  });
258
255
  });
@@ -274,10 +271,13 @@ const computeBundleSize = async (buildOutput)=>{
274
271
  };
275
272
  return Promise.all(buildOutput.map(async (item)=>computeFileSize(item)));
276
273
  };
274
+ const formatSize = (bytes)=>{
275
+ const kiloBytes = bytes / 1000;
276
+ return kiloBytes < 1 ? `${bytes} B` : `${kiloBytes.toFixed(2)} kB`;
277
+ };
277
278
 
278
279
  const watch = (configurations)=>{
279
- var _process_env;
280
- (_process_env = process.env).NODE_ENV ?? (_process_env.NODE_ENV = "development");
280
+ process.env.NODE_ENV ??= "development";
281
281
  const watcher = watch$1(configurations.map((config)=>({
282
282
  ...config,
283
283
  onLog
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickbundle",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "The zero-configuration transpiler and bundler for the web",
5
5
  "author": {
6
6
  "name": "Ayoub Adib",
@@ -52,16 +52,16 @@
52
52
  "@rollup/plugin-json": "^6.1.0",
53
53
  "@rollup/plugin-node-resolve": "^15.3.0",
54
54
  "@rollup/plugin-url": "^8.0.2",
55
- "@swc/core": "^1.7.40",
55
+ "@swc/core": "^1.7.42",
56
56
  "gzip-size": "^7.0.0",
57
- "rollup": "^4.24.0",
57
+ "rollup": "^4.24.3",
58
58
  "rollup-plugin-dts": "^6.1.1",
59
59
  "rollup-plugin-node-externals": "^7.1.3",
60
60
  "rollup-plugin-swc3": "^0.12.1",
61
- "termost": "^0.14.0"
61
+ "termost": "^0.18.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@types/node": "20.16.11"
64
+ "@types/node": "22.8.5"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "rollup --config ./src/bundler/config.ts --configPlugin rollup-plugin-swc3",