@tarojs/plugin-generator 4.0.8-beta.3

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 (36) hide show
  1. package/LICENSE +174 -0
  2. package/README.md +38 -0
  3. package/dist/generators/es5/babel.d.ts +31 -0
  4. package/dist/generators/es5/babel.js +260 -0
  5. package/dist/generators/es5/babel.js.map +1 -0
  6. package/dist/generators/es5/config.d.ts +8 -0
  7. package/dist/generators/es5/config.js +182 -0
  8. package/dist/generators/es5/config.js.map +1 -0
  9. package/dist/generators/es5/index.d.ts +2 -0
  10. package/dist/generators/es5/index.js +34 -0
  11. package/dist/generators/es5/index.js.map +1 -0
  12. package/dist/generators/tailwindcss/config.d.ts +8 -0
  13. package/dist/generators/tailwindcss/config.js +357 -0
  14. package/dist/generators/tailwindcss/config.js.map +1 -0
  15. package/dist/generators/tailwindcss/deps.d.ts +5 -0
  16. package/dist/generators/tailwindcss/deps.js +26 -0
  17. package/dist/generators/tailwindcss/deps.js.map +1 -0
  18. package/dist/generators/tailwindcss/emit.d.ts +3 -0
  19. package/dist/generators/tailwindcss/emit.js +169 -0
  20. package/dist/generators/tailwindcss/emit.js.map +1 -0
  21. package/dist/generators/tailwindcss/index.d.ts +2 -0
  22. package/dist/generators/tailwindcss/index.js +54 -0
  23. package/dist/generators/tailwindcss/index.js.map +1 -0
  24. package/dist/index.d.ts +6 -0
  25. package/dist/index.js +67 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/utils/ast.d.ts +8 -0
  28. package/dist/utils/ast.js +56 -0
  29. package/dist/utils/ast.js.map +1 -0
  30. package/dist/utils/error.d.ts +20 -0
  31. package/dist/utils/error.js +61 -0
  32. package/dist/utils/error.js.map +1 -0
  33. package/dist/utils/index.d.ts +12 -0
  34. package/dist/utils/index.js +122 -0
  35. package/dist/utils/index.js.map +1 -0
  36. package/package.json +50 -0
