@superblocksteam/vite-plugin-file-sync 2.0.55 → 2.0.56-next.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.
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +394 -2303
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/examples.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/examples.js +34 -35
- package/dist/ai-service/agent/subagents/apis/examples.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/generate-api-source.d.ts +2 -8
- package/dist/ai-service/agent/subagents/apis/generate-api-source.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/generate-api-source.js +17 -46
- package/dist/ai-service/agent/subagents/apis/generate-api-source.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/prompt-builder.d.ts +0 -1
- package/dist/ai-service/agent/subagents/apis/prompt-builder.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/prompt-builder.js +4 -25
- package/dist/ai-service/agent/subagents/apis/prompt-builder.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/state.js +1 -1
- package/dist/ai-service/agent/subagents/apis/state.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/system-prompt.d.ts +1 -1
- package/dist/ai-service/agent/subagents/apis/system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/system-prompt.js +134 -173
- package/dist/ai-service/agent/subagents/apis/system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/types.d.ts +1 -4
- package/dist/ai-service/agent/subagents/apis/types.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.js +14 -31
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.d.ts +1 -6
- package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.js +12 -21
- package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/finalize-api.d.ts +2 -6
- package/dist/ai-service/agent/tools/apis/finalize-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/finalize-api.js +29 -20
- package/dist/ai-service/agent/tools/apis/finalize-api.js.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.js +4 -9
- package/dist/ai-service/agent/tools/build-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.d.ts +7 -1
- package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.js +43 -8
- package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.js +7 -9
- package/dist/ai-service/agent/tools/build-multi-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-read-files.d.ts +2 -0
- package/dist/ai-service/agent/tools/build-read-files.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-read-files.js +18 -18
- package/dist/ai-service/agent/tools/build-read-files.js.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.d.ts +11 -0
- package/dist/ai-service/agent/tools/build-rename-file.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/build-rename-file.js +103 -0
- package/dist/ai-service/agent/tools/build-rename-file.js.map +1 -0
- package/dist/ai-service/agent/tools/build-validate-icons.d.ts +0 -1
- package/dist/ai-service/agent/tools/build-validate-icons.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-validate-icons.js +0 -6
- package/dist/ai-service/agent/tools/build-validate-icons.js.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.js +5 -6
- package/dist/ai-service/agent/tools/build-write-file.js.map +1 -1
- package/dist/ai-service/agent/tools/index.d.ts +0 -10
- package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/index.js +0 -10
- package/dist/ai-service/agent/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools/shared-helpers.d.ts +1 -7
- package/dist/ai-service/agent/tools/shared-helpers.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/shared-helpers.js +9 -29
- package/dist/ai-service/agent/tools/shared-helpers.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +5 -11
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +1 -2
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +89 -67
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/explain-code-finalize.d.ts +4 -0
- package/dist/ai-service/agent/tools2/tools/explain-code-finalize.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/explain-code-finalize.js +19 -0
- package/dist/ai-service/agent/tools2/tools/explain-code-finalize.js.map +1 -0
- package/dist/ai-service/agent/tools2/tools/glob.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/glob.js +15 -6
- package/dist/ai-service/agent/tools2/tools/glob.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts +13 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js +21 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/index.d.ts +1 -0
- package/dist/ai-service/agent/tools2/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/index.js +1 -0
- package/dist/ai-service/agent/tools2/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ls.d.ts +10 -0
- package/dist/ai-service/agent/tools2/tools/ls.d.ts.map +1 -0
- package/dist/ai-service/agent/tools2/tools/ls.js +71 -0
- package/dist/ai-service/agent/tools2/tools/ls.js.map +1 -0
- package/dist/ai-service/agent/utils.d.ts +0 -35
- package/dist/ai-service/agent/utils.d.ts.map +1 -1
- package/dist/ai-service/agent/utils.js +0 -132
- package/dist/ai-service/agent/utils.js.map +1 -1
- package/dist/ai-service/app-interface/file-system-interface.d.ts +1 -1
- package/dist/ai-service/app-interface/file-system-interface.d.ts.map +1 -1
- package/dist/ai-service/app-interface/file-system-interface.js +2 -2
- package/dist/ai-service/app-interface/file-system-interface.js.map +1 -1
- package/dist/ai-service/app-interface/shell.d.ts +5 -0
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +60 -0
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +8 -1
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/clark-provider/clark-chat-settings.d.ts +2 -1
- package/dist/ai-service/clark-provider/clark-chat-settings.d.ts.map +1 -1
- package/dist/ai-service/clark-provider/clark-chat-settings.js +1 -0
- package/dist/ai-service/clark-provider/clark-chat-settings.js.map +1 -1
- package/dist/ai-service/const.d.ts +3 -7
- package/dist/ai-service/const.d.ts.map +1 -1
- package/dist/ai-service/const.js +2 -6
- package/dist/ai-service/const.js.map +1 -1
- package/dist/ai-service/context/app-context.d.ts +2 -1
- package/dist/ai-service/context/app-context.d.ts.map +1 -1
- package/dist/ai-service/context/app-context.js +9 -15
- package/dist/ai-service/context/app-context.js.map +1 -1
- package/dist/ai-service/index.d.ts +4 -4
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +168 -16
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/llm/impl/anthropic.d.ts.map +1 -1
- package/dist/ai-service/llm/impl/anthropic.js +1 -0
- package/dist/ai-service/llm/impl/anthropic.js.map +1 -1
- package/dist/ai-service/llm/impl/clark.d.ts.map +1 -1
- package/dist/ai-service/llm/impl/clark.js +1 -0
- package/dist/ai-service/llm/impl/clark.js.map +1 -1
- package/dist/ai-service/llm/provider.d.ts.map +1 -1
- package/dist/ai-service/llm/provider.js +1 -0
- package/dist/ai-service/llm/provider.js.map +1 -1
- package/dist/ai-service/llm/types.d.ts +1 -1
- package/dist/ai-service/llm/types.d.ts.map +1 -1
- package/dist/ai-service/prompt-builder-service/types.d.ts +0 -2
- package/dist/ai-service/prompt-builder-service/types.d.ts.map +1 -1
- package/dist/ai-service/prompt-builder-service/types.js.map +1 -1
- package/dist/ai-service/prompts/explain-code.d.ts +7 -0
- package/dist/ai-service/prompts/explain-code.d.ts.map +1 -0
- package/dist/ai-service/prompts/explain-code.js +23 -0
- package/dist/ai-service/prompts/explain-code.js.map +1 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts +0 -2
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.js +16 -16
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +39 -4
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/state-machine/mocks.d.ts.map +1 -1
- package/dist/ai-service/state-machine/mocks.js +1 -0
- package/dist/ai-service/state-machine/mocks.js.map +1 -1
- package/dist/ai-service/test-utils/app-generation-mocks/orders-app.d.ts +1 -1
- package/dist/ai-service/test-utils/app-generation-mocks/orders-app.d.ts.map +1 -1
- package/dist/ai-service/test-utils/app-generation-mocks/orders-app.js +0 -7
- package/dist/ai-service/test-utils/app-generation-mocks/orders-app.js.map +1 -1
- package/dist/ai-service/test-utils/app-generation-mocks/smoketest.d.ts +1 -1
- package/dist/ai-service/test-utils/app-generation-mocks/smoketest.d.ts.map +1 -1
- package/dist/ai-service/test-utils/app-generation-mocks/smoketest.js +0 -8
- package/dist/ai-service/test-utils/app-generation-mocks/smoketest.js.map +1 -1
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.d.ts.map +1 -1
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.js +0 -15
- package/dist/ai-service/transform/api-builder/to-sdk-transformer.js.map +1 -1
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.d.ts.map +1 -1
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.js +0 -13
- package/dist/ai-service/transform/api-builder/to-yaml-transformer.js.map +1 -1
- package/dist/ai-service/types.d.ts +2 -2
- package/dist/ai-service/types.d.ts.map +1 -1
- package/dist/ai-service/util/json-stream-parser.d.ts +20 -0
- package/dist/ai-service/util/json-stream-parser.d.ts.map +1 -0
- package/dist/ai-service/util/json-stream-parser.js +139 -0
- package/dist/ai-service/util/json-stream-parser.js.map +1 -0
- package/dist/binding-extraction/extract-identifiers.d.ts +1 -5
- package/dist/binding-extraction/extract-identifiers.d.ts.map +1 -1
- package/dist/binding-extraction/extract-identifiers.js +78 -15
- package/dist/binding-extraction/extract-identifiers.js.map +1 -1
- package/dist/binding-extraction/index.d.ts +1 -1
- package/dist/binding-extraction/index.d.ts.map +1 -1
- package/dist/binding-extraction/index.js +1 -1
- package/dist/binding-extraction/index.js.map +1 -1
- package/dist/binding-extraction/{extract-js-identifiers.d.ts → js-identifiers.d.ts} +2 -1
- package/dist/binding-extraction/js-identifiers.d.ts.map +1 -0
- package/dist/binding-extraction/{extract-js-identifiers.js → js-identifiers.js} +81 -1
- package/dist/binding-extraction/js-identifiers.js.map +1 -0
- package/dist/binding-extraction/python-identifiers.d.ts +13 -0
- package/dist/binding-extraction/python-identifiers.d.ts.map +1 -0
- package/dist/binding-extraction/{extract-py-identifiers.js → python-identifiers.js} +155 -1
- package/dist/binding-extraction/python-identifiers.js.map +1 -0
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +9 -15
- package/dist/codegen.js.map +1 -1
- package/dist/components-manager.d.ts +12 -13
- package/dist/components-manager.d.ts.map +1 -1
- package/dist/components-manager.js +78 -139
- package/dist/components-manager.js.map +1 -1
- package/dist/file-sync-vite-plugin.d.ts +1 -1
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +140 -361
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/file-system-helpers.d.ts +2 -2
- package/dist/file-system-helpers.d.ts.map +1 -1
- package/dist/file-system-helpers.js +6 -4
- package/dist/file-system-helpers.js.map +1 -1
- package/dist/file-system-manager.d.ts +8 -33
- package/dist/file-system-manager.d.ts.map +1 -1
- package/dist/file-system-manager.js +217 -600
- package/dist/file-system-manager.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/inject-no-select.d.ts +15 -0
- package/dist/inject-no-select.d.ts.map +1 -0
- package/dist/inject-no-select.js +173 -0
- package/dist/inject-no-select.js.map +1 -0
- package/dist/injected-index.d.ts +0 -1
- package/dist/injected-index.d.ts.map +1 -1
- package/dist/injected-index.js +0 -1
- package/dist/injected-index.js.map +1 -1
- package/dist/lock-service/activity-tracker.d.ts.map +1 -1
- package/dist/lock-service/activity-tracker.js +4 -1
- package/dist/lock-service/activity-tracker.js.map +1 -1
- package/dist/parsing/entity/to-code-entity.d.ts.map +1 -1
- package/dist/parsing/entity/to-code-entity.js +3 -4
- package/dist/parsing/entity/to-code-entity.js.map +1 -1
- package/dist/parsing/entity/to-value-entity.d.ts.map +1 -1
- package/dist/parsing/entity/to-value-entity.js +19 -13
- package/dist/parsing/entity/to-value-entity.js.map +1 -1
- package/dist/parsing/ids.d.ts +0 -1
- package/dist/parsing/ids.d.ts.map +1 -1
- package/dist/parsing/ids.js +3 -4
- package/dist/parsing/ids.js.map +1 -1
- package/dist/parsing/imports.d.ts.map +1 -1
- package/dist/parsing/imports.js +0 -10
- package/dist/parsing/imports.js.map +1 -1
- package/dist/parsing/index.d.ts +0 -1
- package/dist/parsing/index.d.ts.map +1 -1
- package/dist/parsing/index.js +0 -1
- package/dist/parsing/index.js.map +1 -1
- package/dist/parsing/jsx.d.ts.map +1 -1
- package/dist/parsing/jsx.js +50 -22
- package/dist/parsing/jsx.js.map +1 -1
- package/dist/parsing/page.d.ts +0 -1
- package/dist/parsing/page.d.ts.map +1 -1
- package/dist/parsing/page.js +55 -32
- package/dist/parsing/page.js.map +1 -1
- package/dist/parsing/properties.d.ts.map +1 -1
- package/dist/parsing/properties.js +45 -15
- package/dist/parsing/properties.js.map +1 -1
- package/dist/parsing/template/index.js +1 -1
- package/dist/parsing/template/index.js.map +1 -1
- package/dist/parsing/template/to-code-template.d.ts +1 -2
- package/dist/parsing/template/to-code-template.d.ts.map +1 -1
- package/dist/parsing/template/to-code-template.js +2 -3
- package/dist/parsing/template/to-code-template.js.map +1 -1
- package/dist/parsing/type-parsing-registry.d.ts +0 -1
- package/dist/parsing/type-parsing-registry.d.ts.map +1 -1
- package/dist/parsing/type-parsing-registry.js +0 -2
- package/dist/parsing/type-parsing-registry.js.map +1 -1
- package/dist/parsing/util.d.ts.map +1 -1
- package/dist/parsing/util.js +22 -5
- package/dist/parsing/util.js.map +1 -1
- package/dist/plugin-options.d.ts +8 -1
- package/dist/plugin-options.d.ts.map +1 -1
- package/dist/plugin-options.js.map +1 -1
- package/dist/refactor/javascript.js +1 -1
- package/dist/refactor/javascript.js.map +1 -1
- package/dist/rename-manager.d.ts.map +1 -1
- package/dist/rename-manager.js +1 -2
- package/dist/rename-manager.js.map +1 -1
- package/dist/router-parser.d.ts +35 -0
- package/dist/router-parser.d.ts.map +1 -0
- package/dist/router-parser.js +490 -0
- package/dist/router-parser.js.map +1 -0
- package/dist/socket-manager.d.ts +3 -3
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +14 -15
- package/dist/socket-manager.js.map +1 -1
- package/dist/source-tracker.d.ts +9 -77
- package/dist/source-tracker.d.ts.map +1 -1
- package/dist/source-tracker.js +84 -375
- package/dist/source-tracker.js.map +1 -1
- package/dist/util/operation-queue.d.ts +3 -0
- package/dist/util/operation-queue.d.ts.map +1 -1
- package/dist/util/operation-queue.js +5 -0
- package/dist/util/operation-queue.js.map +1 -1
- package/dist/util.d.ts +13 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +49 -28
- package/dist/util.js.map +1 -1
- package/dist/vite-plugin-yaml-types.d.ts +9 -0
- package/dist/vite-plugin-yaml-types.d.ts.map +1 -0
- package/dist/vite-plugin-yaml-types.js +114 -0
- package/dist/vite-plugin-yaml-types.js.map +1 -0
- package/package.json +8 -7
- package/dist/ai-service/agent/tools/build-add-event.d.ts +0 -14
- package/dist/ai-service/agent/tools/build-add-event.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-add-event.js +0 -44
- package/dist/ai-service/agent/tools/build-add-event.js.map +0 -1
- package/dist/ai-service/agent/tools/build-add-state-var.d.ts +0 -16
- package/dist/ai-service/agent/tools/build-add-state-var.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-add-state-var.js +0 -62
- package/dist/ai-service/agent/tools/build-add-state-var.js.map +0 -1
- package/dist/ai-service/agent/tools/build-add-timer.d.ts +0 -16
- package/dist/ai-service/agent/tools/build-add-timer.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-add-timer.js +0 -46
- package/dist/ai-service/agent/tools/build-add-timer.js.map +0 -1
- package/dist/ai-service/agent/tools/build-create-page.d.ts +0 -10
- package/dist/ai-service/agent/tools/build-create-page.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-create-page.js +0 -57
- package/dist/ai-service/agent/tools/build-create-page.js.map +0 -1
- package/dist/ai-service/agent/tools/build-list-available-components.d.ts +0 -9
- package/dist/ai-service/agent/tools/build-list-available-components.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-list-available-components.js +0 -55
- package/dist/ai-service/agent/tools/build-list-available-components.js.map +0 -1
- package/dist/ai-service/agent/tools/build-register-component-name.d.ts +0 -9
- package/dist/ai-service/agent/tools/build-register-component-name.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-register-component-name.js +0 -53
- package/dist/ai-service/agent/tools/build-register-component-name.js.map +0 -1
- package/dist/ai-service/agent/tools/build-rename-page.d.ts +0 -9
- package/dist/ai-service/agent/tools/build-rename-page.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-rename-page.js +0 -50
- package/dist/ai-service/agent/tools/build-rename-page.js.map +0 -1
- package/dist/ai-service/agent/tools/build-set-api-triggers.d.ts +0 -25
- package/dist/ai-service/agent/tools/build-set-api-triggers.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-set-api-triggers.js +0 -266
- package/dist/ai-service/agent/tools/build-set-api-triggers.js.map +0 -1
- package/dist/ai-service/agent/tools/build-update-state-var.d.ts +0 -16
- package/dist/ai-service/agent/tools/build-update-state-var.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/build-update-state-var.js +0 -67
- package/dist/ai-service/agent/tools/build-update-state-var.js.map +0 -1
- package/dist/ai-service/agent/tools/study-current-app-state.d.ts +0 -20
- package/dist/ai-service/agent/tools/study-current-app-state.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/study-current-app-state.js +0 -20
- package/dist/ai-service/agent/tools/study-current-app-state.js.map +0 -1
- package/dist/binding-extraction/extract-js-identifiers.d.ts.map +0 -1
- package/dist/binding-extraction/extract-js-identifiers.js.map +0 -1
- package/dist/binding-extraction/extract-py-identifiers.d.ts +0 -4
- package/dist/binding-extraction/extract-py-identifiers.d.ts.map +0 -1
- package/dist/binding-extraction/extract-py-identifiers.js.map +0 -1
- package/dist/component-docs-service/index.d.ts +0 -37
- package/dist/component-docs-service/index.d.ts.map +0 -1
- package/dist/component-docs-service/index.js +0 -118
- package/dist/component-docs-service/index.js.map +0 -1
- package/dist/parsing/events/index.d.ts +0 -5
- package/dist/parsing/events/index.d.ts.map +0 -1
- package/dist/parsing/events/index.js +0 -7
- package/dist/parsing/events/index.js.map +0 -1
- package/dist/parsing/events/to-code-events.d.ts +0 -3
- package/dist/parsing/events/to-code-events.d.ts.map +0 -1
- package/dist/parsing/events/to-code-events.js +0 -147
- package/dist/parsing/events/to-code-events.js.map +0 -1
- package/dist/parsing/events/to-value-events.d.ts +0 -10
- package/dist/parsing/events/to-value-events.d.ts.map +0 -1
- package/dist/parsing/events/to-value-events.js +0 -473
- package/dist/parsing/events/to-value-events.js.map +0 -1
- package/dist/parsing/scope.d.ts +0 -103
- package/dist/parsing/scope.d.ts.map +0 -1
- package/dist/parsing/scope.js +0 -902
- package/dist/parsing/scope.js.map +0 -1
- package/dist/routing.d.ts +0 -6
- package/dist/routing.d.ts.map +0 -1
- package/dist/routing.js +0 -169
- package/dist/routing.js.map +0 -1
- package/dist/sb-scope-manager.d.ts +0 -121
- package/dist/sb-scope-manager.d.ts.map +0 -1
- package/dist/sb-scope-manager.js +0 -678
- package/dist/sb-scope-manager.js.map +0 -1
|
@@ -2,29 +2,28 @@ import { writeFileSync, unlinkSync } from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { pipeline } from "node:stream/promises";
|
|
4
4
|
import { createGzip } from "node:zlib";
|
|
5
|
-
import { ViteMessageKind } from "@superblocksteam/library-shared/types";
|
|
6
5
|
import { ApiTriggerType } from "@superblocksteam/shared";
|
|
7
6
|
import bodyParser from "body-parser";
|
|
8
7
|
import { debounce } from "lodash-es";
|
|
9
8
|
import * as tar from "tar";
|
|
10
|
-
import {
|
|
9
|
+
import { extractInputsFromApi } from "./binding-extraction/extract-identifiers.js";
|
|
11
10
|
import { ImportError } from "./build-errors.js";
|
|
12
|
-
import {
|
|
13
|
-
import { ComponentsManager, getComponentSourceCode, } from "./components-manager.js";
|
|
11
|
+
import { ComponentsManager, getComponentSourceCode, getComponentSiblingSourceCode, } from "./components-manager.js";
|
|
14
12
|
import { makeServerError } from "./errors/make-server-error.js";
|
|
15
|
-
import {
|
|
13
|
+
import { isApiFilePath, SCOPE_FILE, isPageFilePath, codeModeDownloadExcludedDirectories, codeModeExcludedFiles, } from "./file-system-helpers.js";
|
|
16
14
|
import { FileSystemManager } from "./file-system-manager.js";
|
|
17
15
|
import { indexHtmlMiddleware } from "./injected-index.js";
|
|
18
16
|
import { LockServiceStatus } from "./lock-service/index.js";
|
|
19
17
|
import { getImports } from "./parsing/imports.js";
|
|
20
18
|
import { getLegacyComponentsFolder, isCustomBuildEnabled, setOptions, } from "./plugin-options.js";
|
|
21
19
|
import { createIdResolver, getFullImportPath } from "./resolver.js";
|
|
22
|
-
import {
|
|
20
|
+
import { parseRouterFile } from "./router-parser.js";
|
|
23
21
|
import { createSocketManager, disposeSocketManager } from "./socket-manager.js";
|
|
24
22
|
import { GenerationNumberSequence } from "./util/generation-number-sequence.js";
|
|
25
23
|
import { getErrorMeta, getLogger, setDefaultLogger } from "./util/logger.js";
|
|
26
|
-
import {
|
|
24
|
+
import { getAllPages } from "./util.js";
|
|
27
25
|
import { resolvedVirtualRegisteredComponentsId, virtualLegacyId, resolvedVirtualLegacyId, virtualRegisteredComponentsId, } from "./virtual-modules.js";
|
|
26
|
+
import { yamlApiTypesPlugin } from "./vite-plugin-yaml-types.js";
|
|
28
27
|
let hasStarted = false;
|
|
29
28
|
let isInitialized = false;
|
|
30
29
|
let config;
|
|
@@ -44,7 +43,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
44
43
|
const aiService = pluginParams.aiService;
|
|
45
44
|
const fsOperationQueue = pluginParams.fsOperationQueue;
|
|
46
45
|
const httpServer = pluginParams.httpServer;
|
|
47
|
-
let componentDocsService;
|
|
48
46
|
let socketManager;
|
|
49
47
|
const fileSyncManager = new FileSystemManager(fsOperationQueue, generationNumberSequence, pluginParams.tracer);
|
|
50
48
|
if (syncService) {
|
|
@@ -63,8 +61,9 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
63
61
|
await aiService.waitUntilGenerationComplete();
|
|
64
62
|
});
|
|
65
63
|
}
|
|
66
|
-
const componentsManager = ComponentsManager.setInstance(pluginParams.tracer
|
|
64
|
+
const componentsManager = ComponentsManager.setInstance(pluginParams.tracer);
|
|
67
65
|
const lastImportErrorFiles = new Set();
|
|
66
|
+
const debouncedFileUpdateHandlers = new Map();
|
|
68
67
|
const addFileTransformError = (filePath, error) => {
|
|
69
68
|
const fileTransformError = makeServerError(error, {
|
|
70
69
|
critical: false,
|
|
@@ -88,7 +87,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
88
87
|
enforce: "pre",
|
|
89
88
|
async configureServer(server) {
|
|
90
89
|
config = server.config;
|
|
91
|
-
componentDocsService = new ComponentDocsService(server.config.root);
|
|
92
90
|
// Set up Vite module invalidation callback for SyncService
|
|
93
91
|
// This ensures that when Clark writes files, Vite's module cache is invalidated
|
|
94
92
|
if (syncService) {
|
|
@@ -137,46 +135,11 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
137
135
|
]);
|
|
138
136
|
if (aiService) {
|
|
139
137
|
aiService.setSourceTracker(fileSyncManager.getSourceTracker());
|
|
140
|
-
aiService.setComponentDocsService(componentDocsService);
|
|
141
138
|
aiService.setFileSystemManager(fileSyncManager);
|
|
142
139
|
}
|
|
143
140
|
server.middlewares.use((req, res, next) => {
|
|
144
141
|
void indexHtmlMiddleware(server, pluginParams?.features)(req, res, next);
|
|
145
142
|
});
|
|
146
|
-
server.middlewares.use("/sb-init", bodyParser.json({ strict: true }));
|
|
147
|
-
server.middlewares.use("/sb-init", (req, res, next) => {
|
|
148
|
-
void (async () => {
|
|
149
|
-
if (!isInitialized) {
|
|
150
|
-
return next();
|
|
151
|
-
}
|
|
152
|
-
if (req.method !== "GET" && req.method !== "OPTIONS") {
|
|
153
|
-
res.statusCode = 405;
|
|
154
|
-
res.end("Method not allowed");
|
|
155
|
-
return res.end();
|
|
156
|
-
}
|
|
157
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
158
|
-
res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
|
|
159
|
-
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
160
|
-
if (req.method === "OPTIONS") {
|
|
161
|
-
res.statusCode = 204;
|
|
162
|
-
res.end();
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const fullUrl = new URL(req.url ?? "/", "http://localhost:5173");
|
|
166
|
-
if (!fullUrl.searchParams.get("route")) {
|
|
167
|
-
res.statusCode = 400;
|
|
168
|
-
res.end("Missing route, use ?route=/route");
|
|
169
|
-
return res.end();
|
|
170
|
-
}
|
|
171
|
-
const actualUrl = new URL(fullUrl.searchParams.get("route") ?? "/", fullUrl);
|
|
172
|
-
const files = await getAllApiDefinitions({
|
|
173
|
-
rootDir: config.root,
|
|
174
|
-
currentUrl: actualUrl.toString(),
|
|
175
|
-
});
|
|
176
|
-
res.setHeader("Content-Type", "application/json");
|
|
177
|
-
return res.end(JSON.stringify(files));
|
|
178
|
-
})();
|
|
179
|
-
});
|
|
180
143
|
server.middlewares.use("/sb-scopes", bodyParser.json({ strict: true }));
|
|
181
144
|
server.middlewares.use("/sb-scopes", (req, res, next) => {
|
|
182
145
|
void (async () => {
|
|
@@ -275,7 +238,7 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
275
238
|
lockService,
|
|
276
239
|
syncService,
|
|
277
240
|
aiService,
|
|
278
|
-
|
|
241
|
+
checkAuthorization: pluginParams.checkAuthorization,
|
|
279
242
|
tracer: pluginParams.tracer,
|
|
280
243
|
path: "/sb-updates",
|
|
281
244
|
});
|
|
@@ -312,59 +275,10 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
312
275
|
});
|
|
313
276
|
})();
|
|
314
277
|
});
|
|
315
|
-
const extractApiParamsAndDependencies = (socket) => {
|
|
316
|
-
const allApis = fileSyncManager.getApiFiles();
|
|
317
|
-
// If we do not have any APIs, we can mark the apis as loaded immediately
|
|
318
|
-
// to trigger side effects like page load events
|
|
319
|
-
if (Object.keys(allApis).length === 0) {
|
|
320
|
-
void socket.call.setApisLoaded();
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
const allApiNames = Object.values(allApis).map(({ api }) => api.apiPb.metadata.name);
|
|
324
|
-
// TODO: This logic is copied in the getApiDependencies function in the
|
|
325
|
-
// generateBuildManifestPlugin plugin.
|
|
326
|
-
//
|
|
327
|
-
// This logic should be refactored so that it can be shared between the two plugins.
|
|
328
|
-
const apiDependencyMap = {};
|
|
329
|
-
return Promise.all([
|
|
330
|
-
...Object.values(allApis).map(async ({ api, scopeId }) => {
|
|
331
|
-
const bindings = await extractIdentifierPathsFromApi(api);
|
|
332
|
-
const apiDependencies = extractApiDependencies(allApiNames, bindings);
|
|
333
|
-
apiDependencyMap[api.apiPb.metadata.name] = apiDependencies;
|
|
334
|
-
// We don't need to explicitly call setApisLoaded here because the
|
|
335
|
-
// updateApiParams call will trigger that if its not already marked as loaded
|
|
336
|
-
return socket.call.updateApiParams({
|
|
337
|
-
apiName: api.apiPb.metadata.name,
|
|
338
|
-
scopeId,
|
|
339
|
-
params: bindings,
|
|
340
|
-
apiDependencies,
|
|
341
|
-
});
|
|
342
|
-
}),
|
|
343
|
-
]).then(() => {
|
|
344
|
-
void socketManager.callEditorClients((editorClientSocket) => {
|
|
345
|
-
return editorClientSocket.call.setApiDependencies({
|
|
346
|
-
apiDependencies: apiDependencyMap,
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
};
|
|
351
|
-
socketManager.on("connect:library", (socket) => {
|
|
352
|
-
void (async () => {
|
|
353
|
-
const allApis = fileSyncManager.getApiFiles();
|
|
354
|
-
void socket.call
|
|
355
|
-
.setApiDefinitions(allApis)
|
|
356
|
-
.then(() => extractApiParamsAndDependencies(socket));
|
|
357
|
-
const tsFilePaths = fileSyncManager.getTsFilePaths();
|
|
358
|
-
void socket.call.updateLocalBindingEntities({
|
|
359
|
-
entities: Array.from(new Set(tsFilePaths.flatMap((file) => fileSyncManager.getLocalBindingEntities(file)))),
|
|
360
|
-
});
|
|
361
|
-
})();
|
|
362
|
-
});
|
|
363
278
|
const sendRootUpdate = async (path, sync = false) => {
|
|
364
279
|
const roots = await fileSyncManager.getPageRootNodes(path);
|
|
365
280
|
const scope = fileSyncManager.getScope(path);
|
|
366
281
|
if (!roots || !scope) {
|
|
367
|
-
logger?.error(`sendRootUpdate: no roots or scope ${path}`);
|
|
368
282
|
return;
|
|
369
283
|
}
|
|
370
284
|
const { scopeId } = scope;
|
|
@@ -390,49 +304,9 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
390
304
|
await syncService.uploadDirectory("multiRootUpdate");
|
|
391
305
|
}
|
|
392
306
|
};
|
|
393
|
-
const
|
|
307
|
+
const sendFileUpdate = async (_path) => {
|
|
394
308
|
const appScope = await getAppScope(fileSyncManager);
|
|
395
|
-
|
|
396
|
-
void socketManager.callEditorClients(async (socket) => {
|
|
397
|
-
await socket.call.resetScope({
|
|
398
|
-
appScope,
|
|
399
|
-
});
|
|
400
|
-
for (const api of Object.values(allApis)) {
|
|
401
|
-
void socket.call.manualUpdateApi({
|
|
402
|
-
api: {
|
|
403
|
-
...api.api,
|
|
404
|
-
scopeId: api.scopeId,
|
|
405
|
-
},
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
if (!skipLibrary) {
|
|
410
|
-
socketManager.callLibraryClients(async (socket) => {
|
|
411
|
-
void socket.call.updateApis(Object.values(allApis).map((api) => ({
|
|
412
|
-
api: api.api,
|
|
413
|
-
scopeId: api.scopeId,
|
|
414
|
-
})));
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
if (syncService) {
|
|
418
|
-
await syncService.uploadDirectory("rootReset");
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
// TODO: @damian - Check if we need both sendFileUpdate and sendEntityUpdate
|
|
422
|
-
const sendFileUpdate = async (path) => {
|
|
423
|
-
const scope = fileSyncManager.getScope(path);
|
|
424
|
-
const entities = scope?.entities ?? {};
|
|
425
|
-
const scopeId = scope?.scopeId ?? "";
|
|
426
|
-
// Check if this is an app-level file (App.tsx or root scope.ts)
|
|
427
|
-
const isAppFile = path === fileSyncManager.appFilePath;
|
|
428
|
-
const isRootScope = path === fileSyncManager.rootScopeFilePath;
|
|
429
|
-
const roots = isAppFile || isRootScope
|
|
430
|
-
? await fileSyncManager.getAppRootNodes()
|
|
431
|
-
: await fileSyncManager.getPageRootNodes(path);
|
|
432
|
-
void socketManager.callEditorClients((socket) => socket.call.updateScope({
|
|
433
|
-
scopeId,
|
|
434
|
-
updates: { entities, roots: roots ?? undefined },
|
|
435
|
-
}));
|
|
309
|
+
void socketManager.callEditorClients((socket) => socket.call.resetScope({ appScope }));
|
|
436
310
|
};
|
|
437
311
|
const sendDeleteComponentsUpdate = async (path, sourceIds) => {
|
|
438
312
|
const scope = fileSyncManager.getScope(path);
|
|
@@ -448,50 +322,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
448
322
|
})));
|
|
449
323
|
});
|
|
450
324
|
};
|
|
451
|
-
const sendDeleteEntityUpdate = async (path, entityName) => {
|
|
452
|
-
const scope = fileSyncManager.getScope(path);
|
|
453
|
-
if (!scope) {
|
|
454
|
-
console.error("No scope found for", path);
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
const { scopeId } = scope;
|
|
458
|
-
await sendEntityUpdate(path, undefined, true);
|
|
459
|
-
void socketManager.callLibraryClients((socket) => {
|
|
460
|
-
return socket.call.deleteEntities([
|
|
461
|
-
{
|
|
462
|
-
scopeId,
|
|
463
|
-
entityName,
|
|
464
|
-
},
|
|
465
|
-
]);
|
|
466
|
-
});
|
|
467
|
-
};
|
|
468
|
-
const sendEntityUpdate = async (path, _request, includeRootsUpdate = false) => {
|
|
469
|
-
const scope = fileSyncManager.getScope(path);
|
|
470
|
-
if (!scope) {
|
|
471
|
-
console.error("No scope found for", path);
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
const { entities, scopeId } = scope;
|
|
475
|
-
let roots = undefined;
|
|
476
|
-
if (includeRootsUpdate) {
|
|
477
|
-
// Check if this is an app-level file (App.tsx or root scope.ts)
|
|
478
|
-
const isAppFile = path === fileSyncManager.appFilePath;
|
|
479
|
-
const isRootScope = path === fileSyncManager.rootScopeFilePath;
|
|
480
|
-
const newRoots = isAppFile || isRootScope
|
|
481
|
-
? await fileSyncManager.getAppRootNodes()
|
|
482
|
-
: await fileSyncManager.getPageRootNodes(path);
|
|
483
|
-
if (newRoots) {
|
|
484
|
-
roots = newRoots;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
socketManager.callEditorClients((socket) => socket.call.updateScope({
|
|
488
|
-
scopeId,
|
|
489
|
-
updates: {
|
|
490
|
-
entities,
|
|
491
|
-
roots,
|
|
492
|
-
},
|
|
493
|
-
}));
|
|
494
|
-
};
|
|
495
325
|
const toApiV3Dto = (api) => {
|
|
496
326
|
const { apiPb } = api;
|
|
497
327
|
return {
|
|
@@ -523,55 +353,20 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
523
353
|
fileSyncManager.on("deleteComponents", (path, sourceIds) => {
|
|
524
354
|
void sendDeleteComponentsUpdate(path, sourceIds);
|
|
525
355
|
});
|
|
526
|
-
fileSyncManager.on("
|
|
527
|
-
void
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
});
|
|
541
|
-
fileSyncManager.on("addPage", (_, navigateTo) => {
|
|
542
|
-
void sendRootReset();
|
|
543
|
-
// Send HMR message to update routes without touching root.tsx
|
|
544
|
-
server.ws.send({
|
|
545
|
-
type: "custom",
|
|
546
|
-
event: ViteMessageKind.ROUTES_UPDATE,
|
|
547
|
-
data: {
|
|
548
|
-
routes: fileSyncManager.getRoutes(),
|
|
549
|
-
navigateTo,
|
|
550
|
-
},
|
|
551
|
-
});
|
|
552
|
-
});
|
|
553
|
-
fileSyncManager.on("deletePage", () => {
|
|
554
|
-
void sendRootReset();
|
|
555
|
-
// Send HMR message to update routes without touching root.tsx
|
|
556
|
-
server.ws.send({
|
|
557
|
-
type: "custom",
|
|
558
|
-
event: ViteMessageKind.ROUTES_UPDATE,
|
|
559
|
-
data: {
|
|
560
|
-
routes: fileSyncManager.getRoutes(),
|
|
561
|
-
navigateTo: "/",
|
|
562
|
-
},
|
|
563
|
-
});
|
|
564
|
-
});
|
|
565
|
-
fileSyncManager.on("renamePage", () => {
|
|
566
|
-
void sendRootReset();
|
|
567
|
-
// Send HMR message to update routes without touching root.tsx
|
|
568
|
-
server.ws.send({
|
|
569
|
-
type: "custom",
|
|
570
|
-
event: ViteMessageKind.ROUTES_UPDATE,
|
|
571
|
-
data: {
|
|
572
|
-
routes: fileSyncManager.getRoutes(),
|
|
573
|
-
},
|
|
574
|
-
});
|
|
356
|
+
fileSyncManager.on("routerChange", (routerFilePath) => {
|
|
357
|
+
void (async () => {
|
|
358
|
+
try {
|
|
359
|
+
logger.info("Router file changed, re-parsing routes");
|
|
360
|
+
const routes = await parseRouterFile(routerFilePath, config.root);
|
|
361
|
+
logger.info(`Routes updated: ${routes.length} routes found`);
|
|
362
|
+
// Update editor clients with new app scope
|
|
363
|
+
void sendFileUpdate(routerFilePath);
|
|
364
|
+
await syncService?.uploadDirectory(aiService?.isBusy() ? "ai:generate:interim" : "fileChanged");
|
|
365
|
+
}
|
|
366
|
+
catch (e) {
|
|
367
|
+
logger.error("Error parsing router file", getErrorMeta(e));
|
|
368
|
+
}
|
|
369
|
+
})();
|
|
575
370
|
});
|
|
576
371
|
if (aiService) {
|
|
577
372
|
fileSyncManager.on("fileChanged", debounce(() => {
|
|
@@ -587,15 +382,20 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
587
382
|
})();
|
|
588
383
|
});
|
|
589
384
|
}
|
|
385
|
+
const debouncedFileUpdate = (filePath) => {
|
|
386
|
+
let fn = debouncedFileUpdateHandlers.get(filePath);
|
|
387
|
+
if (!fn) {
|
|
388
|
+
fn = debounce(() => {
|
|
389
|
+
void sendFileUpdate(filePath);
|
|
390
|
+
}, 100, { leading: true, trailing: true, maxWait: 500 });
|
|
391
|
+
}
|
|
392
|
+
debouncedFileUpdateHandlers.set(filePath, fn);
|
|
393
|
+
fn();
|
|
394
|
+
};
|
|
590
395
|
fileSyncManager.on("fileChanged", (path, _content, isNonVisualEdit) => {
|
|
591
396
|
void (async () => {
|
|
592
|
-
void socketManager.callLibraryClients((socket) => {
|
|
593
|
-
return socket.call.updateLocalBindingEntities({
|
|
594
|
-
entities: fileSyncManager.getLocalBindingEntities(path),
|
|
595
|
-
});
|
|
596
|
-
});
|
|
597
397
|
if (isNonVisualEdit) {
|
|
598
|
-
void
|
|
398
|
+
void debouncedFileUpdate(path);
|
|
599
399
|
void socketManager.callLibraryClients((socket) => {
|
|
600
400
|
return socket.call.nonVisualEdit();
|
|
601
401
|
});
|
|
@@ -612,15 +412,23 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
612
412
|
fileSyncManager.on("apiUpdate", (payload) => {
|
|
613
413
|
void (async () => {
|
|
614
414
|
void socketManager.callLibraryClients(async (socket) => {
|
|
615
|
-
void
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
415
|
+
void socket.call.updateApis([payload]);
|
|
416
|
+
});
|
|
417
|
+
void socketManager.callEditorClients(async (socket) => {
|
|
418
|
+
if (payload.api.apiPb?.metadata?.id) {
|
|
419
|
+
const inputs = await extractInputsFromApi(payload.api);
|
|
420
|
+
void socket.call.updateApiInputs({
|
|
421
|
+
apiId: payload.api.apiPb.metadata.id,
|
|
422
|
+
inputs,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
return socket.call.manualUpdateApi({
|
|
426
|
+
api: {
|
|
427
|
+
...payload.api,
|
|
428
|
+
scopeId: payload.scopeId ?? "",
|
|
429
|
+
},
|
|
430
|
+
});
|
|
619
431
|
});
|
|
620
|
-
if (payload.api.pageName) {
|
|
621
|
-
const pagePath = getPageFilePath(config.root, payload.api.pageName);
|
|
622
|
-
void sendEntityUpdate(pagePath);
|
|
623
|
-
}
|
|
624
432
|
if (syncService) {
|
|
625
433
|
await syncService.uploadDirectory("apiUpdate");
|
|
626
434
|
}
|
|
@@ -629,50 +437,35 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
629
437
|
}
|
|
630
438
|
})();
|
|
631
439
|
});
|
|
632
|
-
// Debounce the library client update calls to prevent multiple rapid API invocations
|
|
633
|
-
// which can occur during AI generation when the API is set to execute on page load
|
|
634
|
-
const DEBOUNCE_WINDOW_MS = 300;
|
|
635
|
-
const debouncedLibraryApiUpdates = new Map();
|
|
636
|
-
const getOrCreateDebouncedLibraryApiUpdate = (apiName) => {
|
|
637
|
-
if (!debouncedLibraryApiUpdates.has(apiName)) {
|
|
638
|
-
debouncedLibraryApiUpdates.set(apiName, debounce(async (payload) => {
|
|
639
|
-
void socketManager.callLibraryClients(async (socket) => {
|
|
640
|
-
void Promise.all([
|
|
641
|
-
socket.call.updateApis([payload]),
|
|
642
|
-
extractApiParamsAndDependencies(socket),
|
|
643
|
-
]);
|
|
644
|
-
});
|
|
645
|
-
}, DEBOUNCE_WINDOW_MS, { leading: false, trailing: true }));
|
|
646
|
-
}
|
|
647
|
-
return debouncedLibraryApiUpdates.get(apiName);
|
|
648
|
-
};
|
|
649
440
|
fileSyncManager.on("apiManualUpdate", (payload, sendScopeUpdates = false) => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
441
|
+
void (async () => {
|
|
442
|
+
if (sendScopeUpdates) {
|
|
443
|
+
void sendFileUpdate(path.join(config.root, "App.tsx"));
|
|
444
|
+
}
|
|
445
|
+
if (syncService) {
|
|
446
|
+
// Use different source during AI generation to prevent individual draft commits
|
|
447
|
+
const source = aiService && aiService.isBusy()
|
|
448
|
+
? "ai:generate:interim"
|
|
449
|
+
: "apiManualUpdate";
|
|
450
|
+
void syncService.uploadDirectory(source);
|
|
451
|
+
}
|
|
452
|
+
void socketManager.callEditorClients(async (socket) => {
|
|
453
|
+
const inputs = await extractInputsFromApi(payload.api);
|
|
454
|
+
void socket.call.updateApiInputs({
|
|
455
|
+
apiId: payload.api.apiPb.metadata.id,
|
|
456
|
+
inputs,
|
|
457
|
+
});
|
|
458
|
+
return socket.call.manualUpdateApi({
|
|
459
|
+
api: {
|
|
460
|
+
...payload.api,
|
|
461
|
+
scopeId: payload.scopeId ?? "",
|
|
462
|
+
},
|
|
463
|
+
});
|
|
671
464
|
});
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
465
|
+
if (aiService) {
|
|
466
|
+
void aiService.appContext.handleApiUpdate(toApiV3Dto(payload.api));
|
|
467
|
+
}
|
|
468
|
+
})();
|
|
676
469
|
});
|
|
677
470
|
if (syncService) {
|
|
678
471
|
syncService.on("synchronizationStatusChange", (status, generationNumber) => {
|
|
@@ -713,38 +506,13 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
713
506
|
});
|
|
714
507
|
});
|
|
715
508
|
}
|
|
716
|
-
fileSyncManager.on("routesChanged", () => {
|
|
717
|
-
const rootModule = server.moduleGraph.getModuleById(path.join(config.root, "root.tsx"));
|
|
718
|
-
if (rootModule) {
|
|
719
|
-
server.moduleGraph.invalidateModule(rootModule);
|
|
720
|
-
}
|
|
721
|
-
// Send HMR message to update routes without touching root.tsx
|
|
722
|
-
server.ws.send({
|
|
723
|
-
type: "custom",
|
|
724
|
-
event: ViteMessageKind.ROUTES_UPDATE,
|
|
725
|
-
data: {
|
|
726
|
-
routes: fileSyncManager.getRoutes(),
|
|
727
|
-
},
|
|
728
|
-
});
|
|
729
|
-
});
|
|
730
509
|
fileSyncManager.on("apiDelete", (payload) => {
|
|
731
510
|
void (async () => {
|
|
732
511
|
void socketManager.callLibraryClients(async (socket) => {
|
|
733
|
-
void
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}))),
|
|
738
|
-
extractApiParamsAndDependencies(socket),
|
|
739
|
-
]);
|
|
740
|
-
// All APIs should belong to the same page but to be consistant we iterate over all APIs
|
|
741
|
-
const pageNames = new Set(payload.apis.map((api) => api.pageName));
|
|
742
|
-
if (pageNames.size > 0) {
|
|
743
|
-
pageNames.forEach((pageName) => {
|
|
744
|
-
const pagePath = getPageFilePath(config.root, pageName);
|
|
745
|
-
void sendFileUpdate(pagePath);
|
|
746
|
-
});
|
|
747
|
-
}
|
|
512
|
+
void socket.call.deleteApis(payload.apis.map((api) => ({
|
|
513
|
+
apiName: api.apiName,
|
|
514
|
+
scopeId: api.scopeId,
|
|
515
|
+
})));
|
|
748
516
|
if (syncService) {
|
|
749
517
|
await syncService.uploadDirectory("apiDelete");
|
|
750
518
|
}
|
|
@@ -759,17 +527,12 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
759
527
|
fileSyncManager.on("apiManualDelete", (payload) => {
|
|
760
528
|
void (async () => {
|
|
761
529
|
void socketManager.callLibraryClients(async (socket) => {
|
|
762
|
-
void
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
},
|
|
768
|
-
]),
|
|
769
|
-
extractApiParamsAndDependencies(socket),
|
|
530
|
+
void socket.call.deleteApis([
|
|
531
|
+
{
|
|
532
|
+
apiName: payload.api.apiName,
|
|
533
|
+
scopeId: payload.api.scopeId,
|
|
534
|
+
},
|
|
770
535
|
]);
|
|
771
|
-
const pagePath = getPageFilePath(config.root, payload.api.pageName);
|
|
772
|
-
void sendFileUpdate(pagePath);
|
|
773
536
|
});
|
|
774
537
|
void socketManager.callEditorClients((socket) => {
|
|
775
538
|
return socket.call.manualDeleteApi({
|
|
@@ -794,6 +557,16 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
794
557
|
if (aiService.isBusy()) {
|
|
795
558
|
aiService.handleUserConnected(socket, peerId);
|
|
796
559
|
}
|
|
560
|
+
const allApis = fileSyncManager.getApiFiles();
|
|
561
|
+
for (const api of Object.values(allApis)) {
|
|
562
|
+
if (api.api.apiPb?.metadata?.id) {
|
|
563
|
+
const inputs = await extractInputsFromApi(api.api);
|
|
564
|
+
void socket.call.updateApiInputs({
|
|
565
|
+
apiId: api.api.apiPb.metadata.id,
|
|
566
|
+
inputs,
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}
|
|
797
570
|
// Send any pending file transform error
|
|
798
571
|
if (pendingFileTransformError) {
|
|
799
572
|
const { filePath, error } = pendingFileTransformError;
|
|
@@ -826,18 +599,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
826
599
|
});
|
|
827
600
|
aiService.on("generationCompleted", (hasDraft) => {
|
|
828
601
|
void (async () => {
|
|
829
|
-
logger.info("Updating routes");
|
|
830
|
-
server.ws.send({
|
|
831
|
-
type: "custom",
|
|
832
|
-
event: ViteMessageKind.ROUTES_UPDATE,
|
|
833
|
-
data: {
|
|
834
|
-
routes: fileSyncManager.getRoutes(),
|
|
835
|
-
},
|
|
836
|
-
});
|
|
837
|
-
logger.info("Triggering APIs");
|
|
838
|
-
socketManager.callLibraryClients(async (socket) => {
|
|
839
|
-
await socket.call.setApisLoaded();
|
|
840
|
-
});
|
|
841
602
|
aiService.handleClearBuildSystemErrors();
|
|
842
603
|
aiService.handleClearAllRuntimeErrors();
|
|
843
604
|
// Upload directory after successful AI generation
|
|
@@ -887,21 +648,13 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
887
648
|
});
|
|
888
649
|
},
|
|
889
650
|
async transform(code, id) {
|
|
890
|
-
if (id.includes("/node_modules/")) {
|
|
651
|
+
if (id.includes("/node_modules/") || id.endsWith(".d.ts")) {
|
|
891
652
|
return;
|
|
892
653
|
}
|
|
893
654
|
const relativePath = path.relative(config.root, id);
|
|
894
655
|
if (!this.meta.watchMode)
|
|
895
656
|
return;
|
|
896
|
-
if (
|
|
897
|
-
const source = generateRootSource(code, fileSyncManager.getRoutes(), fileSyncManager.routeChange);
|
|
898
|
-
return {
|
|
899
|
-
code: source,
|
|
900
|
-
map: null,
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
else if (id.endsWith(".tsx") &&
|
|
904
|
-
!id.includes(`${getLegacyComponentsFolder()}/`)) {
|
|
657
|
+
if (id.endsWith(".tsx")) {
|
|
905
658
|
try {
|
|
906
659
|
if (!fileSyncManager.readFile(id)) {
|
|
907
660
|
return { code, map: null };
|
|
@@ -910,10 +663,31 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
910
663
|
if (!fileContents) {
|
|
911
664
|
throw new Error("File not found in file sync manager " + id);
|
|
912
665
|
}
|
|
666
|
+
if (id === fileSyncManager.routerFilePath) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
913
669
|
if (componentsManager.isCustomComponentFile(id)) {
|
|
914
|
-
const
|
|
670
|
+
const componentName = componentsManager.getComponentName(id);
|
|
671
|
+
if (!componentName) {
|
|
672
|
+
return {
|
|
673
|
+
code,
|
|
674
|
+
map: null,
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
const transformedCode = getComponentSourceCode(fileContents, componentName);
|
|
915
678
|
return {
|
|
916
|
-
code,
|
|
679
|
+
code: transformedCode,
|
|
680
|
+
map: null,
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
const isComponentFile = id.endsWith(".tsx") ||
|
|
684
|
+
id.endsWith(".jsx") ||
|
|
685
|
+
id.endsWith(".ts") ||
|
|
686
|
+
id.endsWith(".js");
|
|
687
|
+
if (isComponentFile && componentsManager.isInComponentDirectory(id)) {
|
|
688
|
+
const transformedCode = getComponentSiblingSourceCode(fileContents, path.basename(id));
|
|
689
|
+
return {
|
|
690
|
+
code: transformedCode,
|
|
917
691
|
map: null,
|
|
918
692
|
};
|
|
919
693
|
}
|
|
@@ -1040,10 +814,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
1040
814
|
if (isApiFilePath(ctx.file)) {
|
|
1041
815
|
return [];
|
|
1042
816
|
}
|
|
1043
|
-
// We do not want route changes to trigger full page reloads, we handle those internally
|
|
1044
|
-
if (ctx.file.endsWith(ROUTES_FILE)) {
|
|
1045
|
-
return [];
|
|
1046
|
-
}
|
|
1047
817
|
// if this HMR call reloads a file that an error was thrown about before,
|
|
1048
818
|
// perform a full-reload and clear the error.
|
|
1049
819
|
if (loggedViteErrors.length > 0) {
|
|
@@ -1152,8 +922,11 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
1152
922
|
},
|
|
1153
923
|
};
|
|
1154
924
|
return {
|
|
1155
|
-
plugin,
|
|
925
|
+
plugin: [plugin, yamlApiTypesPlugin(syncService, aiService)],
|
|
1156
926
|
dispose: () => {
|
|
927
|
+
// Cancel all pending debounced root updates
|
|
928
|
+
debouncedFileUpdateHandlers.forEach((fn) => fn.cancel());
|
|
929
|
+
debouncedFileUpdateHandlers.clear();
|
|
1157
930
|
disposeSocketManager();
|
|
1158
931
|
},
|
|
1159
932
|
};
|
|
@@ -1166,14 +939,20 @@ async function getAppScope(fileSyncManager) {
|
|
|
1166
939
|
for (const { name, route, fileName } of pageContents) {
|
|
1167
940
|
const roots = await fileSyncManager.getPageRootNodes(fileName);
|
|
1168
941
|
const pageScopeDef = fileSyncManager.getScope(fileName);
|
|
1169
|
-
if (roots
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
};
|
|
942
|
+
if (!roots || !pageScopeDef)
|
|
943
|
+
continue;
|
|
944
|
+
if (pages[name]) {
|
|
945
|
+
// Page already exists, add this route to its routes array
|
|
946
|
+
pages[name].routes.push(route);
|
|
947
|
+
continue;
|
|
1176
948
|
}
|
|
949
|
+
// New page, initialize with routes array
|
|
950
|
+
pages[name] = {
|
|
951
|
+
name,
|
|
952
|
+
...pageScopeDef,
|
|
953
|
+
routes: [route],
|
|
954
|
+
roots,
|
|
955
|
+
};
|
|
1177
956
|
}
|
|
1178
957
|
const appScopeDef = fileSyncManager.getScope(fileSyncManager.appFilePath);
|
|
1179
958
|
const appRoots = await fileSyncManager.getAppRootNodes();
|