openxiangda 1.0.265 → 2.0.0-alpha.2
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/README.md +11 -675
- package/bin/run.js +11 -0
- package/dist/browser/AuthoritativeSelector.d.ts +37 -0
- package/dist/browser/AuthoritativeSelector.d.ts.map +1 -0
- package/dist/browser/AuthoritativeSelector.js +357 -0
- package/dist/browser/AuthoritativeSelector.js.map +1 -0
- package/dist/browser/FilePreviewPage.d.ts +2 -0
- package/dist/browser/FilePreviewPage.d.ts.map +1 -0
- package/dist/browser/FilePreviewPage.js +191 -0
- package/dist/browser/FilePreviewPage.js.map +1 -0
- package/dist/browser/Shell.d.ts +6 -0
- package/dist/browser/Shell.d.ts.map +1 -0
- package/dist/browser/Shell.js +198 -0
- package/dist/browser/Shell.js.map +1 -0
- package/dist/browser/appearance.d.ts +12 -0
- package/dist/browser/appearance.d.ts.map +1 -0
- package/dist/browser/appearance.js +100 -0
- package/dist/browser/appearance.js.map +1 -0
- package/dist/browser/application.d.ts +8 -0
- package/dist/browser/application.d.ts.map +1 -0
- package/dist/browser/application.js +42 -0
- package/dist/browser/application.js.map +1 -0
- package/dist/browser/components/platform-fields/AddressField.d.ts +12 -0
- package/dist/browser/components/platform-fields/AddressField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/AddressField.js +179 -0
- package/dist/browser/components/platform-fields/AddressField.js.map +1 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.d.ts +9 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.js +164 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.js.map +1 -0
- package/dist/browser/components/platform-fields/CascadeField.d.ts +13 -0
- package/dist/browser/components/platform-fields/CascadeField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/CascadeField.js +14 -0
- package/dist/browser/components/platform-fields/CascadeField.js.map +1 -0
- package/dist/browser/components/platform-fields/DateTimeField.d.ts +16 -0
- package/dist/browser/components/platform-fields/DateTimeField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/DateTimeField.js +51 -0
- package/dist/browser/components/platform-fields/DateTimeField.js.map +1 -0
- package/dist/browser/components/platform-fields/JsonField.d.ts +11 -0
- package/dist/browser/components/platform-fields/JsonField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/JsonField.js +40 -0
- package/dist/browser/components/platform-fields/JsonField.js.map +1 -0
- package/dist/browser/components/platform-fields/LocationField.d.ts +11 -0
- package/dist/browser/components/platform-fields/LocationField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/LocationField.js +73 -0
- package/dist/browser/components/platform-fields/LocationField.js.map +1 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts +12 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js +269 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js.map +1 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts +12 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.js +22 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.js.map +1 -0
- package/dist/browser/components/platform-fields/RichTextField.d.ts +14 -0
- package/dist/browser/components/platform-fields/RichTextField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/RichTextField.js +214 -0
- package/dist/browser/components/platform-fields/RichTextField.js.map +1 -0
- package/dist/browser/components/platform-fields/SignatureField.d.ts +15 -0
- package/dist/browser/components/platform-fields/SignatureField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/SignatureField.js +179 -0
- package/dist/browser/components/platform-fields/SignatureField.js.map +1 -0
- package/dist/browser/components/platform-fields/SubtableField.d.ts +18 -0
- package/dist/browser/components/platform-fields/SubtableField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/SubtableField.js +236 -0
- package/dist/browser/components/platform-fields/SubtableField.js.map +1 -0
- package/dist/browser/components/platform-fields/address-value.d.ts +13 -0
- package/dist/browser/components/platform-fields/address-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/address-value.js +70 -0
- package/dist/browser/components/platform-fields/address-value.js.map +1 -0
- package/dist/browser/components/platform-fields/cascade-value.d.ts +6 -0
- package/dist/browser/components/platform-fields/cascade-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/cascade-value.js +47 -0
- package/dist/browser/components/platform-fields/cascade-value.js.map +1 -0
- package/dist/browser/components/platform-fields/directory-value.d.ts +7 -0
- package/dist/browser/components/platform-fields/directory-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/directory-value.js +35 -0
- package/dist/browser/components/platform-fields/directory-value.js.map +1 -0
- package/dist/browser/components/platform-fields/field-form-codec.d.ts +10 -0
- package/dist/browser/components/platform-fields/field-form-codec.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/field-form-codec.js +82 -0
- package/dist/browser/components/platform-fields/field-form-codec.js.map +1 -0
- package/dist/browser/components/platform-fields/location-value.d.ts +20 -0
- package/dist/browser/components/platform-fields/location-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/location-value.js +57 -0
- package/dist/browser/components/platform-fields/location-value.js.map +1 -0
- package/dist/browser/components/platform-fields/resource-query.d.ts +14 -0
- package/dist/browser/components/platform-fields/resource-query.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/resource-query.js +102 -0
- package/dist/browser/components/platform-fields/resource-query.js.map +1 -0
- package/dist/browser/components/platform-fields/rich-text-value.d.ts +12 -0
- package/dist/browser/components/platform-fields/rich-text-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/rich-text-value.js +83 -0
- package/dist/browser/components/platform-fields/rich-text-value.js.map +1 -0
- package/dist/browser/components/platform-fields/subtable-value.d.ts +31 -0
- package/dist/browser/components/platform-fields/subtable-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/subtable-value.js +120 -0
- package/dist/browser/components/platform-fields/subtable-value.js.map +1 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.d.ts +8 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.d.ts.map +1 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.js +580 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.js.map +1 -0
- package/dist/browser/components/resource/ResourceBatchActions.d.ts +25 -0
- package/dist/browser/components/resource/ResourceBatchActions.d.ts.map +1 -0
- package/dist/browser/components/resource/ResourceBatchActions.js +168 -0
- package/dist/browser/components/resource/ResourceBatchActions.js.map +1 -0
- package/dist/browser/components/resource/StandardResourcePages.d.ts +57 -0
- package/dist/browser/components/resource/StandardResourcePages.d.ts.map +1 -0
- package/dist/browser/components/resource/StandardResourcePages.js +89 -0
- package/dist/browser/components/resource/StandardResourcePages.js.map +1 -0
- package/dist/browser/components/resource/SurfaceFields.d.ts +88 -0
- package/dist/browser/components/resource/SurfaceFields.d.ts.map +1 -0
- package/dist/browser/components/resource/SurfaceFields.js +497 -0
- package/dist/browser/components/resource/SurfaceFields.js.map +1 -0
- package/dist/browser/components/resource/generated-resource-definition.d.ts +19 -0
- package/dist/browser/components/resource/generated-resource-definition.d.ts.map +1 -0
- package/dist/browser/components/resource/generated-resource-definition.js +2 -0
- package/dist/browser/components/resource/generated-resource-definition.js.map +1 -0
- package/dist/browser/components/resource/resource-import.d.ts +15 -0
- package/dist/browser/components/resource/resource-import.d.ts.map +1 -0
- package/dist/browser/components/resource/resource-import.js +197 -0
- package/dist/browser/components/resource/resource-import.js.map +1 -0
- package/dist/browser/data-provider.d.ts +4 -0
- package/dist/browser/data-provider.d.ts.map +1 -0
- package/dist/browser/data-provider.js +45 -0
- package/dist/browser/data-provider.js.map +1 -0
- package/dist/browser/platform-client.d.ts +81 -0
- package/dist/browser/platform-client.d.ts.map +1 -0
- package/dist/browser/platform-client.js +422 -0
- package/dist/browser/platform-client.js.map +1 -0
- package/dist/browser/resource-definitions.d.ts +8 -0
- package/dist/browser/resource-definitions.d.ts.map +1 -0
- package/dist/browser/resource-definitions.js +14 -0
- package/dist/browser/resource-definitions.js.map +1 -0
- package/dist/browser/runtime-meta.d.ts +22 -0
- package/dist/browser/runtime-meta.d.ts.map +1 -0
- package/dist/browser/runtime-meta.js +79 -0
- package/dist/browser/runtime-meta.js.map +1 -0
- package/dist/browser/runtime.d.ts +13 -0
- package/dist/browser/runtime.d.ts.map +1 -0
- package/dist/browser/runtime.js +47 -0
- package/dist/browser/runtime.js.map +1 -0
- package/dist/browser/styles.css +1941 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +6 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -0
- package/dist/field-kit.d.ts +22 -0
- package/dist/field-kit.d.ts.map +1 -0
- package/dist/field-kit.js +22 -0
- package/dist/field-kit.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/nest.d.ts +10 -0
- package/dist/nest.d.ts.map +1 -0
- package/dist/nest.js +9 -0
- package/dist/nest.js.map +1 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +11 -0
- package/dist/react.js.map +1 -0
- package/dist/testing.d.ts +4 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +4 -0
- package/dist/testing.js.map +1 -0
- package/package.json +95 -200
- package/skills/manifest.json +10 -0
- package/skills/openxiangda-v2/SKILL.md +55 -0
- package/skills/openxiangda-v2/references/architecture.md +7 -0
- package/skills/openxiangda-v2/references/backend.md +116 -0
- package/skills/openxiangda-v2/references/data-authz.md +93 -0
- package/skills/openxiangda-v2/references/delivery.md +11 -0
- package/skills/openxiangda-v2/references/discovery.md +15 -0
- package/skills/openxiangda-v2/references/frontend.md +10 -0
- package/skills/openxiangda-v2/references/testing.md +16 -0
- package/skills/openxiangda-v2/references/workflow-notification.md +69 -0
- package/skills/openxiangda-v2/references/workspace.md +21 -0
- package/bin/openxiangda.js +0 -26
- package/lib/app-function-invoke.js +0 -28
- package/lib/application-environments.js +0 -1134
- package/lib/change-baseline.js +0 -1359
- package/lib/cli.js +0 -31084
- package/lib/config.js +0 -450
- package/lib/content-cache.js +0 -97
- package/lib/delivery-v2-cli.js +0 -329
- package/lib/delivery-v2-executor.js +0 -1703
- package/lib/delivery-v2-package.js +0 -1176
- package/lib/dependency-capsule.js +0 -246
- package/lib/design-gates.js +0 -668
- package/lib/design-review.js +0 -220
- package/lib/developer-center.js +0 -160
- package/lib/form-field-contract.js +0 -79
- package/lib/form-schema-loader.js +0 -181
- package/lib/git-remote-identity.js +0 -89
- package/lib/http.js +0 -196
- package/lib/integration-bundle.js +0 -225
- package/lib/js-code-build.js +0 -175
- package/lib/open-api.js +0 -256
- package/lib/policy.js +0 -137
- package/lib/publish-context.js +0 -98
- package/lib/publish-lease-heartbeat.js +0 -182
- package/lib/publish-lease.js +0 -221
- package/lib/release-error-classification.js +0 -41
- package/lib/release-explain.js +0 -75
- package/lib/release-mainline.js +0 -654
- package/lib/release-plan.js +0 -550
- package/lib/release-telemetry.js +0 -182
- package/lib/resource-binding-contract.js +0 -210
- package/lib/role-resolution.js +0 -57
- package/lib/runtime-lineage.js +0 -326
- package/lib/sdd.js +0 -3306
- package/lib/skills.js +0 -453
- package/lib/source-dependencies.js +0 -921
- package/lib/task-status.js +0 -330
- package/lib/utils.js +0 -178
- package/lib/workspace-bootstrap.js +0 -268
- package/lib/workspace-init.js +0 -202
- package/lib/worktree-cleanup.js +0 -631
- package/lib/worktree-owner.js +0 -354
- package/openxiangda-skills/SKILL.md +0 -229
- package/openxiangda-skills/references/architecture-design.md +0 -409
- package/openxiangda-skills/references/architecture-patterns.md +0 -264
- package/openxiangda-skills/references/automation-v3.md +0 -349
- package/openxiangda-skills/references/best-practices.md +0 -272
- package/openxiangda-skills/references/component-guide.md +0 -287
- package/openxiangda-skills/references/connector-resources.md +0 -80
- package/openxiangda-skills/references/data-views.md +0 -360
- package/openxiangda-skills/references/forms/component-registry.md +0 -90
- package/openxiangda-skills/references/forms/form-schema.md +0 -146
- package/openxiangda-skills/references/forms/layout-and-rules.md +0 -24
- package/openxiangda-skills/references/notifications.md +0 -227
- package/openxiangda-skills/references/openxiangda-api.md +0 -971
- package/openxiangda-skills/references/pages/app-shell.md +0 -66
- package/openxiangda-skills/references/pages/page-sdk.md +0 -401
- package/openxiangda-skills/references/pages/publish-flow.md +0 -84
- package/openxiangda-skills/references/pages/workspace-structure.md +0 -41
- package/openxiangda-skills/references/permission-design-patterns.md +0 -313
- package/openxiangda-skills/references/permissions-settings.md +0 -468
- package/openxiangda-skills/references/platform-data-model.md +0 -340
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +0 -936
- package/openxiangda-skills/references/school-contact-relations.md +0 -242
- package/openxiangda-skills/references/style-system.md +0 -218
- package/openxiangda-skills/references/troubleshooting.md +0 -271
- package/openxiangda-skills/references/workflow-v3.md +0 -441
- package/openxiangda-skills/references/workspace-state.md +0 -115
- package/openxiangda-skills/skills/openxiangda-app/SKILL.md +0 -118
- package/openxiangda-skills/skills/openxiangda-architecture-design/SKILL.md +0 -137
- package/openxiangda-skills/skills/openxiangda-core/SKILL.md +0 -222
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +0 -184
- package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +0 -63
- package/openxiangda-skills/skills/openxiangda-open-api/SKILL.md +0 -57
- package/openxiangda-skills/skills/openxiangda-open-api/agents/openai.yaml +0 -4
- package/openxiangda-skills/skills/openxiangda-open-api/references/backend-authentication.md +0 -63
- package/openxiangda-skills/skills/openxiangda-open-api/references/dingtalk-api.openapi.json +0 -15653
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +0 -154
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +0 -209
- package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +0 -201
- package/packages/sdk/bin/lowcode-workspace.mjs +0 -4
- package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.mts +0 -1292
- package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.ts +0 -1292
- package/packages/sdk/dist/build/index.cjs +0 -1
- package/packages/sdk/dist/build/index.d.mts +0 -60
- package/packages/sdk/dist/build/index.d.ts +0 -60
- package/packages/sdk/dist/build/index.mjs +0 -1
- package/packages/sdk/dist/components/index.cjs +0 -148
- package/packages/sdk/dist/components/index.d.mts +0 -970
- package/packages/sdk/dist/components/index.d.ts +0 -970
- package/packages/sdk/dist/components/index.mjs +0 -148
- package/packages/sdk/dist/dataManagementApi-Ro9itwm8.d.ts +0 -142
- package/packages/sdk/dist/dataManagementApi-p_HOhQnA.d.mts +0 -142
- package/packages/sdk/dist/runtime/index.cjs +0 -148
- package/packages/sdk/dist/runtime/index.d.mts +0 -171
- package/packages/sdk/dist/runtime/index.d.ts +0 -171
- package/packages/sdk/dist/runtime/index.mjs +0 -148
- package/packages/sdk/dist/runtime/react.cjs +0 -148
- package/packages/sdk/dist/runtime/react.d.mts +0 -3209
- package/packages/sdk/dist/runtime/react.d.ts +0 -3209
- package/packages/sdk/dist/runtime/react.mjs +0 -148
- package/packages/sdk/dist/styles/antd-theme.cjs +0 -1
- package/packages/sdk/dist/styles/antd-theme.d.mts +0 -6
- package/packages/sdk/dist/styles/antd-theme.d.ts +0 -6
- package/packages/sdk/dist/styles/antd-theme.mjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.mts +0 -74
- package/packages/sdk/dist/styles/tailwind-preset.d.ts +0 -74
- package/packages/sdk/dist/styles/tailwind-preset.mjs +0 -1
- package/packages/sdk/dist/styles/tokens.css +0 -74
- package/packages/sdk/dist/workflow/index.cjs +0 -3
- package/packages/sdk/dist/workflow/index.d.mts +0 -291
- package/packages/sdk/dist/workflow/index.d.ts +0 -291
- package/packages/sdk/dist/workflow/index.mjs +0 -3
- package/packages/sdk/source/admin-list/AdminList.tsx +0 -1734
- package/packages/sdk/source/admin-list/README.md +0 -12
- package/packages/sdk/source/admin-list/dataSources.ts +0 -345
- package/packages/sdk/source/admin-list/index.ts +0 -42
- package/packages/sdk/source/admin-list/preferences.ts +0 -174
- package/packages/sdk/source/admin-list/types.ts +0 -273
- package/packages/sdk/src/build-source/README.md +0 -9
- package/packages/sdk/src/build-source/bin/lowcode-workspace.mjs +0 -7
- package/packages/sdk/src/build-source/package.json +0 -34
- package/packages/sdk/src/build-source/scripts/build-forms.mjs +0 -1129
- package/packages/sdk/src/build-source/scripts/build-pages.mjs +0 -897
- package/packages/sdk/src/build-source/scripts/build-workspace.mjs +0 -89
- package/packages/sdk/src/build-source/scripts/publish-all.mjs +0 -190
- package/packages/sdk/src/build-source/scripts/publish-oss.mjs +0 -144
- package/packages/sdk/src/build-source/scripts/register-bundle.mjs +0 -1
- package/packages/sdk/src/build-source/scripts/register.mjs +0 -362
- package/packages/sdk/src/build-source/scripts/sync-schema.mjs +0 -381
- package/packages/sdk/src/build-source/scripts/utils/form-api.mjs +0 -1058
- package/packages/sdk/src/build-source/scripts/utils/form-runtime-assets.mjs +0 -57
- package/packages/sdk/src/build-source/scripts/utils/incremental.mjs +0 -348
- package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +0 -331
- package/packages/sdk/src/build-source/scripts/utils/mime-types.mjs +0 -70
- package/packages/sdk/src/build-source/scripts/utils/namespace-css.mjs +0 -77
- package/packages/sdk/src/build-source/scripts/utils/oss-client.mjs +0 -128
- package/packages/sdk/src/build-source/scripts/utils/pages.mjs +0 -150
- package/packages/sdk/src/build-source/scripts/utils/progress.mjs +0 -57
- package/packages/sdk/src/build-source/scripts/utils/publish-oss-patterns.mjs +0 -20
- package/packages/sdk/src/build-source/scripts/utils/register-payload.mjs +0 -90
- package/packages/sdk/src/build-source/scripts/utils/runtime-css-check.mjs +0 -44
- package/packages/sdk/src/build-source/scripts/utils/schema-transform.mjs +0 -142
- package/packages/sdk/src/build-source/scripts/utils/static-assets.mjs +0 -165
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +0 -283
- package/packages/sdk/src/build-source/scripts/utils/tailwind-token-warnings.mjs +0 -146
- package/packages/sdk/src/build-source/scripts/utils/workspace-style-entry.mjs +0 -29
- package/packages/sdk/src/build-source/src/cli.mjs +0 -735
- package/policy/openxiangda-policy.json +0 -72
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-form.mdc +0 -24
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-page.mdc +0 -25
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-resources.mdc +0 -32
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-workflow-automation.mdc +0 -26
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda.mdc +0 -68
- package/templates/openxiangda-react-spa/.env.example +0 -4
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-form.md +0 -37
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-page.md +0 -29
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-resources.md +0 -32
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-workflow-automation.md +0 -34
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda.md +0 -66
- package/templates/openxiangda-react-spa/AGENTS.md +0 -197
- package/templates/openxiangda-react-spa/DELIVERY.md +0 -43
- package/templates/openxiangda-react-spa/app-workspace.config.ts +0 -50
- package/templates/openxiangda-react-spa/index.html +0 -12
- package/templates/openxiangda-react-spa/package.json +0 -53
- package/templates/openxiangda-react-spa/postcss.config.cjs +0 -6
- package/templates/openxiangda-react-spa/scripts/build-js-code.mjs +0 -600
- package/templates/openxiangda-react-spa/scripts/deploy.mjs +0 -18
- package/templates/openxiangda-react-spa/scripts/guard-publish.mjs +0 -21
- package/templates/openxiangda-react-spa/src/app/navigation.ts +0 -73
- package/templates/openxiangda-react-spa/src/app/router.tsx +0 -146
- package/templates/openxiangda-react-spa/src/app/starter-content.ts +0 -144
- package/templates/openxiangda-react-spa/src/forms/.gitkeep +0 -1
- package/templates/openxiangda-react-spa/src/layouts/AdminShell.tsx +0 -570
- package/templates/openxiangda-react-spa/src/main.tsx +0 -21
- package/templates/openxiangda-react-spa/src/pages/admin/AdminDashboardPage.tsx +0 -170
- package/templates/openxiangda-react-spa/src/pages/admin/LoginLogPage.tsx +0 -425
- package/templates/openxiangda-react-spa/src/pages/defaults/DataRoutePage.tsx +0 -36
- package/templates/openxiangda-react-spa/src/pages/defaults/FilePreviewRoutePage.tsx +0 -65
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +0 -235
- package/templates/openxiangda-react-spa/src/pages/public/PublicRegisterPage.tsx +0 -15
- package/templates/openxiangda-react-spa/src/pages/states/NotFoundPage.tsx +0 -31
- package/templates/openxiangda-react-spa/src/resources/menus/menus.json +0 -22
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/app-admin.json +0 -8
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/public-visitor.json +0 -8
- package/templates/openxiangda-react-spa/src/resources/public-access/public-register.json +0 -14
- package/templates/openxiangda-react-spa/src/resources/roles/roles.json +0 -15
- package/templates/openxiangda-react-spa/src/resources/routes/public-register.json +0 -8
- package/templates/openxiangda-react-spa/src/runtime/default-page-overrides.tsx +0 -35
- package/templates/openxiangda-react-spa/src/runtime/default-routes.ts +0 -16
- package/templates/openxiangda-react-spa/src/shared/form-schema.ts +0 -135
- package/templates/openxiangda-react-spa/src/shared/mac-admin.tsx +0 -651
- package/templates/openxiangda-react-spa/src/shared/ui.tsx +0 -22
- package/templates/openxiangda-react-spa/src/styles/index.css +0 -105
- package/templates/openxiangda-react-spa/tailwind.config.cjs +0 -37
- package/templates/openxiangda-react-spa/tsconfig.app.json +0 -36
- package/templates/openxiangda-react-spa/tsconfig.js-code-nodes.json +0 -19
- package/templates/openxiangda-react-spa/tsconfig.json +0 -7
- package/templates/openxiangda-react-spa/tsconfig.node.json +0 -10
- package/templates/openxiangda-react-spa/vite.config.ts +0 -209
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-form.mdc +0 -24
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-page.mdc +0 -21
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +0 -40
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-workflow-automation.mdc +0 -21
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda.mdc +0 -81
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-form.md +0 -38
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-page.md +0 -39
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +0 -59
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-workflow-automation.md +0 -46
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda.md +0 -82
- package/templates/sy-lowcode-app-workspace/AGENTS.md +0 -159
- package/templates/sy-lowcode-app-workspace/DELIVERY.md +0 -43
- package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +0 -51
- package/templates/sy-lowcode-app-workspace/examples/best-practices/README.md +0 -43
- package/templates/sy-lowcode-app-workspace/examples/best-practices/access-governance.md +0 -239
- package/templates/sy-lowcode-app-workspace/examples/best-practices/catalog.json +0 -99
- package/templates/sy-lowcode-app-workspace/examples/best-practices/decision-guide.md +0 -94
- package/templates/sy-lowcode-app-workspace/examples/best-practices/design-style.md +0 -91
- package/templates/sy-lowcode-app-workspace/examples/best-practices/module-structure.md +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/index.ts +0 -2
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.test.ts +0 -52
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.ts +0 -37
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/types.ts +0 -19
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/index.ts +0 -4
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.test.ts +0 -42
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.ts +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.test.ts +0 -63
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.ts +0 -73
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.test.ts +0 -34
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.ts +0 -73
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/types.ts +0 -66
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/schema.ts +0 -109
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/schema.ts +0 -92
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/schema.ts +0 -153
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/schema.ts +0 -65
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/daily_ticket_digest/index.ts +0 -44
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/sync_roles_to_platform/index.ts +0 -33
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/GlassHomeDashboard.tsx +0 -232
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/styles.css +0 -196
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/WorkbenchPage.tsx +0 -36
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/ConfigPanel.tsx +0 -34
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/PreviewPanel.tsx +0 -17
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/page.config.ts +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/reducer.ts +0 -29
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/styles.css +0 -24
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/MintAnalyticsDashboard.tsx +0 -279
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/styles.css +0 -163
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/MobilePortalShell.tsx +0 -31
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/modules/MobileHome.tsx +0 -13
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/routes.ts +0 -13
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/styles.css +0 -11
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/OpsMonitorDashboard.tsx +0 -306
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/styles.css +0 -248
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/PcPortalShell.tsx +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/components/PortalMetric.tsx +0 -11
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/HomeModule.tsx +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/TicketsModule.tsx +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/routes.ts +0 -19
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/styles.css +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/TicketOpsPage.tsx +0 -105
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketActionTimeline.tsx +0 -22
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketDetailDrawer.tsx +0 -44
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketTableActions.tsx +0 -57
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/page.config.ts +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/styles.css +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/WorkOrderListDrawerPage.tsx +0 -371
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/styles.css +0 -182
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/automation.json +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/trigger.json +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/notifications/daily-ticket-digest.json +0 -24
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/form-groups/service-ticket-college.json +0 -21
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/roles.json +0 -17
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/workflows/expense-approval-workflow.json +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/ConfirmAction.tsx +0 -22
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/QueryState.tsx +0 -37
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/StatusTag.tsx +0 -20
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/DashboardPrimitives.tsx +0 -832
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/chartOptions.ts +0 -140
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/sampleData.ts +0 -466
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/styles.css +0 -874
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/types.ts +0 -150
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/hooks/useTicketOps.ts +0 -96
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/role-governance.ts +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/service-ticket.ts +0 -113
- package/templates/sy-lowcode-app-workspace/examples/forms/customer/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/forms/customer/schema.ts +0 -36
- package/templates/sy-lowcode-app-workspace/index.html +0 -12
- package/templates/sy-lowcode-app-workspace/package.json +0 -58
- package/templates/sy-lowcode-app-workspace/postcss.config.cjs +0 -9
- package/templates/sy-lowcode-app-workspace/scripts/build-js-code.mjs +0 -600
- package/templates/sy-lowcode-app-workspace/scripts/guard-publish.mjs +0 -29
- package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +0 -820
- package/templates/sy-lowcode-app-workspace/src/forms/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/forms/README.md +0 -52
- package/templates/sy-lowcode-app-workspace/src/index.css +0 -26
- package/templates/sy-lowcode-app-workspace/src/js-code-nodes/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/js-code-nodes/types.d.ts +0 -3
- package/templates/sy-lowcode-app-workspace/src/main.tsx +0 -29
- package/templates/sy-lowcode-app-workspace/src/pages/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/runtime/builtin-overrides.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/src/shared/form-schema.ts +0 -135
- package/templates/sy-lowcode-app-workspace/src/types/app-workspace.types.ts +0 -88
- package/templates/sy-lowcode-app-workspace/tailwind.config.cjs +0 -31
- package/templates/sy-lowcode-app-workspace/tsconfig.app.json +0 -40
- package/templates/sy-lowcode-app-workspace/tsconfig.examples.json +0 -24
- package/templates/sy-lowcode-app-workspace/tsconfig.js-code-nodes.json +0 -19
- package/templates/sy-lowcode-app-workspace/tsconfig.json +0 -7
- package/templates/sy-lowcode-app-workspace/tsconfig.node.json +0 -10
- package/templates/sy-lowcode-app-workspace/vite.config.ts +0 -85
- package/v2/README.md +0 -35
- package/v2/skills/manifest.json +0 -45
- package/v2/skills/openxiangda-v1-maintenance/SKILL.md +0 -21
- package/v2/skills/openxiangda-v1-maintenance/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2/SKILL.md +0 -38
- package/v2/skills/openxiangda-v2-architecture/SKILL.md +0 -29
- package/v2/skills/openxiangda-v2-architecture/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-backend/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-backend/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-data-authz/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-data-authz/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-delivery/SKILL.md +0 -30
- package/v2/skills/openxiangda-v2-delivery/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-frontend/SKILL.md +0 -21
- package/v2/skills/openxiangda-v2-frontend/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-workflow-events/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-workflow-events/agents/openai.yaml +0 -4
- /package/{v2/skills → skills}/openxiangda-v2/agents/openai.yaml +0 -0
|
@@ -1,921 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const ts = require('typescript');
|
|
4
|
-
|
|
5
|
-
const SOURCE_EXTENSIONS = new Set([
|
|
6
|
-
'.ts',
|
|
7
|
-
'.tsx',
|
|
8
|
-
'.mts',
|
|
9
|
-
'.cts',
|
|
10
|
-
'.js',
|
|
11
|
-
'.jsx',
|
|
12
|
-
'.mjs',
|
|
13
|
-
'.cjs',
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
const LOCAL_MODULE_EXTENSIONS = [
|
|
17
|
-
'',
|
|
18
|
-
'.ts',
|
|
19
|
-
'.tsx',
|
|
20
|
-
'.mts',
|
|
21
|
-
'.cts',
|
|
22
|
-
'.js',
|
|
23
|
-
'.jsx',
|
|
24
|
-
'.mjs',
|
|
25
|
-
'.cjs',
|
|
26
|
-
'.json',
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
const RESOURCE_BUCKETS = [
|
|
30
|
-
'forms',
|
|
31
|
-
'dataViews',
|
|
32
|
-
'connectors',
|
|
33
|
-
'notifications',
|
|
34
|
-
'functions',
|
|
35
|
-
'storageConfigs',
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const RESOURCE_BUCKET_ALIASES = new Map([
|
|
39
|
-
['forms', 'forms'],
|
|
40
|
-
['form', 'forms'],
|
|
41
|
-
['dataviews', 'dataViews'],
|
|
42
|
-
['data-views', 'dataViews'],
|
|
43
|
-
['dataview', 'dataViews'],
|
|
44
|
-
['connectors', 'connectors'],
|
|
45
|
-
['connector', 'connectors'],
|
|
46
|
-
['notifications', 'notifications'],
|
|
47
|
-
['notification', 'notifications'],
|
|
48
|
-
['notificationtypes', 'notifications'],
|
|
49
|
-
['notification-types', 'notifications'],
|
|
50
|
-
['functions', 'functions'],
|
|
51
|
-
['function', 'functions'],
|
|
52
|
-
['storageconfigs', 'storageConfigs'],
|
|
53
|
-
['storage-configs', 'storageConfigs'],
|
|
54
|
-
['storage', 'storageConfigs'],
|
|
55
|
-
]);
|
|
56
|
-
|
|
57
|
-
const TARGET_MANIFEST_KEYS = [
|
|
58
|
-
['functions', 'functions'],
|
|
59
|
-
['automations', 'automations'],
|
|
60
|
-
['workflows', 'workflows'],
|
|
61
|
-
['jsCodeNodes', 'jsCodeNodes'],
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
function normalizeWorkspacePath(value) {
|
|
65
|
-
return String(value || '')
|
|
66
|
-
.split(path.sep)
|
|
67
|
-
.join('/')
|
|
68
|
-
.replace(/^\.\//, '');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function isPathInside(root, target) {
|
|
72
|
-
const relative = path.relative(root, target);
|
|
73
|
-
return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function workspaceRelativePath(workspaceRoot, filePath) {
|
|
77
|
-
return normalizeWorkspacePath(path.relative(workspaceRoot, filePath));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function getScriptKind(filePath) {
|
|
81
|
-
switch (path.extname(filePath).toLowerCase()) {
|
|
82
|
-
case '.tsx':
|
|
83
|
-
return ts.ScriptKind.TSX;
|
|
84
|
-
case '.jsx':
|
|
85
|
-
return ts.ScriptKind.JSX;
|
|
86
|
-
case '.js':
|
|
87
|
-
case '.mjs':
|
|
88
|
-
case '.cjs':
|
|
89
|
-
return ts.ScriptKind.JS;
|
|
90
|
-
default:
|
|
91
|
-
return ts.ScriptKind.TS;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function loadCompilerOptions(workspaceRoot) {
|
|
96
|
-
const configPath = ts.findConfigFile(workspaceRoot, ts.sys.fileExists, 'tsconfig.json');
|
|
97
|
-
if (!configPath) {
|
|
98
|
-
return {
|
|
99
|
-
allowJs: true,
|
|
100
|
-
moduleResolution: ts.ModuleResolutionKind.Node10,
|
|
101
|
-
resolveJsonModule: true,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
const config = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
105
|
-
if (config.error) return { allowJs: true, resolveJsonModule: true };
|
|
106
|
-
const parsed = ts.parseJsonConfigFileContent(config.config, ts.sys, path.dirname(configPath));
|
|
107
|
-
return {
|
|
108
|
-
...parsed.options,
|
|
109
|
-
allowJs: true,
|
|
110
|
-
resolveJsonModule: true,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function resolveFileCandidate(basePath) {
|
|
115
|
-
for (const extension of LOCAL_MODULE_EXTENSIONS) {
|
|
116
|
-
const candidate = `${basePath}${extension}`;
|
|
117
|
-
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return path.resolve(candidate);
|
|
118
|
-
}
|
|
119
|
-
for (const extension of LOCAL_MODULE_EXTENSIONS.slice(1)) {
|
|
120
|
-
const candidate = path.join(basePath, `index${extension}`);
|
|
121
|
-
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return path.resolve(candidate);
|
|
122
|
-
}
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function resolveLocalModule(workspaceRoot, containingFile, specifier, compilerOptions) {
|
|
127
|
-
const value = String(specifier || '').trim();
|
|
128
|
-
if (!value) return null;
|
|
129
|
-
const localLooking = value.startsWith('.') || value.startsWith('@/') || value.startsWith('~/');
|
|
130
|
-
const resolved = ts.resolveModuleName(value, containingFile, compilerOptions, ts.sys).resolvedModule;
|
|
131
|
-
if (resolved?.resolvedFileName) {
|
|
132
|
-
const filePath = path.resolve(resolved.resolvedFileName);
|
|
133
|
-
if (isPathInside(workspaceRoot, filePath) && !filePath.includes(`${path.sep}node_modules${path.sep}`)) {
|
|
134
|
-
return filePath;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (!localLooking) return null;
|
|
138
|
-
const fallbackBase = value.startsWith('@/') || value.startsWith('~/')
|
|
139
|
-
? path.join(workspaceRoot, 'src', value.slice(2))
|
|
140
|
-
: path.resolve(path.dirname(containingFile), value);
|
|
141
|
-
return resolveFileCandidate(fallbackBase);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function unwrapExpression(expression) {
|
|
145
|
-
let current = expression;
|
|
146
|
-
while (
|
|
147
|
-
current &&
|
|
148
|
-
(ts.isParenthesizedExpression(current) ||
|
|
149
|
-
ts.isAsExpression(current) ||
|
|
150
|
-
ts.isTypeAssertionExpression(current) ||
|
|
151
|
-
ts.isNonNullExpression(current) ||
|
|
152
|
-
ts.isSatisfiesExpression?.(current))
|
|
153
|
-
) {
|
|
154
|
-
current = current.expression;
|
|
155
|
-
}
|
|
156
|
-
return current;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function propertyNameText(name) {
|
|
160
|
-
if (!name) return '';
|
|
161
|
-
if (ts.isIdentifier(name) || ts.isPrivateIdentifier(name)) return name.text;
|
|
162
|
-
if (ts.isStringLiteralLike(name) || ts.isNumericLiteral(name)) return String(name.text);
|
|
163
|
-
return '';
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function collectConstInitializers(sourceFile) {
|
|
167
|
-
const bindings = new Map();
|
|
168
|
-
const visit = node => {
|
|
169
|
-
if (
|
|
170
|
-
ts.isVariableStatement(node) &&
|
|
171
|
-
(node.declarationList.flags & ts.NodeFlags.Const) !== 0
|
|
172
|
-
) {
|
|
173
|
-
for (const declaration of node.declarationList.declarations) {
|
|
174
|
-
if (ts.isIdentifier(declaration.name) && declaration.initializer) {
|
|
175
|
-
bindings.set(declaration.name.text, declaration.initializer);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
ts.forEachChild(node, visit);
|
|
180
|
-
};
|
|
181
|
-
visit(sourceFile);
|
|
182
|
-
return bindings;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function readStaticString(expression, bindings, seen = new Set()) {
|
|
186
|
-
const value = unwrapExpression(expression);
|
|
187
|
-
if (!value) return null;
|
|
188
|
-
if (ts.isStringLiteralLike(value) || ts.isNoSubstitutionTemplateLiteral(value)) {
|
|
189
|
-
return value.text;
|
|
190
|
-
}
|
|
191
|
-
if (ts.isIdentifier(value)) {
|
|
192
|
-
if (seen.has(value.text)) return null;
|
|
193
|
-
const initializer = bindings.get(value.text);
|
|
194
|
-
if (!initializer) return null;
|
|
195
|
-
const nextSeen = new Set(seen);
|
|
196
|
-
nextSeen.add(value.text);
|
|
197
|
-
return readStaticString(initializer, bindings, nextSeen);
|
|
198
|
-
}
|
|
199
|
-
if (ts.isPropertyAccessExpression(value) || ts.isElementAccessExpression(value)) {
|
|
200
|
-
const owner = unwrapExpression(value.expression);
|
|
201
|
-
const property = ts.isPropertyAccessExpression(value)
|
|
202
|
-
? value.name.text
|
|
203
|
-
: readStaticString(value.argumentExpression, bindings, seen);
|
|
204
|
-
if (!property) return null;
|
|
205
|
-
const ownerValue = ts.isIdentifier(owner) && bindings.has(owner.text)
|
|
206
|
-
? unwrapExpression(bindings.get(owner.text))
|
|
207
|
-
: owner;
|
|
208
|
-
if (!ownerValue || !ts.isObjectLiteralExpression(ownerValue)) return null;
|
|
209
|
-
const entry = ownerValue.properties.find(item =>
|
|
210
|
-
(ts.isPropertyAssignment(item) || ts.isShorthandPropertyAssignment(item)) &&
|
|
211
|
-
propertyNameText(item.name) === property
|
|
212
|
-
);
|
|
213
|
-
if (!entry) return null;
|
|
214
|
-
if (ts.isPropertyAssignment(entry)) return readStaticString(entry.initializer, bindings, seen);
|
|
215
|
-
return readStaticString(bindings.get(entry.name.text), bindings, seen);
|
|
216
|
-
}
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function getPropertyPath(expression, bindings) {
|
|
221
|
-
const value = unwrapExpression(expression);
|
|
222
|
-
if (!value) return null;
|
|
223
|
-
if (ts.isIdentifier(value)) return [value.text];
|
|
224
|
-
if (ts.isPropertyAccessExpression(value)) {
|
|
225
|
-
const parent = getPropertyPath(value.expression, bindings);
|
|
226
|
-
return parent ? [...parent, value.name.text] : null;
|
|
227
|
-
}
|
|
228
|
-
if (ts.isElementAccessExpression(value)) {
|
|
229
|
-
const parent = getPropertyPath(value.expression, bindings);
|
|
230
|
-
const key = readStaticString(value.argumentExpression, bindings);
|
|
231
|
-
return parent && key ? [...parent, key] : null;
|
|
232
|
-
}
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function readStaticObjectProperty(expression, propertyNames, bindings) {
|
|
237
|
-
const value = unwrapExpression(expression);
|
|
238
|
-
if (!value || !ts.isObjectLiteralExpression(value)) return null;
|
|
239
|
-
for (const property of value.properties) {
|
|
240
|
-
if (!ts.isPropertyAssignment(property)) continue;
|
|
241
|
-
if (!propertyNames.includes(propertyNameText(property.name))) continue;
|
|
242
|
-
const result = readStaticString(property.initializer, bindings);
|
|
243
|
-
if (result) return result;
|
|
244
|
-
}
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function resolveStaticExpression(expression, bindings, seen = new Set()) {
|
|
249
|
-
const value = unwrapExpression(expression);
|
|
250
|
-
if (!value || !ts.isIdentifier(value)) return value;
|
|
251
|
-
if (seen.has(value.text)) return value;
|
|
252
|
-
const initializer = bindings.get(value.text);
|
|
253
|
-
if (!initializer) return value;
|
|
254
|
-
const nextSeen = new Set(seen);
|
|
255
|
-
nextSeen.add(value.text);
|
|
256
|
-
return resolveStaticExpression(initializer, bindings, nextSeen);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function readStaticObjectPropertyExpression(
|
|
260
|
-
expression,
|
|
261
|
-
propertyNames,
|
|
262
|
-
bindings
|
|
263
|
-
) {
|
|
264
|
-
const value = resolveStaticExpression(expression, bindings);
|
|
265
|
-
if (!value || !ts.isObjectLiteralExpression(value)) return null;
|
|
266
|
-
for (const property of value.properties) {
|
|
267
|
-
if (!ts.isPropertyAssignment(property)) continue;
|
|
268
|
-
if (!propertyNames.includes(propertyNameText(property.name))) continue;
|
|
269
|
-
return property.initializer;
|
|
270
|
-
}
|
|
271
|
-
return null;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function collectStaticQueryFieldNodes(
|
|
275
|
-
expression,
|
|
276
|
-
bindings,
|
|
277
|
-
result,
|
|
278
|
-
fieldPropertyNames,
|
|
279
|
-
seen = new Set()
|
|
280
|
-
) {
|
|
281
|
-
const value = resolveStaticExpression(expression, bindings, seen);
|
|
282
|
-
if (!value || seen.has(value)) return;
|
|
283
|
-
seen.add(value);
|
|
284
|
-
if (ts.isArrayLiteralExpression(value)) {
|
|
285
|
-
for (const element of value.elements) {
|
|
286
|
-
collectStaticQueryFieldNodes(
|
|
287
|
-
element,
|
|
288
|
-
bindings,
|
|
289
|
-
result,
|
|
290
|
-
fieldPropertyNames,
|
|
291
|
-
seen
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
if (!ts.isObjectLiteralExpression(value)) return;
|
|
297
|
-
for (const property of value.properties) {
|
|
298
|
-
if (ts.isSpreadAssignment(property)) {
|
|
299
|
-
collectStaticQueryFieldNodes(
|
|
300
|
-
property.expression,
|
|
301
|
-
bindings,
|
|
302
|
-
result,
|
|
303
|
-
fieldPropertyNames,
|
|
304
|
-
seen
|
|
305
|
-
);
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
if (!ts.isPropertyAssignment(property)) continue;
|
|
309
|
-
const name = propertyNameText(property.name);
|
|
310
|
-
if (fieldPropertyNames.has(name)) {
|
|
311
|
-
const field = readStaticString(property.initializer, bindings);
|
|
312
|
-
if (field) result.push({ field, node: property.initializer });
|
|
313
|
-
}
|
|
314
|
-
collectStaticQueryFieldNodes(
|
|
315
|
-
property.initializer,
|
|
316
|
-
bindings,
|
|
317
|
-
result,
|
|
318
|
-
fieldPropertyNames,
|
|
319
|
-
seen
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function addFormFieldReferences(
|
|
325
|
-
formFieldReferences,
|
|
326
|
-
sourceFile,
|
|
327
|
-
workspaceRoot,
|
|
328
|
-
bindings,
|
|
329
|
-
formCode,
|
|
330
|
-
inputExpression,
|
|
331
|
-
api
|
|
332
|
-
) {
|
|
333
|
-
if (!formCode || !inputExpression) return;
|
|
334
|
-
const fields = [];
|
|
335
|
-
for (const propertyName of ['filters', 'order']) {
|
|
336
|
-
const expression = readStaticObjectPropertyExpression(
|
|
337
|
-
inputExpression,
|
|
338
|
-
[propertyName],
|
|
339
|
-
bindings
|
|
340
|
-
);
|
|
341
|
-
if (expression) {
|
|
342
|
-
collectStaticQueryFieldNodes(
|
|
343
|
-
expression,
|
|
344
|
-
bindings,
|
|
345
|
-
fields,
|
|
346
|
-
new Set(
|
|
347
|
-
propertyName === 'order'
|
|
348
|
-
? ['id', 'key', 'field', 'fieldId']
|
|
349
|
-
: ['key', 'field', 'fieldId']
|
|
350
|
-
)
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
for (const item of fields) {
|
|
355
|
-
formFieldReferences.push({
|
|
356
|
-
formCode,
|
|
357
|
-
field: item.field,
|
|
358
|
-
api,
|
|
359
|
-
...sourceLocation(sourceFile, item.node, workspaceRoot),
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
function sourceLocation(sourceFile, node, workspaceRoot) {
|
|
365
|
-
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
|
|
366
|
-
return {
|
|
367
|
-
file: workspaceRelativePath(workspaceRoot, sourceFile.fileName),
|
|
368
|
-
line: start.line + 1,
|
|
369
|
-
column: start.character + 1,
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function addReference(references, sourceFile, node, workspaceRoot, bucket, code, api) {
|
|
374
|
-
const normalizedCode = String(code || '').trim();
|
|
375
|
-
if (!normalizedCode) return;
|
|
376
|
-
references.push({
|
|
377
|
-
bucket,
|
|
378
|
-
code: normalizedCode,
|
|
379
|
-
api,
|
|
380
|
-
...sourceLocation(sourceFile, node, workspaceRoot),
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, expected) {
|
|
385
|
-
warnings.push({
|
|
386
|
-
code: 'dynamic-resource-reference',
|
|
387
|
-
api,
|
|
388
|
-
message: `${api} 使用动态资源 code,无法静态核对 manifest;请确认 resources.${expected} 已完整声明`,
|
|
389
|
-
...sourceLocation(sourceFile, node, workspaceRoot),
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function inspectResourceCall(
|
|
394
|
-
node,
|
|
395
|
-
sourceFile,
|
|
396
|
-
workspaceRoot,
|
|
397
|
-
bindings,
|
|
398
|
-
references,
|
|
399
|
-
formFieldReferences,
|
|
400
|
-
warnings
|
|
401
|
-
) {
|
|
402
|
-
if (!ts.isCallExpression(node)) return;
|
|
403
|
-
const callee = getPropertyPath(node.expression, bindings);
|
|
404
|
-
if (!callee) return;
|
|
405
|
-
if (
|
|
406
|
-
callee.length === 1 &&
|
|
407
|
-
callee[0] === 'queryAdvancedFormPage'
|
|
408
|
-
) {
|
|
409
|
-
const formCode = readStaticString(node.arguments[1], bindings);
|
|
410
|
-
if (formCode) {
|
|
411
|
-
addReference(
|
|
412
|
-
references,
|
|
413
|
-
sourceFile,
|
|
414
|
-
node,
|
|
415
|
-
workspaceRoot,
|
|
416
|
-
'forms',
|
|
417
|
-
formCode,
|
|
418
|
-
'queryAdvancedFormPage'
|
|
419
|
-
);
|
|
420
|
-
addFormFieldReferences(
|
|
421
|
-
formFieldReferences,
|
|
422
|
-
sourceFile,
|
|
423
|
-
workspaceRoot,
|
|
424
|
-
bindings,
|
|
425
|
-
formCode,
|
|
426
|
-
node.arguments[2],
|
|
427
|
-
'queryAdvancedFormPage'
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
if (callee[0] !== 'ctx' || callee.length < 3) return;
|
|
433
|
-
const namespace = callee[1];
|
|
434
|
-
const method = callee[2];
|
|
435
|
-
const api = callee.join('.');
|
|
436
|
-
const firstArgument = node.arguments[0];
|
|
437
|
-
|
|
438
|
-
if (namespace === 'resources' && method.startsWith('resolve')) {
|
|
439
|
-
const bucket = {
|
|
440
|
-
resolveForm: 'forms',
|
|
441
|
-
resolveDataView: 'dataViews',
|
|
442
|
-
resolveConnector: 'connectors',
|
|
443
|
-
resolveNotification: 'notifications',
|
|
444
|
-
resolveNotificationType: 'notifications',
|
|
445
|
-
resolveTemplate: 'notifications',
|
|
446
|
-
resolveFunction: 'functions',
|
|
447
|
-
resolveStorage: 'storageConfigs',
|
|
448
|
-
}[method];
|
|
449
|
-
if (!bucket) return;
|
|
450
|
-
const code = readStaticString(firstArgument, bindings);
|
|
451
|
-
if (code) addReference(references, sourceFile, node, workspaceRoot, bucket, code, api);
|
|
452
|
-
else addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, bucket);
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (namespace === 'form') {
|
|
457
|
-
const code = readStaticObjectProperty(firstArgument, ['formCode', 'code'], bindings) ||
|
|
458
|
-
readStaticString(firstArgument, bindings);
|
|
459
|
-
if (code) {
|
|
460
|
-
addReference(references, sourceFile, node, workspaceRoot, 'forms', code, api);
|
|
461
|
-
addFormFieldReferences(
|
|
462
|
-
formFieldReferences,
|
|
463
|
-
sourceFile,
|
|
464
|
-
workspaceRoot,
|
|
465
|
-
bindings,
|
|
466
|
-
code,
|
|
467
|
-
ts.isObjectLiteralExpression(
|
|
468
|
-
resolveStaticExpression(firstArgument, bindings)
|
|
469
|
-
)
|
|
470
|
-
? firstArgument
|
|
471
|
-
: node.arguments[1],
|
|
472
|
-
api
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'forms');
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
if (namespace === 'dataView' && ['query', 'stats'].includes(method)) {
|
|
480
|
-
const code = readStaticString(firstArgument, bindings) ||
|
|
481
|
-
readStaticObjectProperty(firstArgument, ['dataViewCode', 'code'], bindings);
|
|
482
|
-
if (code) addReference(references, sourceFile, node, workspaceRoot, 'dataViews', code, api);
|
|
483
|
-
else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'dataViews');
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
if (namespace === 'connector' && ['invoke', 'call'].includes(method)) {
|
|
488
|
-
let code = readStaticObjectProperty(firstArgument, ['connector', 'connectorCode', 'code'], bindings);
|
|
489
|
-
if (!code && method === 'call') {
|
|
490
|
-
const callName = readStaticString(firstArgument, bindings);
|
|
491
|
-
code = callName ? callName.split('.')[0] : null;
|
|
492
|
-
}
|
|
493
|
-
if (code) addReference(references, sourceFile, node, workspaceRoot, 'connectors', code, api);
|
|
494
|
-
else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'connectors');
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
if (
|
|
499
|
-
namespace === 'notification' &&
|
|
500
|
-
[
|
|
501
|
-
'sendByType',
|
|
502
|
-
'batchSendByType',
|
|
503
|
-
'findConfig',
|
|
504
|
-
'previewTemplate',
|
|
505
|
-
'previewDingTalk',
|
|
506
|
-
'sendDingTalk',
|
|
507
|
-
'updateDingTalkCard',
|
|
508
|
-
].includes(method)
|
|
509
|
-
) {
|
|
510
|
-
const code = readStaticString(firstArgument, bindings) ||
|
|
511
|
-
readStaticObjectProperty(firstArgument, ['notificationType', 'templateCode', 'code'], bindings);
|
|
512
|
-
if (code) addReference(references, sourceFile, node, workspaceRoot, 'notifications', code, api);
|
|
513
|
-
else if (firstArgument) addDynamicReferenceWarning(warnings, sourceFile, node, workspaceRoot, api, 'notifications');
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function collectModuleSpecifiers(sourceFile) {
|
|
518
|
-
const result = [];
|
|
519
|
-
const visit = node => {
|
|
520
|
-
if (
|
|
521
|
-
(ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) &&
|
|
522
|
-
node.moduleSpecifier &&
|
|
523
|
-
ts.isStringLiteralLike(node.moduleSpecifier)
|
|
524
|
-
) {
|
|
525
|
-
result.push({ value: node.moduleSpecifier.text, node: node.moduleSpecifier });
|
|
526
|
-
} else if (
|
|
527
|
-
ts.isImportEqualsDeclaration(node) &&
|
|
528
|
-
ts.isExternalModuleReference(node.moduleReference) &&
|
|
529
|
-
node.moduleReference.expression &&
|
|
530
|
-
ts.isStringLiteralLike(node.moduleReference.expression)
|
|
531
|
-
) {
|
|
532
|
-
result.push({ value: node.moduleReference.expression.text, node: node.moduleReference.expression });
|
|
533
|
-
} else if (
|
|
534
|
-
ts.isCallExpression(node) &&
|
|
535
|
-
node.arguments.length > 0 &&
|
|
536
|
-
(node.expression.kind === ts.SyntaxKind.ImportKeyword ||
|
|
537
|
-
(ts.isIdentifier(node.expression) && node.expression.text === 'require')) &&
|
|
538
|
-
ts.isStringLiteralLike(node.arguments[0])
|
|
539
|
-
) {
|
|
540
|
-
result.push({ value: node.arguments[0].text, node: node.arguments[0] });
|
|
541
|
-
}
|
|
542
|
-
ts.forEachChild(node, visit);
|
|
543
|
-
};
|
|
544
|
-
visit(sourceFile);
|
|
545
|
-
return result;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
function dedupeDetails(values, keys) {
|
|
549
|
-
const seen = new Set();
|
|
550
|
-
return values.filter(value => {
|
|
551
|
-
const key = keys.map(name => value[name] || '').join('\0');
|
|
552
|
-
if (seen.has(key)) return false;
|
|
553
|
-
seen.add(key);
|
|
554
|
-
return true;
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function analyzeTypeScriptEntry(options = {}) {
|
|
559
|
-
const workspaceRoot = path.resolve(options.workspaceRoot || process.cwd());
|
|
560
|
-
const entryFile = path.resolve(workspaceRoot, options.entryFile || '');
|
|
561
|
-
const compilerOptions = options.compilerOptions || loadCompilerOptions(workspaceRoot);
|
|
562
|
-
const queue = [entryFile];
|
|
563
|
-
const visited = new Set();
|
|
564
|
-
const sourceDependencies = new Set();
|
|
565
|
-
const references = [];
|
|
566
|
-
const formFieldReferences = [];
|
|
567
|
-
const warnings = [];
|
|
568
|
-
|
|
569
|
-
while (queue.length > 0) {
|
|
570
|
-
const current = path.resolve(queue.shift());
|
|
571
|
-
if (visited.has(current)) continue;
|
|
572
|
-
visited.add(current);
|
|
573
|
-
if (!fs.existsSync(current) || !fs.statSync(current).isFile()) {
|
|
574
|
-
warnings.push({
|
|
575
|
-
code: 'missing-source-file',
|
|
576
|
-
file: workspaceRelativePath(workspaceRoot, current),
|
|
577
|
-
line: 1,
|
|
578
|
-
column: 1,
|
|
579
|
-
message: `本地 sourceFile 不存在: ${workspaceRelativePath(workspaceRoot, current)}`,
|
|
580
|
-
});
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
if (!isPathInside(workspaceRoot, current)) continue;
|
|
584
|
-
sourceDependencies.add(workspaceRelativePath(workspaceRoot, current));
|
|
585
|
-
if (!SOURCE_EXTENSIONS.has(path.extname(current).toLowerCase())) continue;
|
|
586
|
-
|
|
587
|
-
const content = fs.readFileSync(current, 'utf8');
|
|
588
|
-
const sourceFile = ts.createSourceFile(
|
|
589
|
-
current,
|
|
590
|
-
content,
|
|
591
|
-
ts.ScriptTarget.Latest,
|
|
592
|
-
true,
|
|
593
|
-
getScriptKind(current)
|
|
594
|
-
);
|
|
595
|
-
for (const diagnostic of sourceFile.parseDiagnostics || []) {
|
|
596
|
-
const position = diagnostic.start === undefined
|
|
597
|
-
? { line: 0, character: 0 }
|
|
598
|
-
: sourceFile.getLineAndCharacterOfPosition(diagnostic.start);
|
|
599
|
-
warnings.push({
|
|
600
|
-
code: 'source-parse-diagnostic',
|
|
601
|
-
file: workspaceRelativePath(workspaceRoot, current),
|
|
602
|
-
line: position.line + 1,
|
|
603
|
-
column: position.character + 1,
|
|
604
|
-
message: ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
const bindings = collectConstInitializers(sourceFile);
|
|
609
|
-
const inspect = node => {
|
|
610
|
-
inspectResourceCall(
|
|
611
|
-
node,
|
|
612
|
-
sourceFile,
|
|
613
|
-
workspaceRoot,
|
|
614
|
-
bindings,
|
|
615
|
-
references,
|
|
616
|
-
formFieldReferences,
|
|
617
|
-
warnings
|
|
618
|
-
);
|
|
619
|
-
ts.forEachChild(node, inspect);
|
|
620
|
-
};
|
|
621
|
-
inspect(sourceFile);
|
|
622
|
-
|
|
623
|
-
for (const imported of collectModuleSpecifiers(sourceFile)) {
|
|
624
|
-
const localLooking = imported.value.startsWith('.') || imported.value.startsWith('@/') || imported.value.startsWith('~/');
|
|
625
|
-
const resolved = resolveLocalModule(workspaceRoot, current, imported.value, compilerOptions);
|
|
626
|
-
if (resolved) {
|
|
627
|
-
queue.push(resolved);
|
|
628
|
-
} else if (localLooking) {
|
|
629
|
-
warnings.push({
|
|
630
|
-
code: 'unresolved-local-import',
|
|
631
|
-
specifier: imported.value,
|
|
632
|
-
message: `无法解析本地 import: ${imported.value}`,
|
|
633
|
-
...sourceLocation(sourceFile, imported.node, workspaceRoot),
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
const resourceReferenceDetails = dedupeDetails(
|
|
640
|
-
references,
|
|
641
|
-
['bucket', 'code', 'file', 'line', 'column', 'api']
|
|
642
|
-
).sort((left, right) =>
|
|
643
|
-
`${left.bucket}\0${left.code}\0${left.file}\0${left.line}`.localeCompare(
|
|
644
|
-
`${right.bucket}\0${right.code}\0${right.file}\0${right.line}`
|
|
645
|
-
)
|
|
646
|
-
);
|
|
647
|
-
const resourceReferences = Object.fromEntries(
|
|
648
|
-
RESOURCE_BUCKETS.map(bucket => [
|
|
649
|
-
bucket,
|
|
650
|
-
Array.from(
|
|
651
|
-
new Set(
|
|
652
|
-
resourceReferenceDetails
|
|
653
|
-
.filter(reference => reference.bucket === bucket)
|
|
654
|
-
.map(reference => reference.code)
|
|
655
|
-
)
|
|
656
|
-
).sort(),
|
|
657
|
-
])
|
|
658
|
-
);
|
|
659
|
-
|
|
660
|
-
return {
|
|
661
|
-
entryFile: workspaceRelativePath(workspaceRoot, entryFile),
|
|
662
|
-
sourceDependencies: Array.from(sourceDependencies).sort(),
|
|
663
|
-
resourceReferences,
|
|
664
|
-
resourceReferenceDetails,
|
|
665
|
-
formFieldReferences: dedupeDetails(
|
|
666
|
-
formFieldReferences,
|
|
667
|
-
['formCode', 'field', 'file', 'line', 'column', 'api']
|
|
668
|
-
),
|
|
669
|
-
warnings: dedupeDetails(warnings, ['code', 'file', 'line', 'column', 'api', 'message']),
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
function readJsonFile(filePath) {
|
|
674
|
-
try {
|
|
675
|
-
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
676
|
-
} catch {
|
|
677
|
-
return null;
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
function resolveManifestLocalPath(workspaceRoot, baseDir, localPath) {
|
|
682
|
-
const fromBase = path.resolve(baseDir || workspaceRoot, localPath);
|
|
683
|
-
if (fs.existsSync(fromBase)) return fromBase;
|
|
684
|
-
return path.resolve(workspaceRoot, localPath);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
function collectManifestStructures(workspaceRoot, item) {
|
|
688
|
-
const sourceEntries = new Set();
|
|
689
|
-
const resourceContainers = [];
|
|
690
|
-
const visited = new Set();
|
|
691
|
-
const externalFiles = new Set();
|
|
692
|
-
|
|
693
|
-
const visit = (value, baseDir) => {
|
|
694
|
-
if (!value || typeof value !== 'object' || visited.has(value)) return;
|
|
695
|
-
visited.add(value);
|
|
696
|
-
if (Array.isArray(value)) {
|
|
697
|
-
for (const child of value) visit(child, baseDir);
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
if (value.sourceFile?.localPath) {
|
|
701
|
-
sourceEntries.add(
|
|
702
|
-
resolveManifestLocalPath(workspaceRoot, baseDir, String(value.sourceFile.localPath))
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
if (value.resources && typeof value.resources === 'object') {
|
|
706
|
-
resourceContainers.push(value.resources);
|
|
707
|
-
}
|
|
708
|
-
if (value.resourceBindings && typeof value.resourceBindings === 'object') {
|
|
709
|
-
resourceContainers.push(value.resourceBindings);
|
|
710
|
-
}
|
|
711
|
-
for (const [key, child] of Object.entries(value)) {
|
|
712
|
-
if (key.startsWith('__')) continue;
|
|
713
|
-
if (key === 'definitionFile' && typeof child === 'string' && child.trim()) {
|
|
714
|
-
const definitionPath = path.resolve(baseDir || workspaceRoot, child);
|
|
715
|
-
if (!externalFiles.has(definitionPath) && fs.existsSync(definitionPath)) {
|
|
716
|
-
externalFiles.add(definitionPath);
|
|
717
|
-
const external = readJsonFile(definitionPath);
|
|
718
|
-
if (external) visit(external, path.dirname(definitionPath));
|
|
719
|
-
}
|
|
720
|
-
continue;
|
|
721
|
-
}
|
|
722
|
-
if (child && typeof child === 'object') visit(child, baseDir);
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
visit(item, item.__dir || workspaceRoot);
|
|
727
|
-
return {
|
|
728
|
-
sourceEntries: Array.from(sourceEntries).sort(),
|
|
729
|
-
resourceContainers,
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
function normalizeDeclaredCodes(value) {
|
|
734
|
-
if (value === undefined || value === null || value === false) return [];
|
|
735
|
-
if (Array.isArray(value)) {
|
|
736
|
-
return value.flatMap(normalizeDeclaredCodes);
|
|
737
|
-
}
|
|
738
|
-
if (typeof value === 'object') {
|
|
739
|
-
return Object.keys(value).map(key => String(key).trim()).filter(Boolean);
|
|
740
|
-
}
|
|
741
|
-
return String(value)
|
|
742
|
-
.split(',')
|
|
743
|
-
.map(item => item.trim())
|
|
744
|
-
.filter(Boolean);
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
function collectDeclaredResources(item, resourceContainers) {
|
|
748
|
-
const result = Object.fromEntries(RESOURCE_BUCKETS.map(bucket => [bucket, new Set()]));
|
|
749
|
-
for (const container of resourceContainers) {
|
|
750
|
-
for (const [rawBucket, value] of Object.entries(container || {})) {
|
|
751
|
-
const normalizedBucket = RESOURCE_BUCKET_ALIASES.get(
|
|
752
|
-
String(rawBucket).replace(/[_\s]+/g, '-').toLowerCase()
|
|
753
|
-
);
|
|
754
|
-
if (!normalizedBucket) continue;
|
|
755
|
-
for (const code of normalizeDeclaredCodes(value)) result[normalizedBucket].add(code);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
if (item.formCode) result.forms.add(String(item.formCode));
|
|
759
|
-
return Object.fromEntries(
|
|
760
|
-
RESOURCE_BUCKETS.map(bucket => [bucket, Array.from(result[bucket]).sort()])
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
function getManifestItemCode(item) {
|
|
765
|
-
return String(
|
|
766
|
-
item?.code || item?.resourceCode || item?.functionCode || item?.scriptCode || item?.methodName || ''
|
|
767
|
-
).trim();
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
function mergeAnalyses(workspaceRoot, entries) {
|
|
771
|
-
const analyses = entries.map(entryFile =>
|
|
772
|
-
analyzeTypeScriptEntry({ workspaceRoot, entryFile })
|
|
773
|
-
);
|
|
774
|
-
const sourceDependencies = Array.from(
|
|
775
|
-
new Set(analyses.flatMap(analysis => analysis.sourceDependencies))
|
|
776
|
-
).sort();
|
|
777
|
-
const resourceReferenceDetails = dedupeDetails(
|
|
778
|
-
analyses.flatMap(analysis => analysis.resourceReferenceDetails),
|
|
779
|
-
['bucket', 'code', 'file', 'line', 'column', 'api']
|
|
780
|
-
);
|
|
781
|
-
const resourceReferences = Object.fromEntries(
|
|
782
|
-
RESOURCE_BUCKETS.map(bucket => [
|
|
783
|
-
bucket,
|
|
784
|
-
Array.from(
|
|
785
|
-
new Set(
|
|
786
|
-
resourceReferenceDetails
|
|
787
|
-
.filter(reference => reference.bucket === bucket)
|
|
788
|
-
.map(reference => reference.code)
|
|
789
|
-
)
|
|
790
|
-
).sort(),
|
|
791
|
-
])
|
|
792
|
-
);
|
|
793
|
-
const formFieldReferences = dedupeDetails(
|
|
794
|
-
analyses.flatMap(analysis => analysis.formFieldReferences || []),
|
|
795
|
-
['formCode', 'field', 'file', 'line', 'column', 'api']
|
|
796
|
-
);
|
|
797
|
-
return {
|
|
798
|
-
entryFiles: entries.map(entry => workspaceRelativePath(workspaceRoot, entry)).sort(),
|
|
799
|
-
sourceDependencies,
|
|
800
|
-
resourceReferences,
|
|
801
|
-
resourceReferenceDetails,
|
|
802
|
-
formFieldReferences,
|
|
803
|
-
warnings: dedupeDetails(
|
|
804
|
-
analyses.flatMap(analysis => analysis.warnings),
|
|
805
|
-
['code', 'file', 'line', 'column', 'api', 'message']
|
|
806
|
-
),
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
function analyzeManifestSourceDependencies(options = {}) {
|
|
811
|
-
const workspaceRoot = path.resolve(options.workspaceRoot || process.cwd());
|
|
812
|
-
const manifest = options.manifest || {};
|
|
813
|
-
const targets = [];
|
|
814
|
-
const byDependency = new Map();
|
|
815
|
-
|
|
816
|
-
for (const [manifestKey, targetKey] of TARGET_MANIFEST_KEYS) {
|
|
817
|
-
for (const item of manifest[manifestKey] || []) {
|
|
818
|
-
const code = getManifestItemCode(item);
|
|
819
|
-
if (!code) continue;
|
|
820
|
-
const structures = collectManifestStructures(workspaceRoot, item);
|
|
821
|
-
if (structures.sourceEntries.length === 0) continue;
|
|
822
|
-
const analysis = {
|
|
823
|
-
targetKey,
|
|
824
|
-
code,
|
|
825
|
-
declaredResources: collectDeclaredResources(item, structures.resourceContainers),
|
|
826
|
-
...mergeAnalyses(workspaceRoot, structures.sourceEntries),
|
|
827
|
-
};
|
|
828
|
-
Object.defineProperty(item, '__sourceAnalysis', {
|
|
829
|
-
value: analysis,
|
|
830
|
-
configurable: true,
|
|
831
|
-
enumerable: false,
|
|
832
|
-
writable: true,
|
|
833
|
-
});
|
|
834
|
-
targets.push(analysis);
|
|
835
|
-
for (const dependency of analysis.sourceDependencies) {
|
|
836
|
-
if (!byDependency.has(dependency)) byDependency.set(dependency, []);
|
|
837
|
-
byDependency.get(dependency).push({ targetKey, code });
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
return { workspaceRoot, targets, byDependency };
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
function validateManifestSourceBindings(options = {}) {
|
|
846
|
-
const index = analyzeManifestSourceDependencies(options);
|
|
847
|
-
const errors = [];
|
|
848
|
-
const warnings = [];
|
|
849
|
-
|
|
850
|
-
for (const target of index.targets) {
|
|
851
|
-
const label = `${target.targetKey.replace(/s$/, '')} ${target.code}`;
|
|
852
|
-
const undeclared = [];
|
|
853
|
-
for (const reference of target.resourceReferenceDetails) {
|
|
854
|
-
const declared = target.declaredResources[reference.bucket] || [];
|
|
855
|
-
if (declared.includes(reference.code)) continue;
|
|
856
|
-
if (reference.bucket === 'forms' && /^FORM[_-]/i.test(reference.code)) continue;
|
|
857
|
-
undeclared.push(reference);
|
|
858
|
-
}
|
|
859
|
-
if (undeclared.length > 0) {
|
|
860
|
-
const codes = Array.from(
|
|
861
|
-
new Set(undeclared.map(reference => `${reference.bucket}.${reference.code}`))
|
|
862
|
-
).sort();
|
|
863
|
-
const visible = codes.slice(0, 12);
|
|
864
|
-
warnings.push(
|
|
865
|
-
`${label}: 源码引用了未在逐资源清单声明的应用内资源: ${visible.join(', ')}` +
|
|
866
|
-
`${codes.length > visible.length ? ` 等 ${codes.length} 项` : ''}。` +
|
|
867
|
-
'平台运行时将按当前租户和应用自动解析;resources 仅用于显式映射、审计和影响分析'
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
for (const warning of target.warnings) {
|
|
871
|
-
if (
|
|
872
|
-
warning.code === 'dynamic-resource-reference' &&
|
|
873
|
-
!target.entryFiles.includes(warning.file)
|
|
874
|
-
) {
|
|
875
|
-
continue;
|
|
876
|
-
}
|
|
877
|
-
warnings.push(
|
|
878
|
-
`${label}: ${warning.file}:${warning.line} ${warning.message}`
|
|
879
|
-
);
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
return {
|
|
884
|
-
index,
|
|
885
|
-
errors: Array.from(new Set(errors)),
|
|
886
|
-
warnings: Array.from(new Set(warnings)),
|
|
887
|
-
sourceDependencies: index.targets.map(target => ({
|
|
888
|
-
kind: target.targetKey,
|
|
889
|
-
code: target.code,
|
|
890
|
-
entryFiles: target.entryFiles,
|
|
891
|
-
sourceDependencies: target.sourceDependencies,
|
|
892
|
-
resourceReferences: target.resourceReferences,
|
|
893
|
-
formFieldReferences: target.formFieldReferences,
|
|
894
|
-
})),
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function getImpactedResourceTargets(index, changedFiles = []) {
|
|
899
|
-
const result = {
|
|
900
|
-
functions: new Set(),
|
|
901
|
-
automations: new Set(),
|
|
902
|
-
workflows: new Set(),
|
|
903
|
-
jsCodeNodes: new Set(),
|
|
904
|
-
};
|
|
905
|
-
for (const rawFile of changedFiles) {
|
|
906
|
-
const file = normalizeWorkspacePath(rawFile);
|
|
907
|
-
for (const target of index?.byDependency?.get(file) || []) {
|
|
908
|
-
if (result[target.targetKey]) result[target.targetKey].add(target.code);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
return Object.fromEntries(
|
|
912
|
-
Object.entries(result).map(([key, values]) => [key, Array.from(values).sort()])
|
|
913
|
-
);
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
module.exports = {
|
|
917
|
-
analyzeManifestSourceDependencies,
|
|
918
|
-
analyzeTypeScriptEntry,
|
|
919
|
-
getImpactedResourceTargets,
|
|
920
|
-
validateManifestSourceBindings,
|
|
921
|
-
};
|