@arkade-os/sdk 0.5.13 → 0.5.15

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.
Files changed (90) hide show
  1. package/README.md +55 -1
  2. package/dist/adapters/expo.cjs +6 -6
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/artifact-DA5YHM2k.d.cts +87 -0
  7. package/dist/artifact-DacurepK.d.ts +87 -0
  8. package/dist/{asyncStorageTaskQueue-Dhbe00Ya.d.ts → asyncStorageTaskQueue-B3umqlkb.d.ts} +1 -1
  9. package/dist/{asyncStorageTaskQueue-Y4BlVm41.d.cts → asyncStorageTaskQueue-Dq6AJHNv.d.cts} +1 -1
  10. package/dist/{chunk-TYSUFG2K.cjs → chunk-35GRSVCZ.cjs} +11 -11
  11. package/dist/{chunk-TYSUFG2K.cjs.map → chunk-35GRSVCZ.cjs.map} +1 -1
  12. package/dist/{chunk-X57WKONW.js → chunk-43APGKWL.js} +130 -22
  13. package/dist/chunk-43APGKWL.js.map +1 -0
  14. package/dist/{chunk-6WPP4UGN.cjs → chunk-CMFRCBZW.cjs} +1245 -658
  15. package/dist/chunk-CMFRCBZW.cjs.map +1 -0
  16. package/dist/{chunk-HS7TKVOZ.cjs → chunk-FKHUXSYW.cjs} +8 -4
  17. package/dist/chunk-FKHUXSYW.cjs.map +1 -0
  18. package/dist/{chunk-BP4NA7HK.js → chunk-HVUZKXB2.js} +4 -4
  19. package/dist/{chunk-BP4NA7HK.js.map → chunk-HVUZKXB2.js.map} +1 -1
  20. package/dist/{chunk-6XVTGWQK.cjs → chunk-INQAIZUO.cjs} +17 -17
  21. package/dist/{chunk-6XVTGWQK.cjs.map → chunk-INQAIZUO.cjs.map} +1 -1
  22. package/dist/{chunk-WFJPLXOE.cjs → chunk-JSYS2KX3.cjs} +18 -18
  23. package/dist/{chunk-WFJPLXOE.cjs.map → chunk-JSYS2KX3.cjs.map} +1 -1
  24. package/dist/{chunk-QSERJPTT.js → chunk-R37I633T.js} +22 -17
  25. package/dist/chunk-R37I633T.js.map +1 -0
  26. package/dist/{chunk-ACIQZLWL.cjs → chunk-UNLH3NNG.cjs} +129 -20
  27. package/dist/chunk-UNLH3NNG.cjs.map +1 -0
  28. package/dist/{chunk-TD4PKK2I.cjs → chunk-VIQF74QJ.cjs} +38 -33
  29. package/dist/chunk-VIQF74QJ.cjs.map +1 -0
  30. package/dist/{chunk-D4QH6L54.js → chunk-XPZ7TMXH.js} +4 -4
  31. package/dist/{chunk-D4QH6L54.js.map → chunk-XPZ7TMXH.js.map} +1 -1
  32. package/dist/{chunk-BA36SQY2.js → chunk-YYSHQPCG.js} +3 -3
  33. package/dist/{chunk-BA36SQY2.js.map → chunk-YYSHQPCG.js.map} +1 -1
  34. package/dist/{chunk-LHLRG2BE.js → chunk-Z4LG3CZ4.js} +8 -5
  35. package/dist/chunk-Z4LG3CZ4.js.map +1 -0
  36. package/dist/{chunk-Y3AWLHQP.js → chunk-ZECZ2MKX.js} +730 -143
  37. package/dist/chunk-ZECZ2MKX.js.map +1 -0
  38. package/dist/compiler.cjs +5 -5
  39. package/dist/compiler.cjs.map +1 -1
  40. package/dist/compiler.d.cts +10 -10
  41. package/dist/compiler.d.ts +10 -10
  42. package/dist/compiler.js +5 -5
  43. package/dist/compiler.js.map +1 -1
  44. package/dist/contracts/handlers/index.cjs +11 -11
  45. package/dist/contracts/handlers/index.d.cts +3 -3
  46. package/dist/contracts/handlers/index.d.ts +3 -3
  47. package/dist/contracts/handlers/index.js +3 -3
  48. package/dist/{index-BQwrHcOh.d.cts → index-Bi22mLsh.d.cts} +212 -43
  49. package/dist/{index-BapVvuoI.d.ts → index-CiLMmCHX.d.ts} +2 -2
  50. package/dist/{index-DuXylQrN.d.ts → index-DOdoDqvM.d.ts} +212 -43
  51. package/dist/{index-BaTItxPx.d.cts → index-DnKugm-h.d.cts} +2 -2
  52. package/dist/index.cjs +327 -327
  53. package/dist/index.d.cts +149 -114
  54. package/dist/index.d.ts +149 -114
  55. package/dist/index.js +5 -5
  56. package/dist/{program-DPzf5qsk.d.cts → program-ZWUAWy_9.d.cts} +1 -1
  57. package/dist/{program-38A2Twvj.d.ts → program-zdDO4cMt.d.ts} +1 -1
  58. package/dist/repositories/realm/index.cjs +38 -38
  59. package/dist/repositories/realm/index.d.cts +2 -2
  60. package/dist/repositories/realm/index.d.ts +2 -2
  61. package/dist/repositories/realm/index.js +6 -6
  62. package/dist/repositories/sqlite/index.cjs +36 -36
  63. package/dist/repositories/sqlite/index.d.cts +2 -2
  64. package/dist/repositories/sqlite/index.d.ts +2 -2
  65. package/dist/repositories/sqlite/index.js +6 -6
  66. package/dist/{taskRunner-BxOmg-O6.d.ts → taskRunner-CoE4Xx9K.d.ts} +1 -1
  67. package/dist/{taskRunner-D2itCXf6.d.cts → taskRunner-DFG0BN_R.d.cts} +1 -1
  68. package/dist/wallet/expo/background.cjs +15 -15
  69. package/dist/wallet/expo/background.d.cts +3 -3
  70. package/dist/wallet/expo/background.d.ts +3 -3
  71. package/dist/wallet/expo/background.js +7 -7
  72. package/dist/wallet/expo/index.cjs +19 -16
  73. package/dist/wallet/expo/index.cjs.map +1 -1
  74. package/dist/wallet/expo/index.d.cts +3 -2
  75. package/dist/wallet/expo/index.d.ts +3 -2
  76. package/dist/wallet/expo/index.js +9 -6
  77. package/dist/wallet/expo/index.js.map +1 -1
  78. package/dist/worker/expo/index.cjs +10 -10
  79. package/dist/worker/expo/index.d.cts +4 -4
  80. package/dist/worker/expo/index.d.ts +4 -4
  81. package/dist/worker/expo/index.js +6 -6
  82. package/package.json +3 -3
  83. package/dist/chunk-6WPP4UGN.cjs.map +0 -1
  84. package/dist/chunk-ACIQZLWL.cjs.map +0 -1
  85. package/dist/chunk-HS7TKVOZ.cjs.map +0 -1
  86. package/dist/chunk-LHLRG2BE.js.map +0 -1
  87. package/dist/chunk-QSERJPTT.js.map +0 -1
  88. package/dist/chunk-TD4PKK2I.cjs.map +0 -1
  89. package/dist/chunk-X57WKONW.js.map +0 -1
  90. package/dist/chunk-Y3AWLHQP.js.map +0 -1
