xtsz

0.0.8 • Public • Published

NOTE: youmust be on Node.js LTS (v18) or higher

This is like tsx but with https imports support +
ability to run external files directly from CLI +
only 1 dependency: esbuild

If file is .js, .cjs, .mjs, .ts, .cts, or .mts, it will bundled with esbuild on the fly then executed with Node.js.

If the file is css, txt, md, html, svg, xml, yaml, yml, toml, csv, sql, graphql, or gql it will be read and printed to the console.

xtsz

Install

# pnpm
pnpm add --global xtsz@latest
# yarn
yarn global add xtsz@latest
# npm
npm install --global xtsz@latest

Run

xtsz ./path/to/file.ts

as a devDependency

# install
pnpm add --save-dev xtsz@latest
# run
pnpm dlx xtsz ./path/to/file.ts
# or
xtsz https://gist.githubusercontent.com/o-az/e8ed1e89fde52af306099ed28e297cae/raw/f997df001ee197f638af14d09309eb3c060240b0/sample-iife.js
xtsz is a TypeScript and JavaScript (Node.js) file runner that supports https-imports and running external files directly from CLI.
It can run ESM and CJS: .ts, .js, .cjs, .mjs.

Usage:
  $ xtsz <filepath>
  $ xtsz <url>

Options:
  -f, --file  The file to run. Can be passed as a flag or as the only argument with no other flags.
  -u, --url   The url to run. Can be passed as a flag or as the only argument with no other flags.
  -h, --help  Show this help message.

Examples:
  $ xtsz ./src/index.ts
  $ xtsz --file ./src/index.cjs

  $ xtsz https://gist.githubusercontent.com/o-az/e8ed1e89fde52af306099ed28e297cae/raw/f997df001ee197f638af14d09309eb3c060240b0/sample-iife.js

  $ xtsz help, --help, -h

  - "What is https imports?"
  See https://nodejs.org/api/esm.html#https-and-http-imports

  - "How does this package work?"
  It uses a custom esbuild plugin to handle https imports and uses Node.js to run TypeScript & ESM.

    BUGS
  https://github.com/o-az/xtsz/issues

Package Sidebar

Install

npm i xtsz

Weekly Downloads

0

Version

0.0.8

License

MIT

Unpacked Size

8.05 kB

Total Files

3

Last publish

Collaborators

  • o-az