@cloudsnorkel/cdk-github-runners 0.12.2 → 0.12.4

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 (31) hide show
  1. package/.jsii +116 -20
  2. package/API.md +84 -1
  3. package/assets/delete-failed-runner.lambda/index.js +15 -6
  4. package/assets/idle-runner-repear.lambda/index.js +15 -6
  5. package/assets/image-builders/aws-image-builder/versioner.lambda/index.js +15 -6
  6. package/assets/setup.lambda/index.html +1 -1
  7. package/assets/status.lambda/index.js +15 -6
  8. package/assets/token-retriever.lambda/index.js +15 -6
  9. package/assets/webhook-handler.lambda/index.js +15 -6
  10. package/lib/access.js +1 -1
  11. package/lib/image-builders/api.js +1 -1
  12. package/lib/image-builders/aws-image-builder/builder.d.ts +39 -0
  13. package/lib/image-builders/aws-image-builder/builder.js +70 -8
  14. package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
  15. package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
  16. package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  17. package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  18. package/lib/image-builders/codebuild-deprecated.js +1 -1
  19. package/lib/image-builders/codebuild.d.ts +1 -1
  20. package/lib/image-builders/codebuild.js +25 -3
  21. package/lib/image-builders/components.js +1 -1
  22. package/lib/image-builders/static.js +1 -1
  23. package/lib/providers/codebuild.js +2 -2
  24. package/lib/providers/common.js +3 -3
  25. package/lib/providers/ec2.js +2 -2
  26. package/lib/providers/ecs.js +1 -1
  27. package/lib/providers/fargate.js +2 -2
  28. package/lib/providers/lambda.js +2 -2
  29. package/lib/runner.js +1 -1
  30. package/lib/secrets.js +1 -1
  31. package/package.json +19 -19
package/.jsii CHANGED
@@ -3556,7 +3556,7 @@
3556
3556
  "stability": "experimental"
3557
3557
  },
3558
3558
  "homepage": "https://github.com/CloudSnorkel/cdk-github-runners.git",
3559
- "jsiiVersion": "5.3.2 (build 6cb444d)",
3559
+ "jsiiVersion": "5.3.30 (build 94b2281)",
3560
3560
  "keywords": [
3561
3561
  "aws",
3562
3562
  "aws-cdk",
@@ -4539,6 +4539,25 @@
4539
4539
  },
4540
4540
  "name": "AwsImageBuilderRunnerImageBuilderProps",
