Skip to content

Commit 6fc87c2

Browse files
committed
bump: 2.1.7, reducing the size of the final bundle
1 parent 5a9653b commit 6fc87c2

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ jestTestFile.js
77
BackupCopia
88
.eslintrc.js
99
jest.config.js
10+
*.js
11+
*.mjs

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ Feel free to find bugs and report them to me. Your feedback is highly appreciate
1818
jsDelivr:
1919

2020
```bash
21-
https://cdn.jsdelivr.net/npm/[email protected].3/dist/bundle.min.js
21+
https://cdn.jsdelivr.net/npm/[email protected].7/dist/cjs/index.min.js
2222
```
2323

2424
```html
25-
<script src="https://cdn.jsdelivr.net/npm/[email protected].3/dist/bundle.min.js"></script>
25+
<script src="https://cdn.jsdelivr.net/npm/[email protected].7/dist/cjs/index.min.js"></script>
2626
```
2727

2828
unpkg:
2929

3030
```bash
31-
https://unpkg.com/[email protected].3/dist/bundle.js
31+
https://unpkg.com/[email protected].7/dist/cjs/index.js
3232
```
3333

3434
```html
35-
<script src="https://unpkg.com/[email protected].3/dist/bundle.js"></script>
35+
<script src="https://unpkg.com/[email protected].7/dist/cjs/index.js"></script>
3636
```
3737

3838
### Example of use with CDN
3939

4040
```html
41-
<script src="https://cdn.jsdelivr.net/npm/[email protected].3/dist/bundle.min.js"></script>
41+
<script src="https://cdn.jsdelivr.net/npm/[email protected].7/dist/cjs/index.min.js"></script>
4242
<script>
4343
const emailResult = isEmail("123456");
4444
const cpfResult = cpfIsValid("123456");

index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ import passwordStrengthTester from "./src/passwordStrengthTester";
2727
import validateSurname from "./src/validateSurname";
2828
import validateName from "./src/validateName";
2929
import validateTextarea from "./src/validateTextarea";
30-
import { ValidateFunctions, IsValidFunctions } from "./src/types";
3130
import isValidImage from "./src/isValidImage";
3231
import isValidAudio from "./src/isValidAudio";
3332
import isValidPdf from "./src/isValidPdf";
3433
import isValidVideo from "./src/isValidVideo";
3534
import isValidTxt from "./src/isValidTxt";
35+
import type { ValidateFunctions, IsValidFunctions } from "./src/types";
3636

3737
export {
3838
cpfIsValid,
@@ -64,11 +64,11 @@ export {
6464
validateName,
6565
validateSurname,
6666
validateTextarea,
67-
ValidateFunctions,
68-
IsValidFunctions,
6967
isValidImage,
7068
isValidAudio,
7169
isValidPdf,
7270
isValidVideo,
7371
isValidTxt,
7472
};
73+
74+
export type { ValidateFunctions, IsValidFunctions };

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "multiform-validator",
3-
"version": "2.1.6",
3+
"version": "2.1.7",
44
"description": "Javascript library made to validate, several form fields, such as: email, phone, password, cpf etc.",
5-
"main": "./dist/index.js",
5+
"main": "./dist/cjs/index.js",
6+
"module": "./dist/esm/index.js",
67
"types": "./types/index.d.ts",
7-
"unpkg": "./dist/bundle.js",
8+
"unpkg": "./dist/cjs/index.js",
89
"scripts": {
910
"test": "jest --coverage",
1011
"test:file": "jest tests/src/isDecimal.test --watch",

tsconfig.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
2626

2727
/* Modules */
28-
"module": "commonjs" /* Specify what module code is generated. */,
28+
"module": "NodeNext" /* Specify what module code is generated. */,
2929
// "rootDir": "./src", /* Specify the root folder within your source files. */
3030
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
3131
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
@@ -55,7 +55,7 @@
5555
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5656
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5757
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
58+
"outDir": "./dist/esm" /* Specify an output folder for all emitted files. */,
5959
"removeComments": true /* Disable emitting comments. */,
6060
// "noEmit": true, /* Disable emitting files from a compilation. */
6161
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -104,7 +104,8 @@
104104

105105
/* Completeness */
106106
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
107+
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
108+
"moduleResolution": "NodeNext"
108109
},
109110
"include": ["src/**/*", "index.ts", ".eslintrc.js"]
110111
}

webpack.config.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
const path = require("path");
22

3-
module.exports = {
3+
const commonjsWebpackConfig = {
44
mode: "production", // production mode
55
entry: "./index.ts", // entry point of your application
66
output: {
7-
filename: "bundle.js", // output file name
7+
filename: "cjs/index.js", // output file name
88
path: path.resolve(__dirname, "dist"), // output folder
99
libraryTarget: "umd", // this allows your module to be used via require() and as a global
1010
globalObject: "this", // this ensures that 'this' is 'window' in a browser environment
1111
},
1212
module: {
1313
rules: [
1414
{
15-
test: /\.tsx?$/,
15+
test: /\.ts?$/,
1616
use: "ts-loader",
1717
exclude: /node_modules/,
1818
},
@@ -21,4 +21,6 @@ module.exports = {
2121
resolve: {
2222
extensions: [".ts"],
2323
},
24-
};
24+
}
25+
26+
module.exports = [commonjsWebpackConfig]; // export the webpack config

0 commit comments

Comments
 (0)