gio-miniprogram-sdk 4.0.0

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 (103) hide show
  1. package/.babelrc +4 -0
  2. package/.eslintignore +11 -0
  3. package/.eslintrc.js +120 -0
  4. package/.github/workflows/greetings.yml +13 -0
  5. package/.github/workflows/publish.yml +43 -0
  6. package/.prettierignore +19 -0
  7. package/.prettierrc.js +9 -0
  8. package/LICENSE +674 -0
  9. package/README.md +103 -0
  10. package/babel.config.js +6 -0
  11. package/bin/build/all.sh +38 -0
  12. package/bin/build/full.sh +32 -0
  13. package/bin/build/jd.sh +14 -0
  14. package/bin/build/ks.sh +14 -0
  15. package/bin/build/my.sh +14 -0
  16. package/bin/build/plugins.sh +5 -0
  17. package/bin/build/qq.sh +14 -0
  18. package/bin/build/quickapp.sh +14 -0
  19. package/bin/build/swan.sh +14 -0
  20. package/bin/build/taro.sh +18 -0
  21. package/bin/build/tb.sh +18 -0
  22. package/bin/build/tt.sh +14 -0
  23. package/bin/build/uniapp.sh +18 -0
  24. package/bin/build/wx.sh +14 -0
  25. package/dist/alipay.js +1 -0
  26. package/dist/baidu.js +1 -0
  27. package/dist/bytedance.js +1 -0
  28. package/dist/jingdong.js +1 -0
  29. package/dist/kuaishou.js +1 -0
  30. package/dist/plugins/gioABTest.js +1 -0
  31. package/dist/plugins/gioCompress.js +1 -0
  32. package/dist/plugins/gioEventAutoTracking.js +1 -0
  33. package/dist/plugins/gioImpressionTracking.js +1 -0
  34. package/dist/qq.js +1 -0
  35. package/dist/quickapp.js +1 -0
  36. package/dist/taobao.js +1 -0
  37. package/dist/taro.js +1 -0
  38. package/dist/uniapp.js +1 -0
  39. package/dist/wechat.js +1 -0
  40. package/package.json +144 -0
  41. package/rollup.config.js +92 -0
  42. package/rollup.plugins.config.js +76 -0
  43. package/src/constants/config.ts +136 -0
  44. package/src/constants/regex.ts +4 -0
  45. package/src/core/dataStore/eventContextBuilder.ts +70 -0
  46. package/src/core/dataStore/eventHooks/appEffects.ts +220 -0
  47. package/src/core/dataStore/eventHooks/index.ts +403 -0
  48. package/src/core/dataStore/eventHooks/minipPage.ts +132 -0
  49. package/src/core/dataStore/eventHooks/pageEffects.ts +168 -0
  50. package/src/core/dataStore/index.ts +543 -0
  51. package/src/core/growingIO.ts +433 -0
  52. package/src/core/plugins.ts +152 -0
  53. package/src/core/uploader.ts +219 -0
  54. package/src/core/userStore.ts +203 -0
  55. package/src/index.ts +68 -0
  56. package/src/minipInstance/base.ts +287 -0
  57. package/src/minipInstance/framework.ts +22 -0
  58. package/src/minipInstance/jd.ts +11 -0
  59. package/src/minipInstance/ks.ts +12 -0
  60. package/src/minipInstance/my.ts +53 -0
  61. package/src/minipInstance/qq.ts +12 -0
  62. package/src/minipInstance/quickapp.ts +230 -0
  63. package/src/minipInstance/swan.ts +20 -0
  64. package/src/minipInstance/tb.ts +53 -0
  65. package/src/minipInstance/tt.ts +12 -0
  66. package/src/minipInstance/wx.ts +12 -0
  67. package/src/platformConfig/base.ts +86 -0
  68. package/src/platformConfig/framework.ts +29 -0
  69. package/src/platformConfig/jd.ts +11 -0
  70. package/src/platformConfig/ks.ts +11 -0
  71. package/src/platformConfig/my.ts +15 -0
  72. package/src/platformConfig/qq.ts +13 -0
  73. package/src/platformConfig/quickapp.ts +48 -0
  74. package/src/platformConfig/swan.ts +11 -0
  75. package/src/platformConfig/tb.ts +29 -0
  76. package/src/platformConfig/tt.ts +11 -0
  77. package/src/platformConfig/wx.ts +20 -0
  78. package/src/pluginsOut/README.md +50 -0
  79. package/src/pluginsOut/frameworks/gioTaobaoAdapter.ts +195 -0
  80. package/src/pluginsOut/frameworks/gioTaroAdapter.ts +358 -0
  81. package/src/pluginsOut/frameworks/gioUniAppAdapter.ts +220 -0
  82. package/src/pluginsOut/ordinary/gioABTest.ts +254 -0
  83. package/src/pluginsOut/ordinary/gioCompress.ts +251 -0
  84. package/src/pluginsOut/ordinary/gioCustomTracking.ts +71 -0
  85. package/src/pluginsOut/ordinary/gioEventAutoTracking.ts +164 -0
  86. package/src/pluginsOut/ordinary/gioImpressionTracking.ts +298 -0
  87. package/src/types/base.ts +150 -0
  88. package/src/types/dataStore.ts +43 -0
  89. package/src/types/eventHooks.ts +141 -0
  90. package/src/types/gioCustomTracking.ts +9 -0
  91. package/src/types/gioEventTracking.ts +10 -0
  92. package/src/types/gioPerformance.ts +8 -0
  93. package/src/types/growingIO.ts +102 -0
  94. package/src/types/minipInstance.ts +126 -0
  95. package/src/types/platforms.ts +65 -0
  96. package/src/types/plugins.ts +24 -0
  97. package/src/types/uploader.ts +26 -0
  98. package/src/types/userStore.ts +22 -0
  99. package/src/utils/glodash.ts +423 -0
  100. package/src/utils/tools.ts +384 -0
  101. package/src/utils/verifiers.ts +76 -0
  102. package/tsconfig.json +32 -0
  103. package/typings/global.d.ts +92 -0
