@ywfe/fe-tools 1.0.2-beta.5 → 1.0.2-beta.6
Sign up to get free protection for your applications and to get access to all the features.
- package/jest.config.js +12 -0
- package/package.json +19 -13
- package/rollup.config.js +72 -21
- package/tsconfig.json +17 -3
- package/tsconfig.type.json +7 -7
- package/userInputToJson.ts +2 -2
- package/lib/JSON2String.d.ts +0 -5
- package/lib/JSON2String.d.ts.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.d.ts.map +0 -1
- package/lib/request.d.ts +0 -10
- package/lib/request.d.ts.map +0 -1
- package/lib/userInputToJson.d.ts +0 -9
- package/lib/userInputToJson.d.ts.map +0 -1
- package/lib/ywfe-tools.esm.js +0 -8677
- package/lib/ywfe-tools.esm.js.map +0 -1
package/jest.config.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module.exports = {
|
2
|
+
preset: 'ts-jest',
|
3
|
+
testEnvironment: 'jsdom',
|
4
|
+
moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'],
|
5
|
+
rootDir: '.',
|
6
|
+
roots: ['<rootDir>/src/'],
|
7
|
+
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?|ts?)$',
|
8
|
+
transform: {
|
9
|
+
'^.+\\.(t|j)s$': 'ts-jest',
|
10
|
+
'^.+\\.(t|j)sx$': 'ts-jest',
|
11
|
+
},
|
12
|
+
};
|
package/package.json
CHANGED
@@ -1,26 +1,32 @@
|
|
1
1
|
{
|
2
|
+
"private": false,
|
2
3
|
"name": "@ywfe/fe-tools",
|
3
|
-
"version": "1.0.2-beta.
|
4
|
+
"version": "1.0.2-beta.6",
|
4
5
|
"description": "工具函数库",
|
5
6
|
"main": "lib/ywfe-tools.esm.js",
|
6
7
|
"module": "lib/ywfe-tools.esm.js",
|
7
8
|
"browser": "lib/ywfe-tools.umd.js",
|
8
9
|
"types": "lib/index.d.ts",
|
9
|
-
"type": "module",
|
10
10
|
"scripts": {
|
11
|
-
"build": "rollup -c",
|
12
|
-
"
|
11
|
+
"build": "NODE_ENV=production rollup -c",
|
12
|
+
"build:type": "tsc -p ./tsconfig.type.json",
|
13
|
+
"publish:npm": "npm publish --access public",
|
14
|
+
"test": "jest --coverage"
|
13
15
|
},
|
14
|
-
"
|
15
|
-
|
16
|
-
"
|
16
|
+
"repository": "ywfe",
|
17
|
+
"author": {
|
18
|
+
"name": "YWFE",
|
19
|
+
"email": "ywfe@ywwl.com",
|
20
|
+
"url": "http://ywfe.com"
|
17
21
|
},
|
22
|
+
"license": "MIT",
|
18
23
|
"dependencies": {
|
19
|
-
"@ywfe/utils": "^0.10.74"
|
24
|
+
"@ywfe/utils": "^0.10.74",
|
25
|
+
"crypto-js": "^4.0.0",
|
26
|
+
"ramda": "^0.27.1",
|
27
|
+
"strtok3": "^6.3.0",
|
28
|
+
"token-types": "^4.2.0",
|
29
|
+
"uuid": "^8.3.2"
|
20
30
|
},
|
21
|
-
"
|
22
|
-
"typescript": "^5.4.5"
|
23
|
-
},
|
24
|
-
"author": "",
|
25
|
-
"license": "ISC"
|
31
|
+
"gitHead": "795058c747c80a3a69f6904dccffb53c42acfcc7"
|
26
32
|
}
|
package/rollup.config.js
CHANGED
@@ -1,26 +1,77 @@
|
|
1
|
+
import nodeResolver from '@rollup/plugin-node-resolve';
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
3
|
+
import replace from '@rollup/plugin-replace';
|
4
|
+
import json from '@rollup/plugin-json';
|
5
|
+
import nodePolyfills from 'rollup-plugin-node-polyfills';
|
6
|
+
import clear from 'rollup-plugin-clear';
|
7
|
+
import progress from 'rollup-plugin-progress';
|
1
8
|
import typescript from '@rollup/plugin-typescript';
|
2
|
-
import commonjs from '@rollup/plugin-commonjs'
|
3
|
-
import resolve from '@rollup/plugin-node-resolve';
|
4
|
-
import babel from 'rollup-plugin-babel';
|
5
9
|
import { terser } from 'rollup-plugin-terser';
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
// import pkg from './package.json';
|
11
|
+
|
12
|
+
const isProd = process.env.NODE_ENV === 'production';
|
13
|
+
|
14
|
+
const formats = {
|
15
|
+
commonjs: {
|
16
|
+
format: 'cjs',
|
17
|
+
file: 'lib/ywfe-tools.esm.js',
|
18
|
+
sourcemap: true,
|
19
|
+
exports: 'named',
|
13
20
|
},
|
14
|
-
|
21
|
+
esm: {
|
22
|
+
format: 'esm',
|
23
|
+
file: 'lib/ywfe-tools.esm.js',
|
24
|
+
sourcemap: true,
|
25
|
+
exports: 'named',
|
26
|
+
},
|
27
|
+
umd: {
|
28
|
+
format: 'umd',
|
29
|
+
file: 'lib/ywfe-tools.umd.js',
|
30
|
+
name: 'YWTOOLS',
|
31
|
+
sourcemap: true,
|
32
|
+
exports: 'named',
|
33
|
+
globals: {
|
34
|
+
'react': 'React',
|
35
|
+
'react-dom': 'ReactDOM',
|
36
|
+
},
|
37
|
+
},
|
38
|
+
};
|
39
|
+
|
40
|
+
const config = {
|
41
|
+
input: './index.ts',
|
42
|
+
inlineDynamicImports: true,
|
43
|
+
output: [formats.esm, formats.commonjs],
|
44
|
+
external: ['react', 'react-dom'],
|
15
45
|
plugins: [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
babel({
|
22
|
-
exclude: 'node_modules/**', // 排除转换node_modules下的文件
|
46
|
+
clear({
|
47
|
+
targets: ['lib'],
|
48
|
+
}),
|
49
|
+
progress({
|
50
|
+
clearLine: false,
|
23
51
|
}),
|
24
|
-
|
25
|
-
|
26
|
-
}
|
52
|
+
replace({
|
53
|
+
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
|
54
|
+
}),
|
55
|
+
nodeResolver(),
|
56
|
+
commonjs(),
|
57
|
+
typescript(),
|
58
|
+
json(),
|
59
|
+
nodePolyfills(),
|
60
|
+
],
|
61
|
+
watch: {
|
62
|
+
include: 'src/**',
|
63
|
+
exclude: 'node_modules/**',
|
64
|
+
},
|
65
|
+
};
|
66
|
+
|
67
|
+
if (isProd) {
|
68
|
+
const file = formats.umd.file;
|
69
|
+
|
70
|
+
config.output.push({
|
71
|
+
...formats.umd,
|
72
|
+
file,
|
73
|
+
plugins: [terser()],
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
export default config;
|
package/tsconfig.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
-
"rootDir": "./",
|
3
|
+
"rootDir": "./src",
|
4
4
|
"outDir": "./lib",
|
5
5
|
/* Basic Options */
|
6
6
|
"target": "es2017",
|
@@ -33,6 +33,20 @@
|
|
33
33
|
"pretty": true,
|
34
34
|
"jsx": "react",
|
35
35
|
"allowJs": true,
|
36
|
-
"baseUrl": "./"
|
36
|
+
"baseUrl": "./",
|
37
|
+
"paths": {
|
38
|
+
"@/*": [
|
39
|
+
"src/*"
|
40
|
+
]
|
41
|
+
}
|
37
42
|
},
|
38
|
-
|
43
|
+
"include": [
|
44
|
+
"src/**/*.ts",
|
45
|
+
"**/*.spec.ts",
|
46
|
+
"src/_internal/jsMD5.js"
|
47
|
+
],
|
48
|
+
"exclude": [
|
49
|
+
"node_modules",
|
50
|
+
"src/**/*.js",
|
51
|
+
]
|
52
|
+
}
|
package/tsconfig.type.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
"extends": "./tsconfig",
|
3
|
+
"compilerOptions": {
|
4
|
+
"declaration": true,
|
5
|
+
"declarationDir": "./lib",
|
6
|
+
"emitDeclarationOnly": true
|
7
|
+
}
|
8
|
+
}
|
package/userInputToJson.ts
CHANGED
@@ -4,8 +4,8 @@ interface userInput {
|
|
4
4
|
rules?:string,
|
5
5
|
}
|
6
6
|
async function userInputToJson({input}:{input:userInput}){
|
7
|
-
const {userInput, rules} = input
|
8
|
-
console.log('cesh')
|
7
|
+
//const {userInput, rules} = input
|
8
|
+
console.log('cesh',input)
|
9
9
|
//@ts-ignore
|
10
10
|
const res = await feTools.request({
|
11
11
|
input:{
|
package/lib/JSON2String.d.ts
DELETED
package/lib/JSON2String.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"JSON2String.d.ts","sourceRoot":"","sources":["../JSON2String.ts"],"names":[],"mappings":"AAGA,iBAAS,WAAW,CAAC,EAAE,KAAK,EAAE;;CAAA,UAO7B;AAED,eAAe,WAAW,CAAA"}
|
package/lib/index.d.ts
DELETED
package/lib/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
package/lib/request.d.ts
DELETED
package/lib/request.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../request.ts"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,GAAG,EAAC,MAAM,CAAC;IACX,MAAM,CAAC,EAAC,MAAM,CAAC;IACf,MAAM,CAAC,EAAC,GAAG,CAAA;CACZ;AACD,iBAAe,OAAO,CAAC,EAAC,KAAK,EAAC,EAAC;IAAC,KAAK,EAAC,cAAc,CAAA;CAAC,gBAwCpD;AACD,eAAe,OAAO,CAAA"}
|
package/lib/userInputToJson.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"userInputToJson.d.ts","sourceRoot":"","sources":["../userInputToJson.ts"],"names":[],"mappings":"AACA,UAAU,SAAS;IACjB,SAAS,CAAC,EAAC,MAAM,CAAC;IAClB,KAAK,CAAC,EAAC,MAAM,CAAC;CACf;AACD,iBAAe,eAAe,CAAC,EAAC,KAAK,EAAC,EAAC;IAAC,KAAK,EAAC,SAAS,CAAA;CAAC,gBAWvD;AACD,eAAe,eAAe,CAAA"}
|