You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
}
❯ tzx zx_scripts_plain/test.ts
REPRO
⚡️ Currently active tools:
See options for more detailed reports by running
volta list --help
.tsup
LICENSE README.md assets dist node_modules package.json
index.js index.js.map
#!/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%
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
The text was updated successfully, but these errors were encountered: