@latticexyz/abi-ts 2.2.13-main-b3b4c559e57286e7ee58c8c079c6093835944d04 → 2.2.13-main-75e93bac492f9000c482d6a26a5c8e29079dd32d

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/bin/abi-ts.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // workaround for https://github.com/pnpm/pnpm/issues/1801
4
- import "../dist/abi-ts.js";
4
+ import "../dist/bin/abi-ts.js";
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{a as r}from"../chunk-UUU2MDZM.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
+ //# sourceMappingURL=abi-ts.js.map
@@ -0,0 +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,2DAA2D,CAC5G,EAGF,QAAQ,KAAK,CAAC,CAChB,CAAC,EAEA,MAAM,CAAE,EAAG,MAAO,CAAC,EAAE","names":["yargs","hideBin","chalk","command","yargs","hideBin","msg"]}
@@ -0,0 +1,8 @@
1
+ import{readFileSync as f,writeFileSync as p}from"fs";import m from"path";import{globSync as b}from"glob";import l from"debug";var t=l("abi-ts"),d=l("abi-ts");t.log=console.debug.bind(console);d.log=console.error.bind(console);var O={command:"abi-ts",describe:"Convert a directory of JSON ABI files to a directory of TS or DTS files with `as const`.",builder(e){return e.options({input:{type:"string",desc:"Input glob of ABI JSON files.",default:"**/*.abi.json"},extension:{type:"string",desc:"Extension of the resulting ABI TS or DTS file.",default:".json.d.ts"}})},handler({input:e,extension:i}){let s=b(e).sort();s.length||(console.error(`No files found for glob: ${e}`),process.exit(1));for(let o of s){let n=f(o,"utf8").trim();if(n==="[]"){t("Skipping empty ABI file",o);continue}let c=m.extname(o),r=`${o.substring(0,o.lastIndexOf(c))}${i}`,a=i.includes(".d.")?`declare const abi: ${n};
2
+
3
+ export default abi;
4
+ `:`const abi = ${n};
5
+
6
+ export default abi;
7
+ `;t("Writing",r),p(r,a)}process.exit(0)}};export{O as a};
8
+ //# sourceMappingURL=chunk-UUU2MDZM.js.map
@@ -0,0 +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};\\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"]}
@@ -0,0 +1,9 @@
1
+ import { CommandModule } from 'yargs';
2
+
3
+ type Options = {
4
+ input: string;
5
+ extension: string;
6
+ };
7
+ declare const command: CommandModule<Options, Options>;
8
+
9
+ export { command };
@@ -0,0 +1,2 @@
1
+ import{a as o}from"../chunk-UUU2MDZM.js";export{o as command};
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.13-main-b3b4c559e57286e7ee58c8c079c6093835944d04",
3
+ "version": "2.2.13-main-75e93bac492f9000c482d6a26a5c8e29079dd32d",
4
4
  "description": "Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,12 +10,12 @@
10
10
  "license": "MIT",
11
11
  "type": "module",
12
12
  "exports": {
13
- ".": "./dist/index.js"
13
+ "./internal": "./dist/exports/internal.js"
14
14
  },
15
15
  "typesVersions": {
16
16
  "*": {
17
- "index": [
18
- "./dist/index.d.ts"
17
+ "internal": [
18
+ "./dist/exports/internal.d.ts"
19
19
  ]
20
20
  }
21
21
  },
package/dist/abi-ts.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a as r}from"./chunk-EKGXNXNJ.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
- //# sourceMappingURL=abi-ts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/abi-ts.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport abiTsCommand from \".\";\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":";wCAEA,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","src_default","yargs","hideBin","msg"]}
@@ -1,3 +0,0 @@
1
- import{readFileSync as d,writeFileSync as f}from"fs";import{globSync as p}from"glob";import s from"debug";var e=s("abi-ts"),c=s("abi-ts");e.log=console.debug.bind(console);c.log=console.error.bind(console);var a={command:"abi-ts",describe:"Convert a directory of JSON ABI files to a directory of TS files with `as const`",builder(o){return o.options({input:{type:"string",desc:"Input glob of ABI JSON files",default:"**/*.abi.json"}})},handler({input:o}){let n=p(o).sort();n.length||(console.error(`No files found for glob: ${o}`),process.exit(1));for(let t of n){let r=d(t,"utf8").trim();if(r==="[]"){e("Skipping empty ABI file",t);continue}let l=`declare const abi: ${r}; export default abi;
2
- `,i=`${t}.d.ts`;e("Writing",i),f(i,l)}process.exit(0)}},S=a;export{S as a};
3
- //# sourceMappingURL=chunk-EKGXNXNJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/debug.ts"],"sourcesContent":["import type { CommandModule } from \"yargs\";\nimport { readFileSync, writeFileSync } from \"fs\";\nimport { globSync } from \"glob\";\nimport { debug } from \"./debug\";\n\ntype Options = {\n input: string;\n output: string;\n};\n\nconst commandModule: CommandModule<Options, Options> = {\n command: \"abi-ts\",\n\n describe: \"Convert a directory of JSON ABI files to a directory of TS 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 });\n },\n\n handler({ input }) {\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 ts = `declare const abi: ${json}; export default abi;\\n`;\n const tsFilename = `${jsonFilename}.d.ts`;\n\n debug(\"Writing\", tsFilename);\n writeFileSync(tsFilename, ts);\n }\n\n process.exit(0);\n },\n};\n\nexport default commandModule;\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,OAAS,YAAAC,MAAgB,OCFzB,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,EDCtC,IAAMC,EAAiD,CACrD,QAAS,SAET,SAAU,mFAEV,QAAQC,EAAO,CACb,OAAOA,EAAM,QAAQ,CACnB,MAAO,CACL,KAAM,SACN,KAAM,+BACN,QAAS,eACX,CACF,CAAC,CACH,EAEA,QAAQ,CAAE,MAAAC,CAAM,EAAG,CACjB,IAAMC,EAAQC,EAASF,CAAK,EAAE,KAAK,EAE9BC,EAAM,SACT,QAAQ,MAAM,4BAA4BD,GAAO,EACjD,QAAQ,KAAK,CAAC,GAGhB,QAAWG,KAAgBF,EAAO,CAChC,IAAMG,EAAOC,EAAaF,EAAc,MAAM,EAAE,KAAK,EACrD,GAAIC,IAAS,KAAM,CACjBE,EAAM,0BAA2BH,CAAY,EAC7C,SAGF,IAAMI,EAAK,sBAAsBH;AAAA,EAC3BI,EAAa,GAAGL,SAEtBG,EAAM,UAAWE,CAAU,EAC3BC,EAAcD,EAAYD,CAAE,EAG9B,QAAQ,KAAK,CAAC,CAChB,CACF,EAEOG,EAAQZ","names":["readFileSync","writeFileSync","globSync","createDebug","debug","error","commandModule","yargs","input","files","globSync","jsonFilename","json","readFileSync","debug","ts","tsFilename","writeFileSync","src_default"]}
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { CommandModule } from 'yargs';
2
-
3
- type Options = {
4
- input: string;
5
- output: string;
6
- };
7
- declare const commandModule: CommandModule<Options, Options>;
8
-
9
- export { commandModule as default };
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- import{a}from"./chunk-EKGXNXNJ.js";export{a as default};
2
- //# sourceMappingURL=index.js.map
File without changes
File without changes