4541
4541
  "properties": [
4542
+ {
4543
+ "abstract": true,
4544
+ "docs": {
4545
+ "default": "disabled",
4546
+ "remarks": "This is only supported for Windows AMIs.",
4547
+ "stability": "experimental",
4548
+ "summary": "Options for fast launch."
4549
+ },
4550
+ "immutable": true,
4551
+ "locationInModule": {
4552
+ "filename": "src/image-builders/aws-image-builder/builder.ts",
4553
+ "line": 46
4554
+ },
4555
+ "name": "fastLaunchOptions",
4556
+ "optional": true,
4557
+ "type": {
4558
+ "fqn": "@cloudsnorkel/cdk-github-runners.FastLaunchOptions"
4559
+ }
4560
+ },
4542
4561
  {
4543
4562
  "abstract": true,
4544
4563
  "docs": {
@@ -5149,7 +5168,7 @@
5149
5168
  {
5150
5169
  "abstract": true,
5151
5170
  "docs": {
5152
- "default": "Ubuntu 22.04 for x64 and Amazon Linux 2 for ARM64",
5171
+ "default": "Amazon Linux 2023",
5153
5172
  "remarks": "This is the image that's going to run the code that builds the runner image.\n\nThe only action taken in CodeBuild is running `docker build`. You would therefore not need to change this setting often.",
5154
5173
  "stability": "experimental",
5155
5174
  "summary": "Build image to use in CodeBuild."
@@ -8540,6 +8559,83 @@
8540
8559
  ],
8541
8560
  "symbolId": "src/providers/fargate:FargateRunnerProviderProps"
8542
8561
  },
8562
+ "@cloudsnorkel/cdk-github-runners.FastLaunchOptions": {
8563
+ "assembly": "@cloudsnorkel/cdk-github-runners",
8564
+ "datatype": true,
8565
+ "docs": {
8566
+ "stability": "experimental",
8567
+ "summary": "Options for fast launch."
8568
+ },
8569
+ "fqn": "@cloudsnorkel/cdk-github-runners.FastLaunchOptions",
8570
+ "kind": "interface",
8571
+ "locationInModule": {
8572
+ "filename": "src/image-builders/aws-image-builder/builder.ts",
8573
+ "line": 52
8574
+ },
8575
+ "name": "FastLaunchOptions",
8576
+ "properties": [
8577
+ {
8578
+ "abstract": true,
8579
+ "docs": {
8580
+ "custom": {
8581
+ "note": "enabling fast launch on an existing builder will not enable it for existing AMIs. It will only affect new AMIs. If you want immediate effect, trigger a new image build. Alternatively, you can create a new builder with fast launch enabled and use it for new AMIs."
8582
+ },
8583
+ "default": "false",
8584
+ "remarks": "It creates a snapshot of the root volume and uses it to launch new instances faster.\n\nThis is only supported for Windows AMIs.",
8585
+ "stability": "experimental",
8586
+ "summary": "Enable fast launch for AMIs generated by this builder."
8587
+ },
8588
+ "immutable": true,
8589
+ "locationInModule": {
8590
+ "filename": "src/image-builders/aws-image-builder/builder.ts",
8591
+ "line": 63
8592
+ },
8593
+ "name": "enabled",
8594
+ "optional": true,
8595
+ "type": {
8596
+ "primitive": "boolean"
8597
+ }
8598
+ },
8599
+ {
8600
+ "abstract": true,
8601
+ "docs": {
8602
+ "default": "6",
8603
+ "remarks": "Must be at least 6.",
8604
+ "stability": "experimental",
8605
+ "summary": "The maximum number of parallel instances that are launched for creating resources."
8606
+ },
8607
+ "immutable": true,
8608
+ "locationInModule": {
8609
+ "filename": "src/image-builders/aws-image-builder/builder.ts",
8610
+ "line": 72
8611
+ },
8612
+ "name": "maxParallelLaunches",
8613
+ "optional": true,
8614
+ "type": {
8615
+ "primitive": "number"
8616
+ }
8617
+ },
8618
+ {
8619
+ "abstract": true,
8620
+ "docs": {
8621
+ "default": "1",
8622
+ "stability": "experimental",
8623
+ "summary": "The number of pre-provisioned snapshots to keep on hand for a fast-launch enabled Windows AMI."
8624
+ },
8625
+ "immutable": true,
8626
+ "locationInModule": {
8627
+ "filename": "src/image-builders/aws-image-builder/builder.ts",
8628
+ "line": 79
8629
+ },
8630
+ "name": "targetResourceCount",
8631
+ "optional": true,
8632
+ "type": {
8633
+ "primitive": "number"
8634
+ }
8635
+ }
8636
+ ],
8637
+ "symbolId": "src/image-builders/aws-image-builder/builder:FastLaunchOptions"
8638
+ },
8543
8639
  "@cloudsnorkel/cdk-github-runners.GitHubRunners": {
8544
8640
  "assembly": "@cloudsnorkel/cdk-github-runners",
8545
8641
  "base": "constructs.Construct",
@@ -9664,7 +9760,7 @@
9664
9760
  "kind": "interface",
9665
9761
  "locationInModule": {
9666
9762
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9667
- "line": 43
9763
+ "line": 85
9668
9764
  },
9669
9765
  "name": "ImageBuilderAsset",
9670
9766
  "properties": [
@@ -9677,7 +9773,7 @@
9677
9773
  "immutable": true,
9678
9774
  "locationInModule": {
9679
9775
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9680
- "line": 52
9776
+ "line": 94
9681
9777
  },
9682
9778
  "name": "asset",
9683
9779
  "type": {
@@ -9693,7 +9789,7 @@
9693
9789
  "immutable": true,
9694
9790
  "locationInModule": {
9695
9791
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9696
- "line": 47
9792
+ "line": 89
9697
9793
  },
9698
9794
  "name": "path",
9699
9795
  "type": {
@@ -9719,7 +9815,7 @@
9719
9815
  },
9720
9816
  "locationInModule": {
9721
9817
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9722
- "line": 126
9818
+ "line": 168
9723
9819
  },
9724
9820
  "parameters": [
9725
9821
  {
@@ -9745,7 +9841,7 @@
9745
9841
  "kind": "class",
9746
9842
  "locationInModule": {
9747
9843
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9748
- "line": 113
9844
+ "line": 155
9749
9845
  },
9750
9846
  "methods": [
9751
9847
  {
@@ -9791,7 +9887,7 @@
9791
9887
  },
9792
9888
  "locationInModule": {
9793
9889
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9794
- "line": 228
9890
+ "line": 270
9795
9891
  },
9796
9892
  "name": "grantAssetsRead",
9797
9893
  "parameters": [
@@ -9809,7 +9905,7 @@
9809
9905
  },
9810
9906
  "locationInModule": {
9811
9907
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9812
- "line": 234
9908
+ "line": 276
9813
9909
  },
9814
9910
  "name": "prefixCommandsWithErrorHandling",
9815
9911
  "parameters": [
@@ -9853,7 +9949,7 @@
9853
9949
  "immutable": true,
9854
9950
  "locationInModule": {
9855
9951
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9856
- "line": 117
9952
+ "line": 159
9857
9953
  },
9858
9954
  "name": "arn",
9859
9955
  "type": {
@@ -9868,7 +9964,7 @@
9868
9964
  "immutable": true,
9869
9965
  "locationInModule": {
9870
9966
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9871
- "line": 122
9967
+ "line": 164
9872
9968
  },
9873
9969
  "name": "platform",
9874
9970
  "type": {
@@ -9889,7 +9985,7 @@
9889
9985
  "kind": "interface",
9890
9986
  "locationInModule": {
9891
9987
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9892
- "line": 58
9988
+ "line": 100
9893
9989
  },
9894
9990
  "name": "ImageBuilderComponentProperties",
9895
9991
  "properties": [
@@ -9903,7 +9999,7 @@
9903
9999
  "immutable": true,
9904
10000
  "locationInModule": {
9905
10001
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9906
- "line": 79
10002
+ "line": 121
9907
10003
  },
9908
10004
  "name": "commands",
9909
10005
  "type": {
@@ -9924,7 +10020,7 @@
9924
10020
  "immutable": true,
9925
10021
  "locationInModule": {
9926
10022
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9927
- "line": 72
10023
+ "line": 114
9928
10024
  },
9929
10025
  "name": "description",
9930
10026
  "type": {
@@ -9940,7 +10036,7 @@
9940
10036
  "immutable": true,
9941
10037
  "locationInModule": {
9942
10038
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9943
- "line": 67
10039
+ "line": 109
9944
10040
  },
9945
10041
  "name": "displayName",
9946
10042
  "type": {
@@ -9957,7 +10053,7 @@
9957
10053
  "immutable": true,
9958
10054
  "locationInModule": {
9959
10055
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9960
- "line": 62
10056
+ "line": 104
9961
10057
  },
9962
10058
  "name": "platform",
9963
10059
  "type": {
@@ -9973,7 +10069,7 @@
9973
10069
  "immutable": true,
9974
10070
  "locationInModule": {
9975
10071
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9976
- "line": 84
10072
+ "line": 126
9977
10073
  },
9978
10074
  "name": "assets",
9979
10075
  "optional": true,
@@ -9996,7 +10092,7 @@
9996
10092
  "immutable": true,
9997
10093
  "locationInModule": {
9998
10094
  "filename": "src/image-builders/aws-image-builder/builder.ts",
9999
- "line": 91
10095
+ "line": 133
10000
10096
  },
10001
10097
  "name": "reboot",
10002
10098
  "optional": true,
@@ -13603,6 +13699,6 @@
13603
13699
  "symbolId": "src/image-builders/aws-image-builder/deprecated/windows-components:WindowsComponents"
13604
13700
  }
13605
13701
  },
13606
- "version": "0.12.2",
13607
- "fingerprint": "502qTOcrp7WkMrQIn4BX5KL5qRt8n3gnUomQVOfIHZU="
13702
+ "version": "0.12.4",
13703
+ "fingerprint": "69HizPxkz7NpAmcNSxp+KX9fAJDLW6cxtGoJG45fW9s="
13608
13704
  }
package/API.md CHANGED
@@ -5118,10 +5118,26 @@ const awsImageBuilderRunnerImageBuilderProps: AwsImageBuilderRunnerImageBuilderP
5118
5118
 
5119
5119
  | **Name** | **Type** | **Description** |
5120
5120
  | --- | --- | --- |
5121
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.fastLaunchOptions">fastLaunchOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.FastLaunchOptions">FastLaunchOptions</a></code> | Options for fast launch. |
5121
5122
  | <code><a href="#@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.instanceType">instanceType</a></code> | <code>aws-cdk-lib.aws_ec2.InstanceType</code> | The instance type used to build the image. |
5122
5123
 
5123
5124
  ---
5124
5125
 
5126
+ ##### `fastLaunchOptions`<sup>Optional</sup> <a name="fastLaunchOptions" id="@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.fastLaunchOptions"></a>
5127
+
5128
+ ```typescript
5129
+ public readonly fastLaunchOptions: FastLaunchOptions;
5130
+ ```
5131
+
5132
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.FastLaunchOptions">FastLaunchOptions</a>
5133
+ - *Default:* disabled
5134
+
5135
+ Options for fast launch.
5136
+
5137
+ This is only supported for Windows AMIs.
5138
+
5139
+ ---
5140
+
5125
5141
  ##### `instanceType`<sup>Optional</sup> <a name="instanceType" id="@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.instanceType"></a>
5126
5142
 
5127
5143
  ```typescript
@@ -5385,7 +5401,7 @@ public readonly buildImage: IBuildImage;
5385
5401
  ```
5386
5402
 
5387
5403
  - *Type:* aws-cdk-lib.aws_codebuild.IBuildImage
5388
- - *Default:* Ubuntu 22.04 for x64 and Amazon Linux 2 for ARM64
5404
+ - *Default:* Amazon Linux 2023
5389
5405
 
5390
5406
  Build image to use in CodeBuild.
5391
5407
 
@@ -6674,6 +6690,73 @@ VPC to launch the runners in.
6674
6690
 
6675
6691
  ---
6676
6692
 
6693
+ ### FastLaunchOptions <a name="FastLaunchOptions" id="@cloudsnorkel/cdk-github-runners.FastLaunchOptions"></a>
6694
+
6695
+ Options for fast launch.
6696
+
6697
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.FastLaunchOptions.Initializer"></a>
6698
+
6699
+ ```typescript
6700
+ import { FastLaunchOptions } from '@cloudsnorkel/cdk-github-runners'
6701
+
6702
+ const fastLaunchOptions: FastLaunchOptions = { ... }
6703
+ ```
6704
+
6705
+ #### Properties <a name="Properties" id="Properties"></a>
6706
+
6707
+ | **Name** | **Type** | **Description** |
6708
+ | --- | --- | --- |
6709
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FastLaunchOptions.property.enabled">enabled</a></code> | <code>boolean</code> | Enable fast launch for AMIs generated by this builder. |
6710
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FastLaunchOptions.property.maxParallelLaunches">maxParallelLaunches</a></code> | <code>number</code> | The maximum number of parallel instances that are launched for creating resources. |
6711
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FastLaunchOptions.property.targetResourceCount">targetResourceCount</a></code> | <code>number</code> | The number of pre-provisioned snapshots to keep on hand for a fast-launch enabled Windows AMI. |
6712
+
6713
+ ---
6714
+
6715
+ ##### `enabled`<sup>Optional</sup> <a name="enabled" id="@cloudsnorkel/cdk-github-runners.FastLaunchOptions.property.enabled"></a>
6716
+
6717
+ ```typescript
6718
+ public readonly enabled: boolean;
6719
+ ```
6720
+
6721
+ - *Type:* boolean
6722
+ - *Default:* false
6723
+
6724
+ Enable fast launch for AMIs generated by this builder.
6725
+
6726
+ It creates a snapshot of the root volume and uses it to launch new instances faster.
6727
+
6728
+ This is only supported for Windows AMIs.
6729
+
6730
+ ---
6731
+
6732
+ ##### `maxParallelLaunches`<sup>Optional</sup> <a name="maxParallelLaunches" id="@cloudsnorkel/cdk-github-runners.FastLaunchOptions.property.maxParallelLaunches"></a>
6733
+
6734
+ ```typescript
6735
+ public readonly maxParallelLaunches: number;
6736
+ ```
6737
+
6738
+ - *Type:* number
6739
+ - *Default:* 6
6740
+
6741
+ The maximum number of parallel instances that are launched for creating resources.
6742
+
6743
+ Must be at least 6.
6744
+
6745
+ ---
6746
+
6747
+ ##### `targetResourceCount`<sup>Optional</sup> <a name="targetResourceCount" id="@cloudsnorkel/cdk-github-runners.FastLaunchOptions.property.targetResourceCount"></a>
6748
+
6749
+ ```typescript
6750
+ public readonly targetResourceCount: number;
6751
+ ```
6752
+
6753
+ - *Type:* number
6754
+ - *Default:* 1
6755
+
6756
+ The number of pre-provisioned snapshots to keep on hand for a fast-launch enabled Windows AMI.
6757
+
6758
+ ---
6759
+
6677
6760
  ### GitHubRunnersProps <a name="GitHubRunnersProps" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps"></a>
6678
6761
 
6679
6762
  Properties for GitHubRunners.
@@ -5755,8 +5755,11 @@ var require_re = __commonJS({
5755
5755
  createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
5756
5756
  createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
5757
5757
  createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
5758
- createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
5758
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
5759
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
5760
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
5759
5761
  createToken("COERCERTL", src[t.COERCE], true);
5762
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
5760
5763
  createToken("LONETILDE", "(?:~>?)");
5761
5764
  createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
5762
5765
  exports2.tildeTrimReplace = "$1~";
@@ -6417,21 +6420,27 @@ var require_coerce = __commonJS({
6417
6420
  options = options || {};
6418
6421
  let match = null;
6419
6422
  if (!options.rtl) {
6420
- match = version.match(re[t.COERCE]);
6423
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
6421
6424
  } else {
6425
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
6422
6426
  let next;
6423
- while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
6427
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
6424
6428
  if (!match || next.index + next[0].length !== match.index + match[0].length) {
6425
6429
  match = next;
6426
6430
  }
6427
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
6431
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
6428
6432
  }
6429
- re[t.COERCERTL].lastIndex = -1;
6433
+ coerceRtlRegex.lastIndex = -1;
6430
6434
  }
6431
6435
  if (match === null) {
6432
6436
  return null;
6433
6437
  }
6434
- return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
6438
+ const major = match[2];
6439
+ const minor = match[3] || "0";
6440
+ const patch = match[4] || "0";
6441
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
6442
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
6443
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
6435
6444
  };
6436
6445
  module2.exports = coerce;
6437
6446
  }
@@ -5755,8 +5755,11 @@ var require_re = __commonJS({
5755
5755
  createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
5756
5756
  createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
5757
5757
  createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
5758
- createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
5758
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
5759
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
5760
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
5759
5761
  createToken("COERCERTL", src[t.COERCE], true);
5762
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
5760
5763
  createToken("LONETILDE", "(?:~>?)");
5761
5764
  createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
5762
5765
  exports2.tildeTrimReplace = "$1~";
@@ -6417,21 +6420,27 @@ var require_coerce = __commonJS({
6417
6420
  options = options || {};
6418
6421
  let match = null;
6419
6422
  if (!options.rtl) {
6420
- match = version.match(re[t.COERCE]);
6423
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
6421
6424
  } else {
6425
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
6422
6426
  let next;
6423
- while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
6427
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
6424
6428
  if (!match || next.index + next[0].length !== match.index + match[0].length) {
6425
6429
  match = next;
6426
6430
  }
6427
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
6431
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
6428
6432
  }
6429
- re[t.COERCERTL].lastIndex = -1;
6433
+ coerceRtlRegex.lastIndex = -1;
6430
6434
  }
6431
6435
  if (match === null) {
6432
6436
  return null;
6433
6437
  }
6434
- return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
6438
+ const major = match[2];
6439
+ const minor = match[3] || "0";
6440
+ const patch = match[4] || "0";
6441
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
6442
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
6443
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
6435
6444
  };
6436
6445
  module2.exports = coerce;
6437
6446
  }
@@ -131,8 +131,11 @@ var require_re = __commonJS({
131
131
  createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
132
132
  createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
133
133
  createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
134
- createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
134
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
135
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
136
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
135
137
  createToken("COERCERTL", src[t.COERCE], true);
138
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
136
139
  createToken("LONETILDE", "(?:~>?)");
137
140
  createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
138
141
  exports2.tildeTrimReplace = "$1~";
@@ -793,21 +796,27 @@ var require_coerce = __commonJS({
793
796
  options = options || {};
794
797
  let match = null;
795
798
  if (!options.rtl) {
796
- match = version.match(re[t.COERCE]);
799
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
797
800
  } else {
801
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
798
802
  let next;
799
- while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
803
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
800
804
  if (!match || next.index + next[0].length !== match.index + match[0].length) {
801
805
  match = next;
802
806
  }
803
- re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
807
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
804
808
  }
805
- re[t.COERCERTL].lastIndex = -1;
809
+ coerceRtlRegex.lastIndex = -1;
806
810
  }
807
811
  if (match === null) {
808
812
  return null;
809
813
  }
810
- return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
814
+ const major = match[2];
815
+ const minor = match[3] || "0";
816
+ const patch = match[4] || "0";
817
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
818
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
819
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
811
820
  };
812
821
  module2.exports = coerce;
813
822
  }