@xpack/xpm-lib 3.1.2 → 4.0.0

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 (202) hide show
  1. package/README.md +16 -212
  2. package/dist/classes/actions.d.ts +58 -0
  3. package/dist/classes/actions.d.ts.map +1 -0
  4. package/dist/classes/actions.js +250 -0
  5. package/dist/classes/actions.js.map +1 -0
  6. package/dist/classes/build-configurations.d.ts +78 -0
  7. package/dist/classes/build-configurations.d.ts.map +1 -0
  8. package/dist/classes/build-configurations.js +489 -0
  9. package/dist/classes/build-configurations.js.map +1 -0
  10. package/dist/classes/combinations-generator.d.ts +19 -0
  11. package/dist/classes/combinations-generator.d.ts.map +1 -0
  12. package/dist/classes/combinations-generator.js +48 -0
  13. package/dist/classes/combinations-generator.js.map +1 -0
  14. package/dist/classes/data-model.d.ts +21 -0
  15. package/dist/classes/data-model.d.ts.map +1 -0
  16. package/dist/classes/data-model.js +47 -0
  17. package/dist/classes/data-model.js.map +1 -0
  18. package/dist/classes/errors.d.ts +13 -0
  19. package/dist/classes/errors.d.ts.map +1 -0
  20. package/dist/classes/errors.js +13 -0
  21. package/dist/classes/errors.js.map +1 -0
  22. package/dist/classes/init-template-base.d.ts +47 -0
  23. package/dist/classes/init-template-base.d.ts.map +1 -0
  24. package/dist/classes/init-template-base.js +358 -0
  25. package/dist/classes/init-template-base.js.map +1 -0
  26. package/dist/classes/liquid-drop.d.ts +28 -0
  27. package/dist/classes/liquid-drop.d.ts.map +1 -0
  28. package/dist/classes/liquid-drop.js +70 -0
  29. package/dist/classes/liquid-drop.js.map +1 -0
  30. package/dist/classes/liquid-engine.d.ts +7 -0
  31. package/dist/classes/liquid-engine.d.ts.map +1 -0
  32. package/dist/classes/liquid-engine.js +72 -0
  33. package/dist/classes/liquid-engine.js.map +1 -0
  34. package/dist/classes/package.d.ts +31 -0
  35. package/dist/classes/package.d.ts.map +1 -0
  36. package/dist/classes/package.js +268 -0
  37. package/dist/classes/package.js.map +1 -0
  38. package/dist/classes/platform-detector.d.ts +14 -0
  39. package/dist/classes/platform-detector.d.ts.map +1 -0
  40. package/dist/classes/platform-detector.js +26 -0
  41. package/dist/classes/platform-detector.js.map +1 -0
  42. package/dist/classes/policies.d.ts +14 -0
  43. package/dist/classes/policies.d.ts.map +1 -0
  44. package/dist/classes/policies.js +20 -0
  45. package/dist/classes/policies.js.map +1 -0
  46. package/dist/classes/template-expander.d.ts +29 -0
  47. package/dist/classes/template-expander.d.ts.map +1 -0
  48. package/dist/classes/template-expander.js +62 -0
  49. package/dist/classes/template-expander.js.map +1 -0
  50. package/dist/data/substitutions-variables.d.ts +43 -0
  51. package/dist/data/substitutions-variables.d.ts.map +1 -0
  52. package/dist/{lib → data}/substitutions-variables.js +1 -16
  53. package/dist/data/substitutions-variables.js.map +1 -0
  54. package/dist/functions/chmod-recursively.d.ts +9 -0
  55. package/dist/functions/chmod-recursively.d.ts.map +1 -0
  56. package/dist/functions/chmod-recursively.js +66 -0
  57. package/dist/functions/chmod-recursively.js.map +1 -0
  58. package/dist/functions/filter-paths.d.ts +5 -0
  59. package/dist/functions/filter-paths.d.ts.map +1 -0
  60. package/dist/functions/filter-paths.js +16 -0
  61. package/dist/functions/filter-paths.js.map +1 -0
  62. package/dist/functions/is-something.d.ts +9 -0
  63. package/dist/functions/is-something.d.ts.map +1 -0
  64. package/dist/functions/is-something.js +25 -0
  65. package/dist/functions/is-something.js.map +1 -0
  66. package/dist/functions/matrix-expander.d.ts +17 -0
  67. package/dist/functions/matrix-expander.d.ts.map +1 -0
  68. package/dist/functions/matrix-expander.js +52 -0
  69. package/dist/functions/matrix-expander.js.map +1 -0
  70. package/dist/functions/perform-substitutions.d.ts +12 -0
  71. package/dist/functions/perform-substitutions.d.ts.map +1 -0
  72. package/dist/functions/perform-substitutions.js +76 -0
  73. package/dist/functions/perform-substitutions.js.map +1 -0
  74. package/dist/functions/utils.d.ts +8 -0
  75. package/dist/functions/utils.d.ts.map +1 -0
  76. package/dist/functions/utils.js +16 -0
  77. package/dist/functions/utils.js.map +1 -0
  78. package/dist/index.d.ts +22 -15
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +22 -29
  81. package/dist/index.js.map +1 -1
  82. package/dist/{lib/types.d.ts → types/json.d.ts} +31 -22
  83. package/dist/types/json.d.ts.map +1 -0
  84. package/dist/types/json.js +2 -0
  85. package/dist/types/json.js.map +1 -0
  86. package/dist/types/xpm-init-template.d.ts +21 -0
  87. package/dist/types/xpm-init-template.d.ts.map +1 -0
  88. package/dist/types/xpm-init-template.js +2 -0
  89. package/dist/types/xpm-init-template.js.map +1 -0
  90. package/dist/types/xpm.d.ts +16 -0
  91. package/dist/types/xpm.d.ts.map +1 -0
  92. package/dist/types/xpm.js +2 -0
  93. package/dist/types/xpm.js.map +1 -0
  94. package/package.json +53 -44
  95. package/src/CODE-REVIEW.md +2167 -0
  96. package/src/README.md +393 -6
  97. package/src/classes/actions.ts +1157 -0
  98. package/src/classes/build-configurations.ts +2127 -0
  99. package/src/classes/combinations-generator.ts +331 -0
  100. package/src/classes/data-model.ts +337 -0
  101. package/src/classes/errors.ts +105 -0
  102. package/src/classes/init-template-base.ts +1028 -0
  103. package/src/classes/liquid-drop.ts +376 -0
  104. package/src/classes/liquid-engine.ts +249 -0
  105. package/src/classes/package.ts +765 -0
  106. package/src/classes/platform-detector.ts +237 -0
  107. package/src/classes/policies.ts +200 -0
  108. package/src/classes/template-expander.ts +330 -0
  109. package/src/data/substitutions-variables.ts +390 -0
  110. package/src/functions/chmod-recursively.ts +195 -0
  111. package/src/functions/filter-paths.ts +126 -0
  112. package/src/functions/is-something.ts +223 -0
  113. package/src/functions/matrix-expander.ts +172 -0
  114. package/src/functions/perform-substitutions.ts +253 -0
  115. package/src/functions/utils.ts +151 -0
  116. package/src/index.ts +72 -19
  117. package/src/types/json.ts +519 -0
  118. package/src/types/xpm-init-template.ts +282 -0
  119. package/src/types/xpm.ts +162 -0
  120. package/dist/lib/chmod-recursive.d.ts +0 -7
  121. package/dist/lib/chmod-recursive.d.ts.map +0 -1
  122. package/dist/lib/chmod-recursive.js +0 -81
  123. package/dist/lib/chmod-recursive.js.map +0 -1
  124. package/dist/lib/errors.d.ts +0 -11
  125. package/dist/lib/errors.d.ts.map +0 -1
  126. package/dist/lib/errors.js +0 -26
  127. package/dist/lib/errors.js.map +0 -1
  128. package/dist/lib/functions/chmod-recursive.d.ts +0 -7
  129. package/dist/lib/functions/chmod-recursive.d.ts.map +0 -1
  130. package/dist/lib/functions/chmod-recursive.js +0 -81
  131. package/dist/lib/functions/chmod-recursive.js.map +0 -1
  132. package/dist/lib/functions/perform-substitutions.d.ts +0 -20
  133. package/dist/lib/functions/perform-substitutions.d.ts.map +0 -1
  134. package/dist/lib/functions/perform-substitutions.js +0 -85
  135. package/dist/lib/functions/perform-substitutions.js.map +0 -1
  136. package/dist/lib/functions/utils.d.ts +0 -30
  137. package/dist/lib/functions/utils.d.ts.map +0 -1
  138. package/dist/lib/functions/utils.js +0 -70
  139. package/dist/lib/functions/utils.js.map +0 -1
  140. package/dist/lib/init-template-base.d.ts +0 -46
  141. package/dist/lib/init-template-base.d.ts.map +0 -1
  142. package/dist/lib/init-template-base.js +0 -281
  143. package/dist/lib/init-template-base.js.map +0 -1
  144. package/dist/lib/liquid-actions.d.ts +0 -37
  145. package/dist/lib/liquid-actions.d.ts.map +0 -1
  146. package/dist/lib/liquid-actions.js +0 -148
  147. package/dist/lib/liquid-actions.js.map +0 -1
  148. package/dist/lib/liquid-build-configurations.d.ts +0 -47
  149. package/dist/lib/liquid-build-configurations.d.ts.map +0 -1
  150. package/dist/lib/liquid-build-configurations.js +0 -282
  151. package/dist/lib/liquid-build-configurations.js.map +0 -1
  152. package/dist/lib/liquid-drop.d.ts +0 -13
  153. package/dist/lib/liquid-drop.d.ts.map +0 -1
  154. package/dist/lib/liquid-drop.js +0 -56
  155. package/dist/lib/liquid-drop.js.map +0 -1
  156. package/dist/lib/liquid-engine.d.ts +0 -5
  157. package/dist/lib/liquid-engine.d.ts.map +0 -1
  158. package/dist/lib/liquid-engine.js +0 -85
  159. package/dist/lib/liquid-engine.js.map +0 -1
  160. package/dist/lib/liquid-package.d.ts +0 -17
  161. package/dist/lib/liquid-package.d.ts.map +0 -1
  162. package/dist/lib/liquid-package.js +0 -70
  163. package/dist/lib/liquid-package.js.map +0 -1
  164. package/dist/lib/package.d.ts +0 -66
  165. package/dist/lib/package.d.ts.map +0 -1
  166. package/dist/lib/package.js +0 -700
  167. package/dist/lib/package.js.map +0 -1
  168. package/dist/lib/perform-substitutions.d.ts +0 -20
  169. package/dist/lib/perform-substitutions.d.ts.map +0 -1
  170. package/dist/lib/perform-substitutions.js +0 -85
  171. package/dist/lib/perform-substitutions.js.map +0 -1
  172. package/dist/lib/policies.d.ts +0 -14
  173. package/dist/lib/policies.d.ts.map +0 -1
  174. package/dist/lib/policies.js +0 -33
  175. package/dist/lib/policies.js.map +0 -1
  176. package/dist/lib/substitutions-variables.d.ts +0 -117
  177. package/dist/lib/substitutions-variables.d.ts.map +0 -1
  178. package/dist/lib/substitutions-variables.js.map +0 -1
  179. package/dist/lib/types.d.ts.map +0 -1
  180. package/dist/lib/types.js +0 -13
  181. package/dist/lib/types.js.map +0 -1
  182. package/dist/lib/utils.d.ts +0 -30
  183. package/dist/lib/utils.d.ts.map +0 -1
  184. package/dist/lib/utils.js +0 -70
  185. package/dist/lib/utils.js.map +0 -1
  186. package/dist/tsconfig.tsbuildinfo +0 -1
  187. package/src/lib/errors.ts +0 -29
  188. package/src/lib/functions/chmod-recursive.ts +0 -103
  189. package/src/lib/functions/perform-substitutions.ts +0 -116
  190. package/src/lib/functions/utils.ts +0 -88
  191. package/src/lib/init-template-base.ts +0 -408
  192. package/src/lib/liquid-actions.ts +0 -223
  193. package/src/lib/liquid-build-configurations.ts +0 -433
  194. package/src/lib/liquid-drop.ts +0 -99
  195. package/src/lib/liquid-engine.ts +0 -135
  196. package/src/lib/liquid-package.ts +0 -108
  197. package/src/lib/package.ts +0 -947
  198. package/src/lib/policies.ts +0 -51
  199. package/src/lib/substitutions-variables.ts +0 -177
  200. package/src/lib/types.ts +0 -109
  201. package/src/package.json +0 -3
  202. package/src/tsconfig.json +0 -10
