Skip to content

Commit 1f5c043

Browse files
authored
Merge pull request #2071 from sveltejs/gh-2067
.html -> .svelte
2 parents da11d75 + e6ed8ef commit 1f5c043

File tree

1,256 files changed

+467
-470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,256 files changed

+467
-470
lines changed

register.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const { compile } = require('./compiler.js');
44

55
let compileOptions = {
6-
extensions: ['.html']
6+
extensions: ['.svelte', '.html']
77
};
88

99
function capitalise(name) {
@@ -43,6 +43,7 @@ function registerExtension(extension) {
4343
};
4444
}
4545

46+
registerExtension('.svelte');
4647
registerExtension('.html');
4748

4849
module.exports = register;

site/content/examples/hacker-news/App.html renamed to site/content/examples/hacker-news/App.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { onMount } from 'svelte';
3-
import List from './List.html';
4-
import Item from './Item.html';
3+
import List from './List.svelte';
4+
import Item from './Item.svelte';
55
66
let item;
77
let page;

site/content/examples/homepage-demo-scoped-styles/App.html renamed to site/content/examples/homepage-demo-scoped-styles/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Foo from './Foo.html';
2+
import Foo from './Foo.svelte';
33
</script>
44

55
<style>

site/content/examples/immutable/App.html renamed to site/content/examples/immutable/App.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<svelte:options immutable/>
22

33
<script>
4-
import ImmutableTodo from './ImmutableTodo.html';
5-
import MutableTodo from './MutableTodo.html';
4+
import ImmutableTodo from './ImmutableTodo.svelte';
5+
import MutableTodo from './MutableTodo.svelte';
66
77
export let todos;
88

site/content/examples/modal-with-slot/App.html renamed to site/content/examples/modal-with-slot/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Modal from './Modal.html';
2+
import Modal from './Modal.svelte';
33
44
export let showModal;
55
</script>

site/content/examples/nested-components/App.html renamed to site/content/examples/nested-components/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Nested from './Nested.html';
2+
import Nested from './Nested.svelte';
33
</script>
44

55
<p>This is a top-level element.</p>

site/content/examples/scatterplot/App.html renamed to site/content/examples/scatterplot/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import Scatterplot from './Scatterplot.html';
2+
import Scatterplot from './Scatterplot.svelte';
33
44
export let a;
55
export let b;

site/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"rollup-plugin-replace": "^2.1.0",
5353
"rollup-plugin-svelte": "^5.0.1",
5454
"rollup-plugin-terser": "^4.0.4",
55-
"sapper": "^0.26.0-alpha.5",
55+
"sapper": "^0.26.0-alpha.7",
5656
"svelte": "^3.0.0-beta.3"
5757
}
5858
}
File renamed without changes.
File renamed without changes.

site/src/components/TopNav.html renamed to site/src/components/TopNav.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { onMount } from 'svelte';
3-
import Icon from './Icon.html';
4-
import Logo from './Logo.html';
3+
import Icon from './Icon.svelte';
4+
import Logo from './Logo.svelte';
55
66
export let segment;
77
File renamed without changes.

site/src/routes/_layout.html renamed to site/src/routes/_layout.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import InlineSvg from '../components/InlineSvg.html';
3-
import Nav from '../components/TopNav.html';
2+
import InlineSvg from '../components/InlineSvg.svelte';
3+
import Nav from '../components/TopNav.svelte';
44
55
export let child;
66
export let path;
File renamed without changes.

