@json-to-office/jto 0.30.0 → 0.31.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 (28) hide show
  1. package/dist/cli.js +28 -8
  2. package/dist/cli.js.map +1 -1
  3. package/dist/client/assets/{HomePage-DdoBbkci.js → HomePage-CUlcBMHx.js} +40 -40
  4. package/dist/client/assets/HomePage-CUlcBMHx.js.map +1 -0
  5. package/dist/client/assets/{JsonEditorPage-DzwrMvnL.js → JsonEditorPage-DTKKgR2h.js} +3 -3
  6. package/dist/client/assets/{JsonEditorPage-DzwrMvnL.js.map → JsonEditorPage-DTKKgR2h.js.map} +1 -1
  7. package/dist/client/assets/{MonacoPluginProvider-YJNcGGax.js → MonacoPluginProvider-CMMxV-i2.js} +3 -3
  8. package/dist/client/assets/{MonacoPluginProvider-YJNcGGax.js.map → MonacoPluginProvider-CMMxV-i2.js.map} +1 -1
  9. package/dist/client/assets/{button-D-eAs5li.js → button-DpZ0m-Zd.js} +2 -2
  10. package/dist/client/assets/{button-D-eAs5li.js.map → button-DpZ0m-Zd.js.map} +1 -1
  11. package/dist/client/assets/editor-gUyDUz63.js +9 -0
  12. package/dist/client/assets/editor-gUyDUz63.js.map +1 -0
  13. package/dist/client/assets/{editor-monaco-json-Cm5QFfZ9.js → editor-monaco-json-D4CMHx8D.js} +2 -2
  14. package/dist/client/assets/{editor-monaco-json-Cm5QFfZ9.js.map → editor-monaco-json-D4CMHx8D.js.map} +1 -1
  15. package/dist/client/assets/{index-Cfi2fdyV.js → index-D1wtfnMa.js} +4 -4
  16. package/dist/client/assets/index-D1wtfnMa.js.map +1 -0
  17. package/dist/client/assets/index-M8Aq8GqY.css +1 -0
  18. package/dist/client/assets/preview-CjoG7qgc.js +3 -0
  19. package/dist/client/assets/preview-CjoG7qgc.js.map +1 -0
  20. package/dist/client/index.html +2 -2
  21. package/package.json +4 -4
  22. package/dist/client/assets/HomePage-DdoBbkci.js.map +0 -1
  23. package/dist/client/assets/editor-3sZ4Fpsu.js +0 -9
  24. package/dist/client/assets/editor-3sZ4Fpsu.js.map +0 -1
  25. package/dist/client/assets/index-BdmImuIf.css +0 -1
  26. package/dist/client/assets/index-Cfi2fdyV.js.map +0 -1
  27. package/dist/client/assets/preview-CC4_sT2f.js +0 -3
  28. package/dist/client/assets/preview-CC4_sT2f.js.map +0 -1
package/dist/cli.js CHANGED
@@ -2641,14 +2641,19 @@ function createFormatRouter(adapter) {
2641
2641
  contentTypeMw,
2642
2642
  tbValidator(LooseDocumentGenerationRequestSchema),
2643
2643
  async (c) => {
2644
- const { jsonDefinition, customThemes } = getValidated(c, "json");
2644
+ const { jsonDefinition, customThemes, options } = getValidated(c, "json");
2645
2645
  const requestId = c.get("requestId");
2646
2646
  try {
2647
- assertRequestSources(jsonDefinition, "jsonDefinition");
2647
+ const baseDir = await resolveSourceBaseDir(options);
2648
+ const effectiveDefinition = await inlineDiscoveredMedia(
2649
+ jsonDefinition,
2650
+ baseDir
2651
+ );
2652
+ assertRequestSources(effectiveDefinition, "jsonDefinition");
2648
2653
  assertRequestSources(customThemes, "customThemes");
2649
2654
  let config2;
2650
2655
  try {
2651
- config2 = typeof jsonDefinition === "string" ? JSON.parse(jsonDefinition) : jsonDefinition;
2656
+ config2 = typeof effectiveDefinition === "string" ? JSON.parse(effectiveDefinition) : effectiveDefinition;
2652
2657
  } catch {
2653
2658
  throw new HTTPException4(400, {
2654
2659
  message: "jsonDefinition is not valid JSON"
@@ -2658,7 +2663,8 @@ function createFormatRouter(adapter) {
2658
2663
  if (registry.hasPlugins()) {
2659
2664
  const plugins = registry.getPlugins();
2660
2665
  const generatorResult = await adapter.createGenerator(plugins, {
2661
- theme: customThemes ? Object.values(customThemes)[0] : void 0
2666
+ customThemes,
2667
+ baseDir
2662
2668
  });
2663
2669
  if (generatorResult.getStandardDefinition) {
2664
2670
  const standardComponents = await generatorResult.getStandardDefinition(config2);
@@ -2697,6 +2703,17 @@ function createFormatRouter(adapter) {
2697
2703
  const cacheService = getContainer().get("cacheService");
2698
2704
  const stats = cacheService.getStats();
2699
2705
  const components = await adapter.getComponentCacheStats?.() ?? null;
2706
+ const rasterizer = await (async () => {
2707
+ try {
2708
+ const cli = await import("@json-to-office/jto-cli");
2709
+ const engine = await cli.getRasterizerCacheStats?.();
2710
+ if (!engine) return null;
2711
+ const prepass = await adapter.getVisualPrepassStats?.() ?? null;
2712
+ return { ...engine, ...prepass ? { prepass } : {} };
2713
+ } catch {
2714
+ return null;
2715
+ }
2716
+ })();
2700
2717
  return c.json({
2701
2718
  success: true,
2702
2719
  data: {
@@ -2708,7 +2725,8 @@ function createFormatRouter(adapter) {
2708
2725
  itemCount: stats.itemCount,
2709
2726
  enabled: stats.enabled
2710
2727
  },
2711
- ...components ? { components } : {}
2728
+ ...components ? { components } : {},
2729
+ ...rasterizer ? { rasterizer } : {}
2712
2730
  },
2713
2731
  meta: { timestamp: (/* @__PURE__ */ new Date()).toISOString() }
2714
2732
  });
@@ -2745,8 +2763,10 @@ function createFormatRouter(adapter) {
2745
2763
  try {
2746
2764
  const cacheService = getContainer().get("cacheService");
2747
2765
  cacheService.clear();
2748
- const { invalidateAllCaches } = await import("@json-to-office/jto-cli");
2749
- invalidateAllCaches();
2766
+ const cli = await import("@json-to-office/jto-cli");
2767
+ cli.invalidateAllCaches();
2768
+ await adapter.clearComponentCache?.();
2769
+ await cli.clearRasterizerCache?.();
2750
2770
  return c.json({
2751
2771
  success: true,
2752
2772
  data: { message: "Cache cleared successfully" },
@@ -4438,7 +4458,7 @@ function createDevCommand(adapter) {
4438
4458
  }
4439
4459
 
4440
4460
  // src/cli.ts
4441
- var PACKAGE_VERSION = true ? "0.30.0" : "dev-mode";
4461
+ var PACKAGE_VERSION = true ? "0.31.1" : "dev-mode";
4442
4462
  var program = new Command2();
4443
4463
  program.name("jto").description("JSON to Office CLI - Generate .docx and .pptx from JSON").version(PACKAGE_VERSION);
4444
4464
  registerCoreCommands(program, {