package/LICENSE ADDED
@@ -0,0 +1,174 @@
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 (weui):
158
+ The following files embed [weui](https://github.com/Tencent/weui) MIT:
159
+ `/packages/taro-components/src/components/*.scss`
160
+ See `/LICENSE.txt` for details of the license.
161
+
162
+ ==================
163
+
164
+ Apache-2.0 (intersection-observer):
165
+ The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
166
+ `/packages/taro-api/src/polyfill/intersection-observer.ts`
167
+ See `/LICENSE.txt` for details of the license.
168
+
169
+ ==================
170
+
171
+ MIT (babel-plugin-jsx-dom-expressions):
172
+ The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
173
+ `/packages/babel-plugin-transform-solid-jsx/src/*`
174
+ See `/LICENSE` for details of the license.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @tarojs/plugin-generator
2
+
3
+ ## 使用
4
+
5
+ ```bash
6
+ // config/index.ts
7
+ export default defineConfig<'webpack5'>(async (merge, {command, mode}) => {
8
+ const baseConfig: UserConfigExport<'webpack5'> = {
9
+ ...
10
+ plugins: [
11
+ ...,
12
+ "@tarojs/plugin-generator" // 添加插件
13
+ ],
14
+ ...
15
+ }
16
+ ...
17
+ }
18
+ ```
19
+
20
+ ```json
21
+ {
22
+ "scripts": {
23
+ ...
24
+ "new": "taro new"
25
+ }
26
+ }
27
+ ```
28
+
29
+ 执行命令,选择需要开启的功能
30
+
31
+ ```bash
32
+ > pnpm new
33
+
34
+ ✔ 获取 taro 全局配置成功
35
+ ? 启用可选功能
36
+ ❯ 启用「Tailwind CSS」支持
37
+ 启用「编译为 ES5」
38
+ ```
@@ -0,0 +1,31 @@
1
+ import type { IPluginContext } from '@tarojs/service';
2
+ /**
3
+ * 更新 babel.config.js
4
+ * 主要处理模板里的写法
5
+ * 1.
6
+ * ```js
7
+ * module.exports = {
8
+ * presets: [
9
+ * ['taro', {
10
+ * framework: 'react',
11
+ * ts: true,
12
+ * compiler: 'webpack5',
13
+ * }]
14
+ * ]
15
+ * }
16
+ * ```
17
+ * 2.
18
+ * ```js
19
+ * const taroBabelConfig = {
20
+ * framework: 'react',
21
+ * ts: true,
22
+ * compiler: 'webpack5',
23
+ * }
24
+ * module.exports = {
25
+ * presets: [
26
+ * ['taro', taroBabelConfig]
27
+ * ]
28
+ * }
29
+ * ```
30
+ */
31
+ export declare function updateBabelConfig(ctx: IPluginContext): Promise<void>;
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.updateBabelConfig = void 0;
30
+ /* eslint-disable no-console */
31
+ /* eslint-disable brace-style */
32
+ const node_path_1 = __importDefault(require("node:path"));
33
+ const generator_1 = __importDefault(require("@babel/generator"));
34
+ const parser = __importStar(require("@babel/parser"));
35
+ const traverse_1 = __importDefault(require("@babel/traverse"));
36
+ const t = __importStar(require("@babel/types"));
37
+ const dedent_1 = __importDefault(require("dedent"));
38
+ const error_1 = require("../../utils/error");
39
+ const USE_BUILT_INS = 'useBuiltIns';
40
+ const config = (0, dedent_1.default)(`
41
+ [
42
+ 'taro',
43
+ {
44
+ framework: 'react',
45
+ ts: true,
46
+ compiler: 'vite',
47
+ ${USE_BUILT_INS}: process.env.TARO_ENV === 'h5' ? 'usage' : false
48
+ }
49
+ ]
50
+ `);
51
+ const modifyConfigError = new error_1.GeneratorError({
52
+ type: error_1.GeneratorErrorType.modifyConfig,
53
+ message: (0, dedent_1.default)(`{
54
+ presets: [
55
+ [
56
+ 'taro',
57
+ {
58
+ framework: 'react',
59
+ ts: true,
60
+ compiler: 'vite',
61
+ ${USE_BUILT_INS}: process.env.TARO_ENV === 'h5' ? 'usage' : false
62
+ }
63
+ ]
64
+ ]
65
+ }`),
66
+ targetFile: 'babel.config.js',
67
+ });
68
+ /**
69
+ * 更新 babel.config.js
70
+ * 主要处理模板里的写法
71
+ * 1.
72
+ * ```js
73
+ * module.exports = {
74
+ * presets: [
75
+ * ['taro', {
76
+ * framework: 'react',
77
+ * ts: true,
78
+ * compiler: 'webpack5',
79
+ * }]
80
+ * ]
81
+ * }
82
+ * ```
83
+ * 2.
84
+ * ```js
85
+ * const taroBabelConfig = {
86
+ * framework: 'react',
87
+ * ts: true,
88
+ * compiler: 'webpack5',
89
+ * }
90
+ * module.exports = {
91
+ * presets: [
92
+ * ['taro', taroBabelConfig]
93
+ * ]
94
+ * }
95
+ * ```
96
+ */
97
+ async function updateBabelConfig(ctx) {
98
+ const { fs } = ctx.helper;
99
+ const babelConfigPath = node_path_1.default.join(ctx.paths.appPath, 'babel.config.js');
100
+ if (!(await fs.pathExists(babelConfigPath))) {
101
+ await fs.writeFile(babelConfigPath, (0, dedent_1.default)(`
102
+ module.exports = {
103
+ presets: [
104
+ [
105
+ 'taro',
106
+ {
107
+ framework: 'react',
108
+ ts: true,
109
+ compiler: 'vite',
110
+ ${USE_BUILT_INS}: process.env.TARO_ENV === 'h5' ? 'usage' : false
111
+ }
112
+ ]
113
+ ]
114
+ }
115
+ `), { encoding: 'utf-8', flag: 'w' });
116
+ return;
117
+ }
118
+ const sourceCode = await fs.readFile(node_path_1.default.join(babelConfigPath), { encoding: 'utf-8' });
119
+ const ast = parser.parse(sourceCode, {
120
+ sourceType: 'module',
121
+ plugins: ['typescript'],
122
+ });
123
+ (0, traverse_1.default)(ast, {
124
+ AssignmentExpression: (expr) => {
125
+ const { node } = expr;
126
+ // module.exports = {}
127
+ if (t.isMemberExpression(node.left) &&
128
+ t.isIdentifier(node.left.object) &&
129
+ node.left.object.name === 'module' &&
130
+ t.isIdentifier(node.left.property) &&
131
+ node.left.property.name === 'exports') {
132
+ if (t.isObjectExpression(node.right)) {
133
+ const presetsProp = node.right.properties.find((p) => t.isObjectProperty(p) && t.isIdentifier(p.key) && p.key.name === 'presets');
134
+ // 没有 presets 属性,直接创建
135
+ if (!presetsProp) {
136
+ node.right.properties.push(t.objectProperty(t.identifier('presets'), t.arrayExpression([parser.parseExpression(config)])));
137
+ }
138
+ // presets: [...]
139
+ else if (t.isArrayExpression(presetsProp.value)) {
140
+ handlePresets(presetsProp.value, expr);
141
+ }
142
+ // presets是变量的情况:presets: presets
143
+ else if (t.isIdentifier(presetsProp.value)) {
144
+ const variable = presetsProp.value.name;
145
+ const binding = expr.scope.getBinding(variable);
146
+ // const presets = [...]
147
+ if (binding?.path.isVariableDeclarator()) {
148
+ const init = binding.path.node.init;
149
+ if (t.isArrayExpression(init)) {
150
+ handlePresets(init, expr);
151
+ }
152
+ else {
153
+ // 不是合法的 presets
154
+ throw modifyConfigError;
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ },
161
+ });
162
+ await fs.writeFile(babelConfigPath, (0, generator_1.default)(ast).code, { encoding: 'utf-8', flag: 'w' });
163
+ console.log('✅ 更新 babel.config.js 成功\n');
164
+ }
165
+ exports.updateBabelConfig = updateBabelConfig;
166
+ /**
167
+ * 处理 presets
168
+ * 遍历 presets 数组
169
+ * - 如果元素是字符串,且是 'taro',则替换为 config
170
+ * - 如果元素是数组,且第一个元素是字符串,且是 'taro',处理 options,插入 useBuiltIns 属性
171
+ * - 如果元素是变量,且变量的值是 'taro',则替换为 config,变量的值为数组,那么执行元素为数组的情况的处理逻辑
172
+ */
173
+ function handlePresets(presets, nodePath) {
174
+ const { elements } = presets;
175
+ let modified = false;
176
+ /**
177
+ * 处理 presets 里的 taro preset
178
+ * - 元组第一项必须是 'taro'
179
+ * - 元组第二项是对象或者变量
180
+ * - - 对象的情况,插入 useBuiltIns 属性。
181
+ * - - 变量的情况,找到变量定义的地方,如果值是对象,插入 useBuiltIns 属性
182
+ */
183
+ const handleTaroPreset = (preset) => {
184
+ const first = preset.elements[0];
185
+ if (t.isStringLiteral(first) && first.value === 'taro') {
186
+ const options = preset.elements[1];
187
+ if (t.isObjectExpression(options)) {
188
+ insertUseBuiltInsProp(options);
189
+ modified = true;
190
+ }
191
+ if (t.isIdentifier(options)) {
192
+ const variable = options.name;
193
+ const binding = nodePath.scope.getBinding(variable);
194
+ if (binding?.path.isVariableDeclarator()) {
195
+ // const options = init {}
196
+ const init = binding.path.node.init;
197
+ if (t.isObjectExpression(init)) {
198
+ insertUseBuiltInsProp(init);
199
+ modified = true;
200
+ return;
201
+ }
202
+ }
203
+ throw modifyConfigError;
204
+ }
205
+ }
206
+ };
207
+ // 扫描 presets 数组每一项,presets 每一项可能是字符串、元组、变量
208
+ for (let i = 0; i < elements.length; i += 1) {
209
+ if (modified) {
210
+ break;
211
+ }
212
+ const el = elements[i];
213
+ // ["taro", ...] -> presets: [['taro', {...}], ...]
214
+ if (t.isStringLiteral(el)) {
215
+ if (el.value === 'taro') {
216
+ elements[i] = parser.parseExpression(config);
217
+ modified = true;
218
+ }
219
+ }
220
+ // [["taro", {...}], ...]
221
+ if (t.isArrayExpression(el)) {
222
+ handleTaroPreset(el);
223
+ }
224
+ /**
225
+ * const taroPreset = ['taro', {}];
226
+ * presets: [taroPreset, ...]
227
+ */
228
+ if (t.isIdentifier(el)) {
229
+ const variable = el.name;
230
+ const binding = nodePath.scope.getBinding(variable);
231
+ if (binding?.path.isVariableDeclarator()) {
232
+ const init = binding.path.node.init;
233
+ // const taroPreset = 'taro';
234
+ if (t.isStringLiteral(init) && init.value === 'taro') {
235
+ binding.path.node.init = parser.parseExpression(config);
236
+ }
237
+ // const taroPreset = ['taro', {...}];
238
+ if (t.isArrayExpression(init)) {
239
+ handleTaroPreset(init);
240
+ }
241
+ }
242
+ }
243
+ }
244
+ if (!modified) {
245
+ elements.push(parser.parseExpression(config));
246
+ }
247
+ }
248
+ function insertUseBuiltInsProp(obj) {
249
+ const useBuiltInProp = obj.properties.find((p) => t.isObjectProperty(p) && t.isIdentifier(p.key) && p.key.name === USE_BUILT_INS);
250
+ const builtInValue = parser.parseExpression("process.env.TARO_ENV === 'h5' ? 'usage' : false");
251
+ // 如果有 useBuiltIns 属性,直接替换值
252
+ if (useBuiltInProp) {
253
+ useBuiltInProp.value = builtInValue;
254
+ }
255
+ // 没有 useBuiltIns 属性,直接添加
256
+ else {
257
+ obj.properties.push(t.objectProperty(t.identifier(USE_BUILT_INS), builtInValue));
258
+ }
259
+ }
260
+ //# sourceMappingURL=babel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babel.js","sourceRoot":"","sources":["../../../src/generators/es5/babel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,gCAAgC;AAChC,0DAA4B;AAE5B,iEAAuC;AACvC,sDAAuC;AACvC,+DAAyD;AACzD,gDAAiC;AACjC,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CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,aAAa,CAClE,CAAA;IACrB,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,iDAAiD,CAAC,CAAA;IAC9F,2BAA2B;IAC3B,IAAI,cAAc,EAAE,CAAC;QACnB,cAAc,CAAC,KAAK,GAAG,YAAY,CAAA;IACrC,CAAC;IACD,yBAAyB;SACpB,CAAC;QACJ,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,CAAC,CAAA;IAClF,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { IPluginContext } from '@tarojs/service';
2
+ /**
3
+ * 更新配置文件
4
+ */
5
+ export declare function updateConfig(options: {
6
+ ctx: IPluginContext;
7
+ compilerType: CompilerType;
8
+ }): Promise<void>;