Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "module",
"devDependencies": {
"@sourceacademy/modules-repotools": "workspace:^",
"@types/lodash": "^4.14.198",
"@types/node": "^22.15.30",
"typescript": "^5.8.2",
"vitest": "^4.0.18"
Expand All @@ -14,7 +13,7 @@
"@actions/artifact": "^6.0.0",
"@actions/core": "^1.11.1",
"@actions/exec": "^3.0.0",
"lodash": "^4.17.23",
"es-toolkit": "^1.44.0",
"snyk-nodejs-lockfile-parser": "^2.4.2"
},
"scripts": {
Expand Down
10 changes: 7 additions & 3 deletions .github/actions/src/__tests__/commons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import * as exec from '@actions/exec';
import { describe, expect, it, test, vi } from 'vitest';
import * as commons from '../commons.js';

vi.mock(import('lodash/memoize.js'), () => ({
default: (x: any) => x
}) as any);
vi.mock(import('es-toolkit'), async (importOriginal) => {
const actual = await importOriginal();
return {
...actual,
memoize: (x: any) => x
};
});

const mockedExecOutput = vi.spyOn(exec, 'getExecOutput');

Expand Down
12 changes: 6 additions & 6 deletions .github/actions/src/__tests__/sample_why.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/src/commons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getExecOutput } from '@actions/exec';
import memoize from 'lodash/memoize.js';
import { memoize } from 'es-toolkit';

