Skip to content

Commit 7937fe9

Browse files
Refactor/remove all default exports (#205)
* Improve auto complete by removing duplicate code exports with default
1 parent a416017 commit 7937fe9

File tree

108 files changed

+150
-789
lines changed

Some content is hidden

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

108 files changed

+150
-789
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
This page references a list of annotated code examples<br/>
2+

__DOC_EXAMPLES__/annotatedExamples/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Import the cloudinary class, and the assets you want to use
66
// In this case, we import a TransformableImage type.
7-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
7+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
88

99
// Create your instance
1010
const cld = new Cloudinary({
@@ -25,7 +25,7 @@ cld.useImage(TransformableImage);
2525

2626
// Import the cloudinary class, and the assets you want to use
2727
// In this case, we import a TransformableImage type.
28-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
28+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
2929

3030
// Create your instance
3131
const cld = new Cloudinary({});
@@ -49,7 +49,7 @@ image.setConfig({
4949

5050
// Import the cloudinary class, and the assets you want to use
5151
// In this case, we import a TransformableImage type.
52-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
52+
import {TransformableImage, Cloudinary} from '@cloudinary/base';
5353

5454
// Create your instance
5555
const cld = new Cloudinary({

__DOC_EXAMPLES__/annotatedExamples/imageOverlay.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Import the cloudinary class, and the assets you want to use
44
// In this case, we import a TransformableImage type.
5-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
5+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
66

77
// Create your instance
88
const cld = new Cloudinary({
@@ -22,12 +22,12 @@ const myImage = cld.image('sample');
2222

2323
// An overlay is built from several parts
2424
// Import video or image overlay, based on your asset
25-
import Overlay from '@cloudinary/base/actions/overlay';
25+
import {Overlay} from "@cloudinary/base/actions/Actions";
2626
// Import the source of the layer, this determines if the layer is an image, text or video
27-
import {image} from "@cloudinary/base/values/sources";
27+
import {image} from "@cloudinary/base/values/sources/Sources";
2828

2929
// Import how to position your layer
30-
import Position from "@cloudinary/base/values/position";
30+
import * as Position from "@cloudinary/base/values/position/Position";
3131

3232
// We'll also resize our overlay, we'll need this for later.
3333
import Resize from "@cloudinary/base/actions/resize";

__DOC_EXAMPLES__/annotatedExamples/resize.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Import the cloudinary class, and the assets you want to use
44
// In this case, we import a TransformableImage type.
5-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
5+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
66

77
// Create your instance
88
const cld = new Cloudinary({
@@ -33,7 +33,8 @@ const myImage = cld.image('sample');
3333
// Lets give resize() a ResizeScale paramter to scale our image
3434
// We import all of our Action parameters from @cloudinary/base/actions/{actionGroup}
3535
// Note that you can import all Resize Actions, or just the single one you want
36-
import Resize, {scale} from '@cloudinary/base/actions/resize';
36+
import {Resize} from "@cloudinary/base/actions/Actions";
37+
const {scale} = Resize;
3738
// Resize.scale === scale
3839
// Explore the Resize object to discover more resize actions
3940

__DOC_EXAMPLES__/annotatedExamples/rotate.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```javascript
2-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
2+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
33

44
const cld = new Cloudinary({
55
cloud: {
@@ -14,18 +14,18 @@ const cld = new Cloudinary({
1414
cld.useImage(TransformableImage);
1515

1616
// Import the RotationModeAction
17-
import {mode} from '@cloudinary/base/actions/rotate';
17+
import {mode} from '@cloudinary/base/actions/rotate/Rotate';
1818

1919
// Remember, mode is a function that returns an Action
2020
// but we refer to both as a RotationMode action
2121

2222
// The RotationModeAction (mode) requires a Qualifier
2323
// That qualifier will require a certain QualifierValue
2424
// To make life easier, you can import all possible QualifierValue(s) of rotate
25-
import * as RotationMode from '@cloudinary/base/values/rotate';
25+
import * as RotationMode from '@cloudinary/base/values/rotate/Rotate';
2626

2727
// You can also import only the required QualifierValue you want
28-
import {verticalFlip} from '@cloudinary/base/values/rotate';
28+
import {verticalFlip} from '@cloudinary/base/values/rotate/Rotate';
2929
// RotationMode.verticalFlip === verticalFlip
3030

3131
const myImage = cld.image('sample');

__DOC_EXAMPLES__/gettingStarted/helloworld.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```javascript
66

7-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
7+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
88

99
// Create your instance
1010
const cld = new Cloudinary({
@@ -22,7 +22,7 @@
2222
// Create a new image
2323
const myImage = cld.image('sample');
2424

25-
import {scale} from '@cloudinary/base/actions/resize';
25+
import {scale} from '@cloudinary/base/actions/resize/Resize';
2626

2727
myImage.resize(
2828
scale()

__DOC_EXAMPLES__/gettingStarted/terminology.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
```javascript
77

8-
import Cloudinary, {TransformableImage} from '@cloudinary/base';
8+
import {Cloudinary, TransformableImage} from '@cloudinary/base';
99

1010
// Create your instance
1111
const cld = new Cloudinary({
@@ -21,9 +21,9 @@
2121

2222
const myImage = cld.image('sample');
2323

24-
import Resize from '@cloudinary/base/actions/resize';
25-
import Rotate from '@cloudinary/base/actions/rotate';
26-
import * as RotationMode from '@cloudinary/base/values/rotate';
24+
import Resize from '@cloudinary/base/actions/resize/Resize';
25+
import Rotate from '@cloudinary/base/actions/rotate/Rotate';
26+
import * as RotationMode from '@cloudinary/base/values/rotate/Rotate';
2727

2828
myImage
2929
.resize(

__DOC_EXAMPLES__/gettingStarted/treeShaking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ Everything can be very granularly imported to ensure you only import what you ne
1616
<h4>Without Tree-Shaking</h4>
1717

1818
```javascript
19-
import Resize from '@cloudinary/base/actions/resize';
19+
import {Resize} from '@cloudinary/base/actions';
2020
Resize.scale()
2121
Resize.crop()
2222
```
2323
<h4>With Tree-Shaking</h4>
2424

2525
```javascript
26-
import {scale, crop} from '@cloudinary/base/actions/resize';
26+
import {scale, crop} from '@cloudinary/base/actions/resize/Resize';
2727
scale()
2828
crop()
2929
```

__TESTS_BUNDLE_SIZE__/bundleSizeTestCases.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,36 @@ const bundleSizeTestCases:ITestCase[] = [
1818
sizeLimitInKB: 16,
1919
importsArray: [
2020
importFromBase('TransformableImage'),
21-
importFromDist('actions/resize')
21+
importFromDist('actions/resize/Resize')
2222
]
2323
},
2424
{
2525
name: 'Tests a transformable image with Resize and Adjust',
2626
sizeLimitInKB: 25,
2727
importsArray: [
2828
importFromBase('TransformableImage'),
29-
importFromDist('actions/resize'),
30-
importFromDist('actions/adjust')
29+
importFromDist('actions/resize/Resize'),
30+
importFromDist('actions/adjust/Adjust')
3131
]
3232
},
3333
{
3434
name: 'Tests a transformable image with Resize, Adjust and Border',
3535
sizeLimitInKB: 25,
3636
importsArray: [
3737
importFromBase('TransformableImage'),
38-
importFromDist('actions/resize'),
39-
importFromDist('actions/adjust'),
40-
importFromDist('actions/border')
38+
importFromDist('actions/resize/Resize'),
39+
importFromDist('actions/adjust/Adjust'),
40+
importFromDist('actions/border/Border')
4141
]
4242
},
4343
{
4444
name: 'Tests a transformable image with Resize, adjust and delivery',
4545
sizeLimitInKB: 30,
4646
importsArray: [
4747
importFromBase('TransformableImage'),
48-
importFromDist('actions/resize'),
49-
importFromDist('actions/adjust'),
50-
importFromDist('actions/delivery')
48+
importFromDist('actions/resize/Resize'),
49+
importFromDist('actions/adjust/Adjust'),
50+
importFromDist('actions/delivery/Delivery')
5151
]
5252
}
5353
];

__TESTS__/TestConstants/createEntryMockedFS.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,9 @@
11
const TEST_FILE_STRUCTURE = {
22
'package.json': '{"fieldA":"foobar"}',
33
dist: {
4-
types: {
5-
onlyTypes: {
6-
border: {
7-
'Border.d.ts' : '// Some content'
8-
}
9-
},
10-
actions: {
11-
border: {
12-
'Border.d.ts' : '// Some content'
13-
}
14-
},
15-
constants: {
16-
colors: {
17-
'Colors.d.ts' : '// Some content'
18-
}
19-
},
20-
deep: { // We'll show we can create even deeper entry points
21-
nested: {
22-
entryPoint1: {
23-
'EntryPoint1.d.ts': '// Some content'
24-
}
25-
}
26-
}
27-
},
284
bundles: {
295
umd: {
306
'package.json': '{}'
31-
},
32-
esm: {
33-
notAFolder: '// Some content',
34-
onlyESM: {
35-
border: {
36-
'Border.js' : '// Some content'
37-
}
38-
},
39-
wrongStructure: {
40-
border: {
41-
'thisIsNotRight.js' : '// Some content'
42-
}
43-
},
44-
actions: {
45-
notADir: '// Some content',
46-
border: {
47-
'Border.js' : '// Some content'
48-
}
49-
},
50-
constants: {
51-
notADir: '// Some content',
52-
colors: {
53-
'Colors.js' : '// Some content'
54-
}
55-
},
56-
deep: { // We'll show we can create even deeper entry points
57-
nested: {
58-
entryPoint1: {
59-
'EntryPoint1.js': '// Some content'
60-
}
61-
}
62-
}
637
}
648
}
659
}

0 commit comments

Comments
 (0)