Skip to content

Commit 2998d86

Browse files
authored
Merge pull request #2909 from hapijs/chore/bump-address
chore: use latest address module
2 parents f8fab8c + 286dc6d commit 2998d86

37 files changed

Lines changed: 157 additions & 90 deletions

API.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,7 @@ Requires the string value to be a valid domain name.
27272727
- `options` - optional settings:
27282728
- `allowFullyQualified` - if `true`, domains ending with a `.` character are permitted. Defaults to `false`.
27292729
- `allowUnicode` - if `true`, Unicode characters are permitted. Defaults to `true`.
2730+
- `allowUnderscore` - if `true`, underscores (`_`) are allowed in the domain name. Defaults to `false`.
27302731
- `minDomainSegments` - number of segments required for the domain. Defaults to `2`.
27312732
- `maxDomainSegments` - maximum number of allowed domain segments. Default to no limit.
27322733
- `tlds` - options for TLD (top level domain) validation. By default, the TLD must be a valid
@@ -2754,6 +2755,7 @@ Requires the string value to be a valid email address.
27542755
- `options` - optional settings:
27552756
- `allowFullyQualified` - if `true`, domains ending with a `.` character are permitted. Defaults to `false`.
27562757
- `allowUnicode` - if `true`, Unicode characters are permitted. Defaults to `true`.
2758+
- `allowUnderscore` - if `true`, underscores (`_`) are allowed in the domain name. Defaults to `false`.
27572759
- `ignoreLength` - if `true`, ignore invalid email length errors. Defaults to `false`.
27582760
- `minDomainSegments` - number of segments required for the domain. The default setting excludes
27592761
single segment domains such as `example@io` which is a valid email but very uncommon. Defaults

benchmarks/bench.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const Fs = require('fs');
44

5-
const Assert = require('@hapi/hoek/lib/assert');
5+
const Assert = require('@hapi/hoek/assert');
66
const Benchmark = require('benchmark');
77
const Bossy = require('@hapi/bossy');
88
const Chalk = require('chalk');

browser/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77
"test": "karma start"
88
},
99
"devDependencies": {
10-
"@babel/core": "^7.4.5",
11-
"@babel/plugin-proposal-class-properties": "^7.7.4",
12-
"@babel/preset-env": "^7.4.5",
10+
"@babel/core": "^7.20.12",
11+
"@babel/plugin-proposal-class-properties": "^7.18.6",
12+
"@babel/preset-env": "^7.20.2",
13+
"@mixer/webpack-bundle-compare": "^0.1.1",
1314
"assert": "^2.0.0",
14-
"babel-loader": "^8.0.6",
15+
"babel-loader": "^9.1.2",
1516
"karma": "^4.2.0",
1617
"karma-chrome-launcher": "^3.0.0",
1718
"karma-mocha": "^1.3.0",
1819
"karma-sourcemap-loader": "^0.3.7",
1920
"karma-webpack": "^5.0.0",
2021
"mocha": "^6.2.0",
2122
"mocha-loader": "^2.0.1",
22-
"util": "^0.12.4",
23-
"webpack": "^5.40.0",
23+
"util": "^0.12.5",
24+
"webpack": "^5.75.0",
2425
"webpack-bundle-analyzer": "^3.4.1",
25-
"webpack-cli": "^4.7.2"
26+
"webpack-cli": "^4.10.0"
2627
}
2728
}

browser/tests/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ describe('Joi', () => {
77

88
it('should be able to create schemas', () => {
99

10-
Joi.string().min(5);
10+
Joi.boolean().truthy('true');
11+
Joi.number().min(5).max(10).multiple(2);
12+
Joi.array().items(Joi.number().required());
13+
Joi.object({
14+
key: Joi.string().required()
15+
});
1116
});
1217

1318
it('should be able to validate data', () => {
@@ -30,4 +35,12 @@ describe('Joi', () => {
3035
Assert.ok(schema.validate('test@example.com ').error);
3136
Assert.ok(!schema.validate('伊昭傑@郵件.商務').error);
3237
});
38+
39+
it('validates domain', () => {
40+
41+
const schema = Joi.string().domain().required();
42+
Assert.ok(!schema.validate('example.com').error);
43+
Assert.ok(schema.validate('example.com ').error);
44+
Assert.ok(!schema.validate('example.商務').error);
45+
});
3346
});

browser/webpack.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const Path = require('path');
44

55
const Webpack = require('webpack');
6+
const { BundleComparisonPlugin } = require('@mixer/webpack-bundle-compare');
67

78

89
module.exports = {
@@ -16,6 +17,11 @@ module.exports = {
1617
plugins: [
1718
new Webpack.DefinePlugin({
1819
Buffer: false
20+
}),
21+
new BundleComparisonPlugin({
22+
file: '../stats.msp.gz',
23+
format: 'msgpack',
24+
gzip: true,
1925
})
2026
],
2127
module: {
@@ -44,6 +50,10 @@ module.exports = {
4450
]
4551
}
4652
}
53+
},
54+
{
55+
test: /@(hapi|sideway)\//,
56+
sideEffects: false
4757
}
4858
]
4959
},
@@ -54,7 +64,8 @@ module.exports = {
5464
[Path.join(__dirname, '../lib/manifest.js')]: false,
5565
[Path.join(__dirname, '../lib/trace.js')]: false,
5666
[Path.join(__dirname, '../lib/types/binary.js')]: false,
57-
[Path.join(__dirname, '../node_modules/@sideway/address/lib/tlds.js')]: false,
67+
[Path.join(__dirname, '../node_modules/@hapi/tlds/esm/index.js')]: false,
68+
[Path.join(__dirname, '../node_modules/@hapi/address/esm/decode.js')]: false,
5869
},
5970
fallback: {
6071
url: false,

lib/annotate.js

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

3-
const Clone = require('@hapi/hoek/lib/clone');
3+
const Clone = require('@hapi/hoek/clone');
44

55
const Common = require('./common');
66

lib/base.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

3-
const Assert = require('@hapi/hoek/lib/assert');
4-
const Clone = require('@hapi/hoek/lib/clone');
5-
const DeepEqual = require('@hapi/hoek/lib/deepEqual');
6-
const Merge = require('@hapi/hoek/lib/merge');
3+
const Assert = require('@hapi/hoek/assert');
4+
const Clone = require('@hapi/hoek/clone');
5+
const DeepEqual = require('@hapi/hoek/deepEqual');
6+
const Merge = require('@hapi/hoek/merge');
77

88
const Cache = require('./cache');
99
const Common = require('./common');

lib/cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const Assert = require('@hapi/hoek/lib/assert');
4-
const Clone = require('@hapi/hoek/lib/clone');
3+
const Assert = require('@hapi/hoek/assert');
4+
const Clone = require('@hapi/hoek/clone');
55

66
const Common = require('./common');
77

lib/common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const Assert = require('@hapi/hoek/lib/assert');
4-
const AssertError = require('@hapi/hoek/lib/error');
3+
const Assert = require('@hapi/hoek/assert');
4+
const AssertError = require('@hapi/hoek/assertError');
55

66
const Pkg = require('../package.json');
77

lib/compile.js

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

3-
const Assert = require('@hapi/hoek/lib/assert');
3+
const Assert = require('@hapi/hoek/assert');
44

55
const Common = require('./common');
66
const Ref = require('./ref');

0 commit comments

Comments
 (0)