Skip to content

Commit

Permalink
Make the package a module type (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 4, 2021
1 parent 3038671 commit d976029
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 13 deletions.
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"import": "./index.js",
"require": "./umd.js"
},
"engines": {
"node": ">=10"
},
Expand Down Expand Up @@ -48,7 +53,7 @@
],
"devDependencies": {
"abort-controller": "^3.0.0",
"ava": "^3.2.0",
"ava": "^3.15.0",
"body": "^5.1.0",
"busboy": "^0.3.1",
"create-test-server": "2.1.1",
Expand All @@ -69,13 +74,21 @@
],
"globals": [
"globalThis"
]
],
"rules": {
"import/no-useless-path-segments": "off",
"unicorn/import-index": "off",
"import/extensions": "off"
}
},
"ava": {
"require": [
"esm",
"./test/_require"
]
],
"nonSemVerExperiments": {
"nextGenConfig": true
}
},
"tsd": {
"compilerOptions": {
Expand Down
5 changes: 3 additions & 2 deletions test/browser.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import util from 'util';
import body from 'body';
import {serial as test} from 'ava';
import ava from 'ava'; // eslint-disable-line ava/use-test
import createTestServer from 'create-test-server';
import Busboy from 'busboy';
import withPage from './helpers/with-page';
import withPage from './helpers/with-page.js';

const test = ava.serial;
const pBody = util.promisify(body);

test('prefixUrl option', withPage, async (t, page) => {
Expand Down
2 changes: 1 addition & 1 deletion test/fetch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import ky from '..';
import ky from '../index.js';

test.serial('relative URLs are passed to fetch unresolved', async t => {
const originalFetch = global.fetch;
Expand Down
2 changes: 1 addition & 1 deletion test/headers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import createTestServer from 'create-test-server';
import FormData from 'form-data';
import test from 'ava';
import ky from '..';
import ky from '../index.js';

const echoHeaders = (request, response) => {
request.resume();
Expand Down
2 changes: 1 addition & 1 deletion test/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import createTestServer from 'create-test-server';
import body from 'body';
import delay from 'delay';
import ky from '..';
import ky from '../index.js';

const pBody = util.promisify(body);

Expand Down
2 changes: 1 addition & 1 deletion test/http-error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';
import {Response} from 'node-fetch';
import ky from '..';
import ky from '../index.js';

function createFakeResponse({status, statusText}) {
// Start with a realistic fetch Response.
Expand Down
2 changes: 1 addition & 1 deletion test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import createTestServer from 'create-test-server';
import body from 'body';
import delay from 'delay';
import ky from '..';
import ky from '../index.js';

const pBody = util.promisify(body);
const fixture = 'fixture';
Expand Down
2 changes: 1 addition & 1 deletion test/methods.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';
import createTestServer from 'create-test-server';
import ky from '..';
import ky from '../index.js';

test('common method is normalized', async t => {
const server = await createTestServer();
Expand Down
2 changes: 1 addition & 1 deletion test/prefix-url.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';
import createTestServer from 'create-test-server';
import ky from '..';
import ky from '../index.js';

test('prefixUrl option', async t => {
const server = await createTestServer();
Expand Down
2 changes: 1 addition & 1 deletion test/retry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';
import createTestServer from 'create-test-server';
import ky from '..';
import ky from '../index.js';

const fixture = 'fixture';
const defaultRetryCount = 2;
Expand Down

0 comments on commit d976029

Please sign in to comment.