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.
- package/.babelrc +4 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +120 -0
- package/.github/workflows/greetings.yml +13 -0
- package/.github/workflows/publish.yml +43 -0
- package/.prettierignore +19 -0
- package/.prettierrc.js +9 -0
- package/LICENSE +674 -0
- package/README.md +103 -0
- package/babel.config.js +6 -0
- package/bin/build/all.sh +38 -0
- package/bin/build/full.sh +32 -0
- package/bin/build/jd.sh +14 -0
- package/bin/build/ks.sh +14 -0
- package/bin/build/my.sh +14 -0
- package/bin/build/plugins.sh +5 -0
- package/bin/build/qq.sh +14 -0
- package/bin/build/quickapp.sh +14 -0
- package/bin/build/swan.sh +14 -0
- package/bin/build/taro.sh +18 -0
- package/bin/build/tb.sh +18 -0
- package/bin/build/tt.sh +14 -0
- package/bin/build/uniapp.sh +18 -0
- package/bin/build/wx.sh +14 -0
- package/dist/alipay.js +1 -0
- package/dist/baidu.js +1 -0
- package/dist/bytedance.js +1 -0
- package/dist/jingdong.js +1 -0
- package/dist/kuaishou.js +1 -0
- package/dist/plugins/gioABTest.js +1 -0
- package/dist/plugins/gioCompress.js +1 -0
- package/dist/plugins/gioEventAutoTracking.js +1 -0
- package/dist/plugins/gioImpressionTracking.js +1 -0
- package/dist/qq.js +1 -0
- package/dist/quickapp.js +1 -0
- package/dist/taobao.js +1 -0
- package/dist/taro.js +1 -0
- package/dist/uniapp.js +1 -0
- package/dist/wechat.js +1 -0
- package/package.json +144 -0
- package/rollup.config.js +92 -0
- package/rollup.plugins.config.js +76 -0
- package/src/constants/config.ts +136 -0
- package/src/constants/regex.ts +4 -0
- package/src/core/dataStore/eventContextBuilder.ts +70 -0
- package/src/core/dataStore/eventHooks/appEffects.ts +220 -0
- package/src/core/dataStore/eventHooks/index.ts +403 -0
- package/src/core/dataStore/eventHooks/minipPage.ts +132 -0
- package/src/core/dataStore/eventHooks/pageEffects.ts +168 -0
- package/src/core/dataStore/index.ts +543 -0
- package/src/core/growingIO.ts +433 -0
- package/src/core/plugins.ts +152 -0
- package/src/core/uploader.ts +219 -0
- package/src/core/userStore.ts +203 -0
- package/src/index.ts +68 -0
- package/src/minipInstance/base.ts +287 -0
- package/src/minipInstance/framework.ts +22 -0
- package/src/minipInstance/jd.ts +11 -0
- package/src/minipInstance/ks.ts +12 -0
- package/src/minipInstance/my.ts +53 -0
- package/src/minipInstance/qq.ts +12 -0
- package/src/minipInstance/quickapp.ts +230 -0
- package/src/minipInstance/swan.ts +20 -0
- package/src/minipInstance/tb.ts +53 -0
- package/src/minipInstance/tt.ts +12 -0
- package/src/minipInstance/wx.ts +12 -0
- package/src/platformConfig/base.ts +86 -0
- package/src/platformConfig/framework.ts +29 -0
- package/src/platformConfig/jd.ts +11 -0
- package/src/platformConfig/ks.ts +11 -0
- package/src/platformConfig/my.ts +15 -0
- package/src/platformConfig/qq.ts +13 -0
- package/src/platformConfig/quickapp.ts +48 -0
- package/src/platformConfig/swan.ts +11 -0
- package/src/platformConfig/tb.ts +29 -0
- package/src/platformConfig/tt.ts +11 -0
- package/src/platformConfig/wx.ts +20 -0
- package/src/pluginsOut/README.md +50 -0
- package/src/pluginsOut/frameworks/gioTaobaoAdapter.ts +195 -0
- package/src/pluginsOut/frameworks/gioTaroAdapter.ts +358 -0
- package/src/pluginsOut/frameworks/gioUniAppAdapter.ts +220 -0
- package/src/pluginsOut/ordinary/gioABTest.ts +254 -0
- package/src/pluginsOut/ordinary/gioCompress.ts +251 -0
- package/src/pluginsOut/ordinary/gioCustomTracking.ts +71 -0
- package/src/pluginsOut/ordinary/gioEventAutoTracking.ts +164 -0
- package/src/pluginsOut/ordinary/gioImpressionTracking.ts +298 -0
- package/src/types/base.ts +150 -0
- package/src/types/dataStore.ts +43 -0
- package/src/types/eventHooks.ts +141 -0
- package/src/types/gioCustomTracking.ts +9 -0
- package/src/types/gioEventTracking.ts +10 -0
- package/src/types/gioPerformance.ts +8 -0
- package/src/types/growingIO.ts +102 -0
- package/src/types/minipInstance.ts +126 -0
- package/src/types/platforms.ts +65 -0
- package/src/types/plugins.ts +24 -0
- package/src/types/uploader.ts +26 -0
- package/src/types/userStore.ts +22 -0
- package/src/utils/glodash.ts +423 -0
- package/src/utils/tools.ts +384 -0
- package/src/utils/verifiers.ts +76 -0
- package/tsconfig.json +32 -0
- package/typings/global.d.ts +92 -0
package/.babelrc
ADDED
package/.eslintignore
ADDED
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
|
package/.prettierignore
ADDED