@forsakringskassan/vite-lib-config 4.3.7 → 4.5.0

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.
@@ -3,6 +3,8 @@
3
3
  const { run } = require("../dist/api-extractor");
4
4
 
5
5
  const argv = process.argv.slice(2);
6
+
7
+ /* eslint-disable-next-line unicorn/prefer-top-level-await -- technical debt, this still runs as commonjs */
6
8
  run(argv).catch((err) => {
7
9
  console.error(err);
8
10
  process.exitCode = 1;
@@ -3,6 +3,8 @@
3
3
  import { cli } from "../dist/cli.mjs";
4
4
 
5
5
  const argv = process.argv.slice(2);
6
+
7
+ /* eslint-disable-next-line unicorn/prefer-top-level-await -- technical debt, this still runs as commonjs */
6
8
  cli(argv).catch((err) => {
7
9
  console.error(err);
8
10
  process.exitCode = 1;
@@ -39,6 +39,11 @@ var require_vendors = __commonJS({
39
39
  env: "AGOLA_GIT_REF",
40
40
  pr: "AGOLA_PULL_REQUEST_ID"
41
41
  },
42
+ {
43
+ name: "Alpic",
44
+ constant: "ALPIC",
45
+ env: "ALPIC_HOST"
46
+ },
42
47
  {
43
48
  name: "Appcircle",
44
49
  constant: "APPCIRCLE",
@@ -119,6 +124,16 @@ var require_vendors = __commonJS({
119
124
  env: "CIRRUS_CI",
120
125
  pr: "CIRRUS_PR"
121
126
  },
127
+ {
128
+ name: "Cloudflare Pages",
129
+ constant: "CLOUDFLARE_PAGES",
130
+ env: "CF_PAGES"
131
+ },
132
+ {
133
+ name: "Cloudflare Workers",
134
+ constant: "CLOUDFLARE_WORKERS",
135
+ env: "WORKERS_CI"
136
+ },
122
137
  {
123
138
  name: "Codefresh",
124
139
  constant: "CODEFRESH",
@@ -397,23 +412,25 @@ var require_ci_info = __commonJS({
397
412
  exports2.name = null;
398
413
  exports2.isPR = null;
399
414
  exports2.id = null;
400
- vendors.forEach(function(vendor) {
401
- const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
402
- const isCI2 = envs.every(function(obj) {
403
- return checkEnv(obj);
415
+ if (env.CI !== "false") {
416
+ vendors.forEach(function(vendor) {
417
+ const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
418
+ const isCI2 = envs.every(function(obj) {
419
+ return checkEnv(obj);
420
+ });
421
+ exports2[vendor.constant] = isCI2;
422
+ if (!isCI2) {
423
+ return;
424
+ }
425
+ exports2.name = vendor.name;
426
+ exports2.isPR = checkPR(vendor);
427
+ exports2.id = vendor.constant;
404
428
  });
405
- exports2[vendor.constant] = isCI2;
406
- if (!isCI2) {
407
- return;
408
- }
409
- exports2.name = vendor.name;
410
- exports2.isPR = checkPR(vendor);
411
- exports2.id = vendor.constant;
412
- });
429
+ }
413
430
  exports2.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
414
431
  (env.BUILD_ID || // Jenkins, Cloudbees
415
432
  env.BUILD_NUMBER || // Jenkins, TeamCity
416
- env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
433
+ env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
417
434
  env.CI_APP_ID || // Appflow
418
435
  env.CI_BUILD_ID || // Appflow
419
436
  env.CI_BUILD_NUMBER || // Appflow
@@ -2453,8 +2470,17 @@ var Queue = class {
2453
2470
  }
2454
2471
  this.#head = this.#head.next;
2455
2472
  this.#size--;
2473
+ if (!this.#head) {
2474
+ this.#tail = void 0;
2475
+ }
2456
2476
  return current.value;
2457
2477
  }
2478
+ peek() {
2479
+ if (!this.#head) {
2480
+ return;
2481
+ }
2482
+ return this.#head.value;
2483
+ }
2458
2484
  clear() {
2459
2485
  this.#head = void 0;
2460
2486
  this.#tail = void 0;
@@ -2470,6 +2496,11 @@ var Queue = class {
2470
2496
  current = current.next;
2471
2497
  }
2472
2498
  }
2499
+ *drain() {
2500
+ while (this.#head) {
2501
+ yield this.dequeue();
2502
+ }
2503
+ }
2473
2504
  };
2474
2505
 
2475
2506
  // node_modules/p-locate/node_modules/p-limit/index.js
@@ -5756,7 +5787,7 @@ function extractAugmentations(content) {
5756
5787
  return Array.from(matches).map((it2) => {
5757
5788
  const [withDeclaration, name = "", withoutDeclaration] = it2;
5758
5789
  if (name.startsWith(".")) {
5759
- const exported = withoutDeclaration.replace(
5790
+ const exported = withoutDeclaration.replaceAll(
5760
5791
  /^(\s*)interface/g,
5761
5792
  "$1export interface"
5762
5793
  );
@@ -5770,7 +5801,7 @@ function extractAugmentations(content) {
5770
5801
  // src/api-extractor.ts
5771
5802
  async function getConfigFiles(configFiles) {
5772
5803
  if (configFiles.length > 0) {
5773
- return configFiles.map((it2) => ts(it2)).flat();
5804
+ return configFiles.flatMap((it2) => ts(it2));
5774
5805
  } else {
5775
5806
  const result = await findUp("api-extractor.json");
5776
5807
  return result ? [result] : [];
@@ -5781,7 +5812,7 @@ async function findReferencedFiles(filename, visited) {
5781
5812
  return;
5782
5813
  }
5783
5814
  visited.add(filename);
5784
- const content = await import_promises2.default.readFile(filename, "utf-8");
5815
+ const content = await import_promises2.default.readFile(filename, "utf8");
5785
5816
  const matches = content.matchAll(/^(?:import|export)[^"]*"([^"]+)";?$/gm);
5786
5817
  for (const match of Array.from(matches)) {
5787
5818
  const modname = match[1];
@@ -5810,13 +5841,13 @@ async function patchAugmentations(config) {
5810
5841
  return;
5811
5842
  }
5812
5843
  async function extract(filename) {
5813
- const content = await import_promises2.default.readFile(filename, "utf-8");
5844
+ const content = await import_promises2.default.readFile(filename, "utf8");
5814
5845
  return extractAugmentations(content);
5815
5846
  }
5816
5847
  async function patch(filename, augmentations2) {
5817
- const content = await import_promises2.default.readFile(filename, "utf-8");
5848
+ const content = await import_promises2.default.readFile(filename, "utf8");
5818
5849
  const patched = [content, ...augmentations2].join("\n\n");
5819
- await import_promises2.default.writeFile(filename, patched, "utf-8");
5850
+ await import_promises2.default.writeFile(filename, patched, "utf8");
5820
5851
  }
5821
5852
  console.log();
5822
5853
  console.group("Patching module augmentations");
@@ -5848,13 +5879,13 @@ async function patchDeclareVarVls(declarationDir) {
5848
5879
  const filenames = await Ze("**/*.vue.d.ts", { cwd: declarationDir });
5849
5880
  const promises = filenames.map(async (filename) => {
5850
5881
  const filePath = import_node_path4.default.join(declarationDir, filename);
5851
- const content = await import_promises2.default.readFile(filePath, "utf-8");
5882
+ const content = await import_promises2.default.readFile(filePath, "utf8");
5852
5883
  const updated = content.replace(
5853
5884
  /declare var (__VLS_\d+)/,
5854
5885
  "declare const $1"
5855
5886
  );
5856
5887
  if (content !== updated) {
5857
- await import_promises2.default.writeFile(filePath, updated, "utf-8");
5888
+ await import_promises2.default.writeFile(filePath, updated, "utf8");
5858
5889
  numPatchedFiles++;
5859
5890
  console.log(filename);
5860
5891
  }
@@ -5867,9 +5898,9 @@ async function patchDeclareVarVls(declarationDir) {
5867
5898
  );
5868
5899
  }
5869
5900
  async function run(argv) {
5870
- const flags = argv.filter((it2) => it2.startsWith("--"));
5901
+ const flags = new Set(argv.filter((it2) => it2.startsWith("--")));
5871
5902
  const positional = argv.filter((it2) => !it2.startsWith("--"));
5872
- if (flags.includes("--help")) {
5903
+ if (flags.has("--help")) {
5873
5904
  console.log("usage: fk-api-extractor [OPTIONS..] [FILENAME..]");
5874
5905
  console.log(`
5875
5906
  --help Show this help.
@@ -5898,7 +5929,7 @@ only.
5898
5929
  }
5899
5930
  console.groupEnd();
5900
5931
  console.log();
5901
- if (flags.includes("--patch-declare-var-vls")) {
5932
+ if (flags.has("--patch-declare-var-vls")) {
5902
5933
  await patchDeclareVarVls("temp/types");
5903
5934
  }
5904
5935
  for (const filePath of configFiles) {
@@ -5919,7 +5950,7 @@ only.
5919
5950
  );
5920
5951
  process.exitCode = 1;
5921
5952
  }
5922
- if (flags.includes("--patch-augmentations")) {
5953
+ if (flags.has("--patch-augmentations")) {
5923
5954
  await patchAugmentations(config);
5924
5955
  }
5925
5956
  }
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.57.6"
8
+ "packageVersion": "7.57.7"
9
9
  }
10
10
  ]
11
11
  }