Skip to content

Commit adea603

Browse files
committed
Merge branch 'master' into fix-binding-head-duplicate
2 parents f0e1f69 + d06cfe3 commit adea603

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.changeset/eighty-poems-deliver.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: css sourcemap generation with unicode filenames

packages/svelte/src/compiler/utils/mapped_code.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,18 @@ export function apply_preprocessor_sourcemap(filename, svelte_map, preprocessor_
292292
toUrl: {
293293
enumerable: false,
294294
value: function toUrl() {
295-
return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());
295+
let b64 = '';
296+
if (typeof window !== 'undefined' && window.btoa) {
297+
// btoa doesn't support multi-byte characters
298+
b64 = window.btoa(unescape(encodeURIComponent(this.toString())));
299+
} else if (typeof Buffer !== 'undefined') {
300+
b64 = Buffer.from(this.toString(), 'utf8').toString('base64');
301+
} else {
302+
throw new Error(
303+
'Unsupported environment: `window.btoa` or `Buffer` should be present to use toUrl.'
304+
);
305+
}
306+
return 'data:application/json;charset=utf-8;base64,' + b64;
296307
}
297308
}
298309
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<svelte:head>
2+
<meta name="robots" content="noindex">
3+
</svelte:head>
4+
5+
<slot />

sites/svelte.dev/static/robots.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
User-agent: *
2-
Disallow: /tutorial/* # new tutorial is at learn.svelte.dev
2+
Disallow:

0 commit comments

Comments
 (0)