@cloudbase/oauth 2.5.49-beta.5 → 2.5.49-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/auth/apis.d.ts +2 -2
  2. package/dist/cjs/auth/apis.js +16 -6
  3. package/dist/cjs/auth/consts.d.ts +32 -3
  4. package/dist/cjs/auth/consts.js +32 -3
  5. package/dist/cjs/index.d.ts +4 -8
  6. package/dist/cjs/index.js +3 -17
  7. package/dist/cjs/oauth2client/consts.d.ts +1 -48
  8. package/dist/cjs/oauth2client/consts.js +4 -51
  9. package/dist/cjs/oauth2client/oauth2client.js +5 -7
  10. package/dist/cjs/utils/cloudbase-adapter-wx_mp.d.ts +1 -0
  11. package/dist/cjs/utils/cloudbase-adapter-wx_mp.js +40 -0
  12. package/dist/cjs/utils/encrypt.d.ts +1 -1
  13. package/dist/cjs/utils/encrypt.js +3 -3
  14. package/dist/cjs/utils/encryptlong/index.d.ts +537 -129
  15. package/dist/cjs/utils/encryptlong/index.js +2695 -2692
  16. package/dist/esm/auth/apis.d.ts +2 -2
  17. package/dist/esm/auth/apis.js +14 -4
  18. package/dist/esm/auth/consts.d.ts +32 -3
  19. package/dist/esm/auth/consts.js +31 -2
  20. package/dist/esm/index.d.ts +4 -8
  21. package/dist/esm/index.js +2 -6
  22. package/dist/esm/oauth2client/consts.d.ts +1 -48
  23. package/dist/esm/oauth2client/consts.js +1 -49
  24. package/dist/esm/oauth2client/oauth2client.js +3 -4
  25. package/dist/esm/utils/cloudbase-adapter-wx_mp.d.ts +1 -0
  26. package/dist/esm/utils/cloudbase-adapter-wx_mp.js +35 -0
  27. package/dist/esm/utils/encrypt.d.ts +1 -1
  28. package/dist/esm/utils/encrypt.js +1 -1
  29. package/dist/esm/utils/encryptlong/index.d.ts +537 -129
  30. package/dist/esm/utils/encryptlong/index.js +2639 -2636
  31. package/dist/miniprogram/index.js +1 -0
  32. package/package.json +11 -3
  33. package/src/auth/apis.ts +21 -6
  34. package/src/auth/consts.ts +31 -2
  35. package/src/index.ts +4 -22
  36. package/src/oauth2client/consts.ts +1 -51
  37. package/src/oauth2client/oauth2client.ts +2 -2
  38. package/src/utils/cloudbase-adapter-wx_mp.ts +42 -0
  39. package/src/utils/encrypt.ts +5 -5
  40. package/src/utils/encryptlong/index.js +3111 -3109
  41. package/tsconfig.json +0 -1
  42. package/webpack/web.prod.js +100 -0
  43. package/webpack/webpack.miniprogram.js +23 -0
  44. package/src/index.d.ts +0 -1
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "commonjs",
5
4
  "outDir": "dist/cjs",
6
5
  "rootDir": "src",
7
6
  "noImplicitAny": false,
@@ -0,0 +1,100 @@
1
+ const path = require('path')
2
+ const webpack = require('webpack')
3
+ const TerserPlugin = require('terser-webpack-plugin')
4
+ // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
5
+ module.exports = function (options) {
6
+ const { context, entry, output, mode, watch, externals, definePlugin = {}, optimization = {} } = options
7
+ const isDevelopment = mode !== 'production'
8
+ let plugins = [
9
+ new webpack.DefinePlugin(definePlugin),
10
+ // new BundleAnalyzerPlugin()
11
+ ].filter((item) => !!item)
12
+
13
+ const BABEL_LOADER = {
14
+ loader: 'babel-loader',
15
+ options: {
16
+ presets: [
17
+ [
18
+ '@babel/preset-env',
19
+ {
20
+ modules: false,
21
+ targets: {
22
+ esmodules: true,
23
+ },
24
+ },
25
+ ],
26
+ ],
27
+ },
28
+ }
29
+
30
+ return {
31
+ context,
32
+ entry,
33
+ mode,
34
+ watch,
35
+ watchOptions: {
36
+ ignored: [output.path],
37
+ },
38
+ output,
39
+ externals,
40
+ cache: {
41
+ type: 'memory',
42
+ },
43
+ devtool: false,
44
+ resolve: {
45
+ extensions: ['.ts', '.js', '.json'],
46
+ },
47
+ module: {
48
+ rules: [
49
+ {
50
+ test: /\.ts$/,
51
+ exclude: [/node_modules/],
52
+ use: [
53
+ BABEL_LOADER,
54
+ {
55
+ loader: require.resolve('ts-loader'),
56
+ options: {
57
+ configFile: path.resolve(context, './tsconfig.esm.json'),
58
+ },
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ test: /\.js$/,
64
+ exclude: [/node_modules/],
65
+ use: [BABEL_LOADER],
66
+ },
67
+ {
68
+ test: /package\.json$/,
69
+ loader: 'package-json-cleanup-loader',
70
+ options: {
71
+ only: ['version'],
72
+ },
73
+ },
74
+ ],
75
+ noParse: [/sjcl\.js$/],
76
+ },
77
+ plugins,
78
+ optimization: {
79
+ emitOnErrors: false,
80
+ removeEmptyChunks: true,
81
+ usedExports: true,
82
+ ...optimization,
83
+ ...(isDevelopment
84
+ ? {
85
+ minimize: false,
86
+ removeAvailableModules: false,
87
+ concatenateModules: true,
88
+ }
89
+ : {
90
+ minimizer: [
91
+ new TerserPlugin({
92
+ test: /\.js(\?.*)?$/i,
93
+ cache: false,
94
+ parallel: true,
95
+ }),
96
+ ],
97
+ }),
98
+ },
99
+ }
100
+ }
@@ -0,0 +1,23 @@
1
+ const path = require('path')
2
+
3
+ const params = {
4
+ context: path.resolve(__dirname, '../'),
5
+ mode: 'production',
6
+ watch: false,
7
+ entry: path.resolve(__dirname, '../src/index.ts'),
8
+ output: {
9
+ path: path.resolve(__dirname, '../dist/miniprogram'),
10
+ filename: 'index.js',
11
+ library: `tcboauth`,
12
+ libraryTarget: 'umd',
13
+ umdNamedDefine: true,
14
+ globalObject: 'typeof window !== "undefined"?window:this',
15
+ },
16
+ externals: {},
17
+ definePlugin: {
18
+ 'process.env.NODE_ENV': JSON.stringify('production'), // 注入环境变量,用于业务代码判断
19
+ 'globalThis.IS_MP_BUILD': true,
20
+ },
21
+ }
22
+
23
+ module.exports = require('./web.prod.js')(params)
package/src/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from '@cloudbase/oauth';