weapp-vite 6.0.0-alpha.6 → 6.0.0
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/auto-routes.cjs +5 -3
- package/dist/auto-routes.mjs +4 -2
- package/dist/{chunk-ZZA26GJI.cjs → chunk-4BJD3MLI.cjs} +26 -5
- package/dist/chunk-4DN42HS3.mjs +94 -0
- package/dist/{chunk-CUXJUO62.mjs → chunk-4PZDXK3H.mjs} +993 -1385
- package/dist/{chunk-X4XBMC6D.cjs → chunk-4ZPNCEA4.cjs} +1028 -1420
- package/dist/chunk-BZODFQ4Z.cjs +94 -0
- package/dist/{chunk-H2OPU5AG.cjs → chunk-DJXJJ7GH.cjs} +4 -4
- package/dist/{chunk-T6MAVU7E.mjs → chunk-EHG44ZB2.mjs} +25 -4
- package/dist/{chunk-KN2VEJ32.mjs → chunk-NYMYLANF.mjs} +1 -1
- package/dist/chunk-PCFMCUAE.cjs +421 -0
- package/dist/chunk-PHN5WL6B.mjs +421 -0
- package/dist/cli.cjs +58 -56
- package/dist/cli.mjs +5 -3
- package/dist/{config-CNXNPp1P.d.ts → config-Bv7Rgh4e.d.ts} +3 -0
- package/dist/{config-D0FIclL4.d.cts → config-KbfGr98B.d.cts} +3 -0
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{file-4WEK4X45.mjs → file-KS6C356U.mjs} +2 -1
- package/dist/file-SDAACSRF.cjs +30 -0
- package/dist/index.cjs +6 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +5 -3
- package/dist/json.d.cts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/jsonMacros-F6BGS7I5.cjs +10 -0
- package/dist/jsonMacros-Q54HBTRE.mjs +10 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +6 -6
- package/dist/file-IMZTAEKY.cjs +0 -29
package/dist/auto-routes.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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 _chunk4ZPNCEA4cjs = require('./chunk-4ZPNCEA4.cjs');
|
|
4
|
+
require('./chunk-PCFMCUAE.cjs');
|
|
5
|
+
require('./chunk-4BJD3MLI.cjs');
|
|
6
|
+
require('./chunk-BZODFQ4Z.cjs');
|
|
5
7
|
require('./chunk-HL25C7YQ.cjs');
|
|
6
8
|
require('./chunk-2CHNKORP.cjs');
|
|
7
9
|
|
|
@@ -25,7 +27,7 @@ function createGetter(resolver) {
|
|
|
25
27
|
get: resolver
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
|
-
var ctx =
|
|
30
|
+
var ctx = _chunk4ZPNCEA4cjs.getCompilerContext.call(void 0, );
|
|
29
31
|
var service = ctx.autoRoutesService;
|
|
30
32
|
var routes = {};
|
|
31
33
|
Object.defineProperties(routes, {
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-4PZDXK3H.mjs";
|
|
4
|
+
import "./chunk-PHN5WL6B.mjs";
|
|
5
|
+
import "./chunk-EHG44ZB2.mjs";
|
|
6
|
+
import "./chunk-4DN42HS3.mjs";
|
|
5
7
|
import "./chunk-AZBN7A5I.mjs";
|
|
6
8
|
import "./chunk-V5RMQ6TF.mjs";
|
|
7
9
|
import {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
|
+
|
|
3
|
+
var _chunkBZODFQ4Zcjs = require('./chunk-BZODFQ4Z.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
2
6
|
|
|
3
7
|
var _chunkPFE2IVZ3cjs = require('./chunk-PFE2IVZ3.cjs');
|
|
4
8
|
|
|
5
9
|
// src/utils/file.ts
|
|
6
10
|
_chunkPFE2IVZ3cjs.init_cjs_shims.call(void 0, );
|
|
11
|
+
var import_merge = _chunkPFE2IVZ3cjs.__toESM.call(void 0, _chunkBZODFQ4Zcjs.require_src.call(void 0, ), 1);
|
|
7
12
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
8
13
|
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
9
14
|
var _compilersfc = require('vue/compiler-sfc');
|
|
@@ -144,12 +149,9 @@ async function extractConfigFromVue(vueFilePath) {
|
|
|
144
149
|
if (errors.length > 0) {
|
|
145
150
|
return void 0;
|
|
146
151
|
}
|
|
147
|
-
const jsonBlocks = descriptor.customBlocks.filter((block) => block.type === "json");
|
|
148
|
-
if (!jsonBlocks.length) {
|
|
149
|
-
return void 0;
|
|
150
|
-
}
|
|
151
152
|
const mergedConfig = {};
|
|
152
153
|
const { parse: parseJson } = await Promise.resolve().then(() => _interopRequireWildcard(require("comment-json")));
|
|
154
|
+
const jsonBlocks = descriptor.customBlocks.filter((block) => block.type === "json");
|
|
153
155
|
for (const block of jsonBlocks) {
|
|
154
156
|
try {
|
|
155
157
|
const lang = (block.lang || "json").toLowerCase();
|
|
@@ -163,6 +165,25 @@ async function extractConfigFromVue(vueFilePath) {
|
|
|
163
165
|
} catch (e3) {
|
|
164
166
|
}
|
|
165
167
|
}
|
|
168
|
+
const setupContent = _optionalChain([descriptor, 'access', _ => _.scriptSetup, 'optionalAccess', _2 => _2.content]);
|
|
169
|
+
const hasMacroHint = typeof setupContent === "string" && /\bdefine(?:App|Page|Component)Json\s*\(/.test(setupContent);
|
|
170
|
+
if (hasMacroHint) {
|
|
171
|
+
const { extractJsonMacroFromScriptSetup } = await Promise.resolve().then(() => _interopRequireWildcard(require("./jsonMacros-F6BGS7I5.cjs")));
|
|
172
|
+
try {
|
|
173
|
+
const extracted = await extractJsonMacroFromScriptSetup(
|
|
174
|
+
setupContent,
|
|
175
|
+
vueFilePath,
|
|
176
|
+
_optionalChain([descriptor, 'access', _3 => _3.scriptSetup, 'optionalAccess', _4 => _4.lang])
|
|
177
|
+
);
|
|
178
|
+
if (extracted.config && typeof extracted.config === "object" && !Array.isArray(extracted.config)) {
|
|
179
|
+
(0, import_merge.recursive)(mergedConfig, extracted.config);
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
if (jsonBlocks.length === 0) {
|
|
183
|
+
throw error;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
166
187
|
return Object.keys(mergedConfig).length > 0 ? mergedConfig : void 0;
|
|
167
188
|
} catch (e4) {
|
|
168
189
|
return void 0;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-AOUAT7U3.mjs";
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/.pnpm/merge@2.1.1/node_modules/merge/lib/src/index.js
|
|
7
|
+
var require_src = __commonJS({
|
|
8
|
+
"../../node_modules/.pnpm/merge@2.1.1/node_modules/merge/lib/src/index.js"(exports, module) {
|
|
9
|
+
"use strict";
|
|
10
|
+
init_esm_shims();
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.isPlainObject = exports.clone = exports.recursive = exports.merge = exports.main = void 0;
|
|
13
|
+
module.exports = exports = main;
|
|
14
|
+
exports.default = main;
|
|
15
|
+
function main() {
|
|
16
|
+
var items = [];
|
|
17
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
18
|
+
items[_i] = arguments[_i];
|
|
19
|
+
}
|
|
20
|
+
return merge.apply(void 0, items);
|
|
21
|
+
}
|
|
22
|
+
exports.main = main;
|
|
23
|
+
main.clone = clone;
|
|
24
|
+
main.isPlainObject = isPlainObject;
|
|
25
|
+
main.recursive = recursive;
|
|
26
|
+
function merge() {
|
|
27
|
+
var items = [];
|
|
28
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
29
|
+
items[_i] = arguments[_i];
|
|
30
|
+
}
|
|
31
|
+
return _merge(items[0] === true, false, items);
|
|
32
|
+
}
|
|
33
|
+
exports.merge = merge;
|
|
34
|
+
function recursive() {
|
|
35
|
+
var items = [];
|
|
36
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
37
|
+
items[_i] = arguments[_i];
|
|
38
|
+
}
|
|
39
|
+
return _merge(items[0] === true, true, items);
|
|
40
|
+
}
|
|
41
|
+
exports.recursive = recursive;
|
|
42
|
+
function clone(input) {
|
|
43
|
+
if (Array.isArray(input)) {
|
|
44
|
+
var output = [];
|
|
45
|
+
for (var index = 0; index < input.length; ++index)
|
|
46
|
+
output.push(clone(input[index]));
|
|
47
|
+
return output;
|
|
48
|
+
} else if (isPlainObject(input)) {
|
|
49
|
+
var output = {};
|
|
50
|
+
for (var index in input)
|
|
51
|
+
output[index] = clone(input[index]);
|
|
52
|
+
return output;
|
|
53
|
+
} else {
|
|
54
|
+
return input;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.clone = clone;
|
|
58
|
+
function isPlainObject(input) {
|
|
59
|
+
return input && typeof input === "object" && !Array.isArray(input);
|
|
60
|
+
}
|
|
61
|
+
exports.isPlainObject = isPlainObject;
|
|
62
|
+
function _recursiveMerge(base, extend) {
|
|
63
|
+
if (!isPlainObject(base))
|
|
64
|
+
return extend;
|
|
65
|
+
for (var key in extend) {
|
|
66
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
67
|
+
continue;
|
|
68
|
+
base[key] = isPlainObject(base[key]) && isPlainObject(extend[key]) ? _recursiveMerge(base[key], extend[key]) : extend[key];
|
|
69
|
+
}
|
|
70
|
+
return base;
|
|
71
|
+
}
|
|
72
|
+
function _merge(isClone, isRecursive, items) {
|
|
73
|
+
var result;
|
|
74
|
+
if (isClone || !isPlainObject(result = items.shift()))
|
|
75
|
+
result = {};
|
|
76
|
+
for (var index = 0; index < items.length; ++index) {
|
|
77
|
+
var item = items[index];
|
|
78
|
+
if (!isPlainObject(item))
|
|
79
|
+
continue;
|
|
80
|
+
for (var key in item) {
|
|
81
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype")
|
|
82
|
+
continue;
|
|
83
|
+
var value = isClone ? clone(item[key]) : item[key];
|
|
84
|
+
result[key] = isRecursive ? _recursiveMerge(result[key], value) : value;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
require_src
|
|
94
|
+
};
|