@mojir/lits 1.2.2-alpha.6 → 1.3.0

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.
Files changed (53) hide show
  1. package/dist/cli/cli.js +541 -1125
  2. package/dist/cli/src/Lits/Lits.d.ts +1 -6
  3. package/dist/cli/src/index.d.ts +3 -8
  4. package/dist/cli/src/tokenizer/tokenizers.d.ts +1 -0
  5. package/dist/index.esm.js +18 -7442
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +17 -7452
  8. package/dist/index.js.map +1 -1
  9. package/dist/lits.iife.js +17 -7452
  10. package/dist/lits.iife.js.map +1 -1
  11. package/dist/src/Lits/Lits.d.ts +1 -6
  12. package/dist/src/index.d.ts +3 -8
  13. package/dist/src/tokenizer/tokenizers.d.ts +1 -0
  14. package/dist/testFramework.esm.js +3 -586
  15. package/dist/testFramework.esm.js.map +1 -1
  16. package/dist/testFramework.js +3 -586
  17. package/dist/testFramework.js.map +1 -1
  18. package/package.json +1 -1
  19. package/dist/cli/src/identifier.d.ts +0 -8
  20. package/dist/cli/src/transformer/index.d.ts +0 -2
  21. package/dist/cli/src/unparser/UnparseOptions.d.ts +0 -15
  22. package/dist/cli/src/unparser/unparse.d.ts +0 -5
  23. package/dist/cli/src/unparser/unparseArrayLiteral.d.ts +0 -3
  24. package/dist/cli/src/unparser/unparseBindings.d.ts +0 -3
  25. package/dist/cli/src/unparser/unparseNormalExpression.d.ts +0 -3
  26. package/dist/cli/src/unparser/unparseObjectLiteral.d.ts +0 -3
  27. package/dist/cli/src/unparser/unparseParams.d.ts +0 -17
  28. package/dist/cli/src/unparser/unparseSpecialExpression/index.d.ts +0 -3
  29. package/dist/cli/src/unparser/unparseSpecialExpression/unparseCond.d.ts +0 -3
  30. package/dist/cli/src/unparser/unparseSpecialExpression/unparseDo.d.ts +0 -3
  31. package/dist/cli/src/unparser/unparseSpecialExpression/unparseIfLet.d.ts +0 -3
  32. package/dist/cli/src/unparser/unparseSpecialExpression/unparseIfOrWhenLike.d.ts +0 -6
  33. package/dist/cli/src/unparser/unparseSpecialExpression/unparseLet.d.ts +0 -3
  34. package/dist/cli/src/unparser/utils.d.ts +0 -5
  35. package/dist/cli/src/untokenizer/index.d.ts +0 -2
  36. package/dist/src/identifier.d.ts +0 -8
  37. package/dist/src/transformer/index.d.ts +0 -2
  38. package/dist/src/unparser/UnparseOptions.d.ts +0 -15
  39. package/dist/src/unparser/__tests__/testFormatter.d.ts +0 -1
  40. package/dist/src/unparser/unparse.d.ts +0 -5
  41. package/dist/src/unparser/unparseArrayLiteral.d.ts +0 -3
  42. package/dist/src/unparser/unparseBindings.d.ts +0 -3
  43. package/dist/src/unparser/unparseNormalExpression.d.ts +0 -3
  44. package/dist/src/unparser/unparseObjectLiteral.d.ts +0 -3
  45. package/dist/src/unparser/unparseParams.d.ts +0 -17
  46. package/dist/src/unparser/unparseSpecialExpression/index.d.ts +0 -3
  47. package/dist/src/unparser/unparseSpecialExpression/unparseCond.d.ts +0 -3
  48. package/dist/src/unparser/unparseSpecialExpression/unparseDo.d.ts +0 -3
  49. package/dist/src/unparser/unparseSpecialExpression/unparseIfLet.d.ts +0 -3
  50. package/dist/src/unparser/unparseSpecialExpression/unparseIfOrWhenLike.d.ts +0 -6
  51. package/dist/src/unparser/unparseSpecialExpression/unparseLet.d.ts +0 -3
  52. package/dist/src/unparser/utils.d.ts +0 -5
  53. package/dist/src/untokenizer/index.d.ts +0 -2
