Skip to content

Commit 1c016da

Browse files
authored
feat(bson-transpiler)!: bump bson and remove unused inputs (#5410)
* feat(bson-transpiler)!: remove unused inputs * delete commented code * chore: keep some of the js tests as shell * feat: align js with shell * chore: bump bson * revert number decimal
1 parent c7f8cff commit 1c016da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+6366
-34289
lines changed

Diff for: package-lock.json

+6-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/bson-transpilers/README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
[![downloads][5]][6]
44

55
Transpilers for building BSON documents in any language. Current support
6-
provided for `shell` `javascript` and `python` as inputs. `java`, `c#`, `node`, `shell`, `python`, `ruby` and `go` as outputs.
7-
8-
> ⚠️  `shell` output produces code that is compatible only with legacy `mongo` shell not the new `mongosh` shell. See [COMPASS-4930](https://jira.mongodb.org/browse/COMPASS-4930) for some additional context
6+
provided for `shell` as inputs. `java`, `c#`, `node`, `shell`, `python`, `ruby` and `go` as outputs.
97

108
See also the original presentation: https://drive.google.com/file/d/1jvwtR3k9oBUzIjL4z_VtpHvdWahfcjTK/view
119

10+
**NOTES:**
11+
1. A version of the code with support for `python` with corresponding test cases has been removed to avoid bundling and supporting unused code, however it can be still be found in https://github.com/mongodb-js/compass/tree/80cf701e44cd966207f956fac69e8233861b1cd5/packages/bson-transpilers.
12+
2. The `shell` output is disabled as is essentially the only input in use and it produces code that is compatible only with legacy `mongo` shell not the new `mongosh` shell. See [COMPASS-4930](https://jira.mongodb.org/browse/COMPASS-4930) for some additional context.
13+
1214
# Usage
1315

1416
```js
1517
const transpiler = require('bson-transpilers');
1618

17-
const input = 'javascript';
19+
const input = 'shell';
1820
const output = 'java';
1921

2022
const string =`

Diff for: packages/bson-transpilers/codegeneration/shell/Visitor.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ module.exports = (JavascriptVisitor) => class Visitor extends JavascriptVisitor
3232
ObjectId: bson.ObjectId,
3333
BSONSymbol: bson.BSONSymbol,
3434
Timestamp: bson.Timestamp,
35+
Decimal128: bson.Decimal128,
36+
Long: bson.Long,
37+
Int32: bson.Int32,
38+
Double: bson.Double,
3539
Code: function(c, s) {
3640
return new bson.Code(c, s);
3741
},
@@ -94,7 +98,6 @@ module.exports = (JavascriptVisitor) => class Visitor extends JavascriptVisitor
9498
} catch (error) {
9599
throw new BsonTranspilersRuntimeError(error.message);
96100
}
97-
98101
if ('emitNumberDecimal' in this) {
99102
return this.emitNumberDecimal(ctx, decstr);
100103
}

Diff for: packages/bson-transpilers/compile-symbol-table.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const loadSymbolTable = (dir, inputLang, outputLang) => {
5858

5959
const loadAll = () => {
6060
const dir = path.join(__dirname, 'lib', 'symbol-table');
61-
const inputLangs = ['javascript', 'shell', 'python'];
61+
const inputLangs = ['shell'];
6262
const outputLangs = ['java', 'shell', 'python', 'csharp', 'javascript', 'object', 'ruby', 'go', 'rust', 'php'];
6363
if (!fs.existsSync(dir)) {
6464
fs.mkdirSync(dir);

0 commit comments

Comments
 (0)