Skip to content

Commit 0c11d98

Browse files
authored
Revert "feat: Support TypeScript in the playground!" (sveltejs#1260)
Revert "feat: Support TypeScript in the playground! (sveltejs#1221)" This reverts commit af8ada5.
1 parent af8ada5 commit 0c11d98

File tree

11 files changed

+11
-202
lines changed

11 files changed

+11
-202
lines changed

apps/svelte.dev/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const config: UserConfig = {
7171
}
7272
},
7373
optimizeDeps: {
74-
exclude: ['@sveltejs/site-kit', '@sveltejs/repl', '@rollup/browser', 'typestript']
74+
exclude: ['@sveltejs/site-kit', '@sveltejs/repl', '@rollup/browser']
7575
},
7676
ssr: {
7777
noExternal: ['@sveltejs/site-kit', '@sveltejs/repl'],

packages/repl/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"@sveltejs/package": "^2.0.0",
6565
"@sveltejs/vite-plugin-svelte": "4.0.0",
6666
"@types/estree": "^1.0.5",
67-
"magic-string": "^0.30.11",
6867
"prettier": "^3.3.2",
6968
"prettier-plugin-svelte": "^3.3.2",
7069
"publint": "^0.2.12",
@@ -103,7 +102,6 @@
103102
"svelte": "5.23.0",
104103
"tailwindcss": "^4.0.15",
105104
"tarparser": "^0.0.4",
106-
"zimmerframe": "^1.1.2",
107-
"typestript": "workspace:*"
105+
"zimmerframe": "^1.1.2"
108106
}
109107
}

packages/repl/src/lib/Workspace.svelte.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,6 @@ export class Workspace {
589589
extensions.push(javascript());
590590
break;
591591

592-
case 'ts':
593-
extensions.push(javascript({ typescript: true }));
594-
break;
595-
596592
case 'html':
597593
extensions.push(html());
598594
break;

packages/repl/src/lib/workers/bundler/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { walk } from 'zimmerframe';
33
import '../patch_window';
44
import { rollup } from '@rollup/browser';
55
import { DEV } from 'esm-env';
6-
import strip_types from './plugins/typescript-strip-types';
76
import commonjs from './plugins/commonjs';
87
import glsl from './plugins/glsl';
98
import json from './plugins/json';
@@ -185,7 +184,7 @@ async function get_bundle(
185184
if (importer.startsWith(VIRTUAL)) {
186185
const url = new URL(importee, importer);
187186

188-
for (const suffix of ['', '.js', '.ts', '.json']) {
187+
for (const suffix of ['', '.js', '.json']) {
189188
const with_suffix = `${url.pathname.slice(1)}${suffix}`;
190189
const file = virtual.get(with_suffix);
191190

@@ -281,15 +280,15 @@ async function get_bundle(
281280
const message = `bundling ${id.replace(VIRTUAL + '/', '').replace(NPM + '/', '')}`;
282281
self.postMessage({ type: 'status', message });
283282

284-
if (!/\.(svelte|js|ts)$/.test(id)) return null;
283+
if (!/\.(svelte|js)$/.test(id)) return null;
285284

286-
const filename = id.split('/').pop()!;
285+
const name = id.split('/').pop()?.split('.')[0];
287286

288287
let result: CompileResult;
289288

290289
if (id.endsWith('.svelte')) {
291290
const compilerOptions: any = {
292-
filename,
291+
filename: name + '.svelte',
293292
generate: Number(svelte.VERSION.split('.')[0]) >= 5 ? 'client' : 'dom',
294293
dev: true
295294
};
@@ -343,9 +342,9 @@ async function get_bundle(
343342
$$_styles.push($$__style);
344343
`.replace(/\t/g, '');
345344
}
346-
} else if (/\.svelte\.(js|ts)$/.test(id)) {
345+
} else if (id.endsWith('.svelte.js')) {
347346
const compilerOptions: any = {
348-
filename,
347+
filename: name + '.js',
349348
generate: 'client',
350349
dev: true
351350
};
@@ -388,7 +387,6 @@ async function get_bundle(
388387
input: './__entry.js',
389388
cache: previous?.key === key && previous.cache,
390389
plugins: [
391-
strip_types,
392390
repl_plugin,
393391
commonjs,
394392
json,

packages/repl/src/lib/workers/bundler/plugins/typescript-strip-types.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/repl/src/lib/workers/compiler/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import '@sveltejs/site-kit/polyfills';
22
import type { CompileResult } from 'svelte/compiler';
33
import type { ExposedCompilerOptions, File } from '../../Workspace.svelte';
4-
import { stripTypes } from 'typestript';
54
import { load_svelte } from '../npm';
65

76
// hack for magic-string and Svelte 4 compiler
@@ -22,7 +21,7 @@ addEventListener('message', async (event) => {
2221

2322
const { can_use_experimental_async, svelte } = (cache[version] ??= await load_svelte(version));
2423

25-
if (!file.name.endsWith('.svelte') && !file.name.includes('.svelte.') && !svelte.compileModule) {
24+
if (!file.name.endsWith('.svelte') && !svelte.compileModule) {
2625
// .svelte.js file compiled with Svelte 3/4 compiler
2726
postMessage({
2827
id,
@@ -38,7 +37,7 @@ addEventListener('message', async (event) => {
3837

3938
let migration = null;
4039

41-
if (file.name.endsWith('.svelte') && svelte.migrate) {
40+
if (svelte.migrate) {
4241
try {
4342
migration = svelte.migrate(file.contents, { filename: file.name });
4443
} catch (e) {
@@ -81,8 +80,7 @@ addEventListener('message', async (event) => {
8180
compilerOptions.experimental = { async: true };
8281
}
8382

84-
const code = file.name.endsWith('.ts') ? stripTypes(file.contents).toString() : file.contents;
85-
result = svelte.compileModule(code, compilerOptions);
83+
result = svelte.compileModule(file.contents, compilerOptions);
8684
}
8785

8886
postMessage({

packages/typestript/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/typestript/package.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

packages/typestript/src/index.js

Lines changed: 0 additions & 84 deletions
This file was deleted.

packages/typestript/tsconfig.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)