@json-to-office/jto 0.32.0 → 0.33.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 (22) hide show
  1. package/dist/cli.js +22 -4
  2. package/dist/cli.js.map +1 -1
  3. package/dist/client/assets/{HomePage-CxftAvxV.js → HomePage-Cq6woGMG.js} +4 -4
  4. package/dist/client/assets/{HomePage-CxftAvxV.js.map → HomePage-Cq6woGMG.js.map} +1 -1
  5. package/dist/client/assets/{JsonEditorPage-I6sk6Db3.js → JsonEditorPage-GZV7oJD2.js} +3 -3
  6. package/dist/client/assets/{JsonEditorPage-I6sk6Db3.js.map → JsonEditorPage-GZV7oJD2.js.map} +1 -1
  7. package/dist/client/assets/{MonacoPluginProvider-kUq_bpMI.js → MonacoPluginProvider-btNzJ41o.js} +3 -3
  8. package/dist/client/assets/{MonacoPluginProvider-kUq_bpMI.js.map → MonacoPluginProvider-btNzJ41o.js.map} +1 -1
  9. package/dist/client/assets/{editor-h_FlzUyg.js → editor-Cugq4RzH.js} +2 -2
  10. package/dist/client/assets/{editor-h_FlzUyg.js.map → editor-Cugq4RzH.js.map} +1 -1
  11. package/dist/client/assets/{editor-monaco-json-DsKirQnz.js → editor-monaco-json-rhvIaBDI.js} +2 -2
  12. package/dist/client/assets/{editor-monaco-json-DsKirQnz.js.map → editor-monaco-json-rhvIaBDI.js.map} +1 -1
  13. package/dist/client/assets/{editor-refs-store-KuYpGA4M.js → editor-refs-store-DeJZ8FB9.js} +2 -2
  14. package/dist/client/assets/{editor-refs-store-KuYpGA4M.js.map → editor-refs-store-DeJZ8FB9.js.map} +1 -1
  15. package/dist/client/assets/index-C9uVroFQ.js +5 -0
  16. package/dist/client/assets/index-C9uVroFQ.js.map +1 -0
  17. package/dist/client/assets/{preview-aCcyncRa.js → preview-B_B09gpA.js} +2 -2
  18. package/dist/client/assets/{preview-aCcyncRa.js.map → preview-B_B09gpA.js.map} +1 -1
  19. package/dist/client/index.html +1 -1
  20. package/package.json +7 -7
  21. package/dist/client/assets/index-B1h-zv5O.js +0 -5
  22. package/dist/client/assets/index-B1h-zv5O.js.map +0 -1
package/dist/cli.js CHANGED
@@ -2831,10 +2831,26 @@ function cleanupTypeBoxIds(schema) {
2831
2831
  cleanupTypeBoxIds(schema[key]);
2832
2832
  });
2833
2833
  }
2834
+ async function ensurePluginsRegistered(format, pluginNames) {
2835
+ const registry = PluginRegistry3.getInstance();
2836
+ const satisfied = pluginNames ? pluginNames.every((name) => registry.getPlugin(name)) : registry.hasPlugins();
2837
+ if (satisfied) return;
2838
+ if (!pluginLoadInFlight) {
2839
+ registry.setFormat(format);
2840
+ pluginLoadInFlight = registry.discoverAndLoad().then(() => void 0).catch((error) => {
2841
+ logger.warn("On-demand plugin load for schema generation failed", {
2842
+ error: error?.message
2843
+ });
2844
+ }).finally(() => {
2845
+ pluginLoadInFlight = null;
2846
+ });
2847
+ }
2848
+ await pluginLoadInFlight;
2849
+ }
2834
2850
  function getSelectedPlugins(pluginNames) {
2835
2851
  const registry = PluginRegistry3.getInstance();
2836
2852
  if (!registry.hasPlugins()) return [];
2837
- const plugins = pluginNames?.length ? pluginNames.map((n) => registry.getPlugin(n)).filter(Boolean) : registry.getPlugins();
2853
+ const plugins = pluginNames ? pluginNames.map((n) => registry.getPlugin(n)).filter(Boolean) : registry.getPlugins();
2838
2854
  return plugins.map((plugin) => {
2839
2855
  const versions = plugin.versions || {};
2840
2856
  const versionKeys = Object.keys(versions);
@@ -2844,6 +2860,7 @@ function getSelectedPlugins(pluginNames) {
2844
2860
  });
2845
2861
  }
2846
2862
  async function generateDocumentSchema(format, pluginNames) {
2863
+ await ensurePluginsRegistered(format, pluginNames);
2847
2864
  const selected = getSelectedPlugins(pluginNames);
2848
2865
  if (format === "docx") {
2849
2866
  const shared = await import("@json-to-office/shared-docx");
@@ -2913,7 +2930,7 @@ async function generateThemeSchema(format) {
2913
2930
  description: `Theme definition for JSON to ${label} ${format === "docx" ? "documents" : "presentations"}`
2914
2931
  };
2915
2932
  }
2916
- var discoveryRouter;
2933
+ var discoveryRouter, pluginLoadInFlight;
2917
2934
  var init_discovery = __esm({
2918
2935
  "src/server/routes/discovery.ts"() {
2919
2936
  "use strict";
@@ -2921,6 +2938,7 @@ var init_discovery = __esm({
2921
2938
  init_logger();
2922
2939
  init_container();
2923
2940
  discoveryRouter = new Hono3();
2941
+ pluginLoadInFlight = null;
2924
2942
  discoveryRouter.get("/all", async (c) => {
2925
2943
  try {
2926
2944
  const format = Container.getAdapter().name;
@@ -3077,7 +3095,7 @@ var init_discovery = __esm({
3077
3095
  try {
3078
3096
  const adapter = Container.getAdapter();
3079
3097
  const pluginsParam = c.req.query("plugins");
3080
- const pluginNames = pluginsParam ? pluginsParam.split(",").filter(Boolean) : void 0;
3098
+ const pluginNames = pluginsParam !== void 0 ? pluginsParam.split(",").filter(Boolean) : void 0;
3081
3099
  const schema = await generateDocumentSchema(adapter.name, pluginNames);
3082
3100
  return c.json({ success: true, data: schema });
3083
3101
  } catch (error) {
@@ -4458,7 +4476,7 @@ function createDevCommand(adapter) {
4458
4476
  }
4459
4477
 
4460
4478
  // src/cli.ts
4461
- var PACKAGE_VERSION = true ? "0.32.0" : "dev-mode";
4479
+ var PACKAGE_VERSION = true ? "0.33.1" : "dev-mode";
4462
4480
  var program = new Command2();
4463
4481
  program.name("jto").description("JSON to Office CLI - Generate .docx and .pptx from JSON").version(PACKAGE_VERSION);
4464
4482
  registerCoreCommands(program, {