Skip to content

Commit 0a2d8de

Browse files
Merge branch 'fix-package-module' into 4.0.0
2 parents ca522bc + 7ac35af commit 0a2d8de

File tree

10 files changed

+33
-38
lines changed

10 files changed

+33
-38
lines changed

dist/cep-promise-browser.js

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
return CepPromiseError;
277277
}( /*#__PURE__*/_wrapNativeSuper(Error));
278278

279-
function unfetch (e, n) {
279+
function fetch (e, n) {
280280
return n = n || {}, new Promise(function (t, r) {
281281
var s = new XMLHttpRequest(),
282282
o = [],
@@ -327,19 +327,6 @@
327327
});
328328
}
329329

330-
var unfetch$1 = /*#__PURE__*/Object.freeze({
331-
__proto__: null,
332-
'default': unfetch
333-
});
334-
335-
function getCjsExportFromNamespace (n) {
336-
return n && n['default'] || n;
337-
}
338-
339-
var require$$0 = getCjsExportFromNamespace(unfetch$1);
340-
341-
var browser = window.fetch || (window.fetch = require$$0["default"] || require$$0);
342-
343330
var ServiceError = /*#__PURE__*/function (_Error) {
344331
_inherits(ServiceError, _Error);
345332

@@ -375,7 +362,7 @@
375362
'cache-control': 'no-cache'
376363
}
377364
};
378-
return browser(url, options).then(analyzeAndParseResponse)["catch"](throwApplicationError);
365+
return fetch(url, options).then(analyzeAndParseResponse)["catch"](throwApplicationError);
379366
}
380367

381368
function analyzeAndParseResponse(response) {
@@ -457,7 +444,7 @@
457444
'content-type': 'application/json;charset=utf-8'
458445
}
459446
};
460-
return browser(url, options).then(analyzeAndParseResponse$1).then(checkForViaCepError).then(extractCepValuesFromResponse)["catch"](throwApplicationError$1);
447+
return fetch(url, options).then(analyzeAndParseResponse$1).then(checkForViaCepError).then(extractCepValuesFromResponse)["catch"](throwApplicationError$1);
461448
}
462449

463450
function analyzeAndParseResponse$1(response) {
@@ -510,7 +497,7 @@
510497
'content-type': 'application/json;charset=utf-8'
511498
}
512499
};
513-
return browser(url, options).then(analyzeAndParseResponse$2).then(checkForWideNetError).then(extractCepValuesFromResponse$1)["catch"](throwApplicationError$2);
500+
return fetch(url, options).then(analyzeAndParseResponse$2).then(checkForWideNetError).then(extractCepValuesFromResponse$1)["catch"](throwApplicationError$2);
514501
}
515502

516503
function analyzeAndParseResponse$2(response) {

dist/cep-promise-browser.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cep-promise.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function (global, factory) {
2-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('isomorphic-unfetch')) :
3-
typeof define === 'function' && define.amd ? define(['isomorphic-unfetch'], factory) :
2+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('node-fetch')) :
3+
typeof define === 'function' && define.amd ? define(['node-fetch'], factory) :
44
(global = global || self, global.cep = factory(global.fetch));
55
}(this, (function (fetch) { 'use strict';
66

dist/cep-promise.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

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

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "cep-promise",
3-
"version": "3.0.9",
3+
"version": "3.0.10",
44
"description": "Busca por CEP integrado diretamente aos serviços dos Correios e ViaCEP",
55
"main": "dist/cep-promise.min.js",
6-
"module": "dist/cep-promise-browser.min.js",
6+
"module": "dist/cep-promise.min.js",
77
"scripts": {
88
"dev": "nodemon --watch src/ --exec \"npm run build\"",
99
"test": "npm run coverage",
@@ -58,6 +58,7 @@
5858
"rollup-plugin-babel": "4.4.0",
5959
"rollup-plugin-commonjs": "10.1.0",
6060
"rollup-plugin-node-resolve": "5.2.0",
61+
"rollup-plugin-replace": "2.2.0",
6162
"standard": "14.3.4",
6263
"uglify-js": "3.10.0"
6364
},
@@ -70,7 +71,8 @@
7071
]
7172
},
7273
"dependencies": {
73-
"isomorphic-unfetch": "3.0.0"
74+
"node-fetch": "2.6.0",
75+
"unfetch": "4.1.0"
7476
},
7577
"files": [
7678
"dist",

rollup.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import babel from 'rollup-plugin-babel'
22
import commonjs from 'rollup-plugin-commonjs'
33
import resolve from 'rollup-plugin-node-resolve'
4+
import replace from 'rollup-plugin-replace'
45

56
const input = 'src/cep-promise.js'
67
const defaultPlugins = [
@@ -24,7 +25,11 @@ export default [
2425
},
2526
{
2627
input,
27-
plugins: [].concat(defaultPlugins, [
28+
plugins: [
29+
replace({
30+
'node-fetch': 'unfetch',
31+
})
32+
].concat(defaultPlugins, [
2833
resolve({
2934
browser: true
3035
}),

src/services/correios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
import fetch from 'isomorphic-unfetch'
3+
import fetch from 'node-fetch'
44
import ServiceError from '../errors/service.js'
55

66
export default function fetchCorreiosService (cepWithLeftPad, proxyURL = '') {

src/services/viacep.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
import fetch from 'isomorphic-unfetch'
3+
import fetch from 'node-fetch'
44
import ServiceError from '../errors/service.js'
55

66
export default function fetchViaCepService (cepWithLeftPad, proxyURL = '') {

src/services/widenet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
import fetch from 'isomorphic-unfetch'
3+
import fetch from 'node-fetch'
44
import ServiceError from '../errors/service.js'
55

66
export default function fetchWideNetService (cepWithLeftPad, proxyURL = '') {

0 commit comments

Comments
 (0)