Skip to content

Commit

Permalink
chore(export-to-language): reokace usage of vm module COMPASS-7312
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Oct 9, 2023
1 parent c27cf54 commit 8f60807
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 48 deletions.
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/compass-export-to-language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@
"@mongodb-js/compass-maybe-protect-connection-string": "^0.13.0",
"@mongodb-js/mongodb-redux-common": "*",
"bson-transpilers": "*",
"ejson-shell-parser": "^1.2.4",
"react": "^17.0.2"
},
"dependencies": {
"@mongodb-js/compass-components": "^1.15.0",
"@mongodb-js/compass-logging": "^1.2.1",
"@mongodb-js/compass-maybe-protect-connection-string": "^0.13.0",
"@mongodb-js/mongodb-redux-common": "^2.0.12",
"bson-transpilers": "^2.0.4"
"bson-transpilers": "^2.0.4",
"ejson-shell-parser": "^1.2.4"
},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "^1.0.9",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import parseShellBSON, { ParseMode } from 'ejson-shell-parser';

export function countAggregationStagesInString(source: string): number {
const parsed = parseShellBSON(source, { mode: ParseMode.Loose });
if (!Array.isArray(parsed)) {
throw new Error('Source expression is not an aggregation stage array');
}
return parsed.length;
}

0 comments on commit 8f60807

Please sign in to comment.