diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 7d618d44..13234dce 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -24,7 +24,7 @@
*.json @quinn-dougherty @Hazelfire @berekuk @OAGr
*.y*ml @quinn-dougherty @berekuk @OAGr
*.config.js @Hazelfire @berekuk @OAGr
-netlify.toml @quinn-dougherty @OAGr @berekuk @Hazelfire
+vercel.json @OAGr @berekuk @Hazelfire
# Documentation
*.md @quinn-dougherty @OAGr @Hazelfire
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 70f41327..bbb6a7ee 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,4 +1,4 @@
-name: Squiggle packages check
+name: Squiggle packages checks
on:
push:
@@ -9,217 +9,38 @@ on:
branches:
- master
- develop
- - reducer-dev
- - epic-reducer-project
- - epic-0.5.0
+
+env:
+ TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
+ TURBO_TEAM: quantified-uncertainty
jobs:
- pre_check:
- name: Precheck for skipping redundant jobs
+ build-test-lint:
+ name: Build, test, lint
runs-on: ubuntu-latest
- outputs:
- should_skip_lang: ${{ steps.skip_lang_check.outputs.should_skip }}
- should_skip_components: ${{ steps.skip_components_check.outputs.should_skip }}
- should_skip_website: ${{ steps.skip_website_check.outputs.should_skip }}
- should_skip_vscodeext: ${{ steps.skip_vscodeext_check.outputs.should_skip }}
- should_skip_cli: ${{ steps.skip_cli_check.outputs.should_skip }}
steps:
- - id: skip_lang_check
- name: Check if the changes are about squiggle-lang src files
- uses: fkirc/skip-duplicate-actions@v5.2.0
+ - uses: actions/checkout@v3
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v3
with:
- paths: '["packages/squiggle-lang/**"]'
- - id: skip_components_check
- name: Check if the changes are about components src files
- uses: fkirc/skip-duplicate-actions@v5.2.0
- with:
- paths: '["packages/components/**"]'
- - id: skip_website_check
- name: Check if the changes are about website src files
- uses: fkirc/skip-duplicate-actions@v5.2.0
- with:
- paths: '["packages/website/**"]'
- - id: skip_vscodeext_check
- name: Check if the changes are about vscode extension src files
- uses: fkirc/skip-duplicate-actions@v5.2.0
- with:
- paths: '["packages/vscode-ext/**"]'
- - id: skip_cli_check
- name: Check if the changes are about cli src files
- uses: fkirc/skip-duplicate-actions@v5.2.0
- with:
- paths: '["packages/cli/**"]'
+ node-version: 16
+ cache: 'yarn'
+ - name: Install dependencies
+ run: yarn --frozen-lockfile
+ - name: Turbo run
+ run: npx turbo run build test lint bundle
- lang-lint:
- name: Language lint
+ coverage:
+ name: Coverage
runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
- defaults:
- run:
- shell: bash
- working-directory: packages/squiggle-lang
steps:
- uses: actions/checkout@v3
- - name: Install Dependencies
- run: cd ../../ && yarn
- - name: Check rescript lint
- run: yarn lint:rescript
- - name: Check javascript, typescript, and markdown lint
- uses: creyD/prettier_action@v4.2
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v2
with:
- dry: true
- prettier_options: --check packages/squiggle-lang
-
- lang-build-test-bundle:
- name: Language build, test, and bundle
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
- defaults:
- run:
- shell: bash
- working-directory: packages/squiggle-lang
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 2
- - name: Install dependencies from monorepo level
- run: cd ../../ && yarn
- - name: Build rescript codebase
- run: yarn build
- - name: Run rescript tests
- run: yarn test:rescript
- - name: Run typescript tests
- run: yarn test:ts
- - name: Run webpack
- run: yarn bundle
- - name: Upload rescript coverage report
- run: yarn coverage:rescript:ci
- - name: Upload typescript coverage report
- run: yarn coverage:ts:ci
-
- components-lint:
- name: Components lint
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }}
- defaults:
- run:
- shell: bash
- working-directory: packages/components
- steps:
- - uses: actions/checkout@v3
- - name: Check javascript, typescript, and markdown lint
- uses: creyD/prettier_action@v4.2
- with:
- dry: true
- prettier_options: --check packages/components --ignore-path packages/components/.prettierignore
-
- components-bundle-build-test:
- name: Components bundle, build and test
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }}
- defaults:
- run:
- shell: bash
- working-directory: packages/components
- steps:
- - uses: actions/checkout@v3
- - name: Install dependencies from monorepo level
- run: cd ../../ && yarn
- - name: Build rescript codebase in squiggle-lang
- run: cd ../squiggle-lang && yarn build
- - name: Run webpack
- run: yarn bundle
- - name: Build storybook
- run: yarn build
- - name: Test components
- run: yarn test
-
- website-lint:
- name: Website lint
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ needs.pre_check.outputs.should_skip_website != 'true' }}
- defaults:
- run:
- shell: bash
- working-directory: packages/website
- steps:
- - uses: actions/checkout@v3
- - name: Check javascript, typescript, and markdown lint
- uses: creyD/prettier_action@v4.2
- with:
- dry: true
- prettier_options: --check packages/website
-
- website-build:
- name: Website build
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ (needs.pre_check.outputs.should_skip_website != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') || (needs.pre_check.outputs.should_skip_components != 'true') }}
- defaults:
- run:
- shell: bash
- working-directory: packages/website
- steps:
- - uses: actions/checkout@v3
- - name: Install dependencies from monorepo level
- run: cd ../../ && yarn
- - name: Build rescript in squiggle-lang
- run: cd ../squiggle-lang && yarn build
- - name: Build components
- run: cd ../components && yarn build
- - name: Build website assets
- run: yarn build
-
- vscode-ext-lint:
- name: VS Code extension lint
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ needs.pre_check.outputs.should_skip_vscodeext != 'true' }}
- defaults:
- run:
- shell: bash
- working-directory: packages/vscode-ext
- steps:
- - uses: actions/checkout@v3
- - name: Check javascript, typescript, and markdown lint
- uses: creyD/prettier_action@v4.2
- with:
- dry: true
- prettier_options: --check packages/vscode-ext
-
- vscode-ext-build:
- name: VS Code extension build
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} || (needs.pre_check.outputs.should_skip_vscodeext != 'true') }}
- defaults:
- run:
- shell: bash
- working-directory: packages/vscode-ext
- steps:
- - uses: actions/checkout@v3
- - name: Install dependencies from monorepo level
- run: cd ../../ && yarn
- - name: Build
- run: yarn compile
- cli-lint:
- name: CLI lint
- runs-on: ubuntu-latest
- needs: pre_check
- if: ${{ needs.pre_check.outputs.should_skip_cli != 'true' }}
- defaults:
- run:
- shell: bash
- working-directory: packages/cli
- steps:
- - uses: actions/checkout@v3
- - name: Check javascript, typescript, and markdown lint
- uses: creyD/prettier_action@v4.2
- with:
- dry: true
- prettier_options: --check packages/cli
+ node-version: 16
+ cache: 'yarn'
+ - name: Install dependencies
+ run: yarn
+ - name: Coverage
+ run: npx turbo run coverage
diff --git a/.gitignore b/.gitignore
index 8f538f09..3cc94af0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ yarn-error.log
.vscode
todo.txt
result
+shell.nix
+.turbo
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8a3b026a..452fb0c2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -16,7 +16,7 @@ Squiggle is currently pre-alpha.
# Bug reports
-Anyone (with a github account) can file an issue at any time. Please allow Quinn, Sam, and Ozzie to triage, but otherwise just follow the suggestions in the issue templates.
+Anyone (with a github account) can file an issue at any time. Please allow Slava, Sam, and Ozzie to triage, but otherwise just follow the suggestions in the issue templates.
# Project structure
@@ -28,7 +28,7 @@ Squiggle is a **monorepo** with three **packages**.
# Deployment ops
-We use netlify, and it should only concern Quinn, Sam, and Ozzie.
+We use Vercel, and it should only concern Slava, Sam, and Ozzie.
# Development environment, building, testing, dev server
@@ -56,9 +56,9 @@ If you absolutely must, please prefix your commit message with `hotfix: `.
Please work against `develop` branch. **Do not** work against `master`.
-- For rescript code: Quinn and Ozzie are reviewers
+- For rescript code: Slava and Ozzie are reviewers
- For js or typescript code: Sam and Ozzie are reviewers
-- For ops code (i.e. yaml, package.json): Quinn and Sam are reviewers
+- For ops code (i.e. yaml, package.json): Slava and Sam are reviewers
Autopings are set up: if you are not autopinged, you are welcome to comment, but please do not use the formal review feature, send approvals, rejections, or merges.
diff --git a/README.md b/README.md
index e182f539..9be8b2b2 100644
--- a/README.md
+++ b/README.md
@@ -21,10 +21,10 @@ _An estimation language_.
## Our deployments
-- **website/docs prod**: https://squiggle-language.com [![Netlify Status](https://api.netlify.com/api/v1/badges/2139af5c-671d-473d-a9f6-66c96077d8a1/deploy-status)](https://app.netlify.com/sites/squiggle-documentation/deploys)
-- **website/docs staging**: https://develop--squiggle-documentation.netlify.app/
-- **components storybook prod**: https://squiggle-components.netlify.app/ [![Netlify Status](https://api.netlify.com/api/v1/badges/b7f724aa-6b20-4d0e-bf86-3fcd1a3e9a70/deploy-status)](https://app.netlify.com/sites/squiggle-components/deploys)
-- **components storybook staging**: https://develop--squiggle-components.netlify.app/
+- **website/docs prod**: https://squiggle-language.com
+- **website/docs staging**: https://preview.squiggle-language.com
+- **components storybook prod**: https://components.squiggle-language.com
+- **components storybook staging**: https://preview-components.squiggle-language.com
- **legacy (2020) playground**: https://playground.squiggle-language.com
## Packages
@@ -51,7 +51,19 @@ For any project in the repo, begin by running `yarn` in the top level
yarn
```
-See `packages/*/README.md` to work with whatever project you're interested in.
+Then use `turbo` to build the specific packages or the entire monorepo:
+
+```sh
+turbo run build
+```
+
+Or:
+
+```sh
+turbo run build --filter=@quri/squiggle-components
+```
+
+You can also run specific npm scripts for the package you're working on. See `packages/*/README.md` for the details.
# Contributing
diff --git a/package.json b/package.json
index dcab983e..f1241ebe 100644
--- a/package.json
+++ b/package.json
@@ -2,12 +2,11 @@
"private": true,
"name": "squiggle",
"scripts": {
- "nodeclean": "rm -r node_modules && rm -r packages/*/node_modules",
- "format:all": "prettier --write . && cd packages/squiggle-lang && yarn format",
- "lint:all": "prettier --check . && cd packages/squiggle-lang && yarn lint:rescript"
+ "nodeclean": "rm -r node_modules && rm -r packages/*/node_modules"
},
"devDependencies": {
- "prettier": "^2.7.1"
+ "prettier": "^2.7.1",
+ "turbo": "^1.5.5"
},
"workspaces": [
"packages/*"
diff --git a/packages/cli/package.json b/packages/cli/package.json
index dca34532..92a088f0 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -7,7 +7,9 @@
"bin": "index.js",
"type": "module",
"scripts": {
- "start": "node ."
+ "start": "node .",
+ "lint": "prettier --check .",
+ "format": "prettier --write ."
},
"license": "MIT",
"dependencies": {
diff --git a/packages/components/netlify.toml b/packages/components/netlify.toml
deleted file mode 100644
index d6e5474d..00000000
--- a/packages/components/netlify.toml
+++ /dev/null
@@ -1,8 +0,0 @@
-[build]
- base = "packages/components/"
- command = "cd ../squiggle-lang && yarn build && cd ../components && yarn build"
- publish = "storybook-static/"
- ignore = "node -e 'process.exitCode = process.env.BRANCH.includes(\"dependabot\") ? 0 : 1' && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../squiggle-lang"
-
-[build.environment]
- NETLIFY_USE_YARN = "true"
diff --git a/packages/components/package.json b/packages/components/package.json
index e0a1abd2..6e0cba3f 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -10,6 +10,7 @@
"@hookform/resolvers": "^2.9.8",
"@quri/squiggle-lang": "^0.5.0",
"@react-hook/size": "^2.1.2",
+ "@types/uuid": "^8.3.4",
"clsx": "^1.2.1",
"framer-motion": "^7.5.1",
"lodash": "^4.17.21",
@@ -18,6 +19,7 @@
"react-hook-form": "^7.36.1",
"react-use": "^17.4.0",
"react-vega": "^7.6.0",
+ "uuid": "^9.0.0",
"vega": "^5.22.1",
"vega-embed": "^6.21.0",
"vega-lite": "^5.5.0",
@@ -42,6 +44,7 @@
"@types/node": "^18.8.0",
"@types/react": "^18.0.21",
"@types/styled-components": "^5.1.26",
+ "@types/uuid": "^8.3.4",
"@types/webpack": "^5.28.0",
"canvas": "^2.10.1",
"cross-env": "^7.0.3",
@@ -82,7 +85,8 @@
"format": "prettier --write .",
"prepack": "yarn run build:cjs && yarn run bundle",
"test": "jest",
- "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand"
+ "test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
+ "test:profile": "node --cpu-prof node_modules/.bin/jest --runInBand"
},
"eslintConfig": {
"extends": [
diff --git a/packages/components/src/components/Alert.tsx b/packages/components/src/components/Alert.tsx
index bc2e2f92..cb579536 100644
--- a/packages/components/src/components/Alert.tsx
+++ b/packages/components/src/components/Alert.tsx
@@ -30,7 +30,7 @@ export const Alert: React.FC<{
className={clsx("h-5 w-5 flex-shrink-0", iconColor)}
aria-hidden="true"
/>
-
+
diff --git a/packages/components/src/components/CodeEditor.tsx b/packages/components/src/components/CodeEditor.tsx
index 15802131..ec2fdee7 100644
--- a/packages/components/src/components/CodeEditor.tsx
+++ b/packages/components/src/components/CodeEditor.tsx
@@ -5,6 +5,8 @@ import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-golang";
import "ace-builds/src-noconflict/theme-github";
+import { SqLocation } from "@quri/squiggle-lang";
+
interface CodeEditorProps {
value: string;
onChange: (value: string) => void;
@@ -13,15 +15,17 @@ interface CodeEditorProps {
width?: number;
height: number;
showGutter?: boolean;
+ errorLocations?: SqLocation[];
}
export const CodeEditor: FC
= ({
value,
onChange,
onSubmit,
+ height,
oneLine = false,
showGutter = false,
- height,
+ errorLocations = [],
}) => {
const lineCount = value.split("\n").length;
const id = useMemo(() => _.uniqueId(), []);
@@ -30,8 +34,11 @@ export const CodeEditor: FC = ({
const onSubmitRef = useRef(null);
onSubmitRef.current = onSubmit;
+ const editorEl = useRef(null);
+
return (
= ({
exec: () => onSubmitRef.current?.(),
},
]}
+ markers={errorLocations?.map((location) => ({
+ startRow: location.start.line - 1,
+ startCol: location.start.column - 1,
+ endRow: location.end.line - 1,
+ endCol: location.end.column - 1,
+ className: "ace-error-marker",
+ type: "text",
+ }))}
/>
);
};
diff --git a/packages/components/src/components/FunctionChart.tsx b/packages/components/src/components/FunctionChart.tsx
index 2da5d367..fda699e9 100644
--- a/packages/components/src/components/FunctionChart.tsx
+++ b/packages/components/src/components/FunctionChart.tsx
@@ -1,9 +1,15 @@
import * as React from "react";
-import { SqLambda, environment, SqValueTag } from "@quri/squiggle-lang";
+import {
+ SqLambda,
+ environment,
+ SqValueTag,
+ SqError,
+} from "@quri/squiggle-lang";
import { FunctionChart1Dist } from "./FunctionChart1Dist";
import { FunctionChart1Number } from "./FunctionChart1Number";
import { DistributionPlottingSettings } from "./DistributionChart";
-import { ErrorAlert, MessageAlert } from "./Alert";
+import { MessageAlert } from "./Alert";
+import { SquiggleErrorAlert } from "./SquiggleErrorAlert";
export type FunctionChartSettings = {
start: number;
@@ -19,6 +25,25 @@ interface FunctionChartProps {
height: number;
}
+const FunctionCallErrorAlert = ({ error }: { error: SqError }) => {
+ const [expanded, setExpanded] = React.useState(false);
+ if (expanded) {
+ }
+ return (
+
+
+ setExpanded(!expanded)}
+ >
+ {expanded ? "Hide" : "Show"} error details
+
+ {expanded ? : null}
+
+
+ );
+};
+
export const FunctionChart: React.FC = ({
fn,
chartSettings,
@@ -26,7 +51,8 @@ export const FunctionChart: React.FC = ({
distributionPlotSettings,
height,
}) => {
- if (fn.parameters.length > 1) {
+ console.log(fn.parameters().length);
+ if (fn.parameters().length !== 1) {
return (
Only functions with one parameter are displayed.
@@ -47,9 +73,7 @@ export const FunctionChart: React.FC = ({
const validResult = getValidResult();
if (validResult.tag === "Error") {
- return (
- {validResult.value.toString()}
- );
+ return ;
}
switch (validResult.value.tag) {
diff --git a/packages/components/src/components/SquiggleChart.tsx b/packages/components/src/components/SquiggleChart.tsx
index 4dd57a1f..215031a7 100644
--- a/packages/components/src/components/SquiggleChart.tsx
+++ b/packages/components/src/components/SquiggleChart.tsx
@@ -1,24 +1,17 @@
import * as React from "react";
-import {
- SqValue,
- environment,
- defaultEnvironment,
- resultMap,
- SqValueTag,
-} from "@quri/squiggle-lang";
+import { SqValue, environment, SqProject } from "@quri/squiggle-lang";
import { useSquiggle } from "../lib/hooks";
import { SquiggleViewer } from "./SquiggleViewer";
import { JsImports } from "../lib/jsImports";
+import { getValueToRender } from "../lib/utility";
-export interface SquiggleChartProps {
+export type SquiggleChartProps = {
/** The input string for squiggle */
- code?: string;
+ code: string;
/** Allows to re-run the code if code hasn't changed */
executionId?: number;
/** If the output requires monte carlo sampling, the amount of samples */
sampleCount?: number;
- /** The amount of points returned to draw the distribution */
- environment?: environment;
/** If the result is a function, where the function domain starts */
diagramStart?: number;
/** If the result is a function, where the function domain ends */
@@ -26,7 +19,7 @@ export interface SquiggleChartProps {
/** If the result is a function, the amount of stops sampled */
diagramCount?: number;
/** When the squiggle code gets reevaluated */
- onChange?(expr: SqValue | undefined): void;
+ onChange?(expr: SqValue | undefined, sourceName: string): void;
/** CSS width of the element */
width?: number;
height?: number;
@@ -53,21 +46,31 @@ export interface SquiggleChartProps {
/** Whether to show vega actions to the user, so they can copy the chart spec */
distributionChartActions?: boolean;
enableLocalSettings?: boolean;
-}
+} & (StandaloneExecutionProps | ProjectExecutionProps);
+// Props needed for a standalone execution
+type StandaloneExecutionProps = {
+ project?: undefined;
+ continues?: undefined;
+ /** The amount of points returned to draw the distribution, not needed if using a project */
+ environment?: environment;
+};
+
+// Props needed when executing inside a project.
+type ProjectExecutionProps = {
+ environment?: undefined;
+ /** The project that this execution is part of */
+ project: SqProject;
+ /** What other squiggle sources from the project to continue. Default [] */
+ continues?: string[];
+};
const defaultOnChange = () => {};
const defaultImports: JsImports = {};
+const defaultContinues: string[] = [];
-export const SquiggleChart: React.FC = React.memo(
- ({
- code = "",
- executionId = 0,
- environment,
- onChange = defaultOnChange, // defaultOnChange must be constant, don't move its definition here
- height = 200,
- jsImports = defaultImports,
+export const splitSquiggleChartSettings = (props: SquiggleChartProps) => {
+ const {
showSummary = false,
- width,
logX = false,
expY = false,
diagramStart = 0,
@@ -80,47 +83,77 @@ export const SquiggleChart: React.FC = React.memo(
title,
xAxisType = "number",
distributionChartActions,
- enableLocalSettings = false,
- }) => {
- const { result, bindings } = useSquiggle({
+ } = props;
+
+ const distributionPlotSettings = {
+ showSummary,
+ logX,
+ expY,
+ format: tickFormat,
+ minX,
+ maxX,
+ color,
+ title,
+ xAxisType,
+ actions: distributionChartActions,
+ };
+
+ const chartSettings = {
+ start: diagramStart,
+ stop: diagramStop,
+ count: diagramCount,
+ };
+
+ return { distributionPlotSettings, chartSettings };
+};
+
+export const SquiggleChart: React.FC = React.memo(
+ (props) => {
+ const { distributionPlotSettings, chartSettings } =
+ splitSquiggleChartSettings(props);
+
+ const {
+ code,
+ jsImports = defaultImports,
+ onChange = defaultOnChange, // defaultOnChange must be constant, don't move its definition here
+ executionId = 0,
+ width,
+ height = 200,
+ enableLocalSettings = false,
+ continues = defaultContinues,
+ } = props;
+
+ const p = React.useMemo(() => {
+ if (props.project) {
+ return props.project;
+ } else {
+ const p = SqProject.create();
+ if (props.environment) {
+ p.setEnvironment(props.environment);
+ }
+ return p;
+ }
+ }, [props.project, props.environment]);
+
+ const resultAndBindings = useSquiggle({
+ continues,
+ project: p,
code,
- environment,
jsImports,
onChange,
executionId,
});
- const distributionPlotSettings = {
- showSummary,
- logX,
- expY,
- format: tickFormat,
- minX,
- maxX,
- color,
- title,
- xAxisType,
- actions: distributionChartActions,
- };
-
- const chartSettings = {
- start: diagramStart,
- stop: diagramStop,
- count: diagramCount,
- };
-
- const resultToRender = resultMap(result, (value) =>
- value.tag === SqValueTag.Void ? bindings.asValue() : value
- );
+ const valueToRender = getValueToRender(resultAndBindings);
return (
);
diff --git a/packages/components/src/components/SquiggleEditor.tsx b/packages/components/src/components/SquiggleEditor.tsx
index 9a11ac44..23765f38 100644
--- a/packages/components/src/components/SquiggleEditor.tsx
+++ b/packages/components/src/components/SquiggleEditor.tsx
@@ -1,13 +1,21 @@
import React from "react";
import { CodeEditor } from "./CodeEditor";
import { SquiggleContainer } from "./SquiggleContainer";
-import { SquiggleChart, SquiggleChartProps } from "./SquiggleChart";
-import { useMaybeControlledValue } from "../lib/hooks";
+import {
+ splitSquiggleChartSettings,
+ SquiggleChartProps,
+} from "./SquiggleChart";
+import { useMaybeControlledValue, useSquiggle } from "../lib/hooks";
+import { JsImports } from "../lib/jsImports";
+import { defaultEnvironment, SqLocation, SqProject } from "@quri/squiggle-lang";
+import { SquiggleViewer } from "./SquiggleViewer";
+import { getErrorLocations, getValueToRender } from "../lib/utility";
const WrappedCodeEditor: React.FC<{
code: string;
setCode: (code: string) => void;
-}> = ({ code, setCode }) => (
+ errorLocations?: SqLocation[];
+}> = ({ code, setCode, errorLocations }) => (
);
@@ -24,6 +33,9 @@ export type SquiggleEditorProps = SquiggleChartProps & {
onCodeChange?: (code: string) => void;
};
+const defaultOnChange = () => {};
+const defaultImports: JsImports = {};
+
export const SquiggleEditor: React.FC = (props) => {
const [code, setCode] = useMaybeControlledValue({
value: props.code,
@@ -31,11 +43,54 @@ export const SquiggleEditor: React.FC = (props) => {
onChange: props.onCodeChange,
});
- let chartProps = { ...props, code };
+ const { distributionPlotSettings, chartSettings } =
+ splitSquiggleChartSettings(props);
+
+ const {
+ environment,
+ jsImports = defaultImports,
+ onChange = defaultOnChange, // defaultOnChange must be constant, don't move its definition here
+ executionId = 0,
+ width,
+ height = 200,
+ enableLocalSettings = false,
+ } = props;
+
+ const project = React.useMemo(() => {
+ const p = SqProject.create();
+ if (environment) {
+ p.setEnvironment(environment);
+ }
+ return p;
+ }, [environment]);
+
+ const resultAndBindings = useSquiggle({
+ code,
+ project,
+ jsImports,
+ onChange,
+ executionId,
+ });
+
+ const valueToRender = getValueToRender(resultAndBindings);
+ const errorLocations = getErrorLocations(resultAndBindings.result);
+
return (
-
-
+
+
);
};
diff --git a/packages/components/src/components/SquiggleErrorAlert.tsx b/packages/components/src/components/SquiggleErrorAlert.tsx
index 49179497..fee0fca5 100644
--- a/packages/components/src/components/SquiggleErrorAlert.tsx
+++ b/packages/components/src/components/SquiggleErrorAlert.tsx
@@ -1,4 +1,4 @@
-import { SqError } from "@quri/squiggle-lang";
+import { SqError, SqFrame } from "@quri/squiggle-lang";
import React from "react";
import { ErrorAlert } from "./Alert";
@@ -6,6 +6,39 @@ type Props = {
error: SqError;
};
-export const SquiggleErrorAlert: React.FC = ({ error }) => {
- return {error.toString()};
+const StackTraceFrame: React.FC<{ frame: SqFrame }> = ({ frame }) => {
+ const location = frame.location();
+ return (
+
+ {frame.name()}
+ {location
+ ? ` at line ${location.start.line}, column ${location.start.column}`
+ : ""}
+
+ );
+};
+
+const StackTrace: React.FC = ({ error }) => {
+ const frames = error.getFrameArray();
+ return frames.length ? (
+
+
Stack trace:
+
+ {frames.map((frame, i) => (
+
+ ))}
+
+
+ ) : null;
+};
+
+export const SquiggleErrorAlert: React.FC = ({ error }) => {
+ return (
+
+
+
+ );
};
diff --git a/packages/components/src/components/SquigglePlayground.tsx b/packages/components/src/components/SquigglePlayground.tsx
index 8039bbe0..59898d6b 100644
--- a/packages/components/src/components/SquigglePlayground.tsx
+++ b/packages/components/src/components/SquigglePlayground.tsx
@@ -8,7 +8,11 @@ import React, {
} from "react";
import { useForm, UseFormRegister, useWatch } from "react-hook-form";
import * as yup from "yup";
-import { useMaybeControlledValue, useRunnerState } from "../lib/hooks";
+import {
+ useMaybeControlledValue,
+ useRunnerState,
+ useSquiggle,
+} from "../lib/hooks";
import { yupResolver } from "@hookform/resolvers/yup";
import {
ChartSquareBarIcon,
@@ -24,9 +28,9 @@ import {
} from "@heroicons/react/solid";
import clsx from "clsx";
-import { environment } from "@quri/squiggle-lang";
+import { environment, SqProject } from "@quri/squiggle-lang";
-import { SquiggleChart, SquiggleChartProps } from "./SquiggleChart";
+import { SquiggleChartProps } from "./SquiggleChart";
import { CodeEditor } from "./CodeEditor";
import { JsonEditor } from "./JsonEditor";
import { ErrorAlert, SuccessAlert } from "./Alert";
@@ -40,6 +44,8 @@ import { HeadedSection } from "./ui/HeadedSection";
import { defaultTickFormat } from "../lib/distributionSpecBuilder";
import { Button } from "./ui/Button";
import { JsImports } from "../lib/jsImports";
+import { getErrorLocations, getValueToRender } from "../lib/utility";
+import { SquiggleViewer } from "./SquiggleViewer";
type PlaygroundProps = SquiggleChartProps & {
/** The initial squiggle string to put in the playground */
@@ -282,7 +288,7 @@ export const SquigglePlayground: FC = ({
onSettingsChange?.(vars);
}, [vars, onSettingsChange]);
- const env: environment = useMemo(
+ const environment: environment = useMemo(
() => ({
sampleCount: Number(vars.sampleCount),
xyPointLength: Number(vars.xyPointLength),
@@ -299,26 +305,59 @@ export const SquigglePlayground: FC = ({
executionId,
} = useRunnerState(code);
+ const project = React.useMemo(() => {
+ const p = SqProject.create();
+ if (environment) {
+ p.setEnvironment(environment);
+ }
+ return p;
+ }, [environment]);
+
+ const resultAndBindings = useSquiggle({
+ code,
+ project,
+ jsImports: imports,
+ executionId,
+ });
+
+ const valueToRender = getValueToRender(resultAndBindings);
+
const squiggleChart =
renderedCode === "" ? null : (
{isRunning ? (
) : null}
-
);
+ const errorLocations = getErrorLocations(resultAndBindings.result);
+
const firstTab = vars.showEditor ? (
= ({
{location.path.items.length ? (
) : null}
diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts
index bbd0d178..b8a6e385 100644
--- a/packages/components/src/index.ts
+++ b/packages/components/src/index.ts
@@ -1,3 +1,4 @@
+export { SqProject } from "@quri/squiggle-lang/";
export { SquiggleChart } from "./components/SquiggleChart";
export { SquiggleEditor } from "./components/SquiggleEditor";
export { SquigglePlayground } from "./components/SquigglePlayground";
diff --git a/packages/components/src/lib/hooks/useSquiggle.ts b/packages/components/src/lib/hooks/useSquiggle.ts
index 5916ac54..63fa3839 100644
--- a/packages/components/src/lib/hooks/useSquiggle.ts
+++ b/packages/components/src/lib/hooks/useSquiggle.ts
@@ -1,42 +1,85 @@
-import { environment, SqProject, SqValue } from "@quri/squiggle-lang";
+import {
+ result,
+ SqError,
+ SqProject,
+ SqRecord,
+ SqValue,
+} from "@quri/squiggle-lang";
import { useEffect, useMemo } from "react";
import { JsImports, jsImportsToSquiggleCode } from "../jsImports";
+import * as uuid from "uuid";
type SquiggleArgs = {
code: string;
executionId?: number;
jsImports?: JsImports;
- environment?: environment;
- onChange?: (expr: SqValue | undefined) => void;
+ project: SqProject;
+ continues?: string[];
+ onChange?: (expr: SqValue | undefined, sourceName: string) => void;
};
-export const useSquiggle = (args: SquiggleArgs) => {
+export type ResultAndBindings = {
+ result: result
;
+ bindings: SqRecord;
+};
+
+const importSourceName = (sourceName: string) => "imports-" + sourceName;
+const defaultContinues = [];
+
+export const useSquiggle = (args: SquiggleArgs): ResultAndBindings => {
+ const sourceName = useMemo(() => uuid.v4(), []);
+
+ const env = args.project.getEnvironment();
+ const continues = args.continues || defaultContinues;
+
const result = useMemo(
() => {
- const project = SqProject.create();
- project.setSource("main", args.code);
- if (args.environment) {
- project.setEnvironment(args.environment);
- }
+ const project = args.project;
+
+ project.setSource(sourceName, args.code);
+ let fullContinues = continues;
if (args.jsImports && Object.keys(args.jsImports).length) {
const importsSource = jsImportsToSquiggleCode(args.jsImports);
- project.setSource("imports", importsSource);
- project.setContinues("main", ["imports"]);
+ project.setSource(importSourceName(sourceName), importsSource);
+ fullContinues = continues.concat(importSourceName(sourceName));
}
- project.run("main");
- const result = project.getResult("main");
- const bindings = project.getBindings("main");
+ project.setContinues(sourceName, fullContinues);
+ project.run(sourceName);
+ const result = project.getResult(sourceName);
+ const bindings = project.getBindings(sourceName);
return { result, bindings };
},
+ // This complains about executionId not being used inside the function body.
+ // This is on purpose, as executionId simply allows you to run the squiggle
+ // code again
// eslint-disable-next-line react-hooks/exhaustive-deps
- [args.code, args.environment, args.jsImports, args.executionId]
+ [
+ args.code,
+ args.jsImports,
+ args.executionId,
+ sourceName,
+ continues,
+ args.project,
+ env,
+ ]
);
const { onChange } = args;
useEffect(() => {
- onChange?.(result.result.tag === "Ok" ? result.result.value : undefined);
- }, [result, onChange]);
+ onChange?.(
+ result.result.tag === "Ok" ? result.result.value : undefined,
+ sourceName
+ );
+ }, [result, onChange, sourceName]);
+
+ useEffect(() => {
+ return () => {
+ args.project.removeSource(sourceName);
+ if (args.project.getSource(importSourceName(sourceName)))
+ args.project.removeSource(importSourceName(sourceName));
+ };
+ }, [args.project, sourceName]);
return result;
};
diff --git a/packages/components/src/lib/utility.ts b/packages/components/src/lib/utility.ts
index d4d3661b..cb002954 100644
--- a/packages/components/src/lib/utility.ts
+++ b/packages/components/src/lib/utility.ts
@@ -1,4 +1,5 @@
-import { result } from "@quri/squiggle-lang";
+import { result, resultMap, SqValueTag } from "@quri/squiggle-lang";
+import { ResultAndBindings } from "./hooks/useSquiggle";
export function flattenResult(x: result[]): result {
if (x.length === 0) {
@@ -35,3 +36,18 @@ export function all(arr: boolean[]): boolean {
export function some(arr: boolean[]): boolean {
return arr.reduce((x, y) => x || y, false);
}
+
+export function getValueToRender({ result, bindings }: ResultAndBindings) {
+ return resultMap(result, (value) =>
+ value.tag === SqValueTag.Void ? bindings.asValue() : value
+ );
+}
+
+export function getErrorLocations(result: ResultAndBindings["result"]) {
+ if (result.tag === "Error") {
+ const location = result.value.location();
+ return location ? [location] : [];
+ } else {
+ return [];
+ }
+}
diff --git a/packages/components/src/styles/main.css b/packages/components/src/styles/main.css
index 987c3714..257c5712 100644
--- a/packages/components/src/styles/main.css
+++ b/packages/components/src/styles/main.css
@@ -22,3 +22,8 @@ but this line is still necessary for proper initialization of `--tw-*` variables
.ace_cursor {
border-left: 2px solid !important;
}
+
+.ace-error-marker {
+ position: absolute;
+ border-bottom: 1px solid red;
+}
diff --git a/packages/components/test/basic.test.tsx b/packages/components/test/basic.test.tsx
index 9eb4973a..e77f104b 100644
--- a/packages/components/test/basic.test.tsx
+++ b/packages/components/test/basic.test.tsx
@@ -3,11 +3,11 @@ import React from "react";
import "@testing-library/jest-dom";
import { SquiggleChart } from "../src/index";
-test("Logs no warnings or errors", async () => {
- debugger;
+test("Logs nothing on render", async () => {
const { unmount } = render();
unmount();
+ expect(console.log).not.toBeCalled();
expect(console.warn).not.toBeCalled();
expect(console.error).not.toBeCalled();
});
diff --git a/packages/components/test/cleanup.test.tsx b/packages/components/test/cleanup.test.tsx
new file mode 100644
index 00000000..d2be427a
--- /dev/null
+++ b/packages/components/test/cleanup.test.tsx
@@ -0,0 +1,39 @@
+import { render } from "@testing-library/react";
+import React from "react";
+import "@testing-library/jest-dom";
+import { SquiggleChart } from "../src/index";
+import { SqProject } from "@quri/squiggle-lang";
+
+test("Creates and cleans up source", async () => {
+ const project = SqProject.create();
+
+ const { unmount } = render(
+
+ );
+
+ expect(project.getSourceIds().length).toBe(1);
+
+ const sourceId = project.getSourceIds()[0];
+ expect(project.getSource(sourceId)).toBe("normal(0, 1)");
+
+ unmount();
+ expect(project.getSourceIds().length).toBe(0);
+ expect(project.getSource(sourceId)).toBe(undefined);
+});
+
+test("Creates and cleans up source and imports", async () => {
+ const project = SqProject.create();
+
+ const { unmount } = render(
+
+ );
+
+ expect(project.getSourceIds().length).toBe(2);
+
+ unmount();
+ expect(project.getSourceIds()).toStrictEqual([]);
+});
diff --git a/packages/components/vercel.json b/packages/components/vercel.json
new file mode 100644
index 00000000..65397eb3
--- /dev/null
+++ b/packages/components/vercel.json
@@ -0,0 +1,4 @@
+{
+ "buildCommand": "cd ../.. && npx turbo run build --filter=@quri/squiggle-components",
+ "outputDirectory": "storybook-static"
+}
diff --git a/packages/squiggle-lang/.prettierignore b/packages/squiggle-lang/.prettierignore
index cc0cf959..75fd1e23 100644
--- a/packages/squiggle-lang/.prettierignore
+++ b/packages/squiggle-lang/.prettierignore
@@ -6,3 +6,5 @@ lib
_coverage/
.cache/
Reducer_Peggy_GeneratedParser.js
+ReducerProject_IncludeParser.js
+src/rescript/Reducer/Reducer_Peggy/helpers.js
diff --git a/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res b/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res
index 99e3e5a3..84cf3ee5 100644
--- a/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res
+++ b/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res
@@ -3,7 +3,7 @@ This is the most basic file in our invariants family of tests.
Validate that the addition of means equals the mean of the addition, similar for subtraction and multiplication.
-Details in https://develop--squiggle-documentation.netlify.app/docs/internal/invariants/
+Details in https://squiggle-language.com/docs/internal/invariants/
Note: epsilon of 1e3 means the invariants are, in general, not being satisfied.
*/
diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res
index 6c60c187..1e1ba209 100644
--- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res
+++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res
@@ -182,7 +182,7 @@ describe("Peggy parse", () => {
"a.p1 to a.p2",
"{(:credibleIntervalToDistribution (:$_atIndex_$ :a 'p1') (:$_atIndex_$ :a 'p2'))}",
) // lower than post
- testParse("1 to 2 + 3", "{(:add (:credibleIntervalToDistribution 1 2) 3)}") // higher than binary operators
+ testParse("1 to 2 + 3", "{(:credibleIntervalToDistribution 1 (:add 2 3))}")
testParse(
"1->add(2) to 3->add(4) -> add(4)",
"{(:credibleIntervalToDistribution (:add 1 2) (:add (:add 3 4) 4))}",
@@ -197,7 +197,7 @@ describe("Peggy parse", () => {
describe("lambda", () => {
testParse("{|x| x}", "{{|:x| :x}}")
- testParse("f={|x| x}", "{:f = {{|:x| :x}}}")
+ testParse("f={|x| x}", "{:f = {|:x| :x}}")
testParse("f(x)=x", "{:f = {|:x| {:x}}}") // Function definitions are lambda assignments
testParse("f(x)=x ? 1 : 0", "{:f = {|:x| {(::$$_ternary_$$ :x 1 0)}}}") // Function definitions are lambda assignments
})
diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_TestHelpers.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_TestHelpers.res
index 0dadae86..1731168f 100644
--- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_TestHelpers.res
+++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_TestHelpers.res
@@ -9,12 +9,12 @@ open Jest
open Expect
let expectParseToBe = (expr, answer) =>
- Parse.parse(expr)->Parse.toStringResult->expect->toBe(answer)
+ Parse.parse(expr, "test")->Parse.toStringResult->expect->toBe(answer)
let testParse = (expr, answer) => test(expr, () => expectParseToBe(expr, answer))
-let expectToExpressionToBe = (expr, answer, ~v="_", ()) => {
- let rExpr = Parse.parse(expr)->Result.map(ToExpression.fromNode)
+let expectExpressionToBe = (expr, answer, ~v="_", ()) => {
+ let rExpr = Parse.parse(expr, "test")->Result.map(ToExpression.fromNode)
let a1 = rExpr->ExpressionT.toStringResultOkless
if v == "_" {
@@ -22,6 +22,7 @@ let expectToExpressionToBe = (expr, answer, ~v="_", ()) => {
} else {
let a2 =
rExpr
+ ->E.R2.errMap(e => e->SqError.fromParseError)
->Result.flatMap(expr => Expression.BackCompatible.evaluate(expr))
->Reducer_Value.toStringResultOkless
(a1, a2)->expect->toEqual((answer, v))
@@ -29,16 +30,16 @@ let expectToExpressionToBe = (expr, answer, ~v="_", ()) => {
}
let testToExpression = (expr, answer, ~v="_", ()) =>
- test(expr, () => expectToExpressionToBe(expr, answer, ~v, ()))
+ test(expr, () => expectExpressionToBe(expr, answer, ~v, ()))
module MyOnly = {
let testParse = (expr, answer) => Only.test(expr, () => expectParseToBe(expr, answer))
let testToExpression = (expr, answer, ~v="_", ()) =>
- Only.test(expr, () => expectToExpressionToBe(expr, answer, ~v, ()))
+ Only.test(expr, () => expectExpressionToBe(expr, answer, ~v, ()))
}
module MySkip = {
let testParse = (expr, answer) => Skip.test(expr, () => expectParseToBe(expr, answer))
let testToExpression = (expr, answer, ~v="_", ()) =>
- Skip.test(expr, () => expectToExpressionToBe(expr, answer, ~v, ()))
+ Skip.test(expr, () => expectExpressionToBe(expr, answer, ~v, ()))
}
diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res
index cab84681..daeab3f0 100644
--- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res
+++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res
@@ -135,7 +135,7 @@ describe("Peggy to Expression", () => {
describe("lambda", () => {
testToExpression("{|x| x}", "{|x| x}", ~v="lambda(x=>internal code)", ())
- testToExpression("f={|x| x}", "f = {{|x| x}}", ())
+ testToExpression("f={|x| x}", "f = {|x| x}", ())
testToExpression("f(x)=x", "f = {|x| {x}}", ()) // Function definitions are lambda assignments
testToExpression("f(x)=x ? 1 : 0", "f = {|x| {x ? (1) : (0)}}", ())
})
diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_TestHelpers.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_TestHelpers.res
index 43de902e..efff179e 100644
--- a/packages/squiggle-lang/__tests__/Reducer/Reducer_TestHelpers.res
+++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_TestHelpers.res
@@ -1,4 +1,3 @@
-module ErrorValue = Reducer_ErrorValue
module Expression = Reducer_Expression
module ExpressionT = Reducer_Expression_T
@@ -9,7 +8,7 @@ let unwrapRecord = rValue =>
rValue->Belt.Result.flatMap(value =>
switch value {
| Reducer_T.IEvRecord(aRecord) => Ok(aRecord)
- | _ => ErrorValue.RETodo("TODO: Internal bindings must be returned")->Error
+ | _ => SqError.Message.RETodo("TODO: Internal bindings must be returned")->Error
}
)
diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res
index 49180135..381c4a81 100644
--- a/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res
+++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_test.res
@@ -70,7 +70,7 @@ describe("test exceptions", () => {
testDescriptionEvalToBe(
"javascript exception",
"javascriptraise('div by 0')",
- "Error(Error: 'div by 0')",
+ "Error(JS Exception: Error: 'div by 0')",
)
// testDescriptionEvalToBe(
// "rescript exception",
@@ -78,3 +78,33 @@ describe("test exceptions", () => {
// "Error(TODO: unhandled rescript exception)",
// )
})
+
+describe("stacktraces", () => {
+ test("nested calls", () => {
+ open Expect
+
+ let error =
+ Expression.BackCompatible.evaluateString(`
+ f(x) = {
+ y = "a"
+ x + y
+ }
+ g = {|x| f(x)}
+ h(x) = g(x)
+ h(5)
+`)
+ ->E.R.getError
+ ->E.O2.toExn("oops")
+ ->SqError.toStringWithStackTrace
+
+ expect(
+ error,
+ )->toBe(`Error: There are function matches for add(), but with different arguments: [add(number, number)]; [add(distribution, number)]; [add(number, distribution)]; [add(distribution, distribution)]; [add(date, duration)]; [add(duration, duration)]
+Stack trace:
+ f at line 4, column 5
+ g at line 6, column 12
+ h at line 7, column 10
+ at line 8, column 3
+`)
+ })
+})
diff --git a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res
index 07660044..9c21ff1d 100644
--- a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res
+++ b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_includes_test.res
@@ -25,7 +25,7 @@ x=1`,
let mainIncludes = Project.getIncludes(project, "main")
switch mainIncludes {
| Ok(includes) => expect(includes) == ["common"]
- | Error(error) => fail(error->Reducer_ErrorValue.errorToString)
+ | Error(error) => fail(error->SqError.toString)
}
})
test("past chain", () => {
@@ -60,7 +60,7 @@ x=1`,
let mainIncludes = Project.getIncludes(project, "main")
switch mainIncludes {
| Ok(includes) => expect(includes) == ["common", "myModule"]
- | Error(error) => fail(error->Reducer_ErrorValue.errorToString)
+ | Error(error) => fail(error->SqError.toString)
}
})
@@ -99,7 +99,7 @@ x=1`,
let mainIncludes = Project.getIncludes(project, "main")
switch mainIncludes {
| Ok(includes) => expect(includes) == ["common", "common2", "myModule"]
- | Error(error) => fail(error->Reducer_ErrorValue.errorToString)
+ | Error(error) => fail(error->SqError.toString)
}
})
test("direct past chain", () => {
diff --git a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_3_includes_test.res b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_3_includes_test.res
index 2c63dfff..5692d93c 100644
--- a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_3_includes_test.res
+++ b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_3_includes_test.res
@@ -36,7 +36,7 @@ Here we will finally proceed to a real life scenario. */
/* Parse includes has set the includes */
switch project->Project.getIncludes("main") {
| Ok(includes) => includes->expect == ["common"]
- | Error(err) => err->Reducer_ErrorValue.errorToString->fail
+ | Error(err) => err->SqError.toString->fail
}
/* If the includes cannot be parsed then you get a syntax error.
Otherwise you get the includes.
@@ -85,7 +85,7 @@ Here we will finally proceed to a real life scenario. */
let rIncludes = project->Project.getIncludes(sourceName)
switch rIncludes {
/* Maybe there is an include syntax error */
- | Error(err) => err->Reducer_ErrorValue.errorToString->Js.Exn.raiseError
+ | Error(err) => err->SqError.toString->Js.Exn.raiseError
| Ok(includes) =>
includes->Belt.Array.forEach(newIncludeName => {
@@ -169,7 +169,7 @@ Here we will finally proceed to a real life scenario. */
test("getIncludes", () => {
switch Project.getIncludes(project, "main") {
| Ok(includes) => includes->expect == ["common"]
- | Error(err) => err->Reducer_ErrorValue.errorToString->fail
+ | Error(err) => err->SqError.toString->fail
}
})
})
diff --git a/packages/squiggle-lang/__tests__/SqError_test.res b/packages/squiggle-lang/__tests__/SqError_test.res
new file mode 100644
index 00000000..55109dde
--- /dev/null
+++ b/packages/squiggle-lang/__tests__/SqError_test.res
@@ -0,0 +1,41 @@
+open Jest
+open Expect
+
+describe("SqError.Message", () => {
+ test("toString", () =>
+ expect(SqError.Message.REOther("test error")->SqError.Message.toString)->toBe(
+ "Error: test error",
+ )
+ )
+})
+
+describe("SqError", () => {
+ test("fromMessage", () =>
+ expect(SqError.Message.REOther("test error")->SqError.fromMessage->SqError.toString)->toBe(
+ "Error: test error",
+ )
+ )
+
+ test("toStringWithStackTrace with empty stacktrace", () =>
+ expect(
+ SqError.Message.REOther("test error")->SqError.fromMessage->SqError.toStringWithStackTrace,
+ )->toBe("Error: test error")
+ )
+
+ test("toStringWithStackTrace", () => {
+ let frameStack =
+ Reducer_FrameStack.make()
+ ->Reducer_FrameStack.extend("frame1", None)
+ ->Reducer_FrameStack.extend("frame2", None)
+
+ expect(
+ SqError.Message.REOther("test error")
+ ->SqError.fromMessageWithFrameStack(frameStack)
+ ->SqError.toStringWithStackTrace,
+ )->toBe(`Error: test error
+Stack trace:
+ frame2
+ frame1
+`)
+ })
+})
diff --git a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res
index af2c3d7a..96ed2308 100644
--- a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res
+++ b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res
@@ -10,6 +10,8 @@ let examples = E.A.to_list(FunctionRegistry_Core.Registry.allExamples(registry))
describe("FunctionRegistry Library", () => {
describe("Regular tests", () => {
+ testEvalToBe("List.length([3,5,8])", "Ok(3)")
+ testEvalToBe("List.length([])", "Ok(0)")
testEvalToBe("List.make(3, 'HI')", "Ok(['HI','HI','HI'])")
testEvalToBe("make(3, 'HI')", "Error(make is not defined)")
testEvalToBe("List.upTo(1,3)", "Ok([1,2,3])")
@@ -80,6 +82,10 @@ describe("FunctionRegistry Library", () => {
"SampleSet.toList(SampleSet.mapN([SampleSet.fromList([1,2,3,4,5,6]), SampleSet.fromList([6, 5, 4, 3, 2, 1])], {|x| x[0] > x[1] ? x[0] : x[1]}))",
"Ok([6,5,4,4,5,6])",
)
+ testEvalToBe(
+ "SampleSet.fromList([1, 2, 3])",
+ "Error(Error: Too few samples when constructing sample set)",
+ )
testEvalToBe("Dict.merge({a: 1, b: 2}, {b: 3, c: 4, d: 5})", "Ok({a: 1,b: 3,c: 4,d: 5})")
testEvalToBe(
diff --git a/packages/squiggle-lang/package.json b/packages/squiggle-lang/package.json
index 13058dfb..2ee6e92c 100644
--- a/packages/squiggle-lang/package.json
+++ b/packages/squiggle-lang/package.json
@@ -22,10 +22,12 @@
"test:rescript": "jest --modulePathIgnorePatterns=__tests__/TS/*",
"test:watch": "jest --watchAll",
"test:fnRegistry": "jest __tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.bs.js",
- "coverage:rescript": "rm -f *.coverage && yarn clean && BISECT_ENABLE=yes yarn build && yarn test:rescript && bisect-ppx-report html",
- "coverage:ts": "yarn clean && yarn build && nyc --reporter=lcov yarn test:ts",
- "coverage:rescript:ci": "yarn clean && BISECT_ENABLE=yes yarn build:rescript && yarn test:rescript && bisect-ppx-report send-to Codecov",
- "coverage:ts:ci": "yarn coverage:ts && codecov",
+ "coverage:rescript:local": "rm -f *.coverage && yarn clean && BISECT_ENABLE=yes yarn build && yarn test:rescript && bisect-ppx-report html",
+ "coverage:ts:local": "yarn clean && yarn build && nyc --reporter=lcov yarn test:ts",
+ "coverage:rescript": "yarn clean && BISECT_ENABLE=yes yarn build:rescript && yarn test:rescript && bisect-ppx-report send-to Codecov",
+ "coverage:ts": "yarn coverage:ts:local && codecov",
+ "coverage": "yarn coverage:ts && yarn coverage:rescript",
+ "coverage:local": "yarn coverage:ts:local && yarn coverage:rescript:local",
"lint:rescript": "./lint.sh",
"lint:prettier": "prettier --check .",
"lint": "yarn lint:rescript && yarn lint:prettier",
diff --git a/packages/squiggle-lang/scripts/lib.mjs b/packages/squiggle-lang/scripts/lib.mjs
index 606f58ec..dbb83956 100644
--- a/packages/squiggle-lang/scripts/lib.mjs
+++ b/packages/squiggle-lang/scripts/lib.mjs
@@ -36,7 +36,7 @@ export const run = (src, { output, sampleCount } = {}) => {
"Time:",
String(time),
result.tag === "Error" ? red(result.tag) : green(result.tag),
- result.tag === "Error" ? result.value.toString() : ""
+ result.tag === "Error" ? result.value.toStringWithFrameStack() : ""
);
};
diff --git a/packages/squiggle-lang/scripts/run.mjs b/packages/squiggle-lang/scripts/run.mjs
index 6dde265f..91058f33 100755
--- a/packages/squiggle-lang/scripts/run.mjs
+++ b/packages/squiggle-lang/scripts/run.mjs
@@ -1,11 +1,18 @@
#!/usr/bin/env node
import { run } from "./lib.mjs";
-const src = process.argv[2];
+import { Command } from "commander";
+
+const program = new Command();
+
+program.arguments("");
+
+const options = program.parse(process.argv);
+
+const src = program.args[0];
if (!src) {
throw new Error("Expected src");
}
-console.log(`Running ${src}`);
const sampleCount = process.env.SAMPLE_COUNT;
diff --git a/packages/squiggle-lang/src/js/SqError.ts b/packages/squiggle-lang/src/js/SqError.ts
index 317fde4f..5c63d907 100644
--- a/packages/squiggle-lang/src/js/SqError.ts
+++ b/packages/squiggle-lang/src/js/SqError.ts
@@ -1,17 +1,48 @@
-import * as RSErrorValue from "../rescript/ForTS/ForTS_Reducer_ErrorValue.gen";
+import * as RSError from "../rescript/SqError.gen";
+import * as RSReducerT from "../rescript/Reducer/Reducer_T.gen";
+
+import * as RSFrameStack from "../rescript/Reducer/Reducer_FrameStack.gen";
+
+export { location as SqLocation } from "../rescript/Reducer/Reducer_Peggy/Reducer_Peggy_Parse.gen";
export class SqError {
- constructor(private _value: RSErrorValue.reducerErrorValue) {}
+ constructor(private _value: RSError.t) {}
toString() {
- return RSErrorValue.toString(this._value);
+ return RSError.toString(this._value);
}
- static createTodoError(v: string) {
- return new SqError(RSErrorValue.createTodoError(v));
+ toStringWithStackTrace() {
+ return RSError.toStringWithStackTrace(this._value);
}
static createOtherError(v: string) {
- return new SqError(RSErrorValue.createOtherError(v));
+ return new SqError(RSError.createOtherError(v));
+ }
+
+ getTopFrame(): SqFrame | undefined {
+ const frame = RSFrameStack.getTopFrame(RSError.getFrameStack(this._value));
+ return frame ? new SqFrame(frame) : undefined;
+ }
+
+ getFrameArray(): SqFrame[] {
+ const frames = RSError.getFrameArray(this._value);
+ return frames.map((frame) => new SqFrame(frame));
+ }
+
+ location() {
+ return this.getTopFrame()?.location();
+ }
+}
+
+export class SqFrame {
+ constructor(private _value: RSReducerT.frame) {}
+
+ name(): string {
+ return RSFrameStack.Frame.getName(this._value);
+ }
+
+ location() {
+ return RSFrameStack.Frame.getLocation(this._value);
}
}
diff --git a/packages/squiggle-lang/src/js/SqProject.ts b/packages/squiggle-lang/src/js/SqProject.ts
index e44c7dba..fd00f864 100644
--- a/packages/squiggle-lang/src/js/SqProject.ts
+++ b/packages/squiggle-lang/src/js/SqProject.ts
@@ -1,5 +1,5 @@
import * as RSProject from "../rescript/ForTS/ForTS_ReducerProject.gen";
-import { reducerErrorValue } from "../rescript/ForTS/ForTS_Reducer_ErrorValue.gen";
+import * as RSError from "../rescript/SqError.gen";
import { environment } from "../rescript/ForTS/ForTS_Distribution/ForTS_Distribution_Environment.gen";
import { SqError } from "./SqError";
import { SqRecord } from "./SqRecord";
@@ -54,7 +54,7 @@ export class SqProject {
return resultMap2(
RSProject.getIncludes(this._value, sourceId),
(a) => a,
- (v: reducerErrorValue) => new SqError(v)
+ (v: RSError.t) => new SqError(v)
);
}
@@ -108,7 +108,7 @@ export class SqProject {
items: [],
})
),
- (v: reducerErrorValue) => new SqError(v)
+ (v: RSError.t) => new SqError(v)
);
}
diff --git a/packages/squiggle-lang/src/js/SqValueLocation.ts b/packages/squiggle-lang/src/js/SqValueLocation.ts
index 33c7060b..ad2e7e02 100644
--- a/packages/squiggle-lang/src/js/SqValueLocation.ts
+++ b/packages/squiggle-lang/src/js/SqValueLocation.ts
@@ -1,4 +1,3 @@
-import { isParenthesisNode } from "mathjs";
import { SqProject } from "./SqProject";
type PathItem = string | number;
diff --git a/packages/squiggle-lang/src/js/index.ts b/packages/squiggle-lang/src/js/index.ts
index aac26bd5..886c830a 100644
--- a/packages/squiggle-lang/src/js/index.ts
+++ b/packages/squiggle-lang/src/js/index.ts
@@ -13,7 +13,7 @@ export {
environment,
defaultEnvironment,
} from "../rescript/ForTS/ForTS_Distribution/ForTS_Distribution.gen";
-export { SqError } from "./SqError";
+export { SqError, SqFrame, SqLocation } from "./SqError";
export { SqShape } from "./SqPointSetDist";
export { resultMap } from "./types";
diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res
index 17fbe431..0bcd4ee9 100644
--- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res
+++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res
@@ -4,13 +4,6 @@ module Error = {
type sampleSetError =
TooFewSamples | NonNumericInput(string) | OperationError(Operation.operationError)
- let sampleSetErrorToString = (err: sampleSetError): string =>
- switch err {
- | TooFewSamples => "Too few samples when constructing sample set"
- | NonNumericInput(err) => `Found a non-number in input: ${err}`
- | OperationError(err) => Operation.Error.toString(err)
- }
-
@genType
type pointsetConversionError = TooFewSamplesForConversionToPointSet
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res b/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res
index 84e6a50f..3e7a9e8b 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res
@@ -5,7 +5,7 @@ let nameSpace = "" // no namespaced versions
type simpleDefinition = {
inputs: array,
- fn: array => result,
+ fn: array => result,
}
let makeFnMany = (name: string, definitions: array) =>
@@ -22,7 +22,7 @@ let makeFnMany = (name: string, definitions: array) =>
let makeFn = (
name: string,
inputs: array,
- fn: array => result,
+ fn: array => result,
) => makeFnMany(name, [{inputs: inputs, fn: fn}])
let library = [
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Danger.res b/packages/squiggle-lang/src/rescript/FR/FR_Danger.res
index 2d60f556..cd8c1c88 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Danger.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Danger.res
@@ -67,7 +67,7 @@ module Integration = {
let applyFunctionAtFloatToFloatOption = (point: float) => {
// Defined here so that it has access to environment, reducer
let pointAsInternalExpression = FunctionRegistry_Helpers.Wrappers.evNumber(point)
- let resultAsInternalExpression = Reducer_Expression_Lambda.doLambdaCall(
+ let resultAsInternalExpression = Reducer_Lambda.doLambdaCall(
aLambda,
[pointAsInternalExpression],
environment,
@@ -77,7 +77,7 @@ module Integration = {
| Reducer_T.IEvNumber(x) => Ok(x)
| _ =>
Error(
- "Error 1 in Danger.integrate. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead"->Reducer_ErrorValue.REOther,
+ "Error 1 in Danger.integrate. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead"->SqError.Message.REOther,
)
}
result
@@ -143,8 +143,8 @@ module Integration = {
| Error(b) =>
("Integration error 2 in Danger.integrate. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead." ++
"Original error: " ++
- b->Reducer_ErrorValue.errorToString)
- ->Reducer_ErrorValue.REOther
+ b->SqError.Message.toString)
+ ->SqError.Message.REOther
->Error
}
result
@@ -169,7 +169,7 @@ module Integration = {
let result = switch inputs {
| [_, _, _, IEvNumber(0.0)] =>
"Integration error 4 in Danger.integrate: Increment can't be 0."
- ->Reducer_ErrorValue.REOther
+ ->SqError.Message.REOther
->Error
| [
IEvLambda(aLambda),
@@ -187,7 +187,7 @@ module Integration = {
)
| _ =>
Error(
- Reducer_ErrorValue.REOther(
+ SqError.Message.REOther(
"Integration error 5 in Danger.integrate. Remember that inputs are (function, number (min), number (max), number(increment))",
),
)
@@ -213,7 +213,7 @@ module Integration = {
let result = switch inputs {
| [_, _, _, IEvNumber(0.0)] =>
"Integration error in Danger.integrate: Increment can't be 0."
- ->Reducer_ErrorValue.REOther
+ ->SqError.Message.REOther
->Error
| [IEvLambda(aLambda), IEvNumber(min), IEvNumber(max), IEvNumber(epsilon)] =>
Helpers.integrateFunctionBetweenWithNumIntegrationPoints(
@@ -225,11 +225,11 @@ module Integration = {
reducer,
)->E.R2.errMap(b =>
("Integration error 7 in Danger.integrate. Something went wrong along the way: " ++
- b->Reducer_ErrorValue.errorToString)->Reducer_ErrorValue.REOther
+ b->SqError.Message.toString)->SqError.Message.REOther
)
| _ =>
"Integration error 8 in Danger.integrate. Remember that inputs are (function, number (min), number (max), number(increment))"
- ->Reducer_ErrorValue.REOther
+ ->SqError.Message.REOther
->Error
}
result
@@ -246,7 +246,7 @@ module DiminishingReturns = {
module Helpers = {
type diminishingReturnsAccumulatorInner = {
optimalAllocations: array,
- currentMarginalReturns: result, errorValue>,
+ currentMarginalReturns: result, errorMessage>,
}
let findBiggestElementIndex = (xs: array) =>
E.A.reducei(xs, 0, (acc, newElement, index) => {
@@ -255,7 +255,7 @@ module DiminishingReturns = {
| false => acc
}
})
- type diminishingReturnsAccumulator = result
+ type diminishingReturnsAccumulator = result
// TODO: This is so complicated, it probably should be its own file. It might also make sense to have it work in Rescript directly, taking in a function rather than a reducer; then something else can wrap that function in the reducer/lambdas/environment.
/*
The key idea for this function is that
@@ -290,25 +290,25 @@ module DiminishingReturns = {
) {
| (false, _, _, _) =>
Error(
- "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, number of functions should be greater than 1."->Reducer_ErrorValue.REOther,
+ "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, number of functions should be greater than 1."->SqError.Message.REOther,
)
| (_, false, _, _) =>
Error(
- "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, funds should be greater than 0."->Reducer_ErrorValue.REOther,
+ "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, funds should be greater than 0."->SqError.Message.REOther,
)
| (_, _, false, _) =>
Error(
- "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, approximateIncrement should be greater than 0."->Reducer_ErrorValue.REOther,
+ "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, approximateIncrement should be greater than 0."->SqError.Message.REOther,
)
| (_, _, _, false) =>
Error(
- "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, approximateIncrement should be smaller than funds amount."->Reducer_ErrorValue.REOther,
+ "Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions, approximateIncrement should be smaller than funds amount."->SqError.Message.REOther,
)
| (true, true, true, true) => {
let applyFunctionAtPoint = (lambda, point: float) => {
// Defined here so that it has access to environment, reducer
let pointAsInternalExpression = FunctionRegistry_Helpers.Wrappers.evNumber(point)
- let resultAsInternalExpression = Reducer_Expression_Lambda.doLambdaCall(
+ let resultAsInternalExpression = Reducer_Lambda.doLambdaCall(
lambda,
[pointAsInternalExpression],
environment,
@@ -318,7 +318,7 @@ module DiminishingReturns = {
| Reducer_T.IEvNumber(x) => Ok(x)
| _ =>
Error(
- "Error 1 in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead"->Reducer_ErrorValue.REOther,
+ "Error 1 in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions. It's possible that your function doesn't return a number, try definining auxiliaryFunction(x) = mean(yourFunction(x)) and integrate auxiliaryFunction instead"->SqError.Message.REOther,
)
}
}
@@ -411,7 +411,7 @@ module DiminishingReturns = {
| Reducer_T.IEvLambda(lambda) => Ok(lambda)
| _ =>
"Error in Danger.optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions. A member of the array wasn't a function"
- ->Reducer_ErrorValue.REOther
+ ->SqError.Message.REOther
->Error
}
}, innerlambdas)
@@ -433,7 +433,7 @@ module DiminishingReturns = {
}
| _ =>
"Error in Danger.diminishingMarginalReturnsForTwoFunctions"
- ->Reducer_ErrorValue.REOther
+ ->SqError.Message.REOther
->Error
},
(),
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Date.res b/packages/squiggle-lang/src/rescript/FR/FR_Date.res
index c9732980..0e4b828d 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Date.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Date.res
@@ -4,7 +4,7 @@ open FunctionRegistry_Helpers
let makeFn = (
name: string,
inputs: array,
- fn: array => result,
+ fn: array => result,
) =>
Function.make(
~name,
@@ -66,7 +66,7 @@ let library = [
| [IEvNumber(year)] =>
switch DateTime.Date.makeFromYear(year) {
| Ok(t) => IEvDate(t)->Ok
- | Error(e) => Reducer_ErrorValue.RETodo(e)->Error
+ | Error(e) => SqError.Message.RETodo(e)->Error
}
| _ => Error(impossibleError)
}
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Dict.res b/packages/squiggle-lang/src/rescript/FR/FR_Dict.res
index 77ca49a7..a858e1bb 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Dict.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Dict.res
@@ -17,7 +17,7 @@ module Internals = {
->E.A2.fmap(((key, value)) => Wrappers.evArray([IEvString(key), value]))
->Wrappers.evArray
- let fromList = (items: array): result =>
+ let fromList = (items: array): result =>
items
->E.A2.fmap(item => {
switch (item: Reducer_T.value) {
@@ -76,7 +76,7 @@ let library = [
->Belt.Array.map(dictValue =>
switch dictValue {
| IEvRecord(dict) => dict
- | _ => impossibleError->Reducer_ErrorValue.toException
+ | _ => impossibleError->SqError.Message.throw
}
)
->Internals.mergeMany
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Dist.res b/packages/squiggle-lang/src/rescript/FR/FR_Dist.res
index 97befcd4..8f5ec0a1 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Dist.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Dist.res
@@ -16,13 +16,14 @@ module DistributionCreation = {
r
->E.R.bind(Process.DistOrNumberToDist.twoValuesUsingSymbolicDist(~fn, ~values=_, ~env))
->E.R2.fmap(Wrappers.evDistribution)
- ->E.R2.errMap(e => Reducer_ErrorValue.REOther(e))
+ ->E.R2.errMap(e => SqError.Message.REOther(e))
let make = (name, fn) => {
FnDefinition.make(
~name,
~inputs=[FRTypeDistOrNumber, FRTypeDistOrNumber],
- ~run=(inputs, env, _) => inputs->Prepare.ToValueTuple.twoDistOrNumber->process(~fn, ~env),
+ ~run=(inputs, context, _) =>
+ inputs->Prepare.ToValueTuple.twoDistOrNumber->process(~fn, ~env=context.environment),
(),
)
}
@@ -31,8 +32,10 @@ module DistributionCreation = {
FnDefinition.make(
~name,
~inputs=[FRTypeRecord([("p5", FRTypeDistOrNumber), ("p95", FRTypeDistOrNumber)])],
- ~run=(inputs, env, _) =>
- inputs->Prepare.ToValueTuple.Record.twoDistOrNumber(("p5", "p95"))->process(~fn, ~env),
+ ~run=(inputs, context, _) =>
+ inputs
+ ->Prepare.ToValueTuple.Record.twoDistOrNumber(("p5", "p95"))
+ ->process(~fn, ~env=context.environment),
(),
)
}
@@ -41,10 +44,10 @@ module DistributionCreation = {
FnDefinition.make(
~name,
~inputs=[FRTypeRecord([("mean", FRTypeDistOrNumber), ("stdev", FRTypeDistOrNumber)])],
- ~run=(inputs, env, _) =>
+ ~run=(inputs, context, _) =>
inputs
->Prepare.ToValueTuple.Record.twoDistOrNumber(("mean", "stdev"))
- ->process(~fn, ~env),
+ ->process(~fn, ~env=context.environment),
(),
)
}
@@ -55,13 +58,14 @@ module DistributionCreation = {
r
->E.R.bind(Process.DistOrNumberToDist.oneValueUsingSymbolicDist(~fn, ~value=_, ~env))
->E.R2.fmap(Wrappers.evDistribution)
- ->E.R2.errMap(e => Reducer_ErrorValue.REOther(e))
+ ->E.R2.errMap(e => SqError.Message.REOther(e))
let make = (name, fn) =>
FnDefinition.make(
~name,
~inputs=[FRTypeDistOrNumber],
- ~run=(inputs, env, _) => inputs->Prepare.ToValueTuple.oneDistOrNumber->process(~fn, ~env),
+ ~run=(inputs, context, _) =>
+ inputs->Prepare.ToValueTuple.oneDistOrNumber->process(~fn, ~env=context.environment),
(),
)
}
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res b/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res
index 6f98d132..ad456650 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res
@@ -296,7 +296,7 @@ module Old = {
let genericOutputToReducerValue = (o: DistributionOperation.outputType): result<
Reducer_T.value,
- Reducer_ErrorValue.errorValue,
+ SqError.Message.t,
> =>
switch o {
| Dist(d) => Ok(Reducer_T.IEvDistribution(d))
@@ -311,9 +311,9 @@ module Old = {
switch dispatchToGenericOutput(call, environment) {
| Some(o) => genericOutputToReducerValue(o)
| None =>
- Reducer_ErrorValue.REOther("Internal error in FR_GenericDist implementation")
- ->Reducer_ErrorValue.ErrorException
- ->raise
+ SqError.Message.REOther(
+ "Internal error in FR_GenericDist implementation",
+ )->SqError.Message.throw
}
}
@@ -326,7 +326,7 @@ let makeProxyFn = (name: string, inputs: array) => {
FnDefinition.make(
~name,
~inputs,
- ~run=(inputs, env, _) => Old.dispatch((name, inputs), env),
+ ~run=(inputs, context, _) => Old.dispatch((name, inputs), context.environment),
(),
),
],
@@ -402,9 +402,9 @@ let library = E.A.concatMany([
])
// FIXME - impossible to implement with FR due to arbitrary parameters length;
-let mxLambda = Reducer_Expression_Lambda.makeFFILambda((inputs, env, _) => {
- switch Old.dispatch(("mx", inputs), env) {
+let mxLambda = Reducer_Lambda.makeFFILambda("mx", (inputs, context, _) => {
+ switch Old.dispatch(("mx", inputs), context.environment) {
| Ok(value) => value
- | Error(e) => e->Reducer_ErrorValue.ErrorException->raise
+ | Error(e) => e->SqError.Message.throw
}
})
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_List.res b/packages/squiggle-lang/src/rescript/FR/FR_List.res
index 21106978..803bfc05 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_List.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_List.res
@@ -5,6 +5,10 @@ let nameSpace = "List"
let requiresNamespace = true
module Internals = {
+ let length = (v: array): Reducer_T.value => IEvNumber(
+ Belt.Int.toFloat(Array.length(v)),
+ )
+
let makeFromNumber = (n: float, value: Reducer_T.value): Reducer_T.value => IEvArray(
Belt.Array.make(E.Float.toInt(n), value),
)
@@ -26,11 +30,11 @@ module Internals = {
let map = (
array: array,
eLambdaValue,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
): Reducer_T.value => {
Belt.Array.map(array, elem =>
- Reducer_Expression_Lambda.doLambdaCall(eLambdaValue, [elem], env, reducer)
+ Reducer_Lambda.doLambdaCall(eLambdaValue, [elem], context, reducer)
)->Wrappers.evArray
}
@@ -38,11 +42,11 @@ module Internals = {
aValueArray,
initialValue,
aLambdaValue,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
) => {
aValueArray->E.A.reduce(initialValue, (acc, elem) =>
- Reducer_Expression_Lambda.doLambdaCall(aLambdaValue, [acc, elem], env, reducer)
+ Reducer_Lambda.doLambdaCall(aLambdaValue, [acc, elem], context, reducer)
)
}
@@ -50,22 +54,22 @@ module Internals = {
aValueArray,
initialValue,
aLambdaValue,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
) => {
aValueArray->Belt.Array.reduceReverse(initialValue, (acc, elem) =>
- Reducer_Expression_Lambda.doLambdaCall(aLambdaValue, [acc, elem], env, reducer)
+ Reducer_Lambda.doLambdaCall(aLambdaValue, [acc, elem], context, reducer)
)
}
let filter = (
aValueArray,
aLambdaValue,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
) => {
Js.Array2.filter(aValueArray, elem => {
- let result = Reducer_Expression_Lambda.doLambdaCall(aLambdaValue, [elem], env, reducer)
+ let result = Reducer_Lambda.doLambdaCall(aLambdaValue, [elem], context, reducer)
switch result {
| IEvBool(true) => true
| _ => false
@@ -75,6 +79,26 @@ module Internals = {
}
let library = [
+ Function.make(
+ ~name="length",
+ ~nameSpace,
+ ~output=EvtNumber,
+ ~requiresNamespace=true,
+ ~examples=[`List.length([1,4,5])`],
+ ~definitions=[
+ FnDefinition.make(
+ ~name="length",
+ ~inputs=[FRTypeArray(FRTypeAny)],
+ ~run=(inputs, _, _) =>
+ switch inputs {
+ | [IEvArray(array)] => Internals.length(array)->Ok
+ | _ => Error(impossibleError)
+ },
+ (),
+ ),
+ ],
+ (),
+ ),
Function.make(
~name="make",
~nameSpace,
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res b/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res
index a12164bd..f7caaabb 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res
@@ -16,30 +16,30 @@ let inputsToDist = (inputs: array, xyShapeToPointSetDist) => {
let yValue = map->Belt.Map.String.get("y")
switch (xValue, yValue) {
| (Some(IEvNumber(x)), Some(IEvNumber(y))) => (x, y)
- | _ => impossibleError->Reducer_ErrorValue.toException
+ | _ => impossibleError->SqError.Message.throw
}
}
- | _ => impossibleError->Reducer_ErrorValue.toException
+ | _ => impossibleError->SqError.Message.throw
}
)
->Ok
->E.R.bind(r => r->XYShape.T.makeFromZipped->E.R2.errMap(XYShape.Error.toString))
->E.R2.fmap(r => Reducer_T.IEvDistribution(PointSet(r->xyShapeToPointSetDist)))
- | _ => impossibleError->Reducer_ErrorValue.toException
+ | _ => impossibleError->SqError.Message.throw
}
}
module Internal = {
type t = PointSetDist.t
- let toType = (r): result =>
+ let toType = (r): result =>
switch r {
| Ok(r) => Ok(Wrappers.evDistribution(PointSet(r)))
| Error(err) => Error(REOperationError(err))
}
let doLambdaCall = (aLambdaValue, list, env, reducer) =>
- switch Reducer_Expression_Lambda.doLambdaCall(aLambdaValue, list, env, reducer) {
+ switch Reducer_Lambda.doLambdaCall(aLambdaValue, list, env, reducer) {
| Reducer_T.IEvNumber(f) => Ok(f)
| _ => Error(Operation.SampleMapNeedsNtoNFunction)
}
@@ -61,18 +61,18 @@ let library = [
FnDefinition.make(
~name="fromDist",
~inputs=[FRTypeDist],
- ~run=(inputs, env, _) =>
+ ~run=(inputs, context, _) =>
switch inputs {
| [IEvDistribution(dist)] =>
GenericDist.toPointSet(
dist,
- ~xyPointLength=env.xyPointLength,
- ~sampleCount=env.sampleCount,
+ ~xyPointLength=context.environment.xyPointLength,
+ ~sampleCount=context.environment.sampleCount,
(),
)
->E.R2.fmap(Wrappers.pointSet)
->E.R2.fmap(Wrappers.evDistribution)
- ->E.R2.errMap(e => Reducer_ErrorValue.REDistributionError(e))
+ ->E.R2.errMap(e => SqError.Message.REDistributionError(e))
| _ => Error(impossibleError)
},
(),
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res b/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res
index 9263bf29..ab50a04b 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res
@@ -10,41 +10,40 @@ module Internal = {
let doLambdaCall = (
aLambdaValue,
list,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
) =>
- switch Reducer_Expression_Lambda.doLambdaCall(aLambdaValue, list, env, reducer) {
+ switch Reducer_Lambda.doLambdaCall(aLambdaValue, list, context, reducer) {
| IEvNumber(f) => Ok(f)
| _ => Error(Operation.SampleMapNeedsNtoNFunction)
}
- let toType = (r): result =>
+ let toType = (r): result =>
switch r {
| Ok(r) => Ok(Wrappers.evDistribution(SampleSet(r)))
| Error(r) => Error(REDistributionError(SampleSetError(r)))
}
//TODO: I don't know why this seems to need at least one input
- let fromFn = (aLambdaValue, environment: Reducer_T.environment, reducer: Reducer_T.reducerFn) => {
- let sampleCount = environment.sampleCount
- let fn = r => doLambdaCall(aLambdaValue, [IEvNumber(r)], environment, reducer)
+ let fromFn = (aLambdaValue, context: Reducer_T.context, reducer: Reducer_T.reducerFn) => {
+ let sampleCount = context.environment.sampleCount
+ let fn = r => doLambdaCall(aLambdaValue, [IEvNumber(r)], context, reducer)
Belt_Array.makeBy(sampleCount, r => fn(r->Js.Int.toFloat))->E.A.R.firstErrorOrOpen
}
- let map1 = (sampleSetDist: t, aLambdaValue, environment: Reducer_T.environment, reducer) => {
- let fn = r => doLambdaCall(aLambdaValue, [IEvNumber(r)], environment, reducer)
+ let map1 = (sampleSetDist: t, aLambdaValue, context: Reducer_T.context, reducer) => {
+ let fn = r => doLambdaCall(aLambdaValue, [IEvNumber(r)], context, reducer)
SampleSetDist.samplesMap(~fn, sampleSetDist)->toType
}
- let map2 = (t1: t, t2: t, aLambdaValue, environment: Reducer_T.environment, reducer) => {
- let fn = (a, b) =>
- doLambdaCall(aLambdaValue, [IEvNumber(a), IEvNumber(b)], environment, reducer)
+ let map2 = (t1: t, t2: t, aLambdaValue, context: Reducer_T.context, reducer) => {
+ let fn = (a, b) => doLambdaCall(aLambdaValue, [IEvNumber(a), IEvNumber(b)], context, reducer)
SampleSetDist.map2(~fn, ~t1, ~t2)->toType
}
- let map3 = (t1: t, t2: t, t3: t, aLambdaValue, environment: Reducer_T.environment, reducer) => {
+ let map3 = (t1: t, t2: t, t3: t, aLambdaValue, context: Reducer_T.context, reducer) => {
let fn = (a, b, c) =>
- doLambdaCall(aLambdaValue, [IEvNumber(a), IEvNumber(b), IEvNumber(c)], environment, reducer)
+ doLambdaCall(aLambdaValue, [IEvNumber(a), IEvNumber(b), IEvNumber(c)], context, reducer)
SampleSetDist.map3(~fn, ~t1, ~t2, ~t3)->toType
}
@@ -60,7 +59,7 @@ module Internal = {
let mapN = (
aValueArray: array,
aLambdaValue,
- environment: Reducer_T.environment,
+ context: Reducer_T.context,
reducer,
) => {
switch parseSampleSetArray(aValueArray) {
@@ -69,7 +68,7 @@ module Internal = {
doLambdaCall(
aLambdaValue,
[IEvArray(E.A.fmap(x => Wrappers.evNumber(x), a))],
- environment,
+ context,
reducer,
)
SampleSetDist.mapN(~fn, ~t1)->toType
@@ -89,13 +88,13 @@ let libaryBase = [
FnDefinition.make(
~name="fromDist",
~inputs=[FRTypeDist],
- ~run=(inputs, environment, _) =>
+ ~run=(inputs, context, _) =>
switch inputs {
| [IEvDistribution(dist)] =>
- GenericDist.toSampleSetDist(dist, environment.sampleCount)
+ GenericDist.toSampleSetDist(dist, context.environment.sampleCount)
->E.R2.fmap(Wrappers.sampleSet)
->E.R2.fmap(Wrappers.evDistribution)
- ->E.R2.errMap(e => Reducer_ErrorValue.REDistributionError(e))
+ ->E.R2.errMap(e => SqError.Message.REDistributionError(e))
| _ => Error(impossibleError)
},
(),
@@ -116,7 +115,7 @@ let libaryBase = [
~run=(inputs, _, _) => {
let sampleSet =
inputs->Prepare.ToTypedArray.numbers
- |> E.R2.bind(r => SampleSetDist.make(r)->E.R2.errMap(_ => "AM I HERE? WHYERE AMI??"))
+ |> E.R2.bind(r => SampleSetDist.make(r)->E.R2.errMap(SampleSetDist.Error.toString))
sampleSet
->E.R2.fmap(Wrappers.sampleSet)
->E.R2.fmap(Wrappers.evDistribution)
@@ -163,7 +162,7 @@ let libaryBase = [
| [IEvLambda(lambda)] =>
switch Internal.fromFn(lambda, environment, reducer) {
| Ok(r) => Ok(r->Wrappers.sampleSet->Wrappers.evDistribution)
- | Error(e) => e->Reducer_ErrorValue.REOperationError->Error
+ | Error(e) => e->SqError.Message.REOperationError->Error
}
| _ => Error(impossibleError)
},
@@ -290,7 +289,7 @@ module Comparison = {
r
->E.R2.fmap(r => r->Wrappers.sampleSet->Wrappers.evDistribution)
->E.R2.errMap(e =>
- e->DistributionTypes.Error.sampleErrorToDistErr->Reducer_ErrorValue.REDistributionError
+ e->DistributionTypes.Error.sampleErrorToDistErr->SqError.Message.REDistributionError
)
let mkBig = (name, withDist, withFloat) =>
diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res b/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res
index 5b780da5..ffe10384 100644
--- a/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res
+++ b/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res
@@ -6,7 +6,7 @@ let requiresNamespace = true
let runScoring = (estimate, answer, prior, env) => {
GenericDist.Score.logScore(~estimate, ~answer, ~prior, ~env)
->E.R2.fmap(FunctionRegistry_Helpers.Wrappers.evNumber)
- ->E.R2.errMap(e => Reducer_ErrorValue.REDistributionError(e))
+ ->E.R2.errMap(e => SqError.Message.REDistributionError(e))
}
let library = [
@@ -30,15 +30,15 @@ let library = [
("prior", FRTypeDist),
]),
],
- ~run=(inputs, environment, _) => {
+ ~run=(inputs, context, _) => {
switch FunctionRegistry_Helpers.Prepare.ToValueArray.Record.threeArgs(
inputs,
("estimate", "answer", "prior"),
) {
| Ok([IEvDistribution(estimate), IEvDistribution(d), IEvDistribution(prior)]) =>
- runScoring(estimate, Score_Dist(d), Some(prior), environment)
+ runScoring(estimate, Score_Dist(d), Some(prior), context.environment)
| Ok([IEvDistribution(estimate), IEvNumber(d), IEvDistribution(prior)]) =>
- runScoring(estimate, Score_Scalar(d), Some(prior), environment)
+ runScoring(estimate, Score_Scalar(d), Some(prior), context.environment)
| Error(e) => Error(e->FunctionRegistry_Helpers.wrapError)
| _ => Error(FunctionRegistry_Helpers.impossibleError)
}
@@ -48,15 +48,15 @@ let library = [
FnDefinition.make(
~name="logScore",
~inputs=[FRTypeRecord([("estimate", FRTypeDist), ("answer", FRTypeDistOrNumber)])],
- ~run=(inputs, environment, _) => {
+ ~run=(inputs, context, _) => {
switch FunctionRegistry_Helpers.Prepare.ToValueArray.Record.twoArgs(
inputs,
("estimate", "answer"),
) {
| Ok([IEvDistribution(estimate), IEvDistribution(d)]) =>
- runScoring(estimate, Score_Dist(d), None, environment)
+ runScoring(estimate, Score_Dist(d), None, context.environment)
| Ok([IEvDistribution(estimate), IEvNumber(d)]) =>
- runScoring(estimate, Score_Scalar(d), None, environment)
+ runScoring(estimate, Score_Scalar(d), None, context.environment)
| Error(e) => Error(e->FunctionRegistry_Helpers.wrapError)
| _ => Error(FunctionRegistry_Helpers.impossibleError)
}
@@ -76,10 +76,10 @@ let library = [
FnDefinition.make(
~name="klDivergence",
~inputs=[FRTypeDist, FRTypeDist],
- ~run=(inputs, environment, _) => {
+ ~run=(inputs, context, _) => {
switch inputs {
| [IEvDistribution(estimate), IEvDistribution(d)] =>
- runScoring(estimate, Score_Dist(d), None, environment)
+ runScoring(estimate, Score_Dist(d), None, context.environment)
| _ => Error(FunctionRegistry_Helpers.impossibleError)
}
},
diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_ReducerProject.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_ReducerProject.res
index 93a47e31..7c49461b 100644
--- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_ReducerProject.res
+++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_ReducerProject.res
@@ -1,7 +1,8 @@
@genType type reducerProject = ReducerProject_T.project //re-export
@genType type reducerProjectJson = ReducerProject_T.projectJson //re-export
-type reducerErrorValue = ForTS_Reducer_ErrorValue.reducerErrorValue //use
+type error = SqError.t //use
+type errorMessage = SqError.Message.t //use
type squiggleValue = ForTS_SquiggleValue.squiggleValue //use
type squiggleValue_Record = ForTS_SquiggleValue.squiggleValue_Record //use
@@ -104,10 +105,8 @@ let cleanAllResults = (project: reducerProject): unit => project->Private.cleanA
To set the includes one first has to call "parseIncludes". The parsed includes or the parser error is returned.
*/
@genType
-let getIncludes = (project: reducerProject, sourceId: string): result<
- array,
- reducerErrorValue,
-> => project->Private.getIncludes(sourceId)
+let getIncludes = (project: reducerProject, sourceId: string): result, error> =>
+ project->Private.getIncludes(sourceId)
/* Other sources contributing to the global namespace of this source. */
@genType
@@ -199,10 +198,8 @@ let getBindings = (project: reducerProject, sourceId: string): squiggleValue_Rec
Get the result after running this source file or the project
*/
@genType
-let getResult = (project: reducerProject, sourceId: string): result<
- squiggleValue,
- reducerErrorValue,
-> => project->Private.getResult(sourceId)
+let getResult = (project: reducerProject, sourceId: string): result =>
+ project->Private.getResult(sourceId)
/*
This is a convenience function to get the result of a single source without creating a project.
@@ -210,10 +207,8 @@ However, without a project, you cannot handle include directives.
The source has to be include free
*/
@genType
-let evaluate = (sourceCode: string): (
- result,
- squiggleValue_Record,
-) => Private.evaluate(sourceCode)
+let evaluate = (sourceCode: string): (result, squiggleValue_Record) =>
+ Private.evaluate(sourceCode)
@genType
let setEnvironment = (project: reducerProject, environment: environment): unit =>
diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res
deleted file mode 100644
index d4a8059b..00000000
--- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_Reducer_ErrorValue.res
+++ /dev/null
@@ -1,18 +0,0 @@
-@genType type reducerErrorValue = Reducer_ErrorValue.errorValue //alias
-@genType type syntaxErrorLocation = Reducer_ErrorValue.syntaxErrorLocation //alias
-
-@genType
-let toString = (e: reducerErrorValue): string => Reducer_ErrorValue.errorToString(e)
-
-@genType
-let getLocation = (e: reducerErrorValue): option =>
- switch e {
- | RESyntaxError(_, optionalLocation) => optionalLocation
- | _ => None
- }
-
-@genType
-let createTodoError = (v: string) => Reducer_ErrorValue.RETodo(v)
-
-@genType
-let createOtherError = (v: string) => Reducer_ErrorValue.REOther(v)
diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue.res
index 8331e776..d116b74b 100644
--- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue.res
+++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue.res
@@ -1,5 +1,5 @@
@genType type squiggleValue = Reducer_T.value //re-export
-type reducerErrorValue = ForTS_Reducer_ErrorValue.reducerErrorValue //use
+type error = SqError.t //use
@genType type squiggleValue_Array = Reducer_T.arrayValue //re-export recursive type
@genType type squiggleValue_Record = Reducer_T.map //re-export recursive type
@@ -69,7 +69,7 @@ let toString = (variant: squiggleValue) => Reducer_Value.toString(variant)
// This is a useful method for unit tests.
// Convert the result along with the error message to a string.
@genType
-let toStringResult = (variantResult: result) =>
+let toStringResult = (variantResult: result) =>
Reducer_Value.toStringResult(variantResult)
@genType
diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res
index a9793e87..58213c04 100644
--- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res
+++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res
@@ -1,9 +1,7 @@
@genType type squiggleValue_Lambda = Reducer_T.lambdaValue //re-export
@genType
-let toString = (v: squiggleValue_Lambda): string => Reducer_Value.toStringFunction(v)
+let toString = (v: squiggleValue_Lambda): string => Reducer_Value.toStringLambda(v)
@genType
-let parameters = (v: squiggleValue_Lambda): array => {
- v.parameters
-}
+let parameters = (v: squiggleValue_Lambda): array => Reducer_Lambda.parameters(v)
diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS__Types.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS__Types.res
index 1cd74827..b2bb9d98 100644
--- a/packages/squiggle-lang/src/rescript/ForTS/ForTS__Types.res
+++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS__Types.res
@@ -1,6 +1,3 @@
-@genType type reducerErrorValue = ForTS_Reducer_ErrorValue.reducerErrorValue //re-export
-@genType type syntaxErrorLocation = ForTS_Reducer_ErrorValue.syntaxErrorLocation //re-export
-
@genType type reducerProject = ForTS_ReducerProject.reducerProject //re-export
@genType type squiggleValue = ForTS_SquiggleValue.squiggleValue //re-export
@genType type squiggleValue_Array = ForTS_SquiggleValue_Array.squiggleValue_Array //re-export
diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res
index 9683147f..d2d0cfbe 100644
--- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res
+++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res
@@ -1,5 +1,5 @@
type internalExpressionValueType = Reducer_Value.internalExpressionValueType
-type errorValue = Reducer_ErrorValue.errorValue
+type errorMessage = SqError.Message.t
/*
Function Registry "Type". A type, without any other information.
@@ -30,9 +30,9 @@ type fnDefinition = {
inputs: array,
run: (
array,
- Reducer_T.environment,
+ Reducer_T.context,
Reducer_T.reducerFn,
- ) => result,
+ ) => result,
}
type function = {
@@ -122,11 +122,11 @@ module FnDefinition = {
let run = (
t: t,
args: array,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
) => {
switch t->isMatch(args) {
- | true => t.run(args, env, reducer)
+ | true => t.run(args, context, reducer)
| false => REOther("Incorrect Types")->Error
}
}
@@ -164,7 +164,7 @@ module Function = {
nameSpace: nameSpace,
definitions: definitions,
output: output,
- examples: examples |> E.O.default([]),
+ examples: examples->E.O2.default([]),
isExperimental: isExperimental,
requiresNamespace: requiresNamespace,
description: description,
@@ -225,9 +225,9 @@ module Registry = {
registry,
fnName: string,
args: array,
- env: Reducer_T.environment,
+ context: Reducer_T.context,
reducer: Reducer_T.reducerFn,
- ): result => {
+ ): result => {
switch Belt.Map.String.get(registry.fnNameDict, fnName) {
| Some(definitions) => {
let showNameMatchDefinitions = () => {
@@ -241,7 +241,7 @@ module Registry = {
let match = definitions->Js.Array2.find(def => def->FnDefinition.isMatch(args))
switch match {
- | Some(def) => def->FnDefinition.run(args, env, reducer)
+ | Some(def) => def->FnDefinition.run(args, context, reducer)
| None => REOther(showNameMatchDefinitions())->Error
}
}
diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res
index 9a7f04db..9ace7e20 100644
--- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res
+++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res
@@ -2,8 +2,8 @@ open FunctionRegistry_Core
open Reducer_T
let impossibleErrorString = "Wrong inputs / Logically impossible"
-let impossibleError: errorValue = impossibleErrorString->Reducer_ErrorValue.REOther
-let wrapError = e => Reducer_ErrorValue.REOther(e)
+let impossibleError: errorMessage = impossibleErrorString->SqError.Message.REOther
+let wrapError = e => SqError.Message.REOther(e)
module Wrappers = {
let symbolic = r => DistributionTypes.Symbolic(r)
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Context.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Context.res
index c45994bb..809ac514 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Context.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Context.res
@@ -4,9 +4,13 @@ let defaultEnvironment: Reducer_T.environment = DistributionOperation.defaultEnv
let createContext = (stdLib: Reducer_Namespace.t, environment: Reducer_T.environment): t => {
{
+ frameStack: list{},
bindings: stdLib->Reducer_Bindings.fromNamespace->Reducer_Bindings.extend,
environment: environment,
+ inFunction: None,
}
}
-let createDefaultContext = (): t => createContext(SquiggleLibrary_StdLib.stdLib, defaultEnvironment)
+let currentFunctionName = (t: t): string => {
+ t.inFunction->E.O2.fmap(Reducer_Lambda_T.name)->E.O2.default(Reducer_T.topFrameName)
+}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_ChainPiece.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_ChainPiece.res
deleted file mode 100644
index e545bb2d..00000000
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_ChainPiece.res
+++ /dev/null
@@ -1,27 +0,0 @@
-// types are disabled until review and rewrite for 0.5 interpreter compatibility
-/*
-module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
-module T = Reducer_Dispatch_T
-module TypeChecker = Reducer_Type_TypeChecker
-open Reducer_Value
-
-type errorValue = Reducer_ErrorValue.errorValue
-
-let makeFromTypes = jumpTable => {
- let dispatchChainPiece: T.dispatchChainPiece = (
- (fnName, fnArgs): functionCall,
- accessors: ProjectAccessorsT.t,
- ) => {
- let jumpTableEntry = jumpTable->Js.Array2.find(elem => {
- let (candidName, candidType, _) = elem
- candidName == fnName && TypeChecker.checkITypeArgumentsBool(candidType, fnArgs)
- })
- switch jumpTableEntry {
- | Some((_, _, bridgeFn)) => bridgeFn(fnArgs, accessors)->Some
- | _ => None
- }
- }
- dispatchChainPiece
-}
-
-*/
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_T.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_T.res
deleted file mode 100644
index 0d852783..00000000
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_T.res
+++ /dev/null
@@ -1,21 +0,0 @@
-// module ExpressionT = Reducer_Expression_T
-// module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
-
-// // Each piece of the dispatch chain computes the result or returns None so that the chain can continue
-// type dispatchChainPiece = (
-// Reducer_Value.functionCall,
-// ProjectAccessorsT.t,
-// ) => option>
-
-// type dispatchChainPieceWithReducer = (
-// Reducer_Value.functionCall,
-// ProjectAccessorsT.t,
-// Reducer_T.reducerFn,
-// ) => option>
-
-// // This is a switch statement case implementation: get the arguments and compute the result
-// type genericIEvFunction = (
-// array,
-// ProjectAccessorsT.t,
-// ) => result
-
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res
deleted file mode 100644
index b6baeaf5..00000000
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_ErrorValue.res
+++ /dev/null
@@ -1,83 +0,0 @@
-//TODO: Do not export here but in ForTS__Types
-@gentype.import("peggy") @genType.as("LocationRange")
-type syntaxErrorLocation
-
-@genType.opaque
-type errorValue =
- | REArityError(option, int, int)
- | REArrayIndexNotFound(string, int)
- | REAssignmentExpected
- | REDistributionError(DistributionTypes.error)
- | REExpectedType(string, string)
- | REExpressionExpected
- | REFunctionExpected(string)
- | REFunctionNotFound(string)
- | REJavaScriptExn(option, option) // Javascript Exception
- | REMacroNotFound(string)
- | RENotAFunction(string)
- | REOperationError(Operation.operationError)
- | RERecordPropertyNotFound(string, string)
- | RESymbolNotFound(string)
- | RESyntaxError(string, option)
- | RETodo(string) // To do
- | REUnitNotFound(string)
- | RENeedToRun
- | REOther(string)
-
-type t = errorValue
-
-exception ErrorException(errorValue)
-
-let errorToString = err =>
- switch err {
- | REArityError(_oFnName, arity, usedArity) =>
- `${Js.String.make(arity)} arguments expected. Instead ${Js.String.make(
- usedArity,
- )} argument(s) were passed.`
- | REArrayIndexNotFound(msg, index) => `${msg}: ${Js.String.make(index)}`
- | REAssignmentExpected => "Assignment expected"
- | REExpressionExpected => "Expression expected"
- | REFunctionExpected(msg) => `Function expected: ${msg}`
- | REFunctionNotFound(msg) => `Function not found: ${msg}`
- | REDistributionError(err) => `Distribution Math Error: ${DistributionTypes.Error.toString(err)}`
- | REOperationError(err) => `Math Error: ${Operation.Error.toString(err)}`
- | REJavaScriptExn(omsg, oname) => {
- let answer = "JS Exception:"
- let answer = switch oname {
- | Some(name) => `${answer} ${name}`
- | _ => answer
- }
- let answer = switch omsg {
- | Some(msg) => `${answer}: ${msg}`
- | _ => answer
- }
- answer
- }
- | REMacroNotFound(macro) => `Macro not found: ${macro}`
- | RENotAFunction(valueString) => `${valueString} is not a function`
- | RERecordPropertyNotFound(msg, index) => `${msg}: ${index}`
- | RESymbolNotFound(symbolName) => `${symbolName} is not defined`
- | RESyntaxError(desc, _) => `Syntax Error: ${desc}`
- | RETodo(msg) => `TODO: ${msg}`
- | REExpectedType(typeName, valueString) => `Expected type: ${typeName} but got: ${valueString}`
- | REUnitNotFound(unitName) => `Unit not found: ${unitName}`
- | RENeedToRun => "Need to run"
- | REOther(msg) => `Error: ${msg}`
- }
-
-let fromException = exn =>
- switch exn {
- | ErrorException(e) => e
- | Js.Exn.Error(e) =>
- switch Js.Exn.message(e) {
- | Some(message) => REOther(message)
- | None =>
- switch Js.Exn.name(e) {
- | Some(name) => REOther(name)
- | None => REOther("Unknown error")
- }
- }
- | _e => REOther("Unknown error")
- }
-
-let toException = (errorValue: t) => raise(ErrorException(errorValue))
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Exception.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Exception.res
deleted file mode 100644
index 14db0843..00000000
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Exception.res
+++ /dev/null
@@ -1,3 +0,0 @@
-// There are switch statement cases in the code which are impossible to reach by design.
-// ImpossibleException is a sign of programming error.
-exception ImpossibleException(string)
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res
index c28e121e..4906dd54 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression.res
@@ -1,16 +1,25 @@
module Bindings = Reducer_Bindings
-module Lambda = Reducer_Expression_Lambda
module Result = Belt.Result
module T = Reducer_T
-type errorValue = Reducer_ErrorValue.errorValue
+let toLocation = (expression: T.expression): Reducer_Peggy_Parse.location => {
+ expression.ast.location
+}
+
+let throwFrom = (error: SqError.Message.t, expression: T.expression, context: T.context) =>
+ error->SqError.throwMessageWithFrameStack(
+ context.frameStack->Reducer_FrameStack.extend(
+ context->Reducer_Context.currentFunctionName,
+ Some(expression->toLocation),
+ ),
+ )
/*
Recursively evaluate the expression
*/
let rec evaluate: T.reducerFn = (expression, context): (T.value, T.context) => {
// Js.log(`reduce: ${expression->Reducer_Expression_T.toString}`)
- switch expression {
+ switch expression.content {
| T.EBlock(statements) => {
let innerContext = {...context, bindings: context.bindings->Bindings.extend}
let (value, _) =
@@ -49,7 +58,7 @@ let rec evaluate: T.reducerFn = (expression, context): (T.value, T.context) => {
let (key, _) = eKey->evaluate(context)
let keyString = switch key {
| IEvString(s) => s
- | _ => REOther("Record keys must be strings")->Reducer_ErrorValue.ErrorException->raise
+ | _ => REOther("Record keys must be strings")->throwFrom(expression, context)
}
let (value, _) = eValue->evaluate(context)
(keyString, value)
@@ -73,7 +82,7 @@ let rec evaluate: T.reducerFn = (expression, context): (T.value, T.context) => {
| T.ESymbol(name) =>
switch context.bindings->Bindings.get(name) {
| Some(v) => (v, context)
- | None => Reducer_ErrorValue.RESymbolNotFound(name)->Reducer_ErrorValue.ErrorException->raise
+ | None => RESymbolNotFound(name)->throwFrom(expression, context)
}
| T.EValue(value) => (value, context)
@@ -82,28 +91,39 @@ let rec evaluate: T.reducerFn = (expression, context): (T.value, T.context) => {
let (predicateResult, _) = predicate->evaluate(context)
switch predicateResult {
| T.IEvBool(value) => (value ? trueCase : falseCase)->evaluate(context)
- | _ => REExpectedType("Boolean", "")->Reducer_ErrorValue.ErrorException->raise
+ | _ => REExpectedType("Boolean", "")->throwFrom(expression, context)
}
}
- | T.ELambda(parameters, body) => (
- Lambda.makeLambda(parameters, context.bindings, body)->T.IEvLambda,
+ | T.ELambda(parameters, body, name) => (
+ Reducer_Lambda.makeLambda(
+ name,
+ parameters,
+ context.bindings,
+ body,
+ expression->toLocation,
+ )->T.IEvLambda,
context,
)
| T.ECall(fn, args) => {
let (lambda, _) = fn->evaluate(context)
- let argValues = Js.Array2.map(args, arg => {
+ let argValues = Belt.Array.map(args, arg => {
let (argValue, _) = arg->evaluate(context)
argValue
})
switch lambda {
- | T.IEvLambda(lambda) => (
- Lambda.doLambdaCall(lambda, argValues, context.environment, evaluate),
- context,
- )
- | _ =>
- RENotAFunction(lambda->Reducer_Value.toString)->Reducer_ErrorValue.ErrorException->raise
+ | T.IEvLambda(lambda) => {
+ let result = Reducer_Lambda.doLambdaCallFrom(
+ lambda,
+ argValues,
+ context,
+ evaluate,
+ Some(expression->toLocation), // we have to pass the location of a current expression here, to put it on frameStack
+ )
+ (result, context)
+ }
+ | _ => RENotAFunction(lambda->Reducer_Value.toString)->throwFrom(expression, context)
}
}
}
@@ -112,19 +132,22 @@ let rec evaluate: T.reducerFn = (expression, context): (T.value, T.context) => {
module BackCompatible = {
// Those methods are used to support the existing tests
// If they are used outside limited testing context, error location reporting will fail
- let parse = (peggyCode: string): result =>
- peggyCode->Reducer_Peggy_Parse.parse->Result.map(Reducer_Peggy_ToExpression.fromNode)
+ let parse = (peggyCode: string): result =>
+ peggyCode->Reducer_Peggy_Parse.parse("main")->Result.map(Reducer_Peggy_ToExpression.fromNode)
- let evaluate = (expression: T.expression): result => {
- let context = Reducer_Context.createDefaultContext()
+ let createDefaultContext = () =>
+ Reducer_Context.createContext(SquiggleLibrary_StdLib.stdLib, Reducer_Context.defaultEnvironment)
+
+ let evaluate = (expression: T.expression): result => {
+ let context = createDefaultContext()
try {
let (value, _) = expression->evaluate(context)
value->Ok
} catch {
- | exn => Reducer_ErrorValue.fromException(exn)->Error
+ | exn => exn->SqError.fromException->Error
}
}
- let evaluateString = (peggyCode: string): result =>
- parse(peggyCode)->Result.flatMap(evaluate)
+ let evaluateString = (peggyCode: string): result =>
+ parse(peggyCode)->E.R2.errMap(e => e->SqError.fromParseError)->Result.flatMap(evaluate)
}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_ExpressionBuilder.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_ExpressionBuilder.res
index 9f1ed5fb..527331fb 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_ExpressionBuilder.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_ExpressionBuilder.res
@@ -1,16 +1,19 @@
-module BErrorValue = Reducer_ErrorValue
module T = Reducer_T
-type errorValue = BErrorValue.errorValue
type expression = Reducer_T.expression
+type expressionContent = Reducer_T.expressionContent
-let eArray = (anArray: array) => anArray->T.EArray
+let eArray = (anArray: array): expressionContent => anArray->T.EArray
let eBool = aBool => aBool->T.IEvBool->T.EValue
-let eCall = (fn: expression, args: array): expression => T.ECall(fn, args)
+let eCall = (fn: expression, args: array): expressionContent => T.ECall(fn, args)
-let eLambda = (parameters: array, expr: expression) => T.ELambda(parameters, expr)
+let eLambda = (
+ parameters: array,
+ expr: expression,
+ name: option,
+): expressionContent => T.ELambda(parameters, expr, name)
let eNumber = aNumber => aNumber->T.IEvNumber->T.EValue
@@ -18,13 +21,13 @@ let eRecord = (aMap: array<(T.expression, T.expression)>) => aMap->T.ERecord
let eString = aString => aString->T.IEvString->T.EValue
-let eSymbol = (name: string): expression => T.ESymbol(name)
+let eSymbol = (name: string): expressionContent => T.ESymbol(name)
-let eBlock = (exprs: array): expression => T.EBlock(exprs)
+let eBlock = (exprs: array): expressionContent => T.EBlock(exprs)
-let eProgram = (exprs: array): expression => T.EProgram(exprs)
+let eProgram = (exprs: array): expressionContent => T.EProgram(exprs)
-let eLetStatement = (symbol: string, valueExpression: expression): expression => T.EAssign(
+let eLetStatement = (symbol: string, valueExpression: expression): expressionContent => T.EAssign(
symbol,
valueExpression,
)
@@ -33,11 +36,8 @@ let eTernary = (
predicate: expression,
trueCase: expression,
falseCase: expression,
-): expression => T.ETernary(predicate, trueCase, falseCase)
+): expressionContent => T.ETernary(predicate, trueCase, falseCase)
-let eIdentifier = (name: string): expression => name->T.ESymbol
+let eIdentifier = (name: string): expressionContent => name->T.ESymbol
-// let eTypeIdentifier = (name: string): expression =>
-// name->T.IEvTypeIdentifier->T.EValue
-
-let eVoid: expression = T.IEvVoid->T.EValue
+let eVoid: expressionContent = T.IEvVoid->T.EValue
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res
deleted file mode 100644
index e9a85a1a..00000000
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_Lambda.res
+++ /dev/null
@@ -1,60 +0,0 @@
-module ErrorValue = Reducer_ErrorValue
-
-let doLambdaCall = (
- lambdaValue: Reducer_T.lambdaValue,
- args,
- environment: Reducer_T.environment,
- reducer: Reducer_T.reducerFn,
-): Reducer_T.value => {
- lambdaValue.body(args, environment, reducer)
-}
-
-let makeLambda = (
- parameters: array,
- bindings: Reducer_T.bindings,
- body: Reducer_T.expression,
-): Reducer_T.lambdaValue => {
- // TODO - clone bindings to avoid later redefinitions affecting lambdas?
-
- // Note: with this implementation, FFI lambdas (created by other methods than calling `makeLambda`) are allowed to violate the rules, pollute the bindings, etc.
- // Not sure yet if that's a bug or a feature.
- // FunctionRegistry functions are unaffected by this, their API is too limited.
-
- let lambda = (
- arguments: array,
- environment: Reducer_T.environment,
- reducer: Reducer_T.reducerFn,
- ) => {
- let argsLength = arguments->Js.Array2.length
- let parametersLength = parameters->Js.Array2.length
- if argsLength !== parametersLength {
- ErrorValue.REArityError(None, parametersLength, argsLength)->ErrorValue.ErrorException->raise
- }
-
- let localBindings = bindings->Reducer_Bindings.extend
- let localBindingsWithParameters = parameters->Belt.Array.reduceWithIndex(localBindings, (
- currentBindings,
- parameter,
- index,
- ) => {
- currentBindings->Reducer_Bindings.set(parameter, arguments[index])
- })
-
- let (value, _) = reducer(
- body,
- {bindings: localBindingsWithParameters, environment: environment},
- )
- value
- }
-
- {
- // context: bindings,
- body: lambda,
- parameters: parameters,
- }
-}
-
-let makeFFILambda = (body: Reducer_T.lambdaBody): Reducer_T.lambdaValue => {
- body: body,
- parameters: ["..."],
-}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_T.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_T.res
index 71995c0a..c7804c7a 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_T.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Expression/Reducer_Expression_T.res
@@ -12,7 +12,7 @@ let semicolonJoin = values =>
Converts the expression to String
*/
let rec toString = (expression: t) =>
- switch expression {
+ switch expression.content {
| EBlock(statements) =>
`{${Js.Array2.map(statements, aValue => toString(aValue))->semicolonJoin}}`
| EProgram(statements) => Js.Array2.map(statements, aValue => toString(aValue))->semicolonJoin
@@ -24,37 +24,23 @@ let rec toString = (expression: t) =>
`${predicate->toString} ? (${trueCase->toString}) : (${falseCase->toString})`
| EAssign(name, value) => `${name} = ${value->toString}`
| ECall(fn, args) => `(${fn->toString})(${args->Js.Array2.map(toString)->commaJoin})`
- | ELambda(parameters, body) => `{|${parameters->commaJoin}| ${body->toString}}`
+ | ELambda(parameters, body, _) => `{|${parameters->commaJoin}| ${body->toString}}`
| EValue(aValue) => Reducer_Value.toString(aValue)
}
let toStringResult = codeResult =>
switch codeResult {
| Ok(a) => `Ok(${toString(a)})`
- | Error(m) => `Error(${Reducer_ErrorValue.errorToString(m)})`
+ | Error(m) => `Error(${Reducer_Peggy_Parse.toStringError(m)})`
}
let toStringResultOkless = codeResult =>
switch codeResult {
| Ok(a) => toString(a)
- | Error(m) => `Error(${Reducer_ErrorValue.errorToString(m)})`
+ | Error(m) => `Error(${Reducer_Peggy_Parse.toStringError(m)})`
}
let inspect = (expr: t): t => {
Js.log(toString(expr))
expr
}
-
-let inspectResult = (r: result): result<
- t,
- Reducer_ErrorValue.errorValue,
-> => {
- Js.log(toStringResult(r))
- r
-}
-
-let resultToValue = (rExpression: result): t =>
- switch rExpression {
- | Ok(expression) => expression
- | Error(errorValue) => Reducer_ErrorValue.toException(errorValue)
- }
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_FrameStack.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_FrameStack.res
new file mode 100644
index 00000000..b7370e00
--- /dev/null
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_FrameStack.res
@@ -0,0 +1,51 @@
+// This is called "frameStack" and not "callStack", because the last frame in errors is often not a function call.
+// A "frame" is a pair of a scope (function or top-level scope, currently stored as a string) and a location inside it.
+// See this comment to deconfuse about what a frame is: https://github.com/quantified-uncertainty/squiggle/pull/1172#issuecomment-1264115038
+type t = Reducer_T.frameStack
+
+module Frame = {
+ let toString = ({name, location}: Reducer_T.frame) =>
+ name ++
+ switch location {
+ | Some(location) =>
+ ` at line ${location.start.line->Js.Int.toString}, column ${location.start.column->Js.Int.toString}` // TODO - source id?
+ | None => ""
+ }
+
+ @genType
+ let getLocation = (t: Reducer_T.frame): option => t.location
+
+ @genType
+ let getName = (t: Reducer_T.frame): string => t.name
+}
+
+let make = (): t => list{}
+
+let extend = (t: t, name: string, location: option) =>
+ t->Belt.List.add({
+ name: name,
+ location: location,
+ })
+
+// this is useful for SyntaxErrors
+let makeSingleFrameStack = (location: Reducer_Peggy_Parse.location): t =>
+ make()->extend(Reducer_T.topFrameName, Some(location))
+
+// this includes the left offset because it's mostly used in SqError.toStringWithStackTrace
+let toString = (t: t) =>
+ t
+ ->Belt.List.map(s => " " ++ s->Frame.toString ++ "\n")
+ ->Belt.List.toArray
+ ->Js.Array2.joinWith("")
+
+@genType
+let toFrameArray = (t: t): array => t->Belt.List.toArray
+
+@genType
+let getTopFrame = (t: t): option => t->Belt.List.head
+
+let isEmpty = (t: t): bool =>
+ switch t->Belt.List.head {
+ | Some(_) => true
+ | None => false
+ }
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Lambda.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Lambda.res
new file mode 100644
index 00000000..b814ea45
--- /dev/null
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Lambda.res
@@ -0,0 +1,95 @@
+type t = Reducer_T.lambdaValue
+
+// user-defined functions, i.e. `add2 = {|x, y| x + y}`, are built by this method
+let makeLambda = (
+ name: option,
+ parameters: array,
+ bindings: Reducer_T.bindings,
+ body: Reducer_T.expression,
+ location: Reducer_Peggy_Parse.location,
+): t => {
+ let lambda = (
+ arguments: array,
+ context: Reducer_T.context,
+ reducer: Reducer_T.reducerFn,
+ ) => {
+ let argsLength = arguments->E.A.length
+ let parametersLength = parameters->E.A.length
+ if argsLength !== parametersLength {
+ SqError.Message.REArityError(None, parametersLength, argsLength)->SqError.Message.throw
+ }
+
+ // create new bindings scope - technically not necessary, since bindings are immutable, but might help with debugging/new features in the future
+ let localBindings = bindings->Reducer_Bindings.extend
+
+ let localBindingsWithParameters = parameters->Belt.Array.reduceWithIndex(localBindings, (
+ currentBindings,
+ parameter,
+ index,
+ ) => {
+ currentBindings->Reducer_Bindings.set(parameter, arguments[index])
+ })
+
+ let lambdaContext: Reducer_T.context = {
+ bindings: localBindingsWithParameters, // based on bindings at the moment of lambda creation
+ environment: context.environment, // environment at the moment when lambda is called
+ frameStack: context.frameStack, // already extended in `doLambdaCall`
+ inFunction: context.inFunction, // already updated in `doLambdaCall`
+ }
+
+ let (value, _) = reducer(body, lambdaContext)
+ value
+ }
+
+ FnLambda({
+ // context: bindings,
+ name: name,
+ body: lambda,
+ parameters: parameters,
+ location: location,
+ })
+}
+
+// stdlib functions (everything in FunctionRegistry) are built by this method. Body is generated in SquiggleLibrary_StdLib.res
+let makeFFILambda = (name: string, body: Reducer_T.lambdaBody): t => FnBuiltin({
+ // Note: current bindings could be accidentally exposed here through context (compare with native lambda implementation above, where we override them with local bindings).
+ // But FunctionRegistry API is too limited for that to matter. Please take care not to violate that in the future by accident.
+ body: body,
+ name: name,
+})
+
+// this function doesn't scale to FunctionRegistry's polymorphic functions
+let parameters = (t: t): array => {
+ switch t {
+ | FnLambda({parameters}) => parameters
+ | FnBuiltin(_) => ["..."]
+ }
+}
+
+let doLambdaCallFrom = (
+ t: t,
+ args: array,
+ context: Reducer_T.context,
+ reducer,
+ location: option,
+) => {
+ let newContext = {
+ ...context,
+ frameStack: context.frameStack->Reducer_FrameStack.extend(
+ context->Reducer_Context.currentFunctionName,
+ location,
+ ),
+ inFunction: Some(t),
+ }
+
+ SqError.rethrowWithFrameStack(() => {
+ switch t {
+ | FnLambda({body}) => body(args, newContext, reducer)
+ | FnBuiltin({body}) => body(args, newContext, reducer)
+ }
+ }, newContext.frameStack)
+}
+
+let doLambdaCall = (t: t, args, context, reducer) => {
+ doLambdaCallFrom(t, args, context, reducer, None)
+}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Lambda_T.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Lambda_T.res
new file mode 100644
index 00000000..ab0724b4
--- /dev/null
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Lambda_T.res
@@ -0,0 +1,8 @@
+type t = Reducer_T.lambdaValue
+
+let name = (t: t): string => {
+ switch t {
+ | FnLambda({name}) => name->E.O2.default("")
+ | FnBuiltin({name}) => name
+ }
+}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy
index 4d8cc135..7bb01c56 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy
@@ -7,26 +7,26 @@
start
= _nl start:outerBlock _nl finalComment? {return start}
-zeroOMoreArgumentsBlockOrExpression = innerBlockOrExpression / lambda
+zeroOMoreArgumentsBlockOrExpression = lambda / innerBlockOrExpression
outerBlock
= statements:array_statements finalExpression: (statementSeparator @expression)?
{ if (finalExpression) statements.push(finalExpression)
- return h.nodeProgram(statements) }
+ return h.nodeProgram(statements, location()) }
/ finalExpression: expression
- { return h.nodeProgram([finalExpression]) }
+ { return h.nodeProgram([finalExpression], location()) }
innerBlockOrExpression
= quotedInnerBlock
/ finalExpression: expression
- { return h.nodeBlock([finalExpression])}
+ { return h.nodeBlock([finalExpression], location())}
quotedInnerBlock
= '{' _nl statements:array_statements finalExpression: (statementSeparator @expression) _nl '}'
{ if (finalExpression) statements.push(finalExpression)
- return h.nodeBlock(statements) }
+ return h.nodeBlock(statements, location()) }
/ '{' _nl finalExpression: expression _nl '}'
- { return h.nodeBlock([finalExpression]) }
+ { return h.nodeBlock([finalExpression], location()) }
array_statements
= head:statement tail:(statementSeparator @array_statements )
@@ -42,16 +42,16 @@ statement
voidStatement
= "call" _nl value:zeroOMoreArgumentsBlockOrExpression
{ var variable = h.nodeIdentifier("_", location());
- return h.nodeLetStatement(variable, value); }
+ return h.nodeLetStatement(variable, value, location()); }
letStatement
= variable:variable _ assignmentOp _nl value:zeroOMoreArgumentsBlockOrExpression
- { return h.nodeLetStatement(variable, value) }
+ { return h.nodeLetStatement(variable, value, location()) }
defunStatement
= variable:variable '(' _nl args:array_parameters _nl ')' _ assignmentOp _nl body:innerBlockOrExpression
- { var value = h.nodeLambda(args, body)
- return h.nodeLetStatement(variable, value) }
+ { var value = h.nodeLambda(args, body, location(), variable)
+ return h.nodeLetStatement(variable, value, location()) }
assignmentOp "assignment" = '='
@@ -67,16 +67,16 @@ ifthenelse
= 'if' __nl condition:logicalAdditive
__nl 'then' __nl trueExpression:innerBlockOrExpression
__nl 'else' __nl falseExpression:(ifthenelse/innerBlockOrExpression)
- { return h.nodeTernary(condition, trueExpression, falseExpression) }
+ { return h.nodeTernary(condition, trueExpression, falseExpression, location()) }
ternary
= condition:logicalAdditive _ '?' _nl trueExpression:logicalAdditive _ ':' _nl falseExpression:(ternary/logicalAdditive)
- { return h.nodeTernary(condition, trueExpression, falseExpression) }
+ { return h.nodeTernary(condition, trueExpression, falseExpression, location()) }
logicalAdditive
= head:logicalMultiplicative tail:(_ operator:logicalAdditiveOp _nl arg:logicalMultiplicative {return {operator: operator, right: arg}})*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right])
+ return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right], location())
}, head)}
logicalAdditiveOp "operator" = '||'
@@ -85,29 +85,37 @@ logicalAdditive
logicalMultiplicative
= head:equality tail:(_ operator:logicalMultiplicativeOp _nl arg:equality {return {operator: operator, right: arg}})*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right])
+ return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right], location())
}, head)}
logicalMultiplicativeOp "operator" = '&&'
equality
= left:relational _ operator:equalityOp _nl right:relational
- { return h.makeFunctionCall(h.toFunction[operator], [left, right])}
+ { return h.makeFunctionCall(h.toFunction[operator], [left, right], location())}
/ relational
equalityOp "operator" = '=='/'!='
relational
- = left:additive _ operator:relationalOp _nl right:additive
- { return h.makeFunctionCall(h.toFunction[operator], [left, right])}
- / additive
+ = left:credibleInterval _ operator:relationalOp _nl right:credibleInterval
+ { return h.makeFunctionCall(h.toFunction[operator], [left, right], location())}
+ / credibleInterval
relationalOp "operator" = '<='/'<'/'>='/'>'
+credibleInterval
+ = head:additive tail:(__ operator:credibleIntervalOp __nl arg:additive {return {operator: operator, right: arg}})*
+ { return tail.reduce(function(result, element) {
+ return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right], location())
+ }, head)}
+
+ credibleIntervalOp "operator" = 'to'
+
additive
= head:multiplicative tail:(_ operator:additiveOp _nl arg:multiplicative {return {operator: operator, right: arg}})*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right])
+ return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right], location())
}, head)}
additiveOp "operator" = '+' / '-' / '.+' / '.-'
@@ -115,31 +123,23 @@ additive
multiplicative
= head:power tail:(_ operator:multiplicativeOp _nl arg:power {return {operator: operator, right: arg}})*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right])
+ return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right], location())
}, head)}
multiplicativeOp "operator" = '*' / '/' / '.*' / './'
power
- = head:credibleInterval tail:(_ operator:powerOp _nl arg:credibleInterval {return {operator: operator, right: arg}})*
+ = head:chainFunctionCall tail:(_ operator:powerOp _nl arg:chainFunctionCall {return {operator: operator, right: arg}})*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right])
+ return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right], location())
}, head)}
powerOp "operator" = '^' / '.^'
-credibleInterval
- = head:chainFunctionCall tail:(__ operator:credibleIntervalOp __nl arg:chainFunctionCall {return {operator: operator, right: arg}})*
- { return tail.reduce(function(result, element) {
- return h.makeFunctionCall(h.toFunction[element.operator], [result, element.right])
- }, head)}
-
- credibleIntervalOp "operator" = 'to'
-
chainFunctionCall
= head:unary tail:(_ ('->'/'|>') _nl chained:chainedFunction {return chained})*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(element.fnName, [result, ...element.args])
+ return h.makeFunctionCall(element.fnName, [result, ...element.args], location())
}, head)}
chainedFunction
@@ -154,7 +154,7 @@ chainFunctionCall
unary
= unaryOperator:unaryOperator _nl right:(unary/postOperator)
- { return h.makeFunctionCall(h.unaryToFunction[unaryOperator], [right])}
+ { return h.makeFunctionCall(h.unaryToFunction[unaryOperator], [right], location())}
/ postOperator
unaryOperator "unary operator"
@@ -169,17 +169,17 @@ collectionElement
tail:(
_ '[' _nl arg:expression _nl ']' {return {fn: h.postOperatorToFunction['[]'], args: [arg]}}
/ _ '(' _nl args:array_functionArguments _nl ')' {return {fn: h.postOperatorToFunction['()'], args: args}}
- / '.' arg:$dollarIdentifier {return {fn: h.postOperatorToFunction['[]'], args: [h.nodeString(arg)]}}
+ / '.' arg:$dollarIdentifier {return {fn: h.postOperatorToFunction['[]'], args: [h.nodeString(arg, location())]}}
)*
{ return tail.reduce(function(result, element) {
- return h.makeFunctionCall(element.fn, [result, ...element.args])
+ return h.makeFunctionCall(element.fn, [result, ...element.args], location())
}, head)}
array_functionArguments
= head:expression tail:(_ ',' _nl @expression)*
{ return [head, ...tail]; }
/ ""
- {return [h.nodeVoid()];}
+ {return [h.nodeVoid(location())];}
atom
= '(' _nl expression:expression _nl ')' {return expression}
@@ -195,7 +195,7 @@ basicLiteral
/ voidLiteral
voidLiteral 'void'
- = "()" {return h.nodeVoid();}
+ = "()" {return h.nodeVoid(location());}
variable = dollarIdentifierWithModule / dollarIdentifier
@@ -221,36 +221,36 @@ dollarIdentifier '$identifier'
= ([\$_a-z]+[\$_a-z0-9]i*) {return h.nodeIdentifier(text(), location())}
moduleIdentifier 'identifier'
- = ([A-Z]+[_a-z0-9]i*) {return h.nodeModuleIdentifier(text())}
+ = ([A-Z]+[_a-z0-9]i*) {return h.nodeModuleIdentifier(text(), location())}
string 'string'
- = characters:("'" @([^'])* "'") {return h.nodeString(characters.join(''))}
- / characters:('"' @([^"])* '"') {return h.nodeString(characters.join(''))}
+ = characters:("'" @([^'])* "'") {return h.nodeString(characters.join(''), location())}
+ / characters:('"' @([^"])* '"') {return h.nodeString(characters.join(''), location())}
number = number:(float / integer) unit:unitIdentifier?
{
if (unit === null)
{ return number }
else
- { return h.makeFunctionCall('fromUnit_'+unit.value, [number])
+ { return h.makeFunctionCall('fromUnit_'+unit.value, [number], location())
}
}
integer 'integer'
= d+ !"\." ![e]i
- { return h.nodeInteger(parseInt(text()))}
+ { return h.nodeInteger(parseInt(text()), location())}
float 'float'
= $(((d+ "\." d*) / ("\." d+)) floatExponent? / d+ floatExponent)
- { return h.nodeFloat(parseFloat(text()))}
+ { return h.nodeFloat(parseFloat(text()), location())}
floatExponent = [e]i '-'? d+
d = [0-9]
boolean 'boolean'
= ('true'/'false') ! [a-z]i ! [_$]
- { return h.nodeBoolean(text() === 'true')}
+ { return h.nodeBoolean(text() === 'true', location())}
valueConstructor
= recordConstructor
@@ -261,15 +261,15 @@ valueConstructor
lambda
= '{' _nl '|' _nl args:array_parameters _nl '|' _nl statements:array_statements finalExpression: (statementSeparator @expression) _nl '}'
{ statements.push(finalExpression)
- return h.nodeLambda(args, h.nodeBlock(statements)) }
+ return h.nodeLambda(args, h.nodeBlock(statements, location()), location(), undefined) }
/ '{' _nl '|' _nl args:array_parameters _nl '|' _nl finalExpression: expression _nl '}'
- { return h.nodeLambda(args, finalExpression) }
+ { return h.nodeLambda(args, finalExpression, location(), undefined) }
arrayConstructor 'array'
= '[' _nl ']'
- { return h.constructArray([]); }
+ { return h.constructArray([], location()); }
/ '[' _nl args:array_elements _nl ']'
- { return h.constructArray(args); }
+ { return h.constructArray(args, location()); }
array_elements
= head:expression tail:(_ ',' _nl @expression)*
@@ -277,7 +277,7 @@ arrayConstructor 'array'
recordConstructor 'record'
= '{' _nl args:array_recordArguments _nl end_of_record
- { return h.constructRecord(args); }
+ { return h.constructRecord(args, location()); }
end_of_record
= '}'
@@ -289,7 +289,7 @@ recordConstructor 'record'
keyValuePair
= key:expression _ ':' _nl value:expression
- { return h.nodeKeyValue(key, value)}
+ { return h.nodeKeyValue(key, value, location())}
// Separators
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_Parse.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_Parse.res
index 9c59c504..001f3e5b 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_Parse.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_Parse.res
@@ -1,22 +1,37 @@
module Extra = Reducer_Extra
-open Reducer_ErrorValue
-type node = {"type": string}
+@genType
+type locationPoint = {
+ line: int,
+ column: int,
+}
+@genType
+type location = {
+ source: string,
+ start: locationPoint,
+ end: locationPoint,
+}
-@module("./Reducer_Peggy_GeneratedParser.js") external parse__: string => node = "parse"
+type node = {"type": string, "location": location}
-type withLocation = {"location": Reducer_ErrorValue.syntaxErrorLocation}
+type parseError = SyntaxError(string, location)
+
+type parseResult = result
+
+@module("./Reducer_Peggy_GeneratedParser.js")
+external parse__: (string, {"grammarSource": string}) => node = "parse"
+
+type withLocation = {"location": location}
external castWithLocation: Js.Exn.t => withLocation = "%identity"
-let syntaxErrorToLocation = (error: Js.Exn.t): Reducer_ErrorValue.syntaxErrorLocation =>
- castWithLocation(error)["location"]
+let syntaxErrorToLocation = (error: Js.Exn.t): location => castWithLocation(error)["location"]
-let parse = (expr: string): result =>
+let parse = (expr: string, source: string): parseResult =>
try {
- Ok(parse__(expr))
+ Ok(parse__(expr, {"grammarSource": source}))
} catch {
| Js.Exn.Error(obj) =>
- RESyntaxError(Belt.Option.getExn(Js.Exn.message(obj)), syntaxErrorToLocation(obj)->Some)->Error
+ SyntaxError(Belt.Option.getExn(Js.Exn.message(obj)), syntaxErrorToLocation(obj))->Error
}
type nodeBlock = {...node, "statements": array}
@@ -29,32 +44,35 @@ type nodeIdentifier = {...node, "value": string}
type nodeInteger = {...node, "value": int}
type nodeKeyValue = {...node, "key": node, "value": node}
type nodeRecord = {...node, "elements": array}
-type nodeLambda = {...node, "args": array, "body": node}
+type nodeLambda = {...node, "args": array, "body": node, "name": option}
type nodeLetStatement = {...node, "variable": nodeIdentifier, "value": node}
type nodeModuleIdentifier = {...node, "value": string}
type nodeString = {...node, "value": string}
type nodeTernary = {...node, "condition": node, "trueExpression": node, "falseExpression": node}
-// type nodeTypeIdentifier = {...node, "value": string}
type nodeVoid = node
-type peggyNode =
- | PgNodeBlock(nodeBlock)
- | PgNodeProgram(nodeProgram)
- | PgNodeArray(nodeArray)
- | PgNodeRecord(nodeRecord)
- | PgNodeBoolean(nodeBoolean)
- | PgNodeFloat(nodeFloat)
- | PgNodeCall(nodeCall)
- | PgNodeIdentifier(nodeIdentifier)
- | PgNodeInteger(nodeInteger)
- | PgNodeKeyValue(nodeKeyValue)
- | PgNodeLambda(nodeLambda)
- | PgNodeLetStatement(nodeLetStatement)
- | PgNodeModuleIdentifier(nodeModuleIdentifier)
- | PgNodeString(nodeString)
- | PgNodeTernary(nodeTernary)
- // | PgNodeTypeIdentifier(nodeTypeIdentifier)
- | PgNodeVoid(nodeVoid)
+type astContent =
+ | ASTBlock(nodeBlock)
+ | ASTProgram(nodeProgram)
+ | ASTArray(nodeArray)
+ | ASTRecord(nodeRecord)
+ | ASTBoolean(nodeBoolean)
+ | ASTFloat(nodeFloat)
+ | ASTCall(nodeCall)
+ | ASTIdentifier(nodeIdentifier)
+ | ASTInteger(nodeInteger)
+ | ASTKeyValue(nodeKeyValue)
+ | ASTLambda(nodeLambda)
+ | ASTLetStatement(nodeLetStatement)
+ | ASTModuleIdentifier(nodeModuleIdentifier)
+ | ASTString(nodeString)
+ | ASTTernary(nodeTernary)
+ | ASTVoid(nodeVoid)
+
+type ast = {
+ location: location,
+ content: astContent,
+}
external castNodeBlock: node => nodeBlock = "%identity"
external castNodeProgram: node => nodeProgram = "%identity"
@@ -71,80 +89,92 @@ external castNodeLetStatement: node => nodeLetStatement = "%identity"
external castNodeModuleIdentifier: node => nodeModuleIdentifier = "%identity"
external castNodeString: node => nodeString = "%identity"
external castNodeTernary: node => nodeTernary = "%identity"
-// external castNodeTypeIdentifier: node => nodeTypeIdentifier = "%identity"
external castNodeVoid: node => nodeVoid = "%identity"
exception UnsupportedPeggyNodeType(string) // This should never happen; programming error
-let castNodeType = (node: node) =>
- switch node["type"] {
- | "Block" => node->castNodeBlock->PgNodeBlock
- | "Program" => node->castNodeBlock->PgNodeProgram
- | "Array" => node->castNodeArray->PgNodeArray
- | "Record" => node->castNodeRecord->PgNodeRecord
- | "Boolean" => node->castNodeBoolean->PgNodeBoolean
- | "Call" => node->castNodeCall->PgNodeCall
- | "Float" => node->castNodeFloat->PgNodeFloat
- | "Identifier" => node->castNodeIdentifier->PgNodeIdentifier
- | "Integer" => node->castNodeInteger->PgNodeInteger
- | "KeyValue" => node->castNodeKeyValue->PgNodeKeyValue
- | "Lambda" => node->castNodeLambda->PgNodeLambda
- | "LetStatement" => node->castNodeLetStatement->PgNodeLetStatement
- | "ModuleIdentifier" => node->castNodeModuleIdentifier->PgNodeModuleIdentifier
- | "String" => node->castNodeString->PgNodeString
- | "Ternary" => node->castNodeTernary->PgNodeTernary
- // | "TypeIdentifier" => node->castNodeTypeIdentifier->PgNodeTypeIdentifier
- | "Void" => node->castNodeVoid->PgNodeVoid
+let nodeToAST = (node: node) => {
+ let content = switch node["type"] {
+ | "Block" => node->castNodeBlock->ASTBlock
+ | "Program" => node->castNodeBlock->ASTProgram
+ | "Array" => node->castNodeArray->ASTArray
+ | "Record" => node->castNodeRecord->ASTRecord
+ | "Boolean" => node->castNodeBoolean->ASTBoolean
+ | "Call" => node->castNodeCall->ASTCall
+ | "Float" => node->castNodeFloat->ASTFloat
+ | "Identifier" => node->castNodeIdentifier->ASTIdentifier
+ | "Integer" => node->castNodeInteger->ASTInteger
+ | "KeyValue" => node->castNodeKeyValue->ASTKeyValue
+ | "Lambda" => node->castNodeLambda->ASTLambda
+ | "LetStatement" => node->castNodeLetStatement->ASTLetStatement
+ | "ModuleIdentifier" => node->castNodeModuleIdentifier->ASTModuleIdentifier
+ | "String" => node->castNodeString->ASTString
+ | "Ternary" => node->castNodeTernary->ASTTernary
+ | "Void" => node->castNodeVoid->ASTVoid
| _ => raise(UnsupportedPeggyNodeType(node["type"]))
}
-let rec pgToString = (peggyNode: peggyNode): string => {
+ {location: node["location"], content: content}
+}
+
+let nodeIdentifierToAST = (node: nodeIdentifier) => {
+ {location: node["location"], content: node->ASTIdentifier}
+}
+
+let nodeKeyValueToAST = (node: nodeKeyValue) => {
+ {location: node["location"], content: node->ASTKeyValue}
+}
+
+let rec pgToString = (ast: ast): string => {
let argsToString = (args: array): string =>
- args->Js.Array2.map(arg => PgNodeIdentifier(arg)->pgToString)->Js.Array2.toString
+ args->Belt.Array.map(arg => arg->nodeIdentifierToAST->pgToString)->Js.Array2.toString
let nodesToStringUsingSeparator = (nodes: array, separator: string): string =>
- nodes->Js.Array2.map(toString)->Extra.Array.intersperse(separator)->Js.String.concatMany("")
+ nodes->Belt.Array.map(toString)->Extra.Array.intersperse(separator)->Js.String.concatMany("")
- let pgNodesToStringUsingSeparator = (nodes: array, separator: string): string =>
- nodes->Js.Array2.map(pgToString)->Extra.Array.intersperse(separator)->Js.String.concatMany("")
+ let pgNodesToStringUsingSeparator = (nodes: array, separator: string): string =>
+ nodes->Belt.Array.map(pgToString)->Extra.Array.intersperse(separator)->Js.String.concatMany("")
- switch peggyNode {
- | PgNodeBlock(node)
- | PgNodeProgram(node) =>
+ switch ast.content {
+ | ASTBlock(node)
+ | ASTProgram(node) =>
"{" ++ node["statements"]->nodesToStringUsingSeparator("; ") ++ "}"
- | PgNodeArray(node) => "[" ++ node["elements"]->nodesToStringUsingSeparator("; ") ++ "]"
- | PgNodeRecord(node) =>
+ | ASTArray(node) => "[" ++ node["elements"]->nodesToStringUsingSeparator("; ") ++ "]"
+ | ASTRecord(node) =>
"{" ++
node["elements"]
- ->Js.Array2.map(element => PgNodeKeyValue(element))
+ ->Belt.Array.map(element => element->nodeKeyValueToAST)
->pgNodesToStringUsingSeparator(", ") ++ "}"
- | PgNodeBoolean(node) => node["value"]->Js.String.make
- | PgNodeCall(node) =>
+ | ASTBoolean(node) => node["value"]->Js.String.make
+ | ASTCall(node) =>
"(" ++ node["fn"]->toString ++ " " ++ node["args"]->nodesToStringUsingSeparator(" ") ++ ")"
- | PgNodeFloat(node) => node["value"]->Js.String.make
- | PgNodeIdentifier(node) => `:${node["value"]}`
- | PgNodeInteger(node) => node["value"]->Js.String.make
- | PgNodeKeyValue(node) => toString(node["key"]) ++ ": " ++ toString(node["value"])
- | PgNodeLambda(node) =>
- "{|" ++ node["args"]->argsToString ++ "| " ++ node["body"]->toString ++ "}"
- | PgNodeLetStatement(node) =>
- pgToString(PgNodeIdentifier(node["variable"])) ++ " = " ++ toString(node["value"])
- | PgNodeModuleIdentifier(node) => `@${node["value"]}`
- | PgNodeString(node) => `'${node["value"]->Js.String.make}'`
- | PgNodeTernary(node) =>
+ | ASTFloat(node) => node["value"]->Js.String.make
+ | ASTIdentifier(node) => `:${node["value"]}`
+ | ASTInteger(node) => node["value"]->Js.String.make
+ | ASTKeyValue(node) => toString(node["key"]) ++ ": " ++ toString(node["value"])
+ | ASTLambda(node) => "{|" ++ node["args"]->argsToString ++ "| " ++ node["body"]->toString ++ "}"
+ | ASTLetStatement(node) =>
+ pgToString(node["variable"]->nodeIdentifierToAST) ++ " = " ++ toString(node["value"])
+ | ASTModuleIdentifier(node) => `@${node["value"]}`
+ | ASTString(node) => `'${node["value"]->Js.String.make}'`
+ | ASTTernary(node) =>
"(::$$_ternary_$$ " ++
toString(node["condition"]) ++
" " ++
toString(node["trueExpression"]) ++
" " ++
toString(node["falseExpression"]) ++ ")"
- // | PgNodeTypeIdentifier(node) => `#${node["value"]}`
- | PgNodeVoid(_node) => "()"
+ | ASTVoid(_node) => "()"
}
}
-and toString = (node: node): string => node->castNodeType->pgToString
+and toString = (node: node): string => node->nodeToAST->pgToString
-let toStringResult = (rNode: result): string =>
+let toStringError = (error: parseError): string => {
+ let SyntaxError(message, _) = error
+ `Syntax Error: ${message}}`
+}
+
+let toStringResult = (rNode: parseResult): string =>
switch rNode {
- | Ok(node) => toString(node)
- | Error(error) => `Error(${errorToString(error)})`
+ | Ok(node) => node->toString
+ | Error(error) => `Error(${error->toStringError})`
}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression.res
index ef8ed75b..2e858c55 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression.res
@@ -3,62 +3,72 @@ module ExpressionT = Reducer_Expression_T
module Parse = Reducer_Peggy_Parse
type expression = Reducer_T.expression
+type expressionContent = Reducer_T.expressionContent
let rec fromNode = (node: Parse.node): expression => {
- let caseBlock = nodeBlock =>
- ExpressionBuilder.eBlock(nodeBlock["statements"]->Js.Array2.map(fromNode))
+ let ast = Parse.nodeToAST(node)
- let caseProgram = nodeProgram =>
- ExpressionBuilder.eProgram(nodeProgram["statements"]->Js.Array2.map(fromNode))
+ let content: expressionContent = {
+ let caseBlock = nodeBlock =>
+ ExpressionBuilder.eBlock(nodeBlock["statements"]->Js.Array2.map(fromNode))
- let caseLambda = (nodeLambda: Parse.nodeLambda): expression => {
- let args =
- nodeLambda["args"]->Js.Array2.map((argNode: Parse.nodeIdentifier) => argNode["value"])
- let body = nodeLambda["body"]->fromNode
+ let caseProgram = nodeProgram =>
+ ExpressionBuilder.eProgram(nodeProgram["statements"]->Js.Array2.map(fromNode))
- ExpressionBuilder.eLambda(args, body)
+ let caseLambda = (nodeLambda: Parse.nodeLambda): expressionContent => {
+ let args =
+ nodeLambda["args"]->Js.Array2.map((argNode: Parse.nodeIdentifier) => argNode["value"])
+ let body = nodeLambda["body"]->fromNode
+
+ ExpressionBuilder.eLambda(args, body, nodeLambda["name"])
+ }
+
+ let caseRecord = (nodeRecord): expressionContent => {
+ nodeRecord["elements"]
+ ->Js.Array2.map(keyValueNode => (
+ keyValueNode["key"]->fromNode,
+ keyValueNode["value"]->fromNode,
+ ))
+ ->ExpressionBuilder.eRecord
+ }
+
+ switch ast.content {
+ | ASTBlock(nodeBlock) => caseBlock(nodeBlock)
+ | ASTProgram(nodeProgram) => caseProgram(nodeProgram)
+ | ASTArray(nodeArray) =>
+ ExpressionBuilder.eArray(nodeArray["elements"]->Js.Array2.map(fromNode))
+ | ASTRecord(nodeRecord) => caseRecord(nodeRecord)
+ | ASTBoolean(nodeBoolean) => ExpressionBuilder.eBool(nodeBoolean["value"])
+ | ASTCall(nodeCall) =>
+ ExpressionBuilder.eCall(fromNode(nodeCall["fn"]), nodeCall["args"]->Js.Array2.map(fromNode))
+ | ASTFloat(nodeFloat) => ExpressionBuilder.eNumber(nodeFloat["value"])
+ | ASTIdentifier(nodeIdentifier) => ExpressionBuilder.eSymbol(nodeIdentifier["value"])
+ | ASTInteger(nodeInteger) => ExpressionBuilder.eNumber(Belt.Int.toFloat(nodeInteger["value"]))
+ | ASTKeyValue(nodeKeyValue) =>
+ ExpressionBuilder.eArray([fromNode(nodeKeyValue["key"]), fromNode(nodeKeyValue["value"])])
+ | ASTLambda(nodeLambda) => caseLambda(nodeLambda)
+ | ASTLetStatement(nodeLetStatement) =>
+ ExpressionBuilder.eLetStatement(
+ nodeLetStatement["variable"]["value"],
+ fromNode(nodeLetStatement["value"]),
+ )
+ | ASTModuleIdentifier(nodeModuleIdentifier) =>
+ ExpressionBuilder.eIdentifier(nodeModuleIdentifier["value"])
+ | ASTString(nodeString) => ExpressionBuilder.eString(nodeString["value"])
+ | ASTTernary(nodeTernary) =>
+ ExpressionBuilder.eTernary(
+ fromNode(nodeTernary["condition"]),
+ fromNode(nodeTernary["trueExpression"]),
+ fromNode(nodeTernary["falseExpression"]),
+ )
+ // | PgNodeTypeIdentifier(nodeTypeIdentifier) =>
+ // ExpressionBuilder.eTypeIdentifier(nodeTypeIdentifier["value"])
+ | ASTVoid(_) => ExpressionBuilder.eVoid
+ }
}
- let caseRecord = (nodeRecord): expression => {
- nodeRecord["elements"]
- ->Js.Array2.map(keyValueNode => (
- keyValueNode["key"]->fromNode,
- keyValueNode["value"]->fromNode,
- ))
- ->ExpressionBuilder.eRecord
- }
-
- switch Parse.castNodeType(node) {
- | PgNodeBlock(nodeBlock) => caseBlock(nodeBlock)
- | PgNodeProgram(nodeProgram) => caseProgram(nodeProgram)
- | PgNodeArray(nodeArray) =>
- ExpressionBuilder.eArray(nodeArray["elements"]->Js.Array2.map(fromNode))
- | PgNodeRecord(nodeRecord) => caseRecord(nodeRecord)
- | PgNodeBoolean(nodeBoolean) => ExpressionBuilder.eBool(nodeBoolean["value"])
- | PgNodeCall(nodeCall) =>
- ExpressionBuilder.eCall(fromNode(nodeCall["fn"]), nodeCall["args"]->Js.Array2.map(fromNode))
- | PgNodeFloat(nodeFloat) => ExpressionBuilder.eNumber(nodeFloat["value"])
- | PgNodeIdentifier(nodeIdentifier) => ExpressionBuilder.eSymbol(nodeIdentifier["value"])
- | PgNodeInteger(nodeInteger) => ExpressionBuilder.eNumber(Belt.Int.toFloat(nodeInteger["value"]))
- | PgNodeKeyValue(nodeKeyValue) =>
- ExpressionBuilder.eArray([fromNode(nodeKeyValue["key"]), fromNode(nodeKeyValue["value"])])
- | PgNodeLambda(nodeLambda) => caseLambda(nodeLambda)
- | PgNodeLetStatement(nodeLetStatement) =>
- ExpressionBuilder.eLetStatement(
- nodeLetStatement["variable"]["value"],
- fromNode(nodeLetStatement["value"]),
- )
- | PgNodeModuleIdentifier(nodeModuleIdentifier) =>
- ExpressionBuilder.eIdentifier(nodeModuleIdentifier["value"])
- | PgNodeString(nodeString) => ExpressionBuilder.eString(nodeString["value"])
- | PgNodeTernary(nodeTernary) =>
- ExpressionBuilder.eTernary(
- fromNode(nodeTernary["condition"]),
- fromNode(nodeTernary["trueExpression"]),
- fromNode(nodeTernary["falseExpression"]),
- )
- // | PgNodeTypeIdentifier(nodeTypeIdentifier) =>
- // ExpressionBuilder.eTypeIdentifier(nodeTypeIdentifier["value"])
- | PgNodeVoid(_) => ExpressionBuilder.eVoid
+ {
+ ast: ast,
+ content: content,
}
}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/helpers.ts b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/helpers.ts
index f24fd819..15597ea0 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/helpers.ts
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/helpers.ts
@@ -34,83 +34,92 @@ export const postOperatorToFunction = {
"[]": "$_atIndex_$",
};
-type NodeBlock = {
+type Node = {
+ location: LocationRange;
+};
+
+type NodeBlock = Node & {
type: "Block";
statements: AnyPeggyNode[];
};
-type NodeProgram = {
+type NodeProgram = Node & {
type: "Program";
statements: AnyPeggyNode[];
};
-type NodeArray = {
+type NodeArray = Node & {
type: "Array";
elements: AnyPeggyNode[];
};
-type NodeRecord = {
+type NodeRecord = Node & {
type: "Record";
elements: NodeKeyValue[];
};
-type NodeCall = {
+type NodeCall = Node & {
type: "Call";
fn: AnyPeggyNode;
args: AnyPeggyNode[];
};
-type NodeFloat = {
+type NodeFloat = Node & {
type: "Float";
value: number;
};
-type NodeInteger = {
+type NodeInteger = Node & {
type: "Integer";
value: number;
};
-type NodeIdentifier = {
+type NodeIdentifier = Node & {
type: "Identifier";
value: string;
};
-type NodeLetStatement = {
+type NodeLetStatement = Node & {
type: "LetStatement";
variable: NodeIdentifier;
value: AnyPeggyNode;
};
-type NodeLambda = {
+type NodeLambda = Node & {
type: "Lambda";
args: AnyPeggyNode[];
body: AnyPeggyNode;
+ name?: string;
};
-type NodeTernary = {
+type NodeTernary = Node & {
type: "Ternary";
condition: AnyPeggyNode;
trueExpression: AnyPeggyNode;
falseExpression: AnyPeggyNode;
};
-type NodeKeyValue = {
+type NodeKeyValue = Node & {
type: "KeyValue";
key: AnyPeggyNode;
value: AnyPeggyNode;
};
-type NodeString = {
+type NodeString = Node & {
type: "String";
value: string;
location?: LocationRange;
};
-type NodeBoolean = {
+type NodeBoolean = Node & {
type: "Boolean";
value: boolean;
};
+type NodeVoid = Node & {
+ type: "Void";
+};
+
export type AnyPeggyNode =
| NodeArray
| NodeRecord
@@ -125,47 +134,78 @@ export type AnyPeggyNode =
| NodeTernary
| NodeKeyValue
| NodeString
- | NodeBoolean;
+ | NodeBoolean
+ | NodeVoid;
-export function makeFunctionCall(fn: string, args: AnyPeggyNode[]) {
+export function makeFunctionCall(
+ fn: string,
+ args: AnyPeggyNode[],
+ location: LocationRange
+) {
if (fn === "$$_applyAll_$$") {
- return nodeCall(args[0], args.splice(1));
+ return nodeCall(args[0], args.splice(1), location);
} else {
- return nodeCall(nodeIdentifier(fn), args);
+ return nodeCall(nodeIdentifier(fn, location), args, location);
}
}
-export function constructArray(elements: AnyPeggyNode[]) {
- return { type: "Array", elements };
+export function constructArray(
+ elements: AnyPeggyNode[],
+ location: LocationRange
+): NodeArray {
+ return { type: "Array", elements, location };
}
-export function constructRecord(elements: AnyPeggyNode[]) {
- return { type: "Record", elements };
+export function constructRecord(
+ elements: NodeKeyValue[],
+ location: LocationRange
+): NodeRecord {
+ return { type: "Record", elements, location };
}
-export function nodeBlock(statements: AnyPeggyNode[]): NodeBlock {
- return { type: "Block", statements };
+export function nodeBlock(
+ statements: AnyPeggyNode[],
+ location: LocationRange
+): NodeBlock {
+ return { type: "Block", statements, location };
}
-export function nodeProgram(statements: AnyPeggyNode[]): NodeProgram {
- return { type: "Program", statements };
+export function nodeProgram(
+ statements: AnyPeggyNode[],
+ location: LocationRange
+): NodeProgram {
+ return { type: "Program", statements, location };
}
-export function nodeBoolean(value: boolean): NodeBoolean {
- return { type: "Boolean", value };
+export function nodeBoolean(
+ value: boolean,
+ location: LocationRange
+): NodeBoolean {
+ return { type: "Boolean", value, location };
}
-export function nodeCall(fn: AnyPeggyNode, args: AnyPeggyNode[]): NodeCall {
- return { type: "Call", fn, args };
+export function nodeCall(
+ fn: AnyPeggyNode,
+ args: AnyPeggyNode[],
+ location: LocationRange
+): NodeCall {
+ return { type: "Call", fn, args, location };
}
-export function nodeFloat(value: number): NodeFloat {
- return { type: "Float", value };
+export function nodeFloat(value: number, location: LocationRange): NodeFloat {
+ return { type: "Float", value, location };
}
-export function nodeIdentifier(value: string): NodeIdentifier {
- return { type: "Identifier", value };
+export function nodeIdentifier(
+ value: string,
+ location: LocationRange
+): NodeIdentifier {
+ return { type: "Identifier", value, location };
}
-export function nodeInteger(value: number): NodeInteger {
- return { type: "Integer", value };
+export function nodeInteger(
+ value: number,
+ location: LocationRange
+): NodeInteger {
+ return { type: "Integer", value, location };
}
export function nodeKeyValue(
key: AnyPeggyNode,
- value: AnyPeggyNode
+ value: AnyPeggyNode,
+ location: LocationRange
): NodeKeyValue {
if (key.type === "Identifier") {
key = {
@@ -173,43 +213,46 @@ export function nodeKeyValue(
type: "String",
};
}
- return { type: "KeyValue", key, value };
+ return { type: "KeyValue", key, value, location };
}
export function nodeLambda(
args: AnyPeggyNode[],
- body: AnyPeggyNode
+ body: AnyPeggyNode,
+ location: LocationRange,
+ name?: NodeIdentifier
): NodeLambda {
- return { type: "Lambda", args, body };
+ return { type: "Lambda", args, body, location, name: name?.value };
}
export function nodeLetStatement(
variable: NodeIdentifier,
- value: AnyPeggyNode
+ value: AnyPeggyNode,
+ location: LocationRange
): NodeLetStatement {
- return { type: "LetStatement", variable, value };
+ const patchedValue =
+ value.type === "Lambda" ? { ...value, name: variable.value } : value;
+ return { type: "LetStatement", variable, value: patchedValue, location };
}
-export function nodeModuleIdentifier(value: string) {
- return { type: "ModuleIdentifier", value };
+export function nodeModuleIdentifier(value: string, location: LocationRange) {
+ return { type: "ModuleIdentifier", value, location };
}
-export function nodeString(value: string): NodeString {
- return { type: "String", value };
+export function nodeString(value: string, location: LocationRange): NodeString {
+ return { type: "String", value, location };
}
export function nodeTernary(
condition: AnyPeggyNode,
trueExpression: AnyPeggyNode,
- falseExpression: AnyPeggyNode
+ falseExpression: AnyPeggyNode,
+ location: LocationRange
): NodeTernary {
return {
type: "Ternary",
condition,
trueExpression,
falseExpression,
+ location,
};
}
-export function nodeTypeIdentifier(typeValue: string) {
- return { type: "TypeIdentifier", value: typeValue };
-}
-
-export function nodeVoid() {
- return { type: "Void" };
+export function nodeVoid(location: LocationRange): NodeVoid {
+ return { type: "Void", location };
}
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_T.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_T.res
index 106f8a8e..cba89d7b 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_T.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_T.res
@@ -16,14 +16,18 @@ type rec value =
| IEvVoid
@genType.opaque and arrayValue = array
@genType.opaque and map = Belt.Map.String.t
-and lambdaBody = (array, environment, reducerFn) => value
+and lambdaBody = (array, context, reducerFn) => value
@genType.opaque
-and lambdaValue = {
- parameters: array,
- body: lambdaBody,
-}
+and lambdaValue =
+ | FnLambda({
+ parameters: array,
+ body: lambdaBody,
+ location: Reducer_Peggy_Parse.location,
+ name: option,
+ })
+ | FnBuiltin({body: lambdaBody, name: string})
@genType.opaque and lambdaDeclaration = Declaration.declaration
-and expression =
+and expressionContent =
| EBlock(array)
// programs are similar to blocks, but don't create an inner scope. there can be only one program at the top level of the expression.
| EProgram(array)
@@ -33,18 +37,34 @@ and expression =
| ETernary(expression, expression, expression)
| EAssign(string, expression)
| ECall(expression, array)
- | ELambda(array, expression)
+ | ELambda(array, expression, option)
| EValue(value)
+and expression = {
+ ast: Reducer_Peggy_Parse.ast,
+ content: expressionContent,
+}
+
and namespace = Belt.Map.String.t
and bindings = {
namespace: namespace,
parent: option,
}
+@genType.opaque
+and frame = {
+ name: string,
+ location: option, // can be empty for calls from builtin functions
+}
+@genType.opaque and frameStack = list
+
and context = {
bindings: bindings,
environment: environment,
+ frameStack: frameStack,
+ inFunction: option,
}
and reducerFn = (expression, context) => (value, context)
+
+let topFrameName = ""
diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Value.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Value.res
index cd1eefef..01f97647 100644
--- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Value.res
+++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Value.res
@@ -1,7 +1,3 @@
-// deprecated, use Reducer_T instead
-// (value methods should be moved to Reducer_Value.res)
-
-module ErrorValue = Reducer_ErrorValue
type environment = GenericDist.env
module T = Reducer_T
@@ -32,10 +28,12 @@ and toStringCall = fName => `:${fName}`
and toStringDate = date => DateTime.Date.toString(date)
and toStringDeclaration = d => Declaration.toString(d, r => toString(IEvLambda(r)))
and toStringDistribution = dist => GenericDist.toString(dist)
-and toStringLambda = (lambdaValue: T.lambdaValue) =>
- `lambda(${Js.Array2.toString(lambdaValue.parameters)}=>internal code)`
-and toStringFunction = (lambdaValue: T.lambdaValue) =>
- `function(${Js.Array2.toString(lambdaValue.parameters)})`
+and toStringLambda = (lambdaValue: T.lambdaValue) => {
+ switch lambdaValue {
+ | FnLambda({parameters}) => `lambda(${Js.Array2.toString(parameters)}=>internal code)`
+ | FnBuiltin(_) => "Builtin function"
+ }
+}
and toStringNumber = aNumber => Js.String.make(aNumber)
and toStringRecord = aMap => aMap->toStringMap
and toStringString = aString => `'${aString}'`
@@ -76,25 +74,13 @@ let toStringFunctionCall = ((fn, args)): string => `${fn}(${argsToString(args)})
let toStringResult = x =>
switch x {
| Ok(a) => `Ok(${toString(a)})`
- | Error(m) => `Error(${ErrorValue.errorToString(m)})`
+ | Error(m) => `Error(${SqError.toString(m)})`
}
-let toStringOptionResult = x =>
- switch x {
- | Some(a) => toStringResult(a)
- | None => "None"
- }
-
-let toStringResultOkless = (codeResult: result): string =>
+let toStringResultOkless = (codeResult: result): string =>
switch codeResult {
| Ok(a) => toString(a)
- | Error(m) => `Error(${ErrorValue.errorToString(m)})`
- }
-
-let toStringResultRecord = x =>
- switch x {
- | Ok(a) => `Ok(${toStringMap(a)})`
- | Error(m) => `Error(${ErrorValue.errorToString(m)})`
+ | Error(m) => `Error(${SqError.toString(m)})`
}
type internalExpressionValueType =
@@ -156,10 +142,10 @@ let functionCallSignatureToString = (functionCallSignature: functionCallSignatur
let arrayToValueArray = (arr: array): array => arr
-let resultToValue = (rExpression: result): t =>
+let resultToValue = (rExpression: result): t =>
switch rExpression {
| Ok(expression) => expression
- | Error(errorValue) => Reducer_ErrorValue.toException(errorValue)
+ | Error(errorValue) => SqError.Message.throw(errorValue)
}
let recordToKeyValuePairs = (record: T.map): array<(string, t)> => record->Belt.Map.String.toArray
diff --git a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject.res b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject.res
index 78cf8771..5ff27839 100644
--- a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject.res
+++ b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject.res
@@ -1,7 +1,6 @@
// TODO: Auto clean project based on topology
module Bindings = Reducer_Bindings
-module ErrorValue = Reducer_ErrorValue
module ProjectItem = ReducerProject_ProjectItem
module T = ReducerProject_T
module Topology = ReducerProject_Topology
@@ -121,7 +120,7 @@ let getResultOption = (project: t, sourceId: string): ProjectItem.T.resultType =
let getResult = (project: t, sourceId: string): ProjectItem.T.resultArgumentType =>
switch getResultOption(project, sourceId) {
- | None => RENeedToRun->Error
+ | None => RENeedToRun->SqError.fromMessage->Error
| Some(result) => result
}
@@ -197,7 +196,7 @@ let linkDependencies = (project: t, sourceId: string): Reducer_T.namespace => {
"__result__",
switch project->getResult(id) {
| Ok(result) => result
- | Error(error) => error->Reducer_ErrorValue.ErrorException->raise
+ | Error(error) => error->SqError.throw
},
),
])
diff --git a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ParseIncludes.res b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ParseIncludes.res
index 38370488..bab3fa88 100644
--- a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ParseIncludes.res
+++ b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ParseIncludes.res
@@ -1,10 +1,7 @@
@module("./ReducerProject_IncludeParser.js")
external parse__: string => array> = "parse"
-let parseIncludes = (expr: string): result<
- array<(string, string)>,
- Reducer_ErrorValue.errorValue,
-> =>
+let parseIncludes = (expr: string): result, SqError.t> =>
try {
let answer = parse__(expr)
// let logEntry = answer->Js.Array2.joinWith(",")
@@ -12,8 +9,9 @@ let parseIncludes = (expr: string): result<
Belt.Array.map(answer, item => (item[0], item[1]))->Ok
} catch {
| Js.Exn.Error(obj) =>
- RESyntaxError(
- Belt.Option.getExn(Js.Exn.message(obj)),
- Reducer_Peggy_Parse.syntaxErrorToLocation(obj)->Some,
- )->Error
+ RESyntaxError(Belt.Option.getExn(Js.Exn.message(obj)))
+ ->SqError.fromMessageWithFrameStack(
+ Reducer_FrameStack.makeSingleFrameStack(Reducer_Peggy_Parse.syntaxErrorToLocation(obj)),
+ )
+ ->Error
}
diff --git a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem.res b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem.res
index c4ec1208..3612c492 100644
--- a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem.res
+++ b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem.res
@@ -4,8 +4,9 @@ module T = ReducerProject_ProjectItem_T
type projectItem = T.projectItem
type t = T.t
-let emptyItem: projectItem = {
+let emptyItem = (sourceId: string): projectItem => {
source: "",
+ sourceId: sourceId,
rawParse: None,
expression: None,
continuation: Reducer_Namespace.make(),
@@ -18,6 +19,7 @@ let emptyItem: projectItem = {
// source -> rawParse -> includes -> expression -> continuation -> result
let getSource = (r: t): T.sourceType => r.source
+let getSourceId = (r: t): T.sourceType => r.sourceId
let getRawParse = (r: t): T.rawParseType => r.rawParse
let getExpression = (r: t): T.expressionType => r.expression
let getContinuation = (r: t): T.continuationArgumentType => r.continuation
@@ -29,7 +31,7 @@ let getDirectIncludes = (r: t): array => r.directIncludes
let getIncludesAsVariables = (r: t): T.importAsVariablesType => r.includeAsVariables
let touchSource = (this: t): t => {
- let r = emptyItem
+ let r = emptyItem(this->getSourceId)
{
...r,
source: getSource(this),
@@ -41,8 +43,9 @@ let touchSource = (this: t): t => {
}
let touchRawParse = (this: t): t => {
+ let r = emptyItem(this->getSourceId)
{
- ...emptyItem,
+ ...r,
source: getSource(this),
continues: getContinues(this),
includes: getIncludes(this),
@@ -148,7 +151,8 @@ let parseIncludes = (this: t): t => {
}
}
}
-let doRawParse = (this: t): T.rawParseArgumentType => this->getSource->Reducer_Peggy_Parse.parse
+let doRawParse = (this: t): T.rawParseArgumentType =>
+ this->getSource->Reducer_Peggy_Parse.parse(this.sourceId)->E.R2.errMap(SqError.fromParseError)
let rawParse = (this: t): t =>
this->getRawParse->E.O2.defaultFn(() => doRawParse(this))->setRawParse(this, _)
@@ -167,7 +171,7 @@ let buildExpression = (this: t): t => {
}
}
-let failRun = (this: t, e: Reducer_ErrorValue.errorValue): t =>
+let failRun = (this: t, e: SqError.t): t =>
this->setResult(e->Error)->setContinuation(Reducer_Namespace.make())
let doRun = (this: t, context: Reducer_T.context): t =>
@@ -181,11 +185,11 @@ let doRun = (this: t, context: Reducer_T.context): t =>
->setResult(result->Ok)
->setContinuation(contextAfterEvaluation.bindings->Reducer_Bindings.locals)
} catch {
- | Reducer_ErrorValue.ErrorException(e) => this->failRun(e)
+ | e => this->failRun(e->SqError.fromException)
}
| Error(e) => this->failRun(e)
}
- | None => this->failRun(RETodo("attempt to run without expression"))
+ | None => this->failRun(RETodo("attempt to run without expression")->SqError.fromMessage)
}
let run = (this: t, context: Reducer_T.context): t => {
diff --git a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem_T.res b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem_T.res
index bf1cbfcb..24e690eb 100644
--- a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem_T.res
+++ b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_ProjectItem_T.res
@@ -1,26 +1,24 @@
module Parse = Reducer_Peggy_Parse
module ExpressionT = Reducer_Expression_T
-open Reducer_ErrorValue
type sourceArgumentType = string
type sourceType = string
-type rawParseArgumentType = result
+type rawParseArgumentType = result
type rawParseType = option
-type expressionArgumentType = result
+type expressionArgumentType = result
type expressionType = option
type continuationArgumentType = Reducer_T.namespace
-type continuationType = option
-type continuationResultType = option>
-type resultArgumentType = result
+type resultArgumentType = result
type resultType = option
type continuesArgumentType = array
type continuesType = array
type includesArgumentType = string
-type includesType = result, errorValue>
+type includesType = result, SqError.t>
type importAsVariablesType = array<(string, string)>
type projectItem = {
source: sourceType,
+ sourceId: string,
rawParse: rawParseType,
expression: expressionType,
continuation: continuationArgumentType,
diff --git a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_T.res b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_T.res
index c481b1dc..6b8e3005 100644
--- a/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_T.res
+++ b/packages/squiggle-lang/src/rescript/ReducerProject/ReducerProject_T.res
@@ -27,4 +27,4 @@ type projectJson = {
let getSourceIds = (project: t): array => Belt.MutableMap.String.keysToArray(project.items)
let getItem = (project: t, sourceId: string) =>
- Belt.MutableMap.String.getWithDefault(project.items, sourceId, ProjectItem.emptyItem)
+ Belt.MutableMap.String.getWithDefault(project.items, sourceId, ProjectItem.emptyItem(sourceId))
diff --git a/packages/squiggle-lang/src/rescript/SqError.res b/packages/squiggle-lang/src/rescript/SqError.res
new file mode 100644
index 00000000..dd28fa4b
--- /dev/null
+++ b/packages/squiggle-lang/src/rescript/SqError.res
@@ -0,0 +1,159 @@
+type location = Reducer_Peggy_Parse.location
+
+// Messages don't contain any stack trace information.
+// FunctionRegistry functions are allowed to throw MessageExceptions, though,
+// because they will be caught and rewrapped by Reducer_Lambda code.
+module Message = {
+ @genType.opaque
+ type t =
+ | REArityError(option, int, int)
+ | REArrayIndexNotFound(string, int)
+ | REAssignmentExpected
+ | REDistributionError(DistributionTypes.error)
+ | REExpectedType(string, string)
+ | REExpressionExpected
+ | REFunctionExpected(string)
+ | REFunctionNotFound(string)
+ | REJavaScriptExn(option, option) // Javascript Exception
+ | REMacroNotFound(string)
+ | RENotAFunction(string)
+ | REOperationError(Operation.operationError)
+ | RERecordPropertyNotFound(string, string)
+ | RESymbolNotFound(string)
+ | RESyntaxError(string)
+ | RETodo(string) // To do
+ | REUnitNotFound(string)
+ | RENeedToRun
+ | REOther(string)
+
+ exception MessageException(t)
+
+ let toString = (err: t) =>
+ switch err {
+ | REArityError(_oFnName, arity, usedArity) =>
+ `${Js.String.make(arity)} arguments expected. Instead ${Js.String.make(
+ usedArity,
+ )} argument(s) were passed.`
+ | REArrayIndexNotFound(msg, index) => `${msg}: ${Js.String.make(index)}`
+ | REAssignmentExpected => "Assignment expected"
+ | REExpressionExpected => "Expression expected"
+ | REFunctionExpected(msg) => `Function expected: ${msg}`
+ | REFunctionNotFound(msg) => `Function not found: ${msg}`
+ | REDistributionError(err) =>
+ `Distribution Math Error: ${DistributionTypes.Error.toString(err)}`
+ | REOperationError(err) => `Math Error: ${Operation.Error.toString(err)}`
+ | REJavaScriptExn(omsg, oname) => {
+ let answer = "JS Exception:"
+ let answer = switch oname {
+ | Some(name) => `${answer} ${name}`
+ | _ => answer
+ }
+ let answer = switch omsg {
+ | Some(msg) => `${answer}: ${msg}`
+ | _ => answer
+ }
+ answer
+ }
+ | REMacroNotFound(macro) => `Macro not found: ${macro}`
+ | RENotAFunction(valueString) => `${valueString} is not a function`
+ | RERecordPropertyNotFound(msg, index) => `${msg}: ${index}`
+ | RESymbolNotFound(symbolName) => `${symbolName} is not defined`
+ | RESyntaxError(desc) => `Syntax Error: ${desc}`
+ | RETodo(msg) => `TODO: ${msg}`
+ | REExpectedType(typeName, valueString) => `Expected type: ${typeName} but got: ${valueString}`
+ | REUnitNotFound(unitName) => `Unit not found: ${unitName}`
+ | RENeedToRun => "Need to run"
+ | REOther(msg) => `Error: ${msg}`
+ }
+
+ let fromException = exn =>
+ switch exn {
+ | MessageException(e) => e
+ | Js.Exn.Error(e) =>
+ switch Js.Exn.message(e) {
+ | Some(message) => REOther(message)
+ | None =>
+ switch Js.Exn.name(e) {
+ | Some(name) => REOther(name)
+ | None => REOther("Unknown error")
+ }
+ }
+ | _e => REOther("Unknown error")
+ }
+
+ let throw = (errorValue: t) => errorValue->MessageException->raise
+}
+
+@genType.opaque
+type t = {
+ message: Message.t,
+ frameStack: Reducer_FrameStack.t,
+}
+
+exception SqException(t)
+
+let fromMessageWithFrameStack = (message: Message.t, frameStack: Reducer_FrameStack.t): t => {
+ message: message,
+ frameStack: frameStack,
+}
+
+// this shouldn't be used much, since frame stack will be empty
+// but it's useful for global errors, e.g. in ReducerProject or somethere in the frontend
+@genType
+let fromMessage = (message: Message.t) =>
+ fromMessageWithFrameStack(message, Reducer_FrameStack.make())
+
+let fromParseError = (SyntaxError(message, location): Reducer_Peggy_Parse.parseError) =>
+ RESyntaxError(message)->fromMessageWithFrameStack(
+ Reducer_FrameStack.makeSingleFrameStack(location),
+ )
+
+@genType
+let getTopFrame = (t: t): option => t.frameStack->Reducer_FrameStack.getTopFrame
+
+@genType
+let getFrameStack = (t: t): Reducer_FrameStack.t => t.frameStack
+
+@genType
+let toString = (t: t): string => t.message->Message.toString
+
+@genType
+let createOtherError = (v: string): t => Message.REOther(v)->fromMessage
+
+@genType
+let getFrameArray = (t: t): array => t.frameStack->Reducer_FrameStack.toFrameArray
+
+@genType
+let toStringWithStackTrace = (t: t) =>
+ t->toString ++ if t.frameStack->Reducer_FrameStack.isEmpty {
+ "\nStack trace:\n" ++ t.frameStack->Reducer_FrameStack.toString
+ } else {
+ ""
+ }
+let throw = (t: t) => t->SqException->raise
+
+let throwMessageWithFrameStack = (message: Message.t, frameStack: Reducer_FrameStack.t) =>
+ message->fromMessageWithFrameStack(frameStack)->throw
+
+// this shouldn't be used for most runtime errors - the resulting error would have an empty framestack
+let fromException = exn =>
+ switch exn {
+ | SqException(e) => e
+ | Message.MessageException(e) => e->fromMessage
+ | Js.Exn.Error(obj) => REJavaScriptExn(obj->Js.Exn.message, obj->Js.Exn.name)->fromMessage
+ | _ => REOther("Unknown exception")->fromMessage
+ }
+
+// converts raw exceptions into exceptions with framestack attached
+// already converted exceptions won't be affected
+let rethrowWithFrameStack = (fn: unit => 'a, frameStack: Reducer_FrameStack.t) => {
+ try {
+ fn()
+ } catch {
+ | SqException(e) => e->throw // exception already has a framestack
+ | Message.MessageException(e) => e->throwMessageWithFrameStack(frameStack) // probably comes from FunctionRegistry, adding framestack
+ | Js.Exn.Error(obj) =>
+ REJavaScriptExn(obj->Js.Exn.message, obj->Js.Exn.name)->throwMessageWithFrameStack(frameStack)
+ | _ => REOther("Unknown exception")->throwMessageWithFrameStack(frameStack)
+ }
+}
diff --git a/packages/squiggle-lang/src/rescript/SquiggleLibrary/SquiggleLibrary_StdLib.res b/packages/squiggle-lang/src/rescript/SquiggleLibrary/SquiggleLibrary_StdLib.res
index 3be93851..9b2fea1d 100644
--- a/packages/squiggle-lang/src/rescript/SquiggleLibrary/SquiggleLibrary_StdLib.res
+++ b/packages/squiggle-lang/src/rescript/SquiggleLibrary/SquiggleLibrary_StdLib.res
@@ -1,5 +1,3 @@
-exception ErrorException = Reducer_ErrorValue.ErrorException
-
let stdLib: Reducer_T.namespace = {
// constants
let res =
@@ -10,23 +8,23 @@ let stdLib: Reducer_T.namespace = {
// array and record lookups
let res = res->Reducer_Namespace.set(
"$_atIndex_$",
- Reducer_Expression_Lambda.makeFFILambda((inputs, _, _) => {
+ Reducer_Lambda.makeFFILambda("$_atIndex_$", (inputs, _, _) => {
switch inputs {
| [IEvArray(aValueArray), IEvNumber(fIndex)] => {
let index = Belt.Int.fromFloat(fIndex) // TODO - fail on non-integer indices?
switch Belt.Array.get(aValueArray, index) {
| Some(value) => value
- | None => REArrayIndexNotFound("Array index not found", index)->ErrorException->raise
+ | None => REArrayIndexNotFound("Array index not found", index)->SqError.Message.throw
}
}
| [IEvRecord(dict), IEvString(sIndex)] =>
switch Belt.Map.String.get(dict, sIndex) {
| Some(value) => value
| None =>
- RERecordPropertyNotFound("Record property not found", sIndex)->ErrorException->raise
+ RERecordPropertyNotFound("Record property not found", sIndex)->SqError.Message.throw
}
- | _ => REOther("Trying to access key on wrong value")->ErrorException->raise
+ | _ => REOther("Trying to access key on wrong value")->SqError.Message.throw
}
})->Reducer_T.IEvLambda,
)
@@ -46,10 +44,10 @@ let stdLib: Reducer_T.namespace = {
->Belt.Array.reduce(res, (cur, name) => {
cur->Reducer_Namespace.set(
name,
- Reducer_Expression_Lambda.makeFFILambda((arguments, environment, reducer) => {
- switch FunctionRegistry_Library.call(name, arguments, environment, reducer) {
+ Reducer_Lambda.makeFFILambda(name, (arguments, context, reducer) => {
+ switch FunctionRegistry_Library.call(name, arguments, context, reducer) {
| Ok(value) => value
- | Error(error) => error->Reducer_ErrorValue.ErrorException->raise
+ | Error(error) => error->SqError.Message.throw
}
})->Reducer_T.IEvLambda,
)
diff --git a/packages/vscode-ext/.gitignore b/packages/vscode-ext/.gitignore
index a4e24e9e..2cef1086 100644
--- a/packages/vscode-ext/.gitignore
+++ b/packages/vscode-ext/.gitignore
@@ -3,3 +3,4 @@
/server/out
/*.vsix
/syntaxes/*.json
+dist
diff --git a/packages/vscode-ext/.vscodeignore b/packages/vscode-ext/.vscodeignore
index 38999676..0b96f75e 100644
--- a/packages/vscode-ext/.vscodeignore
+++ b/packages/vscode-ext/.vscodeignore
@@ -1,7 +1,10 @@
.vscode/**
.vscode-test/**
src/**
+client
+server
.gitignore
+node_modules
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
diff --git a/packages/vscode-ext/client/tsconfig.json b/packages/vscode-ext/client/tsconfig.json
deleted file mode 100644
index 079e3466..00000000
--- a/packages/vscode-ext/client/tsconfig.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "es2020",
- "lib": ["ES2020", "dom"],
- "outDir": "out",
- "rootDir": "src",
- "sourceMap": true
- },
- "include": ["src"],
- "exclude": ["node_modules", ".vscode-test"]
-}
diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json
index 29b62437..e7917e0d 100644
--- a/packages/vscode-ext/package.json
+++ b/packages/vscode-ext/package.json
@@ -22,7 +22,7 @@
"onCustomEditor:squiggle.wysiwyg",
"onCommand:squiggle.preview"
],
- "main": "./client/out/extension.js",
+ "main": "./dist/src/client/extension.js",
"contributes": {
"languages": [
{
@@ -114,30 +114,32 @@
}
},
"scripts": {
- "vscode:prepublish": "yarn run compile",
- "compile:tsc": "tsc -b",
- "compile:grammar": "js-yaml syntaxes/squiggle.tmLanguage.yaml >syntaxes/squiggle.tmLanguage.json",
- "compile:vendor": "(cd ../squiggle-lang && yarn run build) && (cd ../components && yarn run bundle && yarn run build:css) && mkdir -p media/vendor && cp ../components/dist/bundle.js media/vendor/components.js && cp ../components/dist/main.css media/vendor/components.css && cp ../../node_modules/react/umd/react.production.min.js media/vendor/react.js && cp ../../node_modules/react-dom/umd/react-dom.production.min.js media/vendor/react-dom.js && cp ../website/static/img/squiggle-logo.png media/vendor/icon.png",
- "compile": "yarn run compile:vendor && yarn run compile:grammar && yarn run compile:tsc",
- "watch": "tsc -b -watch",
- "pretest": "yarn run compile && yarn run lint",
- "lint": "prettier --check .",
+ "vscode:prepublish": "yarn run lint && yarn run build",
+ "build:grammar": "js-yaml syntaxes/squiggle.tmLanguage.yaml >syntaxes/squiggle.tmLanguage.json",
+ "build:vendor": "mkdir -p media/vendor && cp ../components/dist/bundle.js media/vendor/components.js && cp ../components/dist/main.css media/vendor/components.css && cp ../../node_modules/react/umd/react.production.min.js media/vendor/react.js && cp ../../node_modules/react-dom/umd/react-dom.production.min.js media/vendor/react-dom.js && cp ../website/static/img/squiggle-logo.png media/vendor/icon.png",
+ "build:bundle": "esbuild ./src/client/extension.ts ./src/server/server.ts --format=cjs --platform=node --sourcemap --minify --bundle --external:vscode --outdir=./dist",
+ "build": "yarn run build:vendor && yarn run build:grammar && yarn run build:bundle",
+ "watch": "yarn run compile:bundle --watch",
+ "pretest": "yarn run build && yarn run lint",
+ "lint": "tsc -noEmit && prettier --check .",
"format": "prettier --write .",
- "package": "npx vsce package --yarn"
+ "package": "vsce package --yarn"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/node": "18.x",
"@types/vscode": "^1.70.0",
+ "esbuild": "^0.15.10",
"glob": "^8.0.3",
"js-yaml": "^4.1.0",
"typescript": "^4.8.4",
- "vsce-yarn-patch": "^1.66.2"
+ "vsce": "^2.11.0"
},
"dependencies": {
"vscode-languageclient": "^8.0.2",
"vscode-languageserver": "^8.0.2",
"vscode-languageserver-textdocument": "^1.0.7",
- "@quri/squiggle-lang": "^0.2.11"
+ "@quri/squiggle-lang": "^0.2.11",
+ "@quri/squiggle-components": "*"
}
}
diff --git a/packages/vscode-ext/server/tsconfig.json b/packages/vscode-ext/server/tsconfig.json
deleted file mode 100644
index 39822b33..00000000
--- a/packages/vscode-ext/server/tsconfig.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "compilerOptions": {
- "module": "commonjs",
- "target": "es2020",
- "lib": ["ES2020", "dom"],
- "outDir": "out",
- "rootDir": "src",
- "sourceMap": true
- },
- "include": ["src"],
- "exclude": ["node_modules"]
-}
diff --git a/packages/vscode-ext/client/src/client.ts b/packages/vscode-ext/src/client/client.ts
similarity index 97%
rename from packages/vscode-ext/client/src/client.ts
rename to packages/vscode-ext/src/client/client.ts
index 83a80129..8f7a4670 100644
--- a/packages/vscode-ext/client/src/client.ts
+++ b/packages/vscode-ext/src/client/client.ts
@@ -13,7 +13,7 @@ let client: LanguageClient;
export const startClient = (context: vscode.ExtensionContext) => {
// The server is implemented in node
let serverModule = context.asAbsolutePath(
- path.join("server", "out", "server.js")
+ path.join("dist", "src", "server", "server.js")
);
// The debug options for the server
// --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
diff --git a/packages/vscode-ext/client/src/editor.ts b/packages/vscode-ext/src/client/editor.ts
similarity index 100%
rename from packages/vscode-ext/client/src/editor.ts
rename to packages/vscode-ext/src/client/editor.ts
diff --git a/packages/vscode-ext/client/src/extension.ts b/packages/vscode-ext/src/client/extension.ts
similarity index 100%
rename from packages/vscode-ext/client/src/extension.ts
rename to packages/vscode-ext/src/client/extension.ts
diff --git a/packages/vscode-ext/client/src/highlight.ts b/packages/vscode-ext/src/client/highlight.ts
similarity index 100%
rename from packages/vscode-ext/client/src/highlight.ts
rename to packages/vscode-ext/src/client/highlight.ts
diff --git a/packages/vscode-ext/client/src/preview.ts b/packages/vscode-ext/src/client/preview.ts
similarity index 100%
rename from packages/vscode-ext/client/src/preview.ts
rename to packages/vscode-ext/src/client/preview.ts
diff --git a/packages/vscode-ext/client/src/utils.ts b/packages/vscode-ext/src/client/utils.ts
similarity index 100%
rename from packages/vscode-ext/client/src/utils.ts
rename to packages/vscode-ext/src/client/utils.ts
diff --git a/packages/vscode-ext/server/src/server.ts b/packages/vscode-ext/src/server/server.ts
similarity index 100%
rename from packages/vscode-ext/server/src/server.ts
rename to packages/vscode-ext/src/server/server.ts
diff --git a/packages/vscode-ext/tsconfig.json b/packages/vscode-ext/tsconfig.json
index 62d1f7fa..b3865b4f 100644
--- a/packages/vscode-ext/tsconfig.json
+++ b/packages/vscode-ext/tsconfig.json
@@ -7,7 +7,6 @@
"rootDir": "src",
"sourceMap": true
},
- "include": ["src"],
- "exclude": ["node_modules", ".vscode-test"],
- "references": [{ "path": "./client" }, { "path": "./server" }]
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", ".vscode-test"]
}
diff --git a/packages/website/docs/Guides/Functions.mdx b/packages/website/docs/Guides/Functions.mdx
index 98208954..5e62125f 100644
--- a/packages/website/docs/Guides/Functions.mdx
+++ b/packages/website/docs/Guides/Functions.mdx
@@ -181,7 +181,7 @@ The `sample(distribution)` samples a given distribution.
## Converting between distribution formats
-Recall the [three formats of distributions](https://develop--squiggle-documentation.netlify.app/docs/Discussions/Three-Types-Of-Distributions). We can force any distribution into `SampleSet` format
+Recall the [three formats of distributions](/docs/Discussions/Three-Formats-Of-Distributions). We can force any distribution into `SampleSet` format
diff --git a/packages/website/docs/Guides/Language.mdx b/packages/website/docs/Guides/Language.mdx
index 311ef6ba..6f439be4 100644
--- a/packages/website/docs/Guides/Language.mdx
+++ b/packages/website/docs/Guides/Language.mdx
@@ -86,11 +86,11 @@ c = 5 to 10 // namespace not required
""`}
/>
-## Number Prefixes
+## Number Suffixes
-Numbers support a few scientific notation prefixes.
+Numbers support a few scientific notation suffixes.
-| prefix | multiplier |
+| suffix | multiplier |
| ------ | ---------- |
| n | 10^-9 |
| m | 10^-3 |
diff --git a/packages/website/docs/Integrations.md b/packages/website/docs/Integrations.md
index d10a7e9a..3a0242b6 100644
--- a/packages/website/docs/Integrations.md
+++ b/packages/website/docs/Integrations.md
@@ -22,7 +22,7 @@ Types are available for both packages.
This documentation uses `@quri/squiggle-components` frequently.
-We host [a storybook](https://squiggle-components.netlify.app/) with details
+We host [a storybook](https://components.squiggle-language.com) with details
and usage of each of the components made available.
## [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle) ![npm version](https://vsmarketplacebadge.apphb.com/version/QURI.vscode-squiggle.svg)
diff --git a/packages/website/docs/Overview.mdx b/packages/website/docs/Overview.mdx
index d00ef749..c71b64db 100644
--- a/packages/website/docs/Overview.mdx
+++ b/packages/website/docs/Overview.mdx
@@ -75,7 +75,7 @@ There's a simple [VS Code extension](https://marketplace.visualstudio.com/items?
Squiggle is built using [Rescript](https://rescript-lang.org/), and is accessible via a simple Typescript library. You can use this library to either run Squiggle code in full, or to call select specific functions within Squiggle (though this latter functionality is very minimal).
**[React Components Library](https://www.npmjs.com/package/@quri/squiggle-components)**
-All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://squiggle-components.netlify.app).
+All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://components.squiggle-language.com).
**[Observable](https://observablehq.com/@hazelfire/squiggle)**
You can use Squiggle Components in Observable notebooks. Sam Nolan put together an exportable [Observable Notebook](https://observablehq.com/@hazelfire/squiggle) of the key components that you can directly import and use in your Observable notebooks.
diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js
index ffcb1e85..f1f426f7 100644
--- a/packages/website/docusaurus.config.js
+++ b/packages/website/docusaurus.config.js
@@ -76,6 +76,10 @@ const config = {
// //... other Algolia params
// },
+ colorMode: {
+ // squiggle playground is not compatible with dark mode yet, see https://github.com/quantified-uncertainty/squiggle/issues/1192
+ disableSwitch: true,
+ },
navbar: {
title: "Squiggle",
hideOnScroll: true,
diff --git a/packages/website/netlify.toml b/packages/website/netlify.toml
deleted file mode 100644
index cb064992..00000000
--- a/packages/website/netlify.toml
+++ /dev/null
@@ -1,8 +0,0 @@
-[build]
- base = "packages/website/"
- command = "cd ../squiggle-lang && yarn build && cd ../components && yarn build && cd ../website && yarn build"
- publish = "build/"
- ignore = "node -e 'process.exitCode = process.env.BRANCH.includes(\"dependabot\") ? 0 : 1' && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ../"
-
-[build.environment]
- NETLIFY_USE_YARN = "true"
diff --git a/packages/website/package.json b/packages/website/package.json
index 2f44bb72..60e6da0b 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -15,7 +15,7 @@
"@docusaurus/core": "2.1.0",
"@docusaurus/preset-classic": "2.1.0",
"@heroicons/react": "^1.0.6",
- "@quri/squiggle-components": "^0.5.0",
+ "@quri/squiggle-components": "*",
"base64-js": "^1.5.1",
"clsx": "^1.2.1",
"hast-util-is-element": "2.1.2",
diff --git a/packages/website/vercel.json b/packages/website/vercel.json
new file mode 100644
index 00000000..3e208976
--- /dev/null
+++ b/packages/website/vercel.json
@@ -0,0 +1,4 @@
+{
+ "buildCommand": "cd ../.. && npx turbo run build --filter=squiggle-website",
+ "framework": "docusaurus-2"
+}
diff --git a/turbo.json b/turbo.json
new file mode 100644
index 00000000..a8ea7384
--- /dev/null
+++ b/turbo.json
@@ -0,0 +1,40 @@
+{
+ "$schema": "https://turborepo.org/schema.json",
+ "pipeline": {
+ "lint": {
+ "outputs": []
+ },
+ "format": {},
+ "build": {
+ "dependsOn": ["^build"]
+ },
+ "vscode-squiggle#build": {
+ "dependsOn": ["^build", "@quri/squiggle-components#bundle"]
+ },
+ "@quri/squiggle-components#build": {
+ "dependsOn": ["^build"],
+ "outputs": ["dist/**", "storybook-static/**"]
+ },
+ "@quri/squiggle-lang#build": {
+ "dependsOn": ["^build"],
+ "outputs": [
+ "__tests__/**/*.bs.js",
+ "benchmark/**/*.bs.js",
+ "src/rescript/**/*.js",
+ "src/rescript/**/*.gen.tsx",
+ "../../node_modules/bisect_ppx/**/*.bs.js",
+ "dist/**"
+ ]
+ },
+ "test": {
+ "dependsOn": ["build"],
+ "outputs": []
+ },
+ "bundle": {
+ "dependsOn": ["^build", "build"]
+ },
+ "coverage": {
+ "cache": false
+ }
+ }
+}
diff --git a/yarn.lock b/yarn.lock
index 9e4d2db1..ec4cad05 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2185,6 +2185,16 @@
resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb"
integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==
+"@esbuild/android-arm@0.15.10":
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.15.10.tgz#a5f9432eb221afc243c321058ef25fe899886892"
+ integrity sha512-FNONeQPy/ox+5NBkcSbYJxoXj9GWu8gVGJTVmUyoOCKQFDTrHVKgNSzChdNt0I8Aj/iKcsDf2r9BFwv+FSNUXg==
+
+"@esbuild/linux-loong64@0.15.10":
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.15.10.tgz#78a42897c2cf8db9fd5f1811f7590393b77774c7"
+ integrity sha512-w0Ou3Z83LOYEkwaui2M8VwIp+nLi/NA60lBLMvaJ+vXVMcsARYdEzLNE7RSm4+lSg4zq4d7fAVuzk7PNQ5JFgg==
+
"@eslint/eslintrc@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d"
@@ -5186,6 +5196,11 @@
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==
+"@types/uuid@^8.3.4":
+ version "8.3.4"
+ resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
+ integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==
+
"@types/vscode@^1.70.0":
version "1.71.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.71.0.tgz#a8d9bb7aca49b0455060e6eb978711b510bdd2e2"
@@ -6236,15 +6251,13 @@ axobject-query@^2.2.0:
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
integrity sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==
-azure-devops-node-api@^7.2.0:
- version "7.2.0"
- resolved "https://registry.yarnpkg.com/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz#131d4e01cf12ebc6e45569b5e0c5c249e4114d6d"
- integrity sha512-pMfGJ6gAQ7LRKTHgiRF+8iaUUeGAI0c8puLaqHLc7B8AR7W6GJLozK9RFeUHFjEGybC9/EB3r67WPd7e46zQ8w==
+azure-devops-node-api@^11.0.1:
+ version "11.2.0"
+ resolved "https://registry.yarnpkg.com/azure-devops-node-api/-/azure-devops-node-api-11.2.0.tgz#bf04edbef60313117a0507415eed4790a420ad6b"
+ integrity sha512-XdiGPhrpaT5J8wdERRKs5g8E0Zy1pvOYTli7z9E8nmOn3YGp4FhtjhrOyFmX/8veWCwdI69mCHKJw6l+4J/bHA==
dependencies:
- os "0.1.1"
- tunnel "0.0.4"
- typed-rest-client "1.2.0"
- underscore "1.8.3"
+ tunnel "0.0.6"
+ typed-rest-client "^1.8.4"
babel-code-frame@^6.26.0:
version "6.26.0"
@@ -6560,7 +6573,7 @@ base16@^1.0.0:
resolved "https://registry.yarnpkg.com/base16/-/base16-1.0.0.tgz#e297f60d7ec1014a7a971a39ebc8a98c0b681e70"
integrity sha512-pNdYkNPiJUnEhnfXV56+sQy8+AaPcG3POZAUnwr4EeqCUZFz4u2PePbo3e5Gj4ziYPCWGUZT9RHisvJKnwFuBQ==
-base64-js@^1.0.2, base64-js@^1.5.1:
+base64-js@^1.0.2, base64-js@^1.3.1, base64-js@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
@@ -6632,6 +6645,15 @@ bisect_ppx@^2.7.1:
resolved "https://registry.yarnpkg.com/bisect_ppx/-/bisect_ppx-2.7.1.tgz#8fde3e6f767a1a4ca190a266d0bd38800b088f66"
integrity sha512-e8gRgfhmCptiyGGov+54Acah+rc+svm0yc/26mn+M6CCNDADufVLMgRaG1uw3LAHm/PFPy+zGFAKMwd6lD2O2g==
+bl@^4.0.3:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a"
+ integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==
+ dependencies:
+ buffer "^5.5.0"
+ inherits "^2.0.4"
+ readable-stream "^3.4.0"
+
bluebird@^3.5.5:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
@@ -6877,6 +6899,14 @@ buffer@^4.3.0:
ieee754 "^1.1.4"
isarray "^1.0.0"
+buffer@^5.5.0:
+ version "5.7.1"
+ resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
+ integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
+ dependencies:
+ base64-js "^1.3.1"
+ ieee754 "^1.1.13"
+
builtin-modules@^3.1.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
@@ -7176,7 +7206,7 @@ cheerio-select@^2.1.0:
domhandler "^5.0.3"
domutils "^3.0.1"
-cheerio@^1.0.0-rc.1, cheerio@^1.0.0-rc.12:
+cheerio@^1.0.0-rc.12, cheerio@^1.0.0-rc.9:
version "1.0.0-rc.12"
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.12.tgz#788bf7466506b1c6bf5fae51d24a2c4d62e47683"
integrity sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==
@@ -7457,7 +7487,7 @@ comma-separated-tokens@^1.0.0:
resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-1.0.8.tgz#632b80b6117867a158f1080ad498b2fbe7e3f5ea"
integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==
-commander@2, commander@^2.19.0, commander@^2.20.0, commander@^2.8.1:
+commander@2, commander@^2.19.0, commander@^2.20.0:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@@ -7477,7 +7507,7 @@ commander@^5.1.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
-commander@^6.2.1:
+commander@^6.1.0, commander@^6.2.1:
version "6.2.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
@@ -8333,6 +8363,13 @@ decompress-response@^4.2.0:
dependencies:
mimic-response "^2.0.0"
+decompress-response@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc"
+ integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==
+ dependencies:
+ mimic-response "^3.1.0"
+
dedent@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
@@ -8452,11 +8489,6 @@ delegates@^1.0.0:
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==
-denodeify@^1.2.1:
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/denodeify/-/denodeify-1.2.1.tgz#3a36287f5034e699e7577901052c2e6c94251631"
- integrity sha512-KNTihKNmQENUZeKu5fzfpzRqR5S2VMp4gl9RFHiWzj9DfvYQPMJ6XHKNaQxaGCXwPk6y9yme3aUoaiAe+KX+vg==
-
depd@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
@@ -8544,7 +8576,7 @@ detective@^5.2.1:
defined "^1.0.0"
minimist "^1.2.6"
-didyoumean@^1.2.1, didyoumean@^1.2.2:
+didyoumean@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037"
integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==
@@ -8855,7 +8887,7 @@ encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
-end-of-stream@^1.0.0, end-of-stream@^1.1.0:
+end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1:
version "1.4.4"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
@@ -8898,10 +8930,10 @@ entities@^4.2.0, entities@^4.3.0:
resolved "https://registry.yarnpkg.com/entities/-/entities-4.3.1.tgz#c34062a94c865c322f9d67b4384e4169bcede6a4"
integrity sha512-o4q/dYJlmyjP2zfnaWDUC6A3BQFmVTX+tZPezK7k0GLSU9QYCauscf5Y+qcEPzKL+EixVouYDgLQK5H9GrLpkg==
-entities@~1.1.1:
- version "1.1.2"
- resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56"
- integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==
+entities@~2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5"
+ integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==
envinfo@^7.7.3:
version "7.8.1"
@@ -9013,6 +9045,134 @@ es6-shim@^0.35.5:
resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.6.tgz#d10578301a83af2de58b9eadb7c2c9945f7388a0"
integrity sha512-EmTr31wppcaIAgblChZiuN/l9Y7DPyw8Xtbg7fIVngn6zMW+IEBJDJngeKC3x6wr0V/vcA2wqeFnaw1bFJbDdA==
+esbuild-android-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.15.10.tgz#8a59a84acbf2eca96996cadc35642cf055c494f0"
+ integrity sha512-UI7krF8OYO1N7JYTgLT9ML5j4+45ra3amLZKx7LO3lmLt1Ibn8t3aZbX5Pu4BjWiqDuJ3m/hsvhPhK/5Y/YpnA==
+
+esbuild-android-arm64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.15.10.tgz#f453851dc1d8c5409a38cf7613a33852faf4915d"
+ integrity sha512-EOt55D6xBk5O05AK8brXUbZmoFj4chM8u3riGflLa6ziEoVvNjRdD7Cnp82NHQGfSHgYR06XsPI8/sMuA/cUwg==
+
+esbuild-darwin-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.15.10.tgz#778bd29c8186ff47b176c8af58c08cf0fb8e6b86"
+ integrity sha512-hbDJugTicqIm+WKZgp208d7FcXcaK8j2c0l+fqSJ3d2AzQAfjEYDRM3Z2oMeqSJ9uFxyj/muSACLdix7oTstRA==
+
+esbuild-darwin-arm64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.10.tgz#b30bbefb46dc3c5d4708b0435e52f6456578d6df"
+ integrity sha512-M1t5+Kj4IgSbYmunf2BB6EKLkWUq+XlqaFRiGOk8bmBapu9bCDrxjf4kUnWn59Dka3I27EiuHBKd1rSO4osLFQ==
+
+esbuild-freebsd-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.10.tgz#ab301c5f6ded5110dbdd611140bef1a7c2e99236"
+ integrity sha512-KMBFMa7C8oc97nqDdoZwtDBX7gfpolkk6Bcmj6YFMrtCMVgoU/x2DI1p74DmYl7CSS6Ppa3xgemrLrr5IjIn0w==
+
+esbuild-freebsd-arm64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.10.tgz#a5b09b867a6ff49110f52343b6f12265db63d43f"
+ integrity sha512-m2KNbuCX13yQqLlbSojFMHpewbn8wW5uDS6DxRpmaZKzyq8Dbsku6hHvh2U+BcLwWY4mpgXzFUoENEf7IcioGg==
+
+esbuild-linux-32@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.15.10.tgz#5282fe9915641caf9c8070e4ba2c3e16d358f837"
+ integrity sha512-guXrwSYFAvNkuQ39FNeV4sNkNms1bLlA5vF1H0cazZBOLdLFIny6BhT+TUbK/hdByMQhtWQ5jI9VAmPKbVPu1w==
+
+esbuild-linux-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.15.10.tgz#f3726e85a00149580cb19f8abfabcbb96f5d52bb"
+ integrity sha512-jd8XfaSJeucMpD63YNMO1JCrdJhckHWcMv6O233bL4l6ogQKQOxBYSRP/XLWP+6kVTu0obXovuckJDcA0DKtQA==
+
+esbuild-linux-arm64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.10.tgz#2f0056e9d5286edb0185b56655caa8c574d8dbe7"
+ integrity sha512-GByBi4fgkvZFTHFDYNftu1DQ1GzR23jws0oWyCfhnI7eMOe+wgwWrc78dbNk709Ivdr/evefm2PJiUBMiusS1A==
+
+esbuild-linux-arm@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.15.10.tgz#40a9270da3c8ffa32cf72e24a79883e323dff08d"
+ integrity sha512-6N8vThLL/Lysy9y4Ex8XoLQAlbZKUyExCWyayGi2KgTBelKpPgj6RZnUaKri0dHNPGgReJriKVU6+KDGQwn10A==
+
+esbuild-linux-mips64le@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.10.tgz#90ce1c4ee0202edb4ac69807dea77f7e5804abc4"
+ integrity sha512-BxP+LbaGVGIdQNJUNF7qpYjEGWb0YyHVSKqYKrn+pTwH/SiHUxFyJYSP3pqkku61olQiSBnSmWZ+YUpj78Tw7Q==
+
+esbuild-linux-ppc64le@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.10.tgz#782837ae7bd5b279178106c9dd801755a21fabdf"
+ integrity sha512-LoSQCd6498PmninNgqd/BR7z3Bsk/mabImBWuQ4wQgmQEeanzWd5BQU2aNi9mBURCLgyheuZS6Xhrw5luw3OkQ==
+
+esbuild-linux-riscv64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.10.tgz#d7420d806ece5174f24f4634303146f915ab4207"
+ integrity sha512-Lrl9Cr2YROvPV4wmZ1/g48httE8z/5SCiXIyebiB5N8VT7pX3t6meI7TQVHw/wQpqP/AF4SksDuFImPTM7Z32Q==
+
+esbuild-linux-s390x@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.10.tgz#21fdf0cb3494a7fb520a71934e4dffce67fe47be"
+ integrity sha512-ReP+6q3eLVVP2lpRrvl5EodKX7EZ1bS1/z5j6hsluAlZP5aHhk6ghT6Cq3IANvvDdscMMCB4QEbI+AjtvoOFpA==
+
+esbuild-netbsd-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.10.tgz#6c06b3107e3df53de381e6299184d4597db0440f"
+ integrity sha512-iGDYtJCMCqldMskQ4eIV+QSS/CuT7xyy9i2/FjpKvxAuCzrESZXiA1L64YNj6/afuzfBe9i8m/uDkFHy257hTw==
+
+esbuild-openbsd-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.10.tgz#4daef5f5d8e74bbda53b65160029445d582570cf"
+ integrity sha512-ftMMIwHWrnrYnvuJQRJs/Smlcb28F9ICGde/P3FUTCgDDM0N7WA0o9uOR38f5Xe2/OhNCgkjNeb7QeaE3cyWkQ==
+
+esbuild-sunos-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.15.10.tgz#5fe7bef267a02f322fd249a8214d0274937388a7"
+ integrity sha512-mf7hBL9Uo2gcy2r3rUFMjVpTaGpFJJE5QTDDqUFf1632FxteYANffDZmKbqX0PfeQ2XjUDE604IcE7OJeoHiyg==
+
+esbuild-windows-32@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.15.10.tgz#48e3dde25ab0135579a288b30ab6ddef6d1f0b28"
+ integrity sha512-ttFVo+Cg8b5+qHmZHbEc8Vl17kCleHhLzgT8X04y8zudEApo0PxPg9Mz8Z2cKH1bCYlve1XL8LkyXGFjtUYeGg==
+
+esbuild-windows-64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.15.10.tgz#387a9515bef3fee502d277a5d0a2db49a4ecda05"
+ integrity sha512-2H0gdsyHi5x+8lbng3hLbxDWR7mKHWh5BXZGKVG830KUmXOOWFE2YKJ4tHRkejRduOGDrBvHBriYsGtmTv3ntA==
+
+esbuild-windows-arm64@0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.10.tgz#5a6fcf2fa49e895949bf5495cf088ab1b43ae879"
+ integrity sha512-S+th4F+F8VLsHLR0zrUcG+Et4hx0RKgK1eyHc08kztmLOES8BWwMiaGdoW9hiXuzznXQ0I/Fg904MNbr11Nktw==
+
+esbuild@^0.15.10:
+ version "0.15.10"
+ resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.15.10.tgz#85c2f8446e9b1fe04fae68daceacba033eedbd42"
+ integrity sha512-N7wBhfJ/E5fzn/SpNgX+oW2RLRjwaL8Y0ezqNqhjD6w0H2p0rDuEz2FKZqpqLnO8DCaWumKe8dsC/ljvVSSxng==
+ optionalDependencies:
+ "@esbuild/android-arm" "0.15.10"
+ "@esbuild/linux-loong64" "0.15.10"
+ esbuild-android-64 "0.15.10"
+ esbuild-android-arm64 "0.15.10"
+ esbuild-darwin-64 "0.15.10"
+ esbuild-darwin-arm64 "0.15.10"
+ esbuild-freebsd-64 "0.15.10"
+ esbuild-freebsd-arm64 "0.15.10"
+ esbuild-linux-32 "0.15.10"
+ esbuild-linux-64 "0.15.10"
+ esbuild-linux-arm "0.15.10"
+ esbuild-linux-arm64 "0.15.10"
+ esbuild-linux-mips64le "0.15.10"
+ esbuild-linux-ppc64le "0.15.10"
+ esbuild-linux-riscv64 "0.15.10"
+ esbuild-linux-s390x "0.15.10"
+ esbuild-netbsd-64 "0.15.10"
+ esbuild-openbsd-64 "0.15.10"
+ esbuild-sunos-64 "0.15.10"
+ esbuild-windows-32 "0.15.10"
+ esbuild-windows-64 "0.15.10"
+ esbuild-windows-arm64 "0.15.10"
+
escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
@@ -9421,6 +9581,11 @@ expand-brackets@^2.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"
+expand-template@^2.0.3:
+ version "2.0.3"
+ resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c"
+ integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==
+
expect@^27.5.1:
version "27.5.1"
resolved "https://registry.yarnpkg.com/expect/-/expect-27.5.1.tgz#83ce59f1e5bdf5f9d2b94b61d2050db48f3fef74"
@@ -9950,6 +10115,11 @@ fromentries@^1.2.0:
resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a"
integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==
+fs-constants@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
+ integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
+
fs-extra@^10.0.0, fs-extra@^10.1.0:
version "10.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
@@ -10130,6 +10300,11 @@ get-value@^2.0.3, get-value@^2.0.6:
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==
+github-from-package@0.0.0:
+ version "0.0.0"
+ resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
+ integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==
+
github-slugger@^1.0.0, github-slugger@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.4.0.tgz#206eb96cdb22ee56fdc53a28d5a302338463444e"
@@ -10614,6 +10789,13 @@ hosted-git-info@^2.1.4:
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
+hosted-git-info@^4.0.2:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224"
+ integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==
+ dependencies:
+ lru-cache "^6.0.0"
+
hpack.js@^2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2"
@@ -10876,7 +11058,7 @@ identity-obj-proxy@^3.0.0:
dependencies:
harmony-reflect "^1.4.6"
-ieee754@^1.1.4:
+ieee754@^1.1.13, ieee754@^1.1.4:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
@@ -12782,6 +12964,14 @@ katex@^0.13.0:
dependencies:
commander "^8.0.0"
+keytar@^7.7.0:
+ version "7.9.0"
+ resolved "https://registry.yarnpkg.com/keytar/-/keytar-7.9.0.tgz#4c6225708f51b50cbf77c5aae81721964c2918cb"
+ integrity sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==
+ dependencies:
+ node-addon-api "^4.3.0"
+ prebuild-install "^7.0.1"
+
keyv@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9"
@@ -12884,10 +13074,10 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
-linkify-it@^2.0.0:
- version "2.2.0"
- resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf"
- integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==
+linkify-it@^3.0.1:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e"
+ integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==
dependencies:
uc.micro "^1.0.1"
@@ -13012,7 +13202,7 @@ lodash.uniq@4.5.0, lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==
-lodash@^4.17.10, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0:
+lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@@ -13136,14 +13326,14 @@ markdown-escapes@^1.0.0:
resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535"
integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==
-markdown-it@^8.3.1:
- version "8.4.2"
- resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-8.4.2.tgz#386f98998dc15a37722aa7722084f4020bdd9b54"
- integrity sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==
+markdown-it@^12.3.2:
+ version "12.3.2"
+ resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90"
+ integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==
dependencies:
- argparse "^1.0.7"
- entities "~1.1.1"
- linkify-it "^2.0.0"
+ argparse "^2.0.1"
+ entities "~2.1.0"
+ linkify-it "^3.0.1"
mdurl "^1.0.1"
uc.micro "^1.0.5"
@@ -13397,6 +13587,11 @@ mimic-response@^2.0.0:
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43"
integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==
+mimic-response@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9"
+ integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==
+
min-document@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
@@ -13455,7 +13650,7 @@ minimatch@^5.0.1:
dependencies:
brace-expansion "^2.0.1"
-minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
+minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
@@ -13520,6 +13715,11 @@ mixin-deep@^1.2.0:
for-in "^1.0.2"
is-extendable "^1.0.1"
+mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3:
+ version "0.5.3"
+ resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113"
+ integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==
+
mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
@@ -13636,6 +13836,11 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
+napi-build-utils@^1.0.1:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806"
+ integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==
+
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
@@ -13669,6 +13874,18 @@ no-case@^3.0.4:
lower-case "^2.0.2"
tslib "^2.0.3"
+node-abi@^3.3.0:
+ version "3.26.0"
+ resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.26.0.tgz#fa5dfb912b821f29f058cb04b87f397ce107dc4b"
+ integrity sha512-jRVtMFTChbi2i/jqo/i2iP9634KMe+7K1v35mIdj3Mn59i5q27ZYhn+sW6npISM/PQg7HrP2kwtRBMmh5Uvzdg==
+ dependencies:
+ semver "^7.3.5"
+
+node-addon-api@^4.3.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f"
+ integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==
+
node-dir@^0.1.10:
version "0.1.17"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"
@@ -14068,24 +14285,6 @@ os-homedir@^1.0.0:
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"
integrity sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==
-os-tmpdir@^1.0.0, os-tmpdir@~1.0.1:
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
- integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==
-
-os@0.1.1:
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/os/-/os-0.1.1.tgz#208845e89e193ad4d971474b93947736a56d13f3"
- integrity sha512-jg06S2xr5De63mLjZVJDf3/k37tpjppr2LR7MUOsxv8XuUCVpCnvbCksXCBcB5gQqQf/K0+87WGTRlAj5q7r1A==
-
-osenv@^0.1.3:
- version "0.1.5"
- resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410"
- integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==
- dependencies:
- os-homedir "^1.0.0"
- os-tmpdir "^1.0.0"
-
p-all@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/p-all/-/p-all-2.1.0.tgz#91419be56b7dee8fe4c5db875d55e0da084244a0"
@@ -15269,6 +15468,24 @@ postcss@^8.2.15, postcss@^8.3.11, postcss@^8.3.5, postcss@^8.4.13, postcss@^8.4.
picocolors "^1.0.0"
source-map-js "^1.0.2"
+prebuild-install@^7.0.1:
+ version "7.1.1"
+ resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45"
+ integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==
+ dependencies:
+ detect-libc "^2.0.0"
+ expand-template "^2.0.3"
+ github-from-package "0.0.0"
+ minimist "^1.2.3"
+ mkdirp-classic "^0.5.3"
+ napi-build-utils "^1.0.1"
+ node-abi "^3.3.0"
+ pump "^3.0.0"
+ rc "^1.2.7"
+ simple-get "^4.0.0"
+ tar-fs "^2.0.0"
+ tunnel-agent "^0.6.0"
+
prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
@@ -15557,7 +15774,7 @@ qs@6.10.3:
dependencies:
side-channel "^1.0.4"
-qs@^6.10.0:
+qs@^6.10.0, qs@^6.9.1:
version "6.11.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a"
integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==
@@ -15651,7 +15868,7 @@ raw-loader@^4.0.2:
loader-utils "^2.0.0"
schema-utils "^3.0.0"
-rc@1.2.8, rc@^1.2.8:
+rc@1.2.8, rc@^1.2.7, rc@^1.2.8:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==
@@ -16044,7 +16261,7 @@ read@^1.0.7:
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
-readable-stream@^3.0.6, readable-stream@^3.6.0:
+readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
@@ -16657,7 +16874,7 @@ sass-loader@^12.3.0:
klona "^2.0.4"
neo-async "^2.6.2"
-sax@^1.2.4, sax@~1.2.4:
+sax@>=0.6.0, sax@^1.2.4, sax@~1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
@@ -17016,6 +17233,15 @@ simple-get@^3.0.3:
once "^1.3.1"
simple-concat "^1.0.0"
+simple-get@^4.0.0:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543"
+ integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==
+ dependencies:
+ decompress-response "^6.0.0"
+ once "^1.3.1"
+ simple-concat "^1.0.0"
+
sirv@^1.0.7:
version "1.0.19"
resolved "https://registry.yarnpkg.com/sirv/-/sirv-1.0.19.tgz#1d73979b38c7fe91fcba49c85280daa9c2363b49"
@@ -17774,6 +18000,27 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
+tar-fs@^2.0.0:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
+ integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==
+ dependencies:
+ chownr "^1.1.1"
+ mkdirp-classic "^0.5.2"
+ pump "^3.0.0"
+ tar-stream "^2.1.4"
+
+tar-stream@^2.1.4:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287"
+ integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==
+ dependencies:
+ bl "^4.0.3"
+ end-of-stream "^1.4.1"
+ fs-constants "^1.0.0"
+ inherits "^2.0.3"
+ readable-stream "^3.1.1"
+
tar@^6.0.2, tar@^6.1.11:
version "6.1.11"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621"
@@ -17958,12 +18205,12 @@ tiny-warning@^1.0.0, tiny-warning@^1.0.3:
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
-tmp@0.0.29:
- version "0.0.29"
- resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.29.tgz#f25125ff0dd9da3ccb0c2dd371ee1288bb9128c0"
- integrity sha512-89PTqMWGDva+GqClOqBV9s3SMh7MA3Mq0pJUdAoHuF65YoE7O0LermaZkVfT5/Ngfo18H4eYiyG7zKOtnEbxsw==
+tmp@^0.2.1:
+ version "0.2.1"
+ resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14"
+ integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==
dependencies:
- os-tmpdir "~1.0.1"
+ rimraf "^3.0.0"
tmpl@1.0.5:
version "1.0.5"
@@ -18232,10 +18479,59 @@ tty-browserify@0.0.0:
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
integrity sha512-JVa5ijo+j/sOoHGjw0sxw734b1LhBkQ3bvUGNdxnVXDCX81Yx7TFgnZygxrIIWn23hbfTaMYLwRmAxFyDuFmIw==
-tunnel@0.0.4:
- version "0.0.4"
- resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.4.tgz#2d3785a158c174c9a16dc2c046ec5fc5f1742213"
- integrity sha512-o9QYRJN5WgS8oCtqvwzzcfnzaTnDPr7HpUsQdSXscTyzXbjvl4wSHPTUKOKzEaDeQvOuyRtt3ui+ujM7x7TReQ==
+tunnel-agent@^0.6.0:
+ version "0.6.0"
+ resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
+ integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==
+ dependencies:
+ safe-buffer "^5.0.1"
+
+tunnel@0.0.6:
+ version "0.0.6"
+ resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
+ integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==
+
+turbo-darwin-64@1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.5.5.tgz#710d4e7999066bd4f500456f7cd1c30f6e6205ed"
+ integrity sha512-HvEn6P2B+NXDekq9LRpRgUjcT9/oygLTcK47U0qsAJZXRBSq/2hvD7lx4nAwgY/4W3rhYJeWtHTzbhoN6BXqGQ==
+
+turbo-darwin-arm64@1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.5.5.tgz#f7955a800e945ab110e8a6e23f60a2b9795296ab"
+ integrity sha512-Dmxr09IUy6M0nc7/xWod9galIO2DD500B75sJSkHeT+CCdJOWnlinux0ZPF8CSygNqymwYO8AO2l15/6yxcycg==
+
+turbo-linux-64@1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.5.5.tgz#f31eb117a9b605f5731048c50473bff903850047"
+ integrity sha512-wd07TZ4zXXWjzZE00FcFMLmkybQQK/NV9ff66vvAV0vdiuacSMBCNLrD6Mm4ncfrUPW/rwFW5kU/7hyuEqqtDw==
+
+turbo-linux-arm64@1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.5.5.tgz#b9ce6912ae6477e829355d6f012500bfef58669d"
+ integrity sha512-q3q33tuo74R7gicnfvFbnZZvqmlq7Vakcvx0eshifnJw4PR+oMnTCb4w8ElVFx070zsb8DVTibq99y8NJH8T1Q==
+
+turbo-windows-64@1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.5.5.tgz#609098de3bc6178f733615d21b06d5c1602637eb"
+ integrity sha512-lPp9kHonNFfqgovbaW+UAPO5cLmoAN+m3G3FzqcrRPnlzt97vXYsDhDd/4Zy3oAKoAcprtP4CGy0ddisqsKTVw==
+
+turbo-windows-arm64@1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.5.5.tgz#60522e1e347a54c64bdddb68089fc322ee19c3d7"
+ integrity sha512-3AfGULKNZiZVrEzsIE+W79ZRW1+f5r4nM4wLlJ1PTBHyRxBZdD6KTH1tijGfy/uTlcV5acYnKHEkDc6Q9PAXGQ==
+
+turbo@^1.5.5:
+ version "1.5.5"
+ resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.5.5.tgz#9fc3a917c914ffa113c260a4eadb4bc632eee227"
+ integrity sha512-PVQSDl0STC9WXIyHcYUWs9gXsf8JjQig/FuHfuB8N6+XlgCGB3mPbfMEE6zrChGz2hufH4/guKRX1XJuNL6XTA==
+ optionalDependencies:
+ turbo-darwin-64 "1.5.5"
+ turbo-darwin-arm64 "1.5.5"
+ turbo-linux-64 "1.5.5"
+ turbo-linux-arm64 "1.5.5"
+ turbo-windows-64 "1.5.5"
+ turbo-windows-arm64 "1.5.5"
type-check@^0.4.0, type-check@~0.4.0:
version "0.4.0"
@@ -18299,13 +18595,14 @@ typed-function@^4.1.0:
resolved "https://registry.yarnpkg.com/typed-function/-/typed-function-4.1.0.tgz#da4bdd8a6d19a89e22732f75e4a410860aaf9712"
integrity sha512-DGwUl6cioBW5gw2L+6SMupGwH/kZOqivy17E4nsh1JI9fKF87orMmlQx3KISQPmg3sfnOUGlwVkroosvgddrlg==
-typed-rest-client@1.2.0:
- version "1.2.0"
- resolved "https://registry.yarnpkg.com/typed-rest-client/-/typed-rest-client-1.2.0.tgz#723085d203f38d7d147271e5ed3a75488eb44a02"
- integrity sha512-FrUshzZ1yxH8YwGR29PWWnfksLEILbWJydU7zfIRkyH7kAEzB62uMAl2WY6EyolWpLpVHeJGgQm45/MaruaHpw==
+typed-rest-client@^1.8.4:
+ version "1.8.9"
+ resolved "https://registry.yarnpkg.com/typed-rest-client/-/typed-rest-client-1.8.9.tgz#e560226bcadfe71b0fb5c416b587f8da3b8f92d8"
+ integrity sha512-uSmjE38B80wjL85UFX3sTYEUlvZ1JgCRhsWj/fJ4rZ0FqDUFoIuodtiVeE+cUqiVTOKPdKrp/sdftD15MDek6g==
dependencies:
- tunnel "0.0.4"
- underscore "1.8.3"
+ qs "^6.9.1"
+ tunnel "0.0.6"
+ underscore "^1.12.1"
typedarray-to-buffer@^3.1.5:
version "3.1.5"
@@ -18349,10 +18646,10 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"
-underscore@1.8.3:
- version "1.8.3"
- resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022"
- integrity sha512-5WsVTFcH1ut/kkhAaHf4PVgI8c7++GiVcpCGxPouI6ZVjsqPnSDf8h/8HtVqc0t4fzRXwnMK70EcZeAs3PIddg==
+underscore@^1.12.1:
+ version "1.13.6"
+ resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441"
+ integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==
unfetch@^4.2.0:
version "4.2.0"
@@ -18590,10 +18887,10 @@ urix@^0.1.0:
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
integrity sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg==
-url-join@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/url-join/-/url-join-1.1.0.tgz#741c6c2f4596c4830d6718460920d0c92202dc78"
- integrity sha512-zz1wZk4Lb5PTVwZ3HWDmm8XnlPvmOof6/fjdDPA5yBrUcbtV64U6bV832Zf1BtU2WkBBWaUT46wCs+l0HP5nhg==
+url-join@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7"
+ integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==
url-loader@^4.1.1:
version "4.1.1"
@@ -18723,6 +19020,11 @@ uuid@^8.0.0, uuid@^8.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
+uuid@^9.0.0:
+ version "9.0.0"
+ resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
+ integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
+
v8-compile-cache-lib@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
@@ -19159,29 +19461,29 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
-vsce-yarn-patch@^1.66.2:
- version "1.66.2"
- resolved "https://registry.yarnpkg.com/vsce-yarn-patch/-/vsce-yarn-patch-1.66.2.tgz#b217a9d73ee715ad41ec44393a5d78ed0955ab44"
- integrity sha512-IJjBF/WQWQvEIikI93qDEhiugjVFDgibqsBa2roawp5abeovPZ9/bzLt0b9AylBtP60q2qSMWsGtf1hZBAs7fw==
+vsce@^2.11.0:
+ version "2.11.0"
+ resolved "https://registry.yarnpkg.com/vsce/-/vsce-2.11.0.tgz#e60aac58ecfc3aec6e40024e13ea8c8d29764aef"
+ integrity sha512-pr9Y0va/HCer0tTifeqaUrK24JJSpRd6oLeF/PY6FtrY41e+lwxiAq6jfMXx4ShAZglYg2rFKoKROwa7E7SEqQ==
dependencies:
- azure-devops-node-api "^7.2.0"
+ azure-devops-node-api "^11.0.1"
chalk "^2.4.2"
- cheerio "^1.0.0-rc.1"
- commander "^2.8.1"
- denodeify "^1.2.1"
- didyoumean "^1.2.1"
+ cheerio "^1.0.0-rc.9"
+ commander "^6.1.0"
glob "^7.0.6"
- lodash "^4.17.10"
- markdown-it "^8.3.1"
+ hosted-git-info "^4.0.2"
+ keytar "^7.7.0"
+ leven "^3.1.0"
+ markdown-it "^12.3.2"
mime "^1.3.4"
minimatch "^3.0.3"
- osenv "^0.1.3"
parse-semver "^1.1.1"
read "^1.0.7"
semver "^5.1.0"
- tmp "0.0.29"
- typed-rest-client "1.2.0"
- url-join "^1.1.0"
+ tmp "^0.2.1"
+ typed-rest-client "^1.8.4"
+ url-join "^4.0.1"
+ xml2js "^0.4.23"
yauzl "^2.3.1"
yazl "^2.2.2"
@@ -19998,6 +20300,19 @@ xml-name-validator@^4.0.0:
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835"
integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==
+xml2js@^0.4.23:
+ version "0.4.23"
+ resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66"
+ integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==
+ dependencies:
+ sax ">=0.6.0"
+ xmlbuilder "~11.0.0"
+
+xmlbuilder@~11.0.0:
+ version "11.0.1"
+ resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
+ integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
+
xmlchars@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"