Skip to content

Commit 2eaa957

Browse files
committed
Merge branch 'main' into 1.36-releases
2 parents bda3ab0 + 8dc8ca1 commit 2eaa957

File tree

273 files changed

+19113
-51493
lines changed

Some content is hidden

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

273 files changed

+19113
-51493
lines changed

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **compass**.
2-
This document was automatically generated on Sun Mar 05 2023.
2+
This document was automatically generated on Tue Mar 21 2023.
33

44
## List of dependencies
55

configs/eslint-plugin-compass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@mongodb-js/prettier-config-compass": "^1.0.0",
4242
"depcheck": "^1.4.1",
4343
"eslint": "^7.25.0",
44-
"mocha": "^8.4.0",
44+
"mocha": "^10.2.0",
4545
"nyc": "^15.1.0",
4646
"prettier": "^2.7.1"
4747
}

configs/mocha-config-compass/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"chai-enzyme": "^1.0.0-beta.1",
3232
"enzyme": "^3.11.0",
3333
"global-jsdom": "^8.3.0",
34+
"jsdom": "^21.1.0",
3435
"identity-obj-proxy": "^3.0.0",
3536
"react-16-node-hanging-test-fix": "^1.0.0",
3637
"sinon-chai": "^3.7.0",

configs/mocha-config-compass/register/jsdom-global-register.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ if (!globalThis.IntersectionObserver) {
5555
// jsdom doesn't override classes that already exist in global scope
5656
// https://github.com/jsdom/jsdom/issues/3331
5757
globalThis.EventTarget = window.EventTarget;
58+
59+
Range.prototype.getClientRects = function () {
60+
return [];
61+
};

configs/mocha-config-compass/register/why-node-running.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require('why-is-node-running/include');
22
exports.mochaHooks = {
33
afterAll() {
4+
if (process.argv.includes('--watch')) {
5+
return;
6+
}
47
const timeout = setTimeout(() => {
58
console.log(
69
"if the process still running, run kill -SIGINFO %s to see what's keeping it",

configs/webpack-config-compass/src/loaders.ts

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,62 @@
1+
import browserslist from 'browserslist';
12
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
3+
import { execSync } from 'child_process';
4+
25
import type { ConfigArgs } from './args';
36
import { isServe } from './args';
7+
import chalk from 'chalk';
8+
9+
function isLatestBrowserslist() {
10+
// eslint-disable-next-line @typescript-eslint/no-var-requires
11+
const browserslistVersion = require('browserslist/package.json').version;
12+
const command = `npm view browserslist version --json`;
13+
const latestBrowserslistVersion = JSON.parse(
14+
execSync(command).toString().trim()
15+
);
16+
17+
return browserslistVersion === latestBrowserslistVersion;
18+
}
419

520
const electronVersion = (() => {
621
// eslint-disable-next-line @typescript-eslint/no-var-requires
722
const [maj, min] = require('electron/package.json').version.split(
823
'.'
924
) as string[];
25+
1026
return `${maj}.${min}`;
1127
})();
1228

29+
const browserslistElectronVersion = (() => {
30+
const installedElectronVersion = `electron ${electronVersion}`;
31+
try {
32+
// Occasionally it may happen that browserslist does not catch up with
33+
// Electron versions.
34+
35+
// If we discover that our version of Electron is not supported by browserslist
36+
// we first try to determine if a new version of browserslist is avaliable.
37+
//
38+
// If a new version of browserslist is available we throw an error and prompt to update
39+
// browserslist, otherwise we ignore the error and we use the last known electron version.
40+
browserslist(installedElectronVersion);
41+
return installedElectronVersion;
42+
} catch (e) {
43+
if (!isLatestBrowserslist()) {
44+
const errorMessage = `${(e as Error).message}.
45+
Please update browserslist in webpack-config-compass:
46+
npm i -S -w @mongodb-js/webpack-config-compass browserslist@latest`;
47+
throw new Error(chalk.red(errorMessage));
48+
}
49+
50+
return 'last 1 electron version';
51+
}
52+
})();
53+
1354
/**
14-
* "We support the latest two versions Chrome, Firefox and Safari."
15-
* @see {@link https://wiki.corp.mongodb.com/display/MMS/Browser+Support}
55+
* "Cloud Manager can be accessed on your computer through Chrome, Firefox, Safari and Edge. We no longer support IE."
56+
* @see {@link https://wiki.corp.mongodb.com/x/n5kVBQ}
1657
*/
1758
const cloudSupportedBrowserslistConfig =
18-
'last 2 Chrome versions, last 2 Safari versions, last 2 Firefox versions';
59+
'last 1 Chrome versions, last 1 Safari versions, last 1 Firefox versions, last 1 Edge versions';
1960

2061
export const javascriptLoader = (args: ConfigArgs, web = false) => ({
2162
test: /\.(mjs|c?jsx?|tsx?)$/,
@@ -36,7 +77,7 @@ export const javascriptLoader = (args: ConfigArgs, web = false) => ({
3677
{
3778
targets: web
3879
? cloudSupportedBrowserslistConfig
39-
: { electron: electronVersion },
80+
: browserslistElectronVersion,
4081
useBuiltIns: 'usage',
4182
corejs: { version: '3.12', proposals: true },
4283
},
@@ -110,7 +151,7 @@ export const cssLoader = (args: ConfigArgs, web = false) => ({
110151
{
111152
browsers: web
112153
? cloudSupportedBrowserslistConfig
113-
: `electron ${electronVersion}`,
154+
: browserslistElectronVersion,
114155
},
115156
],
116157
],

0 commit comments

Comments
 (0)