Skip to content

Commit

Permalink
Merge pull request #2071 from sveltejs/gh-2067
Browse files Browse the repository at this point in the history
.html -> .svelte
  • Loading branch information
Rich-Harris committed Feb 9, 2019
2 parents da11d75 + e6ed8ef commit 1f5c043
Show file tree
Hide file tree
Showing 1,256 changed files with 467 additions and 470 deletions.
3 changes: 2 additions & 1 deletion register.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
const { compile } = require('./compiler.js');

let compileOptions = {
extensions: ['.html']
extensions: ['.svelte', '.html']
};

function capitalise(name) {
Expand Down Expand Up @@ -43,6 +43,7 @@ function registerExtension(extension) {
};
}

registerExtension('.svelte');
registerExtension('.html');

module.exports = register;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { onMount } from 'svelte';
import List from './List.html';
import Item from './Item.html';
import List from './List.svelte';
import Item from './Item.svelte';
let item;
let page;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import Foo from './Foo.html';
import Foo from './Foo.svelte';
</script>

<style>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<svelte:options immutable/>

<script>
import ImmutableTodo from './ImmutableTodo.html';
import MutableTodo from './MutableTodo.html';
import ImmutableTodo from './ImmutableTodo.svelte';
import MutableTodo from './MutableTodo.svelte';
export let todos;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import Modal from './Modal.html';
import Modal from './Modal.svelte';
export let showModal;
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import Nested from './Nested.html';
import Nested from './Nested.svelte';
</script>

<p>This is a top-level element.</p>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import Scatterplot from './Scatterplot.html';
import Scatterplot from './Scatterplot.svelte';
export let a;
export let b;
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-svelte": "^5.0.1",
"rollup-plugin-terser": "^4.0.4",
"sapper": "^0.26.0-alpha.5",
"sapper": "^0.26.0-alpha.7",
"svelte": "^3.0.0-beta.3"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { onMount } from 'svelte';
import Icon from './Icon.html';
import Logo from './Logo.html';
import Icon from './Icon.svelte';
import Logo from './Logo.svelte';
export let segment;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import InlineSvg from '../components/InlineSvg.html';
import Nav from '../components/TopNav.html';
import InlineSvg from '../components/InlineSvg.svelte';
import Nav from '../components/TopNav.svelte';
export let child;
export let path;
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions site/src/routes/api/examples/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function createExample(slug) {
const components = files
.map(file => {
const ext = path.extname(file);
if (ext !== '.html' && ext !== '.js') return null;
if (ext !== '.svelte' && ext !== '.js') return null;

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

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

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

return a.name < b.name ? -1 : 1;
});
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions site/src/routes/gist/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function get(req, res) {
const { id } = req.params;

const headers = {};
const user = req.session.passport && req.session.passport.user;
const user = req.session && req.session.passport && req.session.passport.user;
if (user) {
headers.Authorization = `token ${user.token}`;
}
Expand Down Expand Up @@ -34,7 +34,7 @@ export async function get(req, res) {
}

export async function patch(req, res) {
const user = req.session.passport && req.session.passport.user;
const user = req.session && req.session.passport && req.session.passport.user;

if (!user) {
res.writeHead(403, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { onMount, afterUpdate } from 'svelte';
import Icon from '../../components/Icon.html';
import Icon from '../../components/Icon.svelte';
export let sections = [];
export let active_section = null;
Expand Down
2 changes: 1 addition & 1 deletion site/src/routes/guide/_sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function() {

if (meta) {
source = lines.slice(1).join('\n');
const filename = meta.filename || (lang === 'html' && 'App.html');
const filename = meta.filename || (lang === 'html' && 'App.svelte');
if (filename) {
prefix = `<span class='filename'>${prefix} ${filename}</span>`;
className += ' named';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<script>
import { onMount, afterUpdate } from 'svelte';
import GuideContents from './_GuideContents.html';
import Icon from '../../components/Icon.html';
import GuideContents from './_GuideContents.svelte';
import Icon from '../../components/Icon.svelte';
export let sections;
let active_section;
Expand Down
4 changes: 2 additions & 2 deletions site/src/routes/index.html → site/src/routes/index.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import Icon from '../components/Icon.html';
import Logo from '../components/Logo.html';
import Icon from '../components/Icon.svelte';
import Logo from '../components/Logo.svelte';
import contributors from './_contributors.js';
let sy = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script>
import * as fleece from 'golden-fleece';
import { createEventDispatcher } from 'svelte';
import UserMenu from './UserMenu.html';
import Icon from '../../../../components/Icon.html';
import UserMenu from './UserMenu.svelte';
import Icon from '../../../../components/Icon.svelte';
import * as doNotZip from 'do-not-zip';
import downloadBlob from '../../_utils/downloadBlob.js';
import { user } from '../../../../user.js';
Expand Down Expand Up @@ -115,7 +115,7 @@
// null out any deleted files
const set = new Set(components.map(m => `${m.name}.${m.type}`));
Object.keys(gist.files).forEach(file => {
if (/\.(html|js)$/.test(file)) {
if (/\.(svelte|html|js)$/.test(file)) {
if (!set.has(file)) files[file] = null;
}
});
Expand All @@ -126,7 +126,7 @@
throw new Error(`GitHub does not allow saving gists with empty files - ${file}`);
}
if (!gist.files[files] || module.source !== gist.files[file].content) {
if (!gist.files[file] || module.source !== gist.files[file].content) {
files[file] = { content: module.source };
}
});
Expand Down Expand Up @@ -189,7 +189,7 @@
files.push(...components.map(component => ({ path: `src/${component.name}.${component.type}`, data: component.source })));
files.push({
path: `src/main.js`, data: `import App from './App.html';
path: `src/main.js`, data: `import App from './App.svelte';
var app = new App({
target: document.body,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import { createEventDispatcher } from 'svelte';
import Icon from '../../../../components/Icon.html';
import Icon from '../../../../components/Icon.svelte';
import { enter } from '../events.js';
const dispatch = createEventDispatcher();
Expand All @@ -25,7 +25,7 @@
}
function closeEdit() {
const match = /(.+)\.(html|js)$/.exec($selected_store.name);
const match = /(.+)\.(svelte|js)$/.exec($selected_store.name);
$selected_store.name = match ? match[1] : $selected_store.name;
if (match && match[2]) $selected_store.type = match[2];
editing = null;
Expand All @@ -49,7 +49,7 @@
function addNew() {
const component = {
name: uid++ ? `Component${uid}` : 'Component1',
type: 'html',
type: 'svelte',
source: ''
};
Expand Down Expand Up @@ -181,7 +181,7 @@
>
{#if component.name == 'App'}
<div class="uneditable">
App.html
App.svelte
</div>
{:else}
{#if component === editing}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import CodeMirror from '../CodeMirror.html';
import CodeMirror from '../CodeMirror.svelte';
export let component;
export let error;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script>
import ComponentSelector from './ComponentSelector.html';
import ModuleEditor from './ModuleEditor.html';
import ComponentSelector from './ComponentSelector.svelte';
import ModuleEditor from './ModuleEditor.svelte';
export let component_store;
export let selected_store;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { createEventDispatcher } from 'svelte';
import * as fleece from 'golden-fleece';
import CodeMirror from '../CodeMirror.html';
import CodeMirror from '../CodeMirror.svelte';
const dispatch = createEventDispatcher();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script>
import SplitPane from '../SplitPane.html';
import Viewer from './Viewer.html';
import CompilerOptions from './CompilerOptions.html';
import PropEditor from './PropEditor.html';
import CodeMirror from '../CodeMirror.html';
import SplitPane from '../SplitPane.svelte';
import Viewer from './Viewer.svelte';
import CompilerOptions from './CompilerOptions.svelte';
import PropEditor from './PropEditor.svelte';
import CodeMirror from '../CodeMirror.svelte';
export let bundle;
export let js;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
import * as fleece from 'golden-fleece';
import SplitPane from './SplitPane.html';
import CodeMirror from './CodeMirror.html';
import Input from './Input/index.html';
import Output from './Output/index.html';
import InputOutputToggle from './InputOutputToggle.html';
import SplitPane from './SplitPane.svelte';
import CodeMirror from './CodeMirror.svelte';
import Input from './Input/index.svelte';
import Output from './Output/index.svelte';
import InputOutputToggle from './InputOutputToggle.svelte';
export let version = 'beta'; // TODO change this to latest when the time comes
export let app;
Expand Down Expand Up @@ -100,7 +100,7 @@
const selected = $selected_store;
if (selected.name === 'App') {
// App.html can't be removed
// App.svelte can't be removed
selected.source = '';
// $selected_store.set(selected);
} else {
Expand All @@ -118,13 +118,13 @@
}
function compile(component, options) {
if (component.type === 'html') {
if (component.type === 'svelte') {
workers.compiler.postMessage({
type: 'compile',
source: component.source,
options: Object.assign({
name: component.name,
filename: `${component.name}.html`
filename: `${component.name}.svelte`
}, options),
entry: component === $component_store[0]
});
Expand Down Expand Up @@ -154,7 +154,7 @@
}
function navigate(filename) {
const name = filename.replace(/\.html$/, '');
const name = filename.replace(/\.svelte$/, '');
console.error(`TODO navigate`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script>
import { onMount } from 'svelte';
import * as fleece from 'golden-fleece';
import Repl from './_components/Repl.html';
import Repl from './_components/Repl.svelte';
export let version, gist, demo;
Expand Down Expand Up @@ -57,12 +57,12 @@
source
};
})
.filter(x => x.type === 'html' || x.type === 'js')
.filter(x => x.type === 'svelte' || x.type === 'js')
.sort((a, b) => {
if (a.name === 'App' && a.type === 'html') return -1;
if (b.name === 'App' && b.type === 'html') return 1;
if (a.name === 'App' && a.type === 'svelte') return -1;
if (b.name === 'App' && b.type === 'svelte') return 1;
if (a.type !== b.type) return a.type === 'html' ? -1 : 1;
if (a.type !== b.type) return a.type === 'svelte' ? -1 : 1;
return a.name < b.name ? -1 : 1;
});
Expand Down
Loading

0 comments on commit 1f5c043

Please sign in to comment.