Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/jco-transpile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!/.vscode/

*.tsbuildinfo
20 changes: 20 additions & 0 deletions packages/jco-transpile/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"label": "tsc",
"script": "tsc",
"problemMatcher": ["$tsc"],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"env": {
"NPM_TOKEN": ""
}
}
}
]
}
4 changes: 4 additions & 0 deletions packages/jco-transpile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
}
},
"scripts": {
"tsc": "tsc --build",
"lint": "eslint -c ../../eslint.config.mjs ./src/**/*.js ./test/**/*.js",
"lint:fix": "npm run lint -- --fix",
"test": "vitest run -c test/vitest.ts",
Expand All @@ -53,5 +54,8 @@
"@bytecodealliance/preview2-shim": "^0.17.2",
"chalk-template": "^1",
"terser": "^5"
},
"devDependencies": {
"@tsconfig/node20": "^20.1.6"
}
}
99 changes: 59 additions & 40 deletions packages/jco-transpile/src/common.d.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,61 @@
export function setShowSpinner(val: boolean): void;
export function getShowSpinner(): boolean;

interface SizeStrOpts {
import { FileHandle } from 'node:fs/promises';
/** Detect a windows environment */
export declare const isWindows: boolean;
export type FileBytes = Record<string, Uint8Array>;
export interface SizeStrOptions {
significantDigits?: number;
}
export function sizeStr(num: any, opts?: SizeStrOpts): string;

export function fixedDigitDisplay(num: number, maxChars: number): string;

type CellAlignment = 'left' | 'right';
export function table(data: any[][], cellAlignment?: CellAlignment[]): string;

export function getTmpDir(): Promise<string>;

export function spawnIOTmp(
cmd: any,
input: any,
args: any
): Promise<Buffer<ArrayBufferLike>>;

export const isWindows: boolean;

export function readFile(
file: string,
encoding: string
): Promise<Buffer<ArrayBufferLike>>;

export function spawnIOTmp(
cmd: string,
input: Buffer | string | any,
args: string[]
): Promise<void>;

export function byteLengthLEB128(val: number): number;

/** Bytes that belong in one or more files */
type FileBytes = {
[filename: string]: Uint8Array;
};

//# sourceMappingURL=common.d.ts.map
/**
* Convert a given number into the string that would appropriately represent it,
* in either KiB or MiB.
*
* @param {number} num
*/
export declare function sizeStr(num: number, opts?: SizeStrOptions): string;
/**
* Display a given number with a fixed number of digits
*
* @param {number} num - number to display
* @param {number} maxChars - character limit
* @returns {string} The number, displayed
*/
export declare function fixedDigitDisplay(num: number, maxChars: number): string;
/**
* Tabulate an array of data for display as a table
*
* @param {any[][]} data - row-major array of data
* @param {string[]} align - preferred alignment of cells
* @returns {string} Tabulated data
*/
export declare function table(data: any[][], cellAlignment?: string[]): string;
/**
* Securely creates a temporary directory and returns its path.
*
* The new directory is created using `fsPromises.mkdtemp()`.
*
* @return {Promise<string>} A Promise that resolves to the created temporary directory
*/
export declare function getTmpDir(): Promise<string>;
/**
* Read a file, throwing and error when a file could not be read
*
* @param {string} file - file to read
* @param {string} encoding - encoding of the file
*/
export declare function readFile(file: string | Buffer | URL | FileHandle, encoding?: BufferEncoding): Promise<Buffer | string>;
/**
* Spawn an command that modified a WebAssembly component as a subprocess,
* with a temporary (scratch) directory for performing work in.
*
* @param {string} cmd - the command to run
* @param {string} input - wasm input to write to a temporary input file
* @param {string[]} args
*/
export declare function runWASMTransformProgram(cmd: string, input: Uint8Array, args: string[]): Promise<Buffer>;
/**
* Counts the byte length for the LEB128 encoding of a number.
*
* @param {number} val
* @returns {number}
*/
export declare function byteLengthLEB128(val: number): number;
1 change: 0 additions & 1 deletion packages/jco-transpile/src/common.d.ts.map

This file was deleted.

56 changes: 18 additions & 38 deletions packages/jco-transpile/src/common.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/jco-transpile/src/common.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading