@eightshift/frontend-libs-tailwind 4.0.0-beta.5 → 4.0.0-beta.6

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/CHANGELOG.md CHANGED
@@ -8,6 +8,11 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
8
8
 
9
9
  ## [4.0.0]
10
10
 
11
+ ### 4.0.0-beta.6
12
+
13
+ - Add the boolean `removeUnreferencedStyles` option to `defineThemeBuild` so custom CSS callbacks can opt into removing unreferenced entry stylesheet originals after generating hashed replacements. Existing defaults remain unchanged; aliases and detected references retain originals. Custom or disabled publishers cannot use this option.
14
+ - Document the cleanup opt-in and the requirement to pin dynamically constructed stable CSS URLs with aliases; extra styles, lazy CSS, source maps and CSS compilation remain unchanged.
15
+
11
16
  ### 4.0.0-beta.5
12
17
 
13
18
  - Use ESLint 9 to satisfy the React lint plugin peer range without changing lint rules.
package/README.md CHANGED
@@ -449,7 +449,14 @@ Structured conventional CSS omits unreferenced stable entry styles only after th
449
449
  same-directory hashed stylesheet and manifest are generated. Alias targets and
450
450
  references in packaged files or generated wrappers retain the stable stylesheet;
451
451
  queries, fragments and escaped names are considered conservatively. Custom `css`
452
- callbacks retain their entry styles. Hooks that construct CSS URLs dynamically
452
+ callbacks retain their entry styles by default. With the default publisher, set
453
+ `defineThemeBuild({ root, css: customCss, removeUnreferencedStyles: true })` to opt
454
+ custom CSS into the same scoped cleanup, or set `removeUnreferencedStyles: false`
455
+ to retain originals with the conventional compiler. The option must be a boolean
456
+ and cannot be supplied with custom or disabled `publish`. It does not change CSS
457
+ compilation, order, hashed stylesheet contents, or `extraCss` handling. Install a
458
+ library version `4.0.0-beta.6` or newer before enabling it; beta.5 ignores it.
459
+ Hooks that construct CSS URLs dynamically
453
460
  must pin the stable path with an alias; static inspection cannot certify computed
454
461
  URLs. Extra styles, script intermediates and source maps are not blanket-removed.
455
462
  Low-level packagers can opt into this scoped behavior with
@@ -26,6 +26,9 @@ import { prepareSharedFonts } from './shared-fonts.mjs';
26
26
  * optimizeImports controls Bun's package barrel optimization for browser builds.
27
27
  * UI Components is optimized by default; pass [] to disable the explicit default.
28
28
  * watch: false disables watching; an object overrides the safe watch defaults.
29
+ * @param {object} [options]
30
+ * @param {boolean} [options.removeUnreferencedStyles] Override entry CSS cleanup
31
+ * for default publication; omitted enables it only with the default CSS compiler.
29
32
  */
30
33
  export function defineThemeBuild(options = {}) {
31
34
  if (Object.hasOwn(options, 'publicationLayout')) {
@@ -50,6 +53,7 @@ export function defineThemeBuild(options = {}) {
50
53
  editor,
51
54
  responsive = {},
52
55
  css,
56
+ removeUnreferencedStyles = css === undefined,
53
57
  discovery,
54
58
  ssr,
55
59
  publish,
@@ -63,6 +67,14 @@ export function defineThemeBuild(options = {}) {
63
67
  throw new TypeError('sharedFonts must be a boolean and requires default theme publication');
64
68
  }
65
69
 
70
+ if (typeof removeUnreferencedStyles !== 'boolean') {
71
+ throw new TypeError('removeUnreferencedStyles must be a boolean');
72
+ }
73
+
74
+ if (Object.hasOwn(options, 'removeUnreferencedStyles') && publish !== undefined) {
75
+ throw new TypeError('removeUnreferencedStyles requires default theme publication');
76
+ }
77
+
66
78
  if (typeof createPlugins !== 'function') {
67
79
  throw new TypeError('createPlugins must be a function');
68
80
  }
@@ -544,7 +556,7 @@ export function defineThemeBuild(options = {}) {
544
556
  retain: additions.retain,
545
557
  previousPublic: resolve(root, 'public'),
546
558
  root: outdir,
547
- removeUnreferencedStyles: css === undefined,
559
+ removeUnreferencedStyles,
548
560
  flatDir,
549
561
  entries,
550
562
  ssrDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/frontend-libs-tailwind",
3
- "version": "4.0.0-beta.5",
3
+ "version": "4.0.0-beta.6",
4
4
  "description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
5
5
  "author": {
6
6
  "name": "Eightshift team",