quickbundle 0.0.0-next-386ba5d → 0.0.0-next-68182ec

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 +19 -11
  2. package/package.json +1 -1
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 { copyFile as copyFile$1, rm, writeFile as writeFile$1, rename, mkdir, readFile as readFile$1 } from 'node:fs/promises';
6
+ import { mkdir, copyFile as copyFile$1, rm, writeFile as writeFile$1, rename, 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-386ba5d";
22
+ var version = "0.0.0-next-68182ec";
23
23
 
24
24
  /**
25
25
  * Resolve a relative path from the Quickbundle node modules directory.
@@ -67,12 +67,21 @@ const writeFile = async (filePath, content)=>{
67
67
  await writeFile$1(filePath, content, "utf8");
68
68
  };
69
69
  const download = async (url, filePath)=>{
70
- await createDirectory(dirname(filePath));
71
- const { body } = await fetch(url);
72
- if (!body) {
73
- throw new Error(`Empty body while attempting to download file from \`${url}\`.`);
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);
74
84
  }
75
- return finished(Readable.fromWeb(body).pipe(createWriteStream(filePath)));
76
85
  };
77
86
  const unzip = async (input, output)=>{
78
87
  const { targetArchivePath } = input;
@@ -426,11 +435,10 @@ const createCompileCommand = (program)=>{
426
435
  }
427
436
  const osType = getOsType(matchedRuntimeParts.os);
428
437
  const extension = osType === "windows" ? "zip" : "tar.gz";
438
+ await createDirectory(dirname(TEMPORARY_DOWNLOAD_PATH));
429
439
  await download(`https://nodejs.org/download/release/${matchedRuntimeParts.version}/${targetInput}.${extension}`, TEMPORARY_DOWNLOAD_PATH);
430
- console.log(TEMPORARY_DOWNLOAD_PATH, {
431
- directoryPath: dirname(TEMPORARY_RUNTIME_PATH),
432
- filename: basename(TEMPORARY_RUNTIME_PATH)
433
- });
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`));
434
442
  await unzip({
435
443
  path: TEMPORARY_DOWNLOAD_PATH,
436
444
  targetArchivePath: osType === "windows" ? join(targetInput, "node.exe") : join(targetInput, "bin", "node")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickbundle",
3
- "version": "0.0.0-next-386ba5d",
3
+ "version": "0.0.0-next-68182ec",
4
4
  "description": "The zero-configuration transpiler and bundler for the web",
5
5
  "author": {
6
6
  "name": "Ayoub Adib",