@tarojs/plugin-html 3.5.0-canary.1 → 3.5.0-theta.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/dist/index.js +124 -126
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +304 -301
- package/dist/runtime.js.map +1 -1
- package/index.js +1 -0
- package/package.json +6 -7
- package/src/index.ts +6 -6
- package/src/runtime.ts +114 -119
- package/src/utils.ts +6 -4
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var path = require('path');
|
|
5
|
+
var generator = require('@babel/generator');
|
|
7
6
|
var parser = require('@babel/parser');
|
|
8
7
|
var traverse = require('@babel/traverse');
|
|
9
8
|
var t = require('@babel/types');
|
|
10
|
-
var
|
|
9
|
+
var shared = require('@tarojs/shared');
|
|
10
|
+
var path = require('path');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -20,140 +20,138 @@ function _interopNamespace(e) {
|
|
|
20
20
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
21
|
Object.defineProperty(n, k, d.get ? d : {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return e[k];
|
|
25
|
-
}
|
|
23
|
+
get: function () { return e[k]; }
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
n[
|
|
28
|
+
n["default"] = e;
|
|
31
29
|
return Object.freeze(n);
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
var
|
|
32
|
+
var generator__default = /*#__PURE__*/_interopDefaultLegacy(generator);
|
|
35
33
|
var parser__namespace = /*#__PURE__*/_interopNamespace(parser);
|
|
36
34
|
var traverse__default = /*#__PURE__*/_interopDefaultLegacy(traverse);
|
|
37
35
|
var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
|
38
|
-
var
|
|
36
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
39
37
|
|
|
40
|
-
var index = (ctx, options) => {
|
|
41
|
-
const inlineElements = ['i', 'abbr', 'select', 'acronym', 'small', 'bdi', 'kbd', 'strong', 'big', 'sub', 'sup', 'br', 'mark', 'meter', 'template', 'cite', 'object', 'time', 'code', 'output', 'u', 'data', 'picture', 'tt', 'datalist', 'var', 'dfn', 'del', 'q', 'em', 's', 'embed', 'samp', 'b'];
|
|
42
|
-
const blockElements = ['body', 'svg', 'address', 'fieldset', 'li', 'span', 'article', 'figcaption', 'main', 'aside', 'figure', 'nav', 'blockquote', 'footer', 'ol', 'details', 'p', 'dialog', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'dd', 'header', 'section', 'div', 'hgroup', 'table', 'dl', 'hr', 'ul', 'dt', 'view', 'view-block'];
|
|
43
|
-
const specialElements = ['slot', 'form', 'iframe', 'img', 'audio', 'video', 'canvas', 'a', 'input', 'label', 'textarea', 'progress', 'button'];
|
|
44
|
-
patchMappingElements(ctx, options, inlineElements, blockElements);
|
|
45
|
-
// 默认允许使用 getBoundingClientRect 等 API
|
|
46
|
-
ctx.modifyWebpackChain(({ chain }) => {
|
|
47
|
-
chain
|
|
48
|
-
.plugin('definePlugin')
|
|
49
|
-
.tap(args => {
|
|
50
|
-
var _a;
|
|
51
|
-
args[0].ENABLE_SIZE_APIS = (_a = options.enableSizeAPIs) !== null && _a !== void 0 ? _a : true;
|
|
52
|
-
return args;
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
ctx.registerMethod({
|
|
56
|
-
name: 'onSetupClose',
|
|
57
|
-
fn(platform) {
|
|
58
|
-
injectRuntimePath(platform);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
// React 收集使用到的小程序组件
|
|
62
|
-
ctx.onParseCreateElement(({ nodeName, componentConfig }) => {
|
|
63
|
-
if (!(inlineElements.includes(nodeName) ||
|
|
64
|
-
blockElements.includes(nodeName) ||
|
|
65
|
-
specialElements.includes(nodeName)))
|
|
66
|
-
return;
|
|
67
|
-
const simple = ['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video'];
|
|
68
|
-
const special = {
|
|
69
|
-
a: ['navigator'],
|
|
70
|
-
iframe: ['web-view'],
|
|
71
|
-
img: ['image'],
|
|
72
|
-
input: ['input', 'checkbox', 'radio']
|
|
73
|
-
};
|
|
74
|
-
const includes = componentConfig.includes;
|
|
75
|
-
if (simple.includes(nodeName) && !includes.has(nodeName)) {
|
|
76
|
-
includes.add(nodeName);
|
|
77
|
-
}
|
|
78
|
-
else if (nodeName in special) {
|
|
79
|
-
const maps = special[nodeName];
|
|
80
|
-
maps.forEach(item => {
|
|
81
|
-
!includes.has(item) && includes.add(item);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
// 如果组件使用渲染函数而不是模板,我们分析不了使用到的内置组件,所以只能默认加上所有 HTML 对应的小程序组件模板
|
|
86
|
-
ctx.modifyComponentConfig(({ componentConfig, config }) => {
|
|
87
|
-
if (config.framework === 'vue' || config.framework === 'vue3') {
|
|
88
|
-
['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video', 'navigator', 'web-view', 'image', 'input', 'checkbox', 'radio'].forEach(item => {
|
|
89
|
-
componentConfig.includes.add(item);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
// 修改 H5 postcss options
|
|
94
|
-
ctx.modifyRunnerOpts(({ opts }) => {
|
|
95
|
-
if (!(opts === null || opts === void 0 ? void 0 : opts.platform))
|
|
96
|
-
return;
|
|
97
|
-
modifyPostcssConfigs(opts, options, opts.platform === 'h5');
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
function injectRuntimePath(platform) {
|
|
101
|
-
const injectedPath = '@tarojs/plugin-html/dist/runtime';
|
|
102
|
-
if (shared.isArray(platform.runtimePath)) {
|
|
103
|
-
platform.runtimePath.push(injectedPath);
|
|
104
|
-
}
|
|
105
|
-
else if (shared.isString(platform.runtimePath)) {
|
|
106
|
-
platform.runtimePath = [platform.runtimePath, injectedPath];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function modifyPostcssConfigs(config, options, isH5) {
|
|
110
|
-
config.postcss || (config.postcss = {});
|
|
111
|
-
const postcssConfig = config.postcss;
|
|
112
|
-
if (!isH5) {
|
|
113
|
-
postcssConfig.htmltransform = {
|
|
114
|
-
enable: true
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
if (options.pxtransformBlackList) {
|
|
118
|
-
postcssConfig.pxtransform || (postcssConfig.pxtransform = {
|
|
119
|
-
enable: true
|
|
120
|
-
});
|
|
121
|
-
const pxtransformConfig = postcssConfig.pxtransform;
|
|
122
|
-
if (pxtransformConfig.enable) {
|
|
123
|
-
pxtransformConfig.config || (pxtransformConfig.config = {});
|
|
124
|
-
const config = pxtransformConfig.config;
|
|
125
|
-
config.selectorBlackList || (config.selectorBlackList = []);
|
|
126
|
-
config.selectorBlackList = config.selectorBlackList.concat(options.pxtransformBlackList);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function patchMappingElements(ctx, options, inlineElements, blockElements) {
|
|
131
|
-
var _a;
|
|
132
|
-
const helper = ctx.helper;
|
|
133
|
-
const filePath = path__namespace.resolve(__dirname, './runtime.js');
|
|
134
|
-
const content = helper.fs.readFileSync(filePath).toString();
|
|
135
|
-
const ast = parser__namespace.parse(content, { sourceType: 'unambiguous' });
|
|
136
|
-
(_a = options.modifyElements) === null || _a === void 0 ? void 0 : _a.call(options, inlineElements, blockElements);
|
|
137
|
-
traverse__default[
|
|
138
|
-
VariableDeclarator(path) {
|
|
139
|
-
const node = path.node;
|
|
140
|
-
const varid = node.id;
|
|
141
|
-
if (varid.type === 'Identifier') {
|
|
142
|
-
if (varid.name === 'inlineElements') {
|
|
143
|
-
node.init = getNewExpression(inlineElements);
|
|
144
|
-
}
|
|
145
|
-
if (varid.name === 'blockElements') {
|
|
146
|
-
node.init = getNewExpression(blockElements);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
const str = generator__default[
|
|
152
|
-
helper.fs.writeFileSync(filePath, str);
|
|
153
|
-
}
|
|
154
|
-
function getNewExpression(elements) {
|
|
155
|
-
return t__namespace.newExpression(t__namespace.identifier('Set'), [t__namespace.arrayExpression(elements.map(el => t__namespace.stringLiteral(el)))]);
|
|
38
|
+
var index = (ctx, options) => {
|
|
39
|
+
const inlineElements = ['i', 'abbr', 'select', 'acronym', 'small', 'bdi', 'kbd', 'strong', 'big', 'sub', 'sup', 'br', 'mark', 'meter', 'template', 'cite', 'object', 'time', 'code', 'output', 'u', 'data', 'picture', 'tt', 'datalist', 'var', 'dfn', 'del', 'q', 'em', 's', 'embed', 'samp', 'b'];
|
|
40
|
+
const blockElements = ['body', 'svg', 'address', 'fieldset', 'li', 'span', 'article', 'figcaption', 'main', 'aside', 'figure', 'nav', 'blockquote', 'footer', 'ol', 'details', 'p', 'dialog', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'dd', 'header', 'section', 'div', 'hgroup', 'table', 'dl', 'hr', 'ul', 'dt', 'view', 'view-block'];
|
|
41
|
+
const specialElements = ['slot', 'form', 'iframe', 'img', 'audio', 'video', 'canvas', 'a', 'input', 'label', 'textarea', 'progress', 'button'];
|
|
42
|
+
patchMappingElements(ctx, options, inlineElements, blockElements);
|
|
43
|
+
// 默认允许使用 getBoundingClientRect 等 API
|
|
44
|
+
ctx.modifyWebpackChain(({ chain }) => {
|
|
45
|
+
chain
|
|
46
|
+
.plugin('definePlugin')
|
|
47
|
+
.tap(args => {
|
|
48
|
+
var _a;
|
|
49
|
+
args[0].ENABLE_SIZE_APIS = (_a = options.enableSizeAPIs) !== null && _a !== void 0 ? _a : true;
|
|
50
|
+
return args;
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
ctx.registerMethod({
|
|
54
|
+
name: 'onSetupClose',
|
|
55
|
+
fn(platform) {
|
|
56
|
+
injectRuntimePath(platform);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// React 收集使用到的小程序组件
|
|
60
|
+
ctx.onParseCreateElement(({ nodeName, componentConfig }) => {
|
|
61
|
+
if (!(inlineElements.includes(nodeName) ||
|
|
62
|
+
blockElements.includes(nodeName) ||
|
|
63
|
+
specialElements.includes(nodeName)))
|
|
64
|
+
return;
|
|
65
|
+
const simple = ['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video'];
|
|
66
|
+
const special = {
|
|
67
|
+
a: ['navigator'],
|
|
68
|
+
iframe: ['web-view'],
|
|
69
|
+
img: ['image'],
|
|
70
|
+
input: ['input', 'checkbox', 'radio']
|
|
71
|
+
};
|
|
72
|
+
const includes = componentConfig.includes;
|
|
73
|
+
if (simple.includes(nodeName) && !includes.has(nodeName)) {
|
|
74
|
+
includes.add(nodeName);
|
|
75
|
+
}
|
|
76
|
+
else if (nodeName in special) {
|
|
77
|
+
const maps = special[nodeName];
|
|
78
|
+
maps.forEach(item => {
|
|
79
|
+
!includes.has(item) && includes.add(item);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// 如果组件使用渲染函数而不是模板,我们分析不了使用到的内置组件,所以只能默认加上所有 HTML 对应的小程序组件模板
|
|
84
|
+
ctx.modifyComponentConfig(({ componentConfig, config }) => {
|
|
85
|
+
if (config.framework === 'vue' || config.framework === 'vue3') {
|
|
86
|
+
['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video', 'navigator', 'web-view', 'image', 'input', 'checkbox', 'radio'].forEach(item => {
|
|
87
|
+
componentConfig.includes.add(item);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
// 修改 H5 postcss options
|
|
92
|
+
ctx.modifyRunnerOpts(({ opts }) => {
|
|
93
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.platform))
|
|
94
|
+
return;
|
|
95
|
+
modifyPostcssConfigs(opts, options, opts.platform === 'h5');
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
function injectRuntimePath(platform) {
|
|
99
|
+
const injectedPath = '@tarojs/plugin-html/dist/runtime';
|
|
100
|
+
if (shared.isArray(platform.runtimePath)) {
|
|
101
|
+
platform.runtimePath.push(injectedPath);
|
|
102
|
+
}
|
|
103
|
+
else if (shared.isString(platform.runtimePath)) {
|
|
104
|
+
platform.runtimePath = [platform.runtimePath, injectedPath];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function modifyPostcssConfigs(config, options, isH5) {
|
|
108
|
+
config.postcss || (config.postcss = {});
|
|
109
|
+
const postcssConfig = config.postcss;
|
|
110
|
+
if (!isH5) {
|
|
111
|
+
postcssConfig.htmltransform || (postcssConfig.htmltransform = {
|
|
112
|
+
enable: true
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (options.pxtransformBlackList) {
|
|
116
|
+
postcssConfig.pxtransform || (postcssConfig.pxtransform = {
|
|
117
|
+
enable: true
|
|
118
|
+
});
|
|
119
|
+
const pxtransformConfig = postcssConfig.pxtransform;
|
|
120
|
+
if (pxtransformConfig.enable) {
|
|
121
|
+
pxtransformConfig.config || (pxtransformConfig.config = {});
|
|
122
|
+
const config = pxtransformConfig.config;
|
|
123
|
+
config.selectorBlackList || (config.selectorBlackList = []);
|
|
124
|
+
config.selectorBlackList = config.selectorBlackList.concat(options.pxtransformBlackList);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function patchMappingElements(ctx, options, inlineElements, blockElements) {
|
|
129
|
+
var _a;
|
|
130
|
+
const helper = ctx.helper;
|
|
131
|
+
const filePath = path__namespace.resolve(__dirname, './runtime.js');
|
|
132
|
+
const content = helper.fs.readFileSync(filePath).toString();
|
|
133
|
+
const ast = parser__namespace.parse(content, { sourceType: 'unambiguous' });
|
|
134
|
+
(_a = options.modifyElements) === null || _a === void 0 ? void 0 : _a.call(options, inlineElements, blockElements);
|
|
135
|
+
traverse__default["default"](ast, {
|
|
136
|
+
VariableDeclarator(path) {
|
|
137
|
+
const node = path.node;
|
|
138
|
+
const varid = node.id;
|
|
139
|
+
if (varid.type === 'Identifier') {
|
|
140
|
+
if (varid.name === 'inlineElements') {
|
|
141
|
+
node.init = getNewExpression(inlineElements);
|
|
142
|
+
}
|
|
143
|
+
if (varid.name === 'blockElements') {
|
|
144
|
+
node.init = getNewExpression(blockElements);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const str = generator__default["default"](ast).code;
|
|
150
|
+
helper.fs.writeFileSync(filePath, str);
|
|
151
|
+
}
|
|
152
|
+
function getNewExpression(elements) {
|
|
153
|
+
return t__namespace.newExpression(t__namespace.identifier('Set'), [t__namespace.arrayExpression(elements.map(el => t__namespace.stringLiteral(el)))]);
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
exports[
|
|
156
|
+
exports["default"] = index;
|
|
159
157
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["\nimport type { IPluginContext, TaroPlatformBase } from '@tarojs/service'\nimport { isArray, isString } from '@tarojs/shared'\nimport * as path from 'path'\nimport * as parser from '@babel/parser'\nimport traverse from '@babel/traverse'\nimport * as t from '@babel/types'\nimport generator from '@babel/generator'\n\ninterface IOptions {\n pxtransformBlackList?: any[]\n modifyElements?(inline: string[], block: string[]): void\n enableSizeAPIs?: boolean\n}\n\ninterface IComponentConfig {\n includes: Set<string>\n}\n\ninterface OnParseCreateElementArgs {\n nodeName: string\n componentConfig: IComponentConfig\n}\n\ninterface ModifyComponentConfigArgs {\n componentConfig: IComponentConfig,\n config: Record<string, any>\n}\n\nexport default (ctx: IPluginContext, options: IOptions) => {\n const inlineElements = ['i', 'abbr', 'select', 'acronym', 'small', 'bdi', 'kbd', 'strong', 'big', 'sub', 'sup', 'br', 'mark', 'meter', 'template', 'cite', 'object', 'time', 'code', 'output', 'u', 'data', 'picture', 'tt', 'datalist', 'var', 'dfn', 'del', 'q', 'em', 's', 'embed', 'samp', 'b']\n const blockElements = ['body', 'svg', 'address', 'fieldset', 'li', 'span', 'article', 'figcaption', 'main', 'aside', 'figure', 'nav', 'blockquote', 'footer', 'ol', 'details', 'p', 'dialog', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'dd', 'header', 'section', 'div', 'hgroup', 'table', 'dl', 'hr', 'ul', 'dt', 'view', 'view-block']\n const specialElements = ['slot', 'form', 'iframe', 'img', 'audio', 'video', 'canvas', 'a', 'input', 'label', 'textarea', 'progress', 'button']\n\n patchMappingElements(ctx, options, inlineElements, blockElements)\n\n // 默认允许使用 getBoundingClientRect 等 API\n ctx.modifyWebpackChain(({ chain }) => {\n chain\n .plugin('definePlugin')\n .tap(args => {\n args[0].ENABLE_SIZE_APIS = options.enableSizeAPIs ?? true\n return args\n })\n })\n ctx.registerMethod({\n name: 'onSetupClose',\n fn (platform: TaroPlatformBase) {\n injectRuntimePath(platform)\n }\n })\n // React 收集使用到的小程序组件\n ctx.onParseCreateElement(({ nodeName, componentConfig }: OnParseCreateElementArgs) => {\n if (!(\n inlineElements.includes(nodeName) ||\n blockElements.includes(nodeName) ||\n specialElements.includes(nodeName)\n )) return\n\n const simple = ['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video']\n const special = {\n a: ['navigator'],\n iframe: ['web-view'],\n img: ['image'],\n input: ['input', 'checkbox', 'radio']\n }\n const includes = componentConfig.includes\n\n if (simple.includes(nodeName) && !includes.has(nodeName)) {\n includes.add(nodeName)\n } else if (nodeName in special) {\n const maps = special[nodeName]\n maps.forEach(item => {\n !includes.has(item) && includes.add(item)\n })\n }\n })\n // 如果组件使用渲染函数而不是模板,我们分析不了使用到的内置组件,所以只能默认加上所有 HTML 对应的小程序组件模板\n ctx.modifyComponentConfig(({ componentConfig, config }: ModifyComponentConfigArgs) => {\n if (config.framework === 'vue' || config.framework === 'vue3') {\n ['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video', 'navigator', 'web-view', 'image', 'input', 'checkbox', 'radio'].forEach(item => {\n componentConfig.includes.add(item)\n })\n }\n })\n // 修改 H5 postcss options\n ctx.modifyRunnerOpts(({ opts }) => {\n if (!opts?.platform) return\n modifyPostcssConfigs(opts, options, opts.platform === 'h5')\n })\n}\n\nfunction injectRuntimePath (platform: TaroPlatformBase) {\n const injectedPath = '@tarojs/plugin-html/dist/runtime'\n if (isArray(platform.runtimePath)) {\n platform.runtimePath.push(injectedPath)\n } else if (isString(platform.runtimePath)) {\n platform.runtimePath = [platform.runtimePath, injectedPath]\n }\n}\n\nfunction modifyPostcssConfigs (config: Record<string, any>, options: IOptions, isH5?: boolean) {\n config.postcss ||= {}\n const postcssConfig = config.postcss\n\n if (!isH5) {\n postcssConfig.htmltransform = {\n enable: true\n }\n }\n\n if (options.pxtransformBlackList) {\n postcssConfig.pxtransform ||= {\n enable: true\n }\n const pxtransformConfig = postcssConfig.pxtransform\n\n if (pxtransformConfig.enable) {\n pxtransformConfig.config ||= {}\n const config = pxtransformConfig.config\n config.selectorBlackList ||= []\n config.selectorBlackList = config.selectorBlackList.concat(options.pxtransformBlackList)\n }\n }\n}\n\nfunction patchMappingElements (ctx: IPluginContext, options: IOptions, inlineElements: string[], blockElements: string[]) {\n const helper = ctx.helper\n const filePath = path.resolve(__dirname, './runtime.js')\n const content = helper.fs.readFileSync(filePath).toString()\n const ast = parser.parse(content, { sourceType: 'unambiguous' })\n\n options.modifyElements?.(inlineElements, blockElements)\n\n traverse(ast, {\n VariableDeclarator (path) {\n const node = path.node\n const varid = node.id\n if (varid.type === 'Identifier') {\n if (varid.name === 'inlineElements') {\n node.init = getNewExpression(inlineElements)\n }\n if (varid.name === 'blockElements') {\n node.init = getNewExpression(blockElements)\n }\n }\n }\n })\n\n const str = generator(ast).code\n helper.fs.writeFileSync(filePath, str)\n}\n\nfunction getNewExpression (elements: string[]) {\n return t.newExpression(\n t.identifier('Set'),\n [t.arrayExpression(elements.map(el => t.stringLiteral(el)))]\n )\n}\n"],"names":["isArray","isString","path","parser","traverse","generator","t"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,YAAe,CAAC,GAAmB,EAAE,OAAiB;IACpD,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;IACnS,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EA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BA,YAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EACnB,CAACA,YAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAIA,YAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAC7D,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["\nimport generator from '@babel/generator'\nimport * as parser from '@babel/parser'\nimport traverse from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { IPluginContext, TaroPlatformBase } from '@tarojs/service'\nimport { isArray, isString } from '@tarojs/shared'\nimport * as path from 'path'\n\ninterface IOptions {\n pxtransformBlackList?: any[]\n modifyElements?(inline: string[], block: string[]): void\n enableSizeAPIs?: boolean\n}\n\ninterface IComponentConfig {\n includes: Set<string>\n}\n\ninterface OnParseCreateElementArgs {\n nodeName: string\n componentConfig: IComponentConfig\n}\n\ninterface ModifyComponentConfigArgs {\n componentConfig: IComponentConfig\n config: Record<string, any>\n}\n\nexport default (ctx: IPluginContext, options: IOptions) => {\n const inlineElements = ['i', 'abbr', 'select', 'acronym', 'small', 'bdi', 'kbd', 'strong', 'big', 'sub', 'sup', 'br', 'mark', 'meter', 'template', 'cite', 'object', 'time', 'code', 'output', 'u', 'data', 'picture', 'tt', 'datalist', 'var', 'dfn', 'del', 'q', 'em', 's', 'embed', 'samp', 'b']\n const blockElements = ['body', 'svg', 'address', 'fieldset', 'li', 'span', 'article', 'figcaption', 'main', 'aside', 'figure', 'nav', 'blockquote', 'footer', 'ol', 'details', 'p', 'dialog', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'dd', 'header', 'section', 'div', 'hgroup', 'table', 'dl', 'hr', 'ul', 'dt', 'view', 'view-block']\n const specialElements = ['slot', 'form', 'iframe', 'img', 'audio', 'video', 'canvas', 'a', 'input', 'label', 'textarea', 'progress', 'button']\n\n patchMappingElements(ctx, options, inlineElements, blockElements)\n\n // 默认允许使用 getBoundingClientRect 等 API\n ctx.modifyWebpackChain(({ chain }) => {\n chain\n .plugin('definePlugin')\n .tap(args => {\n args[0].ENABLE_SIZE_APIS = options.enableSizeAPIs ?? true\n return args\n })\n })\n ctx.registerMethod({\n name: 'onSetupClose',\n fn (platform: TaroPlatformBase) {\n injectRuntimePath(platform)\n }\n })\n // React 收集使用到的小程序组件\n ctx.onParseCreateElement(({ nodeName, componentConfig }: OnParseCreateElementArgs) => {\n if (!(\n inlineElements.includes(nodeName) ||\n blockElements.includes(nodeName) ||\n specialElements.includes(nodeName)\n )) return\n\n const simple = ['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video']\n const special = {\n a: ['navigator'],\n iframe: ['web-view'],\n img: ['image'],\n input: ['input', 'checkbox', 'radio']\n }\n const includes = componentConfig.includes\n\n if (simple.includes(nodeName) && !includes.has(nodeName)) {\n includes.add(nodeName)\n } else if (nodeName in special) {\n const maps = special[nodeName]\n maps.forEach(item => {\n !includes.has(item) && includes.add(item)\n })\n }\n })\n // 如果组件使用渲染函数而不是模板,我们分析不了使用到的内置组件,所以只能默认加上所有 HTML 对应的小程序组件模板\n ctx.modifyComponentConfig(({ componentConfig, config }: ModifyComponentConfigArgs) => {\n if (config.framework === 'vue' || config.framework === 'vue3') {\n ['audio', 'button', 'canvas', 'form', 'label', 'progress', 'textarea', 'video', 'navigator', 'web-view', 'image', 'input', 'checkbox', 'radio'].forEach(item => {\n componentConfig.includes.add(item)\n })\n }\n })\n // 修改 H5 postcss options\n ctx.modifyRunnerOpts(({ opts }) => {\n if (!opts?.platform) return\n modifyPostcssConfigs(opts, options, opts.platform === 'h5')\n })\n}\n\nfunction injectRuntimePath (platform: TaroPlatformBase) {\n const injectedPath = '@tarojs/plugin-html/dist/runtime'\n if (isArray(platform.runtimePath)) {\n platform.runtimePath.push(injectedPath)\n } else if (isString(platform.runtimePath)) {\n platform.runtimePath = [platform.runtimePath, injectedPath]\n }\n}\n\nfunction modifyPostcssConfigs (config: Record<string, any>, options: IOptions, isH5?: boolean) {\n config.postcss ||= {}\n const postcssConfig = config.postcss\n\n if (!isH5) {\n postcssConfig.htmltransform ||= {\n enable: true\n }\n }\n\n if (options.pxtransformBlackList) {\n postcssConfig.pxtransform ||= {\n enable: true\n }\n const pxtransformConfig = postcssConfig.pxtransform\n\n if (pxtransformConfig.enable) {\n pxtransformConfig.config ||= {}\n const config = pxtransformConfig.config\n config.selectorBlackList ||= []\n config.selectorBlackList = config.selectorBlackList.concat(options.pxtransformBlackList)\n }\n }\n}\n\nfunction patchMappingElements (ctx: IPluginContext, options: IOptions, inlineElements: string[], blockElements: string[]) {\n const helper = ctx.helper\n const filePath = path.resolve(__dirname, './runtime.js')\n const content = helper.fs.readFileSync(filePath).toString()\n const ast = parser.parse(content, { sourceType: 'unambiguous' })\n\n options.modifyElements?.(inlineElements, blockElements)\n\n traverse(ast, {\n VariableDeclarator (path) {\n const node = path.node\n const varid = node.id\n if (varid.type === 'Identifier') {\n if (varid.name === 'inlineElements') {\n node.init = getNewExpression(inlineElements)\n }\n if (varid.name === 'blockElements') {\n node.init = getNewExpression(blockElements)\n }\n }\n }\n })\n\n const str = generator(ast).code\n helper.fs.writeFileSync(filePath, str)\n}\n\nfunction getNewExpression (elements: string[]) {\n return t.newExpression(\n t.identifier('Set'),\n [t.arrayExpression(elements.map(el => t.stringLiteral(el)))]\n )\n}\n"],"names":["isArray","isString","path","parser","traverse","generator","t"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,YAAe,CAAC,GAAmB,EAAE,OAAiB,KAAI;AACxD,IAAA,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAA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