Commit 0005d22c authored by Nikolay Kuchumov's avatar Nikolay Kuchumov 💬
Browse files

Migrated to "ES Module" exports

parent 38662fa4
Pipeline #544808601 failed with stage
in 1 minute and 34 seconds
......@@ -5,9 +5,7 @@
],
"plugins": [
["@babel/plugin-transform-for-of", { loose: true }],
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties"
["@babel/plugin-transform-for-of", { loose: true }]
],
"env": {
......
image: node:10
image: node:12
pages:
script:
......
<!-- Maybe change the link to the flags to this repo's `unpkg.com` or something like that. -->
3.2.0 / 21.05.2022
==================
* Migrated to "ES Module" exports.
3.1.50 / 11.04.2022
==================
......
......@@ -686,6 +686,32 @@ To check whether a country code is supported, use [`isSupportedCountry()`](#issu
This library comes with TypeScript "typings". If you happen to find any bugs in those, create an issue.
## Tests
This component comes with 100% code coverage for the core `./source/helpers` directory.
To run tests:
```
npm test
```
To generate a code coverage report:
```
npm run test-coverage
```
The code coverage report can be viewed by opening `./coverage/lcov-report/index.html`.
The `handlebars@4.5.3` [work](https://github.com/handlebars-lang/handlebars.js/issues/1646#issuecomment-578306544)[around](https://github.com/facebook/jest/issues/9396#issuecomment-573328488) in `devDependencies` is for the test coverage to not produce empty reports:
```
Handlebars: Access has been denied to resolve the property "statements" because it is not an "own property" of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
```
## GitHub
On March 9th, 2020, GitHub, Inc. silently [banned](https://medium.com/@catamphetamine/how-github-blocked-me-and-all-my-libraries-c32c61f061d3) my account (erasing all my repos, issues and comments) without any notice or explanation. Because of that, all source codes had to be promptly moved to [GitLab](https://gitlab.com/catamphetamine/react-phone-number-input). GitHub repo is now deprecated, and the latest source codes can be found on GitLab, which is also the place to report any issues.
......
'use strict'
exports = module.exports = require('../commonjs/PhoneInputWithCountry').default
exports = module.exports = require('../commonjs/PhoneInputWithCountry.js').default
exports.formatPhoneNumber = require('../commonjs/libphonenumber/formatPhoneNumber').default
exports.formatPhoneNumberIntl = require('../commonjs/libphonenumber/formatPhoneNumber').formatPhoneNumberIntl
exports.formatPhoneNumber = require('../commonjs/libphonenumber/formatPhoneNumber.js').default
exports.formatPhoneNumberIntl = require('../commonjs/libphonenumber/formatPhoneNumber.js').formatPhoneNumberIntl
exports.parsePhoneNumber = require('libphonenumber-js/core').default
exports.isValidPhoneNumber = require('libphonenumber-js/core').isValidPhoneNumber
......@@ -12,4 +12,4 @@ exports.getCountries = require('libphonenumber-js/core').getCountries
exports.getCountryCallingCode = require('libphonenumber-js/core').getCountryCallingCode
exports.isSupportedCountry = require('libphonenumber-js/core').isSupportedCountry
exports['default'] = require('../commonjs/PhoneInputWithCountry').default
\ No newline at end of file
exports['default'] = require('../commonjs/PhoneInputWithCountry.js').default
\ No newline at end of file
'use strict'
// This file is deprecated.
// It's the same as `index.cjs`, just with an added `.js` file extension.
// It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
exports = module.exports = require('../commonjs/PhoneInputWithCountry.js').default
exports.formatPhoneNumber = require('../commonjs/libphonenumber/formatPhoneNumber.js').default
exports.formatPhoneNumberIntl = require('../commonjs/libphonenumber/formatPhoneNumber.js').formatPhoneNumberIntl
exports.parsePhoneNumber = require('libphonenumber-js/core').default
exports.isValidPhoneNumber = require('libphonenumber-js/core').isValidPhoneNumber
exports.isPossiblePhoneNumber = require('libphonenumber-js/core').isPossiblePhoneNumber
exports.getCountries = require('libphonenumber-js/core').getCountries
exports.getCountryCallingCode = require('libphonenumber-js/core').getCountryCallingCode
exports.isSupportedCountry = require('libphonenumber-js/core').isSupportedCountry
exports['default'] = require('../commonjs/PhoneInputWithCountry.js').default
\ No newline at end of file
export { default as default } from '../modules/PhoneInputWithCountry'
export { default as formatPhoneNumber, formatPhoneNumberIntl } from '../modules/libphonenumber/formatPhoneNumber'
export { default as default } from '../modules/PhoneInputWithCountry.js'
export { default as formatPhoneNumber, formatPhoneNumberIntl } from '../modules/libphonenumber/formatPhoneNumber.js'
export {
default as parsePhoneNumber,
......
{
"private": true,
"name": "react-phone-number-input-core",
"version": "1.0.0",
"main": "index.commonjs.js",
"name": "react-phone-number-input/core",
"main": "index.cjs",
"module": "index.js",
"sideEffects": [
"*.css"
]
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.cjs"
}
},
"sideEffects": false
}
// This file is deprecated.
// It's the same as `index.cjs`, just with an added `.js` file extension.
// It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
module.exports = require('country-flag-icons/react/3x2')
\ No newline at end of file
{
"private": true,
"name": "react-phone-number-input-flags",
"version": "1.0.0",
"main": "index.commonjs.js",
"name": "react-phone-number-input/flags",
"main": "index.cjs",
"module": "index.js",
"sideEffects": [
"*.css"
]
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.cjs"
}
},
"sideEffects": false
}
var Input = require('../commonjs/PhoneInputBrowser').default
var Input = require('../commonjs/PhoneInputBrowser.js').default
exports = module.exports = Input
exports['default'] = Input
exports.formatPhoneNumber = require('../commonjs/libphonenumber/formatPhoneNumber').default
exports.formatPhoneNumberIntl = require('../commonjs/libphonenumber/formatPhoneNumber').formatPhoneNumberIntl
exports.formatPhoneNumber = require('../commonjs/libphonenumber/formatPhoneNumber.js').default
exports.formatPhoneNumberIntl = require('../commonjs/libphonenumber/formatPhoneNumber.js').formatPhoneNumberIntl
exports.parsePhoneNumber = require('libphonenumber-js/core').default
exports.isValidPhoneNumber = require('libphonenumber-js/core').isValidPhoneNumber
......
// This file is deprecated.
// It's the same as `index.cjs`, just with an added `.js` file extension.
// It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
var Input = require('../commonjs/PhoneInputBrowser.js').default
exports = module.exports = Input
exports['default'] = Input
exports.formatPhoneNumber = require('../commonjs/libphonenumber/formatPhoneNumber.js').default
exports.formatPhoneNumberIntl = require('../commonjs/libphonenumber/formatPhoneNumber.js').formatPhoneNumberIntl
exports.parsePhoneNumber = require('libphonenumber-js/core').default
exports.isValidPhoneNumber = require('libphonenumber-js/core').isValidPhoneNumber
exports.isPossiblePhoneNumber = require('libphonenumber-js/core').isPossiblePhoneNumber
exports.getCountries = require('libphonenumber-js/core').getCountries
exports.getCountryCallingCode = require('libphonenumber-js/core').getCountryCallingCode
exports.isSupportedCountry = require('libphonenumber-js/core').isSupportedCountry
export { default as default } from '../modules/PhoneInputBrowser'
export { default as default } from '../modules/PhoneInputBrowser.js'
export {
default as parsePhoneNumber,
......@@ -9,4 +9,4 @@ export {
isSupportedCountry
} from 'libphonenumber-js/core'
export { default as formatPhoneNumber, formatPhoneNumberIntl } from '../modules/libphonenumber/formatPhoneNumber'
export { default as formatPhoneNumber, formatPhoneNumberIntl } from '../modules/libphonenumber/formatPhoneNumber.js'
{
"private": true,
"name": "react-phone-number-input-input-core",
"version": "1.0.0",
"main": "index.commonjs.js",
"name": "react-phone-number-input/input-core",
"main": "index.cjs",
"module": "index.js",
"sideEffects": [
"*.css"
]
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.cjs"
}
},
"sideEffects": false
}
'use strict'
var metadata = require('libphonenumber-js/metadata.full.json')
var core = require('../core/index.commonjs')
var createInput = require('../commonjs/PhoneInputBrowser').createInput
var metadata = require('libphonenumber-js/metadata.max.json')
var core = require('../core/index.cjs')
var createInput = require('../commonjs/PhoneInputBrowser.js').createInput
function call(func, _arguments) {
var args = Array.prototype.slice.call(_arguments)
......
'use strict'
// This file is deprecated.
// It's the same as `index.cjs`, just with an added `.js` file extension.
// It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
// https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
var metadata = require('libphonenumber-js/metadata.max.json')
var core = require('../core/index.cjs')
var createInput = require('../commonjs/PhoneInputBrowser.js').createInput
function call(func, _arguments) {
var args = Array.prototype.slice.call(_arguments)
args.push(metadata)
return func.apply(this, args)
}
var PhoneInput = createInput(metadata)
exports = module.exports = PhoneInput
exports.parsePhoneNumber = function parsePhoneNumber() {
return call(core.parsePhoneNumber, arguments)
}
exports.formatPhoneNumber = function formatPhoneNumber() {
return call(core.formatPhoneNumber, arguments)
}
exports.formatPhoneNumberIntl = function formatPhoneNumberIntl() {
return call(core.formatPhoneNumberIntl, arguments)
}
exports.isValidPhoneNumber = function isValidPhoneNumber() {
return call(core.isValidPhoneNumber, arguments)
}
exports.isPossiblePhoneNumber = function isPossiblePhoneNumber() {
return call(core.isPossiblePhoneNumber, arguments)
}
exports.getCountries = function getCountries() {
return call(core.getCountries, arguments)
}
exports.getCountryCallingCode = function getCountryCallingCode() {
return call(core.getCountryCallingCode, arguments)
}
exports.isSupportedCountry = function isSupportedCountry() {
return call(core.isSupportedCountry, arguments)
}
exports['default'] = PhoneInput
\ No newline at end of file
import metadata from 'libphonenumber-js/metadata.full.json'
import metadata from 'libphonenumber-js/metadata.max.json'
import {
parsePhoneNumber as _parsePhoneNumber,
......@@ -9,9 +9,9 @@ import {
getCountries as _getCountries,
getCountryCallingCode as _getCountryCallingCode,
isSupportedCountry as _isSupportedCountry
} from '../core/index'
} from '../core/index.js'
import { createInput } from '../modules/PhoneInputBrowser'
import { createInput } from '../modules/PhoneInputBrowser.js'
function call(func, _arguments) {
var args = Array.prototype.slice.call(_arguments)
......
{
"private": true,
"name": "react-phone-number-input-input-max",
"version": "1.0.0",
"main": "index.commonjs.js",
"name": "react-phone-number-input/input-max",
"main": "index.cjs",
"module": "index.js",
"sideEffects": [
"*.css"
]
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.cjs"
}
},
"sideEffects": false
}
'use strict'
var metadata = require('libphonenumber-js/metadata.mobile.json')
var core = require('../core/index.commonjs')
var createInput = require('../commonjs/PhoneInputBrowser').createInput
var core = require('../core/index.cjs')
var createInput = require('../commonjs/PhoneInputBrowser.js').createInput
function call(func, _arguments) {
var args = Array.prototype.slice.call(_arguments)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment