@superblocksteam/vite-plugin-file-sync 2.0.55 → 2.0.56-next.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.
- 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 +164 -326
- 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 +7 -33
- package/dist/file-system-manager.d.ts.map +1 -1
- package/dist/file-system-manager.js +185 -594
- 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 +83 -374
- 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
|
@@ -7,24 +7,24 @@ import { ApiTriggerType } from "@superblocksteam/shared";
|
|
|
7
7
|
import bodyParser from "body-parser";
|
|
8
8
|
import { debounce } from "lodash-es";
|
|
9
9
|
import * as tar from "tar";
|
|
10
|
-
import {
|
|
10
|
+
import { extractInputsFromApi } from "./binding-extraction/extract-identifiers.js";
|
|
11
11
|
import { ImportError } from "./build-errors.js";
|
|
12
|
-
import {
|
|
13
|
-
import { ComponentsManager, getComponentSourceCode, } from "./components-manager.js";
|
|
12
|
+
import { ComponentsManager, getComponentSourceCode, getComponentSiblingSourceCode, } from "./components-manager.js";
|
|
14
13
|
import { makeServerError } from "./errors/make-server-error.js";
|
|
15
|
-
import {
|
|
14
|
+
import { isApiFilePath, SCOPE_FILE, isPageFilePath, codeModeDownloadExcludedDirectories, codeModeExcludedFiles, } from "./file-system-helpers.js";
|
|
16
15
|
import { FileSystemManager } from "./file-system-manager.js";
|
|
17
16
|
import { indexHtmlMiddleware } from "./injected-index.js";
|
|
18
17
|
import { LockServiceStatus } from "./lock-service/index.js";
|
|
19
18
|
import { getImports } from "./parsing/imports.js";
|
|
20
19
|
import { getLegacyComponentsFolder, isCustomBuildEnabled, setOptions, } from "./plugin-options.js";
|
|
21
20
|
import { createIdResolver, getFullImportPath } from "./resolver.js";
|
|
22
|
-
import {
|
|
21
|
+
import { parseRouterFile } from "./router-parser.js";
|
|
23
22
|
import { createSocketManager, disposeSocketManager } from "./socket-manager.js";
|
|
24
23
|
import { GenerationNumberSequence } from "./util/generation-number-sequence.js";
|
|
25
24
|
import { getErrorMeta, getLogger, setDefaultLogger } from "./util/logger.js";
|
|
26
|
-
import {
|
|
25
|
+
import { getAllPages } from "./util.js";
|
|
27
26
|
import { resolvedVirtualRegisteredComponentsId, virtualLegacyId, resolvedVirtualLegacyId, virtualRegisteredComponentsId, } from "./virtual-modules.js";
|
|
27
|
+
import { yamlApiTypesPlugin } from "./vite-plugin-yaml-types.js";
|
|
28
28
|
let hasStarted = false;
|
|
29
29
|
let isInitialized = false;
|
|
30
30
|
let config;
|
|
@@ -44,7 +44,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
44
44
|
const aiService = pluginParams.aiService;
|
|
45
45
|
const fsOperationQueue = pluginParams.fsOperationQueue;
|
|
46
46
|
const httpServer = pluginParams.httpServer;
|
|
47
|
-
let componentDocsService;
|
|
48
47
|
let socketManager;
|
|
49
48
|
const fileSyncManager = new FileSystemManager(fsOperationQueue, generationNumberSequence, pluginParams.tracer);
|
|
50
49
|
if (syncService) {
|
|
@@ -63,8 +62,9 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
63
62
|
await aiService.waitUntilGenerationComplete();
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
const componentsManager = ComponentsManager.setInstance(pluginParams.tracer
|
|
65
|
+
const componentsManager = ComponentsManager.setInstance(pluginParams.tracer);
|
|
67
66
|
const lastImportErrorFiles = new Set();
|
|
67
|
+
const debouncedRootUpdateByPath = new Map();
|
|
68
68
|
const addFileTransformError = (filePath, error) => {
|
|
69
69
|
const fileTransformError = makeServerError(error, {
|
|
70
70
|
critical: false,
|
|
@@ -88,7 +88,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
88
88
|
enforce: "pre",
|
|
89
89
|
async configureServer(server) {
|
|
90
90
|
config = server.config;
|
|
91
|
-
componentDocsService = new ComponentDocsService(server.config.root);
|
|
92
91
|
// Set up Vite module invalidation callback for SyncService
|
|
93
92
|
// This ensures that when Clark writes files, Vite's module cache is invalidated
|
|
94
93
|
if (syncService) {
|
|
@@ -137,46 +136,11 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
137
136
|
]);
|
|
138
137
|
if (aiService) {
|
|
139
138
|
aiService.setSourceTracker(fileSyncManager.getSourceTracker());
|
|
140
|
-
aiService.setComponentDocsService(componentDocsService);
|
|
141
139
|
aiService.setFileSystemManager(fileSyncManager);
|
|
142
140
|
}
|
|
143
141
|
server.middlewares.use((req, res, next) => {
|
|
144
142
|
void indexHtmlMiddleware(server, pluginParams?.features)(req, res, next);
|
|
145
143
|
});
|
|
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
144
|
server.middlewares.use("/sb-scopes", bodyParser.json({ strict: true }));
|
|
181
145
|
server.middlewares.use("/sb-scopes", (req, res, next) => {
|
|
182
146
|
void (async () => {
|
|
@@ -275,7 +239,7 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
275
239
|
lockService,
|
|
276
240
|
syncService,
|
|
277
241
|
aiService,
|
|
278
|
-
|
|
242
|
+
checkAuthorization: pluginParams.checkAuthorization,
|
|
279
243
|
tracer: pluginParams.tracer,
|
|
280
244
|
path: "/sb-updates",
|
|
281
245
|
});
|
|
@@ -312,59 +276,10 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
312
276
|
});
|
|
313
277
|
})();
|
|
314
278
|
});
|
|
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
279
|
const sendRootUpdate = async (path, sync = false) => {
|
|
364
280
|
const roots = await fileSyncManager.getPageRootNodes(path);
|
|
365
281
|
const scope = fileSyncManager.getScope(path);
|
|
366
282
|
if (!roots || !scope) {
|
|
367
|
-
logger?.error(`sendRootUpdate: no roots or scope ${path}`);
|
|
368
283
|
return;
|
|
369
284
|
}
|
|
370
285
|
const { scopeId } = scope;
|
|
@@ -404,6 +319,13 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
404
319
|
scopeId: api.scopeId,
|
|
405
320
|
},
|
|
406
321
|
});
|
|
322
|
+
if (api.api.apiPb?.metadata?.id) {
|
|
323
|
+
const inputs = await extractInputsFromApi(api.api);
|
|
324
|
+
void socket.call.updateApiInputs({
|
|
325
|
+
apiId: api.api.apiPb.metadata.id,
|
|
326
|
+
inputs,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
407
329
|
}
|
|
408
330
|
});
|
|
409
331
|
if (!skipLibrary) {
|
|
@@ -418,21 +340,12 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
418
340
|
await syncService.uploadDirectory("rootReset");
|
|
419
341
|
}
|
|
420
342
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
const
|
|
426
|
-
|
|
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
|
-
}));
|
|
343
|
+
fileSyncManager.on("routerChange", () => {
|
|
344
|
+
void sendRootReset(true);
|
|
345
|
+
});
|
|
346
|
+
const sendFileUpdate = async (_path) => {
|
|
347
|
+
const appScope = await getAppScope(fileSyncManager);
|
|
348
|
+
void socketManager.callEditorClients((socket) => socket.call.resetScope({ appScope }));
|
|
436
349
|
};
|
|
437
350
|
const sendDeleteComponentsUpdate = async (path, sourceIds) => {
|
|
438
351
|
const scope = fileSyncManager.getScope(path);
|
|
@@ -448,50 +361,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
448
361
|
})));
|
|
449
362
|
});
|
|
450
363
|
};
|
|
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
364
|
const toApiV3Dto = (api) => {
|
|
496
365
|
const { apiPb } = api;
|
|
497
366
|
return {
|
|
@@ -523,55 +392,38 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
523
392
|
fileSyncManager.on("deleteComponents", (path, sourceIds) => {
|
|
524
393
|
void sendDeleteComponentsUpdate(path, sourceIds);
|
|
525
394
|
});
|
|
526
|
-
fileSyncManager.on("addEntity", (path, request) => {
|
|
527
|
-
void sendEntityUpdate(path, request);
|
|
528
|
-
});
|
|
529
|
-
fileSyncManager.on("updateEntity", (path, request) => {
|
|
530
|
-
void sendEntityUpdate(path, request);
|
|
531
|
-
});
|
|
532
|
-
fileSyncManager.on("deleteEntity", (path, entityName) => {
|
|
533
|
-
void sendDeleteEntityUpdate(path, entityName);
|
|
534
|
-
});
|
|
535
395
|
fileSyncManager.on("renameComponent", (path) => {
|
|
536
396
|
void sendFileUpdate(path);
|
|
537
397
|
});
|
|
538
398
|
fileSyncManager.on("renameEntity", (path) => {
|
|
539
399
|
void sendFileUpdate(path);
|
|
540
400
|
});
|
|
541
|
-
fileSyncManager.on("
|
|
542
|
-
void
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
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
|
-
});
|
|
401
|
+
fileSyncManager.on("routerChange", (routerFilePath) => {
|
|
402
|
+
void (async () => {
|
|
403
|
+
try {
|
|
404
|
+
logger.info("Router file changed, re-parsing routes");
|
|
405
|
+
const routes = await parseRouterFile(routerFilePath, config.root);
|
|
406
|
+
// Send HMR message to update routes in the library
|
|
407
|
+
server.ws.send({
|
|
408
|
+
type: "custom",
|
|
409
|
+
event: ViteMessageKind.ROUTES_UPDATE,
|
|
410
|
+
data: {
|
|
411
|
+
routes,
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
// Update editor clients with new app scope
|
|
415
|
+
const appScope = await getAppScope(fileSyncManager);
|
|
416
|
+
void socketManager.callEditorClients(async (socket) => {
|
|
417
|
+
await socket.call.resetScope({
|
|
418
|
+
appScope,
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
logger.info(`Routes updated: ${routes.length} routes found`);
|
|
422
|
+
}
|
|
423
|
+
catch (e) {
|
|
424
|
+
logger.error("Error parsing router file", getErrorMeta(e));
|
|
425
|
+
}
|
|
426
|
+
})();
|
|
575
427
|
});
|
|
576
428
|
if (aiService) {
|
|
577
429
|
fileSyncManager.on("fileChanged", debounce(() => {
|
|
@@ -587,15 +439,22 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
587
439
|
})();
|
|
588
440
|
});
|
|
589
441
|
}
|
|
442
|
+
const scheduleDebouncedRootUpdate = (filePath) => {
|
|
443
|
+
let fn = debouncedRootUpdateByPath.get(filePath);
|
|
444
|
+
if (!fn) {
|
|
445
|
+
fn = debounce(() => {
|
|
446
|
+
void sendRootUpdate(filePath);
|
|
447
|
+
debouncedRootUpdateByPath.delete(filePath);
|
|
448
|
+
}, 700, { leading: true, trailing: false });
|
|
449
|
+
debouncedRootUpdateByPath.set(filePath, fn);
|
|
450
|
+
}
|
|
451
|
+
fn();
|
|
452
|
+
};
|
|
590
453
|
fileSyncManager.on("fileChanged", (path, _content, isNonVisualEdit) => {
|
|
591
454
|
void (async () => {
|
|
592
|
-
void socketManager.callLibraryClients((socket) => {
|
|
593
|
-
return socket.call.updateLocalBindingEntities({
|
|
594
|
-
entities: fileSyncManager.getLocalBindingEntities(path),
|
|
595
|
-
});
|
|
596
|
-
});
|
|
597
455
|
if (isNonVisualEdit) {
|
|
598
456
|
void sendFileUpdate(path);
|
|
457
|
+
scheduleDebouncedRootUpdate(path);
|
|
599
458
|
void socketManager.callLibraryClients((socket) => {
|
|
600
459
|
return socket.call.nonVisualEdit();
|
|
601
460
|
});
|
|
@@ -612,15 +471,23 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
612
471
|
fileSyncManager.on("apiUpdate", (payload) => {
|
|
613
472
|
void (async () => {
|
|
614
473
|
void socketManager.callLibraryClients(async (socket) => {
|
|
615
|
-
void
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
474
|
+
void socket.call.updateApis([payload]);
|
|
475
|
+
});
|
|
476
|
+
void socketManager.callEditorClients(async (socket) => {
|
|
477
|
+
if (payload.api.apiPb?.metadata?.id) {
|
|
478
|
+
const inputs = await extractInputsFromApi(payload.api);
|
|
479
|
+
void socket.call.updateApiInputs({
|
|
480
|
+
apiId: payload.api.apiPb.metadata.id,
|
|
481
|
+
inputs,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
return socket.call.manualUpdateApi({
|
|
485
|
+
api: {
|
|
486
|
+
...payload.api,
|
|
487
|
+
scopeId: payload.scopeId ?? "",
|
|
488
|
+
},
|
|
489
|
+
});
|
|
619
490
|
});
|
|
620
|
-
if (payload.api.pageName) {
|
|
621
|
-
const pagePath = getPageFilePath(config.root, payload.api.pageName);
|
|
622
|
-
void sendEntityUpdate(pagePath);
|
|
623
|
-
}
|
|
624
491
|
if (syncService) {
|
|
625
492
|
await syncService.uploadDirectory("apiUpdate");
|
|
626
493
|
}
|
|
@@ -629,50 +496,35 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
629
496
|
}
|
|
630
497
|
})();
|
|
631
498
|
});
|
|
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
499
|
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
|
-
|
|
500
|
+
void (async () => {
|
|
501
|
+
if (sendScopeUpdates) {
|
|
502
|
+
void sendFileUpdate(path.join(config.root, "App.tsx"));
|
|
503
|
+
}
|
|
504
|
+
if (syncService) {
|
|
505
|
+
// Use different source during AI generation to prevent individual draft commits
|
|
506
|
+
const source = aiService && aiService.isBusy()
|
|
507
|
+
? "ai:generate:interim"
|
|
508
|
+
: "apiManualUpdate";
|
|
509
|
+
void syncService.uploadDirectory(source);
|
|
510
|
+
}
|
|
511
|
+
void socketManager.callEditorClients(async (socket) => {
|
|
512
|
+
const inputs = await extractInputsFromApi(payload.api);
|
|
513
|
+
void socket.call.updateApiInputs({
|
|
514
|
+
apiId: payload.api.apiPb.metadata.id,
|
|
515
|
+
inputs,
|
|
516
|
+
});
|
|
517
|
+
return socket.call.manualUpdateApi({
|
|
518
|
+
api: {
|
|
519
|
+
...payload.api,
|
|
520
|
+
scopeId: payload.scopeId ?? "",
|
|
521
|
+
},
|
|
522
|
+
});
|
|
671
523
|
});
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
524
|
+
if (aiService) {
|
|
525
|
+
void aiService.appContext.handleApiUpdate(toApiV3Dto(payload.api));
|
|
526
|
+
}
|
|
527
|
+
})();
|
|
676
528
|
});
|
|
677
529
|
if (syncService) {
|
|
678
530
|
syncService.on("synchronizationStatusChange", (status, generationNumber) => {
|
|
@@ -713,38 +565,13 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
713
565
|
});
|
|
714
566
|
});
|
|
715
567
|
}
|
|
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
568
|
fileSyncManager.on("apiDelete", (payload) => {
|
|
731
569
|
void (async () => {
|
|
732
570
|
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
|
-
}
|
|
571
|
+
void socket.call.deleteApis(payload.apis.map((api) => ({
|
|
572
|
+
apiName: api.apiName,
|
|
573
|
+
scopeId: api.scopeId,
|
|
574
|
+
})));
|
|
748
575
|
if (syncService) {
|
|
749
576
|
await syncService.uploadDirectory("apiDelete");
|
|
750
577
|
}
|
|
@@ -759,17 +586,12 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
759
586
|
fileSyncManager.on("apiManualDelete", (payload) => {
|
|
760
587
|
void (async () => {
|
|
761
588
|
void socketManager.callLibraryClients(async (socket) => {
|
|
762
|
-
void
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
},
|
|
768
|
-
]),
|
|
769
|
-
extractApiParamsAndDependencies(socket),
|
|
589
|
+
void socket.call.deleteApis([
|
|
590
|
+
{
|
|
591
|
+
apiName: payload.api.apiName,
|
|
592
|
+
scopeId: payload.api.scopeId,
|
|
593
|
+
},
|
|
770
594
|
]);
|
|
771
|
-
const pagePath = getPageFilePath(config.root, payload.api.pageName);
|
|
772
|
-
void sendFileUpdate(pagePath);
|
|
773
595
|
});
|
|
774
596
|
void socketManager.callEditorClients((socket) => {
|
|
775
597
|
return socket.call.manualDeleteApi({
|
|
@@ -794,6 +616,16 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
794
616
|
if (aiService.isBusy()) {
|
|
795
617
|
aiService.handleUserConnected(socket, peerId);
|
|
796
618
|
}
|
|
619
|
+
const allApis = fileSyncManager.getApiFiles();
|
|
620
|
+
for (const api of Object.values(allApis)) {
|
|
621
|
+
if (api.api.apiPb?.metadata?.id) {
|
|
622
|
+
const inputs = await extractInputsFromApi(api.api);
|
|
623
|
+
void socket.call.updateApiInputs({
|
|
624
|
+
apiId: api.api.apiPb.metadata.id,
|
|
625
|
+
inputs,
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
}
|
|
797
629
|
// Send any pending file transform error
|
|
798
630
|
if (pendingFileTransformError) {
|
|
799
631
|
const { filePath, error } = pendingFileTransformError;
|
|
@@ -826,18 +658,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
826
658
|
});
|
|
827
659
|
aiService.on("generationCompleted", (hasDraft) => {
|
|
828
660
|
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
661
|
aiService.handleClearBuildSystemErrors();
|
|
842
662
|
aiService.handleClearAllRuntimeErrors();
|
|
843
663
|
// Upload directory after successful AI generation
|
|
@@ -887,21 +707,13 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
887
707
|
});
|
|
888
708
|
},
|
|
889
709
|
async transform(code, id) {
|
|
890
|
-
if (id.includes("/node_modules/")) {
|
|
710
|
+
if (id.includes("/node_modules/") || id.endsWith(".d.ts")) {
|
|
891
711
|
return;
|
|
892
712
|
}
|
|
893
713
|
const relativePath = path.relative(config.root, id);
|
|
894
714
|
if (!this.meta.watchMode)
|
|
895
715
|
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()}/`)) {
|
|
716
|
+
if (id.endsWith(".tsx")) {
|
|
905
717
|
try {
|
|
906
718
|
if (!fileSyncManager.readFile(id)) {
|
|
907
719
|
return { code, map: null };
|
|
@@ -910,10 +722,31 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
910
722
|
if (!fileContents) {
|
|
911
723
|
throw new Error("File not found in file sync manager " + id);
|
|
912
724
|
}
|
|
725
|
+
if (id === fileSyncManager.routerFilePath) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
913
728
|
if (componentsManager.isCustomComponentFile(id)) {
|
|
914
|
-
const
|
|
729
|
+
const componentName = componentsManager.getComponentName(id);
|
|
730
|
+
if (!componentName) {
|
|
731
|
+
return {
|
|
732
|
+
code,
|
|
733
|
+
map: null,
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
const transformedCode = getComponentSourceCode(fileContents, componentName);
|
|
915
737
|
return {
|
|
916
|
-
code,
|
|
738
|
+
code: transformedCode,
|
|
739
|
+
map: null,
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
const isComponentFile = id.endsWith(".tsx") ||
|
|
743
|
+
id.endsWith(".jsx") ||
|
|
744
|
+
id.endsWith(".ts") ||
|
|
745
|
+
id.endsWith(".js");
|
|
746
|
+
if (isComponentFile && componentsManager.isInComponentDirectory(id)) {
|
|
747
|
+
const transformedCode = getComponentSiblingSourceCode(fileContents, path.basename(id));
|
|
748
|
+
return {
|
|
749
|
+
code: transformedCode,
|
|
917
750
|
map: null,
|
|
918
751
|
};
|
|
919
752
|
}
|
|
@@ -1040,10 +873,6 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
1040
873
|
if (isApiFilePath(ctx.file)) {
|
|
1041
874
|
return [];
|
|
1042
875
|
}
|
|
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
876
|
// if this HMR call reloads a file that an error was thrown about before,
|
|
1048
877
|
// perform a full-reload and clear the error.
|
|
1049
878
|
if (loggedViteErrors.length > 0) {
|
|
@@ -1152,8 +981,11 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
|
|
|
1152
981
|
},
|
|
1153
982
|
};
|
|
1154
983
|
return {
|
|
1155
|
-
plugin,
|
|
984
|
+
plugin: [plugin, yamlApiTypesPlugin(syncService, aiService)],
|
|
1156
985
|
dispose: () => {
|
|
986
|
+
// Cancel all pending debounced root updates
|
|
987
|
+
debouncedRootUpdateByPath.forEach((fn) => fn.cancel());
|
|
988
|
+
debouncedRootUpdateByPath.clear();
|
|
1157
989
|
disposeSocketManager();
|
|
1158
990
|
},
|
|
1159
991
|
};
|
|
@@ -1166,14 +998,20 @@ async function getAppScope(fileSyncManager) {
|
|
|
1166
998
|
for (const { name, route, fileName } of pageContents) {
|
|
1167
999
|
const roots = await fileSyncManager.getPageRootNodes(fileName);
|
|
1168
1000
|
const pageScopeDef = fileSyncManager.getScope(fileName);
|
|
1169
|
-
if (roots
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
};
|
|
1001
|
+
if (!roots || !pageScopeDef)
|
|
1002
|
+
continue;
|
|
1003
|
+
if (pages[name]) {
|
|
1004
|
+
// Page already exists, add this route to its routes array
|
|
1005
|
+
pages[name].routes.push(route);
|
|
1006
|
+
continue;
|
|
1176
1007
|
}
|
|
1008
|
+
// New page, initialize with routes array
|
|
1009
|
+
pages[name] = {
|
|
1010
|
+
name,
|
|
1011
|
+
...pageScopeDef,
|
|
1012
|
+
routes: [route],
|
|
1013
|
+
roots,
|
|
1014
|
+
};
|
|
1177
1015
|
}
|
|
1178
1016
|
const appScopeDef = fileSyncManager.getScope(fileSyncManager.appFilePath);
|
|
1179
1017
|
const appRoots = await fileSyncManager.getAppRootNodes();
|