site/src/routes/api/examples/[slug].js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function createExample(slug) {
1919
const components = files
2020
.map(file => {
2121
const ext = path.extname(file);
22-
if (ext !== '.html' && ext !== '.js') return null;
22+
if (ext !== '.svelte' && ext !== '.js') return null;
2323

2424
const source = fs.readFileSync(`content/examples/${slug}/${file}`, 'utf-8');
2525

@@ -31,10 +31,10 @@ function createExample(slug) {
3131
})
3232
.filter(Boolean)
3333
.sort((a, b) => {
34-
if (a.name === 'App' && a.type === 'html') return -1;
35-
if (b.name === 'App' && b.type === 'html') return 1;
34+
if (a.name === 'App' && a.type === 'svelte') return -1;
35+
if (b.name === 'App' && b.type === 'svelte') return 1;
3636

37-
if (a.type !== b.type) return a.type === 'html' ? -1 : 1;
37+
if (a.type !== b.type) return a.type === 'svelte' ? -1 : 1;
3838

3939
return a.name < b.name ? -1 : 1;
4040
});
File renamed without changes.
File renamed without changes.

site/src/routes/gist/[id].js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export async function get(req, res) {
55
const { id } = req.params;
66

77
const headers = {};
8-
const user = req.session.passport && req.session.passport.user;
8+
const user = req.session && req.session.passport && req.session.passport.user;
99
if (user) {
1010
headers.Authorization = `token ${user.token}`;
1111
}
@@ -34,7 +34,7 @@ export async function get(req, res) {
3434
}
3535

3636
export async function patch(req, res) {
37-
const user = req.session.passport && req.session.passport.user;
37+
const user = req.session && req.session.passport && req.session.passport.user;
3838

3939
if (!user) {
4040
res.writeHead(403, {

site/src/routes/guide/_GuideContents.html renamed to site/src/routes/guide/_GuideContents.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { onMount, afterUpdate } from 'svelte';
3-
import Icon from '../../components/Icon.html';
3+
import Icon from '../../components/Icon.svelte';
44
55
export let sections = [];
66
export let active_section = null;

site/src/routes/guide/_sections.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default function() {
113113

114114
if (meta) {
115115
source = lines.slice(1).join('\n');
116-
const filename = meta.filename || (lang === 'html' && 'App.html');
116+
const filename = meta.filename || (lang === 'html' && 'App.svelte');
117117
if (filename) {
118118
prefix = `<span class='filename'>${prefix} ${filename}</span>`;
119119
className += ' named';

site/src/routes/guide/index.html renamed to site/src/routes/guide/index.svelte

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

88
<script>
99
import { onMount, afterUpdate } from 'svelte';
10-
import GuideContents from './_GuideContents.html';
11-
import Icon from '../../components/Icon.html';
10+
import GuideContents from './_GuideContents.svelte';
11+
import Icon from '../../components/Icon.svelte';
1212
1313
export let sections;
1414
let active_section;

site/src/routes/index.html renamed to site/src/routes/index.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import Icon from '../components/Icon.html';
3-
import Logo from '../components/Logo.html';
2+
import Icon from '../components/Icon.svelte';
3+
import Logo from '../components/Logo.svelte';
44
import contributors from './_contributors.js';
55
66
let sy = 0;

site/src/routes/repl/_components/AppControls/index.html renamed to site/src/routes/repl/_components/AppControls/index.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script>
22
import * as fleece from 'golden-fleece';
33
import { createEventDispatcher } from 'svelte';
4-
import UserMenu from './UserMenu.html';
5-
import Icon from '../../../../components/Icon.html';
4+
import UserMenu from './UserMenu.svelte';
5+
import Icon from '../../../../components/Icon.svelte';
66
import * as doNotZip from 'do-not-zip';
77
import downloadBlob from '../../_utils/downloadBlob.js';
88
import { user } from '../../../../user.js';
@@ -115,7 +115,7 @@
115115
// null out any deleted files
116116
const set = new Set(components.map(m => `${m.name}.${m.type}`));
117117
Object.keys(gist.files).forEach(file => {
118-
if (/\.(html|js)$/.test(file)) {
118+
if (/\.(svelte|html|js)$/.test(file)) {
119119
if (!set.has(file)) files[file] = null;
120120
}
121121
});
@@ -126,7 +126,7 @@
126126
throw new Error(`GitHub does not allow saving gists with empty files - ${file}`);
127127
}
128128
129-
if (!gist.files[files] || module.source !== gist.files[file].content) {
129+
if (!gist.files[file] || module.source !== gist.files[file].content) {
130130
files[file] = { content: module.source };
131131
}
132132
});
@@ -189,7 +189,7 @@
189189
190190
files.push(...components.map(component => ({ path: `src/${component.name}.${component.type}`, data: component.source })));
191191
files.push({
192-
path: `src/main.js`, data: `import App from './App.html';
192+
path: `src/main.js`, data: `import App from './App.svelte';
193193
194194
var app = new App({
195195
target: document.body,

site/src/routes/repl/_components/Input/ComponentSelector.html renamed to site/src/routes/repl/_components/Input/ComponentSelector.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { createEventDispatcher } from 'svelte';
3-
import Icon from '../../../../components/Icon.html';
3+
import Icon from '../../../../components/Icon.svelte';
44
import { enter } from '../events.js';
55
66
const dispatch = createEventDispatcher();
@@ -25,7 +25,7 @@
2525
}
2626
2727
function closeEdit() {
28-
const match = /(.+)\.(html|js)$/.exec($selected_store.name);
28+
const match = /(.+)\.(svelte|js)$/.exec($selected_store.name);
2929
$selected_store.name = match ? match[1] : $selected_store.name;
3030
if (match && match[2]) $selected_store.type = match[2];
3131
editing = null;
@@ -49,7 +49,7 @@
4949
function addNew() {
5050
const component = {
5151
name: uid++ ? `Component${uid}` : 'Component1',
52-
type: 'html',
52+
type: 'svelte',
5353
source: ''
5454
};
5555
@@ -181,7 +181,7 @@
181181
>
182182
{#if component.name == 'App'}
183183
<div class="uneditable">
184-
App.html
184+
App.svelte
185185
</div>
186186
{:else}
187187
{#if component === editing}

site/src/routes/repl/_components/Input/ModuleEditor.html renamed to site/src/routes/repl/_components/Input/ModuleEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import CodeMirror from '../CodeMirror.html';
2+
import CodeMirror from '../CodeMirror.svelte';
33
44
export let component;
55
export let error;

site/src/routes/repl/_components/Input/index.html renamed to site/src/routes/repl/_components/Input/index.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import ComponentSelector from './ComponentSelector.html';
3-
import ModuleEditor from './ModuleEditor.html';
2+
import ComponentSelector from './ComponentSelector.svelte';
3+
import ModuleEditor from './ModuleEditor.svelte';
44
55
export let component_store;
66
export let selected_store;

site/src/routes/repl/_components/Output/PropEditor.html renamed to site/src/routes/repl/_components/Output/PropEditor.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { createEventDispatcher } from 'svelte';
33
import * as fleece from 'golden-fleece';
4-
import CodeMirror from '../CodeMirror.html';
4+
import CodeMirror from '../CodeMirror.svelte';
55
66
const dispatch = createEventDispatcher();
77

site/src/routes/repl/_components/Output/index.html renamed to site/src/routes/repl/_components/Output/index.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script>
2-
import SplitPane from '../SplitPane.html';
3-
import Viewer from './Viewer.html';
4-
import CompilerOptions from './CompilerOptions.html';
5-
import PropEditor from './PropEditor.html';
6-
import CodeMirror from '../CodeMirror.html';
2+
import SplitPane from '../SplitPane.svelte';
3+
import Viewer from './Viewer.svelte';
4+
import CompilerOptions from './CompilerOptions.svelte';
5+
import PropEditor from './PropEditor.svelte';
6+
import CodeMirror from '../CodeMirror.svelte';
77
88
export let bundle;
99
export let js;

site/src/routes/repl/_components/Repl.html renamed to site/src/routes/repl/_components/Repl.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import { onMount } from 'svelte';
33
import { writable } from 'svelte/store';
44
import * as fleece from 'golden-fleece';
5-
import SplitPane from './SplitPane.html';
6-
import CodeMirror from './CodeMirror.html';
7-
import Input from './Input/index.html';
8-
import Output from './Output/index.html';
9-
import InputOutputToggle from './InputOutputToggle.html';
5+
import SplitPane from './SplitPane.svelte';
6+
import CodeMirror from './CodeMirror.svelte';
7+
import Input from './Input/index.svelte';
8+
import Output from './Output/index.svelte';
9+
import InputOutputToggle from './InputOutputToggle.svelte';
1010
1111
export let version = 'beta'; // TODO change this to latest when the time comes
1212
export let app;
@@ -100,7 +100,7 @@
100100
const selected = $selected_store;
101101
102102
if (selected.name === 'App') {
103-
// App.html can't be removed
103+
// App.svelte can't be removed
104104
selected.source = '';
105105
// $selected_store.set(selected);
106106
} else {
@@ -118,13 +118,13 @@
118118
}
119119
120120
function compile(component, options) {
121-
if (component.type === 'html') {
121+
if (component.type === 'svelte') {
122122
workers.compiler.postMessage({
123123
type: 'compile',
124124
source: component.source,
125125
options: Object.assign({
126126
name: component.name,
127-
filename: `${component.name}.html`
127+
filename: `${component.name}.svelte`
128128
}, options),
129129
entry: component === $component_store[0]
130130
});
@@ -154,7 +154,7 @@
154154
}
155155
156156
function navigate(filename) {
157-
const name = filename.replace(/\.html$/, '');
157+
const name = filename.replace(/\.svelte$/, '');
158158
159159
console.error(`TODO navigate`);
160160

site/src/routes/repl/embed.html renamed to site/src/routes/repl/embed.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<script>
1212
import { onMount } from 'svelte';
1313
import * as fleece from 'golden-fleece';
14-
import Repl from './_components/Repl.html';
14+
import Repl from './_components/Repl.svelte';
1515
1616
export let version, gist, demo;
1717
@@ -57,12 +57,12 @@
5757
source
5858
};
5959
})
60-
.filter(x => x.type === 'html' || x.type === 'js')
60+
.filter(x => x.type === 'svelte' || x.type === 'js')
6161
.sort((a, b) => {
62-
if (a.name === 'App' && a.type === 'html') return -1;
63-
if (b.name === 'App' && b.type === 'html') return 1;
62+
if (a.name === 'App' && a.type === 'svelte') return -1;
63+
if (b.name === 'App' && b.type === 'svelte') return 1;
6464
65-
if (a.type !== b.type) return a.type === 'html' ? -1 : 1;
65+
if (a.type !== b.type) return a.type === 'svelte' ? -1 : 1;
6666
6767
return a.name < b.name ? -1 : 1;
6868
});

0 commit comments

Comments
 (0)