package/dist/compiler.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkACIQZLWL_cjs = require('./chunk-ACIQZLWL.cjs');
3
+ var chunkUNLH3NNG_cjs = require('./chunk-UNLH3NNG.cjs');
4
4
  require('./chunk-6TBTL42M.cjs');
5
5
 
6
6
  // src/compiler.ts
@@ -31,14 +31,14 @@ async function compile(input, options) {
31
31
  }
32
32
  throw error;
33
33
  }
34
- const { debug = true, ...compilerOptions } = options ?? {};
34
+ const { contracts, ...compilerOptions } = options ?? {};
35
35
  const result = await compiler.compile(input, compilerOptions);
36
36
  if (result.artifact === null) throw new CompileError(result.diagnostics);
37
- const kept = debug ? result.debug : void 0;
37
+ const debug = result.debug ?? void 0;
38
38
  return {
39
- program: chunkACIQZLWL_cjs.programFromArtifact(result.artifact, kept),
39
+ program: chunkUNLH3NNG_cjs.programFromArtifact(result.artifact, { debug, contracts }),
40
40
  artifact: result.artifact,
41
- ...kept ? { debug: kept } : {},
41
+ ...debug ? { debug } : {},
42
42
  diagnostics: result.diagnostics
43
43
  };
44
44
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/compiler.ts"],"names":["programFromArtifact"],"mappings":";;;;;;AAoCO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAEpC,YAAqB,WAAA,EAA2B;AAC5C,IAAA,KAAA;AAAA,MACI,YACK,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,CACpC,GAAA;AAAA,QACG,CAAC,MACG,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,EAAG,CAAA,CAAE,QAAQ,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,IAAI,CAAA,CAAA,EAAI,EAAE,KAAA,CAAM,MAAM,KAAK,EAAE,CAAA,EAAA,EAAK,EAAE,OAAO,CAAA;AAAA,OACrF,CACC,IAAA,CAAK,IAAI,CAAA,IAAK;AAAA,KACvB;AATiB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAUrB;AAAA,EAVqB,WAAA;AAAA,EADH,IAAA,GAAO,cAAA;AAY7B;AAEA,IAAM,IAAA,GAAO,qBAAA;AAGb,eAAsB,OAAA,CAClB,OACA,OAAA,EACsB;AACtB,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACA,IAAA,QAAA,GAAW,MAAM,OAAO,qBAAqB,CAAA;AAAA,EACjD,SAAS,KAAA,EAAO;AAEZ,IAAA,MAAM,OAAQ,KAAA,EAAqC,IAAA;AACnD,IAAA,IAAA,CACK,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,kBAAA,KAC7C,MAAA,CAAQ,KAAA,CAAgB,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAG,CAAA,EACvD;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAA,gDAAA,EAAmD,IAAI,CAAA,2BAAA,EAA8B,IAAI,CAAA,CAAA;AAAA,QACzF,EAAE,OAAO,KAAA;AAAM,OACnB;AAAA,IACJ;AACA,IAAA,MAAM,KAAA;AAAA,EACV;AACA,EAAA,MAAM,EAAE,KAAA,GAAQ,IAAA,EAAM,GAAG,eAAA,EAAgB,GAAI,WAAW,EAAC;AACzD,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,OAAA,CAAQ,OAAO,eAAe,CAAA;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,IAAA,QAAY,IAAI,YAAA,CAAa,OAAO,WAAW,CAAA;AAGvE,EAAA,MAAM,IAAA,GAAO,KAAA,GAAQ,MAAA,CAAO,KAAA,GAAQ,MAAA;AACpC,EAAA,OAAO;AAAA,IACH,OAAA,EAASA,qCAAA,CAAoB,MAAA,CAAO,QAAA,EAAU,IAAI,CAAA;AAAA,IAClD,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,GAAI,IAAA,GAAO,EAAE,KAAA,EAAO,IAAA,KAAS,EAAC;AAAA,IAC9B,aAAa,MAAA,CAAO;AAAA,GACxB;AACJ","file":"compiler.cjs","sourcesContent":["/**\n * Compile Arkade source into an SDK {@link Program}. Needs the optional peer\n * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.\n *\n * @module compiler\n */\n\nimport type {\n CompileInput,\n CompileOptions as CompilerOptions,\n CompilerArtifact,\n DebugInfo,\n Diagnostic,\n} from \"@arkade-os/compiler\";\n\nimport { programFromArtifact } from \"./arkade/artifact\";\nimport type { Program } from \"./arkade/program\";\n\nexport type { CompileInput, CompilerArtifact, DebugInfo, Diagnostic };\n\nexport interface CompileOptions extends CompilerOptions {\n /** Return the debug file and put its source maps on `program`. Defaults to `true`. */\n debug?: boolean;\n}\n\nexport interface CompileOutput {\n program: Program;\n /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */\n artifact: CompilerArtifact;\n /** The debug file: each covenant's source map. Absent with `debug: false`. */\n debug?: DebugInfo;\n /** Warnings; errors reject with {@link CompileError}. */\n diagnostics: Diagnostic[];\n}\n\n/** The source did not compile. `diagnostics` lists every error and warning. */\nexport class CompileError extends Error {\n override readonly name = \"CompileError\";\n constructor(readonly diagnostics: Diagnostic[]) {\n super(\n diagnostics\n .filter((d) => d.severity === \"error\")\n .map(\n (d) =>\n `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : \"\"}: ${d.message}`,\n )\n .join(\"\\n\") || \"compilation failed\",\n );\n }\n}\n\nconst PEER = \"@arkade-os/compiler\";\n\n/** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */\nexport async function compile(\n input: CompileInput,\n options?: CompileOptions,\n): Promise<CompileOutput> {\n let compiler: typeof import(\"@arkade-os/compiler\");\n try {\n compiler = await import(\"@arkade-os/compiler\");\n } catch (error) {\n // Only a missing peer gets the install hint; anything else keeps its own error.\n const code = (error as { code?: unknown } | null)?.code;\n if (\n (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") &&\n String((error as Error).message).includes(`'${PEER}'`)\n ) {\n throw new Error(\n `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,\n { cause: error },\n );\n }\n throw error;\n }\n const { debug = true, ...compilerOptions } = options ?? {};\n const result = await compiler.compile(input, compilerOptions);\n if (result.artifact === null) throw new CompileError(result.diagnostics);\n // ponytail: the compiler always builds the debug file; it will take an option to skip it soon,\n // until then `debug: false` only drops it.\n const kept = debug ? result.debug : undefined;\n return {\n program: programFromArtifact(result.artifact, kept),\n artifact: result.artifact,\n ...(kept ? { debug: kept } : {}),\n diagnostics: result.diagnostics,\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/compiler.ts"],"names":["programFromArtifact"],"mappings":";;;;;;AA+BO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAEpC,YAAqB,WAAA,EAA2B;AAC5C,IAAA,KAAA;AAAA,MACI,YACK,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,CACpC,GAAA;AAAA,QACG,CAAC,MACG,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,EAAG,CAAA,CAAE,QAAQ,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,IAAI,CAAA,CAAA,EAAI,EAAE,KAAA,CAAM,MAAM,KAAK,EAAE,CAAA,EAAA,EAAK,EAAE,OAAO,CAAA;AAAA,OACrF,CACC,IAAA,CAAK,IAAI,CAAA,IAAK;AAAA,KACvB;AATiB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAUrB;AAAA,EAVqB,WAAA;AAAA,EADH,IAAA,GAAO,cAAA;AAY7B;AAEA,IAAM,IAAA,GAAO,qBAAA;AAMb,eAAsB,OAAA,CAClB,OACA,OAAA,EACsB;AACtB,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACA,IAAA,QAAA,GAAW,MAAM,OAAO,qBAAqB,CAAA;AAAA,EACjD,SAAS,KAAA,EAAO;AAEZ,IAAA,MAAM,OAAQ,KAAA,EAAqC,IAAA;AACnD,IAAA,IAAA,CACK,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,kBAAA,KAC7C,MAAA,CAAQ,KAAA,CAAgB,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAG,CAAA,EACvD;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAA,gDAAA,EAAmD,IAAI,CAAA,2BAAA,EAA8B,IAAI,CAAA,CAAA;AAAA,QACzF,EAAE,OAAO,KAAA;AAAM,OACnB;AAAA,IACJ;AACA,IAAA,MAAM,KAAA;AAAA,EACV;AACA,EAAA,MAAM,EAAE,SAAA,EAAW,GAAG,eAAA,EAAgB,GAAI,WAAW,EAAC;AACtD,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,OAAA,CAAQ,OAAO,eAAe,CAAA;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,IAAA,QAAY,IAAI,YAAA,CAAa,OAAO,WAAW,CAAA;AACvE,EAAA,MAAM,KAAA,GAAQ,OAAO,KAAA,IAAS,MAAA;AAC9B,EAAA,OAAO;AAAA,IACH,SAASA,qCAAA,CAAoB,MAAA,CAAO,UAAU,EAAE,KAAA,EAAO,WAAW,CAAA;AAAA,IAClE,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,GAAI,KAAA,GAAQ,EAAE,KAAA,KAAU,EAAC;AAAA,IACzB,aAAa,MAAA,CAAO;AAAA,GACxB;AACJ","file":"compiler.cjs","sourcesContent":["/**\n * Compile Arkade source into an SDK {@link Program}. Needs the optional peer\n * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.\n *\n * @module compiler\n */\n\nimport type {\n CompileInput,\n CompileOptions,\n CompilerArtifact,\n DebugInfo,\n Diagnostic,\n} from \"@arkade-os/compiler\";\n\nimport { programFromArtifact, type ProgramFromArtifactOptions } from \"./arkade/artifact\";\nimport type { Program } from \"./arkade/program\";\n\nexport type { CompileInput, CompileOptions, CompilerArtifact, DebugInfo, Diagnostic };\n\nexport interface CompileOutput {\n program: Program;\n /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */\n artifact: CompilerArtifact;\n /** The debug file: each covenant's source map. Absent with `debug: false`. */\n debug?: DebugInfo;\n /** Warnings; errors reject with {@link CompileError}. */\n diagnostics: Diagnostic[];\n}\n\n/** The source did not compile. `diagnostics` lists every error and warning. */\nexport class CompileError extends Error {\n override readonly name = \"CompileError\";\n constructor(readonly diagnostics: Diagnostic[]) {\n super(\n diagnostics\n .filter((d) => d.severity === \"error\")\n .map(\n (d) =>\n `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : \"\"}: ${d.message}`,\n )\n .join(\"\\n\") || \"compilation failed\",\n );\n }\n}\n\nconst PEER = \"@arkade-os/compiler\";\n\n/**\n * Compile `input.entry` and its relative imports from `input.files` into a {@link Program}.\n * `contracts` takes the artifacts of the contracts it instantiates, as `programFromArtifact` does.\n */\nexport async function compile(\n input: CompileInput,\n options?: CompileOptions & Pick<ProgramFromArtifactOptions, \"contracts\">,\n): Promise<CompileOutput> {\n let compiler: typeof import(\"@arkade-os/compiler\");\n try {\n compiler = await import(\"@arkade-os/compiler\");\n } catch (error) {\n // Only a missing peer gets the install hint; anything else keeps its own error.\n const code = (error as { code?: unknown } | null)?.code;\n if (\n (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") &&\n String((error as Error).message).includes(`'${PEER}'`)\n ) {\n throw new Error(\n `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,\n { cause: error },\n );\n }\n throw error;\n }\n const { contracts, ...compilerOptions } = options ?? {};\n const result = await compiler.compile(input, compilerOptions);\n if (result.artifact === null) throw new CompileError(result.diagnostics);\n const debug = result.debug ?? undefined;\n return {\n program: programFromArtifact(result.artifact, { debug, contracts }),\n artifact: result.artifact,\n ...(debug ? { debug } : {}),\n diagnostics: result.diagnostics,\n };\n}\n"]}
@@ -1,6 +1,7 @@
1
- import { Diagnostic, CompileOptions as CompileOptions$1, CompilerArtifact, DebugInfo, CompileInput } from '@arkade-os/compiler';
2
- export { CompileInput, CompilerArtifact, DebugInfo, Diagnostic } from '@arkade-os/compiler';
3
- import { P as Program } from './program-DPzf5qsk.cjs';
1
+ import { Diagnostic, CompilerArtifact, DebugInfo, CompileInput, CompileOptions } from '@arkade-os/compiler';
2
+ export { CompileInput, CompileOptions, CompilerArtifact, DebugInfo, Diagnostic } from '@arkade-os/compiler';
3
+ import { P as ProgramFromArtifactOptions } from './artifact-DA5YHM2k.cjs';
4
+ import { P as Program } from './program-ZWUAWy_9.cjs';
4
5
  import './base-C-Y5t_0F.cjs';
5
6
  import '@scure/btc-signer';
6
7
  import '@scure/btc-signer/psbt.js';
@@ -13,10 +14,6 @@ import '@scure/btc-signer/utils.js';
13
14
  * @module compiler
14
15
  */
15
16
 
16
- interface CompileOptions extends CompileOptions$1 {
17
- /** Return the debug file and put its source maps on `program`. Defaults to `true`. */
18
- debug?: boolean;
19
- }
20
17
  interface CompileOutput {
21
18
  program: Program;
22
19
  /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */
@@ -32,7 +29,10 @@ declare class CompileError extends Error {
32
29
  readonly name = "CompileError";
33
30
  constructor(diagnostics: Diagnostic[]);
34
31
  }
35
- /** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */
36
- declare function compile(input: CompileInput, options?: CompileOptions): Promise<CompileOutput>;
32
+ /**
33
+ * Compile `input.entry` and its relative imports from `input.files` into a {@link Program}.
34
+ * `contracts` takes the artifacts of the contracts it instantiates, as `programFromArtifact` does.
35
+ */
36
+ declare function compile(input: CompileInput, options?: CompileOptions & Pick<ProgramFromArtifactOptions, "contracts">): Promise<CompileOutput>;
37
37
 
38
- export { CompileError, type CompileOptions, type CompileOutput, compile };
38
+ export { CompileError, type CompileOutput, compile };
@@ -1,6 +1,7 @@
1
- import { Diagnostic, CompileOptions as CompileOptions$1, CompilerArtifact, DebugInfo, CompileInput } from '@arkade-os/compiler';
2
- export { CompileInput, CompilerArtifact, DebugInfo, Diagnostic } from '@arkade-os/compiler';
3
- import { P as Program } from './program-38A2Twvj.js';
1
+ import { Diagnostic, CompilerArtifact, DebugInfo, CompileInput, CompileOptions } from '@arkade-os/compiler';
2
+ export { CompileInput, CompileOptions, CompilerArtifact, DebugInfo, Diagnostic } from '@arkade-os/compiler';
3
+ import { P as ProgramFromArtifactOptions } from './artifact-DacurepK.js';
4
+ import { P as Program } from './program-zdDO4cMt.js';
4
5
  import './base-C-Y5t_0F.js';
5
6
  import '@scure/btc-signer';
6
7
  import '@scure/btc-signer/psbt.js';
@@ -13,10 +14,6 @@ import '@scure/btc-signer/utils.js';
13
14
  * @module compiler
14
15
  */
15
16
 
16
- interface CompileOptions extends CompileOptions$1 {
17
- /** Return the debug file and put its source maps on `program`. Defaults to `true`. */
18
- debug?: boolean;
19
- }
20
17
  interface CompileOutput {
21
18
  program: Program;
22
19
  /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */
@@ -32,7 +29,10 @@ declare class CompileError extends Error {
32
29
  readonly name = "CompileError";
33
30
  constructor(diagnostics: Diagnostic[]);
34
31
  }
35
- /** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */
36
- declare function compile(input: CompileInput, options?: CompileOptions): Promise<CompileOutput>;
32
+ /**
33
+ * Compile `input.entry` and its relative imports from `input.files` into a {@link Program}.
34
+ * `contracts` takes the artifacts of the contracts it instantiates, as `programFromArtifact` does.
35
+ */
36
+ declare function compile(input: CompileInput, options?: CompileOptions & Pick<ProgramFromArtifactOptions, "contracts">): Promise<CompileOutput>;
37
37
 
38
- export { CompileError, type CompileOptions, type CompileOutput, compile };
38
+ export { CompileError, type CompileOutput, compile };
package/dist/compiler.js CHANGED
@@ -1,4 +1,4 @@
1
- import { programFromArtifact } from './chunk-X57WKONW.js';
1
+ import { programFromArtifact } from './chunk-43APGKWL.js';
2
2
  import './chunk-GB67AGXG.js';
3
3
 
4
4
  // src/compiler.ts
@@ -29,14 +29,14 @@ async function compile(input, options) {
29
29
  }
30
30
  throw error;
31
31
  }
32
- const { debug = true, ...compilerOptions } = options ?? {};
32
+ const { contracts, ...compilerOptions } = options ?? {};
33
33
  const result = await compiler.compile(input, compilerOptions);
34
34
  if (result.artifact === null) throw new CompileError(result.diagnostics);
35
- const kept = debug ? result.debug : void 0;
35
+ const debug = result.debug ?? void 0;
36
36
  return {
37
- program: programFromArtifact(result.artifact, kept),
37
+ program: programFromArtifact(result.artifact, { debug, contracts }),
38
38
  artifact: result.artifact,
39
- ...kept ? { debug: kept } : {},
39
+ ...debug ? { debug } : {},
40
40
  diagnostics: result.diagnostics
41
41
  };
42
42
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/compiler.ts"],"names":[],"mappings":";;;;AAoCO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAEpC,YAAqB,WAAA,EAA2B;AAC5C,IAAA,KAAA;AAAA,MACI,YACK,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,CACpC,GAAA;AAAA,QACG,CAAC,MACG,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,EAAG,CAAA,CAAE,QAAQ,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,IAAI,CAAA,CAAA,EAAI,EAAE,KAAA,CAAM,MAAM,KAAK,EAAE,CAAA,EAAA,EAAK,EAAE,OAAO,CAAA;AAAA,OACrF,CACC,IAAA,CAAK,IAAI,CAAA,IAAK;AAAA,KACvB;AATiB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAUrB;AAAA,EAVqB,WAAA;AAAA,EADH,IAAA,GAAO,cAAA;AAY7B;AAEA,IAAM,IAAA,GAAO,qBAAA;AAGb,eAAsB,OAAA,CAClB,OACA,OAAA,EACsB;AACtB,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACA,IAAA,QAAA,GAAW,MAAM,OAAO,qBAAqB,CAAA;AAAA,EACjD,SAAS,KAAA,EAAO;AAEZ,IAAA,MAAM,OAAQ,KAAA,EAAqC,IAAA;AACnD,IAAA,IAAA,CACK,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,kBAAA,KAC7C,MAAA,CAAQ,KAAA,CAAgB,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAG,CAAA,EACvD;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAA,gDAAA,EAAmD,IAAI,CAAA,2BAAA,EAA8B,IAAI,CAAA,CAAA;AAAA,QACzF,EAAE,OAAO,KAAA;AAAM,OACnB;AAAA,IACJ;AACA,IAAA,MAAM,KAAA;AAAA,EACV;AACA,EAAA,MAAM,EAAE,KAAA,GAAQ,IAAA,EAAM,GAAG,eAAA,EAAgB,GAAI,WAAW,EAAC;AACzD,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,OAAA,CAAQ,OAAO,eAAe,CAAA;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,IAAA,QAAY,IAAI,YAAA,CAAa,OAAO,WAAW,CAAA;AAGvE,EAAA,MAAM,IAAA,GAAO,KAAA,GAAQ,MAAA,CAAO,KAAA,GAAQ,MAAA;AACpC,EAAA,OAAO;AAAA,IACH,OAAA,EAAS,mBAAA,CAAoB,MAAA,CAAO,QAAA,EAAU,IAAI,CAAA;AAAA,IAClD,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,GAAI,IAAA,GAAO,EAAE,KAAA,EAAO,IAAA,KAAS,EAAC;AAAA,IAC9B,aAAa,MAAA,CAAO;AAAA,GACxB;AACJ","file":"compiler.js","sourcesContent":["/**\n * Compile Arkade source into an SDK {@link Program}. Needs the optional peer\n * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.\n *\n * @module compiler\n */\n\nimport type {\n CompileInput,\n CompileOptions as CompilerOptions,\n CompilerArtifact,\n DebugInfo,\n Diagnostic,\n} from \"@arkade-os/compiler\";\n\nimport { programFromArtifact } from \"./arkade/artifact\";\nimport type { Program } from \"./arkade/program\";\n\nexport type { CompileInput, CompilerArtifact, DebugInfo, Diagnostic };\n\nexport interface CompileOptions extends CompilerOptions {\n /** Return the debug file and put its source maps on `program`. Defaults to `true`. */\n debug?: boolean;\n}\n\nexport interface CompileOutput {\n program: Program;\n /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */\n artifact: CompilerArtifact;\n /** The debug file: each covenant's source map. Absent with `debug: false`. */\n debug?: DebugInfo;\n /** Warnings; errors reject with {@link CompileError}. */\n diagnostics: Diagnostic[];\n}\n\n/** The source did not compile. `diagnostics` lists every error and warning. */\nexport class CompileError extends Error {\n override readonly name = \"CompileError\";\n constructor(readonly diagnostics: Diagnostic[]) {\n super(\n diagnostics\n .filter((d) => d.severity === \"error\")\n .map(\n (d) =>\n `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : \"\"}: ${d.message}`,\n )\n .join(\"\\n\") || \"compilation failed\",\n );\n }\n}\n\nconst PEER = \"@arkade-os/compiler\";\n\n/** Compile `input.entry` and its relative imports from `input.files` into a {@link Program}. */\nexport async function compile(\n input: CompileInput,\n options?: CompileOptions,\n): Promise<CompileOutput> {\n let compiler: typeof import(\"@arkade-os/compiler\");\n try {\n compiler = await import(\"@arkade-os/compiler\");\n } catch (error) {\n // Only a missing peer gets the install hint; anything else keeps its own error.\n const code = (error as { code?: unknown } | null)?.code;\n if (\n (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") &&\n String((error as Error).message).includes(`'${PEER}'`)\n ) {\n throw new Error(\n `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,\n { cause: error },\n );\n }\n throw error;\n }\n const { debug = true, ...compilerOptions } = options ?? {};\n const result = await compiler.compile(input, compilerOptions);\n if (result.artifact === null) throw new CompileError(result.diagnostics);\n // ponytail: the compiler always builds the debug file; it will take an option to skip it soon,\n // until then `debug: false` only drops it.\n const kept = debug ? result.debug : undefined;\n return {\n program: programFromArtifact(result.artifact, kept),\n artifact: result.artifact,\n ...(kept ? { debug: kept } : {}),\n diagnostics: result.diagnostics,\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/compiler.ts"],"names":[],"mappings":";;;;AA+BO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAEpC,YAAqB,WAAA,EAA2B;AAC5C,IAAA,KAAA;AAAA,MACI,YACK,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,QAAA,KAAa,OAAO,CAAA,CACpC,GAAA;AAAA,QACG,CAAC,MACG,CAAA,EAAG,CAAA,CAAE,IAAI,CAAA,EAAG,CAAA,CAAE,QAAQ,CAAA,CAAA,EAAI,CAAA,CAAE,MAAM,IAAI,CAAA,CAAA,EAAI,EAAE,KAAA,CAAM,MAAM,KAAK,EAAE,CAAA,EAAA,EAAK,EAAE,OAAO,CAAA;AAAA,OACrF,CACC,IAAA,CAAK,IAAI,CAAA,IAAK;AAAA,KACvB;AATiB,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AAAA,EAUrB;AAAA,EAVqB,WAAA;AAAA,EADH,IAAA,GAAO,cAAA;AAY7B;AAEA,IAAM,IAAA,GAAO,qBAAA;AAMb,eAAsB,OAAA,CAClB,OACA,OAAA,EACsB;AACtB,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACA,IAAA,QAAA,GAAW,MAAM,OAAO,qBAAqB,CAAA;AAAA,EACjD,SAAS,KAAA,EAAO;AAEZ,IAAA,MAAM,OAAQ,KAAA,EAAqC,IAAA;AACnD,IAAA,IAAA,CACK,IAAA,KAAS,sBAAA,IAA0B,IAAA,KAAS,kBAAA,KAC7C,MAAA,CAAQ,KAAA,CAAgB,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,CAAG,CAAA,EACvD;AACE,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,CAAA,gDAAA,EAAmD,IAAI,CAAA,2BAAA,EAA8B,IAAI,CAAA,CAAA;AAAA,QACzF,EAAE,OAAO,KAAA;AAAM,OACnB;AAAA,IACJ;AACA,IAAA,MAAM,KAAA;AAAA,EACV;AACA,EAAA,MAAM,EAAE,SAAA,EAAW,GAAG,eAAA,EAAgB,GAAI,WAAW,EAAC;AACtD,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,OAAA,CAAQ,OAAO,eAAe,CAAA;AAC5D,EAAA,IAAI,OAAO,QAAA,KAAa,IAAA,QAAY,IAAI,YAAA,CAAa,OAAO,WAAW,CAAA;AACvE,EAAA,MAAM,KAAA,GAAQ,OAAO,KAAA,IAAS,MAAA;AAC9B,EAAA,OAAO;AAAA,IACH,SAAS,mBAAA,CAAoB,MAAA,CAAO,UAAU,EAAE,KAAA,EAAO,WAAW,CAAA;AAAA,IAClE,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,GAAI,KAAA,GAAQ,EAAE,KAAA,KAAU,EAAC;AAAA,IACzB,aAAa,MAAA,CAAO;AAAA,GACxB;AACJ","file":"compiler.js","sourcesContent":["/**\n * Compile Arkade source into an SDK {@link Program}. Needs the optional peer\n * `@arkade-os/compiler`, which is loaded on the first {@link compile} call.\n *\n * @module compiler\n */\n\nimport type {\n CompileInput,\n CompileOptions,\n CompilerArtifact,\n DebugInfo,\n Diagnostic,\n} from \"@arkade-os/compiler\";\n\nimport { programFromArtifact, type ProgramFromArtifactOptions } from \"./arkade/artifact\";\nimport type { Program } from \"./arkade/program\";\n\nexport type { CompileInput, CompileOptions, CompilerArtifact, DebugInfo, Diagnostic };\n\nexport interface CompileOutput {\n program: Program;\n /** The compiler's artifact, carrying the source bundle, compiler version and fingerprint. */\n artifact: CompilerArtifact;\n /** The debug file: each covenant's source map. Absent with `debug: false`. */\n debug?: DebugInfo;\n /** Warnings; errors reject with {@link CompileError}. */\n diagnostics: Diagnostic[];\n}\n\n/** The source did not compile. `diagnostics` lists every error and warning. */\nexport class CompileError extends Error {\n override readonly name = \"CompileError\";\n constructor(readonly diagnostics: Diagnostic[]) {\n super(\n diagnostics\n .filter((d) => d.severity === \"error\")\n .map(\n (d) =>\n `${d.file}${d.start ? `:${d.start.line}:${d.start.column}` : \"\"}: ${d.message}`,\n )\n .join(\"\\n\") || \"compilation failed\",\n );\n }\n}\n\nconst PEER = \"@arkade-os/compiler\";\n\n/**\n * Compile `input.entry` and its relative imports from `input.files` into a {@link Program}.\n * `contracts` takes the artifacts of the contracts it instantiates, as `programFromArtifact` does.\n */\nexport async function compile(\n input: CompileInput,\n options?: CompileOptions & Pick<ProgramFromArtifactOptions, \"contracts\">,\n): Promise<CompileOutput> {\n let compiler: typeof import(\"@arkade-os/compiler\");\n try {\n compiler = await import(\"@arkade-os/compiler\");\n } catch (error) {\n // Only a missing peer gets the install hint; anything else keeps its own error.\n const code = (error as { code?: unknown } | null)?.code;\n if (\n (code === \"ERR_MODULE_NOT_FOUND\" || code === \"MODULE_NOT_FOUND\") &&\n String((error as Error).message).includes(`'${PEER}'`)\n ) {\n throw new Error(\n `@arkade-os/sdk/compiler needs the optional peer ${PEER}: npm install --save-exact ${PEER}`,\n { cause: error },\n );\n }\n throw error;\n }\n const { contracts, ...compilerOptions } = options ?? {};\n const result = await compiler.compile(input, compilerOptions);\n if (result.artifact === null) throw new CompileError(result.diagnostics);\n const debug = result.debug ?? undefined;\n return {\n program: programFromArtifact(result.artifact, { debug, contracts }),\n artifact: result.artifact,\n ...(debug ? { debug } : {}),\n diagnostics: result.diagnostics,\n };\n}\n"]}
@@ -1,43 +1,43 @@
1
1
  'use strict';
2
2
 
3
- var chunkTD4PKK2I_cjs = require('../../chunk-TD4PKK2I.cjs');
4
- require('../../chunk-ACIQZLWL.cjs');
5
- require('../../chunk-HS7TKVOZ.cjs');
3
+ var chunkVIQF74QJ_cjs = require('../../chunk-VIQF74QJ.cjs');
4
+ require('../../chunk-UNLH3NNG.cjs');
5
+ require('../../chunk-FKHUXSYW.cjs');
6
6
  require('../../chunk-6TBTL42M.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "ArkadeContractHandler", {
11
11
  enumerable: true,
12
- get: function () { return chunkTD4PKK2I_cjs.ArkadeContractHandler; }
12
+ get: function () { return chunkVIQF74QJ_cjs.ArkadeContractHandler; }
13
13
  });
