Skip to content

Commit 0cb467f

Browse files
refactor(html): spell block-contents in place rather than exporting it
It names a CSS production, not anything about data: URLs, and cssMinify and the defaults already spell it as a literal.
1 parent 0e5cf6c commit 0cb467f

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

‎lib/html/builtinEmbeddedRenderer.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
const { SourceProcessor: CssSourceProcessor } = require("../css/syntax");
99
const { CSS_TYPE } = require("../module/ModuleSourceTypeConstants");
10-
const { BLOCK_CONTENTS, JSON_TYPE, SVG_TYPE } = require("../util/dataURL");
10+
const { JSON_TYPE, SVG_TYPE } = require("../util/dataURL");
1111
const { SourceProcessor: HtmlSourceProcessor } = require("./syntax");
1212

1313
/** @import { CssPrintOptions, CssProcessOptions } from "../css/syntax-parser" */
@@ -91,7 +91,7 @@ const builtinEmbeddedRenderer = (options = {}) => {
9191
return svg && info.as === undefined ? renderSvg(source) : undefined;
9292
}
9393
if (info.type !== CSS_TYPE) return undefined;
94-
const isBlock = info.as === BLOCK_CONTENTS;
94+
const isBlock = info.as === "block-contents";
9595
if (isBlock) {
9696
const memoized = blocks.get(source);
9797
if (memoized !== undefined) return memoized;
@@ -111,7 +111,7 @@ const builtinEmbeddedRenderer = (options = {}) => {
111111
)
112112
: undefined
113113
};
114-
block = { ...sheet, as: BLOCK_CONTENTS };
114+
block = { ...sheet, as: "block-contents" };
115115
}
116116
code = new CssSourceProcessor().process(
117117
source,

‎lib/util/dataURL.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ const SVG_TYPE = "svg";
5454
const CSS_TYPE = "css";
5555
const HTML_TYPE = "html";
5656
const JAVASCRIPT_TYPE = "javascript";
57-
// The `as` of a `style=""` body: a block's contents rather than a stylesheet.
58-
const BLOCK_CONTENTS = "block-contents";
5957

6058
/**
6159
* Every language `languageOfMediaType` can name, for a consumer that has to say
@@ -328,7 +326,6 @@ const askEmbeddedRenderer = async (render, hole, reported) => {
328326
};
329327

330328
module.exports = {
331-
BLOCK_CONTENTS,
332329
EMBEDDED_LANGUAGES,
333330
JSON_TYPE,
334331
SVG_TYPE,

‎types.d.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37619,7 +37619,6 @@ declare namespace exports {
3761937619
export let itemsToRegexp: (itemsArr: string[]) => string;
3762037620
}
3762137621
export namespace dataURL {
37622-
export let BLOCK_CONTENTS: "block-contents";
3762337622
export let EMBEDDED_LANGUAGES: string[];
3762437623
export let JSON_TYPE: "json";
3762537624
export let SVG_TYPE: "svg";

0 commit comments

Comments
 (0)