@xingwangzhe/stalux 1.35.14 → 1.35.15
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
package/src/index.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { findHtmlImages } from "./internal/html-images";
|
|
|
41
41
|
import { createHtmlMutationEmitter } from "./internal/html-output";
|
|
42
42
|
import { type ImageDimensions, updateLocalImageDimensions } from "./internal/image-dimensions";
|
|
43
43
|
import { createInjectedRoutes } from "./internal/injected-routes";
|
|
44
|
+
import { markdownPropagationPlugin } from "./internal/markdown-propagation";
|
|
44
45
|
import { createPageOutputCache } from "./internal/page-output-cache";
|
|
45
46
|
import { syncBackgroundSvgs, syncFontAssets } from "./internal/public-assets";
|
|
46
47
|
import { createRuntimeCacheKey } from "./internal/runtime-cache-key";
|
|
@@ -161,7 +162,9 @@ export function stalux(options: StaluxOptions = {}): AstroIntegration[] {
|
|
|
161
162
|
alias: createViteAliases(srcDir),
|
|
162
163
|
},
|
|
163
164
|
plugins: [
|
|
164
|
-
...(command === "build"
|
|
165
|
+
...(command === "build"
|
|
166
|
+
? [markdownPropagationPlugin(), compactStylesPlugin(srcDir)]
|
|
167
|
+
: []),
|
|
165
168
|
staluxComponentsAlias(opt.components, logger.fork("stalux/components")),
|
|
166
169
|
],
|
|
167
170
|
define: {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import astroPackage from "astro/package.json" with { type: "json" };
|
|
2
|
+
import type { Plugin } from "vite";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Astro 7 loads Markdown before replacing its propagated-assets module with
|
|
6
|
+
* imports of the real content module. That throwaway load renders the same
|
|
7
|
+
* document twice. The propagation transform ignores its input entirely.
|
|
8
|
+
*
|
|
9
|
+
* Only skip this internal forwarding module, never the real content module,
|
|
10
|
+
* direct imports, Markdown pages, or MDX (which owns a different pipeline).
|
|
11
|
+
* The internal transform has been verified on 7.4.0 only. Future Astro versions
|
|
12
|
+
* use the ordinary pipeline until their propagation contract is rechecked.
|
|
13
|
+
*/
|
|
14
|
+
export function markdownPropagationPlugin(): Plugin {
|
|
15
|
+
return {
|
|
16
|
+
name: "stalux:markdown-propagation",
|
|
17
|
+
enforce: "pre",
|
|
18
|
+
apply: (_, environment) =>
|
|
19
|
+
environment.command === "build" && astroPackage.version === "7.4.0",
|
|
20
|
+
load: {
|
|
21
|
+
order: "pre",
|
|
22
|
+
filter: { id: /\.(?:md|markdown)\?astroPropagatedAssets$/u },
|
|
23
|
+
handler() {
|
|
24
|
+
return "";
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -267,6 +267,9 @@ const analysisCache = new Map<string, Promise<FeatureFlagsResult>>();
|
|
|
267
267
|
|
|
268
268
|
function getFeatureFlagsProcessor() {
|
|
269
269
|
processorPromise ??= createSatteriMarkdownProcessor({
|
|
270
|
+
// Statistics consume AST metadata only. Highlighting every code block here
|
|
271
|
+
// duplicates Expressive Code work and repeats in each prerender worker.
|
|
272
|
+
syntaxHighlight: false,
|
|
270
273
|
mdastPlugins: [featureFlagsMdast],
|
|
271
274
|
hastPlugins: [featureFlagsHast],
|
|
272
275
|
features: { math: true },
|