Skip to content

Commit

Permalink
Change URL of playground build CDN (#3095)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey authored Jun 3, 2024
1 parent fb8ea17 commit 642ea11
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-items-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@typescript/vfs": patch
---

Move playground CDN to new, stable URL
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The TypeScript Playground supports TypeScript versions all the way back to `3.3.

The ability to switch the version of TypeScript makes it easy to figure out potential regressions and to be able to let people test out new language features without having to upgrade their projects to (potentially) an unstable version of TypeScript. You can access the list of production TypeScript versions via a dropdown in the editor's toolbar inside the Playground. If there's a current beta or rc, that will show at the top.

The dropdown shows the highest patch version for a TypeScript release, but that is not every version available. You can refer to these two JSON files for the full list of [release versions](https://typescript.azureedge.net/indexes/releases.json) and [pre-release versions](https://typescript.azureedge.net/indexes/pre-releases.json).
The dropdown shows the highest patch version for a TypeScript release, but that is not every version available. You can refer to these two JSON files for the full list of [release versions](https://playgroundcdn.typescriptlang.org/indexes/releases.json) and [pre-release versions](https://playgroundcdn.typescriptlang.org/indexes/pre-releases.json).

Setting a TypeScript version will append `?ts=[version]` to your URL and reload. For example, setting the TypeScript version to 4.3.5 will add `?ts=4.3.5` to the URL, which is an OK segue to the overview of the [URL's structure](/play#handbook-10).

Expand Down
2 changes: 1 addition & 1 deletion packages/playground-handbook/copy/en/URL Structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or to trigger some action in the Playground UI by default:

Then the query string tend to be about changing the state of the Playground setup from the default:

- `?ts=3.9.2` - Sets the TypeScript version, the list of supported versions is in these [two](https://typescript.azureedge.net/indexes/pre-releases.json) [json](https://typescript.azureedge.net/indexes/releases.json) files.
- `?ts=3.9.2` - Sets the TypeScript version, the list of supported versions is in these [two](https://playgroundcdn.typescriptlang.org/indexes/pre-releases.json) [json](https://playgroundcdn.typescriptlang.org/indexes/releases.json) files.

There are two special cases for the `ts` option:

Expand Down
2 changes: 1 addition & 1 deletion packages/playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Or to trigger some action by default:

Then queries tend to be about changing the state of the Playground setup from the default:

- `?ts=3.9.2` - Sets the TypeScript version, the list of supported versions is in these [two](https://typescript.azureedge.net/indexes/pre-releases.json) [json](https://typescript.azureedge.net/indexes/releases.json) files.
- `?ts=3.9.2` - Sets the TypeScript version, the list of supported versions is in these [two](https://playgroundcdn.typescriptlang.org/indexes/pre-releases.json) [json](https://playgroundcdn.typescriptlang.org/indexes/releases.json) files.

There are two special cases for the `ts` option:

Expand Down
4 changes: 2 additions & 2 deletions packages/sandbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ the same runtime loader patterns for importing into your web page. This package
// For the monaco version you can use unpkg or the TypeScript web infra CDN
// You can see the available releases for TypeScript here:
// https://typescript.azureedge.net/indexes/releases.json
// https://playgroundcdn.typescriptlang.org/indexes/releases.json
//
require.config({
paths: {
vs: "https://typescript.azureedge.net/cdn/4.0.5/monaco/min/vs",
vs: "https://playgroundcdn.typescriptlang.org/cdn/4.0.5/monaco/min/vs",
// vs: 'https://unpkg.com/@typescript-deploys/[email protected]/min/vs',
sandbox: "https://www.typescriptlang.org/js/sandbox",
},
Expand Down
4 changes: 2 additions & 2 deletions packages/sandbox/script/downloadReleases.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ const { join } = require("path")
const { format } = require("prettier")

const go = async () => {
const response = await fetch("https://typescript.azureedge.net/indexes/releases.json")
const response = await fetch("https://playgroundcdn.typescriptlang.org/indexes/releases.json")
const releases = await response.json()
const versions = releases.versions.reverse()

// Look through the prereleases to see if the beta and RC are included in the pre-releases
// and add those to the list of versions.
const preReleaseResponse = await fetch("https://typescript.azureedge.net/indexes/pre-releases.json")
const preReleaseResponse = await fetch("https://playgroundcdn.typescriptlang.org/indexes/pre-releases.json")
const preReleases = await preReleaseResponse.json()
const latestStable = versions[0]

Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-vfs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export const createDefaultMapFromCDN = (
const fetchlike = fetcher || fetch
const fsMap = new Map<string, string>()
const files = knownLibFilesForCompilerOptions(options, ts)
const prefix = `https://typescript.azureedge.net/cdn/${version}/typescript/lib/`
const prefix = `https://playgroundcdn.typescriptlang.org/cdn/${version}/typescript/lib/`

function zip(str: string) {
return lzstring ? lzstring.compressToUTF16(str) : str
Expand Down
6 changes: 3 additions & 3 deletions packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const Play: React.FC<Props> = (props) => {
let tsVersionParam = params.get("ts")
// handle the nightly lookup
if (!tsVersionParam || tsVersionParam && tsVersionParam === "Nightly" || tsVersionParam === "next") {
// Avoids the CDN to doubly skip caching
const nightlyLookup = await fetch("https://tswebinfra.blob.core.windows.net/indexes/next.json", { cache: "no-cache" })
// The CDN is configured to have a short TTL on the indexes directory.
const nightlyLookup = await fetch("https://playgroundcdn.typescriptlang.org/indexes/next.json", { cache: "no-cache" })
const nightlyJSON = await nightlyLookup.json()
tsVersionParam = nightlyJSON.version
}
Expand All @@ -66,7 +66,7 @@ const Play: React.FC<Props> = (props) => {
const re: any = global.require
re.config({
paths: {
vs: `https://typescript.azureedge.net/cdn/${tsVersionParam}/monaco/dev/vs`,
vs: `https://playgroundcdn.typescriptlang.org/cdn/${tsVersionParam}/monaco/dev/vs`,
"typescript-sandbox": sandboxRoot,
"typescript-playground": playgroundRoot,
"unpkg": "https://unpkg.com/",
Expand Down
6 changes: 3 additions & 3 deletions packages/typescriptlang-org/src/pages/dev/sandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Index: React.FC<Props> = props => {

re.config({
paths: {
vs: "https://typescript.azureedge.net/cdn/4.0.5/monaco/min/vs",
vs: "https://playgroundcdn.typescriptlang.org/cdn/4.0.5/monaco/min/vs",
sandbox: withPrefix("/js/sandbox"),
},
ignoreDuplicateModules: ["vs/editor/editor.main"],
Expand Down Expand Up @@ -238,11 +238,11 @@ export default async function () {
// For the monaco version you can use unpkg or the TypeSCript web infra CDN
// You can see the available releases for TypeScript here:
// https://typescript.azureedge.net/indexes/releases.json
// https://playgroundcdn.typescriptlang.org/indexes/releases.json
//
require.config({
paths: {
vs: 'https://typescript.azureedge.net/cdn/4.0.5/monaco/min/vs',
vs: 'https://playgroundcdn.typescriptlang.org/cdn/4.0.5/monaco/min/vs',
// vs: 'https://unpkg.com/@typescript-deploys/[email protected]/min/vs',
sandbox: 'https://www.typescriptlang.org/js/sandbox',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/typescriptlang-org/src/pages/dev/twoslash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Index: React.FC<Props> = props => {

re.config({
paths: {
vs: "https://typescript.azureedge.net/cdn/4.0.5/monaco/min/vs",
vs: "https://playgroundcdn.typescriptlang.org/cdn/4.0.5/monaco/min/vs",
sandbox: sandboxRoot,
},
ignoreDuplicateModules: ["vs/editor/editor.main"],
Expand Down
6 changes: 3 additions & 3 deletions packages/typescriptlang-org/src/templates/play.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const Play: React.FC<Props> = (props) => {
let tsVersionParam = params.get("ts")
// handle the nightly lookup
if (tsVersionParam && tsVersionParam === "Nightly" || tsVersionParam === "next") {
// Avoids the CDN to doubly skip caching
const nightlyLookup = await fetch("https://tswebinfra.blob.core.windows.net/indexes/next.json", { cache: "no-cache" })
// The CDN is configured to have a short TTL on the indexes directory.
const nightlyLookup = await fetch("https://playgroundcdn.typescriptlang.org/indexes/next.json", { cache: "no-cache" })
const nightlyJSON = await nightlyLookup.json()
tsVersionParam = nightlyJSON.version
}
Expand All @@ -99,7 +99,7 @@ const Play: React.FC<Props> = (props) => {
const useLocalCompiler = tsVersion === "dev"
const devIsh = ["pr", "dev"]
const version = devIsh.find(d => tsVersion.includes(d)) ? "dev" : "min"
const urlForMonaco = useLocalCompiler ? "http://localhost:5615/dev/vs" : `https://typescript.azureedge.net/cdn/${tsVersion}/monaco/${version}/vs`
const urlForMonaco = useLocalCompiler ? "http://localhost:5615/dev/vs" : `https://playgroundcdn.typescriptlang.org/cdn/${tsVersion}/monaco/${version}/vs`

// Make a quick HEAD call for the main monaco editor for this version of TS, if it
// bails then give a useful error message and bail.
Expand Down

0 comments on commit 642ea11

Please sign in to comment.