14
14
  Object.defineProperty(exports, "BoardingContractHandler", {
15
15
  enumerable: true,
16
- get: function () { return chunkTD4PKK2I_cjs.BoardingContractHandler; }
16
+ get: function () { return chunkVIQF74QJ_cjs.BoardingContractHandler; }
17
17
  });
18
18
  Object.defineProperty(exports, "DefaultContractHandler", {
19
19
  enumerable: true,
20
- get: function () { return chunkTD4PKK2I_cjs.DefaultContractHandler; }
20
+ get: function () { return chunkVIQF74QJ_cjs.DefaultContractHandler; }
21
21
  });
22
22
  Object.defineProperty(exports, "DelegateContractHandler", {
23
23
  enumerable: true,
24
- get: function () { return chunkTD4PKK2I_cjs.DelegateContractHandler; }
24
+ get: function () { return chunkVIQF74QJ_cjs.DelegateContractHandler; }
25
25
  });
26
26
  Object.defineProperty(exports, "ExecutorContractHandler", {
27
27
  enumerable: true,
28
- get: function () { return chunkTD4PKK2I_cjs.ExecutorContractHandler; }
28
+ get: function () { return chunkVIQF74QJ_cjs.ExecutorContractHandler; }
29
29
  });
30
30
  Object.defineProperty(exports, "VHTLCContractHandler", {
31
31
  enumerable: true,
32
- get: function () { return chunkTD4PKK2I_cjs.VHTLCContractHandler; }
32
+ get: function () { return chunkVIQF74QJ_cjs.VHTLCContractHandler; }
33
33
  });
