@forsakringskassan/vite-lib-config 3.3.0 → 3.4.1

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/README.md CHANGED
@@ -108,3 +108,20 @@ export function setup(options: SetupOptions): void {
108
108
  If the `setup` function is async (i.e. returns a `Promise`) it will be awaited before continuing.
109
109
 
110
110
  Create `src/vite-dev/app.vue` containing the root component you want to serve as a development environment.
111
+
112
+ ### Appending Plugins
113
+
114
+ If you need to use custom plugins in your library, remember to also include the default plugins, these will otherwise by overwritten.
115
+
116
+ #### `vite.config.ts`
117
+
118
+ ```ts
119
+ import {
120
+ defineConfig,
121
+ defaultPlugins,
122
+ } from "@forsakringskassan/vite-lib-config/vite";
123
+
124
+ export default defineConfig({
125
+ plugins: [...defaultPlugins, myFancyPlugin],
126
+ });
127
+ ```
@@ -987,6 +987,17 @@ var require_semver = __commonJS({
987
987
  // preminor will bump the version up to the next minor release, and immediately
988
988
  // down to pre-release. premajor and prepatch work the same way.
989
989
  inc(release, identifier, identifierBase) {
990
+ if (release.startsWith("pre")) {
991
+ if (!identifier && identifierBase === false) {
992
+ throw new Error("invalid increment argument: identifier is empty");
993
+ }
994
+ if (identifier) {
995
+ const match2 = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
996
+ if (!match2 || match2[1] !== identifier) {
997
+ throw new Error(`invalid identifier: ${identifier}`);
998
+ }
999
+ }
1000
+ }
990
1001
  switch (release) {
991
1002
  case "premajor":
992
1003
  this.prerelease.length = 0;
@@ -1014,6 +1025,12 @@ var require_semver = __commonJS({
1014
1025
  }
1015
1026
  this.inc("pre", identifier, identifierBase);
1016
1027
  break;
1028
+ case "release":
1029
+ if (this.prerelease.length === 0) {
1030
+ throw new Error(`version ${this.raw} is not a prerelease`);
1031
+ }
1032
+ this.prerelease.length = 0;
1033
+ break;
1017
1034
  case "major":
1018
1035
  if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
1019
1036
  this.major++;
@@ -1039,9 +1056,6 @@ var require_semver = __commonJS({
1039
1056
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
1040
1057
  case "pre": {
1041
1058
  const base = Number(identifierBase) ? 1 : 0;
1042
- if (!identifier && identifierBase === false) {
1043
- throw new Error("invalid increment argument: identifier is empty");
1044
- }
1045
1059
  if (this.prerelease.length === 0) {
1046
1060
  this.prerelease = [base];
1047
1061
  } else {
@@ -1176,13 +1190,12 @@ var require_diff = __commonJS({
1176
1190
  if (!lowVersion.patch && !lowVersion.minor) {
1177
1191
  return "major";
1178
1192
  }
1179
- if (highVersion.patch) {
1193
+ if (lowVersion.compareMain(highVersion) === 0) {
1194
+ if (lowVersion.minor && !lowVersion.patch) {
1195
+ return "minor";
1196
+ }
1180
1197
  return "patch";
1181
1198
  }
1182
- if (highVersion.minor) {
1183
- return "minor";
1184
- }
1185
- return "major";
1186
1199
  }
1187
1200
  const prefix = highHasPre ? "pre" : "";
1188
1201
  if (v1.major !== v2.major) {
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.49.1"
8
+ "packageVersion": "7.49.2"
9
9
  }
10
10
  ]
11
11
  }
@@ -3339,6 +3339,17 @@ var require_semver = __commonJS({
3339
3339
  // preminor will bump the version up to the next minor release, and immediately
3340
3340
  // down to pre-release. premajor and prepatch work the same way.
3341
3341
  inc(release, identifier, identifierBase) {
3342
+ if (release.startsWith("pre")) {
3343
+ if (!identifier && identifierBase === false) {
3344
+ throw new Error("invalid increment argument: identifier is empty");
3345
+ }
3346
+ if (identifier) {
3347
+ const match2 = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
3348
+ if (!match2 || match2[1] !== identifier) {
3349
+ throw new Error(`invalid identifier: ${identifier}`);
3350
+ }
3351
+ }
3352
+ }
3342
3353
  switch (release) {
3343
3354
  case "premajor":
3344
3355
  this.prerelease.length = 0;
@@ -3366,6 +3377,12 @@ var require_semver = __commonJS({
3366
3377
  }
3367
3378
  this.inc("pre", identifier, identifierBase);
3368
3379
  break;
3380
+ case "release":
3381
+ if (this.prerelease.length === 0) {
3382
+ throw new Error(`version ${this.raw} is not a prerelease`);
3383
+ }
3384
+ this.prerelease.length = 0;
3385
+ break;
3369
3386
  case "major":
3370
3387
  if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
3371
3388
  this.major++;
@@ -3391,9 +3408,6 @@ var require_semver = __commonJS({
3391
3408
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
3392
3409
  case "pre": {
3393
3410
  const base = Number(identifierBase) ? 1 : 0;
3394
- if (!identifier && identifierBase === false) {
3395
- throw new Error("invalid increment argument: identifier is empty");
3396
- }
3397
3411
  if (this.prerelease.length === 0) {
3398
3412
  this.prerelease = [base];
3399
3413
  } else {
@@ -3528,13 +3542,12 @@ var require_diff = __commonJS({
3528
3542
  if (!lowVersion.patch && !lowVersion.minor) {
3529
3543
  return "major";
3530
3544
  }
3531
- if (highVersion.patch) {
3545
+ if (lowVersion.compareMain(highVersion) === 0) {
3546
+ if (lowVersion.minor && !lowVersion.patch) {
3547
+ return "minor";
3548
+ }
3532
3549
  return "patch";
3533
3550
  }
3534
- if (highVersion.minor) {
3535
- return "minor";
3536
- }
3537
- return "major";
3538
3551
  }
3539
3552
  const prefix = highHasPre ? "pre" : "";
3540
3553
  if (v1.major !== v2.major) {
@@ -4882,6 +4895,7 @@ var require_semver2 = __commonJS({
4882
4895
  var vite_config_exports = {};
4883
4896
  __export(vite_config_exports, {
4884
4897
  apimockPlugin: () => import_apimock_express2.vitePlugin,
4898
+ defaultPlugins: () => defaultPlugins,
4885
4899
  defineConfig: () => defineConfig,
4886
4900
  vuePlugin: () => vuePlugin
4887
4901
  });
@@ -4960,9 +4974,7 @@ function lookupFile(nameWithoutExtension) {
4960
4974
  return fileName;
4961
4975
  }
4962
4976
  }
4963
- throw new Error(
4964
- `Entry is missing. ${nameWithoutExtension}.{${extensions.join(",")}}`
4965
- );
4977
+ return `${nameWithoutExtension}.ts`;
4966
4978
  }
4967
4979
 
4968
4980
  // src/plugins/index-html-plugin.ts
@@ -11648,6 +11660,7 @@ function defineConfig(config) {
11648
11660
  // Annotate the CommonJS export names for ESM import in node:
11649
11661
  0 && (module.exports = {
11650
11662
  apimockPlugin,
11663
+ defaultPlugins,
11651
11664
  defineConfig,
11652
11665
  vuePlugin
11653
11666
  });
@@ -5,6 +5,11 @@ import { UserConfig as UserConfig_2 } from 'vite';
5
5
 
6
6
  export { apimockPlugin }
7
7
 
8
+ /**
9
+ * @public
10
+ */
11
+ export declare const defaultPlugins: Plugin_2<any>[];
12
+
8
13
  /**
9
14
  * @public
10
15
  */
@@ -852,6 +852,17 @@ var require_semver = __commonJS({
852
852
  // preminor will bump the version up to the next minor release, and immediately
853
853
  // down to pre-release. premajor and prepatch work the same way.
854
854
  inc(release, identifier, identifierBase) {
855
+ if (release.startsWith("pre")) {
856
+ if (!identifier && identifierBase === false) {
857
+ throw new Error("invalid increment argument: identifier is empty");
858
+ }
859
+ if (identifier) {
860
+ const match2 = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
861
+ if (!match2 || match2[1] !== identifier) {
862
+ throw new Error(`invalid identifier: ${identifier}`);
863
+ }
864
+ }
865
+ }
855
866
  switch (release) {
856
867
  case "premajor":
857
868
  this.prerelease.length = 0;
@@ -879,6 +890,12 @@ var require_semver = __commonJS({
879
890
  }
880
891
  this.inc("pre", identifier, identifierBase);
881
892
  break;
893
+ case "release":
894
+ if (this.prerelease.length === 0) {
895
+ throw new Error(`version ${this.raw} is not a prerelease`);
896
+ }
897
+ this.prerelease.length = 0;
898
+ break;
882
899
  case "major":
883
900
  if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
884
901
  this.major++;
@@ -904,9 +921,6 @@ var require_semver = __commonJS({
904
921
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
905
922
  case "pre": {
906
923
  const base = Number(identifierBase) ? 1 : 0;
907
- if (!identifier && identifierBase === false) {
908
- throw new Error("invalid increment argument: identifier is empty");
909
- }
910
924
  if (this.prerelease.length === 0) {
911
925
  this.prerelease = [base];
912
926
  } else {
@@ -1041,13 +1055,12 @@ var require_diff = __commonJS({
1041
1055
  if (!lowVersion.patch && !lowVersion.minor) {
1042
1056
  return "major";
1043
1057
  }
1044
- if (highVersion.patch) {
1058
+ if (lowVersion.compareMain(highVersion) === 0) {
1059
+ if (lowVersion.minor && !lowVersion.patch) {
1060
+ return "minor";
1061
+ }
1045
1062
  return "patch";
1046
1063
  }
1047
- if (highVersion.minor) {
1048
- return "minor";
1049
- }
1050
- return "major";
1051
1064
  }
1052
1065
  const prefix = highHasPre ? "pre" : "";
1053
1066
  if (v1.major !== v2.major) {
@@ -4938,9 +4951,7 @@ function lookupFile(nameWithoutExtension) {
4938
4951
  return fileName;
4939
4952
  }
4940
4953
  }
4941
- throw new Error(
4942
- `Entry is missing. ${nameWithoutExtension}.{${extensions.join(",")}}`
4943
- );
4954
+ return `${nameWithoutExtension}.ts`;
4944
4955
  }
4945
4956
 
4946
4957
  // src/plugins/index-html-plugin.ts
@@ -11627,6 +11638,7 @@ function defineConfig(config) {
11627
11638
  }
11628
11639
  export {
11629
11640
  vitePlugin as apimockPlugin,
11641
+ defaultPlugins,
11630
11642
  defineConfig,
11631
11643
  vuePlugin2 as vuePlugin
11632
11644
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vite-lib-config",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "Försäkringskassan toolchain to build libraries with Vite",
5
5
  "keywords": [
6
6
  "vite"
@@ -42,7 +42,7 @@
42
42
  "dist"
43
43
  ],
44
44
  "dependencies": {
45
- "@microsoft/api-extractor": "7.49.1",
45
+ "@microsoft/api-extractor": "7.49.2",
46
46
  "@vue/babel-preset-app": "5.0.8"
47
47
  },
48
48
  "peerDependencies": {