@chargebee/code-sample-generator 1.0.2 → 1.1.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 (39) hide show
  1. package/README.md +48 -0
  2. package/dist/{LanguageSwitcher-CmrCgNzs.js → TryInApiExplorer-BVv51ABv.js} +185 -178
  3. package/dist/browser.js +6 -6
  4. package/dist/code-sample-generator.css +96 -0
  5. package/dist/components/CodeBlock.d.ts +3 -1
  6. package/dist/components/CodeSamples.d.ts +1 -1
  7. package/dist/components/CopyButton.d.ts +3 -1
  8. package/dist/core/types.d.ts +1 -1
  9. package/dist/{generate-code-sample-DwenHif9.js → generate-code-sample-BxJGH1rJ.js} +11 -10
  10. package/dist/{generate-from-sample-B1Rj07T6.js → generate-from-sample-DPxmR-75.js} +6310 -4866
  11. package/dist/generated/ops/operation-ids.d.ts +2 -2
  12. package/dist/generated/ops/operation-params.d.ts +159 -18
  13. package/dist/generated/ops/v2-pcv1/cancel_a_collections_payment_promise.d.ts +3 -0
  14. package/dist/generated/ops/v2-pcv1/create_a_collections_payment_promise.d.ts +3 -0
  15. package/dist/generated/ops/v2-pcv1/list_collections_payment_promises.d.ts +3 -0
  16. package/dist/generated/ops/v2-pcv1/list_email_logs_for_a_customer.d.ts +3 -0
  17. package/dist/generated/ops/v2-pcv1/retrieve_a_payment_promise.d.ts +3 -0
  18. package/dist/generated/ops/v2-pcv1/retrieve_a_retry_segment.d.ts +3 -0
  19. package/dist/generated/ops/v2-pcv1/update_a_collections_payment_promise.d.ts +3 -0
  20. package/dist/generated/ops/v2-pcv2/cancel_a_collections_payment_promise.d.ts +3 -0
  21. package/dist/generated/ops/v2-pcv2/create_a_collections_payment_promise.d.ts +3 -0
  22. package/dist/generated/ops/v2-pcv2/create_a_price_ramp.d.ts +3 -0
  23. package/dist/generated/ops/v2-pcv2/delete_a_price_ramp.d.ts +3 -0
  24. package/dist/generated/ops/v2-pcv2/list_collections_payment_promises.d.ts +3 -0
  25. package/dist/generated/ops/v2-pcv2/list_email_logs_for_a_customer.d.ts +3 -0
  26. package/dist/generated/ops/v2-pcv2/list_price_ramps.d.ts +3 -0
  27. package/dist/generated/ops/v2-pcv2/remove_payment_schedule_scheme_from_an_invoice.d.ts +3 -0
  28. package/dist/generated/ops/v2-pcv2/retrieve_a_payment_promise.d.ts +3 -0
  29. package/dist/generated/ops/v2-pcv2/retrieve_a_price_ramp.d.ts +3 -0
  30. package/dist/generated/ops/v2-pcv2/retrieve_a_retry_segment.d.ts +3 -0
  31. package/dist/generated/ops/v2-pcv2/update_a_collections_payment_promise.d.ts +3 -0
  32. package/dist/generated/ops/v2-pcv2/update_a_price_ramp.d.ts +3 -0
  33. package/dist/generated/ops/v2-pcv2/update_overdraft_limit.d.ts +3 -0
  34. package/dist/generators/chargebee-cli.d.ts +30 -0
  35. package/dist/generators/registry.d.ts +12 -3
  36. package/dist/{highlight-code-DEB0Ig2J.js → highlight-code-WTmlHcwe.js} +11 -10
  37. package/dist/index.js +33 -33
  38. package/dist/node.js +32 -32
  39. package/package.json +9 -4
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,3 @@
1
+ import type { MinimalOperationDescriptor } from "../../../core/minimal-types";
2
+ export declare const descriptor: MinimalOperationDescriptor;
3
+ export default descriptor;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Chargebee CLI Generator - IR-based implementation.
3
+ *
4
+ * Output format:
5
+ * - `chargebee <resource> <command> [<id>]`, then ` \` and 4-space `-d` lines
6
+ * - One `-d 'key=value'` per param, with the same keys cURL sends (JSON-input
7
+ * operations included)
8
+ * - Optional `# NOTE : {{note}}` when the request has a note
9
+ * - Request headers are not rendered: the CLI has no header option
10
+ * - API v2 only
11
+ *
12
+ * Command names follow the CLI's own generator (`src/tools/generate.ts`):
13
+ * resource `_` → `-`, SDK method name camelCase → kebab-case, and a
14
+ * positional ID iff the path has a `{placeholder}`.
15
+ */
16
+ import type { IR } from "../core/ir-builder";
17
+ import type { GeneratorEntry } from "./types";
18
+ /** Same transform as the CLI's `camelToKebab`; must stay byte-for-byte compatible. */
19
+ export declare function camelToKebab(s: string): string;
20
+ /** Same quoting as the CLI's help examples (`command-help.ts` `shellQuote`). */
21
+ export declare function shellQuote(value: string): string;
22
+ /**
23
+ * Generates a Chargebee CLI command from an IR.
24
+ */
25
+ export declare function generateChargebeeCli(ir: IR): string;
26
+ /**
27
+ * Generator entry for the command registry.
28
+ */
29
+ export declare const chargebeeCliGenerator: GeneratorEntry;
30
+ export default chargebeeCliGenerator;
@@ -9,6 +9,7 @@
9
9
  * lives in index.ts and is only used by server-side build scripts.
