@modern-js/ssg-generator 3.7.75 → 3.7.76

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.
Files changed (2) hide show
  1. package/dist/index.js +188 -269
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -66293,63 +66293,113 @@ var require_lib5 = __commonJS({
66293
66293
  }
66294
66294
  });
66295
66295
 
66296
- // ../../../../node_modules/.pnpm/tmp@0.2.5/node_modules/tmp/lib/tmp.js
66296
+ // ../../../../node_modules/.pnpm/os-tmpdir@1.0.2/node_modules/os-tmpdir/index.js
66297
+ var require_os_tmpdir = __commonJS({
66298
+ "../../../../node_modules/.pnpm/os-tmpdir@1.0.2/node_modules/os-tmpdir/index.js"(exports, module2) {
66299
+ "use strict";
66300
+ var isWindows = process.platform === "win32";
66301
+ var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
66302
+ module2.exports = function() {
66303
+ var path5;
66304
+ if (isWindows) {
66305
+ path5 = process.env.TEMP || process.env.TMP || (process.env.SystemRoot || process.env.windir) + "\\temp";
66306
+ } else {
66307
+ path5 = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
66308
+ }
66309
+ if (trailingSlashRe.test(path5)) {
66310
+ path5 = path5.slice(0, -1);
66311
+ }
66312
+ return path5;
66313
+ };
66314
+ }
66315
+ });
66316
+
66317
+ // ../../../../node_modules/.pnpm/tmp@0.0.33/node_modules/tmp/lib/tmp.js
66297
66318
  var require_tmp = __commonJS({
66298
- "../../../../node_modules/.pnpm/tmp@0.2.5/node_modules/tmp/lib/tmp.js"(exports, module2) {
66319
+ "../../../../node_modules/.pnpm/tmp@0.0.33/node_modules/tmp/lib/tmp.js"(exports, module2) {
66299
66320
  "use strict";
66300
66321
  var fs2 = require("fs");
66301
- var os = require("os");
66302
66322
  var path5 = require("path");
66303
66323
  var crypto = require("crypto");
66304
- var _c = { fs: fs2.constants, os: os.constants };
66324
+ var osTmpDir = require_os_tmpdir();
66325
+ var _c = process.binding("constants");
66326
+ var tmpDir = osTmpDir();
66305
66327
  var RANDOM_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
66306
66328
  var TEMPLATE_PATTERN = /XXXXXX/;
66307
66329
  var DEFAULT_TRIES = 3;
66308
66330
  var CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR);
66309
- var IS_WIN32 = os.platform() === "win32";
66310
66331
  var EBADF = _c.EBADF || _c.os.errno.EBADF;
66311
66332
  var ENOENT = _c.ENOENT || _c.os.errno.ENOENT;
66312
66333
  var DIR_MODE = 448;
66313
66334
  var FILE_MODE = 384;
66314
- var EXIT = "exit";
66315
66335
  var _removeObjects = [];
66316
- var FN_RMDIR_SYNC = fs2.rmdirSync.bind(fs2);
66317
66336
  var _gracefulCleanup = false;
66318
- function rimraf(dirPath, callback) {
66319
- return fs2.rm(dirPath, { recursive: true }, callback);
66337
+ var _uncaughtException = false;
66338
+ function _randomChars(howMany) {
66339
+ var value = [], rnd = null;
66340
+ try {
66341
+ rnd = crypto.randomBytes(howMany);
66342
+ } catch (e) {
66343
+ rnd = crypto.pseudoRandomBytes(howMany);
66344
+ }
66345
+ for (var i = 0; i < howMany; i++) {
66346
+ value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
66347
+ }
66348
+ return value.join("");
66349
+ }
66350
+ function _isUndefined(obj) {
66351
+ return typeof obj === "undefined";
66320
66352
  }
66321
- function FN_RIMRAF_SYNC(dirPath) {
66322
- return fs2.rmSync(dirPath, { recursive: true });
66353
+ function _parseArguments(options, callback) {
66354
+ if (typeof options == "function") {
66355
+ return [callback || {}, options];
66356
+ }
66357
+ if (_isUndefined(options)) {
66358
+ return [{}, callback];
66359
+ }
66360
+ return [options, callback];
66361
+ }
66362
+ function _generateTmpName(opts) {
66363
+ if (opts.name) {
66364
+ return path5.join(opts.dir || tmpDir, opts.name);
66365
+ }
66366
+ if (opts.template) {
66367
+ return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));
66368
+ }
66369
+ const name = [
66370
+ opts.prefix || "tmp-",
66371
+ process.pid,
66372
+ _randomChars(12),
66373
+ opts.postfix || ""
66374
+ ].join("");
66375
+ return path5.join(opts.dir || tmpDir, name);
66323
66376
  }
66324
66377
  function tmpName(options, callback) {
66325
- const args = _parseArguments(options, callback), opts = args[0], cb = args[1];
66326
- _assertAndSanitizeOptions(opts, function(err, sanitizedOptions) {
66327
- if (err)
66328
- return cb(err);
66329
- let tries = sanitizedOptions.tries;
66330
- (function _getUniqueName() {
66331
- try {
66332
- const name = _generateTmpName(sanitizedOptions);
66333
- fs2.stat(name, function(err2) {
66334
- if (!err2) {
66335
- if (tries-- > 0)
66336
- return _getUniqueName();
66337
- return cb(new Error("Could not get a unique tmp filename, max tries reached " + name));
66338
- }
66339
- cb(null, name);
66340
- });
66341
- } catch (err2) {
66342
- cb(err2);
66343
- }
66344
- })();
66345
- });
66378
+ var args = _parseArguments(options, callback), opts = args[0], cb = args[1], tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
66379
+ if (isNaN(tries) || tries < 0)
66380
+ return cb(new Error("Invalid tries"));
66381
+ if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
66382
+ return cb(new Error("Invalid template provided"));
66383
+ (function _getUniqueName() {
66384
+ const name = _generateTmpName(opts);
66385
+ fs2.stat(name, function(err) {
66386
+ if (!err) {
66387
+ if (tries-- > 0)
66388
+ return _getUniqueName();
66389
+ return cb(new Error("Could not get a unique tmp filename, max tries reached " + name));
66390
+ }
66391
+ cb(null, name);
66392
+ });
66393
+ })();
66346
66394
  }
66347
66395
  function tmpNameSync(options) {
66348
- const args = _parseArguments(options), opts = args[0];
66349
- const sanitizedOptions = _assertAndSanitizeOptionsSync(opts);
66350
- let tries = sanitizedOptions.tries;
66396
+ var args = _parseArguments(options), opts = args[0], tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;
66397
+ if (isNaN(tries) || tries < 0)
66398
+ throw new Error("Invalid tries");
66399
+ if (opts.template && !opts.template.match(TEMPLATE_PATTERN))
66400
+ throw new Error("Invalid template provided");
66351
66401
  do {
66352
- const name = _generateTmpName(sanitizedOptions);
66402
+ const name = _generateTmpName(opts);
66353
66403
  try {
66354
66404
  fs2.statSync(name);
66355
66405
  } catch (e) {
@@ -66359,7 +66409,8 @@ var require_tmp = __commonJS({
66359
66409
  throw new Error("Could not get a unique tmp filename, max tries reached");
66360
66410
  }
66361
66411
  function file(options, callback) {
66362
- const args = _parseArguments(options, callback), opts = args[0], cb = args[1];
66412
+ var args = _parseArguments(options, callback), opts = args[0], cb = args[1];
66413
+ opts.postfix = _isUndefined(opts.postfix) ? ".tmp" : opts.postfix;
66363
66414
  tmpName(opts, function _tmpNameCreated(err, name) {
66364
66415
  if (err)
66365
66416
  return cb(err);
@@ -66367,21 +66418,33 @@ var require_tmp = __commonJS({
66367
66418
  if (err2)
66368
66419
  return cb(err2);
66369
66420
  if (opts.discardDescriptor) {
66370
- return fs2.close(fd, function _discardCallback(possibleErr) {
66371
- return cb(possibleErr, name, void 0, _prepareTmpFileRemoveCallback(name, -1, opts, false));
66421
+ return fs2.close(fd, function _discardCallback(err3) {
66422
+ if (err3) {
66423
+ try {
66424
+ fs2.unlinkSync(name);
66425
+ } catch (e) {
66426
+ if (!isENOENT(e)) {
66427
+ err3 = e;
66428
+ }
66429
+ }
66430
+ return cb(err3);
66431
+ }
66432
+ cb(null, name, void 0, _prepareTmpFileRemoveCallback(name, -1, opts));
66372
66433
  });
66373
- } else {
66374
- const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
66375
- cb(null, name, fd, _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, false));
66376
66434
  }
66435
+ if (opts.detachDescriptor) {
66436
+ return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));
66437
+ }
66438
+ cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));
66377
66439
  });
66378
66440
  });
66379
66441
  }
66380
66442
  function fileSync(options) {
66381
- const args = _parseArguments(options), opts = args[0];
66443
+ var args = _parseArguments(options), opts = args[0];
66444
+ opts.postfix = opts.postfix || ".tmp";
66382
66445
  const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
66383
66446
  const name = tmpNameSync(opts);
66384
- let fd = fs2.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
66447
+ var fd = fs2.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
66385
66448
  if (opts.discardDescriptor) {
66386
66449
  fs2.closeSync(fd);
66387
66450
  fd = void 0;
@@ -66389,281 +66452,137 @@ var require_tmp = __commonJS({
66389
66452
  return {
66390
66453
  name,
66391
66454
  fd,
66392
- removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts, true)
66455
+ removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)
66393
66456
  };
66394
66457
  }
66458
+ function _rmdirRecursiveSync(root) {
66459
+ const dirs = [root];
66460
+ do {
66461
+ var dir2 = dirs.pop(), deferred = false, files = fs2.readdirSync(dir2);
66462
+ for (var i = 0, length = files.length; i < length; i++) {
66463
+ var file2 = path5.join(dir2, files[i]), stat = fs2.lstatSync(file2);
66464
+ if (stat.isDirectory()) {
66465
+ if (!deferred) {
66466
+ deferred = true;
66467
+ dirs.push(dir2);
66468
+ }
66469
+ dirs.push(file2);
66470
+ } else {
66471
+ fs2.unlinkSync(file2);
66472
+ }
66473
+ }
66474
+ if (!deferred) {
66475
+ fs2.rmdirSync(dir2);
66476
+ }
66477
+ } while (dirs.length !== 0);
66478
+ }
66395
66479
  function dir(options, callback) {
66396
- const args = _parseArguments(options, callback), opts = args[0], cb = args[1];
66480
+ var args = _parseArguments(options, callback), opts = args[0], cb = args[1];
66397
66481
  tmpName(opts, function _tmpNameCreated(err, name) {
66398
66482
  if (err)
66399
66483
  return cb(err);
66400
66484
  fs2.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
66401
66485
  if (err2)
66402
66486
  return cb(err2);
66403
- cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false));
66487
+ cb(null, name, _prepareTmpDirRemoveCallback(name, opts));
66404
66488
  });
66405
66489
  });
66406
66490
  }
66407
66491
  function dirSync(options) {
66408
- const args = _parseArguments(options), opts = args[0];
66492
+ var args = _parseArguments(options), opts = args[0];
66409
66493
  const name = tmpNameSync(opts);
66410
66494
  fs2.mkdirSync(name, opts.mode || DIR_MODE);
66411
66495
  return {
66412
66496
  name,
66413
- removeCallback: _prepareTmpDirRemoveCallback(name, opts, true)
66497
+ removeCallback: _prepareTmpDirRemoveCallback(name, opts)
66414
66498
  };
66415
66499
  }
66416
- function _removeFileAsync(fdPath, next) {
66417
- const _handler = function(err) {
66418
- if (err && !_isENOENT(err)) {
66419
- return next(err);
66500
+ function _prepareTmpFileRemoveCallback(name, fd, opts) {
66501
+ const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {
66502
+ try {
66503
+ if (0 <= fdPath[0]) {
66504
+ fs2.closeSync(fdPath[0]);
66505
+ }
66506
+ } catch (e) {
66507
+ if (!isEBADF(e) && !isENOENT(e)) {
66508
+ throw e;
66509
+ }
66420
66510
  }
66421
- next();
66422
- };
66423
- if (0 <= fdPath[0])
66424
- fs2.close(fdPath[0], function() {
66425
- fs2.unlink(fdPath[1], _handler);
66426
- });
66427
- else
66428
- fs2.unlink(fdPath[1], _handler);
66429
- }
66430
- function _removeFileSync(fdPath) {
66431
- let rethrownException = null;
66432
- try {
66433
- if (0 <= fdPath[0])
66434
- fs2.closeSync(fdPath[0]);
66435
- } catch (e) {
66436
- if (!_isEBADF(e) && !_isENOENT(e))
66437
- throw e;
66438
- } finally {
66439
66511
  try {
66440
66512
  fs2.unlinkSync(fdPath[1]);
66441
66513
  } catch (e) {
66442
- if (!_isENOENT(e))
66443
- rethrownException = e;
66514
+ if (!isENOENT(e)) {
66515
+ throw e;
66516
+ }
66444
66517
  }
66518
+ }, [fd, name]);
66519
+ if (!opts.keep) {
66520
+ _removeObjects.unshift(removeCallback);
66445
66521
  }
66446
- if (rethrownException !== null) {
66447
- throw rethrownException;
66448
- }
66522
+ return removeCallback;
66449
66523
  }
66450
- function _prepareTmpFileRemoveCallback(name, fd, opts, sync) {
66451
- const removeCallbackSync = _prepareRemoveCallback(_removeFileSync, [fd, name], sync);
66452
- const removeCallback = _prepareRemoveCallback(_removeFileAsync, [fd, name], sync, removeCallbackSync);
66453
- if (!opts.keep)
66454
- _removeObjects.unshift(removeCallbackSync);
66455
- return sync ? removeCallbackSync : removeCallback;
66456
- }
66457
- function _prepareTmpDirRemoveCallback(name, opts, sync) {
66458
- const removeFunction = opts.unsafeCleanup ? rimraf : fs2.rmdir.bind(fs2);
66459
- const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC;
66460
- const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync);
66461
- const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync);
66462
- if (!opts.keep)
66463
- _removeObjects.unshift(removeCallbackSync);
66464
- return sync ? removeCallbackSync : removeCallback;
66524
+ function _prepareTmpDirRemoveCallback(name, opts) {
66525
+ const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs2.rmdirSync.bind(fs2);
66526
+ const removeCallback = _prepareRemoveCallback(removeFunction, name);
66527
+ if (!opts.keep) {
66528
+ _removeObjects.unshift(removeCallback);
66529
+ }
66530
+ return removeCallback;
66465
66531
  }
66466
- function _prepareRemoveCallback(removeFunction, fileOrDirName, sync, cleanupCallbackSync) {
66467
- let called = false;
66532
+ function _prepareRemoveCallback(removeFunction, arg) {
66533
+ var called = false;
66468
66534
  return function _cleanupCallback(next) {
66469
66535
  if (!called) {
66470
- const toRemove = cleanupCallbackSync || _cleanupCallback;
66471
- const index = _removeObjects.indexOf(toRemove);
66472
- if (index >= 0)
66536
+ const index = _removeObjects.indexOf(_cleanupCallback);
66537
+ if (index >= 0) {
66473
66538
  _removeObjects.splice(index, 1);
66474
- called = true;
66475
- if (sync || removeFunction === FN_RMDIR_SYNC || removeFunction === FN_RIMRAF_SYNC) {
66476
- return removeFunction(fileOrDirName);
66477
- } else {
66478
- return removeFunction(fileOrDirName, next || function() {
66479
- });
66480
66539
  }
66540
+ called = true;
66541
+ removeFunction(arg);
66481
66542
  }
66543
+ if (next)
66544
+ next(null);
66482
66545
  };
66483
66546
  }
66484
66547
  function _garbageCollector() {
66485
- if (!_gracefulCleanup)
66548
+ if (_uncaughtException && !_gracefulCleanup) {
66486
66549
  return;
66550
+ }
66487
66551
  while (_removeObjects.length) {
66488
66552
  try {
66489
- _removeObjects[0]();
66553
+ _removeObjects[0].call(null);
66490
66554
  } catch (e) {
66491
66555
  }
66492
66556
  }
66493
66557
  }
66494
- function _randomChars(howMany) {
66495
- let value = [], rnd = null;
66496
- try {
66497
- rnd = crypto.randomBytes(howMany);
66498
- } catch (e) {
66499
- rnd = crypto.pseudoRandomBytes(howMany);
66500
- }
66501
- for (let i = 0; i < howMany; i++) {
66502
- value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);
66503
- }
66504
- return value.join("");
66505
- }
66506
- function _isUndefined(obj) {
66507
- return typeof obj === "undefined";
66508
- }
66509
- function _parseArguments(options, callback) {
66510
- if (typeof options === "function") {
66511
- return [{}, options];
66512
- }
66513
- if (_isUndefined(options)) {
66514
- return [{}, callback];
66515
- }
66516
- const actualOptions = {};
66517
- for (const key of Object.getOwnPropertyNames(options)) {
66518
- actualOptions[key] = options[key];
66519
- }
66520
- return [actualOptions, callback];
66521
- }
66522
- function _resolvePath(name, tmpDir, cb) {
66523
- const pathToResolve = path5.isAbsolute(name) ? name : path5.join(tmpDir, name);
66524
- fs2.stat(pathToResolve, function(err) {
66525
- if (err) {
66526
- fs2.realpath(path5.dirname(pathToResolve), function(err2, parentDir) {
66527
- if (err2)
66528
- return cb(err2);
66529
- cb(null, path5.join(parentDir, path5.basename(pathToResolve)));
66530
- });
66531
- } else {
66532
- fs2.realpath(pathToResolve, cb);
66533
- }
66534
- });
66535
- }
66536
- function _resolvePathSync(name, tmpDir) {
66537
- const pathToResolve = path5.isAbsolute(name) ? name : path5.join(tmpDir, name);
66538
- try {
66539
- fs2.statSync(pathToResolve);
66540
- return fs2.realpathSync(pathToResolve);
66541
- } catch (_err) {
66542
- const parentDir = fs2.realpathSync(path5.dirname(pathToResolve));
66543
- return path5.join(parentDir, path5.basename(pathToResolve));
66544
- }
66545
- }
66546
- function _generateTmpName(opts) {
66547
- const tmpDir = opts.tmpdir;
66548
- if (!_isUndefined(opts.name)) {
66549
- return path5.join(tmpDir, opts.dir, opts.name);
66550
- }
66551
- if (!_isUndefined(opts.template)) {
66552
- return path5.join(tmpDir, opts.dir, opts.template).replace(TEMPLATE_PATTERN, _randomChars(6));
66553
- }
66554
- const name = [
66555
- opts.prefix ? opts.prefix : "tmp",
66556
- "-",
66557
- process.pid,
66558
- "-",
66559
- _randomChars(12),
66560
- opts.postfix ? "-" + opts.postfix : ""
66561
- ].join("");
66562
- return path5.join(tmpDir, opts.dir, name);
66563
- }
66564
- function _assertOptionsBase(options) {
66565
- if (!_isUndefined(options.name)) {
66566
- const name = options.name;
66567
- if (path5.isAbsolute(name))
66568
- throw new Error(`name option must not contain an absolute path, found "${name}".`);
66569
- const basename = path5.basename(name);
66570
- if (basename === ".." || basename === "." || basename !== name)
66571
- throw new Error(`name option must not contain a path, found "${name}".`);
66572
- }
66573
- if (!_isUndefined(options.template) && !options.template.match(TEMPLATE_PATTERN)) {
66574
- throw new Error(`Invalid template, found "${options.template}".`);
66575
- }
66576
- if (!_isUndefined(options.tries) && isNaN(options.tries) || options.tries < 0) {
66577
- throw new Error(`Invalid tries, found "${options.tries}".`);
66578
- }
66579
- options.tries = _isUndefined(options.name) ? options.tries || DEFAULT_TRIES : 1;
66580
- options.keep = !!options.keep;
66581
- options.detachDescriptor = !!options.detachDescriptor;
66582
- options.discardDescriptor = !!options.discardDescriptor;
66583
- options.unsafeCleanup = !!options.unsafeCleanup;
66584
- options.prefix = _isUndefined(options.prefix) ? "" : options.prefix;
66585
- options.postfix = _isUndefined(options.postfix) ? "" : options.postfix;
66586
- }
66587
- function _getRelativePath(option, name, tmpDir, cb) {
66588
- if (_isUndefined(name))
66589
- return cb(null);
66590
- _resolvePath(name, tmpDir, function(err, resolvedPath) {
66591
- if (err)
66592
- return cb(err);
66593
- const relativePath = path5.relative(tmpDir, resolvedPath);
66594
- if (!resolvedPath.startsWith(tmpDir)) {
66595
- return cb(new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`));
66596
- }
66597
- cb(null, relativePath);
66598
- });
66599
- }
66600
- function _getRelativePathSync(option, name, tmpDir) {
66601
- if (_isUndefined(name))
66602
- return;
66603
- const resolvedPath = _resolvePathSync(name, tmpDir);
66604
- const relativePath = path5.relative(tmpDir, resolvedPath);
66605
- if (!resolvedPath.startsWith(tmpDir)) {
66606
- throw new Error(`${option} option must be relative to "${tmpDir}", found "${relativePath}".`);
66607
- }
66608
- return relativePath;
66609
- }
66610
- function _assertAndSanitizeOptions(options, cb) {
66611
- _getTmpDir(options, function(err, tmpDir) {
66612
- if (err)
66613
- return cb(err);
66614
- options.tmpdir = tmpDir;
66615
- try {
66616
- _assertOptionsBase(options, tmpDir);
66617
- } catch (err2) {
66618
- return cb(err2);
66619
- }
66620
- _getRelativePath("dir", options.dir, tmpDir, function(err2, dir2) {
66621
- if (err2)
66622
- return cb(err2);
66623
- options.dir = _isUndefined(dir2) ? "" : dir2;
66624
- _getRelativePath("template", options.template, tmpDir, function(err3, template) {
66625
- if (err3)
66626
- return cb(err3);
66627
- options.template = template;
66628
- cb(null, options);
66629
- });
66630
- });
66631
- });
66632
- }
66633
- function _assertAndSanitizeOptionsSync(options) {
66634
- const tmpDir = options.tmpdir = _getTmpDirSync(options);
66635
- _assertOptionsBase(options, tmpDir);
66636
- const dir2 = _getRelativePathSync("dir", options.dir, tmpDir);
66637
- options.dir = _isUndefined(dir2) ? "" : dir2;
66638
- options.template = _getRelativePathSync("template", options.template, tmpDir);
66639
- return options;
66558
+ function isEBADF(error) {
66559
+ return isExpectedError(error, -EBADF, "EBADF");
66640
66560
  }
66641
- function _isEBADF(error) {
66642
- return _isExpectedError(error, -EBADF, "EBADF");
66561
+ function isENOENT(error) {
66562
+ return isExpectedError(error, -ENOENT, "ENOENT");
66643
66563
  }
66644
- function _isENOENT(error) {
66645
- return _isExpectedError(error, -ENOENT, "ENOENT");
66646
- }
66647
- function _isExpectedError(error, errno, code) {
66648
- return IS_WIN32 ? error.code === code : error.code === code && error.errno === errno;
66564
+ function isExpectedError(error, code, errno) {
66565
+ return error.code == code || error.code == errno;
66649
66566
  }
66650
66567
  function setGracefulCleanup() {
66651
66568
  _gracefulCleanup = true;
66652
66569
  }
66653
- function _getTmpDir(options, cb) {
66654
- return fs2.realpath(options && options.tmpdir || os.tmpdir(), cb);
66655
- }
66656
- function _getTmpDirSync(options) {
66657
- return fs2.realpathSync(options && options.tmpdir || os.tmpdir());
66570
+ var version = process.versions.node.split(".").map(function(value) {
66571
+ return parseInt(value, 10);
66572
+ });
66573
+ if (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {
66574
+ process.addListener("uncaughtException", function _uncaughtExceptionThrown(err) {
66575
+ _uncaughtException = true;
66576
+ _garbageCollector();
66577
+ throw err;
66578
+ });
66658
66579
  }
66659
- process.addListener(EXIT, _garbageCollector);
66660
- Object.defineProperty(module2.exports, "tmpdir", {
66661
- enumerable: true,
66662
- configurable: false,
66663
- get: function() {
66664
- return _getTmpDirSync();
66665
- }
66580
+ process.addListener("exit", function _exit(code) {
66581
+ if (code)
66582
+ _uncaughtException = true;
66583
+ _garbageCollector();
66666
66584
  });
66585
+ module2.exports.tmpdir = tmpDir;
66667
66586
  module2.exports.dir = dir;
66668
66587
  module2.exports.dirSync = dirSync;
66669
66588
  module2.exports.file = file;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.7.75",
18
+ "version": "3.7.76",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -30,10 +30,10 @@
30
30
  "@types/node": "^18",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@modern-js/dependence-generator": "3.7.75",
34
- "@modern-js/generator-common": "3.7.75",
35
- "@modern-js/generator-utils": "3.7.75",
36
- "@modern-js/plugin-i18n": "2.71.0",
33
+ "@modern-js/dependence-generator": "3.7.76",
34
+ "@modern-js/generator-common": "3.7.76",
35
+ "@modern-js/generator-utils": "3.7.76",
36
+ "@modern-js/plugin-i18n": "2.71.1",
37
37
  "@scripts/build": "2.66.0",
38
38
  "@scripts/jest-config": "2.66.0"
39
39
  },