@baseplate-dev/project-builder-lib 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +390 -0
- package/dist/compiler/admin-crud-input-spec.d.ts +26 -0
- package/dist/compiler/admin-crud-input-spec.d.ts.map +1 -0
- package/dist/compiler/admin-crud-input-spec.js +29 -0
- package/dist/compiler/admin-crud-input-spec.js.map +1 -0
- package/dist/compiler/app-compiler-spec.d.ts +36 -0
- package/dist/compiler/app-compiler-spec.d.ts.map +1 -0
- package/dist/compiler/app-compiler-spec.js +42 -0
- package/dist/compiler/app-compiler-spec.js.map +1 -0
- package/dist/compiler/index.d.ts +5 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +4 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/model-transformer-compiler-spec.d.ts +25 -0
- package/dist/compiler/model-transformer-compiler-spec.d.ts.map +1 -0
- package/dist/compiler/model-transformer-compiler-spec.js +29 -0
- package/dist/compiler/model-transformer-compiler-spec.js.map +1 -0
- package/dist/compiler/types.d.ts +2 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +2 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/constants/colors.d.ts +294 -0
- package/dist/constants/colors.d.ts.map +1 -0
- package/dist/constants/colors.js +307 -0
- package/dist/constants/colors.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/theme-colors.d.ts +397 -0
- package/dist/constants/theme-colors.d.ts.map +1 -0
- package/dist/constants/theme-colors.js +247 -0
- package/dist/constants/theme-colors.js.map +1 -0
- package/dist/definition/apps/app-utils.d.ts +11 -0
- package/dist/definition/apps/app-utils.d.ts.map +1 -0
- package/dist/definition/apps/app-utils.js +30 -0
- package/dist/definition/apps/app-utils.js.map +1 -0
- package/dist/definition/feature/feature-utils.d.ts +27 -0
- package/dist/definition/feature/feature-utils.d.ts.map +1 -0
- package/dist/definition/feature/feature-utils.js +81 -0
- package/dist/definition/feature/feature-utils.js.map +1 -0
- package/dist/definition/index.d.ts +10 -0
- package/dist/definition/index.d.ts.map +1 -0
- package/dist/definition/index.js +10 -0
- package/dist/definition/index.js.map +1 -0
- package/dist/definition/model/enum-utils.d.ts +9 -0
- package/dist/definition/model/enum-utils.d.ts.map +1 -0
- package/dist/definition/model/enum-utils.js +15 -0
- package/dist/definition/model/enum-utils.js.map +1 -0
- package/dist/definition/model/model-field-utils.d.ts +17 -0
- package/dist/definition/model/model-field-utils.d.ts.map +1 -0
- package/dist/definition/model/model-field-utils.js +85 -0
- package/dist/definition/model/model-field-utils.js.map +1 -0
- package/dist/definition/model/model-transformer-utils.d.ts +11 -0
- package/dist/definition/model/model-transformer-utils.d.ts.map +1 -0
- package/dist/definition/model/model-transformer-utils.js +13 -0
- package/dist/definition/model/model-transformer-utils.js.map +1 -0
- package/dist/definition/model/model-utils.d.ts +32 -0
- package/dist/definition/model/model-utils.d.ts.map +1 -0
- package/dist/definition/model/model-utils.js +59 -0
- package/dist/definition/model/model-utils.js.map +1 -0
- package/dist/definition/plugins/index.d.ts +2 -0
- package/dist/definition/plugins/index.d.ts.map +1 -0
- package/dist/definition/plugins/index.js +2 -0
- package/dist/definition/plugins/index.js.map +1 -0
- package/dist/definition/plugins/plugin-utils.d.ts +14 -0
- package/dist/definition/plugins/plugin-utils.d.ts.map +1 -0
- package/dist/definition/plugins/plugin-utils.js +44 -0
- package/dist/definition/plugins/plugin-utils.js.map +1 -0
- package/dist/definition/project-definition-container.d.ts +65 -0
- package/dist/definition/project-definition-container.d.ts.map +1 -0
- package/dist/definition/project-definition-container.js +118 -0
- package/dist/definition/project-definition-container.js.map +1 -0
- package/dist/definition/project-definition-container.test-helper.d.ts +5 -0
- package/dist/definition/project-definition-container.test-helper.d.ts.map +1 -0
- package/dist/definition/project-definition-container.test-helper.js +36 -0
- package/dist/definition/project-definition-container.test-helper.js.map +1 -0
- package/dist/feature-flags/flags.d.ts +3 -0
- package/dist/feature-flags/flags.d.ts.map +1 -0
- package/dist/feature-flags/flags.js +2 -0
- package/dist/feature-flags/flags.js.map +1 -0
- package/dist/feature-flags/index.d.ts +2 -0
- package/dist/feature-flags/index.d.ts.map +1 -0
- package/dist/feature-flags/index.js +2 -0
- package/dist/feature-flags/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +15 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +68 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/migration-005-primaryUniqueRefs.d.ts +37 -0
- package/dist/migrations/migration-005-primaryUniqueRefs.d.ts.map +1 -0
- package/dist/migrations/migration-005-primaryUniqueRefs.js +40 -0
- package/dist/migrations/migration-005-primaryUniqueRefs.js.map +1 -0
- package/dist/migrations/migration-006-individual-service-controllers.d.ts +42 -0
- package/dist/migrations/migration-006-individual-service-controllers.d.ts.map +1 -0
- package/dist/migrations/migration-006-individual-service-controllers.js +31 -0
- package/dist/migrations/migration-006-individual-service-controllers.js.map +1 -0
- package/dist/migrations/migration-007-model-graphql.d.ts +59 -0
- package/dist/migrations/migration-007-model-graphql.d.ts.map +1 -0
- package/dist/migrations/migration-007-model-graphql.js +62 -0
- package/dist/migrations/migration-007-model-graphql.js.map +1 -0
- package/dist/migrations/migration-008-anonymous-public-role.d.ts +22 -0
- package/dist/migrations/migration-008-anonymous-public-role.d.ts.map +1 -0
- package/dist/migrations/migration-008-anonymous-public-role.js +52 -0
- package/dist/migrations/migration-008-anonymous-public-role.js.map +1 -0
- package/dist/migrations/migration-009-rename-refs.d.ts +2 -0
- package/dist/migrations/migration-009-rename-refs.d.ts.map +1 -0
- package/dist/migrations/migration-009-rename-refs.js +59 -0
- package/dist/migrations/migration-009-rename-refs.js.map +1 -0
- package/dist/migrations/migration-010-hex-to-oklch.d.ts +2 -0
- package/dist/migrations/migration-010-hex-to-oklch.d.ts.map +1 -0
- package/dist/migrations/migration-010-hex-to-oklch.js +24 -0
- package/dist/migrations/migration-010-hex-to-oklch.js.map +1 -0
- package/dist/migrations/migration-011-plugin-id.d.ts +2 -0
- package/dist/migrations/migration-011-plugin-id.d.ts.map +1 -0
- package/dist/migrations/migration-011-plugin-id.js +10 -0
- package/dist/migrations/migration-011-plugin-id.js.map +1 -0
- package/dist/migrations/migration-012-migrate-auth-config.d.ts +36 -0
- package/dist/migrations/migration-012-migrate-auth-config.d.ts.map +1 -0
- package/dist/migrations/migration-012-migrate-auth-config.js +48 -0
- package/dist/migrations/migration-012-migrate-auth-config.js.map +1 -0
- package/dist/migrations/migration-013-move-general-settings.d.ts +38 -0
- package/dist/migrations/migration-013-move-general-settings.d.ts.map +1 -0
- package/dist/migrations/migration-013-move-general-settings.js +22 -0
- package/dist/migrations/migration-013-move-general-settings.js.map +1 -0
- package/dist/migrations/migration-014-migrate-plugin-ids.d.ts +21 -0
- package/dist/migrations/migration-014-migrate-plugin-ids.d.ts.map +1 -0
- package/dist/migrations/migration-014-migrate-plugin-ids.js +32 -0
- package/dist/migrations/migration-014-migrate-plugin-ids.js.map +1 -0
- package/dist/migrations/transform-json-path.d.ts +13 -0
- package/dist/migrations/transform-json-path.d.ts.map +1 -0
- package/dist/migrations/transform-json-path.js +66 -0
- package/dist/migrations/transform-json-path.js.map +1 -0
- package/dist/migrations/types.d.ts +29 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +4 -0
- package/dist/migrations/types.js.map +1 -0
- package/dist/migrations/utils.d.ts +3 -0
- package/dist/migrations/utils.d.ts.map +1 -0
- package/dist/migrations/utils.js +10 -0
- package/dist/migrations/utils.js.map +1 -0
- package/dist/parser/index.d.ts +3 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +2 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/parser.d.ts +35 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +84 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/types.d.ts +8 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +2 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/plugin-tools/index.d.ts +2 -0
- package/dist/plugin-tools/index.d.ts.map +1 -0
- package/dist/plugin-tools/index.js +2 -0
- package/dist/plugin-tools/index.js.map +1 -0
- package/dist/plugin-tools/plugin-loader.d.ts +16 -0
- package/dist/plugin-tools/plugin-loader.d.ts.map +1 -0
- package/dist/plugin-tools/plugin-loader.js +166 -0
- package/dist/plugin-tools/plugin-loader.js.map +1 -0
- package/dist/plugins/imports/index.d.ts +3 -0
- package/dist/plugins/imports/index.d.ts.map +1 -0
- package/dist/plugins/imports/index.js +3 -0
- package/dist/plugins/imports/index.js.map +1 -0
- package/dist/plugins/imports/loader.d.ts +23 -0
- package/dist/plugins/imports/loader.d.ts.map +1 -0
- package/dist/plugins/imports/loader.js +81 -0
- package/dist/plugins/imports/loader.js.map +1 -0
- package/dist/plugins/imports/types.d.ts +27 -0
- package/dist/plugins/imports/types.d.ts.map +1 -0
- package/dist/plugins/imports/types.js +4 -0
- package/dist/plugins/imports/types.js.map +1 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +7 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/manifest/manifest.d.ts +13 -0
- package/dist/plugins/manifest/manifest.d.ts.map +1 -0
- package/dist/plugins/manifest/manifest.js +6 -0
- package/dist/plugins/manifest/manifest.js.map +1 -0
- package/dist/plugins/metadata/index.d.ts +2 -0
- package/dist/plugins/metadata/index.d.ts.map +1 -0
- package/dist/plugins/metadata/index.js +2 -0
- package/dist/plugins/metadata/index.js.map +1 -0
- package/dist/plugins/metadata/types.d.ts +163 -0
- package/dist/plugins/metadata/types.d.ts.map +1 -0
- package/dist/plugins/metadata/types.js +59 -0
- package/dist/plugins/metadata/types.js.map +1 -0
- package/dist/plugins/migrations/index.d.ts +2 -0
- package/dist/plugins/migrations/index.d.ts.map +1 -0
- package/dist/plugins/migrations/index.js +2 -0
- package/dist/plugins/migrations/index.js.map +1 -0
- package/dist/plugins/migrations/run-migrations.d.ts +4 -0
- package/dist/plugins/migrations/run-migrations.d.ts.map +1 -0
- package/dist/plugins/migrations/run-migrations.js +30 -0
- package/dist/plugins/migrations/run-migrations.js.map +1 -0
- package/dist/plugins/schema/common.d.ts +6 -0
- package/dist/plugins/schema/common.d.ts.map +1 -0
- package/dist/plugins/schema/common.js +2 -0
- package/dist/plugins/schema/common.js.map +1 -0
- package/dist/plugins/schema/index.d.ts +4 -0
- package/dist/plugins/schema/index.d.ts.map +1 -0
- package/dist/plugins/schema/index.js +4 -0
- package/dist/plugins/schema/index.js.map +1 -0
- package/dist/plugins/schema/parser.d.ts +19 -0
- package/dist/plugins/schema/parser.d.ts.map +1 -0
- package/dist/plugins/schema/parser.js +41 -0
- package/dist/plugins/schema/parser.js.map +1 -0
- package/dist/plugins/schema/store.d.ts +8 -0
- package/dist/plugins/schema/store.d.ts.map +1 -0
- package/dist/plugins/schema/store.js +21 -0
- package/dist/plugins/schema/store.js.map +1 -0
- package/dist/plugins/schema/zod-with-plugins.d.ts +12 -0
- package/dist/plugins/schema/zod-with-plugins.d.ts.map +1 -0
- package/dist/plugins/schema/zod-with-plugins.js +26 -0
- package/dist/plugins/schema/zod-with-plugins.js.map +1 -0
- package/dist/plugins/spec/auth-config-spec.d.ts +21 -0
- package/dist/plugins/spec/auth-config-spec.d.ts.map +1 -0
- package/dist/plugins/spec/auth-config-spec.js +6 -0
- package/dist/plugins/spec/auth-config-spec.js.map +1 -0
- package/dist/plugins/spec/config-spec.d.ts +31 -0
- package/dist/plugins/spec/config-spec.d.ts.map +1 -0
- package/dist/plugins/spec/config-spec.js +58 -0
- package/dist/plugins/spec/config-spec.js.map +1 -0
- package/dist/plugins/spec/index.d.ts +5 -0
- package/dist/plugins/spec/index.d.ts.map +1 -0
- package/dist/plugins/spec/index.js +5 -0
- package/dist/plugins/spec/index.js.map +1 -0
- package/dist/plugins/spec/types.d.ts +29 -0
- package/dist/plugins/spec/types.d.ts.map +1 -0
- package/dist/plugins/spec/types.js +17 -0
- package/dist/plugins/spec/types.js.map +1 -0
- package/dist/plugins/spec/web-config-spec.d.ts +22 -0
- package/dist/plugins/spec/web-config-spec.d.ts.map +1 -0
- package/dist/plugins/spec/web-config-spec.js +23 -0
- package/dist/plugins/spec/web-config-spec.js.map +1 -0
- package/dist/references/deserialize-schema.d.ts +4 -0
- package/dist/references/deserialize-schema.d.ts.map +1 -0
- package/dist/references/deserialize-schema.js +68 -0
- package/dist/references/deserialize-schema.js.map +1 -0
- package/dist/references/fix-ref-deletions.d.ts +22 -0
- package/dist/references/fix-ref-deletions.d.ts.map +1 -0
- package/dist/references/fix-ref-deletions.js +99 -0
- package/dist/references/fix-ref-deletions.js.map +1 -0
- package/dist/references/index.d.ts +6 -0
- package/dist/references/index.d.ts.map +1 -0
- package/dist/references/index.js +6 -0
- package/dist/references/index.js.map +1 -0
- package/dist/references/parse-schema-with-references.d.ts +14 -0
- package/dist/references/parse-schema-with-references.d.ts.map +1 -0
- package/dist/references/parse-schema-with-references.js +16 -0
- package/dist/references/parse-schema-with-references.js.map +1 -0
- package/dist/references/ref-builder.d.ts +346 -0
- package/dist/references/ref-builder.d.ts.map +1 -0
- package/dist/references/ref-builder.js +494 -0
- package/dist/references/ref-builder.js.map +1 -0
- package/dist/references/resolve-zod-ref-payload-names.d.ts +26 -0
- package/dist/references/resolve-zod-ref-payload-names.d.ts.map +1 -0
- package/dist/references/resolve-zod-ref-payload-names.js +52 -0
- package/dist/references/resolve-zod-ref-payload-names.js.map +1 -0
- package/dist/references/serialize-schema.d.ts +5 -0
- package/dist/references/serialize-schema.d.ts.map +1 -0
- package/dist/references/serialize-schema.js +22 -0
- package/dist/references/serialize-schema.js.map +1 -0
- package/dist/references/types.d.ts +126 -0
- package/dist/references/types.d.ts.map +1 -0
- package/dist/references/types.js +59 -0
- package/dist/references/types.js.map +1 -0
- package/dist/schema/apps/admin/app.d.ts +1144 -0
- package/dist/schema/apps/admin/app.d.ts.map +1 -0
- package/dist/schema/apps/admin/app.js +27 -0
- package/dist/schema/apps/admin/app.js.map +1 -0
- package/dist/schema/apps/admin/index.d.ts +3 -0
- package/dist/schema/apps/admin/index.d.ts.map +1 -0
- package/dist/schema/apps/admin/index.js +3 -0
- package/dist/schema/apps/admin/index.js.map +1 -0
- package/dist/schema/apps/admin/sections/base.d.ts +9 -0
- package/dist/schema/apps/admin/sections/base.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/base.js +15 -0
- package/dist/schema/apps/admin/sections/base.js.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-crud-input.d.ts +11 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-crud-input.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-crud-input.js +11 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-crud-input.js.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-input-spec.d.ts +17 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-input-spec.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-input-spec.js +30 -0
- package/dist/schema/apps/admin/sections/crud-form/admin-input-spec.js.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/built-in-input.d.ts +138 -0
- package/dist/schema/apps/admin/sections/crud-form/built-in-input.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/built-in-input.js +101 -0
- package/dist/schema/apps/admin/sections/crud-form/built-in-input.js.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/index.d.ts +5 -0
- package/dist/schema/apps/admin/sections/crud-form/index.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/index.js +5 -0
- package/dist/schema/apps/admin/sections/crud-form/index.js.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/types.d.ts +19 -0
- package/dist/schema/apps/admin/sections/crud-form/types.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/crud-form/types.js +14 -0
- package/dist/schema/apps/admin/sections/crud-form/types.js.map +1 -0
- package/dist/schema/apps/admin/sections/crud.d.ts +988 -0
- package/dist/schema/apps/admin/sections/crud.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/crud.js +101 -0
- package/dist/schema/apps/admin/sections/crud.js.map +1 -0
- package/dist/schema/apps/admin/sections/index.d.ts +5 -0
- package/dist/schema/apps/admin/sections/index.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/index.js +5 -0
- package/dist/schema/apps/admin/sections/index.js.map +1 -0
- package/dist/schema/apps/admin/sections/types.d.ts +2 -0
- package/dist/schema/apps/admin/sections/types.d.ts.map +1 -0
- package/dist/schema/apps/admin/sections/types.js +6 -0
- package/dist/schema/apps/admin/sections/types.js.map +1 -0
- package/dist/schema/apps/backend/index.d.ts +49 -0
- package/dist/schema/apps/backend/index.d.ts.map +1 -0
- package/dist/schema/apps/backend/index.js +15 -0
- package/dist/schema/apps/backend/index.js.map +1 -0
- package/dist/schema/apps/base.d.ts +25 -0
- package/dist/schema/apps/base.d.ts.map +1 -0
- package/dist/schema/apps/base.js +16 -0
- package/dist/schema/apps/base.js.map +1 -0
- package/dist/schema/apps/index.d.ts +6 -0
- package/dist/schema/apps/index.d.ts.map +1 -0
- package/dist/schema/apps/index.js +6 -0
- package/dist/schema/apps/index.js.map +1 -0
- package/dist/schema/apps/types.d.ts +6 -0
- package/dist/schema/apps/types.d.ts.map +1 -0
- package/dist/schema/apps/types.js +6 -0
- package/dist/schema/apps/types.js.map +1 -0
- package/dist/schema/apps/web/index.d.ts +49 -0
- package/dist/schema/apps/web/index.d.ts.map +1 -0
- package/dist/schema/apps/web/index.js +22 -0
- package/dist/schema/apps/web/index.js.map +1 -0
- package/dist/schema/auth/index.d.ts +2 -0
- package/dist/schema/auth/index.d.ts.map +1 -0
- package/dist/schema/auth/index.js +3 -0
- package/dist/schema/auth/index.js.map +1 -0
- package/dist/schema/creator/index.d.ts +2 -0
- package/dist/schema/creator/index.d.ts.map +1 -0
- package/dist/schema/creator/index.js +2 -0
- package/dist/schema/creator/index.js.map +1 -0
- package/dist/schema/creator/schema-creator.d.ts +4 -0
- package/dist/schema/creator/schema-creator.d.ts.map +1 -0
- package/dist/schema/creator/schema-creator.js +4 -0
- package/dist/schema/creator/schema-creator.js.map +1 -0
- package/dist/schema/creator/types.d.ts +14 -0
- package/dist/schema/creator/types.d.ts.map +1 -0
- package/dist/schema/creator/types.js +2 -0
- package/dist/schema/creator/types.js.map +1 -0
- package/dist/schema/features/feature.d.ts +33 -0
- package/dist/schema/features/feature.d.ts.map +1 -0
- package/dist/schema/features/feature.js +21 -0
- package/dist/schema/features/feature.js.map +1 -0
- package/dist/schema/features/index.d.ts +3 -0
- package/dist/schema/features/index.d.ts.map +1 -0
- package/dist/schema/features/index.js +3 -0
- package/dist/schema/features/index.js.map +1 -0
- package/dist/schema/features/theme.d.ts +208 -0
- package/dist/schema/features/theme.d.ts.map +1 -0
- package/dist/schema/features/theme.js +34 -0
- package/dist/schema/features/theme.js.map +1 -0
- package/dist/schema/index.d.ts +11 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +11 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/models/enums.d.ts +97 -0
- package/dist/schema/models/enums.d.ts.map +1 -0
- package/dist/schema/models/enums.js +25 -0
- package/dist/schema/models/enums.js.map +1 -0
- package/dist/schema/models/graphql.d.ts +181 -0
- package/dist/schema/models/graphql.d.ts.map +1 -0
- package/dist/schema/models/graphql.js +96 -0
- package/dist/schema/models/graphql.js.map +1 -0
- package/dist/schema/models/index.d.ts +1692 -0
- package/dist/schema/models/index.d.ts.map +1 -0
- package/dist/schema/models/index.js +220 -0
- package/dist/schema/models/index.js.map +1 -0
- package/dist/schema/models/mocks.d.ts +6 -0
- package/dist/schema/models/mocks.d.ts.map +1 -0
- package/dist/schema/models/mocks.js +55 -0
- package/dist/schema/models/mocks.js.map +1 -0
- package/dist/schema/models/transformers/built-in-transformers.d.ts +71 -0
- package/dist/schema/models/transformers/built-in-transformers.d.ts.map +1 -0
- package/dist/schema/models/transformers/built-in-transformers.js +59 -0
- package/dist/schema/models/transformers/built-in-transformers.js.map +1 -0
- package/dist/schema/models/transformers/index.d.ts +5 -0
- package/dist/schema/models/transformers/index.d.ts.map +1 -0
- package/dist/schema/models/transformers/index.js +5 -0
- package/dist/schema/models/transformers/index.js.map +1 -0
- package/dist/schema/models/transformers/model-transformer-spec.d.ts +17 -0
- package/dist/schema/models/transformers/model-transformer-spec.d.ts.map +1 -0
- package/dist/schema/models/transformers/model-transformer-spec.js +40 -0
- package/dist/schema/models/transformers/model-transformer-spec.js.map +1 -0
- package/dist/schema/models/transformers/transformers.d.ts +11 -0
- package/dist/schema/models/transformers/transformers.d.ts.map +1 -0
- package/dist/schema/models/transformers/transformers.js +11 -0
- package/dist/schema/models/transformers/transformers.js.map +1 -0
- package/dist/schema/models/transformers/types.d.ts +23 -0
- package/dist/schema/models/transformers/types.d.ts.map +1 -0
- package/dist/schema/models/transformers/types.js +12 -0
- package/dist/schema/models/transformers/types.js.map +1 -0
- package/dist/schema/models/types.d.ts +9 -0
- package/dist/schema/models/types.d.ts.map +1 -0
- package/dist/schema/models/types.js +14 -0
- package/dist/schema/models/types.js.map +1 -0
- package/dist/schema/plugins/definition.d.ts +128 -0
- package/dist/schema/plugins/definition.d.ts.map +1 -0
- package/dist/schema/plugins/definition.js +28 -0
- package/dist/schema/plugins/definition.js.map +1 -0
- package/dist/schema/plugins/entity-types.d.ts +2 -0
- package/dist/schema/plugins/entity-types.d.ts.map +1 -0
- package/dist/schema/plugins/entity-types.js +3 -0
- package/dist/schema/plugins/entity-types.js.map +1 -0
- package/dist/schema/plugins/index.d.ts +3 -0
- package/dist/schema/plugins/index.d.ts.map +1 -0
- package/dist/schema/plugins/index.js +3 -0
- package/dist/schema/plugins/index.js.map +1 -0
- package/dist/schema/project-definition.d.ts +2877 -0
- package/dist/schema/project-definition.d.ts.map +1 -0
- package/dist/schema/project-definition.js +34 -0
- package/dist/schema/project-definition.js.map +1 -0
- package/dist/schema/settings.d.ts +228 -0
- package/dist/schema/settings.d.ts.map +1 -0
- package/dist/schema/settings.js +32 -0
- package/dist/schema/settings.js.map +1 -0
- package/dist/schema/template-extractor/index.d.ts +25 -0
- package/dist/schema/template-extractor/index.d.ts.map +1 -0
- package/dist/schema/template-extractor/index.js +18 -0
- package/dist/schema/template-extractor/index.js.map +1 -0
- package/dist/schema/utils/validation.d.ts +8 -0
- package/dist/schema/utils/validation.d.ts.map +1 -0
- package/dist/schema/utils/validation.js +18 -0
- package/dist/schema/utils/validation.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/model-merger/index.d.ts +2 -0
- package/dist/tools/model-merger/index.d.ts.map +1 -0
- package/dist/tools/model-merger/index.js +2 -0
- package/dist/tools/model-merger/index.js.map +1 -0
- package/dist/tools/model-merger/model-merger.d.ts +376 -0
- package/dist/tools/model-merger/model-merger.d.ts.map +1 -0
- package/dist/tools/model-merger/model-merger.js +229 -0
- package/dist/tools/model-merger/model-merger.js.map +1 -0
- package/dist/types/field-types.d.ts +3 -0
- package/dist/types/field-types.d.ts.map +1 -0
- package/dist/types/field-types.js +13 -0
- package/dist/types/field-types.js.map +1 -0
- package/dist/types/files.d.ts +8 -0
- package/dist/types/files.d.ts.map +1 -0
- package/dist/types/files.js +2 -0
- package/dist/types/files.js.map +1 -0
- package/dist/utils/color-conversions.d.ts +20 -0
- package/dist/utils/color-conversions.d.ts.map +1 -0
- package/dist/utils/color-conversions.js +38 -0
- package/dist/utils/color-conversions.js.map +1 -0
- package/dist/utils/color-names.d.ts +18 -0
- package/dist/utils/color-names.d.ts.map +1 -0
- package/dist/utils/color-names.js +54 -0
- package/dist/utils/color-names.js.map +1 -0
- package/dist/utils/definition-diff/definition-diff.d.ts +68 -0
- package/dist/utils/definition-diff/definition-diff.d.ts.map +1 -0
- package/dist/utils/definition-diff/definition-diff.js +149 -0
- package/dist/utils/definition-diff/definition-diff.js.map +1 -0
- package/dist/utils/definition-diff/index.d.ts +2 -0
- package/dist/utils/definition-diff/index.d.ts.map +1 -0
- package/dist/utils/definition-diff/index.js +2 -0
- package/dist/utils/definition-diff/index.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/path.d.ts +5 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +27 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/strip.d.ts +18 -0
- package/dist/utils/strip.d.ts.map +1 -0
- package/dist/utils/strip.js +37 -0
- package/dist/utils/strip.js.map +1 -0
- package/dist/utils/theme.d.ts +10 -0
- package/dist/utils/theme.d.ts.map +1 -0
- package/dist/utils/theme.js +58 -0
- package/dist/utils/theme.js.map +1 -0
- package/dist/web/components/FeatureComboboxField.d.ts +17 -0
- package/dist/web/components/FeatureComboboxField.d.ts.map +1 -0
- package/dist/web/components/FeatureComboboxField.js +38 -0
- package/dist/web/components/FeatureComboboxField.js.map +1 -0
- package/dist/web/components/ModelComboboxField.d.ts +17 -0
- package/dist/web/components/ModelComboboxField.d.ts.map +1 -0
- package/dist/web/components/ModelComboboxField.js +38 -0
- package/dist/web/components/ModelComboboxField.js.map +1 -0
- package/dist/web/components/ModelMergerResultAlert.d.ts +8 -0
- package/dist/web/components/ModelMergerResultAlert.d.ts.map +1 -0
- package/dist/web/components/ModelMergerResultAlert.js +10 -0
- package/dist/web/components/ModelMergerResultAlert.js.map +1 -0
- package/dist/web/components/index.d.ts +4 -0
- package/dist/web/components/index.d.ts.map +1 -0
- package/dist/web/components/index.js +4 -0
- package/dist/web/components/index.js.map +1 -0
- package/dist/web/contexts/error-handler.d.ts +7 -0
- package/dist/web/contexts/error-handler.d.ts.map +1 -0
- package/dist/web/contexts/error-handler.js +3 -0
- package/dist/web/contexts/error-handler.js.map +1 -0
- package/dist/web/contexts/index.d.ts +2 -0
- package/dist/web/contexts/index.d.ts.map +1 -0
- package/dist/web/contexts/index.js +2 -0
- package/dist/web/contexts/index.js.map +1 -0
- package/dist/web/hooks/index.d.ts +8 -0
- package/dist/web/hooks/index.d.ts.map +1 -0
- package/dist/web/hooks/index.js +8 -0
- package/dist/web/hooks/index.js.map +1 -0
- package/dist/web/hooks/useBlockDirtyFormNavigate.d.ts +3 -0
- package/dist/web/hooks/useBlockDirtyFormNavigate.d.ts.map +1 -0
- package/dist/web/hooks/useBlockDirtyFormNavigate.js +14 -0
- package/dist/web/hooks/useBlockDirtyFormNavigate.js.map +1 -0
- package/dist/web/hooks/useBlockUnsavedChangesNavigate.d.ts +7 -0
- package/dist/web/hooks/useBlockUnsavedChangesNavigate.d.ts.map +1 -0
- package/dist/web/hooks/useBlockUnsavedChangesNavigate.js +47 -0
- package/dist/web/hooks/useBlockUnsavedChangesNavigate.js.map +1 -0
- package/dist/web/hooks/useBlockerDialog.d.ts +44 -0
- package/dist/web/hooks/useBlockerDialog.d.ts.map +1 -0
- package/dist/web/hooks/useBlockerDialog.js +77 -0
- package/dist/web/hooks/useBlockerDialog.js.map +1 -0
- package/dist/web/hooks/useErrorHandler.d.ts +3 -0
- package/dist/web/hooks/useErrorHandler.d.ts.map +1 -0
- package/dist/web/hooks/useErrorHandler.js +10 -0
- package/dist/web/hooks/useErrorHandler.js.map +1 -0
- package/dist/web/hooks/usePluginEnhancedSchema.d.ts +4 -0
- package/dist/web/hooks/usePluginEnhancedSchema.d.ts.map +1 -0
- package/dist/web/hooks/usePluginEnhancedSchema.js +8 -0
- package/dist/web/hooks/usePluginEnhancedSchema.js.map +1 -0
- package/dist/web/hooks/useProjectDefinition.d.ts +65 -0
- package/dist/web/hooks/useProjectDefinition.d.ts.map +1 -0
- package/dist/web/hooks/useProjectDefinition.js +10 -0
- package/dist/web/hooks/useProjectDefinition.js.map +1 -0
- package/dist/web/hooks/useResettableForm.d.ts +3 -0
- package/dist/web/hooks/useResettableForm.d.ts.map +1 -0
- package/dist/web/hooks/useResettableForm.js +29 -0
- package/dist/web/hooks/useResettableForm.js.map +1 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +6 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/specs/admin-crud-input-web-spec.d.ts +36 -0
- package/dist/web/specs/admin-crud-input-web-spec.d.ts.map +1 -0
- package/dist/web/specs/admin-crud-input-web-spec.js +35 -0
- package/dist/web/specs/admin-crud-input-web-spec.js.map +1 -0
- package/dist/web/specs/index.d.ts +3 -0
- package/dist/web/specs/index.d.ts.map +1 -0
- package/dist/web/specs/index.js +3 -0
- package/dist/web/specs/index.js.map +1 -0
- package/dist/web/specs/model-transformer-web-spec.d.ts +40 -0
- package/dist/web/specs/model-transformer-web-spec.d.ts.map +1 -0
- package/dist/web/specs/model-transformer-web-spec.js +35 -0
- package/dist/web/specs/model-transformer-web-spec.js.map +1 -0
- package/dist/web/utils/form.d.ts +2 -0
- package/dist/web/utils/form.d.ts.map +1 -0
- package/dist/web/utils/form.js +6 -0
- package/dist/web/utils/form.js.map +1 -0
- package/dist/web/utils/index.d.ts +2 -0
- package/dist/web/utils/index.d.ts.map +1 -0
- package/dist/web/utils/index.js +2 -0
- package/dist/web/utils/index.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a schema migration.
|
|
3
|
+
*
|
|
4
|
+
* @template TInputConfig - The type of the input configuration.
|
|
5
|
+
* @template TOutputConfig - The type of the output configuration.
|
|
6
|
+
*/
|
|
7
|
+
export interface SchemaMigration<TInputConfig = any, TOutputConfig = any> {
|
|
8
|
+
/**
|
|
9
|
+
* The version of the migration. Must be sequential.
|
|
10
|
+
*/
|
|
11
|
+
version: number;
|
|
12
|
+
/**
|
|
13
|
+
* The name of the migration.
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* A description of the migration.
|
|
18
|
+
*/
|
|
19
|
+
description: string;
|
|
20
|
+
/**
|
|
21
|
+
* Migrate the configuration.
|
|
22
|
+
*
|
|
23
|
+
* @param config - The configuration to migrate.
|
|
24
|
+
* @returns The migrated configuration.
|
|
25
|
+
*/
|
|
26
|
+
migrate: (config: TInputConfig) => TOutputConfig;
|
|
27
|
+
}
|
|
28
|
+
export declare function createSchemaMigration<TInputConfig, TOutputConfig>(migration: SchemaMigration<TInputConfig, TOutputConfig>): SchemaMigration<TInputConfig, TOutputConfig>;
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/migrations/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,eAAe,CAAC,YAAY,GAAG,GAAG,EAAE,aAAa,GAAG,GAAG;IACtE;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,aAAa,CAAC;CAClD;AAED,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,aAAa,EAC/D,SAAS,EAAE,eAAe,CAAC,YAAY,EAAE,aAAa,CAAC,GACtD,eAAe,CAAC,YAAY,EAAE,aAAa,CAAC,CAE9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/migrations/types.ts"],"names":[],"mappings":"AA6BA,MAAM,UAAU,qBAAqB,CACnC,SAAuD;IAEvD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/migrations/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtE,GAAG,EAAE,CAAC,GACL,CAAC,CAEH;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtE,GAAG,EAAE,CAAC,GACL,CAAC,GAAG,SAAS,CAIf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { pickBy } from 'es-toolkit';
|
|
2
|
+
export function stripUndefinedChildren(obj) {
|
|
3
|
+
return pickBy(obj, (value) => value !== undefined);
|
|
4
|
+
}
|
|
5
|
+
export function undefinedIfEmptyObject(obj) {
|
|
6
|
+
return Object.keys(obj).every((key) => obj[key] === undefined)
|
|
7
|
+
? undefined
|
|
8
|
+
: obj;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/migrations/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAU,sBAAsB,CACpC,GAAM;IAEN,OAAO,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAM,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,GAAM;IAEN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;QAC5D,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,GAAG,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PluginStore } from '#src/plugins/imports/types.js';
|
|
2
|
+
import type { PluginImplementationStore, ZodPluginWrapper } from '#src/plugins/index.js';
|
|
3
|
+
import type { ResolvedZodRefPayload } from '#src/references/types.js';
|
|
4
|
+
import type { ProjectDefinition, ProjectDefinitionSchema } from '#src/schema/project-definition.js';
|
|
5
|
+
import type { SchemaParserContext } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a plugin implementation store from the project definition and plugin store,
|
|
8
|
+
* initializing the set of plugins enabled in the project definition.
|
|
9
|
+
*
|
|
10
|
+
* @param pluginStore The plugin store to use
|
|
11
|
+
* @param projectDefinition The project definition to use
|
|
12
|
+
* @returns The plugin implementation store
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPluginImplementationStore(pluginStore: PluginStore, projectDefinition: unknown): PluginImplementationStore;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a project definition schema with the given context.
|
|
17
|
+
*
|
|
18
|
+
* @param projectDefinition The project definition to create a schema for
|
|
19
|
+
* @param context The context to use
|
|
20
|
+
* @return The project definition schema
|
|
21
|
+
*/
|
|
22
|
+
export declare function createProjectDefinitionSchemaWithContext(projectDefinition: unknown, context: SchemaParserContext): ZodPluginWrapper<ProjectDefinitionSchema>;
|
|
23
|
+
export declare function parseProjectDefinitionWithContext(projectDefinition: unknown, context: SchemaParserContext): ProjectDefinition;
|
|
24
|
+
/**
|
|
25
|
+
* Parses a project definition and obtains entities/references from it.
|
|
26
|
+
*
|
|
27
|
+
* @param projectDefinition The project definition to parse
|
|
28
|
+
* @param context The context to use
|
|
29
|
+
* @returns The parsed project definition with entities/references
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseProjectDefinitionWithReferences(projectDefinition: unknown, context: SchemaParserContext): {
|
|
32
|
+
definition: ResolvedZodRefPayload<ProjectDefinition>;
|
|
33
|
+
pluginStore: PluginImplementationStore;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAEV,yBAAyB,EAGzB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,mCAAmC,CAAC;AAS3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAOtD;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,OAAO,GACzB,yBAAyB,CA2C3B;AAED;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACtD,iBAAiB,EAAE,OAAO,EAC1B,OAAO,EAAE,mBAAmB,GAC3B,gBAAgB,CAAC,uBAAuB,CAAC,CAU3C;AAED,wBAAgB,iCAAiC,CAC/C,iBAAiB,EAAE,OAAO,EAC1B,OAAO,EAAE,mBAAmB,GAC3B,iBAAiB,CAMnB;AAED;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,iBAAiB,EAAE,OAAO,EAC1B,OAAO,EAAE,mBAAmB,GAC3B;IACD,UAAU,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IACrD,WAAW,EAAE,yBAAyB,CAAC;CACxC,CAOA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { initializePlugins } from '#src/plugins/imports/loader.js';
|
|
3
|
+
import { pluginConfigSpec, zPluginWrapper } from '#src/plugins/index.js';
|
|
4
|
+
import { parseSchemaWithReferences } from '#src/references/parse-schema-with-references.js';
|
|
5
|
+
import { adminCrudInputSpec, modelTransformerSpec } from '#src/schema/index.js';
|
|
6
|
+
import { basePluginDefinitionSchema } from '#src/schema/plugins/definition.js';
|
|
7
|
+
import { createProjectDefinitionSchema } from '#src/schema/project-definition.js';
|
|
8
|
+
const COMMON_SPEC_IMPLEMENTATIONS = [pluginConfigSpec, modelTransformerSpec, adminCrudInputSpec];
|
|
9
|
+
/**
|
|
10
|
+
* Creates a plugin implementation store from the project definition and plugin store,
|
|
11
|
+
* initializing the set of plugins enabled in the project definition.
|
|
12
|
+
*
|
|
13
|
+
* @param pluginStore The plugin store to use
|
|
14
|
+
* @param projectDefinition The project definition to use
|
|
15
|
+
* @returns The plugin implementation store
|
|
16
|
+
*/
|
|
17
|
+
export function createPluginImplementationStore(pluginStore, projectDefinition) {
|
|
18
|
+
const { availablePlugins, builtinSpecImplementations = [] } = pluginStore;
|
|
19
|
+
const pluginData = z
|
|
20
|
+
.object({
|
|
21
|
+
plugins: z.array(basePluginDefinitionSchema).optional(),
|
|
22
|
+
})
|
|
23
|
+
.parse(projectDefinition);
|
|
24
|
+
const { plugins = [] } = pluginData;
|
|
25
|
+
// initialize plugins
|
|
26
|
+
const initialImplementations = [
|
|
27
|
+
...COMMON_SPEC_IMPLEMENTATIONS,
|
|
28
|
+
...builtinSpecImplementations,
|
|
29
|
+
];
|
|
30
|
+
const specImplementations = {};
|
|
31
|
+
for (const spec of initialImplementations) {
|
|
32
|
+
if ('type' in spec) {
|
|
33
|
+
if (typeof spec.defaultInitializer !== 'function') {
|
|
34
|
+
throw new TypeError(`Spec ${spec.type} does not have a defaultInitializer function!`);
|
|
35
|
+
}
|
|
36
|
+
specImplementations[spec.name] = spec.defaultInitializer();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
specImplementations[spec.spec.name] = spec.implementation;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const pluginsWithModules = plugins.map((p) => {
|
|
43
|
+
const plugin = availablePlugins.find(({ metadata }) => metadata.name === p.name && metadata.packageName === p.packageName);
|
|
44
|
+
const pluginName = `${p.packageName}/${p.name}`;
|
|
45
|
+
if (!plugin) {
|
|
46
|
+
throw new Error(`Unable to find plugin ${pluginName}!`);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
id: plugin.metadata.id,
|
|
50
|
+
name: pluginName,
|
|
51
|
+
pluginModules: plugin.modules,
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
return initializePlugins(pluginsWithModules, specImplementations);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a project definition schema with the given context.
|
|
58
|
+
*
|
|
59
|
+
* @param projectDefinition The project definition to create a schema for
|
|
60
|
+
* @param context The context to use
|
|
61
|
+
* @return The project definition schema
|
|
62
|
+
*/
|
|
63
|
+
export function createProjectDefinitionSchemaWithContext(projectDefinition, context) {
|
|
64
|
+
const { pluginStore } = context;
|
|
65
|
+
const pluginImplementationStore = createPluginImplementationStore(pluginStore, projectDefinition);
|
|
66
|
+
return zPluginWrapper(createProjectDefinitionSchema({ plugins: pluginImplementationStore }), pluginImplementationStore);
|
|
67
|
+
}
|
|
68
|
+
export function parseProjectDefinitionWithContext(projectDefinition, context) {
|
|
69
|
+
const schema = createProjectDefinitionSchemaWithContext(projectDefinition, context);
|
|
70
|
+
return schema.parse(projectDefinition);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Parses a project definition and obtains entities/references from it.
|
|
74
|
+
*
|
|
75
|
+
* @param projectDefinition The project definition to parse
|
|
76
|
+
* @param context The context to use
|
|
77
|
+
* @returns The parsed project definition with entities/references
|
|
78
|
+
*/
|
|
79
|
+
export function parseProjectDefinitionWithReferences(projectDefinition, context) {
|
|
80
|
+
const schema = createProjectDefinitionSchemaWithContext(projectDefinition, context);
|
|
81
|
+
const definition = parseSchemaWithReferences(schema, projectDefinition);
|
|
82
|
+
return { definition, pluginStore: schema._def.pluginStore };
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAIlF,MAAM,2BAA2B,GAG3B,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,UAAU,+BAA+B,CAC7C,WAAwB,EACxB,iBAA0B;IAE1B,MAAM,EAAE,gBAAgB,EAAE,0BAA0B,GAAG,EAAE,EAAE,GAAG,WAAW,CAAC;IAC1E,MAAM,UAAU,GAAG,CAAC;SACjB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,QAAQ,EAAE;KACxD,CAAC;SACD,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC5B,MAAM,EAAE,OAAO,GAAG,EAAE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AC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wCAAwC,CACtD,iBAA0B,EAC1B,OAA4B;IAE5B,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,yBAAyB,GAAG,+BAA+B,CAC/D,WAAW,EACX,iBAAiB,CAClB,CAAC;IACF,OAAO,cAAc,CACnB,6BAA6B,CAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC,EACrE,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,iBAA0B,EAC1B,OAA4B;IAE5B,MAAM,MAAM,GAAG,wCAAwC,CACrD,iBAAiB,EACjB,OAAO,CACR,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oCAAoC,CAClD,iBAA0B,EAC1B,OAA4B;IAK5B,MAAM,MAAM,GAAG,wCAAwC,CACrD,iBAAiB,EACjB,OAAO,CACR,CAAC;IACF,MAAM,UAAU,GAAG,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACxE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/parser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,WAAW,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/parser/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin-tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin-tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PluginMetadataWithPaths } from '../plugins/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Finds the available plugins in a package.
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadPluginsInPackage(pluginPackageDirectory: string, packageName: string): Promise<PluginMetadataWithPaths[]>;
|
|
6
|
+
export declare function rewriteDistToSrc(directory: string): string;
|
|
7
|
+
interface GetModuleFederationTargetsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Rewrites the plugin directory to a different path. Useful when
|
|
10
|
+
* the source plugin directory is different than the compiled code.
|
|
11
|
+
*/
|
|
12
|
+
rewritePluginDirectory?: (directory: string) => string;
|
|
13
|
+
}
|
|
14
|
+
export declare function getModuleFederationTargets(pluginPackageDirectory: string, options?: GetModuleFederationTargetsOptions): Promise<Record<string, string>>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=plugin-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/plugin-tools/plugin-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGV,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAiM7B;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,sBAAsB,EAAE,MAAM,EAC9B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAqBpC;AA6BD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,UAAU,iCAAiC;IACzC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CACxD;AAED,wBAAsB,0BAA0B,CAC9C,sBAAsB,EAAE,MAAM,EAC9B,OAAO,GAAE,iCAAsC,GAC9C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAuCjC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { globby } from 'globby';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { pluginManifestJsonSchema, pluginMetadataSchema, } from '../plugins/index.js';
|
|
5
|
+
class PluginLoaderError extends Error {
|
|
6
|
+
constructor(message, innerError) {
|
|
7
|
+
super(`Error loading plugin (${message}): ${innerError instanceof Error ? innerError.message : String(innerError)}`);
|
|
8
|
+
Object.defineProperty(this, "innerError", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: innerError
|
|
13
|
+
});
|
|
14
|
+
this.name = 'PluginLoaderError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function fileExists(path) {
|
|
18
|
+
return fs
|
|
19
|
+
.access(path)
|
|
20
|
+
.then(() => true)
|
|
21
|
+
.catch(() => false);
|
|
22
|
+
}
|
|
23
|
+
async function readManifestJson(pluginPackagePath) {
|
|
24
|
+
const manifestJsonPath = path.join(pluginPackagePath, 'manifest.json');
|
|
25
|
+
if (!(await fileExists(manifestJsonPath))) {
|
|
26
|
+
throw new Error(`Package ${pluginPackagePath} does not have a valid manifest.json file.`);
|
|
27
|
+
}
|
|
28
|
+
return await fs
|
|
29
|
+
.readFile(manifestJsonPath, 'utf8')
|
|
30
|
+
.then((data) => pluginManifestJsonSchema.parse(JSON.parse(data)));
|
|
31
|
+
}
|
|
32
|
+
async function readMetadataJson(directory) {
|
|
33
|
+
const metadataJsonFilename = path.join(directory, 'metadata.json');
|
|
34
|
+
try {
|
|
35
|
+
if (!(await fileExists(metadataJsonFilename))) {
|
|
36
|
+
throw new Error(`Plugin metadata file not found: ${metadataJsonFilename}`);
|
|
37
|
+
}
|
|
38
|
+
return await fs
|
|
39
|
+
.readFile(metadataJsonFilename, 'utf8')
|
|
40
|
+
.then((data) => pluginMetadataSchema.parse(JSON.parse(data)));
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
throw new PluginLoaderError(`Unable to read plugin metadata ${metadataJsonFilename}`, error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const ENTRYPOINT_TYPES = ['node', 'web', 'common'];
|
|
47
|
+
const NODE_ENTRYPOINT_TYPES = new Set(['node', 'common']);
|
|
48
|
+
const WEB_ENTRYPOINT_TYPES = new Set(['web', 'common']);
|
|
49
|
+
/**
|
|
50
|
+
* Look for a file that exists with a JS extension (.js(x), .ts(x))
|
|
51
|
+
*/
|
|
52
|
+
async function findJavascriptFile(pathWithoutExtension) {
|
|
53
|
+
const candidatePaths = ['ts', 'js', 'tsx', 'jsx'].map((extension) => `${pathWithoutExtension}.${extension}`);
|
|
54
|
+
for (const path of candidatePaths) {
|
|
55
|
+
if (await fileExists(path)) {
|
|
56
|
+
return path;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
async function getPluginEntrypoints(metadata, pluginDirectory) {
|
|
62
|
+
try {
|
|
63
|
+
const { moduleDirectories = ['.'] } = metadata;
|
|
64
|
+
// find all module directories
|
|
65
|
+
const moduleDirectoryPaths = moduleDirectories.map((moduleDirectory) => path.join(pluginDirectory, moduleDirectory));
|
|
66
|
+
const moduleEntrypoints = await Promise.all(moduleDirectoryPaths.map(async (moduleDirectoryPath) => await Promise.all(ENTRYPOINT_TYPES.map(async (entrypoint) => {
|
|
67
|
+
const entrypointPath = await findJavascriptFile(path.join(moduleDirectoryPath, entrypoint));
|
|
68
|
+
if (!entrypointPath) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
return { type: entrypoint, path: entrypointPath };
|
|
72
|
+
}))));
|
|
73
|
+
return moduleEntrypoints.flat().filter((x) => x !== undefined);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new PluginLoaderError(`Unable to find plugin entrypoints in ${pluginDirectory}`, error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function getWebEntrypointImport(pluginName, pluginDirectory, entrypointPath) {
|
|
80
|
+
const pathWithoutExtension = entrypointPath.replace(/\.[jt]sx?$/, '');
|
|
81
|
+
const relativeEntrypoint = path
|
|
82
|
+
.relative(pluginDirectory, pathWithoutExtension)
|
|
83
|
+
.replace(/\\/g, '/');
|
|
84
|
+
return `${pluginName}/${relativeEntrypoint}`;
|
|
85
|
+
}
|
|
86
|
+
async function populatePluginMetadataWithPaths(metadata, packageName, pluginDirectory, webBuildDirectory) {
|
|
87
|
+
try {
|
|
88
|
+
const entrypoints = await getPluginEntrypoints(metadata, pluginDirectory);
|
|
89
|
+
const nodeEntrypoints = entrypoints.filter((n) => NODE_ENTRYPOINT_TYPES.has(n.type));
|
|
90
|
+
const webEntrypoints = entrypoints.filter((n) => WEB_ENTRYPOINT_TYPES.has(n.type));
|
|
91
|
+
return {
|
|
92
|
+
...metadata,
|
|
93
|
+
// URL safe ID
|
|
94
|
+
id: `${packageName
|
|
95
|
+
.replace(/^@/, '')
|
|
96
|
+
.replace(/[^a-z0-9/]+/g, '-')
|
|
97
|
+
.replace(/\//g, '_')}_${metadata.name.replace(/[^a-z0-9]+/g, '-')}`,
|
|
98
|
+
packageName,
|
|
99
|
+
pluginDirectory,
|
|
100
|
+
webBuildDirectory,
|
|
101
|
+
nodeModulePaths: nodeEntrypoints.map((e) => e.path),
|
|
102
|
+
webModulePaths: webEntrypoints.map((e) => getWebEntrypointImport(metadata.name, pluginDirectory, e.path)),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
throw new PluginLoaderError('Unable to populate plugin metadata with paths', error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async function getPluginDirectories(pluginPackageDirectory, plugins) {
|
|
110
|
+
const pluginDirectories = await globby(plugins, {
|
|
111
|
+
cwd: pluginPackageDirectory,
|
|
112
|
+
onlyDirectories: true,
|
|
113
|
+
expandDirectories: false,
|
|
114
|
+
});
|
|
115
|
+
return pluginDirectories.map((pluginDirectory) => path.join(pluginPackageDirectory, pluginDirectory));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Finds the available plugins in a package.
|
|
119
|
+
*/
|
|
120
|
+
export async function loadPluginsInPackage(pluginPackageDirectory, packageName) {
|
|
121
|
+
// Look for manifest.json file
|
|
122
|
+
const manifest = await readManifestJson(pluginPackageDirectory);
|
|
123
|
+
const pluginDirectories = await getPluginDirectories(pluginPackageDirectory, manifest.plugins);
|
|
124
|
+
// Load the plugins
|
|
125
|
+
const plugins = await Promise.all(pluginDirectories.map(async (directory) => {
|
|
126
|
+
const metadata = await readMetadataJson(directory);
|
|
127
|
+
return populatePluginMetadataWithPaths(metadata, packageName, directory, path.join(pluginPackageDirectory, manifest.webBuild));
|
|
128
|
+
}));
|
|
129
|
+
return plugins;
|
|
130
|
+
}
|
|
131
|
+
async function getModuleFederationTargetsForPlugin(metadata, pluginDirectory, pluginPackageDirectory) {
|
|
132
|
+
const entrypoints = await getPluginEntrypoints(metadata, pluginDirectory);
|
|
133
|
+
const pluginTargets = entrypoints
|
|
134
|
+
.filter((e) => WEB_ENTRYPOINT_TYPES.has(e.type))
|
|
135
|
+
.map((entrypoint) => {
|
|
136
|
+
const entrypointImport = getWebEntrypointImport(metadata.name, pluginDirectory, entrypoint.path);
|
|
137
|
+
const relativePath = path.relative(pluginPackageDirectory, entrypoint.path);
|
|
138
|
+
return {
|
|
139
|
+
[entrypointImport]: relativePath,
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
return Object.assign({}, ...pluginTargets.flat());
|
|
143
|
+
}
|
|
144
|
+
export function rewriteDistToSrc(directory) {
|
|
145
|
+
return directory.replace(/^dist\//, 'src/');
|
|
146
|
+
}
|
|
147
|
+
export async function getModuleFederationTargets(pluginPackageDirectory, options = {}) {
|
|
148
|
+
const { rewritePluginDirectory } = options;
|
|
149
|
+
const manifest = await readManifestJson(pluginPackageDirectory);
|
|
150
|
+
const pluginDirectories = await getPluginDirectories(pluginPackageDirectory, manifest.plugins.map((plugin) => rewritePluginDirectory ? rewritePluginDirectory(plugin) : plugin));
|
|
151
|
+
const rewrittenPluginDirectories = rewritePluginDirectory
|
|
152
|
+
? pluginDirectories.map((directory) => {
|
|
153
|
+
const relativeDirectory = path.relative(pluginPackageDirectory, directory);
|
|
154
|
+
return path.join(pluginPackageDirectory, rewritePluginDirectory(relativeDirectory));
|
|
155
|
+
})
|
|
156
|
+
: pluginDirectories;
|
|
157
|
+
const targets = await Promise.all(rewrittenPluginDirectories.map(async (directory) => {
|
|
158
|
+
const metadata = await readMetadataJson(directory);
|
|
159
|
+
return getModuleFederationTargetsForPlugin(metadata, directory, pluginPackageDirectory);
|
|
160
|
+
}));
|
|
161
|
+
if (targets.length === 0) {
|
|
162
|
+
throw new Error(`No module federation targets found in ${pluginPackageDirectory}`);
|
|
163
|
+
}
|
|
164
|
+
return Object.assign({}, ...targets);
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=plugin-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/plugin-tools/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,iBAAkB,S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AO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,0BAA0B,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACjD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACnD,OAAO,mCAAmC,CACxC,QAAQ,EACR,SAAS,EACT,sBAAsB,CACvB,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,yCAAyC,sBAAsB,EAAE,CAClE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,OAAO,CAA2B,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/imports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/imports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PluginSpecImplementation } from '../spec/types.js';
|
|
2
|
+
import type { KeyedPluginPlatformModule } from './types.js';
|
|
3
|
+
import { PluginImplementationStore } from '../schema/store.js';
|
|
4
|
+
export interface PluginWithPlatformModules {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
pluginModules: KeyedPluginPlatformModule[];
|
|
8
|
+
}
|
|
9
|
+
interface KeyedPlatformModuleWithPlugin extends KeyedPluginPlatformModule {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
pluginId: string;
|
|
13
|
+
pluginName: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function extractPlatformModulesFromPlugins(plugins: PluginWithPlatformModules[]): KeyedPlatformModuleWithPlugin[];
|
|
16
|
+
export declare function getOrderedPluginModuleInitializationSteps(pluginModules: KeyedPlatformModuleWithPlugin[], initialSpecImplementations: Record<string, PluginSpecImplementation>): string[];
|
|
17
|
+
export declare function initializeOrderedPluginModules(orderedPluginModules: KeyedPlatformModuleWithPlugin[], initialSpecImplementations: Partial<Record<string, PluginSpecImplementation>>): Partial<Record<string, PluginSpecImplementation>>;
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the plugins based on their interdependencies and creates a store of the plugin implementations
|
|
20
|
+
*/
|
|
21
|
+
export declare function initializePlugins(plugins: PluginWithPlatformModules[], initialSpecImplementations: Record<string, PluginSpecImplementation>): PluginImplementationStore;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/plugins/imports/loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,yBAAyB,EAAE,CAAC;CAC5C;AAED,UAAU,6BAA8B,SAAQ,yBAAyB;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,yBAAyB,EAAE,GACnC,6BAA6B,EAAE,CAUjC;AAED,wBAAgB,yCAAyC,CACvD,aAAa,EAAE,6BAA6B,EAAE,EAC9C,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,GACnE,MAAM,EAAE,CAgDV;AAED,wBAAgB,8BAA8B,CAC5C,oBAAoB,EAAE,6BAA6B,EAAE,EACrD,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,GAC5E,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CA4BnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,yBAAyB,EAAE,EACpC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,GACnE,yBAAyB,CAc3B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { toposortOrdered } from '@baseplate-dev/utils';
|
|
2
|
+
import { keyBy, mapValues } from 'es-toolkit';
|
|
3
|
+
import { stripUndefinedValues } from '#src/utils/strip.js';
|
|
4
|
+
import { PluginImplementationStore } from '../schema/store.js';
|
|
5
|
+
export function extractPlatformModulesFromPlugins(plugins) {
|
|
6
|
+
return plugins.flatMap((plugin) => plugin.pluginModules.map((m) => ({
|
|
7
|
+
...m,
|
|
8
|
+
id: `${plugin.id}/${m.key}`,
|
|
9
|
+
name: `${plugin.name}/${m.key}`,
|
|
10
|
+
pluginId: plugin.id,
|
|
11
|
+
pluginName: plugin.name,
|
|
12
|
+
})));
|
|
13
|
+
}
|
|
14
|
+
export function getOrderedPluginModuleInitializationSteps(pluginModules, initialSpecImplementations) {
|
|
15
|
+
const pluginModulesById = keyBy(pluginModules, (p) => p.id);
|
|
16
|
+
// create export map of plugin ID to export spec name
|
|
17
|
+
const pluginModuleIdByExport = mapValues(initialSpecImplementations, () => 'built-in');
|
|
18
|
+
for (const { name, module, id } of pluginModules) {
|
|
19
|
+
for (const m of Object.values(module.exports ?? {})) {
|
|
20
|
+
const exportName = m.name;
|
|
21
|
+
if (exportName in pluginModuleIdByExport) {
|
|
22
|
+
const existingPlugin = pluginModulesById[pluginModuleIdByExport[exportName]];
|
|
23
|
+
throw new Error(`Duplicate export from plugins found ${exportName} (${name} and ${existingPlugin.name})`);
|
|
24
|
+
}
|
|
25
|
+
pluginModuleIdByExport[exportName] = id;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// create list of plugin to plugin dependencies
|
|
29
|
+
const edges = pluginModules.flatMap(({ module, name, id }) => Object.values(module.dependencies ?? {})
|
|
30
|
+
.map((m) => {
|
|
31
|
+
const resolvedDep = pluginModuleIdByExport[m.name];
|
|
32
|
+
if (!resolvedDep) {
|
|
33
|
+
if (m.isOptional) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Cannot resolve plugin dependency for ${name} (${m.name})`);
|
|
37
|
+
}
|
|
38
|
+
if (resolvedDep === 'built-in') {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return [resolvedDep, id];
|
|
42
|
+
})
|
|
43
|
+
.filter((x) => x !== undefined));
|
|
44
|
+
const nodes = pluginModules.map((p) => p.id);
|
|
45
|
+
return toposortOrdered(nodes, edges);
|
|
46
|
+
}
|
|
47
|
+
export function initializeOrderedPluginModules(orderedPluginModules, initialSpecImplementations) {
|
|
48
|
+
const specImplementations = { ...initialSpecImplementations };
|
|
49
|
+
for (const { name, module, pluginId } of orderedPluginModules) {
|
|
50
|
+
const dependencies = module.dependencies
|
|
51
|
+
? stripUndefinedValues(mapValues(module.dependencies, (dep) => {
|
|
52
|
+
const implementation = specImplementations[dep.name];
|
|
53
|
+
if (!implementation && !dep.isOptional) {
|
|
54
|
+
throw new Error(`Plugin ${name} missing dependency ${dep.name}`);
|
|
55
|
+
}
|
|
56
|
+
return implementation;
|
|
57
|
+
}))
|
|
58
|
+
: {};
|
|
59
|
+
const context = { pluginId };
|
|
60
|
+
const exports = module.initialize(dependencies, context);
|
|
61
|
+
Object.entries(module.exports ?? {}).map(([key, spec]) => {
|
|
62
|
+
const exportedImplementation = exports[key];
|
|
63
|
+
if (!exportedImplementation) {
|
|
64
|
+
throw new Error(`Plugin ${name} did not return required export ${key}`);
|
|
65
|
+
}
|
|
66
|
+
specImplementations[spec.name] = exportedImplementation;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return specImplementations;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Initialize the plugins based on their interdependencies and creates a store of the plugin implementations
|
|
73
|
+
*/
|
|
74
|
+
export function initializePlugins(plugins, initialSpecImplementations) {
|
|
75
|
+
const pluginModules = extractPlatformModulesFromPlugins(plugins);
|
|
76
|
+
const pluginModulesById = keyBy(pluginModules, (p) => p.id);
|
|
77
|
+
const orderedModuleIds = getOrderedPluginModuleInitializationSteps(pluginModules, initialSpecImplementations);
|
|
78
|
+
const specImplementations = initializeOrderedPluginModules(orderedModuleIds.map((p) => pluginModulesById[p]), initialSpecImplementations);
|
|
79
|
+
return new PluginImplementationStore(specImplementations);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../src/plugins/imports/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAK3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAe/D,MAAM,UAAU,iCAAiC,CAC/C,OAAoC;IAEpC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAChC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/B,GAAG,CAAC;QACJ,EAA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F,OAAO,IAAI,yBAAyB,CAAC,mBAAmB,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PluginMetadataWithPaths } from '../metadata/types.js';
|
|
2
|
+
import type { InitializedPluginSpec, PluginSpec, PluginSpecImplementationFromSpec, PluginSpecWithInitializer } from '../spec/types.js';
|
|
3
|
+
export type PluginSpecMap = Record<string, PluginSpec>;
|
|
4
|
+
export type ExtractPluginImplementationFromSpecMap<T extends PluginSpecMap> = {
|
|
5
|
+
[TKey in keyof T]: PluginSpecImplementationFromSpec<T[TKey]>;
|
|
6
|
+
};
|
|
7
|
+
export interface PluginInitializerContext {
|
|
8
|
+
pluginId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PluginPlatformModule<TImports extends PluginSpecMap = PluginSpecMap, TExports extends PluginSpecMap = PluginSpecMap> {
|
|
11
|
+
dependencies?: TImports;
|
|
12
|
+
exports?: TExports;
|
|
13
|
+
initialize: (dependencies: ExtractPluginImplementationFromSpecMap<TImports>, context: PluginInitializerContext) => ExtractPluginImplementationFromSpecMap<TExports>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createPlatformPluginExport<TImports extends PluginSpecMap, TExports extends PluginSpecMap>(config: PluginPlatformModule<TImports, TExports>): PluginPlatformModule<TImports, TExports>;
|
|
16
|
+
export interface KeyedPluginPlatformModule {
|
|
17
|
+
key: string;
|
|
18
|
+
module: PluginPlatformModule;
|
|
19
|
+
}
|
|
20
|
+
export interface PluginStore {
|
|
21
|
+
availablePlugins: {
|
|
22
|
+
metadata: PluginMetadataWithPaths;
|
|
23
|
+
modules: KeyedPluginPlatformModule[];
|
|
24
|
+
}[];
|
|
25
|
+
builtinSpecImplementations?: (InitializedPluginSpec | PluginSpecWithInitializer)[];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/pl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