vite-plugin-php 1.0.7 → 1.0.8

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
@@ -5435,15 +5435,15 @@ var reusify_1 = reusify$1;
5435
5435
 
5436
5436
  var reusify = reusify_1;
5437
5437
 
5438
- function fastqueue (context, worker, concurrency) {
5438
+ function fastqueue (context, worker, _concurrency) {
5439
5439
  if (typeof context === 'function') {
5440
- concurrency = worker;
5440
+ _concurrency = worker;
5441
5441
  worker = context;
5442
5442
  context = null;
5443
5443
  }
5444
5444
 
5445
- if (concurrency < 1) {
5446
- throw new Error('fastqueue concurrency must be greater than 1')
5445
+ if (!(_concurrency >= 1)) {
5446
+ throw new Error('fastqueue concurrency must be equal to or greater than 1')
5447
5447
  }
5448
5448
 
5449
5449
  var cache = reusify(Task);
@@ -5458,7 +5458,23 @@ function fastqueue (context, worker, concurrency) {
5458
5458
  saturated: noop,
5459
5459
  pause: pause,
5460
5460
  paused: false,
5461
- concurrency: concurrency,
5461
+
5462
+ get concurrency () {
5463
+ return _concurrency
5464
+ },
5465
+ set concurrency (value) {
5466
+ if (!(value >= 1)) {
5467
+ throw new Error('fastqueue concurrency must be equal to or greater than 1')
5468
+ }
5469
+ _concurrency = value;
5470
+
5471
+ if (self.paused) return
5472
+ for (; queueHead && _running < _concurrency;) {
5473
+ _running++;
5474
+ release();
5475
+ }
5476
+ },
5477
+
5462
5478
  running: running,
5463
5479
  resume: resume,
5464
5480
  idle: idle,
@@ -5508,7 +5524,12 @@ function fastqueue (context, worker, concurrency) {
5508
5524
  function resume () {
5509
5525
  if (!self.paused) return
5510
5526
  self.paused = false;
5511
- for (var i = 0; i < self.concurrency; i++) {
5527
+ if (queueHead === null) {
5528
+ _running++;
5529
+ release();
5530
+ return
5531
+ }
5532
+ for (; queueHead && _running < _concurrency;) {
5512
5533
  _running++;
5513
5534
  release();
5514
5535
  }
@@ -5527,7 +5548,7 @@ function fastqueue (context, worker, concurrency) {
5527
5548
  current.callback = done || noop;
5528
5549
  current.errorHandler = errorHandler;
5529
5550
 
5530
- if (_running === self.concurrency || self.paused) {
5551
+ if (_running >= _concurrency || self.paused) {
5531
5552
  if (queueTail) {
5532
5553
  queueTail.next = current;
5533
5554
  queueTail = current;
@@ -5549,8 +5570,9 @@ function fastqueue (context, worker, concurrency) {
5549
5570
  current.release = release;
5550
5571
  current.value = value;
5551
5572
  current.callback = done || noop;
5573
+ current.errorHandler = errorHandler;
5552
5574
 
5553
- if (_running === self.concurrency || self.paused) {
5575
+ if (_running >= _concurrency || self.paused) {
5554
5576
  if (queueHead) {
5555
5577
  current.next = queueHead;
5556
5578
  queueHead = current;
@@ -5570,7 +5592,7 @@ function fastqueue (context, worker, concurrency) {
5570
5592
  cache.release(holder);
5571
5593
  }
5572
5594
  var next = queueHead;
5573
- if (next) {
5595
+ if (next && _running <= _concurrency) {
5574
5596
  if (!self.paused) {
5575
5597
  if (queueTail === queueHead) {
5576
5598
  queueTail = null;
@@ -5633,9 +5655,9 @@ function Task () {
5633
5655
  };
5634
5656
  }
5635
5657
 
5636
- function queueAsPromised (context, worker, concurrency) {
5658
+ function queueAsPromised (context, worker, _concurrency) {
5637
5659
  if (typeof context === 'function') {
5638
- concurrency = worker;
5660
+ _concurrency = worker;
5639
5661
  worker = context;
5640
5662
  context = null;
5641
5663
  }
@@ -5647,7 +5669,7 @@ function queueAsPromised (context, worker, concurrency) {
5647
5669
  }, cb);
5648
5670
  }
5649
5671
 
5650
- var queue = fastqueue(context, asyncWrapper, concurrency);
5672
+ var queue = fastqueue(context, asyncWrapper, _concurrency);
5651
5673
 
5652
5674
  var pushCb = queue.push;
5653
5675
  var unshiftCb = queue.unshift;
@@ -5697,6 +5719,12 @@ function queueAsPromised (context, worker, concurrency) {
5697
5719
  }
5698
5720
 
5699
5721
  function drained () {
5722
+ if (queue.idle()) {
5723
+ return new Promise(function (resolve) {
5724
+ resolve();
5725
+ })
5726
+ }
5727
+
5700
5728
  var previousDrain = queue.drain;
5701
5729
 
5702
5730
  var p = new Promise(function (resolve) {
package/dist/index.mjs CHANGED
@@ -5422,15 +5422,15 @@ var reusify_1 = reusify$1;
5422
5422
 
5423
5423
  var reusify = reusify_1;
5424
5424
 
5425
- function fastqueue (context, worker, concurrency) {
5425
+ function fastqueue (context, worker, _concurrency) {
5426
5426
  if (typeof context === 'function') {
5427
- concurrency = worker;
5427
+ _concurrency = worker;
5428
5428
  worker = context;
5429
5429
  context = null;
5430
5430
  }
5431
5431
 
5432
- if (concurrency < 1) {
5433
- throw new Error('fastqueue concurrency must be greater than 1')
5432
+ if (!(_concurrency >= 1)) {
5433
+ throw new Error('fastqueue concurrency must be equal to or greater than 1')
5434
5434
  }
5435
5435
 
5436
5436
  var cache = reusify(Task);
@@ -5445,7 +5445,23 @@ function fastqueue (context, worker, concurrency) {
5445
5445
  saturated: noop,
5446
5446
  pause: pause,
5447
5447
  paused: false,
5448
- concurrency: concurrency,
5448
+
5449
+ get concurrency () {
5450
+ return _concurrency
5451
+ },
5452
+ set concurrency (value) {
5453
+ if (!(value >= 1)) {
5454
+ throw new Error('fastqueue concurrency must be equal to or greater than 1')
5455
+ }
5456
+ _concurrency = value;
5457
+
5458
+ if (self.paused) return
5459
+ for (; queueHead && _running < _concurrency;) {
5460
+ _running++;
5461
+ release();
5462
+ }
5463
+ },
5464
+
5449
5465
  running: running,
5450
5466
  resume: resume,
5451
5467
  idle: idle,
@@ -5495,7 +5511,12 @@ function fastqueue (context, worker, concurrency) {
5495
5511
  function resume () {
5496
5512
  if (!self.paused) return
5497
5513
  self.paused = false;
5498
- for (var i = 0; i < self.concurrency; i++) {
5514
+ if (queueHead === null) {
5515
+ _running++;
5516
+ release();
5517
+ return
5518
+ }
5519
+ for (; queueHead && _running < _concurrency;) {
5499
5520
  _running++;
5500
5521
  release();
5501
5522
  }
@@ -5514,7 +5535,7 @@ function fastqueue (context, worker, concurrency) {
5514
5535
  current.callback = done || noop;
5515
5536
  current.errorHandler = errorHandler;
5516
5537
 
5517
- if (_running === self.concurrency || self.paused) {
5538
+ if (_running >= _concurrency || self.paused) {
5518
5539
  if (queueTail) {
5519
5540
  queueTail.next = current;
5520
5541
  queueTail = current;
@@ -5536,8 +5557,9 @@ function fastqueue (context, worker, concurrency) {
5536
5557
  current.release = release;
5537
5558
  current.value = value;
5538
5559
  current.callback = done || noop;
5560
+ current.errorHandler = errorHandler;
5539
5561
 
5540
- if (_running === self.concurrency || self.paused) {
5562
+ if (_running >= _concurrency || self.paused) {
5541
5563
  if (queueHead) {
5542
5564
  current.next = queueHead;
5543
5565
  queueHead = current;
@@ -5557,7 +5579,7 @@ function fastqueue (context, worker, concurrency) {
5557
5579
  cache.release(holder);
5558
5580
  }
5559
5581
  var next = queueHead;
5560
- if (next) {
5582
+ if (next && _running <= _concurrency) {
5561
5583
  if (!self.paused) {
5562
5584
  if (queueTail === queueHead) {
5563
5585
  queueTail = null;
@@ -5620,9 +5642,9 @@ function Task () {
5620
5642
  };
5621
5643
  }
5622
5644
 
5623
- function queueAsPromised (context, worker, concurrency) {
5645
+ function queueAsPromised (context, worker, _concurrency) {
5624
5646
  if (typeof context === 'function') {
5625
- concurrency = worker;
5647
+ _concurrency = worker;
5626
5648
  worker = context;
5627
5649
  context = null;
5628
5650
  }
@@ -5634,7 +5656,7 @@ function queueAsPromised (context, worker, concurrency) {
5634
5656
  }, cb);
5635
5657
  }
5636
5658
 
5637
- var queue = fastqueue(context, asyncWrapper, concurrency);
5659
+ var queue = fastqueue(context, asyncWrapper, _concurrency);
5638
5660
 
5639
5661
  var pushCb = queue.push;
5640
5662
  var unshiftCb = queue.unshift;
@@ -5684,6 +5706,12 @@ function queueAsPromised (context, worker, concurrency) {
5684
5706
  }
5685
5707
 
5686
5708
  function drained () {
5709
+ if (queue.idle()) {
5710
+ return new Promise(function (resolve) {
5711
+ resolve();
5712
+ })
5713
+ }
5714
+
5687
5715
  var previousDrain = queue.drain;
5688
5716
 
5689
5717
  var p = new Promise(function (resolve) {
package/dist/router.php CHANGED
@@ -11,5 +11,9 @@ $source = str_replace(
11
11
  );
12
12
 
13
13
  die((function ($__SOURCE) {
14
- eval("?>$__SOURCE<?php");
14
+ try {
15
+ return eval("?> $__SOURCE <?php");
16
+ } catch (\Throwable $th) {
17
+ return $th->getMessage();
18
+ }
15
19
  })($source));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-php",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Precompile PHP-files with the speed of Vite",
5
5
  "keywords": [
6
6
  "vite",