Skip to content

Commit 2e1659d

Browse files
committed
Merge branch 'main' into 1.31-releases
2 parents 5a10693 + 7fba629 commit 2e1659d

File tree

65 files changed

+223
-117
lines changed

Some content is hidden

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

65 files changed

+223
-117
lines changed

configs/webpack-config-compass/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"types": "./dist/index.d.ts",
3434
"scripts": {
3535
"bootstrap": "npm run compile",
36-
"prepublishOnly": "npm run compile",
36+
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
3737
"compile": "tsc -p tsconfig.json",
3838
"postcompile": "gen-esm-wrapper . ./dist/.esm-wrapper.mjs",
3939
"eslint": "eslint",

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

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'fs';
2-
import type { WebpackPluginInstance } from 'webpack';
2+
import type { ResolveOptions, WebpackPluginInstance } from 'webpack';
33
import { merge } from 'webpack-merge';
44
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
55
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -31,10 +31,31 @@ import { sharedExternals } from './externals';
3131
import { WebpackPluginMulticompilerProgress } from './webpack-plugin-multicompiler-progress';
3232
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
3333

34-
const sharedResolveOptions = {
35-
mainFields: ['compass:module', 'compass:main', 'module', 'main'],
36-
exportsFields: ['compass:exports', 'exports'],
37-
extensions: ['.jsx', '.tsx', '.ts', '...'],
34+
const sharedResolveOptions = (
35+
target: ConfigArgs['target']
36+
): Pick<ResolveOptions, 'mainFields' | 'exportsFields' | 'extensions'> => {
37+
if (typeof target === 'string') {
38+
target = [target];
39+
}
40+
return {
41+
// This replicates webpack behavior with additional special `compass:` keys
42+
// taking priority over the default ones that webpack uses
43+
//
44+
// See https://webpack.js.org/configuration/resolve/#resolvemainfields
45+
mainFields:
46+
target?.includes('web') || target?.includes('webworker')
47+
? [
48+
'compass:browser',
49+
'compass:module',
50+
'compass:main',
51+
'browser',
52+
'module',
53+
'main',
54+
]
55+
: ['compass:module', 'compass:main', 'module', 'main'],
56+
exportsFields: ['compass:exports', 'exports'],
57+
extensions: ['.jsx', '.tsx', '.ts', '...'],
58+
};
3859
};
3960

4061
export function createElectronMainConfig(
@@ -69,7 +90,7 @@ export function createElectronMainConfig(
6990
resolve: {
7091
// To avoid resolving the `browser` field
7192
aliasFields: [],
72-
...sharedResolveOptions,
93+
...sharedResolveOptions(opts.target),
7394
},
7495
plugins: [new WebpackPluginMulticompilerProgress()],
7596
};
@@ -141,7 +162,7 @@ export function createElectronRendererConfig(
141162
resolve: {
142163
// To avoid resolving the `browser` field
143164
aliasFields: [],
144-
...sharedResolveOptions,
165+
...sharedResolveOptions(opts.target),
145166
},
146167
};
147168

@@ -254,7 +275,7 @@ export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
254275
...toCommonJsExternal(builtinModules),
255276
},
256277
resolve: {
257-
...sharedResolveOptions,
278+
...sharedResolveOptions(opts.target),
258279
},
259280
};
260281
}

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-aggregations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
".": "./src/index.js"
1515
},
1616
"scripts": {
17-
"prepublishOnly": "npm run compile",
17+
"prepublishOnly": "npm run compile && compass-scripts check-exports-exist",
1818
"compile": "npm run webpack -- --mode production",
1919
"prewebpack": "rimraf ./dist",
2020
"webpack": "webpack-compass",

packages/compass-aggregations/src/components/pipeline-builder-workspace/pipeline-builder-workspace.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class PipelineWorkspace extends PureComponent {
6868
onStageMoved = ({ oldIndex, newIndex }) => {
6969
if (oldIndex !== newIndex) {
7070
this.props.stageMoved(oldIndex, newIndex);
71-
this.props.runStage(0);
71+
this.props.runStage(0, true /* force execute */);
7272
}
7373
}
7474

packages/compass-aggregations/src/components/pipeline/modals/confirm-import-pipeline.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ConfirmImportPipeline extends PureComponent {
3131
onConfirm = () => {
3232
this.props.confirmNew();
3333
if (this.props.isAutoPreviewing) {
34-
this.props.runStage(0);
34+
this.props.runStage(0, true /* force execute */);
3535
}
3636
}
3737

packages/compass-aggregations/src/components/settings/settings.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Settings extends PureComponent {
6161
this.props.applySettings();
6262

6363
// Updated settings used to run all stages in the current pipeline.
64-
this.props.runStage(0);
64+
this.props.runStage(0, true /* force execute */);
6565

6666
// Hide the settings panel.
6767
this.props.toggleSettingsIsExpanded();

packages/compass-aggregations/src/components/stage-editor-toolbar/delete-stage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DeleteStage extends PureComponent {
2323
onStageDeleted = () => {
2424
this.props.stageDeleted(this.props.index);
2525
this.props.setIsModified(true);
26-
this.props.runStage(this.props.index);
26+
this.props.runStage(this.props.index, true /* force execute */);
2727
};
2828

2929
/**

packages/compass-aggregations/src/components/stage-editor-toolbar/toggle-stage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ToggleStage extends PureComponent {
2525
onStageToggled = () => {
2626
this.props.stageToggled(this.props.index);
2727
this.props.setIsModified(true);
28-
this.props.runStage(this.props.index);
28+
this.props.runStage(this.props.index, true /* force execute */);
2929
};
3030

3131
/**

packages/compass-aggregations/src/modules/auto-preview.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ export const toggleAutoPreview = (
2525
newVal: boolean
2626
): ThunkAction<void, RootState, void, AutoPreviewToggledAction> => {
2727
return (dispatch) => {
28+
dispatch({
29+
type: ActionTypes.AutoPreviewToggled,
30+
value: newVal
31+
});
32+
2833
if (
2934
newVal &&
3035
global?.process?.env?.COMPASS_SHOW_NEW_AGGREGATION_TOOLBAR === 'true'
3136
) {
32-
dispatch(runStage(0));
37+
dispatch(runStage(0, true /* force execute */));
3338
}
34-
dispatch({
35-
type: ActionTypes.AutoPreviewToggled,
36-
value: newVal
37-
});
3839
};
3940
};

0 commit comments

Comments
 (0)