Skip to content

Commit bec8a2f

Browse files
committed
stdをエクスポート
1 parent e25e35b commit bec8a2f

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

etc/aiscript.api.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ type Index = NodeBase & {
416416

417417
// @public (undocumented)
418418
export class Interpreter {
419-
constructor(consts: Record<string, Value>, opts?: {
419+
constructor(globals: Record<string, Value>, opts?: {
420420
in?(q: string): Promise<string>;
421421
out?(value: Value): void;
422422
err?(e: AiScriptError): void;
@@ -713,6 +713,9 @@ export class Scope {
713713
// @public (undocumented)
714714
type Statement = Definition | Return | Each | For | Loop | Break | Continue | Assign | AddAssign | SubAssign;
715715

716+
// @public (undocumented)
717+
export const std: Record<string, Value>;
718+
716719
// @public (undocumented)
717720
const STR: (str: VStr["value"]) => VStr;
718721

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//export * from './interpreter/index';
33
//export * as utils from './interpreter/util';
44
//export * as values from './interpreter/value';
5-
import { Interpreter } from './interpreter/index.js';
5+
import { Interpreter, std } from './interpreter/index.js';
66
import { Scope } from './interpreter/scope.js';
77
import * as utils from './interpreter/util.js';
88
import * as values from './interpreter/value.js';
@@ -12,7 +12,7 @@ import * as errors from './error.js';
1212
import * as Ast from './node.js';
1313
import { AISCRIPT_VERSION } from './constants.js';
1414
import type { ParserPlugin, PluginType } from './parser/index.js';
15-
export { Interpreter };
15+
export { Interpreter, std };
1616
export { Scope };
1717
export { utils };
1818
export { values };

src/interpreter/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { Reference } from './reference.js';
1616
import type { JsValue } from './util.js';
1717
import type { Value, VFn, VUserFn } from './value.js';
1818

19+
export { std } from './lib/std.js';
20+
1921
export type LogObject = {
2022
scope?: string;
2123
var?: string;

test/interpreter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import * as assert from 'assert';
22
import { describe, expect, test, vi, beforeEach, afterEach } from 'vitest';
3-
import { Parser, Interpreter, values, errors, utils, Ast } from '../src';
3+
import { Parser, Interpreter, std, values, errors, utils, Ast } from '../src';
44
import { FALSE, NUM, OBJ, STR, TRUE, Value } from '../src/interpreter/value';
5-
import { std } from '../src/interpreter/lib/std';
65

76
let { FN_NATIVE } = values;
87
let { AiScriptRuntimeError, AiScriptIndexOutOfRangeError, AiScriptHostsideError } = errors;

test/testutils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { expect as globalExpect } from 'vitest';
2-
import { Parser, Interpreter } from '../src';
2+
import { Parser, Interpreter, std } from '../src';
33
import { Value } from '../src/interpreter/value';
4-
import { std } from '../src/interpreter/lib/std';
54

65
export async function exe(script: string): Promise<Value | undefined> {
76
const parser = new Parser();

0 commit comments

Comments
 (0)