jslike 1.4.4 → 1.4.5

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/dist/esm/index.js CHANGED
@@ -38,7 +38,8 @@ export function parse(code, options = {}) {
38
38
  ecmaVersion: 2022, // Support ES2022 features (including top-level await)
39
39
  sourceType: sourceType,
40
40
  locations: true, // Track source locations for better error messages
41
- allowReturnOutsideFunction: true // Allow top-level return statements
41
+ allowReturnOutsideFunction: true, // Allow top-level return statements
42
+ allowAwaitOutsideFunction: true // Allow top-level await
42
43
  });
43
44
  } catch (error) {
44
45
  // Reformat error message for consistency
@@ -2137,6 +2137,14 @@ export class Interpreter {
2137
2137
  if (Array.isArray(arg)) {
2138
2138
  return { __spread: true, __values: arg };
2139
2139
  }
2140
+ // Strings are iterable - spread into characters
2141
+ if (typeof arg === 'string') {
2142
+ return { __spread: true, __values: [...arg] };
2143
+ }
2144
+ // Handle other iterables (like Set, Map, etc.)
2145
+ if (arg !== null && arg !== undefined && typeof arg[Symbol.iterator] === 'function') {
2146
+ return { __spread: true, __values: [...arg] };
2147
+ }
2140
2148
  if (typeof arg === 'object' && arg !== null) {
2141
2149
  return { __spread: true, __values: Object.entries(arg) };
2142
2150
  }
package/dist/index.cjs CHANGED
@@ -7431,6 +7431,12 @@ var Interpreter = class _Interpreter {
7431
7431
  if (Array.isArray(arg)) {
7432
7432
  return { __spread: true, __values: arg };
7433
7433
  }
7434
+ if (typeof arg === "string") {
7435
+ return { __spread: true, __values: [...arg] };
7436
+ }
7437
+ if (arg !== null && arg !== void 0 && typeof arg[Symbol.iterator] === "function") {
7438
+ return { __spread: true, __values: [...arg] };
7439
+ }
7434
7440
  if (typeof arg === "object" && arg !== null) {
7435
7441
  return { __spread: true, __values: Object.entries(arg) };
7436
7442
  }
@@ -8022,8 +8028,10 @@ function parse4(code, options = {}) {
8022
8028
  sourceType,
8023
8029
  locations: true,
8024
8030
  // Track source locations for better error messages
8025
- allowReturnOutsideFunction: true
8031
+ allowReturnOutsideFunction: true,
8026
8032
  // Allow top-level return statements
8033
+ allowAwaitOutsideFunction: true
8034
+ // Allow top-level await
8027
8035
  });
8028
8036
  } catch (error) {
8029
8037
  throw new SyntaxError(
package/dist/index.d.cts CHANGED
@@ -8568,6 +8568,14 @@ class Interpreter {
8568
8568
  if (Array.isArray(arg)) {
8569
8569
  return { __spread: true, __values: arg };
8570
8570
  }
8571
+ // Strings are iterable - spread into characters
8572
+ if (typeof arg === 'string') {
8573
+ return { __spread: true, __values: [...arg] };
8574
+ }
8575
+ // Handle other iterables (like Set, Map, etc.)
8576
+ if (arg !== null && arg !== undefined && typeof arg[Symbol.iterator] === 'function') {
8577
+ return { __spread: true, __values: [...arg] };
8578
+ }
8571
8579
  if (typeof arg === 'object' && arg !== null) {
8572
8580
  return { __spread: true, __values: Object.entries(arg) };
8573
8581
  }
@@ -9355,7 +9363,8 @@ function parse(code, options = {}) {
9355
9363
  ecmaVersion: 2022, // Support ES2022 features (including top-level await)
9356
9364
  sourceType: sourceType,
9357
9365
  locations: true, // Track source locations for better error messages
9358
- allowReturnOutsideFunction: true // Allow top-level return statements
9366
+ allowReturnOutsideFunction: true, // Allow top-level return statements
9367
+ allowAwaitOutsideFunction: true // Allow top-level await
9359
9368
  });
9360
9369
  } catch (error) {
9361
9370
  // Reformat error message for consistency
package/dist/index.d.ts CHANGED
@@ -8568,6 +8568,14 @@ class Interpreter {
8568
8568
  if (Array.isArray(arg)) {
8569
8569
  return { __spread: true, __values: arg };
8570
8570
  }
8571
+ // Strings are iterable - spread into characters
8572
+ if (typeof arg === 'string') {
8573
+ return { __spread: true, __values: [...arg] };
8574
+ }
8575
+ // Handle other iterables (like Set, Map, etc.)
8576
+ if (arg !== null && arg !== undefined && typeof arg[Symbol.iterator] === 'function') {
8577
+ return { __spread: true, __values: [...arg] };
8578
+ }
8571
8579
  if (typeof arg === 'object' && arg !== null) {
8572
8580
  return { __spread: true, __values: Object.entries(arg) };
8573
8581
  }
@@ -9355,7 +9363,8 @@ function parse(code, options = {}) {
9355
9363
  ecmaVersion: 2022, // Support ES2022 features (including top-level await)
9356
9364
  sourceType: sourceType,
9357
9365
  locations: true, // Track source locations for better error messages
9358
- allowReturnOutsideFunction: true // Allow top-level return statements
9366
+ allowReturnOutsideFunction: true, // Allow top-level return statements
9367
+ allowAwaitOutsideFunction: true // Allow top-level await
9359
9368
  });
9360
9369
  } catch (error) {
9361
9370
  // Reformat error message for consistency
package/dist/index.js CHANGED
@@ -7398,6 +7398,12 @@ var Interpreter = class _Interpreter {
7398
7398
  if (Array.isArray(arg)) {
7399
7399
  return { __spread: true, __values: arg };
7400
7400
  }
7401
+ if (typeof arg === "string") {
7402
+ return { __spread: true, __values: [...arg] };
7403
+ }
7404
+ if (arg !== null && arg !== void 0 && typeof arg[Symbol.iterator] === "function") {
7405
+ return { __spread: true, __values: [...arg] };
7406
+ }
7401
7407
  if (typeof arg === "object" && arg !== null) {
7402
7408
  return { __spread: true, __values: Object.entries(arg) };
7403
7409
  }
@@ -7989,8 +7995,10 @@ function parse4(code, options = {}) {
7989
7995
  sourceType,
7990
7996
  locations: true,
7991
7997
  // Track source locations for better error messages
7992
- allowReturnOutsideFunction: true
7998
+ allowReturnOutsideFunction: true,
7993
7999
  // Allow top-level return statements
8000
+ allowAwaitOutsideFunction: true
8001
+ // Allow top-level await
7994
8002
  });
7995
8003
  } catch (error) {
7996
8004
  throw new SyntaxError(
@@ -5658,8 +5658,10 @@ function parse4(code, options = {}) {
5658
5658
  sourceType,
5659
5659
  locations: true,
5660
5660
  // Track source locations for better error messages
5661
- allowReturnOutsideFunction: true
5661
+ allowReturnOutsideFunction: true,
5662
5662
  // Allow top-level return statements
5663
+ allowAwaitOutsideFunction: true
5664
+ // Allow top-level await
5663
5665
  });
5664
5666
  } catch (error) {
5665
5667
  throw new SyntaxError(
@@ -5633,8 +5633,10 @@ function parse4(code, options = {}) {
5633
5633
  sourceType,
5634
5634
  locations: true,
5635
5635
  // Track source locations for better error messages
5636
- allowReturnOutsideFunction: true
5636
+ allowReturnOutsideFunction: true,
5637
5637
  // Allow top-level return statements
5638
+ allowAwaitOutsideFunction: true
5639
+ // Allow top-level await
5638
5640
  });
5639
5641
  } catch (error) {
5640
5642
  throw new SyntaxError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jslike",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Production-ready JavaScript interpreter with full ES6+ support using Acorn parser",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",