Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ECMAScript Modules #156

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
'consistent-return': 'off',
'filenames/match-exported': 'error',
'import/default': 'error',
'import/extensions': ['warn', 'never'],
'import/extensions': ['warn', 'always'],
'import/first': 'off',
'import/named': 'error',
'import/newline-after-import': 'warn',
Expand Down
5 changes: 1 addition & 4 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
recursive: true
reporter: spec
require:
- ts-node/register
- source-map-support/register
inline-diffs: false
spec: test/**/*.ts
spec: dist/esm/test/**/*.js
4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

10 changes: 1 addition & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ arch:
- ppc64le
language: node_js
node_js:
- 16
- 15
- 14
- 13
- 12
- 18
script: "./coverage.sh"
jobs:
allow_failures:
# this specific combination is broken within Travis at present
- arch: ppc64le
node_js: 16
fast_finish: true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ Documentation is available at [ip-address.js.org](http://ip-address.js.org/).
### Examples

```js
var Address6 = require('ip-address').Address6;
import { Address6 } from 'ip-address';

var address = new Address6('2001:0:ce49:7601:e866:efff:62c3:fffe');
const address = new Address6('2001:0:ce49:7601:e866:efff:62c3:fffe');

var teredo = address.inspectTeredo();
const teredo = address.inspectTeredo();

teredo.client4; // '157.60.0.1'
```
Expand Down
8 changes: 4 additions & 4 deletions ip-address.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Address4 } from './lib/ipv4';
import { Address6 } from './lib/ipv6';
import { AddressError } from './lib/address-error';
import { Address4 } from './lib/ipv4.js';
import { Address6 } from './lib/ipv6.js';
import { AddressError } from './lib/address-error.js';

export { Address4 };
export { Address6 };
export { AddressError };

import * as helpers from './lib/v6/helpers';
import * as helpers from './lib/v6/helpers.js';

export const v6 = { helpers };
4 changes: 2 additions & 2 deletions lib/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address4 } from './ipv4';
import { Address6 } from './ipv6';
import { Address4 } from './ipv4.js';
import { Address6 } from './ipv6.js';

export interface ReverseFormOptions {
omitSuffix?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions lib/ipv4.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-param-reassign */

import * as common from './common';
import * as constants from './v4/constants';
import { AddressError } from './address-error';
import * as common from './common.js';
import * as constants from './v4/constants.js';
import { AddressError } from './address-error.js';
import { BigInteger } from 'jsbn';
import { sprintf } from 'sprintf-js';

Expand Down
15 changes: 7 additions & 8 deletions lib/ipv6.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* eslint-disable prefer-destructuring */
/* eslint-disable no-param-reassign */

import * as common from './common';
import * as constants4 from './v4/constants';
import * as constants6 from './v6/constants';
import * as helpers from './v6/helpers';
import { Address4 } from './ipv4';
import * as common from './common.js';
import * as constants4 from './v4/constants.js';
import * as constants6 from './v6/constants.js';
import * as helpers from './v6/helpers.js';
import { Address4 } from './ipv4.js';
import {
ADDRESS_BOUNDARY,
possibleElisions,
simpleRegularExpression,
} from './v6/regular-expressions';
import { AddressError } from './address-error';
} from './v6/regular-expressions.js';
import { AddressError } from './address-error.js';
import { BigInteger } from 'jsbn';
import { sprintf } from 'sprintf-js';

Expand Down Expand Up @@ -66,7 +66,6 @@ function unsignByte(b: number) {
return b & 0xff;
}


interface SixToFourProperties {
prefix: string;
gateway: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/v6/regular-expressions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as v6 from './constants';
import * as v6 from './constants.js';
import { sprintf } from 'sprintf-js';

export function groupPossibilities(possibilities: string[]): string {
Expand Down
Loading