unplugin-env 0.1.4 → 0.1.5

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/index.cjs CHANGED
@@ -561,7 +561,7 @@ var require_to_regex_range = __commonJS({
561
561
  if (start === stop) {
562
562
  return { pattern: start, count: [], digits: 0 };
563
563
  }
564
- let zipped = zip2(start, stop);
564
+ let zipped = zip(start, stop);
565
565
  let digits = zipped.length;
566
566
  let pattern = "";
567
567
  let count = 0;
@@ -621,7 +621,7 @@ var require_to_regex_range = __commonJS({
621
621
  }
622
622
  return result;
623
623
  }
624
- function zip2(a, b) {
624
+ function zip(a, b) {
625
625
  let arr = [];
626
626
  for (let i = 0; i < a.length; i++)
627
627
  arr.push([a[i], b[i]]);
@@ -3443,8 +3443,8 @@ var require_utils3 = __commonJS({
3443
3443
  exports2.array = array;
3444
3444
  var errno = require_errno();
3445
3445
  exports2.errno = errno;
3446
- var fs3 = require_fs();
3447
- exports2.fs = fs3;
3446
+ var fs4 = require_fs();
3447
+ exports2.fs = fs4;
3448
3448
  var path2 = require_path();
3449
3449
  exports2.path = path2;
3450
3450
  var pattern = require_pattern();
@@ -3628,12 +3628,12 @@ var require_fs2 = __commonJS({
3628
3628
  "use strict";
3629
3629
  Object.defineProperty(exports2, "__esModule", { value: true });
3630
3630
  exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
3631
- var fs3 = require("fs");
3631
+ var fs4 = require("fs");
3632
3632
  exports2.FILE_SYSTEM_ADAPTER = {
3633
- lstat: fs3.lstat,
3634
- stat: fs3.stat,
3635
- lstatSync: fs3.lstatSync,
3636
- statSync: fs3.statSync
3633
+ lstat: fs4.lstat,
3634
+ stat: fs4.stat,
3635
+ lstatSync: fs4.lstatSync,
3636
+ statSync: fs4.statSync
3637
3637
  };
3638
3638
  function createFileSystemAdapter(fsMethods) {
3639
3639
  if (fsMethods === void 0) {
@@ -3650,12 +3650,12 @@ var require_settings = __commonJS({
3650
3650
  "node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
3651
3651
  "use strict";
3652
3652
  Object.defineProperty(exports2, "__esModule", { value: true });
3653
- var fs3 = require_fs2();
3653
+ var fs4 = require_fs2();
3654
3654
  var Settings = class {
3655
3655
  constructor(_options = {}) {
3656
3656
  this._options = _options;
3657
3657
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
3658
- this.fs = fs3.createFileSystemAdapter(this._options.fs);
3658
+ this.fs = fs4.createFileSystemAdapter(this._options.fs);
3659
3659
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
3660
3660
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
3661
3661
  }
@@ -3815,8 +3815,8 @@ var require_utils4 = __commonJS({
3815
3815
  "use strict";
3816
3816
  Object.defineProperty(exports2, "__esModule", { value: true });
3817
3817
  exports2.fs = void 0;
3818
- var fs3 = require_fs3();
3819
- exports2.fs = fs3;
3818
+ var fs4 = require_fs3();
3819
+ exports2.fs = fs4;
3820
3820
  }
3821
3821
  });
3822
3822
 
@@ -4011,14 +4011,14 @@ var require_fs4 = __commonJS({
4011
4011
  "use strict";
4012
4012
  Object.defineProperty(exports2, "__esModule", { value: true });
4013
4013
  exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
4014
- var fs3 = require("fs");
4014
+ var fs4 = require("fs");
4015
4015
  exports2.FILE_SYSTEM_ADAPTER = {
4016
- lstat: fs3.lstat,
4017
- stat: fs3.stat,
4018
- lstatSync: fs3.lstatSync,
4019
- statSync: fs3.statSync,
4020
- readdir: fs3.readdir,
4021
- readdirSync: fs3.readdirSync
4016
+ lstat: fs4.lstat,
4017
+ stat: fs4.stat,
4018
+ lstatSync: fs4.lstatSync,
4019
+ statSync: fs4.statSync,
4020
+ readdir: fs4.readdir,
4021
+ readdirSync: fs4.readdirSync
4022
4022
  };
4023
4023
  function createFileSystemAdapter(fsMethods) {
4024
4024
  if (fsMethods === void 0) {
@@ -4037,12 +4037,12 @@ var require_settings2 = __commonJS({
4037
4037
  Object.defineProperty(exports2, "__esModule", { value: true });
4038
4038
  var path2 = require("path");
4039
4039
  var fsStat = require_out();
4040
- var fs3 = require_fs4();
4040
+ var fs4 = require_fs4();
4041
4041
  var Settings = class {
4042
4042
  constructor(_options = {}) {
4043
4043
  this._options = _options;
4044
4044
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
4045
- this.fs = fs3.createFileSystemAdapter(this._options.fs);
4045
+ this.fs = fs4.createFileSystemAdapter(this._options.fs);
4046
4046
  this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path2.sep);
4047
4047
  this.stats = this._getValue(this._options.stats, false);
4048
4048
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
@@ -5378,16 +5378,16 @@ var require_settings4 = __commonJS({
5378
5378
  "use strict";
5379
5379
  Object.defineProperty(exports2, "__esModule", { value: true });
5380
5380
  exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
5381
- var fs3 = require("fs");
5381
+ var fs4 = require("fs");
5382
5382
  var os2 = require("os");
5383
5383
  var CPU_COUNT = Math.max(os2.cpus().length, 1);
5384
5384
  exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
5385
- lstat: fs3.lstat,
5386
- lstatSync: fs3.lstatSync,
5387
- stat: fs3.stat,
5388
- statSync: fs3.statSync,
5389
- readdir: fs3.readdir,
5390
- readdirSync: fs3.readdirSync
5385
+ lstat: fs4.lstat,
5386
+ lstatSync: fs4.lstatSync,
5387
+ stat: fs4.stat,
5388
+ statSync: fs4.statSync,
5389
+ readdir: fs4.readdir,
5390
+ readdirSync: fs4.readdirSync
5391
5391
  };
5392
5392
  var Settings = class {
5393
5393
  constructor(_options = {}) {
@@ -21592,7 +21592,7 @@ __export(src_exports, {
21592
21592
  unpluginFactory: () => unpluginFactory
21593
21593
  });
21594
21594
  module.exports = __toCommonJS(src_exports);
21595
- var import_node_fs3 = require("fs");
21595
+ var import_node_fs4 = require("fs");
21596
21596
  var import_node_process4 = __toESM(require("process"), 1);
21597
21597
  var import_unplugin = require("unplugin");
21598
21598
 
@@ -30349,7 +30349,7 @@ async function loadFile(filename, options = {}) {
30349
30349
  var import_utils = require("@antfu/utils");
30350
30350
  async function generateScript(options, mode) {
30351
30351
  const { dir, fileName, globalName, serve, build } = options.env;
30352
- const folder = await findFolder(import_node_process.default.cwd(), dir || "");
30352
+ const folder = await findFolder(import_node_process.default.cwd(), dir);
30353
30353
  const files = await (0, import_fast_glob.default)("*.+(js|ts)", {
30354
30354
  absolute: true,
30355
30355
  cwd: folder
@@ -30358,7 +30358,7 @@ async function generateScript(options, mode) {
30358
30358
  let target = {};
30359
30359
  const source = [];
30360
30360
  let code = "";
30361
- const name = fileName || "";
30361
+ const name = fileName;
30362
30362
  for (const file of files) {
30363
30363
  try {
30364
30364
  const mod = await loadFile(file);
@@ -30418,7 +30418,7 @@ async function findFolder(directoryPath, dir) {
30418
30418
 
30419
30419
  // src/core/options.ts
30420
30420
  var import_utils2 = require("@antfu/utils");
30421
- async function resolveOptions(options) {
30421
+ function resolveOptions(options) {
30422
30422
  const defaults2 = {
30423
30423
  env: {
30424
30424
  dir: "config",
@@ -30426,6 +30426,10 @@ async function resolveOptions(options) {
30426
30426
  globalName: "manifest",
30427
30427
  serve: /dev|development/i,
30428
30428
  build: /prod|production/i
30429
+ },
30430
+ compress: {
30431
+ outDir: "dist",
30432
+ ignoreBase: true
30429
30433
  }
30430
30434
  };
30431
30435
  const mergeOptions = (0, import_utils2.deepMerge)(defaults2, options);
@@ -30436,8 +30440,9 @@ async function resolveOptions(options) {
30436
30440
  }
30437
30441
 
30438
30442
  // src/core/compress.ts
30443
+ var import_node_fs3 = __toESM(require("fs"), 1);
30439
30444
  var import_node_process3 = __toESM(require("process"), 1);
30440
- var compressing = __toESM(require("compressing"), 1);
30445
+ var import_archiver = __toESM(require("archiver"), 1);
30441
30446
 
30442
30447
  // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
30443
30448
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -30944,10 +30949,19 @@ var Log = class {
30944
30949
 
30945
30950
  // src/core/compress.ts
30946
30951
  async function createCompress(options) {
30947
- Log.log("Compressing the directory", options);
30952
+ const { outDir, ignoreBase } = options;
30953
+ const zipFilePath = `${outDir}.zip`;
30954
+ Log.log("Compressing the directory", outDir);
30948
30955
  try {
30949
- await compressing.zip.compressDir("./dist", "./dist.zip");
30950
- Log.success("Successfully compressed the directory", options);
30956
+ const output = import_node_fs3.default.createWriteStream(zipFilePath);
30957
+ const archive = (0, import_archiver.default)("zip", {
30958
+ zlib: { level: 9 }
30959
+ // 设置压缩级别为最高
30960
+ });
30961
+ archive.pipe(output);
30962
+ archive.directory(outDir, ignoreBase ? outDir : false);
30963
+ await archive.finalize();
30964
+ Log.success("Successfully compressed the directory", outDir);
30951
30965
  import_node_process3.default.exit(0);
30952
30966
  } catch (error) {
30953
30967
  Log.error("Error compressing the directory", error);
@@ -30970,8 +30984,7 @@ var unpluginFactory = (options = {}) => {
30970
30984
  },
30971
30985
  async load(id) {
30972
30986
  if (id.startsWith(resolvedVirtualEnvId)) {
30973
- const config = await resolved;
30974
- const { code, watchFiles } = await generateScript(config, "serve");
30987
+ const { code, watchFiles } = await generateScript(resolved, "serve");
30975
30988
  watchFiles.forEach((file) => {
30976
30989
  this.addWatchFile(file);
30977
30990
  });
@@ -30987,14 +31000,13 @@ var unpluginFactory = (options = {}) => {
30987
31000
  return resolvedVirtualEnvId;
30988
31001
  },
30989
31002
  async load(id) {
30990
- const config = await resolved;
30991
- const { emit, script } = await generateScript(config, "build");
31003
+ const { emit, script } = await generateScript(resolved, "build");
30992
31004
  if (id.startsWith(resolvedVirtualEnvId)) {
30993
31005
  this.emitFile(emit);
30994
31006
  return "";
30995
31007
  }
30996
31008
  if (id.endsWith(".html")) {
30997
- let code = await import_node_fs3.promises.readFile(id, "utf8");
31009
+ let code = await import_node_fs4.promises.readFile(id, "utf8");
30998
31010
  code = code.replace(/<\/head>/gm, script);
30999
31011
  return {
31000
31012
  code
@@ -31004,7 +31016,8 @@ var unpluginFactory = (options = {}) => {
31004
31016
  },
31005
31017
  buildEnd: () => {
31006
31018
  import_node_process4.default.on("beforeExit", async () => {
31007
- await createCompress({});
31019
+ const { compress } = resolved;
31020
+ await createCompress(compress);
31008
31021
  });
31009
31022
  }
31010
31023
  }];
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  src_default,
8
8
  unplugin,
9
9
  unpluginFactory
10
- } from "./chunk-EQCBPN6Z.js";
10
+ } from "./chunk-2KZLPXSE.js";
11
11
  export {
12
12
  src_default as default,
13
13
  unplugin,
package/dist/nuxt.cjs CHANGED
@@ -561,7 +561,7 @@ var require_to_regex_range = __commonJS({
561
561
  if (start === stop) {
562
562
  return { pattern: start, count: [], digits: 0 };
563
563
  }
564
- let zipped = zip2(start, stop);
564
+ let zipped = zip(start, stop);
565
565
  let digits = zipped.length;
566
566
  let pattern = "";
567
567
  let count = 0;
@@ -621,7 +621,7 @@ var require_to_regex_range = __commonJS({
621
621
  }
622
622
  return result;
623
623
  }
624
- function zip2(a, b) {
624
+ function zip(a, b) {
625
625
  let arr = [];
626
626
  for (let i = 0; i < a.length; i++)
627
627
  arr.push([a[i], b[i]]);
@@ -3443,8 +3443,8 @@ var require_utils3 = __commonJS({
3443
3443
  exports2.array = array;
3444
3444
  var errno = require_errno();
3445
3445
  exports2.errno = errno;
3446
- var fs3 = require_fs();
3447
- exports2.fs = fs3;
3446
+ var fs4 = require_fs();
3447
+ exports2.fs = fs4;
3448
3448
  var path2 = require_path();
3449
3449
  exports2.path = path2;
3450
3450
  var pattern = require_pattern();
@@ -3628,12 +3628,12 @@ var require_fs2 = __commonJS({
3628
3628
  "use strict";
3629
3629
  Object.defineProperty(exports2, "__esModule", { value: true });
3630
3630
  exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
3631
- var fs3 = require("fs");
3631
+ var fs4 = require("fs");
3632
3632
  exports2.FILE_SYSTEM_ADAPTER = {
3633
- lstat: fs3.lstat,
3634
- stat: fs3.stat,
3635
- lstatSync: fs3.lstatSync,
3636
- statSync: fs3.statSync
3633
+ lstat: fs4.lstat,
3634
+ stat: fs4.stat,
3635
+ lstatSync: fs4.lstatSync,
3636
+ statSync: fs4.statSync
3637
3637
  };
3638
3638
  function createFileSystemAdapter(fsMethods) {
3639
3639
  if (fsMethods === void 0) {
@@ -3650,12 +3650,12 @@ var require_settings = __commonJS({
3650
3650
  "node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
3651
3651
  "use strict";
3652
3652
  Object.defineProperty(exports2, "__esModule", { value: true });
3653
- var fs3 = require_fs2();
3653
+ var fs4 = require_fs2();
3654
3654
  var Settings = class {
3655
3655
  constructor(_options = {}) {
3656
3656
  this._options = _options;
3657
3657
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
3658
- this.fs = fs3.createFileSystemAdapter(this._options.fs);
3658
+ this.fs = fs4.createFileSystemAdapter(this._options.fs);
3659
3659
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
3660
3660
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
3661
3661
  }
@@ -3815,8 +3815,8 @@ var require_utils4 = __commonJS({
3815
3815
  "use strict";
3816
3816
  Object.defineProperty(exports2, "__esModule", { value: true });
3817
3817
  exports2.fs = void 0;
3818
- var fs3 = require_fs3();
3819
- exports2.fs = fs3;
3818
+ var fs4 = require_fs3();
3819
+ exports2.fs = fs4;
3820
3820
  }
3821
3821
  });
3822
3822
 
@@ -4011,14 +4011,14 @@ var require_fs4 = __commonJS({
4011
4011
  "use strict";
4012
4012
  Object.defineProperty(exports2, "__esModule", { value: true });
4013
4013
  exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
4014
- var fs3 = require("fs");
4014
+ var fs4 = require("fs");
4015
4015
  exports2.FILE_SYSTEM_ADAPTER = {
4016
- lstat: fs3.lstat,
4017
- stat: fs3.stat,
4018
- lstatSync: fs3.lstatSync,
4019
- statSync: fs3.statSync,
4020
- readdir: fs3.readdir,
4021
- readdirSync: fs3.readdirSync
4016
+ lstat: fs4.lstat,
4017
+ stat: fs4.stat,
4018
+ lstatSync: fs4.lstatSync,
4019
+ statSync: fs4.statSync,
4020
+ readdir: fs4.readdir,
4021
+ readdirSync: fs4.readdirSync
4022
4022
  };
4023
4023
  function createFileSystemAdapter(fsMethods) {
4024
4024
  if (fsMethods === void 0) {
@@ -4037,12 +4037,12 @@ var require_settings2 = __commonJS({
4037
4037
  Object.defineProperty(exports2, "__esModule", { value: true });
4038
4038
  var path2 = require("path");
4039
4039
  var fsStat = require_out();
4040
- var fs3 = require_fs4();
4040
+ var fs4 = require_fs4();
4041
4041
  var Settings = class {
4042
4042
  constructor(_options = {}) {
4043
4043
  this._options = _options;
4044
4044
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
4045
- this.fs = fs3.createFileSystemAdapter(this._options.fs);
4045
+ this.fs = fs4.createFileSystemAdapter(this._options.fs);
4046
4046
  this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path2.sep);
4047
4047
  this.stats = this._getValue(this._options.stats, false);
4048
4048
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
@@ -5378,16 +5378,16 @@ var require_settings4 = __commonJS({
5378
5378
  "use strict";
5379
5379
  Object.defineProperty(exports2, "__esModule", { value: true });
5380
5380
  exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
5381
- var fs3 = require("fs");
5381
+ var fs4 = require("fs");
5382
5382
  var os2 = require("os");
5383
5383
  var CPU_COUNT = Math.max(os2.cpus().length, 1);
5384
5384
  exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
5385
- lstat: fs3.lstat,
5386
- lstatSync: fs3.lstatSync,
5387
- stat: fs3.stat,
5388
- statSync: fs3.statSync,
5389
- readdir: fs3.readdir,
5390
- readdirSync: fs3.readdirSync
5385
+ lstat: fs4.lstat,
5386
+ lstatSync: fs4.lstatSync,
5387
+ stat: fs4.stat,
5388
+ statSync: fs4.statSync,
5389
+ readdir: fs4.readdir,
5390
+ readdirSync: fs4.readdirSync
5391
5391
  };
5392
5392
  var Settings = class {
5393
5393
  constructor(_options = {}) {
@@ -21596,7 +21596,7 @@ var import_kit = require("@nuxt/kit");
21596
21596
  var import_unplugin2 = require("unplugin");
21597
21597
 
21598
21598
  // src/index.ts
21599
- var import_node_fs3 = require("fs");
21599
+ var import_node_fs4 = require("fs");
21600
21600
  var import_node_process4 = __toESM(require("process"), 1);
21601
21601
  var import_unplugin = require("unplugin");
21602
21602
 
@@ -30353,7 +30353,7 @@ async function loadFile(filename, options = {}) {
30353
30353
  var import_utils = require("@antfu/utils");
30354
30354
  async function generateScript(options, mode) {
30355
30355
  const { dir, fileName, globalName, serve, build } = options.env;
30356
- const folder = await findFolder(import_node_process.default.cwd(), dir || "");
30356
+ const folder = await findFolder(import_node_process.default.cwd(), dir);
30357
30357
  const files = await (0, import_fast_glob.default)("*.+(js|ts)", {
30358
30358
  absolute: true,
30359
30359
  cwd: folder
@@ -30362,7 +30362,7 @@ async function generateScript(options, mode) {
30362
30362
  let target = {};
30363
30363
  const source = [];
30364
30364
  let code = "";
30365
- const name = fileName || "";
30365
+ const name = fileName;
30366
30366
  for (const file of files) {
30367
30367
  try {
30368
30368
  const mod = await loadFile(file);
@@ -30422,7 +30422,7 @@ async function findFolder(directoryPath, dir) {
30422
30422
 
30423
30423
  // src/core/options.ts
30424
30424
  var import_utils2 = require("@antfu/utils");
30425
- async function resolveOptions(options) {
30425
+ function resolveOptions(options) {
30426
30426
  const defaults2 = {
30427
30427
  env: {
30428
30428
  dir: "config",
@@ -30430,6 +30430,10 @@ async function resolveOptions(options) {
30430
30430
  globalName: "manifest",
30431
30431
  serve: /dev|development/i,
30432
30432
  build: /prod|production/i
30433
+ },
30434
+ compress: {
30435
+ outDir: "dist",
30436
+ ignoreBase: true
30433
30437
  }
30434
30438
  };
30435
30439
  const mergeOptions = (0, import_utils2.deepMerge)(defaults2, options);
@@ -30440,8 +30444,9 @@ async function resolveOptions(options) {
30440
30444
  }
30441
30445
 
30442
30446
  // src/core/compress.ts
30447
+ var import_node_fs3 = __toESM(require("fs"), 1);
30443
30448
  var import_node_process3 = __toESM(require("process"), 1);
30444
- var compressing = __toESM(require("compressing"), 1);
30449
+ var import_archiver = __toESM(require("archiver"), 1);
30445
30450
 
30446
30451
  // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
30447
30452
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -30948,10 +30953,19 @@ var Log = class {
30948
30953
 
30949
30954
  // src/core/compress.ts
30950
30955
  async function createCompress(options) {
30951
- Log.log("Compressing the directory", options);
30956
+ const { outDir, ignoreBase } = options;
30957
+ const zipFilePath = `${outDir}.zip`;
30958
+ Log.log("Compressing the directory", outDir);
30952
30959
  try {
30953
- await compressing.zip.compressDir("./dist", "./dist.zip");
30954
- Log.success("Successfully compressed the directory", options);
30960
+ const output = import_node_fs3.default.createWriteStream(zipFilePath);
30961
+ const archive = (0, import_archiver.default)("zip", {
30962
+ zlib: { level: 9 }
30963
+ // 设置压缩级别为最高
30964
+ });
30965
+ archive.pipe(output);
30966
+ archive.directory(outDir, ignoreBase ? outDir : false);
30967
+ await archive.finalize();
30968
+ Log.success("Successfully compressed the directory", outDir);
30955
30969
  import_node_process3.default.exit(0);
30956
30970
  } catch (error) {
30957
30971
  Log.error("Error compressing the directory", error);
@@ -30974,8 +30988,7 @@ var unpluginFactory = (options = {}) => {
30974
30988
  },
30975
30989
  async load(id) {
30976
30990
  if (id.startsWith(resolvedVirtualEnvId)) {
30977
- const config = await resolved;
30978
- const { code, watchFiles } = await generateScript(config, "serve");
30991
+ const { code, watchFiles } = await generateScript(resolved, "serve");
30979
30992
  watchFiles.forEach((file) => {
30980
30993
  this.addWatchFile(file);
30981
30994
  });
@@ -30991,14 +31004,13 @@ var unpluginFactory = (options = {}) => {
30991
31004
  return resolvedVirtualEnvId;
30992
31005
  },
30993
31006
  async load(id) {
30994
- const config = await resolved;
30995
- const { emit, script } = await generateScript(config, "build");
31007
+ const { emit, script } = await generateScript(resolved, "build");
30996
31008
  if (id.startsWith(resolvedVirtualEnvId)) {
30997
31009
  this.emitFile(emit);
30998
31010
  return "";
30999
31011
  }
31000
31012
  if (id.endsWith(".html")) {
31001
- let code = await import_node_fs3.promises.readFile(id, "utf8");
31013
+ let code = await import_node_fs4.promises.readFile(id, "utf8");
31002
31014
  code = code.replace(/<\/head>/gm, script);
31003
31015
  return {
31004
31016
  code
@@ -31008,7 +31020,8 @@ var unpluginFactory = (options = {}) => {
31008
31020
  },
31009
31021
  buildEnd: () => {
31010
31022
  import_node_process4.default.on("beforeExit", async () => {
31011
- await createCompress({});
31023
+ const { compress } = resolved;
31024
+ await createCompress(compress);
31012
31025
  });
31013
31026
  }
31014
31027
  }];
package/dist/nuxt.js CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  import {
7
7
  vite_default
8
- } from "./chunk-CJQKBNAY.js";
8
+ } from "./chunk-QAX3K5V3.js";
9
9
  import {
10
10
  webpack_default
11
- } from "./chunk-R5LAC3HA.js";
12
- import "./chunk-EQCBPN6Z.js";
11
+ } from "./chunk-5EP4GEYR.js";
12
+ import "./chunk-2KZLPXSE.js";
13
13
 
14
14
  // src/nuxt.ts
15
15
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";