ether-code 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/ether.js CHANGED
@@ -6,7 +6,7 @@ const http = require('http')
6
6
  const { EtherCompiler } = require('./compiler')
7
7
  const { Watcher } = require('./watcher')
8
8
 
9
- const VERSION = '0.7.2'
9
+ const VERSION = '0.7.3'
10
10
 
11
11
  const COLORS = {
12
12
  reset: '\x1b[0m',
@@ -1704,11 +1704,30 @@ class JSGenerator {
1704
1704
  return `${object}[${property}]`
1705
1705
  }
1706
1706
 
1707
- const translatedProperty = this.translateMethod(property)
1707
+ const knownObjects = [
1708
+ 'console', 'document', 'window', 'math', 'json', 'object', 'array',
1709
+ 'string', 'number', 'date', 'regexp', 'promise', 'set', 'map',
1710
+ 'weakset', 'weakmap', 'symbol', 'reflect', 'proxy', 'intl',
1711
+ 'atomics', 'sharedarraybuffer', 'arraybuffer', 'dataview',
1712
+ 'uint8array', 'int8array', 'uint16array', 'int16array',
1713
+ 'uint32array', 'int32array', 'float32array', 'float64array',
1714
+ 'bigint64array', 'biguint64array', 'error', 'typeerror',
1715
+ 'syntaxerror', 'referenceerror', 'rangeerror', 'urierror',
1716
+ 'localstorage', 'sessionstorage', 'navigator', 'location',
1717
+ 'history', 'screen', 'performance', 'fetch', 'request', 'response',
1718
+ 'headers', 'url', 'urlsearchparams', 'formdata', 'blob', 'file',
1719
+ 'filereader', 'xmlhttprequest', 'websocket', 'worker',
1720
+ 'serviceworker', 'notification', 'geolocation'
1721
+ ]
1722
+
1723
+ const objectLower = object.toLowerCase()
1724
+ const shouldTranslate = knownObjects.includes(objectLower)
1725
+
1726
+ const translatedProperty = shouldTranslate ? this.translateMethod(property) : property
1708
1727
 
1709
1728
  if (translatedProperty.includes('.')) {
1710
1729
  const parts = translatedProperty.split('.')
1711
- if (parts[0].toLowerCase() === object.toLowerCase()) {
1730
+ if (parts[0].toLowerCase() === objectLower) {
1712
1731
  return translatedProperty
1713
1732
  }
1714
1733
  return `${object}.${parts.slice(-1)[0]}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ether-code",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Ether - Le langage intentionnel",
5
5
  "main": "cli/compiler.js",
6
6
  "bin": {