@mojir/lits 2.6.2 → 2.6.4
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/cli/cli.js +8 -10
- package/dist/cli/src/evaluator/ContextStack.d.ts +1 -1
- package/dist/cli/src/parser/types.d.ts +0 -2
- package/dist/full.esm.js +1 -1
- package/dist/full.esm.js.map +1 -1
- package/dist/full.js +1 -1
- package/dist/full.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +1 -1
- package/dist/lits.iife.js.map +1 -1
- package/dist/modules/src/evaluator/ContextStack.d.ts +1 -1
- package/dist/modules/src/parser/types.d.ts +0 -2
- package/dist/src/evaluator/ContextStack.d.ts +1 -1
- package/dist/src/parser/types.d.ts +0 -2
- package/dist/testFramework.esm.js +1 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ var readline = require('node:readline');
|
|
|
7
7
|
var os = require('node:os');
|
|
8
8
|
var process$1 = require('node:process');
|
|
9
9
|
|
|
10
|
-
var version = "2.6.
|
|
10
|
+
var version = "2.6.4";
|
|
11
11
|
|
|
12
12
|
function getCodeMarker(sourceCodeInfo) {
|
|
13
13
|
if (!sourceCodeInfo.position || !sourceCodeInfo.code)
|
|
@@ -5503,9 +5503,6 @@ const condSpecialExpression = {
|
|
|
5503
5503
|
getUndefinedSymbols: (node, contextStack, { getUndefinedSymbols, builtin, evaluateNode }) => getUndefinedSymbols(node[1][1].flat(), contextStack, builtin, evaluateNode),
|
|
5504
5504
|
};
|
|
5505
5505
|
|
|
5506
|
-
function isJsFunction(fn) {
|
|
5507
|
-
return typeof fn === 'object' && fn !== null && 'fn' in fn && typeof fn.fn === 'function';
|
|
5508
|
-
}
|
|
5509
5506
|
const bindingTargetTypes = {
|
|
5510
5507
|
symbol: 11,
|
|
5511
5508
|
rest: 12,
|
|
@@ -7545,9 +7542,8 @@ function createContextStack(params = {}, modules, pure) {
|
|
|
7545
7542
|
throw new LitsError(`Dots are not allowed in binding keys: "${identifier}"`, undefined);
|
|
7546
7543
|
}
|
|
7547
7544
|
const isFunction = typeof entry === 'function';
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
const jsFunction = isJsFunctionObject ? entry : { fn: entry };
|
|
7545
|
+
if (isFunction) {
|
|
7546
|
+
const jsFunction = { fn: entry };
|
|
7551
7547
|
assertNotShadowingBuiltin(identifier);
|
|
7552
7548
|
if (!nativeJsFunctions) {
|
|
7553
7549
|
nativeJsFunctions = {};
|
|
@@ -9759,9 +9755,11 @@ class Lits {
|
|
|
9759
9755
|
const ast = this.generateAst(source, params);
|
|
9760
9756
|
const moduleContextStack = contextStack.create({});
|
|
9761
9757
|
const result = evaluate(ast, moduleContextStack);
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9758
|
+
// TODO: When async functions in file modules are able to mark themselves as pure and
|
|
9759
|
+
// are returning a Promise, uncomment the following check, and make sure a test is verifying the behaviour.
|
|
9760
|
+
// if (result instanceof Promise) {
|
|
9761
|
+
// throw new TypeError('Unexpected async result in synchronous runBundle(). Use lits.async.run() for async operations.')
|
|
9762
|
+
// }
|
|
9765
9763
|
contextStack.registerValueModule(name, result);
|
|
9766
9764
|
}
|
|
9767
9765
|
contextStack.pure = savedPure;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Any } from '../interface';
|
|
2
2
|
import type { ContextParams } from '../Lits/Lits';
|
|
3
3
|
import type { LitsModule } from '../builtin/modules/interface';
|
|
4
|
-
import {
|
|
4
|
+
import type { NativeJsFunction, SymbolNode, UserDefinedSymbolNode } from '../parser/types';
|
|
5
5
|
import type { SourceCodeInfo } from '../tokenizer/token';
|
|
6
6
|
import type { Context, LookUpResult } from './interface';
|
|
7
7
|
export type ContextStack = ContextStackImpl;
|
|
@@ -27,8 +27,6 @@ export interface NativeJsFunction extends GenericLitsFunction {
|
|
|
27
27
|
nativeFn: JsFunction;
|
|
28
28
|
docString: string;
|
|
29
29
|
}
|
|
30
|
-
export declare function isJsFunction(fn: unknown): fn is JsFunction;
|
|
31
|
-
export declare function assertJsFunction(fn: unknown): asserts fn is JsFunction;
|
|
32
30
|
export interface UserDefinedFunction extends GenericLitsFunction {
|
|
33
31
|
functionType: 'UserDefined';
|
|
34
32
|
name: string | undefined;
|