permachine 0.3.0 → 0.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.
Files changed (2) hide show
  1. package/dist/cli.js +8 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5845,9 +5845,12 @@ function createCustomContext(overrides) {
5845
5845
  return { ...base, ...overrides };
5846
5846
  }
5847
5847
  var FILTER_REGEX = /\{([a-zA-Z0-9_-]+)(=|!=|~|\^)([a-zA-Z0-9_*.,\-]+)\}/g;
5848
+ var BASE_PLACEHOLDER_REGEX = /\{base\}/gi;
5848
5849
  function parseFilters(filename) {
5849
5850
  const filters = [];
5850
5851
  let match2;
5852
+ BASE_PLACEHOLDER_REGEX.lastIndex = 0;
5853
+ const hasBasePlaceholder = BASE_PLACEHOLDER_REGEX.test(filename);
5851
5854
  FILTER_REGEX.lastIndex = 0;
5852
5855
  while ((match2 = FILTER_REGEX.exec(filename)) !== null) {
5853
5856
  const [raw, key, operator, value] = match2;
@@ -5860,11 +5863,14 @@ function parseFilters(filename) {
5860
5863
  }
5861
5864
  let baseFilename = filename.replace(/\.?\{[^}]+\}/g, "");
5862
5865
  baseFilename = baseFilename.replace(/\.{2,}/g, ".");
5863
- return { filters, baseFilename };
5866
+ return { filters, baseFilename, hasBasePlaceholder };
5864
5867
  }
5865
5868
  function hasFilters(filename) {
5866
5869
  FILTER_REGEX.lastIndex = 0;
5867
- return FILTER_REGEX.test(filename);
5870
+ const hasFilterSyntax = FILTER_REGEX.test(filename);
5871
+ BASE_PLACEHOLDER_REGEX.lastIndex = 0;
5872
+ const hasBasePlaceholder = BASE_PLACEHOLDER_REGEX.test(filename);
5873
+ return hasFilterSyntax || hasBasePlaceholder;
5868
5874
  }
5869
5875
  function evaluateFilter(filter2, context) {
5870
5876
  const contextValue = context[filter2.key];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "permachine",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Automatically merge machine-specific config files with base configs using git hooks",
5
5
  "type": "module",
6
6
  "bin": {