Skip to content

chore(NODE-4401): enable isolatedModules tsc compiler option #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2022

Conversation

thekorn
Copy link
Contributor

@thekorn thekorn commented Jul 10, 2022

Description

What is changing?

compiling js-bson with isolatedModules set to true

Is there new documentation needed for these changes?

no, as per https://www.typescriptlang.org/tsconfig#isolatedModules the behaviour of the code does not change

What is the motivation for this change?

I'm working on a feature complete port of js-bson for deno. Idea is to "compile" this library automatically for deno, into bson-deno

Current state of bson-deno can be reviewed here: https://github.com/thekorn/bson-deno
The "build" script is maintained in this repository: https://github.com/thekorn/deno-build-mongodb-native

The overall goal is to provide an up-to-date, feature complete version of the mongodb-native client library for deno

For tracking purposes I also created a jira ticket: https://jira.mongodb.org/browse/NODE-4401

Double check the following

  • Ran npm run lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@thekorn thekorn changed the title <type>(NODE-4401)<!>: Enable isolated modules feat(NODE-4401): Enable isolated modules tsc compiler option Jul 10, 2022
@nbbeeken nbbeeken self-requested a review July 12, 2022 18:37
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jul 12, 2022
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thekorn!

Thanks for the contribution, I'm looping the team in on the details but this looks good to me, thanks for posting this with all the details/ticketing.


diff -ur lib.main/bson.js lib/bson.js
--- lib.main/bson.js	2022-07-12 14:29:30.000000000 -0400
+++ lib/bson.js	2022-07-12 14:29:45.000000000 -0400
@@ -41,8 +41,6 @@
 Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return timestamp_1.Timestamp; } });
 var uuid_1 = require("./uuid");
 Object.defineProperty(exports, "UUID", { enumerable: true, get: function () { return uuid_1.UUID; } });
-var binary_2 = require("./binary");
-var code_2 = require("./code");
 var constants_1 = require("./constants");
 Object.defineProperty(exports, "BSON_BINARY_SUBTYPE_BYTE_ARRAY", { enumerable: true, get: function () { return constants_1.BSON_BINARY_SUBTYPE_BYTE_ARRAY; } });
 Object.defineProperty(exports, "BSON_BINARY_SUBTYPE_DEFAULT", { enumerable: true, get: function () { return constants_1.BSON_BINARY_SUBTYPE_DEFAULT; } });
@@ -78,21 +76,10 @@
 Object.defineProperty(exports, "BSON_INT32_MIN", { enumerable: true, get: function () { return constants_1.BSON_INT32_MIN; } });
 Object.defineProperty(exports, "BSON_INT64_MAX", { enumerable: true, get: function () { return constants_1.BSON_INT64_MAX; } });
 Object.defineProperty(exports, "BSON_INT64_MIN", { enumerable: true, get: function () { return constants_1.BSON_INT64_MIN; } });
-var db_ref_2 = require("./db_ref");
-var decimal128_2 = require("./decimal128");
-var double_2 = require("./double");
 var extended_json_2 = require("./extended_json");
 Object.defineProperty(exports, "EJSON", { enumerable: true, get: function () { return extended_json_2.EJSON; } });
-var int_32_2 = require("./int_32");
-var long_2 = require("./long");
-var max_key_2 = require("./max_key");
-var min_key_2 = require("./min_key");
-var objectid_2 = require("./objectid");
-var regexp_2 = require("./regexp");
-var symbol_2 = require("./symbol");
 var timestamp_2 = require("./timestamp");
 Object.defineProperty(exports, "LongWithoutOverridesClass", { enumerable: true, get: function () { return timestamp_2.LongWithoutOverridesClass; } });
-var uuid_2 = require("./uuid");
 var error_2 = require("./error");
 Object.defineProperty(exports, "BSONError", { enumerable: true, get: function () { return error_2.BSONError; } });
 Object.defineProperty(exports, "BSONTypeError", { enumerable: true, get: function () { return error_2.BSONTypeError; } });

For other reviewers convenience this is the change to the compiled JS, where these requires weren't being used. They were present because we didn't have the export type indicator on our type only exports, isolateModules requires this.

@nbbeeken nbbeeken added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Jul 12, 2022
@nbbeeken nbbeeken changed the title feat(NODE-4401): Enable isolated modules tsc compiler option chore(NODE-4401): enable isolatedModules tsc compiler option Jul 12, 2022
@nbbeeken nbbeeken merged commit 4d13309 into mongodb:main Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants