weapp-vite 2.1.4 → 2.1.6

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.
@@ -4,7 +4,7 @@ import { PackageJson } from 'pkg-types';
4
4
  import { InlineConfig } from 'vite';
5
5
  import { RollupWatcher, RollupOutput } from 'rollup';
6
6
  import { Options } from 'tsup';
7
- import * as ts_morph from 'ts-morph';
7
+ import { MemoryEmitResultFile } from 'ts-morph';
8
8
  import { Buffer } from 'node:buffer';
9
9
 
10
10
  interface WxmlDep {
@@ -175,7 +175,9 @@ declare class ScanService {
175
175
  isSubpackage?: boolean;
176
176
  } | undefined;
177
177
  get workersDir(): string | undefined;
178
- workersBuild(files: string[]): ts_morph.MemoryEmitResultFile[] | undefined;
178
+ workersBuild(files: string[]): (MemoryEmitResultFile & {
179
+ absPath: string;
180
+ })[] | undefined;
179
181
  }
180
182
 
181
183
  declare class SubPackageService {
@@ -4,7 +4,7 @@ import { PackageJson } from 'pkg-types';
4
4
  import { InlineConfig } from 'vite';
5
5
  import { RollupWatcher, RollupOutput } from 'rollup';
6
6
  import { Options } from 'tsup';
7
- import * as ts_morph from 'ts-morph';
7
+ import { MemoryEmitResultFile } from 'ts-morph';
8
8
  import { Buffer } from 'node:buffer';
9
9
 
10
10
  interface WxmlDep {
@@ -175,7 +175,9 @@ declare class ScanService {
175
175
  isSubpackage?: boolean;
176
176
  } | undefined;
177
177
  get workersDir(): string | undefined;
178
- workersBuild(files: string[]): ts_morph.MemoryEmitResultFile[] | undefined;
178
+ workersBuild(files: string[]): (MemoryEmitResultFile & {
179
+ absPath: string;
180
+ })[] | undefined;
179
181
  }
180
182
 
181
183
  declare class SubPackageService {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "../chunk-HAHM2NKS.mjs";
4
+ } from "../chunk-SINWZUTE.mjs";
5
5
 
6
6
  // src/auto-import-components/resolvers/index.ts
7
7
  init_esm_shims();
@@ -3,7 +3,7 @@ import {
3
3
  __name,
4
4
  __toESM,
5
5
  init_esm_shims
6
- } from "./chunk-HAHM2NKS.mjs";
6
+ } from "./chunk-SINWZUTE.mjs";
7
7
 
8
8
  // ../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
9
9
  var require_Reflect = __commonJS({
@@ -14307,7 +14307,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
14307
14307
  const absPath = path6.resolve(configService.cwd, relPath);
14308
14308
  cachedWatchFiles.push(absPath);
14309
14309
  const isWxs = relPath.endsWith(".wxs");
14310
- const isWorker = isJsOrTs(relPath) && scanService.workersDir && relPath.startsWith(scanService.workersDir);
14310
+ const isWorker = isJsOrTs(relPath) && scanService.workersDir && configService.relativeSrcRoot(relPath).startsWith(scanService.workersDir);
14311
14311
  const fileName = configService.relativeSrcRoot(relPath);
14312
14312
  if (isTemplateRequest(relPath)) {
14313
14313
  if (weapp?.enhance?.autoImportComponents && autoImportService.filter(relPath, subPackageMeta)) {
@@ -14473,7 +14473,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
14473
14473
  if (workerFiles) {
14474
14474
  for (let i2 = 0; i2 < workerFiles.length; i2++) {
14475
14475
  const workerFile = workerFiles[i2];
14476
- const fileName = configService.relativeSrcRoot(configService.relativeCwd(cachedWorkerFiles[i2].absPath));
14476
+ const fileName = configService.relativeSrcRoot(configService.relativeCwd(workerFile.absPath));
14477
14477
  this.emitFile({
14478
14478
  type: "prebuilt-chunk",
14479
14479
  fileName,
@@ -15099,7 +15099,7 @@ var externalPlugin = /* @__PURE__ */ __name(({ external, notExternal, externalNo
15099
15099
  }
15100
15100
  };
15101
15101
  }, "externalPlugin");
15102
- var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile = defaultReadFile } = {}) => {
15102
+ var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile: readFile2 = defaultReadFile } = {}) => {
15103
15103
  return {
15104
15104
  name: "bundle-require:inject-file-scope",
15105
15105
  setup(ctx) {
@@ -15112,7 +15112,7 @@ var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile = defaultReadFile
15112
15112
  ctx.onLoad({
15113
15113
  filter: JS_EXT_RE
15114
15114
  }, (args) => {
15115
- const contents = readFile(args.path);
15115
+ const contents = readFile2(args.path);
15116
15116
  const injectLines = [
15117
15117
  `const ${FILENAME_VAR_NAME} = ${JSON.stringify(args.path)};`,
15118
15118
  `const ${DIRNAME_VAR_NAME} = ${JSON.stringify(path22.dirname(args.path))};`,
@@ -15316,14 +15316,16 @@ init_esm_shims();
15316
15316
  import { defu as defu5, isObject as isObject4, objectHash } from "@weapp-core/shared";
15317
15317
  import fs10 from "fs-extra";
15318
15318
 
15319
- // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
15319
+ // ../../node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
15320
15320
  init_esm_shims();
15321
15321
  import fs9 from "node:fs";
15322
15322
  import { createRequire as createRequire4 } from "node:module";
15323
- import path11, { dirname as dirname2, win32, join } from "node:path";
15323
+ import path11, { dirname as dirname2, join, win32 } from "node:path";
15324
15324
  import process4 from "node:process";
15325
+ import fsPromises from "node:fs/promises";
15326
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
15325
15327
 
15326
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
15328
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
15327
15329
  init_esm_shims();
15328
15330
 
15329
15331
  // ../../node_modules/.pnpm/acorn@8.14.0/node_modules/acorn/dist/acorn.mjs
@@ -20892,7 +20894,7 @@ Parser2.acorn = {
20892
20894
  nonASCIIwhitespace
20893
20895
  };
20894
20896
 
20895
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
20897
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
20896
20898
  import { builtinModules, createRequire as createRequire3 } from "node:module";
20897
20899
  import fs8, { realpathSync, statSync, promises } from "node:fs";
20898
20900
 
@@ -20948,7 +20950,7 @@ function joinURL(base, ...input) {
20948
20950
  __name(joinURL, "joinURL");
20949
20951
  var protocolRelative = Symbol.for("ufo:protocolRelative");
20950
20952
 
20951
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
20953
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
20952
20954
  import { normalize, isAbsolute, extname as extname$1 } from "pathe";
20953
20955
  import { fileURLToPath as fileURLToPath$1, URL as URL$1, pathToFileURL as pathToFileURL$1 } from "node:url";
20954
20956
  import assert from "node:assert";
@@ -21645,7 +21647,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
21645
21647
  error.url = String(resolved);
21646
21648
  throw error;
21647
21649
  }
21648
- if (!preserveSymlinks) {
21650
+ {
21649
21651
  const real = realpathSync(filePath);
21650
21652
  const { search, hash } = resolved;
21651
21653
  resolved = pathToFileURL$1(real + (filePath.endsWith(path10.sep) ? "/" : ""));
@@ -22209,7 +22211,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
22209
22211
  if (resolved.protocol !== "file:") {
22210
22212
  return resolved;
22211
22213
  }
22212
- return finalizeResolution(resolved, base, preserveSymlinks);
22214
+ return finalizeResolution(resolved, base);
22213
22215
  }
22214
22216
  __name(moduleResolve, "moduleResolve");
22215
22217
  function fileURLToPath(id) {
@@ -22344,7 +22346,170 @@ function resolvePathSync(id, options) {
22344
22346
  }
22345
22347
  __name(resolvePathSync, "resolvePathSync");
22346
22348
 
22347
- // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
22349
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/macro.mjs
22350
+ init_esm_shims();
22351
+
22352
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/index.mjs
22353
+ init_esm_shims();
22354
+ var GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
22355
+ var QuansyncError = class extends Error {
22356
+ static {
22357
+ __name(this, "QuansyncError");
22358
+ }
22359
+ constructor(message = "Unexpected promise in sync context") {
22360
+ super(message);
22361
+ this.name = "QuansyncError";
22362
+ }
22363
+ };
22364
+ function isThenable(value) {
22365
+ return value && typeof value === "object" && typeof value.then === "function";
22366
+ }
22367
+ __name(isThenable, "isThenable");
22368
+ function isQuansyncGenerator(value) {
22369
+ return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
22370
+ }
22371
+ __name(isQuansyncGenerator, "isQuansyncGenerator");
22372
+ function fromObject(options) {
22373
+ const generator = /* @__PURE__ */ __name(function* (...args) {
22374
+ const isAsync = yield GET_IS_ASYNC;
22375
+ if (isAsync)
22376
+ return yield options.async.apply(this, args);
22377
+ return options.sync.apply(this, args);
22378
+ }, "generator");
22379
+ function fn(...args) {
22380
+ const iter = generator.apply(this, args);
22381
+ iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
22382
+ iter.__quansync = true;
22383
+ return iter;
22384
+ }
22385
+ __name(fn, "fn");
22386
+ fn.sync = options.sync;
22387
+ fn.async = options.async;
22388
+ return fn;
22389
+ }
22390
+ __name(fromObject, "fromObject");
22391
+ function fromPromise(promise) {
22392
+ return fromObject({
22393
+ async: /* @__PURE__ */ __name(() => Promise.resolve(promise), "async"),
22394
+ sync: /* @__PURE__ */ __name(() => {
22395
+ if (isThenable(promise))
22396
+ throw new QuansyncError();
22397
+ return promise;
22398
+ }, "sync")
22399
+ });
22400
+ }
22401
+ __name(fromPromise, "fromPromise");
22402
+ function unwrapYield(value, isAsync) {
22403
+ if (value === GET_IS_ASYNC)
22404
+ return isAsync;
22405
+ if (isQuansyncGenerator(value))
22406
+ return isAsync ? iterateAsync(value) : iterateSync(value);
22407
+ if (!isAsync && isThenable(value))
22408
+ throw new QuansyncError();
22409
+ return value;
22410
+ }
22411
+ __name(unwrapYield, "unwrapYield");
22412
+ function iterateSync(generator) {
22413
+ let current2 = generator.next();
22414
+ while (!current2.done) {
22415
+ try {
22416
+ current2 = generator.next(unwrapYield(current2.value));
22417
+ } catch (err) {
22418
+ current2 = generator.throw(err);
22419
+ }
22420
+ }
22421
+ return unwrapYield(current2.value);
22422
+ }
22423
+ __name(iterateSync, "iterateSync");
22424
+ async function iterateAsync(generator) {
22425
+ let current2 = generator.next();
22426
+ while (!current2.done) {
22427
+ try {
22428
+ current2 = generator.next(await unwrapYield(current2.value, true));
22429
+ } catch (err) {
22430
+ current2 = generator.throw(err);
22431
+ }
22432
+ }
22433
+ return current2.value;
22434
+ }
22435
+ __name(iterateAsync, "iterateAsync");
22436
+ function fromGeneratorFn(generatorFn) {
22437
+ return fromObject({
22438
+ name: generatorFn.name,
22439
+ async(...args) {
22440
+ return iterateAsync(generatorFn.apply(this, args));
22441
+ },
22442
+ sync(...args) {
22443
+ return iterateSync(generatorFn.apply(this, args));
22444
+ }
22445
+ });
22446
+ }
22447
+ __name(fromGeneratorFn, "fromGeneratorFn");
22448
+ function quansync(options) {
22449
+ if (isThenable(options))
22450
+ return fromPromise(options);
22451
+ if (typeof options === "function")
22452
+ return fromGeneratorFn(options);
22453
+ else
22454
+ return fromObject(options);
22455
+ }
22456
+ __name(quansync, "quansync");
22457
+
22458
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/macro.mjs
22459
+ var quansync2 = quansync;
22460
+
22461
+ // ../../node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
22462
+ var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath, "toPath");
22463
+ async function findUp$1(name, {
22464
+ cwd = process4.cwd(),
22465
+ type = "file",
22466
+ stopAt
22467
+ } = {}) {
22468
+ let directory = path11.resolve(toPath(cwd) ?? "");
22469
+ const { root } = path11.parse(directory);
22470
+ stopAt = path11.resolve(directory, toPath(stopAt ?? root));
22471
+ const isAbsoluteName = path11.isAbsolute(name);
22472
+ while (directory) {
22473
+ const filePath = isAbsoluteName ? name : path11.join(directory, name);
22474
+ try {
22475
+ const stats = await fsPromises.stat(filePath);
22476
+ if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
22477
+ return filePath;
22478
+ }
22479
+ } catch {
22480
+ }
22481
+ if (directory === stopAt || directory === root) {
22482
+ break;
22483
+ }
22484
+ directory = path11.dirname(directory);
22485
+ }
22486
+ }
22487
+ __name(findUp$1, "findUp$1");
22488
+ function findUpSync(name, {
22489
+ cwd = process4.cwd(),
22490
+ type = "file",
22491
+ stopAt
22492
+ } = {}) {
22493
+ let directory = path11.resolve(toPath(cwd) ?? "");
22494
+ const { root } = path11.parse(directory);
22495
+ stopAt = path11.resolve(directory, toPath(stopAt) ?? root);
22496
+ const isAbsoluteName = path11.isAbsolute(name);
22497
+ while (directory) {
22498
+ const filePath = isAbsoluteName ? name : path11.join(directory, name);
22499
+ try {
22500
+ const stats = fs9.statSync(filePath, { throwIfNoEntry: false });
22501
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
22502
+ return filePath;
22503
+ }
22504
+ } catch {
22505
+ }
22506
+ if (directory === stopAt || directory === root) {
22507
+ break;
22508
+ }
22509
+ directory = path11.dirname(directory);
22510
+ }
22511
+ }
22512
+ __name(findUpSync, "findUpSync");
22348
22513
  function _resolve2(path15, options = {}) {
22349
22514
  if (options.platform === "auto" || !options.platform)
22350
22515
  options.platform = process4.platform === "win32" ? "win32" : "posix";
@@ -22381,11 +22546,15 @@ function getPackageJsonPath(name, options = {}) {
22381
22546
  return searchPackageJSON(entry);
22382
22547
  }
22383
22548
  __name(getPackageJsonPath, "getPackageJsonPath");
22384
- async function getPackageInfo(name, options = {}) {
22549
+ var readFile = quansync2({
22550
+ async: /* @__PURE__ */ __name((id) => fs9.promises.readFile(id, "utf8"), "async"),
22551
+ sync: /* @__PURE__ */ __name((id) => fs9.readFileSync(id, "utf8"), "sync")
22552
+ });
22553
+ var getPackageInfo = quansync2(function* (name, options = {}) {
22385
22554
  const packageJsonPath = getPackageJsonPath(name, options);
22386
22555
  if (!packageJsonPath)
22387
22556
  return;
22388
- const packageJson = JSON.parse(await fs9.promises.readFile(packageJsonPath, "utf8"));
22557
+ const packageJson = JSON.parse(yield readFile(packageJsonPath));
22389
22558
  return {
22390
22559
  name,
22391
22560
  version: packageJson.version,
@@ -22393,8 +22562,8 @@ async function getPackageInfo(name, options = {}) {
22393
22562
  packageJsonPath,
22394
22563
  packageJson
22395
22564
  };
22396
- }
22397
- __name(getPackageInfo, "getPackageInfo");
22565
+ });
22566
+ var getPackageInfoSync = getPackageInfo.sync;
22398
22567
  function resolvePackage(name, options = {}) {
22399
22568
  try {
22400
22569
  return _resolve2(`${name}/package.json`, options);
@@ -22425,6 +22594,22 @@ function searchPackageJSON(dir) {
22425
22594
  return packageJsonPath;
22426
22595
  }
22427
22596
  __name(searchPackageJSON, "searchPackageJSON");
22597
+ var findUp2 = quansync2({
22598
+ sync: findUpSync,
22599
+ async: findUp$1
22600
+ });
22601
+ var loadPackageJSON = quansync2(function* (cwd = process4.cwd()) {
22602
+ const path15 = yield findUp2("package.json", { cwd });
22603
+ if (!path15 || !fs9.existsSync(path15))
22604
+ return null;
22605
+ return JSON.parse(yield readFile(path15));
22606
+ });
22607
+ var loadPackageJSONSync = loadPackageJSON.sync;
22608
+ var isPackageListed = quansync2(function* (name, cwd) {
22609
+ const pkg = (yield loadPackageJSON(cwd)) || {};
22610
+ return name in (pkg.dependencies || {}) || name in (pkg.devDependencies || {});
22611
+ });
22612
+ var isPackageListedSync = isPackageListed.sync;
22428
22613
 
22429
22614
  // src/context/services/NpmService.ts
22430
22615
  import path12 from "pathe";
@@ -22923,6 +23108,16 @@ var ScanService2 = class {
22923
23108
  }
22924
23109
  const result = project.emitToMemory();
22925
23110
  const sourceFiles = result.getFiles();
23111
+ for (let i2 = 0; i2 < sourceFiles.length; i2++) {
23112
+ const absPath = files.find((x4) => {
23113
+ const fileName = this.configService.relativeSrcRoot(this.configService.relativeCwd(x4));
23114
+ const y3 = path13.relative(this.configService.outDir, this.configService.relativeCwd(sourceFiles[i2].filePath));
23115
+ return fileName === y3;
23116
+ });
23117
+ if (absPath) {
23118
+ sourceFiles[i2].absPath = absPath;
23119
+ }
23120
+ }
22926
23121
  return sourceFiles;
22927
23122
  }
22928
23123
  }
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
31
+ // ../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.5_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
32
32
  var init_esm_shims = __esm({
33
- "../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
33
+ "../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.5_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
34
34
  "use strict";
35
35
  }
36
36
  });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "./chunk-HAHM2NKS.mjs";
4
+ } from "./chunk-SINWZUTE.mjs";
5
5
 
6
6
  // src/config.ts
7
7
  init_esm_shims();
package/dist/cli.cjs CHANGED
@@ -29,10 +29,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  mod
30
30
  ));
31
31
 
32
- // ../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
32
+ // ../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.5_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
33
33
  var getImportMetaUrl, importMetaUrl;
34
34
  var init_cjs_shims = __esm({
35
- "../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
35
+ "../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.5_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
36
36
  "use strict";
37
37
  getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
38
38
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -14960,7 +14960,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
14960
14960
  const absPath = import_pathe6.default.resolve(configService.cwd, relPath);
14961
14961
  cachedWatchFiles.push(absPath);
14962
14962
  const isWxs = relPath.endsWith(".wxs");
14963
- const isWorker = isJsOrTs(relPath) && scanService.workersDir && relPath.startsWith(scanService.workersDir);
14963
+ const isWorker = isJsOrTs(relPath) && scanService.workersDir && configService.relativeSrcRoot(relPath).startsWith(scanService.workersDir);
14964
14964
  const fileName = configService.relativeSrcRoot(relPath);
14965
14965
  if (isTemplateRequest(relPath)) {
14966
14966
  if (weapp?.enhance?.autoImportComponents && autoImportService.filter(relPath, subPackageMeta)) {
@@ -15126,7 +15126,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
15126
15126
  if (workerFiles) {
15127
15127
  for (let i2 = 0; i2 < workerFiles.length; i2++) {
15128
15128
  const workerFile = workerFiles[i2];
15129
- const fileName = configService.relativeSrcRoot(configService.relativeCwd(cachedWorkerFiles[i2].absPath));
15129
+ const fileName = configService.relativeSrcRoot(configService.relativeCwd(workerFile.absPath));
15130
15130
  this.emitFile({
15131
15131
  type: "prebuilt-chunk",
15132
15132
  fileName,
@@ -15752,7 +15752,7 @@ var externalPlugin = /* @__PURE__ */ __name(({ external, notExternal, externalNo
15752
15752
  }
15753
15753
  };
15754
15754
  }, "externalPlugin");
15755
- var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile = defaultReadFile } = {}) => {
15755
+ var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile: readFile2 = defaultReadFile } = {}) => {
15756
15756
  return {
15757
15757
  name: "bundle-require:inject-file-scope",
15758
15758
  setup(ctx) {
@@ -15765,7 +15765,7 @@ var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile = defaultReadFile
15765
15765
  ctx.onLoad({
15766
15766
  filter: JS_EXT_RE
15767
15767
  }, (args) => {
15768
- const contents = readFile(args.path);
15768
+ const contents = readFile2(args.path);
15769
15769
  const injectLines = [
15770
15770
  `const ${FILENAME_VAR_NAME} = ${JSON.stringify(args.path)};`,
15771
15771
  `const ${DIRNAME_VAR_NAME} = ${JSON.stringify(import_path2.default.dirname(args.path))};`,
@@ -15969,16 +15969,16 @@ init_cjs_shims();
15969
15969
  var import_shared14 = require("@weapp-core/shared");
15970
15970
  var import_fs_extra6 = __toESM(require("fs-extra"), 1);
15971
15971
 
15972
- // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
15972
+ // ../../node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
15973
15973
  init_cjs_shims();
15974
15974
  var import_node_fs2 = __toESM(require("fs"), 1);
15975
- var import_promises = __toESM(require("fs/promises"), 1);
15976
15975
  var import_node_module2 = require("module");
15977
15976
  var import_node_path2 = __toESM(require("path"), 1);
15978
15977
  var import_node_process4 = __toESM(require("process"), 1);
15978
+ var import_promises = __toESM(require("fs/promises"), 1);
15979
15979
  var import_node_url2 = require("url");
15980
15980
 
15981
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
15981
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
15982
15982
  init_cjs_shims();
15983
15983
 
15984
15984
  // ../../node_modules/.pnpm/acorn@8.14.0/node_modules/acorn/dist/acorn.mjs
@@ -21547,7 +21547,7 @@ Parser2.acorn = {
21547
21547
  nonASCIIwhitespace
21548
21548
  };
21549
21549
 
21550
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
21550
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
21551
21551
  var import_node_module = require("module");
21552
21552
  var import_node_fs = __toESM(require("fs"), 1);
21553
21553
 
@@ -21603,7 +21603,7 @@ function joinURL(base, ...input) {
21603
21603
  __name(joinURL, "joinURL");
21604
21604
  var protocolRelative = Symbol.for("ufo:protocolRelative");
21605
21605
 
21606
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
21606
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
21607
21607
  var import_pathe8 = require("pathe");
21608
21608
  var import_node_url = require("url");
21609
21609
  var import_node_assert = __toESM(require("assert"), 1);
@@ -22300,7 +22300,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
22300
22300
  error.url = String(resolved);
22301
22301
  throw error;
22302
22302
  }
22303
- if (!preserveSymlinks) {
22303
+ {
22304
22304
  const real = (0, import_node_fs.realpathSync)(filePath);
22305
22305
  const { search, hash } = resolved;
22306
22306
  resolved = (0, import_node_url.pathToFileURL)(real + (filePath.endsWith(import_node_path.default.sep) ? "/" : ""));
@@ -22864,7 +22864,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
22864
22864
  if (resolved.protocol !== "file:") {
22865
22865
  return resolved;
22866
22866
  }
22867
- return finalizeResolution(resolved, base, preserveSymlinks);
22867
+ return finalizeResolution(resolved, base);
22868
22868
  }
22869
22869
  __name(moduleResolve, "moduleResolve");
22870
22870
  function fileURLToPath(id) {
@@ -22999,7 +22999,170 @@ function resolvePathSync(id, options) {
22999
22999
  }
23000
23000
  __name(resolvePathSync, "resolvePathSync");
23001
23001
 
23002
- // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
23002
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/macro.mjs
23003
+ init_cjs_shims();
23004
+
23005
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/index.mjs
23006
+ init_cjs_shims();
23007
+ var GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
23008
+ var QuansyncError = class extends Error {
23009
+ static {
23010
+ __name(this, "QuansyncError");
23011
+ }
23012
+ constructor(message = "Unexpected promise in sync context") {
23013
+ super(message);
23014
+ this.name = "QuansyncError";
23015
+ }
23016
+ };
23017
+ function isThenable(value) {
23018
+ return value && typeof value === "object" && typeof value.then === "function";
23019
+ }
23020
+ __name(isThenable, "isThenable");
23021
+ function isQuansyncGenerator(value) {
23022
+ return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
23023
+ }
23024
+ __name(isQuansyncGenerator, "isQuansyncGenerator");
23025
+ function fromObject(options) {
23026
+ const generator = /* @__PURE__ */ __name(function* (...args) {
23027
+ const isAsync = yield GET_IS_ASYNC;
23028
+ if (isAsync)
23029
+ return yield options.async.apply(this, args);
23030
+ return options.sync.apply(this, args);
23031
+ }, "generator");
23032
+ function fn(...args) {
23033
+ const iter = generator.apply(this, args);
23034
+ iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
23035
+ iter.__quansync = true;
23036
+ return iter;
23037
+ }
23038
+ __name(fn, "fn");
23039
+ fn.sync = options.sync;
23040
+ fn.async = options.async;
23041
+ return fn;
23042
+ }
23043
+ __name(fromObject, "fromObject");
23044
+ function fromPromise(promise) {
23045
+ return fromObject({
23046
+ async: /* @__PURE__ */ __name(() => Promise.resolve(promise), "async"),
23047
+ sync: /* @__PURE__ */ __name(() => {
23048
+ if (isThenable(promise))
23049
+ throw new QuansyncError();
23050
+ return promise;
23051
+ }, "sync")
23052
+ });
23053
+ }
23054
+ __name(fromPromise, "fromPromise");
23055
+ function unwrapYield(value, isAsync) {
23056
+ if (value === GET_IS_ASYNC)
23057
+ return isAsync;
23058
+ if (isQuansyncGenerator(value))
23059
+ return isAsync ? iterateAsync(value) : iterateSync(value);
23060
+ if (!isAsync && isThenable(value))
23061
+ throw new QuansyncError();
23062
+ return value;
23063
+ }
23064
+ __name(unwrapYield, "unwrapYield");
23065
+ function iterateSync(generator) {
23066
+ let current2 = generator.next();
23067
+ while (!current2.done) {
23068
+ try {
23069
+ current2 = generator.next(unwrapYield(current2.value));
23070
+ } catch (err) {
23071
+ current2 = generator.throw(err);
23072
+ }
23073
+ }
23074
+ return unwrapYield(current2.value);
23075
+ }
23076
+ __name(iterateSync, "iterateSync");
23077
+ async function iterateAsync(generator) {
23078
+ let current2 = generator.next();
23079
+ while (!current2.done) {
23080
+ try {
23081
+ current2 = generator.next(await unwrapYield(current2.value, true));
23082
+ } catch (err) {
23083
+ current2 = generator.throw(err);
23084
+ }
23085
+ }
23086
+ return current2.value;
23087
+ }
23088
+ __name(iterateAsync, "iterateAsync");
23089
+ function fromGeneratorFn(generatorFn) {
23090
+ return fromObject({
23091
+ name: generatorFn.name,
23092
+ async(...args) {
23093
+ return iterateAsync(generatorFn.apply(this, args));
23094
+ },
23095
+ sync(...args) {
23096
+ return iterateSync(generatorFn.apply(this, args));
23097
+ }
23098
+ });
23099
+ }
23100
+ __name(fromGeneratorFn, "fromGeneratorFn");
23101
+ function quansync(options) {
23102
+ if (isThenable(options))
23103
+ return fromPromise(options);
23104
+ if (typeof options === "function")
23105
+ return fromGeneratorFn(options);
23106
+ else
23107
+ return fromObject(options);
23108
+ }
23109
+ __name(quansync, "quansync");
23110
+
23111
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/macro.mjs
23112
+ var quansync2 = quansync;
23113
+
23114
+ // ../../node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
23115
+ var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url2.fileURLToPath)(urlOrPath) : urlOrPath, "toPath");
23116
+ async function findUp$1(name, {
23117
+ cwd = import_node_process4.default.cwd(),
23118
+ type = "file",
23119
+ stopAt
23120
+ } = {}) {
23121
+ let directory = import_node_path2.default.resolve(toPath(cwd) ?? "");
23122
+ const { root } = import_node_path2.default.parse(directory);
23123
+ stopAt = import_node_path2.default.resolve(directory, toPath(stopAt ?? root));
23124
+ const isAbsoluteName = import_node_path2.default.isAbsolute(name);
23125
+ while (directory) {
23126
+ const filePath = isAbsoluteName ? name : import_node_path2.default.join(directory, name);
23127
+ try {
23128
+ const stats = await import_promises.default.stat(filePath);
23129
+ if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
23130
+ return filePath;
23131
+ }
23132
+ } catch {
23133
+ }
23134
+ if (directory === stopAt || directory === root) {
23135
+ break;
23136
+ }
23137
+ directory = import_node_path2.default.dirname(directory);
23138
+ }
23139
+ }
23140
+ __name(findUp$1, "findUp$1");
23141
+ function findUpSync(name, {
23142
+ cwd = import_node_process4.default.cwd(),
23143
+ type = "file",
23144
+ stopAt
23145
+ } = {}) {
23146
+ let directory = import_node_path2.default.resolve(toPath(cwd) ?? "");
23147
+ const { root } = import_node_path2.default.parse(directory);
23148
+ stopAt = import_node_path2.default.resolve(directory, toPath(stopAt) ?? root);
23149
+ const isAbsoluteName = import_node_path2.default.isAbsolute(name);
23150
+ while (directory) {
23151
+ const filePath = isAbsoluteName ? name : import_node_path2.default.join(directory, name);
23152
+ try {
23153
+ const stats = import_node_fs2.default.statSync(filePath, { throwIfNoEntry: false });
23154
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
23155
+ return filePath;
23156
+ }
23157
+ } catch {
23158
+ }
23159
+ if (directory === stopAt || directory === root) {
23160
+ break;
23161
+ }
23162
+ directory = import_node_path2.default.dirname(directory);
23163
+ }
23164
+ }
23165
+ __name(findUpSync, "findUpSync");
23003
23166
  function _resolve2(path17, options = {}) {
23004
23167
  if (options.platform === "auto" || !options.platform)
23005
23168
  options.platform = import_node_process4.default.platform === "win32" ? "win32" : "posix";
@@ -23036,11 +23199,15 @@ function getPackageJsonPath(name, options = {}) {
23036
23199
  return searchPackageJSON(entry);
23037
23200
  }
23038
23201
  __name(getPackageJsonPath, "getPackageJsonPath");
23039
- async function getPackageInfo(name, options = {}) {
23202
+ var readFile = quansync2({
23203
+ async: /* @__PURE__ */ __name((id) => import_node_fs2.default.promises.readFile(id, "utf8"), "async"),
23204
+ sync: /* @__PURE__ */ __name((id) => import_node_fs2.default.readFileSync(id, "utf8"), "sync")
23205
+ });
23206
+ var getPackageInfo = quansync2(function* (name, options = {}) {
23040
23207
  const packageJsonPath = getPackageJsonPath(name, options);
23041
23208
  if (!packageJsonPath)
23042
23209
  return;
23043
- const packageJson = JSON.parse(await import_node_fs2.default.promises.readFile(packageJsonPath, "utf8"));
23210
+ const packageJson = JSON.parse(yield readFile(packageJsonPath));
23044
23211
  return {
23045
23212
  name,
23046
23213
  version: packageJson.version,
@@ -23048,8 +23215,8 @@ async function getPackageInfo(name, options = {}) {
23048
23215
  packageJsonPath,
23049
23216
  packageJson
23050
23217
  };
23051
- }
23052
- __name(getPackageInfo, "getPackageInfo");
23218
+ });
23219
+ var getPackageInfoSync = getPackageInfo.sync;
23053
23220
  function resolvePackage(name, options = {}) {
23054
23221
  try {
23055
23222
  return _resolve2(`${name}/package.json`, options);
@@ -23080,6 +23247,22 @@ function searchPackageJSON(dir) {
23080
23247
  return packageJsonPath;
23081
23248
  }
23082
23249
  __name(searchPackageJSON, "searchPackageJSON");
23250
+ var findUp2 = quansync2({
23251
+ sync: findUpSync,
23252
+ async: findUp$1
23253
+ });
23254
+ var loadPackageJSON = quansync2(function* (cwd = import_node_process4.default.cwd()) {
23255
+ const path17 = yield findUp2("package.json", { cwd });
23256
+ if (!path17 || !import_node_fs2.default.existsSync(path17))
23257
+ return null;
23258
+ return JSON.parse(yield readFile(path17));
23259
+ });
23260
+ var loadPackageJSONSync = loadPackageJSON.sync;
23261
+ var isPackageListed = quansync2(function* (name, cwd) {
23262
+ const pkg = (yield loadPackageJSON(cwd)) || {};
23263
+ return name in (pkg.dependencies || {}) || name in (pkg.devDependencies || {});
23264
+ });
23265
+ var isPackageListedSync = isPackageListed.sync;
23083
23266
 
23084
23267
  // src/context/services/NpmService.ts
23085
23268
  var import_pathe9 = __toESM(require("pathe"), 1);
@@ -23578,6 +23761,16 @@ var ScanService2 = class {
23578
23761
  }
23579
23762
  const result = project.emitToMemory();
23580
23763
  const sourceFiles = result.getFiles();
23764
+ for (let i2 = 0; i2 < sourceFiles.length; i2++) {
23765
+ const absPath = files.find((x4) => {
23766
+ const fileName = this.configService.relativeSrcRoot(this.configService.relativeCwd(x4));
23767
+ const y3 = import_pathe10.default.relative(this.configService.outDir, this.configService.relativeCwd(sourceFiles[i2].filePath));
23768
+ return fileName === y3;
23769
+ });
23770
+ if (absPath) {
23771
+ sourceFiles[i2].absPath = absPath;
23772
+ }
23773
+ }
23581
23774
  return sourceFiles;
23582
23775
  }
23583
23776
  }
@@ -23927,7 +24120,7 @@ function logBuildAppFinish() {
23927
24120
  if (!logBuildAppFinishOnlyShowOnce) {
23928
24121
  logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
23929
24122
  logger_default.info("\u6267\u884C `npm run open` / `yarn open` / `pnpm open` \u76F4\u63A5\u5728 `\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528");
23930
- logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177,\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55),\u5373\u53EF\u9884\u89C8\u6548\u679C");
24123
+ logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
23931
24124
  logBuildAppFinishOnlyShowOnce = true;
23932
24125
  }
23933
24126
  }
package/dist/cli.mjs CHANGED
@@ -3,13 +3,13 @@ import {
3
3
  createCompilerContext,
4
4
  logger_default,
5
5
  require_Reflect
6
- } from "./chunk-3X3GXWYT.mjs";
7
- import "./chunk-CRVQ5UE6.mjs";
6
+ } from "./chunk-DNDQS5UT.mjs";
7
+ import "./chunk-XT4V3UFH.mjs";
8
8
  import {
9
9
  __name,
10
10
  __toESM,
11
11
  init_esm_shims
12
- } from "./chunk-HAHM2NKS.mjs";
12
+ } from "./chunk-SINWZUTE.mjs";
13
13
 
14
14
  // src/cli.ts
15
15
  init_esm_shims();
@@ -711,7 +711,7 @@ function logBuildAppFinish() {
711
711
  if (!logBuildAppFinishOnlyShowOnce) {
712
712
  logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
713
713
  logger_default.info("\u6267\u884C `npm run open` / `yarn open` / `pnpm open` \u76F4\u63A5\u5728 `\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528");
714
- logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177,\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55),\u5373\u53EF\u9884\u89C8\u6548\u679C");
714
+ logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
715
715
  logBuildAppFinishOnlyShowOnce = true;
716
716
  }
717
717
  }
package/dist/config.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineConfig
3
- } from "./chunk-CRVQ5UE6.mjs";
4
- import "./chunk-HAHM2NKS.mjs";
3
+ } from "./chunk-XT4V3UFH.mjs";
4
+ import "./chunk-SINWZUTE.mjs";
5
5
  export {
6
6
  defineConfig
7
7
  };
package/dist/index.cjs CHANGED
@@ -34,10 +34,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
- // ../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
37
+ // ../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.5_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
38
38
  var getImportMetaUrl, importMetaUrl;
39
39
  var init_cjs_shims = __esm({
40
- "../../node_modules/.pnpm/tsup@8.3.6_@swc+core@1.10.15_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
40
+ "../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.5_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
41
41
  "use strict";
42
42
  getImportMetaUrl = /* @__PURE__ */ __name(() => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href, "getImportMetaUrl");
43
43
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -14364,7 +14364,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
14364
14364
  const absPath = import_pathe6.default.resolve(configService.cwd, relPath);
14365
14365
  cachedWatchFiles.push(absPath);
14366
14366
  const isWxs = relPath.endsWith(".wxs");
14367
- const isWorker = isJsOrTs(relPath) && scanService.workersDir && relPath.startsWith(scanService.workersDir);
14367
+ const isWorker = isJsOrTs(relPath) && scanService.workersDir && configService.relativeSrcRoot(relPath).startsWith(scanService.workersDir);
14368
14368
  const fileName = configService.relativeSrcRoot(relPath);
14369
14369
  if (isTemplateRequest(relPath)) {
14370
14370
  if (weapp?.enhance?.autoImportComponents && autoImportService.filter(relPath, subPackageMeta)) {
@@ -14530,7 +14530,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
14530
14530
  if (workerFiles) {
14531
14531
  for (let i2 = 0; i2 < workerFiles.length; i2++) {
14532
14532
  const workerFile = workerFiles[i2];
14533
- const fileName = configService.relativeSrcRoot(configService.relativeCwd(cachedWorkerFiles[i2].absPath));
14533
+ const fileName = configService.relativeSrcRoot(configService.relativeCwd(workerFile.absPath));
14534
14534
  this.emitFile({
14535
14535
  type: "prebuilt-chunk",
14536
14536
  fileName,
@@ -15156,7 +15156,7 @@ var externalPlugin = /* @__PURE__ */ __name(({ external, notExternal, externalNo
15156
15156
  }
15157
15157
  };
15158
15158
  }, "externalPlugin");
15159
- var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile = defaultReadFile } = {}) => {
15159
+ var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile: readFile2 = defaultReadFile } = {}) => {
15160
15160
  return {
15161
15161
  name: "bundle-require:inject-file-scope",
15162
15162
  setup(ctx) {
@@ -15169,7 +15169,7 @@ var injectFileScopePlugin = /* @__PURE__ */ __name(({ readFile = defaultReadFile
15169
15169
  ctx.onLoad({
15170
15170
  filter: JS_EXT_RE
15171
15171
  }, (args) => {
15172
- const contents = readFile(args.path);
15172
+ const contents = readFile2(args.path);
15173
15173
  const injectLines = [
15174
15174
  `const ${FILENAME_VAR_NAME} = ${JSON.stringify(args.path)};`,
15175
15175
  `const ${DIRNAME_VAR_NAME} = ${JSON.stringify(import_path2.default.dirname(args.path))};`,
@@ -15373,16 +15373,16 @@ init_cjs_shims();
15373
15373
  var import_shared14 = require("@weapp-core/shared");
15374
15374
  var import_fs_extra6 = __toESM(require("fs-extra"), 1);
15375
15375
 
15376
- // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
15376
+ // ../../node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
15377
15377
  init_cjs_shims();
15378
15378
  var import_node_fs2 = __toESM(require("fs"), 1);
15379
- var import_promises = __toESM(require("fs/promises"), 1);
15380
15379
  var import_node_module2 = require("module");
15381
15380
  var import_node_path2 = __toESM(require("path"), 1);
15382
15381
  var import_node_process4 = __toESM(require("process"), 1);
15382
+ var import_promises = __toESM(require("fs/promises"), 1);
15383
15383
  var import_node_url2 = require("url");
15384
15384
 
15385
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
15385
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
15386
15386
  init_cjs_shims();
15387
15387
 
15388
15388
  // ../../node_modules/.pnpm/acorn@8.14.0/node_modules/acorn/dist/acorn.mjs
@@ -20951,7 +20951,7 @@ Parser2.acorn = {
20951
20951
  nonASCIIwhitespace
20952
20952
  };
20953
20953
 
20954
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
20954
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
20955
20955
  var import_node_module = require("module");
20956
20956
  var import_node_fs = __toESM(require("fs"), 1);
20957
20957
 
@@ -21007,7 +21007,7 @@ function joinURL(base, ...input) {
21007
21007
  __name(joinURL, "joinURL");
21008
21008
  var protocolRelative = Symbol.for("ufo:protocolRelative");
21009
21009
 
21010
- // ../../node_modules/.pnpm/mlly@1.7.3/node_modules/mlly/dist/index.mjs
21010
+ // ../../node_modules/.pnpm/mlly@1.7.4/node_modules/mlly/dist/index.mjs
21011
21011
  var import_pathe8 = require("pathe");
21012
21012
  var import_node_url = require("url");
21013
21013
  var import_node_assert = __toESM(require("assert"), 1);
@@ -21704,7 +21704,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
21704
21704
  error.url = String(resolved);
21705
21705
  throw error;
21706
21706
  }
21707
- if (!preserveSymlinks) {
21707
+ {
21708
21708
  const real = (0, import_node_fs.realpathSync)(filePath);
21709
21709
  const { search, hash } = resolved;
21710
21710
  resolved = (0, import_node_url.pathToFileURL)(real + (filePath.endsWith(import_node_path.default.sep) ? "/" : ""));
@@ -22268,7 +22268,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
22268
22268
  if (resolved.protocol !== "file:") {
22269
22269
  return resolved;
22270
22270
  }
22271
- return finalizeResolution(resolved, base, preserveSymlinks);
22271
+ return finalizeResolution(resolved, base);
22272
22272
  }
22273
22273
  __name(moduleResolve, "moduleResolve");
22274
22274
  function fileURLToPath(id) {
@@ -22403,7 +22403,170 @@ function resolvePathSync(id, options) {
22403
22403
  }
22404
22404
  __name(resolvePathSync, "resolvePathSync");
22405
22405
 
22406
- // ../../node_modules/.pnpm/local-pkg@1.0.0/node_modules/local-pkg/dist/index.mjs
22406
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/macro.mjs
22407
+ init_cjs_shims();
22408
+
22409
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/index.mjs
22410
+ init_cjs_shims();
22411
+ var GET_IS_ASYNC = Symbol.for("quansync.getIsAsync");
22412
+ var QuansyncError = class extends Error {
22413
+ static {
22414
+ __name(this, "QuansyncError");
22415
+ }
22416
+ constructor(message = "Unexpected promise in sync context") {
22417
+ super(message);
22418
+ this.name = "QuansyncError";
22419
+ }
22420
+ };
22421
+ function isThenable(value) {
22422
+ return value && typeof value === "object" && typeof value.then === "function";
22423
+ }
22424
+ __name(isThenable, "isThenable");
22425
+ function isQuansyncGenerator(value) {
22426
+ return value && typeof value === "object" && typeof value[Symbol.iterator] === "function" && "__quansync" in value;
22427
+ }
22428
+ __name(isQuansyncGenerator, "isQuansyncGenerator");
22429
+ function fromObject(options) {
22430
+ const generator = /* @__PURE__ */ __name(function* (...args) {
22431
+ const isAsync = yield GET_IS_ASYNC;
22432
+ if (isAsync)
22433
+ return yield options.async.apply(this, args);
22434
+ return options.sync.apply(this, args);
22435
+ }, "generator");
22436
+ function fn(...args) {
22437
+ const iter = generator.apply(this, args);
22438
+ iter.then = (...thenArgs) => options.async.apply(this, args).then(...thenArgs);
22439
+ iter.__quansync = true;
22440
+ return iter;
22441
+ }
22442
+ __name(fn, "fn");
22443
+ fn.sync = options.sync;
22444
+ fn.async = options.async;
22445
+ return fn;
22446
+ }
22447
+ __name(fromObject, "fromObject");
22448
+ function fromPromise(promise) {
22449
+ return fromObject({
22450
+ async: /* @__PURE__ */ __name(() => Promise.resolve(promise), "async"),
22451
+ sync: /* @__PURE__ */ __name(() => {
22452
+ if (isThenable(promise))
22453
+ throw new QuansyncError();
22454
+ return promise;
22455
+ }, "sync")
22456
+ });
22457
+ }
22458
+ __name(fromPromise, "fromPromise");
22459
+ function unwrapYield(value, isAsync) {
22460
+ if (value === GET_IS_ASYNC)
22461
+ return isAsync;
22462
+ if (isQuansyncGenerator(value))
22463
+ return isAsync ? iterateAsync(value) : iterateSync(value);
22464
+ if (!isAsync && isThenable(value))
22465
+ throw new QuansyncError();
22466
+ return value;
22467
+ }
22468
+ __name(unwrapYield, "unwrapYield");
22469
+ function iterateSync(generator) {
22470
+ let current2 = generator.next();
22471
+ while (!current2.done) {
22472
+ try {
22473
+ current2 = generator.next(unwrapYield(current2.value));
22474
+ } catch (err) {
22475
+ current2 = generator.throw(err);
22476
+ }
22477
+ }
22478
+ return unwrapYield(current2.value);
22479
+ }
22480
+ __name(iterateSync, "iterateSync");
22481
+ async function iterateAsync(generator) {
22482
+ let current2 = generator.next();
22483
+ while (!current2.done) {
22484
+ try {
22485
+ current2 = generator.next(await unwrapYield(current2.value, true));
22486
+ } catch (err) {
22487
+ current2 = generator.throw(err);
22488
+ }
22489
+ }
22490
+ return current2.value;
22491
+ }
22492
+ __name(iterateAsync, "iterateAsync");
22493
+ function fromGeneratorFn(generatorFn) {
22494
+ return fromObject({
22495
+ name: generatorFn.name,
22496
+ async(...args) {
22497
+ return iterateAsync(generatorFn.apply(this, args));
22498
+ },
22499
+ sync(...args) {
22500
+ return iterateSync(generatorFn.apply(this, args));
22501
+ }
22502
+ });
22503
+ }
22504
+ __name(fromGeneratorFn, "fromGeneratorFn");
22505
+ function quansync(options) {
22506
+ if (isThenable(options))
22507
+ return fromPromise(options);
22508
+ if (typeof options === "function")
22509
+ return fromGeneratorFn(options);
22510
+ else
22511
+ return fromObject(options);
22512
+ }
22513
+ __name(quansync, "quansync");
22514
+
22515
+ // ../../node_modules/.pnpm/quansync@0.2.8/node_modules/quansync/dist/macro.mjs
22516
+ var quansync2 = quansync;
22517
+
22518
+ // ../../node_modules/.pnpm/local-pkg@1.1.1/node_modules/local-pkg/dist/index.mjs
22519
+ var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url2.fileURLToPath)(urlOrPath) : urlOrPath, "toPath");
22520
+ async function findUp$1(name, {
22521
+ cwd = import_node_process4.default.cwd(),
22522
+ type = "file",
22523
+ stopAt
22524
+ } = {}) {
22525
+ let directory = import_node_path2.default.resolve(toPath(cwd) ?? "");
22526
+ const { root } = import_node_path2.default.parse(directory);
22527
+ stopAt = import_node_path2.default.resolve(directory, toPath(stopAt ?? root));
22528
+ const isAbsoluteName = import_node_path2.default.isAbsolute(name);
22529
+ while (directory) {
22530
+ const filePath = isAbsoluteName ? name : import_node_path2.default.join(directory, name);
22531
+ try {
22532
+ const stats = await import_promises.default.stat(filePath);
22533
+ if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
22534
+ return filePath;
22535
+ }
22536
+ } catch {
22537
+ }
22538
+ if (directory === stopAt || directory === root) {
22539
+ break;
22540
+ }
22541
+ directory = import_node_path2.default.dirname(directory);
22542
+ }
22543
+ }
22544
+ __name(findUp$1, "findUp$1");
22545
+ function findUpSync(name, {
22546
+ cwd = import_node_process4.default.cwd(),
22547
+ type = "file",
22548
+ stopAt
22549
+ } = {}) {
22550
+ let directory = import_node_path2.default.resolve(toPath(cwd) ?? "");
22551
+ const { root } = import_node_path2.default.parse(directory);
22552
+ stopAt = import_node_path2.default.resolve(directory, toPath(stopAt) ?? root);
22553
+ const isAbsoluteName = import_node_path2.default.isAbsolute(name);
22554
+ while (directory) {
22555
+ const filePath = isAbsoluteName ? name : import_node_path2.default.join(directory, name);
22556
+ try {
22557
+ const stats = import_node_fs2.default.statSync(filePath, { throwIfNoEntry: false });
22558
+ if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) {
22559
+ return filePath;
22560
+ }
22561
+ } catch {
22562
+ }
22563
+ if (directory === stopAt || directory === root) {
22564
+ break;
22565
+ }
22566
+ directory = import_node_path2.default.dirname(directory);
22567
+ }
22568
+ }
22569
+ __name(findUpSync, "findUpSync");
22407
22570
  function _resolve2(path15, options = {}) {
22408
22571
  if (options.platform === "auto" || !options.platform)
22409
22572
  options.platform = import_node_process4.default.platform === "win32" ? "win32" : "posix";
@@ -22440,11 +22603,15 @@ function getPackageJsonPath(name, options = {}) {
22440
22603
  return searchPackageJSON(entry);
22441
22604
  }
22442
22605
  __name(getPackageJsonPath, "getPackageJsonPath");
22443
- async function getPackageInfo(name, options = {}) {
22606
+ var readFile = quansync2({
22607
+ async: /* @__PURE__ */ __name((id) => import_node_fs2.default.promises.readFile(id, "utf8"), "async"),
22608
+ sync: /* @__PURE__ */ __name((id) => import_node_fs2.default.readFileSync(id, "utf8"), "sync")
22609
+ });
22610
+ var getPackageInfo = quansync2(function* (name, options = {}) {
22444
22611
  const packageJsonPath = getPackageJsonPath(name, options);
22445
22612
  if (!packageJsonPath)
22446
22613
  return;
22447
- const packageJson = JSON.parse(await import_node_fs2.default.promises.readFile(packageJsonPath, "utf8"));
22614
+ const packageJson = JSON.parse(yield readFile(packageJsonPath));
22448
22615
  return {
22449
22616
  name,
22450
22617
  version: packageJson.version,
@@ -22452,8 +22619,8 @@ async function getPackageInfo(name, options = {}) {
22452
22619
  packageJsonPath,
22453
22620
  packageJson
22454
22621
  };
22455
- }
22456
- __name(getPackageInfo, "getPackageInfo");
22622
+ });
22623
+ var getPackageInfoSync = getPackageInfo.sync;
22457
22624
  function resolvePackage(name, options = {}) {
22458
22625
  try {
22459
22626
  return _resolve2(`${name}/package.json`, options);
@@ -22484,6 +22651,22 @@ function searchPackageJSON(dir) {
22484
22651
  return packageJsonPath;
22485
22652
  }
22486
22653
  __name(searchPackageJSON, "searchPackageJSON");
22654
+ var findUp2 = quansync2({
22655
+ sync: findUpSync,
22656
+ async: findUp$1
22657
+ });
22658
+ var loadPackageJSON = quansync2(function* (cwd = import_node_process4.default.cwd()) {
22659
+ const path15 = yield findUp2("package.json", { cwd });
22660
+ if (!path15 || !import_node_fs2.default.existsSync(path15))
22661
+ return null;
22662
+ return JSON.parse(yield readFile(path15));
22663
+ });
22664
+ var loadPackageJSONSync = loadPackageJSON.sync;
22665
+ var isPackageListed = quansync2(function* (name, cwd) {
22666
+ const pkg = (yield loadPackageJSON(cwd)) || {};
22667
+ return name in (pkg.dependencies || {}) || name in (pkg.devDependencies || {});
22668
+ });
22669
+ var isPackageListedSync = isPackageListed.sync;
22487
22670
 
22488
22671
  // src/context/services/NpmService.ts
22489
22672
  var import_pathe9 = __toESM(require("pathe"), 1);
@@ -22982,6 +23165,16 @@ var ScanService2 = class {
22982
23165
  }
22983
23166
  const result = project.emitToMemory();
22984
23167
  const sourceFiles = result.getFiles();
23168
+ for (let i2 = 0; i2 < sourceFiles.length; i2++) {
23169
+ const absPath = files.find((x4) => {
23170
+ const fileName = this.configService.relativeSrcRoot(this.configService.relativeCwd(x4));
23171
+ const y3 = import_pathe10.default.relative(this.configService.outDir, this.configService.relativeCwd(sourceFiles[i2].filePath));
23172
+ return fileName === y3;
23173
+ });
23174
+ if (absPath) {
23175
+ sourceFiles[i2].absPath = absPath;
23176
+ }
23177
+ }
22985
23178
  return sourceFiles;
22986
23179
  }
22987
23180
  }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { d as defineConfig } from './config-D9TqUhDK.cjs';
2
- import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-C7LldNoo.cjs';
2
+ import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-CF4ALRqU.cjs';
3
3
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
4
4
  import './types-dS68tjL6.cjs';
5
5
  import 'tsup';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { d as defineConfig } from './config-C-GvdaN9.js';
2
- import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-D0jeQpYe.js';
2
+ import { L as LoadConfigOptions, C as CompilerContext } from './CompilerContext-Ba0WSUPb.js';
3
3
  export { UserConfig, UserConfigExport, UserConfigFnObject } from 'vite';
4
4
  import './types-dS68tjL6.js';
5
5
  import 'tsup';
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  createCompilerContext,
3
3
  require_Reflect
4
- } from "./chunk-3X3GXWYT.mjs";
4
+ } from "./chunk-DNDQS5UT.mjs";
5
5
  import {
6
6
  defineConfig
7
- } from "./chunk-CRVQ5UE6.mjs";
7
+ } from "./chunk-XT4V3UFH.mjs";
8
8
  import {
9
9
  __toESM,
10
10
  init_esm_shims
11
- } from "./chunk-HAHM2NKS.mjs";
11
+ } from "./chunk-SINWZUTE.mjs";
12
12
 
13
13
  // src/index.ts
14
14
  init_esm_shims();
package/dist/json.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { App, Page, Component, Sitemap, Theme } from '@weapp-core/schematics';
2
2
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
3
- import { C as CompilerContext } from './CompilerContext-C7LldNoo.cjs';
3
+ import { C as CompilerContext } from './CompilerContext-CF4ALRqU.cjs';
4
4
  import './types-dS68tjL6.cjs';
5
5
  import './config-D9TqUhDK.cjs';
6
6
  import 'vite';
package/dist/json.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { App, Page, Component, Sitemap, Theme } from '@weapp-core/schematics';
2
2
  export { App, Component, Page, Sitemap, Theme } from '@weapp-core/schematics';
3
- import { C as CompilerContext } from './CompilerContext-D0jeQpYe.js';
3
+ import { C as CompilerContext } from './CompilerContext-Ba0WSUPb.js';
4
4
  import './types-dS68tjL6.js';
5
5
  import './config-C-GvdaN9.js';
6
6
  import 'vite';
package/dist/json.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __name,
3
3
  init_esm_shims
4
- } from "./chunk-HAHM2NKS.mjs";
4
+ } from "./chunk-SINWZUTE.mjs";
5
5
 
6
6
  // src/json.ts
7
7
  init_esm_shims();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "2.1.4",
4
+ "version": "2.1.6",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -80,26 +80,26 @@
80
80
  "node": ">=20.0.0"
81
81
  },
82
82
  "dependencies": {
83
- "@babel/core": "^7.26.8",
84
- "@babel/preset-env": "^7.26.8",
83
+ "@babel/core": "^7.26.9",
84
+ "@babel/preset-env": "^7.26.9",
85
85
  "@babel/preset-typescript": "^7.26.0",
86
- "@babel/types": "^7.26.8",
86
+ "@babel/types": "^7.26.9",
87
87
  "comment-json": "^4.2.5",
88
88
  "debug": "^4.4.0",
89
89
  "del": "^8.0.0",
90
90
  "esbuild": "^0.25.0",
91
91
  "fdir": "^6.4.3",
92
92
  "fs-extra": "^11.3.0",
93
- "pathe": "^2.0.2",
93
+ "pathe": "^2.0.3",
94
94
  "picomatch": "^4.0.2",
95
- "postcss": "^8.5.2",
95
+ "postcss": "^8.5.3",
96
96
  "ts-morph": "^25.0.1",
97
- "tsup": "^8.3.6",
97
+ "tsup": "^8.4.0",
98
98
  "vite": "^5.4.14",
99
99
  "vite-tsconfig-paths": "^5.1.4",
100
+ "@weapp-core/init": "^1.1.16",
100
101
  "@weapp-core/logger": "^1.0.3",
101
102
  "@weapp-core/schematics": "^1.0.10",
102
- "@weapp-core/init": "^1.1.16",
103
103
  "@weapp-core/shared": "^1.0.6",
104
104
  "weapp-ide-cli": "^2.0.10"
105
105
  },
@@ -112,7 +112,7 @@
112
112
  "cac": "^6.7.14",
113
113
  "htmlparser2": "^10.0.0",
114
114
  "inversify": "^6.2.2",
115
- "local-pkg": "^1.0.0",
115
+ "local-pkg": "^1.1.1",
116
116
  "magic-string": "^0.30.17",
117
117
  "reflect-metadata": "^0.2.2"
118
118
  },