weapp-vite 6.0.0-alpha.2 → 6.0.0-alpha.4
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/README.md +11 -9
- package/client.d.ts +16 -0
- package/dist/auto-routes.cjs +3 -3
- package/dist/auto-routes.mjs +2 -2
- package/dist/{chunk-MK4LDVBT.mjs → chunk-AYB4WOZM.mjs} +9 -6
- package/dist/{chunk-KBGC6ODZ.cjs → chunk-EVZXCCHN.cjs} +3274 -1262
- package/dist/{chunk-GGB7MGZY.mjs → chunk-PXOMWSIN.mjs} +1 -1
- package/dist/{chunk-IEICAJDZ.cjs → chunk-R6Z72GR5.cjs} +9 -6
- package/dist/{chunk-CBPLMYFL.cjs → chunk-SVAH2XJL.cjs} +4 -4
- package/dist/{chunk-IHHBS4DF.mjs → chunk-ZAAP7JAU.mjs} +3618 -1606
- package/dist/cli.cjs +56 -56
- package/dist/cli.mjs +3 -3
- package/dist/{config-B6T_L15M.d.ts → config-CNXNPp1P.d.ts} +4 -4
- package/dist/{config-D5ATg2Pv.d.cts → config-D0FIclL4.d.cts} +4 -4
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{file-KXULPGWG.mjs → file-AP6E5UEG.mjs} +1 -1
- package/dist/file-ZWW24BA5.cjs +29 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/runtime.d.cts +6 -6
- package/dist/runtime.d.ts +6 -6
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +7 -6
- package/dist/file-S6QIP4VW.cjs +0 -29
package/README.md
CHANGED
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
### Vue 项目
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
+
import weappVite from '@weapp-vite/vite'
|
|
36
37
|
// vite.config.ts
|
|
37
38
|
import { defineConfig } from 'vite'
|
|
38
|
-
import weappVite from '@weapp-vite/vite'
|
|
39
39
|
|
|
40
40
|
export default defineConfig({
|
|
41
41
|
plugins: [
|
|
@@ -53,23 +53,25 @@ export default defineConfig({
|
|
|
53
53
|
|
|
54
54
|
```vue
|
|
55
55
|
<!-- App.vue -->
|
|
56
|
-
<template>
|
|
57
|
-
<view class="container">
|
|
58
|
-
<text>{{ message }}</text>
|
|
59
|
-
<button @click="handleClick">Click</button>
|
|
60
|
-
</view>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
56
|
<script setup>
|
|
64
57
|
import { ref } from 'vue'
|
|
65
58
|
|
|
66
59
|
const message = ref('Hello Vue in Mini-program!')
|
|
67
60
|
|
|
68
|
-
|
|
61
|
+
function handleClick() {
|
|
69
62
|
console.log('Button clicked!')
|
|
70
63
|
}
|
|
71
64
|
</script>
|
|
72
65
|
|
|
66
|
+
<template>
|
|
67
|
+
<view class="container">
|
|
68
|
+
<text>{{ message }}</text>
|
|
69
|
+
<button @click="handleClick">
|
|
70
|
+
Click
|
|
71
|
+
</button>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
73
75
|
<style scoped>
|
|
74
76
|
.container {
|
|
75
77
|
padding: 20rpx;
|
package/client.d.ts
CHANGED
|
@@ -30,3 +30,19 @@ declare module 'process' {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
type __WEAPP_APP_JSON__ = import('@weapp-core/schematics').App
|
|
35
|
+
type __WEAPP_PAGE_JSON__ = import('@weapp-core/schematics').Page
|
|
36
|
+
type __WEAPP_COMPONENT_JSON__ = import('@weapp-core/schematics').Component
|
|
37
|
+
|
|
38
|
+
declare function defineAppJson(config: () => __WEAPP_APP_JSON__): () => __WEAPP_APP_JSON__
|
|
39
|
+
declare function defineAppJson(config: () => Promise<__WEAPP_APP_JSON__>): () => Promise<__WEAPP_APP_JSON__>
|
|
40
|
+
declare function defineAppJson(config: __WEAPP_APP_JSON__): __WEAPP_APP_JSON__
|
|
41
|
+
|
|
42
|
+
declare function definePageJson(config: () => __WEAPP_PAGE_JSON__): () => __WEAPP_PAGE_JSON__
|
|
43
|
+
declare function definePageJson(config: () => Promise<__WEAPP_PAGE_JSON__>): () => Promise<__WEAPP_PAGE_JSON__>
|
|
44
|
+
declare function definePageJson(config: __WEAPP_PAGE_JSON__): __WEAPP_PAGE_JSON__
|
|
45
|
+
|
|
46
|
+
declare function defineComponentJson(config: () => __WEAPP_COMPONENT_JSON__): () => __WEAPP_COMPONENT_JSON__
|
|
47
|
+
declare function defineComponentJson(config: () => Promise<__WEAPP_COMPONENT_JSON__>): () => Promise<__WEAPP_COMPONENT_JSON__>
|
|
48
|
+
declare function defineComponentJson(config: __WEAPP_COMPONENT_JSON__): __WEAPP_COMPONENT_JSON__
|
package/dist/auto-routes.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkEVZXCCHNcjs = require('./chunk-EVZXCCHN.cjs');
|
|
4
|
+
require('./chunk-R6Z72GR5.cjs');
|
|
5
5
|
require('./chunk-E34K6TPD.cjs');
|
|
6
6
|
require('./chunk-SJSLFDTA.cjs');
|
|
7
7
|
|
|
@@ -25,7 +25,7 @@ function createGetter(resolver) {
|
|
|
25
25
|
get: resolver
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
var ctx =
|
|
28
|
+
var ctx = _chunkEVZXCCHNcjs.getCompilerContext.call(void 0, );
|
|
29
29
|
var service = ctx.autoRoutesService;
|
|
30
30
|
var routes = {};
|
|
31
31
|
Object.defineProperties(routes, {
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -144,18 +144,21 @@ async function extractConfigFromVue(vueFilePath) {
|
|
|
144
144
|
if (errors.length > 0) {
|
|
145
145
|
return void 0;
|
|
146
146
|
}
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
147
|
+
const jsonBlocks = descriptor.customBlocks.filter((block) => block.type === "json");
|
|
148
|
+
if (!jsonBlocks.length) {
|
|
149
149
|
return void 0;
|
|
150
150
|
}
|
|
151
151
|
const mergedConfig = {};
|
|
152
152
|
const { parse: parseJson } = await import("comment-json");
|
|
153
|
-
for (const block of
|
|
153
|
+
for (const block of jsonBlocks) {
|
|
154
154
|
try {
|
|
155
|
-
const lang = block.lang || "json";
|
|
156
|
-
if (lang === "json" || lang === "json5" || lang === "
|
|
155
|
+
const lang = (block.lang || "json").toLowerCase();
|
|
156
|
+
if (lang === "json" || lang === "jsonc" || lang === "json5" || lang === "txt") {
|
|
157
157
|
const config = parseJson(block.content, void 0, true);
|
|
158
|
-
|
|
158
|
+
if (config && typeof config === "object" && !Array.isArray(config)) {
|
|
159
|
+
Object.assign(mergedConfig, config);
|
|
160
|
+
}
|
|
161
|
+
continue;
|
|
159
162
|
}
|
|
160
163
|
} catch {
|
|
161
164
|
}
|