jz 0.1.1 → 0.2.1

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/src/autoload.js CHANGED
@@ -14,7 +14,7 @@ export const PROP_MODULES = Object.assign(Object.create(null), {
14
14
  every: ['core', 'array'], some: ['core', 'array'], flat: ['core', 'array'], flatMap: ['core', 'array'],
15
15
  join: ['core', 'array'], copyWithin: ['core', 'array'], at: ['core', 'array'],
16
16
  charAt: ['core', 'string'], charCodeAt: ['core', 'string'], codePointAt: ['core', 'string'],
17
- toUpperCase: ['core', 'string'], toLowerCase: ['core', 'string'], trim: ['core', 'string'],
17
+ toUpperCase: ['core', 'string'], toLowerCase: ['core', 'string'], toLocaleLowerCase: ['core', 'string'], trim: ['core', 'string'],
18
18
  trimStart: ['core', 'string'], trimEnd: ['core', 'string'],
19
19
  split: ['core', 'string'], replace: ['core', 'string'], replaceAll: ['core', 'string'],
20
20
  repeat: ['core', 'string'], startsWith: ['core', 'string'], endsWith: ['core', 'string'],
@@ -61,10 +61,15 @@ export const CALL_MODULES = dict({
61
61
  'console.warn': ['core', 'string', 'number', 'console'],
62
62
  'console.error': ['core', 'string', 'number', 'console'],
63
63
  'Object.fromEntries': ['collection', 'string'],
64
- 'Object.keys': ['string'],
65
- 'Object.entries': ['string'],
64
+ 'Object.keys': ['core', 'object', 'string'],
65
+ 'Object.values': ['core', 'object', 'string'],
66
+ 'Object.entries': ['core', 'object', 'string'],
67
+ 'Object.assign': ['core', 'object'],
68
+ 'Object.create': ['core', 'object'],
69
+ 'Date.UTC': ['core', 'date'],
66
70
  'Date.now': ['core', 'console'],
67
71
  'performance.now': ['core', 'console'],
72
+ 'readStdin': ['core', 'console'],
68
73
  'String.fromCharCode': ['core', 'string'],
69
74
  'String.fromCodePoint': ['core', 'string'],
70
75
  'BigInt.asIntN': ['number'],
@@ -85,14 +90,15 @@ export const GENERIC_METHOD_MODULES = dict({
85
90
  toFixed: ['core', 'string', 'number'],
86
91
  toPrecision: ['core', 'string', 'number'],
87
92
  toExponential: ['core', 'string', 'number'],
93
+ hasOwnProperty: ['core', 'object', 'string', 'collection'],
88
94
  })
89
95
 
90
- export const CTORS = ['Float64Array','Float32Array','Int32Array','Uint32Array','Int16Array','Uint16Array','Int8Array','Uint8Array','BigInt64Array','BigUint64Array','Set','Map']
96
+ export const CTORS = ['Float64Array','Float32Array','Int32Array','Uint32Array','Int16Array','Uint16Array','Int8Array','Uint8Array','BigInt64Array','BigUint64Array','Set','Map','Date']
91
97
  export const TYPED_CTORS = ['Float64Array','Float32Array','Int32Array','Uint32Array','Int16Array','Uint16Array','Int8Array','Uint8Array','BigInt64Array','BigUint64Array','ArrayBuffer','DataView']
92
98
  export const COLLECTION_CTORS = ['Set', 'Map']
93
99
  export const TIMER_NAMES = new Set(['setTimeout', 'clearTimeout', 'setInterval', 'clearInterval'])
94
100
 
95
- export const MOD_ALIAS = { Number: 'number', Array: 'array', Object: 'object', Symbol: 'symbol', JSON: 'json', BigInt: 'number', Error: 'core', TextEncoder: 'string', TextDecoder: 'string' }
101
+ export const MOD_ALIAS = { Number: 'number', Array: 'array', Object: 'object', Symbol: 'symbol', JSON: 'json', Date: 'date', BigInt: 'number', Error: 'core', TextEncoder: 'string', TextDecoder: 'string' }
96
102
 
97
103
  const MOD_DEPS = {
98
104
  number: ['core', 'string'],
@@ -102,6 +108,7 @@ const MOD_DEPS = {
102
108
  collection: ['core', 'number'],
103
109
  symbol: ['core'],
104
110
  json: ['core', 'string', 'number', 'collection'],
111
+ date: ['core', 'number', 'string'],
105
112
  console: ['core', 'string', 'number'],
106
113
  regex: ['core', 'string', 'array'],
107
114
  }
@@ -155,12 +162,13 @@ export const includeForProperty = prop => {
155
162
  }
156
163
 
157
164
  export const runtimeCtorKind = name =>
158
- TYPED_CTORS.includes(name) ? 'typedarray' : COLLECTION_CTORS.includes(name) ? 'collection' : null
165
+ TYPED_CTORS.includes(name) ? 'typedarray' : COLLECTION_CTORS.includes(name) ? 'collection' : name === 'Date' ? 'date' : null
159
166
 
160
167
  export const includeForRuntimeCtor = name => {
161
168
  const kind = runtimeCtorKind(name)
162
169
  if (kind === 'typedarray') includeMods('core', 'typedarray')
163
170
  else if (kind === 'collection') includeMods('core', 'collection')
171
+ else if (kind === 'date') includeMods('core', 'console', 'date')
164
172
  return kind
165
173
  }
166
174
 
@@ -172,4 +180,4 @@ export function includeModule(name) {
172
180
  ctx.module.modules[modName] = true
173
181
  for (const dep of MOD_DEPS[modName] || []) includeModule(dep)
174
182
  init(ctx)
175
- }
183
+ }