weapp-vite 6.0.0-alpha.3 → 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.
@@ -2,7 +2,7 @@ import {
2
2
  getCompilerContext,
3
3
  resetCompilerContext,
4
4
  setActiveCompilerContextKey
5
- } from "./chunk-645T2KR3.mjs";
5
+ } from "./chunk-ZAAP7JAU.mjs";
6
6
  import {
7
7
  init_esm_shims
8
8
  } from "./chunk-5CBZRYDL.mjs";
@@ -144,18 +144,21 @@ async function extractConfigFromVue(vueFilePath) {
144
144
  if (errors.length > 0) {
145
145
  return void 0;
146
146
  }
147
- const configBlocks = descriptor.customBlocks.filter((block) => block.type === "config");
148
- if (!configBlocks.length) {
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 Promise.resolve().then(() => _interopRequireWildcard(require("comment-json")));
153
- for (const block of configBlocks) {
153
+ for (const block of jsonBlocks) {
154
154
  try {
155
- const lang = block.lang || "json";
156
- if (lang === "json" || lang === "json5" || lang === "jsonc") {
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
- Object.assign(mergedConfig, config);
158
+ if (config && typeof config === "object" && !Array.isArray(config)) {
159
+ Object.assign(mergedConfig, config);
160
+ }
161
+ continue;
159
162
  }
160
163
  } catch (e3) {
161
164
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkHXHJ32P4cjs = require('./chunk-HXHJ32P4.cjs');
5
+ var _chunkEVZXCCHNcjs = require('./chunk-EVZXCCHN.cjs');
6
6
 
7
7
 
8
8
  var _chunkTZGJRA2Ycjs = require('./chunk-TZGJRA2Y.cjs');
@@ -12,10 +12,10 @@ _chunkTZGJRA2Ycjs.init_cjs_shims.call(void 0, );
12
12
  async function createCompilerContext(options) {
13
13
  const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.key]), () => ( "default"));
14
14
  if (!_optionalChain([options, 'optionalAccess', _2 => _2.key])) {
15
- _chunkHXHJ32P4cjs.resetCompilerContext.call(void 0, key);
15
+ _chunkEVZXCCHNcjs.resetCompilerContext.call(void 0, key);
16
16
  }
17
- _chunkHXHJ32P4cjs.setActiveCompilerContextKey.call(void 0, key);
18
- const ctx = _chunkHXHJ32P4cjs.getCompilerContext.call(void 0, key);
17
+ _chunkEVZXCCHNcjs.setActiveCompilerContextKey.call(void 0, key);
18
+ const ctx = _chunkEVZXCCHNcjs.getCompilerContext.call(void 0, key);
19
19
  const { configService, scanService, autoRoutesService } = ctx;
20
20
  await configService.load(options);
21
21
  if (autoRoutesService) {