export interface RawPackageRecord {
directory: string;
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/src/info/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const mockDirectory: Record<string, string | Record<string, unknown>> = {
'package.json': JSON.stringify({
name: '@sourceacademy/tab-Tab0',
dependencies: {
lodash: '^4.1.1',
'lodash': '^4.17.20',
'@sourceacademy/bundle-bundle0': 'workspace:^',
},
devDependencies: {
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/src/lockfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs/promises';
import pathlib from 'path';
import * as core from '@actions/core';
import { getExecOutput } from '@actions/exec';
import memoize from 'lodash/memoize.js';
import { memoize } from 'es-toolkit';
import { extractPkgsFromYarnLockV2 } from 'snyk-nodejs-lockfile-parser';
import { gitRoot } from './gitRoot.js';

Expand Down
4 changes: 2 additions & 2 deletions devserver/src/components/ControlButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnchorButton, Button, Icon, Intent, type IconName } from '@blueprintjs/core';
import { AnchorButton, Button, Icon, Intent, type IconProps } from '@blueprintjs/core';
import React from 'react';

type ButtonOptions = {
Expand All @@ -13,7 +13,7 @@ type ButtonOptions = {

type ControlButtonProps = {
label?: string;
icon?: IconName;
icon?: IconProps['icon'];
onClick?: () => void;
options?: Partial<ButtonOptions>;
isDisabled?: boolean;
Expand Down
11 changes: 9 additions & 2 deletions devserver/src/components/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Button, Classes, Intent, OverlayToaster, Popover, Tooltip, type ToastProps } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import { Settings } from '@blueprintjs/icons';
import classNames from 'classnames';
import { SourceDocumentation, getNames, runInContext, type Context } from 'js-slang';
// Importing this straight from js-slang doesn't work for whatever reason
import createContext from 'js-slang/dist/createContext';
import { ModuleInternalError } from 'js-slang/dist/modules/errors';
import { setModulesStaticURL } from 'js-slang/dist/modules/loader';
import { Chapter, Variant } from 'js-slang/dist/types';
import { stringify } from 'js-slang/dist/utils/stringify';
Expand Down Expand Up @@ -159,6 +160,12 @@ const Playground: React.FC = () => {
value: stringify(result.value)
});
} else if (result.status === 'error') {
codeContext.errors.forEach(error => {
if (error instanceof ModuleInternalError) {
console.error(error.error);
}
});

setReplOutput({
type: 'errors',
errors: codeContext.errors,
Expand Down Expand Up @@ -210,7 +217,7 @@ const Playground: React.FC = () => {
<Tooltip content="Settings">
<Button
{...targetProps}
icon={IconNames.SETTINGS}
icon={<Settings />}
/>
</Tooltip>
);
Expand Down
4 changes: 2 additions & 2 deletions devserver/src/components/controlBar/ControlBarClearButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tooltip } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import { Trash } from '@blueprintjs/icons';
import ControlButton from '../ControlButton';

type Props = {
Expand All @@ -9,7 +9,7 @@ type Props = {
export const ControlBarClearButton = (props: Props) => <Tooltip content="Clear the editor and context">
<ControlButton
label="Clear"
icon={IconNames.Trash}
icon={<Trash />}
onClick={props.onClick}
/>
</Tooltip>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tooltip } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import { Refresh } from '@blueprintjs/icons';
import ControlButton from '../ControlButton';

type Props = {
Expand All @@ -9,7 +9,7 @@ type Props = {
export const ControlBarRefreshButton = (props: Props) => <Tooltip content="Manually refresh the side content">
<ControlButton
onClick={props.onClick}
icon={IconNames.Refresh}
icon={<Refresh />}
label="Refresh"
/>
</Tooltip>;
4 changes: 2 additions & 2 deletions devserver/src/components/controlBar/ControlBarRunButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Position, Tooltip } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import { Play } from '@blueprintjs/icons';
import React from 'react';

import ControlButton from '../ControlButton';
Expand All @@ -22,7 +22,7 @@ export const ControlBarRunButton: React.FC<ControlButtonRunButtonProps> = (props
<Tooltip content={tooltipContent} placement={Position.TOP}>
<ControlButton
label="Run"
icon={IconNames.PLAY}
icon={<Play />}
onClick={props.handleEditorEval}
options={{
iconColor: props.color,
Expand Down
1 change: 1 addition & 0 deletions devserver/src/components/sideContent/SideContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const renderTab = (
) => {
const tabProps: TabProps = {
id: tab.id,
// @ts-expect-error Disable until we migrate tabs to the new icon format?
title: <TabIcon iconName={tab.iconName} tooltip={tab.label} shouldAlert={shouldAlert} />,
// disabled: tab.disabled,
className: 'side-content-tab'
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/2-bundle/3-editing.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ You can also add the dependency directly by modifying your `package.json`:
{
"name": "@sourceacademy/bundle-bundle0",
"dependencies": {
"lodash": "^4.0.0"
"es-toolkit": "^1.44.0"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/3-tabs/3-editing.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ You can also add the dependency directly by modifying your `package.json`:
{
"name": "@sourceacademy/tab-Tab0",
"dependencies": {
"lodash": "^4.0.0"
"es-toolkit": "^1.44.0"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export default defineConfig(
// disable in the CI since we don't install packages so all node packages
// become unresolvable
process.env.CI ? 'off' : 'error',
{ ignore: [ 'js-slang/context', '^virtual:.+$' ] }
{ ignore: ['js-slang/context', '^virtual:.+$'] }
],

'jsdoc/no-types': 'warn',
Expand Down
3 changes: 1 addition & 2 deletions lib/buildtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@commander-js/extra-typings": "^14.0.0",
"@types/estree": "^1.0.0",
"@types/http-server": "^0.12.4",
"@types/lodash": "^4.14.198",
"@types/node": "^22.15.30",
"typescript": "^5.8.2"
},
Expand All @@ -26,11 +25,11 @@
"astring": "^1.8.6",
"chalk": "^5.0.1",
"commander": "^14.0.0",
"es-toolkit": "^1.44.0",
"esbuild": "^0.27.0",
"eslint": "^9.35.0",
"http-server": "^14.1.1",
"jsdom": "^26.1.0",
"lodash": "^4.17.23",
"typedoc": "^0.28.9",
"vite": "^7.1.11",
"vitest": "^4.0.18"
Expand Down
2 changes: 1 addition & 1 deletion lib/buildtools/src/commands/commandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { InvalidArgumentError, Option } from '@commander-js/extra-typings';
import type { ErrorResult, Severity } from '@sourceacademy/modules-repotools/types';
import { isSeverity, objectKeys, objectValues } from '@sourceacademy/modules-repotools/utils';
import chalk from 'chalk';
import capitalize from 'lodash/capitalize.js';
import { capitalize } from 'es-toolkit';
import { LogLevel } from 'typedoc';

export const lintOption = new Option('--lint', 'Run ESLint when building')
Expand Down
8 changes: 4 additions & 4 deletions lib/buildtools/src/commands/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from '@commander-js/extra-typings';
import { bundlesDir, tabsDir } from '@sourceacademy/modules-repotools/getGitRoot';
import { resolveAllBundles, resolveAllTabs, resolveSingleBundle, resolveSingleTab } from '@sourceacademy/modules-repotools/manifest';
import chalk from 'chalk';
import omit from 'lodash/omit.js';
import { omit } from 'es-toolkit';
import { logCommandErrorAndExit } from './commandUtils.js';

export const getListBundlesCommand = () => new Command('bundle')
Expand All @@ -23,7 +23,7 @@ export const getListBundlesCommand = () => new Command('bundle')
return;
}

const bundlesStr = bundleNames.map((each, i) => `${i+1}. ${each}`).join('\n');
const bundlesStr = bundleNames.map((each, i) => `${i + 1}. ${each}`).join('\n');
console.log(`${chalk.magentaBright(`Detected ${bundleNames.length} bundles in ${bundlesDir}:`)}\n${bundlesStr}`);
} else {
logCommandErrorAndExit(`No bundles in ${bundlesDir}!`);
Expand All @@ -49,7 +49,7 @@ export const getListTabsCommand = () => new Command('tabs')
return;
}

const tabsStr = tabNames.map((each, i) => `${i+1}. ${each}`).join('\n');
const tabsStr = tabNames.map((each, i) => `${i + 1}. ${each}`).join('\n');
console.log(`${chalk.magentaBright(`Detected ${tabNames.length} tabs in ${tabsDir}:`)}\n${tabsStr}`);
} else {
logCommandErrorAndExit(`No tabs in ${tabsDir}`);
Expand All @@ -73,7 +73,7 @@ export const getValidateCommand = () => new Command('validate')
} else if (manifestResult.severity === 'error') {
logCommandErrorAndExit(manifestResult);
} else {
const bundle = omit(manifestResult.bundle, 'type');
const bundle = omit(manifestResult.bundle, ['type']);
const manifestStr = JSON.stringify(bundle, null, 2);
console.log(`${chalk.magentaBright(`Bundle '${manifestResult.bundle.name}' found in ${directory}`)}:\n${manifestStr}`);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/buildtools/src/templates/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import pathlib from 'path';
import type { Interface } from 'readline/promises';
import { getBundleManifests } from '@sourceacademy/modules-repotools/manifest';
import type { BundleManifest, ModulesManifest } from '@sourceacademy/modules-repotools/types';
import omit from 'lodash/omit.js';
import { omit } from 'es-toolkit/object';
import _package from '../../../../package.json' with { type: 'json' };
import { formatResult } from '../build/formatter.js';
import { askQuestion, error, success, warn } from './print.js';
Expand Down Expand Up @@ -79,7 +79,7 @@ export async function addNew(bundlesDir: string, tabsDir: string, rl: Interface)
};

// Version property gets stored in package.json, not manifest.json
const requiredProperties = omit(manifest[moduleName], 'version');
const requiredProperties = omit(manifest[moduleName], ['version']);

const newManifest: BundleManifest = {
...requiredProperties,
Expand Down
8 changes: 4 additions & 4 deletions lib/lintplugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"globals": "^17.0.0",
"typescript-eslint": "^8.33.1"
"typescript-eslint": "^8.56.1"
},
"devDependencies": {
"@eslint/markdown": "^7.5.1",
"@sourceacademy/modules-buildtools": "workspace:^",
"@sourceacademy/modules-repotools": "workspace:^",
"@stylistic/eslint-plugin": "^5.0.0",
"@typescript-eslint/rule-tester": "^8.53.1",
"@typescript-eslint/utils": "^8.53.1",
"@typescript-eslint/rule-tester": "^8.56.1",
"@typescript-eslint/utils": "^8.56.1",
"@vitest/eslint-plugin": "^1.6.6",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsdoc": "^62.0.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"globals": "^17.0.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.53.1"
"typescript-eslint": "^8.56.1"
},
"scripts": {
"build": "node ./build.js",
Expand Down
3 changes: 1 addition & 2 deletions lib/markdown-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"devDependencies": {
"@sourceacademy/modules-buildtools": "workspace:^",
"@sourceacademy/modules-repotools": "workspace:^",
"@types/lodash": "^4.14.198",
"@types/markdown-it": "^14.1.2",
"shiki": "^3.15.0",
"typescript": "^5.8.2"
Expand All @@ -23,7 +22,7 @@
"shiki": ">=2"
},
"dependencies": {
"lodash": "^4.17.23",
"es-toolkit": "^1.44.0",
"tm-themes": "^1.10.12",
"yaml": "^2.8.0"
},
Expand Down
11 changes: 4 additions & 7 deletions lib/markdown-tree/src/tree.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Adapted from: https://gitlab.com/nfriend/tree-online/-/tree/master?ref_type=heads

import type { RecursiveArray } from 'lodash';
import defaultsDeep from 'lodash/defaultsDeep';
import flattenDeep from 'lodash/flattenDeep';
import last from 'lodash/last';
import { flattenDeep, last } from 'es-toolkit';
import type { FileStructure } from './types';

/**
Expand Down Expand Up @@ -73,11 +70,11 @@ export function generateTree(
commentLoc: number,
options?: GenerateTreeOptions
): string {
const combinedOptions = defaultsDeep({}, options, defaultOptions);
const combinedOptions = { ...defaultOptions, ...options };

return flattenDeep([
getAsciiLine(structure, commentLoc, combinedOptions),
structure.children.map(c => generateTree(c, commentLoc, options)) as RecursiveArray<string>,
structure.children.map(c => generateTree(c, commentLoc, options)),
])
// Remove null entries. Should only occur for the very first node
// when `options.rootDot === false`
Expand Down Expand Up @@ -161,7 +158,7 @@ const getName = (
nameChunks.unshift(
getName(
structure.parent,
defaultsDeep({}, { trailingDirSlash: true }, options),
{ ...{ trailingDirSlash: true }, ...options },
),
);
}
Expand Down
3 changes: 1 addition & 2 deletions lib/modules-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "module",
"devDependencies": {
"@sourceacademy/modules-buildtools": "workspace:^",
"@types/lodash": "^4.14.198",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^5.1.0",
Expand Down Expand Up @@ -34,8 +33,8 @@
"dependencies": {
"@blueprintjs/core": "^6.0.0",
"@blueprintjs/icons": "^6.0.0",
"es-toolkit": "^1.44.0",
"js-slang": "^1.0.85",
"lodash": "^4.17.23",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
Expand Down
4 changes: 2 additions & 2 deletions lib/modules-lib/src/tabs/AnimationCanvas.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Icon, Slider, Tooltip } from '@blueprintjs/core';
import { IconNames } from '@blueprintjs/icons';
import { Reset } from '@blueprintjs/icons';
import { useMemo, useState } from 'react';
import type { glAnimation } from '../types';
import AnimationError from './AnimationError';
Expand Down Expand Up @@ -71,7 +71,7 @@ export default function AnimationCanvas(props: AnimCanvasProps) {
disabled={Boolean(errored)}
onClick={reset}
>
<Icon icon={IconNames.RESET} />
<Icon icon={<Reset />} />
</ButtonComponent>
</Tooltip>
<Slider
Expand Down
Loading
Loading