All Projects → ambit-tsai → shadowrealm-api

ambit-tsai / shadowrealm-api

Licence: Apache-2.0 license
🗳️ A implementation of the ShadowRealm API Proposal, a JavaScript sandbox, test with TC39 Test262 cases.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to shadowrealm-api

aaf-easyphotomap
📷 Easy Photo Map is a photomap application that displays the location of the photo on the map using the location information included in the photo.
Stars: ✭ 36 (-18.18%)
Mutual labels:  realm
ops-examples
A repository of basic and advanced examples using Ops
Stars: ✭ 68 (+54.55%)
Mutual labels:  sandbox
Linux-Active-Directory-join-script
Active directory Join script for Ubuntu, Debian, CentOS, Linux Mint, Fedora, Kali, Elementary OS and Raspbian with built in failchcheck and debugmode for Ubuntu. "The most advanced and updated AD join script on GITHUB for Linux"
Stars: ✭ 97 (+120.45%)
Mutual labels:  realm
RealmSearchView
SearchView with result list powered by Realm
Stars: ✭ 23 (-47.73%)
Mutual labels:  realm
erxes-android-sdk
erxes Android SDK, for integrating erxes into your android application
Stars: ✭ 23 (-47.73%)
Mutual labels:  realm
Realm-and-Swift-Codable
How to implement Swift 4 Codable with Realm Database
Stars: ✭ 34 (-22.73%)
Mutual labels:  realm
realm-mapper-ios
Realm + ObjectMapper
Stars: ✭ 28 (-36.36%)
Mutual labels:  realm
firejailed-tor-browser
HOWTO: Firejailed Tor Browser
Stars: ✭ 18 (-59.09%)
Mutual labels:  sandbox
MultiAV2
MultiAV scanner with Python and JSON REST API using Malice Docker AV Containers and Docker-Machine based Autoscaling
Stars: ✭ 30 (-31.82%)
Mutual labels:  sandbox
o-fish-realm
Realm application code and sample data for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection. The web app allows agencies to gain insights from the aggregated information.
Stars: ✭ 23 (-47.73%)
Mutual labels:  realm
UseCases
This a library that offers a generic implementation of the data layers from the clean architecture by Uncle bob.
Stars: ✭ 23 (-47.73%)
Mutual labels:  realm
sandboxed-fs
Sandboxed Wrapper for Node.js File System API
Stars: ✭ 41 (-6.82%)
Mutual labels:  sandbox
Warri0r
ios 12 Sandbox escape POC
Stars: ✭ 32 (-27.27%)
Mutual labels:  sandbox
Conty
Easy to use unprivileged Linux container packed into a single portable executable
Stars: ✭ 198 (+350%)
Mutual labels:  sandbox
Bold-Falcon
毕方智能云沙箱(Bold-Falcon)是一个开源的自动化恶意软件分析系统;方班网络安全综合实验-设计类;
Stars: ✭ 30 (-31.82%)
Mutual labels:  sandbox
NewsReader
Android News Reader app. Kotlin Coroutines, Retrofit and Realm
Stars: ✭ 21 (-52.27%)
Mutual labels:  realm
realm-dart-samples
Samples for Realm Flutter and Realm Dart SDKs
Stars: ✭ 26 (-40.91%)
Mutual labels:  realm
Voxel
Sandbox survival game created with Light Engine (Development halted due to other projects)
Stars: ✭ 18 (-59.09%)
Mutual labels:  sandbox
SandboxBrowser
A simple iOS sandbox file browser, you can share files through AirDrop
Stars: ✭ 84 (+90.91%)
Mutual labels:  sandbox
mobile-realm
mobile-realm
Stars: ✭ 21 (-52.27%)
Mutual labels:  realm

ShadowRealm API Polyfill

A implementation of the ShadowRealm API Proposal, a JavaScript sandbox, test with TC39 Test262 cases.

简体中文 | English

declare class ShadowRealm {
    constructor();
    evaluate(sourceText: string): Primitive | Function;
    importValue(specifier: string, bindingName: string): Promise<Primitive | Function>;
}

Try it now 🎉

Install

npm i -S shadowrealm-api

Usage

Ponyfill: non-invasive

import ShadowRealm from 'shadowrealm-api'

const realm = new ShadowRealm();

Polyfill: patch up the global object

import 'shadowrealm-api/browser/polyfill.mjs'

const realm = new ShadowRealm();

Debugging

Print internal info for debugging

ShadowRealm.__debug = true;

Limitations

  1. All code evaluated inside a ShadowRealm runs in strict mode;
  2. The ESM statement must not contain redundant comments;
// ❌
import/* */defaultExport from "module-name";
export default/* */'xxx';

// ✅
import defaultExport from "module-name";
export default 'xxx';
  1. Exporting variable declarations is not supported;
// ❌
export const obj = {...}, fn = () => {...};

// ✅
const obj = {...}, fn = () => {...};
export { obj, fn };

Compatibility

IE Edge Firefox Chrome Safari Opera
10[1][2][3] 12[1][2][3] 4[1][2][3][4] 13[1][2][3][4] 6[1][2][3] 12.1[1][2][3][4]
14 19[1][2][3] 19[1][2][3] 8[3] 15[1][2][3]
29[1][3] 32[1][3] 10.1 19[1][3]
41 49 36

Notes:

  1. Don't support destructuring assignment in ESM statement;
  2. Need Promise polyfill in ShadowRealm;
  3. Need fetch polyfill in top window;
  4. Need URL polyfill in top window;

Use fetch or URL polyfill:

import "fetch polyfill";
import "URL polyfill";
import "shadowrealm-api/browser/polyfill.mjs";
// Your codes

Use Promise polyfill:

ShadowRealm.__shims = [
    'path/to/promise-polyfill.js',
    'other polyfills',
];

Contact

  1. WeChat: cai_fanwei
  2. QQ Group: 663286147
  3. E-mail: [email protected]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].