@weapp-core/schematics 1.0.2 → 1.0.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/index.cjs +81 -20
- package/dist/index.d.cts +46 -6
- package/dist/index.d.ts +46 -6
- package/dist/index.js +81 -20
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -38,30 +38,91 @@ function generateJs(type) {
|
|
|
38
38
|
function generateWxss() {
|
|
39
39
|
return "";
|
|
40
40
|
}
|
|
41
|
-
function generateWxml(
|
|
42
|
-
return `<view
|
|
41
|
+
function generateWxml(filepath) {
|
|
42
|
+
return `<view>hello weapp-vite!${filepath ? ` from ${filepath}` : ""}</view>`;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function JSONStringify(res) {
|
|
45
|
+
return JSON.stringify(res, void 0, 2);
|
|
46
|
+
}
|
|
47
|
+
function generateJson(type, ext = "json") {
|
|
45
48
|
if (type === "app") {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
if (ext === "ts") {
|
|
50
|
+
return `import { defineAppJson } from 'weapp-vite/json'
|
|
51
|
+
|
|
52
|
+
export default defineAppJson({
|
|
53
|
+
pages: [
|
|
54
|
+
'pages/index/index',
|
|
55
|
+
],
|
|
56
|
+
usingComponents: {},
|
|
57
|
+
})
|
|
58
|
+
`;
|
|
59
|
+
} else if (ext === "js") {
|
|
60
|
+
return `import { defineAppJson } from 'weapp-vite/json'
|
|
61
|
+
|
|
62
|
+
export default defineAppJson({
|
|
63
|
+
pages: [
|
|
64
|
+
'pages/index/index',
|
|
65
|
+
],
|
|
66
|
+
usingComponents: {},
|
|
67
|
+
})
|
|
68
|
+
`;
|
|
69
|
+
} else {
|
|
70
|
+
return JSONStringify({
|
|
71
|
+
$schema: "https://vite.icebreaker.top/app.json",
|
|
72
|
+
usingComponents: {},
|
|
73
|
+
pages: [
|
|
74
|
+
"pages/index/index"
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
53
78
|
} else if (type === "page") {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
if (ext === "ts") {
|
|
80
|
+
return `import { definePageJson } from 'weapp-vite/json'
|
|
81
|
+
|
|
82
|
+
export default definePageJson({
|
|
83
|
+
usingComponents: {},
|
|
84
|
+
})
|
|
85
|
+
`;
|
|
86
|
+
} else if (ext === "js") {
|
|
87
|
+
return `import { definePageJson } from 'weapp-vite/json'
|
|
88
|
+
|
|
89
|
+
export default definePageJson({
|
|
90
|
+
usingComponents: {},
|
|
91
|
+
})
|
|
92
|
+
`;
|
|
93
|
+
} else {
|
|
94
|
+
return JSONStringify({
|
|
95
|
+
$schema: "https://vite.icebreaker.top/page.json",
|
|
96
|
+
usingComponents: {}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
58
99
|
} else {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
100
|
+
if (ext === "ts") {
|
|
101
|
+
return `import { defineComponentJson } from 'weapp-vite/json'
|
|
102
|
+
|
|
103
|
+
export default defineComponentJson({
|
|
104
|
+
component: true,
|
|
105
|
+
styleIsolation: 'apply-shared',
|
|
106
|
+
usingComponents: {},
|
|
107
|
+
})
|
|
108
|
+
`;
|
|
109
|
+
} else if (ext === "js") {
|
|
110
|
+
return `import { defineComponentJson } from 'weapp-vite/json'
|
|
111
|
+
|
|
112
|
+
export default defineComponentJson({
|
|
113
|
+
component: true,
|
|
114
|
+
styleIsolation: 'apply-shared',
|
|
115
|
+
usingComponents: {},
|
|
116
|
+
})
|
|
117
|
+
`;
|
|
118
|
+
} else {
|
|
119
|
+
return JSONStringify({
|
|
120
|
+
$schema: "https://vite.icebreaker.top/component.json",
|
|
121
|
+
component: true,
|
|
122
|
+
styleIsolation: "apply-shared",
|
|
123
|
+
usingComponents: {}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
65
126
|
}
|
|
66
127
|
}
|
|
67
128
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* 全局配置, 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。
|
|
8
8
|
*/
|
|
9
|
-
interface App {
|
|
9
|
+
interface App$1 {
|
|
10
10
|
/**
|
|
11
11
|
* 指定小程序的默认启动路径(首页),常见情景是从微信聊天列表页下拉启动、小程序列表启动等。如果不填,将默认为 pages 列表的第一项。不支持带页面路径参数。
|
|
12
12
|
*/
|
|
@@ -243,7 +243,7 @@ interface App {
|
|
|
243
243
|
/**
|
|
244
244
|
* 自定义组件配置
|
|
245
245
|
*/
|
|
246
|
-
interface Component {
|
|
246
|
+
interface Component$1 {
|
|
247
247
|
component?: boolean;
|
|
248
248
|
styleIsolation?: "isolated" | "apply-shared" | "shared";
|
|
249
249
|
componentGenerics?: {
|
|
@@ -267,7 +267,7 @@ interface Component {
|
|
|
267
267
|
/**
|
|
268
268
|
* 页面配置, 支持对单个页面进行配置,可以在页面对应的 .json 文件来对本页面的表现进行配置
|
|
269
269
|
*/
|
|
270
|
-
interface Page {
|
|
270
|
+
interface Page$1 {
|
|
271
271
|
backgroundColorContent?: string;
|
|
272
272
|
disableScroll?: boolean;
|
|
273
273
|
styleIsolation?: "page-isolated" | "page-apply-shared" | "page-shared";
|
|
@@ -314,11 +314,51 @@ interface Page {
|
|
|
314
314
|
handleWebviewPreload?: "static" | "manual" | "auto";
|
|
315
315
|
[k: string]: unknown;
|
|
316
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
319
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
320
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
321
|
+
*/
|
|
322
|
+
/**
|
|
323
|
+
* https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html
|
|
324
|
+
*/
|
|
325
|
+
interface Sitemap$1 {
|
|
326
|
+
rules: {
|
|
327
|
+
action?: "allow" | "disallow";
|
|
328
|
+
page: string;
|
|
329
|
+
params?: string[];
|
|
330
|
+
matching?: "exact" | "inclusive" | "exclusive" | "partial";
|
|
331
|
+
priority?: number;
|
|
332
|
+
}[];
|
|
333
|
+
$schema?: string;
|
|
334
|
+
[k: string]: unknown;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
338
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
339
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
340
|
+
*/
|
|
341
|
+
interface Theme$1 {
|
|
342
|
+
light: {
|
|
343
|
+
[k: string]: unknown;
|
|
344
|
+
};
|
|
345
|
+
dark: {
|
|
346
|
+
[k: string]: unknown;
|
|
347
|
+
};
|
|
348
|
+
$schema?: string;
|
|
349
|
+
[k: string]: unknown;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
type App = App$1;
|
|
353
|
+
type Component = Component$1;
|
|
354
|
+
type Page = Page$1;
|
|
355
|
+
type Sitemap = Sitemap$1;
|
|
356
|
+
type Theme = Theme$1;
|
|
317
357
|
|
|
318
358
|
type GenerateType = 'app' | 'page' | 'component';
|
|
319
359
|
declare function generateJs(type?: GenerateType): "App({})" | "Page({})" | "Component({})";
|
|
320
360
|
declare function generateWxss(): string;
|
|
321
|
-
declare function generateWxml(
|
|
322
|
-
declare function generateJson(type?: GenerateType
|
|
361
|
+
declare function generateWxml(filepath?: string): string;
|
|
362
|
+
declare function generateJson(type?: GenerateType, ext?: 'json' | 'js' | 'ts' | (string & {})): string;
|
|
323
363
|
|
|
324
|
-
export { type App, type Component, type GenerateType, type Page, generateJs, generateJson, generateWxml, generateWxss };
|
|
364
|
+
export { type App, type Component, type GenerateType, type Page, type Sitemap, type Theme, generateJs, generateJson, generateWxml, generateWxss };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* 全局配置, 小程序根目录下的 app.json 文件用来对微信小程序进行全局配置。
|
|
8
8
|
*/
|
|
9
|
-
interface App {
|
|
9
|
+
interface App$1 {
|
|
10
10
|
/**
|
|
11
11
|
* 指定小程序的默认启动路径(首页),常见情景是从微信聊天列表页下拉启动、小程序列表启动等。如果不填,将默认为 pages 列表的第一项。不支持带页面路径参数。
|
|
12
12
|
*/
|
|
@@ -243,7 +243,7 @@ interface App {
|
|
|
243
243
|
/**
|
|
244
244
|
* 自定义组件配置
|
|
245
245
|
*/
|
|
246
|
-
interface Component {
|
|
246
|
+
interface Component$1 {
|
|
247
247
|
component?: boolean;
|
|
248
248
|
styleIsolation?: "isolated" | "apply-shared" | "shared";
|
|
249
249
|
componentGenerics?: {
|
|
@@ -267,7 +267,7 @@ interface Component {
|
|
|
267
267
|
/**
|
|
268
268
|
* 页面配置, 支持对单个页面进行配置,可以在页面对应的 .json 文件来对本页面的表现进行配置
|
|
269
269
|
*/
|
|
270
|
-
interface Page {
|
|
270
|
+
interface Page$1 {
|
|
271
271
|
backgroundColorContent?: string;
|
|
272
272
|
disableScroll?: boolean;
|
|
273
273
|
styleIsolation?: "page-isolated" | "page-apply-shared" | "page-shared";
|
|
@@ -314,11 +314,51 @@ interface Page {
|
|
|
314
314
|
handleWebviewPreload?: "static" | "manual" | "auto";
|
|
315
315
|
[k: string]: unknown;
|
|
316
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
319
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
320
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
321
|
+
*/
|
|
322
|
+
/**
|
|
323
|
+
* https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html
|
|
324
|
+
*/
|
|
325
|
+
interface Sitemap$1 {
|
|
326
|
+
rules: {
|
|
327
|
+
action?: "allow" | "disallow";
|
|
328
|
+
page: string;
|
|
329
|
+
params?: string[];
|
|
330
|
+
matching?: "exact" | "inclusive" | "exclusive" | "partial";
|
|
331
|
+
priority?: number;
|
|
332
|
+
}[];
|
|
333
|
+
$schema?: string;
|
|
334
|
+
[k: string]: unknown;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
338
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
339
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
340
|
+
*/
|
|
341
|
+
interface Theme$1 {
|
|
342
|
+
light: {
|
|
343
|
+
[k: string]: unknown;
|
|
344
|
+
};
|
|
345
|
+
dark: {
|
|
346
|
+
[k: string]: unknown;
|
|
347
|
+
};
|
|
348
|
+
$schema?: string;
|
|
349
|
+
[k: string]: unknown;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
type App = App$1;
|
|
353
|
+
type Component = Component$1;
|
|
354
|
+
type Page = Page$1;
|
|
355
|
+
type Sitemap = Sitemap$1;
|
|
356
|
+
type Theme = Theme$1;
|
|
317
357
|
|
|
318
358
|
type GenerateType = 'app' | 'page' | 'component';
|
|
319
359
|
declare function generateJs(type?: GenerateType): "App({})" | "Page({})" | "Component({})";
|
|
320
360
|
declare function generateWxss(): string;
|
|
321
|
-
declare function generateWxml(
|
|
322
|
-
declare function generateJson(type?: GenerateType
|
|
361
|
+
declare function generateWxml(filepath?: string): string;
|
|
362
|
+
declare function generateJson(type?: GenerateType, ext?: 'json' | 'js' | 'ts' | (string & {})): string;
|
|
323
363
|
|
|
324
|
-
export { type App, type Component, type GenerateType, type Page, generateJs, generateJson, generateWxml, generateWxss };
|
|
364
|
+
export { type App, type Component, type GenerateType, type Page, type Sitemap, type Theme, generateJs, generateJson, generateWxml, generateWxss };
|
package/dist/index.js
CHANGED
|
@@ -11,30 +11,91 @@ function generateJs(type) {
|
|
|
11
11
|
function generateWxss() {
|
|
12
12
|
return "";
|
|
13
13
|
}
|
|
14
|
-
function generateWxml(
|
|
15
|
-
return `<view
|
|
14
|
+
function generateWxml(filepath) {
|
|
15
|
+
return `<view>hello weapp-vite!${filepath ? ` from ${filepath}` : ""}</view>`;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function JSONStringify(res) {
|
|
18
|
+
return JSON.stringify(res, void 0, 2);
|
|
19
|
+
}
|
|
20
|
+
function generateJson(type, ext = "json") {
|
|
18
21
|
if (type === "app") {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (ext === "ts") {
|
|
23
|
+
return `import { defineAppJson } from 'weapp-vite/json'
|
|
24
|
+
|
|
25
|
+
export default defineAppJson({
|
|
26
|
+
pages: [
|
|
27
|
+
'pages/index/index',
|
|
28
|
+
],
|
|
29
|
+
usingComponents: {},
|
|
30
|
+
})
|
|
31
|
+
`;
|
|
32
|
+
} else if (ext === "js") {
|
|
33
|
+
return `import { defineAppJson } from 'weapp-vite/json'
|
|
34
|
+
|
|
35
|
+
export default defineAppJson({
|
|
36
|
+
pages: [
|
|
37
|
+
'pages/index/index',
|
|
38
|
+
],
|
|
39
|
+
usingComponents: {},
|
|
40
|
+
})
|
|
41
|
+
`;
|
|
42
|
+
} else {
|
|
43
|
+
return JSONStringify({
|
|
44
|
+
$schema: "https://vite.icebreaker.top/app.json",
|
|
45
|
+
usingComponents: {},
|
|
46
|
+
pages: [
|
|
47
|
+
"pages/index/index"
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
26
51
|
} else if (type === "page") {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
if (ext === "ts") {
|
|
53
|
+
return `import { definePageJson } from 'weapp-vite/json'
|
|
54
|
+
|
|
55
|
+
export default definePageJson({
|
|
56
|
+
usingComponents: {},
|
|
57
|
+
})
|
|
58
|
+
`;
|
|
59
|
+
} else if (ext === "js") {
|
|
60
|
+
return `import { definePageJson } from 'weapp-vite/json'
|
|
61
|
+
|
|
62
|
+
export default definePageJson({
|
|
63
|
+
usingComponents: {},
|
|
64
|
+
})
|
|
65
|
+
`;
|
|
66
|
+
} else {
|
|
67
|
+
return JSONStringify({
|
|
68
|
+
$schema: "https://vite.icebreaker.top/page.json",
|
|
69
|
+
usingComponents: {}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
31
72
|
} else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
73
|
+
if (ext === "ts") {
|
|
74
|
+
return `import { defineComponentJson } from 'weapp-vite/json'
|
|
75
|
+
|
|
76
|
+
export default defineComponentJson({
|
|
77
|
+
component: true,
|
|
78
|
+
styleIsolation: 'apply-shared',
|
|
79
|
+
usingComponents: {},
|
|
80
|
+
})
|
|
81
|
+
`;
|
|
82
|
+
} else if (ext === "js") {
|
|
83
|
+
return `import { defineComponentJson } from 'weapp-vite/json'
|
|
84
|
+
|
|
85
|
+
export default defineComponentJson({
|
|
86
|
+
component: true,
|
|
87
|
+
styleIsolation: 'apply-shared',
|
|
88
|
+
usingComponents: {},
|
|
89
|
+
})
|
|
90
|
+
`;
|
|
91
|
+
} else {
|
|
92
|
+
return JSONStringify({
|
|
93
|
+
$schema: "https://vite.icebreaker.top/component.json",
|
|
94
|
+
component: true,
|
|
95
|
+
styleIsolation: "apply-shared",
|
|
96
|
+
usingComponents: {}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
38
99
|
}
|
|
39
100
|
}
|
|
40
101
|
export {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/schematics",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"description": "@weapp-core/schematics",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"dev": "tsup --watch --sourcemap",
|
|
31
|
-
"build": "
|
|
31
|
+
"build": "tsup",
|
|
32
32
|
"test": "vitest run",
|
|
33
33
|
"test:dev": "vitest",
|
|
34
34
|
"release": "pnpm publish",
|