weapp-vite 6.15.12 → 6.15.13
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 +3 -3
- package/dist/{createContext-CySjzbQy.mjs → createContext-CBnOZ_FN.mjs} +62 -16
- package/dist/file-BbtjekFm.mjs +2 -0
- package/dist/{file-pbdfOAKg.mjs → file-CycxGM0E.mjs} +1 -1
- package/dist/getInstance-BN1eXe7O.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/file-slN_aOEg.mjs +0 -2
- package/dist/getInstance-BGGhJCLI.mjs +0 -2
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getCompilerContext, u as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { i as getCompilerContext, u as getRouteRuntimeGlobalKeys } from "./createContext-CBnOZ_FN.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 { S as isPathInside, _ as DEFAULT_MP_PLATFORM, b as resolveMiniPlatform, c as createSharedBuildConfig, d as resolveWeappConfigFile, f as checkRuntime, g as createCjsConfigLoadError, h as parseCommentJson, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as loadViteConfigFile, n as syncProjectSupportFiles, p as getProjectConfigFileName, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as getDefaultIdeProjectRoot, x as shouldPassPlatformArgToIdeOpen, y as normalizeMiniPlatform } from "./createContext-
|
|
1
|
+
import { S as isPathInside, _ as DEFAULT_MP_PLATFORM, b as resolveMiniPlatform, c as createSharedBuildConfig, d as resolveWeappConfigFile, f as checkRuntime, g as createCjsConfigLoadError, h as parseCommentJson, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as loadViteConfigFile, n as syncProjectSupportFiles, p as getProjectConfigFileName, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as getDefaultIdeProjectRoot, x as shouldPassPlatformArgToIdeOpen, y as normalizeMiniPlatform } from "./createContext-CBnOZ_FN.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
|
|
3
|
-
import { h as VERSION } from "./file-
|
|
3
|
+
import { h as VERSION } from "./file-CycxGM0E.mjs";
|
|
4
4
|
import { a as resolveWeappMcpConfig, o as startWeappViteMcpServer } from "./mcp-DRlj32v4.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -2125,7 +2125,7 @@ function registerPrepareCommand(cli) {
|
|
|
2125
2125
|
}
|
|
2126
2126
|
//#endregion
|
|
2127
2127
|
//#region package.json
|
|
2128
|
-
var version = "6.15.
|
|
2128
|
+
var version = "6.15.13";
|
|
2129
2129
|
//#endregion
|
|
2130
2130
|
//#region src/cli/devHotkeys/format.ts
|
|
2131
2131
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as applyWeappViteHostMeta } from "./pluginHost-BzPJL4F-.mjs";
|
|
2
2
|
import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.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-CycxGM0E.mjs";
|
|
4
4
|
import { createRequire, isBuiltin } from "node:module";
|
|
5
5
|
import path, { posix } from "pathe";
|
|
6
6
|
import path$1, { normalize, relative, win32 } from "node:path";
|
|
@@ -29265,6 +29265,18 @@ function matchesSubPackageDependency(dependencies, importee, fallbackDependencie
|
|
|
29265
29265
|
}
|
|
29266
29266
|
//#endregion
|
|
29267
29267
|
//#region src/plugins/core/lifecycle/emit/rewrite/localRoot.ts
|
|
29268
|
+
function isRelativeMiniprogramNpmImport(importee) {
|
|
29269
|
+
return importee === "miniprogram_npm" || importee.startsWith("./miniprogram_npm/") || importee.startsWith("../miniprogram_npm/") || importee.includes("/miniprogram_npm/");
|
|
29270
|
+
}
|
|
29271
|
+
function isToEsmCall(node) {
|
|
29272
|
+
const callee = node?.callee;
|
|
29273
|
+
if (!callee) return false;
|
|
29274
|
+
if (callee.type === "Identifier") return callee.name === "__toESM";
|
|
29275
|
+
return callee.type === "MemberExpression" && !callee.computed && callee.property?.type === "Identifier" && callee.property.name === "__toESM";
|
|
29276
|
+
}
|
|
29277
|
+
function isNumericOneLiteral(node) {
|
|
29278
|
+
return (node?.type === "NumericLiteral" || node?.type === "Literal") && node.value === 1;
|
|
29279
|
+
}
|
|
29268
29280
|
function toRelativeRuntimeNpmImport(fileName, root, importee, basedir) {
|
|
29269
29281
|
const normalized = normalizeWeappLocalNpmImport(importee, basedir);
|
|
29270
29282
|
const target = root ? `${root}/miniprogram_npm/${normalized}` : `miniprogram_npm/${normalized}`;
|
|
@@ -29276,20 +29288,54 @@ function rewriteChunkNpmImportsToLocalRoot(chunk, root, dependencyPatterns, depe
|
|
|
29276
29288
|
try {
|
|
29277
29289
|
const ast = parseJsLike(chunk.code);
|
|
29278
29290
|
let mutated = false;
|
|
29279
|
-
|
|
29280
|
-
|
|
29281
|
-
|
|
29282
|
-
|
|
29283
|
-
|
|
29284
|
-
|
|
29285
|
-
|
|
29286
|
-
|
|
29287
|
-
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
|
|
29291
|
-
|
|
29292
|
-
|
|
29291
|
+
const localizedRequireBindings = /* @__PURE__ */ new Set();
|
|
29292
|
+
traverse(ast, {
|
|
29293
|
+
VariableDeclarator(path) {
|
|
29294
|
+
const id = path.node?.id;
|
|
29295
|
+
const init = path.node?.init;
|
|
29296
|
+
if (!id || id.type !== "Identifier" || !init || init.type !== "CallExpression") return;
|
|
29297
|
+
const callee = init.callee;
|
|
29298
|
+
if (!callee || callee.type !== "Identifier" || callee.name !== "require") return;
|
|
29299
|
+
if (path.scope?.hasBinding?.("require")) return;
|
|
29300
|
+
const currentValue = getRequireImportLiteral(init.arguments?.[0]);
|
|
29301
|
+
if (typeof currentValue === "string" && isRelativeMiniprogramNpmImport(currentValue)) localizedRequireBindings.add(id.name);
|
|
29302
|
+
},
|
|
29303
|
+
AssignmentExpression(path) {
|
|
29304
|
+
const left = path.node?.left;
|
|
29305
|
+
const right = path.node?.right;
|
|
29306
|
+
if (!left || left.type !== "Identifier" || !right || right.type !== "CallExpression") return;
|
|
29307
|
+
const callee = right.callee;
|
|
29308
|
+
if (!callee || callee.type !== "Identifier" || callee.name !== "require") return;
|
|
29309
|
+
if (path.scope?.hasBinding?.("require")) return;
|
|
29310
|
+
const currentValue = getRequireImportLiteral(right.arguments?.[0]);
|
|
29311
|
+
if (typeof currentValue === "string" && isRelativeMiniprogramNpmImport(currentValue)) localizedRequireBindings.add(left.name);
|
|
29312
|
+
},
|
|
29313
|
+
CallExpression(path) {
|
|
29314
|
+
const callee = path.node?.callee;
|
|
29315
|
+
if (callee?.type === "Identifier" && callee.name === "require") {
|
|
29316
|
+
if (path.scope?.hasBinding?.("require")) return;
|
|
29317
|
+
const args = path.node.arguments;
|
|
29318
|
+
if (!Array.isArray(args) || args.length === 0) return;
|
|
29319
|
+
const firstArg = args[0];
|
|
29320
|
+
const currentValue = getRequireImportLiteral(firstArg);
|
|
29321
|
+
if (typeof currentValue !== "string" || !matchesSubPackageDependency(dependencyPatterns, currentValue, dependencies)) return;
|
|
29322
|
+
const nextValue = toRelativeRuntimeNpmImport(chunk.fileName, root, currentValue, options?.basedir);
|
|
29323
|
+
if (nextValue === currentValue) return;
|
|
29324
|
+
setRequireImportLiteral(firstArg, nextValue);
|
|
29325
|
+
if (isRelativeMiniprogramNpmImport(nextValue) && path.parentPath?.node?.type === "VariableDeclarator" && path.parentPath.node.id?.type === "Identifier") localizedRequireBindings.add(path.parentPath.node.id.name);
|
|
29326
|
+
if (isRelativeMiniprogramNpmImport(nextValue) && path.parentPath?.node?.type === "AssignmentExpression" && path.parentPath.node.left?.type === "Identifier") localizedRequireBindings.add(path.parentPath.node.left.name);
|
|
29327
|
+
mutated = true;
|
|
29328
|
+
return;
|
|
29329
|
+
}
|
|
29330
|
+
if (!isToEsmCall(path.node)) return;
|
|
29331
|
+
const args = path.node.arguments;
|
|
29332
|
+
if (!Array.isArray(args) || args.length < 2 || !isNumericOneLiteral(args[1])) return;
|
|
29333
|
+
const firstArg = args[0];
|
|
29334
|
+
if (!(firstArg?.type === "Identifier" ? localizedRequireBindings.has(firstArg.name) : firstArg?.type === "CallExpression" && firstArg.callee?.type === "Identifier" && firstArg.callee.name === "require" && typeof getRequireImportLiteral(firstArg.arguments?.[0]) === "string" && isRelativeMiniprogramNpmImport(String(getRequireImportLiteral(firstArg.arguments?.[0]))))) return;
|
|
29335
|
+
path.node.arguments = [firstArg];
|
|
29336
|
+
mutated = true;
|
|
29337
|
+
}
|
|
29338
|
+
});
|
|
29293
29339
|
if (mutated) chunk.code = generate(ast).code;
|
|
29294
29340
|
} catch {}
|
|
29295
29341
|
}
|
|
@@ -35311,7 +35357,7 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
35311
35357
|
const vueAppPath = await findVueEntry(appBasename);
|
|
35312
35358
|
let configFromVue;
|
|
35313
35359
|
if (!appConfigFile && vueAppPath) {
|
|
35314
|
-
const { extractConfigFromVue } = await import("./file-
|
|
35360
|
+
const { extractConfigFromVue } = await import("./file-BbtjekFm.mjs");
|
|
35315
35361
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
35316
35362
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
35317
35363
|
}
|
|
@@ -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-BN1eXe7O.mjs");
|
|
88
88
|
const compilerContext = getCompilerContext();
|
|
89
89
|
const service = compilerContext.autoRoutesService;
|
|
90
90
|
const reference = service?.getReference?.();
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCompilerContext } from "./createContext-
|
|
1
|
+
import { t as createCompilerContext } from "./createContext-CBnOZ_FN.mjs";
|
|
2
2
|
import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-wnfVS9jE.mjs";
|
|
3
3
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-BzPJL4F-.mjs";
|
|
4
4
|
import { t as defineConfig } from "./config-B2xtjEug.mjs";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.15.
|
|
4
|
+
"version": "6.15.13",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"@weapp-core/logger": "3.1.1",
|
|
123
123
|
"@weapp-core/schematics": "6.0.4",
|
|
124
124
|
"@weapp-core/shared": "3.0.4",
|
|
125
|
-
"@weapp-vite/ast": "6.15.
|
|
125
|
+
"@weapp-vite/ast": "6.15.13",
|
|
126
126
|
"@weapp-vite/mcp": "1.2.1",
|
|
127
127
|
"@weapp-vite/miniprogram-automator": "1.0.3",
|
|
128
128
|
"@weapp-vite/volar": "2.1.0",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"rolldown-require": "2.0.14",
|
|
133
133
|
"vite-plugin-performance": "2.0.1",
|
|
134
134
|
"weapp-ide-cli": "5.2.4",
|
|
135
|
-
"wevu": "6.15.
|
|
135
|
+
"wevu": "6.15.13"
|
|
136
136
|
},
|
|
137
137
|
"publishConfig": {
|
|
138
138
|
"access": "public",
|
package/dist/file-slN_aOEg.mjs
DELETED