@@ -1 +0,0 @@
1
- {"version":3,"file":"chmod-recursive.js","sourceRoot":"","sources":["../../../src/lib/functions/chmod-recursive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6DAA6D;AAE7D,+EAA+E;AAE/E,sCAAsC;AACtC,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAIjC,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,GAAG,GAKJ;IACC,MAAM,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAA;IACxC,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,CAAA;IAE5B,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACtC,gCAAgC;IAEhC,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QAC1B,gEAAgE;QAChE,2DAA2D;QAC3D,aAAa;QACb,OAAM;IACR,CAAC;IAED,oDAAoD;IACpD,qBAAqB;IACrB,IAAI,QAAQ,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACnC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QACpB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE;YAC1C,aAAa,EAAE,IAAI;SACpB,CAAC,CAAA;QACF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,cAAc,CAAC;gBACnB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;gB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M,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,cAAc,CAAC;gBACnB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;gBAC/C,QAAQ;gBACR,GAAG;aACJ,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,+EAA+E"}
@@ -1,20 +0,0 @@
1
- import { Logger } from '@xpack/logger';
2
- import { XpmLiquidEngine } from '../liquid-engine.js';
3
- import { XpmLiquidSubstitutionsVariables } from '../substitutions-variables.js';
4
- /**
5
- * Perform substitution on the input string.
6
- * Repeat until no more Liquid variables or tags are identified.
7
- *
8
- * @param input - The input string, possibly with substitutions.
9
- * @param map - The substitution map.
10
- * @returns The substituted string.
11
- *
12
- * @throws Liquid exceptions
13
- */
14
- export declare function performSubstitutions({ log, engine, input, substitutionsVariables, }: {
15
- log: Logger;
16
- engine: XpmLiquidEngine;
17
- input: string;
18
- substitutionsVariables: XpmLiquidSubstitutionsVariables;
19
- }): Promise<string>;
20
- //# sourceMappingURL=perform-substitutions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perform-substitutions.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/perform-substitutions.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAG/E;;;;;;;;;GASG;AAEH,wBAAsB,oBAAoB,CAAC,EACzC,GAAG,EACH,MAAM,EACN,KAAK,EACL,sBAAsB,GACvB,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,sBAAsB,EAAE,+BAA+B,CAAA;CACxD,GAAG,OAAO,CAAC,MAAM,CAAC,CAkElB"}
@@ -1,85 +0,0 @@
1
- /*
2
- * This file is part of the xPack project (http://xpack.github.io).
3
- * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software
6
- * for any purpose is hereby granted, under the terms of the MIT license.
7
- *
8
- * If a copy of the license was not distributed with this file, it can
9
- * be obtained from https://opensource.org/license/mit.
10
- */
11
- /* eslint max-len: [ "error", 80, { "ignoreUrls": true } ] */
12
- // ----------------------------------------------------------------------------
13
- import assert from 'node:assert';
14
- import { Context } from 'liquidjs';
15
- import { XpmLiquidPropertiesDrop } from '../liquid-drop.js';
16
- // ----------------------------------------------------------------------------
17
- /**
18
- * Perform substitution on the input string.
19
- * Repeat until no more Liquid variables or tags are identified.
20
- *
21
- * @param input - The input string, possibly with substitutions.
22
- * @param map - The substitution map.
23
- * @returns The substituted string.
24
- *
25
- * @throws Liquid exceptions
26
- */
27
- export async function performSubstitutions({ log, engine, input, substitutionsVariables, }) {
28
- assert(substitutionsVariables);
29
- if (input.trim() === '') {
30
- // Spare it the trouble for empty strings.
31
- return input;
32
- }
33
- let context;
34
- // Wrap properties into a liquid drop (a mechanism to process
35
- // substitutions immediately).
36
- if (Object.keys(substitutionsVariables.properties).length > 0) {
37
- context = new Context({
38
- ...substitutionsVariables,
39
- properties: new XpmLiquidPropertiesDrop({
40
- log,
41
- engine,
42
- properties: substitutionsVariables.properties,
43
- }),
44
- });
45
- }
46
- else {
47
- context = new Context(substitutionsVariables);
48
- }
49
- log.trace(`performSubstitutions('${input}')`);
50
- let current = input;
51
- let substituted = current;
52
- let count = 0;
53
- // Iterate until all substitutions are done.
54
- while (current.includes('{{') || current.includes('{%')) {
55
- ++count;
56
- // May throw.
57
- try {
58
- substituted = (await engine.parseAndRender(current, context));
59
- /* c8 ignore start */ /* istanbul ignore next */
60
- if (substituted === current) {
61
- // If nothing changed, we're done.
62
- // This test is just a safety net, normally should not get there.
63
- log.warn(`performSubstitutions() ${String(count)} => |`, substituted, '| did not change');
64
- break;
65
- } /* c8 ignore stop */
66
- }
67
- catch (ex) {
68
- if (ex instanceof Error) {
69
- // log.error(ex)
70
- log.error(ex.message);
71
- }
72
- else {
73
- log.error(new Error(String(ex)));
74
- }
75
- // Return the current (unsubstituted) value.
76
- substituted = current;
77
- break;
78
- }
79
- log.trace(`performSubstitutions() ${String(count)} => |`, substituted, '|');
80
- current = substituted;
81
- }
82
- return substituted;
83
- }
84
- // ----------------------------------------------------------------------------
85
- //# sourceMappingURL=perform-substitutions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perform-substitutions.js","sourceRoot":"","sources":["../../../src/lib/functions/perform-substitutions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6DAA6D;AAE7D,+EAA+E;AAE/E,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAKlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,+EAA+E;AAC/E;;;;;;;;;GASG;AAEH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,MAAM,EACN,KAAK,EACL,sBAAsB,GAMvB;IACC,MAAM,CAAC,sBAAsB,CAAC,CAAA;IAE9B,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACxB,0CAA0C;QAC1C,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,OAAO,CAAA;IACX,6DAA6D;IAC7D,8BAA8B;IAC9B,IAAI,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9D,OAAO,GAAG,IAAI,OAAO,CAAC;YACpB,GAAG,sBAAsB;YACzB,UAAU,EAAE,IAAI,uBAAuB,CAAC;gBACtC,GAAG;gBACH,MAAM;gBACN,UAAU,EAAE,sBAAsB,CAAC,UAAU;aAC9C,CAAC;SACH,CAAC,CAAA;IACJ,CAAC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AAO,GAAG,WAAW,CAAA;IACvB,CAAC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,+EAA+E"}
@@ -1,30 +0,0 @@
1
- export declare function isPrimitive(value: unknown): boolean;
2
- export declare function isJsonObject(value: unknown): boolean;
3
- export declare function isJsonArray(value: unknown): boolean;
4
- export declare function isNonEmptyJsonObject(value: unknown): boolean;
5
- export declare function isString(value: unknown): value is string;
6
- /**
7
- * Replace non alphanumeric chars with dashes to make the paths
8
- * comply with filesystem names.
9
- *
10
- * @param {string} input A path candidate.
11
- * @returns {string} A validated path.
12
- */
13
- export declare function filterPath(input: string): string;
14
- /**
15
- * Replace non alphanumeric chars with dashes to make the paths
16
- * comply with Posix filesystem names.
17
- *
18
- * @param {string} input A path candidate.
19
- * @returns {string} A validated path.
20
- */
21
- export declare function filterPosixPath(input: string): string;
22
- /**
23
- * Replace non alphanumeric chars with dashes to make the paths
24
- * comply with Windows filesystem names.
25
- *
26
- * @param {string} input A path candidate.
27
- * @returns {string} A validated path.
28
- */
29
- export declare function filterWin32Path(input: string): string;
30
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/utils.ts"],"names":[],"mappings":"AAmBA,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAInD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAShD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKrD"}
@@ -1,70 +0,0 @@
1
- /*
2
- * This file is part of the xPack project (http://xpack.github.io).
3
- * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software
6
- * for any purpose is hereby granted, under the terms of the MIT license.
7
- *
8
- * If a copy of the license was not distributed with this file, it can
9
- * be obtained from https://opensource.org/license/mit.
10
- */
11
- /* eslint max-len: [ "error", 80, { "ignoreUrls": true } ] */
12
- // ----------------------------------------------------------------------------
13
- import * as os from 'node:os';
14
- // ----------------------------------------------------------------------------
15
- export function isPrimitive(value) {
16
- return ((typeof value !== 'object' && typeof value !== 'function') || value === null);
17
- }
18
- export function isJsonObject(value) {
19
- return value !== undefined && !isPrimitive(value) && !Array.isArray(value);
20
- }
21
- export function isJsonArray(value) {
22
- return value !== undefined && Array.isArray(value);
23
- }
24
- export function isNonEmptyJsonObject(value) {
25
- return isJsonObject(value) && Object.keys(value).length > 0;
26
- }
27
- export function isString(value) {
28
- return typeof value === 'string';
29
- }
30
- /**
31
- * Replace non alphanumeric chars with dashes to make the paths
32
- * comply with filesystem names.
33
- *
34
- * @param {string} input A path candidate.
35
- * @returns {string} A validated path.
36
- */
37
- export function filterPath(input) {
38
- /* c8 ignore start */ /* istanbul ignore next */
39
- const fixed = os.platform() === 'win32'
40
- ? input.replace(/[^a-zA-Z0-9\\:]+/g, '-')
41
- : input.replace(/[^a-zA-Z0-9/]+/g, '-');
42
- /* c8 ignore stop */
43
- return fixed.replace(/--/g, '-');
44
- }
45
- /**
46
- * Replace non alphanumeric chars with dashes to make the paths
47
- * comply with Posix filesystem names.
48
- *
49
- * @param {string} input A path candidate.
50
- * @returns {string} A validated path.
51
- */
52
- export function filterPosixPath(input) {
53
- /* istanbul ignore next */
54
- const fixed = input.replace(/[^a-zA-Z0-9/]+/g, '-');
55
- return fixed.replace(/--/g, '-');
56
- }
57
- /**
58
- * Replace non alphanumeric chars with dashes to make the paths
59
- * comply with Windows filesystem names.
60
- *
61
- * @param {string} input A path candidate.
62
- * @returns {string} A validated path.
63
- */
64
- export function filterWin32Path(input) {
65
- /* istanbul ignore next */
66
- const fixed = input.replace(/[^a-zA-Z0-9\\:]+/g, '-');
67
- return fixed.replace(/--/g, '-');
68
- }
69
- // ----------------------------------------------------------------------------
70
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/lib/functions/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6DAA6D;AAE7D,+EAA+E;AAE/E,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,+EAA+E;AAE/E,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,CAC7E,CAAA;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC5E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AACvE,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAA;AAClC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,qBAAqB,CAAC,0BAA0B;IAChD,MAAM,KAAK,GACT,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO;QACvB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC;QACzC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IAC3C,oBAAoB;IAEpB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,0BAA0B;IAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IAEnD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,0BAA0B;IAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAA;IAErD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAED,+EAA+E"}
@@ -1,46 +0,0 @@
1
- import { Liquid } from 'liquidjs';
2
- import { Logger } from '@xpack/logger';
3
- import { XpmContext } from './types.js';
4
- export type XpmInitTemplatePropertiesDefinitions = Record<string, XpmInitTemplatePropertiesDefinition>;
5
- export interface XpmInitTemplatePropertiesDefinition {
6
- label: string;
7
- description: string;
8
- type: 'select' | 'string' | 'number' | 'boolean';
9
- items: Record<string, string | XpmInitTemplateItemValue>;
10
- isMandatory?: boolean;
11
- default?: string | number | boolean;
12
- }
13
- export type XpmInitTemplatePlatform = 'linux' | 'linux-x64' | 'linux-arm64' | 'win32' | 'darwin' | 'darwin-x64' | 'darwin-arm64';
14
- export interface XpmInitTemplateItemValue {
15
- platforms: XpmInitTemplatePlatform[];
16
- message: string;
17
- }
18
- export interface XpmInitTemplateSubstitutionsVariables {
19
- properties: Record<string, string | boolean | number>;
20
- [key: string]: unknown;
21
- }
22
- export declare abstract class XpmInitTemplateBase {
23
- context: XpmContext;
24
- log: Logger;
25
- propertiesDefinitions: XpmInitTemplatePropertiesDefinitions;
26
- __dirname: string;
27
- templatesPath: string;
28
- engine: Liquid;
29
- substitutionsVariables?: XpmInitTemplateSubstitutionsVariables;
30
- constructor({ context, __dirname, templatesPath, propertiesDefinitions, }: {
31
- context: XpmContext;
32
- __dirname: string;
33
- templatesPath: string;
34
- propertiesDefinitions: XpmInitTemplatePropertiesDefinitions;
35
- });
36
- run(): Promise<number>;
37
- abstract generate(isInteractive: boolean): Promise<void>;
38
- validateValue(name: string, value: string): string | boolean | number;
39
- askForMoreValues(): Promise<void>;
40
- isPlatformSupported(platforms: string[] | undefined): boolean;
41
- copyFile(sourceFileRelativePath: string, destinationFilePath?: string): Promise<void>;
42
- copyFolder(source: string, destination?: string): Promise<void>;
43
- copyFolderRecursive(sourceFolderPath: string, destinationFolderPath: string): Promise<void>;
44
- render(inputFileRelativePath: string, outputFileRelativePath: string, substitutionsVariables?: XpmInitTemplateSubstitutionsVariables): Promise<void>;
45
- }
46
- //# sourceMappingURL=init-template-base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-template-base.d.ts","sourceRoot":"","sources":["../../src/lib/init-template-base.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAKvC,MAAM,MAAM,oCAAoC,GAAG,MAAM,CACvD,MAAM,EACN,mCAAmC,CACpC,CAAA;AAED,MAAM,WAAW,mCAAmC;IAClD,KAAK,EAAE,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AC;IAExD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM;IAkC/D,gBAAgB;IAqEtB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO;IAgBvD,QAAQ,CACZ,sBAAsB,EAAE,MAAM,EAC9B,mBAAmB,SAAyB,GAC3C,OAAO,CAAC,IAAI,CAAC;IAaV,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/D,mBAAmB,CACvB,gBAAgB,EAAE,MAAM,EACxB,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,IAAI,CAAC;IA0BV,MAAM,CACV,qBAAqB,EAAE,MAAM,EAC7B,sBAAsB,EAAE,MAAM,EAE9B,sBAAsB,wCAA+B,GACpD,OAAO,CAAC,IAAI,CAAC;CAsBjB"}
@@ -1,281 +0,0 @@
1
- /*
2
- * This file is part of the xPack project (http://xpack.github.io).
3
- * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software
6
- * for any purpose is hereby granted, under the terms of the MIT license.
7
- *
8
- * If a copy of the license was not distributed with this file, it can
9
- * be obtained from https://opensource.org/license/mit.
10
- */
11
- /* eslint max-len: [ "error", 80, { "ignoreUrls": true } ] */
12
- // ----------------------------------------------------------------------------
13
- import assert from 'node:assert';
14
- import * as util from 'node:util';
15
- import * as readline from 'node:readline/promises';
16
- import * as path from 'node:path';
17
- import * as fs from 'node:fs/promises';
18
- // https://www.npmjs.com/package/make-dir
19
- import { makeDirectory } from 'make-dir';
20
- // https://www.npmjs.com/package/cp-file
21
- import { copyFile } from 'cp-file';
22
- // https://www.npmjs.com/package/liquidjs
23
- import { Liquid } from 'liquidjs';
24
- import { XpmOutputError, XpmSyntaxError } from './errors.js';
25
- // ----------------------------------------------------------------------------
26
- export class XpmInitTemplateBase {
27
- // --------------------------------------------------------------------------
28
- // Members.
29
- context;
30
- log;
31
- propertiesDefinitions = {};
32
- __dirname;
33
- templatesPath;
34
- engine;
35
- substitutionsVariables;
36
- // --------------------------------------------------------------------------
37
- // Constructor.
38
- constructor({ context, __dirname, templatesPath, propertiesDefinitions, }) {
39
- assert(context);
40
- assert(context.log);
41
- assert(__dirname);
42
- assert(templatesPath);
43
- assert(propertiesDefinitions);
44
- this.context = context;
45
- this.log = context.log;
46
- this.propertiesDefinitions = propertiesDefinitions;
47
- this.__dirname = __dirname;
48
- this.templatesPath = templatesPath;
49
- // https://liquidjs.com
50
- this.engine = new Liquid({
51
- root: this.templatesPath,
52
- cache: false,
53
- strictFilters: true, // default: false
54
- strictVariables: true, // default: false
55
- trimTagRight: false, // default: false
56
- trimTagLeft: false, // default: false
57
- greedy: false,
58
- });
59
- }
60
- async run() {
61
- const log = this.log;
62
- log.trace(`${this.constructor.name}.run()`);
63
- log.info();
64
- const context = this.context;
65
- const config = context.config;
66
- assert(config.properties);
67
- let isError = false;
68
- for (const [key, val] of Object.entries(config.properties)) {
69
- try {
70
- config.properties[key] = this.validateValue(key, val);
71
- }
72
- catch (err) {
73
- if (err instanceof Error) {
74
- log.error(err.message);
75
- }
76
- isError = true;
77
- }
78
- }
79
- if (isError) {
80
- throw new XpmSyntaxError();
81
- }
82
- // Properties set by `--property name=value` are in `config.properties`.
83
- // If there is at least one mandatory property without an explicit value,
84
- // enter the interactive mode and ask for the missing values.
85
- const mustAsk = Object.keys(this.propertiesDefinitions).some((key) => {
86
- return (this.propertiesDefinitions[key].isMandatory && !config.properties?.[key]);
87
- });
88
- let isInteractive;
89
- if (mustAsk) {
90
- // Need to ask for more values.
91
- if (!(process.stdin.isTTY && process.stdout.isTTY)) {
92
- throw new XpmSyntaxError('Interactive mode not possible without a TTY.');
93
- }
94
- await this.askForMoreValues();
95
- log.trace(util.inspect(config.properties));
96
- // Reset start time to skip interactive time.
97
- context.startTime = Date.now();
98
- isInteractive = true;
99
- }
100
- else {
101
- // Properties without explicit values get their defaults.
102
- Object.entries(this.propertiesDefinitions).forEach(([key, val]) => {
103
- assert(config.properties);
104
- if (!config.properties[key] && val.default) {
105
- config.properties[key] = val.default;
106
- }
107
- });
108
- isInteractive = false;
109
- }
110
- const currentTime = new Date();
111
- const substitutionsVariables = {
112
- // Spread all config properties.
113
- ...config.properties,
114
- // Also pass the properties grouped.
115
- properties: config.properties,
116
- propertiesNames: Object.keys(config.properties),
117
- projectName: config.projectName,
118
- year: currentTime.getFullYear().toString(),
119
- };
120
- this.substitutionsVariables = substitutionsVariables;
121
- await this.generate(isInteractive);
122
- return 0; // success
123
- }
124
- validateValue(name, value) {
125
- const propDef = this.propertiesDefinitions[name];
126
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
127
- if (propDef === undefined) {
128
- throw new Error(`Unsupported property '${name}'`);
129
- }
130
- if (propDef.type === 'select') {
131
- if (propDef.items[value]) {
132
- if (typeof propDef.items[value] === 'string') {
133
- return value;
134
- }
135
- else if (typeof propDef.items[value] === 'object' &&
136
- this.isPlatformSupported(propDef.items[value].platforms)) {
137
- return value;
138
- }
139
- }
140
- }
141
- else if (propDef.type === 'boolean') {
142
- if (value === 'true') {
143
- return true;
144
- }
145
- else if (value === 'false') {
146
- return false;
147
- }
148
- }
149
- else if (propDef.type === 'number') {
150
- return Number(value);
151
- }
152
- if (value === '' && propDef.default !== undefined) {
153
- return propDef.default;
154
- }
155
- throw new Error(`Unsupported value '${value}' for property '${name}'`);
156
- }
157
- async askForMoreValues() {
158
- const context = this.context;
159
- const config = context.config;
160
- assert(config.properties);
161
- const rl = readline.createInterface({
162
- input: process.stdin,
163
- output: process.stdout,
164
- });
165
- for (const name of Object.keys(this.propertiesDefinitions)) {
166
- if (config.properties[name]) {
167
- continue;
168
- }
169
- const definition = this.propertiesDefinitions[name];
170
- let prompt = `${definition.label}?`;
171
- if (definition.type === 'select') {
172
- prompt += ' (';
173
- const validItems = [];
174
- for (const [ikey, ival] of Object.entries(definition.items)) {
175
- if (typeof ival === 'string') {
176
- validItems.push(ikey);
177
- }
178
- else if (typeof ival === 'object' &&
179
- this.isPlatformSupported(ival.platforms)) {
180
- validItems.push(ikey);
181
- }
182
- }
183
- prompt += validItems.join(', ');
184
- prompt += ', ?)';
185
- }
186
- else if (definition.type === 'boolean') {
187
- prompt += ' (true, false, ?)';
188
- }
189
- if (definition.default !== undefined) {
190
- prompt += ` [${String(definition.default)}]`;
191
- }
192
- prompt += ': ';
193
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
194
- while (true) {
195
- const answer = (await rl.question(prompt)).trim();
196
- try {
197
- const value = this.validateValue(name, answer);
198
- config.properties[name] = value;
199
- break;
200
- }
201
- catch (err) {
202
- if (err instanceof Error) {
203
- this.log.trace(err.message);
204
- }
205
- console.log(definition.description);
206
- if (definition.type === 'select') {
207
- for (const [ikey, ival] of Object.entries(definition.items)) {
208
- if (typeof ival === 'string') {
209
- console.log(`- ${ikey}: ${ival}`);
210
- }
211
- else if (typeof ival === 'object' &&
212
- this.isPlatformSupported(ival.platforms)) {
213
- console.log(`- ${ikey}: ${ival.message}`);
214
- }
215
- }
216
- }
217
- }
218
- }
219
- }
220
- }
221
- isPlatformSupported(platforms) {
222
- if (!platforms || platforms.length === 0) {
223
- return false;
224
- }
225
- if (platforms.includes(`${process.platform}-${process.arch}`)) {
226
- return true;
227
- }
228
- if (platforms.includes(process.platform)) {
229
- return true;
230
- }
231
- return false;
232
- }
233
- async copyFile(sourceFileRelativePath, destinationFilePath = sourceFileRelativePath) {
234
- const log = this.log;
235
- await makeDirectory(path.dirname(destinationFilePath));
236
- const sourceFileAbsolutePath = path.resolve(this.templatesPath, sourceFileRelativePath);
237
- await copyFile(sourceFileAbsolutePath, destinationFilePath);
238
- log.info(`File '${destinationFilePath}' copied.`);
239
- }
240
- async copyFolder(source, destination = source) {
241
- const log = this.log;
242
- await this.copyFolderRecursive(path.resolve(this.templatesPath, source), path.resolve(destination));
243
- log.info(`Folder '${destination}' copied.`);
244
- }
245
- async copyFolderRecursive(sourceFolderPath, destinationFolderPath) {
246
- // const log = this.log
247
- await makeDirectory(path.dirname(destinationFolderPath));
248
- const dirents = await fs.readdir(sourceFolderPath, {
249
- withFileTypes: true,
250
- });
251
- for (const dirent of dirents) {
252
- // log.trace(dirent.name)
253
- if (dirent.isDirectory()) {
254
- await this.copyFolderRecursive(path.join(sourceFolderPath, dirent.name), path.join(destinationFolderPath, dirent.name));
255
- }
256
- else {
257
- await copyFile(path.join(sourceFolderPath, dirent.name), path.join(destinationFolderPath, dirent.name));
258
- }
259
- }
260
- }
261
- async render(inputFileRelativePath, outputFileRelativePath,
262
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
263
- substitutionsVariables = this.substitutionsVariables) {
264
- const log = this.log;
265
- log.trace(`render(${inputFileRelativePath}, ${outputFileRelativePath})`);
266
- await makeDirectory(path.dirname(outputFileRelativePath));
267
- // const headerPath = path.resolve(codePath, `${pnam}.h`)
268
- try {
269
- const fileContent = (await this.engine.renderFile(inputFileRelativePath, substitutionsVariables));
270
- await fs.writeFile(outputFileRelativePath, fileContent, 'utf8');
271
- }
272
- catch (err) {
273
- if (err instanceof Error) {
274
- throw new XpmOutputError(err.message);
275
- }
276
- }
277
- log.info(`File '${outputFileRelativePath}' generated.`);
278
- }
279
- }
280
- // ----------------------------------------------------------------------------
281
- //# sourceMappingURL=init-template-base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-template-base.js","sourceRoot":"","sources":["../../src/lib/init-template-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6DAA6D;AAE7D,+EAA+E;AAE/E,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,kBAAkB,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AAC;IAED,KAAK,CAAC,MAAM,CACV,qBAA6B,EAC7B,sBAA8B;IAC9B,oEAAoE;IACpE,yBAAyB,IAAI,CAAC,sBAAuB;QAErD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;QAEpB,GAAG,CAAC,KAAK,CAAC,UAAU,qBAAqB,KAAK,sBAAsB,GAAG,CAAC,CAAA;QAExE,MAAM,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAA;QAEzD,yDAAyD;QACzD,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAC/C,qBAAqB,EACrB,sBAAsB,CACvB,CAAW,CAAA;YAEZ,MAAM,EAAE,CAAC,SAAS,CAAC,sBAAsB,EAAE,WAAW,EAAE,MAAM,CAAC,CAAA;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;gBACzB,MAAM,IAAI,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,SAAS,sBAAsB,cAAc,CAAC,CAAA;IACzD,CAAC;CACF;AAED,+EAA+E"}
@@ -1,37 +0,0 @@
1
- import { Logger } from '@xpack/logger';
2
- import { XpmLiquidEngine } from './liquid-engine.js';
3
- import { XpmLiquidSubstitutionsVariables, XpmLiquidSubstitutionsStrings } from './substitutions-variables.js';
4
- import { JsonActions, JsonActionValue } from './types.js';
5
- export declare class XpmLiquidActions {
6
- #private;
7
- readonly log: Logger;
8
- readonly engine: XpmLiquidEngine;
9
- readonly substitutionsVariables: XpmLiquidSubstitutionsVariables;
10
- readonly jsonActions: JsonActions;
11
- constructor({ log, engine, substitutionsVariables, inheritedActionsMap, jsonActions, }: {
12
- log: Logger;
13
- engine: XpmLiquidEngine;
14
- substitutionsVariables: XpmLiquidSubstitutionsVariables;
15
- inheritedActionsMap?: Map<string, XpmLiquidAction>;
16
- jsonActions: JsonActions | undefined;
17
- });
18
- initialise(): Promise<void>;
19
- empty(): boolean;
20
- names(): string[];
21
- has(actionName: string): boolean;
22
- get(actionName: string): XpmLiquidAction;
23
- }
24
- export declare class XpmLiquidAction {
25
- #private;
26
- readonly actionName: string;
27
- readonly jsonAction: JsonActionValue;
28
- parentActions: XpmLiquidActions;
29
- matrixParameters?: XpmLiquidSubstitutionsStrings;
30
- constructor({ actionName, jsonAction, parentActions, }: {
31
- actionName: string;
32
- jsonAction: JsonActionValue;
33
- parentActions: XpmLiquidActions;
34
- });
35
- getCommands(): Promise<string[]>;
36
- }
37
- //# sourceMappingURL=liquid-actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"liquid-actions.d.ts","sourceRoot":"","sources":["../../src/lib/liquid-actions.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC9B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMzD,qBAAa,gBAAgB;;IAI3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,QAAQ,CAAC,sBAAsB,EAAE,+BAA+B,CAAA;IAChE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;gBAUrB,EACV,GAAG,EACH,MAAM,EACN,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,GACZ,EAAE;QACD,GAAG,EAAE,MAAM,CAAA;QACX,MAAM,EAAE,eAAe,CAAA;QACvB,sBAAsB,EAAE,+BAA+B,CAAA;QACvD,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;QAClD,WAAW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