@cloudbase/framework-plugin-low-code 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/package.json +3 -3
  2. package/lib/builder/config/common.d.ts +0 -2
  3. package/lib/builder/config/common.d.ts.map +0 -1
  4. package/lib/builder/config/common.js +0 -13
  5. package/lib/builder/config/index.d.ts +0 -3
  6. package/lib/builder/config/index.d.ts.map +0 -1
  7. package/lib/builder/config/index.js +0 -29
  8. package/lib/builder/config/mp.d.ts +0 -2
  9. package/lib/builder/config/mp.d.ts.map +0 -1
  10. package/lib/builder/config/mp.js +0 -13
  11. package/lib/builder/core/copy.d.ts +0 -5
  12. package/lib/builder/core/copy.d.ts.map +0 -1
  13. package/lib/builder/core/copy.js +0 -62
  14. package/lib/builder/core/generate.d.ts +0 -9
  15. package/lib/builder/core/generate.d.ts.map +0 -1
  16. package/lib/builder/core/generate.js +0 -128
  17. package/lib/builder/core/index.d.ts +0 -32
  18. package/lib/builder/core/index.d.ts.map +0 -1
  19. package/lib/builder/core/index.js +0 -149
  20. package/lib/builder/core/material.d.ts +0 -4
  21. package/lib/builder/core/material.d.ts.map +0 -1
  22. package/lib/builder/core/material.js +0 -80
  23. package/lib/builder/core/plugin.d.ts +0 -4
  24. package/lib/builder/core/plugin.d.ts.map +0 -1
  25. package/lib/builder/core/plugin.js +0 -30
  26. package/lib/builder/core/prepare.d.ts +0 -8
  27. package/lib/builder/core/prepare.d.ts.map +0 -1
  28. package/lib/builder/core/prepare.js +0 -108
  29. package/lib/builder/core/webpack.d.ts +0 -15
  30. package/lib/builder/core/webpack.d.ts.map +0 -1
  31. package/lib/builder/core/webpack.js +0 -58
  32. package/lib/builder/mp/BuildContext.d.ts +0 -13
  33. package/lib/builder/mp/BuildContext.d.ts.map +0 -1
  34. package/lib/builder/mp/BuildContext.js +0 -2
  35. package/lib/builder/mp/index.d.ts +0 -33
  36. package/lib/builder/mp/index.d.ts.map +0 -1
  37. package/lib/builder/mp/index.js +0 -450
  38. package/lib/builder/mp/lowcode.d.ts +0 -8
  39. package/lib/builder/mp/lowcode.d.ts.map +0 -1
  40. package/lib/builder/mp/lowcode.js +0 -54
  41. package/lib/builder/mp/materials.d.ts +0 -15
  42. package/lib/builder/mp/materials.d.ts.map +0 -1
  43. package/lib/builder/mp/materials.js +0 -338
  44. package/lib/builder/mp/mixMode.d.ts +0 -10
  45. package/lib/builder/mp/mixMode.d.ts.map +0 -1
  46. package/lib/builder/mp/mixMode.js +0 -215
  47. package/lib/builder/mp/mp_config.d.ts +0 -18
  48. package/lib/builder/mp/mp_config.d.ts.map +0 -1
  49. package/lib/builder/mp/mp_config.js +0 -206
  50. package/lib/builder/mp/util.d.ts +0 -20
  51. package/lib/builder/mp/util.d.ts.map +0 -1
  52. package/lib/builder/mp/util.js +0 -243
  53. package/lib/builder/mp/wxml.d.ts +0 -16
  54. package/lib/builder/mp/wxml.d.ts.map +0 -1
  55. package/lib/builder/mp/wxml.js +0 -300
  56. package/lib/builder/service/builder/copy.d.ts +0 -14
  57. package/lib/builder/service/builder/copy.d.ts.map +0 -1
  58. package/lib/builder/service/builder/copy.js +0 -189
  59. package/lib/builder/service/builder/generate.d.ts +0 -52
  60. package/lib/builder/service/builder/generate.d.ts.map +0 -1
  61. package/lib/builder/service/builder/generate.js +0 -792
  62. package/lib/builder/service/builder/index.d.ts +0 -16
  63. package/lib/builder/service/builder/index.d.ts.map +0 -1
  64. package/lib/builder/service/builder/index.js +0 -69
  65. package/lib/builder/service/builder/plugin.d.ts +0 -8
  66. package/lib/builder/service/builder/plugin.d.ts.map +0 -1
  67. package/lib/builder/service/builder/plugin.js +0 -149
  68. package/lib/builder/service/builder/webpack.d.ts +0 -91
  69. package/lib/builder/service/builder/webpack.d.ts.map +0 -1
  70. package/lib/builder/service/builder/webpack.js +0 -589
  71. package/lib/builder/types/common.d.ts +0 -12
  72. package/lib/builder/types/common.d.ts.map +0 -1
  73. package/lib/builder/types/common.js +0 -7
  74. package/lib/builder/util/common.d.ts +0 -36
  75. package/lib/builder/util/common.d.ts.map +0 -1
  76. package/lib/builder/util/common.js +0 -257
  77. package/lib/builder/util/console.d.ts +0 -2
  78. package/lib/builder/util/console.d.ts.map +0 -1
  79. package/lib/builder/util/console.js +0 -13
  80. package/lib/builder/util/generateFiles.d.ts +0 -6
  81. package/lib/builder/util/generateFiles.d.ts.map +0 -1
  82. package/lib/builder/util/generateFiles.js +0 -94
  83. package/lib/builder/util/index.d.ts +0 -2
  84. package/lib/builder/util/index.d.ts.map +0 -1
  85. package/lib/builder/util/index.js +0 -13
  86. package/lib/builder/util/junk.d.ts +0 -3
  87. package/lib/builder/util/junk.d.ts.map +0 -1
  88. package/lib/builder/util/junk.js +0 -25
  89. package/lib/builder/util/mp.d.ts +0 -5
  90. package/lib/builder/util/mp.d.ts.map +0 -1
  91. package/lib/builder/util/mp.js +0 -99
  92. package/lib/builder/util/name-mangler.d.ts +0 -3
  93. package/lib/builder/util/name-mangler.d.ts.map +0 -1
  94. package/lib/builder/util/name-mangler.js +0 -7
  95. package/lib/builder/util/net.d.ts +0 -3
  96. package/lib/builder/util/net.d.ts.map +0 -1
  97. package/lib/builder/util/net.js +0 -54
  98. package/lib/builder/util/process.d.ts +0 -9
  99. package/lib/builder/util/process.d.ts.map +0 -1
  100. package/lib/builder/util/process.js +0 -28
  101. package/lib/builder/util/style.d.ts +0 -2
  102. package/lib/builder/util/style.d.ts.map +0 -1
  103. package/lib/builder/util/style.js +0 -13
  104. package/lib/builder/util/weapp.d.ts +0 -2
  105. package/lib/builder/util/weapp.d.ts.map +0 -1
  106. package/lib/builder/util/weapp.js +0 -13
  107. package/lib/config/private.d.ts +0 -3
  108. package/lib/config/private.d.ts.map +0 -1
  109. package/lib/config/private.js +0 -14
  110. package/lib/generate.d.ts +0 -2
  111. package/lib/generate.d.ts.map +0 -1
  112. package/lib/generate.js +0 -49
  113. package/lib/generator/config/common.d.ts +0 -6
  114. package/lib/generator/config/common.d.ts.map +0 -1
  115. package/lib/generator/config/common.js +0 -25
  116. package/lib/generator/config/index.d.ts +0 -18
  117. package/lib/generator/config/index.d.ts.map +0 -1
  118. package/lib/generator/config/index.js +0 -43
  119. package/lib/generator/config/mp.d.ts +0 -56
  120. package/lib/generator/config/mp.d.ts.map +0 -1
  121. package/lib/generator/config/mp.js +0 -104
  122. package/lib/generator/core/generate.d.ts +0 -59
  123. package/lib/generator/core/generate.d.ts.map +0 -1
  124. package/lib/generator/core/generate.js +0 -663
  125. package/lib/generator/core/index.d.ts +0 -25
  126. package/lib/generator/core/index.d.ts.map +0 -1
  127. package/lib/generator/core/index.js +0 -102
  128. package/lib/generator/core/material.d.ts +0 -14
  129. package/lib/generator/core/material.d.ts.map +0 -1
  130. package/lib/generator/core/material.js +0 -230
  131. package/lib/generator/template.d.ts +0 -3
  132. package/lib/generator/template.d.ts.map +0 -1
  133. package/lib/generator/template.js +0 -3
  134. package/lib/generator/types/common.d.ts +0 -69
  135. package/lib/generator/types/common.d.ts.map +0 -1
  136. package/lib/generator/types/common.js +0 -21
  137. package/lib/generator/util/common.d.ts +0 -36
  138. package/lib/generator/util/common.d.ts.map +0 -1
  139. package/lib/generator/util/common.js +0 -238
  140. package/lib/generator/util/console.d.ts +0 -3
  141. package/lib/generator/util/console.d.ts.map +0 -1
  142. package/lib/generator/util/console.js +0 -17
  143. package/lib/generator/util/index.d.ts +0 -2
  144. package/lib/generator/util/index.d.ts.map +0 -1
  145. package/lib/generator/util/index.js +0 -13
  146. package/lib/generator/util/name-mangler.d.ts +0 -17
  147. package/lib/generator/util/name-mangler.d.ts.map +0 -1
  148. package/lib/generator/util/name-mangler.js +0 -63
  149. package/lib/generator/util/postcss-rpx.d.ts +0 -11
  150. package/lib/generator/util/postcss-rpx.d.ts.map +0 -1
  151. package/lib/generator/util/postcss-rpx.js +0 -16
  152. package/lib/generator/util/style.d.ts +0 -6
  153. package/lib/generator/util/style.d.ts.map +0 -1
  154. package/lib/generator/util/style.js +0 -92
  155. package/lib/generator/util/weapp.d.ts +0 -5
  156. package/lib/generator/util/weapp.d.ts.map +0 -1
  157. package/lib/generator/util/weapp.js +0 -17
  158. package/lib/types.d.ts +0 -14
  159. package/lib/types.d.ts.map +0 -1
  160. package/lib/types.js +0 -19
  161. package/lib/utils/dataSource.d.ts +0 -28
  162. package/lib/utils/dataSource.d.ts.map +0 -1
  163. package/lib/utils/dataSource.js +0 -171
  164. package/lib/utils/postProcess.d.ts +0 -3
  165. package/lib/utils/postProcess.d.ts.map +0 -1
  166. package/lib/utils/postProcess.js +0 -48
  167. package/lib/weapps-core/config/index.d.ts +0 -2
  168. package/lib/weapps-core/config/index.d.ts.map +0 -1
  169. package/lib/weapps-core/config/index.js +0 -13
  170. package/lib/weapps-core/config/style.d.ts +0 -7
  171. package/lib/weapps-core/config/style.d.ts.map +0 -1
  172. package/lib/weapps-core/config/style.js +0 -70
  173. package/lib/weapps-core/index.d.ts +0 -6
  174. package/lib/weapps-core/index.d.ts.map +0 -1
  175. package/lib/weapps-core/index.js +0 -31
  176. package/lib/weapps-core/types/action.d.ts +0 -25
  177. package/lib/weapps-core/types/action.d.ts.map +0 -1
  178. package/lib/weapps-core/types/action.js +0 -28
  179. package/lib/weapps-core/types/app.d.ts +0 -142
  180. package/lib/weapps-core/types/app.d.ts.map +0 -1
  181. package/lib/weapps-core/types/app.js +0 -21
  182. package/lib/weapps-core/types/appbuild.d.ts +0 -63
  183. package/lib/weapps-core/types/appbuild.d.ts.map +0 -1
  184. package/lib/weapps-core/types/appbuild.js +0 -78
  185. package/lib/weapps-core/types/code_types.d.ts +0 -26
  186. package/lib/weapps-core/types/code_types.d.ts.map +0 -1
  187. package/lib/weapps-core/types/code_types.js +0 -2
  188. package/lib/weapps-core/types/git.d.ts +0 -7
  189. package/lib/weapps-core/types/git.d.ts.map +0 -1
  190. package/lib/weapps-core/types/git.js +0 -2
  191. package/lib/weapps-core/types/index.d.ts +0 -11
  192. package/lib/weapps-core/types/index.d.ts.map +0 -1
  193. package/lib/weapps-core/types/index.js +0 -22
  194. package/lib/weapps-core/types/lowcode.d.ts +0 -26
  195. package/lib/weapps-core/types/lowcode.d.ts.map +0 -1
  196. package/lib/weapps-core/types/lowcode.js +0 -25
  197. package/lib/weapps-core/types/material.d.ts +0 -90
  198. package/lib/weapps-core/types/material.d.ts.map +0 -1
  199. package/lib/weapps-core/types/material.js +0 -9
  200. package/lib/weapps-core/types/plugins.d.ts +0 -17
  201. package/lib/weapps-core/types/plugins.d.ts.map +0 -1
  202. package/lib/weapps-core/types/plugins.js +0 -2
  203. package/lib/weapps-core/types/style.d.ts +0 -93
  204. package/lib/weapps-core/types/style.d.ts.map +0 -1
  205. package/lib/weapps-core/types/style.js +0 -2
  206. package/lib/weapps-core/types/web.d.ts +0 -120
  207. package/lib/weapps-core/types/web.d.ts.map +0 -1
  208. package/lib/weapps-core/types/web.js +0 -2
  209. package/lib/weapps-core/utils/appbuild.d.ts +0 -6
  210. package/lib/weapps-core/utils/appbuild.d.ts.map +0 -1
  211. package/lib/weapps-core/utils/appbuild.js +0 -40
  212. package/lib/weapps-core/utils/common.d.ts +0 -16
  213. package/lib/weapps-core/utils/common.d.ts.map +0 -1
  214. package/lib/weapps-core/utils/common.js +0 -90
  215. package/lib/weapps-core/utils/file.d.ts +0 -12
  216. package/lib/weapps-core/utils/file.d.ts.map +0 -1
  217. package/lib/weapps-core/utils/file.js +0 -142
  218. package/lib/weapps-core/utils/formily.d.ts +0 -5
  219. package/lib/weapps-core/utils/formily.d.ts.map +0 -1
  220. package/lib/weapps-core/utils/formily.js +0 -416
  221. package/lib/weapps-core/utils/index.d.ts +0 -7
  222. package/lib/weapps-core/utils/index.d.ts.map +0 -1
  223. package/lib/weapps-core/utils/index.js +0 -18
  224. package/lib/weapps-core/utils/lowcdoe.d.ts +0 -4
  225. package/lib/weapps-core/utils/lowcdoe.d.ts.map +0 -1
  226. package/lib/weapps-core/utils/lowcdoe.js +0 -69
  227. package/lib/weapps-core/utils/style.d.ts +0 -17
  228. package/lib/weapps-core/utils/style.d.ts.map +0 -1
  229. package/lib/weapps-core/utils/style.js +0 -330