34
34
  Object.defineProperty(exports, "VHTLCV2ContractHandler", {
35
35
  enumerable: true,
36
- get: function () { return chunkTD4PKK2I_cjs.VHTLCV2ContractHandler; }
36
+ get: function () { return chunkVIQF74QJ_cjs.VHTLCV2ContractHandler; }
37
37
  });
38
38
  Object.defineProperty(exports, "contractHandlers", {
39
39
  enumerable: true,
40
- get: function () { return chunkTD4PKK2I_cjs.contractHandlers; }
40
+ get: function () { return chunkVIQF74QJ_cjs.contractHandlers; }
41
41
  });
42
42
  //# sourceMappingURL=index.cjs.map
43
43
  //# sourceMappingURL=index.cjs.map
@@ -1,8 +1,8 @@
1
- export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from '../../index-BaTItxPx.cjs';
2
- export { cq as ExecutorContractHandler, cs as ExecutorContractParams } from '../../index-BQwrHcOh.cjs';
1
+ export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from '../../index-DnKugm-h.cjs';
2
+ export { cr as ExecutorContractHandler, ct as ExecutorContractParams } from '../../index-Bi22mLsh.cjs';
3
3
  import '../../base-C-Y5t_0F.cjs';
4
4
  import '@scure/btc-signer';
