Skip to content

Commit 3c87349

Browse files
committed
Revert "Fix #92"
This reverts commit 38ae98a.
1 parent a024a62 commit 3c87349

File tree

4 files changed

+83
-149
lines changed

4 files changed

+83
-149
lines changed

dist/yopta.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 72 additions & 143 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yopta",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "YoptaScript - язык программирования для гопников и реальных пацанов.",
55
"main": "dist/yopta.js",
66
"types": "dist/index.d.ts",
@@ -29,6 +29,7 @@
2929
},
3030
"homepage": "https://yopta.space/",
3131
"devDependencies": {
32+
"@types/globalthis": "^1.0.1",
3233
"@types/jest": "^26.0.23",
3334
"@types/node": "^15.12.1",
3435
"@typescript-eslint/eslint-plugin": "^4.27.0",
@@ -44,5 +45,8 @@
4445
},
4546
"files": [
4647
"dist/**/*"
47-
]
48+
],
49+
"dependencies": {
50+
"globalthis": "^1.0.2"
51+
}
4852
}

src/core.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import polyfill from 'globalthis';
12
import dictionary from './dictionary/sortedYopta.json';
23

34
function escapeRegExp(str: string) {
@@ -70,5 +71,5 @@ export function compile(text: string, lang: 'js' | 'ys' = 'ys'): string {
7071

7172
// YoptaScript to globals
7273
// eslint-disable-next-line @typescript-eslint/no-explicit-any
73-
const _global = (typeof window !== 'undefined' ? window : global) as any;
74-
_global.yopta = compile;
74+
const globalThis = polyfill() as any;
75+
globalThis.yopta = compile;

0 commit comments

Comments
 (0)