Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
6ac0e97
Add standalone TypeScript 7.1 playground
jakebailey Sep 16, 2026
21f6e30
Integrate TS 7.1 playground into website
jakebailey Sep 16, 2026
5b0bda0
Vendor TypeScript 7 compiler for playground
jakebailey Sep 16, 2026
1360e9a
Add vendored TypeScript compiler artifacts
jakebailey Sep 16, 2026
e263e75
Remove internal playground README
jakebailey Sep 16, 2026
b105882
Add TypeScript 7 Monaco LSP support
jakebailey Sep 16, 2026
0bca0ef
Fix TypeScript 7 playground asset URLs
jakebailey Sep 16, 2026
fed0140
Fix playground COI redirect loop
jakebailey Sep 16, 2026
53eca8e
Turn TS7 playground into a project workspace
jakebailey Sep 16, 2026
d67f86b
Improve TypeScript 7 project UX
jakebailey Sep 16, 2026
cdda448
Fix TSConfig validation and saved emit
jakebailey Sep 16, 2026
eb6943b
Add truthful playground loading progress
jakebailey Sep 16, 2026
8639a6a
Cache TypeScript playground assets
jakebailey Sep 16, 2026
65665fd
Enable TS7 semantic editor features
jakebailey Sep 16, 2026
02ee465
Show playground while TypeScript loads
jakebailey Sep 16, 2026
6cfd09a
Clarify playground file tree nesting
jakebailey Sep 16, 2026
0be5f54
Support type queries in JavaScript files
jakebailey Sep 22, 2026
a38d170
Refresh vendored TypeScript WASI compiler
jakebailey Sep 24, 2026
3b18493
Add unified classic TypeScript versions
jakebailey Sep 24, 2026
cdd91f6
Make TS7 playground mobile responsive
jakebailey Sep 24, 2026
dc974e5
Add playground editor navigation history
jakebailey Sep 24, 2026
2c0f368
Add project file deletion
jakebailey Sep 24, 2026
38d49bf
Restore classic Monaco editor features
jakebailey Sep 24, 2026
2155152
Add project-wide Problems panel
jakebailey Sep 24, 2026
151543a
Add automatic package type acquisition
jakebailey Sep 24, 2026
cf26cf6
Integrate playground examples and help
jakebailey Sep 24, 2026
0eb90e5
Vendor the package type acquisition runtime
jakebailey Sep 24, 2026
6bb80a4
Wrap playground controls on tablets
jakebailey Sep 24, 2026
659b863
Add playground workspace layout controls
jakebailey Sep 24, 2026
a7334c0
Simplify playground compiler versions
jakebailey Sep 24, 2026
0ab90f8
Wrap playground code on mobile
jakebailey Sep 24, 2026
6d026df
Contain Monaco on mobile viewports
jakebailey Sep 24, 2026
b98a7e8
Keep Problems above emitted output
jakebailey Sep 24, 2026
85d9fc0
Expand the editor when panels are hidden
jakebailey Sep 24, 2026
653e0f0
Use disclosure controls for output sections
jakebailey Sep 24, 2026
53699e5
Confirm the initial compiler download
jakebailey Sep 24, 2026
16e24e7
Replace the new-file browser prompt
jakebailey Sep 24, 2026
0299dd3
Show the exact compiler version
jakebailey Sep 24, 2026
0a6be8c
Center the compiler download consent
jakebailey Sep 24, 2026
bd61e5f
Version multi-file playground URLs
jakebailey Sep 24, 2026
f5b0cc0
Add inline compiler option overrides
jakebailey Sep 24, 2026
49b8dae
Route legacy examples and handbook links
jakebailey Sep 24, 2026
fb54626
Load acquired package types into the live LSP
jakebailey Sep 24, 2026
5e0e760
Add persisted playground settings
jakebailey Sep 24, 2026
fcfa20f
Replace native playground dialogs
jakebailey Sep 24, 2026
a9e3f53
Replace the native compiler selector
jakebailey Sep 24, 2026
b3daccd
Add a compact playground site shell
jakebailey Sep 24, 2026
a92ba11
Persist editor selections in project links
jakebailey Sep 24, 2026
7de6b82
Restore reflect-metadata run compatibility
jakebailey Sep 24, 2026
c8a5bab
Rename the next-generation playground
jakebailey Sep 25, 2026
e263476
Move Playground v2 to its permanent route
jakebailey Sep 25, 2026
32ca7e0
Improve Playground v2 accessibility
jakebailey Sep 25, 2026
7f0e826
Build the Monaco LSP client from source
jakebailey Sep 30, 2026
80221c2
Patch the Monaco LSP client from git
jakebailey Sep 30, 2026
726e690
Generalize Monaco LSP model ownership
jakebailey Sep 30, 2026
1a332b3
Refresh the Playground v2 compiler
jakebailey Sep 30, 2026
a6d13f3
Include new Corsa API modules
jakebailey Sep 30, 2026
1d8f7c2
Resolve Node builtin package types
jakebailey Sep 30, 2026
86ba926
Make Problems messages copyable
jakebailey Sep 30, 2026
44ffd5e
Show automatic type configuration
jakebailey Sep 30, 2026
8376018
Replace Playground v2 type acquisition
jakebailey Oct 1, 2026
06701a6
Leave the legacy ATA package unchanged
jakebailey Oct 1, 2026
f8d20f6
Leave the legacy playground entry unchanged
jakebailey Oct 1, 2026
41a1f12
Make Playground v2 the default playground
jakebailey Oct 1, 2026
a04a799
Record a release for legacy plugin links
jakebailey Oct 1, 2026
76eebf1
Test compatibility redirects without parsing HTML
jakebailey Oct 1, 2026
bff3dcb
Keep package type acquisition off the startup path
jakebailey Oct 1, 2026
3f1c940
Refresh editor diagnostics after package acquisition
jakebailey Oct 1, 2026
e97206b
Use one compiler diagnostic source in the native editor
jakebailey Oct 1, 2026
1a3fa89
Tighten playground controls and pane layout
jakebailey Oct 1, 2026
14f8b78
Move automatic native compiler work off the UI thread
jakebailey Oct 2, 2026
95822df
Remove the playground's global compiler API
jakebailey Oct 2, 2026
0b4c065
Avoid redundant native program preparation
jakebailey Oct 2, 2026
20c3aa5
Coalesce playground project and selection saves
jakebailey Oct 2, 2026
7830149
Refresh Corsa with the revised WASI package layout
jakebailey Oct 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/legacy-playground-plugin-links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-typescript-playground-plugin": patch
---

