quickbundle 0.0.0-next-68182ec → 0.0.0-next-9474b9e

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 CHANGED
@@ -187,7 +187,7 @@ quickbundle compile --target node-v23.1.0-win-x64 # Embeds Node v23 runtime buil
187
187
  ```
188
188
 
189
189
  > [!note]
190
- > The accepted target input follows the `node-vx.y.z-(darwin|linux|win)-(arm64|x64|x86)` format (for an exhaustive view, check available filenames in [https://nodejs.org/download/release/vx.y.z](https://nodejs.org/download/release/latest/)).
190
+ > The target input must follow the `node-vx.y.z-(darwin|linux|win)-(arm64|x64|x86)` format (for an exhaustive view, check available filenames in [https://nodejs.org/download/release/vx.y.z](https://nodejs.org/download/release/latest/)).
191
191
 
192
192
  <br>
193
193
 
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { finished } from 'node:stream/promises';
3
3
  import { Readable } from 'node:stream';
4
4
  import process from 'node:process';
5
5
  import { resolve, dirname, join, basename } from 'node:path';
6
- import { mkdir, copyFile as copyFile$1, rm, writeFile as writeFile$1, rename, readFile as readFile$1 } from 'node:fs/promises';
6
+ import { copyFile as copyFile$1, rm, writeFile as writeFile$1, rename, mkdir, readFile as readFile$1 } from 'node:fs/promises';
7
7
  import { createWriteStream } from 'node:fs';
8
8
  import decompress from 'decompress';
9
9
  import { watch as watch$1, rollup } from 'rollup';
@@ -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-68182ec";
22
+ var version = "0.0.0-next-9474b9e";
23
23
 
24
24
  /**
25
25
  * Resolve a relative path from the Quickbundle node modules directory.
@@ -67,31 +67,25 @@ const writeFile = async (filePath, content)=>{
67
67
  await writeFile$1(filePath, content, "utf8");
68
68
  };
69
69
  const download = async (url, filePath)=>{
70
- try {
71
- await createDirectory(dirname(filePath));
72
- const { body, ok, status, statusText } = await fetch(url);
73
- console.log({
74
- ok,
75
- status,
76
- statusText
77
- });
78
- if (!body) {
79
- throw new Error(`Empty body while attempting to download file from \`${url}\`.`);
80
- }
81
- await finished(Readable.fromWeb(body).pipe(createWriteStream(filePath)));
82
- } catch (error) {
83
- console.error("An error occurred while donwloading", error);
70
+ await createDirectory(dirname(filePath));
71
+ const { body, ok, status, statusText } = await fetch(url);
72
+ if (!ok) {
73
+ throw new Error(`An error ocurred while downloading \`${url}\`. Received \`${status}\` status code with the following message \`${statusText}\`.`);
74
+ }
75
+ if (!body) {
76
+ throw new Error(`Empty body received while downloading \`${url}\`.`);
84
77
  }
78
+ await finished(Readable.fromWeb(body).pipe(createWriteStream(filePath)));
85
79
  };
86
80
  const unzip = async (input, output)=>{
87
- const { targetArchivePath } = input;
81
+ const { targetedArchivePath } = input;
88
82
  const { directoryPath } = output;
89
83
  await decompress(input.path, directoryPath, {
90
84
  filter (file) {
91
- return file.path === targetArchivePath;
85
+ return file.path === targetedArchivePath;
92
86
  }
93
87
  });
94
- await rename(join(directoryPath, targetArchivePath), join(directoryPath, output.filename));
88
+ await rename(join(directoryPath, targetedArchivePath), join(directoryPath, output.filename));
95
89
  };
96
90
  const createCommand = (program, input)=>{
97
91
  return program.command(input).option({
@@ -435,13 +429,10 @@ const createCompileCommand = (program)=>{
435
429
  }
436
430
  const osType = getOsType(matchedRuntimeParts.os);
437
431
  const extension = osType === "windows" ? "zip" : "tar.gz";
438
- await createDirectory(dirname(TEMPORARY_DOWNLOAD_PATH));
439
432
  await download(`https://nodejs.org/download/release/${matchedRuntimeParts.version}/${targetInput}.${extension}`, TEMPORARY_DOWNLOAD_PATH);
440
- console.log("LS -AL", await helpers.exec(`ls ${TEMPORARY_PATH} -al`));
441
- console.log("LS -AL DOWNLOAD", await helpers.exec(`ls ${TEMPORARY_DOWNLOAD_PATH} -al`));
442
433
  await unzip({
443
434
  path: TEMPORARY_DOWNLOAD_PATH,
444
- targetArchivePath: osType === "windows" ? join(targetInput, "node.exe") : join(targetInput, "bin", "node")
435
+ targetedArchivePath: osType === "windows" ? join(targetInput, "node.exe") : join(targetInput, "bin", "node")
445
436
  }, {
446
437
  directoryPath: dirname(TEMPORARY_RUNTIME_PATH),
447
438
  filename: basename(TEMPORARY_RUNTIME_PATH)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickbundle",
3
- "version": "0.0.0-next-68182ec",
3
+ "version": "0.0.0-next-9474b9e",
4
4
  "description": "The zero-configuration transpiler and bundler for the web",
5
5
  "author": {
6
6
  "name": "Ayoub Adib",