@uniweb/build 0.73.2 → 0.73.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.73.
|
|
3
|
+
"version": "0.73.3",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"js-yaml": "^4.1.0",
|
|
58
58
|
"sharp": "^0.35.3",
|
|
59
59
|
"yaml": "^2.5.0",
|
|
60
|
-
"@uniweb/schemas": "^0.9.
|
|
60
|
+
"@uniweb/schemas": "^0.9.4",
|
|
61
61
|
"@uniweb/content-writer": "^0.3.4",
|
|
62
62
|
"@uniweb/projections": "^0.7.11",
|
|
63
|
-
"@uniweb/semantic-parser": "^1.
|
|
64
|
-
"@uniweb/
|
|
65
|
-
"@uniweb/
|
|
63
|
+
"@uniweb/semantic-parser": "^1.5.0",
|
|
64
|
+
"@uniweb/theming": "^0.2.0",
|
|
65
|
+
"@uniweb/content-reader": "^1.2.7"
|
|
66
66
|
},
|
|
67
67
|
"optionalDependencies": {
|
|
68
68
|
"@uniweb/runtime": "^0.28.3"
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prose without its stylesheet — the one foundation mistake that renders fine and looks wrong.
|
|
3
|
+
*
|
|
4
|
+
* kit's `<Prose>` (and `<Article>`, which is `<Prose>` in an `<article>`) draws content inside
|
|
5
|
+
* Tailwind Typography's `prose` classes. Those classes style nothing unless the foundation's
|
|
6
|
+
* stylesheet brings the plugin, which is one line:
|
|
7
|
+
*
|
|
8
|
+
* @import "@uniweb/kit/prose-tokens.css";
|
|
9
|
+
*
|
|
10
|
+
* Without it, Tailwind's reset takes the markers off every list, and headings, spacing and quotes
|
|
11
|
+
* get no typography — while the markup underneath is correct, so nothing fails and nothing says so.
|
|
12
|
+
* Three official templates shipped that way until 2026-09-29.
|
|
13
|
+
*
|
|
14
|
+
* ⇒ The check reads the build's own output: kit's Prose module rendered into a chunk, and no
|
|
15
|
+
* `.prose` rule in any CSS the build emitted.
|
|
16
|
+
*
|
|
17
|
+
* @module @uniweb/build/foundation/prose-styles
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** kit's Prose module, wherever kit resolves from — the workspace or node_modules. */
|
|
21
|
+
const PROSE_MODULE = /[\\/]kit[\\/]src[\\/]styled[\\/]Prose[\\/]index\.jsx$/
|
|
22
|
+
|
|
23
|
+
/** A rule of the typography plugin's, which every one of its selectors starts with. */
|
|
24
|
+
const PROSE_RULE = /\.prose\b/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Is this module id kit's Prose?
|
|
28
|
+
*
|
|
29
|
+
* @param {string} id - a module id from the bundle's graph
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
export function isProseModule(id) {
|
|
33
|
+
return typeof id === 'string' && PROSE_MODULE.test(id)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Does this bundle render kit's Prose, with no prose styles in its CSS?
|
|
38
|
+
*
|
|
39
|
+
* A module that tree-shaking left empty does not count — importing kit is not rendering Prose.
|
|
40
|
+
*
|
|
41
|
+
* @param {object} bundle - Rollup's bundle, as handed to `writeBundle`
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
export function proseWithoutStyles(bundle) {
|
|
45
|
+
let rendersProse = false
|
|
46
|
+
let hasProseRule = false
|
|
47
|
+
for (const item of Object.values(bundle || {})) {
|
|
48
|
+
if (item?.type === 'chunk' && item.modules) {
|
|
49
|
+
for (const [id, mod] of Object.entries(item.modules)) {
|
|
50
|
+
if (mod?.renderedLength > 0 && isProseModule(id)) rendersProse = true
|
|
51
|
+
}
|
|
52
|
+
} else if (item?.type === 'asset' && String(item.fileName || '').endsWith('.css')) {
|
|
53
|
+
const source = typeof item.source === 'string' ? item.source : Buffer.from(item.source || []).toString('utf8')
|
|
54
|
+
if (PROSE_RULE.test(source)) hasProseRule = true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return rendersProse && !hasProseRule
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** What the foundation build prints when `proseWithoutStyles` is true. */
|
|
61
|
+
export const PROSE_WITHOUT_STYLES_WARNING =
|
|
62
|
+
"[uniweb] This foundation renders kit's <Prose> or <Article>, and its CSS has no prose styles — " +
|
|
63
|
+
'lists render without bullets or numbers, and text without typography. Add this line to the ' +
|
|
64
|
+
"foundation's stylesheet, after its Tailwind import:\n" +
|
|
65
|
+
' @import "@uniweb/kit/prose-tokens.css";'
|
|
@@ -16,6 +16,11 @@ import { processAllPreviews } from './images.js'
|
|
|
16
16
|
import { generateFoundationVars } from './theme/index.js'
|
|
17
17
|
import { DEFAULT_EXTERNALS } from './import-map-plugin.js'
|
|
18
18
|
import { deriveSupports } from './foundation/derive-supports.js'
|
|
19
|
+
import { proseWithoutStyles, PROSE_WITHOUT_STYLES_WARNING } from './foundation/prose-styles.js'
|
|
20
|
+
|
|
21
|
+
// Foundations already told that their prose has no stylesheet — once per process, so a dev
|
|
22
|
+
// server's rebuild on every save does not repeat it.
|
|
23
|
+
const warnedProseWithoutStyles = new Set()
|
|
19
24
|
|
|
20
25
|
/**
|
|
21
26
|
* Build schema.json with preview image references
|
|
@@ -441,6 +446,14 @@ export function foundationBuildPlugin(options = {}) {
|
|
|
441
446
|
// Skip while the entry-ssr.js sub-build (buildEntrySSR) is running
|
|
442
447
|
if (_buildingSSRBundle) return
|
|
443
448
|
|
|
449
|
+
// kit's <Prose> / <Article> with no prose styles in the CSS: correct markup, unstyled page,
|
|
450
|
+
// and nothing else says so (`foundation/prose-styles.js`). Dev rebuilds included — that is
|
|
451
|
+
// where a developer sees it first.
|
|
452
|
+
if (!warnedProseWithoutStyles.has(resolvedSrcDir) && proseWithoutStyles(bundle)) {
|
|
453
|
+
warnedProseWithoutStyles.add(resolvedSrcDir)
|
|
454
|
+
console.warn(PROSE_WITHOUT_STYLES_WARNING)
|
|
455
|
+
}
|
|
456
|
+
|
|
444
457
|
// What host services this foundation actually reaches for, read off the
|
|
445
458
|
// post-tree-shake module graph rather than asked for in package.json.
|
|
446
459
|
//
|