Skip to content

Commit cd4cb7a

Browse files
authored
OPTIMIZE build - native async/await (pubkey#4214)
* OPTIMIZE build * REMOVE more transpilation stuff * FIX build * FIX more stuff
1 parent 46edb32 commit cd4cb7a

File tree

4 files changed

+22
-30
lines changed

4 files changed

+22
-30
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030
- ADD typings to the query selector
3131
- CHANGE start replication via pure functions instead of RxCollection methods.
3232
- FIX replication does not provide a `._rev` to the storage write when a conflict is resolved.
33+
- CHANGE to reduce bundle size and improve performance, the following JavaScript features will no longer be transpiled:
34+
- [async/await](https://caniuse.com/async-functions)
35+
- [Arrow functions](https://caniuse.com/arrow-functions)
36+
- [for...of](https://caniuse.com/?search=for...of)
37+
- [shorthand properties](https://caniuse.com/mdn-javascript_operators_object_initializer_shorthand_property_names)
38+
- [Spread operator](https://caniuse.com/?search=spread%20operator)
39+
- [destructuring](https://caniuse.com/?search=destructuring)
40+
- [default parameters](https://caniuse.com/?search=default%20parameters)
41+
- [object spread](https://caniuse.com/?search=Object%20spread)
42+
3343

3444
<!-- /CHANGELOG NEWEST -->
3545

babel.config.js

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,17 @@ const plugins = [
55
'loose': true
66
}],
77
'@babel/transform-literals',
8-
'@babel/transform-function-name',
9-
'@babel/transform-arrow-functions',
108
'@babel/transform-block-scoped-functions',
119
['@babel/plugin-transform-classes', {
1210
'loose': true
1311
}],
14-
'@babel/transform-object-super',
15-
'@babel/transform-shorthand-properties',
16-
['@babel/transform-computed-properties', {
17-
'loose': true
18-
}],
19-
['@babel/transform-for-of', {
20-
'loose': true
21-
}],
2212
'@babel/transform-sticky-regex',
2313
'@babel/transform-unicode-regex',
24-
['@babel/transform-spread', {
25-
'loose': true
26-
}],
27-
'@babel/transform-parameters', ['@babel/transform-destructuring', {
28-
'loose': true
29-
}],
3014
'@babel/transform-block-scoping',
31-
'@babel/plugin-transform-member-expression-literals',
32-
'@babel/transform-property-literals',
33-
'@babel/transform-async-to-generator',
34-
'@babel/transform-regenerator',
3515
['@babel/transform-runtime', {
3616
'regenerator': true
3717
}],
38-
'@babel/proposal-class-properties',
39-
'@babel/proposal-object-rest-spread'
18+
'@babel/proposal-class-properties'
4019
];
4120

4221
let presets = [
@@ -58,11 +37,10 @@ if (process.env['NODE_ENV'] === 'es5') {
5837
{
5938
loose: true,
6039
targets: {
61-
edge: '17',
62-
firefox: '60',
63-
chrome: '67',
64-
safari: '11.1',
65-
ie: '11'
40+
edge: '107',
41+
firefox: '107',
42+
chrome: '108',
43+
safari: '16.2'
6644
},
6745
useBuiltIns: false
6846
}]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,4 +525,4 @@
525525
"webpack-dev-server": "4.11.1",
526526
"wrtc": "0.4.7"
527527
}
528-
}
528+
}

src/rx-query-helper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ export function normalizeMangoQuery<RxDocType>(
8888
* which has a bad performance in most cases.
8989
*/
9090
if (normalizedMangoQuery.index) {
91-
normalizedMangoQuery.sort = normalizedMangoQuery.index.map((field: string) => ({ [field as any]: 'asc' } as any));
91+
normalizedMangoQuery.sort = normalizedMangoQuery.index.map((field: string) => {
92+
return { [field as any]: 'asc' } as any;
93+
});
9294
} else {
9395
/**
9496
* Find the index that best matches the fields with the logical operators
@@ -122,7 +124,9 @@ export function normalizeMangoQuery<RxDocType>(
122124
}
123125
});
124126
if (currentBestIndexForSort) {
125-
normalizedMangoQuery.sort = currentBestIndexForSort.map((field: string) => ({ [field as any]: 'asc' } as any));
127+
normalizedMangoQuery.sort = currentBestIndexForSort.map((field: string) => {
128+
return { [field as any]: 'asc' } as any;
129+
});
126130
}
127131

128132
}

0 commit comments

Comments
 (0)