@k8slens/package-build 3.3.0 → 3.4.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.
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { extensionPublishCheck } = require("../dist");
4
+
5
+ process.exitCode = extensionPublishCheck();
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { globImportPlugin } from "./src/glob-import-plugin";
3
3
  export { packageBuild } from "./src/package-build";
4
4
  export { stylesheetPlugin, type StylesheetPluginParams } from "./src/stylesheet-plugin";
5
5
  export { extensionDependenciesCheck } from "./src/extension-dependencies-check";
6
+ export { extensionPublishCheck } from "./src/extension-publish-check";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -1360,11 +1360,11 @@ var require_lodash = __commonJS({
1360
1360
  return isFunction(object[key]);
1361
1361
  });
1362
1362
  }
1363
- function baseGet(object, path5) {
1364
- path5 = castPath(path5, object);
1365
- var index = 0, length = path5.length;
1363
+ function baseGet(object, path6) {
1364
+ path6 = castPath(path6, object);
1365
+ var index = 0, length = path6.length;
1366
1366
  while (object != null && index < length) {
1367
- object = object[toKey(path5[index++])];
1367
+ object = object[toKey(path6[index++])];
1368
1368
  }
1369
1369
  return index && index == length ? object : undefined2;
1370
1370
  }
@@ -1428,10 +1428,10 @@ var require_lodash = __commonJS({
1428
1428
  });
1429
1429
  return accumulator;
1430
1430
  }
