@dynect/base 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/module.ts +16 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynect/base",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Reusable Nuxt base module — components, composables, utils, plugins and i18n from the Dynect design system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/module.ts CHANGED
@@ -69,15 +69,25 @@ export default defineNuxtModule<DynectBaseOptions>({
69
69
  const isStandalone = existsSync(join(runtimeComponentsDir, 'dynect'));
70
70
  const componentsBase = isStandalone ? runtimeComponentsDir : monorepoComponentsDir;
71
71
 
72
- // ── Ensure ~/lib/utils is available in the consuming app ─────────────────
73
- // Components import { cn } from '~/lib/utils'. If the consuming app does
74
- // not have that file we point the resolver at the bundled copy.
75
- const consumingLibUtils = join(nuxt.options.srcDir, 'lib', 'utils.ts');
76
- if (!existsSync(consumingLibUtils)) {
77
- nuxt.options.alias[join(nuxt.options.srcDir, 'lib', 'utils')] =
72
+ // ── Path aliases for intra-package imports ───────────────────────────────
73
+ // Dynect components use @/components/ui/* and @/lib/utils.
74
+ // In standalone mode, @/ resolves to the consuming app's srcDir which won't
75
+ // have those paths redirect them to the bundled runtime copies.
76
+
77
+ const srcDir = nuxt.options.srcDir;
78
+
79
+ // @/lib/utils → runtime/lib/utils (when not present in consuming app)
80
+ if (!existsSync(join(srcDir, 'lib', 'utils.ts'))) {
81
+ nuxt.options.alias[join(srcDir, 'lib', 'utils')] =
78
82
  resolver.resolve('./runtime/lib/utils');
79
83
  }
80
84
 
85
+ // @/components/ui/* → runtime/components/ui/* (when not present in consuming app)
86
+ if (isStandalone && !existsSync(join(srcDir, 'components', 'ui'))) {
87
+ nuxt.options.alias[join(srcDir, 'components', 'ui')] =
88
+ join(runtimeComponentsDir, 'ui');
89
+ }
90
+
81
91
  // ── Install required Nuxt modules ────────────────────────────────────────
82
92
  if (options.shadcn !== false) {
83
93
  await installModule('shadcn-nuxt', {