Skip to content

Commit

Permalink
Merge pull request #1 from ambit-tsai/dev
Browse files Browse the repository at this point in the history
publish v0.8.2
  • Loading branch information
ambit-tsai authored Jun 21, 2022
2 parents 889c141 + 7573fb1 commit 6d55029
Show file tree
Hide file tree
Showing 142 changed files with 4,340 additions and 9,938 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test/test262"]
path = test/test262
url = https://github.com/tc39/test262.git
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.vscode/
docs/
docs-src/
node_modules/
scripts/
src/
test/
.gitignore
.gitmodules
.prettierignore
.npmrc
.prettierrc.js
chromedriver.exe
geckodriver.exe
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/es-module/helpers.ts
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
tabWidth: 4,
semi: true,
singleQuote: true,
trailingComma: 'es5',
};
48 changes: 48 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": false,
"source.fixAll.stylelint": false
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.detectIndentation": false,
"editor.guides.bracketPairs": true,
"editor.tabSize": 4,
"eslint.enable": false,
"stylelint.enable": false,
"prettier.enable": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},

"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.formatOnSave": false
},
"files.exclude": {
"**/CVS": true,
"**/.DS_Store": true,
"**/.ds": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/.theia": true
}
}
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const realm = new ShadowRealm();

### Po**l**yfill: patch up the global object
```javascript
import 'shadowrealm-api/browser/polyfill.mjs'
import 'shadowrealm-api/dist/polyfill.mjs'

const realm = new ShadowRealm();
```
Expand Down Expand Up @@ -66,31 +66,22 @@ export { obj, fn };
## Compatibility
|IE|Edge|Firefox|Chrome|Safari|Opera|
|:-:|:-:|:-:|:-:|:-:|:-:|
|10<sup>[1][2][3]</sup>|12<sup>[1][2][3]</sup>|4<sup>[1][2][3][4]</sup>|13<sup>[1][2][3][4]</sup>|6<sup>[1][2][3]</sup>|12.1<sup>[1][2][3][4]</sup>|
||14|19<sup>[1][2][3]</sup>|19<sup>[1][2][3]</sup>|8<sup>[3]</sup>|15<sup>[1][2][3]</sup>|
|||29<sup>[1][3]</sup>|32<sup>[1][3]</sup>|10.1|19<sup>[1][3]</sup>|
|||41|49||36|
||14|29<sup>[1][2]</sup>|32<sup>[1][2]</sup>|8<sup>[2][3]</sup>|19<sup>[1][2]</sup>|
|||41|49|10.1<sup>[3]</sup>|36|
|||||14.1||

> Notes:
> 1. Don't support destructuring assignment in ESM statement;
> 1. Need `Promise` polyfill in ShadowRealm;
> 1. Need `fetch` polyfill in top window;
> 1. Need `URL` polyfill in top window;
Use `fetch` or `URL` polyfill:
Use polyfills:
```js
import "fetch polyfill";
import "URL polyfill";
import "shadowrealm-api/browser/polyfill.mjs";
import "shadowrealm-api/dist/polyfill.mjs";
// Your codes
```
Use `Promise` polyfill:
```js
ShadowRealm.__shims = [
'path/to/promise-polyfill.js',
'other polyfills',
];
```


## Contact
Expand Down
23 changes: 7 additions & 16 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const realm = new ShadowRealm();

### Po**l**yfill: 修补全局对象
```javascript
import 'shadowrealm-api/browser/polyfill.mjs'
import 'shadowrealm-api/dist/polyfill.mjs'

const realm = new ShadowRealm();
```
Expand Down Expand Up @@ -67,30 +67,21 @@ export { obj, fn };
## 兼容性
|IE|Edge|Firefox|Chrome|Safari|Opera|
|:-:|:-:|:-:|:-:|:-:|:-:|
|10<sup>[1][2][3]</sup>|12<sup>[1][2][3]</sup>|4<sup>[1][2][3][4]</sup>|13<sup>[1][2][3][4]</sup>|6<sup>[1][2][3]</sup>|12.1<sup>[1][2][3][4]</sup>|
||14|19<sup>[1][2][3]</sup>|19<sup>[1][2][3]</sup>|8<sup>[3]</sup>|15<sup>[1][2][3]</sup>|
|||29<sup>[1][3]</sup>|32<sup>[1][3]</sup>|10.1|19<sup>[1][3]</sup>|
|||41|49||36|
||14|29<sup>[1][2]</sup>|32<sup>[1][2]</sup>|8<sup>[2][3]</sup>|19<sup>[1][2]</sup>|
|||41|49|10.1<sup>[3]</sup>|36|
|||||14.1||

> Notes:
> 1. ESM 语句不支持解构赋值;
> 1. ShadowRealm 中需要`Promise`垫片;
> 1. 顶层作用域需要`fetch`垫片;
> 1. 顶层作用域需要`URL`垫片;
使用 fetch 或 URL 垫片:
使用垫片:
```js
import "fetch polyfill";
import "URL polyfill";
import "shadowrealm-api/browser/polyfill.mjs";
// Your codes
```
使用 Promise 垫片:
```js
ShadowRealm.__shims = [
'path/to/promise-polyfill.js',
'other polyfills',
];
import "shadowrealm-api/dist/polyfill.mjs";
// 你的代码
```


Expand Down
2 changes: 1 addition & 1 deletion docs-src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './index.css';
import '../src/browser/polyfill'
import '../src/polyfill';

const code = `
class ShadowRealm {
Expand Down
9 changes: 0 additions & 9 deletions docs/assets/index.460bfdf1.js

This file was deleted.

Loading

0 comments on commit 6d55029

Please sign in to comment.