package/.babelrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ // "presets": ["@babel/preset-env"],
3
+ "plugins": ["babel-plugin-bulk-import"]
4
+ }
package/.eslintignore ADDED
@@ -0,0 +1,11 @@
1
+ /**/lzString.js
2
+ /test/**/utils
3
+ /dist
4
+ /**/dist
5
+ /typings
6
+ /node_modules
7
+ /test/autotest/dist
8
+ /test/wx-demo/dist
9
+ /test/**/*.json
10
+ /tsconfig.json
11
+ /demos/**
package/.eslintrc.js ADDED
@@ -0,0 +1,120 @@
1
+ module.exports = {
2
+ env: { browser: true, node: true, commonjs: true, es6: true },
3
+ extends: [
4
+ 'eslint:recommended',
5
+ 'plugin:@typescript-eslint/recommended',
6
+ 'plugin:prettier/recommended'
7
+ ],
8
+ globals: {
9
+ __proto__: true,
10
+ __wxConfig: true,
11
+ $global: true,
12
+ App: true,
13
+ Atomics: 'readonly',
14
+ Behavior: true,
15
+ Component: true,
16
+ global: true,
17
+ my: true,
18
+ Page: true,
19
+ platformConfig: true,
20
+ qq: true,
21
+ quickapp: true,
22
+ SharedArrayBuffer: 'readonly',
23
+ swan: true,
24
+ tt: true,
25
+ wx: true
26
+ },
27
+ parser: '@typescript-eslint/parser',
28
+ parserOptions: { ecmaVersion: 2018, sourceType: 'module' },
29
+ plugins: ['prettier'],
30
+ rules: {
31
+ '@typescript-eslint/adjacent-overload-signatures': 'off',
32
+ '@typescript-eslint/ban-ts-comment': 'off',
33
+ '@typescript-eslint/ban-types': 'off',
34
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
35
+ '@typescript-eslint/no-empty-function': 'warn',
36
+ '@typescript-eslint/no-explicit-any': 'off',
37
+ '@typescript-eslint/no-this-alias': 'off',
38
+ '@typescript-eslint/no-var-requires': 'off',
39
+ 'comma-dangle': ['error', 'never'],
40
+ 'default-case': ['warn', { commentPattern: '^no default$' }], //要求 Switch 语句中有 Default
41
+ 'dot-location': ['warn', 'property'], // 强制在点号之前或之后换行
42
+ 'import/no-unresolved': 'off',
43
+ 'init-declarations': 0, //声明时必须赋初值
44
+ 'new-parens': 'warn', //要求调用无参构造函数时带括号
45
+ 'no-alert': 0, //禁止使用alert confirm prompt
46
+ 'no-caller': 'error', // 禁用 caller 或 callee
47
+ 'no-case-declarations': 'off',
48
+ 'no-const-assign': 'error', //不允许改变用 const 声明的变量
49
+ 'no-constant-condition': 'warn',
50
+ 'no-control-regex': 'warn',
51
+ 'no-dupe-args': 'error', //禁止在 function 定义中出现重复的参数
52
+ 'no-dupe-class-members': 'error', //不允许类成员中有重复的名称
53
+ 'no-dupe-keys': 'warn', //禁止在对象字面量中出现重复的键
54
+ 'no-duplicate-case': 2, //switch中的case标签不能重复
55
+ 'no-empty': 'warn',
56
+ 'no-eq-null': 2, //禁止对null使用==或!=运算符
57
+ 'no-extra-bind': 'warn', //禁止不必要的函数绑定
58
+ 'no-fallthrough': 'off',
59
+ 'no-func-assign': 'warn', //禁止对 function 声明重新赋值
60
+ 'no-global-assign': 'warn',
61
+ 'no-implied-eval': 'error', //禁用隐式的 eval()
62
+ 'no-inner-declarations': [2, 'functions'], //禁止在块语句中使用声明(变量或函数)
63
+ 'no-iterator': 2, //禁止使用__iterator__ 属性
64
+ 'no-label-var': 'error', //禁用与变量同名的标签
65
+ 'no-loop-func': 'error', //禁止循环中存在函数
66
+ 'no-misleading-character-class': 'off',
67
+ 'no-mixed-operators': [
68
+ 'warn',
69
+ {
70
+ groups: [
71
+ ['&', '|', '^', '~', '<<', '>>', '>>>'],
72
+ ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
73
+ ['&&', '||'],
74
+ ['in', 'instanceof']
75
+ ],
76
+ allowSamePrecedence: false
77
+ }
78
+ ], //禁止混合使用不同的操作符
79
+ 'no-multi-str': 'warn', //禁止多行字符串 (需要多行时用\n)
80
+ 'no-native-reassign': 'warn', //禁止重新分配本地对象
81
+ 'no-negated-in-lhs': 2, //in 操作符的左边不能有!
82
+ 'no-obj-calls': 'warn', //禁止将全局对象当作函数进行调用
83
+ 'no-octal-escape': 2, //禁止使用八进制转义序列
84
+ 'no-plusplus': 0, //禁止使用++,--
85
+ 'no-prototype-builtins': 'off',
86
+ 'no-redeclare': 'error', //禁止重新声明变量
87
+ 'no-script-url': 'warn', //禁用 Script URL
88
+ 'no-self-compare': 2, //不能比较自身
89
+ 'no-shadow-restricted-names': 'warn', //关键字不能被遮蔽
90
+ 'no-sparse-arrays': 'warn', //禁用稀疏数组
91
+ 'no-this-before-super': 'warn', //在构造函数中禁止在调用 super()之前使用 this 或 super
92
+ 'no-undef-init': 2, //变量初始化时不能直接给它赋值为undefined
93
+ 'no-undef': 'off',
94
+ 'no-unexpected-multiline': 'warn', //禁止使用令人困惑的多行表达式
95
+ 'no-unused-expressions': 2, //禁止无用的表达式
96
+ 'no-unused-vars': 'off',
97
+ 'no-useless-call': 2, //禁止不必要的call和apply
98
+ 'no-useless-escape': 'warn',
99
+ 'no-use-before-define': [
100
+ 'warn',
101
+ {
102
+ functions: false,
103
+ classes: false,
104
+ variables: false
105
+ }
106
+ ], //禁止定义前使用
107
+ 'no-with': 'error', //禁用 with 语句
108
+ 'prefer-const': 0, //首选const
109
+ 'prefer-rest-params': 'off',
110
+ 'prefer-spread': 'off',
111
+ 'prettier/prettier': ['off'],
112
+ 'rest-spread-spacing': ['warn', 'never'], //强制限制扩展运算符及其表达式之间的空格
113
+ 'use-isnan': 2, //禁止比较时使用NaN,只能用isNaN()
114
+ 'vars-on-top': 2, //var必须放在作用域顶部
115
+ camelcase: 'off',
116
+ eqeqeq: 'error',
117
+ quotes: ['error', 'single'],
118
+ radix: 'error' //禁用函数内没有 yield 的 generator 函数
119
+ }
120
+ };
@@ -0,0 +1,13 @@
1
+ name: Greetings
2
+
3
+ on: [issues]
4
+
5
+ jobs:
6
+ greeting:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: Say Hello
10
+ uses: actions/first-interaction@v1
11
+ with:
12
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
13
+ issue-message: 'Hey, thank you for opening your first Issue ! 🙂'
@@ -0,0 +1,43 @@
1
+ # 监听创建tag的事件,tag必须是CDP/Saas-vXXX的格式
2
+ # 会自动进行发版到npm,同时创建一个release包
3
+
4
+ name: Publish And Release
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ - v*
10
+
11
+ jobs:
12
+ publish:
13
+ name: Auto Publish npm
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+ - uses: actions/setup-node@v2
18
+ with:
19
+ node-version: 12
20
+ registry-url: https://registry.npmjs.org/
21
+ - name: Publish
22
+ run: yarn publish --non-interactive --access public
23
+ env:
24
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
25
+ release:
26
+ name: Auto Create Release
27
+ runs-on: ubuntu-latest
28
+ needs: publish
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - uses: actions/setup-node@v2
32
+ with:
33
+ node-version: 12
34
+ registry-url: https://registry.npmjs.org/
35
+ - name: Create Release
36
+ uses: actions/create-release@v1
37
+ env:
38
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39
+ with:
40
+ tag_name: ${{ github.ref }}
41
+ release_name: Release ${{ github.ref }}
42
+ draft: false
43
+ prerelease: false
@@ -0,0 +1,19 @@
1
+ # dependencies
2
+ /node_modules
3
+ /**/lz-string.js
4
+ /typings
5
+
6
+ # editor
7
+ .idea
8
+ .vscode
9
+
10
+ # production
11
+ /build
12
+ /dist
13
+ /test/**/utils
14
+ /test/**/dist
15
+
16
+ # misc
17
+ .DS_Store
18
+
19
+ # logs
package/.prettierrc.js ADDED
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ arrowParens: "always",
3
+ endOfLine: "auto",
4
+ printWidth: 80,
5
+ semi: true,
6
+ singleQuote: true,
7
+ tabWidth: 2,
8
+ trailingComma: "none",
9
+ };