@@ -10,7 +10,6 @@ import Prism from "prismjs";
1010import rehypeSlug from "rehype-slug" ;
1111import { parse } from "svelte/compiler" ;
1212import visit from "unist-util-visit" ;
13- import pkg from "../package.json" with { type : "json" } ;
1413import componentApi from "./src/COMPONENT_API.json" with { type : "json" } ;
1514import "prismjs/components/prism-markup.js" ;
1615import "prismjs/components/prism-css.js" ;
@@ -28,8 +27,6 @@ const componentApiByName = new Set(
2827const ICON_NAME_REGEX = / [ A - Z ] [ a - z ] * / ;
2928const NODE_MODULES_REGEX = / n o d e _ m o d u l e s / ;
3029const PAGES_COMPONENTS_REGEX = / p a g e s \/ ( c o m p o n e n t s ) / ;
31- const GIT_PREFIX_REGEX = / ^ g i t \+ / ;
32- const GIT_SUFFIX_REGEX = / \. g i t $ / ;
3330const SCRIPT_TAG_REGEX = / ( < s c r i p t [ ^ > ] * > ) / i;
3431const FILE_SOURCE_SRC_REGEX = / s r c = " ( [ ^ " ] + ) " / ;
3532
@@ -351,21 +348,6 @@ function carbonify() {
351348export default {
352349 extensions : [ ".svelte" , ".svx" ] ,
353350 preprocess : [
354- {
355- markup : ( { filename, content } ) => {
356- if ( NODE_MODULES_REGEX . test ( filename ) || ! filename . endsWith ( ".svelte" ) )
357- return ;
358- const repoUrl = pkg . repository ?. url ?? "" ;
359- const normalizedRepoUrl = repoUrl
360- . replace ( GIT_PREFIX_REGEX , "" )
361- . replace ( GIT_SUFFIX_REGEX , "" ) ;
362- return {
363- code : content
364- . replace ( / p r o c e s s .e n v .V E R S I O N / g, JSON . stringify ( pkg . version ) )
365- . replace ( / " R E P O _ U R L " / g, JSON . stringify ( normalizedRepoUrl ) ) ,
366- } ;
367- } ,
368- } ,
369351 mdsvex ( {
370352 smartypants : false ,
371353 highlight : { highlighter : mdsvexPrismHighlighter } ,
0 commit comments