feat: Publish ./plugin as its own entry (no-changelog) (#36445)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Alex Grozav 2026-08-24 06:15:39 +00:00 committed by GitHub
parent 0f9fadc361
commit d008bb9bd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 4 deletions

View File

@ -14,6 +14,10 @@
"types": "./dist/icons/lucide/index.d.ts",
"import": "./dist/icons/lucide/index.js"
},
"./plugin": {
"types": "./dist/plugin.d.ts",
"import": "./dist/plugin.js"
},
"./style.css": "./dist/style.css",
"./theme.css": "./dist/theme.css",
"./css/*": "./dist/css/*",

View File

@ -4,6 +4,13 @@ import bucketLoaders from 'virtual:lucide-icons';
import { getBucketIndex } from './bucket';
import type { IconBodyLoader } from '../../composables/useIconBodyLoader';
// The key and a loader are only ever used as a pair — `app.provide(IconBodyLoaderKey,
// loadLucideIconBody)` is the whole contract, at every call site. Re-exported here so
// wiring icons is one import, and so a consumer that must avoid the component barrel
// (`.storybook/preview.ts`, a TurboSnap global) has a published path to the key.
export { IconBodyLoaderKey } from '../../composables/useIconBodyLoader';
export type { IconBodyLoader } from '../../composables/useIconBodyLoader';
const buckets = new Map<number, Promise<Record<string, string>>>();
export const loadLucideIconBody: IconBodyLoader = async (name) => {

View File

@ -164,6 +164,11 @@ export default mergeConfig(
// for everyone who imports the barrel, including consumers that alias
// this package to source and register no plugin.
'icons/lucide/index': resolve(srcDir, 'icons', 'lucide', 'index.ts'),
// Third entry for the same reason: `N8nPlugin` only registers the
// directives, so a consumer that wants them should not have to pull
// the component barrel. It stays on `src/index.ts` too — the entry is
// an extra door, not a move.
plugin: resolve(srcDir, 'plugin.ts'),
},
// ES only. UMD supports neither multiple entries nor code splitting, and
// both are requirements here — the icon buckets have to stay lazy chunks.

View File

@ -1,8 +1,9 @@
// Import from deep paths, not the '@n8n/design-system' barrel: preview.ts is a
// TurboSnap global, and the barrel's `export * from './components'` would make
// Import from the subpath entries, not the '@n8n/design-system' barrel: preview.ts
// is a TurboSnap global, and the barrel's `export * from './components'` would make
// every component a global dep, forcing a full snapshot on any component change.
import { IconBodyLoaderKey } from '@n8n/design-system/composables/useIconBodyLoader';
import { loadLucideIconBody } from '@n8n/design-system/icons/lucide';
// Both specifiers are published `exports` keys, so they resolve outside this
// monorepo alias too.
import { IconBodyLoaderKey, loadLucideIconBody } from '@n8n/design-system/icons/lucide';
import { N8nPlugin } from '@n8n/design-system/plugin';
import { i18nInstance } from '@n8n/i18n';
import { setup } from '@storybook/vue3';