Skip to content

Commit

Permalink
Merge pull request #107 from ShiboSoftwareDev/main
Browse files Browse the repository at this point in the history
removed prompt-benchamrks from dependencies
  • Loading branch information
ShiboSoftwareDev authored Feb 11, 2025
2 parents 3a5b672 + 59f57e9 commit 8f31594
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 370 deletions.
462 changes: 97 additions & 365 deletions bun.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ another project.

```tsx
import * as tscircuitCore from "@tscircuit/core"
import { getImportsFromCode } from "@tscircuit/prompt-benchmarks/code-runner-utils"
import { getImportsFromCode } from "lib/utils/get-imports-from-code"
import type { AnyCircuitElement } from "circuit-json"
import * as jscadFiber from "jscad-fiber"
import * as React from "react"
Expand Down
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { AnyCircuitElement } from "circuit-json"
import * as Comlink from "comlink"
export * from "./utils/index"
import type {
InternalWebWorkerApi,
WebWorkerConfiguration,
Expand Down
13 changes: 13 additions & 0 deletions lib/utils/get-imports-from-code.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const getImportsFromCode = (code: string): string[] => {
const importRegex =
/import\s+(?:(?:(?:\*\s+as\s+\w+)|(?:[\w\s,{}]+))\s+from\s+)?['"](.+?)['"]/g
const imports: string[] = []
let match: RegExpExecArray | null

// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
while ((match = importRegex.exec(code)) !== null) {
imports.push(match[1])
}

return imports
}
1 change: 1 addition & 0 deletions lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./get-imports-from-code"
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@biomejs/biome": "^1.9.4",
"@tscircuit/core": "^0.0.308",
"@tscircuit/math-utils": "^0.0.10",
"@tscircuit/prompt-benchmarks": "^0.0.37",
"@types/babel__standalone": "^7.1.9",
"@types/bun": "latest",
"@types/react": "^18.3.12",
Expand Down
1 change: 0 additions & 1 deletion webworker/import-eval-path.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getImportsFromCode } from "@tscircuit/prompt-benchmarks/code-runner-utils"
import { evalCompiledJs } from "./eval-compiled-js"
import type { ExecutionContext } from "./execution-context"
import * as Babel from "@babel/standalone"
Expand Down
2 changes: 1 addition & 1 deletion webworker/import-local-file.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getImportsFromCode } from "@tscircuit/prompt-benchmarks/code-runner-utils"
import type { ExecutionContext } from "./execution-context"
import { importEvalPath } from "./import-eval-path"
import * as Babel from "@babel/standalone"
import { evalCompiledJs } from "./eval-compiled-js"
import { getImportsFromCode } from "lib/utils/get-imports-from-code"

export const importLocalFile = async (
importName: string,
Expand Down
1 change: 0 additions & 1 deletion webworker/import-snippet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getImportsFromCode } from "@tscircuit/prompt-benchmarks/code-runner-utils"
import { evalCompiledJs } from "./eval-compiled-js"
import type { ExecutionContext } from "./execution-context"
import * as Babel from "@babel/standalone"
Expand Down

0 comments on commit 8f31594

Please sign in to comment.