@firestartr/cli 2.10.0-snapshot-fix-renderer-nondeterminism-3 → 2.10.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.
package/build/index.js CHANGED
@@ -324835,6 +324835,15 @@ var ajv_default = /*#__PURE__*/__nccwpck_require__.n(dist_ajv);
324835
324835
  },
324836
324836
  },
324837
324837
  },
324838
+ meta: {
324839
+ type: 'object',
324840
+ additionalProperties: false,
324841
+ properties: {
324842
+ allow_non_anchored_paths: {
324843
+ type: 'boolean',
324844
+ },
324845
+ },
324846
+ },
324838
324847
  },
324839
324848
  required: ['args', 'feature_name', 'files', 'patches'],
324840
324849
  title: 'root',
@@ -324958,12 +324967,23 @@ function __validateFeatureConfigData(configData) {
324958
324967
  const ajv = new (ajv_default())({
324959
324968
  allowUnionTypes: true,
324960
324969
  });
324961
- const validate = ajv.compile(src_schema);
324970
+ const allowNonAnchoredPaths = configData.meta?.allow_non_anchored_paths === true;
324971
+ const activeSchema = allowNonAnchoredPaths
324972
+ ? stripAnchoringConstraints(src_schema)
324973
+ : src_schema;
324974
+ const validate = ajv.compile(activeSchema);
324962
324975
  const valid = validate(configData);
324963
324976
  if (!valid) {
324964
324977
  throw `Feature: config.yaml invalid ${JSON.stringify(validate.errors)}`;
324965
324978
  }
324966
324979
  }
324980
+ function stripAnchoringConstraints(schemaDef) {
324981
+ const clone = JSON.parse(JSON.stringify(schemaDef));
324982
+ delete clone.definitions.File.properties.src.not;
324983
+ delete clone.definitions.File.properties.dest.not;
324984
+ delete clone.definitions.root.properties.filesTemplates.items.not;
324985
+ return clone;
324986
+ }
324967
324987
  function __validateJsonPatches(configData) {
324968
324988
  const keys = Object.keys(configData.patches);
324969
324989
  for (const key of keys) {
@@ -325799,12 +325819,19 @@ function render(featurePath, featureRenderPath, entity, firestartrConfig = {}, f
325799
325819
  if ('filesTemplates' in context.config) {
325800
325820
  expandFiles(featurePath, configData, context);
325801
325821
  }
325822
+ const allowNonAnchoredPaths = allowsNonAnchoredPaths(configData);
325802
325823
  for (const file of context.config.files) {
325803
325824
  const { src, dest } = file;
325804
- assertSafeRelativePath(src, 'file src');
325805
- assertSafeRelativePath(dest, 'file dest');
325806
- resolveInside(featurePath, external_path_default().join('templates', src), 'file src', 'feature directory');
325807
- resolveInside(featureRenderPath, dest, 'file dest', 'render target directory');
325825
+ if (allowNonAnchoredPaths) {
325826
+ assertNonEmptyString(src, 'file src');
325827
+ assertNonEmptyString(dest, 'file dest');
325828
+ }
325829
+ else {
325830
+ assertSafeRelativePath(src, 'file src');
325831
+ assertSafeRelativePath(dest, 'file dest');
325832
+ resolveInside(featurePath, external_path_default().join('templates', src), 'file src', 'feature directory');
325833
+ resolveInside(featureRenderPath, dest, 'file dest', 'render target directory');
325834
+ }
325808
325835
  }
325809
325836
  const output = { files: [] };
325810
325837
  context.config.files.forEach((file) => {
@@ -325883,14 +325910,17 @@ function buildTemplateArgs(args, context) {
325883
325910
  }
325884
325911
  function expandFiles(featurePath, configData, context) {
325885
325912
  let files = [];
325913
+ const allowNonAnchoredPaths = allowsNonAnchoredPaths(configData);
325886
325914
  for (const tpl of configData.filesTemplates) {
325887
- const addToFiles = expandFilesTemplate(featurePath, tpl, context);
325915
+ const addToFiles = expandFilesTemplate(featurePath, tpl, context, allowNonAnchoredPaths);
325888
325916
  files = files.concat(addToFiles).flat(Infinity);
325889
325917
  }
325890
325918
  context.config.files = context.config.files.concat(files).flat(Infinity);
325891
325919
  }
325892
- function expandFilesTemplate(featurePath, tplPath, context) {
325893
- const templatePath = resolveInside(featurePath, tplPath, 'filesTemplates entry', 'feature directory');
325920
+ function expandFilesTemplate(featurePath, tplPath, context, allowNonAnchoredPaths) {
325921
+ const templatePath = allowNonAnchoredPaths
325922
+ ? external_path_default().resolve(featurePath, tplPath)
325923
+ : resolveInside(featurePath, tplPath, 'filesTemplates entry', 'feature directory');
325894
325924
  src_logger.debug(`Expanding files section with template located at ${templatePath}`);
325895
325925
  let template;
325896
325926
  try {
@@ -325959,6 +325989,9 @@ function resolveInside(basePath, candidate, what, baseLabel) {
325959
325989
  }
325960
325990
  return target;
325961
325991
  }
325992
+ function allowsNonAnchoredPaths(configData) {
325993
+ return configData?.meta?.allow_non_anchored_paths === true;
325994
+ }
325962
325995
 
325963
325996
  // EXTERNAL MODULE: external "node:fs"
325964
325997
  var external_node_fs_ = __nccwpck_require__(87561);
@@ -524900,9 +524933,9 @@ const crsStatusSubcommand = {
524900
524933
  };
524901
524934
 
524902
524935
  ;// CONCATENATED MODULE: ./package.json
524903
- const package_namespaceObject = JSON.parse('{"i8":"2.10.0-snapshot-fix-renderer-nondeterminism-3"}');
524936
+ const package_namespaceObject = {"i8":"2.10.0"};
524904
524937
  ;// CONCATENATED MODULE: ../../package.json
524905
- const package_namespaceObject_1 = {"i8":"2.9.0"};
524938
+ const package_namespaceObject_1 = {"i8":"2.10.0"};
524906
524939
  // EXTERNAL MODULE: ../../node_modules/semver/index.js
524907
524940
  var semver = __nccwpck_require__(77546);
524908
524941
  var semver_default = /*#__PURE__*/__nccwpck_require__.n(semver);
@@ -5,3 +5,4 @@ export declare function renderContent(template: string, ctx: any): any;
5
5
  export declare function assertNonEmptyString(value: unknown, what: string): asserts value is string;
6
6
  export declare function assertSafeRelativePath(candidate: unknown, what: string): void;
7
7
  export declare function resolveInside(basePath: string, candidate: string, what: string, baseLabel: string): string;
8
+ export declare function allowsNonAnchoredPaths(configData: any): boolean;
@@ -39,6 +39,15 @@ declare const _default: {
39
39
  };
40
40
  };
41
41
  };
42
+ meta: {
43
+ type: string;
44
+ additionalProperties: boolean;
45
+ properties: {
46
+ allow_non_anchored_paths: {
47
+ type: string;
48
+ };
49
+ };
50
+ };
42
51
  };
43
52
  required: string[];
44
53
  title: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestartr/cli",
3
- "version": "2.10.0-snapshot-fix-renderer-nondeterminism-3",
3
+ "version": "2.10.0",
4
4
  "private": false,
5
5
  "description": "Commandline tool",
6
6
  "main": "build/main.js",