@latticexyz/abi-ts 2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940 → 2.2.18-e1db80ad5648a9c77b757cda3930aa134e0f1c97
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.
package/dist/bin/abi-ts.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as r}from"../chunk-
|
|
2
|
+
import{a as r}from"../chunk-3YTXQRSA.js";import e from"yargs";import{hideBin as i}from"yargs/helpers";import o from"chalk";r.command="$0";e(i(process.argv)).scriptName("abi-ts").command(r).strict().fail(a=>{console.error(o.red(a)),a.includes("Missing required argument")&&console.log(o.yellow(`Run 'pnpm abi-ts ${process.argv[2]} --help' for a list of available and required arguments.`)),process.exit(1)}).alias({h:"help"}).argv;
|
|
3
3
|
//# sourceMappingURL=abi-ts.js.map
|
package/dist/bin/abi-ts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/abi-ts.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { command as abiTsCommand } from \"../command\";\nimport chalk from \"chalk\";\n\n// $0 makes this a default command (as opposed to a sub-command),\n// which replaces `abi-ts abi-ts` with just `abi-ts`\nabiTsCommand.command = \"$0\";\n\nyargs(hideBin(process.argv))\n .scriptName(\"abi-ts\")\n // Use the commands directory to scaffold\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- command array overload isn't typed, see https://github.com/yargs/yargs/blob/main/docs/advanced.md#esm-hierarchy\n .command(abiTsCommand as any)\n // Enable strict mode.\n .strict()\n // Custom error handler\n .fail((msg) => {\n console.error(chalk.red(msg));\n if (msg.includes(\"Missing required argument\")) {\n console.log(\n chalk.yellow(`Run 'pnpm abi-ts ${process.argv[2]} --help' for a list of available and required arguments.`),\n );\n }\n\n process.exit(1);\n })\n // Useful aliases.\n .alias({ h: \"help\" }).argv;\n"],"mappings":";yCAEA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBAExB,OAAOC,MAAW,QAIlBC,EAAa,QAAU,KAEvBC,EAAMC,EAAQ,QAAQ,IAAI,CAAC,EACxB,WAAW,QAAQ,EAGnB,QAAQF,CAAmB,EAE3B,OAAO,EAEP,KAAMG,GAAQ,CACb,QAAQ,MAAMJ,EAAM,IAAII,CAAG,CAAC,EACxBA,EAAI,SAAS,2BAA2B,GAC1C,QAAQ,IACNJ,EAAM,OAAO,oBAAoB,QAAQ,KAAK,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../src/bin/abi-ts.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { command as abiTsCommand } from \"../command\";\nimport chalk from \"chalk\";\n\n// $0 makes this a default command (as opposed to a sub-command),\n// which replaces `abi-ts abi-ts` with just `abi-ts`\nabiTsCommand.command = \"$0\";\n\nyargs(hideBin(process.argv))\n .scriptName(\"abi-ts\")\n // Use the commands directory to scaffold\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- command array overload isn't typed, see https://github.com/yargs/yargs/blob/main/docs/advanced.md#esm-hierarchy\n .command(abiTsCommand as any)\n // Enable strict mode.\n .strict()\n // Custom error handler\n .fail((msg) => {\n console.error(chalk.red(msg));\n if (msg.includes(\"Missing required argument\")) {\n console.log(\n chalk.yellow(`Run 'pnpm abi-ts ${process.argv[2]} --help' for a list of available and required arguments.`),\n );\n }\n\n process.exit(1);\n })\n // Useful aliases.\n .alias({ h: \"help\" }).argv;\n"],"mappings":";yCAEA,OAAOA,MAAW,QAClB,OAAS,WAAAC,MAAe,gBAExB,OAAOC,MAAW,QAIlBC,EAAa,QAAU,KAEvBC,EAAMC,EAAQ,QAAQ,IAAI,CAAC,EACxB,WAAW,QAAQ,EAGnB,QAAQF,CAAmB,EAE3B,OAAO,EAEP,KAAMG,GAAQ,CACb,QAAQ,MAAMJ,EAAM,IAAII,CAAG,CAAC,EACxBA,EAAI,SAAS,2BAA2B,GAC1C,QAAQ,IACNJ,EAAM,OAAO,oBAAoB,QAAQ,KAAK,CAAC,2DAA2D,CAC5G,EAGF,QAAQ,KAAK,CAAC,CAChB,CAAC,EAEA,MAAM,CAAE,EAAG,MAAO,CAAC,EAAE","names":["yargs","hideBin","chalk","command","yargs","hideBin","msg"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/command.ts","../src/debug.ts"],"sourcesContent":["import type { CommandModule } from \"yargs\";\nimport { readFileSync, writeFileSync } from \"fs\";\nimport path from \"path\";\nimport { globSync } from \"glob\";\nimport { debug } from \"./debug\";\n\ntype Options = {\n input: string;\n extension: string;\n};\n\nexport const command: CommandModule<Options, Options> = {\n command: \"abi-ts\",\n\n describe: \"Convert a directory of JSON ABI files to a directory of TS or DTS files with `as const`.\",\n\n builder(yargs) {\n return yargs.options({\n input: {\n type: \"string\",\n desc: \"Input glob of ABI JSON files.\",\n default: \"**/*.abi.json\",\n },\n extension: {\n type: \"string\",\n desc: \"Extension of the resulting ABI TS or DTS file.\",\n default: \".json.d.ts\",\n },\n });\n },\n\n handler({ input, extension: tsExtension }) {\n const files = globSync(input).sort();\n\n if (!files.length) {\n console.error(`No files found for glob: ${input}`);\n process.exit(1);\n }\n\n for (const jsonFilename of files) {\n const json = readFileSync(jsonFilename, \"utf8\").trim();\n if (json === \"[]\") {\n debug(\"Skipping empty ABI file\", jsonFilename);\n continue;\n }\n\n const jsonExtension = path.extname(jsonFilename);\n const tsFilename = `${jsonFilename.substring(0, jsonFilename.lastIndexOf(jsonExtension))}${tsExtension}`;\n\n const ts = tsExtension.includes(\".d.\")\n ? `declare const abi: ${json};\\n\\nexport default abi;\\n`\n : `const abi = ${json} as const;\\n\\nexport default abi;\\n`;\n\n debug(\"Writing\", tsFilename);\n writeFileSync(tsFilename, ts);\n }\n\n process.exit(0);\n },\n};\n","import createDebug from \"debug\";\n\nexport const debug = createDebug(\"abi-ts\");\nexport const error = createDebug(\"abi-ts\");\n\n// Pipe debug output to stdout instead of stderr\ndebug.log = console.debug.bind(console);\n\n// Pipe error output to stderr\nerror.log = console.error.bind(console);\n"],"mappings":"AACA,OAAS,gBAAAA,EAAc,iBAAAC,MAAqB,KAC5C,OAAOC,MAAU,OACjB,OAAS,YAAAC,MAAgB,OCHzB,OAAOC,MAAiB,QAEjB,IAAMC,EAAQD,EAAY,QAAQ,EAC5BE,EAAQF,EAAY,QAAQ,EAGzCC,EAAM,IAAM,QAAQ,MAAM,KAAK,OAAO,EAGtCC,EAAM,IAAM,QAAQ,MAAM,KAAK,OAAO,EDE/B,IAAMC,EAA2C,CACtD,QAAS,SAET,SAAU,2FAEV,QAAQC,EAAO,CACb,OAAOA,EAAM,QAAQ,CACnB,MAAO,CACL,KAAM,SACN,KAAM,gCACN,QAAS,eACX,EACA,UAAW,CACT,KAAM,SACN,KAAM,iDACN,QAAS,YACX,CACF,CAAC,CACH,EAEA,QAAQ,CAAE,MAAAC,EAAO,UAAWC,CAAY,EAAG,CACzC,IAAMC,EAAQC,EAASH,CAAK,EAAE,KAAK,EAE9BE,EAAM,SACT,QAAQ,MAAM,4BAA4BF,
|
|
1
|
+
{"version":3,"sources":["../src/command.ts","../src/debug.ts"],"sourcesContent":["import type { CommandModule } from \"yargs\";\nimport { readFileSync, writeFileSync } from \"fs\";\nimport path from \"path\";\nimport { globSync } from \"glob\";\nimport { debug } from \"./debug\";\n\ntype Options = {\n input: string;\n extension: string;\n};\n\nexport const command: CommandModule<Options, Options> = {\n command: \"abi-ts\",\n\n describe: \"Convert a directory of JSON ABI files to a directory of TS or DTS files with `as const`.\",\n\n builder(yargs) {\n return yargs.options({\n input: {\n type: \"string\",\n desc: \"Input glob of ABI JSON files.\",\n default: \"**/*.abi.json\",\n },\n extension: {\n type: \"string\",\n desc: \"Extension of the resulting ABI TS or DTS file.\",\n default: \".json.d.ts\",\n },\n });\n },\n\n handler({ input, extension: tsExtension }) {\n const files = globSync(input).sort();\n\n if (!files.length) {\n console.error(`No files found for glob: ${input}`);\n process.exit(1);\n }\n\n for (const jsonFilename of files) {\n const json = readFileSync(jsonFilename, \"utf8\").trim();\n if (json === \"[]\") {\n debug(\"Skipping empty ABI file\", jsonFilename);\n continue;\n }\n\n const jsonExtension = path.extname(jsonFilename);\n const tsFilename = `${jsonFilename.substring(0, jsonFilename.lastIndexOf(jsonExtension))}${tsExtension}`;\n\n const ts = tsExtension.includes(\".d.\")\n ? `declare const abi: ${json};\\n\\nexport default abi;\\n`\n : `const abi = ${json} as const;\\n\\nexport default abi;\\n`;\n\n debug(\"Writing\", tsFilename);\n writeFileSync(tsFilename, ts);\n }\n\n process.exit(0);\n },\n};\n","import createDebug from \"debug\";\n\nexport const debug = createDebug(\"abi-ts\");\nexport const error = createDebug(\"abi-ts\");\n\n// Pipe debug output to stdout instead of stderr\ndebug.log = console.debug.bind(console);\n\n// Pipe error output to stderr\nerror.log = console.error.bind(console);\n"],"mappings":"AACA,OAAS,gBAAAA,EAAc,iBAAAC,MAAqB,KAC5C,OAAOC,MAAU,OACjB,OAAS,YAAAC,MAAgB,OCHzB,OAAOC,MAAiB,QAEjB,IAAMC,EAAQD,EAAY,QAAQ,EAC5BE,EAAQF,EAAY,QAAQ,EAGzCC,EAAM,IAAM,QAAQ,MAAM,KAAK,OAAO,EAGtCC,EAAM,IAAM,QAAQ,MAAM,KAAK,OAAO,EDE/B,IAAMC,EAA2C,CACtD,QAAS,SAET,SAAU,2FAEV,QAAQC,EAAO,CACb,OAAOA,EAAM,QAAQ,CACnB,MAAO,CACL,KAAM,SACN,KAAM,gCACN,QAAS,eACX,EACA,UAAW,CACT,KAAM,SACN,KAAM,iDACN,QAAS,YACX,CACF,CAAC,CACH,EAEA,QAAQ,CAAE,MAAAC,EAAO,UAAWC,CAAY,EAAG,CACzC,IAAMC,EAAQC,EAASH,CAAK,EAAE,KAAK,EAE9BE,EAAM,SACT,QAAQ,MAAM,4BAA4BF,GAAO,EACjD,QAAQ,KAAK,CAAC,GAGhB,QAAWI,KAAgBF,EAAO,CAChC,IAAMG,EAAOC,EAAaF,EAAc,MAAM,EAAE,KAAK,EACrD,GAAIC,IAAS,KAAM,CACjBE,EAAM,0BAA2BH,CAAY,EAC7C,SAGF,IAAMI,EAAgBC,EAAK,QAAQL,CAAY,EACzCM,EAAa,GAAGN,EAAa,UAAU,EAAGA,EAAa,YAAYI,CAAa,CAAC,IAAIP,IAErFU,EAAKV,EAAY,SAAS,KAAK,EACjC,sBAAsBI;AAAA;AAAA;AAAA,EACtB,eAAeA;AAAA;AAAA;AAAA,EAEnBE,EAAM,UAAWG,CAAU,EAC3BE,EAAcF,EAAYC,CAAE,EAG9B,QAAQ,KAAK,CAAC,CAChB,CACF","names":["readFileSync","writeFileSync","path","globSync","createDebug","debug","error","command","yargs","input","tsExtension","files","globSync","jsonFilename","json","readFileSync","debug","jsonExtension","path","tsFilename","ts","writeFileSync"]}
|
package/dist/exports/internal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-3YTXQRSA.js";export{o as command};
|
|
2
2
|
//# sourceMappingURL=internal.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/abi-ts",
|
|
3
|
-
"version": "2.2.18-
|
|
3
|
+
"version": "2.2.18-e1db80ad5648a9c77b757cda3930aa134e0f1c97",
|
|
4
4
|
"description": "Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,12 +29,15 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"chalk": "^5.3.0",
|
|
31
31
|
"debug": "^4.3.4",
|
|
32
|
+
"execa": "^7.0.0",
|
|
32
33
|
"glob": "^10.4.2",
|
|
33
34
|
"yargs": "^17.7.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/debug": "^4.1.7",
|
|
37
|
-
"@types/yargs": "^17.0.10"
|
|
38
|
+
"@types/yargs": "^17.0.10",
|
|
39
|
+
"tsup": "^6.7.0",
|
|
40
|
+
"vitest": "0.34.6"
|
|
38
41
|
},
|
|
39
42
|
"publishConfig": {
|
|
40
43
|
"access": "public"
|