@tarojs/service 3.6.22-nightly.0 → 3.6.22

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.
@@ -1,154 +0,0 @@
1
- import type helper from '@tarojs/helper'
2
- import type { IProjectConfig } from '@tarojs/taro/types/compile'
3
- import type { IModifyChainData } from '@tarojs/taro/types/compile/hooks'
4
- import type joi from 'joi'
5
- import type Webpack from 'webpack'
6
- import type Chain from 'webpack-chain'
7
- import type { PluginType } from './constants'
8
-
9
- export interface IPaths {
10
- /**
11
- * 当前命令执行的目录,如果是 build 命令则为当前项目路径
12
- */
13
- appPath: string
14
- /**
15
- * 当前项目配置目录,如果 init 命令,则没有此路径
16
- */
17
- configPath: string
18
- /**
19
- * 当前项目源码路径
20
- */
21
- sourcePath: string
22
- /**
23
- * 当前项目输出代码路径
24
- */
25
- outputPath: string
26
- /**
27
- * 当前项目所用的 node_modules 路径
28
- */
29
- nodeModulesPath: string
30
- }
31
-
32
- export type Func = (...args: any[]) => any
33
-
34
- export type IPluginsObject = Record<string, Record<any, any> | null>
35
-
36
- export interface IPlugin {
37
- id: string
38
- path: string
39
- opts: any
40
- type: PluginType
41
- apply: Func
42
- }
43
-
44
- export type IPreset = IPlugin
45
-
46
- export interface IHook {
47
- name: string
48
- plugin?: string
49
- fn: Func
50
- before?: string
51
- stage?: number
52
- }
53
-
54
- export interface ICommand extends IHook {
55
- alias?: string
56
- optionsMap?: {
57
- [key: string]: string
58
- }
59
- synopsisList?: string[]
60
- }
61
-
62
- export interface IFileType {
63
- templ: string
64
- style: string
65
- script: string
66
- config: string
67
- }
68
-
69
- export interface IPlatform extends IHook {
70
- useConfigName?: string
71
- }
72
-
73
- export declare interface IPluginContext {
74
- /**
75
- * 获取当前所有挂载的插件
76
- */
77
- plugins: Map<string, IPlugin>
78
- /**
79
- * 获取当前所有挂载的平台
80
- */
81
- platforms: Map<string, IPlatform>
82
- /**
83
- * 包含当前执行命令的相关路径集合
84
- */
85
- paths: IPaths
86
- /**
87
- * 获取当前执行命令所带的参数
88
- */
89
- runOpts: any
90
- /**
91
- * 为包 @tarojs/helper 的快捷使用方式,包含其所有 API
92
- */
93
- helper: typeof helper
94
- /**
95
- * 项目配置
96
- */
97
- initialConfig: IProjectConfig
98
- /**
99
- * 注册一个可供其他插件调用的钩子,接收一个参数,即 Hook 对象
100
- */
101
- register: (hook: IHook) => void
102
- /**
103
- * 向 ctx 上挂载一个方法可供其他插件直接调用
104
- */
105
- registerMethod: (arg: (string | { name: string, fn?: Func }), fn?: Func) => void
106
- /**
107
- * 注册一个自定义命令
108
- */
109
- registerCommand: (command: ICommand) => void
110
- /**
111
- * 注册一个自定义编译平台
112
- */
113
- registerPlatform: (platform: IPlatform) => void
114
- /**
115
- * 触发注册的钩子(使用`ctx.register`方法注册的钩子),传入钩子名和钩子所需参数
116
- */
117
- applyPlugins: (args: string | { name: string, initialVal?: any, opts?: any }) => Promise<any>
118
- /**
119
- * 为插件添加入参校验
120
- */
121
- addPluginOptsSchema: (fn: (joi: joi.Root) => void) => void
122
- /**
123
- * 编译开始
124
- */
125
- onBuildStart: (fn: Func) => void
126
- /**
127
- * 编译结束(保存代码每次编译结束后都会触发)
128
- */
129
- onBuildFinish: (fn: Func) => void
130
- /**
131
- * 编译完成(启动项目后首次编译结束后会触发一次)
132
- */
133
- onBuildComplete: (fn: Func) => void
134
- /**
135
- * 修改编译过程中的页面组件配置
136
- */
137
- onCompilerMake: (fn: (args: { compilation: Webpack.Compilation, compiler: Webpack.Compiler, plugin: any }) => void) => void
138
- /**
139
- * 编译中修改 webpack 配置,在这个钩子中,你可以对 webpackChain 作出想要的调整,等同于配置 [`webpackChain`](./config-detail.md#miniwebpackchain)
140
- */
141
- modifyWebpackChain: (fn: (args: { chain: Chain, webpack: typeof Webpack, data?: IModifyChainData }) => void) => void
142
- /**
143
- * 修改编译后的结果
144
- */
145
- modifyBuildAssets: (fn: (args: { assets: any, miniPlugin: any }) => void) => void
146
- /**
147
- * 修改编译过程中的页面组件配置
148
- */
149
- modifyMiniConfigs: (fn: (args: { configMap: any }) => void) => void
150
-
151
- [key: string]: any
152
- }
153
-
154
- export declare type TConfig = Record<string, any>