Skip to content

Commit

Permalink
Reorganize compilation code folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Oct 8, 2024
1 parent 1afdca7 commit 401865e
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion gui/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CompileContextProvider } from "@SpCompilation/CompileContextProvider";
import ToggleableThemeProvider from "./ToggleableThemeProvider";
import ProjectContextProvider from "@SpCore/ProjectContextProvider";
import HomePage from "@SpPages/HomePage";
import { Analytics } from "@vercel/analytics/react";
import { BrowserRouter } from "react-router-dom";
import { CompileContextProvider } from "./CompileContext/CompileContextProvider";

const App = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ProjectContext } from "@SpCore/ProjectContextProvider";
import compileStanProgram from "@SpCompileContext/compileStanProgram";
import {
FunctionComponent,
PropsWithChildren,
Expand All @@ -8,8 +7,9 @@ import {
useEffect,
useState,
} from "react";
import { CompileContext, CompileStatus } from "./CompileContext";
import { publicCompilationServerUrl } from "@SpStanc/CompilationServerConnectionControl";
import { CompileContext, CompileStatus } from "@SpCompilation/CompileContext";
import { publicCompilationServerUrl } from "@SpCompilation/Constants";
import compileStanProgram from "./compileStanProgram";

type CompileContextProviderProps = {
// none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompileContext } from "@SpCompileContext/CompileContext";
import { CompileContext } from "@SpCompilation/CompileContext";
import { Refresh } from "@mui/icons-material";
import Divider from "@mui/material/Divider";
import FormControl from "@mui/material/FormControl";
Expand All @@ -10,11 +10,11 @@ import RadioGroup from "@mui/material/RadioGroup";
import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography";
import { FunctionComponent, useCallback, useContext } from "react";
import { serverTypeForUrl } from "./CompilationServerToolbar";
import {
localCompilationServerUrl,
publicCompilationServerUrl,
serverTypeForUrl,
} from "./CompilationServerConnectionControl";
} from "./Constants";

type ConfigureCompilationServerDialogProps = {
isConnected: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import CloseableDialog, {
useDialogControls,
} from "@SpComponents/CloseableDialog";
import { FunctionComponent, useCallback, useContext } from "react";
import ConfigureCompilationServerDialog from "./ConfigureCompilationServerDialog";
import ConfigureCompilationServerDialog from "./CompilationServerDialog";
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import { CompileContext } from "@SpCompileContext/CompileContext";

export const publicCompilationServerUrl =
"https://stan-wasm.flatironinstitute.org";
export const localCompilationServerUrl = "http://localhost:8083";

type ServerType = "public" | "local" | "custom";
import { CompileContext } from "@SpCompilation/CompileContext";
import {
ServerType,
publicCompilationServerUrl,
localCompilationServerUrl,
} from "./Constants";

type CompilationServerConnectionControlProps = {
// none
Expand Down
4 changes: 4 additions & 0 deletions gui/src/app/Compilation/Control/Constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const publicCompilationServerUrl =
"https://stan-wasm.flatironinstitute.org";
export const localCompilationServerUrl = "http://localhost:8083";
export type ServerType = "public" | "local" | "custom";
2 changes: 1 addition & 1 deletion gui/src/app/FileEditor/StanFileEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TextEditor from "@SpComponents/TextEditor";
import { ToolbarItem } from "@SpComponents/ToolBar";
import { stancErrorsToCodeMarkers } from "@SpStanc/Linting";
import useStanc from "@SpStanc/useStanc";
import { CompileContext } from "@SpCompileContext/CompileContext";
import { CompileContext } from "@SpCompilation/CompileContext";
import { FunctionComponent, useContext, useMemo, useState } from "react";

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion gui/src/app/RunPanel/RunPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { FunctionComponent, useCallback, useContext, useMemo } from "react";

import Button from "@mui/material/Button";
import { CompileContext } from "@SpCompileContext/CompileContext";
import { CompileContext } from "@SpCompilation/CompileContext";
import { ProjectContext } from "@SpCore/ProjectContextProvider";
import { SamplingOpts, modelHasUnsavedChanges } from "@SpCore/ProjectDataModel";
import StanSampler from "@SpStanSampler/StanSampler";
Expand Down
2 changes: 1 addition & 1 deletion gui/src/app/Stanc/useStanc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useCallback, useContext, useEffect, useMemo, useState } from "react";
// https://vitejs.dev/guide/assets#importing-script-as-a-worker
// https://vitejs.dev/guide/assets#importing-asset-as-url
import stancWorkerURL from "@SpStanc/stancWorker?worker&url";
import { CompileContext } from "@SpCompileContext/CompileContext";
import { CompileContext } from "@SpCompilation/CompileContext";

const useStanc = (
modelName: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import AnalysisPyWindow from "@SpScripting/Analysis/AnalysisPyWindow";
import useStanSampler, { StanRun } from "@SpStanSampler/useStanSampler";
import AnalysisRWindow from "@SpScripting/Analysis/AnalysisRWindow";
import { CompileContext } from "@SpCompileContext/CompileContext";
import { CompileContext } from "@SpCompilation/CompileContext";

type SamplingWindowProps = {
// none
Expand Down
2 changes: 1 addition & 1 deletion gui/src/app/pages/HomePage/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CompilationServerConnectionControl from "@SpStanc/CompilationServerConnectionControl";
import CompilationServerConnectionControl from "@SpCompilation/CompilationServerToolbar";
import { Brightness7, DarkMode, Menu, QuestionMark } from "@mui/icons-material";
import AppBar from "@mui/material/AppBar";
import IconButton from "@mui/material/IconButton";
Expand Down
16 changes: 10 additions & 6 deletions gui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"lib": ["ES2020", "DOM", "DOM.Iterable", "webworker"],
"module": "ESNext",
"skipLibCheck": true,

"types": ["vite/client"],
/* Bundler mode */
"moduleResolution": "bundler",
Expand All @@ -14,13 +13,11 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

/* Imports */
"baseUrl": "./src",
"paths": {
Expand All @@ -37,14 +34,21 @@
"@SpCore/gists/*": ["app/gists/*"],
/* We are playing a bit fast and loose with the distinction */
"@SpPages/*": ["app/pages/HomePage/*"],
"@SpStanc/*": ["app/Stanc/*", "app/CompilationServerConnectionControl/*"],
"@SpStanc/*": ["app/Stanc/*"],
"@SpStanSampler/*": ["app/StanSampler/*"],
"@SpUtil/*": ["app/util/*"],
"@SpStanStats/*": ["app/util/stan_stats/*"],
"@SpScripting/*": ["app/Scripting/*"],
"@SpCompileContext/*": ["app/CompileContext/*"]
"@SpCompilation/*": [
"app/Compilation/Context/*",
"app/Compilation/Control/*"
]
}
},
"include": ["src", "test"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [
{
"path": "./tsconfig.node.json"
}
]
}

0 comments on commit 401865e

Please sign in to comment.