@mybricks/to-code-taro 1.2.1 → 1.2.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.
- package/dist/cjs/generate/compressImages.d.ts +16 -0
- package/dist/cjs/generate/compressImages.js +76 -0
- package/dist/cjs/generate/generateTaroProjectJson.js +3 -3
- package/dist/cjs/handleSlot.js +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/taro-template.json +4 -4
- package/dist/cjs/utils/style/converter.js +1 -1
- package/dist/esm/generate/compressImages.d.ts +16 -0
- package/dist/esm/generate/compressImages.js +108 -0
- package/dist/esm/generate/generateTaroProjectJson.js +3 -3
- package/dist/esm/handleSlot.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/taro-template.json +4 -4
- package/dist/esm/utils/style/converter.js +1 -2
- package/package.json +6 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图片压缩工具
|
|
3
|
+
* 使用 sharp(可选依赖)对生成的图片进行压缩
|
|
4
|
+
*/
|
|
5
|
+
import type { GenerationResult } from "../toCodeTaro";
|
|
6
|
+
export interface ImageCompressionOptions {
|
|
7
|
+
/** sharp .png() 参数,如 { compressionLevel: 9, palette: true, effort: 10 } */
|
|
8
|
+
png?: Record<string, any>;
|
|
9
|
+
/** sharp .jpeg() 参数,如 { quality: 80 } */
|
|
10
|
+
jpeg?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 压缩 GenerationResult 中的所有图片
|
|
14
|
+
* 需要安装 sharp(optionalDependency),未安装时原样返回
|
|
15
|
+
*/
|
|
16
|
+
export declare function compressImages(result: GenerationResult, options: ImageCompressionOptions): Promise<GenerationResult>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/generate/compressImages.ts
|
|
20
|
+
var compressImages_exports = {};
|
|
21
|
+
__export(compressImages_exports, {
|
|
22
|
+
compressImages: () => compressImages
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(compressImages_exports);
|
|
25
|
+
var sharpModule;
|
|
26
|
+
function getSharp() {
|
|
27
|
+
if (sharpModule !== void 0)
|
|
28
|
+
return sharpModule;
|
|
29
|
+
try {
|
|
30
|
+
sharpModule = require("sharp");
|
|
31
|
+
} catch {
|
|
32
|
+
sharpModule = null;
|
|
33
|
+
}
|
|
34
|
+
return sharpModule;
|
|
35
|
+
}
|
|
36
|
+
async function compressImages(result, options) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const sharp = getSharp();
|
|
39
|
+
if (!sharp) {
|
|
40
|
+
console.warn(
|
|
41
|
+
"[to-code-taro] sharp 未安装,跳过图片压缩。可通过 pnpm add sharp 安装。"
|
|
42
|
+
);
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
const allImages = [
|
|
46
|
+
...((_a = result.assets) == null ? void 0 : _a.pageImages) || [],
|
|
47
|
+
...((_b = result.assets) == null ? void 0 : _b.tabBarImages) || []
|
|
48
|
+
];
|
|
49
|
+
if (allImages.length === 0)
|
|
50
|
+
return result;
|
|
51
|
+
await Promise.all(
|
|
52
|
+
allImages.map(async (img) => {
|
|
53
|
+
var _a2;
|
|
54
|
+
const ext = (_a2 = img.filePath.split(".").pop()) == null ? void 0 : _a2.toLowerCase();
|
|
55
|
+
const original = img.fileContent;
|
|
56
|
+
try {
|
|
57
|
+
let compressed;
|
|
58
|
+
if (ext === "png" && options.png) {
|
|
59
|
+
compressed = await sharp(original).png(options.png).toBuffer();
|
|
60
|
+
} else if ((ext === "jpg" || ext === "jpeg") && options.jpeg) {
|
|
61
|
+
compressed = await sharp(original).jpeg(options.jpeg).toBuffer();
|
|
62
|
+
}
|
|
63
|
+
if (compressed) {
|
|
64
|
+
img.fileContent = compressed;
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.warn(`[to-code-taro] 压缩图片失败 ${img.filePath}:`, e);
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
compressImages
|
|
76
|
+
});
|
|
@@ -80,7 +80,7 @@ ${fileContent}` : fileContent;
|
|
|
80
80
|
content: configContent
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
path: `src/pages/${pageName}/index.
|
|
83
|
+
path: `src/pages/${pageName}/index.less`,
|
|
84
84
|
content: item.cssContent || ""
|
|
85
85
|
},
|
|
86
86
|
{
|
|
@@ -119,7 +119,7 @@ ${item.content || ""}`;
|
|
|
119
119
|
content: fullContent
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
path: `src/popupComponents/${popupId}/index.
|
|
122
|
+
path: `src/popupComponents/${popupId}/index.less`,
|
|
123
123
|
content: item.cssContent || ""
|
|
124
124
|
}
|
|
125
125
|
];
|
|
@@ -155,7 +155,7 @@ ${item.content || ""}`;
|
|
|
155
155
|
content: fullContent
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
path: `src/components/${moduleId}/index.
|
|
158
|
+
path: `src/components/${moduleId}/index.less`,
|
|
159
159
|
content: item.cssContent || ""
|
|
160
160
|
}
|
|
161
161
|
];
|
package/dist/cjs/handleSlot.js
CHANGED
|
@@ -102,7 +102,7 @@ var setupImports = (addImport, config, isRoot) => {
|
|
|
102
102
|
if (config.hasPopups) {
|
|
103
103
|
addImport({ packageName: "@/common/popup", dependencyNames: ["POPUP_MAP", "POPUP_IDS"], importType: "named" });
|
|
104
104
|
}
|
|
105
|
-
addImport({ packageName: "./index.
|
|
105
|
+
addImport({ packageName: "./index.less", dependencyNames: [], importType: "module" });
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
var generateSlotUi = (ui, props, childrenUi, childrenResults, config) => {
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as toCodeTaro } from './toCodeTaro';
|
|
2
2
|
export { default as generateTaroProjectJson } from './generate/generateTaroProjectJson';
|
|
3
3
|
export { default as generateTaroTempalteJson } from './generate/generateTaroTempalteJson';
|
|
4
|
+
export { compressImages, type ImageCompressionOptions } from './generate/compressImages';
|
package/dist/cjs/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var src_exports = {};
|
|
31
31
|
__export(src_exports, {
|
|
32
|
+
compressImages: () => import_compressImages.compressImages,
|
|
32
33
|
generateTaroProjectJson: () => import_generateTaroProjectJson.default,
|
|
33
34
|
generateTaroTempalteJson: () => import_generateTaroTempalteJson.default,
|
|
34
35
|
toCodeTaro: () => import_toCodeTaro.default
|
|
@@ -37,9 +38,10 @@ module.exports = __toCommonJS(src_exports);
|
|
|
37
38
|
var import_toCodeTaro = __toESM(require("./toCodeTaro"));
|
|
38
39
|
var import_generateTaroProjectJson = __toESM(require("./generate/generateTaroProjectJson"));
|
|
39
40
|
var import_generateTaroTempalteJson = __toESM(require("./generate/generateTaroTempalteJson"));
|
|
40
|
-
|
|
41
|
+
var import_compressImages = require("./generate/compressImages");
|
|
41
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
43
|
0 && (module.exports = {
|
|
44
|
+
compressImages,
|
|
43
45
|
generateTaroProjectJson,
|
|
44
46
|
generateTaroTempalteJson,
|
|
45
47
|
toCodeTaro
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"path": "config/index.ts",
|
|
12
|
-
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n
|
|
12
|
+
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons', '@mybricks/taro-components']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n optimizeMainPackage: {\n enable: true\n },\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n chain.merge({\n optimization: {\n splitChunks: {\n cacheGroups: {\n 'antv-f2': {\n name: 'antv-f2',\n test: /[\\\\/]node_modules[\\\\/]@antv[\\\\/]f2[\\\\/]/,\n minChunks: 1,\n priority: 100,\n },\n },\n },\n },\n })\n },\n },\n h5: {\n publicPath: '/',\n staticDirectory: 'static',\n output: {\n filename: 'js/[name].[hash:8].js',\n chunkFilename: 'js/[name].[chunkhash:8].js'\n },\n miniCssExtractPluginOption: {\n ignoreOrder: true,\n filename: 'css/[name].[hash].css',\n chunkFilename: 'css/[name].[chunkhash].css'\n },\n postcss: {\n autoprefixer: {\n enable: true,\n config: {}\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n }\n },\n rn: {\n appName: 'taroDemo',\n postcss: {\n cssModules: {\n enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true\n }\n }\n }\n }\n\n process.env.BROWSERSLIST_ENV = process.env.NODE_ENV\n\n if (process.env.NODE_ENV === 'development') {\n // 本地开发构建配置(不混淆压缩)\n return merge({}, baseConfig, devConfig)\n }\n // 生产构建配置(默认开启压缩混淆等)\n return merge({}, baseConfig, prodConfig)\n})\n"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "config/prod.ts",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"content": "export default defineAppConfig({\n pages: [],\n window: {\n backgroundTextStyle: 'light',\n navigationBarBackgroundColor: '#fff',\n navigationBarTitleText: 'WeChat',\n navigationBarTextStyle: 'black'\n }\n})\n"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
"path": "src/app.
|
|
79
|
+
"path": "src/app.less",
|
|
80
80
|
"content": "/* 隐藏 React Refresh 的全屏错误遮罩 */\n#react-refresh-overlay, \niframe[id=\"react-refresh-overlay\"] {\n display: none !important;\n}\n\n.mybricks_taro_systemPage {\n height: 100vh !important;\n}\n\n.mybricks_com{\n flex-shrink: 0;\n min-height: 0; /* 防止子元素撑开父元素 */\n}\n.mybricks_slot{\n width: 100%;\n height: 100%;\n position: relative;\n transform: translateX(0)\n}\n\nview {\n box-sizing: border-box;\n}\n"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"path": "src/app.ts",
|
|
84
|
-
"content": "import { PropsWithChildren } from 'react'\nimport { useLaunch } from '@tarojs/taro'\nimport { configureCoreRuntime } from '@mybricks/taro-core'\n// @ts-ignore\nimport { request } from '@/common/request'\n// @ts-ignore\nimport rootConfig from '@/common/rootConfig'\n// @ts-ignore\nimport tabBarConfig from '@/custom-tab-bar/tabBar.json'\nimport 'brickd-mobile/lib/index.css'\nimport '@mybricks/taro-components/dist/index.css'\nimport \"@taroify/icons/style\"\nimport './app.
|
|
84
|
+
"content": "import { PropsWithChildren } from 'react'\nimport { useLaunch } from '@tarojs/taro'\nimport { configureCoreRuntime } from '@mybricks/taro-core'\n// @ts-ignore\nimport { request } from '@/common/request'\n// @ts-ignore\nimport rootConfig from '@/common/rootConfig'\n// @ts-ignore\nimport tabBarConfig from '@/custom-tab-bar/tabBar.json'\nimport 'brickd-mobile/lib/index.css'\nimport '@mybricks/taro-components/dist/index.css'\nimport \"@taroify/icons/style\"\nimport './app.less'\n\nconfigureCoreRuntime({ request, rootConfig, tabBarConfig })\n\nfunction App({ children }: PropsWithChildren<any>) {\n useLaunch(() => {\n console.log('App launched.')\n })\n\n // children 是将要会渲染的页面\n return children\n}\n\n\nexport default App\n"
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"path": "src/index.html",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"path": "package.json",
|
|
140
|
-
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.
|
|
140
|
+
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.1.2\",\n \"@mybricks/taro-components\": \"^0.1.2\"\n },\n \"devDependencies\": {\n \"@tarojs/plugin-generator\": \"4.1.9\",\n \"@commitlint/cli\": \"^19.8.1\",\n \"@commitlint/config-conventional\": \"^19.8.1\",\n \"lint-staged\": \"^16.1.2\",\n \"husky\": \"^9.1.7\",\n \"stylelint-config-standard\": \"^38.0.0\",\n \"@babel/core\": \"^7.24.4\",\n \"@tarojs/cli\": \"4.1.9\",\n \"@babel/plugin-transform-class-properties\": \"7.25.9\",\n \"@types/webpack-env\": \"^1.13.6\",\n \"@types/react\": \"^18.0.0\",\n \"webpack\": \"5.91.0\",\n \"@tarojs/taro-loader\": \"4.1.9\",\n \"@tarojs/webpack5-runner\": \"4.1.9\",\n \"less\": \"^4.2.0\",\n \"babel-preset-taro\": \"4.1.9\",\n \"eslint-config-taro\": \"4.1.9\",\n \"eslint\": \"^8.57.0\",\n \"@pmmmwh/react-refresh-webpack-plugin\": \"^0.5.5\",\n \"react-refresh\": \"^0.14.0\",\n \"@babel/preset-react\": \"^7.24.1\",\n \"eslint-plugin-react\": \"^7.34.1\",\n \"eslint-plugin-react-hooks\": \"^4.4.0\",\n \"stylelint\": \"^16.4.0\",\n \"typescript\": \"^5.4.5\",\n \"tsconfig-paths-webpack-plugin\": \"^4.1.0\",\n \"postcss\": \"^8.5.6\",\n \"@types/node\": \"^18\",\n \"@types/minimatch\": \"^5\"\n }\n}\n"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"path": "project.config.json",
|
|
@@ -138,7 +138,7 @@ var convertStyleAryToCss = (styleAry, parentSelector) => {
|
|
|
138
138
|
let finalSelector = selector.trim();
|
|
139
139
|
if (parentSelector) {
|
|
140
140
|
const prefix = `.${parentSelector}`;
|
|
141
|
-
finalSelector = `${prefix} ${finalSelector}
|
|
141
|
+
finalSelector = `${prefix} ${finalSelector}`;
|
|
142
142
|
}
|
|
143
143
|
const transformedCss = {};
|
|
144
144
|
Object.entries(css).forEach(([key, value]) => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图片压缩工具
|
|
3
|
+
* 使用 sharp(可选依赖)对生成的图片进行压缩
|
|
4
|
+
*/
|
|
5
|
+
import type { GenerationResult } from "../toCodeTaro";
|
|
6
|
+
export interface ImageCompressionOptions {
|
|
7
|
+
/** sharp .png() 参数,如 { compressionLevel: 9, palette: true, effort: 10 } */
|
|
8
|
+
png?: Record<string, any>;
|
|
9
|
+
/** sharp .jpeg() 参数,如 { quality: 80 } */
|
|
10
|
+
jpeg?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 压缩 GenerationResult 中的所有图片
|
|
14
|
+
* 需要安装 sharp(optionalDependency),未安装时原样返回
|
|
15
|
+
*/
|
|
16
|
+
export declare function compressImages(result: GenerationResult, options: ImageCompressionOptions): Promise<GenerationResult>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
/**
|
|
5
|
+
* 图片压缩工具
|
|
6
|
+
* 使用 sharp(可选依赖)对生成的图片进行压缩
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var sharpModule;
|
|
10
|
+
function getSharp() {
|
|
11
|
+
if (sharpModule !== undefined) return sharpModule;
|
|
12
|
+
try {
|
|
13
|
+
sharpModule = require("sharp");
|
|
14
|
+
} catch (_unused) {
|
|
15
|
+
sharpModule = null;
|
|
16
|
+
}
|
|
17
|
+
return sharpModule;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 压缩 GenerationResult 中的所有图片
|
|
22
|
+
* 需要安装 sharp(optionalDependency),未安装时原样返回
|
|
23
|
+
*/
|
|
24
|
+
export function compressImages(_x, _x2) {
|
|
25
|
+
return _compressImages.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
function _compressImages() {
|
|
28
|
+
_compressImages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(result, options) {
|
|
29
|
+
var _result$assets, _result$assets2;
|
|
30
|
+
var sharp, allImages;
|
|
31
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
32
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
sharp = getSharp();
|
|
35
|
+
if (sharp) {
|
|
36
|
+
_context2.next = 4;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
console.warn("[to-code-taro] sharp 未安装,跳过图片压缩。可通过 pnpm add sharp 安装。");
|
|
40
|
+
return _context2.abrupt("return", result);
|
|
41
|
+
case 4:
|
|
42
|
+
allImages = [].concat(_toConsumableArray(((_result$assets = result.assets) === null || _result$assets === void 0 ? void 0 : _result$assets.pageImages) || []), _toConsumableArray(((_result$assets2 = result.assets) === null || _result$assets2 === void 0 ? void 0 : _result$assets2.tabBarImages) || []));
|
|
43
|
+
if (!(allImages.length === 0)) {
|
|
44
|
+
_context2.next = 7;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
return _context2.abrupt("return", result);
|
|
48
|
+
case 7:
|
|
49
|
+
_context2.next = 9;
|
|
50
|
+
return Promise.all(allImages.map( /*#__PURE__*/function () {
|
|
51
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(img) {
|
|
52
|
+
var _img$filePath$split$p;
|
|
53
|
+
var ext, original, compressed;
|
|
54
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
55
|
+
while (1) switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
ext = (_img$filePath$split$p = img.filePath.split(".").pop()) === null || _img$filePath$split$p === void 0 ? void 0 : _img$filePath$split$p.toLowerCase();
|
|
58
|
+
original = img.fileContent;
|
|
59
|
+
_context.prev = 2;
|
|
60
|
+
if (!(ext === "png" && options.png)) {
|
|
61
|
+
_context.next = 9;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
_context.next = 6;
|
|
65
|
+
return sharp(original).png(options.png).toBuffer();
|
|
66
|
+
case 6:
|
|
67
|
+
compressed = _context.sent;
|
|
68
|
+
_context.next = 13;
|
|
69
|
+
break;
|
|
70
|
+
case 9:
|
|
71
|
+
if (!((ext === "jpg" || ext === "jpeg") && options.jpeg)) {
|
|
72
|
+
_context.next = 13;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
_context.next = 12;
|
|
76
|
+
return sharp(original).jpeg(options.jpeg).toBuffer();
|
|
77
|
+
case 12:
|
|
78
|
+
compressed = _context.sent;
|
|
79
|
+
case 13:
|
|
80
|
+
if (compressed) {
|
|
81
|
+
img.fileContent = compressed;
|
|
82
|
+
}
|
|
83
|
+
_context.next = 19;
|
|
84
|
+
break;
|
|
85
|
+
case 16:
|
|
86
|
+
_context.prev = 16;
|
|
87
|
+
_context.t0 = _context["catch"](2);
|
|
88
|
+
console.warn("[to-code-taro] \u538B\u7F29\u56FE\u7247\u5931\u8D25 ".concat(img.filePath, ":"), _context.t0);
|
|
89
|
+
case 19:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee, null, [[2, 16]]);
|
|
94
|
+
}));
|
|
95
|
+
return function (_x3) {
|
|
96
|
+
return _ref.apply(this, arguments);
|
|
97
|
+
};
|
|
98
|
+
}()));
|
|
99
|
+
case 9:
|
|
100
|
+
return _context2.abrupt("return", result);
|
|
101
|
+
case 10:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context2.stop();
|
|
104
|
+
}
|
|
105
|
+
}, _callee2);
|
|
106
|
+
}));
|
|
107
|
+
return _compressImages.apply(this, arguments);
|
|
108
|
+
}
|
|
@@ -74,7 +74,7 @@ var generateTaroProjectJson = function generateTaroProjectJson(result) {
|
|
|
74
74
|
path: "src/pages/".concat(pageName, "/index.config.ts"),
|
|
75
75
|
content: configContent
|
|
76
76
|
}, {
|
|
77
|
-
path: "src/pages/".concat(pageName, "/index.
|
|
77
|
+
path: "src/pages/".concat(pageName, "/index.less"),
|
|
78
78
|
content: item.cssContent || ""
|
|
79
79
|
}, {
|
|
80
80
|
path: "src/pages/".concat(pageName, "/index.tsx"),
|
|
@@ -113,7 +113,7 @@ var generateTaroProjectJson = function generateTaroProjectJson(result) {
|
|
|
113
113
|
path: "src/popupComponents/".concat(popupId, "/index.tsx"),
|
|
114
114
|
content: fullContent
|
|
115
115
|
}, {
|
|
116
|
-
path: "src/popupComponents/".concat(popupId, "/index.
|
|
116
|
+
path: "src/popupComponents/".concat(popupId, "/index.less"),
|
|
117
117
|
content: item.cssContent || ""
|
|
118
118
|
}];
|
|
119
119
|
if (item.jsModules && item.jsModules.length > 0) {
|
|
@@ -145,7 +145,7 @@ var generateTaroProjectJson = function generateTaroProjectJson(result) {
|
|
|
145
145
|
path: "src/components/".concat(moduleId, "/index.tsx"),
|
|
146
146
|
content: fullContent
|
|
147
147
|
}, {
|
|
148
|
-
path: "src/components/".concat(moduleId, "/index.
|
|
148
|
+
path: "src/components/".concat(moduleId, "/index.less"),
|
|
149
149
|
content: item.cssContent || ""
|
|
150
150
|
}];
|
|
151
151
|
if (item.jsModules && item.jsModules.length > 0) {
|
package/dist/esm/handleSlot.js
CHANGED
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as toCodeTaro } from './toCodeTaro';
|
|
2
2
|
export { default as generateTaroProjectJson } from './generate/generateTaroProjectJson';
|
|
3
3
|
export { default as generateTaroTempalteJson } from './generate/generateTaroTempalteJson';
|
|
4
|
+
export { compressImages, type ImageCompressionOptions } from './generate/compressImages';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as toCodeTaro } from "./toCodeTaro";
|
|
2
2
|
export { default as generateTaroProjectJson } from "./generate/generateTaroProjectJson";
|
|
3
3
|
export { default as generateTaroTempalteJson } from "./generate/generateTaroTempalteJson";
|
|
4
|
-
|
|
4
|
+
export { compressImages } from "./generate/compressImages";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"path": "config/index.ts",
|
|
12
|
-
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n
|
|
12
|
+
"content": "import { defineConfig, type UserConfigExport } from '@tarojs/cli'\nimport path from 'path'\nimport devConfig from './dev'\nimport prodConfig from './prod'\n\n// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数\nexport default defineConfig<'webpack5'>(async (merge, { command, mode }) => {\n const baseConfig: UserConfigExport<'webpack5'> = {\n projectName: 'checkCom',\n date: '2025-12-24',\n designWidth: 375,\n deviceRatio: {\n 640: 2.34 / 2,\n 750: 1,\n 375: 2,\n 828: 1.81 / 2\n },\n sourceRoot: 'src',\n outputRoot: 'dist',\n plugins: [\n \"@tarojs/plugin-generator\"\n ],\n defineConstants: {\n },\n copy: {\n patterns: [\n ],\n options: {\n }\n },\n framework: 'react',\n compiler: {\n type: 'webpack5',\n prebundle: {\n exclude: ['brickd-mobile', '@taroify/icons', '@mybricks/taro-components']\n }\n },\n cache: {\n enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache\n },\n mini: {\n optimizeMainPackage: {\n enable: true\n },\n postcss: {\n pxtransform: {\n enable: true,\n config: {\n\n }\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n chain.merge({\n optimization: {\n splitChunks: {\n cacheGroups: {\n 'antv-f2': {\n name: 'antv-f2',\n test: /[\\\\/]node_modules[\\\\/]@antv[\\\\/]f2[\\\\/]/,\n minChunks: 1,\n priority: 100,\n },\n },\n },\n },\n })\n },\n },\n h5: {\n publicPath: '/',\n staticDirectory: 'static',\n output: {\n filename: 'js/[name].[hash:8].js',\n chunkFilename: 'js/[name].[chunkhash:8].js'\n },\n miniCssExtractPluginOption: {\n ignoreOrder: true,\n filename: 'css/[name].[hash].css',\n chunkFilename: 'css/[name].[chunkhash].css'\n },\n postcss: {\n autoprefixer: {\n enable: true,\n config: {}\n },\n cssModules: {\n enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true\n config: {\n namingPattern: 'module', // 转换模式,取值为 global/module\n generateScopedName: '[local]___[hash:base64:5]'\n }\n }\n },\n webpackChain(chain) {\n chain.resolve.alias\n .set('@', path.resolve(__dirname, '../src'))\n chain.resolve.modules\n .add(path.resolve(__dirname, '../node_modules'))\n .add('node_modules')\n }\n },\n rn: {\n appName: 'taroDemo',\n postcss: {\n cssModules: {\n enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true\n }\n }\n }\n }\n\n process.env.BROWSERSLIST_ENV = process.env.NODE_ENV\n\n if (process.env.NODE_ENV === 'development') {\n // 本地开发构建配置(不混淆压缩)\n return merge({}, baseConfig, devConfig)\n }\n // 生产构建配置(默认开启压缩混淆等)\n return merge({}, baseConfig, prodConfig)\n})\n"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "config/prod.ts",
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"content": "export default defineAppConfig({\n pages: [],\n window: {\n backgroundTextStyle: 'light',\n navigationBarBackgroundColor: '#fff',\n navigationBarTitleText: 'WeChat',\n navigationBarTextStyle: 'black'\n }\n})\n"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
"path": "src/app.
|
|
79
|
+
"path": "src/app.less",
|
|
80
80
|
"content": "/* 隐藏 React Refresh 的全屏错误遮罩 */\n#react-refresh-overlay, \niframe[id=\"react-refresh-overlay\"] {\n display: none !important;\n}\n\n.mybricks_taro_systemPage {\n height: 100vh !important;\n}\n\n.mybricks_com{\n flex-shrink: 0;\n min-height: 0; /* 防止子元素撑开父元素 */\n}\n.mybricks_slot{\n width: 100%;\n height: 100%;\n position: relative;\n transform: translateX(0)\n}\n\nview {\n box-sizing: border-box;\n}\n"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"path": "src/app.ts",
|
|
84
|
-
"content": "import { PropsWithChildren } from 'react'\nimport { useLaunch } from '@tarojs/taro'\nimport { configureCoreRuntime } from '@mybricks/taro-core'\n// @ts-ignore\nimport { request } from '@/common/request'\n// @ts-ignore\nimport rootConfig from '@/common/rootConfig'\n// @ts-ignore\nimport tabBarConfig from '@/custom-tab-bar/tabBar.json'\nimport 'brickd-mobile/lib/index.css'\nimport '@mybricks/taro-components/dist/index.css'\nimport \"@taroify/icons/style\"\nimport './app.
|
|
84
|
+
"content": "import { PropsWithChildren } from 'react'\nimport { useLaunch } from '@tarojs/taro'\nimport { configureCoreRuntime } from '@mybricks/taro-core'\n// @ts-ignore\nimport { request } from '@/common/request'\n// @ts-ignore\nimport rootConfig from '@/common/rootConfig'\n// @ts-ignore\nimport tabBarConfig from '@/custom-tab-bar/tabBar.json'\nimport 'brickd-mobile/lib/index.css'\nimport '@mybricks/taro-components/dist/index.css'\nimport \"@taroify/icons/style\"\nimport './app.less'\n\nconfigureCoreRuntime({ request, rootConfig, tabBarConfig })\n\nfunction App({ children }: PropsWithChildren<any>) {\n useLaunch(() => {\n console.log('App launched.')\n })\n\n // children 是将要会渲染的页面\n return children\n}\n\n\nexport default App\n"
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"path": "src/index.html",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"path": "package.json",
|
|
140
|
-
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.
|
|
140
|
+
"content": "{\n \"name\": \"checkCom\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"description\": \"\",\n \"templateInfo\": {\n \"name\": \"default\",\n \"typescript\": true,\n \"css\": \"Less\",\n \"framework\": \"React\"\n },\n \"scripts\": {\n \"prepare\": \"husky\",\n \"new\": \"taro new\",\n \"build:weapp\": \"taro build --type weapp\",\n \"build:swan\": \"taro build --type swan\",\n \"build:alipay\": \"taro build --type alipay\",\n \"build:tt\": \"taro build --type tt\",\n \"build:h5\": \"taro build --type h5\",\n \"build:rn\": \"taro build --type rn\",\n \"build:qq\": \"taro build --type qq\",\n \"build:jd\": \"taro build --type jd\",\n \"build:harmony-hybrid\": \"taro build --type harmony-hybrid\",\n \"dev:weapp\": \"npm run build:weapp -- --watch\",\n \"dev:swan\": \"npm run build:swan -- --watch\",\n \"dev:alipay\": \"npm run build:alipay -- --watch\",\n \"dev:tt\": \"npm run build:tt -- --watch\",\n \"dev:h5\": \"npm run build:h5 -- --watch\",\n \"dev:rn\": \"npm run build:rn -- --watch\",\n \"dev:qq\": \"npm run build:qq -- --watch\",\n \"dev:jd\": \"npm run build:jd -- --watch\",\n \"dev:harmony-hybrid\": \"npm run build:harmony-hybrid -- --watch\"\n },\n \"browserslist\": {\n \"development\": [\n \"defaults and fully supports es6-module\",\n \"maintained node versions\"\n ],\n \"production\": [\n \"last 3 versions\",\n \"Android >= 4.1\",\n \"ios >= 8\"\n ]\n },\n \"author\": \"\",\n \"dependencies\": {\n \"@babel/runtime\": \"^7.24.4\",\n \"@tarojs/components\": \"4.1.9\",\n \"@tarojs/helper\": \"4.1.9\",\n \"@tarojs/plugin-platform-weapp\": \"4.1.9\",\n \"@tarojs/plugin-platform-alipay\": \"4.1.9\",\n \"@tarojs/plugin-platform-tt\": \"4.1.9\",\n \"@tarojs/plugin-platform-swan\": \"4.1.9\",\n \"@tarojs/plugin-platform-jd\": \"4.1.9\",\n \"@tarojs/plugin-platform-qq\": \"4.1.9\",\n \"@tarojs/plugin-platform-h5\": \"4.1.9\",\n \"@tarojs/plugin-platform-harmony-hybrid\": \"4.1.9\",\n \"@tarojs/runtime\": \"4.1.9\",\n \"@tarojs/shared\": \"4.1.9\",\n \"@tarojs/taro\": \"4.1.9\",\n \"@tarojs/plugin-framework-react\": \"4.1.9\",\n \"@tarojs/react\": \"4.1.9\",\n \"react-dom\": \"^18.0.0\",\n \"react\": \"^18.0.0\",\n \"brickd-mobile\": \"^0.0.53\",\n \"@taroify/icons\": \"^0.9.0\",\n \"@types/crypto-js\": \"^4.2.2\",\n \"dayjs\": \"^1.11.19\",\n \"crypto-js\": \"^4.2.0\",\n \"@antv/f2\": \"3.8.12\",\n \"qrcode-generator\": \"^2.0.4\",\n \"lodash\": \"^4.17.21\",\n \"@mybricks/taro-core\": \"^0.1.2\",\n \"@mybricks/taro-components\": \"^0.1.2\"\n },\n \"devDependencies\": {\n \"@tarojs/plugin-generator\": \"4.1.9\",\n \"@commitlint/cli\": \"^19.8.1\",\n \"@commitlint/config-conventional\": \"^19.8.1\",\n \"lint-staged\": \"^16.1.2\",\n \"husky\": \"^9.1.7\",\n \"stylelint-config-standard\": \"^38.0.0\",\n \"@babel/core\": \"^7.24.4\",\n \"@tarojs/cli\": \"4.1.9\",\n \"@babel/plugin-transform-class-properties\": \"7.25.9\",\n \"@types/webpack-env\": \"^1.13.6\",\n \"@types/react\": \"^18.0.0\",\n \"webpack\": \"5.91.0\",\n \"@tarojs/taro-loader\": \"4.1.9\",\n \"@tarojs/webpack5-runner\": \"4.1.9\",\n \"less\": \"^4.2.0\",\n \"babel-preset-taro\": \"4.1.9\",\n \"eslint-config-taro\": \"4.1.9\",\n \"eslint\": \"^8.57.0\",\n \"@pmmmwh/react-refresh-webpack-plugin\": \"^0.5.5\",\n \"react-refresh\": \"^0.14.0\",\n \"@babel/preset-react\": \"^7.24.1\",\n \"eslint-plugin-react\": \"^7.34.1\",\n \"eslint-plugin-react-hooks\": \"^4.4.0\",\n \"stylelint\": \"^16.4.0\",\n \"typescript\": \"^5.4.5\",\n \"tsconfig-paths-webpack-plugin\": \"^4.1.0\",\n \"postcss\": \"^8.5.6\",\n \"@types/node\": \"^18\",\n \"@types/minimatch\": \"^5\"\n }\n}\n"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"path": "project.config.json",
|
|
@@ -138,8 +138,7 @@ export var convertStyleAryToCss = function convertStyleAryToCss(styleAry, parent
|
|
|
138
138
|
var finalSelector = selector.trim();
|
|
139
139
|
if (parentSelector) {
|
|
140
140
|
var prefix = ".".concat(parentSelector);
|
|
141
|
-
|
|
142
|
-
finalSelector = "".concat(prefix, " ").concat(finalSelector, ", ").concat(prefix).concat(finalSelector);
|
|
141
|
+
finalSelector = "".concat(prefix, " ").concat(finalSelector);
|
|
143
142
|
}
|
|
144
143
|
var transformedCss = {};
|
|
145
144
|
Object.entries(css).forEach(function (_ref9) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mybricks/to-code-taro",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "To code for Taro",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dev": "father dev",
|
|
10
10
|
"build": "father build",
|
|
11
11
|
"build:deps": "father prebundle",
|
|
12
|
-
"
|
|
12
|
+
"release": "node scripts/prepublish.js"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -36,11 +36,15 @@
|
|
|
36
36
|
"@types/crypto-js": "^4.2.2",
|
|
37
37
|
"crypto-js": "^4.2.0"
|
|
38
38
|
},
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"sharp": "^0.33.0"
|
|
41
|
+
},
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"@types/node": "^20.0.0",
|
|
41
44
|
"@types/react": "^18.0.0",
|
|
42
45
|
"csstype": "^3.1.3",
|
|
43
46
|
"father": "^4.5.1",
|
|
47
|
+
"inquirer": "^9.3.8",
|
|
44
48
|
"ts-node": "^10.9.2",
|
|
45
49
|
"ts-node-dev": "^2.0.0",
|
|
46
50
|
"tsx": "^4.21.0",
|