@@ -15,6 +15,7 @@ export interface LazyValue {
15
15
  }
16
16
  export interface JsFunction {
17
17
  fn: (...args: any[]) => unknown;
18
+ [key: string]: unknown;
18
19
  }
19
20
  export interface LitsParams {
20
21
  globalContext?: Context;
@@ -30,9 +31,6 @@ interface LitsConfig {
30
31
  astCacheSize?: number | null;
31
32
  debug?: boolean;
32
33
  }
33
- type FormatParams = LitsParams & {
34
- lineLength?: number;
35
- };
36
34
  export declare class Lits {
37
35
  private astCache;
38
36
  private astCacheSize;
@@ -40,14 +38,11 @@ export declare class Lits {
40
38
  constructor(config?: LitsConfig);
41
39
  getRuntimeInfo(): LitsRuntimeInfo;
42
40
  run(program: string, params?: LitsParams): unknown;
43
- format(program: string, params?: FormatParams): string;
44
41
  context(program: string, params?: LitsParams): Context;
45
42
  analyze(program: string, params?: LitsParams): Analysis;
46
43
  tokenize(program: string, tokenizeParams?: TokenizeParams): TokenStream;
47
44
  parse(tokenStream: TokenStream): Ast;
48
45
  evaluate(ast: Ast, params: LitsParams): Any;
49
- transform(tokenStream: TokenStream, transformer: (name: string) => string): TokenStream;
50
- untokenize(tokenStream: TokenStream): string;
51
46
  apply(fn: LitsFunction, fnParams: unknown[], params?: LitsParams): Any;
52
47
  private generateAst;
53
48
  }
@@ -1,17 +1,12 @@
1
1
  export { AstNodeType, TokenType, FunctionType } from './constants/constants';
2
2
  export { isBuiltinFunction, isLitsFunction, asLitsFunction, assertLitsFunction, isUserDefinedFunction, asUserDefinedFunction, assertUserDefinedFunction, isNativeJsFunction, asNativeJsFunction, assertNativeJsFunction, } from './typeGuards/litsFunction';
3
- export { type LitsFunction, type NativeJsFunction, type ExtraData } from './parser/interface';
3
+ export type { LitsFunction, NativeJsFunction, ExtraData, Ast } from './parser/interface';
4
4
  export type { Context } from './evaluator/interface';
5
- export type { Ast } from './parser/interface';
6
5
  export type { Token, SourceCodeInfo } from './tokenizer/interface';
6
+ export type { UnresolvedIdentifier } from './analyze';
7
7
  export { normalExpressionKeys, specialExpressionKeys } from './builtin';
8
8
  export { reservedNames } from './reservedNames';
9
9
  export { Lits } from './Lits/Lits';
10
10
  export { type LitsError, isLitsError } from './errors';
11
- export type { LitsParams, LitsRuntimeInfo, LazyValue, JsFunction } from './Lits/Lits';
11
+ export type { LitsParams, LitsRuntimeInfo, LazyValue } from './Lits/Lits';
12
12
  export { createNativeJsFunction } from './utils';
13
- export { apiReference, isDatatypeReference, isFunctionReference, isNormalExpressionArgument, isShorthandReference, isSpecialExpressionArgument, isTypedValue } from '../reference';
14
- export type { Argument, CommonReference, DatatypeReference, FunctionReference, Reference, ShorthandReference } from '../reference';
15
- export type { ApiName, FunctionName, ShorthandName, DatatypeName } from '../reference/api';
16
- export { isApiName, isDataType } from '../reference/api';
17
- export { type Identifier, assertIdentifier, isIdentifier } from './identifier';
@@ -1,4 +1,5 @@
1
1
  import type { Tokenizer } from './interface';
2
+ export declare const nameCharacters = "[\\w@%^?=!$<>+*/-]";
2
3
  export declare const tokenizeNewLine: Tokenizer;
3
4
  export declare const tokenizeComment: Tokenizer;
4
5
  export declare const skipWhiteSpace: Tokenizer;