Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@typescript/sandbox
Advanced tools
The TypeScript Sandbox is the editor part of the TypeScript Playground. It's effectively an opinionated fork of monaco-typescript with extra extension points so that projects like the TypeScript Playground can exist.
The TypeScript Sandbox is the editor part of the TypeScript Playground. It's effectively an opinionated fork of monaco-typescript with extra extension points so that projects like the TypeScript Playground can exist.
This project is useful to you if:
This library is published to the CDN as an AMD module. This is the same format that vscode/monaco use, and so you can use the same runtime loader patterns for importing into your web page. This package is also available as an ESM and CJS module on NPM.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<div id="loader">Loading...</div>
<div id="monaco-editor-embed" style="height: 800px;" />
<script>
// First set up the VSCode loader in a script tag
const getLoaderScript = document.createElement("script")
getLoaderScript.src = "https://www.typescriptlang.org/js/vs.loader.js"
getLoaderScript.async = true
getLoaderScript.onload = () => {
// Now the loader is ready, tell require where it can get the version of monaco, and the sandbox
// This version uses the latest version of the sandbox, which is used on the TypeScript website
// For the monaco version you can use unpkg or the TypeScript web infra CDN
// You can see the available releases for TypeScript here:
// https://playgroundcdn.typescriptlang.org/indexes/releases.json
//
require.config({
paths: {
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",
},
// This is something you need for monaco to work
ignoreDuplicateModules: ["vs/editor/editor.main"],
})
// Grab a copy of monaco, TypeScript and the sandbox
require(["vs/editor/editor.main", "vs/language/typescript/tsWorker", "sandbox/index"], (
main,
_tsWorker,
sandboxFactory
) => {
const initialCode = `import {markdown, danger} from "danger"
export default async function () {
// Check for new @types in devDependencies
const packageJSONDiff = await danger.git.JSONDiffForFile("package.json")
const newDeps = packageJSONDiff.devDependencies.added
const newTypesDeps = newDeps?.filter(d => d.includes("@types")) ?? []
if (newTypesDeps.length){
markdown("Added new types packages " + newTypesDeps.join(", "))
}
}
`
const isOK = main && window.ts && sandboxFactory
if (isOK) {
document.getElementById("loader").parentNode.removeChild(document.getElementById("loader"))
} else {
console.error("Could not get all the dependencies of sandbox set up!")
console.error("main", !!main, "ts", !!window.ts, "sandbox", !!sandbox)
return
}
// Create a sandbox and embed it into the div #monaco-editor-embed
const sandboxConfig = {
text: initialCode,
compilerOptions: {},
domID: "monaco-editor-embed",
}
const sandbox = sandboxFactory.createTypeScriptSandbox(sandboxConfig, main, window.ts)
sandbox.editor.focus()
})
}
document.body.appendChild(getLoaderScript)
</script>
</html>
FAQs
The TypeScript Sandbox is the editor part of the TypeScript Playground. It's effectively an opinionated fork of monaco-typescript with extra extension points so that projects like the TypeScript Playground can exist.
The npm package @typescript/sandbox receives a total of 833 weekly downloads. As such, @typescript/sandbox popularity was classified as not popular.
We found that @typescript/sandbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.