@@ -1,238 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.cleanVarName = exports.camelcase = exports.upperFirst = exports.getFileNameByUrl = exports.writeLibCommonRes2file = exports.getYyptConfigInfo = exports.getInputProps = exports.getComponentsInfo = exports.deepDealSchema = exports.JsonToStringWithVariableName = exports.simpleDeepClone = exports.deepDeal = exports.isPlainObject = exports.isArray = exports.getMetaInfoBySourceKey = exports.deepDealComponentSchemaJson = exports.promiseWrapper = void 0;
16
- const path_1 = __importDefault(require("path"));
17
- const url_1 = __importDefault(require("url"));
18
- const react_schema_renderer_1 = require("@formily/react-schema-renderer");
19
- function promiseWrapper(p) {
20
- return new Promise((resolve) => {
21
- try {
22
- p.then((i) => resolve([null, i])).catch((e) => resolve([e, null]));
23
- }
24
- catch (e) {
25
- resolve([e, null]);
26
- }
27
- });
28
- }
29
- exports.promiseWrapper = promiseWrapper;
30
- function deepDealComponentSchemaJson(schema, dealFn) {
31
- if (!schema)
32
- return;
33
- dealFn(schema);
34
- if (schema.properties) {
35
- Object.keys(schema.properties).forEach((key) => {
36
- var _a;
37
- const childSchema = (_a = schema === null || schema === void 0 ? void 0 : schema.properties) === null || _a === void 0 ? void 0 : _a[key];
38
- if (childSchema) {
39
- deepDealComponentSchemaJson(childSchema, dealFn);
40
- }
41
- });
42
- }
43
- }
44
- exports.deepDealComponentSchemaJson = deepDealComponentSchemaJson;
45
- function getMetaInfoBySourceKey(sourceKey) {
46
- if (!sourceKey) {
47
- return {};
48
- }
49
- const [materialName, name] = sourceKey.split(':');
50
- return {
51
- materialName,
52
- name,
53
- variableName: camelcase(materialName + '_' + name),
54
- };
55
- }
56
- exports.getMetaInfoBySourceKey = getMetaInfoBySourceKey;
57
- function isArray(src) {
58
- return Object.prototype.toString.call(src) === '[object Array]';
59
- }
60
- exports.isArray = isArray;
61
- function isPlainObject(src) {
62
- return Object.prototype.toString.call(src) === '[object Object]';
63
- }
64
- exports.isPlainObject = isPlainObject;
65
- function deepDeal(src, reviver) {
66
- if (isArray(src)) {
67
- for (let i = 0, len = src.length; i < len; i++) {
68
- deepDeal(src[i], reviver);
69
- reviver === null || reviver === void 0 ? void 0 : reviver(i, src[i], src);
70
- }
71
- }
72
- if (isPlainObject(src)) {
73
- for (const key in src) {
74
- if (src.hasOwnProperty(key)) {
75
- deepDeal(src[key], reviver);
76
- reviver === null || reviver === void 0 ? void 0 : reviver(key, src[key], src);
77
- }
78
- }
79
- }
80
- }
81
- exports.deepDeal = deepDeal;
82
- function simpleDeepClone(data) {
83
- return JSON.parse(JSON.stringify(data));
84
- }
85
- exports.simpleDeepClone = simpleDeepClone;
86
- function JsonToStringWithVariableName(copyJson, options) {
87
- let variable = JSON.stringify(copyJson, null, 2)
88
- .replace(/"%%%(.*?)%%%"/g, function (match, expression) {
89
- return expression.replace(/\\"/g, '"');
90
- })
91
- .replace(/\\'/g, "'");
92
- if (options.EOL) {
93
- variable = variable.replace(/\\n/g, '\n').replace(/\\r/g, '\r');
94
- }
95
- return variable;
96
- }
97
- exports.JsonToStringWithVariableName = JsonToStringWithVariableName;
98
- function deepDealSchema(sourceSchema, deal) {
99
- const fieldSchema = new react_schema_renderer_1.Schema(sourceSchema);
100
- if (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.isObject()) {
101
- Object.keys(fieldSchema.properties || {}).forEach((key) => {
102
- var _a, _b;
103
- const schema = (_a = fieldSchema.properties) === null || _a === void 0 ? void 0 : _a[key];
104
- const { 'x-props': xProps } = schema || {};
105
- if (((_b = xProps === null || xProps === void 0 ? void 0 : xProps['data']) === null || _b === void 0 ? void 0 : _b._visible) === false) {
106
- fieldSchema.setProperty(key, new react_schema_renderer_1.Schema({}));
107
- }
108
- else if (schema) {
109
- deepDealSchema(schema, deal);
110
- deal === null || deal === void 0 ? void 0 : deal(schema, key);
111
- }
112
- });
113
- }
114
- return fieldSchema.toJSON();
115
- }
116
- exports.deepDealSchema = deepDealSchema;
117
- function getComponentsInfo(appBuildDir, dependencies, fileCodeMap) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- const outputObj = {};
120
- yield Promise.all(dependencies.map(({ name: materialName, components, isComposite }) => __awaiter(this, void 0, void 0, function* () {
121
- if (isComposite) {
122
- components.forEach((component) => {
123
- let compItem = component;
124
- const sourceKey = `${materialName}:${compItem.name}`;
125
- outputObj[sourceKey] = Object.assign({ isComposite }, compItem);
126
- });
127
- }
128
- else {
129
- yield Promise.all(components.map(({ name, meta, emitEvents, events = undefined, compConfig, }) => __awaiter(this, void 0, void 0, function* () {
130
- outputObj[materialName + ':' + name] = Object.assign(Object.assign({ isComposite }, meta), { events,
131
- emitEvents,
132
- compConfig });
133
- })));
134
- }
135
- })));
136
- return outputObj;
137
- });
138
- }
139
- exports.getComponentsInfo = getComponentsInfo;
140
- function getInputProps(componentsMetaMap) {
141
- const outputObj = {};
142
- for (let key in componentsMetaMap) {
143
- let component = componentsMetaMap[key];
144
- const sourceKey = key;
145
- if (component.isComposite) {
146
- let compItem = component;
147
- Object.keys(compItem.dataForm || {}).forEach((key) => {
148
- var _a, _b;
149
- const inputProps = ((_a = compItem.dataForm[key]) === null || _a === void 0 ? void 0 : _a.inputProp) || ((_b = compItem.dataForm[key]) === null || _b === void 0 ? void 0 : _b.syncProp);
150
- if (inputProps) {
151
- outputObj[sourceKey] = Object.assign({ [key]: inputProps }, (outputObj[sourceKey] || {}));
152
- }
153
- });
154
- }
155
- else {
156
- const inputProps = (component === null || component === void 0 ? void 0 : component.inputProps) || (component === null || component === void 0 ? void 0 : component.syncProps);
157
- if (inputProps) {
158
- outputObj[sourceKey] = inputProps;
159
- }
160
- }
161
- }
162
- return outputObj;
163
- }
164
- exports.getInputProps = getInputProps;
165
- function getYyptConfigInfo(extraData) {
166
- return __awaiter(this, void 0, void 0, function* () {
167
- const configJson = {
168
- yyptAppKey: '',
169
- reportUrl: '',
170
- stopReport: 'true',
171
- };
172
- if (!extraData || !extraData.operationService) {
173
- extraData = extraData || {};
174
- extraData.operationService = extraData.operationService || {
175
- yyptEnabled: true,
176
- };
177
- }
178
- const yyptAppKey = configJson.yyptAppKey || extraData.operationService.extAppId || '';
179
- const reportUrl = configJson.reportUrl || extraData.operationService.reportUrl || '';
180
- const stopReport = configJson.stopReport === 'true' || !extraData.operationService.yyptEnabled;
181
- return {
182
- yyptAppKey,
183
- reportUrl,
184
- stopReport,
185
- };
186
- });
187
- }
188
- exports.getYyptConfigInfo = getYyptConfigInfo;
189
- function writeLibCommonRes2file(gItem, codeDir) {
190
- return __awaiter(this, void 0, void 0, function* () {
191
- const compLibCommonResource = gItem.compLibCommonResource;
192
- const libCommonResFiles = [];
193
- libCommonResFiles.push({
194
- path: path_1.default.join(codeDir, `class.less`),
195
- code: `
196
- ${compLibCommonResource.theme.variable || ''}
197
- ${compLibCommonResource.class || ''}
198
- ${compLibCommonResource.theme.class || ''}
199
- `,
200
- }, {
201
- path: path_1.default.join(codeDir, 'const.js'),
202
- code: compLibCommonResource ? compLibCommonResource.const.code : '',
203
- }, {
204
- path: path_1.default.join(codeDir, 'tools.js'),
205
- code: compLibCommonResource ? compLibCommonResource.tools.code : '',
206
- });
207
- return libCommonResFiles.reduce((ret, item) => {
208
- ret[item.path] = {
209
- code: item.code,
210
- };
211
- return ret;
212
- }, {});
213
- });
214
- }
215
- exports.writeLibCommonRes2file = writeLibCommonRes2file;
216
- function getFileNameByUrl(fileUrl) {
217
- const parsedUrl = url_1.default.parse(fileUrl);
218
- const filename = path_1.default.basename((parsedUrl === null || parsedUrl === void 0 ? void 0 : parsedUrl.pathname) || '');
219
- return filename;
220
- }
221
- exports.getFileNameByUrl = getFileNameByUrl;
222
- function upperFirst(str) {
223
- return str[0].toUpperCase() + str.slice(1);
224
- }
225
- exports.upperFirst = upperFirst;
226
- function camelcase(str, firstUpperCase = false) {
227
- str = str.replace(/[\:_-]([a-zA-Z])/g, function (l) {
228
- return l[1].toUpperCase();
229
- });
230
- if (firstUpperCase)
231
- str = str.charAt(0).toUpperCase() + str.slice(1);
232
- return str;
233
- }
234
- exports.camelcase = camelcase;
235
- function cleanVarName(name) {
236
- return name.replace(/[@-]/g, '_');
237
- }
238
- exports.cleanVarName = cleanVarName;
@@ -1,3 +0,0 @@
1
- export declare function notice(...msg: any[]): void;
2
- export declare function log(...msg: any[]): void;
3
- //# sourceMappingURL=console.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/generator/util/console.ts"],"names":[],"mappings":"AACA,wBAAgB,MAAM,CAAC,GAAG,GAAG,OAAA,QAY5B;AAED,wBAAgB,GAAG,CAAC,GAAG,GAAG,OAAA,QAEzB"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.log = exports.notice = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- function notice(...msg) {
9
- console.log(chalk_1.default.yellowBright.bold('~~~~~~~~~~~~~~~~~~~~~~~~~~~~我是notice分割线-start~~~~~~~~~~~~~~~~~~~~~~~~~~~'));
10
- console.log(...msg.map(item => chalk_1.default.yellow(item)));
11
- console.log(chalk_1.default.yellowBright.bold('~~~~~~~~~~~~~~~~~~~~~~~~~~~~我是notice分割线-end~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'));
12
- }
13
- exports.notice = notice;
14
- function log(...msg) {
15
- console.log(...msg.map(item => chalk_1.default.hex(item)));
16
- }
17
- exports.log = log;
@@ -1,2 +0,0 @@
1
- export * from './common';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generator/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./common"), exports);
@@ -1,17 +0,0 @@
1
- export default class NameMangler {
2
- current?: string[];
3
- mangled: {
4
- [name: string]: string;
5
- };
6
- private leadingChars;
7
- private candidateChars;
8
- private blackList;
9
- constructor(opts?: {
10
- leadingCharRanges?: string[];
11
- candidateCharRanges?: string[];
12
- blackList?: string[];
13
- });
14
- private next;
15
- mangle(name: string): string;
16
- }
17
- //# sourceMappingURL=name-mangler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"name-mangler.d.ts","sourceRoot":"","sources":["../../../src/generator/util/name-mangler.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;IAEzC,OAAO,CAAC,YAAY,CAAW;IAC/B,OAAO,CAAC,cAAc,CAAW;IACjC,OAAO,CAAC,SAAS,CAAW;gBAG1B,IAAI,GAAE;QACJ,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC7B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB;IAgBR,OAAO,CAAC,IAAI;IAyBZ,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAW7B"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class NameMangler {
4
- constructor(opts = {}) {
5
- this.mangled = {};
6
- const leadingCharRanges = opts.leadingCharRanges || ['a', 'z', 'A', 'Z'];
7
- const candidateCharRanges = opts.candidateCharRanges || [
8
- 'a',
9
- 'z',
10
- 'A',
11
- 'Z',
12
- '0',
13
- '9',
14
- ];
15
- this.leadingChars = createCharsFromRanges(leadingCharRanges);
16
- this.candidateChars = createCharsFromRanges(candidateCharRanges);
17
- this.blackList = opts.blackList || [];
18
- }
19
- next() {
20
- if (!this.current) {
21
- this.current = [this.leadingChars[0]];
22
- return this.current.join('');
23
- }
24
- const len = this.current.length;
25
- for (let i = len - 1; i >= 0; i--) {
26
- const chars = i === 0 ? this.leadingChars : this.candidateChars;
27
- const curCharIdx = chars.indexOf(this.current[i]);
28
- if (curCharIdx < chars.length - 1) {
29
- this.current[i] = chars[curCharIdx + 1];
30
- break;
31
- }
32
- else if (i === 0) {
33
- this.current[i] = chars[0];
34
- this.current.push(chars[0]);
35
- }
36
- else {
37
- this.current[i] = chars[0];
38
- }
39
- }
40
- return this.current.join('');
41
- }
42
- mangle(name) {
43
- let mangled = this.mangled[name];
44
- if (!mangled) {
45
- mangled = this.next();
46
- if (this.blackList.indexOf(mangled) > -1) {
47
- return this.mangle(name);
48
- }
49
- this.mangled[name] = mangled;
50
- }
51
- return mangled;
52
- }
53
- }
54
- exports.default = NameMangler;
55
- function createCharsFromRanges(range) {
56
- const chars = [];
57
- for (let i = 0; i + 1 < range.length; i += 2) {
58
- for (let code = range[i].charCodeAt(0); code <= range[i + 1].charCodeAt(0); code++) {
59
- chars.push(String.fromCharCode(code));
60
- }
61
- }
62
- return chars;
63
- }
@@ -1,11 +0,0 @@
1
- declare const plugin: {
2
- (opts?: {}): {
3
- postcssPlugin: string;
4
- Once(root: any, { result }: {
5
- result: any;
6
- }): void;
7
- };
8
- postcss: boolean;
9
- };
10
- export default plugin;
11
- //# sourceMappingURL=postcss-rpx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postcss-rpx.d.ts","sourceRoot":"","sources":["../../../src/generator/util/postcss-rpx.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,MAAM;;;;;;;;CAWX,CAAC;AAGF,eAAe,MAAM,CAAC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const plugin = (opts = {}) => {
4
- const { zoom = 1 } = opts || {};
5
- const pxRegExp = /\b(\d+(\.\d+)?)px\b/g;
6
- return {
7
- postcssPlugin: 'wx-px2rpx',
8
- Once(root, { result }) {
9
- root.replaceValues(pxRegExp, { fast: 'px' }, (string) => {
10
- return `${zoom * parseInt(string)}rpx`;
11
- });
12
- },
13
- };
14
- };
15
- plugin.postcss = true;
16
- exports.default = plugin;
@@ -1,6 +0,0 @@
1
- export declare const defaultThemeCode = "\n@example-primary-color: blue;\n// \u6DF7\u7528 ( Mixin )\n/**\n * \u53EF\u4EE5 \u5728\u5168\u5C40style\uFF0C\u6216\u8005\u9875\u9762\u7684style\u4E2D\u4F7F\u7528.mixins()\n * .a {\n color: #111;\n .mixins();\n }\n\n .b {\n color: red;\n .mixins(red);\n }\n * \uFF08\u53CB\u60C5\u63D0\u793A\uFF1A\u4E0D\u5EFA\u8BAEtheme\u4E2D\u4E66\u5199\u5177\u4F53\u7684\u7C7B\u6837\u5F0F\uFF0C \u6216\u8005\u4E0D\u5E26\u62EC\u53F7\u7684mixin\uFF0C\u4F1A\u5BFC\u81F4\u4EE3\u7801\u91CD\u590D\u7F16\u8BD1 \uFF09\n **/\n.mixins(@color: red) {\n display:block;\n padding: 40px;\n background: @color;\n text-decoration:none;\n}\n";
2
- export declare function processLess(lessCode: string): Promise<string>;
3
- export declare function processLessToRpx(lessCode: string): Promise<string>;
4
- export declare function generateDefaultTheme(data: any): any;
5
- export declare function generateDefaultStyle(data: any): void;
6
- //# sourceMappingURL=style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/generator/util/style.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,yoBAsB5B,CAAC;AAEF,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,mBAIjD;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,mBAItD;AAGD,wBAAgB,oBAAoB,CAAC,IAAI,KAAA,OAexC;AAED,wBAAgB,oBAAoB,CAAC,IAAI,KAAA,QAYxC"}
@@ -1,92 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.generateDefaultStyle = exports.generateDefaultTheme = exports.processLessToRpx = exports.processLess = exports.defaultThemeCode = void 0;
16
- const postcss_1 = __importDefault(require("postcss"));
17
- const less_1 = __importDefault(require("less"));
18
- const postcss_pxtorem_1 = __importDefault(require("postcss-pxtorem"));
19
- const postcss_rpx_1 = __importDefault(require("./postcss-rpx"));
20
- const config_1 = require("../config");
21
- const THEME = 'theme';
22
- const STYLE = 'style';
23
- exports.defaultThemeCode = `
24
- @example-primary-color: blue;
25
- // 混用 ( Mixin )
26
- /**
27
- * 可以 在全局style,或者页面的style中使用.mixins()
28
- * .a {
29
- color: #111;
30
- .mixins();
31
- }
32
-
33
- .b {
34
- color: red;
35
- .mixins(red);
36
- }
37
- * (友情提示:不建议theme中书写具体的类样式, 或者不带括号的mixin,会导致代码重复编译 )
38
- **/
39
- .mixins(@color: red) {
40
- display:block;
41
- padding: 40px;
42
- background: @color;
43
- text-decoration:none;
44
- }
45
- `;
46
- function processLess(lessCode) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- const { css: lessCss } = yield less_1.default.render(lessCode);
49
- const { css: remCss } = yield (0, postcss_1.default)([(0, postcss_pxtorem_1.default)(config_1.remConfig)]).process(lessCss);
50
- return remCss;
51
- });
52
- }
53
- exports.processLess = processLess;
54
- function processLessToRpx(lessCode) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- const { css: lessCss } = yield less_1.default.render(lessCode);
57
- const { css: rpxCss } = yield (0, postcss_1.default)([(0, postcss_rpx_1.default)(config_1.rpxConfig)]).process(lessCss);
58
- return rpxCss;
59
- });
60
- }
61
- exports.processLessToRpx = processLessToRpx;
62
- function generateDefaultTheme(data) {
63
- const lowCodes = data.lowCodes || data.codeModules || [];
64
- const isHasTheme = lowCodes.find((item) => item.type === THEME);
65
- if (!isHasTheme) {
66
- const themeStyle = {
67
- type: THEME,
68
- name: THEME,
69
- code: exports.defaultThemeCode,
70
- path: `global/${THEME}`,
71
- system: true,
72
- };
73
- lowCodes.unshift(themeStyle);
74
- return themeStyle;
75
- }
76
- return isHasTheme;
77
- }
78
- exports.generateDefaultTheme = generateDefaultTheme;
79
- function generateDefaultStyle(data) {
80
- const lowCodes = data.lowCodes || data.codeModules || [];
81
- const isHasSTYLE = lowCodes.find((item) => item.type === STYLE);
82
- if (!isHasSTYLE) {
83
- lowCodes.unshift({
84
- type: STYLE,
85
- name: STYLE,
86
- code: '',
87
- path: `${data.id}/${STYLE}`,
88
- system: true,
89
- });
90
- }
91
- }
92
- exports.generateDefaultStyle = generateDefaultStyle;
@@ -1,5 +0,0 @@
1
- import { IWeAppComponentInstance } from '../../weapps-core';
2
- export declare function walkThroughWidgets(widgets: {
3
- [key: string]: IWeAppComponentInstance;
4
- }, fn: (id: string, widget: IWeAppComponentInstance, parentId: string) => void, currentId?: string): void;
5
- //# sourceMappingURL=weapp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"weapp.d.ts","sourceRoot":"","sources":["../../../src/generator/util/weapp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,wBAAgB,kBAAkB,CAChC,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAE,EACnD,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,EAC3E,SAAS,CAAC,EAAE,MAAM,QAYnB"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.walkThroughWidgets = void 0;
4
- function walkThroughWidgets(widgets, fn, currentId) {
5
- var _a;
6
- for (const id in widgets) {
7
- const { properties: children, xComponent, xProps } = widgets[id];
8
- const { directives } = xProps || {};
9
- if (((_a = directives === null || directives === void 0 ? void 0 : directives.waIf) === null || _a === void 0 ? void 0 : _a.value) === false) {
10
- continue;
11
- }
12
- const isSlot = !xComponent;
13
- !isSlot && fn(id, widgets[id], currentId);
14
- children && walkThroughWidgets(children, fn, isSlot ? currentId : id);
15
- }
16
- }
17
- exports.walkThroughWidgets = walkThroughWidgets;
package/lib/types.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export declare enum DEPLOY_MODE {
2
- PREVIEW = "preview",
3
- UPLOAD = "upload"
4
- }
5
- export declare enum RUNTIME {
6
- CI = "CI",
7
- NONE = "",
8
- CLI = "CLI"
9
- }
10
- export declare enum HISTORY_TYPE {
11
- BROWSER = "BROWSER",
12
- HASH = "HASH"
13
- }
14
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,oBAAY,OAAO;IACjB,EAAE,OAAO;IACT,IAAI,KAAK;IACT,GAAG,QAAQ;CACZ;AAED,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,IAAI,SAAS;CACd"}
package/lib/types.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HISTORY_TYPE = exports.RUNTIME = exports.DEPLOY_MODE = void 0;
4
- var DEPLOY_MODE;
5
- (function (DEPLOY_MODE) {
6
- DEPLOY_MODE["PREVIEW"] = "preview";
7
- DEPLOY_MODE["UPLOAD"] = "upload";
8
- })(DEPLOY_MODE = exports.DEPLOY_MODE || (exports.DEPLOY_MODE = {}));
9
- var RUNTIME;
10
- (function (RUNTIME) {
11
- RUNTIME["CI"] = "CI";
12
- RUNTIME["NONE"] = "";
13
- RUNTIME["CLI"] = "CLI";
14
- })(RUNTIME = exports.RUNTIME || (exports.RUNTIME = {}));
15
- var HISTORY_TYPE;
16
- (function (HISTORY_TYPE) {
17
- HISTORY_TYPE["BROWSER"] = "BROWSER";
18
- HISTORY_TYPE["HASH"] = "HASH";
19
- })(HISTORY_TYPE = exports.HISTORY_TYPE || (exports.HISTORY_TYPE = {}));
@@ -1,28 +0,0 @@
1
- import { IWebRuntimeAppData } from 'src/weapps-core';
2
- export declare const CLOUD_FUNCTION_TYPE = "cloud-function";
3
- export declare const EXTERNAL_FUNCTION_TYPE = "http";
4
- export declare const DATABASE_TYPE = "database";
5
- export declare function getDatasourceResourceName(datasrouce: any, mode: any): string;
6
- export declare function getAppDatasourceResourceName(appId: any, datasrouce: any, mode: any): string;
7
- export declare function getDatasourceDatabaseName(dsConfig: any, mode: any): string | null;
8
- export declare function mergeDependencies(...pkgs: any[]): {};
9
- export declare function lowercaseKey(obj: any, deep?: boolean): any;
10
- export declare function standardizeDataSource(ds: any): any;
11
- export declare function getDatasourceProfiles(datasources: any): any;
12
- export declare function getDataVarProfiles(appData: IWebRuntimeAppData): {
13
- $global: any[];
14
- };
15
- export declare function getDatasetProfiles(mainAppData: {
16
- dataset?: any;
17
- rootPath?: string;
18
- pageInstanceList?: {
19
- dataset?: any;
20
- }[];
21
- }, apps?: {
22
- dataset?: any;
23
- rootPath?: string;
24
- pageInstanceList?: {
25
- dataset?: any;
26
- }[];
27
- }[]): {};
28
- //# sourceMappingURL=dataSource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../src/utils/dataSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAiB,MAAM,iBAAiB,CAAC;AAMpE,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,aAAa,aAAa,CAAC;AAMxC,wBAAgB,yBAAyB,CAAC,UAAU,KAAA,EAAE,IAAI,KAAA,UAGzD;AAED,wBAAgB,4BAA4B,CAAC,KAAK,KAAA,EAAE,UAAU,KAAA,EAAE,IAAI,KAAA,UAGnE;AAMD,wBAAgB,yBAAyB,CAAC,QAAQ,KAAA,EAAE,IAAI,KAAA,iBAIvD;AAMD,wBAAgB,iBAAiB,CAAC,GAAG,IAAI,OAAA,MAexC;AAmBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,CAU1D;AAOD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,GAAG,OA6C5C;AAOD,wBAAgB,qBAAqB,CAAC,WAAW,KAAA,OAehD;AAOD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB;;EAU7D;AAiCD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE;IACX,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;CACxC,EACD,IAAI,CAAC,EAAE;IACL,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,GAAG,CAAA;KAAE,EAAE,CAAC;CACxC,EAAE,MAiBJ"}