diff --git a/package.json b/package.json index 1cdb4978a3..0b13a06861 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "@reduxjs/toolkit": "^1.9.7", "@sentry/react": "^10.5.0", "@sourceacademy/c-slang": "^1.0.21", - "@sourceacademy/conductor": "https://github.com/source-academy/conductor.git#0.2.1", + "@sourceacademy/conductor": "^0.2.3", + "@sourceacademy/js-slang": "^1.0.85", "@sourceacademy/language-directory": "https://github.com/source-academy/language-directory.git#0.0.4", "@sourceacademy/plugin-directory": "https://github.com/source-academy/plugin-directory.git#0.0.2", "@sourceacademy/sharedb-ace": "2.1.1", @@ -66,7 +67,6 @@ "immer": "^9.0.21", "java-slang": "^1.0.13", "js-cookie": "^3.0.5", - "js-slang": "^1.0.85", "js-yaml": "^4.1.0", "konva": "^9.2.0", "lodash": "^4.17.21", diff --git a/src/commons/XMLParser/XMLParserHelper.ts b/src/commons/XMLParser/XMLParserHelper.ts index 7b57f9bdae..f91e410dad 100644 --- a/src/commons/XMLParser/XMLParserHelper.ts +++ b/src/commons/XMLParser/XMLParserHelper.ts @@ -1,4 +1,4 @@ -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { Builder } from 'xml2js'; import { ExternalLibraryName } from '../application/types/ExternalTypes'; diff --git a/src/commons/__tests__/Markdown.test.tsx b/src/commons/__tests__/Markdown.test.tsx index d99f55558b..f59cac1be5 100644 --- a/src/commons/__tests__/Markdown.test.tsx +++ b/src/commons/__tests__/Markdown.test.tsx @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { getLanguageConfig } from '../application/ApplicationTypes'; import Markdown from '../Markdown'; diff --git a/src/commons/application/ApplicationTypes.ts b/src/commons/application/ApplicationTypes.ts index 38d926a0d6..9b93622758 100644 --- a/src/commons/application/ApplicationTypes.ts +++ b/src/commons/application/ApplicationTypes.ts @@ -1,4 +1,4 @@ -import { Chapter, Language, type SourceError, type Value, Variant } from 'js-slang/dist/types'; +import { Chapter, Language, type SourceError, type Value, Variant } from '@sourceacademy/js-slang/dist/types'; import type { AchievementState } from '../../features/achievement/AchievementTypes'; import type { DashboardState } from '../../features/dashboard/DashboardTypes'; @@ -382,7 +382,7 @@ export const defaultEditorValue = '// Type your program in here!'; /** * Create a default IWorkspaceState for 'resetting' a workspace. - * Takes in parameters to set the js-slang library and chapter. + * Takes in parameters to set the @sourceacademy/js-slang library and chapter. * * @param workspaceLocation the location of the workspace, used for context */ diff --git a/src/commons/application/__tests__/ApplicationTypes.test.ts b/src/commons/application/__tests__/ApplicationTypes.test.ts index 05f10785ec..55350cab35 100644 --- a/src/commons/application/__tests__/ApplicationTypes.test.ts +++ b/src/commons/application/__tests__/ApplicationTypes.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { ALL_LANGUAGES, diff --git a/src/commons/application/actions/InterpreterActions.ts b/src/commons/application/actions/InterpreterActions.ts index b84838f28c..13ed3a3cec 100644 --- a/src/commons/application/actions/InterpreterActions.ts +++ b/src/commons/application/actions/InterpreterActions.ts @@ -1,4 +1,4 @@ -import { SourceError, Value } from 'js-slang/dist/types'; +import { SourceError, Value } from '@sourceacademy/js-slang/dist/types'; import { createActions } from 'src/commons/redux/utils'; import { WorkspaceLocation } from '../../workspace/WorkspaceTypes'; diff --git a/src/commons/application/actions/__tests__/SessionActions.test.ts b/src/commons/application/actions/__tests__/SessionActions.test.ts index b8d11c0c8d..a1170d65e2 100644 --- a/src/commons/application/actions/__tests__/SessionActions.test.ts +++ b/src/commons/application/actions/__tests__/SessionActions.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { mockStudents } from 'src/commons/mocks/UserMocks'; import { paginationToBackendParams, diff --git a/src/commons/application/reducers/__tests__/SessionReducer.test.ts b/src/commons/application/reducers/__tests__/SessionReducer.test.ts index ff9001f136..3dc0c912db 100644 --- a/src/commons/application/reducers/__tests__/SessionReducer.test.ts +++ b/src/commons/application/reducers/__tests__/SessionReducer.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { GradingOverview, GradingQuery } from '../../../../features/grading/GradingTypes'; import { diff --git a/src/commons/application/types/SessionTypes.ts b/src/commons/application/types/SessionTypes.ts index 401466989f..8df2a75778 100644 --- a/src/commons/application/types/SessionTypes.ts +++ b/src/commons/application/types/SessionTypes.ts @@ -1,5 +1,5 @@ import { Octokit } from '@octokit/rest'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { GradingOverviews, GradingQuery } from '../../../features/grading/GradingTypes'; import { Device, DeviceSession } from '../../../features/remoteExecution/RemoteExecutionTypes'; diff --git a/src/commons/assessment/AssessmentTypes.ts b/src/commons/assessment/AssessmentTypes.ts index bbd7b13644..c7180cbab8 100644 --- a/src/commons/assessment/AssessmentTypes.ts +++ b/src/commons/assessment/AssessmentTypes.ts @@ -1,4 +1,4 @@ -import { Chapter, SourceError, Variant } from 'js-slang/dist/types'; +import { Chapter, SourceError, Variant } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibrary, ExternalLibraryName } from '../application/types/ExternalTypes'; diff --git a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx index ec67ee453b..4ea63c35e9 100644 --- a/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx +++ b/src/commons/assessmentWorkspace/AssessmentWorkspace.tsx @@ -12,7 +12,7 @@ import { } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { isEqual } from 'lodash'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useDispatch } from 'react-redux'; diff --git a/src/commons/controlBar/ControlBarChapterSelect.tsx b/src/commons/controlBar/ControlBarChapterSelect.tsx index 625c09d9ee..1ab61bf8eb 100644 --- a/src/commons/controlBar/ControlBarChapterSelect.tsx +++ b/src/commons/controlBar/ControlBarChapterSelect.tsx @@ -2,7 +2,7 @@ import { Button, Menu, MenuItem } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import { ItemListRenderer, ItemRenderer, Select } from '@blueprintjs/select'; import { IEvaluatorDefinition } from '@sourceacademy/language-directory/dist/types'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import { useDispatch } from 'react-redux'; diff --git a/src/commons/controlBar/LegacyControlBarChapterSelect.tsx b/src/commons/controlBar/LegacyControlBarChapterSelect.tsx index b717c40082..859d0cf204 100644 --- a/src/commons/controlBar/LegacyControlBarChapterSelect.tsx +++ b/src/commons/controlBar/LegacyControlBarChapterSelect.tsx @@ -1,7 +1,7 @@ import { Button, Menu, MenuItem, Tooltip } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import { ItemListRenderer, ItemRenderer, Select } from '@blueprintjs/select'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import { diff --git a/src/commons/documentation/Documentation.ts b/src/commons/documentation/Documentation.ts index f14fc4eb45..41949c2555 100644 --- a/src/commons/documentation/Documentation.ts +++ b/src/commons/documentation/Documentation.ts @@ -1,4 +1,4 @@ -import { SourceDocumentation } from 'js-slang'; +import { SourceDocumentation } from '@sourceacademy/js-slang'; import { deviceTypes } from 'src/features/remoteExecution/RemoteExecutionTypes'; import { externalLibraries } from '../application/types/ExternalTypes'; diff --git a/src/commons/dropdown/DropdownCreateCourse.tsx b/src/commons/dropdown/DropdownCreateCourse.tsx index 2d37ce7eb9..79aa83945d 100644 --- a/src/commons/dropdown/DropdownCreateCourse.tsx +++ b/src/commons/dropdown/DropdownCreateCourse.tsx @@ -13,7 +13,7 @@ import { TextArea } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import { useDispatch } from 'react-redux'; import AcademyActions from 'src/features/academy/AcademyActions'; diff --git a/src/commons/editingWorkspace/EditingWorkspace.tsx b/src/commons/editingWorkspace/EditingWorkspace.tsx index 53b358969d..1ae4ebd659 100644 --- a/src/commons/editingWorkspace/EditingWorkspace.tsx +++ b/src/commons/editingWorkspace/EditingWorkspace.tsx @@ -10,7 +10,7 @@ import { } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useDispatch } from 'react-redux'; import { useNavigate } from 'react-router'; diff --git a/src/commons/editingWorkspaceSideContent/EditingWorkspaceSideContentDeploymentTab.tsx b/src/commons/editingWorkspaceSideContent/EditingWorkspaceSideContentDeploymentTab.tsx index 9dc5638f75..8630eda268 100644 --- a/src/commons/editingWorkspaceSideContent/EditingWorkspaceSideContentDeploymentTab.tsx +++ b/src/commons/editingWorkspaceSideContent/EditingWorkspaceSideContentDeploymentTab.tsx @@ -1,7 +1,7 @@ import { Button, Classes, Divider, MenuItem, Switch } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import { ItemRenderer, Select } from '@blueprintjs/select'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import { SALanguage, sourceLanguages, styliseSublanguage } from '../application/ApplicationTypes'; diff --git a/src/commons/editor/Editor.tsx b/src/commons/editor/Editor.tsx index 31127f0160..73276061a6 100644 --- a/src/commons/editor/Editor.tsx +++ b/src/commons/editor/Editor.tsx @@ -6,7 +6,7 @@ import 'ace-builds/src-noconflict/ace'; import 'ace-builds/src-noconflict/ext-language_tools'; import 'ace-builds/src-noconflict/ext-searchbox'; import 'ace-builds/src-noconflict/ext-settings_menu'; -import 'js-slang/dist/editors/ace/theme/source'; +import '@sourceacademy/js-slang/dist/editors/ace/theme/source'; /** * ace-builds/webpack-resolver is causing some issues in the testing environment. @@ -21,7 +21,7 @@ import 'ace-builds/src-noconflict/keybinding-vim'; import { Card } from '@blueprintjs/core'; import * as AceBuilds from 'ace-builds'; import { Ace, require as acequire, createEditSession } from 'ace-builds'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import AceEditor, { IAceEditorProps, IEditorProps } from 'react-ace'; import { IAceEditor } from 'react-ace/lib/types'; diff --git a/src/commons/editor/UseHighlighting.tsx b/src/commons/editor/UseHighlighting.tsx index 28f94aea3f..c232395024 100644 --- a/src/commons/editor/UseHighlighting.tsx +++ b/src/commons/editor/UseHighlighting.tsx @@ -1,5 +1,5 @@ import { Ace, Range as AceRange } from 'ace-builds'; -import { createContext, getAllOccurrencesInScope, getScope } from 'js-slang'; +import { createContext, getAllOccurrencesInScope, getScope } from '@sourceacademy/js-slang'; import React from 'react'; import { EditorHook } from './Editor'; diff --git a/src/commons/editor/UseNavigation.tsx b/src/commons/editor/UseNavigation.tsx index b0d237789a..a5d8dc20b8 100644 --- a/src/commons/editor/UseNavigation.tsx +++ b/src/commons/editor/UseNavigation.tsx @@ -1,5 +1,5 @@ -import { createContext, hasDeclaration } from 'js-slang'; -import { Variant } from 'js-slang/dist/types'; +import { createContext, hasDeclaration } from '@sourceacademy/js-slang'; +import { Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import { Documentation } from '../documentation/Documentation'; diff --git a/src/commons/editor/UseRefactor.tsx b/src/commons/editor/UseRefactor.tsx index 8fddbc25da..79739af535 100644 --- a/src/commons/editor/UseRefactor.tsx +++ b/src/commons/editor/UseRefactor.tsx @@ -1,5 +1,5 @@ import { Range } from 'ace-builds'; -import { createContext, getAllOccurrencesInScope } from 'js-slang'; +import { createContext, getAllOccurrencesInScope } from '@sourceacademy/js-slang'; import React from 'react'; import { EditorHook } from './Editor'; diff --git a/src/commons/mocks/AssessmentMocks.ts b/src/commons/mocks/AssessmentMocks.ts index 2619f87642..4bd4185be5 100644 --- a/src/commons/mocks/AssessmentMocks.ts +++ b/src/commons/mocks/AssessmentMocks.ts @@ -1,4 +1,4 @@ -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibraryName } from '../application/types/ExternalTypes'; import { diff --git a/src/commons/mocks/ContextMocks.ts b/src/commons/mocks/ContextMocks.ts index 75439360d8..7c817aa7bb 100644 --- a/src/commons/mocks/ContextMocks.ts +++ b/src/commons/mocks/ContextMocks.ts @@ -1,9 +1,9 @@ import { parse } from 'acorn'; import type { Node } from 'estree'; -import { ACORN_PARSE_OPTIONS } from 'js-slang/dist/constants'; -import createContext, { EnvTree } from 'js-slang/dist/createContext'; -import type { Context } from 'js-slang/dist/types'; -import { TypeError } from 'js-slang/dist/utils/rttc'; +import { ACORN_PARSE_OPTIONS } from '@sourceacademy/js-slang/dist/constants'; +import createContext, { EnvTree } from '@sourceacademy/js-slang/dist/createContext'; +import type { Context } from '@sourceacademy/js-slang/dist/types'; +import { TypeError } from '@sourceacademy/js-slang/dist/utils/rttc'; export function mockContext(chapter = 1): Context { return createContext(chapter); diff --git a/src/commons/mocks/UserMocks.ts b/src/commons/mocks/UserMocks.ts index c01dc94b97..3fbeaddebe 100644 --- a/src/commons/mocks/UserMocks.ts +++ b/src/commons/mocks/UserMocks.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { GameState, Role } from '../application/ApplicationTypes'; import { diff --git a/src/commons/repl/Repl.tsx b/src/commons/repl/Repl.tsx index 2a8416c6b5..59f0f8ba8e 100644 --- a/src/commons/repl/Repl.tsx +++ b/src/commons/repl/Repl.tsx @@ -1,9 +1,9 @@ import { Card, Pre } from '@blueprintjs/core'; import { Ace } from 'ace-builds'; import classNames from 'classnames'; -import { parseError } from 'js-slang'; -import { Chapter, Variant } from 'js-slang/dist/types'; -import { stringify } from 'js-slang/dist/utils/stringify'; +import { parseError } from '@sourceacademy/js-slang'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; import React from 'react'; import type { InterpreterOutput, ResultOutput } from '../application/ApplicationTypes'; diff --git a/src/commons/repl/ReplInput.tsx b/src/commons/repl/ReplInput.tsx index dc2a4e4bbc..7d52db4075 100644 --- a/src/commons/repl/ReplInput.tsx +++ b/src/commons/repl/ReplInput.tsx @@ -1,7 +1,7 @@ import { Classes } from '@blueprintjs/core'; import { Ace } from 'ace-builds'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import AceEditor from 'react-ace'; import ReactAce from 'react-ace/lib/ace'; diff --git a/src/commons/repl/__tests__/Repl.test.tsx b/src/commons/repl/__tests__/Repl.test.tsx index da77d4c895..f6ae0f0e3c 100644 --- a/src/commons/repl/__tests__/Repl.test.tsx +++ b/src/commons/repl/__tests__/Repl.test.tsx @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibraryName } from 'src/commons/application/types/ExternalTypes'; import { shallowRender } from 'src/commons/utils/TestUtils'; diff --git a/src/commons/sagas/PersistenceSaga.tsx b/src/commons/sagas/PersistenceSaga.tsx index 0e9a52620b..cef684944c 100644 --- a/src/commons/sagas/PersistenceSaga.tsx +++ b/src/commons/sagas/PersistenceSaga.tsx @@ -2,7 +2,7 @@ /// /// import { Intent } from '@blueprintjs/core'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { call, put, select } from 'redux-saga/effects'; import type { PersistenceFile } from '../../features/persistence/PersistenceTypes'; diff --git a/src/commons/sagas/PlaygroundSaga.ts b/src/commons/sagas/PlaygroundSaga.ts index bb50f2cfdc..07da036e56 100644 --- a/src/commons/sagas/PlaygroundSaga.ts +++ b/src/commons/sagas/PlaygroundSaga.ts @@ -1,5 +1,5 @@ import type { FSModule } from 'browserfs/dist/node/core/FS'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { compressToEncodedURIComponent } from 'lz-string'; import qs from 'query-string'; import { call, delay, put, race, select } from 'redux-saga/effects'; diff --git a/src/commons/sagas/RemoteExecutionSaga.ts b/src/commons/sagas/RemoteExecutionSaga.ts index a481665c6e..18155c35f3 100644 --- a/src/commons/sagas/RemoteExecutionSaga.ts +++ b/src/commons/sagas/RemoteExecutionSaga.ts @@ -1,7 +1,7 @@ import { SlingClient } from '@sourceacademy/sling-client'; -import { assemble, compileFiles, type Context } from 'js-slang'; -import { ExceptionError } from 'js-slang/dist/errors/errors'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { assemble, compileFiles, type Context } from '@sourceacademy/js-slang'; +import { ExceptionError } from '@sourceacademy/js-slang/dist/errors/errors'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import _ from 'lodash'; import { call, put, race, select, take } from 'redux-saga/effects'; import RemoteExecutionActions from 'src/features/remoteExecution/RemoteExecutionActions'; @@ -275,7 +275,7 @@ const RemoteExecutionSaga = combineSagaHandlers({ (state: OverallState) => state.workspaces[session.workspace].context ); // clear the context of errors (note: the way this works is that the context - // is mutated by js-slang anyway, so it's ok to do it like this) + // is mutated by @sourceacademy/js-slang anyway, so it's ok to do it like this) context.errors.length = 0; const compiled: MaybePromise> = yield call( compileFiles, diff --git a/src/commons/sagas/StoriesSaga.ts b/src/commons/sagas/StoriesSaga.ts index dc43f442e3..7eecac001a 100644 --- a/src/commons/sagas/StoriesSaga.ts +++ b/src/commons/sagas/StoriesSaga.ts @@ -1,4 +1,4 @@ -import type { Context } from 'js-slang'; +import type { Context } from '@sourceacademy/js-slang'; import { call, put, select } from 'redux-saga/effects'; import StoriesActions from 'src/features/stories/StoriesActions'; import { diff --git a/src/commons/sagas/WorkspaceSaga/helpers/blockExtraMethods.ts b/src/commons/sagas/WorkspaceSaga/helpers/blockExtraMethods.ts index a93c57b056..5eb554cc4e 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/blockExtraMethods.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/blockExtraMethods.ts @@ -1,4 +1,4 @@ -import type { Context } from 'js-slang'; +import type { Context } from '@sourceacademy/js-slang'; import { call } from 'redux-saga/effects'; import { diff --git a/src/commons/sagas/WorkspaceSaga/helpers/clearContext.ts b/src/commons/sagas/WorkspaceSaga/helpers/clearContext.ts index cb7d034334..2f4c8c8a0a 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/clearContext.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/clearContext.ts @@ -1,5 +1,5 @@ -import type { Context } from 'js-slang'; -import { defineSymbol } from 'js-slang/dist/createContext'; +import type { Context } from '@sourceacademy/js-slang'; +import { defineSymbol } from '@sourceacademy/js-slang/dist/createContext'; import { put, select, take } from 'redux-saga/effects'; import WorkspaceActions from 'src/commons/workspace/WorkspaceActions'; diff --git a/src/commons/sagas/WorkspaceSaga/helpers/evalCode.ts b/src/commons/sagas/WorkspaceSaga/helpers/evalCode.ts index 2e370be3a5..ef9a8761b7 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/evalCode.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/evalCode.ts @@ -2,10 +2,10 @@ import { compileAndRun as compileAndRunCCode } from '@sourceacademy/c-slang/ctow import type { IConduit } from '@sourceacademy/conductor/dist/conduit'; import { IEvaluatorDefinition } from '@sourceacademy/language-directory/dist/types'; import { tokenizer } from 'acorn'; -import { type Context, interrupt, type Result, resume, runFilesInContext } from 'js-slang'; -import { ACORN_PARSE_OPTIONS } from 'js-slang/dist/constants'; -import { InterruptedError } from 'js-slang/dist/errors/errors'; -import { Chapter, ErrorSeverity, ErrorType, type SourceError, Variant } from 'js-slang/dist/types'; +import { type Context, interrupt, type Result, resume, runFilesInContext } from '@sourceacademy/js-slang'; +import { ACORN_PARSE_OPTIONS } from '@sourceacademy/js-slang/dist/constants'; +import { InterruptedError } from '@sourceacademy/js-slang/dist/errors/errors'; +import { Chapter, ErrorSeverity, ErrorType, type SourceError, Variant } from '@sourceacademy/js-slang/dist/types'; import { pick } from 'lodash'; import { eventChannel, type SagaIterator } from 'redux-saga'; import { call, cancel, cancelled, fork, put, race, select, take } from 'redux-saga/effects'; diff --git a/src/commons/sagas/WorkspaceSaga/helpers/evalTestCode.ts b/src/commons/sagas/WorkspaceSaga/helpers/evalTestCode.ts index 146fbd1f07..44bab612aa 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/evalTestCode.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/evalTestCode.ts @@ -1,5 +1,5 @@ -import { type Context, interrupt, runInContext } from 'js-slang'; -import { InterruptedError } from 'js-slang/dist/errors/errors'; +import { type Context, interrupt, runInContext } from '@sourceacademy/js-slang'; +import { InterruptedError } from '@sourceacademy/js-slang/dist/errors/errors'; import { call, put, race, take } from 'redux-saga/effects'; import InterpreterActions from 'src/commons/application/actions/InterpreterActions'; diff --git a/src/commons/sagas/WorkspaceSaga/helpers/insertDebuggerStatements.ts b/src/commons/sagas/WorkspaceSaga/helpers/insertDebuggerStatements.ts index f7fc7b626f..15adf36101 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/insertDebuggerStatements.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/insertDebuggerStatements.ts @@ -1,5 +1,5 @@ -import { Context } from 'js-slang'; -import { parse } from 'js-slang/dist/parser/parser'; +import { Context } from '@sourceacademy/js-slang'; +import { parse } from '@sourceacademy/js-slang/dist/parser/parser'; import { put, StrictEffect } from 'redux-saga/effects'; import { isSourceLanguage } from '../../../application/ApplicationTypes'; diff --git a/src/commons/sagas/WorkspaceSaga/helpers/restoreExtraMethods.ts b/src/commons/sagas/WorkspaceSaga/helpers/restoreExtraMethods.ts index 12458d6f0b..a21ff8ef45 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/restoreExtraMethods.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/restoreExtraMethods.ts @@ -1,4 +1,4 @@ -import type { Context } from 'js-slang'; +import type { Context } from '@sourceacademy/js-slang'; import { call } from 'redux-saga/effects'; import { getDifferenceInMethods, getRestoreExtraMethodsString } from '../../../utils/JsSlangHelper'; diff --git a/src/commons/sagas/WorkspaceSaga/helpers/runTestCase.ts b/src/commons/sagas/WorkspaceSaga/helpers/runTestCase.ts index 35452c49cd..27902ba13b 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/runTestCase.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/runTestCase.ts @@ -1,4 +1,4 @@ -import type { Context } from 'js-slang'; +import type { Context } from '@sourceacademy/js-slang'; import { random } from 'lodash'; import { call, put, select, StrictEffect } from 'redux-saga/effects'; diff --git a/src/commons/sagas/WorkspaceSaga/helpers/updateInspector.ts b/src/commons/sagas/WorkspaceSaga/helpers/updateInspector.ts index 788e813ebf..2b413471cc 100644 --- a/src/commons/sagas/WorkspaceSaga/helpers/updateInspector.ts +++ b/src/commons/sagas/WorkspaceSaga/helpers/updateInspector.ts @@ -1,4 +1,4 @@ -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { SagaIterator } from 'redux-saga'; import { put, select } from 'redux-saga/effects'; diff --git a/src/commons/sagas/WorkspaceSaga/index.ts b/src/commons/sagas/WorkspaceSaga/index.ts index 6046ecaf6f..9d59362992 100644 --- a/src/commons/sagas/WorkspaceSaga/index.ts +++ b/src/commons/sagas/WorkspaceSaga/index.ts @@ -1,6 +1,6 @@ import type { FSModule } from 'browserfs/dist/node/core/FS'; -import { type Context, findDeclaration, getNames } from 'js-slang'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { type Context, findDeclaration, getNames } from '@sourceacademy/js-slang'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import Phaser from 'phaser'; import { call, put, select } from 'redux-saga/effects'; diff --git a/src/commons/sagas/__tests__/BackendSaga.test.ts b/src/commons/sagas/__tests__/BackendSaga.test.ts index 7af850c2e9..b497c98bed 100644 --- a/src/commons/sagas/__tests__/BackendSaga.test.ts +++ b/src/commons/sagas/__tests__/BackendSaga.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { createMemoryRouter } from 'react-router'; import { call } from 'redux-saga/effects'; import { expectSaga } from 'redux-saga-test-plan'; diff --git a/src/commons/sagas/__tests__/PersistenceSaga.test.ts b/src/commons/sagas/__tests__/PersistenceSaga.test.ts index 70de2910df..7b0b2d8ff0 100644 --- a/src/commons/sagas/__tests__/PersistenceSaga.test.ts +++ b/src/commons/sagas/__tests__/PersistenceSaga.test.ts @@ -1,5 +1,5 @@ /// -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { expectSaga } from 'redux-saga-test-plan'; import WorkspaceActions from 'src/commons/workspace/WorkspaceActions'; import PlaygroundActions from 'src/features/playground/PlaygroundActions'; diff --git a/src/commons/sagas/__tests__/PlaygroundSaga.test.ts b/src/commons/sagas/__tests__/PlaygroundSaga.test.ts index cf6d66a1b6..44946ada5b 100644 --- a/src/commons/sagas/__tests__/PlaygroundSaga.test.ts +++ b/src/commons/sagas/__tests__/PlaygroundSaga.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { compressToEncodedURIComponent } from 'lz-string'; import qs from 'query-string'; import { call } from 'redux-saga/effects'; diff --git a/src/commons/sagas/__tests__/SideContentSaga.test.ts b/src/commons/sagas/__tests__/SideContentSaga.test.ts index 2d78f67923..26e356ce5a 100644 --- a/src/commons/sagas/__tests__/SideContentSaga.test.ts +++ b/src/commons/sagas/__tests__/SideContentSaga.test.ts @@ -1,5 +1,5 @@ import { IconNames } from '@blueprintjs/icons'; -import { Context } from 'js-slang'; +import { Context } from '@sourceacademy/js-slang'; import { expectSaga } from 'redux-saga-test-plan'; import { getDynamicTabs } from 'src/commons/sideContent/SideContentHelper'; import { SideContentReducer } from 'src/commons/sideContent/SideContentReducer'; diff --git a/src/commons/sagas/__tests__/WorkspaceSaga.test.ts b/src/commons/sagas/__tests__/WorkspaceSaga.test.ts index f0aef96179..2a7cf11687 100644 --- a/src/commons/sagas/__tests__/WorkspaceSaga.test.ts +++ b/src/commons/sagas/__tests__/WorkspaceSaga.test.ts @@ -5,9 +5,9 @@ import { resume, runFilesInContext, runInContext -} from 'js-slang'; -import createContext from 'js-slang/dist/createContext'; -import { Chapter, ErrorType, type Finished, type SourceError, Variant } from 'js-slang/dist/types'; +} from '@sourceacademy/js-slang'; +import createContext from '@sourceacademy/js-slang/dist/createContext'; +import { Chapter, ErrorType, type Finished, type SourceError, Variant } from '@sourceacademy/js-slang/dist/types'; import { call } from 'redux-saga/effects'; import { expectSaga } from 'redux-saga-test-plan'; import * as matchers from 'redux-saga-test-plan/matchers'; diff --git a/src/commons/sideContent/SideContentHelper.ts b/src/commons/sideContent/SideContentHelper.ts index bd5ed857da..c3cbfb12ee 100644 --- a/src/commons/sideContent/SideContentHelper.ts +++ b/src/commons/sideContent/SideContentHelper.ts @@ -1,8 +1,8 @@ import * as bpcore from '@blueprintjs/core'; import { TabId } from '@blueprintjs/core'; import * as bpicons from '@blueprintjs/icons'; -import * as jsslang from 'js-slang'; -import * as jsslangDist from 'js-slang/dist'; +import * as jsslang from '@sourceacademy/js-slang'; +import * as jsslangDist from '@sourceacademy/js-slang/dist'; import lodash from 'lodash'; import phaser from 'phaser'; import React, { useCallback } from 'react'; @@ -33,8 +33,8 @@ const requireProvider = (x: string) => { 'react-dom': ReactDOM, '@blueprintjs/core': bpcore, '@blueprintjs/icons': bpicons, - 'js-slang': jsslang, - 'js-slang/dist': jsslangDist, + '@sourceacademy/js-slang': jsslang, + '@sourceacademy/js-slang/dist': jsslangDist, lodash, phaser }; diff --git a/src/commons/sideContent/__tests__/SideContentAutograder.test.tsx b/src/commons/sideContent/__tests__/SideContentAutograder.test.tsx index 765e68e1b5..0d4030d954 100644 --- a/src/commons/sideContent/__tests__/SideContentAutograder.test.tsx +++ b/src/commons/sideContent/__tests__/SideContentAutograder.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { ErrorSeverity, ErrorType, SourceError } from 'js-slang/dist/types'; +import { ErrorSeverity, ErrorType, SourceError } from '@sourceacademy/js-slang/dist/types'; import { act } from 'react'; import { shallowRender } from 'src/commons/utils/TestUtils'; diff --git a/src/commons/sideContent/__tests__/SideContentCseMachine.test.tsx b/src/commons/sideContent/__tests__/SideContentCseMachine.test.tsx index 8484741349..ac47c66f72 100644 --- a/src/commons/sideContent/__tests__/SideContentCseMachine.test.tsx +++ b/src/commons/sideContent/__tests__/SideContentCseMachine.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { runInContext } from 'js-slang/dist/'; +import { runInContext } from '@sourceacademy/js-slang/dist/'; import { act } from 'react'; import { Provider } from 'react-redux'; import { mockInitialStore } from 'src/commons/mocks/StoreMocks'; diff --git a/src/commons/sideContent/__tests__/SideContentHtmlDisplay.test.tsx b/src/commons/sideContent/__tests__/SideContentHtmlDisplay.test.tsx index f6ea46d68c..31c45bebb4 100644 --- a/src/commons/sideContent/__tests__/SideContentHtmlDisplay.test.tsx +++ b/src/commons/sideContent/__tests__/SideContentHtmlDisplay.test.tsx @@ -1,5 +1,5 @@ import { fireEvent, render } from '@testing-library/react'; -import { stringify } from 'js-slang/dist/utils/stringify'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; import { Provider } from 'react-redux'; import { mockInitialStore } from 'src/commons/mocks/StoreMocks'; import { renderTreeJson } from 'src/commons/utils/TestUtils'; diff --git a/src/commons/sideContent/content/SideContentCseMachine.tsx b/src/commons/sideContent/content/SideContentCseMachine.tsx index 3089e21096..f007beb64a 100644 --- a/src/commons/sideContent/content/SideContentCseMachine.tsx +++ b/src/commons/sideContent/content/SideContentCseMachine.tsx @@ -13,7 +13,7 @@ import { HotkeyItem } from '@mantine/hooks'; import { bindActionCreators } from '@reduxjs/toolkit'; import classNames from 'classnames'; import { t } from 'i18next'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { debounce } from 'lodash'; import React from 'react'; import { Trans, useTranslation } from 'react-i18next'; diff --git a/src/commons/sideContent/content/SideContentSubstVisualizer.tsx b/src/commons/sideContent/content/SideContentSubstVisualizer.tsx index a39fa67ddf..1ad9169343 100644 --- a/src/commons/sideContent/content/SideContentSubstVisualizer.tsx +++ b/src/commons/sideContent/content/SideContentSubstVisualizer.tsx @@ -1,4 +1,4 @@ -import 'js-slang/dist/editors/ace/theme/source'; +import '@sourceacademy/js-slang/dist/editors/ace/theme/source'; import { Button, @@ -13,30 +13,30 @@ import { } from '@blueprintjs/core'; import { getHotkeyHandler, HotkeyItem } from '@mantine/hooks'; import classNames from 'classnames'; -import { HighlightRulesSelector, ModeSelector } from 'js-slang/dist/editors/ace/modes/source'; -import { IStepperPropContents } from 'js-slang/dist/tracer'; -import { StepperBaseNode } from 'js-slang/dist/tracer/interface'; -import { StepperExpression } from 'js-slang/dist/tracer/nodes'; -import { StepperArrayExpression } from 'js-slang/dist/tracer/nodes/Expression/ArrayExpression'; -import { StepperArrowFunctionExpression } from 'js-slang/dist/tracer/nodes/Expression/ArrowFunctionExpression'; -import { StepperBinaryExpression } from 'js-slang/dist/tracer/nodes/Expression/BinaryExpression'; -import { StepperConditionalExpression } from 'js-slang/dist/tracer/nodes/Expression/ConditionalExpression'; -import { StepperFunctionApplication } from 'js-slang/dist/tracer/nodes/Expression/FunctionApplication'; -import { StepperIdentifier } from 'js-slang/dist/tracer/nodes/Expression/Identifier'; -import { StepperLiteral } from 'js-slang/dist/tracer/nodes/Expression/Literal'; -import { StepperLogicalExpression } from 'js-slang/dist/tracer/nodes/Expression/LogicalExpression'; -import { StepperUnaryExpression } from 'js-slang/dist/tracer/nodes/Expression/UnaryExpression'; -import { StepperProgram } from 'js-slang/dist/tracer/nodes/Program'; -import { StepperBlockStatement } from 'js-slang/dist/tracer/nodes/Statement/BlockStatement'; -import { StepperExpressionStatement } from 'js-slang/dist/tracer/nodes/Statement/ExpressionStatement'; -import { StepperFunctionDeclaration } from 'js-slang/dist/tracer/nodes/Statement/FunctionDeclaration'; -import { StepperIfStatement } from 'js-slang/dist/tracer/nodes/Statement/IfStatement'; -import { StepperReturnStatement } from 'js-slang/dist/tracer/nodes/Statement/ReturnStatement'; +import { HighlightRulesSelector, ModeSelector } from '@sourceacademy/js-slang/dist/editors/ace/modes/source'; +import { IStepperPropContents } from '@sourceacademy/js-slang/dist/tracer'; +import { StepperBaseNode } from '@sourceacademy/js-slang/dist/tracer/interface'; +import { StepperExpression } from '@sourceacademy/js-slang/dist/tracer/nodes'; +import { StepperArrayExpression } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/ArrayExpression'; +import { StepperArrowFunctionExpression } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/ArrowFunctionExpression'; +import { StepperBinaryExpression } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/BinaryExpression'; +import { StepperConditionalExpression } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/ConditionalExpression'; +import { StepperFunctionApplication } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/FunctionApplication'; +import { StepperIdentifier } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/Identifier'; +import { StepperLiteral } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/Literal'; +import { StepperLogicalExpression } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/LogicalExpression'; +import { StepperUnaryExpression } from '@sourceacademy/js-slang/dist/tracer/nodes/Expression/UnaryExpression'; +import { StepperProgram } from '@sourceacademy/js-slang/dist/tracer/nodes/Program'; +import { StepperBlockStatement } from '@sourceacademy/js-slang/dist/tracer/nodes/Statement/BlockStatement'; +import { StepperExpressionStatement } from '@sourceacademy/js-slang/dist/tracer/nodes/Statement/ExpressionStatement'; +import { StepperFunctionDeclaration } from '@sourceacademy/js-slang/dist/tracer/nodes/Statement/FunctionDeclaration'; +import { StepperIfStatement } from '@sourceacademy/js-slang/dist/tracer/nodes/Statement/IfStatement'; +import { StepperReturnStatement } from '@sourceacademy/js-slang/dist/tracer/nodes/Statement/ReturnStatement'; import { StepperVariableDeclaration, StepperVariableDeclarator -} from 'js-slang/dist/tracer/nodes/Statement/VariableDeclaration'; -import { astToString } from 'js-slang/dist/utils/ast/astToString'; +} from '@sourceacademy/js-slang/dist/tracer/nodes/Statement/VariableDeclaration'; +import { astToString } from '@sourceacademy/js-slang/dist/utils/ast/astToString'; import React, { useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; diff --git a/src/commons/sideContent/content/SideContentTestcaseCard.tsx b/src/commons/sideContent/content/SideContentTestcaseCard.tsx index a8342d6cb2..1135080d41 100644 --- a/src/commons/sideContent/content/SideContentTestcaseCard.tsx +++ b/src/commons/sideContent/content/SideContentTestcaseCard.tsx @@ -1,7 +1,7 @@ import { Card, Classes, Elevation, Pre } from '@blueprintjs/core'; import classNames from 'classnames'; -import { parseError } from 'js-slang'; -import { stringify } from 'js-slang/dist/utils/stringify'; +import { parseError } from '@sourceacademy/js-slang'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; import React from 'react'; import { Testcase, TestcaseTypes } from '../../assessment/AssessmentTypes'; diff --git a/src/commons/sideContent/content/githubAssessments/SideContentEditableTestcaseCard.tsx b/src/commons/sideContent/content/githubAssessments/SideContentEditableTestcaseCard.tsx index 2407f595eb..85804cc398 100644 --- a/src/commons/sideContent/content/githubAssessments/SideContentEditableTestcaseCard.tsx +++ b/src/commons/sideContent/content/githubAssessments/SideContentEditableTestcaseCard.tsx @@ -1,8 +1,8 @@ import { Button, Card, Classes, Elevation, InputGroup } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; -import { parseError } from 'js-slang'; -import { stringify } from 'js-slang/dist/utils/stringify'; +import { parseError } from '@sourceacademy/js-slang'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; import React from 'react'; import { Testcase, TestcaseTypes } from '../../../assessment/AssessmentTypes'; diff --git a/src/commons/sourceRecorder/SourceRecorderControlBar.tsx b/src/commons/sourceRecorder/SourceRecorderControlBar.tsx index 842a6d9b1f..9d4c61cbaf 100644 --- a/src/commons/sourceRecorder/SourceRecorderControlBar.tsx +++ b/src/commons/sourceRecorder/SourceRecorderControlBar.tsx @@ -1,6 +1,6 @@ import { ButtonGroup, Slider } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import { diff --git a/src/commons/sourceRecorder/SourceRecorderEditor.tsx b/src/commons/sourceRecorder/SourceRecorderEditor.tsx index da413e9d21..3d5488324a 100644 --- a/src/commons/sourceRecorder/SourceRecorderEditor.tsx +++ b/src/commons/sourceRecorder/SourceRecorderEditor.tsx @@ -1,6 +1,6 @@ import 'ace-builds/src-noconflict/ext-searchbox'; import 'ace-builds/src-noconflict/mode-javascript'; -import 'js-slang/dist/editors/ace/theme/source'; +import '@sourceacademy/js-slang/dist/editors/ace/theme/source'; import { Card } from '@blueprintjs/core'; import { Ace } from 'ace-builds'; diff --git a/src/commons/utils/AceHelper.ts b/src/commons/utils/AceHelper.ts index 4b1202836c..7b4e776a02 100644 --- a/src/commons/utils/AceHelper.ts +++ b/src/commons/utils/AceHelper.ts @@ -1,5 +1,5 @@ -import { HighlightRulesSelector, ModeSelector } from 'js-slang/dist/editors/ace/modes/source'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { HighlightRulesSelector, ModeSelector } from '@sourceacademy/js-slang/dist/editors/ace/modes/source'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { HighlightRulesSelector_native } from '../../features/fullJS/fullJSHighlight'; import { ExternalLibraryName } from '../application/types/ExternalTypes'; @@ -39,7 +39,7 @@ import 'ace-builds/src-noconflict/mode-javascript'; import 'ace-builds/src-noconflict/mode-python'; import 'ace-builds/src-noconflict/mode-scheme'; import 'ace-builds/src-noconflict/mode-typescript'; -import 'js-slang/dist/editors/ace/theme/source'; +import '@sourceacademy/js-slang/dist/editors/ace/theme/source'; export const getModeString = (chapter: Chapter, variant: Variant, library: string) => { // TODO: Create our own highlighting rules for the different sublanguages diff --git a/src/commons/utils/CToWasmHelper.ts b/src/commons/utils/CToWasmHelper.ts index 46e85179e9..09f093dbe2 100644 --- a/src/commons/utils/CToWasmHelper.ts +++ b/src/commons/utils/CToWasmHelper.ts @@ -1,7 +1,7 @@ import type { ModulesGlobalConfig as CCompilerConfig } from '@sourceacademy/c-slang/ctowasm/dist'; -import loadSourceModules from 'js-slang/dist/modules/loader'; -import type { ModuleFunctions } from 'js-slang/dist/modules/moduleTypes'; -import type { Context } from 'js-slang/dist/types'; +import loadSourceModules from '@sourceacademy/js-slang/dist/modules/loader'; +import type { ModuleFunctions } from '@sourceacademy/js-slang/dist/modules/moduleTypes'; +import type { Context } from '@sourceacademy/js-slang/dist/types'; import InterpreterActions from '../application/actions/InterpreterActions'; diff --git a/src/commons/utils/ConsoleOverload.ts b/src/commons/utils/ConsoleOverload.ts index 2965f62494..9fb3e8823b 100644 --- a/src/commons/utils/ConsoleOverload.ts +++ b/src/commons/utils/ConsoleOverload.ts @@ -1,4 +1,4 @@ -import { stringify } from 'js-slang/dist/utils/stringify'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; type DisplayBufferCallback = (log: string) => void; diff --git a/src/commons/utils/Constants.ts b/src/commons/utils/Constants.ts index 0ee626e184..ac8d8f21a4 100644 --- a/src/commons/utils/Constants.ts +++ b/src/commons/utils/Constants.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { AuthProviderType } from './AuthHelper'; diff --git a/src/commons/utils/IntroductionHelper.ts b/src/commons/utils/IntroductionHelper.ts index c2bf5494cc..c49a3d1f2d 100644 --- a/src/commons/utils/IntroductionHelper.ts +++ b/src/commons/utils/IntroductionHelper.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { SALanguage, styliseSublanguage } from '../application/ApplicationTypes'; import { Links } from './Constants'; diff --git a/src/commons/utils/JavaHelper.ts b/src/commons/utils/JavaHelper.ts index fbb7199135..e4ae34ea59 100644 --- a/src/commons/utils/JavaHelper.ts +++ b/src/commons/utils/JavaHelper.ts @@ -2,9 +2,9 @@ import { compileFromSource, ECE, typeCheck } from 'java-slang'; import { BinaryWriter } from 'java-slang/dist/compiler/binary-writer'; import setupJVM, { parseBin } from 'java-slang/dist/jvm'; import { createModuleProxy, loadCachedFiles } from 'java-slang/dist/jvm/utils/integration'; -import { Context, Result } from 'js-slang'; -import loadSourceModules from 'js-slang/dist/modules/loader'; -import { ErrorSeverity, ErrorType, SourceError } from 'js-slang/dist/types'; +import { Context, Result } from '@sourceacademy/js-slang'; +import loadSourceModules from '@sourceacademy/js-slang/dist/modules/loader'; +import { ErrorSeverity, ErrorType, SourceError } from '@sourceacademy/js-slang/dist/types'; import { CseMachine } from '../../features/cseMachine/java/CseMachine'; import { UploadResult } from '../sideContent/content/SideContentUpload'; diff --git a/src/commons/utils/JsSlangHelper.ts b/src/commons/utils/JsSlangHelper.ts index e588ca834d..20ffc7e203 100644 --- a/src/commons/utils/JsSlangHelper.ts +++ b/src/commons/utils/JsSlangHelper.ts @@ -1,5 +1,5 @@ /* tslint:disable: ban-types*/ -import createSlangContext, { defineBuiltin, importBuiltins } from 'js-slang/dist/createContext'; +import createSlangContext, { defineBuiltin, importBuiltins } from '@sourceacademy/js-slang/dist/createContext'; import { type Chapter, type Context, @@ -7,8 +7,8 @@ import { LanguageOptions, type Value, Variant -} from 'js-slang/dist/types'; -import { stringify } from 'js-slang/dist/utils/stringify'; +} from '@sourceacademy/js-slang/dist/types'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; import { difference, keys } from 'lodash'; import CseMachine from 'src/features/cseMachine/CseMachine'; @@ -25,7 +25,7 @@ import DisplayBufferService from './DisplayBufferService'; /** * Function that takes a value and displays it in the interpreter. - * It uses the js-slang stringify to convert values into a "nicer" + * It uses the @sourceacademy/js-slang stringify to convert values into a "nicer" * output. e.g. [1, 2, 3] displays as [1, 2, 3]. * An action is dispatched using the redux store reference * within the global window object. @@ -147,7 +147,7 @@ export const externalBuiltIns = { }; /** - * A wrapper around js-slang's createContext. This + * A wrapper around @sourceacademy/js-slang's createContext. This * provides the original function with the required * externalBuiltIns, such as display and prompt. */ @@ -186,7 +186,7 @@ export function makeElevatedContext(context: Context) { // @ts-ignore const fakeFrame: { [key: string]: any } = new ProxyFrame(); // Explanation: Proxy doesn't work for defineProperty in use-strict. - // The js-slang will defineProperty on loadStandardLibraries + // The @sourceacademy/js-slang will defineProperty on loadStandardLibraries // Creating a raw JS object and setting prototype will allow defineProperty on the child // while reflection should work on parent. diff --git a/src/commons/utils/SourcerorHelper.ts b/src/commons/utils/SourcerorHelper.ts index bd5c695190..099a3c4625 100644 --- a/src/commons/utils/SourcerorHelper.ts +++ b/src/commons/utils/SourcerorHelper.ts @@ -1,4 +1,4 @@ -import { Context } from 'js-slang/dist/types'; +import { Context } from '@sourceacademy/js-slang/dist/types'; import InterpreterActions from '../application/actions/InterpreterActions'; diff --git a/src/commons/utils/StoriesHelper.ts b/src/commons/utils/StoriesHelper.ts index 4e78351793..2f672afd65 100644 --- a/src/commons/utils/StoriesHelper.ts +++ b/src/commons/utils/StoriesHelper.ts @@ -72,7 +72,7 @@ config: --- \`\`\` -The current valid CHAPTER/VARIANT combinations can be found [here](https://github.com/source-academy/js-slang#usage). +The current valid CHAPTER/VARIANT combinations can be found [here](https://github.com/source-academy/@sourceacademy/js-slang#usage). ## Adding New Environments diff --git a/src/commons/workspace/WorkspaceActions.ts b/src/commons/workspace/WorkspaceActions.ts index a46c6cf5c9..1cee7ac20f 100644 --- a/src/commons/workspace/WorkspaceActions.ts +++ b/src/commons/workspace/WorkspaceActions.ts @@ -1,5 +1,5 @@ -import type { Context } from 'js-slang'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import type { Context } from '@sourceacademy/js-slang'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import type { AllColsSortStates, @@ -50,7 +50,7 @@ const newActions = createActions('workspace', { ) => ({ externalLibraryName, workspaceLocation, initialise: initialise || false }), toggleEditorAutorun: (workspaceLocation: WorkspaceLocation) => ({ workspaceLocation }), /** - * Starts the process to clear the js-slang Context + * Starts the process to clear the @sourceacademy/js-slang Context * at a specified workspace location. * * This action is to be handled by saga, in order to @@ -71,7 +71,7 @@ const newActions = createActions('workspace', { clearReplOutput: (workspaceLocation: WorkspaceLocation) => ({ workspaceLocation }), clearReplOutputLast: (workspaceLocation: WorkspaceLocation) => ({ workspaceLocation }), /** - * Finishes the process to clear the js-slang Context + * Finishes the process to clear the @sourceacademy/js-slang Context * at a specified workspace location. * * This action is to be handled in the reducer, to call the reset on the diff --git a/src/commons/workspace/WorkspaceReducer.ts b/src/commons/workspace/WorkspaceReducer.ts index 869a0be1ec..8ee51d7471 100644 --- a/src/commons/workspace/WorkspaceReducer.ts +++ b/src/commons/workspace/WorkspaceReducer.ts @@ -250,7 +250,7 @@ const newWorkspaceReducer = createReducer(defaultWorkspaceManager, builder => { /** * Set the isRunning property of the * context to false, to ensure a re-render. - * Also in case the async js-slang interrupt() + * Also in case the async @sourceacademy/js-slang interrupt() * function does not finish interrupting before * this action is called. */ @@ -265,7 +265,7 @@ const newWorkspaceReducer = createReducer(defaultWorkspaceManager, builder => { }) /** * Resets the workspace to default settings, - * including the js-slang Context. Apply + * including the @sourceacademy/js-slang Context. Apply * any specified settings (workspaceOptions) */ .addCase(WorkspaceActions.resetWorkspace, (state, action) => { diff --git a/src/commons/workspace/WorkspaceTypes.ts b/src/commons/workspace/WorkspaceTypes.ts index 5511dec4d2..8b5d8d8fae 100644 --- a/src/commons/workspace/WorkspaceTypes.ts +++ b/src/commons/workspace/WorkspaceTypes.ts @@ -1,5 +1,5 @@ import type { CollabEditingAccess } from '@sourceacademy/sharedb-ace/types'; -import type { Context } from 'js-slang'; +import type { Context } from '@sourceacademy/js-slang'; import type { AllColsSortStates, diff --git a/src/commons/workspace/__tests__/WorkspaceActions.test.ts b/src/commons/workspace/__tests__/WorkspaceActions.test.ts index 65dade0f70..f2f631a124 100644 --- a/src/commons/workspace/__tests__/WorkspaceActions.test.ts +++ b/src/commons/workspace/__tests__/WorkspaceActions.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { changeSideContentHeight } from 'src/commons/sideContent/SideContentActions'; import { diff --git a/src/commons/workspace/__tests__/WorkspaceReducer.test.ts b/src/commons/workspace/__tests__/WorkspaceReducer.test.ts index b688749fd4..e42c58e53a 100644 --- a/src/commons/workspace/__tests__/WorkspaceReducer.test.ts +++ b/src/commons/workspace/__tests__/WorkspaceReducer.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { cloneDeep } from 'lodash'; import CommonsActions from 'src/commons/application/actions/CommonsActions'; import InterpreterActions from 'src/commons/application/actions/InterpreterActions'; diff --git a/src/features/academy/__tests__/AcademyActions.test.ts b/src/features/academy/__tests__/AcademyActions.test.ts index 451b57c74e..b6bfbfc3d5 100644 --- a/src/features/academy/__tests__/AcademyActions.test.ts +++ b/src/features/academy/__tests__/AcademyActions.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { Role } from 'src/commons/application/ApplicationTypes'; import { UpdateCourseConfiguration } from 'src/commons/application/types/SessionTypes'; import { UsernameRoleGroup } from 'src/pages/academy/adminPanel/subcomponents/AddUserPanel'; diff --git a/src/features/assessments/AssessmentUtils.ts b/src/features/assessments/AssessmentUtils.ts index 029d2d80d0..f6a810f456 100644 --- a/src/features/assessments/AssessmentUtils.ts +++ b/src/features/assessments/AssessmentUtils.ts @@ -1,4 +1,4 @@ -import { stringify } from 'js-slang/dist/utils/stringify'; +import { stringify } from '@sourceacademy/js-slang/dist/utils/stringify'; import { IMCQQuestion, diff --git a/src/features/cseMachine/CseMachine.tsx b/src/features/cseMachine/CseMachine.tsx index f829344807..706844b7ee 100644 --- a/src/features/cseMachine/CseMachine.tsx +++ b/src/features/cseMachine/CseMachine.tsx @@ -1,5 +1,5 @@ -import { Context } from 'js-slang'; -import { Control, Stash } from 'js-slang/dist/cse-machine/interpreter'; +import { Context } from '@sourceacademy/js-slang'; +import { Control, Stash } from '@sourceacademy/js-slang/dist/cse-machine/interpreter'; import React from 'react'; import { Layout } from './CseMachineLayout'; diff --git a/src/features/cseMachine/CseMachineAnimation.tsx b/src/features/cseMachine/CseMachineAnimation.tsx index c145ad4c98..08aeb9454e 100644 --- a/src/features/cseMachine/CseMachineAnimation.tsx +++ b/src/features/cseMachine/CseMachineAnimation.tsx @@ -1,5 +1,5 @@ -import { AppInstr, ArrLitInstr, AssmtInstr, InstrType } from 'js-slang/dist/cse-machine/types'; -import { Node } from 'js-slang/dist/types'; +import { AppInstr, ArrLitInstr, AssmtInstr, InstrType } from '@sourceacademy/js-slang/dist/cse-machine/types'; +import { Node } from '@sourceacademy/js-slang/dist/types'; import { Layer } from 'konva/lib/Layer'; import { Easings } from 'konva/lib/Tween'; import React from 'react'; diff --git a/src/features/cseMachine/CseMachineLayout.tsx b/src/features/cseMachine/CseMachineLayout.tsx index 14db52fc31..bca349a870 100644 --- a/src/features/cseMachine/CseMachineLayout.tsx +++ b/src/features/cseMachine/CseMachineLayout.tsx @@ -1,6 +1,6 @@ -import Heap from 'js-slang/dist/cse-machine/heap'; -import { Control, Stash } from 'js-slang/dist/cse-machine/interpreter'; -import { Chapter, Frame } from 'js-slang/dist/types'; +import Heap from '@sourceacademy/js-slang/dist/cse-machine/heap'; +import { Control, Stash } from '@sourceacademy/js-slang/dist/cse-machine/interpreter'; +import { Chapter, Frame } from '@sourceacademy/js-slang/dist/types'; import { KonvaEventObject } from 'konva/lib/Node'; import { Stage } from 'konva/lib/Stage'; import React, { RefObject } from 'react'; diff --git a/src/features/cseMachine/CseMachineTypes.ts b/src/features/cseMachine/CseMachineTypes.ts index 5346e4347d..1fced69ac9 100644 --- a/src/features/cseMachine/CseMachineTypes.ts +++ b/src/features/cseMachine/CseMachineTypes.ts @@ -1,11 +1,11 @@ -import { _Symbol } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base'; -import { SchemeNumber } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/core'; +import { _Symbol } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base'; +import { SchemeNumber } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/core'; import { EnvTree as EnvironmentTree, EnvTreeNode as EnvironmentTreeNode -} from 'js-slang/dist/createContext'; -import JsSlangClosure from 'js-slang/dist/cse-machine/closure'; -import { Environment } from 'js-slang/dist/types'; +} from '@sourceacademy/js-slang/dist/createContext'; +import JsSlangClosure from '@sourceacademy/js-slang/dist/cse-machine/closure'; +import { Environment } from '@sourceacademy/js-slang/dist/types'; import { KonvaEventObject } from 'konva/lib/Node'; import React from 'react'; diff --git a/src/features/cseMachine/CseMachineUtils.ts b/src/features/cseMachine/CseMachineUtils.ts index a14a467cd8..0caf6b594b 100644 --- a/src/features/cseMachine/CseMachineUtils.ts +++ b/src/features/cseMachine/CseMachineUtils.ts @@ -1,6 +1,6 @@ -import { estreeDecode } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/utils/encoder-visitor'; -import { unparse } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/utils/reverse_parser'; -import JsSlangClosure from 'js-slang/dist/cse-machine/closure'; +import { estreeDecode } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/utils/encoder-visitor'; +import { unparse } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/utils/reverse_parser'; +import JsSlangClosure from '@sourceacademy/js-slang/dist/cse-machine/closure'; import { AppInstr, ArrLitInstr, @@ -11,9 +11,9 @@ import { Instr, InstrType, UnOpInstr -} from 'js-slang/dist/cse-machine/types'; -import { Chapter, Environment, Value as StashValue } from 'js-slang/dist/types'; -import { astToString } from 'js-slang/dist/utils/ast/astToString'; +} from '@sourceacademy/js-slang/dist/cse-machine/types'; +import { Chapter, Environment, Value as StashValue } from '@sourceacademy/js-slang/dist/types'; +import { astToString } from '@sourceacademy/js-slang/dist/utils/ast/astToString'; import { Group } from 'konva/lib/Group'; import { Node } from 'konva/lib/Node'; import { Shape } from 'konva/lib/Shape'; @@ -570,7 +570,7 @@ export const truncateText = (programStr: string, maxWidth: number, maxHeight: nu /** * Typeguard for Instr to distinguish between program statements and instructions. - * The typeguard from js-slang cannot be used due to Typescript raising some weird errors + * The typeguard from @sourceacademy/js-slang cannot be used due to Typescript raising some weird errors * with circular dependencies so it is redefined here. * * @param command A ControlItem @@ -619,7 +619,7 @@ export function getControlItemComponent( } if (isSchemeLanguage(chapter)) { - // use the js-slang decoder on the control item + // use the @sourceacademy/js-slang decoder on the control item controlItem = estreeDecode(controlItem as any); const text = unparse(controlItem as any); return new ControlItemComponent( diff --git a/src/features/cseMachine/__tests__/CseMachine.test.tsx b/src/features/cseMachine/__tests__/CseMachine.test.tsx index 59d34a3b83..3649a5bd63 100644 --- a/src/features/cseMachine/__tests__/CseMachine.test.tsx +++ b/src/features/cseMachine/__tests__/CseMachine.test.tsx @@ -1,5 +1,5 @@ -import { runInContext } from 'js-slang/dist/'; -import createContext from 'js-slang/dist/createContext'; +import { runInContext } from '@sourceacademy/js-slang/dist/'; +import createContext from '@sourceacademy/js-slang/dist/createContext'; import { Binding } from '../components/Binding'; import { ControlItemComponent } from '../components/ControlItemComponent'; diff --git a/src/features/cseMachine/animationComponents/ArrayAccessAnimation.tsx b/src/features/cseMachine/animationComponents/ArrayAccessAnimation.tsx index 7219cafe92..d431f551f1 100644 --- a/src/features/cseMachine/animationComponents/ArrayAccessAnimation.tsx +++ b/src/features/cseMachine/animationComponents/ArrayAccessAnimation.tsx @@ -52,7 +52,7 @@ export class ArrayAccessAnimation extends Animatable { // the target should always be an array value const array = arrayItem.arrow!.target! as ArrayValue; - // if index access is out of range. if index access is negative, error should be thrown from js-slang at this point + // if index access is out of range. if index access is negative, error should be thrown from @sourceacademy/js-slang at this point const arraylen = array.data.length; if (parseInt(indexItem.text) >= arraylen) { diff --git a/src/features/cseMachine/components/ControlStack.tsx b/src/features/cseMachine/components/ControlStack.tsx index 01770ce3d1..cf90850268 100644 --- a/src/features/cseMachine/components/ControlStack.tsx +++ b/src/features/cseMachine/components/ControlStack.tsx @@ -1,7 +1,7 @@ -import { Control } from 'js-slang/dist/cse-machine/interpreter'; -import { ControlItem, Instr } from 'js-slang/dist/cse-machine/types'; -import { Chapter, StatementSequence } from 'js-slang/dist/types'; -import { Node } from 'js-slang/dist/types'; +import { Control } from '@sourceacademy/js-slang/dist/cse-machine/interpreter'; +import { ControlItem, Instr } from '@sourceacademy/js-slang/dist/cse-machine/types'; +import { Chapter, StatementSequence } from '@sourceacademy/js-slang/dist/types'; +import { Node } from '@sourceacademy/js-slang/dist/types'; import { KonvaEventObject } from 'konva/lib/Node'; import React from 'react'; import { Label, Tag, Text } from 'react-konva'; @@ -131,7 +131,7 @@ export class ControlStack extends Visible implements IHoverable { /** * Typeguard for Instr to distinguish between program statements and instructions. - * The typeguard from js-slang cannot be used due to Typescript raising some weird errors + * The typeguard from @sourceacademy/js-slang cannot be used due to Typescript raising some weird errors * with circular dependencies so it is redefined here. * * @param command A ControlItem @@ -143,7 +143,7 @@ export const isInstr = (command: ControlItem): command is Instr => { /** * Typeguard for esNode to distinguish between program statements and instructions. - * The typeguard from js-slang cannot be used due to Typescript raising some weird errors + * The typeguard from @sourceacademy/js-slang cannot be used due to Typescript raising some weird errors * with circular dependencies so it is redefined here. * * @param command A ControlItem diff --git a/src/features/cseMachine/components/StashStack.tsx b/src/features/cseMachine/components/StashStack.tsx index e4e2486c79..a29a39e08a 100644 --- a/src/features/cseMachine/components/StashStack.tsx +++ b/src/features/cseMachine/components/StashStack.tsx @@ -1,5 +1,5 @@ -import { Stash } from 'js-slang/dist/cse-machine/interpreter'; -import { Chapter, Value } from 'js-slang/dist/types'; +import { Stash } from '@sourceacademy/js-slang/dist/cse-machine/interpreter'; +import { Chapter, Value } from '@sourceacademy/js-slang/dist/types'; import React from 'react'; import CseMachine from '../CseMachine'; diff --git a/src/features/cseMachine/components/values/ContValue.tsx b/src/features/cseMachine/components/values/ContValue.tsx index 0e54531631..0b55895ce6 100644 --- a/src/features/cseMachine/components/values/ContValue.tsx +++ b/src/features/cseMachine/components/values/ContValue.tsx @@ -1,5 +1,5 @@ -import { Control, Stash } from 'js-slang/dist/cse-machine/interpreter'; -import { Environment } from 'js-slang/dist/types'; +import { Control, Stash } from '@sourceacademy/js-slang/dist/cse-machine/interpreter'; +import { Environment } from '@sourceacademy/js-slang/dist/types'; import { KonvaEventObject } from 'konva/lib/Node'; import { Label } from 'konva/lib/shapes/Label'; import React, { RefObject } from 'react'; diff --git a/src/features/cseMachine/components/values/PrimitiveValue.tsx b/src/features/cseMachine/components/values/PrimitiveValue.tsx index d4720a2da4..d76f34aba3 100644 --- a/src/features/cseMachine/components/values/PrimitiveValue.tsx +++ b/src/features/cseMachine/components/values/PrimitiveValue.tsx @@ -1,5 +1,5 @@ -import { _Symbol } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base'; -import { SchemeNumber } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/core-math'; +import { _Symbol } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base'; +import { SchemeNumber } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/core-math'; import React from 'react'; import { Config } from '../../CseMachineConfig'; diff --git a/src/features/cseMachine/utils/altLangs.ts b/src/features/cseMachine/utils/altLangs.ts index 3d1e0fd78a..617b836471 100644 --- a/src/features/cseMachine/utils/altLangs.ts +++ b/src/features/cseMachine/utils/altLangs.ts @@ -1,7 +1,7 @@ // alternate representations of data types -import { ControlItem } from 'js-slang/dist/cse-machine/types'; -import { Chapter, Node } from 'js-slang/dist/types'; +import { ControlItem } from '@sourceacademy/js-slang/dist/cse-machine/types'; +import { Chapter, Node } from '@sourceacademy/js-slang/dist/types'; import { isSchemeLanguage } from 'src/commons/application/ApplicationTypes'; import { ControlItemComponent } from '../components/ControlItemComponent'; diff --git a/src/features/cseMachine/utils/scheme.ts b/src/features/cseMachine/utils/scheme.ts index 383188fd8c..ef544fd4eb 100644 --- a/src/features/cseMachine/utils/scheme.ts +++ b/src/features/cseMachine/utils/scheme.ts @@ -1,13 +1,13 @@ -import { schemeVisualise } from 'js-slang/dist/alt-langs/scheme/scheme-mapper'; -import { _Symbol } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base'; -import { SchemeNumber } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/core-math'; -import { estreeDecode } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/utils/encoder-visitor'; -import { unparse } from 'js-slang/dist/alt-langs/scheme/scm-slang/src/utils/reverse_parser'; -import { List, Pair } from 'js-slang/dist/stdlib/list'; -import { Node } from 'js-slang/dist/types'; +import { schemeVisualise } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scheme-mapper'; +import { _Symbol } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/base'; +import { SchemeNumber } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/stdlib/core-math'; +import { estreeDecode } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/utils/encoder-visitor'; +import { unparse } from '@sourceacademy/js-slang/dist/alt-langs/scheme/scm-slang/src/utils/reverse_parser'; +import { List, Pair } from '@sourceacademy/js-slang/dist/stdlib/list'; +import { Node } from '@sourceacademy/js-slang/dist/types'; import { Continuation } from './scheme'; -export { Continuation } from 'js-slang/dist/cse-machine/continuations'; +export { Continuation } from '@sourceacademy/js-slang/dist/cse-machine/continuations'; export function isPair(data: any): data is Pair { return data instanceof Array && data.length === 2; diff --git a/src/features/eventLogging/index.ts b/src/features/eventLogging/index.ts index 9e8010cf71..bc17f655fc 100644 --- a/src/features/eventLogging/index.ts +++ b/src/features/eventLogging/index.ts @@ -1,4 +1,4 @@ -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { v4 as uuid } from 'uuid'; import { ExternalLibraryName } from '../../commons/application/types/ExternalTypes'; diff --git a/src/features/fullJS/fullJSHighlight.js b/src/features/fullJS/fullJSHighlight.js index b898a80558..76797f33ed 100644 --- a/src/features/fullJS/fullJSHighlight.js +++ b/src/features/fullJS/fullJSHighlight.js @@ -1,6 +1,6 @@ /* eslint-disable */ import * as ace from 'ace-builds/src-noconflict/ace'; -import { Variant } from 'js-slang/dist/types'; +import { Variant } from '@sourceacademy/js-slang/dist/types'; export function HighlightRulesSelector_native( id, diff --git a/src/features/game/scenes/roomPreview/RoomPreview.ts b/src/features/game/scenes/roomPreview/RoomPreview.ts index 1970a1aaa4..2122ac2a48 100644 --- a/src/features/game/scenes/roomPreview/RoomPreview.ts +++ b/src/features/game/scenes/roomPreview/RoomPreview.ts @@ -1,5 +1,5 @@ -import { Context, runInContext } from 'js-slang'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Context, runInContext } from '@sourceacademy/js-slang'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { createContext } from 'src/commons/utils/JsSlangHelper'; import ImageAssets from '../../assets/ImageAssets'; diff --git a/src/features/remoteExecution/RemoteExecutionTypes.ts b/src/features/remoteExecution/RemoteExecutionTypes.ts index bc037e0f6a..c44b59711c 100644 --- a/src/features/remoteExecution/RemoteExecutionTypes.ts +++ b/src/features/remoteExecution/RemoteExecutionTypes.ts @@ -1,5 +1,5 @@ import { SlingClient } from '@sourceacademy/sling-client'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibraryName } from 'src/commons/application/types/ExternalTypes'; import { WorkspaceLocation } from 'src/commons/workspace/WorkspaceTypes'; diff --git a/src/features/sicp/SourceTheme.ts b/src/features/sicp/SourceTheme.ts index 382f62f6f3..0b77069b88 100644 --- a/src/features/sicp/SourceTheme.ts +++ b/src/features/sicp/SourceTheme.ts @@ -2,7 +2,7 @@ import React from 'react'; /** * Source Theme for use with react-syntax-highlighter. - * Tries to match the Source Theme for Ace Editor in js-slang + * Tries to match the Source Theme for Ace Editor in @sourceacademy/js-slang */ const SourceThemeBackground = '#2c3e50'; diff --git a/src/features/sourceRecorder/SourceRecorderTypes.ts b/src/features/sourceRecorder/SourceRecorderTypes.ts index 016c501746..d6f2d777f5 100644 --- a/src/features/sourceRecorder/SourceRecorderTypes.ts +++ b/src/features/sourceRecorder/SourceRecorderTypes.ts @@ -1,5 +1,5 @@ import { Ace } from 'ace-builds'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibraryName } from '../../commons/application/types/ExternalTypes'; import { Position } from '../../commons/editor/EditorTypes'; diff --git a/src/features/sourceRecorder/__tests__/SourceRecorderActions.test.ts b/src/features/sourceRecorder/__tests__/SourceRecorderActions.test.ts index fd4268308c..df1e27d1ac 100644 --- a/src/features/sourceRecorder/__tests__/SourceRecorderActions.test.ts +++ b/src/features/sourceRecorder/__tests__/SourceRecorderActions.test.ts @@ -1,4 +1,4 @@ -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibraryName } from '../../../commons/application/types/ExternalTypes'; import { WorkspaceLocation } from '../../../commons/workspace/WorkspaceTypes'; diff --git a/src/features/sourceRecorder/sourcecast/__tests__/SourcecastReducer.test.ts b/src/features/sourceRecorder/sourcecast/__tests__/SourcecastReducer.test.ts index 7a446cee93..40d91876f7 100644 --- a/src/features/sourceRecorder/sourcecast/__tests__/SourcecastReducer.test.ts +++ b/src/features/sourceRecorder/sourcecast/__tests__/SourcecastReducer.test.ts @@ -1,5 +1,5 @@ import { createAction } from '@reduxjs/toolkit'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { SourceActionType } from 'src/commons/utils/ActionsHelper'; import { defaultWorkspaceManager } from '../../../../commons/application/ApplicationTypes'; diff --git a/src/features/sourceRecorder/sourcereel/__tests__/SourcereelActions.test.ts b/src/features/sourceRecorder/sourcereel/__tests__/SourcereelActions.test.ts index fe91ab6db5..8627893940 100644 --- a/src/features/sourceRecorder/sourcereel/__tests__/SourcereelActions.test.ts +++ b/src/features/sourceRecorder/sourcereel/__tests__/SourcereelActions.test.ts @@ -1,4 +1,4 @@ -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { ExternalLibraryName } from '../../../../commons/application/types/ExternalTypes'; import { WorkspaceLocation } from '../../../../commons/workspace/WorkspaceTypes'; diff --git a/src/features/sourceRecorder/sourcereel/__tests__/SourcereelReducer.test.ts b/src/features/sourceRecorder/sourcereel/__tests__/SourcereelReducer.test.ts index da781f0015..35b56c6da8 100644 --- a/src/features/sourceRecorder/sourcereel/__tests__/SourcereelReducer.test.ts +++ b/src/features/sourceRecorder/sourcereel/__tests__/SourcereelReducer.test.ts @@ -1,5 +1,5 @@ import { createAction } from '@reduxjs/toolkit'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { SourceActionType } from 'src/commons/utils/ActionsHelper'; import { defaultWorkspaceManager } from '../../../../commons/application/ApplicationTypes'; diff --git a/src/features/stories/StoriesActions.ts b/src/features/stories/StoriesActions.ts index ae90e48a81..8acf088967 100644 --- a/src/features/stories/StoriesActions.ts +++ b/src/features/stories/StoriesActions.ts @@ -1,4 +1,4 @@ -import { Chapter, Context, SourceError, Value, Variant } from 'js-slang/dist/types'; +import { Chapter, Context, SourceError, Value, Variant } from '@sourceacademy/js-slang/dist/types'; import { StoriesRole } from 'src/commons/application/ApplicationTypes'; import { createActions } from 'src/commons/redux/utils'; diff --git a/src/features/stories/StoriesTypes.ts b/src/features/stories/StoriesTypes.ts index 3f524a6472..933dab7a27 100644 --- a/src/features/stories/StoriesTypes.ts +++ b/src/features/stories/StoriesTypes.ts @@ -1,4 +1,4 @@ -import { Context } from 'js-slang'; +import { Context } from '@sourceacademy/js-slang'; import { DebuggerContext } from 'src/commons/workspace/WorkspaceTypes'; import { InterpreterOutput, StoriesRole } from '../../commons/application/ApplicationTypes'; diff --git a/src/features/stories/__tests__/StoriesActions.test.ts b/src/features/stories/__tests__/StoriesActions.test.ts index dc7a35efc9..bd25e2a877 100644 --- a/src/features/stories/__tests__/StoriesActions.test.ts +++ b/src/features/stories/__tests__/StoriesActions.test.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import StoriesActions from '../StoriesActions'; diff --git a/src/features/stories/storiesComponents/SourceBlock.tsx b/src/features/stories/storiesComponents/SourceBlock.tsx index 86ecd97114..edcb3d2515 100644 --- a/src/features/stories/storiesComponents/SourceBlock.tsx +++ b/src/features/stories/storiesComponents/SourceBlock.tsx @@ -1,6 +1,6 @@ import { Card, Classes } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React, { useEffect, useRef, useState } from 'react'; import AceEditor from 'react-ace'; import { useDispatch } from 'react-redux'; diff --git a/src/features/stories/storiesComponents/UserBlogContent.tsx b/src/features/stories/storiesComponents/UserBlogContent.tsx index b02720e34b..84b2ff9c3e 100644 --- a/src/features/stories/storiesComponents/UserBlogContent.tsx +++ b/src/features/stories/storiesComponents/UserBlogContent.tsx @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import yaml from 'js-yaml'; import React, { useEffect, useState } from 'react'; import debounceRender from 'react-debounce-render'; diff --git a/src/features/vscode/messages.ts b/src/features/vscode/messages.ts index c5e80a00d6..f76d5bc556 100644 --- a/src/features/vscode/messages.ts +++ b/src/features/vscode/messages.ts @@ -3,7 +3,7 @@ // Ideally it is split into multiple files, but for ease of copying, it is kept as one file. /** A subset of the WorkspaceLocation type found in source-academy/frontend */ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; const VscWorkspaceLocationArray = ['assessment', 'playground']; export const isVscWorkspaceLocation = (s: any) => VscWorkspaceLocationArray.includes(s); diff --git a/src/index.tsx b/src/index.tsx index 203f2e55dc..f8e326c290 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,7 +2,7 @@ import 'src/i18n/i18n'; import 'src/styles/index.scss'; import { Button, OverlaysProvider } from '@blueprintjs/core'; -import { setModulesStaticURL } from 'js-slang/dist/modules/loader'; +import { setModulesStaticURL } from '@sourceacademy/js-slang/dist/modules/loader'; import { createRoot } from 'react-dom/client'; import { Provider } from 'react-redux'; import Constants, { Links } from 'src/commons/utils/Constants'; diff --git a/src/pages/__tests__/createStore.test.ts b/src/pages/__tests__/createStore.test.ts index c4d96b0c7c..7afd5a51f8 100644 --- a/src/pages/__tests__/createStore.test.ts +++ b/src/pages/__tests__/createStore.test.ts @@ -1,4 +1,4 @@ -import { Variant } from 'js-slang/dist/types'; +import { Variant } from '@sourceacademy/js-slang/dist/types'; import { compressToUTF16 } from 'lz-string'; import { diff --git a/src/pages/academy/grading/subcomponents/GradingWorkspace.tsx b/src/pages/academy/grading/subcomponents/GradingWorkspace.tsx index b9a11c13db..c9ea00479f 100644 --- a/src/pages/academy/grading/subcomponents/GradingWorkspace.tsx +++ b/src/pages/academy/grading/subcomponents/GradingWorkspace.tsx @@ -1,7 +1,7 @@ import { Classes, NonIdealState, Spinner, SpinnerSize } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React, { useEffect, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import { useNavigate } from 'react-router'; diff --git a/src/pages/academy/groundControl/subcomponents/DefaultChapterSelect.tsx b/src/pages/academy/groundControl/subcomponents/DefaultChapterSelect.tsx index b8fcca0747..b68d5a1d96 100644 --- a/src/pages/academy/groundControl/subcomponents/DefaultChapterSelect.tsx +++ b/src/pages/academy/groundControl/subcomponents/DefaultChapterSelect.tsx @@ -9,7 +9,7 @@ import { } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import { ItemListRenderer, ItemRenderer, Select } from '@blueprintjs/select'; -import { Variant } from 'js-slang/dist/types'; +import { Variant } from '@sourceacademy/js-slang/dist/types'; import React, { useCallback, useState } from 'react'; import { useDispatch } from 'react-redux'; import Constants from 'src/commons/utils/Constants'; diff --git a/src/pages/academy/sourcereel/Sourcereel.tsx b/src/pages/academy/sourcereel/Sourcereel.tsx index 5fe21aabe3..3a7e0e11bd 100644 --- a/src/pages/academy/sourcereel/Sourcereel.tsx +++ b/src/pages/academy/sourcereel/Sourcereel.tsx @@ -1,7 +1,7 @@ import { Classes, Pre } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import React, { useEffect, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import InterpreterActions from 'src/commons/application/actions/InterpreterActions'; diff --git a/src/pages/localStorage.ts b/src/pages/localStorage.ts index 56b1b30a4f..1739c6bd20 100644 --- a/src/pages/localStorage.ts +++ b/src/pages/localStorage.ts @@ -1,4 +1,4 @@ -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { compressToUTF16, decompressFromUTF16 } from 'lz-string'; import { StoriesAuthState } from 'src/features/stories/StoriesTypes'; diff --git a/src/pages/playground/Playground.tsx b/src/pages/playground/Playground.tsx index b664d3b24d..d32c882868 100644 --- a/src/pages/playground/Playground.tsx +++ b/src/pages/playground/Playground.tsx @@ -6,7 +6,7 @@ import type { SharedbAceUser } from '@sourceacademy/sharedb-ace/types'; import { Ace, Range } from 'ace-builds'; import type { FSModule } from 'browserfs/dist/node/core/FS'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { isEqual } from 'lodash'; import { decompressFromEncodedURIComponent } from 'lz-string'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; diff --git a/src/pages/playground/__tests__/Playground.test.tsx b/src/pages/playground/__tests__/Playground.test.tsx index f7799938d2..60fd5f6f4f 100644 --- a/src/pages/playground/__tests__/Playground.test.tsx +++ b/src/pages/playground/__tests__/Playground.test.tsx @@ -1,7 +1,7 @@ import { Dispatch, Store } from '@reduxjs/toolkit'; import { render } from '@testing-library/react'; import { FSModule } from 'browserfs/dist/node/core/FS'; -import { Chapter } from 'js-slang/dist/types'; +import { Chapter } from '@sourceacademy/js-slang/dist/types'; import { act } from 'react'; import { Provider } from 'react-redux'; import { createMemoryRouter, RouteObject, RouterProvider } from 'react-router'; diff --git a/src/pages/sicp/subcomponents/CodeSnippet.tsx b/src/pages/sicp/subcomponents/CodeSnippet.tsx index 0abfa7fa68..dcb4ff2b42 100644 --- a/src/pages/sicp/subcomponents/CodeSnippet.tsx +++ b/src/pages/sicp/subcomponents/CodeSnippet.tsx @@ -1,5 +1,5 @@ import { Card, Elevation, Pre } from '@blueprintjs/core'; -import { HighlightRulesSelector, ModeSelector } from 'js-slang/dist/editors/ace/modes/source'; +import { HighlightRulesSelector, ModeSelector } from '@sourceacademy/js-slang/dist/editors/ace/modes/source'; import { Resizable } from 're-resizable'; import React from 'react'; import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter'; diff --git a/src/pages/sourcecast/Sourcecast.tsx b/src/pages/sourcecast/Sourcecast.tsx index 7d7c9e6cc3..5dbddc5b2d 100644 --- a/src/pages/sourcecast/Sourcecast.tsx +++ b/src/pages/sourcecast/Sourcecast.tsx @@ -1,7 +1,7 @@ import { Classes, Pre } from '@blueprintjs/core'; import { IconNames } from '@blueprintjs/icons'; import classNames from 'classnames'; -import { Chapter, Variant } from 'js-slang/dist/types'; +import { Chapter, Variant } from '@sourceacademy/js-slang/dist/types'; import { useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; diff --git a/src/pages/stories/Story.tsx b/src/pages/stories/Story.tsx index 676eb59cc1..bed21412eb 100644 --- a/src/pages/stories/Story.tsx +++ b/src/pages/stories/Story.tsx @@ -1,4 +1,4 @@ -import 'js-slang/dist/editors/ace/theme/source'; +import '@sourceacademy/js-slang/dist/editors/ace/theme/source'; import { Classes, InputGroup } from '@blueprintjs/core'; import classNames from 'classnames'; diff --git a/yarn.lock b/yarn.lock index 9f757eec8f..c644cb3aec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3335,10 +3335,34 @@ __metadata: languageName: node linkType: hard -"@sourceacademy/conductor@https://github.com/source-academy/conductor.git#0.2.1": - version: 0.2.1 - resolution: "@sourceacademy/conductor@https://github.com/source-academy/conductor.git#commit=d933713f5ae5b822e4f521872a5d9cb46d79b5df" - checksum: 10c0/25dc10930f15010dc6bf6f01d622de0c4bde707892c3bd9d5e221efa9f2d03aac5e8cf27036c4c57ac628b9d140fb6a3d5da3f6ed946faca0fef65d2af8ba514 +"@sourceacademy/conductor@npm:^0.2.3": + version: 0.2.3 + resolution: "@sourceacademy/conductor@npm:0.2.3" + checksum: 10c0/f6251017a6ed95ea4854a67f6b302934e1023bb256e15f93da8b1a55a95df082d88ba93813b5476445f4f82825dd2b7f44cdb1b20ae7815f9f8a8e6eb7816621 + languageName: node + linkType: hard + +"@sourceacademy/js-slang@npm:^1.0.85": + version: 1.0.86 + resolution: "@sourceacademy/js-slang@npm:1.0.86" + dependencies: + "@babel/parser": "npm:^7.19.4" + "@commander-js/extra-typings": "npm:^12.0.1" + "@joeychenofficial/alt-ergo-modified": "npm:^2.4.0" + "@ts-morph/bootstrap": "npm:^0.18.0" + "@types/estree": "npm:^1.0.5" + acorn: "npm:^8.8.2" + acorn-class-fields: "npm:^1.0.0" + acorn-loose: "npm:^8.0.0" + acorn-walk: "npm:^8.0.0" + astring: "npm:^1.4.3" + commander: "npm:^12.0.0" + js-base64: "npm:^3.7.5" + lodash: "npm:^4.17.21" + source-map: "npm:0.7.6" + bin: + js-slang: dist/repl/index.js + checksum: 10c0/ce7bbf66deb7fbb2206c498f238f38aa4e985a3016a4b876d6fdaa3efbd21f73249965f1fbb95cdf26f318c045071492ed1c15c44c9ae3ca955d53374c3bc55b languageName: node linkType: hard @@ -7634,7 +7658,8 @@ __metadata: "@rsbuild/plugin-svgr": "npm:^1.2.0" "@sentry/react": "npm:^10.5.0" "@sourceacademy/c-slang": "npm:^1.0.21" - "@sourceacademy/conductor": "https://github.com/source-academy/conductor.git#0.2.1" + "@sourceacademy/conductor": "npm:^0.2.3" + "@sourceacademy/js-slang": "npm:^1.0.85" "@sourceacademy/language-directory": "https://github.com/source-academy/language-directory.git#0.0.4" "@sourceacademy/plugin-directory": "https://github.com/source-academy/plugin-directory.git#0.0.2" "@sourceacademy/sharedb-ace": "npm:2.1.1" @@ -7700,7 +7725,6 @@ __metadata: immer: "npm:^9.0.21" java-slang: "npm:^1.0.13" js-cookie: "npm:^3.0.5" - js-slang: "npm:^1.0.85" js-yaml: "npm:^4.1.0" jsdom: "npm:^26.0.0" konva: "npm:^9.2.0" @@ -9122,30 +9146,6 @@ __metadata: languageName: node linkType: hard -"js-slang@npm:^1.0.85": - version: 1.0.85 - resolution: "js-slang@npm:1.0.85" - dependencies: - "@babel/parser": "npm:^7.19.4" - "@commander-js/extra-typings": "npm:^12.0.1" - "@joeychenofficial/alt-ergo-modified": "npm:^2.4.0" - "@ts-morph/bootstrap": "npm:^0.18.0" - "@types/estree": "npm:^1.0.5" - acorn: "npm:^8.8.2" - acorn-class-fields: "npm:^1.0.0" - acorn-loose: "npm:^8.0.0" - acorn-walk: "npm:^8.0.0" - astring: "npm:^1.4.3" - commander: "npm:^12.0.0" - js-base64: "npm:^3.7.5" - lodash: "npm:^4.17.21" - source-map: "npm:0.7.6" - bin: - js-slang: dist/repl/index.js - checksum: 10c0/8a206d6052e5b23a27bda4aef66675b4b7f9bebde936c789a182948478e26fa7aee6289effd0d867725a939e14674ee59fd218e1bec1fd1dc597b6bf7cbbaf42 - languageName: node - linkType: hard - "js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0"