10
10
  */
11
11
  import type { Generator, GeneratorEntry } from "./types";
12
+ export { chargebeeCliGenerator, generateChargebeeCli, } from "./chargebee-cli";
12
13
  export { curlGenerator, generateCurl } from "./curl";
13
14
  export type { DotnetOptions } from "./dotnet";
14
15
  export { dotnetGenerator, generateDotnet } from "./dotnet";
@@ -31,15 +32,23 @@ export { escapeShell, escapeSingleQuote, formatCurlKey, formatCurlValue, indent,
31
32
  */
32
33
  export declare const generatorRegistry: Record<string, GeneratorEntry>;
33
34
  /**
34
- * Get a generator by language ID.
35
+ * Registry of command-line tool generators (docs reference only).
36
+ *
37
+ * Kept apart from `generatorRegistry` so `getSupportedLanguages()` keeps
38
+ * listing SDK/HTTP languages only: the Chargebee CLI resolves its
39
+ * `--code-sample` languages from it and must not offer its own commands.
40
+ */
41
+ export declare const commandGeneratorRegistry: Record<string, GeneratorEntry>;
42
+ /**
43
+ * Get a generator by language ID (SDK/HTTP or command-line tool).
35
44
  */
36
45
  export declare function getGenerator(lang: string): Generator | undefined;
37
46
  /**
38
- * Get all supported languages.
47
+ * Get supported SDK/HTTP languages. Excludes command-line tools.
39
48
  */
40
49
  export declare function getSupportedLanguages(): string[];
41
50
  /**
42
- * Check if a generator exists for a language.
51
+ * Check if a generator exists for a language (SDK/HTTP or command-line tool).
43
52
  */
44
53
  export declare function hasGenerator(lang: string): boolean;
45
54
  export default generatorRegistry;
@@ -1,5 +1,5 @@
1
1
  import { getSingletonHighlighter } from "shiki";
2
- import { y as highlightCurlCode, k as fallbackPlainHtml, j as escapeHtml } from "./generate-from-sample-B1Rj07T6.js";
2
+ import { y as highlightCurlCode, j as fallbackPlainHtml, g as escapeHtml } from "./generate-from-sample-DPxmR-75.js";
3
3
  function hideImports() {
4
4
  return {
5
5
  name: "hide-imports",
@@ -41,6 +41,7 @@ function isBundledLanguage(id) {
41
41
  }
42
42
  const SDK_LANG_MAP = {
43
43
  curl: "curl",
44
+ "chargebee-cli": "bash",
44
45
  "node-v2": "javascript",
45
46
  "node-v3": "javascript",
46
47
  "python-v2": "python",
@@ -123,18 +124,18 @@ function resolveHighlightLanguage(language) {
123
124
  }
124
125
  const DUAL_THEME_CLASS = "cb-dual-theme";
125
126
  const DUAL_DATA_THEME = "github-light github-dark";
126
- function addFsExclude(html) {
127
+ function addMaskClass(html) {
127
128
  return html.replace(/<pre([^>]*?)>/g, (match, attrs) => {
128
- if (attrs.includes("fs-exclude")) {
129
+ if (attrs.includes("ph-mask")) {
129
130
  return match;
130
131
  }
131
132
  if (attrs.includes('class="')) {
132
- return `<pre${attrs.replace(/class="([^"]*)"/, 'class="$1 fs-exclude"')}>`;
133
+ return `<pre${attrs.replace(/class="([^"]*)"/, 'class="$1 ph-mask"')}>`;
133
134
  }
134
135
  if (attrs.includes("class=")) {
135
- return `<pre${attrs.replace(/class=([^\s>]+)/, 'class="$1 fs-exclude"')}>`;
136
+ return `<pre${attrs.replace(/class=([^\s>]+)/, 'class="$1 ph-mask"')}>`;
136
137
  }
137
- return `<pre${attrs} class="fs-exclude">`;
138
+ return `<pre${attrs} class="ph-mask">`;
138
139
  });
139
140
  }
140
141
  function stripShikiBackground(html) {
@@ -194,7 +195,7 @@ function wrapCurlHtml(inner, colorMode) {
194
195
  const curlTextColor = "var(--cb-code-text, inherit)";
195
196
  const extraClass = colorMode === "dual" ? ` ${DUAL_THEME_CLASS}` : "";
196
197
  const dataTheme = colorMode === "dual" ? ` data-theme="${DUAL_DATA_THEME}"` : "";
197
- return `<pre class="shiki fs-exclude${extraClass}"${dataTheme} style="background-color: transparent; color: ${curlTextColor}; border-radius: 0;"><code>${inner}</code></pre>`;
198
+ return `<pre class="shiki ph-mask${extraClass}"${dataTheme} style="background-color: transparent; color: ${curlTextColor}; border-radius: 0;"><code>${inner}</code></pre>`;
198
199
  }
199
200
  async function highlightCode(options) {
200
201
  const {
@@ -239,7 +240,7 @@ async function highlightCode(options) {
239
240
  transformers
240
241
  });
241
242
  highlighted = stripShikiBackground(highlighted);
242
- highlighted = addFsExclude(highlighted);
243
+ highlighted = addMaskClass(highlighted);
243
244
  const isLight = shikiTheme.toLowerCase().includes("light");
244
245
  if (isLight) {
245
246
  highlighted = applyLightPanelChrome(highlighted);
@@ -255,7 +256,7 @@ async function highlightCode(options) {
255
256
  transformers
256
257
  });
257
258
  highlighted = stripShikiBackground(highlighted);
258
- highlighted = addFsExclude(highlighted);
259
+ highlighted = addMaskClass(highlighted);
259
260
  highlighted = addDualThemeAttrs(highlighted);
260
261
  }
261
262
  } catch {
@@ -269,7 +270,7 @@ async function highlightCode(options) {
269
270
  transformers: buildTransformers(showLineNumbers, false)
270
271
  });
271
272
  highlighted = addDualThemeAttrs(
272
- addFsExclude(stripShikiBackground(fallback))
273
+ addMaskClass(stripShikiBackground(fallback))
273
274
  );
274
275
  return {
275
276
  html: highlighted,
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-CmrCgNzs.js";
2
- import { a as a2, A, C as C2, D, b as b2, L as L2, w, x, O, V, o, p, q, j, s, m, k, t, l, f, g, c as c2, e, d as d2, n, h, i, u as u2, r, v } from "./generate-from-sample-B1Rj07T6.js";
1
+ import { C, a, b, c, G, L, T, u, d } from "./TryInApiExplorer-BVv51ABv.js";
2
+ import { A, a as a2, C as C2, D, b as b2, L as L2, c as c2, x, O, V, d as d2, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u as u2, v, w } from "./generate-from-sample-DPxmR-75.js";
3
3
  import "change-case";
4
4
  import pluralize from "pluralize";
5
- import { D as D2, S, h as h2, i as i2, r as r2 } from "./highlight-code-DEB0Ig2J.js";
6
- import { L as L3, c as c3, e as e2, d as d3, f as f2, h as h3, a as a3, b as b3, g as g2 } from "./generate-code-sample-DwenHif9.js";
5
+ import { D as D2, S, h as h2, i as i2, r as r2 } from "./highlight-code-WTmlHcwe.js";
6
+ import { L as L3, e as e2, a as a3, b as b3, c as c3, f as f2, g as g2, d as d3, h as h3 } from "./generate-code-sample-BxJGH1rJ.js";
7
7
  import { existsSync, readdirSync, readFileSync } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  function addCopyButton(options = {}) {
@@ -425,8 +425,8 @@ function fetchAllRequestSamples(resource, operation, apiVersion, pcVersion) {
425
425
  }
426
426
  }
427
427
  export {
428
- a2 as AVAILABLE_LANGUAGES,
429
- A as AVAILABLE_LANGUAGE_IDS,
428
+ A as AVAILABLE_LANGUAGES,
429
+ a2 as AVAILABLE_LANGUAGE_IDS,
430
430
  C as Carousel,
431
431
  a as CodeBlock,
432
432
  C2 as CodeGenerationError,
@@ -438,7 +438,7 @@ export {
438
438
  G as GoToApiExplorer,
439
439
  L3 as LANGUAGES,
440
440
  L2 as LANGUAGE_DISPLAY_NAMES,
441
- w as LanguageNotSupportedError,
441
+ c2 as LanguageNotSupportedError,
442
442
  L as LanguageSwitcher,
443
443
  x as OpenAPIExtensions,
444
444
  O as OperationNotFoundError,
@@ -446,40 +446,40 @@ export {
446
446
  T as TryInApiExplorer,
447
447
  V as ValidationError,
448
448
  addCopyButton,
449
- o as assertValid,
450
- p as buildIR,
451
- q as compressDescriptor,
452
- c3 as enrichDescriptorWithOpenAPI,
453
- e2 as enrichDescriptorsWithOpenAPI,
454
- j as escapeHtml,
455
- s as expandDescriptor,
456
- m as extractDescriptors,
457
- d3 as extractReturnsByOperationId,
458
- f2 as extractReturnsFromOpenAPI,
459
- k as fallbackPlainHtml,
449
+ d2 as assertValid,
450
+ e as buildIR,
451
+ f as compressDescriptor,
452
+ e2 as enrichDescriptorWithOpenAPI,
453
+ a3 as enrichDescriptorsWithOpenAPI,
454
+ g as escapeHtml,
455
+ h as expandDescriptor,
456
+ i as extractDescriptors,
457
+ b3 as extractReturnsByOperationId,
458
+ c3 as extractReturnsFromOpenAPI,
459
+ j as fallbackPlainHtml,
460
460
  fetchAllRequestSamples,
461
- h3 as findOperationById,
462
- t as formatValue,
463
- a3 as generateCodeSample,
464
- b3 as generateCodeSamples,
465
- g2 as generateCodeSamplesBatch,
461
+ f2 as findOperationById,
462
+ k as formatValue,
463
+ g2 as generateCodeSample,
464
+ d3 as generateCodeSamples,
465
+ h3 as generateCodeSamplesBatch,
466
466
  l as generateFromSample,
467
467
  getDefaultOperationResponse,
468
468
  getFirstAvailableOperationResponse,
469
- f as getGenerator,
470
- g as getOperation,
471
- c2 as getOperationIds,
472
- e as getOperationIdsForVersion,
473
- d2 as getOperations,
474
- n as getSpecDescriptors,
475
- h as getSupportedLanguages,
476
- i as hasGenerator,
469
+ m as getGenerator,
470
+ n as getOperation,
471
+ o as getOperationIds,
472
+ p as getOperationIdsForVersion,
473
+ q as getOperations,
474
+ r as getSpecDescriptors,
475
+ s as getSupportedLanguages,
476
+ t as hasGenerator,
477
477
  h2 as highlightCode,
478
478
  i2 as isCurlLanguage,
479
479
  u2 as isValid,
480
- r as resolveDescriptor,
480
+ v as resolveDescriptor,
481
481
  r2 as resolveHighlightLanguage,
482
482
  u as useLanguageSelection,
483
483
  d as useSampleLoader,
484
- v as validateParams
484
+ w as validateParams
485
485
  };
package/dist/node.js CHANGED
@@ -1,48 +1,48 @@
1
- import { a, A, C, D, b, L, w, O, V, o, p, q, j, s, m, k, t, l, f, g, c, e, d, n, h, i, u, r, v } from "./generate-from-sample-B1Rj07T6.js";
2
- import { D as D2, S, h as h2, i as i2, r as r2 } from "./highlight-code-DEB0Ig2J.js";
3
- import { L as L2, c as c2, e as e2, d as d2, f as f2, h as h3, a as a2, b as b2, g as g2 } from "./generate-code-sample-DwenHif9.js";
1
+ import { A, a, C, D, b, L, c, O, V, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w } from "./generate-from-sample-DPxmR-75.js";
2
+ import { D as D2, S, h as h2, i as i2, r as r2 } from "./highlight-code-WTmlHcwe.js";
3
+ import { L as L2, e as e2, a as a2, b as b2, c as c2, f as f2, g as g2, d as d2, h as h3 } from "./generate-code-sample-BxJGH1rJ.js";
4
4
  export {
5
- a as AVAILABLE_LANGUAGES,
6
- A as AVAILABLE_LANGUAGE_IDS,
5
+ A as AVAILABLE_LANGUAGES,
6
+ a as AVAILABLE_LANGUAGE_IDS,
7
7
  C as CodeGenerationError,
8
8
  D as DEFAULT_LANGUAGE,
9
9
  b as DEFAULT_THEME,
10
10
  D2 as DOCS_LANG_ALIASES,
11
11
  L2 as LANGUAGES,
12
12
  L as LANGUAGE_DISPLAY_NAMES,
13
- w as LanguageNotSupportedError,
13
+ c as LanguageNotSupportedError,
14
14
  O as OperationNotFoundError,
15
15
  S as SDK_LANG_MAP,
16
16
  V as ValidationError,
17
- o as assertValid,
18
- p as buildIR,
19
- q as compressDescriptor,
20
- c2 as enrichDescriptorWithOpenAPI,
21
- e2 as enrichDescriptorsWithOpenAPI,
22
- j as escapeHtml,
23
- s as expandDescriptor,
24
- m as extractDescriptors,
25
- d2 as extractReturnsByOperationId,
26
- f2 as extractReturnsFromOpenAPI,
27
- k as fallbackPlainHtml,
28
- h3 as findOperationById,
29
- t as formatValue,
30
- a2 as generateCodeSample,
31
- b2 as generateCodeSamples,
32
- g2 as generateCodeSamplesBatch,
17
+ d as assertValid,
18
+ e as buildIR,
19
+ f as compressDescriptor,
20
+ e2 as enrichDescriptorWithOpenAPI,
21
+ a2 as enrichDescriptorsWithOpenAPI,
22
+ g as escapeHtml,
23
+ h as expandDescriptor,
24
+ i as extractDescriptors,
25
+ b2 as extractReturnsByOperationId,
26
+ c2 as extractReturnsFromOpenAPI,
27
+ j as fallbackPlainHtml,
28
+ f2 as findOperationById,
29
+ k as formatValue,
30
+ g2 as generateCodeSample,
31
+ d2 as generateCodeSamples,
32
+ h3 as generateCodeSamplesBatch,
33
33
  l as generateFromSample,
34
- f as getGenerator,
35
- g as getOperation,
36
- c as getOperationIds,
37
- e as getOperationIdsForVersion,
38
- d as getOperations,
39
- n as getSpecDescriptors,
40
- h as getSupportedLanguages,
41
- i as hasGenerator,
34
+ m as getGenerator,
35
+ n as getOperation,
36
+ o as getOperationIds,
37
+ p as getOperationIdsForVersion,
38
+ q as getOperations,
39
+ r as getSpecDescriptors,
40
+ s as getSupportedLanguages,
41
+ t as hasGenerator,
42
42
  h2 as highlightCode,
43
43
  i2 as isCurlLanguage,
44
44
  u as isValid,
45
- r as resolveDescriptor,
45
+ v as resolveDescriptor,
46
46
  r2 as resolveHighlightLanguage,
47
- v as validateParams
47
+ w as validateParams
48
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chargebee/code-sample-generator",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "A self-contained, reusable React component for generating and displaying API code samples from OpenAPI specifications",
6
6
  "main": "./dist/index.js",
@@ -91,11 +91,14 @@
91
91
  },
92
92
  "devDependencies": {
93
93
  "@tailwindcss/vite": "^4.1.14",
94
+ "@testing-library/react": "^16.3.1",
94
95
  "@types/node": "^24.10.0",
95
96
  "@types/pluralize": "^0.0.33",
96
97
  "@types/react": "^19.0.6",
97
98
  "@types/react-dom": "^19.0.2",
98
99
  "@vitejs/plugin-react": "^4.3.4",
100
+ "eol": "^0.10.0",
101
+ "happy-dom": "^20.14.3",
99
102
  "lucide-react": "^0.545.0",
100
103
  "prettier": "^3.4.2",
101
104
  "prettier-plugin-java": "^2.6.0",
@@ -103,27 +106,29 @@
103
106
  "react": "^19.1.1",
104
107
  "react-dom": "^19.1.1",
105
108
  "tailwindcss": "^4.1.14",
106
- "eol": "^0.10.0",
107
109
  "tsx": "^4.20.6",
108
110
  "typescript": "^5.7.3",
109
111
  "vite": "^7.1.9",
110
- "vitest": "^4.0.9",
112
+ "vitest": "^4.1.11",
111
113
  "@cb-docs-platform/openapi-utils": "0.1.0"
112
114
  },
113
115
  "scripts": {
114
116
  "dev": "vite",
115
117
  "clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\" || rm -rf dist || true",
116
- "build": "pnpm run bundle-specs && pnpm run generate && pnpm run build:lib",
118
+ "build": "pnpm run build:lib",
119
+ "build:from-specs": "pnpm run refresh:ops && pnpm run build:lib",
117
120
  "build:lib": "pnpm run clean && vite build && tsc -p tsconfig.build.json",
118
121
  "watch": "vite build --watch",
119
122
  "preview": "vite preview",
120
123
  "bundle-specs": "tsx scripts/bundle-specs.ts",
124
+ "refresh:ops": "pnpm run bundle-specs && pnpm run generate",
121
125
  "generate": "pnpm run generate:ops && pnpm run generate:operation-types",
122
126
  "generate:ops": "tsx scripts/build-ops.ts",
123
127
  "generate:operation-types": "tsx scripts/generate-operation-types.ts",
124
128
  "report:operations": "tsx scripts/generate-operations-report.ts",
125
129
  "report:view": "open reports/report-viewer.html || echo 'Open reports/report-viewer.html in your browser'",
126
130
  "test": "vitest run",
131
+ "test:from-specs": "pnpm run bundle-specs && vitest run",
127
132
  "test:watch": "vitest",
128
133
  "verify:package": "publint && node scripts/verify-public-package.mjs",
129
134
  "validate:samples": "tsx scripts/validate-samples.ts",