@tarojs/plugin-generator 4.1.3-beta.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/LICENSE +174 -0
- package/README.md +38 -0
- package/dist/generators/es5/babel.d.ts +31 -0
- package/dist/generators/es5/babel.js +260 -0
- package/dist/generators/es5/babel.js.map +1 -0
- package/dist/generators/es5/config.d.ts +8 -0
- package/dist/generators/es5/config.js +182 -0
- package/dist/generators/es5/config.js.map +1 -0
- package/dist/generators/es5/index.d.ts +2 -0
- package/dist/generators/es5/index.js +34 -0
- package/dist/generators/es5/index.js.map +1 -0
- package/dist/generators/tailwindcss/config.d.ts +8 -0
- package/dist/generators/tailwindcss/config.js +357 -0
- package/dist/generators/tailwindcss/config.js.map +1 -0
- package/dist/generators/tailwindcss/deps.d.ts +5 -0
- package/dist/generators/tailwindcss/deps.js +26 -0
- package/dist/generators/tailwindcss/deps.js.map +1 -0
- package/dist/generators/tailwindcss/emit.d.ts +3 -0
- package/dist/generators/tailwindcss/emit.js +169 -0
- package/dist/generators/tailwindcss/emit.js.map +1 -0
- package/dist/generators/tailwindcss/index.d.ts +2 -0
- package/dist/generators/tailwindcss/index.js +54 -0
- package/dist/generators/tailwindcss/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/ast.d.ts +8 -0
- package/dist/utils/ast.js +56 -0
- package/dist/utils/ast.js.map +1 -0
- package/dist/utils/error.d.ts +20 -0
- package/dist/utils/error.js +61 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +122 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,182 @@
|
|
|
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.updateConfig = void 0;
|
|
30
|
+
/* eslint-disable no-console */
|
|
31
|
+
const generator_1 = __importDefault(require("@babel/generator"));
|
|
32
|
+
const parser = __importStar(require("@babel/parser"));
|
|
33
|
+
const traverse_1 = __importDefault(require("@babel/traverse"));
|
|
34
|
+
const t = __importStar(require("@babel/types"));
|
|
35
|
+
const dedent_1 = __importDefault(require("dedent"));
|
|
36
|
+
const ast_1 = require("../../utils/ast");
|
|
37
|
+
const error_1 = require("../../utils/error");
|
|
38
|
+
const createModifiedConfigError = (compilerType) => new error_1.GeneratorError({
|
|
39
|
+
type: error_1.GeneratorErrorType.modifyConfig,
|
|
40
|
+
message: compilerType === 'vite'
|
|
41
|
+
? (0, dedent_1.default)(`
|
|
42
|
+
{
|
|
43
|
+
h5: {
|
|
44
|
+
legacy: true,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`)
|
|
48
|
+
: (0, dedent_1.default)(`
|
|
49
|
+
{
|
|
50
|
+
mini: {
|
|
51
|
+
compile: {
|
|
52
|
+
include: [
|
|
53
|
+
filename => /node_modules\\/(?!(.pnpm|@babel|core-js|style-loader|css-loader|react|react-dom))(@?[^/]+)/.test(filename)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
h5: {
|
|
58
|
+
compile: {
|
|
59
|
+
include: [
|
|
60
|
+
filename => /node_modules\\/(?!(.pnpm|@babel|core-js|style-loader|css-loader|react|react-dom))(@?[^/]+)/.test(filename)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`),
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* 更新配置文件
|
|
69
|
+
*/
|
|
70
|
+
async function updateConfig(options) {
|
|
71
|
+
const { ctx, compilerType } = options;
|
|
72
|
+
const { fs } = ctx.helper;
|
|
73
|
+
const sourceCode = await fs.readFile(ctx.paths.configPath, { encoding: 'utf-8' });
|
|
74
|
+
const ast = parser.parse(sourceCode, { sourceType: 'module', plugins: ['typescript'] });
|
|
75
|
+
insertBrowserlistEnv(ast);
|
|
76
|
+
let miniUpdated = false;
|
|
77
|
+
let h5Updated = false;
|
|
78
|
+
(0, traverse_1.default)(ast, {
|
|
79
|
+
ObjectProperty: (o) => {
|
|
80
|
+
const { node } = o;
|
|
81
|
+
if (t.isIdentifier(node.key) && node.key.name === 'mini' && t.isObjectExpression(node.value)) {
|
|
82
|
+
if (compilerType === 'webpack5') {
|
|
83
|
+
modifyWebpackCompileConfig(node.value);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// vite-runner 小程序看着不支持 legacy 字段
|
|
87
|
+
}
|
|
88
|
+
miniUpdated = true;
|
|
89
|
+
}
|
|
90
|
+
if (t.isIdentifier(node.key) && node.key.name === 'h5' && t.isObjectExpression(node.value)) {
|
|
91
|
+
if (compilerType === 'webpack5') {
|
|
92
|
+
modifyWebpackCompileConfig(node.value);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
modifyViteCompileConfig(node.value);
|
|
96
|
+
}
|
|
97
|
+
h5Updated = true;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
if (!miniUpdated || !h5Updated) {
|
|
102
|
+
throw createModifiedConfigError(compilerType);
|
|
103
|
+
}
|
|
104
|
+
const { code } = (0, generator_1.default)(ast);
|
|
105
|
+
await fs.outputFile(ctx.paths.configPath, code, { encoding: 'utf-8' });
|
|
106
|
+
console.log('✅ 更新配置文件成功\n');
|
|
107
|
+
}
|
|
108
|
+
exports.updateConfig = updateConfig;
|
|
109
|
+
function modifyViteCompileConfig(config) {
|
|
110
|
+
const legacyProp = config.properties.find((p) => t.isObjectProperty(p) && t.isIdentifier(p.key) && p.key.name === 'legacy');
|
|
111
|
+
if (!legacyProp) {
|
|
112
|
+
config.properties.push(t.objectProperty(t.identifier('legacy'), t.booleanLiteral(true)));
|
|
113
|
+
}
|
|
114
|
+
else if (t.isObjectProperty(legacyProp)) {
|
|
115
|
+
legacyProp.value = t.booleanLiteral(true);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
throw createModifiedConfigError('vite');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function modifyWebpackCompileConfig(config) {
|
|
122
|
+
(0, ast_1.ensureNestedObjectProperty)(config, ['compile']);
|
|
123
|
+
const compileProp = config.properties.find((p) => t.isObjectProperty(p) && t.isIdentifier(p.key) && p.key.name === 'compile');
|
|
124
|
+
if (compileProp && t.isObjectExpression(compileProp.value)) {
|
|
125
|
+
const includeProp = compileProp.value.properties.find((p) => t.isObjectProperty(p) && t.isIdentifier(p.key) && p.key.name === 'include');
|
|
126
|
+
const include = t.arrowFunctionExpression([t.identifier('filename')], t.callExpression(t.memberExpression(t.regExpLiteral(String.raw `node_modules\/(?!(.pnpm|@babel|core-js|style-loader|css-loader|react|react-dom))(@?[^/]+)`, ''), t.identifier('test')), [t.identifier('filename')]));
|
|
127
|
+
include.params[0].typeAnnotation = t.tsTypeAnnotation(t.tsStringKeyword());
|
|
128
|
+
if (!includeProp) {
|
|
129
|
+
compileProp.value.properties.push(t.objectProperty(t.identifier('include'), t.arrayExpression([include])));
|
|
130
|
+
}
|
|
131
|
+
else if (t.isObjectProperty(includeProp) && t.isArrayExpression(includeProp.value)) {
|
|
132
|
+
includeProp.value.elements.push(include);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
throw createModifiedConfigError('webpack5');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* 往配置文件中插入:
|
|
141
|
+
* process.env.BROWSERSLIST_ENV = process.env.NODE_ENV
|
|
142
|
+
*/
|
|
143
|
+
function insertBrowserlistEnv(ast) {
|
|
144
|
+
let hasEnv = false;
|
|
145
|
+
(0, traverse_1.default)(ast, {
|
|
146
|
+
AssignmentExpression(path) {
|
|
147
|
+
const { node } = path;
|
|
148
|
+
// 判断左侧是 process.env.BROWSERSLIST_ENV
|
|
149
|
+
const isLeftMatch = node.left.type === 'MemberExpression' &&
|
|
150
|
+
node.left.object.type === 'MemberExpression' &&
|
|
151
|
+
node.left.object.object.type === 'Identifier' &&
|
|
152
|
+
node.left.object.object.name === 'process' &&
|
|
153
|
+
node.left.object.property.type === 'Identifier' &&
|
|
154
|
+
node.left.object.property.name === 'env' &&
|
|
155
|
+
node.left.property.type === 'Identifier' &&
|
|
156
|
+
node.left.property.name === 'BROWSERSLIST_ENV';
|
|
157
|
+
// 判断右侧是 process.env.NODE_ENV
|
|
158
|
+
const isRightMatch = node.right.type === 'MemberExpression' &&
|
|
159
|
+
node.right.object.type === 'MemberExpression' &&
|
|
160
|
+
node.right.object.object.type === 'Identifier' &&
|
|
161
|
+
node.right.object.object.name === 'process' &&
|
|
162
|
+
node.right.object.property.type === 'Identifier' &&
|
|
163
|
+
node.right.object.property.name === 'env' &&
|
|
164
|
+
node.right.property.type === 'Identifier' &&
|
|
165
|
+
node.right.property.name === 'NODE_ENV';
|
|
166
|
+
if (isLeftMatch && isRightMatch) {
|
|
167
|
+
hasEnv = true;
|
|
168
|
+
path.stop();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
Program: {
|
|
172
|
+
exit(program) {
|
|
173
|
+
if (!hasEnv) {
|
|
174
|
+
const env = parser.parseExpression('process.env.BROWSERSLIST_ENV = process.env.NODE_ENV');
|
|
175
|
+
const injectIndex = program.node.body.findIndex((stmt) => !t.isImportDeclaration(stmt));
|
|
176
|
+
program.node.body.splice(injectIndex, 0, env);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/generators/es5/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,iEAAuC;AACvC,sDAAuC;AACvC,+DAAsC;AACtC,gDAAiC;AACjC,oDAA2B;AAE3B,yCAA4D;AAC5D,6CAAsE;AAItE,MAAM,yBAAyB,GAAG,CAAC,YAA0B,EAAE,EAAE,CAC/D,IAAI,sBAAc,CAAC;IACjB,IAAI,EAAE,0BAAkB,CAAC,YAAY;IACrC,OAAO,EACL,YAAY,KAAK,MAAM;QACrB,CAAC,CAAC,IAAA,gBAAM,EAAC;;;;;;KAMZ,CAAC;QACE,CAAC,CAAC,IAAA,gBAAM,EAAC;;;;;;;;;;;;;;;;;GAiBd,CAAC;CACD,CAAC,CAAA;AAEJ;;GAEG;A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/C,CAAC;YACH,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.es5Generator = void 0;
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const babel_1 = require("./babel");
|
|
7
|
+
const config_1 = require("./config");
|
|
8
|
+
async function es5Generator(ctx) {
|
|
9
|
+
const compilerType = (0, utils_1.getCompilerType)(ctx.initialConfig.compiler);
|
|
10
|
+
if (!compilerType) {
|
|
11
|
+
throw new Error('未找到编译器类型');
|
|
12
|
+
}
|
|
13
|
+
await updateBrowserList(ctx);
|
|
14
|
+
await (0, config_1.updateConfig)({ ctx, compilerType });
|
|
15
|
+
await (0, babel_1.updateBabelConfig)(ctx);
|
|
16
|
+
console.log('✅ 启用「编译为 ES5」成功');
|
|
17
|
+
}
|
|
18
|
+
exports.es5Generator = es5Generator;
|
|
19
|
+
async function updateBrowserList(ctx) {
|
|
20
|
+
const { fs } = ctx.helper;
|
|
21
|
+
const browserslistrc = `${ctx.paths.appPath}/.browserslistrc`;
|
|
22
|
+
if (await fs.pathExists(browserslistrc)) {
|
|
23
|
+
await fs.writeFile(browserslistrc, 'last 3 versions\nAndroid >= 4.1\nios >= 8\n', { encoding: 'utf-8', flag: 'w' });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const pkgJson = (0, utils_1.readPkgJson)(ctx);
|
|
27
|
+
pkgJson.browserslist = ['last 3 versions', 'Android >= 4.1', 'ios >= 8'];
|
|
28
|
+
await fs.outputJson(`${ctx.paths.appPath}/package.json`, pkgJson, {
|
|
29
|
+
encoding: 'utf-8',
|
|
30
|
+
spaces: 2,
|
|
31
|
+
});
|
|
32
|
+
console.log('✅ 更新 browserslist 成功\n');
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0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Ae,EAAE,OAAO,EAAE;QAChE,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,CAAC;KACV,CAAC,CAAA;IACF,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as parser from '@babel/parser';
|
|
2
|
+
import * as t from '@babel/types';
|
|
3
|
+
import type { IPluginContext } from '@tarojs/service';
|
|
4
|
+
export declare function updateConfig(options: {
|
|
5
|
+
ctx: IPluginContext;
|
|
6
|
+
compilerType: 'webpack5' | 'vite';
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare function processViteConfig(ast: parser.ParseResult<t.File>): void;
|
|
@@ -0,0 +1,357 @@
|
|
|
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.processViteConfig = exports.updateConfig = void 0;
|
|
30
|
+
/* eslint-disable no-console */
|
|
31
|
+
const generator_1 = __importDefault(require("@babel/generator"));
|
|
32
|
+
const parser = __importStar(require("@babel/parser"));
|
|
33
|
+
const traverse_1 = __importDefault(require("@babel/traverse"));
|
|
34
|
+
const t = __importStar(require("@babel/types"));
|
|
35
|
+
const dedent_1 = __importDefault(require("dedent"));
|
|
36
|
+
const error_1 = require("../../utils/error");
|
|
37
|
+
async function updateConfig(options) {
|
|
38
|
+
const { ctx, compilerType } = options;
|
|
39
|
+
const { fs } = ctx.helper;
|
|
40
|
+
const sourceCode = await fs.readFile(ctx.paths.configPath, { encoding: 'utf-8' });
|
|
41
|
+
const ast = parser.parse(sourceCode, {
|
|
42
|
+
sourceType: 'module',
|
|
43
|
+
plugins: ['typescript'],
|
|
44
|
+
});
|
|
45
|
+
if (compilerType === 'webpack5') {
|
|
46
|
+
processWebpack5Config(ast);
|
|
47
|
+
}
|
|
48
|
+
else if (compilerType === 'vite') {
|
|
49
|
+
processViteConfig(ast);
|
|
50
|
+
}
|
|
51
|
+
const { code: latestConfig } = (0, generator_1.default)(ast);
|
|
52
|
+
await fs.writeFile(ctx.paths.configPath, latestConfig, { encoding: 'utf-8' });
|
|
53
|
+
console.log('✅ 更新配置文件成功\n');
|
|
54
|
+
}
|
|
55
|
+
exports.updateConfig = updateConfig;
|
|
56
|
+
function processImportDecl(ast, pkgMap) {
|
|
57
|
+
const alias = new Map();
|
|
58
|
+
const importedModule = new Map();
|
|
59
|
+
(0, traverse_1.default)(ast, {
|
|
60
|
+
ImportDeclaration(path) {
|
|
61
|
+
const importFrom = path.node.source.value;
|
|
62
|
+
if (pkgMap.has(importFrom)) {
|
|
63
|
+
importedModule.set(importFrom, path.node);
|
|
64
|
+
const specifiers = path.node.specifiers;
|
|
65
|
+
const importNames = pkgMap.get(importFrom);
|
|
66
|
+
if (!importNames)
|
|
67
|
+
return;
|
|
68
|
+
for (const specifier of specifiers) {
|
|
69
|
+
if (t.isImportDefaultSpecifier(specifier)) {
|
|
70
|
+
if (importNames.defaultImport) {
|
|
71
|
+
alias.set(specifier.local.name, importNames.defaultImport);
|
|
72
|
+
Reflect.deleteProperty(importNames, 'defaultImport');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (importNames.namedImport) {
|
|
76
|
+
if (importNames.namedImport.size === 0) {
|
|
77
|
+
Reflect.deleteProperty(importNames, 'namedImport');
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported)) {
|
|
81
|
+
const importName = specifier.imported.name;
|
|
82
|
+
const localName = specifier.local?.name ?? importName;
|
|
83
|
+
alias.set(importName, localName);
|
|
84
|
+
if (importNames.namedImport.has(importName)) {
|
|
85
|
+
importNames.namedImport.delete(importName);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
Program: {
|
|
93
|
+
exit(path) {
|
|
94
|
+
for (const [moduleName, { namedImport, defaultImport }] of pkgMap) {
|
|
95
|
+
if (defaultImport) {
|
|
96
|
+
if (importedModule.get(moduleName)) {
|
|
97
|
+
const importDecl = importedModule.get(moduleName);
|
|
98
|
+
importDecl?.specifiers.unshift(t.importDefaultSpecifier(t.identifier(defaultImport)));
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
path.node.body.unshift(t.importDeclaration([t.importDefaultSpecifier(t.identifier(defaultImport))], t.stringLiteral(moduleName)));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (namedImport && namedImport.size > 0) {
|
|
105
|
+
// 需要从已有的导入语句追加
|
|
106
|
+
if (importedModule.get(moduleName)) {
|
|
107
|
+
const importDecl = importedModule.get(moduleName);
|
|
108
|
+
for (const importName of namedImport) {
|
|
109
|
+
importDecl?.specifiers.push(t.importSpecifier(t.identifier(importName), t.identifier(importName)));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
path.node.body.unshift(t.importDeclaration(Array.from(namedImport).map((importName) => t.importSpecifier(t.identifier(importName), t.identifier(importName))), t.stringLiteral(moduleName)));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
return alias;
|
|
121
|
+
}
|
|
122
|
+
function processWebpack5Config(ast) {
|
|
123
|
+
const fromModule = 'weapp-tailwindcss/webpack';
|
|
124
|
+
const importName = 'UnifiedWebpackPluginV5';
|
|
125
|
+
const alias = processImportDecl(ast, new Map([[fromModule, { namedImport: new Set([importName]) }]]));
|
|
126
|
+
let updated = false;
|
|
127
|
+
(0, traverse_1.default)(ast, {
|
|
128
|
+
VariableDeclarator(path) {
|
|
129
|
+
const { node } = path;
|
|
130
|
+
if (t.isIdentifier(node.id, { name: 'baseConfig' }) && t.isObjectExpression(node.init)) {
|
|
131
|
+
(0, traverse_1.default)(node.init, {
|
|
132
|
+
ObjectProperty: (prop) => {
|
|
133
|
+
if (t.isIdentifier(prop.node.key, { name: 'mini' }) && t.isObjectExpression(prop.node.value)) {
|
|
134
|
+
const props = prop.node.value.properties;
|
|
135
|
+
const webpackChainMethod = props.find((p) => t.isObjectMethod(p) && t.isIdentifier(p.key, { name: 'webpackChain' }));
|
|
136
|
+
const installPluginCode = (0, dedent_1.default)(`
|
|
137
|
+
chain.merge({
|
|
138
|
+
plugin: {
|
|
139
|
+
install: {
|
|
140
|
+
plugin: UnifiedWebpackPluginV5,
|
|
141
|
+
args: [{
|
|
142
|
+
// 这里可以传参数
|
|
143
|
+
rem2rpx: true,
|
|
144
|
+
}]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
`);
|
|
149
|
+
const installPluginStmt = parser.parseExpression(installPluginCode);
|
|
150
|
+
let pluginAlreadyExists = false;
|
|
151
|
+
// 存在 webpackChain 方法
|
|
152
|
+
if (webpackChainMethod) {
|
|
153
|
+
for (const stmt of webpackChainMethod.body.body) {
|
|
154
|
+
if (t.isExpressionStatement(stmt) &&
|
|
155
|
+
t.isCallExpression(stmt.expression) &&
|
|
156
|
+
t.isMemberExpression(stmt.expression.callee) &&
|
|
157
|
+
t.isIdentifier(stmt.expression.callee.object, { name: 'chain' }) &&
|
|
158
|
+
t.isIdentifier(stmt.expression.callee.property, { name: 'merge' })) {
|
|
159
|
+
const [arg] = stmt.expression.arguments;
|
|
160
|
+
if (t.isObjectExpression(arg)) {
|
|
161
|
+
for (const prop of arg.properties) {
|
|
162
|
+
if (t.isObjectProperty(prop) &&
|
|
163
|
+
t.isIdentifier(prop.key, { name: 'plugin' }) &&
|
|
164
|
+
t.isObjectExpression(prop.value)) {
|
|
165
|
+
const installProp = prop.value.properties.find((p) => t.isObjectProperty(p) &&
|
|
166
|
+
t.isIdentifier(p.key, { name: 'install' }) &&
|
|
167
|
+
t.isObjectExpression(p.value) &&
|
|
168
|
+
p.value.properties.some((ip) => t.isObjectProperty(ip) &&
|
|
169
|
+
t.isIdentifier(ip.key, { name: 'plugin' }) &&
|
|
170
|
+
t.isIdentifier(ip.value, { name: alias.get(importName) ?? importName })));
|
|
171
|
+
if (installProp) {
|
|
172
|
+
pluginAlreadyExists = true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (!pluginAlreadyExists) {
|
|
180
|
+
webpackChainMethod.body.body.push(t.expressionStatement(installPluginStmt));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// 没有 webpackChain 方法则添加
|
|
185
|
+
prop.node.value.properties.push(t.objectMethod('method', t.identifier('webpackChain'), [t.identifier('chain'), t.identifier('webpack')], t.blockStatement([t.expressionStatement(installPluginStmt)]), false, false));
|
|
186
|
+
}
|
|
187
|
+
updated = true;
|
|
188
|
+
prop.stop();
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
}, path.scope);
|
|
192
|
+
path.stop();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
if (!updated) {
|
|
197
|
+
throw new error_1.GeneratorError({
|
|
198
|
+
type: error_1.GeneratorErrorType.modifyConfig,
|
|
199
|
+
message: (0, dedent_1.default)(`
|
|
200
|
+
import { UnifiedWebpackPluginV5 } from 'weapp-tailwindcss/webpack'
|
|
201
|
+
{
|
|
202
|
+
// 找到 mini 这个配置
|
|
203
|
+
mini: {
|
|
204
|
+
// postcss: { /*...*/ },
|
|
205
|
+
// 中的 webpackChain, 通常紧挨着 postcss
|
|
206
|
+
webpackChain(chain, webpack) {
|
|
207
|
+
// 复制这块区域到你的配置代码中
|
|
208
|
+
chain.merge({
|
|
209
|
+
plugin: {
|
|
210
|
+
install: {
|
|
211
|
+
plugin: UnifiedWebpackPluginV5,
|
|
212
|
+
args: [{
|
|
213
|
+
// 这里可以传参数
|
|
214
|
+
rem2rpx: true,
|
|
215
|
+
}]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
`),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function processViteConfig(ast) {
|
|
227
|
+
const weappTailwindCSS = 'weapp-tailwindcss/vite';
|
|
228
|
+
const tailwindcss = '@tailwindcss/postcss';
|
|
229
|
+
const importPluginName = 'UnifiedViteWeappTailwindcssPlugin';
|
|
230
|
+
const importTailwindcss = 'tailwindcss';
|
|
231
|
+
const alias = processImportDecl(ast, new Map([
|
|
232
|
+
[weappTailwindCSS, { namedImport: new Set([importPluginName]) }],
|
|
233
|
+
[tailwindcss, { defaultImport: importTailwindcss }],
|
|
234
|
+
]));
|
|
235
|
+
function createUnifiedVitePluginNode() {
|
|
236
|
+
const code = `
|
|
237
|
+
${alias.get(importPluginName) ?? importPluginName}({
|
|
238
|
+
// rem转rpx
|
|
239
|
+
rem2rpx: true,
|
|
240
|
+
// 除了小程序这些,其他平台都 disable
|
|
241
|
+
disabled: process.env.TARO_ENV === 'h5' || process.env.TARO_ENV === 'harmony' || process.env.TARO_ENV === 'rn',
|
|
242
|
+
// 由于 taro vite 默认会移除所有的 tailwindcss css 变量,所以一定要开启这个配置,进行css 变量的重新注入
|
|
243
|
+
injectAdditionalCssVarScope: true,
|
|
244
|
+
})
|
|
245
|
+
`;
|
|
246
|
+
return parser.parseExpression(code);
|
|
247
|
+
}
|
|
248
|
+
function createPostcssPluginNode() {
|
|
249
|
+
const code = `
|
|
250
|
+
{
|
|
251
|
+
name: 'postcss-config-loader-plugin',
|
|
252
|
+
config(config) {
|
|
253
|
+
// 加载 tailwindcss
|
|
254
|
+
if (typeof config.css?.postcss === 'object') {
|
|
255
|
+
config.css?.postcss.plugins?.unshift(tailwindcss())
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
`;
|
|
260
|
+
return parser.parseExpression(code);
|
|
261
|
+
}
|
|
262
|
+
let updated = false;
|
|
263
|
+
(0, traverse_1.default)(ast, {
|
|
264
|
+
VariableDeclarator(path) {
|
|
265
|
+
const { node } = path;
|
|
266
|
+
if (t.isIdentifier(node.id, { name: 'baseConfig' }) && t.isObjectExpression(node.init)) {
|
|
267
|
+
(0, traverse_1.default)(node.init, {
|
|
268
|
+
ObjectProperty: (prop) => {
|
|
269
|
+
if (!t.isIdentifier(prop.node.key, { name: 'compiler' }))
|
|
270
|
+
return;
|
|
271
|
+
// compiler: 'vite' => 替换为对象 compiler: { type: 'vite', ... }
|
|
272
|
+
if (t.isStringLiteral(prop.node.value, { value: 'vite' })) {
|
|
273
|
+
prop.node.value = t.objectExpression([
|
|
274
|
+
t.objectProperty(t.identifier('type'), t.stringLiteral('vite')),
|
|
275
|
+
t.objectProperty(t.identifier('vitePlugins'), t.arrayExpression([createPostcssPluginNode(), createUnifiedVitePluginNode()])),
|
|
276
|
+
]);
|
|
277
|
+
updated = true;
|
|
278
|
+
prop.stop();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
// compiler: { type: 'vite', ... }
|
|
282
|
+
if (t.isObjectExpression(prop.node.value)) {
|
|
283
|
+
const compilerProps = prop.node.value.properties;
|
|
284
|
+
let vitePluginsProp;
|
|
285
|
+
for (const p of compilerProps) {
|
|
286
|
+
if (t.isObjectProperty(p) &&
|
|
287
|
+
t.isIdentifier(p.key, { name: 'vitePlugins' }) &&
|
|
288
|
+
t.isArrayExpression(p.value)) {
|
|
289
|
+
vitePluginsProp = p;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (!vitePluginsProp) {
|
|
294
|
+
compilerProps.push(t.objectProperty(t.identifier('vitePlugins'), t.arrayExpression([createPostcssPluginNode(), createUnifiedVitePluginNode()])));
|
|
295
|
+
updated = true;
|
|
296
|
+
prop.stop();
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (!t.isArrayExpression(vitePluginsProp.value))
|
|
300
|
+
return;
|
|
301
|
+
const elements = vitePluginsProp.value.elements;
|
|
302
|
+
const hasPostcssPlugin = elements.some((el) => t.isObjectExpression(el) &&
|
|
303
|
+
el.properties.some((prop) => t.isObjectProperty(prop) &&
|
|
304
|
+
t.isIdentifier(prop.key, { name: 'name' }) &&
|
|
305
|
+
t.isStringLiteral(prop.value, { value: 'postcss-config-loader-plugin' })));
|
|
306
|
+
const hasUnifiedPlugin = elements.some((el) => t.isCallExpression(el) &&
|
|
307
|
+
t.isIdentifier(el.callee, { name: alias.get(importPluginName) ?? importPluginName }));
|
|
308
|
+
if (!hasPostcssPlugin) {
|
|
309
|
+
elements.unshift(createPostcssPluginNode());
|
|
310
|
+
}
|
|
311
|
+
if (!hasUnifiedPlugin) {
|
|
312
|
+
elements.push(createUnifiedVitePluginNode());
|
|
313
|
+
}
|
|
314
|
+
updated = true;
|
|
315
|
+
prop.stop();
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
}, path.scope);
|
|
319
|
+
path.stop();
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
if (!updated) {
|
|
324
|
+
throw new error_1.GeneratorError({
|
|
325
|
+
type: error_1.GeneratorErrorType.modifyConfig,
|
|
326
|
+
message: (0, dedent_1.default)(`
|
|
327
|
+
import tailwindcss from 'tailwindcss';
|
|
328
|
+
import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite'
|
|
329
|
+
|
|
330
|
+
{
|
|
331
|
+
// ... 其他配置
|
|
332
|
+
compiler: {
|
|
333
|
+
type: 'vite',
|
|
334
|
+
vitePlugins: [
|
|
335
|
+
{
|
|
336
|
+
name: 'postcss-config-loader-plugin',
|
|
337
|
+
config(config) {
|
|
338
|
+
if (typeof config.css?.postcss === 'object') {
|
|
339
|
+
config.css?.postcss.plugins?.unshift(tailwindcss())
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
UnifiedViteWeappTailwindcssPlugin({
|
|
344
|
+
rem2rpx: true,
|
|
345
|
+
disabled: process.env.TARO_ENV === 'h5' || process.env.TARO_ENV === 'harmony' || process.env.TARO_ENV === 'rn',
|
|
346
|
+
injectAdditionalCssVarScope: true,
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
// ... 其他配置
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
`),
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
exports.processViteConfig = processViteConfig;
|
|
357
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
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