@shell-shock/core 0.8.13 → 0.9.1

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 (129) hide show
  1. package/dist/api.cjs +34 -0
  2. package/dist/api.cjs.map +1 -1
  3. package/dist/api.mjs +34 -0
  4. package/dist/api.mjs.map +1 -1
  5. package/dist/components/docs.d.cts +5 -5
  6. package/dist/components/docs.d.cts.map +1 -1
  7. package/dist/components/docs.d.mts +5 -5
  8. package/dist/components/helpers.d.cts +6 -6
  9. package/dist/components/helpers.d.cts.map +1 -1
  10. package/dist/components/helpers.d.mts +6 -6
  11. package/dist/components/helpers.d.mts.map +1 -1
  12. package/dist/components/index.cjs +1 -0
  13. package/dist/components/index.d.cts +2 -2
  14. package/dist/components/index.d.mts +2 -2
  15. package/dist/components/index.mjs +2 -2
  16. package/dist/components/options-parser-logic.d.cts +9 -9
  17. package/dist/components/options-parser-logic.d.mts +9 -9
  18. package/dist/components/options-parser-logic.d.mts.map +1 -1
  19. package/dist/components/usage.d.cts +2 -2
  20. package/dist/components/usage.d.mts +2 -2
  21. package/dist/components/utils-builtin.cjs +341 -0
  22. package/dist/components/utils-builtin.cjs.map +1 -1
  23. package/dist/components/utils-builtin.d.cts +12 -8
  24. package/dist/components/utils-builtin.d.cts.map +1 -1
  25. package/dist/components/utils-builtin.d.mts +5 -1
  26. package/dist/components/utils-builtin.d.mts.map +1 -1
  27. package/dist/components/utils-builtin.mjs +342 -2
  28. package/dist/components/utils-builtin.mjs.map +1 -1
  29. package/dist/config.cjs +12 -0
  30. package/dist/config.cjs.map +1 -1
  31. package/dist/config.mjs +12 -0
  32. package/dist/config.mjs.map +1 -1
  33. package/dist/contexts/command.cjs +3 -2
  34. package/dist/contexts/command.cjs.map +1 -1
  35. package/dist/contexts/command.mjs +3 -2
  36. package/dist/contexts/command.mjs.map +1 -1
  37. package/dist/contexts/options.cjs +20 -4
  38. package/dist/contexts/options.cjs.map +1 -1
  39. package/dist/contexts/options.mjs +20 -4
  40. package/dist/contexts/options.mjs.map +1 -1
  41. package/dist/helpers/docs-helpers.cjs +6 -0
  42. package/dist/helpers/docs-helpers.cjs.map +1 -1
  43. package/dist/helpers/docs-helpers.mjs +6 -0
  44. package/dist/helpers/docs-helpers.mjs.map +1 -1
  45. package/dist/helpers/persistence.cjs +92 -11
  46. package/dist/helpers/persistence.cjs.map +1 -1
  47. package/dist/helpers/persistence.mjs +92 -11
  48. package/dist/helpers/persistence.mjs.map +1 -1
  49. package/dist/helpers/resolve-command.cjs +200 -18
  50. package/dist/helpers/resolve-command.cjs.map +1 -1
  51. package/dist/helpers/resolve-command.mjs +201 -19
  52. package/dist/helpers/resolve-command.mjs.map +1 -1
  53. package/dist/helpers/update-package-json.cjs +27 -3
  54. package/dist/helpers/update-package-json.cjs.map +1 -1
  55. package/dist/helpers/update-package-json.mjs +27 -3
  56. package/dist/helpers/update-package-json.mjs.map +1 -1
  57. package/dist/helpers/utilities.cjs +58 -4
  58. package/dist/helpers/utilities.cjs.map +1 -1
  59. package/dist/helpers/utilities.mjs +58 -4
  60. package/dist/helpers/utilities.mjs.map +1 -1
  61. package/dist/helpers/validations.cjs +28 -1
  62. package/dist/helpers/validations.cjs.map +1 -1
  63. package/dist/helpers/validations.mjs +28 -1
  64. package/dist/helpers/validations.mjs.map +1 -1
  65. package/dist/index.cjs +33 -0
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +2 -2
  68. package/dist/index.d.mts +2 -2
  69. package/dist/index.mjs +6 -1
  70. package/dist/index.mjs.map +1 -1
  71. package/dist/plugin-utils/context-helpers.cjs +78 -3
  72. package/dist/plugin-utils/context-helpers.cjs.map +1 -1
  73. package/dist/plugin-utils/context-helpers.mjs +78 -3
  74. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  75. package/dist/plugin-utils/get-command-tree.cjs +17 -1
  76. package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
  77. package/dist/plugin-utils/get-command-tree.mjs +17 -1
  78. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  79. package/dist/plugin-utils/reflect.cjs +31 -3
  80. package/dist/plugin-utils/reflect.cjs.map +1 -1
  81. package/dist/plugin-utils/reflect.mjs +31 -3
  82. package/dist/plugin-utils/reflect.mjs.map +1 -1
  83. package/dist/plugin-utils/traverse-command-tree.cjs +34 -4
  84. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -1
  85. package/dist/plugin-utils/traverse-command-tree.mjs +34 -4
  86. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  87. package/dist/plugin.cjs +5 -1
  88. package/dist/plugin.cjs.map +1 -1
  89. package/dist/plugin.d.cts.map +1 -1
  90. package/dist/plugin.d.mts.map +1 -1
  91. package/dist/plugin.mjs +5 -1
  92. package/dist/plugin.mjs.map +1 -1
  93. package/dist/types/command.cjs +241 -0
  94. package/dist/types/command.cjs.map +1 -0
  95. package/dist/types/command.mjs +221 -1
  96. package/dist/types/command.mjs.map +1 -0
  97. package/dist/types/config.cjs +114 -0
  98. package/dist/types/config.cjs.map +1 -0
  99. package/dist/types/config.d.cts +11 -10
  100. package/dist/types/config.d.cts.map +1 -1
  101. package/dist/types/config.d.mts +11 -10
  102. package/dist/types/config.d.mts.map +1 -1
  103. package/dist/types/config.mjs +110 -1
  104. package/dist/types/config.mjs.map +1 -0
  105. package/dist/types/context.cjs +33 -0
  106. package/dist/types/context.cjs.map +1 -0
  107. package/dist/types/context.mjs +31 -1
  108. package/dist/types/context.mjs.map +1 -0
  109. package/dist/types/env.cjs +12 -0
  110. package/dist/types/env.cjs.map +1 -0
  111. package/dist/types/env.d.cts +17 -0
  112. package/dist/types/env.d.cts.map +1 -0
  113. package/dist/types/env.d.mts +17 -0
  114. package/dist/types/env.d.mts.map +1 -0
  115. package/dist/types/env.mjs +11 -0
  116. package/dist/types/env.mjs.map +1 -0
  117. package/dist/types/index.cjs +34 -0
  118. package/dist/types/index.d.cts +2 -2
  119. package/dist/types/index.d.mts +2 -2
  120. package/dist/types/index.mjs +7 -1
  121. package/dist/types/options.cjs +12 -0
  122. package/dist/types/options.cjs.map +1 -0
  123. package/dist/types/options.mjs +11 -1
  124. package/dist/types/options.mjs.map +1 -0
  125. package/dist/types/runtime.cjs +12 -0
  126. package/dist/types/runtime.cjs.map +1 -0
  127. package/dist/types/runtime.mjs +11 -1
  128. package/dist/types/runtime.mjs.map +1 -0
  129. package/package.json +25 -11
