@tarojs/binding 3.6.19-nightly.2023112217

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 (4) hide show
  1. package/LICENSE +160 -0
  2. package/binding.d.ts +112 -0
  3. package/binding.js +253 -0
  4. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,160 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 O2Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ========================================================================
24
+
25
+ MIT (react-devtools):
26
+ The following files embed [react-devtools](https://github.com/facebook/react) MIT:
27
+ `/packages/taro-plugin-react-devtools/src/backend/index.js`
28
+ See `/LICENSE` for details of the license.
29
+
30
+ ==================
31
+
32
+ MIT (vue-devtools):
33
+ The following files embed [vue-devtools](https://github.com/vuejs/devtools) MIT:
34
+ `/packages/taro-plugin-vue-devtools/src/backend/*`
35
+ See `/LICENSE` for details of the license.
36
+
37
+ ==================
38
+
39
+ MIT (vite):
40
+ The following files embed [vite](https://github.com/vitejs/vite) MIT:
41
+ `/packages/taro-webpack5-prebundle/src/prebundle/scanImport.ts`,
42
+ `/packages/taro-webpack5-prebundle/src/prebundle/bundle.ts`,
43
+ `/packages/taro-webpack5-prebundle/src/h5.ts`,
44
+ `/packages/taro-webpack5-prebundle/src/min.ts`
45
+ See `/LICENSE` for details of the license.
46
+
47
+ ==================
48
+
49
+ MIT (webpack):
50
+ The following files embed [webpack](https://github.com/webpack/webpack) MIT:
51
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerEntryModule.ts`,
52
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerPlugin.ts`,
53
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerReferencePlugin.ts`,
54
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroModuleFederationPlugin.ts`
55
+ See `/LICENSE` for details of the license.
56
+
57
+ ==================
58
+
59
+ MIT (sizzle):
60
+ The following files embed [sizzle](https://github.com/jquery/sizzle) MIT:
61
+ `/packages/taro-extends/src/jquery/sizzle.js`
62
+ See `/LICENSE.txt` for details of the license.
63
+
64
+ ==================
65
+
66
+ MIT (zepto):
67
+ The following files embed [zepto](https://github.com/madrobby/zepto) MIT:
68
+ `/packages/taro-extends/src/jquery/zepto.js`,
69
+ `/packages/taro-extends/src/jquery/event.js`
70
+ See `/MIT-LICENSE` for details of the license.
71
+
72
+ ==================
73
+
74
+ MIT (css-to-react-native):
75
+ The following files embed [css-to-react-native](https://github.com/styled-components/css-to-react-native) MIT:
76
+ `/packages/css-to-react-native/src/css-to-react-native/*`
77
+ See `/LICENSE.md` for details of the license.
78
+
79
+ ==================
80
+
81
+ MIT (reactify-wc):
82
+ The following files embed [reactify-wc](https://github.com/BBKolton/reactify-wc) MIT:
83
+ `/packages/taro-components-library-react/src/component-lib/reactify-wc.ts`
84
+ See `/LICENSE` for details of the license.
85
+
86
+ ==================
87
+
88
+ MIT (ant-design-mobile-rn):
89
+ The following files embed [ant-design-mobile-rn](https://github.com/ant-design/ant-design-mobile-rn) MIT:
90
+ `/packages/taro-components-rn/src/components/Swiper/carousel.tsx`
91
+ See `/LICENSE` for details of the license.
92
+
93
+ ==================
94
+
95
+ MIT (react-wx-images-viewer):
96
+ The following files embed [react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer) MIT:
97
+ `/packages/taro-h5/src/api/media/image/previewImage.ts`
98
+ See `/LICENSE` for details of the license.
99
+
100
+ ==================
101
+
102
+ MIT (webpack-contrib/css-loader):
103
+ The following files embed [webpack-contrib/css-loader](https://github.com/webpack-contrib/css-loader) MIT:
104
+ `/packages/taro-rn-style-transformer/src/utils/index.ts`
105
+ See `/LICENSE` for details of the license.
106
+
107
+ ==================
108
+
109
+ MIT (react-native):
110
+ The following files embed [react-native](https://github.com/facebook/react-native) MIT:
111
+ `/packages/taro-rn-style-transformer/src/transforms/StyleSheet/*`
112
+ See `/LICENSE` for details of the license.
113
+
114
+ ==================
115
+
116
+ MIT (myrne/performance-now):
117
+ The following files embed [myrne/performance-now](https://github.com/myrne/performance-now) MIT:
118
+ `/packages/taro-runtime/src/bom/raf.ts`
119
+ See `/LICENSE` for details of the license.
120
+
121
+ ==================
122
+
123
+ Apache (chameleon-api):
124
+ The following files embed [chameleon-api](https://github.com/chameleon-team/chameleon-api) Apache:
125
+ `/packages/taro-h5/src/api/device/clipboard.ts`
126
+
127
+ ==================
128
+
129
+ MIT (uni-app):
130
+ The following files embed [uni-app](https://github.com/dcloudio/uni-app) MIT:
131
+ `/packages/taro-components-rn/src/components/Video/index.tsx`
132
+ See `/LICENSE` for details of the license.
133
+
134
+ ==================
135
+
136
+ MIT (miniprogram-render):
137
+ The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
138
+ `/packages/taro-plugin-http/src/runtime/Cookie.ts`
139
+ See `/LICENSE` for details of the license.
140
+
141
+ ==================
142
+
143
+ MIT (stencil-ds-output-targets):
144
+ The following files embed [stencil-ds-output-targets](https://github.com/ionic-team/stencil-ds-output-targets/) MIT:
145
+ `/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts`
146
+ `/packages/taro-components-library-react/src/react-component-lib/utils/case.ts`
147
+ `/packages/taro-components-library-react/src/react-component-lib/utils/dev.ts`
148
+ `/packages/taro-components-library-react/src/react-component-lib/utils/index.tsx`
149
+ `/packages/taro-components-library-react/src/react-component-lib/createComponent.tsx`
150
+ `/packages/taro-components-library-react/src/react-component-lib/createOverlayComponent.tsx`
151
+ `/packages/taro-components-library-react/src/react-component-lib/interfaces.ts`
152
+ `/packages/taro-components-library-vue3/src/vue-component-lib/utils.ts`
153
+ See `/LICENSE` for details of the license.
154
+
155
+ ==================
156
+
157
+ MIT (stencil-vue2-output-target):
158
+ The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
159
+ `/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
160
+ See `/LICENSE` for details of the license.
package/binding.d.ts ADDED
@@ -0,0 +1,112 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+
4
+ export class Creator {
5
+ templateRoot: string
6
+ destinationRoot: string
7
+ constructor(templateRoot: string, destinationRoot: string)
8
+ createFileFromTemplate(templateName: string, templatePath: string, destPath: string, options: CreateOptions): Promise<void>
9
+ }
10
+
11
+ export const enum CompilerType {
12
+ Webpack4 = 'Webpack4',
13
+ Webpack5 = 'Webpack5',
14
+ Vite = 'Vite'
15
+ }
16
+
17
+ export interface CreateOptions {
18
+ css?: CSSType
19
+ cssExt?: string
20
+ framework?: FrameworkType
21
+ description?: string
22
+ projectName: string
23
+ version?: string
24
+ date?: string
25
+ typescript?: boolean
26
+ template: string
27
+ pageName?: string
28
+ compiler?: CompilerType
29
+ setPageName?: string
30
+ changeExt?: boolean
31
+ isCustomTemplate?: boolean
32
+ pluginType?: string
33
+ }
34
+
35
+ export function createPage(conf: Page, handlers: Record<string, (err: Error | null, value: CreateOptions) => any>): Promise<void>
36
+
37
+ export function createPlugin(conf: Plugin): Promise<void>
38
+
39
+ export function createProject(conf: Project, handlers: Record<string, (err: Error | null, value: CreateOptions) => any>): Promise<void>
40
+
41
+ export const enum CSSType {
42
+ None = 'None',
43
+ Sass = 'Sass',
44
+ Stylus = 'Stylus',
45
+ Less = 'Less'
46
+ }
47
+
48
+ export const enum FrameworkType {
49
+ React = 'React',
50
+ Preact = 'Preact',
51
+ Vue = 'Vue',
52
+ Vue3 = 'Vue3'
53
+ }
54
+
55
+ export const enum NpmType {
56
+ Yarn = 'Yarn',
57
+ Cnpm = 'Cnpm',
58
+ Pnpm = 'Pnpm',
59
+ Npm = 'Npm'
60
+ }
61
+
62
+ export interface Page {
63
+ projectDir: string
64
+ projectName: string
65
+ template: string
66
+ templateRoot: string
67
+ description?: string
68
+ pageName: string
69
+ date?: string
70
+ framework: FrameworkType
71
+ css: CSSType
72
+ typescript?: boolean
73
+ compiler?: CompilerType
74
+ version?: string
75
+ isCustomTemplate?: boolean
76
+ customTemplatePath?: string
77
+ basePageFiles: Array<string>
78
+ period: PeriodType
79
+ }
80
+
81
+ export const enum PeriodType {
82
+ CreateAPP = 'CreateAPP',
83
+ CreatePage = 'CreatePage'
84
+ }
85
+
86
+ export interface Plugin {
87
+ projectRoot: string
88
+ projectName: string
89
+ description?: string
90
+ pluginType: string
91
+ templateRoot: string
92
+ version: string
93
+ template: string
94
+ }
95
+
96
+ export interface Project {
97
+ projectRoot: string
98
+ projectName: string
99
+ npm: NpmType
100
+ description?: string
101
+ typescript?: boolean
102
+ template: string
103
+ css: CSSType
104
+ autoInstall?: boolean
105
+ framework: FrameworkType
106
+ templateRoot: string
107
+ version: string
108
+ date?: string
109
+ compiler?: CompilerType
110
+ period: PeriodType
111
+ }
112
+
package/binding.js ADDED
@@ -0,0 +1,253 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ /* auto-generated by NAPI-RS */
4
+
5
+ const { existsSync, readFileSync } = require('fs')
6
+ const { join } = require('path')
7
+
8
+ const { platform, arch } = process
9
+
10
+ let nativeBinding = null
11
+ let localFileExisted = false
12
+ let loadError = null
13
+
14
+ function isMusl() {
15
+ // For Node 10
16
+ if (!process.report || typeof process.report.getReport !== 'function') {
17
+ try {
18
+ const lddPath = require('child_process').execSync('which ldd').toString().trim()
19
+ return readFileSync(lddPath, 'utf8').includes('musl')
20
+ } catch (e) {
21
+ return true
22
+ }
23
+ } else {
24
+ const { glibcVersionRuntime } = process.report.getReport().header
25
+ return !glibcVersionRuntime
26
+ }
27
+ }
28
+
29
+ switch (platform) {
30
+ case 'android':
31
+ switch (arch) {
32
+ case 'arm64':
33
+ localFileExisted = existsSync(join(__dirname, 'taro.android-arm64.node'))
34
+ try {
35
+ if (localFileExisted) {
36
+ nativeBinding = require('./taro.android-arm64.node')
37
+ } else {
38
+ nativeBinding = require('@tarojs/binding-android-arm64')
39
+ }
40
+ } catch (e) {
41
+ loadError = e
42
+ }
43
+ break
44
+ case 'arm':
45
+ localFileExisted = existsSync(join(__dirname, 'taro.android-arm-eabi.node'))
46
+ try {
47
+ if (localFileExisted) {
48
+ nativeBinding = require('./taro.android-arm-eabi.node')
49
+ } else {
50
+ nativeBinding = require('@tarojs/binding-android-arm-eabi')
51
+ }
52
+ } catch (e) {
53
+ loadError = e
54
+ }
55
+ break
56
+ default:
57
+ throw new Error(`Unsupported architecture on Android ${arch}`)
58
+ }
59
+ break
60
+ case 'win32':
61
+ switch (arch) {
62
+ case 'x64':
63
+ localFileExisted = existsSync(
64
+ join(__dirname, 'taro.win32-x64-msvc.node')
65
+ )
66
+ try {
67
+ if (localFileExisted) {
68
+ nativeBinding = require('./taro.win32-x64-msvc.node')
69
+ } else {
70
+ nativeBinding = require('@tarojs/binding-win32-x64-msvc')
71
+ }
72
+ } catch (e) {
73
+ loadError = e
74
+ }
75
+ break
76
+ case 'ia32':
77
+ localFileExisted = existsSync(
78
+ join(__dirname, 'taro.win32-ia32-msvc.node')
79
+ )
80
+ try {
81
+ if (localFileExisted) {
82
+ nativeBinding = require('./taro.win32-ia32-msvc.node')
83
+ } else {
84
+ nativeBinding = require('@tarojs/binding-win32-ia32-msvc')
85
+ }
86
+ } catch (e) {
87
+ loadError = e
88
+ }
89
+ break
90
+ case 'arm64':
91
+ localFileExisted = existsSync(
92
+ join(__dirname, 'taro.win32-arm64-msvc.node')
93
+ )
94
+ try {
95
+ if (localFileExisted) {
96
+ nativeBinding = require('./taro.win32-arm64-msvc.node')
97
+ } else {
98
+ nativeBinding = require('@tarojs/binding-win32-arm64-msvc')
99
+ }
100
+ } catch (e) {
101
+ loadError = e
102
+ }
103
+ break
104
+ default:
105
+ throw new Error(`Unsupported architecture on Windows: ${arch}`)
106
+ }
107
+ break
108
+ case 'darwin':
109
+ localFileExisted = existsSync(join(__dirname, 'taro.darwin-universal.node'))
110
+ try {
111
+ if (localFileExisted) {
112
+ nativeBinding = require('./taro.darwin-universal.node')
113
+ } else {
114
+ nativeBinding = require('@tarojs/binding-darwin-universal')
115
+ }
116
+ break
117
+ } catch {}
118
+ switch (arch) {
119
+ case 'x64':
120
+ localFileExisted = existsSync(join(__dirname, 'taro.darwin-x64.node'))
121
+ try {
122
+ if (localFileExisted) {
123
+ nativeBinding = require('./taro.darwin-x64.node')
124
+ } else {
125
+ nativeBinding = require('@tarojs/binding-darwin-x64')
126
+ }
127
+ } catch (e) {
128
+ loadError = e
129
+ }
130
+ break
131
+ case 'arm64':
132
+ localFileExisted = existsSync(
133
+ join(__dirname, 'taro.darwin-arm64.node')
134
+ )
135
+ try {
136
+ if (localFileExisted) {
137
+ nativeBinding = require('./taro.darwin-arm64.node')
138
+ } else {
139
+ nativeBinding = require('@tarojs/binding-darwin-arm64')
140
+ }
141
+ } catch (e) {
142
+ loadError = e
143
+ }
144
+ break
145
+ default:
146
+ throw new Error(`Unsupported architecture on macOS: ${arch}`)
147
+ }
148
+ break
149
+ case 'freebsd':
150
+ if (arch !== 'x64') {
151
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
152
+ }
153
+ localFileExisted = existsSync(join(__dirname, 'taro.freebsd-x64.node'))
154
+ try {
155
+ if (localFileExisted) {
156
+ nativeBinding = require('./taro.freebsd-x64.node')
157
+ } else {
158
+ nativeBinding = require('@tarojs/binding-freebsd-x64')
159
+ }
160
+ } catch (e) {
161
+ loadError = e
162
+ }
163
+ break
164
+ case 'linux':
165
+ switch (arch) {
166
+ case 'x64':
167
+ if (isMusl()) {
168
+ localFileExisted = existsSync(
169
+ join(__dirname, 'taro.linux-x64-musl.node')
170
+ )
171
+ try {
172
+ if (localFileExisted) {
173
+ nativeBinding = require('./taro.linux-x64-musl.node')
174
+ } else {
175
+ nativeBinding = require('@tarojs/binding-linux-x64-musl')
176
+ }
177
+ } catch (e) {
178
+ loadError = e
179
+ }
180
+ } else {
181
+ localFileExisted = existsSync(
182
+ join(__dirname, 'taro.linux-x64-gnu.node')
183
+ )
184
+ try {
185
+ if (localFileExisted) {
186
+ nativeBinding = require('./taro.linux-x64-gnu.node')
187
+ } else {
188
+ nativeBinding = require('@tarojs/binding-linux-x64-gnu')
189
+ }
190
+ } catch (e) {
191
+ loadError = e
192
+ }
193
+ }
194
+ break
195
+ case 'arm64':
196
+ if (isMusl()) {
197
+ localFileExisted = existsSync(
198
+ join(__dirname, 'taro.linux-arm64-musl.node')
199
+ )
200
+ try {
201
+ if (localFileExisted) {
202
+ nativeBinding = require('./taro.linux-arm64-musl.node')
203
+ } else {
204
+ nativeBinding = require('@tarojs/binding-linux-arm64-musl')
205
+ }
206
+ } catch (e) {
207
+ loadError = e
208
+ }
209
+ } else {
210
+ localFileExisted = existsSync(
211
+ join(__dirname, 'taro.linux-arm64-gnu.node')
212
+ )
213
+ try {
214
+ if (localFileExisted) {
215
+ nativeBinding = require('./taro.linux-arm64-gnu.node')
216
+ } else {
217
+ nativeBinding = require('@tarojs/binding-linux-arm64-gnu')
218
+ }
219
+ } catch (e) {
220
+ loadError = e
221
+ }
222
+ }
223
+ break
224
+ case 'arm':
225
+ localFileExisted = existsSync(
226
+ join(__dirname, 'taro.linux-arm-gnueabihf.node')
227
+ )
228
+ try {
229
+ if (localFileExisted) {
230
+ nativeBinding = require('./taro.linux-arm-gnueabihf.node')
231
+ } else {
232
+ nativeBinding = require('@tarojs/binding-linux-arm-gnueabihf')
233
+ }
234
+ } catch (e) {
235
+ loadError = e
236
+ }
237
+ break
238
+ default:
239
+ throw new Error(`Unsupported architecture on Linux: ${arch}`)
240
+ }
241
+ break
242
+ default:
243
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
244
+ }
245
+
246
+ if (!nativeBinding) {
247
+ if (loadError) {
248
+ throw loadError
249
+ }
250
+ throw new Error(`Failed to load native binding`)
251
+ }
252
+
253
+ module.exports.default = module.exports = nativeBinding
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@tarojs/binding",
3
+ "version": "3.6.19-nightly.2023112217",
4
+ "description": "Node binding for taro",
5
+ "main": "binding.js",
6
+ "typings": "binding.d.ts",
7
+ "napi": {
8
+ "binaryName": "taro",
9
+ "triples": {
10
+ "default": true,
11
+ "additional": [
12
+ "aarch64-apple-darwin"
13
+ ]
14
+ }
15
+ },
16
+ "files": [
17
+ "binding.js",
18
+ "binding.d.ts"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/NervJS/taro.git"
23
+ },
24
+ "keywords": [
25
+ "taro"
26
+ ],
27
+ "author": "luckyadam",
28
+ "license": "MIT",
29
+ "devDependencies": {
30
+ "@napi-rs/cli": "3.0.0-alpha.5",
31
+ "ava": "5.3.1"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/NervJS/taro/issues"
35
+ },
36
+ "homepage": "https://github.com/NervJS/taro#readme",
37
+ "optionalDependencies": {
38
+ "@tarojs/binding-darwin-arm64": "npm:@tarojs/taro-darwin-arm64@3.6.19-nightly.2023112217",
39
+ "@tarojs/binding-darwin-x64": "npm:@tarojs/taro-darwin-x64@3.6.19-nightly.2023112217",
40
+ "@tarojs/binding-linux-x64-gnu": "npm:@tarojs/taro-linux-x64-gnu@3.6.19-nightly.2023112217",
41
+ "@tarojs/binding-win32-x64-msvc": "3.6.19-nightly.2023112217"
42
+ },
43
+ "scripts": {
44
+ "artifacts": "napi artifacts --npm-dir ../../npm --cwd ./",
45
+ "build": "napi build --platform --release --no-js --dts binding.d.ts",
46
+ "build:debug": "napi build --platform --no-js --dts binding.d.ts",
47
+ "format": "run-p format:source format:rs",
48
+ "format:rs": "cargo fmt",
49
+ "format:source": "prettier . -w",
50
+ "test": "ava"
51
+ }
52
+ }