Coder Social home page Coder Social logo

tzx's People

Contributors

realfresh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

towhidkashem

tzx's Issues

missing imports

❯ tzx zx_scripts_plain/test.ts

node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'tsup' imported from /home/md/.volta/tools/image/packages/tzx/lib/node_modules/tzx/dist/index.js
Did you mean to import tsup/lib/node_modules/tsup/dist/index.js?
    at new NodeError (node:internal/errors:387:5)
    at packageResolve (node:internal/modules/esm/resolve:951:9)
    at moduleResolve (node:internal/modules/esm/resolve:1000:20)
    at defaultResolve (node:internal/modules/esm/resolve:1214:11)
    at nextResolve (node:internal/modules/esm/loader:165:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

REPRO

❯ volta list

⚡️ Currently active tools:

Node: v16.17.0 (default)
Tool binaries available:
    tsup, tsup-node (default)
    tsc, tsserver (default)
    tzx (default)
    zx (default)

See options for more detailed reports by running volta list --help.

❯ ls /home/md/.volta/tools/image/packages/tsup/lib/node_modules

tsup


❯ ls /home/md/.volta/tools/image/packages/tsup/lib/node_modules/tsup

LICENSE README.md assets dist node_modules package.json


❯ ls /home/md/.volta/tools/image/packages/tzx/lib/node_modules/tzx/dist

index.js index.js.map

❯ cat /home/md/.volta/tools/image/packages/tzx/lib/node_modules/tzx/dist/index.js

#!/usr/bin/env node

// src/index.ts
import tsup from "tsup";
import crypto from "node:crypto";
import { $, path, fs, argv, chalk } from "zx";
var id = crypto.randomBytes(6).toString("hex");
var dir = path.resolve(process.cwd(), .tzx-${id});
var args = process.argv.slice(3);
var clean = () => {
try {
fs.rmSync(dir, { recursive: true });
} catch {
}
};
process.on("SIGINT", clean);
process.on("SIGTERM", clean);
try {
let input = argv._[0];
if (!input) {
console.log(chalk.red("\n[Error]"));
console.log(No file specified);
process.exit(1);
}
if (!input.includes("."))
input += ".tz";
const output = path.resolve(dir, input.replace(".ts", ".js"));
const outputPKG = path.resolve(dir, package.json);
const outputTSConfig = path.resolve(dir, tsconfig.json);
await $rm -rf ${dir}.quiet();
await $mkdir -p ${dir}.quiet();
await $cp ${input} ${dir}/${input}.quiet();
await fs.writeJSON(outputPKG, {
name: "tmp_script",
version: "1.0.0",
type: "module"
});
await fs.writeJSON(outputTSConfig, {});
await tsup.build({
config: false,
entry: [${dir}/${input}],
outDir: dir,
format: "esm",
target: "node16",
platform: "node",
skipNodeModulesBundle: true,
splitting: false,
silent: true,
noExternal: [/./],
outExtension: () => ({ js: ".js" })
});
const content = await fs.readFile(output, "utf8");
const updated = content.replace(/^import.
("|')zx(";|';|"|')/gm, "");
await fs.writeFile(output, updated);
try {
await $zx ${output} ${args}.pipe(process.stdout);
} catch {
}
clean();
} catch (e) {
clean();
console.error(e);
process.exit(1);
}
//# sourceMappingURL=index.js.map%



❯ ls /home/md/.volta/tools/image/packages/tzx/lib/node_modules/tzx

dist node_modules package.json readme.md src test tsconfig.json

❯ ls /home/md/.volta/tools/image/packages/tzx/lib/node_modules/tzx/node_modules

@nodelib            fetch-blob         is-glob            path-type        through
@types              fill-range         is-number          pause-stream     to-regex-range
braces              formdata-polyfill  isexe              picomatch        universalify
chalk               from               jsonfile           ps-tree          web-streams-polyfill
data-uri-to-buffer  fs-extra           map-stream         queue-microtask  which
dir-glob            glob-parent        merge2             reusify          yaml
duplexer            globby             micromatch         run-parallel     zx
event-stream        graceful-fs        minimist           slash
fast-glob           ignore             node-domexception  split
fastq               is-extglob         node-fetch         stream-combiner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.