From 642ea11a75a0c8f16e79a7a14047fc3732581c74 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:52:44 -0700 Subject: [PATCH] Change URL of playground build CDN (#3095) --- .changeset/calm-items-sparkle.md | 5 +++++ packages/playground-handbook/copy/en/TypeScript Versions.md | 2 +- packages/playground-handbook/copy/en/URL Structure.md | 2 +- packages/playground/README.md | 2 +- packages/sandbox/README.md | 4 ++-- packages/sandbox/script/downloadReleases.js | 4 ++-- packages/typescript-vfs/src/index.ts | 2 +- packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx | 6 +++--- packages/typescriptlang-org/src/pages/dev/sandbox.tsx | 6 +++--- packages/typescriptlang-org/src/pages/dev/twoslash.tsx | 2 +- packages/typescriptlang-org/src/templates/play.tsx | 6 +++--- 11 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 .changeset/calm-items-sparkle.md diff --git a/.changeset/calm-items-sparkle.md b/.changeset/calm-items-sparkle.md new file mode 100644 index 000000000000..f5d38f826a56 --- /dev/null +++ b/.changeset/calm-items-sparkle.md @@ -0,0 +1,5 @@ +--- +"@typescript/vfs": patch +--- + +Move playground CDN to new, stable URL diff --git a/packages/playground-handbook/copy/en/TypeScript Versions.md b/packages/playground-handbook/copy/en/TypeScript Versions.md index ba36f151a684..8cc4864d159c 100644 --- a/packages/playground-handbook/copy/en/TypeScript Versions.md +++ b/packages/playground-handbook/copy/en/TypeScript Versions.md @@ -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). diff --git a/packages/playground-handbook/copy/en/URL Structure.md b/packages/playground-handbook/copy/en/URL Structure.md index 86eff8dae948..c6fab888bbd5 100644 --- a/packages/playground-handbook/copy/en/URL Structure.md +++ b/packages/playground-handbook/copy/en/URL Structure.md @@ -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: diff --git a/packages/playground/README.md b/packages/playground/README.md index 22fe6050b368..d4f947fe8611 100644 --- a/packages/playground/README.md +++ b/packages/playground/README.md @@ -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: diff --git a/packages/sandbox/README.md b/packages/sandbox/README.md index 0d05d048c19c..bbc1c425f188 100644 --- a/packages/sandbox/README.md +++ b/packages/sandbox/README.md @@ -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/monaco-editor@4.0.5/min/vs', sandbox: "https://www.typescriptlang.org/js/sandbox", }, diff --git a/packages/sandbox/script/downloadReleases.js b/packages/sandbox/script/downloadReleases.js index e53d4c3dc7bf..b473a7d09244 100644 --- a/packages/sandbox/script/downloadReleases.js +++ b/packages/sandbox/script/downloadReleases.js @@ -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] diff --git a/packages/typescript-vfs/src/index.ts b/packages/typescript-vfs/src/index.ts index 1239a909d33a..10ec61f02026 100755 --- a/packages/typescript-vfs/src/index.ts +++ b/packages/typescript-vfs/src/index.ts @@ -316,7 +316,7 @@ export const createDefaultMapFromCDN = ( const fetchlike = fetcher || fetch const fsMap = new Map() 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 diff --git a/packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx b/packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx index 5572de494b28..c126741867c9 100755 --- a/packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx +++ b/packages/typescriptlang-org/src/pages/dev/bug-workbench.tsx @@ -54,8 +54,8 @@ const Play: React.FC = (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 } @@ -66,7 +66,7 @@ const Play: React.FC = (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/", diff --git a/packages/typescriptlang-org/src/pages/dev/sandbox.tsx b/packages/typescriptlang-org/src/pages/dev/sandbox.tsx index 9b778f55fb43..624002529c34 100644 --- a/packages/typescriptlang-org/src/pages/dev/sandbox.tsx +++ b/packages/typescriptlang-org/src/pages/dev/sandbox.tsx @@ -26,7 +26,7 @@ const Index: React.FC = 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"], @@ -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/monaco-editor@4.0.5/min/vs', sandbox: 'https://www.typescriptlang.org/js/sandbox', }, diff --git a/packages/typescriptlang-org/src/pages/dev/twoslash.tsx b/packages/typescriptlang-org/src/pages/dev/twoslash.tsx index d188b924f0e7..d9f15055c704 100755 --- a/packages/typescriptlang-org/src/pages/dev/twoslash.tsx +++ b/packages/typescriptlang-org/src/pages/dev/twoslash.tsx @@ -40,7 +40,7 @@ const Index: React.FC = 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"], diff --git a/packages/typescriptlang-org/src/templates/play.tsx b/packages/typescriptlang-org/src/templates/play.tsx index f373f8641898..48dcdbf9b694 100644 --- a/packages/typescriptlang-org/src/templates/play.tsx +++ b/packages/typescriptlang-org/src/templates/play.tsx @@ -80,8 +80,8 @@ const Play: React.FC = (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 } @@ -99,7 +99,7 @@ const Play: React.FC = (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.