Point plugin installation and development instructions to the legacy playground at `/oldplay/`.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* -text
patches/*.patch -whitespace
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ typings/

# tdsx
dist
!packages/playground-v2/vendor/typescript/dist/
!packages/playground-v2/vendor/typescript/dist/**
!packages/playground-v2/vendor/typescript-wasip1-wasm/dist/
!packages/playground-v2/vendor/typescript-wasip1-wasm/dist/**

.lighthouserc.json
packages/documentation/output/attribution.json
Expand All @@ -78,6 +82,8 @@ packages/documentation/output/attribution.json
packages/sandbox/src/releases.json
packages/sandbox/src/release_data.ts
packages/typescriptlang-org/src/lib/documentationNavigation.ts
packages/typescriptlang-org/static/play/
packages/typescriptlang-org/static/v2/

.idea/

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"webpack": "^5.105.3"
},
"patchedDependencies": {
"@vscode/[email protected]": "patches/@[email protected]",
"[email protected]": "patches/[email protected]"
},
"ignoredBuiltDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion packages/create-typescript-playground-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A template for creating new plugins for the TypeScript playground.
<p>You need about 5 minutes, Node.js, yarn and Firefox/Edge or Chrome.</p>
<p><b>Step 1</b>: Use the template to bootstrap: <code>yarn create typescript-playground-plugin playground-my-plugin</code></p>
<p><b>Step 2</b>: Run <code>yarn start</code> in the new repo, to start up the local dev server</p>
<p><b>Step 3</b>: Open the playground in your browser, click "Options" and enable <code>"Connect to localhost:5000"</code></p>
<p><b>Step 3</b>: Open the <a href="https://www.typescriptlang.org/oldplay/">legacy playground</a> in your browser, click "Options" and enable <code>"Connect to localhost:5000"</code></p>
<p><b>Step 4</b>: Refresh, and see the new tab. That's your plugin up and running</p>
<p>&nbsp;</p>
<p>That's all the pieces working in tandem, now you can make changes to the template and build out your plugin. The plugin in dev mode will always become forefront when connected, so you can re-load without a lot off clicks. To understand the template's technology, read the <a href='https://github.com/microsoft/TypeScript-Website/blob/v2/packages/create-typescript-playground-plugin/template/CONTRIBUTING.md'>CONTRIBUTING.md</a></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ My new plugin for the TypeScript playground.

## Running this plugin

- [Click this link](https://www.typescriptlang.org/play?install-plugin=[name]) to install
- [Click this link](https://www.typescriptlang.org/oldplay?install-plugin=[name]) to install

or

Expand Down
33 changes: 33 additions & 0 deletions packages/playground-v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@typescript/playground-v2",
"private": true,
"type": "module",
"scripts": {
"build": "node scripts/build.mjs",
"dev": "node scripts/build.mjs --serve",
"test": "node scripts/test-ata.mjs && node scripts/smoke-test.mjs",
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
"vendor-resources": "node scripts/vendor-resources.mjs",
"vendor-typescript": "node scripts/vendor-typescript.mjs"
},
"dependencies": {
"@bjorn3/browser_wasi_shim": "^0.4.2",
"@fontsource/nunito-sans": "^5.2.6",
"@typescript/typescript": "file:vendor/typescript",
"@typescript/typescript-wasip1-wasm": "file:vendor/typescript-wasip1-wasm",
"@vscode/monaco-lsp-client": "github:microsoft/monaco-editor#13f0c872dcf352815cc28d92dfff496c9839ea5c&path:/monaco-lsp-client",
"coi-serviceworker": "^0.1.7",
"hack-font": "^3.3.0",
"jsonc-parser": "^3.3.1",
"lz-string": "^1.5.0",
"monaco-editor": "0.56.0",
"monaco-editor-core": "0.56.0",
"reflect-metadata": "^0.2.2",
"vscode-json-languageservice": "^5.3.11",
"vscode-languageserver-textdocument": "^1.0.11"
},
"devDependencies": {
"esbuild": "^0.27.3",
"typescript": "*"
}
}
117 changes: 117 additions & 0 deletions packages/playground-v2/scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { context } from "esbuild"
import { createHash } from "node:crypto"
import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises"
import { dirname, resolve } from "node:path"
import { fileURLToPath } from "node:url"
import { compatibilityHtml, compatibilityPaths, playgroundPath } from "./routes.mjs"

const packageDirectory = resolve(dirname(fileURLToPath(import.meta.url)), "..")
const websiteDirectory = resolve(packageDirectory, "../..")
const vendorDirectory = resolve(packageDirectory, "vendor")
const outputDirectory = resolve(packageDirectory, "dist")
const websiteStaticDirectory = resolve(websiteDirectory, "packages/typescriptlang-org/static/play")
const compatibilityDirectories = compatibilityPaths.map(path =>
resolve(websiteDirectory, "packages/typescriptlang-org/static", path)
)
const serve = process.argv.includes("--serve")
const playgroundBase = serve ? "/" : process.env.PLAYGROUND_BASE ?? playgroundPath

const wasmFile = new URL(import.meta.resolve("@typescript/typescript-wasip1-wasm/lib/tsc.wasm"))
const libListURL = new URL(import.meta.resolve("@typescript/typescript-wasip1-wasm/lib/libFiles.json"))
const configSchema = new URL(import.meta.resolve("@typescript/typescript/schemas/tsconfig.schema.json"))
const releaseIndex = resolve(packageDirectory, "vendor/versions.json")
const examplesIndex = resolve(packageDirectory, "vendor/examples.json")
const helpIndex = resolve(packageDirectory, "vendor/help.json")
const editorWorker = fileURLToPath(import.meta.resolve("monaco-editor/editor/editor.worker"))
const coiServiceWorker = fileURLToPath(import.meta.resolve("coi-serviceworker/coi-serviceworker.min.js"))

const version = (await readFile(resolve(vendorDirectory, "version.txt"), "utf8")).trim()
const indexHtml = (await readFile(resolve(packageDirectory, "src/index.html"), "utf8"))
.replaceAll("__PLAYGROUND_BASE__", playgroundBase)
.replaceAll("__COMPILER_VERSION__", version)
.replace("<title>", `<title data-typescript-version="${version}">`)

await rm(outputDirectory, { force: true, recursive: true })
await mkdir(outputDirectory, { recursive: true })
const libFileNames = JSON.parse(await readFile(libListURL, "utf8"))
const libFiles = Object.fromEntries(
await Promise.all(
libFileNames.map(async fileName => [
`/${fileName}`,
await readFile(new URL(fileName, libListURL), "utf8"),
])
)
)
const libFilesJSON = JSON.stringify(libFiles)
const [wasmBytes, schemaBytes] = await Promise.all([readFile(wasmFile), readFile(configSchema)])
const assetCacheVersion = createHash("sha256")
.update(wasmBytes)
.update(libFilesJSON)
.update(schemaBytes)
.digest("hex")
.slice(0, 16)
await Promise.all([
writeFile(resolve(outputDirectory, "index.html"), indexHtml),
cp(coiServiceWorker, resolve(outputDirectory, "coi-serviceworker.min.js")),
cp(configSchema, resolve(outputDirectory, "tsconfig.schema.json")),
cp(releaseIndex, resolve(outputDirectory, "versions.json")),
cp(examplesIndex, resolve(outputDirectory, "examples.json")),
cp(helpIndex, resolve(outputDirectory, "help.json")),
cp(wasmFile, resolve(outputDirectory, "tsc.wasm")),
writeFile(resolve(outputDirectory, "lib-files.json"), libFilesJSON),
])

const buildContext = await context({
absWorkingDir: packageDirectory,
bundle: true,
conditions: ["browser", "default"],
define: {
__ASSET_CACHE_VERSION__: JSON.stringify(assetCacheVersion),
__LOAD_ASSET_SIZES__: JSON.stringify({
libraries: Buffer.byteLength(libFilesJSON),
schema: schemaBytes.byteLength,
wasm: wasmBytes.byteLength,
}),
__TS_VERSION__: JSON.stringify(version),
},
entryNames: "[name]",
entryPoints: {
main: resolve(packageDirectory, "src/main.ts"),
"editor.worker": editorWorker,
"strada.worker": resolve(packageDirectory, "src/strada.worker.ts"),
"native.worker": resolve(packageDirectory, "src/native.worker.ts"),
"tsgo-lsp.worker": resolve(packageDirectory, "src/tsgo-lsp.worker.ts"),
},
format: "esm",
loader: {
".ttf": "file",
".woff": "file",
".woff2": "file",
},
outdir: outputDirectory,
platform: "browser",
sourcemap: true,
target: ["es2022"],
})

if (serve) {
await buildContext.watch()
const server = await buildContext.serve({
host: "127.0.0.1",
port: 4173,
servedir: outputDirectory,
})
console.log(`TypeScript Playground v2: http://${server.host}:${server.port}`)
} else {
await buildContext.rebuild()
await buildContext.dispose()
await rm(websiteStaticDirectory, { force: true, recursive: true })
await cp(outputDirectory, websiteStaticDirectory, { recursive: true })
await Promise.all(
compatibilityDirectories.map(async directory => {
await mkdir(directory, { recursive: true })
await writeFile(resolve(directory, "index.html"), compatibilityHtml)
})
)
console.log(`Built TypeScript ${version} playground in ${outputDirectory}`)
}
12 changes: 12 additions & 0 deletions packages/playground-v2/scripts/routes.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const playgroundPath = "/play/"
export const compatibilityPaths = ["play/v2", "play/7", "v2"]
export const compatibilityScript = `location.replace(${JSON.stringify(playgroundPath)} + location.search + location.hash)`

export const compatibilityHtml = `<!doctype html>
<meta charset="utf-8">
<title>TypeScript Playground v2</title>
<script>
${compatibilityScript}
</script>
<noscript><a href="${playgroundPath}">Continue to TypeScript Playground v2</a></noscript>
`
86 changes: 86 additions & 0 deletions packages/playground-v2/scripts/smoke-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import assert from "node:assert/strict"
import { readFile, readdir } from "node:fs/promises"
import { runInNewContext } from "node:vm"
import { compatibilityHtml, compatibilityPaths, compatibilityScript, playgroundPath } from "./routes.mjs"
import { API } from "@typescript/typescript/unstable/sync"
import { instantiateWasm, WasmTransport } from "@typescript/typescript/unstable/wasm"
import { wasmURL } from "@typescript/typescript-wasip1-wasm"

const wasm = await readFile(wasmURL)
const module = await WebAssembly.compile(wasm)
const instance = await instantiateWasm(module)
const transport = new WasmTransport({ instance, cwd: "/workspace" })
const api = new API({ transport })

try {
assert(compatibilityHtml.includes(`<script>\n ${compatibilityScript}\n</script>`))
for (const path of compatibilityPaths) {
const original = new URL(`https://example.test/${path}/?ts=6.0.3&target=99#code/v2/encoded+project`)
let redirected
runInNewContext(compatibilityScript, {
location: {
search: original.search,
hash: original.hash,
replace(value) {
redirected = value
},
},
})
assert.equal(redirected, `${playgroundPath}${original.search}${original.hash}`)
}

const libListURL = new URL(import.meta.resolve("@typescript/typescript-wasip1-wasm/lib/libFiles.json"))
const libFileNames = JSON.parse(await readFile(libListURL, "utf8"))
assert.deepEqual(
libFileNames,
(await readdir(new URL("./", libListURL))).filter(fileName => /^lib(?:\..+)?\.d\.ts$/.test(fileName)).sort()
)
for (const fileName of libFileNames) {
transport.setFile(`/${fileName}`, await readFile(new URL(fileName, libListURL), "utf8"))
}

const files = {
"/workspace/tsconfig.json": JSON.stringify({
compilerOptions: {
declaration: true,
module: "CommonJS",
strict: true,
target: "ES2022",
},
include: ["./src/**/*"],
}),
"/workspace/src/greet.ts": "export const greet = (name: string) => `Hello, ${name}!`;",
"/workspace/src/index.ts": 'import { greet } from "./greet"; console.log(greet("TS7"));',
}
for (const [fileName, source] of Object.entries(files)) {
transport.setFile(fileName, source)
}

