Skip to content

Commit

Permalink
chore: casing
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre committed Jan 8, 2025
1 parent 4b004f9 commit 1ab9ad1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/astro/src/runtime/server/render/server-islands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ export function containsServerDirective(props: Record<string | number, any>) {
return 'server:component-directive' in props;
}

const scriptRegex = /<\/script/giu;
const commentRegex = /<!--/gu;
const scriptReplacer = '<\\/script';
const commentReplacer = '\\u003C!--';
const SCRIPT_RE = /<\/script/giu;
const COMMENT_RE = /<!--/gu;
const SCRIPT_REPLACER = '<\\/script';
const COMMENT_REPLACER = '\\u003C!--';

/**
* Encodes the script end-tag open (ETAGO) delimiter and opening HTML comment syntax for JSON inside a `<script>` tag.
* @see https://mathiasbynens.be/notes/etago
*/
function safeJsonStringify(obj: any) {
return JSON.stringify(obj)
.replace(scriptRegex, scriptReplacer)
.replace(commentRegex, commentReplacer);
.replace(SCRIPT_RE, SCRIPT_REPLACER)
.replace(COMMENT_RE, COMMENT_REPLACER);
}

function createSearchParams(componentExport: string, encryptedProps: string, slots: string) {
Expand Down

0 comments on commit 1ab9ad1

Please sign in to comment.