1431
- function baseInvoke(object, path5, args) {
1432
- path5 = castPath(path5, object);
1433
- object = parent(object, path5);
1434
- var func = object == null ? object : object[toKey(last(path5))];
1431
+ function baseInvoke(object, path6, args) {
1432
+ path6 = castPath(path6, object);
1433
+ object = parent(object, path6);
1434
+ var func = object == null ? object : object[toKey(last(path6))];
1435
1435
  return func == null ? undefined2 : apply(func, object, args);
1436
1436
  }
1437
1437
  function baseIsArguments(value) {
@@ -1587,13 +1587,13 @@ var require_lodash = __commonJS({
1587
1587
  return object === source || baseIsMatch(object, source, matchData);
1588
1588
  };
1589
1589
  }
1590
- function baseMatchesProperty(path5, srcValue) {
1591
- if (isKey(path5) && isStrictComparable(srcValue)) {
1592
- return matchesStrictComparable(toKey(path5), srcValue);
1590
+ function baseMatchesProperty(path6, srcValue) {
1591
+ if (isKey(path6) && isStrictComparable(srcValue)) {
1592
+ return matchesStrictComparable(toKey(path6), srcValue);
1593
1593
  }
1594
1594
  return function(object) {
1595
- var objValue = get(object, path5);
1596
- return objValue === undefined2 && objValue === srcValue ? hasIn(object, path5) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1595
+ var objValue = get(object, path6);
1596
+ return objValue === undefined2 && objValue === srcValue ? hasIn(object, path6) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1597
1597
  };
1598
1598
  }
1599
1599
  function baseMerge(object, source, srcIndex, customizer, stack) {
@@ -1690,23 +1690,23 @@ var require_lodash = __commonJS({
1690
1690
  });
1691
1691
  }
1692
1692
  function basePick(object, paths) {
1693
- return basePickBy(object, paths, function(value, path5) {
1694
- return hasIn(object, path5);
1693
+ return basePickBy(object, paths, function(value, path6) {
1694
+ return hasIn(object, path6);
1695
1695
  });
1696
1696
  }
1697
1697
  function basePickBy(object, paths, predicate) {
1698
1698
  var index = -1, length = paths.length, result2 = {};
1699
1699
  while (++index < length) {
1700
- var path5 = paths[index], value = baseGet(object, path5);
1701
- if (predicate(value, path5)) {
1702
- baseSet(result2, castPath(path5, object), value);
1700
+ var path6 = paths[index], value = baseGet(object, path6);
1701
+ if (predicate(value, path6)) {
1702
+ baseSet(result2, castPath(path6, object), value);
1703
1703
  }
1704
1704
  }
1705
1705
  return result2;
1706
1706
  }
1707
- function basePropertyDeep(path5) {
1707
+ function basePropertyDeep(path6) {
1708
1708
  return function(object) {
1709
- return baseGet(object, path5);
1709
+ return baseGet(object, path6);
1710
1710
  };
1711
1711
  }
1712
1712
  function basePullAll(array, values2, iteratee2, comparator) {
@@ -1780,14 +1780,14 @@ var require_lodash = __commonJS({
1780
1780
  var array = values(collection);
1781
1781
  return shuffleSelf(array, baseClamp(n, 0, array.length));
1782
1782
  }
1783
- function baseSet(object, path5, value, customizer) {
1783
+ function baseSet(object, path6, value, customizer) {
1784
1784
  if (!isObject(object)) {
1785
1785
  return object;
1786
1786
  }
1787
- path5 = castPath(path5, object);
1788
- var index = -1, length = path5.length, lastIndex = length - 1, nested = object;
1787
+ path6 = castPath(path6, object);
1788
+ var index = -1, length = path6.length, lastIndex = length - 1, nested = object;
1789
1789
  while (nested != null && ++index < length) {
1790
- var key = toKey(path5[index]), newValue = value;
1790
+ var key = toKey(path6[index]), newValue = value;
1791
1791
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
1792
1792
  return object;
1793
1793
  }
@@ -1795,7 +1795,7 @@ var require_lodash = __commonJS({
1795
1795
  var objValue = nested[key];
1796
1796
  newValue = customizer ? customizer(objValue, key, nested) : undefined2;
1797
1797
  if (newValue === undefined2) {
1798
- newValue = isObject(objValue) ? objValue : isIndex(path5[index + 1]) ? [] : {};
1798
+ newValue = isObject(objValue) ? objValue : isIndex(path6[index + 1]) ? [] : {};
1799
1799
  }
1800
1800
  }
1801
1801
  assignValue(nested, key, newValue);
@@ -1961,33 +1961,33 @@ var require_lodash = __commonJS({
1961
1961
  }
1962
1962
  return result2;
1963
1963
  }
1964
- function baseUnset(object, path5) {
1965
- path5 = castPath(path5, object);
1966
- var index = -1, length = path5.length;
1964
+ function baseUnset(object, path6) {
1965
+ path6 = castPath(path6, object);
1966
+ var index = -1, length = path6.length;
1967
1967
  if (!length) {
1968
1968
  return true;
1969
1969
  }
1970
1970
  var isRootPrimitive = object == null || typeof object !== "object" && typeof object !== "function";
1971
1971
  while (++index < length) {
1972
- var key = path5[index];
1972
+ var key = path6[index];
1973
1973
  if (typeof key !== "string") {
1974
1974
  continue;
1975
1975
  }
1976
1976
  if (key === "__proto__" && !hasOwnProperty2.call(object, "__proto__")) {
1977
1977
  return false;
1978
1978
  }
1979
- if (key === "constructor" && index + 1 < length && typeof path5[index + 1] === "string" && path5[index + 1] === "prototype") {
1979
+ if (key === "constructor" && index + 1 < length && typeof path6[index + 1] === "string" && path6[index + 1] === "prototype") {
1980
1980
  if (isRootPrimitive && index === 0) {
1981
1981
  continue;
1982
1982
  }
1983
1983
  return false;
1984
1984
  }
1985
1985
  }
1986
- var obj = parent(object, path5);
1987
- return obj == null || delete obj[toKey(last(path5))];
1986
+ var obj = parent(object, path6);
1987
+ return obj == null || delete obj[toKey(last(path6))];
1988
1988
  }
1989
- function baseUpdate(object, path5, updater, customizer) {
1990
- return baseSet(object, path5, updater(baseGet(object, path5)), customizer);
1989
+ function baseUpdate(object, path6, updater, customizer) {
1990
+ return baseSet(object, path6, updater(baseGet(object, path6)), customizer);
1991
1991
  }
1992
1992
  function baseWhile(array, predicate, isDrop, fromRight) {
1993
1993
  var length = array.length, index = fromRight ? length : -1;
@@ -2870,11 +2870,11 @@ var require_lodash = __commonJS({
2870
2870
  var match = source.match(reWrapDetails);
2871
2871
  return match ? match[1].split(reSplitDetails) : [];
2872
2872
  }
2873
- function hasPath(object, path5, hasFunc) {
2874
- path5 = castPath(path5, object);
2875
- var index = -1, length = path5.length, result2 = false;
2873
+ function hasPath(object, path6, hasFunc) {
2874
+ path6 = castPath(path6, object);
2875
+ var index = -1, length = path6.length, result2 = false;
2876
2876
  while (++index < length) {
2877
- var key = toKey(path5[index]);
2877
+ var key = toKey(path6[index]);
2878
2878
  if (!(result2 = object != null && hasFunc(object, key))) {
2879
2879
  break;
2880
2880
  }
@@ -3076,8 +3076,8 @@ var require_lodash = __commonJS({
3076
3076
  return apply(func, this, otherArgs);
3077
3077
  };
3078
3078
  }
3079
- function parent(object, path5) {
3080
- return path5.length < 2 ? object : baseGet(object, baseSlice(path5, 0, -1));
3079
+ function parent(object, path6) {
3080
+ return path6.length < 2 ? object : baseGet(object, baseSlice(path6, 0, -1));
3081
3081
  }
3082
3082
  function reorder(array, indexes) {
3083
3083
  var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
@@ -3712,10 +3712,10 @@ var require_lodash = __commonJS({
3712
3712
  }
3713
3713
  return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
3714
3714
  }
3715
- var invokeMap = baseRest(function(collection, path5, args) {
3716
- var index = -1, isFunc = typeof path5 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
3715
+ var invokeMap = baseRest(function(collection, path6, args) {
3716
+ var index = -1, isFunc = typeof path6 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
3717
3717
  baseEach(collection, function(value) {
3718
- result2[++index] = isFunc ? apply(path5, value, args) : baseInvoke(value, path5, args);
3718
+ result2[++index] = isFunc ? apply(path6, value, args) : baseInvoke(value, path6, args);
3719
3719
  });
3720
3720
  return result2;
3721
3721
  });
@@ -4367,15 +4367,15 @@ var require_lodash = __commonJS({
4367
4367
  function functionsIn(object) {
4368
4368
  return object == null ? [] : baseFunctions(object, keysIn(object));
4369
4369
  }
4370
- function get(object, path5, defaultValue) {
4371
- var result2 = object == null ? undefined2 : baseGet(object, path5);
4370
+ function get(object, path6, defaultValue) {
4371
+ var result2 = object == null ? undefined2 : baseGet(object, path6);
4372
4372
  return result2 === undefined2 ? defaultValue : result2;
4373
4373
  }
4374
- function has(object, path5) {
4375
- return object != null && hasPath(object, path5, baseHas);
4374
+ function has(object, path6) {
4375
+ return object != null && hasPath(object, path6, baseHas);
4376
4376
  }
4377
- function hasIn(object, path5) {
4378
- return object != null && hasPath(object, path5, baseHasIn);
4377
+ function hasIn(object, path6) {
4378
+ return object != null && hasPath(object, path6, baseHasIn);
4379
4379
  }
4380
4380
  var invert = createInverter(function(result2, value, key) {
4381
4381
  if (value != null && typeof value.toString != "function") {
@@ -4428,10 +4428,10 @@ var require_lodash = __commonJS({
4428
4428
  return result2;
4429
4429
  }
4430
4430
  var isDeep = false;
4431
- paths = arrayMap(paths, function(path5) {
4432
- path5 = castPath(path5, object);
4433
- isDeep || (isDeep = path5.length > 1);
4434
- return path5;
4431
+ paths = arrayMap(paths, function(path6) {
4432
+ path6 = castPath(path6, object);
4433
+ isDeep || (isDeep = path6.length > 1);
4434
+ return path6;
4435
4435
  });
4436
4436
  copyObject(object, getAllKeysIn(object), result2);
4437
4437
  if (isDeep) {
@@ -4457,19 +4457,19 @@ var require_lodash = __commonJS({
4457
4457
  return [prop];
4458
4458
  });
4459
4459
  predicate = getIteratee(predicate);
4460
- return basePickBy(object, props, function(value, path5) {
4461
- return predicate(value, path5[0]);
4460
+ return basePickBy(object, props, function(value, path6) {
4461
+ return predicate(value, path6[0]);
4462
4462
  });
4463
4463
  }
4464
- function result(object, path5, defaultValue) {
4465
- path5 = castPath(path5, object);
4466
- var index = -1, length = path5.length;
4464
+ function result(object, path6, defaultValue) {
4465
+ path6 = castPath(path6, object);
4466
+ var index = -1, length = path6.length;
4467
4467
  if (!length) {
4468
4468
  length = 1;
4469
4469
  object = undefined2;
4470
4470
  }
4471
4471
  while (++index < length) {
4472
- var value = object == null ? undefined2 : object[toKey(path5[index])];
4472
+ var value = object == null ? undefined2 : object[toKey(path6[index])];
4473
4473
  if (value === undefined2) {
4474
4474
  index = length;
4475
4475
  value = defaultValue;
@@ -4478,12 +4478,12 @@ var require_lodash = __commonJS({
4478
4478
  }
4479
4479
  return object;
4480
4480
  }
4481
- function set(object, path5, value) {
4482
- return object == null ? object : baseSet(object, path5, value);
4481
+ function set(object, path6, value) {
4482
+ return object == null ? object : baseSet(object, path6, value);
4483
4483
  }
4484
- function setWith(object, path5, value, customizer) {
4484
+ function setWith(object, path6, value, customizer) {
4485
4485
  customizer = typeof customizer == "function" ? customizer : undefined2;
4486
- return object == null ? object : baseSet(object, path5, value, customizer);
4486
+ return object == null ? object : baseSet(object, path6, value, customizer);
4487
4487
  }
4488
4488
  var toPairs = createToPairs(keys);
4489
4489
  var toPairsIn = createToPairs(keysIn);
@@ -4505,15 +4505,15 @@ var require_lodash = __commonJS({
4505
4505
  });
4506
4506
  return accumulator;
4507
4507
  }
4508
- function unset(object, path5) {
4509
- return object == null ? true : baseUnset(object, path5);
4508
+ function unset(object, path6) {
4509
+ return object == null ? true : baseUnset(object, path6);
4510
4510
  }
4511
- function update(object, path5, updater) {
4512
- return object == null ? object : baseUpdate(object, path5, castFunction(updater));
4511
+ function update(object, path6, updater) {
4512
+ return object == null ? object : baseUpdate(object, path6, castFunction(updater));
4513
4513
  }
4514
- function updateWith(object, path5, updater, customizer) {
4514
+ function updateWith(object, path6, updater, customizer) {
4515
4515
  customizer = typeof customizer == "function" ? customizer : undefined2;
4516
- return object == null ? object : baseUpdate(object, path5, castFunction(updater), customizer);
4516
+ return object == null ? object : baseUpdate(object, path6, castFunction(updater), customizer);
4517
4517
  }
4518
4518
  function values(object) {
4519
4519
  return object == null ? [] : baseValues(object, keys(object));
@@ -4894,17 +4894,17 @@ var require_lodash = __commonJS({
4894
4894
  function matches(source) {
4895
4895
  return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
4896
4896
  }
4897
- function matchesProperty(path5, srcValue) {
4898
- return baseMatchesProperty(path5, baseClone(srcValue, CLONE_DEEP_FLAG));
4897
+ function matchesProperty(path6, srcValue) {
4898
+ return baseMatchesProperty(path6, baseClone(srcValue, CLONE_DEEP_FLAG));
4899
4899
  }
4900
- var method = baseRest(function(path5, args) {
4900
+ var method = baseRest(function(path6, args) {
4901
4901
  return function(object) {
4902
- return baseInvoke(object, path5, args);
4902
+ return baseInvoke(object, path6, args);
4903
4903
  };
4904
4904
  });
4905
4905
  var methodOf = baseRest(function(object, args) {
4906
- return function(path5) {
4907
- return baseInvoke(object, path5, args);
4906
+ return function(path6) {
4907
+ return baseInvoke(object, path6, args);
4908
4908
  };
4909
4909
  });
4910
4910
  function mixin(object, source, options) {
@@ -4951,12 +4951,12 @@ var require_lodash = __commonJS({
4951
4951
  var over = createOver(arrayMap);
4952
4952
  var overEvery = createOver(arrayEvery);
4953
4953
  var overSome = createOver(arraySome);
4954
- function property(path5) {
4955
- return isKey(path5) ? baseProperty(toKey(path5)) : basePropertyDeep(path5);
4954
+ function property(path6) {
4955
+ return isKey(path6) ? baseProperty(toKey(path6)) : basePropertyDeep(path6);
4956
4956
  }
4957
4957
  function propertyOf(object) {
4958
- return function(path5) {
4959
- return object == null ? undefined2 : baseGet(object, path5);
4958
+ return function(path6) {
4959
+ return object == null ? undefined2 : baseGet(object, path6);
4960
4960
  };
4961
4961
  }
4962
4962
  var range = createRange();
@@ -5409,12 +5409,12 @@ var require_lodash = __commonJS({
5409
5409
  LazyWrapper.prototype.findLast = function(predicate) {
5410
5410
  return this.reverse().find(predicate);
5411
5411
  };
5412
- LazyWrapper.prototype.invokeMap = baseRest(function(path5, args) {
5413
- if (typeof path5 == "function") {
5412
+ LazyWrapper.prototype.invokeMap = baseRest(function(path6, args) {
5413
+ if (typeof path6 == "function") {
5414
5414
  return new LazyWrapper(this);
5415
5415
  }
5416
5416
  return this.map(function(value) {
5417
- return baseInvoke(value, path5, args);
5417
+ return baseInvoke(value, path6, args);
5418
5418
  });
5419
5419
  });
5420
5420
  LazyWrapper.prototype.reject = function(predicate) {
@@ -5535,6 +5535,7 @@ var index_exports = {};
5535
5535
  __export(index_exports, {
5536
5536
  asciiOutputPlugin: () => asciiOutputPlugin,
5537
5537
  extensionDependenciesCheck: () => extensionDependenciesCheck,
5538
+ extensionPublishCheck: () => extensionPublishCheck,
5538
5539
  globImportPlugin: () => globImportPlugin,
5539
5540
  packageBuild: () => packageBuild,
5540
5541
  stylesheetPlugin: () => stylesheetPlugin
@@ -11296,17 +11297,17 @@ var isEscapedByBackslash = (code, position) => {
11296
11297
  }
11297
11298
  return backslashes % 2 === 1;
11298
11299
  };
11299
- var shiftColumnsOfSourceMapFile = async (path5, columnShifts) => {
11300
+ var shiftColumnsOfSourceMapFile = async (path6, columnShifts) => {
11300
11301
  let sourceMap;
11301
11302
  try {
11302
- sourceMap = await (0, import_promises.readFile)(path5);
11303
+ sourceMap = await (0, import_promises.readFile)(path6);
11303
11304
  } catch (error) {
11304
11305
  if (error.code === "ENOENT") {
11305
11306
  return;
11306
11307
  }
11307
11308
  throw error;
11308
11309
  }
11309
- await (0, import_promises.writeFile)(path5, shiftColumnsOfSourceMap(sourceMap, columnShifts));
11310
+ await (0, import_promises.writeFile)(path6, shiftColumnsOfSourceMap(sourceMap, columnShifts));
11310
11311
  };
11311
11312
  var shiftColumnsOfLine = (line, shifts) => {
11312
11313
  if (line === "") {
@@ -11368,24 +11369,24 @@ var globImportPlugin = () => ({
11368
11369
  setup: (build2) => {
11369
11370
  const uniquenessCache = /* @__PURE__ */ new Map();
11370
11371
  build2.onResolve({ filter: /\*/ }, async (args) => {
11371
- const { resolveDir, path: path5 } = args;
11372
+ const { resolveDir, path: path6 } = args;
11372
11373
  if (resolveDir === "") {
11373
11374
  return;
11374
11375
  }
11375
- const cacheKey = (0, import_node_path.resolve)(resolveDir, path5);
11376
+ const cacheKey = (0, import_node_path.resolve)(resolveDir, path6);
11376
11377
  const uniqueId = getOrInsertWith(uniquenessCache, cacheKey, getRandomUniqueId);
11377
11378
  return {
11378
- path: `${path5}/proof-of-uniqueness/${uniqueId}`,
11379
+ path: `${path6}/proof-of-uniqueness/${uniqueId}`,
11379
11380
  namespace: "import-glob",
11380
11381
  pluginData: { resolveDir }
11381
11382
  };
11382
11383
  });
11383
11384
  build2.onLoad({ filter: /.*/, namespace: "import-glob" }, async (args) => {
11384
11385
  const {
11385
- path: path5,
11386
+ path: path6,
11386
11387
  pluginData: { resolveDir }
11387
11388
  } = args;
11388
- const [globImportString] = path5.split("/proof-of-uniqueness/");
11389
+ const [globImportString] = path6.split("/proof-of-uniqueness/");
11389
11390
  const files = (await (0, import_fast_glob.default)(globImportString, { cwd: resolveDir })).sort();
11390
11391
  const contents = [
11391
11392
  files.map((module2, index) => `import * as module${index} from './${module2}'`).join(";"),
@@ -11812,9 +11813,16 @@ var checkExtensionDependencies = ({
11812
11813
  packageJsonPath,
11813
11814
  versionsFilePath,
11814
11815
  fix,
11815
- log
11816
+ log,
11817
+ requireVersions = false
11816
11818
  }) => {
11817
11819
  const versions = readVersions(versionsFilePath);
11820
+ if (!versions && requireVersions) {
11821
+ log(
11822
+ `Cannot check the dependency ranges against Lens: no "${versionsFilePath}", which Lens writes when it runs on this machine. Start Lens once, or name the versions of another Lens in ${extensionDependencyVersionsFileEnvironmentVariable}.`
11823
+ );
11824
+ return 1;
11825
+ }
11818
11826
  if (!versions) {
11819
11827
  log(
11820
11828
  `Skipped checking dependency ranges against Lens: no "${versionsFilePath}", which Lens writes when it runs on this machine.`
@@ -11866,6 +11874,101 @@ var extensionDependenciesCheck = () => checkExtensionDependencies({
11866
11874
  fix: process.argv.slice(2).includes("--fix"),
11867
11875
  log: (line) => console.log(line)
11868
11876
  });
11877
+
11878
+ // src/extension-publish-check.ts
11879
+ var import_node_child_process = require("node:child_process");
11880
+ var import_node_fs4 = require("node:fs");
11881
+ var import_node_path6 = __toESM(require("node:path"));
11882
+ var import_semver2 = __toESM(require("semver"));
11883
+ var prereleaseDistTag = "next";
11884
+ var relativeEntrypointOf = (packageJson2) => {
11885
+ const { exports, main } = packageJson2;
11886
+ if (exports === void 0 || exports === null) {
11887
+ return typeof main === "string" ? main : void 0;
11888
+ }
11889
+ if (typeof exports === "string") {
11890
+ return exports;
11891
+ }
11892
+ const defaultInExports = exports["."];
11893
+ if (typeof defaultInExports === "string") {
11894
+ return defaultInExports;
11895
+ }
11896
+ if (typeof defaultInExports === "object" && defaultInExports !== null) {
11897
+ const conditions = defaultInExports;
11898
+ const conditional = conditions.default ?? conditions.require;
11899
+ if (typeof conditional === "string") {
11900
+ return conditional;
11901
+ }
11902
+ }
11903
+ return typeof main === "string" ? main : void 0;
11904
+ };
11905
+ var normalized = (relativePath) => relativePath.replaceAll("\\", "/").split("/").filter((segment) => segment !== "" && segment !== ".").join("/");
11906
+ var checkEntrypointIsPacked = (packageJson2, packedFiles) => {
11907
+ const entrypoint = relativeEntrypointOf(packageJson2);
11908
+ if (entrypoint === void 0) {
11909
+ return 'package.json names no entrypoint: set "main" to the built file Lens loads, such as "./dist/index.js".';
11910
+ }
11911
+ if (!packedFiles().map(normalized).includes(normalized(entrypoint))) {
11912
+ return `npm would publish the extension without its entrypoint "${entrypoint}", and Lens could not install it. Build first, and list the built directory in "files" of package.json, such as "files": ["dist"].`;
11913
+ }
11914
+ return void 0;
11915
+ };
11916
+ var checkPrereleaseIsTagged = (version2, distTag) => {
11917
+ const isPrerelease = typeof version2 === "string" && (import_semver2.default.prerelease(version2) ?? []).length > 0;
11918
+ if (!isPrerelease || distTag !== void 0 && distTag !== "latest") {
11919
+ return void 0;
11920
+ }
11921
+ return `${version2} is a prerelease, which would become the version users see and install by default. Publish it with "--tag ${prereleaseDistTag}", or raise "version" in package.json to a release.`;
11922
+ };
11923
+ var checkExtensionPublishing = ({
11924
+ packageJsonPath,
11925
+ versionsFilePath,
11926
+ packedFiles,
11927
+ distTag,
11928
+ log
11929
+ }) => {
11930
+ const packageJson2 = JSON.parse((0, import_node_fs4.readFileSync)(packageJsonPath, "utf-8"));
11931
+ const problems = [
11932
+ checkEntrypointIsPacked(packageJson2, packedFiles),
11933
+ checkPrereleaseIsTagged(packageJson2.version, distTag)
11934
+ ].filter((problem) => problem !== void 0);
11935
+ const dependenciesExitCode = checkExtensionDependencies({
11936
+ packageJsonPath,
11937
+ versionsFilePath,
11938
+ fix: false,
11939
+ log,
11940
+ requireVersions: true
11941
+ });
11942
+ for (const problem of problems) {
11943
+ log(problem);
11944
+ }
11945
+ if (problems.length > 0 || dependenciesExitCode !== 0) {
11946
+ log("Not publishing: fix the above, and publish again.");
11947
+ return 1;
11948
+ }
11949
+ return 0;
11950
+ };
11951
+ var packedFilesOf = (output) => {
11952
+ const listingStart = output.indexOf("[");
11953
+ if (listingStart === -1) {
11954
+ return [];
11955
+ }
11956
+ const [packed] = JSON.parse(output.slice(listingStart));
11957
+ return packed?.files?.map((file) => file.path) ?? [];
11958
+ };
11959
+ var extensionPublishCheck = ({ directory, environment, runCommand, log } = {
11960
+ directory: process.cwd(),
11961
+ environment: process.env,
11962
+ runCommand: (command, cwd) => (0, import_node_child_process.execSync)(command, { cwd, encoding: "utf-8" }),
11963
+ log: (line) => console.log(line)
11964
+ }) => checkExtensionPublishing({
11965
+ packageJsonPath: import_node_path6.default.resolve(directory, "package.json"),
11966
+ versionsFilePath: environment[extensionDependencyVersionsFileEnvironmentVariable] || defaultVersionsFilePath(),
11967
+ packedFiles: () => packedFilesOf(runCommand("npm pack --dry-run --json --ignore-scripts", directory)),
11968
+ // What npm tells the scripts it runs of `npm publish --tag <tag>`.
11969
+ distTag: environment.npm_config_tag || void 0,
11970
+ log
11971
+ });
11869
11972
  /*! Bundled license information:
11870
11973
 
11871
11974
  lodash/lodash.js:
@@ -1,10 +1,13 @@
1
1
  /** Overrides where the check reads the versions Lens serves, e.g. to check against another Lens than the one on this machine. */
2
2
  export declare const extensionDependencyVersionsFileEnvironmentVariable = "LENS_EXTENSION_DEPENDENCY_VERSIONS_FILE";
3
+ export declare const defaultVersionsFilePath: () => string;
3
4
  export interface CheckExtensionDependenciesParams {
4
5
  readonly packageJsonPath: string;
5
6
  readonly versionsFilePath: string;
6
7
  readonly fix: boolean;
7
8
  readonly log: (line: string) => void;
9
+ /** Fails, instead of passing, when Lens has written no versions to check against: what publishing needs. */
10
+ readonly requireVersions?: boolean;
8
11
  }
9
12
  /**
10
13
  * Checks the ranges an extension's package.json declares for the packages Lens serves to
@@ -13,9 +16,9 @@ export interface CheckExtensionDependenciesParams {
13
16
  * fails the check; one in `devDependencies` only warns, as Lens never reads those. With `fix`,
14
17
  * rewrites every such range, in all three, to the caret range of the version Lens serves.
15
18
  *
16
- * @returns the exit code: 0 when Lens would load the extension, or when there is nothing to check against.
19
+ * @returns the exit code: 0 when Lens would load the extension, or when there is nothing to check against and `requireVersions` is not set.
17
20
  */
18
- export declare const checkExtensionDependencies: ({ packageJsonPath, versionsFilePath, fix, log, }: CheckExtensionDependenciesParams) => number;
21
+ export declare const checkExtensionDependencies: ({ packageJsonPath, versionsFilePath, fix, log, requireVersions, }: CheckExtensionDependenciesParams) => number;
19
22
  /** The `lens-extension-dependencies-check [--fix]` command, run in the extension's directory. */
20
23
  export declare const extensionDependenciesCheck: () => number;
21
24
  //# sourceMappingURL=extension-dependencies-check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-dependencies-check.d.ts","sourceRoot":"","sources":["../../src/extension-dependencies-check.ts"],"names":[],"mappings":"AAKA,iIAAiI;AACjI,eAAO,MAAM,kDAAkD,4CAA4C,CAAC;AAoB5G,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAyCD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,qDAKpC,gCAAgC,KAAG,MA8DrC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,QAAO,MAM1C,CAAC"}
1
+ {"version":3,"file":"extension-dependencies-check.d.ts","sourceRoot":"","sources":["../../src/extension-dependencies-check.ts"],"names":[],"mappings":"AAKA,iIAAiI;AACjI,eAAO,MAAM,kDAAkD,4CAA4C,CAAC;AAK5G,eAAO,MAAM,uBAAuB,cAOjC,CAAC;AAQJ,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,4GAA4G;IAC5G,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAyCD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,sEAMpC,gCAAgC,KAAG,MAsErC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,0BAA0B,QAAO,MAM1C,CAAC"}
@@ -0,0 +1,42 @@
1
+ /** The dist-tag a prerelease is published under, so it never becomes the version users install by default. */
2
+ export declare const prereleaseDistTag = "next";
3
+ export interface CheckExtensionPublishingParams {
4
+ readonly packageJsonPath: string;
5
+ readonly versionsFilePath: string;
6
+ /** The paths npm would pack, relative to the extension's directory, as `npm pack --dry-run` lists them. */
7
+ readonly packedFiles: () => readonly string[];
8
+ /** The dist-tag npm is publishing under, when one was given. */
9
+ readonly distTag: string | undefined;
10
+ readonly log: (line: string) => void;
11
+ }
12
+ /**
13
+ * Checks an extension is fit to publish, before npm publishes it: that what npm packs has the
14
+ * entrypoint Lens loads, that Lens would accept every range the extension declares for a package
15
+ * Lens serves, and that a prerelease is not published as the latest version. Fails when Lens has
16
+ * written no versions to check the ranges against, as publishing unchecked is how an extension
17
+ * reaches users that no Lens loads.
18
+ *
19
+ * @returns the exit code: 0 when the extension is fit to publish.
20
+ */
21
+ export declare const checkExtensionPublishing: ({ packageJsonPath, versionsFilePath, packedFiles, distTag, log, }: CheckExtensionPublishingParams) => number;
22
+ /**
23
+ * The paths `npm pack --dry-run --json` says it would pack, from what it printed: one entry per
24
+ * package packed, listing its files, after whatever lines npm writes before it. None when npm
25
+ * printed no listing.
26
+ */
27
+ export declare const packedFilesOf: (output: string) => string[];
28
+ export interface ExtensionPublishCheckParams {
29
+ /** The extension's directory, where npm runs its scripts. */
30
+ readonly directory: string;
31
+ /** The environment npm runs the script in. */
32
+ readonly environment: Readonly<Record<string, string | undefined>>;
33
+ /** Runs a command in a directory, giving back what it printed. */
34
+ readonly runCommand: (command: string, directory: string) => string;
35
+ readonly log: (line: string) => void;
36
+ }
37
+ /**
38
+ * The `lens-extension-publish-check` command, run in the extension's directory, as its
39
+ * `prepublishOnly` script: npm runs it before every publish, and gives up publishing when it fails.
40
+ */
41
+ export declare const extensionPublishCheck: ({ directory, environment, runCommand, log }?: ExtensionPublishCheckParams) => number;
42
+ //# sourceMappingURL=extension-publish-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-publish-check.d.ts","sourceRoot":"","sources":["../../src/extension-publish-check.ts"],"names":[],"mappings":"AAUA,8GAA8G;AAC9G,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,2GAA2G;IAC3G,QAAQ,CAAC,WAAW,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAiED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,sEAMlC,8BAA8B,KAAG,MA2BnC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MAAM,EAUpD,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnE,kEAAkE;IAClE,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACpE,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,iDACa,2BAA2B,KAMvE,MAQC,CAAC"}