@@ -4,15 +4,16 @@ import { createNamedContext, useContext } from "@alloy-js/core";
4
4
  /**
5
5
  * The reflection parameter context used in template rendering.
6
6
  */
7
- const CommandContext = createNamedContext("Command");
7
+ const CommandContext = (createNamedContext.Ω = [["CommandTree", "P\"w!-J"]], createNamedContext("Command"));
8
8
  /**
9
9
  * Hook to access the Command context.
10
10
  *
11
11
  * @returns A reactive version of the current reflection.
12
12
  */
13
13
  function useCommand() {
14
- return useContext(CommandContext);
14
+ return useContext.Ω = [["CommandTree", "P\"w!-J"]], useContext(CommandContext);
15
15
  }
16
+ useCommand.__type = ["useCommand", "P\"/!"];
16
17
 
17
18
  //#endregion
18
19
  export { CommandContext, useCommand };
@@ -1 +1 @@
1
- {"version":3,"file":"command.mjs","names":["createNamedContext","useContext","CommandContext","useCommand"],"sources":["../../src/contexts/command.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":";;;;;;AAyBA,MAAaE,iBACXF,mBAA4C,UAAU;;;;;;AAOxD,SAAgBG,aAAa;AAC3B,QAAOF,WAAoCC,eAAe"}
1
+ {"version":3,"file":"command.mjs","names":[],"sources":["../../src/contexts/command.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":";;;;;;;;;;;;;AA4BE,QAAA,WAAA,IAAA,CAAA,CAAA,eAAA,UAAA,CAAA,EAAA,WAAA,eAAA;;AAEF,WAAC,SAAA,CAAA,cAAA,QAAA"}
@@ -7,10 +7,14 @@ let __alloy_js_core = require("@alloy-js/core");
7
7
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
8
8
 
9
9
  //#region src/contexts/options.ts
10
+ function __assignType(fn, args) {
11
+ fn.__type = args;
12
+ return fn;
13
+ }
10
14
  /**
11
15
  * The reflection parameter context used in template rendering.
12
16
  */
13
- const ExistingOptionsContext = (0, __alloy_js_core.createNamedContext)("ExistingOptions", []);
17
+ const ExistingOptionsContext = (__alloy_js_core.createNamedContext.Ω = [["&F"]], (0, __alloy_js_core.createNamedContext)("ExistingOptions", []));
14
18
  /**
15
19
  * Hook to access the ExistingOptions context.
16
20
  *
@@ -20,10 +24,11 @@ const ExistingOptionsContext = (0, __alloy_js_core.createNamedContext)("Existing
20
24
  * @returns A reactive version of the current reflection.
21
25
  */
22
26
  function useExistingOptions() {
23
- return (0, __alloy_js_core.useContext)(ExistingOptionsContext);
27
+ return __alloy_js_core.useContext.Ω = [["&F"]], (0, __alloy_js_core.useContext)(ExistingOptionsContext);
24
28
  }
29
+ useExistingOptions.__type = ["useExistingOptions", "P\"/!"];
25
30
  function computedOptions(command) {
26
- return Object.entries(command.options).reduce((ret, [name, option]) => {
31
+ return Object.entries(command.options).reduce(__assignType((ret, [name, option]) => {
27
32
  ret[(0, __stryke_string_format_camel_case.camelCase)(name)] ??= (0, defu.default)({ name: (0, __stryke_string_format_camel_case.camelCase)(name) }, ret[name] ?? {}, option);
28
33
  if (option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean && option.isNegativeOf) ret[(0, __stryke_string_format_camel_case.camelCase)(option.isNegativeOf)] = (0, defu.default)({ name: (0, __stryke_string_format_camel_case.camelCase)(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
29
34
  ...option,
@@ -33,8 +38,19 @@ function computedOptions(command) {
33
38
  default: !option.default
34
39
  });
35
40
  return ret;
36
- }, {});
41
+ }, [
42
+ "ret",
43
+ "param1",
44
+ "",
45
+ "P\"2!\"2\"\"/#"
46
+ ]), {});
37
47
  }
48
+ computedOptions.__type = [
49
+ "CommandTree",
50
+ "command",
51
+ "computedOptions",
52
+ "P\"w!2\"\"/#"
53
+ ];
38
54
 
39
55
  //#endregion
40
56
  exports.ExistingOptionsContext = ExistingOptionsContext;
@@ -1 +1 @@
1
- {"version":3,"file":"options.cjs","names":["createNamedContext","useContext","ReflectionKind","camelCase","isSetString","defu","ExistingOptionsContext","useExistingOptions","computedOptions","command","Object","entries","options","reduce","ret","name","option","kind","boolean","isNegativeOf","env","description","replace","default"],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (option.kind === ReflectionKind.boolean && option.isNegativeOf) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAiCA,MAAaM,iEACkB,mBAAmB,EAAE,CAAC;;;;;;;;;AAUrD,SAAgBC,qBAAqB;AACnC,wCAA4BD,uBAAuB;;AAGrD,SAAgBE,gBAAgBC,SAAsB;AACpD,QAAOC,OAAOC,QAAQF,QAAQG,QAAQ,CAACC,QACpCC,KAAK,CAACC,MAAMC,YAAY;AACvBF,uDAAcC,KAAK,wBACjB,EACEA,uDAAgBA,KAAI,EACrB,EACDD,IAAIC,SAAS,EAAE,EACfC,OACgB;AAElB,MAAIA,OAAOC,SAASf,gDAAegB,WAAWF,OAAOG,aACnDL,sDAAcE,OAAOG,aAAa,sBAChC,EACEJ,uDAAgBC,OAAOG,aAAY,EACpC,EACDL,IAAIE,OAAOG,iBAAiB,EAAE,EAC9B;GACE,GAAGH;GACHI,yDAAiBJ,OAAOI,IAAI,GAAG,MAAMJ,OAAOI,QAAQ;GACpDC,aAAa,GAAGL,OAAOK,YAAYC,QACjC,QACA,GACD,CAAA,0CAA2CP,KAAI;GAChDI,+DAAwBJ,KAAK;GAC7BQ,SAAS,CAACP,OAAOO;GAErB,CAAyB;AAG3B,SAAOT;IAET,EACF,CAAC"}
1
+ {"version":3,"file":"options.cjs","names":[],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (option.kind === ReflectionKind.boolean && option.isNegativeOf) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAA0B,mCAAmB,IAAC,CAAA,CAAA,KAAA,CAAA,0CAAA,mBAAA,EAAA,CAAA;;;;;;;;;AAS3D,SAAgB,qBAAqB;AACjC,QAAQ,2BAAW,IAAI,CAAC,CAAC,KAAK,CAAC,kCAAa,uBAAe;;AAE/D,mBAAY,SAAA,CAAA,sBAAA,QAAA;AACZ,SAAgB,gBAAM,SAAA;AAClB,QAAO,OAAI,QAAA,QAAA,QAAA,CAAA,OAAA,cAAA,KAAA,CAAA,MAAA,YAAA;AACP,uDAAI,KAAA,wBAAA,EACA,uDAAK,KAAA;AAEf,MAAA,OAAA,SAAA,gDAAA,WAAA,OAAA,aACU,sDAAc,OAAO,aAAa,sBAAS,EACrD,uDAAA,OAAA,aAAA,EACW,EAAE,IAAI,OAAO,iBAAiB,EAAE,EAAE;GAC/B,GAAG;;GAEjB,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,KAAA;GACc,+DAAwB,KAAK;GAC5C,SAAA,CAAA,OAAA;GACS,CAAA;AAET,SAAA;IACM;EAAC;EAAO;EAAU;EAAI;EAAa,CAAC,EAAE,EAAE,CAAC;;AAEhD,gBAAgB,SAAS;CAAC;CAAW;CAAA;CAAA;CAAA"}
@@ -5,10 +5,14 @@ import { createNamedContext, useContext } from "@alloy-js/core";
5
5
  import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
6
6
 
7
7
  //#region src/contexts/options.ts
8
+ function __assignType(fn, args) {
9
+ fn.__type = args;
10
+ return fn;
11
+ }
8
12
  /**
9
13
  * The reflection parameter context used in template rendering.
10
14
  */
11
- const ExistingOptionsContext = createNamedContext("ExistingOptions", []);
15
+ const ExistingOptionsContext = (createNamedContext.Ω = [["&F"]], createNamedContext("ExistingOptions", []));
12
16
  /**
13
17
  * Hook to access the ExistingOptions context.
14
18
  *
@@ -18,10 +22,11 @@ const ExistingOptionsContext = createNamedContext("ExistingOptions", []);
18
22
  * @returns A reactive version of the current reflection.
19
23
  */
20
24
  function useExistingOptions() {
21
- return useContext(ExistingOptionsContext);
25
+ return useContext.Ω = [["&F"]], useContext(ExistingOptionsContext);
22
26
  }
27
+ useExistingOptions.__type = ["useExistingOptions", "P\"/!"];
23
28
  function computedOptions(command) {
24
- return Object.entries(command.options).reduce((ret, [name, option]) => {
29
+ return Object.entries(command.options).reduce(__assignType((ret, [name, option]) => {
25
30
  ret[camelCase(name)] ??= defu$1({ name: camelCase(name) }, ret[name] ?? {}, option);
26
31
  if (option.kind === ReflectionKind.boolean && option.isNegativeOf) ret[camelCase(option.isNegativeOf)] = defu$1({ name: camelCase(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
27
32
  ...option,
@@ -31,8 +36,19 @@ function computedOptions(command) {
31
36
  default: !option.default
32
37
  });
33
38
  return ret;
34
- }, {});
39
+ }, [
40
+ "ret",
41
+ "param1",
42
+ "",
43
+ "P\"2!\"2\"\"/#"
44
+ ]), {});
35
45
  }
46
+ computedOptions.__type = [
47
+ "CommandTree",
48
+ "command",
49
+ "computedOptions",
50
+ "P\"w!2\"\"/#"
51
+ ];
36
52
 
37
53
  //#endregion
38
54
  export { ExistingOptionsContext, computedOptions, useExistingOptions };
@@ -1 +1 @@
1
- {"version":3,"file":"options.mjs","names":["createNamedContext","useContext","ReflectionKind","camelCase","isSetString","defu","ExistingOptionsContext","useExistingOptions","computedOptions","command","Object","entries","options","reduce","ret","name","option","kind","boolean","isNegativeOf","env","description","replace","default"],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (option.kind === ReflectionKind.boolean && option.isNegativeOf) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;;;;AAiCA,MAAaM,yBACXN,mBAA6B,mBAAmB,EAAE,CAAC;;;;;;;;;AAUrD,SAAgBO,qBAAqB;AACnC,QAAON,WAAqBK,uBAAuB;;AAGrD,SAAgBE,gBAAgBC,SAAsB;AACpD,QAAOC,OAAOC,QAAQF,QAAQG,QAAQ,CAACC,QACpCC,KAAK,CAACC,MAAMC,YAAY;AACvBF,MAAIX,UAAUY,KAAK,MAAMV,OACvB,EACEU,MAAMZ,UAAUY,KAAI,EACrB,EACDD,IAAIC,SAAS,EAAE,EACfC,OACgB;AAElB,MAAIA,OAAOC,SAASf,eAAegB,WAAWF,OAAOG,aACnDL,KAAIX,UAAUa,OAAOG,aAAa,IAAId,OACpC,EACEU,MAAMZ,UAAUa,OAAOG,aAAY,EACpC,EACDL,IAAIE,OAAOG,iBAAiB,EAAE,EAC9B;GACE,GAAGH;GACHI,KAAKhB,YAAYY,OAAOI,IAAI,GAAG,MAAMJ,OAAOI,QAAQ;GACpDC,aAAa,GAAGL,OAAOK,YAAYC,QACjC,QACA,GACD,CAAA,0CAA2CP,KAAI;GAChDI,cAAchB,UAAUY,KAAK;GAC7BQ,SAAS,CAACP,OAAOO;GAErB,CAAyB;AAG3B,SAAOT;IAET,EACF,CAAC"}
1
+ {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (option.kind === ReflectionKind.boolean && option.isNegativeOf) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAA0B,mBAAmB,IAAC,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AAS3D,SAAgB,qBAAqB;AACjC,QAAQ,WAAW,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,WAAW,uBAAe;;AAE/D,mBAAY,SAAA,CAAA,sBAAA,QAAA;AACZ,SAAgB,gBAAM,SAAA;AAClB,QAAO,OAAI,QAAA,QAAA,QAAA,CAAA,OAAA,cAAA,KAAA,CAAA,MAAA,YAAA;AACP,MAAI,UAAA,KAAA,MAAA,OAAA,EACA,MAAK,UAAA,KAAA;AAEf,MAAA,OAAA,SAAA,eAAA,WAAA,OAAA,aACU,KAAI,UAAU,OAAO,aAAa,IAAI,OAAK,EACrD,MAAA,UAAA,OAAA,aAAA,EACW,EAAE,IAAI,OAAO,iBAAiB,EAAE,EAAE;GAC/B,GAAG;;GAEjB,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,KAAA;GACc,cAAc,UAAU,KAAK;GAC5C,SAAA,CAAA,OAAA;GACS,CAAA;AAET,SAAA;IACM;EAAC;EAAO;EAAU;EAAI;EAAa,CAAC,EAAE,EAAE,CAAC;;AAEhD,gBAAgB,SAAS;CAAC;CAAW;CAAA;CAAA;CAAA"}
@@ -11,6 +11,12 @@ let __stryke_path_join = require("@stryke/path/join");
11
11
  function getDocsOutputPath(context) {
12
12
  return (0, __stryke_path_join.joinPaths)(context.config.projectRoot, "docs", "generated");
13
13
  }
14
+ getDocsOutputPath.__type = [
15
+ "Context",
16
+ "context",
17
+ "getDocsOutputPath",
18
+ "P\"w!2\"&/#"
19
+ ];
14
20
 
15
21
  //#endregion
16
22
  exports.getDocsOutputPath = getDocsOutputPath;
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helpers.cjs","names":["joinPaths","getDocsOutputPath","context","config","projectRoot"],"sources":["../../src/helpers/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.projectRoot, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgBC,kBAAkBC,SAA0B;AAC1D,0CAAiBA,QAAQC,OAAOC,aAAa,QAAQ,YAAY"}
1
+ {"version":3,"file":"docs-helpers.cjs","names":[],"sources":["../../src/helpers/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.projectRoot, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAgB,kBAAkB,SAAS;AACvC,0CAAiB,QAAQ,OAAO,aAAa,QAAQ,YAAE;;AAE3D,kBAAkB,SAAS;CAAC;CAAW;CAAW;CAAU;CAAA"}
@@ -10,6 +10,12 @@ import { joinPaths } from "@stryke/path/join";
10
10
  function getDocsOutputPath(context) {
11
11
  return joinPaths(context.config.projectRoot, "docs", "generated");
12
12
  }
13
+ getDocsOutputPath.__type = [
14
+ "Context",
15
+ "context",
16
+ "getDocsOutputPath",
17
+ "P\"w!2\"&/#"
18
+ ];
13
19
 
14
20
  //#endregion
15
21
  export { getDocsOutputPath };
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helpers.mjs","names":["joinPaths","getDocsOutputPath","context","config","projectRoot"],"sources":["../../src/helpers/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.projectRoot, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgBC,kBAAkBC,SAA0B;AAC1D,QAAOF,UAAUE,QAAQC,OAAOC,aAAa,QAAQ,YAAY"}
1
+ {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.projectRoot, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAgB,kBAAkB,SAAS;AACvC,QAAO,UAAU,QAAQ,OAAO,aAAa,QAAQ,YAAE;;AAE3D,kBAAkB,SAAS;CAAC;CAAW;CAAW;CAAU;CAAA"}
@@ -4,31 +4,73 @@ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type"
4
4
  let __stryke_helpers_omit = require("@stryke/helpers/omit");
5
5
 
6
6
  //#region src/helpers/persistence.ts
7
+ const __ΩRecord = [
8
+ "K",
9
+ "T",
10
+ "Record",
11
+ "l'e#\"Rb!b\"Pde\"!N#!w#y"
12
+ ];
13
+ function __assignType(fn, args) {
14
+ fn.__type = args;
15
+ return fn;
16
+ }
7
17
  function getCommandsPersistencePath(context) {
8
18
  return (0, __stryke_path_join_paths.joinPaths)(context.dataPath, "reflections", "commands.json");
9
19
  }
20
+ getCommandsPersistencePath.__type = [
21
+ "Context",
22
+ "context",
23
+ "getCommandsPersistencePath",
24
+ "P\"w!2\"&/#"
25
+ ];
10
26
  function serializedCommandTree(commands) {
11
- const serialize = (node, parent = null) => {
27
+ const serialize = __assignType((node, parent = null) => {
12
28
  const serializedNode = {
13
29
  ...node,
14
- options: Object.entries(node.options).reduce((ret, [key, option]) => {
30
+ options: Object.entries(node.options).reduce(__assignType((ret, [key, option]) => {
15
31
  ret[key] = { ...(0, __stryke_helpers_omit.omit)(option, ["reflection"]) };
16
32
  return ret;
17
- }, {}),
18
- arguments: node.arguments.map((arg) => ({ ...(0, __stryke_helpers_omit.omit)(arg, ["reflection"]) })),
33
+ }, [
34
+ "ret",
35
+ "param1",
36
+ "",
37
+ "P\"2!\"2\"\"/#"
38
+ ]), {}),
39
+ arguments: node.arguments.map(__assignType((arg) => ({ ...(0, __stryke_helpers_omit.omit)(arg, ["reflection"]) }), [
40
+ "arg",
41
+ "",
42
+ "P\"2!\"/\""
43
+ ])),
19
44
  parent,
20
45
  children: {},
21
46
  reflection: node.reflection ? (0, __powerlines_deepkit_vendor_type.serializeType)(node.reflection.type) : void 0
22
47
  };
23
48
  for (const [key, child] of Object.entries(node.children || {})) serializedNode.children[key] = serialize(child, node.id);
24
49
  return serializedNode;
25
- };
50
+ }, [
51
+ "CommandTree",
52
+ "node",
53
+ "parent",
54
+ () => null,
55
+ "SerializedCommandTree",
56
+ "",
57
+ "P\"w!2\"P&,J2#>$\"w%/&"
58
+ ]);
26
59
  const result = {};
27
60
  for (const [key, child] of Object.entries(commands)) result[key] = serialize(child, null);
28
61
  return result;
29
62
  }
63
+ serializedCommandTree.__type = [
64
+ () => __ΩRecord,
65
+ "CommandTree",
66
+ "commands",
67
+ () => __ΩRecord,
68
+ "SerializedCommandTree",
69
+ "serializedCommandTree",
70
+ "P&\"w\"o!#2#&\"w%o$#/&"
71
+ ];
30
72
  function deserializeCommandTree(serializedCommands) {
31
- const deserialize = (node, parent = null) => {
73
+ const deserialize = __assignType((node, parent = null) => {
32
74
  const type = (0, __powerlines_deepkit_vendor_type.deserializeType)(node.reflection);
33
75
  if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.function) throw new Error(`Failed to deserialize persisted data - invalid command handler reflection type for command ${node.id}`);
34
76
  const reflection = new __powerlines_deepkit_vendor_type.ReflectionFunction(type);
@@ -39,37 +81,76 @@ function deserializeCommandTree(serializedCommands) {
39
81
  }
40
82
  const deserializedNode = {
41
83
  ...node,
42
- options: optionsReflection ? Object.entries(node.options).reduce((ret, [key, option]) => {
84
+ options: optionsReflection ? Object.entries(node.options).reduce(__assignType((ret, [key, option]) => {
43
85
  ret[key] = {
44
86
  ...option,
45
87
  reflection: optionsReflection.getProperty(option.name)
46
88
  };
47
89
  return ret;
48
- }, {}) : {},
49
- arguments: node.arguments.map((arg, i) => ({
90
+ }, [
91
+ "ret",
92
+ "param1",
93
+ "",
94
+ "P\"2!\"2\"\"/#"
95
+ ]), {}) : {},
96
+ arguments: node.arguments.map(__assignType((arg, i) => ({
50
97
  ...arg,
51
98
  reflection: reflection.getParameters().length > i + 1 ? reflection.getParameters()[i + 1] : reflection.getParameterOrUndefined(arg.name)
52
- })),
99
+ }), [
100
+ "arg",
101
+ "i",
102
+ "",
103
+ "P\"2!\"2\"\"/#"
104
+ ])),
53
105
  parent,
54
106
  children: {},
55
107
  reflection
56
108
  };
57
109
  for (const [key, child] of Object.entries(node.children || {})) deserializedNode.children[key] = deserialize(child, deserializedNode);
58
110
  return deserializedNode;
59
- };
111
+ }, [
112
+ "SerializedCommandTree",
113
+ "node",
114
+ "CommandTree",
115
+ "parent",
116
+ () => null,
117
+ "",
118
+ "P\"w!2\"P\"w#,J2$>%\"w#/&"
119
+ ]);
60
120
  const result = {};
61
121
  for (const [key, child] of Object.entries(serializedCommands)) result[key] = deserialize(child, null);
62
122
  return result;
63
123
  }
124
+ deserializeCommandTree.__type = [
125
+ () => __ΩRecord,
126
+ "SerializedCommandTree",
127
+ "serializedCommands",
128
+ () => __ΩRecord,
129
+ "CommandTree",
130
+ "deserializeCommandTree",
131
+ "P&\"w\"o!#2#&\"w%o$#/&"
132
+ ];
64
133
  async function readCommandsPersistence(context) {
65
134
  const reflections = await context.fs.read(getCommandsPersistencePath(context));
66
135
  if (!reflections || !reflections.length) throw new Error(`CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`);
67
136
  context.commands = deserializeCommandTree(JSON.parse(reflections));
68
137
  }
138
+ readCommandsPersistence.__type = [
139
+ "Context",
140
+ "context",
141
+ "readCommandsPersistence",
142
+ "P\"w!2\"\"/#"
143
+ ];
69
144
  async function writeCommandsPersistence(context) {
70
145
  const filePath = getCommandsPersistencePath(context);
71
146
  await context.fs.write(filePath, JSON.stringify(serializedCommandTree(context.commands), null, context.config.mode === "development" ? 2 : 0));
72
147
  }
148
+ writeCommandsPersistence.__type = [
149
+ "Context",
150
+ "context",
151
+ "writeCommandsPersistence",
152
+ "P\"w!2\"\"/#"
153
+ ];
73
154
 
74
155
  //#endregion
75
156
  exports.getCommandsPersistencePath = getCommandsPersistencePath;
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.cjs","names":["deserializeType","ReflectionFunction","ReflectionKind","resolveClassType","serializeType","omit","joinPaths","getCommandsPersistencePath","context","dataPath","serializedCommandTree","commands","serialize","node","parent","serializedNode","options","Object","entries","reduce","ret","key","option","arguments","map","arg","children","reflection","type","undefined","child","id","result","deserializeCommandTree","serializedCommands","deserialize","kind","function","Error","optionsReflection","getParameters","length","optionsType","objectLiteral","deserializedNode","getProperty","name","i","getParameterOrUndefined","readCommandsPersistence","reflections","fs","read","JSON","parse","writeCommandsPersistence","filePath","write","stringify","config","mode"],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport {\n deserializeType,\n ReflectionFunction,\n ReflectionKind,\n resolveClassType,\n serializeType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandTree,\n SerializedCommandOption,\n SerializedCommandTree\n} from \"../types\";\nimport type { Context } from \"../types/context\";\n\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\nexport function serializedCommandTree(\n commands: Record<string, CommandTree>\n): Record<string, SerializedCommandTree> {\n const serialize = (\n node: CommandTree,\n parent: string | null = null\n ): SerializedCommandTree => {\n const serializedNode: SerializedCommandTree = {\n ...node,\n options: Object.entries(node.options).reduce(\n (ret, [key, option]) => {\n ret[key] = {\n ...omit(option, [\"reflection\"])\n };\n return ret;\n },\n {} as Record<string, SerializedCommandOption>\n ),\n arguments: node.arguments.map(arg => ({\n ...omit(arg, [\"reflection\"])\n })),\n parent,\n children: {},\n reflection: node.reflection\n ? serializeType(node.reflection.type)\n : undefined\n };\n\n for (const [key, child] of Object.entries(node.children || {})) {\n serializedNode.children[key] = serialize(child, node.id);\n }\n\n return serializedNode;\n };\n\n const result: Record<string, SerializedCommandTree> = {};\n for (const [key, child] of Object.entries(commands)) {\n result[key] = serialize(child, null);\n }\n\n return result;\n}\n\nexport function deserializeCommandTree(\n serializedCommands: Record<string, SerializedCommandTree>\n): Record<string, CommandTree> {\n const deserialize = (\n node: SerializedCommandTree,\n parent: CommandTree | null = null\n ): CommandTree => {\n const type = deserializeType(node.reflection);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `Failed to deserialize persisted data - invalid command handler reflection type for command ${node.id}`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n let optionsReflection: ReflectionClass<any> | undefined;\n if (\n reflection.getParameters().length > 0 &&\n reflection.getParameters()[0]\n ) {\n const optionsType = reflection.getParameters()[0]!.type;\n if (optionsType.kind === ReflectionKind.objectLiteral) {\n optionsReflection = resolveClassType(optionsType);\n }\n }\n\n const deserializedNode: CommandTree = {\n ...node,\n options: optionsReflection\n ? Object.entries(node.options).reduce(\n (ret, [key, option]) => {\n ret[key] = {\n ...option,\n reflection: optionsReflection.getProperty(option.name)\n } as CommandOption;\n return ret;\n },\n {} as Record<string, CommandOption>\n )\n : {},\n arguments: node.arguments.map((arg, i) => ({\n ...arg,\n reflection:\n reflection.getParameters().length > i + 1\n ? reflection.getParameters()[i + 1]\n : reflection.getParameterOrUndefined(arg.name)\n })) as CommandArgument[],\n parent,\n children: {},\n reflection\n };\n\n for (const [key, child] of Object.entries(node.children || {})) {\n deserializedNode.children[key] = deserialize(child, deserializedNode);\n }\n\n return deserializedNode;\n };\n\n const result: Record<string, CommandTree> = {};\n for (const [key, child] of Object.entries(serializedCommands)) {\n result[key] = deserialize(child, null);\n }\n\n return result;\n}\n\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = deserializeCommandTree(JSON.parse(reflections));\n}\n\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n serializedCommandTree(context.commands),\n null,\n context.config.mode === \"development\" ? 2 : 0\n )\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"persistence.cjs","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport {\n deserializeType,\n ReflectionFunction,\n ReflectionKind,\n resolveClassType,\n serializeType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandTree,\n SerializedCommandOption,\n SerializedCommandTree\n} from \"../types\";\nimport type { Context } from \"../types/context\";\n\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\nexport function serializedCommandTree(\n commands: Record<string, CommandTree>\n): Record<string, SerializedCommandTree> {\n const serialize = (\n node: CommandTree,\n parent: string | null = null\n ): SerializedCommandTree => {\n const serializedNode: SerializedCommandTree = {\n ...node,\n options: Object.entries(node.options).reduce(\n (ret, [key, option]) => {\n ret[key] = {\n ...omit(option, [\"reflection\"])\n };\n return ret;\n },\n {} as Record<string, SerializedCommandOption>\n ),\n arguments: node.arguments.map(arg => ({\n ...omit(arg, [\"reflection\"])\n })),\n parent,\n children: {},\n reflection: node.reflection\n ? serializeType(node.reflection.type)\n : undefined\n };\n\n for (const [key, child] of Object.entries(node.children || {})) {\n serializedNode.children[key] = serialize(child, node.id);\n }\n\n return serializedNode;\n };\n\n const result: Record<string, SerializedCommandTree> = {};\n for (const [key, child] of Object.entries(commands)) {\n result[key] = serialize(child, null);\n }\n\n return result;\n}\n\nexport function deserializeCommandTree(\n serializedCommands: Record<string, SerializedCommandTree>\n): Record<string, CommandTree> {\n const deserialize = (\n node: SerializedCommandTree,\n parent: CommandTree | null = null\n ): CommandTree => {\n const type = deserializeType(node.reflection);\n if (type.kind !== ReflectionKind.function) {\n throw new Error(\n `Failed to deserialize persisted data - invalid command handler reflection type for command ${node.id}`\n );\n }\n\n const reflection = new ReflectionFunction(type);\n\n let optionsReflection: ReflectionClass<any> | undefined;\n if (\n reflection.getParameters().length > 0 &&\n reflection.getParameters()[0]\n ) {\n const optionsType = reflection.getParameters()[0]!.type;\n if (optionsType.kind === ReflectionKind.objectLiteral) {\n optionsReflection = resolveClassType(optionsType);\n }\n }\n\n const deserializedNode: CommandTree = {\n ...node,\n options: optionsReflection\n ? Object.entries(node.options).reduce(\n (ret, [key, option]) => {\n ret[key] = {\n ...option,\n reflection: optionsReflection.getProperty(option.name)\n } as CommandOption;\n return ret;\n },\n {} as Record<string, CommandOption>\n )\n : {},\n arguments: node.arguments.map((arg, i) => ({\n ...arg,\n reflection:\n reflection.getParameters().length > i + 1\n ? reflection.getParameters()[i + 1]\n : reflection.getParameterOrUndefined(arg.name)\n })) as CommandArgument[],\n parent,\n children: {},\n reflection\n };\n\n for (const [key, child] of Object.entries(node.children || {})) {\n deserializedNode.children[key] = deserialize(child, deserializedNode);\n }\n\n return deserializedNode;\n };\n\n const result: Record<string, CommandTree> = {};\n for (const [key, child] of Object.entries(serializedCommands)) {\n result[key] = deserialize(child, null);\n }\n\n return result;\n}\n\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = deserializeCommandTree(JSON.parse(reflections));\n}\n\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n serializedCommandTree(context.commands),\n null,\n context.config.mode === \"development\" ? 2 : 0\n )\n );\n}\n"],"mappings":"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"}
@@ -3,31 +3,73 @@ import { ReflectionFunction, ReflectionKind, deserializeType, resolveClassType,
3
3
  import { omit } from "@stryke/helpers/omit";
4
4
 
5
5
  //#region src/helpers/persistence.ts
6
+ const __ΩRecord = [
7
+ "K",
8
+ "T",
9
+ "Record",
10
+ "l'e#\"Rb!b\"Pde\"!N#!w#y"
11
+ ];
12
+ function __assignType(fn, args) {
13
+ fn.__type = args;
14
+ return fn;
15
+ }
6
16
  function getCommandsPersistencePath(context) {
7
17
  return joinPaths(context.dataPath, "reflections", "commands.json");
8
18
  }
19
+ getCommandsPersistencePath.__type = [
20
+ "Context",
21
+ "context",
22
+ "getCommandsPersistencePath",
23
+ "P\"w!2\"&/#"
24
+ ];
9
25
  function serializedCommandTree(commands) {
10
- const serialize = (node, parent = null) => {
26
+ const serialize = __assignType((node, parent = null) => {
11
27
  const serializedNode = {
12
28
  ...node,
13
- options: Object.entries(node.options).reduce((ret, [key, option]) => {
29
+ options: Object.entries(node.options).reduce(__assignType((ret, [key, option]) => {
14
30
  ret[key] = { ...omit(option, ["reflection"]) };
15
31
  return ret;
16
- }, {}),
17
- arguments: node.arguments.map((arg) => ({ ...omit(arg, ["reflection"]) })),
32
+ }, [
33
+ "ret",
34
+ "param1",
35
+ "",
36
+ "P\"2!\"2\"\"/#"
37
+ ]), {}),
38
+ arguments: node.arguments.map(__assignType((arg) => ({ ...omit(arg, ["reflection"]) }), [
39
+ "arg",
40
+ "",
41
+ "P\"2!\"/\""
42
+ ])),
18
43
  parent,
19
44
  children: {},
20
45
  reflection: node.reflection ? serializeType(node.reflection.type) : void 0
21
46
  };
22
47
  for (const [key, child] of Object.entries(node.children || {})) serializedNode.children[key] = serialize(child, node.id);
23
48
  return serializedNode;
24
- };
49
+ }, [
50
+ "CommandTree",
51
+ "node",
52
+ "parent",
53
+ () => null,
54
+ "SerializedCommandTree",
55
+ "",
56
+ "P\"w!2\"P&,J2#>$\"w%/&"
57
+ ]);
25
58
  const result = {};
26
59
  for (const [key, child] of Object.entries(commands)) result[key] = serialize(child, null);
27
60
  return result;
28
61
  }
62
+ serializedCommandTree.__type = [
63
+ () => __ΩRecord,
64
+ "CommandTree",
65
+ "commands",
66
+ () => __ΩRecord,
67
+ "SerializedCommandTree",
68
+ "serializedCommandTree",
69
+ "P&\"w\"o!#2#&\"w%o$#/&"
70
+ ];
29
71
  function deserializeCommandTree(serializedCommands) {
30
- const deserialize = (node, parent = null) => {
72
+ const deserialize = __assignType((node, parent = null) => {
31
73
  const type = deserializeType(node.reflection);
32
74
  if (type.kind !== ReflectionKind.function) throw new Error(`Failed to deserialize persisted data - invalid command handler reflection type for command ${node.id}`);
33
75
  const reflection = new ReflectionFunction(type);
@@ -38,37 +80,76 @@ function deserializeCommandTree(serializedCommands) {
38
80
  }
39
81
  const deserializedNode = {
40
82
  ...node,
41
- options: optionsReflection ? Object.entries(node.options).reduce((ret, [key, option]) => {
83
+ options: optionsReflection ? Object.entries(node.options).reduce(__assignType((ret, [key, option]) => {
42
84
  ret[key] = {
43
85
  ...option,
44
86
  reflection: optionsReflection.getProperty(option.name)
45
87
  };
46
88
  return ret;
47
- }, {}) : {},
48
- arguments: node.arguments.map((arg, i) => ({
89
+ }, [
90
+ "ret",
91
+ "param1",
92
+ "",
93
+ "P\"2!\"2\"\"/#"
94
+ ]), {}) : {},
95
+ arguments: node.arguments.map(__assignType((arg, i) => ({
49
96
  ...arg,
50
97
  reflection: reflection.getParameters().length > i + 1 ? reflection.getParameters()[i + 1] : reflection.getParameterOrUndefined(arg.name)
51
- })),
98
+ }), [
99
+ "arg",
100
+ "i",
101
+ "",
102
+ "P\"2!\"2\"\"/#"
103
+ ])),
52
104
  parent,
53
105
  children: {},
54
106
  reflection
55
107
  };
56
108
  for (const [key, child] of Object.entries(node.children || {})) deserializedNode.children[key] = deserialize(child, deserializedNode);
57
109
  return deserializedNode;
58
- };
110
+ }, [
111
+ "SerializedCommandTree",
112
+ "node",
113
+ "CommandTree",
114
+ "parent",
115
+ () => null,
116
+ "",
117
+ "P\"w!2\"P\"w#,J2$>%\"w#/&"
118
+ ]);
59
119
  const result = {};
60
120
  for (const [key, child] of Object.entries(serializedCommands)) result[key] = deserialize(child, null);
61
121
  return result;
62
122
  }
123
+ deserializeCommandTree.__type = [
124
+ () => __ΩRecord,
125
+ "SerializedCommandTree",
126
+ "serializedCommands",
127
+ () => __ΩRecord,
128
+ "CommandTree",
129
+ "deserializeCommandTree",
130
+ "P&\"w\"o!#2#&\"w%o$#/&"
131
+ ];
63
132
  async function readCommandsPersistence(context) {
64
133
  const reflections = await context.fs.read(getCommandsPersistencePath(context));
65
134
  if (!reflections || !reflections.length) throw new Error(`CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`);
66
135
  context.commands = deserializeCommandTree(JSON.parse(reflections));
67
136
  }
137
+ readCommandsPersistence.__type = [
138
+ "Context",
139
+ "context",
140
+ "readCommandsPersistence",
141
+ "P\"w!2\"\"/#"
142
+ ];
68
143
  async function writeCommandsPersistence(context) {
69
144
  const filePath = getCommandsPersistencePath(context);
70
145
  await context.fs.write(filePath, JSON.stringify(serializedCommandTree(context.commands), null, context.config.mode === "development" ? 2 : 0));
71
146
  }
147
+ writeCommandsPersistence.__type = [
148
+ "Context",
149
+ "context",
150
+ "writeCommandsPersistence",
151
+ "P\"w!2\"\"/#"
152
+ ];
72
153
 
73
154
  //#endregion
74
155
  export { getCommandsPersistencePath, readCommandsPersistence, writeCommandsPersistence };