quickbundle 0.0.0-next-ed1776f → 0.0.0-next-5441a21

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 +43 -32
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { helpers, termost } from 'termost';
2
2
  import { readFile as readFile$1, writeFile, rm } from 'node:fs/promises';
3
- import process, { chdir } from 'node:process';
3
+ import process from 'node:process';
4
4
  import { watch as watch$1, rollup } from 'rollup';
5
- import { join, dirname, basename } from 'node:path';
5
+ import { join, basename, dirname, resolve } from 'node:path';
6
6
  import { createRequire } from 'node:module';
7
7
  import { swc } from 'rollup-plugin-swc3';
8
8
  import externals from 'rollup-plugin-node-externals';
@@ -15,7 +15,7 @@ import os from 'node:os';
15
15
  import { gzipSize } from 'gzip-size';
16
16
 
17
17
  var name = "quickbundle";
18
- var version = "0.0.0-next-ed1776f";
18
+ var version = "0.0.0-next-5441a21";
19
19
 
20
20
  const CWD = process.cwd();
21
21
 
@@ -356,38 +356,49 @@ const createCompileCommand = (program)=>{
356
356
  return `Compile ${binaries}`;
357
357
  },
358
358
  async handler ({ config, osType }) {
359
- for (const { bin, require: filePath } of config.metadata){
360
- if (!filePath || !bin) continue;
361
- chdir(dirname(filePath));
362
- const fileName = basename(filePath);
363
- const blobFileName = `${fileName}.blob`;
364
- const executableFileName = `${bin}${osType === "windows" ? ".exe" : ""}`;
365
- const seaConfigFileName = `${fileName}.sea-config.json`;
366
- await writeFile(seaConfigFileName, JSON.stringify({
367
- disableExperimentalSEAWarning: true,
368
- main: fileName,
369
- output: blobFileName,
370
- useCodeCache: false,
371
- useSnapshot: false
372
- }), "utf-8");
373
- await helpers.exec(`node --experimental-sea-config ${seaConfigFileName}`);
374
- await helpers.exec(`node -e "require('fs').copyFileSync(process.execPath, '${executableFileName}')"`);
375
- if (osType === "macos") {
376
- await helpers.exec(`codesign --remove-signature ${executableFileName}`);
377
- }
378
- await helpers.exec(`npx postject ${executableFileName} NODE_SEA_BLOB ${blobFileName} --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 ${osType === "macos" ? "--macho-segment-name NODE_SEA" : ""}`);
379
- if (osType === "macos") {
380
- await helpers.exec(`codesign --sign - ${executableFileName}`);
381
- }
382
- await Promise.all([
383
- blobFileName,
384
- seaConfigFileName
385
- ].map(async (file)=>rm(file)));
386
- chdir(CWD);
387
- }
359
+ await Promise.all(config.metadata.map(async ({ bin, require })=>{
360
+ if (!require || !bin) return;
361
+ return compile({
362
+ bin,
363
+ input: require,
364
+ osType
365
+ });
366
+ }));
388
367
  }
389
368
  });
390
369
  };
370
+ const compile = async ({ bin, input, osType })=>{
371
+ const inputFileName = basename(input);
372
+ const inputDirectory = dirname(input);
373
+ const resolveFromInputDirectory = (...paths)=>{
374
+ return resolve(inputDirectory, ...paths);
375
+ };
376
+ const blobFileName = resolveFromInputDirectory(`${inputFileName}.blob`);
377
+ const executableFileName = resolveFromInputDirectory(`${bin}${osType === "windows" ? ".exe" : ""}`);
378
+ const seaConfigFileName = resolveFromInputDirectory(`${inputFileName}.sea-config.json`);
379
+ await writeFile(seaConfigFileName, JSON.stringify({
380
+ disableExperimentalSEAWarning: true,
381
+ main: input,
382
+ output: blobFileName,
383
+ useCodeCache: false,
384
+ useSnapshot: false
385
+ }), "utf-8");
386
+ await Promise.all([
387
+ `node --experimental-sea-config ${seaConfigFileName}`,
388
+ `node -e "require('fs').copyFileSync(process.execPath, '${executableFileName}')"`
389
+ ].map(async (command)=>helpers.exec(command)));
390
+ if (osType === "macos") {
391
+ await helpers.exec(`codesign --remove-signature ${executableFileName}`);
392
+ }
393
+ await helpers.exec(`npx postject ${executableFileName} NODE_SEA_BLOB ${blobFileName} --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 ${osType === "macos" ? "--macho-segment-name NODE_SEA" : ""}`);
394
+ if (osType === "macos") {
395
+ await helpers.exec(`codesign --sign - ${executableFileName}`);
396
+ }
397
+ await Promise.all([
398
+ blobFileName,
399
+ seaConfigFileName
400
+ ].map(async (file)=>rm(file)));
401
+ };
391
402
 
392
403
  const createBuildCommand = (program)=>{
393
404
  return createCommand(program, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickbundle",
3
- "version": "0.0.0-next-ed1776f",
3
+ "version": "0.0.0-next-5441a21",
4
4
  "description": "The zero-configuration transpiler and bundler for the web",
5
5
  "author": {
6
6
  "name": "Ayoub Adib",