@weapp-core/schematics 0.0.0 → 0.0.1
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.cjs +44 -30
- package/dist/index.d.cts +322 -12
- package/dist/index.d.ts +322 -12
- package/dist/index.js +40 -19
- package/package.json +2 -6
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,42 +15,58 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
31
21
|
var src_exports = {};
|
|
32
22
|
__export(src_exports, {
|
|
33
|
-
|
|
23
|
+
generateJs: () => generateJs,
|
|
24
|
+
generateJson: () => generateJson,
|
|
25
|
+
generateWxml: () => generateWxml,
|
|
26
|
+
generateWxss: () => generateWxss
|
|
34
27
|
});
|
|
35
28
|
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
29
|
+
function generateJs(type) {
|
|
30
|
+
if (type === "app") {
|
|
31
|
+
return `App({})`;
|
|
32
|
+
} else if (type === "page") {
|
|
33
|
+
return `Page({})`;
|
|
34
|
+
} else {
|
|
35
|
+
return `Component({})`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function generateWxss() {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
function generateWxml(text) {
|
|
42
|
+
return `<view>${text ?? "hello weapp-vite!"}</view>`;
|
|
43
|
+
}
|
|
44
|
+
function generateJson(type) {
|
|
45
|
+
if (type === "app") {
|
|
46
|
+
return {
|
|
47
|
+
$schema: "https://vite.icebreaker.top/app.json",
|
|
48
|
+
usingComponents: {},
|
|
49
|
+
pages: [
|
|
50
|
+
"pages/index/index"
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
} else if (type === "page") {
|
|
54
|
+
return {
|
|
55
|
+
$schema: "https://vite.icebreaker.top/page.json",
|
|
56
|
+
usingComponents: {}
|
|
57
|
+
};
|
|
58
|
+
} else {
|
|
59
|
+
return {
|
|
60
|
+
$schema: "https://vite.icebreaker.top/component.json",
|
|
61
|
+
component: true,
|
|
62
|
+
usingComponents: {}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
54
65
|
}
|
|
55
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
67
|
0 && (module.exports = {
|
|
57
|
-
|
|
68
|
+
generateJs,
|
|
69
|
+
generateJson,
|
|
70
|
+
generateWxml,
|
|
71
|
+
generateWxss
|
|
58
72
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,324 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 全局配置, 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。
|
|
8
|
+
*/
|
|
9
|
+
interface App {
|
|
10
|
+
/**
|
|
11
|
+
* 指定小程序的默认启动路径(首页),常见情景是从微信聊天列表页下拉启动、小程序列表启动等。如果不填,将默认为 pages 列表的第一项。不支持带页面路径参数。
|
|
12
|
+
*/
|
|
13
|
+
entryPagePath?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 用于指定小程序由哪些页面组成,每一项都对应一个页面的 路径(含文件名) 信息。文件名不需要写文件后缀,框架会自动去寻找对应位置的 .json, .js, .wxml, .wxss 四个文件进行处理。
|
|
16
|
+
*/
|
|
17
|
+
pages: string[];
|
|
18
|
+
window?: {
|
|
19
|
+
navigationBarBackgroundColor?: string;
|
|
20
|
+
navigationBarTextStyle?: string;
|
|
21
|
+
navigationBarTitleText?: string;
|
|
22
|
+
navigationStyle?: "default" | "custom";
|
|
23
|
+
homeButton?: boolean;
|
|
24
|
+
backgroundColor?: string;
|
|
25
|
+
backgroundTextStyle?: "dark" | "light";
|
|
26
|
+
backgroundColorTop?: string;
|
|
27
|
+
backgroundColorBottom?: string;
|
|
28
|
+
enablePullDownRefresh?: boolean;
|
|
29
|
+
onReachBottomDistance?: number;
|
|
30
|
+
pageOrientation?: "portrait" | "auto" | "landscape";
|
|
31
|
+
restartStrategy?: "homePage" | "homePageAndLatestPage";
|
|
32
|
+
initialRenderingCache?: "static" | "dynamic";
|
|
33
|
+
visualEffectInBackground?: "none" | "hidden";
|
|
34
|
+
handleWebviewPreload?: "static" | "manual" | "auto";
|
|
35
|
+
[k: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
tabBar?: {
|
|
38
|
+
color: string;
|
|
39
|
+
selectedColor: string;
|
|
40
|
+
backgroundColor: string;
|
|
41
|
+
borderStyle?: "black" | "white";
|
|
42
|
+
/**
|
|
43
|
+
* @minItems 2
|
|
44
|
+
* @maxItems 5
|
|
45
|
+
*/
|
|
46
|
+
list: [
|
|
47
|
+
{
|
|
48
|
+
pagePath: string;
|
|
49
|
+
text: string;
|
|
50
|
+
iconPath?: string;
|
|
51
|
+
selectedIconPath?: string;
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
pagePath: string;
|
|
56
|
+
text: string;
|
|
57
|
+
iconPath?: string;
|
|
58
|
+
selectedIconPath?: string;
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
] | [
|
|
62
|
+
{
|
|
63
|
+
pagePath: string;
|
|
64
|
+
text: string;
|
|
65
|
+
iconPath?: string;
|
|
66
|
+
selectedIconPath?: string;
|
|
67
|
+
[k: string]: unknown;
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
pagePath: string;
|
|
71
|
+
text: string;
|
|
72
|
+
iconPath?: string;
|
|
73
|
+
selectedIconPath?: string;
|
|
74
|
+
[k: string]: unknown;
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
pagePath: string;
|
|
78
|
+
text: string;
|
|
79
|
+
iconPath?: string;
|
|
80
|
+
selectedIconPath?: string;
|
|
81
|
+
[k: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
] | [
|
|
84
|
+
{
|
|
85
|
+
pagePath: string;
|
|
86
|
+
text: string;
|
|
87
|
+
iconPath?: string;
|
|
88
|
+
selectedIconPath?: string;
|
|
89
|
+
[k: string]: unknown;
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pagePath: string;
|
|
93
|
+
text: string;
|
|
94
|
+
iconPath?: string;
|
|
95
|
+
selectedIconPath?: string;
|
|
96
|
+
[k: string]: unknown;
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
pagePath: string;
|
|
100
|
+
text: string;
|
|
101
|
+
iconPath?: string;
|
|
102
|
+
selectedIconPath?: string;
|
|
103
|
+
[k: string]: unknown;
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
pagePath: string;
|
|
107
|
+
text: string;
|
|
108
|
+
iconPath?: string;
|
|
109
|
+
selectedIconPath?: string;
|
|
110
|
+
[k: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
] | [
|
|
113
|
+
{
|
|
114
|
+
pagePath: string;
|
|
115
|
+
text: string;
|
|
116
|
+
iconPath?: string;
|
|
117
|
+
selectedIconPath?: string;
|
|
118
|
+
[k: string]: unknown;
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
pagePath: string;
|
|
122
|
+
text: string;
|
|
123
|
+
iconPath?: string;
|
|
124
|
+
selectedIconPath?: string;
|
|
125
|
+
[k: string]: unknown;
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
pagePath: string;
|
|
129
|
+
text: string;
|
|
130
|
+
iconPath?: string;
|
|
131
|
+
selectedIconPath?: string;
|
|
132
|
+
[k: string]: unknown;
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
pagePath: string;
|
|
136
|
+
text: string;
|
|
137
|
+
iconPath?: string;
|
|
138
|
+
selectedIconPath?: string;
|
|
139
|
+
[k: string]: unknown;
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
pagePath: string;
|
|
143
|
+
text: string;
|
|
144
|
+
iconPath?: string;
|
|
145
|
+
selectedIconPath?: string;
|
|
146
|
+
[k: string]: unknown;
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
position?: "bottom" | "top";
|
|
150
|
+
custom?: boolean;
|
|
151
|
+
[k: string]: unknown;
|
|
152
|
+
};
|
|
153
|
+
networkTimeout?: {
|
|
154
|
+
request?: number;
|
|
155
|
+
connectSocket?: number;
|
|
156
|
+
uploadFile?: number;
|
|
157
|
+
downloadFile?: number;
|
|
158
|
+
[k: string]: unknown;
|
|
159
|
+
};
|
|
160
|
+
debug?: boolean;
|
|
161
|
+
functionalPages?: boolean;
|
|
162
|
+
subpackages?: {
|
|
163
|
+
root?: string;
|
|
164
|
+
name?: string;
|
|
165
|
+
pages?: string[];
|
|
166
|
+
independent?: boolean;
|
|
167
|
+
entry?: string;
|
|
168
|
+
[k: string]: unknown;
|
|
169
|
+
}[];
|
|
170
|
+
workers?: string;
|
|
171
|
+
requiredBackgroundModes?: string[];
|
|
172
|
+
requiredPrivateInfos?: string[];
|
|
173
|
+
plugins?: {
|
|
174
|
+
[k: string]: unknown;
|
|
175
|
+
};
|
|
176
|
+
preloadRule?: {
|
|
177
|
+
[k: string]: unknown;
|
|
178
|
+
};
|
|
179
|
+
resizable?: boolean;
|
|
180
|
+
permission?: {
|
|
181
|
+
[k: string]: unknown;
|
|
182
|
+
};
|
|
183
|
+
sitemapLocation?: string;
|
|
184
|
+
useExtendedLib?: {
|
|
185
|
+
[k: string]: unknown;
|
|
186
|
+
};
|
|
187
|
+
entranceDeclare?: {
|
|
188
|
+
[k: string]: unknown;
|
|
189
|
+
};
|
|
190
|
+
darkmode?: boolean;
|
|
191
|
+
themeLocation?: string;
|
|
192
|
+
lazyCodeLoading?: string;
|
|
193
|
+
supportedMaterials?: {
|
|
194
|
+
[k: string]: unknown;
|
|
195
|
+
};
|
|
196
|
+
serviceProviderTicket?: string;
|
|
197
|
+
embeddedAppIdList?: string[];
|
|
198
|
+
halfPage?: {
|
|
199
|
+
[k: string]: unknown;
|
|
200
|
+
};
|
|
201
|
+
debugOptions?: {
|
|
202
|
+
[k: string]: unknown;
|
|
203
|
+
};
|
|
204
|
+
resolveAlias?: {
|
|
205
|
+
[k: string]: unknown;
|
|
206
|
+
};
|
|
207
|
+
miniApp?: {
|
|
208
|
+
[k: string]: unknown;
|
|
209
|
+
};
|
|
210
|
+
static?: {
|
|
211
|
+
[k: string]: unknown;
|
|
212
|
+
};
|
|
213
|
+
convertRpxToVw?: boolean;
|
|
214
|
+
style?: string;
|
|
215
|
+
singlePage?: {
|
|
216
|
+
[k: string]: unknown;
|
|
217
|
+
};
|
|
218
|
+
enablePassiveEvent?: {
|
|
219
|
+
[k: string]: unknown;
|
|
220
|
+
} | boolean;
|
|
221
|
+
renderer?: "webview" | "skyline";
|
|
222
|
+
rendererOptions?: {
|
|
223
|
+
skyline?: {
|
|
224
|
+
defaultDisplayBlock?: boolean;
|
|
225
|
+
defaultContentBox?: boolean;
|
|
226
|
+
disableABTest?: boolean;
|
|
227
|
+
[k: string]: unknown;
|
|
228
|
+
};
|
|
229
|
+
[k: string]: unknown;
|
|
230
|
+
};
|
|
231
|
+
usingComponents?: {
|
|
232
|
+
[k: string]: unknown;
|
|
233
|
+
};
|
|
234
|
+
componentFramework?: string;
|
|
235
|
+
$schema?: string;
|
|
236
|
+
[k: string]: unknown;
|
|
11
237
|
}
|
|
12
|
-
|
|
238
|
+
/**
|
|
239
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
240
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
241
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* 自定义组件配置
|
|
245
|
+
*/
|
|
246
|
+
interface Component {
|
|
247
|
+
component?: boolean;
|
|
248
|
+
styleIsolation?: "isolated" | "apply-shared" | "shared";
|
|
249
|
+
componentGenerics?: {
|
|
250
|
+
[k: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
componentPlaceholder?: {
|
|
253
|
+
[k: string]: unknown;
|
|
254
|
+
};
|
|
255
|
+
usingComponents?: {
|
|
256
|
+
[k: string]: unknown;
|
|
257
|
+
};
|
|
258
|
+
componentFramework?: string;
|
|
259
|
+
$schema?: string;
|
|
260
|
+
[k: string]: unknown;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
264
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
265
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
266
|
+
*/
|
|
267
|
+
/**
|
|
268
|
+
* 页面配置, 支持对单个页面进行配置,可以在页面对应的 .json 文件来对本页面的表现进行配置
|
|
269
|
+
*/
|
|
270
|
+
interface Page {
|
|
271
|
+
backgroundColorContent?: string;
|
|
272
|
+
disableScroll?: boolean;
|
|
273
|
+
styleIsolation?: "page-isolated" | "page-apply-shared" | "page-shared";
|
|
274
|
+
style?: string;
|
|
275
|
+
singlePage?: {
|
|
276
|
+
[k: string]: unknown;
|
|
277
|
+
};
|
|
278
|
+
enablePassiveEvent?: {
|
|
279
|
+
[k: string]: unknown;
|
|
280
|
+
} | boolean;
|
|
281
|
+
renderer?: "webview" | "skyline";
|
|
282
|
+
rendererOptions?: {
|
|
283
|
+
skyline?: {
|
|
284
|
+
defaultDisplayBlock?: boolean;
|
|
285
|
+
defaultContentBox?: boolean;
|
|
286
|
+
disableABTest?: boolean;
|
|
287
|
+
[k: string]: unknown;
|
|
288
|
+
};
|
|
289
|
+
[k: string]: unknown;
|
|
290
|
+
};
|
|
291
|
+
usingComponents?: {
|
|
292
|
+
[k: string]: unknown;
|
|
293
|
+
};
|
|
294
|
+
componentFramework?: string;
|
|
295
|
+
$schema?: string;
|
|
296
|
+
componentPlaceholder?: {
|
|
297
|
+
[k: string]: unknown;
|
|
298
|
+
};
|
|
299
|
+
navigationBarBackgroundColor?: string;
|
|
300
|
+
navigationBarTextStyle?: string;
|
|
301
|
+
navigationBarTitleText?: string;
|
|
302
|
+
navigationStyle?: "default" | "custom";
|
|
303
|
+
homeButton?: boolean;
|
|
304
|
+
backgroundColor?: string;
|
|
305
|
+
backgroundTextStyle?: "dark" | "light";
|
|
306
|
+
backgroundColorTop?: string;
|
|
307
|
+
backgroundColorBottom?: string;
|
|
308
|
+
enablePullDownRefresh?: boolean;
|
|
309
|
+
onReachBottomDistance?: number;
|
|
310
|
+
pageOrientation?: "portrait" | "auto" | "landscape";
|
|
311
|
+
restartStrategy?: "homePage" | "homePageAndLatestPage";
|
|
312
|
+
initialRenderingCache?: "static" | "dynamic";
|
|
313
|
+
visualEffectInBackground?: "none" | "hidden";
|
|
314
|
+
handleWebviewPreload?: "static" | "manual" | "auto";
|
|
315
|
+
[k: string]: unknown;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
type GenerateType = 'app' | 'page' | 'component';
|
|
319
|
+
declare function generateJs(type?: GenerateType): "App({})" | "Page({})" | "Component({})";
|
|
320
|
+
declare function generateWxss(): string;
|
|
321
|
+
declare function generateWxml(text?: string): string;
|
|
322
|
+
declare function generateJson(type?: GenerateType): App | Page | Component;
|
|
13
323
|
|
|
14
|
-
export { type
|
|
324
|
+
export { type App, type Component, type GenerateType, type Page, generateJs, generateJson, generateWxml, generateWxss };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,324 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 全局配置, 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。
|
|
8
|
+
*/
|
|
9
|
+
interface App {
|
|
10
|
+
/**
|
|
11
|
+
* 指定小程序的默认启动路径(首页),常见情景是从微信聊天列表页下拉启动、小程序列表启动等。如果不填,将默认为 pages 列表的第一项。不支持带页面路径参数。
|
|
12
|
+
*/
|
|
13
|
+
entryPagePath?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 用于指定小程序由哪些页面组成,每一项都对应一个页面的 路径(含文件名) 信息。文件名不需要写文件后缀,框架会自动去寻找对应位置的 .json, .js, .wxml, .wxss 四个文件进行处理。
|
|
16
|
+
*/
|
|
17
|
+
pages: string[];
|
|
18
|
+
window?: {
|
|
19
|
+
navigationBarBackgroundColor?: string;
|
|
20
|
+
navigationBarTextStyle?: string;
|
|
21
|
+
navigationBarTitleText?: string;
|
|
22
|
+
navigationStyle?: "default" | "custom";
|
|
23
|
+
homeButton?: boolean;
|
|
24
|
+
backgroundColor?: string;
|
|
25
|
+
backgroundTextStyle?: "dark" | "light";
|
|
26
|
+
backgroundColorTop?: string;
|
|
27
|
+
backgroundColorBottom?: string;
|
|
28
|
+
enablePullDownRefresh?: boolean;
|
|
29
|
+
onReachBottomDistance?: number;
|
|
30
|
+
pageOrientation?: "portrait" | "auto" | "landscape";
|
|
31
|
+
restartStrategy?: "homePage" | "homePageAndLatestPage";
|
|
32
|
+
initialRenderingCache?: "static" | "dynamic";
|
|
33
|
+
visualEffectInBackground?: "none" | "hidden";
|
|
34
|
+
handleWebviewPreload?: "static" | "manual" | "auto";
|
|
35
|
+
[k: string]: unknown;
|
|
36
|
+
};
|
|
37
|
+
tabBar?: {
|
|
38
|
+
color: string;
|
|
39
|
+
selectedColor: string;
|
|
40
|
+
backgroundColor: string;
|
|
41
|
+
borderStyle?: "black" | "white";
|
|
42
|
+
/**
|
|
43
|
+
* @minItems 2
|
|
44
|
+
* @maxItems 5
|
|
45
|
+
*/
|
|
46
|
+
list: [
|
|
47
|
+
{
|
|
48
|
+
pagePath: string;
|
|
49
|
+
text: string;
|
|
50
|
+
iconPath?: string;
|
|
51
|
+
selectedIconPath?: string;
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
pagePath: string;
|
|
56
|
+
text: string;
|
|
57
|
+
iconPath?: string;
|
|
58
|
+
selectedIconPath?: string;
|
|
59
|
+
[k: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
] | [
|
|
62
|
+
{
|
|
63
|
+
pagePath: string;
|
|
64
|
+
text: string;
|
|
65
|
+
iconPath?: string;
|
|
66
|
+
selectedIconPath?: string;
|
|
67
|
+
[k: string]: unknown;
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
pagePath: string;
|
|
71
|
+
text: string;
|
|
72
|
+
iconPath?: string;
|
|
73
|
+
selectedIconPath?: string;
|
|
74
|
+
[k: string]: unknown;
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
pagePath: string;
|
|
78
|
+
text: string;
|
|
79
|
+
iconPath?: string;
|
|
80
|
+
selectedIconPath?: string;
|
|
81
|
+
[k: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
] | [
|
|
84
|
+
{
|
|
85
|
+
pagePath: string;
|
|
86
|
+
text: string;
|
|
87
|
+
iconPath?: string;
|
|
88
|
+
selectedIconPath?: string;
|
|
89
|
+
[k: string]: unknown;
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pagePath: string;
|
|
93
|
+
text: string;
|
|
94
|
+
iconPath?: string;
|
|
95
|
+
selectedIconPath?: string;
|
|
96
|
+
[k: string]: unknown;
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
pagePath: string;
|
|
100
|
+
text: string;
|
|
101
|
+
iconPath?: string;
|
|
102
|
+
selectedIconPath?: string;
|
|
103
|
+
[k: string]: unknown;
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
pagePath: string;
|
|
107
|
+
text: string;
|
|
108
|
+
iconPath?: string;
|
|
109
|
+
selectedIconPath?: string;
|
|
110
|
+
[k: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
] | [
|
|
113
|
+
{
|
|
114
|
+
pagePath: string;
|
|
115
|
+
text: string;
|
|
116
|
+
iconPath?: string;
|
|
117
|
+
selectedIconPath?: string;
|
|
118
|
+
[k: string]: unknown;
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
pagePath: string;
|
|
122
|
+
text: string;
|
|
123
|
+
iconPath?: string;
|
|
124
|
+
selectedIconPath?: string;
|
|
125
|
+
[k: string]: unknown;
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
pagePath: string;
|
|
129
|
+
text: string;
|
|
130
|
+
iconPath?: string;
|
|
131
|
+
selectedIconPath?: string;
|
|
132
|
+
[k: string]: unknown;
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
pagePath: string;
|
|
136
|
+
text: string;
|
|
137
|
+
iconPath?: string;
|
|
138
|
+
selectedIconPath?: string;
|
|
139
|
+
[k: string]: unknown;
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
pagePath: string;
|
|
143
|
+
text: string;
|
|
144
|
+
iconPath?: string;
|
|
145
|
+
selectedIconPath?: string;
|
|
146
|
+
[k: string]: unknown;
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
position?: "bottom" | "top";
|
|
150
|
+
custom?: boolean;
|
|
151
|
+
[k: string]: unknown;
|
|
152
|
+
};
|
|
153
|
+
networkTimeout?: {
|
|
154
|
+
request?: number;
|
|
155
|
+
connectSocket?: number;
|
|
156
|
+
uploadFile?: number;
|
|
157
|
+
downloadFile?: number;
|
|
158
|
+
[k: string]: unknown;
|
|
159
|
+
};
|
|
160
|
+
debug?: boolean;
|
|
161
|
+
functionalPages?: boolean;
|
|
162
|
+
subpackages?: {
|
|
163
|
+
root?: string;
|
|
164
|
+
name?: string;
|
|
165
|
+
pages?: string[];
|
|
166
|
+
independent?: boolean;
|
|
167
|
+
entry?: string;
|
|
168
|
+
[k: string]: unknown;
|
|
169
|
+
}[];
|
|
170
|
+
workers?: string;
|
|
171
|
+
requiredBackgroundModes?: string[];
|
|
172
|
+
requiredPrivateInfos?: string[];
|
|
173
|
+
plugins?: {
|
|
174
|
+
[k: string]: unknown;
|
|
175
|
+
};
|
|
176
|
+
preloadRule?: {
|
|
177
|
+
[k: string]: unknown;
|
|
178
|
+
};
|
|
179
|
+
resizable?: boolean;
|
|
180
|
+
permission?: {
|
|
181
|
+
[k: string]: unknown;
|
|
182
|
+
};
|
|
183
|
+
sitemapLocation?: string;
|
|
184
|
+
useExtendedLib?: {
|
|
185
|
+
[k: string]: unknown;
|
|
186
|
+
};
|
|
187
|
+
entranceDeclare?: {
|
|
188
|
+
[k: string]: unknown;
|
|
189
|
+
};
|
|
190
|
+
darkmode?: boolean;
|
|
191
|
+
themeLocation?: string;
|
|
192
|
+
lazyCodeLoading?: string;
|
|
193
|
+
supportedMaterials?: {
|
|
194
|
+
[k: string]: unknown;
|
|
195
|
+
};
|
|
196
|
+
serviceProviderTicket?: string;
|
|
197
|
+
embeddedAppIdList?: string[];
|
|
198
|
+
halfPage?: {
|
|
199
|
+
[k: string]: unknown;
|
|
200
|
+
};
|
|
201
|
+
debugOptions?: {
|
|
202
|
+
[k: string]: unknown;
|
|
203
|
+
};
|
|
204
|
+
resolveAlias?: {
|
|
205
|
+
[k: string]: unknown;
|
|
206
|
+
};
|
|
207
|
+
miniApp?: {
|
|
208
|
+
[k: string]: unknown;
|
|
209
|
+
};
|
|
210
|
+
static?: {
|
|
211
|
+
[k: string]: unknown;
|
|
212
|
+
};
|
|
213
|
+
convertRpxToVw?: boolean;
|
|
214
|
+
style?: string;
|
|
215
|
+
singlePage?: {
|
|
216
|
+
[k: string]: unknown;
|
|
217
|
+
};
|
|
218
|
+
enablePassiveEvent?: {
|
|
219
|
+
[k: string]: unknown;
|
|
220
|
+
} | boolean;
|
|
221
|
+
renderer?: "webview" | "skyline";
|
|
222
|
+
rendererOptions?: {
|
|
223
|
+
skyline?: {
|
|
224
|
+
defaultDisplayBlock?: boolean;
|
|
225
|
+
defaultContentBox?: boolean;
|
|
226
|
+
disableABTest?: boolean;
|
|
227
|
+
[k: string]: unknown;
|
|
228
|
+
};
|
|
229
|
+
[k: string]: unknown;
|
|
230
|
+
};
|
|
231
|
+
usingComponents?: {
|
|
232
|
+
[k: string]: unknown;
|
|
233
|
+
};
|
|
234
|
+
componentFramework?: string;
|
|
235
|
+
$schema?: string;
|
|
236
|
+
[k: string]: unknown;
|
|
11
237
|
}
|
|
12
|
-
|
|
238
|
+
/**
|
|
239
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
240
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
241
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* 自定义组件配置
|
|
245
|
+
*/
|
|
246
|
+
interface Component {
|
|
247
|
+
component?: boolean;
|
|
248
|
+
styleIsolation?: "isolated" | "apply-shared" | "shared";
|
|
249
|
+
componentGenerics?: {
|
|
250
|
+
[k: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
componentPlaceholder?: {
|
|
253
|
+
[k: string]: unknown;
|
|
254
|
+
};
|
|
255
|
+
usingComponents?: {
|
|
256
|
+
[k: string]: unknown;
|
|
257
|
+
};
|
|
258
|
+
componentFramework?: string;
|
|
259
|
+
$schema?: string;
|
|
260
|
+
[k: string]: unknown;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
264
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
265
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
266
|
+
*/
|
|
267
|
+
/**
|
|
268
|
+
* 页面配置, 支持对单个页面进行配置,可以在页面对应的 .json 文件来对本页面的表现进行配置
|
|
269
|
+
*/
|
|
270
|
+
interface Page {
|
|
271
|
+
backgroundColorContent?: string;
|
|
272
|
+
disableScroll?: boolean;
|
|
273
|
+
styleIsolation?: "page-isolated" | "page-apply-shared" | "page-shared";
|
|
274
|
+
style?: string;
|
|
275
|
+
singlePage?: {
|
|
276
|
+
[k: string]: unknown;
|
|
277
|
+
};
|
|
278
|
+
enablePassiveEvent?: {
|
|
279
|
+
[k: string]: unknown;
|
|
280
|
+
} | boolean;
|
|
281
|
+
renderer?: "webview" | "skyline";
|
|
282
|
+
rendererOptions?: {
|
|
283
|
+
skyline?: {
|
|
284
|
+
defaultDisplayBlock?: boolean;
|
|
285
|
+
defaultContentBox?: boolean;
|
|
286
|
+
disableABTest?: boolean;
|
|
287
|
+
[k: string]: unknown;
|
|
288
|
+
};
|
|
289
|
+
[k: string]: unknown;
|
|
290
|
+
};
|
|
291
|
+
usingComponents?: {
|
|
292
|
+
[k: string]: unknown;
|
|
293
|
+
};
|
|
294
|
+
componentFramework?: string;
|
|
295
|
+
$schema?: string;
|
|
296
|
+
componentPlaceholder?: {
|
|
297
|
+
[k: string]: unknown;
|
|
298
|
+
};
|
|
299
|
+
navigationBarBackgroundColor?: string;
|
|
300
|
+
navigationBarTextStyle?: string;
|
|
301
|
+
navigationBarTitleText?: string;
|
|
302
|
+
navigationStyle?: "default" | "custom";
|
|
303
|
+
homeButton?: boolean;
|
|
304
|
+
backgroundColor?: string;
|
|
305
|
+
backgroundTextStyle?: "dark" | "light";
|
|
306
|
+
backgroundColorTop?: string;
|
|
307
|
+
backgroundColorBottom?: string;
|
|
308
|
+
enablePullDownRefresh?: boolean;
|
|
309
|
+
onReachBottomDistance?: number;
|
|
310
|
+
pageOrientation?: "portrait" | "auto" | "landscape";
|
|
311
|
+
restartStrategy?: "homePage" | "homePageAndLatestPage";
|
|
312
|
+
initialRenderingCache?: "static" | "dynamic";
|
|
313
|
+
visualEffectInBackground?: "none" | "hidden";
|
|
314
|
+
handleWebviewPreload?: "static" | "manual" | "auto";
|
|
315
|
+
[k: string]: unknown;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
type GenerateType = 'app' | 'page' | 'component';
|
|
319
|
+
declare function generateJs(type?: GenerateType): "App({})" | "Page({})" | "Component({})";
|
|
320
|
+
declare function generateWxss(): string;
|
|
321
|
+
declare function generateWxml(text?: string): string;
|
|
322
|
+
declare function generateJson(type?: GenerateType): App | Page | Component;
|
|
13
323
|
|
|
14
|
-
export { type
|
|
324
|
+
export { type App, type Component, type GenerateType, type Page, generateJs, generateJson, generateWxml, generateWxss };
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,44 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
function generateJs(type) {
|
|
3
|
+
if (type === "app") {
|
|
4
|
+
return `App({})`;
|
|
5
|
+
} else if (type === "page") {
|
|
6
|
+
return `Page({})`;
|
|
7
|
+
} else {
|
|
8
|
+
return `Component({})`;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function generateWxss() {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
function generateWxml(text) {
|
|
15
|
+
return `<view>${text ?? "hello weapp-vite!"}</view>`;
|
|
16
|
+
}
|
|
17
|
+
function generateJson(type) {
|
|
18
|
+
if (type === "app") {
|
|
19
|
+
return {
|
|
20
|
+
$schema: "https://vite.icebreaker.top/app.json",
|
|
21
|
+
usingComponents: {},
|
|
22
|
+
pages: [
|
|
23
|
+
"pages/index/index"
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
} else if (type === "page") {
|
|
27
|
+
return {
|
|
28
|
+
$schema: "https://vite.icebreaker.top/page.json",
|
|
29
|
+
usingComponents: {}
|
|
30
|
+
};
|
|
31
|
+
} else {
|
|
32
|
+
return {
|
|
33
|
+
$schema: "https://vite.icebreaker.top/component.json",
|
|
34
|
+
component: true,
|
|
35
|
+
usingComponents: {}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
20
38
|
}
|
|
21
39
|
export {
|
|
22
|
-
|
|
40
|
+
generateJs,
|
|
41
|
+
generateJson,
|
|
42
|
+
generateWxml,
|
|
43
|
+
generateWxss
|
|
23
44
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/schematics",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1",
|
|
5
5
|
"description": "@weapp-core/schematics",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -25,11 +25,7 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"fs-extra": "^11.2.0",
|
|
30
|
-
"pathe": "^1.1.2",
|
|
31
|
-
"@weapp-core/shared": "1.0.3"
|
|
32
|
-
},
|
|
28
|
+
"dependencies": {},
|
|
33
29
|
"scripts": {
|
|
34
30
|
"dev": "tsup --watch --sourcemap",
|
|
35
31
|
"build": "tsup",
|