From 65f1931d87a1ed84205a1aa25adb458ca1052ded Mon Sep 17 00:00:00 2001 From: seltzdesign Date: Tue, 30 Jun 2026 00:34:09 +0200 Subject: [PATCH] fix(tree-view-table-layout): support Directus 12 The layout never appears in the picker on Directus 12. Two causes: package host range excludes ^12, and the built code imports two bare specifiers absent from Directus 12's app import map (useSync from @directus/composables, isSystemCollection from @directus/system-data). An unresolvable specifier crashes the whole extension bundle at runtime, so no layout registers. - bump host to include ^12.0.0 - import useSync from @directus/extensions-sdk (re-exports it) - inline isSystemCollection as the documented directus_ prefix check --- packages/tree-view-table-layout/package.json | 2 +- .../tree-view-table-layout/src/components/table-header.vue | 5 ++++- .../src/core-clones/utils/get-route.ts | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/tree-view-table-layout/package.json b/packages/tree-view-table-layout/package.json index 83973dd3..075f7fa7 100644 --- a/packages/tree-view-table-layout/package.json +++ b/packages/tree-view-table-layout/package.json @@ -41,7 +41,7 @@ "type": "layout", "path": "dist/index.js", "source": "src/index.ts", - "host": "^10.10.0 || ^11.0.0" + "host": "^10.10.0 || ^11.0.0 || ^12.0.0" }, "scripts": { "build": "directus-extension build", diff --git a/packages/tree-view-table-layout/src/components/table-header.vue b/packages/tree-view-table-layout/src/components/table-header.vue index aed17924..4227d7be 100644 --- a/packages/tree-view-table-layout/src/components/table-header.vue +++ b/packages/tree-view-table-layout/src/components/table-header.vue @@ -2,7 +2,10 @@ import type { ShowSelect } from '@directus/extensions'; // import { Header, Sort } from './types'; import type { Header, Sort } from '../core-clones/components/v-table/types'; -import { useSync } from '@directus/composables'; +// useSync comes from the SDK, not @directus/composables: Directus 12's app bundle does not +// provide @directus/composables in its import map, so importing it directly leaves an +// unresolvable bare specifier that breaks the whole extension at runtime. The SDK re-exports it. +import { useSync } from '@directus/extensions-sdk'; import { clone, throttle } from 'lodash'; import { computed, ref, useSlots } from 'vue'; import { useI18n } from 'vue-i18n'; diff --git a/packages/tree-view-table-layout/src/core-clones/utils/get-route.ts b/packages/tree-view-table-layout/src/core-clones/utils/get-route.ts index 9c0a115b..381b39b1 100644 --- a/packages/tree-view-table-layout/src/core-clones/utils/get-route.ts +++ b/packages/tree-view-table-layout/src/core-clones/utils/get-route.ts @@ -1,4 +1,9 @@ -import { isSystemCollection } from '@directus/system-data'; +// Inlined from @directus/system-data: Directus 12's app bundle does not provide that package in +// its import map, so importing it directly leaves an unresolvable bare specifier that breaks the +// whole extension at runtime. The check is just the documented "directus_" system-prefix test. +function isSystemCollection(collection: string): boolean { + return typeof collection === 'string' && collection.startsWith('directus_'); +} const accessibleSystemCollections = { directus_users: { route: '/users' },