const config = api.readConfigFile("/workspace/tsconfig.json")
assert.equal(config.error, undefined)
const parsed = api.parseJsonConfigFileContent(config.config, {
configFileName: "/workspace/tsconfig.json",
})
assert.deepEqual(parsed.fileNames, ["/workspace/src/greet.ts", "/workspace/src/index.ts"])
const program = api.createProgram(parsed.fileNames, parsed.options, {
projectReferences: parsed.projectReferences,
configFileParsingDiagnostics: parsed.errors,
})
try {
assert.equal(program.getSyntacticDiagnostics().length, 0)
assert.equal(program.getSemanticDiagnostics().length, 0)
const emit = program.emitToString()
assert.equal(emit.emitSkipped, false)
assert.deepEqual(
[...emit.outputFiles.keys()],
["/workspace/src/greet.d.ts", "/workspace/src/greet.js", "/workspace/src/index.d.ts", "/workspace/src/index.js"]
)
assert.match(emit.outputFiles.get("/workspace/src/index.js").text, /require\("\.\/greet"\)/)
} finally {
program.dispose()
}
} finally {
api.close()
}

console.log("TypeScript WASM API smoke test passed")
31 changes: 31 additions & 0 deletions packages/playground-v2/scripts/test-ata.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { build } from "esbuild"
import { spawnSync } from "node:child_process"
import { mkdir, rm } from "node:fs/promises"
import { resolve } from "node:path"

const packageDirectory = resolve(import.meta.dirname, "..")
const testFiles = ["ata.test.mjs", "native-compiler.test.mjs"].map(name => resolve(packageDirectory, "dist", name))
await mkdir(resolve(packageDirectory, "dist"), { recursive: true })
try {
await build({
absWorkingDir: packageDirectory,
bundle: true,
conditions: ["browser"],
entryPoints: ["src/ata/ata.test.ts", "src/native-compiler.test.ts"],
entryNames: "[name]",
outExtension: { ".js": ".mjs" },
external: ["jsonc-parser"],
format: "esm",
outdir: resolve(packageDirectory, "dist"),
platform: "node",
target: ["es2022"],
})
const result = spawnSync(process.execPath, ["--test", ...testFiles], {
env: { ...process.env, PLAYGROUND_DIR: packageDirectory },
stdio: "inherit",
})
if (result.error) throw result.error
if (result.status !== 0) process.exitCode = result.status ?? 1
} finally {
await Promise.all(testFiles.map(file => rm(file, { force: true })))
}
Loading
Loading