5
5
  import '@scure/btc-signer/psbt.js';
6
6
  import '@scure/btc-signer/utils.js';
7
- import '../../program-DPzf5qsk.cjs';
7
+ import '../../program-ZWUAWy_9.cjs';
8
8
  import '@scure/btc-signer/transaction.js';
@@ -1,8 +1,8 @@
1
- export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from '../../index-BapVvuoI.js';
2
- export { cq as ExecutorContractHandler, cs as ExecutorContractParams } from '../../index-DuXylQrN.js';
1
+ export { A as ArkadeContractHandler, B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, e as VHTLCContractHandler, f as VHTLCContractParams, g as VHTLCV2ContractHandler, h as VHTLCV2ContractParams, i as contractHandlers } from '../../index-CiLMmCHX.js';
2
+ export { cr as ExecutorContractHandler, ct as ExecutorContractParams } from '../../index-DOdoDqvM.js';
3
3
  import '../../base-C-Y5t_0F.js';
4
4
  import '@scure/btc-signer';
5
5
  import '@scure/btc-signer/psbt.js';
6
6
  import '@scure/btc-signer/utils.js';
7
- import '../../program-38A2Twvj.js';
7
+ import '../../program-zdDO4cMt.js';
8
8
  import '@scure/btc-signer/transaction.js';
@@ -1,6 +1,6 @@
1
- export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, ExecutorContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-QSERJPTT.js';
2
- import '../../chunk-X57WKONW.js';
3
- import '../../chunk-LHLRG2BE.js';
1
+ export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, ExecutorContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-R37I633T.js';
2
+ import '../../chunk-43APGKWL.js';
3
+ import '../../chunk-Z4LG3CZ4.js';
4
4
  import '../../chunk-GB67AGXG.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map