From 7e983b3b77e2bd3742ebf3cc461da997cc60e9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9opold=20Hubert?= Date: Wed, 28 May 2025 11:27:07 +0200 Subject: [PATCH 1/2] Fix typo in original README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 353bf9b..4abd4c6 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ console.log(scopeB); // {b: 2} console.log(scopeC); // {c: 3, d: 5, b: 6} ``` -You can set your own whilelisted prototypes and global properties like so (`alert` and `Node` are added to whitelist in the following code): +You can set your own whitelisted prototypes and global properties like so (`alert` and `Node` are added to whitelist in the following code): ```javascript const prototypeWhitelist = Sandbox.SAFE_PROTOTYPES; From 43588fa23d698f4afbf0985363442d0b951f11f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9opold=20Hubert?= Date: Wed, 28 May 2025 11:35:37 +0200 Subject: [PATCH 2/2] Add UMD build and documentation --- README.md | 11 +++++++++++ rollup.config.mjs | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/README.md b/README.md index 4abd4c6..4b3c326 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,17 @@ Since parsing and executing are separated, execution with SandboxJS can be somet npm install @nyariv/sandboxjs ``` +UMD build: + +```javascript + + +``` + ## Usage The following is the bare minimum of code for using SandboxJS. This assumes safe whilelisted defaults. diff --git a/rollup.config.mjs b/rollup.config.mjs index e42064e..1771350 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -60,4 +60,25 @@ export default [ filesize() ] }, + { + input: 'src/Sandbox.ts', + output: { + file: 'dist/Sandbox.umd.min.js', + format: 'umd', + name: 'SandboxJS', + sourcemap: true, + }, + plugins: [ + typescript({ + declaration: true, + declarationDir: './', + }), + resolve({ extensions }), + terser({ + keep_fnames: /SandboxFunction/, + maxWorkers: 4, + }), + filesize(), + ], + }, ]