From c6ca5eb6abc68add12558a309ce4df2fb01c3f73 Mon Sep 17 00:00:00 2001 From: Josep Piguillem Date: Mon, 12 Oct 2026 22:34:17 +0200 Subject: [PATCH] Release @pi/ui 0.0.4: import lodash functions with their extension lodash declares no exports, so `lodash/isEqual` resolves in a bundler but not in Node's ESM loader: in 0.0.3 apps could not load @pi/ui in tests or when rendering on the server. Co-Authored-By: Claude Opus 5.5 --- libs/ui/README.md | 9 ++++++--- libs/ui/package.json | 2 +- libs/ui/src/lib/ui/chip/chip-date/chip-date.component.ts | 2 +- .../select/select-carousel/select-carousel.component.ts | 2 +- .../select/select-multiple/select-multiple.component.ts | 2 +- .../ui/select/select-period/select-period.component.ts | 2 +- libs/ui/src/lib/ui/select/select/select.component.ts | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libs/ui/README.md b/libs/ui/README.md index eff057f..ad185a8 100644 --- a/libs/ui/README.md +++ b/libs/ui/README.md @@ -195,9 +195,12 @@ Detalles a tener en cuenta: ignorando su valor. Se descubrió al dividir los componentes; `pi-bar-chart` es la primera versión que realmente renderiza barras. -**`lodash` se importa por función** (`lodash/isEqual`, `lodash/some`, -`lodash/capitalize`), nunca `import _ from 'lodash'`: lodash es CommonJS y el -import completo mete la librería entera en el bundle de quien use un select. +**`lodash` se importa por función y con extensión** (`lodash/isEqual.js`, +`lodash/some.js`, `lodash/capitalize.js`), nunca `import _ from 'lodash'`: +lodash es CommonJS y el import completo mete la librería entera en el bundle de +quien use un select. La extensión hace falta porque lodash no declara +`exports`: un empaquetador resuelve `lodash/isEqual`, pero Node en ESM (Vitest, +SSR) no, y la app falla al cargar `@pi/ui`. **El loader de servidor de traducciones ya no está en el barrel.** `util/translate/loaders/translate-server.loader` usa `fs`, `path` y `process`; diff --git a/libs/ui/package.json b/libs/ui/package.json index 4c9e36f..90f981c 100644 --- a/libs/ui/package.json +++ b/libs/ui/package.json @@ -1,6 +1,6 @@ { "name": "@pi/ui", - "version": "0.0.3", + "version": "0.0.4", "description": "Librería de componentes Angular standalone (botones, campos con Signal Forms, cards, charts, drawer/hub/modal, theming vía tokens CSS...).", "license": "MIT", "generators": "./generators.json", diff --git a/libs/ui/src/lib/ui/chip/chip-date/chip-date.component.ts b/libs/ui/src/lib/ui/chip/chip-date/chip-date.component.ts index d9e2496..e978976 100644 --- a/libs/ui/src/lib/ui/chip/chip-date/chip-date.component.ts +++ b/libs/ui/src/lib/ui/chip/chip-date/chip-date.component.ts @@ -10,7 +10,7 @@ import { ComponentFamilyClass, theming } from '../../../styles'; import { Date } from '../../../util/models'; import { PiBaseChipComponent } from '../base-chip.component'; import { DateTime } from 'luxon'; -import capitalize from 'lodash/capitalize'; +import capitalize from 'lodash/capitalize.js'; @Component({ selector: 'pi-chip-date', diff --git a/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.ts b/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.ts index 2cf5920..4c63076 100644 --- a/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.ts +++ b/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.ts @@ -9,7 +9,7 @@ import { inject, } from '@angular/core'; import { TranslateService, TranslatePipe } from '@ngx-translate/core'; -import isEqual from 'lodash/isEqual'; +import isEqual from 'lodash/isEqual.js'; import { PiBaseSelectComponent } from '../base-select.component'; import { PiSelectOptionComponent } from '../select-option/select-option.component'; import { Device } from '../../../util/device-configs'; diff --git a/libs/ui/src/lib/ui/select/select-multiple/select-multiple.component.ts b/libs/ui/src/lib/ui/select/select-multiple/select-multiple.component.ts index 9a51568..972e007 100644 --- a/libs/ui/src/lib/ui/select/select-multiple/select-multiple.component.ts +++ b/libs/ui/src/lib/ui/select/select-multiple/select-multiple.component.ts @@ -11,7 +11,7 @@ import { import { TranslateService, TranslatePipe } from '@ngx-translate/core'; import { PiBaseSelectComponent } from '../base-select.component'; import { PiSelectOptionComponent } from '../select-option/select-option.component'; -import some from 'lodash/some'; +import some from 'lodash/some.js'; import { MatCheckboxChange, MatCheckbox } from '@angular/material/checkbox'; import { NgTemplateOutlet } from '@angular/common'; import { PiIconComponent } from '../../icon/icon/icon.component'; diff --git a/libs/ui/src/lib/ui/select/select-period/select-period.component.ts b/libs/ui/src/lib/ui/select/select-period/select-period.component.ts index 439d2ab..2dea206 100644 --- a/libs/ui/src/lib/ui/select/select-period/select-period.component.ts +++ b/libs/ui/src/lib/ui/select/select-period/select-period.component.ts @@ -11,7 +11,7 @@ import { import { TranslateService, TranslatePipe } from '@ngx-translate/core'; import { PiBaseSelectComponent } from '../base-select.component'; import { PiSelectOptionComponent } from '../select-option/select-option.component'; -import isEqual from 'lodash/isEqual'; +import isEqual from 'lodash/isEqual.js'; import { NgTemplateOutlet } from '@angular/common'; import { PiIconComponent } from '../../icon/icon/icon.component'; import { PiDisabledDirective } from '../../../util/status/directives/status.directive'; diff --git a/libs/ui/src/lib/ui/select/select/select.component.ts b/libs/ui/src/lib/ui/select/select/select.component.ts index 616c598..cd84010 100644 --- a/libs/ui/src/lib/ui/select/select/select.component.ts +++ b/libs/ui/src/lib/ui/select/select/select.component.ts @@ -13,7 +13,7 @@ import { import { TranslateService, TranslatePipe } from '@ngx-translate/core'; import { PiBaseSelectComponent } from '../base-select.component'; import { PiSelectOptionComponent } from '../select-option/select-option.component'; -import isEqual from 'lodash/isEqual'; +import isEqual from 'lodash/isEqual.js'; import { NgTemplateOutlet } from '@angular/common'; import { PiIconComponent } from '../../icon/icon/icon.component'; import { PiDisabledDirective } from '../../../util/status/directives/status.directive';