weapp-vite 6.19.0 → 6.19.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/auto-routes.mjs +1 -1
- package/dist/cli.mjs +14 -11
- package/dist/{createContext-B5rRMSjV.mjs → createContext-DrwOUlDX.mjs} +52 -36
- package/dist/{file-BgstESAr.mjs → file-CdNDPmkx.mjs} +1 -1
- package/dist/file-TBExd8Jd.mjs +2 -0
- package/dist/getInstance-wujsDq8Q.mjs +2 -0
- package/dist/index.mjs +2 -2
- package/dist/{runtime-kc5RVjrC.mjs → runtime-D6VCNhNY.mjs} +4 -2
- package/dist/runtime.mjs +1 -1
- package/dist/test.mjs +1 -1
- package/package.json +19 -19
- package/dist/file-DDpy9efy.mjs +0 -2
- package/dist/getInstance-DYwC9HEv.mjs +0 -2
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-DrwOUlDX.mjs";
|
|
2
2
|
//#region src/auto-routes.ts
|
|
3
3
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
4
4
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as parseCommentJson, D as isPathInside, E as shouldPassPlatformArgToIdeOpen, S as loadViteConfigFile, T as getDefaultIdeProjectRoot, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as createCjsConfigLoadError, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-
|
|
1
|
+
import { C as parseCommentJson, D as isPathInside, E as shouldPassPlatformArgToIdeOpen, S as loadViteConfigFile, T as getDefaultIdeProjectRoot, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as createCjsConfigLoadError, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-DrwOUlDX.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
|
|
3
|
-
import { h as VERSION } from "./file-
|
|
3
|
+
import { h as VERSION } from "./file-CdNDPmkx.mjs";
|
|
4
4
|
import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -1177,8 +1177,8 @@ function analyzeComponentUsage(options) {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
//#endregion
|
|
1179
1179
|
//#region src/analyze/subpackages/metadata.ts
|
|
1180
|
-
const defaultTotalBudgetBytes =
|
|
1181
|
-
const defaultPackageBudgetBytes =
|
|
1180
|
+
const defaultTotalBudgetBytes = 20971520;
|
|
1181
|
+
const defaultPackageBudgetBytes = 2097152;
|
|
1182
1182
|
const defaultWarningRatio = .85;
|
|
1183
1183
|
const defaultHistoryDir = ".weapp-vite/analyze-history";
|
|
1184
1184
|
const defaultHistoryLimit = 20;
|
|
@@ -1525,10 +1525,11 @@ async function analyzeSubpackages(ctx) {
|
|
|
1525
1525
|
subPackageRoots,
|
|
1526
1526
|
independentRoots
|
|
1527
1527
|
};
|
|
1528
|
-
const
|
|
1528
|
+
const analysisConfig = configService.merge(void 0, createSharedBuildConfig(configService, scanService), { build: {
|
|
1529
1529
|
write: false,
|
|
1530
1530
|
watch: null
|
|
1531
|
-
} })
|
|
1531
|
+
} });
|
|
1532
|
+
const mainResult = await build(analysisConfig);
|
|
1532
1533
|
const mainOutputs = Array.isArray(mainResult) ? mainResult : [mainResult];
|
|
1533
1534
|
const packages = /* @__PURE__ */ new Map();
|
|
1534
1535
|
const modules = /* @__PURE__ */ new Map();
|
|
@@ -1995,7 +1996,7 @@ const ANALYZE_DASHBOARD_PACKAGE_NAME = "@weapp-vite/dashboard";
|
|
|
1995
1996
|
const ANALYZE_SSE_PATH = "/__weapp_vite_analyze";
|
|
1996
1997
|
const FILE_CONTENT_PATH = "/__weapp_vite_file_content";
|
|
1997
1998
|
const DASHBOARD_EVENT_NAME = "weapp-dashboard:event";
|
|
1998
|
-
const MAX_FILE_CONTENT_BYTES =
|
|
1999
|
+
const MAX_FILE_CONTENT_BYTES = 2097152;
|
|
1999
2000
|
const require = createRequire(import.meta.url);
|
|
2000
2001
|
function createInstallCommand(agent) {
|
|
2001
2002
|
const resolved = resolveCommand(agent ?? "npm", "install", [ANALYZE_DASHBOARD_PACKAGE_NAME]);
|
|
@@ -4011,7 +4012,8 @@ async function resolveHttpUrl(options) {
|
|
|
4011
4012
|
const originalCwd = process.cwd();
|
|
4012
4013
|
try {
|
|
4013
4014
|
if (workspaceRoot !== originalCwd) process.chdir(workspaceRoot);
|
|
4014
|
-
const
|
|
4015
|
+
const loaded = await loadConfig(resolveConfigFile(options));
|
|
4016
|
+
const resolved = resolveWeappMcpConfig(loaded?.config?.weapp?.mcp);
|
|
4015
4017
|
return `http://${resolved.host}:${resolved.port}${resolved.endpoint}`;
|
|
4016
4018
|
} catch {
|
|
4017
4019
|
const resolved = resolveWeappMcpConfig(void 0);
|
|
@@ -4290,7 +4292,7 @@ function registerPrepareCommand(cli) {
|
|
|
4290
4292
|
filterDuplicateOptions(options);
|
|
4291
4293
|
const cwd = path.resolve(resolvePrepareRoot(input));
|
|
4292
4294
|
const cliPlatform = resolvePreparePlatform(options);
|
|
4293
|
-
const
|
|
4295
|
+
const ctx = await createCompilerContext({
|
|
4294
4296
|
cwd,
|
|
4295
4297
|
isDev: false,
|
|
4296
4298
|
mode: typeof options.mode === "string" ? options.mode : "development",
|
|
@@ -4299,7 +4301,8 @@ function registerPrepareCommand(cli) {
|
|
|
4299
4301
|
syncSupportFiles: false,
|
|
4300
4302
|
preloadAppEntry: false,
|
|
4301
4303
|
...cliPlatform ? { cliPlatform } : {}
|
|
4302
|
-
})
|
|
4304
|
+
});
|
|
4305
|
+
const supportFiles = await syncProjectSupportFiles(ctx);
|
|
4303
4306
|
for (const warning of supportFiles.managedTsconfigWarnings) logger_default.warn(warning);
|
|
4304
4307
|
logger_default.info("已生成 .weapp-vite 支持文件。");
|
|
4305
4308
|
} catch (error) {
|
|
@@ -4537,7 +4540,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
4537
4540
|
}
|
|
4538
4541
|
//#endregion
|
|
4539
4542
|
//#region package.json
|
|
4540
|
-
var version = "6.19.
|
|
4543
|
+
var version = "6.19.1";
|
|
4541
4544
|
//#endregion
|
|
4542
4545
|
//#region src/cli/devHotkeys/format.ts
|
|
4543
4546
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
|
|
2
2
|
import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.mjs";
|
|
3
|
-
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-
|
|
3
|
+
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-CdNDPmkx.mjs";
|
|
4
4
|
import { createRequire, isBuiltin } from "node:module";
|
|
5
5
|
import { createDebug } from "obug";
|
|
6
6
|
import fs, { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
@@ -480,7 +480,8 @@ function normalizeRelativePath$1(value) {
|
|
|
480
480
|
}
|
|
481
481
|
function normalizeWatchPath(value) {
|
|
482
482
|
if (!value) return value;
|
|
483
|
-
|
|
483
|
+
const posix = toPosixPath(stripWindowsDevicePath(value));
|
|
484
|
+
return toPosixPath(normalize(posix));
|
|
484
485
|
}
|
|
485
486
|
function stripLeadingSlashes(value) {
|
|
486
487
|
return value.replace(LEADING_SLASH_RE$3, "");
|
|
@@ -1320,10 +1321,11 @@ function extractFromPropsInterfaceMembers(node) {
|
|
|
1320
1321
|
}
|
|
1321
1322
|
function extractComponentPropsFromDts(code) {
|
|
1322
1323
|
let props = /* @__PURE__ */ new Map();
|
|
1323
|
-
|
|
1324
|
+
const ast = parse$2(code, {
|
|
1324
1325
|
...BABEL_TS_MODULE_PARSER_OPTIONS,
|
|
1325
1326
|
errorRecovery: true
|
|
1326
|
-
})
|
|
1327
|
+
});
|
|
1328
|
+
traverse(ast, {
|
|
1327
1329
|
TSInterfaceDeclaration(path) {
|
|
1328
1330
|
if (props.size > 0) {
|
|
1329
1331
|
path.stop();
|
|
@@ -6042,7 +6044,7 @@ function createAutoImportScheduling(options) {
|
|
|
6042
6044
|
//#region src/runtime/autoImport/service/shared.ts
|
|
6043
6045
|
const logWarnCache = new LRUCache({
|
|
6044
6046
|
max: 512,
|
|
6045
|
-
ttl:
|
|
6047
|
+
ttl: 36e5
|
|
6046
6048
|
});
|
|
6047
6049
|
function logWarnOnce(message) {
|
|
6048
6050
|
if (logWarnCache.get(message)) return;
|
|
@@ -7646,8 +7648,10 @@ async function transformVueSource(code, id) {
|
|
|
7646
7648
|
const { descriptor, errors } = parse(code, { filename: id });
|
|
7647
7649
|
if (errors.length) throw errors[0];
|
|
7648
7650
|
const blocks = [descriptor.script, descriptor.scriptSetup].filter((block) => block?.content);
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
+
const source = blocks.map((block) => block.content).join("\n") || "export default {}";
|
|
7652
|
+
const lang = blocks.some((block) => block?.lang === "tsx") ? "tsx" : blocks.some((block) => block?.lang === "ts") ? "ts" : "js";
|
|
7653
|
+
return await transformWithOxc(source, id, {
|
|
7654
|
+
lang,
|
|
7651
7655
|
sourcemap: false,
|
|
7652
7656
|
target: "esnext"
|
|
7653
7657
|
});
|
|
@@ -8221,9 +8225,7 @@ function ensureModuleResolution(ts, compilerOptions) {
|
|
|
8221
8225
|
case ts.ModuleKind.NodeNext:
|
|
8222
8226
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
8223
8227
|
break;
|
|
8224
|
-
default:
|
|
8225
|
-
moduleResolution = ts.version.startsWith("5") ? ts.ModuleResolutionKind.Bundler : ts.ModuleResolutionKind.Classic;
|
|
8226
|
-
break;
|
|
8228
|
+
default: moduleResolution = ts.version.startsWith("5") ? ts.ModuleResolutionKind.Bundler : ts.ModuleResolutionKind.Classic;
|
|
8227
8229
|
}
|
|
8228
8230
|
compilerOptions.moduleResolution = moduleResolution;
|
|
8229
8231
|
}
|
|
@@ -8604,13 +8606,13 @@ function getWeappViteConfig() {
|
|
|
8604
8606
|
platform: DEFAULT_MP_PLATFORM,
|
|
8605
8607
|
multiPlatform: false,
|
|
8606
8608
|
es5: false,
|
|
8607
|
-
packageSizeWarningBytes:
|
|
8609
|
+
packageSizeWarningBytes: 2097152,
|
|
8608
8610
|
analyze: {
|
|
8609
8611
|
budgets: {
|
|
8610
|
-
totalBytes:
|
|
8611
|
-
mainBytes:
|
|
8612
|
-
subPackageBytes:
|
|
8613
|
-
independentBytes:
|
|
8612
|
+
totalBytes: 20971520,
|
|
8613
|
+
mainBytes: 2097152,
|
|
8614
|
+
subPackageBytes: 2097152,
|
|
8615
|
+
independentBytes: 2097152,
|
|
8614
8616
|
warningRatio: .85
|
|
8615
8617
|
},
|
|
8616
8618
|
history: {
|
|
@@ -8663,7 +8665,7 @@ function getWeappViteConfig() {
|
|
|
8663
8665
|
dynamicImports: "preserve",
|
|
8664
8666
|
logOptimization: true,
|
|
8665
8667
|
forceDuplicatePatterns: [],
|
|
8666
|
-
duplicateWarningBytes:
|
|
8668
|
+
duplicateWarningBytes: 524288
|
|
8667
8669
|
}
|
|
8668
8670
|
};
|
|
8669
8671
|
}
|
|
@@ -10061,7 +10063,8 @@ function resolveTakeSharedChunkName(options) {
|
|
|
10061
10063
|
function createSharedChunkNameFromKeys(keys) {
|
|
10062
10064
|
const sanitize = (value) => value.replace(/[\\/]+/g, "_");
|
|
10063
10065
|
const combination = keys.filter(Boolean).map(sanitize).sort().join("+");
|
|
10064
|
-
|
|
10066
|
+
const combinationSegment = combination ? `${combination}/` : "";
|
|
10067
|
+
return `${SHARED_CHUNK_VIRTUAL_PREFIX}/${combinationSegment}common`;
|
|
10065
10068
|
}
|
|
10066
10069
|
function resolveSharedChunkName(options) {
|
|
10067
10070
|
const { id, ctx, relativeAbsoluteSrcRoot, subPackageRoots, strategy, sharedMode, resolveSharedMode, resolveSharedPath, forceDuplicateTester } = options;
|
|
@@ -11342,7 +11345,7 @@ async function readBody(request) {
|
|
|
11342
11345
|
for await (const chunk of request) {
|
|
11343
11346
|
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
11344
11347
|
size += buffer.length;
|
|
11345
|
-
if (size >
|
|
11348
|
+
if (size > 65536) throw new Error("stateful HMR request body is too large");
|
|
11346
11349
|
chunks.push(buffer);
|
|
11347
11350
|
}
|
|
11348
11351
|
return Buffer.concat(chunks).toString("utf8");
|
|
@@ -11497,7 +11500,7 @@ function toStableModuleId(id, root) {
|
|
|
11497
11500
|
//#endregion
|
|
11498
11501
|
//#region src/runtime/statefulHmr/session.ts
|
|
11499
11502
|
const maxRetainedDeltaCount = 1e3;
|
|
11500
|
-
const maxRetainedDeltaBytes =
|
|
11503
|
+
const maxRetainedDeltaBytes = 16777216;
|
|
11501
11504
|
async function runStatefulHmrDev(ctx, buildOptions, restart) {
|
|
11502
11505
|
const configService = ctx.configService;
|
|
11503
11506
|
if (configService.platform !== "weapp") throw new Error("weapp.hmr.runtime=\"stateful-experimental\" 目前仅支持微信小程序平台。");
|
|
@@ -13139,7 +13142,8 @@ function getManagedTypeScriptConfig(ctx) {
|
|
|
13139
13142
|
}
|
|
13140
13143
|
async function readLegacyManagedTsconfigFile(filePath) {
|
|
13141
13144
|
try {
|
|
13142
|
-
const
|
|
13145
|
+
const content = await fs$1.readFile(filePath, "utf8");
|
|
13146
|
+
const parsed = parse$1(content, void 0, true);
|
|
13143
13147
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
13144
13148
|
return parsed;
|
|
13145
13149
|
} catch {
|
|
@@ -14650,13 +14654,14 @@ function createBuildService(ctx) {
|
|
|
14650
14654
|
write: true
|
|
14651
14655
|
};
|
|
14652
14656
|
if (target === "app" && configService.weappViteConfig.hmr?.runtime === "stateful-experimental") {
|
|
14653
|
-
|
|
14657
|
+
const snapshotBuildOptions = {
|
|
14654
14658
|
...buildOptions,
|
|
14655
14659
|
build: {
|
|
14656
14660
|
...buildOptions.build ?? {},
|
|
14657
14661
|
watch: void 0
|
|
14658
14662
|
}
|
|
14659
|
-
}
|
|
14663
|
+
};
|
|
14664
|
+
await build(snapshotBuildOptions);
|
|
14660
14665
|
resetRuntimeStateForFreshBuild(ctx.runtimeState);
|
|
14661
14666
|
await scanService.loadAppEntry();
|
|
14662
14667
|
scanService.loadSubPackages();
|
|
@@ -15918,6 +15923,7 @@ function configureBuildAndPlugins(options) {
|
|
|
15918
15923
|
if (config.oxc !== false) {
|
|
15919
15924
|
const oxcOptions = config.oxc ?? {};
|
|
15920
15925
|
if (!Object.prototype.hasOwnProperty.call(oxcOptions, "tsconfig")) oxcOptions.tsconfig = false;
|
|
15926
|
+
if (config.esbuild !== false && config.esbuild?.jsx === "preserve" && !Object.prototype.hasOwnProperty.call(oxcOptions, "jsx")) oxcOptions.jsx = "preserve";
|
|
15921
15927
|
config.oxc = oxcOptions;
|
|
15922
15928
|
}
|
|
15923
15929
|
const rdTransform = rdOptions.transform ?? {};
|
|
@@ -17031,8 +17037,9 @@ function createDependenciesCache(ctx) {
|
|
|
17031
17037
|
return resolveMainPackageDependencyScope(ctx);
|
|
17032
17038
|
}
|
|
17033
17039
|
function dependenciesCacheHash(root) {
|
|
17040
|
+
const configService = requireConfigService(ctx, "读取依赖缓存哈希前必须初始化 configService。");
|
|
17034
17041
|
return objectHash({
|
|
17035
|
-
dependencies:
|
|
17042
|
+
dependencies: configService.packageJson.dependencies ?? {},
|
|
17036
17043
|
scope: serializeDependencyScope(resolveDependencyScope(root))
|
|
17037
17044
|
});
|
|
17038
17045
|
}
|
|
@@ -22495,7 +22502,8 @@ function removeImplicitPagePreloads(bundle, options, snapshot = createBundleChun
|
|
|
22495
22502
|
const pageChunkFileNames = /* @__PURE__ */ new Set();
|
|
22496
22503
|
for (const entry of entriesMap.values()) {
|
|
22497
22504
|
if (!entry || entry.type !== "page") continue;
|
|
22498
|
-
const
|
|
22505
|
+
const relative = configService.relativeAbsoluteSrcRoot(entry.path);
|
|
22506
|
+
const outputFile = changeFileExtension(relative, ".js");
|
|
22499
22507
|
pageChunkFileNames.add(outputFile);
|
|
22500
22508
|
}
|
|
22501
22509
|
if (pageChunkFileNames.size === 0) return;
|
|
@@ -23610,7 +23618,8 @@ function analyzeRequestGlobalsUsage(code, allowedTargets) {
|
|
|
23610
23618
|
if (typeof specifier === "string" && specifier.length > 0) matchedSpecifiers.add(specifier);
|
|
23611
23619
|
};
|
|
23612
23620
|
try {
|
|
23613
|
-
|
|
23621
|
+
const ast = parseJsLike(usageSource);
|
|
23622
|
+
traverse(ast, {
|
|
23614
23623
|
ImportDeclaration(path) {
|
|
23615
23624
|
addSpecifier(path.node?.source?.value);
|
|
23616
23625
|
},
|
|
@@ -25425,8 +25434,9 @@ function injectRequestGlobalsBundleRuntime(bundle, targets, mode, networkDefault
|
|
|
25425
25434
|
const topLevelDeclaredIdentifiers = collectTopLevelDeclaredIdentifiers(chunk.code);
|
|
25426
25435
|
const passiveBindingsCode = createRequestGlobalsPassiveBindingsCode(chunkTargets, bindingTargets.filter((target) => !topLevelDeclaredIdentifiers.has(target)));
|
|
25427
25436
|
const syntheticExportCode = exportName ? "" : `Object.defineProperty(exports,${JSON.stringify(REQUEST_GLOBAL_SYNTHETIC_EXPORT_NAME)},{enumerable:false,get:function(){return ${installerName}}});`;
|
|
25437
|
+
const installerOptionsCode = createRequestGlobalsInstallerOptionsCode(chunkTargets, networkDefaults);
|
|
25428
25438
|
const runtimeBindingCode = [
|
|
25429
|
-
`const ${REQUEST_GLOBAL_BUNDLE_HOST_REF} = ${installerName}(${
|
|
25439
|
+
`const ${REQUEST_GLOBAL_BUNDLE_HOST_REF} = ${installerName}(${installerOptionsCode}) || globalThis`,
|
|
25430
25440
|
...bindingTargets.map((target) => `${REQUEST_GLOBAL_ACTUALS_KEY}[${JSON.stringify(target)}] = ${REQUEST_GLOBAL_BUNDLE_HOST_REF}.${target}`),
|
|
25431
25441
|
...bindingTargets.map((target) => `try{globalThis[${JSON.stringify(target)}]=${REQUEST_GLOBAL_BUNDLE_HOST_REF}.${target}}catch{}`)
|
|
25432
25442
|
].join(";");
|
|
@@ -27415,7 +27425,8 @@ async function normalizeWatchEvent(id, event, options) {
|
|
|
27415
27425
|
if (event === "create" && await fs$1.pathExists(id)) {
|
|
27416
27426
|
const ext = path.extname(id);
|
|
27417
27427
|
if (ext) {
|
|
27418
|
-
const
|
|
27428
|
+
const basePath = id.slice(0, -ext.length);
|
|
27429
|
+
const primaryScript = await findJsEntry(basePath);
|
|
27419
27430
|
const primaryScriptId = primaryScript.path ? normalizeFsResolvedId(primaryScript.path) : "";
|
|
27420
27431
|
if (primaryScriptId && options.resolvedEntryMap.has(primaryScriptId)) return "update";
|
|
27421
27432
|
}
|
|
@@ -28218,13 +28229,14 @@ function resolveClassStylePackageRoot(ctx, relativeBase, configService) {
|
|
|
28218
28229
|
return "";
|
|
28219
28230
|
}
|
|
28220
28231
|
function resolveClassStyleWxsLocationForBase(ctx, relativeBase, extension, configService) {
|
|
28232
|
+
const packageRoot = configService.weappViteConfig?.vue?.template?.classStyleWxsShared ?? true ? resolveClassStylePackageRoot(ctx, relativeBase, configService) : (() => {
|
|
28233
|
+
const dir = path.posix.dirname(toPosixPath(relativeBase));
|
|
28234
|
+
return dir === "." ? "" : dir;
|
|
28235
|
+
})();
|
|
28221
28236
|
return resolveClassStyleWxsLocation({
|
|
28222
28237
|
relativeBase,
|
|
28223
28238
|
extension,
|
|
28224
|
-
packageRoot
|
|
28225
|
-
const dir = path.posix.dirname(toPosixPath(relativeBase));
|
|
28226
|
-
return dir === "." ? "" : dir;
|
|
28227
|
-
})()
|
|
28239
|
+
packageRoot
|
|
28228
28240
|
});
|
|
28229
28241
|
}
|
|
28230
28242
|
//#endregion
|
|
@@ -29345,7 +29357,8 @@ async function finalizeTransformEntryScript(options) {
|
|
|
29345
29357
|
}
|
|
29346
29358
|
function finalizeTransformEntryCode(options) {
|
|
29347
29359
|
const { result, filename, styleBlocks, isPage, isApp, isDev, sourceMap = true, hmrStyleToken } = options;
|
|
29348
|
-
const
|
|
29360
|
+
const script = result.script ?? "";
|
|
29361
|
+
const returned = new MagicString(script);
|
|
29349
29362
|
let hasMutation = false;
|
|
29350
29363
|
if (styleBlocks?.length) {
|
|
29351
29364
|
const styleImports = buildWeappVueStyleRequests(filename, styleBlocks, { hmrToken: hmrStyleToken }).map((request) => `import ${JSON.stringify(request)};\n`).join("");
|
|
@@ -29888,7 +29901,8 @@ function hasUnresolvedModuleImportDeclaration(script) {
|
|
|
29888
29901
|
if (!script?.includes("import")) return false;
|
|
29889
29902
|
try {
|
|
29890
29903
|
let hasUnresolvedImport = false;
|
|
29891
|
-
|
|
29904
|
+
const ast = parseJsLike(script);
|
|
29905
|
+
traverse(ast, { ImportDeclaration(path) {
|
|
29892
29906
|
const source = path.node.source.value;
|
|
29893
29907
|
if (typeof source === "string" && !(source === "wevu" || source === "wevu/router" || source === "wevu/store" || source === "wevu/api" || source === "wevu/fetch" || source === "wevu/web-apis" || source === "wevu/internal-runtime" || source === "wevu/internal-reactivity" || source === "wevu/internal-template" || Object.values(WEAPP_VITE_RUNTIME_VIRTUAL_IDS).includes(source))) {
|
|
29894
29908
|
hasUnresolvedImport = true;
|
|
@@ -31980,7 +31994,8 @@ function resolveScanAppPreludeBasename(absoluteSrcRoot) {
|
|
|
31980
31994
|
return path.resolve(absoluteSrcRoot, "app.prelude");
|
|
31981
31995
|
}
|
|
31982
31996
|
async function resolveScanAppPreludePath(absoluteSrcRoot) {
|
|
31983
|
-
|
|
31997
|
+
const basename = resolveScanAppPreludeBasename(absoluteSrcRoot);
|
|
31998
|
+
return (await findJsEntry(basename)).path;
|
|
31984
31999
|
}
|
|
31985
32000
|
function resolveScanPluginBasename(absolutePluginRoot) {
|
|
31986
32001
|
return absolutePluginRoot ? path.resolve(absolutePluginRoot, "plugin") : void 0;
|
|
@@ -32080,14 +32095,15 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
32080
32095
|
const { path: appEntryPath } = appEntry;
|
|
32081
32096
|
let configFromVue;
|
|
32082
32097
|
if (!appConfigFile && vueAppPath) {
|
|
32083
|
-
const { extractConfigFromVue } = await import("./file-
|
|
32098
|
+
const { extractConfigFromVue } = await import("./file-TBExd8Jd.mjs");
|
|
32084
32099
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
32085
32100
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
32086
32101
|
}
|
|
32087
32102
|
if (appEntryPath && vueAppPath) warnOnce(`[app] 检测到 ${path.basename(appEntryPath)} 与 ${path.basename(vueAppPath)} 同时存在,当前将优先使用 ${path.basename(appEntryPath)} 作为应用入口,${path.basename(vueAppPath)} 将被忽略。`);
|
|
32088
32103
|
if (discoveredAppConfigFile && vueAppPath) warnOnce(`[app] 检测到 ${path.basename(discoveredAppConfigFile)} 与 ${path.basename(vueAppPath)} 同时存在,当前将优先使用 ${path.basename(discoveredAppConfigFile)} 作为应用配置来源,${path.basename(vueAppPath)} 中的 app 配置不会生效。`);
|
|
32089
32104
|
if (ctx.configService.absolutePluginRoot) {
|
|
32090
|
-
const
|
|
32105
|
+
const pluginBasename = resolveScanPluginBasename(ctx.configService.absolutePluginRoot);
|
|
32106
|
+
const { path: pluginConfigFile } = await findJsonEntry(pluginBasename);
|
|
32091
32107
|
if (pluginConfigFile) {
|
|
32092
32108
|
scanState.pluginJson = await ctx.jsonService.read(pluginConfigFile);
|
|
32093
32109
|
scanState.pluginJsonPath = pluginConfigFile;
|
|
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
84
84
|
}
|
|
85
85
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
86
86
|
try {
|
|
87
|
-
const { getCompilerContext } = await import("./getInstance-
|
|
87
|
+
const { getCompilerContext } = await import("./getInstance-wujsDq8Q.mjs");
|
|
88
88
|
const compilerContext = getCompilerContext();
|
|
89
89
|
const service = compilerContext.autoRoutesService;
|
|
90
90
|
const reference = service?.getReference?.();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-BL8Dhhk6.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost--CaeyWpA.mjs";
|
|
3
3
|
import { t as defineConfig } from "./config-DRGcCi3h.mjs";
|
|
4
|
-
import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-
|
|
5
|
-
import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-
|
|
4
|
+
import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-DrwOUlDX.mjs";
|
|
5
|
+
import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-D6VCNhNY.mjs";
|
|
6
6
|
export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, registerLayoutHosts, resolveLayoutHost, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
|
|
@@ -22,7 +22,8 @@ function createWevuComponent(options) {
|
|
|
22
22
|
//#region src/plugins/vue/nativeLayoutHost.ts
|
|
23
23
|
const layoutHostRegistry = createMiniProgramLayoutHostRegistry();
|
|
24
24
|
function resolveCurrentPageInstance$1() {
|
|
25
|
-
|
|
25
|
+
const compiledPlatform = resolveMiniProgramPlatform(import.meta.env?.PLATFORM);
|
|
26
|
+
if (!supportsMiniProgramRuntimeCapability(compiledPlatform, "globalPageStack")) return;
|
|
26
27
|
const getCurrentPagesFn = globalThis.getCurrentPages;
|
|
27
28
|
if (typeof getCurrentPagesFn !== "function") return;
|
|
28
29
|
try {
|
|
@@ -83,7 +84,8 @@ function waitForLayoutHost(key, options = {}) {
|
|
|
83
84
|
//#endregion
|
|
84
85
|
//#region src/plugins/vue/nativePageLayout.ts
|
|
85
86
|
function resolveCurrentPageInstance() {
|
|
86
|
-
|
|
87
|
+
const compiledPlatform = resolveMiniProgramPlatform(import.meta.env?.PLATFORM);
|
|
88
|
+
if (!supportsMiniProgramRuntimeCapability(compiledPlatform, "globalPageStack")) return;
|
|
87
89
|
const getCurrentPagesFn = globalThis.getCurrentPages;
|
|
88
90
|
if (typeof getCurrentPagesFn !== "function") return;
|
|
89
91
|
try {
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-
|
|
1
|
+
import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-D6VCNhNY.mjs";
|
|
2
2
|
export { createWevuComponent, defineEmits, defineProps, registerLayoutHosts, resolveLayoutHost, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
|
package/dist/test.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.19.
|
|
4
|
+
"version": "6.19.1",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
"@babel/preset-env": "^8.0.2",
|
|
102
102
|
"@babel/preset-typescript": "^8.0.1",
|
|
103
103
|
"@jridgewell/remapping": "^2.3.5",
|
|
104
|
-
"@vercel/detect-agent": "^1.2.
|
|
104
|
+
"@vercel/detect-agent": "^1.2.4",
|
|
105
105
|
"@volar/typescript": "^2.4.28",
|
|
106
|
-
"@vue/language-core": "^3.3.
|
|
106
|
+
"@vue/language-core": "^3.3.9",
|
|
107
107
|
"cac": "^7.0.0",
|
|
108
108
|
"chokidar": "^5.0.0",
|
|
109
109
|
"comment-json": "^5.0.0",
|
|
@@ -118,39 +118,39 @@
|
|
|
118
118
|
"package-manager-detector": "^1.8.0",
|
|
119
119
|
"pathe": "^2.0.3",
|
|
120
120
|
"picomatch": "^4.0.5",
|
|
121
|
-
"postcss": "^8.5.
|
|
122
|
-
"rolldown": "1.
|
|
123
|
-
"rolldown-plugin-dts": "0.
|
|
121
|
+
"postcss": "^8.5.25",
|
|
122
|
+
"rolldown": "1.2.2",
|
|
123
|
+
"rolldown-plugin-dts": "0.28.0",
|
|
124
124
|
"semver": "^7.8.5",
|
|
125
125
|
"typescript": "^6.0.3",
|
|
126
|
-
"vite": "8.
|
|
126
|
+
"vite": "8.2.0",
|
|
127
127
|
"vite-tsconfig-paths": "^6.1.1",
|
|
128
128
|
"vue": "^3.5.40",
|
|
129
|
-
"vue-tsc": "^3.3.
|
|
129
|
+
"vue-tsc": "^3.3.9",
|
|
130
130
|
"@weapp-core/constants": "0.1.15",
|
|
131
131
|
"@weapp-core/init": "6.0.13",
|
|
132
132
|
"@weapp-core/logger": "3.1.1",
|
|
133
133
|
"@weapp-core/schematics": "6.0.4",
|
|
134
134
|
"@weapp-core/shared": "3.1.0",
|
|
135
|
-
"@weapp-vite/ast": "6.19.
|
|
135
|
+
"@weapp-vite/ast": "6.19.1",
|
|
136
|
+
"@weapp-vite/mcp": "1.4.11",
|
|
137
|
+
"@weapp-vite/miniprogram-automator": "1.2.10",
|
|
136
138
|
"@weapp-vite/volar": "2.1.2",
|
|
137
|
-
"@
|
|
138
|
-
"@
|
|
139
|
-
"
|
|
140
|
-
"@wevu/web-apis": "1.2.29",
|
|
141
|
-
"@wevu/api": "0.2.13",
|
|
142
|
-
"rolldown-require": "2.0.22",
|
|
139
|
+
"@wevu/api": "0.2.14",
|
|
140
|
+
"@wevu/web-apis": "1.2.30",
|
|
141
|
+
"rolldown-require": "2.0.23",
|
|
143
142
|
"vite-plugin-performance": "2.0.1",
|
|
144
|
-
"weapp-ide-cli": "6.0.
|
|
145
|
-
"wevu": "6.19.
|
|
143
|
+
"weapp-ide-cli": "6.0.2",
|
|
144
|
+
"wevu": "6.19.1",
|
|
145
|
+
"@weapp-vite/web": "1.4.1"
|
|
146
146
|
},
|
|
147
147
|
"publishConfig": {
|
|
148
148
|
"access": "public",
|
|
149
149
|
"registry": "https://registry.npmjs.org"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
|
-
"oxc-parser": "^0.
|
|
153
|
-
"oxc-walker": "^1.
|
|
152
|
+
"oxc-parser": "^0.143.0",
|
|
153
|
+
"oxc-walker": "^1.1.1",
|
|
154
154
|
"tailwindcss": "^4.3.3",
|
|
155
155
|
"ts-morph": "^28.0.0"
|
|
156
156
|
},
|
package/dist/file-DDpy9efy.mjs
DELETED